* [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9
@ 2013-01-11 16:00 Peter Ujfalusi
2013-01-11 16:00 ` [PATCH v2 1/5] ASoC: twl6040: Convert PLUGINT to no-suspend irq Peter Ujfalusi
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2013-01-11 16:00 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: Misael Lopez Cruz, alsa-devel
Hi Mark, Liam,
Changes since v1:
- patch 2 for twl6040_resume() has been replaced with a simpler one
Cover letter from v1:
Small fixe from Misael for twl6040 codec driver and devm_* conversion, switch
to system workqueue and dead code removal.
Regards,
Peter
---
Misael Lopez Cruz (1):
ASoC: twl6040: Convert PLUGINT to no-suspend irq
Peter Ujfalusi (4):
ASoC: twl6040: Only set the bias_level once in twl6040_resume()
ASoC: twl6040: Convert to use devm_* when possible
ASoC: twl6040: Switch to use system workqueue for jack reporting
ASoC: twl6040: Remove leftover code from hs/hf ramp implementation
sound/soc/codecs/twl6040.c | 62 +++++++---------------------------------------
1 file changed, 9 insertions(+), 53 deletions(-)
--
1.8.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/5] ASoC: twl6040: Convert PLUGINT to no-suspend irq
2013-01-11 16:00 [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Peter Ujfalusi
@ 2013-01-11 16:00 ` Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 2/5] ASoC: twl6040: Only set the bias_level once in twl6040_resume() Peter Ujfalusi
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2013-01-11 16:00 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: Misael Lopez Cruz, alsa-devel
From: Misael Lopez Cruz <misael.lopez@ti.com>
Convert headset PLUGINT interrupt to NO_SUSPEND type in order to
allow handling of insertion/removal events while device is suspended.
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/codecs/twl6040.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 3fc3fc6..ef31ace 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -1174,7 +1174,7 @@ static int twl6040_probe(struct snd_soc_codec *codec)
mutex_init(&priv->mutex);
ret = request_threaded_irq(priv->plug_irq, NULL, twl6040_audio_handler,
- 0, "twl6040_irq_plug", codec);
+ IRQF_NO_SUSPEND, "twl6040_irq_plug", codec);
if (ret) {
dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret);
goto plugirq_err;
--
1.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/5] ASoC: twl6040: Only set the bias_level once in twl6040_resume()
2013-01-11 16:00 [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Peter Ujfalusi
2013-01-11 16:00 ` [PATCH v2 1/5] ASoC: twl6040: Convert PLUGINT to no-suspend irq Peter Ujfalusi
@ 2013-01-11 16:01 ` Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 3/5] ASoC: twl6040: Convert to use devm_* when possible Peter Ujfalusi
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2013-01-11 16:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: Misael Lopez Cruz, alsa-devel
No need to set the bias_level twice to _STANDBY - since this is the only
state the device could be at suspend time. The driver do not support
idle_bias_off yet.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/codecs/twl6040.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index ef31ace..86f12a4 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -1115,7 +1115,6 @@ static int twl6040_suspend(struct snd_soc_codec *codec)
static int twl6040_resume(struct snd_soc_codec *codec)
{
twl6040_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
- twl6040_set_bias_level(codec, codec->dapm.suspend_bias_level);
return 0;
}
--
1.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/5] ASoC: twl6040: Convert to use devm_* when possible
2013-01-11 16:00 [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Peter Ujfalusi
2013-01-11 16:00 ` [PATCH v2 1/5] ASoC: twl6040: Convert PLUGINT to no-suspend irq Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 2/5] ASoC: twl6040: Only set the bias_level once in twl6040_resume() Peter Ujfalusi
@ 2013-01-11 16:01 ` Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 4/5] ASoC: twl6040: Switch to use system workqueue for jack reporting Peter Ujfalusi
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2013-01-11 16:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: Misael Lopez Cruz, alsa-devel
In this way we can clean up the probe and remove paths
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/codecs/twl6040.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 86f12a4..90b721e 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -1131,9 +1131,10 @@ static int twl6040_probe(struct snd_soc_codec *codec)
struct platform_device, dev);
int ret = 0;
- priv = kzalloc(sizeof(struct twl6040_data), GFP_KERNEL);
+ priv = devm_kzalloc(codec->dev, sizeof(*priv), GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
+
snd_soc_codec_set_drvdata(codec, priv);
priv->codec = codec;
@@ -1158,25 +1159,23 @@ static int twl6040_probe(struct snd_soc_codec *codec)
priv->plug_irq = platform_get_irq(pdev, 0);
if (priv->plug_irq < 0) {
dev_err(codec->dev, "invalid irq\n");
- ret = -EINVAL;
- goto work_err;
+ return -EINVAL;
}
priv->workqueue = alloc_workqueue("twl6040-codec", 0, 0);
- if (!priv->workqueue) {
- ret = -ENOMEM;
- goto work_err;
- }
+ if (!priv->workqueue)
+ return -ENOMEM;
INIT_DELAYED_WORK(&priv->hs_jack.work, twl6040_accessory_work);
mutex_init(&priv->mutex);
- ret = request_threaded_irq(priv->plug_irq, NULL, twl6040_audio_handler,
- IRQF_NO_SUSPEND, "twl6040_irq_plug", codec);
+ ret = devm_request_threaded_irq(codec->dev, priv->plug_irq, NULL,
+ twl6040_audio_handler, IRQF_NO_SUSPEND,
+ "twl6040_irq_plug", codec);
if (ret) {
dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret);
- goto plugirq_err;
+ goto err;
}
twl6040_init_chip(codec);
@@ -1186,12 +1185,8 @@ static int twl6040_probe(struct snd_soc_codec *codec)
if (!ret)
return 0;
- /* Error path */
- free_irq(priv->plug_irq, codec);
-plugirq_err:
+err:
destroy_workqueue(priv->workqueue);
-work_err:
- kfree(priv);
return ret;
}
@@ -1200,9 +1195,7 @@ static int twl6040_remove(struct snd_soc_codec *codec)
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
- free_irq(priv->plug_irq, codec);
destroy_workqueue(priv->workqueue);
- kfree(priv);
return 0;
}
--
1.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/5] ASoC: twl6040: Switch to use system workqueue for jack reporting
2013-01-11 16:00 [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Peter Ujfalusi
` (2 preceding siblings ...)
2013-01-11 16:01 ` [PATCH v2 3/5] ASoC: twl6040: Convert to use devm_* when possible Peter Ujfalusi
@ 2013-01-11 16:01 ` Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 5/5] ASoC: twl6040: Remove leftover code from hs/hf ramp implementation Peter Ujfalusi
2013-01-11 23:56 ` [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Mark Brown
5 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2013-01-11 16:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: Misael Lopez Cruz, alsa-devel
There's no need to create a queue for this anymore
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/codecs/twl6040.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 90b721e..984911b 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -75,7 +75,6 @@ struct twl6040_data {
u16 hf_right_step;
struct twl6040_jack_data hs_jack;
struct snd_soc_codec *codec;
- struct workqueue_struct *workqueue;
struct mutex mutex;
};
@@ -404,8 +403,7 @@ static irqreturn_t twl6040_audio_handler(int irq, void *data)
struct snd_soc_codec *codec = data;
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
- queue_delayed_work(priv->workqueue, &priv->hs_jack.work,
- msecs_to_jiffies(200));
+ schedule_delayed_work(&priv->hs_jack.work, msecs_to_jiffies(200));
return IRQ_HANDLED;
}
@@ -1162,10 +1160,6 @@ static int twl6040_probe(struct snd_soc_codec *codec)
return -EINVAL;
}
- priv->workqueue = alloc_workqueue("twl6040-codec", 0, 0);
- if (!priv->workqueue)
- return -ENOMEM;
-
INIT_DELAYED_WORK(&priv->hs_jack.work, twl6040_accessory_work);
mutex_init(&priv->mutex);
@@ -1175,27 +1169,18 @@ static int twl6040_probe(struct snd_soc_codec *codec)
"twl6040_irq_plug", codec);
if (ret) {
dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret);
- goto err;
+ return ret;
}
twl6040_init_chip(codec);
/* power on device */
- ret = twl6040_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
- if (!ret)
- return 0;
-
-err:
- destroy_workqueue(priv->workqueue);
- return ret;
+ return twl6040_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
}
static int twl6040_remove(struct snd_soc_codec *codec)
{
- struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
-
twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
- destroy_workqueue(priv->workqueue);
return 0;
}
--
1.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 5/5] ASoC: twl6040: Remove leftover code from hs/hf ramp implementation
2013-01-11 16:00 [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Peter Ujfalusi
` (3 preceding siblings ...)
2013-01-11 16:01 ` [PATCH v2 4/5] ASoC: twl6040: Switch to use system workqueue for jack reporting Peter Ujfalusi
@ 2013-01-11 16:01 ` Peter Ujfalusi
2013-01-11 23:56 ` [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Mark Brown
5 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2013-01-11 16:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: Misael Lopez Cruz, alsa-devel
The code to do the ramp has been removed a long time ago. Remove the
remaining code as well since this is not needed.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/codecs/twl6040.c | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 984911b..9b9a6e5 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -69,10 +69,6 @@ struct twl6040_data {
int hs_power_mode_locked;
unsigned int clk_in;
unsigned int sysclk;
- u16 hs_left_step;
- u16 hs_right_step;
- u16 hf_left_step;
- u16 hf_right_step;
struct twl6040_jack_data hs_jack;
struct snd_soc_codec *codec;
struct mutex mutex;
@@ -1124,7 +1120,6 @@ static int twl6040_resume(struct snd_soc_codec *codec)
static int twl6040_probe(struct snd_soc_codec *codec)
{
struct twl6040_data *priv;
- struct twl6040_codec_data *pdata = dev_get_platdata(codec->dev);
struct platform_device *pdev = container_of(codec->dev,
struct platform_device, dev);
int ret = 0;
@@ -1138,22 +1133,6 @@ static int twl6040_probe(struct snd_soc_codec *codec)
priv->codec = codec;
codec->control_data = dev_get_drvdata(codec->dev->parent);
- if (pdata && pdata->hs_left_step && pdata->hs_right_step) {
- priv->hs_left_step = pdata->hs_left_step;
- priv->hs_right_step = pdata->hs_right_step;
- } else {
- priv->hs_left_step = 1;
- priv->hs_right_step = 1;
- }
-
- if (pdata && pdata->hf_left_step && pdata->hf_right_step) {
- priv->hf_left_step = pdata->hf_left_step;
- priv->hf_right_step = pdata->hf_right_step;
- } else {
- priv->hf_left_step = 1;
- priv->hf_right_step = 1;
- }
-
priv->plug_irq = platform_get_irq(pdev, 0);
if (priv->plug_irq < 0) {
dev_err(codec->dev, "invalid irq\n");
--
1.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9
2013-01-11 16:00 [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Peter Ujfalusi
` (4 preceding siblings ...)
2013-01-11 16:01 ` [PATCH v2 5/5] ASoC: twl6040: Remove leftover code from hs/hf ramp implementation Peter Ujfalusi
@ 2013-01-11 23:56 ` Mark Brown
5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2013-01-11 23:56 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: Misael Lopez Cruz, Liam Girdwood, alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 199 bytes --]
On Fri, Jan 11, 2013 at 05:00:58PM +0100, Peter Ujfalusi wrote:
> Hi Mark, Liam,
>
> Changes since v1:
> - patch 2 for twl6040_resume() has been replaced with a simpler one
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-01-11 23:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 16:00 [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 Peter Ujfalusi
2013-01-11 16:00 ` [PATCH v2 1/5] ASoC: twl6040: Convert PLUGINT to no-suspend irq Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 2/5] ASoC: twl6040: Only set the bias_level once in twl6040_resume() Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 3/5] ASoC: twl6040: Convert to use devm_* when possible Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 4/5] ASoC: twl6040: Switch to use system workqueue for jack reporting Peter Ujfalusi
2013-01-11 16:01 ` [PATCH v2 5/5] ASoC: twl6040: Remove leftover code from hs/hf ramp implementation Peter Ujfalusi
2013-01-11 23:56 ` [PATCH v2 0/5] ASoC: twl6040: Updates for 3.9 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).