All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration
@ 2009-05-22  7:13 Peter Ujfalusi
  2009-05-22  7:13 ` [PATCH 1/2 take2] ASoC: TWL4030: Add support for platform dependent configuration Peter Ujfalusi
  2009-05-22  9:28 ` [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration Mark Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2009-05-22  7:13 UTC (permalink / raw)
  To: alsa-devel; +Cc: sakoman, anuj.aggarwal, getarunks, broonie

Hello,

I have found few typos in the patches, resending...

he following series adds support for platform dependent Headset pop removal
configuration for the twl4030 codec.

Platform drivers can fill the twl4030_setup_data structure and pass it with
snd_soc_device->codec_data to the codec driver.

As an example - based on the feedback for the ramp_delay value variations - the
sdp3430.c board is updated to pass the correct ramp settings.

If you know for the other platforms using the twl4030 codec the correct HS ramp
configuration, please update those files...

Mark: This series needs the DAPM restructuring and HS pop removal related
patches for twl4030 codec.

---
Peter Ujfalusi (2):
  ASoC: TWL4030: Add support for platform dependent configuration
  ASoC: SDP4030: Use the twl4030_setup_data for headset pop-removal

 sound/soc/codecs/twl4030.c |   22 +++++++++++++++++++---
 sound/soc/codecs/twl4030.h |    5 +++++
 sound/soc/omap/sdp3430.c   |    7 +++++++
 3 files changed, 31 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2 take2] ASoC: TWL4030: Add support for platform dependent configuration
  2009-05-22  7:13 [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration Peter Ujfalusi
@ 2009-05-22  7:13 ` Peter Ujfalusi
  2009-05-22  7:13   ` [PATCH 2/2 take2] ASoC: SDP4030: Use the twl4030_setup_data for headset pop-removal Peter Ujfalusi
  2009-05-22  9:28 ` [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration Mark Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Ujfalusi @ 2009-05-22  7:13 UTC (permalink / raw)
  To: alsa-devel; +Cc: sakoman, anuj.aggarwal, getarunks, broonie

twl4030_setup_data structure can be passed from platform drivers to
the codec via the snd_soc_device->codec_data pointer.

Currently the setup data has support for the Headset pop-removal
related configuration, which differs from board to board.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
 sound/soc/codecs/twl4030.c |   22 +++++++++++++++++++---
 sound/soc/codecs/twl4030.h |    5 +++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index f554672..584507f 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1997,6 +1997,8 @@ static int twl4030_resume(struct platform_device *pdev)
 static int twl4030_init(struct snd_soc_device *socdev)
 {
 	struct snd_soc_codec *codec = socdev->card->codec;
+	struct twl4030_setup_data *setup = socdev->codec_data;
+	struct twl4030_priv *twl4030 = codec->private_data;
 	int ret = 0;

 	printk(KERN_INFO "TWL4030 Audio Codec init \n");
@@ -2014,6 +2016,23 @@ static int twl4030_init(struct snd_soc_device *socdev)
 	if (codec->reg_cache == NULL)
 		return -ENOMEM;

+	/* Configuration for headset ramp delay from setup data */
+	if (setup) {
+		unsigned char hs_pop;
+
+		if (setup->sysclk)
+			twl4030->sysclk = setup->sysclk;
+		else
+			twl4030->sysclk = 26000;
+
+		hs_pop = twl4030_read_reg_cache(codec, TWL4030_REG_HS_POPN_SET);
+		hs_pop &= ~TWL4030_RAMP_DELAY;
+		hs_pop |= (setup->ramp_delay_value << 2);
+		twl4030_write_reg_cache(codec, TWL4030_REG_HS_POPN_SET, hs_pop);
+	} else {
+		twl4030->sysclk = 26000;
+	}
+
 	/* register pcms */
 	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
 	if (ret < 0) {
@@ -2063,9 +2082,6 @@ static int twl4030_probe(struct platform_device *pdev)
 		kfree(codec);
 		return -ENOMEM;
 	}
-	/* Set default sysclk (used by the headsetl/rpga_event callback for
-	 * pop-attenuation) */
-	twl4030->sysclk = 26000;

 	codec->private_data = twl4030;
 	socdev->card->codec = codec;
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h
index 9668bdf..48326e2 100644
--- a/sound/soc/codecs/twl4030.h
+++ b/sound/soc/codecs/twl4030.h
@@ -266,4 +266,9 @@
 extern struct snd_soc_dai twl4030_dai[2];
 extern struct snd_soc_codec_device soc_codec_dev_twl4030;

+struct twl4030_setup_data {
+	unsigned int ramp_delay_value;
+	unsigned int sysclk;
+};
+
 #endif	/* End of __TWL4030_AUDIO_H__ */
--
1.6.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2 take2] ASoC: SDP4030: Use the twl4030_setup_data for headset pop-removal
  2009-05-22  7:13 ` [PATCH 1/2 take2] ASoC: TWL4030: Add support for platform dependent configuration Peter Ujfalusi
@ 2009-05-22  7:13   ` Peter Ujfalusi
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2009-05-22  7:13 UTC (permalink / raw)
  To: alsa-devel; +Cc: sakoman, anuj.aggarwal, getarunks, broonie

With this patch the initial headset pop-removal related values are
configured for the twl4030 codec (ramp delay and sysclk).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
 sound/soc/omap/sdp3430.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 19966a7..b719e5d 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -276,10 +276,17 @@ static struct snd_soc_card snd_soc_sdp3430 = {
 	.num_links = ARRAY_SIZE(sdp3430_dai),
 };

+/* twl4030 setup */
+static struct twl4030_setup_data twl4030_setup = {
+	.ramp_delay_value = 3,
+	.sysclk = 26000,
+};
+
 /* Audio subsystem */
 static struct snd_soc_device sdp3430_snd_devdata = {
 	.card = &snd_soc_sdp3430,
 	.codec_dev = &soc_codec_dev_twl4030,
+	.codec_data = &twl4030_setup,
 };

 static struct platform_device *sdp3430_snd_device;
--
1.6.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration
  2009-05-22  7:13 [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration Peter Ujfalusi
  2009-05-22  7:13 ` [PATCH 1/2 take2] ASoC: TWL4030: Add support for platform dependent configuration Peter Ujfalusi
@ 2009-05-22  9:28 ` Mark Brown
  2009-05-22  9:57   ` Peter Ujfalusi
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2009-05-22  9:28 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: sakoman, anuj.aggarwal, alsa-devel, getarunks

On Fri, May 22, 2009 at 10:13:14AM +0300, Peter Ujfalusi wrote:

> he following series adds support for platform dependent Headset pop removal
> configuration for the twl4030 codec.

> Platform drivers can fill the twl4030_setup_data structure and pass it with
> snd_soc_device->codec_data to the codec driver.

I've applied both.  It'd be really good if you could look into
converting the TWL4030 driver into a regular platform driver, probing
via the normal methods, so it could get this data as regular platform
data.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration
  2009-05-22  9:28 ` [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration Mark Brown
@ 2009-05-22  9:57   ` Peter Ujfalusi
  2009-05-22 10:23     ` [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp?configuration Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Ujfalusi @ 2009-05-22  9:57 UTC (permalink / raw)
  To: ext Mark Brown
  Cc: sakoman@gmail.com, anuj.aggarwal@ti.com,
	alsa-devel@alsa-project.org, getarunks@gmail.com

On Friday 22 May 2009 12:28:07 ext Mark Brown wrote:
> I've applied both.  It'd be really good if you could look into
> converting the TWL4030 driver into a regular platform driver, probing
> via the normal methods, so it could get this data as regular platform
> data.

Thanks, any pointers for such an implementation?

Do we need to convert the codec driver(s) to use the 
platform_device_register/platform_driver_register, or is it more feasible to 
convert the platform drivers (for example sound/soc/omap/omap3beagle.c)?

-- 
Péter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp?configuration
  2009-05-22  9:57   ` Peter Ujfalusi
@ 2009-05-22 10:23     ` Mark Brown
  2009-05-22 13:01       ` Peter Ujfalusi
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2009-05-22 10:23 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: sakoman@gmail.com, anuj.aggarwal@ti.com,
	alsa-devel@alsa-project.org, getarunks@gmail.com

On Fri, May 22, 2009 at 12:57:23PM +0300, Peter Ujfalusi wrote:
> On Friday 22 May 2009 12:28:07 ext Mark Brown wrote:

> > I've applied both.  It'd be really good if you could look into
> > converting the TWL4030 driver into a regular platform driver, probing
> > via the normal methods, so it could get this data as regular platform
> > data.

> Thanks, any pointers for such an implementation?

wm8350 and wm8400 are similar chips with audio blocked in with other
functionality.

> Do we need to convert the codec driver(s) to use the 
> platform_device_register/platform_driver_register, or is it more feasible to 
> convert the platform drivers (for example sound/soc/omap/omap3beagle.c)?

The idea is that the device registration gets done either in arch/arm
or in drivers/mfd - the intention is to make things look much more like
the standard device model.  For twl4030 I'd expect it to be done in
drivers/mfd.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp?configuration
  2009-05-22 10:23     ` [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp?configuration Mark Brown
@ 2009-05-22 13:01       ` Peter Ujfalusi
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2009-05-22 13:01 UTC (permalink / raw)
  To: ext Mark Brown
  Cc: sakoman@gmail.com, anuj.aggarwal@ti.com,
	alsa-devel@alsa-project.org, getarunks@gmail.com

On Friday 22 May 2009 13:23:55 ext Mark Brown wrote:
> On Fri, May 22, 2009 at 12:57:23PM +0300, Peter Ujfalusi wrote:
> > On Friday 22 May 2009 12:28:07 ext Mark Brown wrote:
> > > I've applied both.  It'd be really good if you could look into
> > > converting the TWL4030 driver into a regular platform driver, probing
> > > via the normal methods, so it could get this data as regular platform
> > > data.
> >
> > Thanks, any pointers for such an implementation?
>
> wm8350 and wm8400 are similar chips with audio blocked in with other
> functionality.
>
> > Do we need to convert the codec driver(s) to use the
> > platform_device_register/platform_driver_register, or is it more feasible
> > to convert the platform drivers (for example
> > sound/soc/omap/omap3beagle.c)?
>
> The idea is that the device registration gets done either in arch/arm
> or in drivers/mfd - the intention is to make things look much more like
> the standard device model.  For twl4030 I'd expect it to be done in
> drivers/mfd.

I see.
After a quick check: it needs some modification for the 
include/linux/i2c/twl4030.h:
New struct for the twl4030_codec, adding that to the existing
twl4030_platform_data.

Than modification to drivers/mfd/twl4030-core.c:
Adding the audio codec as new child.
Modifying the arch/arm/mach-omap*/ board files to fill up the new audio codec 
struct and include it to their twl4030_platform_data.

Than some modification to the twl4030.c codec in sound/soc/codec/

Or something along these lines...

I'll keep this in mind and try to prepare for it in the near future.

Thanks for the clarification,
Péter

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-22 13:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-22  7:13 [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration Peter Ujfalusi
2009-05-22  7:13 ` [PATCH 1/2 take2] ASoC: TWL4030: Add support for platform dependent configuration Peter Ujfalusi
2009-05-22  7:13   ` [PATCH 2/2 take2] ASoC: SDP4030: Use the twl4030_setup_data for headset pop-removal Peter Ujfalusi
2009-05-22  9:28 ` [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp configuration Mark Brown
2009-05-22  9:57   ` Peter Ujfalusi
2009-05-22 10:23     ` [PATCH 0/2 take2] SoC: TWL4030 and SDP3430 HS ramp?configuration Mark Brown
2009-05-22 13:01       ` Peter Ujfalusi

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.