* [PATCH 1/3] mfd: Add WM1811 support
@ 2011-09-27 18:50 Mark Brown
2011-09-27 18:50 ` [PATCH 2/3] regulator: " Mark Brown
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Mark Brown @ 2011-09-27 18:50 UTC (permalink / raw)
To: Samuel Ortiz, Liam Girdwood; +Cc: alsa-devel, patches, linux-kernel, Mark Brown
The WM1811 is mostly register compatible with the WM8994 and WM8958,
providing a high performance audio hub CODEC in a small form factor
suitable for ultra compact system designs.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
Due to the ASoC cross dependencies it seems like it'll be easier to
merge this via ASoC - Samuel, does this make sense to you?
drivers/mfd/wm8994-core.c | 28 ++++++++++++++++++++++++++++
include/linux/mfd/wm8994/core.h | 1 +
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 719fee8..61894fc 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -167,6 +167,18 @@ static struct mfd_cell wm8994_devs[] = {
* and should be handled via the standard regulator API supply
* management.
*/
+static const char *wm1811_main_supplies[] = {
+ "DBVDD1",
+ "DBVDD2",
+ "DBVDD3",
+ "DCVDD",
+ "AVDD1",
+ "AVDD2",
+ "CPVDD",
+ "SPKVDD1",
+ "SPKVDD2",
+};
+
static const char *wm8994_main_supplies[] = {
"DBVDD",
"DCVDD",
@@ -227,6 +239,7 @@ static int wm8994_suspend(struct device *dev)
switch (wm8994->type) {
case WM8958:
+ case WM1811:
ret = wm8994_reg_read(wm8994, WM8958_MIC_DETECT_1);
if (ret < 0) {
dev_err(dev, "Failed to read power status: %d\n", ret);
@@ -375,6 +388,9 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
}
switch (wm8994->type) {
+ case WM1811:
+ wm8994->num_supplies = ARRAY_SIZE(wm1811_main_supplies);
+ break;
case WM8994:
wm8994->num_supplies = ARRAY_SIZE(wm8994_main_supplies);
break;
@@ -395,6 +411,10 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
}
switch (wm8994->type) {
+ case WM1811:
+ for (i = 0; i < ARRAY_SIZE(wm1811_main_supplies); i++)
+ wm8994->supplies[i].supply = wm1811_main_supplies[i];
+ break;
case WM8994:
for (i = 0; i < ARRAY_SIZE(wm8994_main_supplies); i++)
wm8994->supplies[i].supply = wm8994_main_supplies[i];
@@ -428,6 +448,13 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
goto err_enable;
}
switch (ret) {
+ case 0x1811:
+ devname = "WM1811";
+ if (wm8994->type != WM1811)
+ dev_warn(wm8994->dev, "Device registered as type %d\n",
+ wm8994->type);
+ wm8994->type = WM1811;
+ break;
case 0x8994:
devname = "WM8994";
if (wm8994->type != WM8994)
@@ -592,6 +619,7 @@ static int wm8994_i2c_remove(struct i2c_client *i2c)
}
static const struct i2c_device_id wm8994_i2c_id[] = {
+ { "wm1811", WM1811 },
{ "wm8994", WM8994 },
{ "wm8958", WM8958 },
{ }
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index a275798..f44bdb7 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -20,6 +20,7 @@
enum wm8994_type {
WM8994 = 0,
WM8958 = 1,
+ WM1811 = 2,
};
struct regulator_dev;
--
1.7.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] regulator: Add WM1811 support 2011-09-27 18:50 [PATCH 1/3] mfd: Add WM1811 support Mark Brown @ 2011-09-27 18:50 ` Mark Brown 2011-09-27 18:50 ` [PATCH 3/3] ASoC: " Mark Brown 2011-10-04 10:19 ` [PATCH 1/3] mfd: " Samuel Ortiz 2 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2011-09-27 18:50 UTC (permalink / raw) To: Samuel Ortiz, Liam Girdwood; +Cc: alsa-devel, patches, linux-kernel, Mark Brown The WM1811 has a slightly different range on LDO2 to other WM8994 class devices. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> --- As with the ASoC patch this depends on the MFD changes - Liam, given that ASoC is the thing most likely to run into cross-tree issues are you OK with merging this via ASoC? drivers/regulator/wm8994-regulator.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 1a6a690..b87bf5c 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c @@ -140,6 +140,14 @@ static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev, return (selector * 100000) + 900000; case WM8958: return (selector * 100000) + 1000000; + case WM1811: + switch (selector) { + case 0: + return -EINVAL; + default: + return (selector * 100000) + 950000; + } + break; default: return -EINVAL; } @@ -170,6 +178,11 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev, case WM8958: selector = (min_uV - 1000000) / 100000; break; + case WM1811: + selector = (min_uV - 950000) / 100000; + if (selector == 0) + selector = 1; + break; default: return -EINVAL; } -- 1.7.6.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] ASoC: Add WM1811 support 2011-09-27 18:50 [PATCH 1/3] mfd: Add WM1811 support Mark Brown 2011-09-27 18:50 ` [PATCH 2/3] regulator: " Mark Brown @ 2011-09-27 18:50 ` Mark Brown 2011-10-04 10:19 ` [PATCH 1/3] mfd: " Samuel Ortiz 2 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2011-09-27 18:50 UTC (permalink / raw) To: Samuel Ortiz, Liam Girdwood; +Cc: alsa-devel, patches, linux-kernel, Mark Brown The WM1811 is mostly register compatible with the WM8994 and WM8958, providing a high performance audio hub CODEC in a small form factor suitable for ultra compact system designs. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> --- include/linux/mfd/wm8994/registers.h | 4 ++ sound/soc/codecs/wm8994.c | 83 +++++++++++++++++++++++++++++++-- 2 files changed, 82 insertions(+), 5 deletions(-) diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h index 23b24ca..d7be463 100644 --- a/include/linux/mfd/wm8994/registers.h +++ b/include/linux/mfd/wm8994/registers.h @@ -2073,6 +2073,10 @@ /* * R96 (0x60) - Analogue HP (1) */ +#define WM1811_HPOUT1_ATTN 0x0100 /* HPOUT1_ATTN */ +#define WM1811_HPOUT1_ATTN_MASK 0x0100 /* HPOUT1_ATTN */ +#define WM1811_HPOUT1_ATTN_SHIFT 8 /* HPOUT1_ATTN */ +#define WM1811_HPOUT1_ATTN_WIDTH 1 /* HPOUT1_ATTN */ #define WM8994_HPOUT1L_RMV_SHORT 0x0080 /* HPOUT1L_RMV_SHORT */ #define WM8994_HPOUT1L_RMV_SHORT_MASK 0x0080 /* HPOUT1L_RMV_SHORT */ #define WM8994_HPOUT1L_RMV_SHORT_SHIFT 7 /* HPOUT1L_RMV_SHORT */ diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index e537267..5e8d66d 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -283,6 +283,7 @@ static const DECLARE_TLV_DB_SCALE(st_tlv, -3600, 300, 0); static const DECLARE_TLV_DB_SCALE(wm8994_3d_tlv, -1600, 183, 0); static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static const DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); +static const DECLARE_TLV_DB_SCALE(mixin_boost_tlv, 0, 900, 0); #define WM8994_DRC_SWITCH(xname, reg, shift) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ @@ -703,6 +704,13 @@ SOC_SINGLE_TLV("AIF2DAC Noise Gate Threshold Volume", 7, 1, ng_tlv), }; +static const struct snd_kcontrol_new wm1811_snd_controls[] = { +SOC_SINGLE_TLV("MIXINL IN1LP Boost Volume", WM8994_INPUT_MIXER_1, 7, 1, 0, + mixin_boost_tlv), +SOC_SINGLE_TLV("MIXINL IN1RP Boost Volume", WM8994_INPUT_MIXER_1, 8, 1, 0, + mixin_boost_tlv), +}; + static int clk_sys_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { @@ -2053,6 +2061,15 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, WM8958_CP_DISCH); } break; + + case WM1811: + if (wm8994->revision < 2) { + snd_soc_write(codec, 0x102, 0x3); + snd_soc_write(codec, 0x5d, 0x7e); + snd_soc_write(codec, 0x5e, 0x0); + snd_soc_write(codec, 0x102, 0x0); + } + break; } /* Discharge LINEOUT1 & 2 */ @@ -2168,10 +2185,18 @@ static int wm8994_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) /* The AIF2 format configuration needs to be mirrored to AIF3 * on WM8958 if it's in use so just do it all the time. */ - if (control->type == WM8958 && dai->id == 2) - snd_soc_update_bits(codec, WM8958_AIF3_CONTROL_1, - WM8994_AIF1_LRCLK_INV | - WM8958_AIF3_FMT_MASK, aif1); + switch (control->type) { + case WM1811: + case WM8958: + if (dai->id == 2) + snd_soc_update_bits(codec, WM8958_AIF3_CONTROL_1, + WM8994_AIF1_LRCLK_INV | + WM8958_AIF3_FMT_MASK, aif1); + break; + + default: + break; + } snd_soc_update_bits(codec, aif1_reg, WM8994_AIF1_BCLK_INV | WM8994_AIF1_LRCLK_INV | @@ -2258,6 +2283,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, break; case 3: switch (control->type) { + case WM1811: case WM8958: aif1_reg = WM8958_AIF3_CONTROL_1; break; @@ -2384,6 +2410,7 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream, switch (dai->id) { case 3: switch (control->type) { + case WM1811: case WM8958: aif1_reg = WM8958_AIF3_CONTROL_1; break; @@ -2614,6 +2641,7 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) case WM8994: snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, 0); break; + case WM1811: case WM8958: snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0); @@ -2682,6 +2710,7 @@ static int wm8994_resume(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, WM8994_MICD_ENA); break; + case WM1811: case WM8958: if (wm8994->jack_cb) snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, @@ -2980,8 +3009,13 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = codec->control_data; - if (control->type != WM8958) + switch (control->type) { + case WM1811: + case WM8958: + break; + default: return -EINVAL; + } if (jack) { if (!cb) { @@ -3135,6 +3169,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) wm8994->hubs.dcs_readback_mode = 1; break; + case WM1811: + wm8994->hubs.dcs_readback_mode = 2; + wm8994->hubs.no_series_update = 1; + + switch (wm8994->revision) { + case 0: + case 1: + wm8994->hubs.dcs_codes_l = -7; + wm8994->hubs.dcs_codes_r = -4; + break; + default: + break; + } + + snd_soc_update_bits(codec, WM8994_ANALOGUE_HP_1, + WM1811_HPOUT1_ATTN, WM1811_HPOUT1_ATTN); + break; + default: break; } @@ -3195,6 +3247,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) break; case WM8958: + case WM1811: if (wm8994->micdet_irq) { ret = request_threaded_irq(wm8994->micdet_irq, NULL, wm8958_mic_irq, @@ -3357,6 +3410,19 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) ARRAY_SIZE(wm8994_dac_widgets)); } break; + + case WM1811: + snd_soc_add_controls(codec, wm8958_snd_controls, + ARRAY_SIZE(wm8958_snd_controls)); + snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets, + ARRAY_SIZE(wm8958_dapm_widgets)); + snd_soc_dapm_new_controls(dapm, wm8994_lateclk_widgets, + ARRAY_SIZE(wm8994_lateclk_widgets)); + snd_soc_dapm_new_controls(dapm, wm8994_adc_widgets, + ARRAY_SIZE(wm8994_adc_widgets)); + snd_soc_dapm_new_controls(dapm, wm8994_dac_widgets, + ARRAY_SIZE(wm8994_dac_widgets)); + break; } @@ -3393,6 +3459,12 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) wm8958_dsp2_init(codec); break; + case WM1811: + snd_soc_dapm_add_routes(dapm, wm8994_lateclk_intercon, + ARRAY_SIZE(wm8994_lateclk_intercon)); + snd_soc_dapm_add_routes(dapm, wm8958_intercon, + ARRAY_SIZE(wm8958_intercon)); + break; } return 0; @@ -3448,6 +3520,7 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec) wm8994); break; + case WM1811: case WM8958: if (wm8994->micdet_irq) free_irq(wm8994->micdet_irq, wm8994); -- 1.7.6.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mfd: Add WM1811 support 2011-09-27 18:50 [PATCH 1/3] mfd: Add WM1811 support Mark Brown 2011-09-27 18:50 ` [PATCH 2/3] regulator: " Mark Brown 2011-09-27 18:50 ` [PATCH 3/3] ASoC: " Mark Brown @ 2011-10-04 10:19 ` Samuel Ortiz 2011-10-04 10:58 ` Mark Brown 2 siblings, 1 reply; 5+ messages in thread From: Samuel Ortiz @ 2011-10-04 10:19 UTC (permalink / raw) To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, patches, linux-kernel Hi Mark, On Tue, Sep 27, 2011 at 07:50:05PM +0100, Mark Brown wrote: > The WM1811 is mostly register compatible with the WM8994 and WM8958, > providing a high performance audio hub CODEC in a small form factor > suitable for ultra compact system designs. > > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> > --- > > Due to the ASoC cross dependencies it seems like it'll be easier to > merge this via ASoC - Samuel, does this make sense to you? It does. Liam, please add my: Acked-by: Samuel Ortiz <sameo@linux.intel.com> to this one. Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mfd: Add WM1811 support 2011-10-04 10:19 ` [PATCH 1/3] mfd: " Samuel Ortiz @ 2011-10-04 10:58 ` Mark Brown 0 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2011-10-04 10:58 UTC (permalink / raw) To: Samuel Ortiz; +Cc: Liam Girdwood, alsa-devel, patches, linux-kernel On Tue, Oct 04, 2011 at 12:19:02PM +0200, Samuel Ortiz wrote: > On Tue, Sep 27, 2011 at 07:50:05PM +0100, Mark Brown wrote: > > Due to the ASoC cross dependencies it seems like it'll be easier to > > merge this via ASoC - Samuel, does this make sense to you? > It does. > Liam, please add my: > Acked-by: Samuel Ortiz <sameo@linux.intel.com> Hrm, actually there's a bit of overlap with "mfd: Add more checks for WM8994 being active during suspend" from your tree. It's only a one line change (adding the WM1811 device ID) so I don't see any problem with just applying that during -rc, or I could cherry-pick that change over now? Anyway, I've applied the patch just now. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-04 10:58 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-09-27 18:50 [PATCH 1/3] mfd: Add WM1811 support Mark Brown 2011-09-27 18:50 ` [PATCH 2/3] regulator: " Mark Brown 2011-09-27 18:50 ` [PATCH 3/3] ASoC: " Mark Brown 2011-10-04 10:19 ` [PATCH 1/3] mfd: " Samuel Ortiz 2011-10-04 10:58 ` Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).