Skip to content

ASoC: rt711-sdca: fix mbq_regmap issues - #2925

Merged
plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
bardliao:rt711-mbq_regmap
May 25, 2021
Merged

plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
bardliao:rt711-mbq_regmap

Conversation

@bardliao

Copy link
Copy Markdown
Collaborator

The regcache_sync() function actually do nothing since regcache_mark_dirty() is not called in the existing code. We call regcache_mark_dirty() in rt711_sdca_io_init(), but rt711_sdca_io_init() will not be invoked since rt711->hw_init is true.

Fixes: #2908

RanderWang
RanderWang previously approved these changes May 13, 2021

@RanderWang RanderWang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@shumingfan

Copy link
Copy Markdown

@bardliao LGTM. Thanks.

shumingfan
shumingfan previously approved these changes May 13, 2021
@bardliao
bardliao dismissed stale reviews from shumingfan and RanderWang via c0d7c8b May 13, 2021 08:22
@bardliao
bardliao force-pushed the rt711-mbq_regmap branch from 9e3a08b to c0d7c8b Compare May 13, 2021 08:22
@bardliao

Copy link
Copy Markdown
Collaborator Author

Update commit message.

@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.

Good finding @bardliao but see alternative suggestion below.

Comment thread sound/soc/codecs/rt711-sdca-sdw.c Outdated
regcache_cache_only(rt711->regmap, true);
regcache_cache_only(rt711->mbq_regmap, true);
regcache_mark_dirty(rt711->regmap);
regcache_mark_dirty(rt711->mbq_regmap);

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.

that's not the right fix, we need to extend the existing one with this

	if (rt711->first_hw_init) {
		regcache_cache_bypass(rt711->regmap, false);
		regcache_mark_dirty(rt711->regmap);
>>		regcache_cache_bypass(rt711->regmap_mbq, false);
>>		regcache_mark_dirty(rt711->regmap_mbq);
	} else
		rt711->first_hw_init = true;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

that's not the right fix, we need to extend the existing one with this

	if (rt711->first_hw_init) {
		regcache_cache_bypass(rt711->regmap, false);
		regcache_mark_dirty(rt711->regmap);
>>		regcache_cache_bypass(rt711->regmap_mbq, false);
>>		regcache_mark_dirty(rt711->regmap_mbq);
	} else
		rt711->first_hw_init = true;

I did it in the next patch. I think we need both because there are two scenarios.

  1. Codec is unattached. In this case we need to do rt711_sdca_io_init
  2. Common suspend/resume case. In this case we don't need to do rt711_sdca_io_init, but need to sync some registers since they will be restore to default when we do bus reset.

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.

@bardliao I think we are not aligned on the io_init case. This function will be used when we reattach, and there's no difference between the codec resetting on its own and the bus reset. The codec becoming un-attached can be for different reasons with different side effects, but there is nothing that tells us what the source of the reset was. It's a miss in the SoundWire spec and as a result software has to assume that all the state was lost every time the device re-attaches.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@plbossart So the problem is actually sdw_update_slave_status(SDW_SLAVE_UNATTACHED) is never triggered in the reattach case. See dmesg.txt with bard.diff.txt. Therefore, rt711->hw_init = false; and rt711_sdca_io_init will not be invoked
I will look into it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@plbossart I got why sdw_update_slave_status(SDW_SLAVE_UNATTACHED) is never triggered now. We call sdw_modify_slave_status without sdw_update_slave_status in sdw_clear_slave_status. As a result, sdw_update_slave_status(SDW_SLAVE_UNATTACHED) will never be invoked elsewhere due to the
status is not changed. Please see #2928.
However, with #2928 and this PR updated, I see

[   76.370376] rt711-sdca sdw:0:025d:0711:01: DPN_PortCtrl register write failed for port 3
[   76.370380] soundwire sdw-master-0: Program transport params failed: -61
[   76.370382] soundwire sdw-master-0: Program params failed: -61

dmesg.txt
I think it could be something wrong with rt711_sdca_io_init @shumingfan FYI

@bardliao
bardliao force-pushed the rt711-mbq_regmap branch from c0d7c8b to 72f7951 Compare May 17, 2021 12:06

@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.

the patches look good @bardliao but they both need a Fixes tag (from Mark Brown's tree) so that they are applied to the stable kernel and propagated to distros. Thanks!

bardliao added 2 commits May 25, 2021 09:36
SDW_SDCA_CTL() registers are used but are not set to readable.

Fixes: 7ad4d23 ('ASoC: rt711-sdca: Add RT711 SDCA vendor-specific driver')
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
We currently only hangle rt711->regmap in rt711_sdca_io_init(), and
rt711->mbq_regmap is missing.

Fixes: 7ad4d23 ('ASoC: rt711-sdca: Add RT711 SDCA vendor-specific driver')
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao
bardliao force-pushed the rt711-mbq_regmap branch from 72f7951 to db48b50 Compare May 25, 2021 01:42
@bardliao

Copy link
Copy Markdown
Collaborator Author

the patches look good @bardliao but they both need a Fixes tag (from Mark Brown's tree) so that they are applied to the stable kernel and propagated to distros. Thanks!

Done

@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.

thanks @bardliao

@plbossart
plbossart merged commit d26cb4f into thesofproject:topic/sof-dev May 25, 2021
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.

[BUG] The volume of RT711 codec does not match the actual setting

4 participants