Skip to content

fixup! ASoC: rt711-sdca: fix IO transfer timed out when unloading the module. - #2642

Merged
bardliao merged 2 commits into
thesofproject:topic/sof-devfrom
shumingfan:topic/sof-dev
Jan 27, 2021
Merged

fixup! ASoC: rt711-sdca: fix IO transfer timed out when unloading the module.#2642
bardliao merged 2 commits into
thesofproject:topic/sof-devfrom
shumingfan:topic/sof-dev

Conversation

@shumingfan

@shumingfanshumingfan commented Dec 17, 2020

Copy link
Copy Markdown

Due to the SCP_SDCA_INTMASK will be cleared by any reset,
the codec driver wants to set the setting back while the device attached again.
However, the codec driver may go to the suspend mode already at this moment.
The previous version tries to set cache_only=N and bypass the cache, then writes the registers.
There is a problem here that the cache_only feature doesn't set back to 'Y' if the codec suspended.
With this condition, the driver will try to access the registers when unloading the module.
But, the master suspended already and doesn't work for register access properly.
Therefore, this patch uses sdw_write_no_pm instead of regmap_write in the rt711_sdca_update_status().

The second patch also changed API from the regmap to sdw_write/read_no_pm.
Address 0x5c and 0x5d are related to the SDCA interrupt masks.
Regmap should be limited to vendor-specific registers.

sdw_write_no_pm(rt711->slave, SDW_SCP_SDCA_INTMASK1,
SDW_SCP_SDCA_INTMASK_SDCA_0);
regmap_write(rt711->regmap, SDW_SCP_SDCA_INTMASK2,
sdw_write_no_pm(rt711->slave, SDW_SCP_SDCA_INTMASK2,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should be really careful to access a register by regmap and the IO function directly. The code looks fine to me since we set the same value here as rt711_sdca_jack_init(), and we don't read it. But I will wait for @plbossart 's 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.

indeed we should not have the INTMASK1/2 registers in regmap, so what's missing is the removal of those registers from the regmap definition.
I think I added this in another PR some time back?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@bardliao

Copy link
Copy Markdown
Collaborator

SOFCI TEST

sdw_write_no_pm(rt711->slave, SDW_SCP_SDCA_INTMASK1,
SDW_SCP_SDCA_INTMASK_SDCA_0);
regmap_write(rt711->regmap, SDW_SCP_SDCA_INTMASK2,
sdw_write_no_pm(rt711->slave, SDW_SCP_SDCA_INTMASK2,

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.

indeed we should not have the INTMASK1/2 registers in regmap, so what's missing is the removal of those registers from the regmap definition.
I think I added this in another PR some time back?

@shumingfan

Copy link
Copy Markdown
Author

@plbossart
I modified your patch (923fec7) and added it to this PR.

bardliao
bardliao previously approved these changes Jan 14, 2021

@bardliaobardliao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks @shumingfan Should we explain why we don't use regmap functions for SDW interrupt registers in the commit message when sending these sdca codec driver upstream?

RanderWang
RanderWang previously approved these changes Jan 18, 2021
@shumingfan

Copy link
Copy Markdown
Author

@plbossart
I modified your patch (923fec7) and added it to this PR.

@plbossart Do you have any comments?

@plbossart

Copy link
Copy Markdown
Member

@shumingfan I wasn't sure if you wanted this PR to be merged, the commit messages need work especially the second one that makes a reference to another commit in the SOF tree without explanations.

@shumingfan

Copy link
Copy Markdown
Author

@shumingfan I wasn't sure if you wanted this PR to be merged, the commit messages need work especially the second one that makes a reference to another commit in the SOF tree without explanations.

Sorry about that. I will update the commit messages and update this PR.

Due to the SCP_SDCA_INTMASK will be cleared by any reset,
the codec driver wants to set the setting back while the device attached again.
However, the codec driver may go to the suspend mode already at this moment.
The previous version tries to set cache_only=N and bypass the cache, then writes the registers.
There is a problem here that the cache_only feature doesn't set back to 'Y' if the codec suspended.
With this condition, the driver will try to access the registers when unloading the module.
But, the master suspended already and doesn't work for register access properly.
Therefore, this patch uses sdw_write_no_pm instead of regmap_write in the rt711_sdca_update_status().
Signed-off-by: Shuming Fan <shumingf@realtek.com>
This patch rewrote from the original commit.
thesofproject@923fec7
Address 0x5c and 0x5d are related to the SDCA interrupt masks.
Regmap should be limited to vendor-specific registers.
There are some differences from the original patch.
It did the minor changes in rt711_sdca_interrupt_callback().
When the suspend/resume test, we saw that the driver will not re-do the io_init().
That's why the rt711_sdca_update_status() still set 0x5c/0x5d settings back if
the rt711_sdca_jack_init() was called before.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Shuming Fan <shumingf@realtek.com>
@shumingfan

Copy link
Copy Markdown
Author

@shumingfan I wasn't sure if you wanted this PR to be merged, the commit messages need work especially the second one that makes a reference to another commit in the SOF tree without explanations.

@plbossart I had updated the commits.

@bardliao

Copy link
Copy Markdown
Collaborator

@shumingfan I wasn't sure if you wanted this PR to be merged, the commit messages need work especially the second one that makes a reference to another commit in the SOF tree without explanations.

@plbossart I had updated the commits.

Also, note that the SDCA codec drivers are not upstream yet. So we will squash all these fixups when sending the patch upstream. So the commit message will disappear or we have to rewrite the commit message when squashing

@bardliao

Copy link
Copy Markdown
Collaborator

SOFCI TEST

@bardliaobardliao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Let's wait for the CI test result.

@plbossart

Copy link
Copy Markdown
Member

@bardliao should we merge? not sure what we are missing. I'd like the SDCA codecs to be submitted upstream, we are near the end of the 5.11 cycle.

@bardliao

Copy link
Copy Markdown
Collaborator

The CI pr-device-test failure is NotTested and SKIP. Let's merge it.

@bardliao
bardliao merged commit ba56e4d into thesofproject:topic/sof-devJan 27, 2021
@bardliao

Copy link
Copy Markdown
Collaborator

@bardliao should we merge? not sure what we are missing. I'd like the SDCA codecs to be submitted upstream, we are near the end of the 5.11 cycle.

@plbossartsoundwire: export sdw_write/read_no_pm functions is required for the sdca codec drivers. It is still not merged on upstream yet.

@plbossart

Copy link
Copy Markdown
Member

@bardliao can you ping Vinod and Mark on this? was there any objection?

@bardliao

Copy link
Copy Markdown
Collaborator

@bardliao can you ping Vinod and Mark on this? was there any objection?

I didn't see any objection. Vinod has pinged Mark on Jan. 6 Re: regmap: sdw: use _no_pm functions in regmap_read/write and I resent the series on 22 Jan [RESEND PATCH v2 0/9] soundwire/regmap: use _no_pm routines

Sign up for freeto 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

@shumingfan@bardliao@plbossart@RanderWang