Re: [PATCH v3 8/8] ASoC: msm8916-wcd-analog: add lineout output

Konrad Dybcio
2024-08-20T14:31:10Z

On 31.07.2024 5:25 PM, Adam Skladowski wrote:
> From: Vladimir Lypak <vladimir.lypak@gmail.com>
>
> Add descriptions and controls to toggle lineout output
>
> Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com>
> Signed-off-by: Adam Skladowski <a39.skl@gmail.com>
> ---
> sound/soc/codecs/msm8916-wcd-analog.c | 64 +++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
> diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
> index b9325290c28d..38949556f7d9 100644
> --- a/sound/soc/codecs/msm8916-wcd-analog.c
> +++ b/sound/soc/codecs/msm8916-wcd-analog.c
> @@ -233,6 +233,8 @@
> #define RX_EAR_CTL_PA_SEL BIT(7)
>
> #define CDC_A_RX_EAR_STATUS (0xf1A1)
> +#define CDC_A_RX_LO_DAC_CTL (0xf1AC)
> +#define CDC_A_RX_LO_EN_CTL (0xf1AD)
>
> #define CDC_A_SPKR_DAC_CTL (0xf1B0)
> #define SPKR_DAC_CTL_DAC_RESET_MASK BIT(4)
> @@ -327,6 +329,8 @@ static const struct soc_enum hph_enum = SOC_ENUM_SINGLE_VIRT(
> static const struct snd_kcontrol_new ear_mux = SOC_DAPM_ENUM("EAR_S", hph_enum);
> static const struct snd_kcontrol_new hphl_mux = SOC_DAPM_ENUM("HPHL", hph_enum);
> static const struct snd_kcontrol_new hphr_mux = SOC_DAPM_ENUM("HPHR", hph_enum);
> +static const struct snd_kcontrol_new lineout_mux = SOC_DAPM_ENUM("LINEOUT",
> + hph_enum);
>
> /* ADC2 MUX */
> static const struct soc_enum adc2_enum = SOC_ENUM_SINGLE_VIRT(
> @@ -630,6 +634,46 @@ static int pm8916_wcd_analog_enable_adc(struct snd_soc_dapm_widget *w,
> return 0;
> }
>
> +static int pm8916_wcd_analog_enable_lineout_dac(struct snd_soc_dapm_widget *w,
> + struct snd_kcontrol *kcontrol,
> + int event)
> +{
> + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
> +
> + switch (event) {
> + case SND_SOC_DAPM_PRE_PMU:
> + snd_soc_component_update_bits(component, CDC_A_RX_LO_EN_CTL,
> + 0x20, 0x20);

Using BIT(n) here would be nicer, but this looks reasonable otherwise

Konrad