* wm8960: add DAC Slope switch
@ 2020-11-24 17:23 Lukas F. Hartmann
2020-12-07 10:28 ` Charles Keepax
0 siblings, 1 reply; 3+ messages in thread
From: Lukas F. Hartmann @ 2020-11-24 17:23 UTC (permalink / raw)
To: lukas
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
patches, alsa-devel, linux-kernel
The WM8960 DAC has a "DAC Slope" switch that can toggle between two
different output filter curves. This patch adds support for it.
Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
---
sound/soc/codecs/wm8960.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 660ec46ee..a15cd037d 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -126,6 +126,7 @@ struct wm8960_priv {
struct snd_soc_dapm_widget *rout1;
struct snd_soc_dapm_widget *out3;
bool deemph;
+ bool dacslope;
int lrclk;
int bclk;
int sysclk;
@@ -217,6 +218,33 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
return wm8960_set_deemph(component);
}
+static int wm8960_put_dacslope(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct wm8960_priv *wm8960 = snd_soc_component_get_drvdata(component);
+ unsigned int val = ucontrol->value.integer.value[0];
+
+ if (val > 1)
+ return -EINVAL;
+
+ wm8960->dacslope = val;
+
+ return snd_soc_component_update_bits(component, WM8960_DACCTL1,
+ 0x2, val<<1);
+}
+
+static int wm8960_get_dacslope(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct wm8960_priv *wm8960 = snd_soc_component_get_drvdata(component);
+
+ ucontrol->value.integer.value[0] = wm8960->dacslope;
+ return 0;
+}
+
+
static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1725, 75, 0);
static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
@@ -272,6 +300,9 @@ SOC_ENUM("DAC Polarity", wm8960_enum[1]),
SOC_SINGLE_BOOL_EXT("DAC Deemphasis Switch", 0,
wm8960_get_deemph, wm8960_put_deemph),
+SOC_SINGLE_BOOL_EXT("DAC Slope", 0,
+ wm8960_get_dacslope, wm8960_put_dacslope),
+
SOC_ENUM("3D Filter Upper Cut-Off", wm8960_enum[2]),
SOC_ENUM("3D Filter Lower Cut-Off", wm8960_enum[3]),
SOC_SINGLE("3D Volume", WM8960_3D, 1, 15, 0),
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: wm8960: add DAC Slope switch
2020-11-24 17:23 wm8960: add DAC Slope switch Lukas F. Hartmann
@ 2020-12-07 10:28 ` Charles Keepax
0 siblings, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2020-12-07 10:28 UTC (permalink / raw)
To: Lukas F. Hartmann
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
patches, alsa-devel, linux-kernel
On Tue, Nov 24, 2020 at 06:23:13PM +0100, Lukas F. Hartmann wrote:
> The WM8960 DAC has a "DAC Slope" switch that can toggle between two
> different output filter curves. This patch adds support for it.
>
> Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
> ---
> +static int wm8960_put_dacslope(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
> + struct wm8960_priv *wm8960 = snd_soc_component_get_drvdata(component);
> + unsigned int val = ucontrol->value.integer.value[0];
> +
> + if (val > 1)
> + return -EINVAL;
> +
> + wm8960->dacslope = val;
> +
> + return snd_soc_component_update_bits(component, WM8960_DACCTL1,
> + 0x2, val<<1);
Is the DAC Slope switch not in DACCTL2?
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: wm8960: add DAC Slope switch
@ 2020-12-07 10:28 ` Charles Keepax
0 siblings, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2020-12-07 10:28 UTC (permalink / raw)
To: Lukas F. Hartmann
Cc: alsa-devel, patches, Takashi Iwai, Liam Girdwood, Mark Brown,
linux-kernel
On Tue, Nov 24, 2020 at 06:23:13PM +0100, Lukas F. Hartmann wrote:
> The WM8960 DAC has a "DAC Slope" switch that can toggle between two
> different output filter curves. This patch adds support for it.
>
> Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
> ---
> +static int wm8960_put_dacslope(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
> + struct wm8960_priv *wm8960 = snd_soc_component_get_drvdata(component);
> + unsigned int val = ucontrol->value.integer.value[0];
> +
> + if (val > 1)
> + return -EINVAL;
> +
> + wm8960->dacslope = val;
> +
> + return snd_soc_component_update_bits(component, WM8960_DACCTL1,
> + 0x2, val<<1);
Is the DAC Slope switch not in DACCTL2?
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-07 10:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 17:23 wm8960: add DAC Slope switch Lukas F. Hartmann
2020-12-07 10:28 ` Charles Keepax
2020-12-07 10:28 ` Charles Keepax
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.