* [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO
@ 2011-12-11 20:11 Janusz Krzysztofik
2011-12-11 20:12 ` [PATCH 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO Janusz Krzysztofik
` (6 more replies)
0 siblings, 7 replies; 27+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:11 UTC (permalink / raw)
To: Tony Lindgren, Grant Likely, Dmitry Torokhov, Richard Purdie,
David Woodhouse, Tomi Valkeinen, Jarkko Nikula
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
linux-input, linux-mtd, linux-fbdev, alsa-devel, Liam Girdwood,
Mark Brown
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.
Janusz Krzysztofik (10):
GPIO: gpio-generic: Move initialization up to postcore
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
ARM: OMAP1: ams-delta: Use GPIO API in modem setup
ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
omapfb: lcd_ams_delta: Drive control lines over GPIO
input: serio: ams-delta: toggle keyboard power over GPIO
ARM: OMAP1: ams-delta: drop custom I/O functions
arch/arm/mach-omap1/Kconfig | 2 +
arch/arm/mach-omap1/board-ams-delta.c | 220 +++++++++++++++++----
arch/arm/plat-omap/include/plat/board-ams-delta.h | 50 ++---
drivers/gpio/gpio-generic.c | 2 +-
drivers/input/serio/ams_delta_serio.c | 45 +++--
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 | 21 ++-
11 files changed, 309 insertions(+), 277 deletions(-)
delete mode 100644 drivers/leds/leds-ams-delta.c
--
1.7.3.4
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO
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 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO Janusz Krzysztofik
2011-12-11 20:12 ` Janusz Krzysztofik
@ 2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-12 8:18 ` Dmitry Torokhov
2011-12-11 20:12 ` Janusz Krzysztofik
` (3 subsequent siblings)
6 siblings, 1 reply; 27+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:12 UTC (permalink / raw)
To: Tony Lindgren, Dmitry Torokhov
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
linux-input
Don't use Amstrad Delta custom I/O functions once GPIO interface is
available for the underlying hardware.
Depends on patch 8/10 "omapfb: lcd_ams_delta: Drive control lines over
GPIO".
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
arch/arm/mach-omap1/board-ams-delta.c | 5 --
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
drivers/input/serio/ams_delta_serio.c | 45 +++++++++++---------
3 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index b7422e3..587118c 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -232,11 +232,6 @@ static struct gpio _latch_gpios[] __initconst = {
.label = "dockit2",
},
{
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_pwr",
- },
- {
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
.flags = GPIOF_OUT_INIT_LOW,
.label = "keybrd_dataout",
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 1d0706e..004c827 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,8 +28,6 @@
#if defined (CONFIG_MACH_AMS_DELTA)
-#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
-#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index d4d08bd..1499c7d 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
static int ams_delta_serio_open(struct serio *serio)
{
/* enable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
- AMD_DELTA_LATCH2_KEYBRD_PWR);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
return 0;
}
@@ -101,9 +100,26 @@ static int ams_delta_serio_open(struct serio *serio)
static void ams_delta_serio_close(struct serio *serio)
{
/* disable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
}
+static struct gpio _gpios[] __initconst_or_module = {
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-data",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-clock",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-power",
+ },
+};
static int __init ams_delta_serio_init(void)
{
int err;
@@ -123,19 +139,11 @@ static int __init ams_delta_serio_init(void)
strlcpy(ams_delta_serio->phys, "GPIO/serio0",
sizeof(ams_delta_serio->phys));
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+ err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
if (err) {
- pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
+ pr_err("ams_delta_serio: Couldn't request gpio pins\n");
goto serio;
}
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
-
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
- if (err) {
- pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
- goto gpio_data;
- }
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
@@ -143,7 +151,7 @@ static int __init ams_delta_serio_init(void)
if (err < 0) {
pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
- goto gpio_clk;
+ goto gpio;
}
/*
* Since GPIO register handling for keyboard clock pin is performed
@@ -157,10 +165,8 @@ static int __init ams_delta_serio_init(void)
dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
return 0;
-gpio_clk:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
-gpio_data:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+gpio:
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
serio:
kfree(ams_delta_serio);
return err;
@@ -171,7 +177,6 @@ static void __exit ams_delta_serio_exit(void)
{
serio_unregister_port(ams_delta_serio);
free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
}
module_exit(ams_delta_serio_exit);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO
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 ` Janusz Krzysztofik
` (5 subsequent siblings)
6 siblings, 0 replies; 27+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:12 UTC (permalink / raw)
To: Tony Lindgren, Dmitry Torokhov
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
linux-input
Don't use Amstrad Delta custom I/O functions once GPIO interface is
available for the underlying hardware.
Depends on patch 8/10 "omapfb: lcd_ams_delta: Drive control lines over
GPIO".
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
arch/arm/mach-omap1/board-ams-delta.c | 5 --
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
drivers/input/serio/ams_delta_serio.c | 45 +++++++++++---------
3 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index b7422e3..587118c 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -232,11 +232,6 @@ static struct gpio _latch_gpios[] __initconst = {
.label = "dockit2",
},
{
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_pwr",
- },
- {
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
.flags = GPIOF_OUT_INIT_LOW,
.label = "keybrd_dataout",
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 1d0706e..004c827 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,8 +28,6 @@
#if defined (CONFIG_MACH_AMS_DELTA)
-#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
-#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index d4d08bd..1499c7d 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
static int ams_delta_serio_open(struct serio *serio)
{
/* enable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
- AMD_DELTA_LATCH2_KEYBRD_PWR);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
return 0;
}
@@ -101,9 +100,26 @@ static int ams_delta_serio_open(struct serio *serio)
static void ams_delta_serio_close(struct serio *serio)
{
/* disable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
}
+static struct gpio _gpios[] __initconst_or_module = {
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-data",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-clock",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-power",
+ },
+};
static int __init ams_delta_serio_init(void)
{
int err;
@@ -123,19 +139,11 @@ static int __init ams_delta_serio_init(void)
strlcpy(ams_delta_serio->phys, "GPIO/serio0",
sizeof(ams_delta_serio->phys));
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+ err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
if (err) {
- pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
+ pr_err("ams_delta_serio: Couldn't request gpio pins\n");
goto serio;
}
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
-
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
- if (err) {
- pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
- goto gpio_data;
- }
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
@@ -143,7 +151,7 @@ static int __init ams_delta_serio_init(void)
if (err < 0) {
pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
- goto gpio_clk;
+ goto gpio;
}
/*
* Since GPIO register handling for keyboard clock pin is performed
@@ -157,10 +165,8 @@ static int __init ams_delta_serio_init(void)
dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
return 0;
-gpio_clk:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
-gpio_data:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+gpio:
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
serio:
kfree(ams_delta_serio);
return err;
@@ -171,7 +177,6 @@ static void __exit ams_delta_serio_exit(void)
{
serio_unregister_port(ams_delta_serio);
free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
}
module_exit(ams_delta_serio_exit);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO
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; 27+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:12 UTC (permalink / raw)
To: Tony Lindgren, Dmitry Torokhov
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
linux-input
Don't use Amstrad Delta custom I/O functions once GPIO interface is
available for the underlying hardware.
Depends on patch 8/10 "omapfb: lcd_ams_delta: Drive control lines over
GPIO".
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
arch/arm/mach-omap1/board-ams-delta.c | 5 --
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
drivers/input/serio/ams_delta_serio.c | 45 +++++++++++---------
3 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index b7422e3..587118c 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -232,11 +232,6 @@ static struct gpio _latch_gpios[] __initconst = {
.label = "dockit2",
},
{
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_pwr",
- },
- {
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
.flags = GPIOF_OUT_INIT_LOW,
.label = "keybrd_dataout",
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 1d0706e..004c827 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,8 +28,6 @@
#if defined (CONFIG_MACH_AMS_DELTA)
-#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
-#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index d4d08bd..1499c7d 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
static int ams_delta_serio_open(struct serio *serio)
{
/* enable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
- AMD_DELTA_LATCH2_KEYBRD_PWR);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
return 0;
}
@@ -101,9 +100,26 @@ static int ams_delta_serio_open(struct serio *serio)
static void ams_delta_serio_close(struct serio *serio)
{
/* disable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
}
+static struct gpio _gpios[] __initconst_or_module = {
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-data",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-clock",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-power",
+ },
+};
static int __init ams_delta_serio_init(void)
{
int err;
@@ -123,19 +139,11 @@ static int __init ams_delta_serio_init(void)
strlcpy(ams_delta_serio->phys, "GPIO/serio0",
sizeof(ams_delta_serio->phys));
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+ err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
if (err) {
- pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
+ pr_err("ams_delta_serio: Couldn't request gpio pins\n");
goto serio;
}
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
-
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
- if (err) {
- pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
- goto gpio_data;
- }
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
@@ -143,7 +151,7 @@ static int __init ams_delta_serio_init(void)
if (err < 0) {
pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
- goto gpio_clk;
+ goto gpio;
}
/*
* Since GPIO register handling for keyboard clock pin is performed
@@ -157,10 +165,8 @@ static int __init ams_delta_serio_init(void)
dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
return 0;
-gpio_clk:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
-gpio_data:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+gpio:
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
serio:
kfree(ams_delta_serio);
return err;
@@ -171,7 +177,6 @@ static void __exit ams_delta_serio_exit(void)
{
serio_unregister_port(ams_delta_serio);
free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
}
module_exit(ams_delta_serio_exit);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO
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 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO Janusz Krzysztofik
@ 2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-11 20:12 ` Janusz Krzysztofik
` (4 subsequent siblings)
6 siblings, 0 replies; 27+ messages in thread
From: Janusz Krzysztofik @ 2011-12-11 20:12 UTC (permalink / raw)
To: Tony Lindgren, Dmitry Torokhov
Cc: linux-input, linux-omap, linux-kernel, linux-arm-kernel,
Janusz Krzysztofik
Don't use Amstrad Delta custom I/O functions once GPIO interface is
available for the underlying hardware.
Depends on patch 8/10 "omapfb: lcd_ams_delta: Drive control lines over
GPIO".
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
arch/arm/mach-omap1/board-ams-delta.c | 5 --
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
drivers/input/serio/ams_delta_serio.c | 45 +++++++++++---------
3 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index b7422e3..587118c 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -232,11 +232,6 @@ static struct gpio _latch_gpios[] __initconst = {
.label = "dockit2",
},
{
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_pwr",
- },
- {
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
.flags = GPIOF_OUT_INIT_LOW,
.label = "keybrd_dataout",
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 1d0706e..004c827 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,8 +28,6 @@
#if defined (CONFIG_MACH_AMS_DELTA)
-#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
-#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index d4d08bd..1499c7d 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
static int ams_delta_serio_open(struct serio *serio)
{
/* enable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
- AMD_DELTA_LATCH2_KEYBRD_PWR);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
return 0;
}
@@ -101,9 +100,26 @@ static int ams_delta_serio_open(struct serio *serio)
static void ams_delta_serio_close(struct serio *serio)
{
/* disable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
}
+static struct gpio _gpios[] __initconst_or_module = {
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-data",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-clock",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-power",
+ },
+};
static int __init ams_delta_serio_init(void)
{
int err;
@@ -123,19 +139,11 @@ static int __init ams_delta_serio_init(void)
strlcpy(ams_delta_serio->phys, "GPIO/serio0",
sizeof(ams_delta_serio->phys));
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+ err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
if (err) {
- pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
+ pr_err("ams_delta_serio: Couldn't request gpio pins\n");
goto serio;
}
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
-
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
- if (err) {
- pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
- goto gpio_data;
- }
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
@@ -143,7 +151,7 @@ static int __init ams_delta_serio_init(void)
if (err < 0) {
pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
- goto gpio_clk;
+ goto gpio;
}
/*
* Since GPIO register handling for keyboard clock pin is performed
@@ -157,10 +165,8 @@ static int __init ams_delta_serio_init(void)
dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
return 0;
-gpio_clk:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
-gpio_data:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+gpio:
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
serio:
kfree(ams_delta_serio);
return err;
@@ -171,7 +177,6 @@ static void __exit ams_delta_serio_exit(void)
{
serio_unregister_port(ams_delta_serio);
free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
}
module_exit(ams_delta_serio_exit);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 27+ 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; 27+ 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] 27+ messages in thread
* Re: [PATCH 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO
2011-12-11 20:12 ` Janusz Krzysztofik
@ 2011-12-12 8:18 ` Dmitry Torokhov
0 siblings, 0 replies; 27+ messages in thread
From: Dmitry Torokhov @ 2011-12-12 8:18 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: Tony Lindgren, linux-omap, linux-arm-kernel, linux-kernel,
linux-input
On Sun, Dec 11, 2011 at 09:12:07PM +0100, Janusz Krzysztofik wrote:
> Don't use Amstrad Delta custom I/O functions once GPIO interface is
> available for the underlying hardware.
>
> Depends on patch 8/10 "omapfb: lcd_ams_delta: Drive control lines over
> GPIO".
>
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
> ---
> arch/arm/mach-omap1/board-ams-delta.c | 5 --
> arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
> drivers/input/serio/ams_delta_serio.c | 45 +++++++++++---------
> 3 files changed, 25 insertions(+), 27 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> index b7422e3..587118c 100644
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -232,11 +232,6 @@ static struct gpio _latch_gpios[] __initconst = {
> .label = "dockit2",
> },
> {
> - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
> - .flags = GPIOF_OUT_INIT_LOW,
> - .label = "keybrd_pwr",
> - },
> - {
> .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
> .flags = GPIOF_OUT_INIT_LOW,
> .label = "keybrd_dataout",
> 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 1d0706e..004c827 100644
> --- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
> +++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
> @@ -28,8 +28,6 @@
>
> #if defined (CONFIG_MACH_AMS_DELTA)
>
> -#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
> -#define AMD_DELTA_LATCH2_KEYBRD_DATA 0x0200
> #define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
> #define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
>
> diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> index d4d08bd..1499c7d 100644
> --- a/drivers/input/serio/ams_delta_serio.c
> +++ b/drivers/input/serio/ams_delta_serio.c
> @@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
> static int ams_delta_serio_open(struct serio *serio)
> {
> /* enable keyboard */
> - ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
> - AMD_DELTA_LATCH2_KEYBRD_PWR);
> + gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
>
> return 0;
> }
> @@ -101,9 +100,26 @@ static int ams_delta_serio_open(struct serio *serio)
> static void ams_delta_serio_close(struct serio *serio)
> {
> /* disable keyboard */
> - ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
> + gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
> }
>
> +static struct gpio _gpios[] __initconst_or_module = {
> + {
> + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
> + .flags = GPIOF_DIR_IN,
> + .label = "serio-data",
> + },
> + {
> + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
> + .flags = GPIOF_DIR_IN,
> + .label = "serio-clock",
> + },
> + {
> + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
> + .flags = GPIOF_OUT_INIT_LOW,
> + .label = "serio-power",
> + },
> +};
> static int __init ams_delta_serio_init(void)
> {
> int err;
> @@ -123,19 +139,11 @@ static int __init ams_delta_serio_init(void)
> strlcpy(ams_delta_serio->phys, "GPIO/serio0",
> sizeof(ams_delta_serio->phys));
>
> - err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
> + err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
> if (err) {
> - pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
> + pr_err("ams_delta_serio: Couldn't request gpio pins\n");
> goto serio;
> }
> - gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> -
> - err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
> - if (err) {
> - pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
> - goto gpio_data;
> - }
> - gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
>
> err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
> ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
> @@ -143,7 +151,7 @@ static int __init ams_delta_serio_init(void)
> if (err < 0) {
> pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
> gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
> - goto gpio_clk;
> + goto gpio;
> }
> /*
> * Since GPIO register handling for keyboard clock pin is performed
> @@ -157,10 +165,8 @@ static int __init ams_delta_serio_init(void)
> dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
>
> return 0;
> -gpio_clk:
> - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
> -gpio_data:
> - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> +gpio:
> + gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
> serio:
> kfree(ams_delta_serio);
> return err;
> @@ -171,7 +177,6 @@ static void __exit ams_delta_serio_exit(void)
> {
> serio_unregister_port(ams_delta_serio);
> free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
> - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
> - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> + gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
> }
> module_exit(ams_delta_serio_exit);
> --
> 1.7.3.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Dmitry
^ permalink raw reply [flat|nested] 27+ 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
2011-12-19 23:08 ` [PATCH v2 7/7] input: serio: ams-delta: toggle keyboard power over GPIO Janusz Krzysztofik
[not found] ` <83e934adfc691b347534edb7788a67ab2e6bd7e1.1324331816.git.jkrzyszt@tis.icnet.pl>
6 siblings, 1 reply; 27+ 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] 27+ messages in thread
* [PATCH v2 7/7] input: serio: ams-delta: toggle keyboard power over GPIO
2011-12-19 23:08 ` [PATCH v2 0/7] " Janusz Krzysztofik
@ 2011-12-19 23:08 ` Janusz Krzysztofik
2011-12-20 22:10 ` [PATCH] " Janusz Krzysztofik
0 siblings, 1 reply; 27+ 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,
Dmitry Torokhov, linux-input
Don't use Amstrad Delta custom I/O functions once GPIO interface is
available for the underlying hardware.
While requesting and initializing GPIO pins used, also take care of one
extra pin KEYBRD_DATAOUT which, even if not used by the driver, belongs
to the device and affects its functioning.
Once done, move the driver initialization back to the device_initcall
level, reverting the temporary chane introduced with patch 1/7 "ARM:
OMAP1: ams-delta: register latch dependent devices from late_initcall".
That change is no longer required once the driver takes care of
registering used GPIO pins, and it's better to initialize the device
before others using the latch2 based GPIO pins, otherwise a garbage is
reported on boot, perhaps due to random data already captured by the FIQ
handler while the keyboard related latch bits are written with random
values during initialization of those other latch2 dependent devices.
Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
basic_mmio_gpio"
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
Changes against initial version:
* was 9/10,
* rebased on top of v2 of patch 2/7, just in case,
* moved AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT pin handling from the board
code to the driver,
* reverted a temporary change to the driver initcall level, introduced
by the new solution provided with patch 1/7.
arch/arm/mach-omap1/board-ams-delta.c | 10 ----
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
drivers/input/serio/ams_delta_serio.c | 55 ++++++++++++---------
3 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 3aba8f9..673cf21 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -227,16 +227,6 @@ static struct gpio latch_gpios[] __initconst = {
.label = "dockit2",
},
{
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_pwr",
- },
- {
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_dataout",
- },
- {
.gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN,
.flags = GPIOF_OUT_INIT_LOW,
.label = "scard_rstin",
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 e9ad673..027e79e 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,8 +28,6 @@
#if defined (CONFIG_MACH_AMS_DELTA)
-#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
-#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
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index 56ffd7c..ef1ec40 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
static int ams_delta_serio_open(struct serio *serio)
{
/* enable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
- AMD_DELTA_LATCH2_KEYBRD_PWR);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
return 0;
}
@@ -101,9 +100,32 @@ static int ams_delta_serio_open(struct serio *serio)
static void ams_delta_serio_close(struct serio *serio)
{
/* disable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
}
+static struct gpio _gpios[] __initconst_or_module = {
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-data",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-clock",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-power",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-dataout",
+ },
+};
+
static int __init ams_delta_serio_init(void)
{
int err;
@@ -123,19 +145,11 @@ static int __init ams_delta_serio_init(void)
strlcpy(ams_delta_serio->phys, "GPIO/serio0",
sizeof(ams_delta_serio->phys));
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+ err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
if (err) {
- pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
+ pr_err("ams_delta_serio: Couldn't request gpio pins\n");
goto serio;
}
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
-
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
- if (err) {
- pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
- goto gpio_data;
- }
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
@@ -143,7 +157,7 @@ static int __init ams_delta_serio_init(void)
if (err < 0) {
pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
- goto gpio_clk;
+ goto gpio;
}
/*
* Since GPIO register handling for keyboard clock pin is performed
@@ -157,25 +171,18 @@ static int __init ams_delta_serio_init(void)
dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
return 0;
-gpio_clk:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
-gpio_data:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+gpio:
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
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)
{
serio_unregister_port(ams_delta_serio);
free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
}
module_exit(ams_delta_serio_exit);
-#endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [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; 27+ 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] 27+ 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; 27+ 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] 27+ 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; 27+ 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] 27+ 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; 27+ 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] 27+ 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; 27+ 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] 27+ 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; 27+ 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] 27+ 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; 27+ 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] 27+ messages in thread
* [PATCH] input: serio: ams-delta: toggle keyboard power over GPIO
2011-12-19 23:08 ` [PATCH v2 7/7] input: serio: ams-delta: toggle keyboard power over GPIO Janusz Krzysztofik
@ 2011-12-20 22:10 ` Janusz Krzysztofik
2011-12-21 19:09 ` Tony Lindgren
0 siblings, 1 reply; 27+ messages in thread
From: Janusz Krzysztofik @ 2011-12-20 22:10 UTC (permalink / raw)
To: Tony Lindgren
Cc: Dmitry Torokhov, Russell King - ARM Linux, linux-omap,
linux-arm-kernel, linux-kernel, linux-input, Janusz Krzysztofik
Don't use Amstrad Delta custom I/O functions once GPIO interface is
available for the underlying hardware.
While requesting and initializing GPIO pins used, also take care of one
extra pin KEYBRD_DATAOUT which, even if not used by the driver, belongs
to the device and affects its functioning.
Once done, move the driver initialization back to the device_initcall
level, reverting the temporary chane introduced with patch 1/7 "ARM:
OMAP1: ams-delta: register latch dependent devices later". That change
is no longer required once the driver takes care of registering used
GPIO pins, and it's better to initialize the device before others using
the latch2 based GPIO pins, otherwise a garbage is reported on boot,
perhaps due to random data already captured by the FIQ handler while the
keyboard related latch bits are written with random values during
initialization of those other latch2 dependent devices.
Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
basic_mmio_gpio"
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
Hi,
I'm submitting only this one refreshed on top of updated 1/7. All others
(2/7-6/7) don't require any refresh, can be rebased smoothly.
Thanks,
Janusz
Changes against version 2:
* refreshed on top of updated patch 1/7 v2,
* changelog: corrected patch 1/7 summary (was inaccurate).
Changes against initial version:
* was 9/10,
* rebased on top of v2 of patch 2/7, just in case,
* moved AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT pin handling from the board
code to the driver,
* reverted a temporary change to the driver initcall level, introduced
by the new solution provided with patch 1/7.
arch/arm/mach-omap1/board-ams-delta.c | 10 ----
arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
drivers/input/serio/ams_delta_serio.c | 53 ++++++++++++--------
:x 3 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 3aba8f9..673cf21 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -227,16 +227,6 @@ static struct gpio latch_gpios[] __initconst = {
.label = "dockit2",
},
{
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_pwr",
- },
- {
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_dataout",
- },
- {
.gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN,
.flags = GPIOF_OUT_INIT_LOW,
.label = "scard_rstin",
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 e9ad673..027e79e 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,8 +28,6 @@
#if defined (CONFIG_MACH_AMS_DELTA)
-#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
-#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
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index 835d37a..ef1ec40 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
static int ams_delta_serio_open(struct serio *serio)
{
/* enable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
- AMD_DELTA_LATCH2_KEYBRD_PWR);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
return 0;
}
@@ -101,9 +100,32 @@ static int ams_delta_serio_open(struct serio *serio)
static void ams_delta_serio_close(struct serio *serio)
{
/* disable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
}
+static struct gpio _gpios[] __initconst_or_module = {
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-data",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-clock",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-power",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-dataout",
+ },
+};
+
static int __init ams_delta_serio_init(void)
{
int err;
@@ -123,19 +145,11 @@ static int __init ams_delta_serio_init(void)
strlcpy(ams_delta_serio->phys, "GPIO/serio0",
sizeof(ams_delta_serio->phys));
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+ err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
if (err) {
- pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
+ pr_err("ams_delta_serio: Couldn't request gpio pins\n");
goto serio;
}
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
-
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
- if (err) {
- pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
- goto gpio_data;
- }
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
@@ -143,7 +157,7 @@ static int __init ams_delta_serio_init(void)
if (err < 0) {
pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
- goto gpio_clk;
+ goto gpio;
}
/*
* Since GPIO register handling for keyboard clock pin is performed
@@ -157,21 +171,18 @@ static int __init ams_delta_serio_init(void)
dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
return 0;
-gpio_clk:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
-gpio_data:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+gpio:
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
serio:
kfree(ams_delta_serio);
return err;
}
-late_initcall(ams_delta_serio_init);
+module_init(ams_delta_serio_init);
static void __exit ams_delta_serio_exit(void)
{
serio_unregister_port(ams_delta_serio);
free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+ gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
}
module_exit(ams_delta_serio_exit);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 27+ 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; 27+ 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] 27+ messages in thread
* Re: [PATCH] input: serio: ams-delta: toggle keyboard power over GPIO
2011-12-20 22:10 ` [PATCH] " Janusz Krzysztofik
@ 2011-12-21 19:09 ` Tony Lindgren
2011-12-21 19:55 ` Janusz Krzysztofik
0 siblings, 1 reply; 27+ messages in thread
From: Tony Lindgren @ 2011-12-21 19:09 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: Dmitry Torokhov, Russell King - ARM Linux, linux-omap,
linux-arm-kernel, linux-kernel, linux-input
* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 13:39]:
> Don't use Amstrad Delta custom I/O functions once GPIO interface is
> available for the underlying hardware.
>
> While requesting and initializing GPIO pins used, also take care of one
> extra pin KEYBRD_DATAOUT which, even if not used by the driver, belongs
> to the device and affects its functioning.
>
> Once done, move the driver initialization back to the device_initcall
> level, reverting the temporary chane introduced with patch 1/7 "ARM:
> OMAP1: ams-delta: register latch dependent devices later". That change
> is no longer required once the driver takes care of registering used
> GPIO pins, and it's better to initialize the device before others using
> the latch2 based GPIO pins, otherwise a garbage is reported on boot,
> perhaps due to random data already captured by the FIQ handler while the
> keyboard related latch bits are written with random values during
> initialization of those other latch2 dependent devices.
>
> Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
> basic_mmio_gpio"
>
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
I'm assuming Dmitry's ack for an earlier version of this patch also
covers this one when applying.
Regards,
Tony
> ---
> Hi,
> I'm submitting only this one refreshed on top of updated 1/7. All others
> (2/7-6/7) don't require any refresh, can be rebased smoothly.
>
> Thanks,
> Janusz
>
>
> Changes against version 2:
> * refreshed on top of updated patch 1/7 v2,
> * changelog: corrected patch 1/7 summary (was inaccurate).
>
> Changes against initial version:
> * was 9/10,
> * rebased on top of v2 of patch 2/7, just in case,
> * moved AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT pin handling from the board
> code to the driver,
> * reverted a temporary change to the driver initcall level, introduced
> by the new solution provided with patch 1/7.
>
>
> arch/arm/mach-omap1/board-ams-delta.c | 10 ----
> arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
> drivers/input/serio/ams_delta_serio.c | 53 ++++++++++++--------
> :x 3 files changed, 32 insertions(+), 33 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> index 3aba8f9..673cf21 100644
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -227,16 +227,6 @@ static struct gpio latch_gpios[] __initconst = {
> .label = "dockit2",
> },
> {
> - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
> - .flags = GPIOF_OUT_INIT_LOW,
> - .label = "keybrd_pwr",
> - },
> - {
> - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
> - .flags = GPIOF_OUT_INIT_LOW,
> - .label = "keybrd_dataout",
> - },
> - {
> .gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN,
> .flags = GPIOF_OUT_INIT_LOW,
> .label = "scard_rstin",
> 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 e9ad673..027e79e 100644
> --- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
> +++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
> @@ -28,8 +28,6 @@
>
> #if defined (CONFIG_MACH_AMS_DELTA)
>
> -#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
> -#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
> diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> index 835d37a..ef1ec40 100644
> --- a/drivers/input/serio/ams_delta_serio.c
> +++ b/drivers/input/serio/ams_delta_serio.c
> @@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
> static int ams_delta_serio_open(struct serio *serio)
> {
> /* enable keyboard */
> - ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
> - AMD_DELTA_LATCH2_KEYBRD_PWR);
> + gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
>
> return 0;
> }
> @@ -101,9 +100,32 @@ static int ams_delta_serio_open(struct serio *serio)
> static void ams_delta_serio_close(struct serio *serio)
> {
> /* disable keyboard */
> - ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
> + gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
> }
>
> +static struct gpio _gpios[] __initconst_or_module = {
> + {
> + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
> + .flags = GPIOF_DIR_IN,
> + .label = "serio-data",
> + },
> + {
> + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
> + .flags = GPIOF_DIR_IN,
> + .label = "serio-clock",
> + },
> + {
> + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
> + .flags = GPIOF_OUT_INIT_LOW,
> + .label = "serio-power",
> + },
> + {
> + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
> + .flags = GPIOF_OUT_INIT_LOW,
> + .label = "serio-dataout",
> + },
> +};
> +
> static int __init ams_delta_serio_init(void)
> {
> int err;
> @@ -123,19 +145,11 @@ static int __init ams_delta_serio_init(void)
> strlcpy(ams_delta_serio->phys, "GPIO/serio0",
> sizeof(ams_delta_serio->phys));
>
> - err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
> + err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
> if (err) {
> - pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
> + pr_err("ams_delta_serio: Couldn't request gpio pins\n");
> goto serio;
> }
> - gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> -
> - err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
> - if (err) {
> - pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
> - goto gpio_data;
> - }
> - gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
>
> err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
> ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
> @@ -143,7 +157,7 @@ static int __init ams_delta_serio_init(void)
> if (err < 0) {
> pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
> gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
> - goto gpio_clk;
> + goto gpio;
> }
> /*
> * Since GPIO register handling for keyboard clock pin is performed
> @@ -157,21 +171,18 @@ static int __init ams_delta_serio_init(void)
> dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
>
> return 0;
> -gpio_clk:
> - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
> -gpio_data:
> - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> +gpio:
> + gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
> serio:
> kfree(ams_delta_serio);
> return err;
> }
> -late_initcall(ams_delta_serio_init);
> +module_init(ams_delta_serio_init);
>
> static void __exit ams_delta_serio_exit(void)
> {
> serio_unregister_port(ams_delta_serio);
> free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
> - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
> - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> + gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
> }
> module_exit(ams_delta_serio_exit);
> --
> 1.7.3.4
>
^ permalink raw reply [flat|nested] 27+ 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; 27+ 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] 27+ messages in thread
* Re: [PATCH] input: serio: ams-delta: toggle keyboard power over GPIO
2011-12-21 19:09 ` Tony Lindgren
@ 2011-12-21 19:55 ` Janusz Krzysztofik
2011-12-22 17:45 ` Dmitry Torokhov
0 siblings, 1 reply; 27+ messages in thread
From: Janusz Krzysztofik @ 2011-12-21 19:55 UTC (permalink / raw)
To: Tony Lindgren
Cc: Dmitry Torokhov, Russell King - ARM Linux, linux-omap,
linux-arm-kernel, linux-kernel, linux-input
On Wednesday 21 of December 2011 at 20:09:45, Tony Lindgren wrote:
> * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 13:39]:
> > Don't use Amstrad Delta custom I/O functions once GPIO interface is
> > available for the underlying hardware.
> >
> > While requesting and initializing GPIO pins used, also take care of one
> > extra pin KEYBRD_DATAOUT which, even if not used by the driver, belongs
> > to the device and affects its functioning.
> >
> > Once done, move the driver initialization back to the device_initcall
> > level, reverting the temporary chane introduced with patch 1/7 "ARM:
> > OMAP1: ams-delta: register latch dependent devices later". That change
> > is no longer required once the driver takes care of registering used
> > GPIO pins, and it's better to initialize the device before others using
> > the latch2 based GPIO pins, otherwise a garbage is reported on boot,
> > perhaps due to random data already captured by the FIQ handler while the
> > keyboard related latch bits are written with random values during
> > initialization of those other latch2 dependent devices.
> >
> > Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
> > basic_mmio_gpio"
> >
> > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
>
> I'm assuming Dmitry's ack for an earlier version of this patch also
> covers this one when applying.
Hi Dmitry,
Can we assume your ack still valid for this version?
Thanks,
Janusz
> Regards,
>
> Tony
>
> > ---
> > Hi,
> > I'm submitting only this one refreshed on top of updated 1/7. All others
> > (2/7-6/7) don't require any refresh, can be rebased smoothly.
> >
> > Thanks,
> > Janusz
> >
> >
> > Changes against version 2:
> > * refreshed on top of updated patch 1/7 v2,
> > * changelog: corrected patch 1/7 summary (was inaccurate).
> >
> > Changes against initial version:
> > * was 9/10,
> > * rebased on top of v2 of patch 2/7, just in case,
> > * moved AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT pin handling from the board
> > code to the driver,
> > * reverted a temporary change to the driver initcall level, introduced
> > by the new solution provided with patch 1/7.
> >
> >
> > arch/arm/mach-omap1/board-ams-delta.c | 10 ----
> > arch/arm/plat-omap/include/plat/board-ams-delta.h | 2 -
> > drivers/input/serio/ams_delta_serio.c | 53 ++++++++++++--------
> > :x 3 files changed, 32 insertions(+), 33 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> > index 3aba8f9..673cf21 100644
> > --- a/arch/arm/mach-omap1/board-ams-delta.c
> > +++ b/arch/arm/mach-omap1/board-ams-delta.c
> > @@ -227,16 +227,6 @@ static struct gpio latch_gpios[] __initconst = {
> > .label = "dockit2",
> > },
> > {
> > - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
> > - .flags = GPIOF_OUT_INIT_LOW,
> > - .label = "keybrd_pwr",
> > - },
> > - {
> > - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
> > - .flags = GPIOF_OUT_INIT_LOW,
> > - .label = "keybrd_dataout",
> > - },
> > - {
> > .gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN,
> > .flags = GPIOF_OUT_INIT_LOW,
> > .label = "scard_rstin",
> > 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 e9ad673..027e79e 100644
> > --- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
> > +++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
> > @@ -28,8 +28,6 @@
> >
> > #if defined (CONFIG_MACH_AMS_DELTA)
> >
> > -#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
> > -#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
> > diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
> > index 835d37a..ef1ec40 100644
> > --- a/drivers/input/serio/ams_delta_serio.c
> > +++ b/drivers/input/serio/ams_delta_serio.c
> > @@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
> > static int ams_delta_serio_open(struct serio *serio)
> > {
> > /* enable keyboard */
> > - ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
> > - AMD_DELTA_LATCH2_KEYBRD_PWR);
> > + gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
> >
> > return 0;
> > }
> > @@ -101,9 +100,32 @@ static int ams_delta_serio_open(struct serio *serio)
> > static void ams_delta_serio_close(struct serio *serio)
> > {
> > /* disable keyboard */
> > - ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
> > + gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
> > }
> >
> > +static struct gpio _gpios[] __initconst_or_module = {
> > + {
> > + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
> > + .flags = GPIOF_DIR_IN,
> > + .label = "serio-data",
> > + },
> > + {
> > + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
> > + .flags = GPIOF_DIR_IN,
> > + .label = "serio-clock",
> > + },
> > + {
> > + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
> > + .flags = GPIOF_OUT_INIT_LOW,
> > + .label = "serio-power",
> > + },
> > + {
> > + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
> > + .flags = GPIOF_OUT_INIT_LOW,
> > + .label = "serio-dataout",
> > + },
> > +};
> > +
> > static int __init ams_delta_serio_init(void)
> > {
> > int err;
> > @@ -123,19 +145,11 @@ static int __init ams_delta_serio_init(void)
> > strlcpy(ams_delta_serio->phys, "GPIO/serio0",
> > sizeof(ams_delta_serio->phys));
> >
> > - err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
> > + err = gpio_request_array(_gpios, ARRAY_SIZE(_gpios));
> > if (err) {
> > - pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
> > + pr_err("ams_delta_serio: Couldn't request gpio pins\n");
> > goto serio;
> > }
> > - gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> > -
> > - err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
> > - if (err) {
> > - pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
> > - goto gpio_data;
> > - }
> > - gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
> >
> > err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
> > ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
> > @@ -143,7 +157,7 @@ static int __init ams_delta_serio_init(void)
> > if (err < 0) {
> > pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
> > gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
> > - goto gpio_clk;
> > + goto gpio;
> > }
> > /*
> > * Since GPIO register handling for keyboard clock pin is performed
> > @@ -157,21 +171,18 @@ static int __init ams_delta_serio_init(void)
> > dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
> >
> > return 0;
> > -gpio_clk:
> > - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
> > -gpio_data:
> > - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> > +gpio:
> > + gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
> > serio:
> > kfree(ams_delta_serio);
> > return err;
> > }
> > -late_initcall(ams_delta_serio_init);
> > +module_init(ams_delta_serio_init);
> >
> > static void __exit ams_delta_serio_exit(void)
> > {
> > serio_unregister_port(ams_delta_serio);
> > free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
> > - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
> > - gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
> > + gpio_free_array(_gpios, ARRAY_SIZE(_gpios));
> > }
> > module_exit(ams_delta_serio_exit);
>
^ permalink raw reply [flat|nested] 27+ 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; 27+ 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] 27+ 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; 27+ 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] 27+ 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; 27+ 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] 27+ 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; 27+ 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] 27+ messages in thread
* Re: [PATCH] input: serio: ams-delta: toggle keyboard power over GPIO
2011-12-21 19:55 ` Janusz Krzysztofik
@ 2011-12-22 17:45 ` Dmitry Torokhov
2011-12-22 18:06 ` Tony Lindgren
0 siblings, 1 reply; 27+ messages in thread
From: Dmitry Torokhov @ 2011-12-22 17:45 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: Tony Lindgren, Russell King - ARM Linux, linux-omap,
linux-arm-kernel, linux-kernel, linux-input
On Wed, Dec 21, 2011 at 08:55:09PM +0100, Janusz Krzysztofik wrote:
> On Wednesday 21 of December 2011 at 20:09:45, Tony Lindgren wrote:
> > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 13:39]:
> > > Don't use Amstrad Delta custom I/O functions once GPIO interface is
> > > available for the underlying hardware.
> > >
> > > While requesting and initializing GPIO pins used, also take care of one
> > > extra pin KEYBRD_DATAOUT which, even if not used by the driver, belongs
> > > to the device and affects its functioning.
> > >
> > > Once done, move the driver initialization back to the device_initcall
> > > level, reverting the temporary chane introduced with patch 1/7 "ARM:
> > > OMAP1: ams-delta: register latch dependent devices later". That change
> > > is no longer required once the driver takes care of registering used
> > > GPIO pins, and it's better to initialize the device before others using
> > > the latch2 based GPIO pins, otherwise a garbage is reported on boot,
> > > perhaps due to random data already captured by the FIQ handler while the
> > > keyboard related latch bits are written with random values during
> > > initialization of those other latch2 dependent devices.
> > >
> > > Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
> > > basic_mmio_gpio"
> > >
> > > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> >
> > I'm assuming Dmitry's ack for an earlier version of this patch also
> > covers this one when applying.
>
> Hi Dmitry,
> Can we assume your ack still valid for this version?
>
Yes, please merge with your other changes.
BTW, if you could rename :static struct gpio _gpios" to "ams_delta_gpios"
that would be even better.
Thanks!
--
Dmitry
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] input: serio: ams-delta: toggle keyboard power over GPIO
2011-12-22 17:45 ` Dmitry Torokhov
@ 2011-12-22 18:06 ` Tony Lindgren
0 siblings, 0 replies; 27+ messages in thread
From: Tony Lindgren @ 2011-12-22 18:06 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Janusz Krzysztofik, Russell King - ARM Linux, linux-omap,
linux-arm-kernel, linux-kernel, linux-input
* Dmitry Torokhov <dmitry.torokhov@gmail.com> [111222 09:13]:
> On Wed, Dec 21, 2011 at 08:55:09PM +0100, Janusz Krzysztofik wrote:
> > On Wednesday 21 of December 2011 at 20:09:45, Tony Lindgren wrote:
> > > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [111220 13:39]:
> > > > Don't use Amstrad Delta custom I/O functions once GPIO interface is
> > > > available for the underlying hardware.
> > > >
> > > > While requesting and initializing GPIO pins used, also take care of one
> > > > extra pin KEYBRD_DATAOUT which, even if not used by the driver, belongs
> > > > to the device and affects its functioning.
> > > >
> > > > Once done, move the driver initialization back to the device_initcall
> > > > level, reverting the temporary chane introduced with patch 1/7 "ARM:
> > > > OMAP1: ams-delta: register latch dependent devices later". That change
> > > > is no longer required once the driver takes care of registering used
> > > > GPIO pins, and it's better to initialize the device before others using
> > > > the latch2 based GPIO pins, otherwise a garbage is reported on boot,
> > > > perhaps due to random data already captured by the FIQ handler while the
> > > > keyboard related latch bits are written with random values during
> > > > initialization of those other latch2 dependent devices.
> > > >
> > > > Depends on patch 2/7 "ARM: OMAP1: ams-delta: convert latches to
> > > > basic_mmio_gpio"
> > > >
> > > > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> > >
> > > I'm assuming Dmitry's ack for an earlier version of this patch also
> > > covers this one when applying.
> >
> > Hi Dmitry,
> > Can we assume your ack still valid for this version?
> >
>
> Yes, please merge with your other changes.
OK thanks.
> BTW, if you could rename :static struct gpio _gpios" to "ams_delta_gpios"
> that would be even better.
Done, pushing into omap1-part2 branch with the updated patch below.
Regards,
Tony
From: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Date: Tue, 20 Dec 2011 23:10:34 +0100
Subject: [PATCH] input: serio: ams-delta: toggle keyboard power over GPIO
Don't use Amstrad Delta custom I/O functions once GPIO interface is
available for the underlying hardware.
While requesting and initializing GPIO pins used, also take care of one
extra pin KEYBRD_DATAOUT which, even if not used by the driver, belongs
to the device and affects its functioning.
Once done, move the driver initialization back to the device_initcall
level, reverting the temporary chane introduced with patch 1/7 "ARM:
OMAP1: ams-delta: register latch dependent devices later". That change
is no longer required once the driver takes care of registering used
GPIO pins, and it's better to initialize the device before others using
the latch2 based GPIO pins, otherwise a garbage is reported on boot,
perhaps due to random data already captured by the FIQ handler while the
keyboard related latch bits are written with random values during
initialization of those other latch2 dependent devices.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
[tony@atomide.com: renamed _gpios to ams_delta_gpios]
Signed-off-by: Tony Lindgren <tony@atomide.com>
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 3aba8f9..673cf21 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -227,16 +227,6 @@ static struct gpio latch_gpios[] __initconst = {
.label = "dockit2",
},
{
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_pwr",
- },
- {
- .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "keybrd_dataout",
- },
- {
.gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN,
.flags = GPIOF_OUT_INIT_LOW,
.label = "scard_rstin",
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 e9ad673..027e79e 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -28,8 +28,6 @@
#if defined (CONFIG_MACH_AMS_DELTA)
-#define AMD_DELTA_LATCH2_KEYBRD_PWR 0x0100
-#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
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index 835d37a..0571e2e 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
static int ams_delta_serio_open(struct serio *serio)
{
/* enable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
- AMD_DELTA_LATCH2_KEYBRD_PWR);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
return 0;
}
@@ -101,9 +100,32 @@ static int ams_delta_serio_open(struct serio *serio)
static void ams_delta_serio_close(struct serio *serio)
{
/* disable keyboard */
- ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
+ gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
}
+static struct gpio ams_delta_gpios[] __initconst_or_module = {
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-data",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
+ .flags = GPIOF_DIR_IN,
+ .label = "serio-clock",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-power",
+ },
+ {
+ .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
+ .flags = GPIOF_OUT_INIT_LOW,
+ .label = "serio-dataout",
+ },
+};
+
static int __init ams_delta_serio_init(void)
{
int err;
@@ -123,19 +145,12 @@ static int __init ams_delta_serio_init(void)
strlcpy(ams_delta_serio->phys, "GPIO/serio0",
sizeof(ams_delta_serio->phys));
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+ err = gpio_request_array(ams_delta_gpios,
+ ARRAY_SIZE(ams_delta_gpios));
if (err) {
- pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
+ pr_err("ams_delta_serio: Couldn't request gpio pins\n");
goto serio;
}
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
-
- err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
- if (err) {
- pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
- goto gpio_data;
- }
- gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
@@ -143,7 +158,7 @@ static int __init ams_delta_serio_init(void)
if (err < 0) {
pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
- goto gpio_clk;
+ goto gpio;
}
/*
* Since GPIO register handling for keyboard clock pin is performed
@@ -157,21 +172,20 @@ static int __init ams_delta_serio_init(void)
dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
return 0;
-gpio_clk:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
-gpio_data:
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+gpio:
+ gpio_free_array(ams_delta_gpios,
+ ARRAY_SIZE(ams_delta_gpios));
serio:
kfree(ams_delta_serio);
return err;
}
-late_initcall(ams_delta_serio_init);
+module_init(ams_delta_serio_init);
static void __exit ams_delta_serio_exit(void)
{
serio_unregister_port(ams_delta_serio);
free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
- gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+ gpio_free_array(ams_delta_gpios,
+ ARRAY_SIZE(ams_delta_gpios));
}
module_exit(ams_delta_serio_exit);
^ permalink raw reply related [flat|nested] 27+ messages in thread
end of thread, other threads:[~2011-12-22 18:06 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 09/10] input: serio: ams-delta: Toggle keyboard power over GPIO Janusz Krzysztofik
2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-11 20:12 ` Janusz Krzysztofik
2011-12-12 8:18 ` Dmitry Torokhov
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
2011-12-19 23:08 ` [PATCH v2 0/7] " Janusz Krzysztofik
2011-12-19 23:08 ` [PATCH v2 7/7] input: serio: ams-delta: toggle keyboard power over GPIO Janusz Krzysztofik
2011-12-20 22:10 ` [PATCH] " Janusz Krzysztofik
2011-12-21 19:09 ` Tony Lindgren
2011-12-21 19:55 ` Janusz Krzysztofik
2011-12-22 17:45 ` Dmitry Torokhov
2011-12-22 18:06 ` Tony Lindgren
[not found] ` <83e934adfc691b347534edb7788a67ab2e6bd7e1.1324331816.git.jkrzyszt@tis.icnet.pl>
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:57 ` 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
2011-12-21 19:08 ` Tony Lindgren
2011-12-21 19:51 ` Janusz Krzysztofik
2011-12-21 20:07 ` Tony Lindgren
2011-12-22 10:39 ` Janusz Krzysztofik
2011-12-22 11:08 ` Jarkko Nikula
2011-12-22 11:10 ` 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).