Skip to content

Conversation

@RanderWang
Copy link

This PR ports patch #2123 to fix runtime pm issue.
And also remove idle_bias_on in codec driver to let codec be able to suspend

fixes #2053

@RanderWang
Copy link
Author

@ClarexZhou can you help to validate it ? thanks

@ClarexZhou
Copy link

@ClarexZhou can you help to validate it ? thanks

Verified. Runtime PM is fixed on 373 in SDW mode. Also no side effect on 373 in I2S mode.


static const struct snd_soc_ops max_98373_sdw_ops = {
.startup = sdw_startup,
.trigger = max98373_trigger,
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is this function defined? I don't see it in this file and this file doesn't seem to even include any max98373 headers?

Copy link
Author

Choose a reason for hiding this comment

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

if (info->amp_num == 2)
dai_links->init = spk_init;

info->late_probe = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

do I understand it correctly, that you're modifying here a global static common struct? Are we sure no other driver will want to use it?

Copy link
Author

Choose a reason for hiding this comment

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

we also increase info->amp_num in this function. It is only used by sof_sdw machine driver for it is a static struct define in sof_sdw.c

Copy link
Collaborator

Choose a reason for hiding this comment

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

So what happens if you have several codecs of the same type?

Copy link
Member

Choose a reason for hiding this comment

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

@lyakh can you clarify your question? we do have configurations with 2 amplifiers of the same type, not sure what you see as wrong or incorrect?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@plbossart @RanderWang I think I'm getting it slowly. codec_info_list is a global array of objects - one per device type. Each of these objects is shared by all instances of that respective device - both for reading and writing. That's also how .amp_num is used. And there's no locking because (so far) those fields are changed from .init() and it's called for each device instance successively so no race is possible. This seems to be ok so far, but is a bit... strange. Can we also have codecs of different types mixed on a system? Would we then have to count them separately or together?

Copy link
Author

Choose a reason for hiding this comment

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

yes, no race for sdw-sof is executed serially. We have one case on TGL: 1308 i2s + 711 sdw + HDMI.

@bardliao
Copy link
Collaborator

@RanderWang I finally got what you are trying to do by reading a6c4e1a. However, I am not sure if it is a right solution. "Left Spk" and "Right Spk" are SND_SOC_DAPM_SPK which is supposed to be controlled by DAPM. Maybe what we really need is to enable/disable "VMON", "IMON", and "FBMON".

plbossart
plbossart previously approved these changes Jun 16, 2020
@plbossart
Copy link
Member

SOFCI TEST

This patch unify the codec prefix name to share code between I2S & sdw
mode of max98373.

Signed-off-by: randerwang <rander.wang@linux.intel.com>
Port patch: ASoC: Intel: Boards: tgl_max98373: add dai_trigger
function to sdw platform to fix runtime pm issue.

Signed-off-by: randerwang <rander.wang@linux.intel.com>
Disable Left and Right Spk pin after boot so that sof can
get suspended. Please check patch: ASoC: Intel: Boards:
tgl_max98373: add dai_trigger function

Signed-off-by: randerwang <rander.wang@linux.intel.com>
Idle_bias_on is used to decide bias on/off in standby state by dapm.
When Idle_bias_on is set to one, dapm will keep max98373 active at
idle time. Max98373 is doing nothing in this state, so remove
idle_bias_on setting to let max98373 get suspended when it is idle.

Signed-off-by: randerwang <rander.wang@linux.intel.com>
Reviewed-by : Ryan Lee <ryans.lee@maximintegrated.com>
@RanderWang
Copy link
Author

@RanderWang I finally got what you are trying to do by reading a6c4e1a. However, I am not sure if it is a right solution. "Left Spk" and "Right Spk" are SND_SOC_DAPM_SPK which is supposed to be controlled by DAPM. Maybe what we really need is to enable/disable "VMON", "IMON", and "FBMON".

these widgets are only controlled by codec driver, not by machine driver

@RanderWang
Copy link
Author

ICL-HDA was failed but it is not caused by this PR which only affects sdw platform

@bardliao
Copy link
Collaborator

@RanderWang I finally got what you are trying to do by reading a6c4e1a. However, I am not sure if it is a right solution. "Left Spk" and "Right Spk" are SND_SOC_DAPM_SPK which is supposed to be controlled by DAPM. Maybe what we really need is to enable/disable "VMON", "IMON", and "FBMON".

these widgets are only controlled by codec driver, not by machine driver

That's a good point. Thanks.

struct sof_sdw_codec_info *info,
bool playback);

bool late_probe;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@RanderWang why do we need this book? Can we not simply check if the function pointer below is NULL?

Copy link
Author

Choose a reason for hiding this comment

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

@ranj063 consider a case: a codec has late_probe function but it is not integrated in some platforms, so we don't need to invoke this function.

@lyakh lyakh self-requested a review June 18, 2020 07:46
Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

The only way to revoke my "request for change" seems to me by approving the PR... I'll wait for more approvals from people more knowledgeable about SDW than myself, then I'll change my review to an "approval" too.

Copy link
Collaborator

@bardliao bardliao left a comment

Choose a reason for hiding this comment

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

LGTM and it moves to a good direction that it is better to use the same code cross interfaces.

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.

[TGL] runtime PM always in active on TGL chromebook/I2S mode

6 participants