Repository navigation
ASoC: codec: max98373-sdw: fix a amixer error when codec is suspended #2226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,7 +208,6 @@ static bool max98373_readable_register(struct device *dev, unsigned int reg) | |
| static bool max98373_volatile_reg(struct device *dev, unsigned int reg) | ||
| { | ||
| switch (reg) { | ||
| case MAX98373_R203E_AMP_PATH_GAIN: | ||
| case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK: | ||
| case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK: | ||
| case MAX98373_R20B6_BDE_CUR_STATE_READBACK: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, AMP_PATH_GAIN I can understand, but "MEAS_ADC_*" seems like really volatile data. OTOH, exposing volatile regs directly as kcontrols does not seem like a good idea. Not sure what the right solution is... reading incorrect temperature readings does not sound good either.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, @ryans-lee could you help to check this ?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Agree. Maybe "ADC PVDD" and "ADC TEMP" are for special purpose. And it makes sense that we can't get the value in suspended.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this is correct? Isn't the issue more that we expose some registers that should not be shown to users, or if they are shown the put/get routines should include a pm_runtime_get_sync/put_autosuspend?. It'd be odd to change the nature of regmap registers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree to remove AMP_PATH_GAIN from volatile register list, but 0x2054, 0x2055 and 0x2086 are real volatile registers to update amp ADC values. Amp driver will return only cached value instead of reading actual value from h/w if these registers are removed from the volatile list. PVDD level and amp temperature are changing over time and it is being used for speaker calibration application running in user space. Reading ADC values while amp is suspended is not expected operation since amp is likely powered off in this state. Adding pm get_sync/auto suspend into put/get routine makes sense to me.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ryans-lee thanks for you idea and patch. Today I only have very limited time to access our device with your patch and found one issue. the "compnent->suspend" is only set for S3 sleep, not for runtime suspend. I modify it to "if (snd_soc_dapm_get_bias_level(&component->dapm) != SND_SOC_BIAS_OFF)", but I have to test it on device to confirm it. +static int max98373_adc_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct max98373_priv *max98373 =
+ snd_soc_component_get_drvdata(component);
+ struct soc_mixer_control *mc =
+ (struct soc_mixer_control *)kcontrol->private_value;
+ int reg = 0;
+
+ if (!component->suspend)
+ regmap_read(max98373->regmap, mc->reg, ®);
+ ucontrol->value.integer.value[0] = reg;
+
+ return 0;
+} |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I really don't understand this. If this is a hardware register that can change on its own, then it needs to be volatile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is based on comments "I agree to remove AMP_PATH_GAIN from volatile register list" from Ryans. @ryans-lee , can you explain this ? thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm this register is non-volatile.