* [PATCH 06/10] ARM: OMAP1: ams-delta: Use GPIO API in modem setup
2011-12-11 20:11 [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO Janusz Krzysztofik
@ 2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-11 20:12 ` [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API Janusz Krzysztofik
` (5 subsequent siblings)
6 siblings, 0 replies; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:12 UTC (permalink / raw)
To: Tony Lindgren
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
alsa-devel, Jarkko Nikula, Liam Girdwood, Mark Brown
Don't use Amstrad Delta custom I/O functions for setting up modem
related pins, use GPIO API instead. However, keep old pin definitions
used by ams_delta_latch2_write() for now, as those are still used by the
Amstrad Delta ASoC driver.
While being at it, extend the device platform data with a power
management hook which toggles one of those new GPIO pins.
Depends on patch 2/10 "ARM: OMAP1: Convert Amstrad E3 latches to
basic_mmio_gpio".
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
arch/arm/mach-omap1/board-ams-delta.c | 44 ++++++++++++++++++++------------
1 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 7670374..5705481 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -262,16 +262,6 @@ static struct gpio _latch_gpios[] __initconst = {
.label = "scard_cmdvcc",
},
{
- .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "modem_nreset",
- },
- {
- .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "modem_codec",
- },
- {
.gpio = AMS_DELTA_LATCH2_GPIO_BASE + 14,
.flags = GPIOF_OUT_INIT_LOW,
.label = "hookflash1",
@@ -482,6 +472,12 @@ static void __init ams_delta_init(void)
omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
}
+static void _modem_pm(struct uart_port *port, unsigned int state, unsigned old)
+{
+ if (state != old)
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_NRESET, state == 0);
+}
+
static struct plat_serial8250_port ams_delta_modem_ports[] = {
{
.membase = IOMEM(_MODEM_VIRT),
@@ -492,6 +488,7 @@ static struct plat_serial8250_port ams_delta_modem_ports[] = {
.iotype = UPIO_MEM,
.regshift = 1,
.uartclk = BASE_BAUD * 16,
+ .pm = _modem_pm,
},
{ },
};
@@ -504,6 +501,24 @@ static struct platform_device ams_delta_modem_device = {
},
};
+static struct gpio _modem_gpios[] __initconst = {
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_MODEM_IRQ,
+ .flags = GPIOF_DIR_IN,
+ .label = "modem_irq",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "modem_nreset",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC,
+ .flags = GPIOF_OUT_INIT_HIGH,
+ .label = "modem_codec",
+ },
+};
+
static int __init ams_delta_modem_init(void)
{
int err;
@@ -515,16 +530,11 @@ static int __init ams_delta_modem_init(void)
ams_delta_modem_ports[0].irq =
gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
- err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem");
+ err = gpio_request_array(_modem_gpios, ARRAY_SIZE(_modem_gpios));
if (err) {
- pr_err("Couldn't request gpio pin for modem\n");
+ pr_err("Couldn't request gpio pins for modem\n");
return err;
}
- gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
-
- ams_delta_latch2_write(
- AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
- AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
return platform_device_register(&ams_delta_modem_device);
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
2011-12-11 20:11 [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO Janusz Krzysztofik
2011-12-11 20:12 ` [PATCH 06/10] ARM: OMAP1: ams-delta: Use GPIO API in modem setup Janusz Krzysztofik
@ 2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-11 20:12 ` Janusz Krzysztofik
` (4 subsequent siblings)
6 siblings, 0 replies; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:12 UTC (permalink / raw)
To: Tony Lindgren, Jarkko Nikula
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
alsa-devel, Liam Girdwood, Mark Brown
Don't use Amstrad Delta custom I/O functions any longer, replace them
with GPIO. Old pin definitions, no longer used by the modem bits either,
can be dropped.
Depends on patch 2/10 "ARM: OMAP1: Convert Amstrad E3 latches to
basic_mmio_gpio".
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 --
sound/soc/omap/ams-delta.c | 21 ++++++++++++---------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h
index b586078..73fdab9 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -34,8 +34,6 @@
#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
-#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
-#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000
#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0
#define AMS_DELTA_GPIO_PIN_KEYBRD_CLK 1
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index ccb8a6a..389c488 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -268,7 +268,7 @@ static void cx81801_timeout(unsigned long data)
/* Reconnect the codec DAI back from the modem to the CPU DAI
* only if digital mute still off */
if (!muted)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, 0);
}
/*
@@ -378,8 +378,7 @@ static void cx81801_receive(struct tty_struct *tty,
/* Apply config pulse by connecting the codec to the modem
* if not already done */
if (apply)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
- AMS_DELTA_LATCH2_MODEM_CODEC);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, 1);
break;
}
}
@@ -438,13 +437,11 @@ static int ams_delta_set_bias_level(struct snd_soc_card *card,
case SND_SOC_BIAS_PREPARE:
case SND_SOC_BIAS_STANDBY:
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
- AMS_DELTA_LATCH2_MODEM_NRESET);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_NRESET, 1);
break;
case SND_SOC_BIAS_OFF:
if (codec->dapm.bias_level != SND_SOC_BIAS_OFF)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
- 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_NRESET, 0);
}
codec->dapm.bias_level = level;
@@ -468,8 +465,7 @@ static int ams_delta_digital_mute(struct snd_soc_dai *dai, int mute)
spin_unlock_bh(&ams_delta_lock);
if (apply)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
- mute ? AMS_DELTA_LATCH2_MODEM_CODEC : 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, mute);
return 0;
}
@@ -503,6 +499,13 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
int ret;
/* Codec is ready, now add/activate board specific controls */
+ /*
+ * *_MODEM_CODEC and *_MODEM_NRESET GPIO pins manipulated above are
+ * assumed to be already requested from the board initialisation code,
+ * which should be done while setting up the modem device which those
+ * pins are used for control of in the first place.
+ */
+
/* Store a pointer to the codec structure for tty ldisc use */
cx20442_codec = codec;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
2011-12-11 20:11 [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO Janusz Krzysztofik
2011-12-11 20:12 ` [PATCH 06/10] ARM: OMAP1: ams-delta: Use GPIO API in modem setup Janusz Krzysztofik
2011-12-11 20:12 ` [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API Janusz Krzysztofik
@ 2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-12 4:29 ` Mark Brown
2011-12-21 18:33 ` Liam Girdwood
2011-12-11 20:12 ` Janusz Krzysztofik
` (3 subsequent siblings)
6 siblings, 2 replies; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:12 UTC (permalink / raw)
To: Tony Lindgren, Jarkko Nikula
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
alsa-devel, Liam Girdwood, Mark Brown
Don't use Amstrad Delta custom I/O functions any longer, replace them
with GPIO. Old pin definitions, no longer used by the modem bits either,
can be dropped.
Depends on patch 2/10 "ARM: OMAP1: Convert Amstrad E3 latches to
basic_mmio_gpio".
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 --
sound/soc/omap/ams-delta.c | 21 ++++++++++++---------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h
index b586078..73fdab9 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -34,8 +34,6 @@
#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
-#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
-#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000
#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0
#define AMS_DELTA_GPIO_PIN_KEYBRD_CLK 1
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index ccb8a6a..389c488 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -268,7 +268,7 @@ static void cx81801_timeout(unsigned long data)
/* Reconnect the codec DAI back from the modem to the CPU DAI
* only if digital mute still off */
if (!muted)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, 0);
}
/*
@@ -378,8 +378,7 @@ static void cx81801_receive(struct tty_struct *tty,
/* Apply config pulse by connecting the codec to the modem
* if not already done */
if (apply)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
- AMS_DELTA_LATCH2_MODEM_CODEC);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, 1);
break;
}
}
@@ -438,13 +437,11 @@ static int ams_delta_set_bias_level(struct snd_soc_card *card,
case SND_SOC_BIAS_PREPARE:
case SND_SOC_BIAS_STANDBY:
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
- AMS_DELTA_LATCH2_MODEM_NRESET);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_NRESET, 1);
break;
case SND_SOC_BIAS_OFF:
if (codec->dapm.bias_level != SND_SOC_BIAS_OFF)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
- 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_NRESET, 0);
}
codec->dapm.bias_level = level;
@@ -468,8 +465,7 @@ static int ams_delta_digital_mute(struct snd_soc_dai *dai, int mute)
spin_unlock_bh(&ams_delta_lock);
if (apply)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
- mute ? AMS_DELTA_LATCH2_MODEM_CODEC : 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, mute);
return 0;
}
@@ -503,6 +499,13 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
int ret;
/* Codec is ready, now add/activate board specific controls */
+ /*
+ * *_MODEM_CODEC and *_MODEM_NRESET GPIO pins manipulated above are
+ * assumed to be already requested from the board initialisation code,
+ * which should be done while setting up the modem device which those
+ * pins are used for control of in the first place.
+ */
+
/* Store a pointer to the codec structure for tty ldisc use */
cx20442_codec = codec;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
2011-12-11 20:12 ` Janusz Krzysztofik
@ 2011-12-12 4:29 ` Mark Brown
2011-12-21 18:33 ` Liam Girdwood
1 sibling, 0 replies; 24+ messages in thread
From: Mark Brown @ 2011-12-12 4:29 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: Tony Lindgren, Jarkko Nikula, linux-omap, linux-arm-kernel,
linux-kernel, alsa-devel, Liam Girdwood
On Sun, Dec 11, 2011 at 09:12:05PM +0100, Janusz Krzysztofik wrote:
> Don't use Amstrad Delta custom I/O functions any longer, replace them
> with GPIO. Old pin definitions, no longer used by the modem bits either,
> can be dropped.
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-12 4:29 ` Mark Brown
@ 2011-12-21 18:33 ` Liam Girdwood
2011-12-21 22:14 ` Janusz Krzysztofik
1 sibling, 1 reply; 24+ messages in thread
From: Liam Girdwood @ 2011-12-21 18:33 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: Tony Lindgren, Jarkko Nikula, linux-omap, linux-arm-kernel,
linux-kernel, alsa-devel, Mark Brown
On Sun, 2011-12-11 at 21:12 +0100, Janusz Krzysztofik wrote:
> Don't use Amstrad Delta custom I/O functions any longer, replace them
> with GPIO. Old pin definitions, no longer used by the modem bits either,
> can be dropped.
>
> Depends on patch 2/10 "ARM: OMAP1: Convert Amstrad E3 latches to
> basic_mmio_gpio".
>
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Applied.
Thanks
Liam
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
2011-12-21 18:33 ` Liam Girdwood
@ 2011-12-21 22:14 ` Janusz Krzysztofik
2011-12-22 9:25 ` Girdwood, Liam
0 siblings, 1 reply; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-21 22:14 UTC (permalink / raw)
To: Liam Girdwood
Cc: alsa-devel, Tony Lindgren, Mark Brown, linux-kernel,
Jarkko Nikula, linux-omap, linux-arm-kernel
On Wednesday 21 of December 2011 at 19:33:44, Liam Girdwood wrote:
> On Sun, 2011-12-11 at 21:12 +0100, Janusz Krzysztofik wrote:
> > Don't use Amstrad Delta custom I/O functions any longer, replace them
> > with GPIO. Old pin definitions, no longer used by the modem bits either,
> > can be dropped.
> >
> > Depends on patch 2/10 "ARM: OMAP1: Convert Amstrad E3 latches to
> > basic_mmio_gpio".
> >
> > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
>
> Applied.
Hi,
I'm sorry, but I've probably missed to infrom you explicitly, i.e. other
than in a cover letter to v2 of this series, that this particular patch
has been dropped from the series. I've already started working on an
alternative solution, which I intend to submit as a separate set. It
will be free of potentail problems with two devices, a modem and the
sound card, accessing the same GPIO pins concurrently. For the
MODEM_NRESET pin I've already set up a virtual regulator on top of it,
and for the MODEM_CODEC pin I'll probably choose a virtual clock (pinmux
would match the hardware more closely here, but it looks too complicated
to me). Moreover, I've already started to move all those GPIO pin
related functions, i.e. bias control, digital mute and line discipline
interaction, from the board file to the codec driver, where all those
seem to belong.
Having this patch applied will conflict with the regultor and the clock
solutions, taking control over those two GPIO pins. Please revert this
patch, or reset it if still possible.
Thanks,
Janusz
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
2011-12-21 22:14 ` Janusz Krzysztofik
@ 2011-12-22 9:25 ` Girdwood, Liam
0 siblings, 0 replies; 24+ messages in thread
From: Girdwood, Liam @ 2011-12-22 9:25 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: alsa-devel, Tony Lindgren, Mark Brown, linux-kernel,
Jarkko Nikula, linux-omap, linux-arm-kernel
On 21 December 2011 22:14, Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> wrote:
> On Wednesday 21 of December 2011 at 19:33:44, Liam Girdwood wrote:
>> On Sun, 2011-12-11 at 21:12 +0100, Janusz Krzysztofik wrote:
>> > Don't use Amstrad Delta custom I/O functions any longer, replace them
>> > with GPIO. Old pin definitions, no longer used by the modem bits either,
>> > can be dropped.
>> >
>> > Depends on patch 2/10 "ARM: OMAP1: Convert Amstrad E3 latches to
>> > basic_mmio_gpio".
>> >
>> > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
>>
>> Applied.
>
> Hi,
> I'm sorry, but I've probably missed to infrom you explicitly, i.e. other
> than in a cover letter to v2 of this series, that this particular patch
> has been dropped from the series. I've already started working on an
> alternative solution, which I intend to submit as a separate set. It
> will be free of potentail problems with two devices, a modem and the
> sound card, accessing the same GPIO pins concurrently. For the
> MODEM_NRESET pin I've already set up a virtual regulator on top of it,
> and for the MODEM_CODEC pin I'll probably choose a virtual clock (pinmux
> would match the hardware more closely here, but it looks too complicated
> to me). Moreover, I've already started to move all those GPIO pin
> related functions, i.e. bias control, digital mute and line discipline
> interaction, from the board file to the codec driver, where all those
> seem to belong.
>
> Having this patch applied will conflict with the regultor and the clock
> solutions, taking control over those two GPIO pins. Please revert this
> patch, or reset it if still possible.
>
> Thanks,
> Janusz
Will do, I never pushed last night as it was late. So I'll only will
have to make a local change.
Thanks
Liam
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 07/10] ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
2011-12-11 20:11 [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO Janusz Krzysztofik
` (2 preceding siblings ...)
2011-12-11 20:12 ` Janusz Krzysztofik
@ 2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-12 5:00 ` [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO Jonathan McDowell
` (2 subsequent siblings)
6 siblings, 0 replies; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:12 UTC (permalink / raw)
To: Tony Lindgren, Jarkko Nikula
Cc: alsa-devel, Janusz Krzysztofik, Mark Brown, linux-kernel,
linux-omap, Liam Girdwood, linux-arm-kernel
Don't use Amstrad Delta custom I/O functions any longer, replace them
with GPIO. Old pin definitions, no longer used by the modem bits either,
can be dropped.
Depends on patch 2/10 "ARM: OMAP1: Convert Amstrad E3 latches to
basic_mmio_gpio".
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 --
sound/soc/omap/ams-delta.c | 21 ++++++++++++---------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h
index b586078..73fdab9 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -34,8 +34,6 @@
#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
-#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
-#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000
#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0
#define AMS_DELTA_GPIO_PIN_KEYBRD_CLK 1
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index ccb8a6a..389c488 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -268,7 +268,7 @@ static void cx81801_timeout(unsigned long data)
/* Reconnect the codec DAI back from the modem to the CPU DAI
* only if digital mute still off */
if (!muted)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, 0);
}
/*
@@ -378,8 +378,7 @@ static void cx81801_receive(struct tty_struct *tty,
/* Apply config pulse by connecting the codec to the modem
* if not already done */
if (apply)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
- AMS_DELTA_LATCH2_MODEM_CODEC);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, 1);
break;
}
}
@@ -438,13 +437,11 @@ static int ams_delta_set_bias_level(struct snd_soc_card *card,
case SND_SOC_BIAS_PREPARE:
case SND_SOC_BIAS_STANDBY:
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
- AMS_DELTA_LATCH2_MODEM_NRESET);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_NRESET, 1);
break;
case SND_SOC_BIAS_OFF:
if (codec->dapm.bias_level != SND_SOC_BIAS_OFF)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
- 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_NRESET, 0);
}
codec->dapm.bias_level = level;
@@ -468,8 +465,7 @@ static int ams_delta_digital_mute(struct snd_soc_dai *dai, int mute)
spin_unlock_bh(&ams_delta_lock);
if (apply)
- ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
- mute ? AMS_DELTA_LATCH2_MODEM_CODEC : 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_MODEM_CODEC, mute);
return 0;
}
@@ -503,6 +499,13 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
int ret;
/* Codec is ready, now add/activate board specific controls */
+ /*
+ * *_MODEM_CODEC and *_MODEM_NRESET GPIO pins manipulated above are
+ * assumed to be already requested from the board initialisation code,
+ * which should be done while setting up the modem device which those
+ * pins are used for control of in the first place.
+ */
+
/* Store a pointer to the codec structure for tty ldisc use */
cx20442_codec = codec;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO
2011-12-11 20:11 [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO Janusz Krzysztofik
` (3 preceding siblings ...)
2011-12-11 20:12 ` Janusz Krzysztofik
@ 2011-12-12 5:00 ` Jonathan McDowell
2011-12-19 23:08 ` [PATCH v2 0/7] " Janusz Krzysztofik
[not found] ` <83e934adfc691b347534edb7788a67ab2e6bd7e1.1324331816.git.jkrzyszt@tis.icnet.pl>
6 siblings, 0 replies; 24+ messages in thread
From: Jonathan McDowell @ 2011-12-12 5:00 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: Tony Lindgren, Grant Likely, Dmitry Torokhov, Richard Purdie,
David Woodhouse, Tomi Valkeinen, Jarkko Nikula, linux-fbdev,
alsa-devel, Mark Brown, linux-kernel, linux-mtd, linux-input,
linux-omap, Liam Girdwood, linux-arm-kernel
On Sun, Dec 11, 2011 at 09:11:58PM +0100, Janusz Krzysztofik wrote:
> The Amstrad Delta board has two extra output ports used for driving
> input lines of different on-board devices. Those ports are now
> controlled with custom functions, provided by the board arch code and
> used by several device drivers.
>
> The idea behind the series is to replace those custom I/O functions
> with gpiolib API. This way, existing drivers can be made less platform
> dependent, and some of them perhaps even superseded with generic GPIO
> based drivers after the board platform device descriptions are
> converted. Moreover, should a new driver for the on-board Smart Card
> controller ever be created, it could be designed as a generic GPIO
> based driver, not a custom one.
Nice work; moving ams-delta over to gpiolib has been on my todo list for
a while (albeit quite low down).
J.
--
I just Fedexed my soul to hell. I'm *real* clever.
^ permalink raw reply [flat|nested] 24+ messages in thread* [PATCH v2 0/7] ARM: OMAP1: ams-delta: replace custom I/O with GPIO
2011-12-11 20:11 [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO Janusz Krzysztofik
` (4 preceding siblings ...)
2011-12-12 5:00 ` [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO Jonathan McDowell
@ 2011-12-19 23:08 ` Janusz Krzysztofik
[not found] ` <83e934adfc691b347534edb7788a67ab2e6bd7e1.1324331816.git.jkrzyszt@tis.icnet.pl>
6 siblings, 0 replies; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-19 23:08 UTC (permalink / raw)
To: Tony Lindgren
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
Grant Likely, Dmitry Torokhov, Richard Purdie, David Woodhouse,
Tomi Valkeinen, Jarkko Nikula, Liam Girdwood, Mark Brown,
linux-input, linux-mtd, linux-fbdev, alsa-devel
The Amstrad Delta board has two extra output ports used for driving
input lines of different on-board devices. Those ports are now
controlled with custom functions, provided by the board arch code and
used by several device drivers.
The idea behind the series is to replace those custom I/O functions
with gpiolib API. This way, existing drivers can be made less platform
dependent, and some of them perhaps even superseded with generic GPIO
based drivers after the board platform device descriptions are
converted. Moreover, should a new driver for the on-board Smart Card
controller ever be created, it could be designed as a generic GPIO
based driver, not a custom one.
Changes against initial version:
* the initial patch, which tried to move the gpio-generic driver
initialization up to the postcore_initcall level, replaced with an
alternative solution, moving the on-board devices initialization down
to late_initcall; thanks to Tony Lindgren who suggested this solution,
* dropped patches introducing changes to the modem and ASoC device
handling; those will be addressed in a separate patch series,
* final cleanups also dropped until those remaining devices are updated,
* the serio driver now takes care of one more GPIO pin which, even if
not used, belongs to the device interface and affects its functioning,
* misc code and changelog cosmetic cleanups,
* rebased on top of 3.2-rc6.
Thanks to those who reviewed the initial submission and responded with
their comments or Acks.
Janusz
Janusz Krzysztofik (7):
ARM: OMAP1: ams-delta: register latch dependent devices later
ARM: OMAP1: ams-delta: convert latches to basic_mmio_gpio
ARM: OMAP1: ams-delta: supersede custom led device by leds-gpio
LED: drop leds-ams-delta driver
MTD: NAND: ams-delta: use GPIO instead of custom I/O
omapfb: lcd_ams_delta: drive control lines over GPIO
input: serio: ams-delta: toggle keyboard power over GPIO
arch/arm/mach-omap1/Kconfig | 2 +
arch/arm/mach-omap1/board-ams-delta.c | 226 +++++++++++++++++----
arch/arm/plat-omap/include/plat/board-ams-delta.h | 48 ++---
drivers/input/serio/ams_delta_serio.c | 51 +++--
drivers/leds/Kconfig | 7 -
drivers/leds/Makefile | 1 -
drivers/leds/leds-ams-delta.c | 137 -------------
drivers/mtd/nand/ams-delta.c | 74 +++++--
drivers/video/omap/lcd_ams_delta.c | 27 ++-
sound/soc/omap/ams-delta.c | 4 +
10 files changed, 318 insertions(+), 259 deletions(-)
delete mode 100644 drivers/leds/leds-ams-delta.c
--
1.7.3.4
^ permalink raw reply [flat|nested] 24+ messages in thread[parent not found: <83e934adfc691b347534edb7788a67ab2e6bd7e1.1324331816.git.jkrzyszt@tis.icnet.pl>]
* [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later
[not found] ` <83e934adfc691b347534edb7788a67ab2e6bd7e1.1324331816.git.jkrzyszt@tis.icnet.pl>
@ 2011-12-19 23:28 ` Janusz Krzysztofik
2011-12-20 18:06 ` Tony Lindgren
` (2 more replies)
0 siblings, 3 replies; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-19 23:28 UTC (permalink / raw)
To: Tony Lindgren
Cc: alsa-devel, linux-omap, linux-arm-kernel, linux-kernel,
Dmitry Torokhov, Jarkko Nikula, Liam Girdwood, Mark Brown,
linux-input
Resending because of a typo in the Cc: list, sorry.
8<--------------------------
In preparation to converting Amstrad Delta on-board latches to
basic_mmio_gpio devices, registration of platform devices which depend
on latches and will require initialization of their GPIO pins first,
should be moved out of .machine_init down to late_initcall level, as the
gpio-generic driver is not available until device_initcall time. The
latch reset operation, which will be replaced with GPIO initialization,
must also be moved to late_initcall for the same reason.
Since there was already another, separate arch_initcall function for
setting up one of those latch dependent devices, the on-board modem
device, reuse that function, i.e., rename it to a name that matches the
new purpose, extend with other device setup relocated from
.machine_init, and move down to the late_initcall level.
While being at it, add missing gpio_free() in case the modem platform
device registration fails.
In addition, defer registration of the Amstrad Delta ASoC and serio
devices, done from their device driver files, until late_initcall time,
as those drivers will depend on their GPIO pins already requested from
the board late_init() function until updated to register their GPIO pins
themselves.
Thanks to Tony Lindgren <tony@atomide.com> who suggested this approach
instead of shifting up the gpio-generic driver initialization.
Created and tested against linux-3.2-rc6.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
This patch was not present in the initial submission, it replaces the
old patch 1/10, providing an alternative solution not touching the
gpio-generic driver.
Thanks,
Janusz
arch/arm/mach-omap1/board-ams-delta.c | 28 ++++++++++++++++++++--------
drivers/input/serio/ams_delta_serio.c | 4 ++++
sound/soc/omap/ams-delta.c | 4 ++++
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index b0f15d2..50987c9 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -275,11 +275,14 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
};
static struct platform_device *ams_delta_devices[] __initdata = {
- &ams_delta_nand_device,
&ams_delta_kp_device,
+ &ams_delta_camera_device,
+};
+
+static struct platform_device *late_devices[] __initdata = {
+ &ams_delta_nand_device,
&ams_delta_lcd_device,
&ams_delta_led_device,
- &ams_delta_camera_device,
};
static void __init ams_delta_init(void)
@@ -307,9 +310,6 @@ static void __init ams_delta_init(void)
omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0);
- /* Clear latch2 (NAND, LCD, modem enable) */
- ams_delta_latch2_write(~0, 0);
-
omap1_usb_init(&ams_delta_usb_config);
omap1_set_camera_info(&ams_delta_camera_platform_data);
#ifdef CONFIG_LEDS_TRIGGERS
@@ -345,13 +345,18 @@ static struct platform_device ams_delta_modem_device = {
},
};
-static int __init ams_delta_modem_init(void)
+static int __init late_init(void)
{
int err;
if (!machine_is_ams_delta())
return -ENODEV;
+ /* Clear latch2 (NAND, LCD, modem enable) */
+ ams_delta_latch2_write(~0, 0);
+
+ platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
+
omap_cfg_reg(M14_1510_GPIO2);
ams_delta_modem_ports[0].irq =
gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
@@ -367,9 +372,16 @@ static int __init ams_delta_modem_init(void)
AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
- return platform_device_register(&ams_delta_modem_device);
+ err = platform_device_register(&ams_delta_modem_device);
+ if (err)
+ goto gpio_free;
+ return 0;
+
+gpio_free:
+ gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
+ return err;
}
-arch_initcall(ams_delta_modem_init);
+late_initcall(late_init);
static void __init ams_delta_map_io(void)
{
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index d4d08bd..56ffd7c 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -165,6 +165,9 @@ serio:
kfree(ams_delta_serio);
return err;
}
+#ifndef MODULE
+late_initcall(ams_delta_serio_init);
+#else
module_init(ams_delta_serio_init);
static void __exit ams_delta_serio_exit(void)
@@ -175,3 +178,4 @@ static void __exit ams_delta_serio_exit(void)
gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
}
module_exit(ams_delta_serio_exit);
+#endif
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index ccb8a6a..1764a3b 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -636,6 +636,9 @@ err:
platform_device_put(ams_delta_audio_platform_device);
return ret;
}
+#ifndef MODULE
+late_initcall(ams_delta_module_init);
+#else
module_init(ams_delta_module_init);
static void __exit ams_delta_module_exit(void)
@@ -657,6 +660,7 @@ static void __exit ams_delta_module_exit(void)
platform_device_unregister(ams_delta_audio_platform_device);
}
module_exit(ams_delta_module_exit);
+#endif
MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>");
MODULE_DESCRIPTION("ALSA SoC driver for Amstrad E3 (Delta) videophone");
--
1.7.3.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-19 23:28 ` [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later Janusz Krzysztofik
@ 2011-12-20 18:06 ` Tony Lindgren
2011-12-20 20:34 ` Janusz Krzysztofik
2011-12-20 20:40 ` Russell King - ARM Linux
2011-12-20 21:54 ` [PATCH v2 1/7 v2] " Janusz Krzysztofik
2 siblings, 1 reply; 24+ messages in thread
From: Tony Lindgren @ 2011-12-20 18:06 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: alsa-devel, linux-omap, linux-arm-kernel, linux-kernel,
Dmitry Torokhov, Jarkko Nikula, Liam Girdwood, Mark Brown,
linux-input
* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111219 14:57]:
> Resending because of a typo in the Cc: list, sorry.
>
> 8<--------------------------
>
> In preparation to converting Amstrad Delta on-board latches to
> basic_mmio_gpio devices, registration of platform devices which depend
> on latches and will require initialization of their GPIO pins first,
> should be moved out of .machine_init down to late_initcall level, as the
> gpio-generic driver is not available until device_initcall time. The
> latch reset operation, which will be replaced with GPIO initialization,
> must also be moved to late_initcall for the same reason.
>
> Since there was already another, separate arch_initcall function for
> setting up one of those latch dependent devices, the on-board modem
> device, reuse that function, i.e., rename it to a name that matches the
> new purpose, extend with other device setup relocated from
> .machine_init, and move down to the late_initcall level.
>
> While being at it, add missing gpio_free() in case the modem platform
> device registration fails.
>
> In addition, defer registration of the Amstrad Delta ASoC and serio
> devices, done from their device driver files, until late_initcall time,
> as those drivers will depend on their GPIO pins already requested from
> the board late_init() function until updated to register their GPIO pins
> themselves.
>
> Thanks to Tony Lindgren <tony@atomide.com> who suggested this approach
> instead of shifting up the gpio-generic driver initialization.
...
> --- a/drivers/input/serio/ams_delta_serio.c
> +++ b/drivers/input/serio/ams_delta_serio.c
> @@ -165,6 +165,9 @@ serio:
> kfree(ams_delta_serio);
> return err;
> }
> +#ifndef MODULE
> +late_initcall(ams_delta_serio_init);
> +#else
> module_init(ams_delta_serio_init);
>
> static void __exit ams_delta_serio_exit(void)
> @@ -175,3 +178,4 @@ static void __exit ams_delta_serio_exit(void)
> gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> }
> module_exit(ams_delta_serio_exit);
> +#endif
> diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
> index ccb8a6a..1764a3b 100644
> --- a/sound/soc/omap/ams-delta.c
> +++ b/sound/soc/omap/ams-delta.c
> @@ -636,6 +636,9 @@ err:
> platform_device_put(ams_delta_audio_platform_device);
> return ret;
> }
> +#ifndef MODULE
> +late_initcall(ams_delta_module_init);
> +#else
> module_init(ams_delta_module_init);
>
> static void __exit ams_delta_module_exit(void)
> @@ -657,6 +660,7 @@ static void __exit ams_delta_module_exit(void)
> platform_device_unregister(ams_delta_audio_platform_device);
> }
> module_exit(ams_delta_module_exit);
> +#endif
>
> MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>");
> MODULE_DESCRIPTION("ALSA SoC driver for Amstrad E3 (Delta) videophone");
This looks a bit odd.. I think these drivers should be converted to
a proper platform_driver so you can get rid of the machine_is_ams_delta
check in the init. Then you can rely on the probe to match the
device. To deal with the init order issues, you can pass a set_power
function pointer in platform_data that the driver can use. Or
set up a fixed regulator for it.
Regards,
Tony
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-20 18:06 ` Tony Lindgren
@ 2011-12-20 20:34 ` Janusz Krzysztofik
2011-12-20 20:57 ` Tony Lindgren
0 siblings, 1 reply; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-20 20:34 UTC (permalink / raw)
To: Tony Lindgren
Cc: alsa-devel, Mark Brown, Dmitry Torokhov, linux-kernel,
linux-arm-kernel, linux-input, linux-omap, Liam Girdwood,
Jarkko Nikula
On Tuesday 20 of December 2011 at 19:06:11, Tony Lindgren wrote:
> * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111219 14:57]:
> > Resending because of a typo in the Cc: list, sorry.
> >
> > 8<--------------------------
> >
> > In preparation to converting Amstrad Delta on-board latches to
> > basic_mmio_gpio devices, registration of platform devices which depend
> > on latches and will require initialization of their GPIO pins first,
> > should be moved out of .machine_init down to late_initcall level, as the
> > gpio-generic driver is not available until device_initcall time. The
> > latch reset operation, which will be replaced with GPIO initialization,
> > must also be moved to late_initcall for the same reason.
> >
> > Since there was already another, separate arch_initcall function for
> > setting up one of those latch dependent devices, the on-board modem
> > device, reuse that function, i.e., rename it to a name that matches the
> > new purpose, extend with other device setup relocated from
> > .machine_init, and move down to the late_initcall level.
> >
> > While being at it, add missing gpio_free() in case the modem platform
> > device registration fails.
> >
> > In addition, defer registration of the Amstrad Delta ASoC and serio
> > devices, done from their device driver files, until late_initcall time,
> > as those drivers will depend on their GPIO pins already requested from
> > the board late_init() function until updated to register their GPIO pins
> > themselves.
> >
> > Thanks to Tony Lindgren <tony@atomide.com> who suggested this approach
> > instead of shifting up the gpio-generic driver initialization.
> ...
>
> > --- a/drivers/input/serio/ams_delta_serio.c
> > +++ b/drivers/input/serio/ams_delta_serio.c
> > @@ -165,6 +165,9 @@ serio:
> > kfree(ams_delta_serio);
> > return err;
> > }
> > +#ifndef MODULE
> > +late_initcall(ams_delta_serio_init);
> > +#else
> > module_init(ams_delta_serio_init);
> >
> > static void __exit ams_delta_serio_exit(void)
> > @@ -175,3 +178,4 @@ static void __exit ams_delta_serio_exit(void)
> > gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> > }
> > module_exit(ams_delta_serio_exit);
> > +#endif
> > diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
> > index ccb8a6a..1764a3b 100644
> > --- a/sound/soc/omap/ams-delta.c
> > +++ b/sound/soc/omap/ams-delta.c
> > @@ -636,6 +636,9 @@ err:
> > platform_device_put(ams_delta_audio_platform_device);
> > return ret;
> > }
> > +#ifndef MODULE
> > +late_initcall(ams_delta_module_init);
> > +#else
> > module_init(ams_delta_module_init);
> >
> > static void __exit ams_delta_module_exit(void)
> > @@ -657,6 +660,7 @@ static void __exit ams_delta_module_exit(void)
> > platform_device_unregister(ams_delta_audio_platform_device);
> > }
> > module_exit(ams_delta_module_exit);
> > +#endif
> >
> > MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>");
> > MODULE_DESCRIPTION("ALSA SoC driver for Amstrad E3 (Delta) videophone");
>
> This looks a bit odd.. I think these drivers should be converted to
> a proper platform_driver so you can get rid of the machine_is_ams_delta
> check in the init. Then you can rely on the probe to match the
> device.
Mostly true, but first of all, I don't pretend to solve all problems
with all Amstrad Delta specific drivers in this patch series. I'm
concentrating on converting latches to GPIO pins, and updating those
drivers to access those pins with gpiolib API instead of accessing the
latches with the board specific API. Nothing more.
Now, regarding the serio driver, you are absolutely right, the device
registration could be better moved out of the driver file to the board
file. I'll probably do this some time in the future, once I'm ready with
the latches related stuff, i.e. the ams_delta_latch_write() is finally
removed from the board file as no longer used by any driver, and find
some spare time again. For now, I'm moving that serio device/driver
initialization to late_initcall with patch 2/7, and back to
device_initcall once converted to gpiolib (patch 7/7). Is this
acceptable? If not, let's drop those forward and back moves, and the
driver will get broken with 2/7, but get repaired with 7/7, OK?
Regarding the sound card: the sound/soc/omap/ams-delta.c file is not a
device driver per se, but rather a piece of code which sets up a
platform device representing the sound card, i.e., provides platform
device description and platform data, including device specific
callbacks, to be used by the generic 'soc-audio' driver. There is no
single platform_driver_register() called from that file, only
platform_device_register() or alike. That code seems to belong logically
to the board setup, but was always maintained, among 12 others, and for
reasons not known to me with my relatively short experience as a kernel
developer, inside the sound/soc/omap/ subtree, not under arch/arm/mach-
omap1/. Like all those 12 others, including sdp4430 which is quite
recent I guess, it makes use of the machine_is_* function as if it was a
part of a board files set. Then, the only way I can see to defer the
device initialization until late_initcall time, with the soc-audio
driver already loaded at the device_initcall level, is to move with that
sound card platform device setup code, found in sound/soc/omap/ams-
delta.c, to the late_initcall. Am I missing something?
> To deal with the init order issues, you can pass a set_power
> function pointer in platform_data that the driver can use. Or
> set up a fixed regulator for it.
I'm already working on the follow up patch series mentioned in the cover
letter, and yes, I'm using the fixed regulator. Be patient, please, as
my resources are somehow limited.
Thanks,
Janusz
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-20 20:34 ` Janusz Krzysztofik
@ 2011-12-20 20:57 ` Tony Lindgren
0 siblings, 0 replies; 24+ messages in thread
From: Tony Lindgren @ 2011-12-20 20:57 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: alsa-devel, Mark Brown, Dmitry Torokhov, linux-kernel,
linux-arm-kernel, linux-input, linux-omap, Liam Girdwood,
Jarkko Nikula
* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 12:03]:
> On Tuesday 20 of December 2011 at 19:06:11, Tony Lindgren wrote:
>
> > To deal with the init order issues, you can pass a set_power
> > function pointer in platform_data that the driver can use. Or
> > set up a fixed regulator for it.
>
> I'm already working on the follow up patch series mentioned in the cover
> letter, and yes, I'm using the fixed regulator. Be patient, please, as
> my resources are somehow limited.
Yes, I understand. For this patch I'm fine with the late_initcall
changes Russell suggested, then the rest can be done in separate
patches later on.
Regards,
Tony
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-19 23:28 ` [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later Janusz Krzysztofik
2011-12-20 18:06 ` Tony Lindgren
@ 2011-12-20 20:40 ` Russell King - ARM Linux
2011-12-20 20:51 ` [alsa-devel] " Janusz Krzysztofik
2011-12-20 21:54 ` [PATCH v2 1/7 v2] " Janusz Krzysztofik
2 siblings, 1 reply; 24+ messages in thread
From: Russell King - ARM Linux @ 2011-12-20 20:40 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: alsa-devel, Dmitry Torokhov, Tony Lindgren, Mark Brown,
linux-kernel, Jarkko Nikula, linux-input, linux-omap,
Liam Girdwood, linux-arm-kernel
On Tue, Dec 20, 2011 at 12:28:32AM +0100, Janusz Krzysztofik wrote:
> diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> index d4d08bd..56ffd7c 100644
> --- a/drivers/input/serio/ams_delta_serio.c
> +++ b/drivers/input/serio/ams_delta_serio.c
> @@ -165,6 +165,9 @@ serio:
> kfree(ams_delta_serio);
> return err;
> }
> +#ifndef MODULE
> +late_initcall(ams_delta_serio_init);
> +#else
> module_init(ams_delta_serio_init);
>
> static void __exit ams_delta_serio_exit(void)
> @@ -175,3 +178,4 @@ static void __exit ams_delta_serio_exit(void)
> gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> }
> module_exit(ams_delta_serio_exit);
> +#endif
It's worth noting:
#ifndef MODULE
#define late_initcall(fn) __define_initcall("7",fn,7)
#else /* MODULE */
#define late_initcall(fn) module_init(fn)
So really, all these ifndefs aren't required. Just change the module_init()
to late_initcall().
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [alsa-devel] [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-20 20:40 ` Russell King - ARM Linux
@ 2011-12-20 20:51 ` Janusz Krzysztofik
0 siblings, 0 replies; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-20 20:51 UTC (permalink / raw)
To: alsa-devel
Cc: Russell King - ARM Linux, Dmitry Torokhov, Tony Lindgren,
Mark Brown, linux-kernel, Jarkko Nikula, linux-input, linux-omap,
Liam Girdwood, linux-arm-kernel
On Tuesday 20 of December 2011 at 21:40:46, Russell King - ARM Linux wrote:
> On Tue, Dec 20, 2011 at 12:28:32AM +0100, Janusz Krzysztofik wrote:
> > diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> > index d4d08bd..56ffd7c 100644
> > --- a/drivers/input/serio/ams_delta_serio.c
> > +++ b/drivers/input/serio/ams_delta_serio.c
> > @@ -165,6 +165,9 @@ serio:
> > kfree(ams_delta_serio);
> > return err;
> > }
> > +#ifndef MODULE
> > +late_initcall(ams_delta_serio_init);
> > +#else
> > module_init(ams_delta_serio_init);
> >
> > static void __exit ams_delta_serio_exit(void)
> > @@ -175,3 +178,4 @@ static void __exit ams_delta_serio_exit(void)
> > gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> > }
> > module_exit(ams_delta_serio_exit);
> > +#endif
>
> It's worth noting:
>
> #ifndef MODULE
> #define late_initcall(fn) __define_initcall("7",fn,7)
> #else /* MODULE */
> #define late_initcall(fn) module_init(fn)
>
> So really, all these ifndefs aren't required. Just change the module_init()
> to late_initcall().
Thanks, I'll follow your pattern. My reason for using those ifdefery was
a comment still found in include/linux/init.h:
#else /* MODULE */
/* Don't use these in modules, but some people do... */
#define early_initcall(fn) module_init(fn)
#define core_initcall(fn) module_init(fn)
...
#define late_initcall(fn) module_init(fn)
Thanks,
Janusz
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 1/7 v2] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-19 23:28 ` [PATCH v2 1/7][RESEND] ARM: OMAP1: ams-delta: register latch dependent devices later Janusz Krzysztofik
2011-12-20 18:06 ` Tony Lindgren
2011-12-20 20:40 ` Russell King - ARM Linux
@ 2011-12-20 21:54 ` Janusz Krzysztofik
2011-12-21 19:08 ` Tony Lindgren
2 siblings, 1 reply; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-20 21:54 UTC (permalink / raw)
To: Tony Lindgren
Cc: Dmitry Torokhov, Jarkko Nikula, Liam Girdwood, Mark Brown,
Russell King - ARM Linux, linux-omap, linux-arm-kernel,
linux-kernel, alsa-devel, linux-input, Janusz Krzysztofik
In preparation to converting Amstrad Delta on-board latches to
basic_mmio_gpio devices, registration of platform devices which depend
on latches and will require initialization of their GPIO pins first,
should be moved out of .machine_init down to late_initcall level, as the
gpio-generic driver is not available until device_initcall time. The
latch reset operation, which will be replaced with GPIO initialization,
must also be moved to late_initcall for the same reason.
Since there was already another, separate arch_initcall function for
setting up one of those latch dependent devices, the on-board modem
device, reuse that function, i.e., rename it to a name that matches the
new purpose, extend with other device setup relocated from
.machine_init, and move down to the late_initcall level.
While being at it, add missing gpio_free() in case the modem platform
device registration fails.
Thanks to Tony Lindgren <tony@atomide.com> who suggested this approach
instead of shifting up the gpio-generic driver initialization.
In addition, defer registration of the Amstrad Delta ASoC and serio
devices, done from their device driver files, until late_initcall time,
as those drivers will depend on their GPIO pins already requested from
the board late_init() function until updated to register their GPIO pins
themselves.
Created and tested against linux-3.2-rc6.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
Changes since the initial version of this patch:
* use late_initcall() unconditionally in modules, requested by Russell
King (thanks!); an updated patch 7/7 will follow,
* in the changelog message, move credits to Tony up a bit, since the
person responsible for other changes (he might not necessarily like)
is me, not him ;).
Comments copied from this patch initial submission:
This patch was not present in the initial submission, it replaces the
old patch 1/10, providing an alternative solution not touching the
gpio-generic driver.
arch/arm/mach-omap1/board-ams-delta.c | 28 ++++++++++++++++++++--------
drivers/input/serio/ams_delta_serio.c | 2 +-
sound/soc/omap/ams-delta.c | 2 +-
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index b0f15d2..50987c9 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -275,11 +275,14 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
};
static struct platform_device *ams_delta_devices[] __initdata = {
- &ams_delta_nand_device,
&ams_delta_kp_device,
+ &ams_delta_camera_device,
+};
+
+static struct platform_device *late_devices[] __initdata = {
+ &ams_delta_nand_device,
&ams_delta_lcd_device,
&ams_delta_led_device,
- &ams_delta_camera_device,
};
static void __init ams_delta_init(void)
@@ -307,9 +310,6 @@ static void __init ams_delta_init(void)
omap_serial_init();
omap_register_i2c_bus(1, 100, NULL, 0);
- /* Clear latch2 (NAND, LCD, modem enable) */
- ams_delta_latch2_write(~0, 0);
-
omap1_usb_init(&ams_delta_usb_config);
omap1_set_camera_info(&ams_delta_camera_platform_data);
#ifdef CONFIG_LEDS_TRIGGERS
@@ -345,13 +345,18 @@ static struct platform_device ams_delta_modem_device = {
},
};
-static int __init ams_delta_modem_init(void)
+static int __init late_init(void)
{
int err;
if (!machine_is_ams_delta())
return -ENODEV;
+ /* Clear latch2 (NAND, LCD, modem enable) */
+ ams_delta_latch2_write(~0, 0);
+
+ platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
+
omap_cfg_reg(M14_1510_GPIO2);
ams_delta_modem_ports[0].irq =
gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
@@ -367,9 +372,16 @@ static int __init ams_delta_modem_init(void)
AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
- return platform_device_register(&ams_delta_modem_device);
+ err = platform_device_register(&ams_delta_modem_device);
+ if (err)
+ goto gpio_free;
+ return 0;
+
+gpio_free:
+ gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
+ return err;
}
-arch_initcall(ams_delta_modem_init);
+late_initcall(late_init);
static void __init ams_delta_map_io(void)
{
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index d4d08bd..835d37a 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -165,7 +165,7 @@ serio:
kfree(ams_delta_serio);
return err;
}
-module_init(ams_delta_serio_init);
+late_initcall(ams_delta_serio_init);
static void __exit ams_delta_serio_exit(void)
{
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index ccb8a6a..be81bc7 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -636,7 +636,7 @@ err:
platform_device_put(ams_delta_audio_platform_device);
return ret;
}
-module_init(ams_delta_module_init);
+late_initcall(ams_delta_module_init);
static void __exit ams_delta_module_exit(void)
{
--
1.7.3.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH v2 1/7 v2] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-20 21:54 ` [PATCH v2 1/7 v2] " Janusz Krzysztofik
@ 2011-12-21 19:08 ` Tony Lindgren
2011-12-21 19:51 ` Janusz Krzysztofik
0 siblings, 1 reply; 24+ messages in thread
From: Tony Lindgren @ 2011-12-21 19:08 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: alsa-devel, Mark Brown, Russell King - ARM Linux, Dmitry Torokhov,
linux-kernel, linux-arm-kernel, linux-input, linux-omap,
Liam Girdwood, Jarkko Nikula
* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 13:23]:
> In preparation to converting Amstrad Delta on-board latches to
> basic_mmio_gpio devices, registration of platform devices which depend
> on latches and will require initialization of their GPIO pins first,
> should be moved out of .machine_init down to late_initcall level, as the
> gpio-generic driver is not available until device_initcall time. The
> latch reset operation, which will be replaced with GPIO initialization,
> must also be moved to late_initcall for the same reason.
>
> Since there was already another, separate arch_initcall function for
> setting up one of those latch dependent devices, the on-board modem
> device, reuse that function, i.e., rename it to a name that matches the
> new purpose, extend with other device setup relocated from
> .machine_init, and move down to the late_initcall level.
>
> While being at it, add missing gpio_free() in case the modem platform
> device registration fails.
>
> Thanks to Tony Lindgren <tony@atomide.com> who suggested this approach
> instead of shifting up the gpio-generic driver initialization.
>
> In addition, defer registration of the Amstrad Delta ASoC and serio
> devices, done from their device driver files, until late_initcall time,
> as those drivers will depend on their GPIO pins already requested from
> the board late_init() function until updated to register their GPIO pins
> themselves.
>
> Created and tested against linux-3.2-rc6.
>
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Planning to apply this series. Dmitry, care to ack the drivers/input/serio/
related change?
Regards,
Tony
> ---
> Changes since the initial version of this patch:
> * use late_initcall() unconditionally in modules, requested by Russell
> King (thanks!); an updated patch 7/7 will follow,
> * in the changelog message, move credits to Tony up a bit, since the
> person responsible for other changes (he might not necessarily like)
> is me, not him ;).
>
> Comments copied from this patch initial submission:
> This patch was not present in the initial submission, it replaces the
> old patch 1/10, providing an alternative solution not touching the
> gpio-generic driver.
>
> arch/arm/mach-omap1/board-ams-delta.c | 28 ++++++++++++++++++++--------
> drivers/input/serio/ams_delta_serio.c | 2 +-
> sound/soc/omap/ams-delta.c | 2 +-
> 3 files changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> index b0f15d2..50987c9 100644
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -275,11 +275,14 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
> };
>
> static struct platform_device *ams_delta_devices[] __initdata = {
> - &ams_delta_nand_device,
> &ams_delta_kp_device,
> + &ams_delta_camera_device,
> +};
> +
> +static struct platform_device *late_devices[] __initdata = {
> + &ams_delta_nand_device,
> &ams_delta_lcd_device,
> &ams_delta_led_device,
> - &ams_delta_camera_device,
> };
>
> static void __init ams_delta_init(void)
> @@ -307,9 +310,6 @@ static void __init ams_delta_init(void)
> omap_serial_init();
> omap_register_i2c_bus(1, 100, NULL, 0);
>
> - /* Clear latch2 (NAND, LCD, modem enable) */
> - ams_delta_latch2_write(~0, 0);
> -
> omap1_usb_init(&ams_delta_usb_config);
> omap1_set_camera_info(&ams_delta_camera_platform_data);
> #ifdef CONFIG_LEDS_TRIGGERS
> @@ -345,13 +345,18 @@ static struct platform_device ams_delta_modem_device = {
> },
> };
>
> -static int __init ams_delta_modem_init(void)
> +static int __init late_init(void)
> {
> int err;
>
> if (!machine_is_ams_delta())
> return -ENODEV;
>
> + /* Clear latch2 (NAND, LCD, modem enable) */
> + ams_delta_latch2_write(~0, 0);
> +
> + platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
> +
> omap_cfg_reg(M14_1510_GPIO2);
> ams_delta_modem_ports[0].irq =
> gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> @@ -367,9 +372,16 @@ static int __init ams_delta_modem_init(void)
> AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
> AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
>
> - return platform_device_register(&ams_delta_modem_device);
> + err = platform_device_register(&ams_delta_modem_device);
> + if (err)
> + goto gpio_free;
> + return 0;
> +
> +gpio_free:
> + gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> + return err;
> }
> -arch_initcall(ams_delta_modem_init);
> +late_initcall(late_init);
>
> static void __init ams_delta_map_io(void)
> {
> diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> index d4d08bd..835d37a 100644
> --- a/drivers/input/serio/ams_delta_serio.c
> +++ b/drivers/input/serio/ams_delta_serio.c
> @@ -165,7 +165,7 @@ serio:
> kfree(ams_delta_serio);
> return err;
> }
> -module_init(ams_delta_serio_init);
> +late_initcall(ams_delta_serio_init);
>
> static void __exit ams_delta_serio_exit(void)
> {
> diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
> index ccb8a6a..be81bc7 100644
> --- a/sound/soc/omap/ams-delta.c
> +++ b/sound/soc/omap/ams-delta.c
> @@ -636,7 +636,7 @@ err:
> platform_device_put(ams_delta_audio_platform_device);
> return ret;
> }
> -module_init(ams_delta_module_init);
> +late_initcall(ams_delta_module_init);
>
> static void __exit ams_delta_module_exit(void)
> {
> --
> 1.7.3.4
>
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH v2 1/7 v2] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-21 19:08 ` Tony Lindgren
@ 2011-12-21 19:51 ` Janusz Krzysztofik
2011-12-21 20:07 ` Tony Lindgren
0 siblings, 1 reply; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-21 19:51 UTC (permalink / raw)
To: Tony Lindgren
Cc: alsa-devel, Mark Brown, Russell King - ARM Linux, Dmitry Torokhov,
linux-kernel, linux-arm-kernel, linux-input, linux-omap,
Liam Girdwood, Jarkko Nikula
On Wednesday 21 of December 2011 at 20:08:15, Tony Lindgren wrote:
> * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 13:23]:
> > In preparation to converting Amstrad Delta on-board latches to
> > basic_mmio_gpio devices, registration of platform devices which depend
> > on latches and will require initialization of their GPIO pins first,
> > should be moved out of .machine_init down to late_initcall level, as the
> > gpio-generic driver is not available until device_initcall time. The
> > latch reset operation, which will be replaced with GPIO initialization,
> > must also be moved to late_initcall for the same reason.
> >
> > Since there was already another, separate arch_initcall function for
> > setting up one of those latch dependent devices, the on-board modem
> > device, reuse that function, i.e., rename it to a name that matches the
> > new purpose, extend with other device setup relocated from
> > .machine_init, and move down to the late_initcall level.
> >
> > While being at it, add missing gpio_free() in case the modem platform
> > device registration fails.
> >
> > Thanks to Tony Lindgren <tony@atomide.com> who suggested this approach
> > instead of shifting up the gpio-generic driver initialization.
> >
> > In addition, defer registration of the Amstrad Delta ASoC and serio
> > devices, done from their device driver files, until late_initcall time,
> > as those drivers will depend on their GPIO pins already requested from
> > the board late_init() function until updated to register their GPIO pins
> > themselves.
> >
> > Created and tested against linux-3.2-rc6.
> >
> > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
>
> Planning to apply this series. Dmitry, care to ack the drivers/input/serio/
> related change?
Don't we need Jarkko's or Mark's or Liam's ack as well for the change to
the sound/soc/omap/ams-delta.c file?
Thanks,
Janusz
> Regards,
>
> Tony
>
> > ---
> > Changes since the initial version of this patch:
> > * use late_initcall() unconditionally in modules, requested by Russell
> > King (thanks!); an updated patch 7/7 will follow,
> > * in the changelog message, move credits to Tony up a bit, since the
> > person responsible for other changes (he might not necessarily like)
> > is me, not him ;).
> >
> > Comments copied from this patch initial submission:
> > This patch was not present in the initial submission, it replaces the
> > old patch 1/10, providing an alternative solution not touching the
> > gpio-generic driver.
> >
> > arch/arm/mach-omap1/board-ams-delta.c | 28 ++++++++++++++++++++--------
> > drivers/input/serio/ams_delta_serio.c | 2 +-
> > sound/soc/omap/ams-delta.c | 2 +-
> > 3 files changed, 22 insertions(+), 10 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> > index b0f15d2..50987c9 100644
> > --- a/arch/arm/mach-omap1/board-ams-delta.c
> > +++ b/arch/arm/mach-omap1/board-ams-delta.c
> > @@ -275,11 +275,14 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
> > };
> >
> > static struct platform_device *ams_delta_devices[] __initdata = {
> > - &ams_delta_nand_device,
> > &ams_delta_kp_device,
> > + &ams_delta_camera_device,
> > +};
> > +
> > +static struct platform_device *late_devices[] __initdata = {
> > + &ams_delta_nand_device,
> > &ams_delta_lcd_device,
> > &ams_delta_led_device,
> > - &ams_delta_camera_device,
> > };
> >
> > static void __init ams_delta_init(void)
> > @@ -307,9 +310,6 @@ static void __init ams_delta_init(void)
> > omap_serial_init();
> > omap_register_i2c_bus(1, 100, NULL, 0);
> >
> > - /* Clear latch2 (NAND, LCD, modem enable) */
> > - ams_delta_latch2_write(~0, 0);
> > -
> > omap1_usb_init(&ams_delta_usb_config);
> > omap1_set_camera_info(&ams_delta_camera_platform_data);
> > #ifdef CONFIG_LEDS_TRIGGERS
> > @@ -345,13 +345,18 @@ static struct platform_device ams_delta_modem_device = {
> > },
> > };
> >
> > -static int __init ams_delta_modem_init(void)
> > +static int __init late_init(void)
> > {
> > int err;
> >
> > if (!machine_is_ams_delta())
> > return -ENODEV;
> >
> > + /* Clear latch2 (NAND, LCD, modem enable) */
> > + ams_delta_latch2_write(~0, 0);
> > +
> > + platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
> > +
> > omap_cfg_reg(M14_1510_GPIO2);
> > ams_delta_modem_ports[0].irq =
> > gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> > @@ -367,9 +372,16 @@ static int __init ams_delta_modem_init(void)
> > AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
> > AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
> >
> > - return platform_device_register(&ams_delta_modem_device);
> > + err = platform_device_register(&ams_delta_modem_device);
> > + if (err)
> > + goto gpio_free;
> > + return 0;
> > +
> > +gpio_free:
> > + gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> > + return err;
> > }
> > -arch_initcall(ams_delta_modem_init);
> > +late_initcall(late_init);
> >
> > static void __init ams_delta_map_io(void)
> > {
> > diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> > index d4d08bd..835d37a 100644
> > --- a/drivers/input/serio/ams_delta_serio.c
> > +++ b/drivers/input/serio/ams_delta_serio.c
> > @@ -165,7 +165,7 @@ serio:
> > kfree(ams_delta_serio);
> > return err;
> > }
> > -module_init(ams_delta_serio_init);
> > +late_initcall(ams_delta_serio_init);
> >
> > static void __exit ams_delta_serio_exit(void)
> > {
> > diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
> > index ccb8a6a..be81bc7 100644
> > --- a/sound/soc/omap/ams-delta.c
> > +++ b/sound/soc/omap/ams-delta.c
> > @@ -636,7 +636,7 @@ err:
> > platform_device_put(ams_delta_audio_platform_device);
> > return ret;
> > }
> > -module_init(ams_delta_module_init);
> > +late_initcall(ams_delta_module_init);
> >
> > static void __exit ams_delta_module_exit(void)
> > {
>
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH v2 1/7 v2] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-21 19:51 ` Janusz Krzysztofik
@ 2011-12-21 20:07 ` Tony Lindgren
2011-12-22 10:39 ` Janusz Krzysztofik
0 siblings, 1 reply; 24+ messages in thread
From: Tony Lindgren @ 2011-12-21 20:07 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: Dmitry Torokhov, Jarkko Nikula, Liam Girdwood, Mark Brown,
Russell King - ARM Linux, linux-omap, linux-arm-kernel,
linux-kernel, alsa-devel, linux-input
* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111221 11:20]:
> On Wednesday 21 of December 2011 at 20:08:15, Tony Lindgren wrote:
> > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 13:23]:
> > > In preparation to converting Amstrad Delta on-board latches to
> > > basic_mmio_gpio devices, registration of platform devices which depend
> > > on latches and will require initialization of their GPIO pins first,
> > > should be moved out of .machine_init down to late_initcall level, as the
> > > gpio-generic driver is not available until device_initcall time. The
> > > latch reset operation, which will be replaced with GPIO initialization,
> > > must also be moved to late_initcall for the same reason.
> > >
> > > Since there was already another, separate arch_initcall function for
> > > setting up one of those latch dependent devices, the on-board modem
> > > device, reuse that function, i.e., rename it to a name that matches the
> > > new purpose, extend with other device setup relocated from
> > > .machine_init, and move down to the late_initcall level.
> > >
> > > While being at it, add missing gpio_free() in case the modem platform
> > > device registration fails.
> > >
> > > Thanks to Tony Lindgren <tony@atomide.com> who suggested this approach
> > > instead of shifting up the gpio-generic driver initialization.
> > >
> > > In addition, defer registration of the Amstrad Delta ASoC and serio
> > > devices, done from their device driver files, until late_initcall time,
> > > as those drivers will depend on their GPIO pins already requested from
> > > the board late_init() function until updated to register their GPIO pins
> > > themselves.
> > >
> > > Created and tested against linux-3.2-rc6.
> > >
> > > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> >
> > Planning to apply this series. Dmitry, care to ack the drivers/input/serio/
> > related change?
>
> Don't we need Jarkko's or Mark's or Liam's ack as well for the change to
> the sound/soc/omap/ams-delta.c file?
Yes, you're right.
Tony
> > > Changes since the initial version of this patch:
> > > * use late_initcall() unconditionally in modules, requested by Russell
> > > King (thanks!); an updated patch 7/7 will follow,
> > > * in the changelog message, move credits to Tony up a bit, since the
> > > person responsible for other changes (he might not necessarily like)
> > > is me, not him ;).
> > >
> > > Comments copied from this patch initial submission:
> > > This patch was not present in the initial submission, it replaces the
> > > old patch 1/10, providing an alternative solution not touching the
> > > gpio-generic driver.
> > >
> > > arch/arm/mach-omap1/board-ams-delta.c | 28 ++++++++++++++++++++--------
> > > drivers/input/serio/ams_delta_serio.c | 2 +-
> > > sound/soc/omap/ams-delta.c | 2 +-
> > > 3 files changed, 22 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> > > index b0f15d2..50987c9 100644
> > > --- a/arch/arm/mach-omap1/board-ams-delta.c
> > > +++ b/arch/arm/mach-omap1/board-ams-delta.c
> > > @@ -275,11 +275,14 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
> > > };
> > >
> > > static struct platform_device *ams_delta_devices[] __initdata = {
> > > - &ams_delta_nand_device,
> > > &ams_delta_kp_device,
> > > + &ams_delta_camera_device,
> > > +};
> > > +
> > > +static struct platform_device *late_devices[] __initdata = {
> > > + &ams_delta_nand_device,
> > > &ams_delta_lcd_device,
> > > &ams_delta_led_device,
> > > - &ams_delta_camera_device,
> > > };
> > >
> > > static void __init ams_delta_init(void)
> > > @@ -307,9 +310,6 @@ static void __init ams_delta_init(void)
> > > omap_serial_init();
> > > omap_register_i2c_bus(1, 100, NULL, 0);
> > >
> > > - /* Clear latch2 (NAND, LCD, modem enable) */
> > > - ams_delta_latch2_write(~0, 0);
> > > -
> > > omap1_usb_init(&ams_delta_usb_config);
> > > omap1_set_camera_info(&ams_delta_camera_platform_data);
> > > #ifdef CONFIG_LEDS_TRIGGERS
> > > @@ -345,13 +345,18 @@ static struct platform_device ams_delta_modem_device = {
> > > },
> > > };
> > >
> > > -static int __init ams_delta_modem_init(void)
> > > +static int __init late_init(void)
> > > {
> > > int err;
> > >
> > > if (!machine_is_ams_delta())
> > > return -ENODEV;
> > >
> > > + /* Clear latch2 (NAND, LCD, modem enable) */
> > > + ams_delta_latch2_write(~0, 0);
> > > +
> > > + platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
> > > +
> > > omap_cfg_reg(M14_1510_GPIO2);
> > > ams_delta_modem_ports[0].irq =
> > > gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> > > @@ -367,9 +372,16 @@ static int __init ams_delta_modem_init(void)
> > > AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
> > > AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
> > >
> > > - return platform_device_register(&ams_delta_modem_device);
> > > + err = platform_device_register(&ams_delta_modem_device);
> > > + if (err)
> > > + goto gpio_free;
> > > + return 0;
> > > +
> > > +gpio_free:
> > > + gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> > > + return err;
> > > }
> > > -arch_initcall(ams_delta_modem_init);
> > > +late_initcall(late_init);
> > >
> > > static void __init ams_delta_map_io(void)
> > > {
> > > diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> > > index d4d08bd..835d37a 100644
> > > --- a/drivers/input/serio/ams_delta_serio.c
> > > +++ b/drivers/input/serio/ams_delta_serio.c
> > > @@ -165,7 +165,7 @@ serio:
> > > kfree(ams_delta_serio);
> > > return err;
> > > }
> > > -module_init(ams_delta_serio_init);
> > > +late_initcall(ams_delta_serio_init);
> > >
> > > static void __exit ams_delta_serio_exit(void)
> > > {
> > > diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
> > > index ccb8a6a..be81bc7 100644
> > > --- a/sound/soc/omap/ams-delta.c
> > > +++ b/sound/soc/omap/ams-delta.c
> > > @@ -636,7 +636,7 @@ err:
> > > platform_device_put(ams_delta_audio_platform_device);
> > > return ret;
> > > }
> > > -module_init(ams_delta_module_init);
> > > +late_initcall(ams_delta_module_init);
> > >
> > > static void __exit ams_delta_module_exit(void)
> > > {
> >
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH v2 1/7 v2] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-21 20:07 ` Tony Lindgren
@ 2011-12-22 10:39 ` Janusz Krzysztofik
2011-12-22 11:08 ` Jarkko Nikula
0 siblings, 1 reply; 24+ messages in thread
From: Janusz Krzysztofik @ 2011-12-22 10:39 UTC (permalink / raw)
To: Jarkko Nikula, Liam Girdwood, Mark Brown
Cc: Tony Lindgren, Dmitry Torokhov, Russell King - ARM Linux,
linux-omap, linux-arm-kernel, linux-kernel, alsa-devel,
linux-input
On Wednesday 21 of December 2011 at 21:07:29, Tony Lindgren wrote:
> * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111221 11:20]:
> > On Wednesday 21 of December 2011 at 20:08:15, Tony Lindgren wrote:
> > > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 13:23]:
> > > > In preparation to converting Amstrad Delta on-board latches to
> > > > basic_mmio_gpio devices, registration of platform devices which depend
> > > > on latches and will require initialization of their GPIO pins first,
> > > > should be moved out of .machine_init down to late_initcall level, as the
> > > > gpio-generic driver is not available until device_initcall time. The
> > > > latch reset operation, which will be replaced with GPIO initialization,
> > > > must also be moved to late_initcall for the same reason.
> > > >
> > > > Since there was already another, separate arch_initcall function for
> > > > setting up one of those latch dependent devices, the on-board modem
> > > > device, reuse that function, i.e., rename it to a name that matches the
> > > > new purpose, extend with other device setup relocated from
> > > > .machine_init, and move down to the late_initcall level.
> > > >
> > > > While being at it, add missing gpio_free() in case the modem platform
> > > > device registration fails.
> > > >
> > > > Thanks to Tony Lindgren <tony@atomide.com> who suggested this approach
> > > > instead of shifting up the gpio-generic driver initialization.
> > > >
> > > > In addition, defer registration of the Amstrad Delta ASoC and serio
> > > > devices, done from their device driver files, until late_initcall time,
> > > > as those drivers will depend on their GPIO pins already requested from
> > > > the board late_init() function until updated to register their GPIO pins
> > > > themselves.
> > > >
> > > > Created and tested against linux-3.2-rc6.
> > > >
> > > > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> > >
> > > Planning to apply this series. Dmitry, care to ack the drivers/input/serio/
> > > related change?
> >
> > Don't we need Jarkko's or Mark's or Liam's ack as well for the change to
> > the sound/soc/omap/ams-delta.c file?
>
> Yes, you're right.
Jarkko, Mark or Liam, care to ack this change, moving the Amstrad Delta
sound card registration to late_initcall?
Thanks,
Janusz
> > > > Changes since the initial version of this patch:
> > > > * use late_initcall() unconditionally in modules, requested by Russell
> > > > King (thanks!); an updated patch 7/7 will follow,
> > > > * in the changelog message, move credits to Tony up a bit, since the
> > > > person responsible for other changes (he might not necessarily like)
> > > > is me, not him ;).
> > > >
> > > > Comments copied from this patch initial submission:
> > > > This patch was not present in the initial submission, it replaces the
> > > > old patch 1/10, providing an alternative solution not touching the
> > > > gpio-generic driver.
> > > >
> > > > arch/arm/mach-omap1/board-ams-delta.c | 28 ++++++++++++++++++++--------
> > > > drivers/input/serio/ams_delta_serio.c | 2 +-
> > > > sound/soc/omap/ams-delta.c | 2 +-
> > > > 3 files changed, 22 insertions(+), 10 deletions(-)
> > > >
> > > > diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> > > > index b0f15d2..50987c9 100644
> > > > --- a/arch/arm/mach-omap1/board-ams-delta.c
> > > > +++ b/arch/arm/mach-omap1/board-ams-delta.c
> > > > @@ -275,11 +275,14 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
> > > > };
> > > >
> > > > static struct platform_device *ams_delta_devices[] __initdata = {
> > > > - &ams_delta_nand_device,
> > > > &ams_delta_kp_device,
> > > > + &ams_delta_camera_device,
> > > > +};
> > > > +
> > > > +static struct platform_device *late_devices[] __initdata = {
> > > > + &ams_delta_nand_device,
> > > > &ams_delta_lcd_device,
> > > > &ams_delta_led_device,
> > > > - &ams_delta_camera_device,
> > > > };
> > > >
> > > > static void __init ams_delta_init(void)
> > > > @@ -307,9 +310,6 @@ static void __init ams_delta_init(void)
> > > > omap_serial_init();
> > > > omap_register_i2c_bus(1, 100, NULL, 0);
> > > >
> > > > - /* Clear latch2 (NAND, LCD, modem enable) */
> > > > - ams_delta_latch2_write(~0, 0);
> > > > -
> > > > omap1_usb_init(&ams_delta_usb_config);
> > > > omap1_set_camera_info(&ams_delta_camera_platform_data);
> > > > #ifdef CONFIG_LEDS_TRIGGERS
> > > > @@ -345,13 +345,18 @@ static struct platform_device ams_delta_modem_device = {
> > > > },
> > > > };
> > > >
> > > > -static int __init ams_delta_modem_init(void)
> > > > +static int __init late_init(void)
> > > > {
> > > > int err;
> > > >
> > > > if (!machine_is_ams_delta())
> > > > return -ENODEV;
> > > >
> > > > + /* Clear latch2 (NAND, LCD, modem enable) */
> > > > + ams_delta_latch2_write(~0, 0);
> > > > +
> > > > + platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
> > > > +
> > > > omap_cfg_reg(M14_1510_GPIO2);
> > > > ams_delta_modem_ports[0].irq =
> > > > gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> > > > @@ -367,9 +372,16 @@ static int __init ams_delta_modem_init(void)
> > > > AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
> > > > AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
> > > >
> > > > - return platform_device_register(&ams_delta_modem_device);
> > > > + err = platform_device_register(&ams_delta_modem_device);
> > > > + if (err)
> > > > + goto gpio_free;
> > > > + return 0;
> > > > +
> > > > +gpio_free:
> > > > + gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
> > > > + return err;
> > > > }
> > > > -arch_initcall(ams_delta_modem_init);
> > > > +late_initcall(late_init);
> > > >
> > > > static void __init ams_delta_map_io(void)
> > > > {
> > > > diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> > > > index d4d08bd..835d37a 100644
> > > > --- a/drivers/input/serio/ams_delta_serio.c
> > > > +++ b/drivers/input/serio/ams_delta_serio.c
> > > > @@ -165,7 +165,7 @@ serio:
> > > > kfree(ams_delta_serio);
> > > > return err;
> > > > }
> > > > -module_init(ams_delta_serio_init);
> > > > +late_initcall(ams_delta_serio_init);
> > > >
> > > > static void __exit ams_delta_serio_exit(void)
> > > > {
> > > > diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
> > > > index ccb8a6a..be81bc7 100644
> > > > --- a/sound/soc/omap/ams-delta.c
> > > > +++ b/sound/soc/omap/ams-delta.c
> > > > @@ -636,7 +636,7 @@ err:
> > > > platform_device_put(ams_delta_audio_platform_device);
> > > > return ret;
> > > > }
> > > > -module_init(ams_delta_module_init);
> > > > +late_initcall(ams_delta_module_init);
> > > >
> > > > static void __exit ams_delta_module_exit(void)
> > > > {
> > >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH v2 1/7 v2] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-22 10:39 ` Janusz Krzysztofik
@ 2011-12-22 11:08 ` Jarkko Nikula
2011-12-22 11:10 ` Mark Brown
0 siblings, 1 reply; 24+ messages in thread
From: Jarkko Nikula @ 2011-12-22 11:08 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: Liam Girdwood, Mark Brown, Tony Lindgren, Dmitry Torokhov,
Russell King - ARM Linux, linux-omap, linux-arm-kernel,
linux-kernel, alsa-devel, linux-input
On 12/22/2011 12:39 PM, Janusz Krzysztofik wrote:
>>> Don't we need Jarkko's or Mark's or Liam's ack as well for the change to
>>> the sound/soc/omap/ams-delta.c file?
>>
>> Yes, you're right.
>
> Jarkko, Mark or Liam, care to ack this change, moving the Amstrad Delta
> sound card registration to late_initcall?
>
Unfortunately I haven't had time to look at the series but I'm fine with
sound/soc/omap/ams-delta.c change.
--
Jarkko
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 1/7 v2] ARM: OMAP1: ams-delta: register latch dependent devices later
2011-12-22 11:08 ` Jarkko Nikula
@ 2011-12-22 11:10 ` Mark Brown
0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2011-12-22 11:10 UTC (permalink / raw)
To: Jarkko Nikula
Cc: Janusz Krzysztofik, Liam Girdwood, Tony Lindgren, Dmitry Torokhov,
Russell King - ARM Linux, linux-omap, linux-arm-kernel,
linux-kernel, alsa-devel, linux-input
On Thu, Dec 22, 2011 at 01:08:12PM +0200, Jarkko Nikula wrote:
> On 12/22/2011 12:39 PM, Janusz Krzysztofik wrote:
Guys *please* delete irrelevant context from mails. I wasn't reading
any of the rest of it since nothing about the subject line says anything
about anything relevant and there was no content anywhere near the start
of the actual mails. I only saw this because Jarkko did trim the
context.
> >Jarkko, Mark or Liam, care to ack this change, moving the Amstrad Delta
> >sound card registration to late_initcall?
> Unfortunately I haven't had time to look at the series but I'm fine
> with sound/soc/omap/ams-delta.c change.
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 24+ messages in thread