* [PATCH] ASoC: tpa6130a2: TLV mapping for tpa6140a2
@ 2010-05-04 8:08 Peter Ujfalusi
2010-05-04 9:33 ` Ilkka Koskinen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Peter Ujfalusi @ 2010-05-04 8:08 UTC (permalink / raw)
To: alsa-devel; +Cc: ilkka.koskinen, broonie, lrg
Both tpa6130a2, and tpa6140a2 is supported by the
same driver, but the gain dB scaling is different on
the amplifiers.
Provide different mixer control for the chips with correct
TLV mapping.
User space will see:
"TPA6130A2 Headphone Playback Volume" in case of 6130
"TPA6140A2 Headphone Playback Volume" in case of 6140
The way machine drivers are using this amplifier remained
the same.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
sound/soc/codecs/tpa6130a2.c | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 958d49c..0cf3e38 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -53,6 +53,7 @@ struct tpa6130a2_data {
struct regulator_bulk_data supplies[TPA6130A2_NUM_SUPPLIES];
int power_gpio;
unsigned char power_state;
+ enum tpa_model id;
};
static int tpa6130a2_i2c_read(int reg)
@@ -263,6 +264,20 @@ static const struct snd_kcontrol_new tpa6130a2_controls[] = {
tpa6130_tlv),
};
+static const unsigned int tpa6140_tlv[] = {
+ TLV_DB_RANGE_HEAD(3),
+ 0, 8, TLV_DB_SCALE_ITEM(-5900, 400, 0),
+ 9, 16, TLV_DB_SCALE_ITEM(-2500, 200, 0),
+ 17, 31, TLV_DB_SCALE_ITEM(-1000, 100, 0),
+};
+
+static const struct snd_kcontrol_new tpa6140a2_controls[] = {
+ SOC_SINGLE_EXT_TLV("TPA6140A2 Headphone Playback Volume",
+ TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0,
+ tpa6130a2_get_reg, tpa6130a2_set_reg,
+ tpa6140_tlv),
+};
+
/*
* Enable or disable channel (left or right)
* The bit number for mute and amplifier are the same per channel:
@@ -368,13 +383,22 @@ static const struct snd_soc_dapm_route audio_map[] = {
int tpa6130a2_add_controls(struct snd_soc_codec *codec)
{
+ struct tpa6130a2_data *data;
+
+ BUG_ON(tpa6130a2_client == NULL);
+ data = i2c_get_clientdata(tpa6130a2_client);
+
snd_soc_dapm_new_controls(codec, tpa6130a2_dapm_widgets,
ARRAY_SIZE(tpa6130a2_dapm_widgets));
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
- return snd_soc_add_controls(codec, tpa6130a2_controls,
- ARRAY_SIZE(tpa6130a2_controls));
+ if (data->id == TPA6140A2)
+ return snd_soc_add_controls(codec, tpa6140a2_controls,
+ ARRAY_SIZE(tpa6140a2_controls));
+ else
+ return snd_soc_add_controls(codec, tpa6130a2_controls,
+ ARRAY_SIZE(tpa6130a2_controls));
}
EXPORT_SYMBOL_GPL(tpa6130a2_add_controls);
@@ -407,6 +431,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
pdata = client->dev.platform_data;
data->power_gpio = pdata->power_gpio;
+ data->id = pdata->id;
mutex_init(&data->mutex);
@@ -425,7 +450,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
gpio_direction_output(data->power_gpio, 0);
}
- switch (pdata->id) {
+ switch (data->id) {
case TPA6130A2:
for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tpa6130a2_supply_names[i];
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: tpa6130a2: TLV mapping for tpa6140a2
2010-05-04 8:08 [PATCH] ASoC: tpa6130a2: TLV mapping for tpa6140a2 Peter Ujfalusi
@ 2010-05-04 9:33 ` Ilkka Koskinen
2010-05-04 9:41 ` Mark Brown
2010-05-04 20:09 ` Liam Girdwood
2 siblings, 0 replies; 4+ messages in thread
From: Ilkka Koskinen @ 2010-05-04 9:33 UTC (permalink / raw)
To: Ujfalusi Peter (Nokia-D/Tampere)
Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com,
lrg@slimlogic.co.uk
On Tue, 4 May 2010, Ujfalusi Peter (Nokia-D/Tampere) wrote:
> Both tpa6130a2, and tpa6140a2 is supported by the
> same driver, but the gain dB scaling is different on
> the amplifiers.
>
> Provide different mixer control for the chips with correct
> TLV mapping.
>
> User space will see:
> "TPA6130A2 Headphone Playback Volume" in case of 6130
> "TPA6140A2 Headphone Playback Volume" in case of 6140
>
> The way machine drivers are using this amplifier remained
> the same.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Uh, I wonder how I missed that one. Anyway, look good to me.
Reviewed-by: Ilkka Koskinen <ilkka.koskinen@nokia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: tpa6130a2: TLV mapping for tpa6140a2
2010-05-04 8:08 [PATCH] ASoC: tpa6130a2: TLV mapping for tpa6140a2 Peter Ujfalusi
2010-05-04 9:33 ` Ilkka Koskinen
@ 2010-05-04 9:41 ` Mark Brown
2010-05-04 20:09 ` Liam Girdwood
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-05-04 9:41 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, ilkka.koskinen, lrg
On Tue, May 04, 2010 at 11:08:18AM +0300, Peter Ujfalusi wrote:
> Both tpa6130a2, and tpa6140a2 is supported by the
> same driver, but the gain dB scaling is different on
> the amplifiers.
>
> Provide different mixer control for the chips with correct
> TLV mapping.
>
> User space will see:
> "TPA6130A2 Headphone Playback Volume" in case of 6130
> "TPA6140A2 Headphone Playback Volume" in case of 6140
>
> The way machine drivers are using this amplifier remained
> the same.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: tpa6130a2: TLV mapping for tpa6140a2
2010-05-04 8:08 [PATCH] ASoC: tpa6130a2: TLV mapping for tpa6140a2 Peter Ujfalusi
2010-05-04 9:33 ` Ilkka Koskinen
2010-05-04 9:41 ` Mark Brown
@ 2010-05-04 20:09 ` Liam Girdwood
2 siblings, 0 replies; 4+ messages in thread
From: Liam Girdwood @ 2010-05-04 20:09 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, ilkka.koskinen, broonie
On Tue, 2010-05-04 at 11:08 +0300, Peter Ujfalusi wrote:
> Both tpa6130a2, and tpa6140a2 is supported by the
> same driver, but the gain dB scaling is different on
> the amplifiers.
>
> Provide different mixer control for the chips with correct
> TLV mapping.
>
> User space will see:
> "TPA6130A2 Headphone Playback Volume" in case of 6130
> "TPA6140A2 Headphone Playback Volume" in case of 6140
>
> The way machine drivers are using this amplifier remained
> the same.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
> ---
> sound/soc/codecs/tpa6130a2.c | 31 ++++++++++++++++++++++++++++---
> 1 files changed, 28 insertions(+), 3 deletions(-)
Applied.
Thanks
Liam
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-04 20:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-04 8:08 [PATCH] ASoC: tpa6130a2: TLV mapping for tpa6140a2 Peter Ujfalusi
2010-05-04 9:33 ` Ilkka Koskinen
2010-05-04 9:41 ` Mark Brown
2010-05-04 20:09 ` Liam Girdwood
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.