* [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
@ 2010-05-05 10:02 Jarkko Nikula
2010-05-05 11:28 ` Mark Brown
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Jarkko Nikula @ 2010-05-05 10:02 UTC (permalink / raw)
To: alsa-devel; +Cc: Mark Brown, Peter Ujfalusi, Liam Girdwood
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
---
v2:
- Removed added regulator_bulk_disable brain fart from aic3x_i2c_probe
- Added comment to gpio_reset number in aic3x_pdata
---
include/sound/tlv320aic3x.h | 17 +++++++++++++++++
sound/soc/codecs/tlv320aic3x.c | 25 +++++++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
create mode 100644 include/sound/tlv320aic3x.h
diff --git a/include/sound/tlv320aic3x.h b/include/sound/tlv320aic3x.h
new file mode 100644
index 0000000..b1a5f34
--- /dev/null
+++ b/include/sound/tlv320aic3x.h
@@ -0,0 +1,17 @@
+/*
+ * Platform data for Texas Instruments TLV320AIC3x codec
+ *
+ * Author: Jarkko Nikula <jhnikula@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __TLV320AIC3x_H__
+#define __TLV320AIC3x_H__
+
+struct aic3x_pdata {
+ int gpio_reset; /* < 0 if not used */
+};
+
+#endif
\ No newline at end of file
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index b2c2794..435adf1 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -38,6 +38,7 @@
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
+#include <linux/gpio.h>
#include <linux/regulator/consumer.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -48,6 +49,7 @@
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
+#include <sound/tlv320aic3x.h>
#include "tlv320aic3x.h"
@@ -65,6 +67,7 @@ struct aic3x_priv {
struct regulator_bulk_data supplies[AIC3X_NUM_SUPPLIES];
unsigned int sysclk;
int master;
+ int gpio_reset;
};
/*
@@ -1279,6 +1282,10 @@ static int aic3x_unregister(struct aic3x_priv *aic3x)
snd_soc_unregister_dai(&aic3x_dai);
snd_soc_unregister_codec(&aic3x->codec);
+ if (aic3x->gpio_reset >= 0) {
+ gpio_set_value(aic3x->gpio_reset, 0);
+ gpio_free(aic3x->gpio_reset);
+ }
regulator_bulk_disable(ARRAY_SIZE(aic3x->supplies), aic3x->supplies);
regulator_bulk_free(ARRAY_SIZE(aic3x->supplies), aic3x->supplies);
@@ -1303,6 +1310,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
{
struct snd_soc_codec *codec;
struct aic3x_priv *aic3x;
+ struct aic3x_pdata *pdata = i2c->dev.platform_data;
int ret, i;
aic3x = kzalloc(sizeof(struct aic3x_priv), GFP_KERNEL);
@@ -1319,6 +1327,15 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, aic3x);
+ aic3x->gpio_reset = -1;
+ if (pdata && pdata->gpio_reset >= 0) {
+ ret = gpio_request(pdata->gpio_reset, "tlv320aic3x reset");
+ if (ret != 0)
+ goto err_gpio;
+ aic3x->gpio_reset = pdata->gpio_reset;
+ gpio_direction_output(aic3x->gpio_reset, 0);
+ }
+
for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++)
aic3x->supplies[i].supply = aic3x_supply_names[i];
@@ -1336,11 +1353,19 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
goto err_enable;
}
+ if (aic3x->gpio_reset >= 0) {
+ udelay(1);
+ gpio_set_value(aic3x->gpio_reset, 1);
+ }
+
return aic3x_register(codec);
err_enable:
regulator_bulk_free(ARRAY_SIZE(aic3x->supplies), aic3x->supplies);
err_get:
+ if (aic3x->gpio_reset >= 0)
+ gpio_free(aic3x->gpio_reset);
+err_gpio:
kfree(aic3x);
return ret;
}
--
1.7.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
2010-05-05 10:02 [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling Jarkko Nikula
@ 2010-05-05 11:28 ` Mark Brown
2010-05-06 8:09 ` Peter Ujfalusi
2010-05-06 14:05 ` Liam Girdwood
2 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2010-05-05 11:28 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: alsa-devel, Peter Ujfalusi, Liam Girdwood
On Wed, May 05, 2010 at 01:02:03PM +0300, Jarkko Nikula wrote:
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
but...
> + if (aic3x->gpio_reset >= 0) {
> + gpio_set_value(aic3x->gpio_reset, 0);
> + gpio_free(aic3x->gpio_reset);
> + }
There is gpio_is_valid().
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
2010-05-05 10:02 [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling Jarkko Nikula
2010-05-05 11:28 ` Mark Brown
@ 2010-05-06 8:09 ` Peter Ujfalusi
2010-05-06 8:17 ` Liam Girdwood
2010-05-06 10:18 ` Jarkko Nikula
2010-05-06 14:05 ` Liam Girdwood
2 siblings, 2 replies; 9+ messages in thread
From: Peter Ujfalusi @ 2010-05-06 8:09 UTC (permalink / raw)
To: alsa-devel; +Cc: Mark Brown, Liam Girdwood
On Wednesday 05 May 2010 13:02:03 ext Jarkko Nikula wrote:
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
>
> ---
>
> v2:
>
> - Removed added regulator_bulk_disable brain fart from aic3x_i2c_probe
> - Added comment to gpio_reset number in aic3x_pdata
Would have been nice to have a commit message for this just in case.
Something like this would do:
Handle the reset GPIO within the codec driver in order to follow the startup
protocol for the tlv320aic3x codecs.
Can you Liam add this message (if Jarkko agrees)?
I can give my:
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Or
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Whichever you feel appropriate in case of the tlv320aic3x codec driver.
--
Péter
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
2010-05-06 8:09 ` Peter Ujfalusi
@ 2010-05-06 8:17 ` Liam Girdwood
2010-05-06 9:08 ` Peter Ujfalusi
2010-05-06 10:18 ` Jarkko Nikula
1 sibling, 1 reply; 9+ messages in thread
From: Liam Girdwood @ 2010-05-06 8:17 UTC (permalink / raw)
To: Peter Ujfalusi, Jarkko Nikula; +Cc: alsa-devel, Mark Brown
On Thu, 2010-05-06 at 11:09 +0300, Peter Ujfalusi wrote:
> On Wednesday 05 May 2010 13:02:03 ext Jarkko Nikula wrote:
> > Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> >
> > ---
> >
> > v2:
> >
> > - Removed added regulator_bulk_disable brain fart from aic3x_i2c_probe
> > - Added comment to gpio_reset number in aic3x_pdata
>
> Would have been nice to have a commit message for this just in case.
> Something like this would do:
> Handle the reset GPIO within the codec driver in order to follow the startup
> protocol for the tlv320aic3x codecs.
>
> Can you Liam add this message (if Jarkko agrees)?
I can add a message if required.
Thanks
Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
2010-05-06 8:17 ` Liam Girdwood
@ 2010-05-06 9:08 ` Peter Ujfalusi
2010-05-06 9:52 ` Mark Brown
0 siblings, 1 reply; 9+ messages in thread
From: Peter Ujfalusi @ 2010-05-06 9:08 UTC (permalink / raw)
To: ext Liam Girdwood; +Cc: alsa-devel@alsa-project.org, Mark Brown
On Thursday 06 May 2010 11:17:55 ext Liam Girdwood wrote:
>
> I can add a message if required.
I think it is always a good idea to explain what, and why the change.
In this case the change is not that obvious.
Also all machines, which are using the tlv320aic3x should be aware, that if they
do not have the reset GPIO (which they _should_), than they have to set the
gpio_reset to -1, unless they want to request gpio0 in the tlv320aic3x driver
for fun ;)
>
> Thanks
>
> Liam
--
Péter
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
2010-05-06 9:08 ` Peter Ujfalusi
@ 2010-05-06 9:52 ` Mark Brown
2010-05-06 11:23 ` Peter Ujfalusi
0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2010-05-06 9:52 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel@alsa-project.org, ext Liam Girdwood
On Thu, May 06, 2010 at 12:08:18PM +0300, Peter Ujfalusi wrote:
> Also all machines, which are using the tlv320aic3x should be aware, that if they
> do not have the reset GPIO (which they _should_), than they have to set the
> gpio_reset to -1, unless they want to request gpio0 in the tlv320aic3x driver
> for fun ;)
This should be relatively safe here since the platform data was added at
the same time - it's not changing the semantics underneath existing
code.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
2010-05-06 9:52 ` Mark Brown
@ 2010-05-06 11:23 ` Peter Ujfalusi
0 siblings, 0 replies; 9+ messages in thread
From: Peter Ujfalusi @ 2010-05-06 11:23 UTC (permalink / raw)
To: ext Mark Brown; +Cc: alsa-devel@alsa-project.org, ext Liam Girdwood
On Thursday 06 May 2010 12:52:13 ext Mark Brown wrote:
> On Thu, May 06, 2010 at 12:08:18PM +0300, Peter Ujfalusi wrote:
> > Also all machines, which are using the tlv320aic3x should be aware, that
> > if they do not have the reset GPIO (which they _should_), than they have
> > to set the gpio_reset to -1, unless they want to request gpio0 in the
> > tlv320aic3x driver for fun ;)
>
> This should be relatively safe here since the platform data was added at
> the same time - it's not changing the semantics underneath existing
> code.
Yes, it is actually _safe_
--
Péter
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
2010-05-06 8:09 ` Peter Ujfalusi
2010-05-06 8:17 ` Liam Girdwood
@ 2010-05-06 10:18 ` Jarkko Nikula
1 sibling, 0 replies; 9+ messages in thread
From: Jarkko Nikula @ 2010-05-06 10:18 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, Mark Brown, Liam Girdwood
On Thu, 6 May 2010 11:09:34 +0300
Peter Ujfalusi <peter.ujfalusi@nokia.com> wrote:
> On Wednesday 05 May 2010 13:02:03 ext Jarkko Nikula wrote:
> > Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> >
> > ---
> >
> > v2:
> >
> > - Removed added regulator_bulk_disable brain fart from aic3x_i2c_probe
> > - Added comment to gpio_reset number in aic3x_pdata
>
> Would have been nice to have a commit message for this just in case.
> Something like this would do:
> Handle the reset GPIO within the codec driver in order to follow the startup
> protocol for the tlv320aic3x codecs.
>
> Can you Liam add this message (if Jarkko agrees)?
>
Yeah, Peter is right. Even this reset 'protocol' is business as usual,
reset is released after voltages are stabilized, this is kind of fix to
patch adding regulator support so the commit message is nice be there.
--
Jarkko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling
2010-05-05 10:02 [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling Jarkko Nikula
2010-05-05 11:28 ` Mark Brown
2010-05-06 8:09 ` Peter Ujfalusi
@ 2010-05-06 14:05 ` Liam Girdwood
2 siblings, 0 replies; 9+ messages in thread
From: Liam Girdwood @ 2010-05-06 14:05 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: alsa-devel, Mark Brown, Peter Ujfalusi
On Wed, 2010-05-05 at 13:02 +0300, Jarkko Nikula wrote:
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
>
> ---
>
> v2:
>
> - Removed added regulator_bulk_disable brain fart from aic3x_i2c_probe
> - Added comment to gpio_reset number in aic3x_pdata
> ---
> include/sound/tlv320aic3x.h | 17 +++++++++++++++++
> sound/soc/codecs/tlv320aic3x.c | 25 +++++++++++++++++++++++++
> 2 files changed, 42 insertions(+), 0 deletions(-)
> create mode 100644 include/sound/tlv320aic3x.h
>
Applied with commit message.
Thanks
Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-05-06 14:05 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05 10:02 [PATCHv2] ASoC: tlv320aic3x: Add platform data and reset gpio handling Jarkko Nikula
2010-05-05 11:28 ` Mark Brown
2010-05-06 8:09 ` Peter Ujfalusi
2010-05-06 8:17 ` Liam Girdwood
2010-05-06 9:08 ` Peter Ujfalusi
2010-05-06 9:52 ` Mark Brown
2010-05-06 11:23 ` Peter Ujfalusi
2010-05-06 10:18 ` Jarkko Nikula
2010-05-06 14:05 ` Liam Girdwood
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).