* [PATCH 1/3] sound/spitz: Properly handle MIC GPIO
@ 2011-04-02 1:43 Marek Vasut
2011-04-02 1:43 ` [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c Marek Vasut
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Marek Vasut @ 2011-04-02 1:43 UTC (permalink / raw)
To: linux-arm-kernel
This patch firstly restructurizes the code a bit by getting rid of continuous
checking for machine type in spitz_mic_bias().
Then the patch properly requests the MIC GPIO in the spitz_init() and frees it
in spitz_exit().
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
sound/soc/pxa/spitz.c | 41 +++++++++++++++++++++++++++++------------
1 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index 8e15713..b253d86 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -42,6 +42,7 @@
static int spitz_jack_func;
static int spitz_spk_func;
+static int spitz_mic_gpio;
static void spitz_ext_control(struct snd_soc_codec *codec)
{
@@ -217,14 +218,7 @@ static int spitz_set_spk(struct snd_kcontrol *kcontrol,
static int spitz_mic_bias(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- if (machine_is_borzoi() || machine_is_spitz())
- gpio_set_value(SPITZ_GPIO_MIC_BIAS,
- SND_SOC_DAPM_EVENT_ON(event));
-
- if (machine_is_akita())
- gpio_set_value(AKITA_GPIO_MIC_BIAS,
- SND_SOC_DAPM_EVENT_ON(event));
-
+ gpio_set_value_cansleep(spitz_mic_gpio, SND_SOC_DAPM_EVENT_ON(event));
return 0;
}
@@ -339,22 +333,45 @@ static int __init spitz_init(void)
if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita()))
return -ENODEV;
+ if (machine_is_borzoi() || machine_is_spitz())
+ spitz_mic_gpio = SPITZ_GPIO_MIC_BIAS;
+ else
+ spitz_mic_gpio = AKITA_GPIO_MIC_BIAS;
+
+ ret = gpio_request(spitz_mic_gpio, "MIC GPIO");
+ if (ret)
+ goto err1;
+
+ ret = gpio_direction_output(spitz_mic_gpio, 0);
+ if (ret)
+ goto err2;
+
spitz_snd_device = platform_device_alloc("soc-audio", -1);
- if (!spitz_snd_device)
- return -ENOMEM;
+ if (!spitz_snd_device) {
+ ret = -ENOMEM;
+ goto err2;
+ }
platform_set_drvdata(spitz_snd_device, &snd_soc_spitz);
- ret = platform_device_add(spitz_snd_device);
+ ret = platform_device_add(spitz_snd_device);
if (ret)
- platform_device_put(spitz_snd_device);
+ goto err3;
+
+ return 0;
+err3:
+ platform_device_put(spitz_snd_device);
+err2:
+ gpio_free(spitz_mic_gpio);
+err1:
return ret;
}
static void __exit spitz_exit(void)
{
platform_device_unregister(spitz_snd_device);
+ gpio_free(spitz_mic_gpio);
}
module_init(spitz_init);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-02 1:43 [PATCH 1/3] sound/spitz: Properly handle MIC GPIO Marek Vasut
@ 2011-04-02 1:43 ` Marek Vasut
2011-04-04 10:45 ` Eric Miao
2011-04-02 1:43 ` [PATCH 3/3] PXA: Reorganise pxa2xx_base init() function Marek Vasut
2011-04-03 13:18 ` [PATCH 1/3] sound/spitz: Properly handle MIC GPIO Mark Brown
2 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2011-04-02 1:43 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
drivers/video/backlight/corgi_lcd.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 1e71c35..8c80cb7 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -409,10 +409,10 @@ static int corgi_bl_set_intensity(struct corgi_lcd *lcd, int intensity)
cont = !!(intensity & 0x20) ^ lcd->gpio_backlight_cont_inverted;
if (gpio_is_valid(lcd->gpio_backlight_cont))
- gpio_set_value(lcd->gpio_backlight_cont, cont);
+ gpio_set_value_cansleep(lcd->gpio_backlight_cont, cont);
if (gpio_is_valid(lcd->gpio_backlight_on))
- gpio_set_value(lcd->gpio_backlight_on, intensity);
+ gpio_set_value_cansleep(lcd->gpio_backlight_on, intensity);
if (lcd->kick_battery)
lcd->kick_battery();
--
1.7.4.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] PXA: Reorganise pxa2xx_base init() function
2011-04-02 1:43 [PATCH 1/3] sound/spitz: Properly handle MIC GPIO Marek Vasut
2011-04-02 1:43 ` [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c Marek Vasut
@ 2011-04-02 1:43 ` Marek Vasut
2011-04-03 13:18 ` [PATCH 1/3] sound/spitz: Properly handle MIC GPIO Mark Brown
2 siblings, 0 replies; 12+ messages in thread
From: Marek Vasut @ 2011-04-02 1:43 UTC (permalink / raw)
To: linux-arm-kernel
This kills dead code and kills some redundant code.
Original idea by: Cyril Hrubis <metan@ucw.cz>
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
drivers/pcmcia/pxa2xx_base.c | 30 +++++++++++++-----------------
1 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 2c54054..687d203 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -296,18 +296,20 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
goto err0;
}
- clk = clk_get(&dev->dev, NULL);
- if (!clk)
- return -ENODEV;
-
- pxa2xx_drv_pcmcia_ops(ops);
-
sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL);
if (!sinfo) {
- clk_put(clk);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto err0;
}
+ clk = clk_get(&dev->dev, NULL);
+ if (!clk) {
+ ret = -ENODEV;
+ goto err0;
+ }
+
+ pxa2xx_drv_pcmcia_ops(ops);
+
sinfo->nskt = ops->nr;
sinfo->clk = clk;
@@ -327,15 +329,8 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
goto err1;
}
- if (ret) {
- while (--i >= 0)
- soc_pcmcia_remove_one(&sinfo->skt[i]);
- kfree(sinfo);
- clk_put(clk);
- } else {
- pxa2xx_configure_sockets(&dev->dev);
- dev_set_drvdata(&dev->dev, sinfo);
- }
+ pxa2xx_configure_sockets(&dev->dev);
+ dev_set_drvdata(&dev->dev, sinfo);
return 0;
@@ -343,6 +338,7 @@ err1:
while (--i >= 0)
soc_pcmcia_remove_one(&sinfo->skt[i]);
kfree(sinfo);
+ clk_put(clk);
err0:
return ret;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 1/3] sound/spitz: Properly handle MIC GPIO
2011-04-02 1:43 [PATCH 1/3] sound/spitz: Properly handle MIC GPIO Marek Vasut
2011-04-02 1:43 ` [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c Marek Vasut
2011-04-02 1:43 ` [PATCH 3/3] PXA: Reorganise pxa2xx_base init() function Marek Vasut
@ 2011-04-03 13:18 ` Mark Brown
2 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2011-04-03 13:18 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Apr 02, 2011 at 03:43:15AM +0200, Marek Vasut wrote:
> This patch firstly restructurizes the code a bit by getting rid of continuous
> checking for machine type in spitz_mic_bias().
>
> Then the patch properly requests the MIC GPIO in the spitz_init() and frees it
> in spitz_exit().
>
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-02 1:43 ` [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c Marek Vasut
@ 2011-04-04 10:45 ` Eric Miao
2011-04-04 12:06 ` Mark Brown
2011-04-10 7:58 ` Pavel Machek
0 siblings, 2 replies; 12+ messages in thread
From: Eric Miao @ 2011-04-04 10:45 UTC (permalink / raw)
To: linux-arm-kernel
Personally, I don't quite like the idea of an explicit _cansleep() version,
which is just confusing. A programmer shouldn't be aware of which
version to use.
David, you have any justification?
On Sat, Apr 2, 2011 at 9:43 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> ---
> ?drivers/video/backlight/corgi_lcd.c | ? ?4 ++--
> ?1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
> index 1e71c35..8c80cb7 100644
> --- a/drivers/video/backlight/corgi_lcd.c
> +++ b/drivers/video/backlight/corgi_lcd.c
> @@ -409,10 +409,10 @@ static int corgi_bl_set_intensity(struct corgi_lcd *lcd, int intensity)
> ? ? ? ?cont = !!(intensity & 0x20) ^ lcd->gpio_backlight_cont_inverted;
>
> ? ? ? ?if (gpio_is_valid(lcd->gpio_backlight_cont))
> - ? ? ? ? ? ? ? gpio_set_value(lcd->gpio_backlight_cont, cont);
> + ? ? ? ? ? ? ? gpio_set_value_cansleep(lcd->gpio_backlight_cont, cont);
>
> ? ? ? ?if (gpio_is_valid(lcd->gpio_backlight_on))
> - ? ? ? ? ? ? ? gpio_set_value(lcd->gpio_backlight_on, intensity);
> + ? ? ? ? ? ? ? gpio_set_value_cansleep(lcd->gpio_backlight_on, intensity);
>
> ? ? ? ?if (lcd->kick_battery)
> ? ? ? ? ? ? ? ?lcd->kick_battery();
> --
> 1.7.4.1
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-04 10:45 ` Eric Miao
@ 2011-04-04 12:06 ` Mark Brown
2011-04-04 12:33 ` Eric Miao
2011-04-10 7:58 ` Pavel Machek
1 sibling, 1 reply; 12+ messages in thread
From: Mark Brown @ 2011-04-04 12:06 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 04, 2011 at 06:45:46PM +0800, Eric Miao wrote:
> Personally, I don't quite like the idea of an explicit _cansleep() version,
> which is just confusing. A programmer shouldn't be aware of which
> version to use.
When working in interrupt context you need to pay attention to this
stuff; personally I'd prefer an explict IRQ safe version but YMMV. The
only use the code makes of this is to generate warnings to make problems
easier to diagnose.
> David, you have any justification?
Sadly David passed away recently.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-04 12:06 ` Mark Brown
@ 2011-04-04 12:33 ` Eric Miao
2011-04-04 12:44 ` Marek Vasut
0 siblings, 1 reply; 12+ messages in thread
From: Eric Miao @ 2011-04-04 12:33 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 4, 2011 at 8:06 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Mon, Apr 04, 2011 at 06:45:46PM +0800, Eric Miao wrote:
>> Personally, I don't quite like the idea of an explicit _cansleep() version,
>> which is just confusing. A programmer shouldn't be aware of which
>> version to use.
>
> When working in interrupt context you need to pay attention to this
> stuff; personally I'd prefer an explict IRQ safe version but YMMV. ?The
> only use the code makes of this is to generate warnings to make problems
> easier to diagnose.
>
>> David, you have any justification?
>
> Sadly David passed away recently.
>
What????!!!!????? I didn't know that.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-04 12:33 ` Eric Miao
@ 2011-04-04 12:44 ` Marek Vasut
2011-04-04 12:49 ` Russell King - ARM Linux
0 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2011-04-04 12:44 UTC (permalink / raw)
To: linux-arm-kernel
> On Mon, Apr 4, 2011 at 8:06 PM, Mark Brown
> <broonie@opensource.wolfsonmicro.com> wrote:
> > On Mon, Apr 04, 2011 at 06:45:46PM +0800, Eric Miao wrote:
> > > Personally, I don't quite like the idea of an explicit _cansleep()
> > > version, which is just confusing. A programmer shouldn't be aware of
> > > which version to use.
> >
> > When working in interrupt context you need to pay attention to this
> > stuff; personally I'd prefer an explict IRQ safe version but YMMV. ?The
> > only use the code makes of this is to generate warnings to make
> > problems easier to diagnose.
> >
> > > David, you have any justification?
> >
> > Sadly David passed away recently.
> >
>
> What????!!!!????? I didn't know that.
Me neither. I'm shocked. What happened?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-04 12:44 ` Marek Vasut
@ 2011-04-04 12:49 ` Russell King - ARM Linux
2011-04-04 12:52 ` Marek Vasut
2011-04-04 12:59 ` Russell King - ARM Linux
0 siblings, 2 replies; 12+ messages in thread
From: Russell King - ARM Linux @ 2011-04-04 12:49 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 04, 2011 at 02:44:17PM +0200, Marek Vasut wrote:
> > On Mon, Apr 4, 2011 at 8:06 PM, Mark Brown
> > <broonie@opensource.wolfsonmicro.com> wrote:
> > > On Mon, Apr 04, 2011 at 06:45:46PM +0800, Eric Miao wrote:
> > > > Personally, I don't quite like the idea of an explicit _cansleep()
> > > > version, which is just confusing. A programmer shouldn't be aware of
> > > > which version to use.
> > >
> > > When working in interrupt context you need to pay attention to this
> > > stuff; personally I'd prefer an explict IRQ safe version but YMMV. ?The
> > > only use the code makes of this is to generate warnings to make
> > > problems easier to diagnose.
> > >
> > > > David, you have any justification?
> > >
> > > Sadly David passed away recently.
> > >
> >
> > What????!!!!????? I didn't know that.
>
> Me neither. I'm shocked. What happened?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-04 12:49 ` Russell King - ARM Linux
@ 2011-04-04 12:52 ` Marek Vasut
2011-04-04 12:59 ` Russell King - ARM Linux
1 sibling, 0 replies; 12+ messages in thread
From: Marek Vasut @ 2011-04-04 12:52 UTC (permalink / raw)
To: linux-arm-kernel
> On Mon, Apr 04, 2011 at 02:44:17PM +0200, Marek Vasut wrote:
> > > On Mon, Apr 4, 2011 at 8:06 PM, Mark Brown
> > > <broonie@opensource.wolfsonmicro.com> wrote:
> > > > On Mon, Apr 04, 2011 at 06:45:46PM +0800, Eric Miao wrote:
> > > > > Personally, I don't quite like the idea of an explicit
> > > > > _cansleep() version, which is just confusing. A programmer
> > > > > shouldn't be aware of which version to use.
> > > >
> > > > When working in interrupt context you need to pay attention to this
> > > > stuff; personally I'd prefer an explict IRQ safe version but YMMV.
> > > > ?The only use the code makes of this is to generate warnings to
> > > > make problems easier to diagnose.
> > > >
> > > > > David, you have any justification?
> > > >
> > > > Sadly David passed away recently.
> > > >
> > >
> > > What????!!!!????? I didn't know that.
> >
> > Me neither. I'm shocked. What happened?
>
> From what I can tell, so far it's been passed around in private mail
> only, and so people are hearing about it 3rd, 4th or more hand - which
> really isn't the way to go about giving this news.
>
> So, I'm not going to pass on the details which I've heard, instead
> I'd suggest people wait for (or try to find) an official announcement.
>
My condolences :-(
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-04 12:49 ` Russell King - ARM Linux
2011-04-04 12:52 ` Marek Vasut
@ 2011-04-04 12:59 ` Russell King - ARM Linux
1 sibling, 0 replies; 12+ messages in thread
From: Russell King - ARM Linux @ 2011-04-04 12:59 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 04, 2011 at 01:49:26PM +0100, Russell King - ARM Linux wrote:
> On Mon, Apr 04, 2011 at 02:44:17PM +0200, Marek Vasut wrote:
> > > On Mon, Apr 4, 2011 at 8:06 PM, Mark Brown
> > > <broonie@opensource.wolfsonmicro.com> wrote:
> > > > On Mon, Apr 04, 2011 at 06:45:46PM +0800, Eric Miao wrote:
> > > > > Personally, I don't quite like the idea of an explicit _cansleep()
> > > > > version, which is just confusing. A programmer shouldn't be aware of
> > > > > which version to use.
> > > >
> > > > When working in interrupt context you need to pay attention to this
> > > > stuff; personally I'd prefer an explict IRQ safe version but YMMV. ?The
> > > > only use the code makes of this is to generate warnings to make
> > > > problems easier to diagnose.
> > > >
> > > > > David, you have any justification?
> > > >
> > > > Sadly David passed away recently.
> > > >
> > >
> > > What????!!!!????? I didn't know that.
> >
> > Me neither. I'm shocked. What happened?
>
> >From what I can tell, so far it's been passed around in private mail
> only, and so people are hearing about it 3rd, 4th or more hand - which
> really isn't the way to go about giving this news.
>
> So, I'm not going to pass on the details which I've heard, instead
> I'd suggest people wait for (or try to find) an official announcement.
Additionally, I'd like to say that I've requested from the person I heard
the news from the details for sending condolences, but so far I'm none
the wiser.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c
2011-04-04 10:45 ` Eric Miao
2011-04-04 12:06 ` Mark Brown
@ 2011-04-10 7:58 ` Pavel Machek
1 sibling, 0 replies; 12+ messages in thread
From: Pavel Machek @ 2011-04-10 7:58 UTC (permalink / raw)
To: linux-arm-kernel
On Mon 2011-04-04 18:45:46, Eric Miao wrote:
> Personally, I don't quite like the idea of an explicit _cansleep() version,
> which is just confusing. A programmer shouldn't be aware of which
> version to use.
>
> David, you have any justification?
Whether it is possible to sleep in given context is not something
that can be detected automatically in general case; so two different
functions are needed.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-04-10 7:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-02 1:43 [PATCH 1/3] sound/spitz: Properly handle MIC GPIO Marek Vasut
2011-04-02 1:43 ` [PATCH 2/3] Use gpio_set_value_cansleep() in corgi_lcd.c Marek Vasut
2011-04-04 10:45 ` Eric Miao
2011-04-04 12:06 ` Mark Brown
2011-04-04 12:33 ` Eric Miao
2011-04-04 12:44 ` Marek Vasut
2011-04-04 12:49 ` Russell King - ARM Linux
2011-04-04 12:52 ` Marek Vasut
2011-04-04 12:59 ` Russell King - ARM Linux
2011-04-10 7:58 ` Pavel Machek
2011-04-02 1:43 ` [PATCH 3/3] PXA: Reorganise pxa2xx_base init() function Marek Vasut
2011-04-03 13:18 ` [PATCH 1/3] sound/spitz: Properly handle MIC GPIO 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).