Skip to content

Update changes of snd_hdac_display_power() from upstream - #455

Merged
plbossart merged 9 commits into
thesofproject:topic/sof-devfrom
bardliao:hdmi
Dec 18, 2018
Merged

plbossart merged 9 commits into
thesofproject:topic/sof-devfrom
bardliao:hdmi

Conversation

@bardliao

@bardliao bardliao commented Dec 17, 2018 •

Copy link
Copy Markdown
Collaborator

This PR include Takashi's snd_hdac_display_power() related patches and the necessary changes on SOF side.

Fix #400

@ranj063

ranj063 commented Dec 17, 2018

Copy link
Copy Markdown
Collaborator

@bardliao I presume u have tested this to confirm that suspend/resume works with HDMI playback on glk?

@bardliao

Copy link
Copy Markdown
Collaborator Author

@ranj063 I tested it on up2. HDMI playback works fine after suspend/resume. But we will see underrun and ipc timed out after resume if we suspend during HDMI playback. This issue also happens without the PR.

@ranj063

ranj063 commented Dec 17, 2018

Copy link
Copy Markdown
Collaborator

@ranj063 I tested it on up2. HDMI playback works fine after suspend/resume. But we will see underrun and ipc timed out after resume if we suspend during HDMI playback. This issue also happens without the PR.

How about glk?

@bardliao

Copy link
Copy Markdown
Collaborator Author

@ranj063 I don't have glk at hand. I think we can test it once Chrome team decide to cherry-pick Takashi's patch to their code base.

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also want to change the exit, the comment below does not apply any longer

/*
 	 * we don't need to decrease the refcount with
 	 * hda_codec_i915_put() on exit since the device cannot be
 	 *  active
 	 */

tiwai and others added 9 commits December 18, 2018 00:43
Make unified suspend / resume helpers and call them from both the
runtime- and the system-PM callbacks for simplifying code.

There are slight changes of call orders, but there shouldn't be any
functional difference after refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 3baffc4)
The current HD-audio code manages the DRM audio power via too complex
redirections, and this seems even still unbalanced in a corner case as
Intel DRM CI has been intermittently reporting.  This patch is a big
surgery for addressing the complexity and the possible unbalance.

Basically the patch changes the display PM in the following ways:

- Both HD-audio controller and codec drivers call a single helper,
  snd_hdac_display_power().  (Formerly, the display power control from
  a codec was done indirectly via link_power bus ops.)

- snd_hdac_display_power() receives the codec address index.  For
  turning on/off from the controller, pass HDA_CODEC_IDX_CONTROLLER.

- snd_hdac_display_power() doesn't manage refcounts any longer, but
  keeps the power status in bitmap.  If any of controller or codecs is
  turned on, the function updates the DRM power state via get_power()
  or put_power().

Also this refactor allows us more cleanup:

- The link_power bus ops is dropped, so there is no longer indirect
  management, as mentioned in the above.

- hdac_device link_power_control flag is moved to hda_codec
  display_power_control flag, as it's only for HDA legacy.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106525
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 029d92c)
snd_hdac_display_power() can be called even for a HDA controller
without DRM binding.  The same is true for other helpers,
snd_hdac_i915_set_bclk() and snd_hdac_set_codec_wakeup().
So all superfluous AZX_DCAPS_I915_POWERWELL  checks in hda_intel.c can
be dropped, and the definition of AZX_DCAPS_I915_POWERWELL itself can
be removed as well.  This simplifies the code a lot.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit e454ff8)
When an error occurs in azx_probe_continue(), we should release the
display power.  However, the current code ignores it and releases the
display power only for HSW/BDW cases.  Fix it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 457f3c8)
After the recent refactoring, snd_hdac_display_power() doesn't return
any error, hence it can be defined to return void.
This makes many error checks redundant and allows us to reduce them
gracefully.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 4f799e7)
The display power is in unbalance at removing the driver since it
misses the snd_hdac_display_power(OFF) call.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 77a4967)
We've excluded the display_power_control flag for Intel HSW and BDW
codecs as the HD-audio controllers of the corresponding platforms take
care of the display power as well.  But the recent refactoring
separates the controller and the codec power accounting, so it's fine
to call the display PM even for HSW/BDW codecs.  This is less
confusing since we can avoid this well-hidden condition.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 46594d3)
The prototype of snd_hdac_display_power() has changed.
pass HDA_CODEC_IDX_CONTROLLER since i915 is controller.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
snd_hdac_display_power() is already a void function therefore we
don't need to return any value from hda_codec_i915_get() nor
hda_codec_i915_put().

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
@bardliao

Copy link
Copy Markdown
Collaborator Author

@plbossart Thanks. The comment is removed.

@plbossart

Copy link
Copy Markdown
Member

@plbossart Thanks. The comment is removed.

Ah sorry, I didn't mean to remove the comment only, but also add a display_power(false) as done by the skylake driver.

@bardliao

Copy link
Copy Markdown
Collaborator Author

@plbossart Sorry I misunderstood your comment. Probably it is not necessary to add a display_power(false) in hda_codec_i915_exit() since we call hda_codec_i915_put() after hda_codec_i915_init() in hda_init_caps(). But it is harmless and looks better if we add it in _exit().
We use hda_codec_i915_get() in snd_hdac_i915_init() so, I added hda_codec_i915_put() in hda_codec_i915_exit().
BTW, I see display_power(false) in azx_free() (hda/hda_intel.c) but didn't see a similar function in skl_free() (skylake/skl.c). Am I missing something?

@plbossart
plbossart merged commit a991c2d into thesofproject:topic/sof-dev Dec 18, 2018
@plbossart

plbossart commented Dec 18, 2018 •

Copy link
Copy Markdown
Member

@bardliao this routine wasn't part of the original skylake but maybe it's missing. Do you want to ask Takashi if this is intentional or a miss due to search/replace?

@bardliao

Copy link
Copy Markdown
Collaborator Author

@plbossart According to Takashi's reply, I think it is missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants