mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-03 16:56:45 +07:00
ASoC: wm5102: Move ultrasonic response settings lock to the driver level
The wm5102 driver currently uses the snd_soc_codec mutex to protect its ultrasonic response settings from concurrent access. This patch moves this lock to the driver level. This will allow us to eventually remove the snd_soc_codec mutex. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
210a5fae55
commit
d74bcaaeb6
@ -141,6 +141,7 @@ struct arizona {
|
||||
|
||||
uint16_t dac_comp_coeff;
|
||||
uint8_t dac_comp_enabled;
|
||||
struct mutex dac_comp_lock;
|
||||
};
|
||||
|
||||
int arizona_clk32k_enable(struct arizona *arizona);
|
||||
|
@ -1164,13 +1164,13 @@ static void arizona_wm5102_set_dac_comp(struct snd_soc_codec *codec,
|
||||
{ 0x80, 0x0 },
|
||||
};
|
||||
|
||||
mutex_lock(&codec->mutex);
|
||||
mutex_lock(&arizona->dac_comp_lock);
|
||||
|
||||
dac_comp[1].def = arizona->dac_comp_coeff;
|
||||
if (rate >= 176400)
|
||||
dac_comp[2].def = arizona->dac_comp_enabled;
|
||||
|
||||
mutex_unlock(&codec->mutex);
|
||||
mutex_unlock(&arizona->dac_comp_lock);
|
||||
|
||||
regmap_multi_reg_write(arizona->regmap,
|
||||
dac_comp,
|
||||
|
@ -619,10 +619,10 @@ static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol,
|
||||
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
|
||||
uint16_t data;
|
||||
|
||||
mutex_lock(&codec->mutex);
|
||||
mutex_lock(&arizona->dac_comp_lock);
|
||||
data = cpu_to_be16(arizona->dac_comp_coeff);
|
||||
memcpy(ucontrol->value.bytes.data, &data, sizeof(data));
|
||||
mutex_unlock(&codec->mutex);
|
||||
mutex_unlock(&arizona->dac_comp_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -633,11 +633,11 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
|
||||
|
||||
mutex_lock(&codec->mutex);
|
||||
mutex_lock(&arizona->dac_comp_lock);
|
||||
memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data,
|
||||
sizeof(arizona->dac_comp_coeff));
|
||||
arizona->dac_comp_coeff = be16_to_cpu(arizona->dac_comp_coeff);
|
||||
mutex_unlock(&codec->mutex);
|
||||
mutex_unlock(&arizona->dac_comp_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -648,9 +648,9 @@ static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
|
||||
|
||||
mutex_lock(&codec->mutex);
|
||||
mutex_lock(&arizona->dac_comp_lock);
|
||||
ucontrol->value.integer.value[0] = arizona->dac_comp_enabled;
|
||||
mutex_unlock(&codec->mutex);
|
||||
mutex_unlock(&arizona->dac_comp_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -661,9 +661,9 @@ static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
|
||||
|
||||
mutex_lock(&codec->mutex);
|
||||
mutex_lock(&arizona->dac_comp_lock);
|
||||
arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
|
||||
mutex_unlock(&codec->mutex);
|
||||
mutex_unlock(&arizona->dac_comp_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user