Skip to content

ASoC: SOF: Intel: hda: refine suspend with stop chip#975

Merged
plbossart merged 3 commits intothesofproject:topic/sof-devfrom
zhuyingjiang:topic/sof-dev-refine-suspend-with-stop-chip
Jun 5, 2019
Merged

ASoC: SOF: Intel: hda: refine suspend with stop chip#975
plbossart merged 3 commits intothesofproject:topic/sof-devfrom
zhuyingjiang:topic/sof-dev-refine-suspend-with-stop-chip

Conversation

@zhuyingjiang
Copy link

Define a SOF hda_dsp_ctrl_stop_chip and use this in hda_suspend, so the disable and clear HDA irq and stream irqs steps all called during the suspend. Codec and HDA link related registers are write if CONFIG_SND_SOC_SOF_HDA is true.
Use the SOF defined ppcap functions in hda_suspend/hda_resume.

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

comments below

snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL,
SOF_HDA_INT_ALL_STREAM, 0);

/* disable hda bus irq */
Copy link
Member

Choose a reason for hiding this comment

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

disable controller CIE and GIE

Copy link
Author

Choose a reason for hiding this comment

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

OK, thanks!

Choose a reason for hiding this comment

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

no, not disable CIE and GIE, please check this commit torvalds@7d4f606.
Codec can send out INT or wake up controller depending on whether CIE or GIE enabled.(Figure 4, Interupt structure).

Copy link
Author

Choose a reason for hiding this comment

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

@RanderWang Please check
azx_stop_chip
=>snd_hdac_bus_stop_chip
==>azx_int_disable

Choose a reason for hiding this comment

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

yes, I tried this PR with my 983 PR for headphone detection on whiskylake. Headphone detection worked with it.

/* disable CORB/RIRB */
snd_hdac_bus_stop_cmd_io(bus);

/* disable position buffer */
Copy link
Member

Choose a reason for hiding this comment

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

is this really dependent on SOF_HDA? This is the position buffer that we can use even for NOCODEC for DPIB.

Copy link
Author

Choose a reason for hiding this comment

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

@plbossart OK, thanks for confirm, I will still follow a PR with change the same in hda_dsp_ctrl_init_chip.

Copy link
Member

Choose a reason for hiding this comment

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

It was a question, have you confirmed if yes/no this code is needed for NOCODEC?
And if yes, then the fix is incorrect since you are using snd_hdac_chip_writel() so introduced a dependency on hdac.

Copy link
Author

Choose a reason for hiding this comment

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

@plbossart Yes, I am confirm that this is needed for NOCODEC. for position buffer is according to HDA stream. What ever codec is using, the position buffer need to be set at beginning and reset at end. It is only that NOCODEC will not cause a issue if not set.
I will update the snd_hdac_chip_writel with SOF functions, thanks!

@zhuyingjiang zhuyingjiang force-pushed the topic/sof-dev-refine-suspend-with-stop-chip branch from dd69928 to f1fff35 Compare May 24, 2019 07:52
@zhuyingjiang
Copy link
Author

@plbossart updated

@zhuyingjiang
Copy link
Author

@plbossart I think this can be merged?

RanderWang
RanderWang previously approved these changes May 29, 2019
Copy link

@RanderWang RanderWang left a comment

Choose a reason for hiding this comment

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

LGTM

@plbossart
Copy link
Member

this is going to conflict with @RanderWang changes, and I'd like his PR to go in first.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

The first commit message doesn't explain why the change is needed.

The description of third commit (for example "If CONFIG_SND_SOC_SOF_HDA is
defined, also disable the CORB/RIRB, and stop i/o.") should go to the second commit as that's where the new stop i/o is added.

In general this looks good and helps with readability.

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

same comment as @kv2019i the code looks well structured but the commit messages need more work for upstream. Thanks!

@zhuyingjiang zhuyingjiang force-pushed the topic/sof-dev-refine-suspend-with-stop-chip branch from f19fe55 to ab34e87 Compare June 4, 2019 02:32
@zhuyingjiang
Copy link
Author

@plbossart @kv2019i Updated, thanks for your suggestions!

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Thanks, the commits are now better, but e.g. the last commit still needs work. How about

First:
Unify ppcap function setup by using SOF common functions for both
HDA and non-HDA cases.

Second:
Add common hda_dsp_ctrl_stop_chip() function to stop controller with
the same function handling both HDA and non-HDA cases. This function
disables IRQs and clears status masks. When CONFIG_SND_SOC_SOF_HDA
is defined, also disables the CORB/RIRB, and stops i/o.

Third:
Unify suspend code by using SOF common function
hda_dsp_ctrl_stop_chip() which can handle both HDA and non-HDA cases.

Unify ppcap function setup by using SOF common functions
for both HDA and non-HDA cases.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Add common hda_dsp_ctrl_stop_chip() function to stop controller with
the same function handling both HDA and non-HDA cases. This function
disables IRQs and clears status masks. When CONFIG_SND_SOC_SOF_HDA
is defined, also disables the CORB/RIRB, and stops i/o.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Unify suspend code by using SOF common function
hda_dsp_ctrl_stop_chip() which can handle both HDA
and non-HDA cases.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
@zhuyingjiang zhuyingjiang force-pushed the topic/sof-dev-refine-suspend-with-stop-chip branch from ab34e87 to 6322320 Compare June 5, 2019 02:09
@zhuyingjiang
Copy link
Author

@kv2019i Updated, thanks for your suggestion!

@zhuyingjiang zhuyingjiang requested a review from kv2019i June 5, 2019 04:22
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Thank you, looks good now!

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

Thanks @zhuyingjiang

@plbossart plbossart merged commit 7f300c7 into thesofproject:topic/sof-dev Jun 5, 2019
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