Skip to content

Commit bde15e9

Browse files
kv2019iCommit Bot
authored andcommitted
FROMGIT: ASoC: SOF: Intel: hda: release display power at link_power
The i915 display power is requested both by controller (for init and link reset) as well as by codec driver (for codec control). There's an additional constraint that on some platforms frequent changes to display power state may cause visible flicker. To avoid this, the SOF hda controller requests display power whenever it is active and only releases it when runtime suspended. This patch utilizes the new hdac_bus link_power op to plug into HDA link state changes. By monitoring link state changes, we can keep the controller side display power wakeref until the codec driver has completed its work, and only release the wakeref when codec driver is suspended. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Chintan Patel <chintan.m.patel@intel.com> (cherry picked from commit c99fafd https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next) BUG=b:176942010 TEST=Enabling Google Assistant meets Power KPI Change-Id: I7ceb6c44653c99725fdea251c2858c07680c0707 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2679471 Reviewed-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Curtis Malainey <cujomalainey@chromium.org> Tested-by: Jairaj Arava <jairaj.arava@intel.corp-partner.google.com> Commit-Queue: Curtis Malainey <cujomalainey@chromium.org>
1 parent 5ee1197 commit bde15e9

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

sound/soc/sof/intel/hda-bus.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/io.h>
1111
#include <sound/hdaudio.h>
12+
#include <sound/hda_i915.h>
1213
#include "../sof-priv.h"
1314
#include "hda.h"
1415

@@ -20,10 +21,32 @@
2021
#endif
2122

2223
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
24+
static void sof_hda_bus_link_power(struct hdac_device *codec, bool enable)
25+
{
26+
struct hdac_bus *bus = codec->bus;
27+
bool oldstate = test_bit(codec->addr, &bus->codec_powered);
28+
29+
snd_hdac_ext_bus_link_power(codec, enable);
30+
31+
if (enable == oldstate)
32+
return;
33+
34+
/*
35+
* Both codec driver and controller can hold references to
36+
* display power. To avoid unnecessary power-up/down cycles,
37+
* controller doesn't immediately release its reference.
38+
*
39+
* If the codec driver powers down the link, release
40+
* the controller reference as well.
41+
*/
42+
if (codec->addr == HDA_IDISP_ADDR && !enable)
43+
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
44+
}
45+
2346
static const struct hdac_bus_ops bus_core_ops = {
2447
.command = snd_hdac_bus_send_cmd,
2548
.get_response = snd_hdac_bus_get_response,
26-
.link_power = snd_hdac_ext_bus_link_power,
49+
.link_power = sof_hda_bus_link_power,
2750
};
2851
#endif
2952

sound/soc/sof/intel/hda.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@
388388
#define SSP_SET_SFRM_SLAVE BIT(24)
389389
#define SSP_SET_SLAVE (SSP_SET_SCLK_SLAVE | SSP_SET_SFRM_SLAVE)
390390

391-
#define HDA_IDISP_CODEC(x) ((x) & BIT(2))
391+
#define HDA_IDISP_ADDR 2
392+
#define HDA_IDISP_CODEC(x) ((x) & BIT(HDA_IDISP_ADDR))
392393

393394
struct sof_intel_dsp_bdl {
394395
__le32 addr_l;

0 commit comments

Comments
 (0)