* [PATCH] omap: rx51: Platform support for lp5523 led chip
@ 2011-03-31 12:17 Ameya Palande
2011-03-31 12:27 ` Felipe Balbi
2011-03-31 12:27 ` Aaro Koskinen
0 siblings, 2 replies; 14+ messages in thread
From: Ameya Palande @ 2011-03-31 12:17 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Signed-off-by: Mathias Nyman <mathias.nyman@nokia.com>
---
arch/arm/mach-omap2/board-rx51-peripherals.c | 81 ++++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index bbcb677..488916d 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -38,6 +38,7 @@
#include <sound/tpa6130a2-plat.h>
#include <media/radio-si4713.h>
#include <media/si4713.h>
+#include <linux/leds-lp5523.h>
#include <../drivers/staging/iio/light/tsl2563.h>
@@ -51,6 +52,7 @@
#define RX51_WL1251_IRQ_GPIO 42
#define RX51_FMTX_RESET_GPIO 163
#define RX51_FMTX_IRQ 53
+#define RX51_LP5523_CHIP_EN_GPIO 41
/* list all spi devices here */
enum {
@@ -67,6 +69,79 @@ static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
};
#endif
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+static struct lp5523_led_config rx51_lp5523_led_config[] = {
+ {
+ .chan_nr = 0,
+ .led_current = 50,
+ }, {
+ .chan_nr = 1,
+ .led_current = 50,
+ }, {
+ .chan_nr = 2,
+ .led_current = 50,
+ }, {
+ .chan_nr = 3,
+ .led_current = 50,
+ }, {
+ .chan_nr = 4,
+ .led_current = 50,
+ }, {
+ .chan_nr = 5,
+ .led_current = 50,
+ }, {
+ .chan_nr = 6,
+ .led_current = 50,
+ }, {
+ .chan_nr = 7,
+ .led_current = 50,
+ }, {
+ .chan_nr = 8,
+ .led_current = 50,
+ }
+};
+
+static int rx51_lp5523_setup(void)
+{
+ int err;
+
+ err = gpio_request(RX51_LP5523_CHIP_EN_GPIO, "lp5523_enable");
+ if (err < 0) {
+ pr_err("Unable to get lp5523_enable GPIO\n");
+ return err;
+ }
+
+ err = gpio_direction_output(RX51_LP5523_CHIP_EN_GPIO, 1);
+ if (err < 0) {
+ pr_err("Failed to change direction for %d GPIO\n",
+ RX51_LP5523_CHIP_EN_GPIO);
+ }
+ return err;
+}
+
+static void rx51_lp5523_release(void)
+{
+ gpio_free(RX51_LP5523_CHIP_EN_GPIO);
+}
+
+static void rx51_lp5523_enable(bool state)
+{
+ if (state)
+ gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, 1);
+ else
+ gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, 0);
+}
+
+static struct lp5523_platform_data rx51_lp5523_platform_data = {
+ .led_config = rx51_lp5523_led_config,
+ .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
+ .clock_mode = LP5523_CLOCK_AUTO,
+ .setup_resources = rx51_lp5523_setup,
+ .release_resources = rx51_lp5523_release,
+ .enable = rx51_lp5523_enable,
+};
+#endif
+
static struct omap2_mcspi_device_config wl1251_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1,
@@ -816,6 +891,12 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
.platform_data = &rx51_tsl2563_platform_data,
},
#endif
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+ {
+ I2C_BOARD_INFO("lp5523", 0x32),
+ .platform_data = &rx51_lp5523_platform_data,
+ },
+#endif
{
I2C_BOARD_INFO("tpa6130a2", 0x60),
.platform_data = &rx51_tpa6130a2_data,
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH] omap: rx51: Platform support for lp5523 led chip
2011-03-31 12:17 [PATCH] omap: rx51: Platform support for lp5523 led chip Ameya Palande
@ 2011-03-31 12:27 ` Felipe Balbi
2011-03-31 12:27 ` Aaro Koskinen
1 sibling, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2011-03-31 12:27 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Thu, Mar 31, 2011 at 03:17:57PM +0300, Ameya Palande wrote:
> +static int rx51_lp5523_setup(void)
> +{
> + int err;
> +
> + err = gpio_request(RX51_LP5523_CHIP_EN_GPIO, "lp5523_enable");
> + if (err < 0) {
> + pr_err("Unable to get lp5523_enable GPIO\n");
> + return err;
> + }
> +
> + err = gpio_direction_output(RX51_LP5523_CHIP_EN_GPIO, 1);
> + if (err < 0) {
> + pr_err("Failed to change direction for %d GPIO\n",
> + RX51_LP5523_CHIP_EN_GPIO);
> + }
you can combine these two into
gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
"lp5523_enable");
> + return err;
> +}
> +
> +static void rx51_lp5523_release(void)
> +{
> + gpio_free(RX51_LP5523_CHIP_EN_GPIO);
> +}
> +
> +static void rx51_lp5523_enable(bool state)
> +{
> + if (state)
> + gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, 1);
> + else
> + gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, 0);
how about:
gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state); ??
you drop a useless branch.
> +}
> +
> +static struct lp5523_platform_data rx51_lp5523_platform_data = {
should this be const ??
> + .led_config = rx51_lp5523_led_config,
> + .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
> + .clock_mode = LP5523_CLOCK_AUTO,
> + .setup_resources = rx51_lp5523_setup,
> + .release_resources = rx51_lp5523_release,
^ trailing whitespace
--
balbi
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] omap: rx51: Platform support for lp5523 led chip
2011-03-31 12:17 [PATCH] omap: rx51: Platform support for lp5523 led chip Ameya Palande
2011-03-31 12:27 ` Felipe Balbi
@ 2011-03-31 12:27 ` Aaro Koskinen
2011-03-31 13:38 ` [PATCHv2] " Ameya Palande
1 sibling, 1 reply; 14+ messages in thread
From: Aaro Koskinen @ 2011-03-31 12:27 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Thu, 31 Mar 2011, Ameya Palande wrote:
> +static int rx51_lp5523_setup(void)
> +{
> + int err;
> +
> + err = gpio_request(RX51_LP5523_CHIP_EN_GPIO, "lp5523_enable");
> + if (err < 0) {
> + pr_err("Unable to get lp5523_enable GPIO\n");
> + return err;
> + }
> +
> + err = gpio_direction_output(RX51_LP5523_CHIP_EN_GPIO, 1);
> + if (err < 0) {
> + pr_err("Failed to change direction for %d GPIO\n",
> + RX51_LP5523_CHIP_EN_GPIO);
The error branch is missing gpio_free(). You can fix that by replacing
these with just a single gpio_request_one() call.
> + }
> + return err;
> +}
> +
> +static void rx51_lp5523_release(void)
> +{
> + gpio_free(RX51_LP5523_CHIP_EN_GPIO);
> +}
> +
> +static void rx51_lp5523_enable(bool state)
> +{
> + if (state)
> + gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, 1);
> + else
> + gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, 0);
> +}
> +
> +static struct lp5523_platform_data rx51_lp5523_platform_data = {
> + .led_config = rx51_lp5523_led_config,
> + .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
> + .clock_mode = LP5523_CLOCK_AUTO,
> + .setup_resources = rx51_lp5523_setup,
> + .release_resources = rx51_lp5523_release,
> + .enable = rx51_lp5523_enable,
> +};
> +#endif
> +
> static struct omap2_mcspi_device_config wl1251_mcspi_config = {
> .turbo_mode = 0,
> .single_channel = 1,
> @@ -816,6 +891,12 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
> .platform_data = &rx51_tsl2563_platform_data,
> },
> #endif
> +#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
> + {
> + I2C_BOARD_INFO("lp5523", 0x32),
> + .platform_data = &rx51_lp5523_platform_data,
> + },
> +#endif
> {
> I2C_BOARD_INFO("tpa6130a2", 0x60),
> .platform_data = &rx51_tpa6130a2_data,
> --
> 1.7.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv2] omap: rx51: Platform support for lp5523 led chip
2011-03-31 12:27 ` Aaro Koskinen
@ 2011-03-31 13:38 ` Ameya Palande
2011-03-31 13:50 ` Jarkko Nikula
2011-03-31 14:26 ` Felipe Balbi
0 siblings, 2 replies; 14+ messages in thread
From: Ameya Palande @ 2011-03-31 13:38 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Signed-off-by: Mathias Nyman <mathias.nyman@nokia.com>
---
arch/arm/mach-omap2/board-rx51-peripherals.c | 74 ++++++++++++++++++++++++++
1 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index bbcb677..ed289d1 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -38,6 +38,7 @@
#include <sound/tpa6130a2-plat.h>
#include <media/radio-si4713.h>
#include <media/si4713.h>
+#include <linux/leds-lp5523.h>
#include <../drivers/staging/iio/light/tsl2563.h>
@@ -51,6 +52,7 @@
#define RX51_WL1251_IRQ_GPIO 42
#define RX51_FMTX_RESET_GPIO 163
#define RX51_FMTX_IRQ 53
+#define RX51_LP5523_CHIP_EN_GPIO 41
/* list all spi devices here */
enum {
@@ -67,6 +69,72 @@ static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
};
#endif
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+static struct lp5523_led_config rx51_lp5523_led_config[] = {
+ {
+ .chan_nr = 0,
+ .led_current = 50,
+ }, {
+ .chan_nr = 1,
+ .led_current = 50,
+ }, {
+ .chan_nr = 2,
+ .led_current = 50,
+ }, {
+ .chan_nr = 3,
+ .led_current = 50,
+ }, {
+ .chan_nr = 4,
+ .led_current = 50,
+ }, {
+ .chan_nr = 5,
+ .led_current = 50,
+ }, {
+ .chan_nr = 6,
+ .led_current = 50,
+ }, {
+ .chan_nr = 7,
+ .led_current = 50,
+ }, {
+ .chan_nr = 8,
+ .led_current = 50,
+ }
+};
+
+static int rx51_lp5523_setup(void)
+{
+ int err;
+
+ err = gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
+ "lp5523_enable");
+ if (err < 0) {
+ pr_err("Unable to get lp5523_enable GPIO\n");
+ return err;
+ }
+
+ return err;
+}
+
+static void rx51_lp5523_release(void)
+{
+ gpio_free(RX51_LP5523_CHIP_EN_GPIO);
+}
+
+static void rx51_lp5523_enable(bool state)
+{
+ gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
+}
+
+static struct lp5523_platform_data rx51_lp5523_platform_data = {
+ .led_config = rx51_lp5523_led_config,
+ .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
+ .clock_mode = LP5523_CLOCK_AUTO,
+ .setup_resources = rx51_lp5523_setup,
+ .release_resources = rx51_lp5523_release,
+ .enable = rx51_lp5523_enable,
+};
+#endif
+
static struct omap2_mcspi_device_config wl1251_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1,
@@ -816,6 +884,12 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
.platform_data = &rx51_tsl2563_platform_data,
},
#endif
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+ {
+ I2C_BOARD_INFO("lp5523", 0x32),
+ .platform_data = &rx51_lp5523_platform_data,
+ },
+#endif
{
I2C_BOARD_INFO("tpa6130a2", 0x60),
.platform_data = &rx51_tpa6130a2_data,
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2] omap: rx51: Platform support for lp5523 led chip
2011-03-31 13:38 ` [PATCHv2] " Ameya Palande
@ 2011-03-31 13:50 ` Jarkko Nikula
2011-03-31 14:26 ` Felipe Balbi
1 sibling, 0 replies; 14+ messages in thread
From: Jarkko Nikula @ 2011-03-31 13:50 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 31 Mar 2011 16:38:12 +0300
Ameya Palande <ameya.palande@nokia.com> wrote:
> Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
> Signed-off-by: Mathias Nyman <mathias.nyman@nokia.com>
> ---
> arch/arm/mach-omap2/board-rx51-peripherals.c | 74 ++++++++++++++++++++++++++
> 1 files changed, 74 insertions(+), 0 deletions(-)
>
Nice keyboard and rgb led blinking:
while true; do ls /sys/class/leds/lp5523\:channel?/brightness |xargs -I
{} bash -c 'echo $((RANDOM % 255)) > {}'; done
Tested-by: Jarkko Nikula <jhnikula@gmail.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv2] omap: rx51: Platform support for lp5523 led chip
2011-03-31 13:38 ` [PATCHv2] " Ameya Palande
2011-03-31 13:50 ` Jarkko Nikula
@ 2011-03-31 14:26 ` Felipe Balbi
2011-03-31 15:30 ` Ameya Palande
1 sibling, 1 reply; 14+ messages in thread
From: Felipe Balbi @ 2011-03-31 14:26 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Thu, Mar 31, 2011 at 04:38:12PM +0300, Ameya Palande wrote:
> +static int rx51_lp5523_setup(void)
> +{
> + int err;
> +
> + err = gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
> + "lp5523_enable");
> + if (err < 0) {
> + pr_err("Unable to get lp5523_enable GPIO\n");
> + return err;
> + }
> +
> + return err;
isn't enough to return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO,
GPIOF_DIR_OUT, "lp5523_enable"); ??
--
balbi
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv2] omap: rx51: Platform support for lp5523 led chip
2011-03-31 14:26 ` Felipe Balbi
@ 2011-03-31 15:30 ` Ameya Palande
2011-03-31 15:44 ` Felipe Balbi
0 siblings, 1 reply; 14+ messages in thread
From: Ameya Palande @ 2011-03-31 15:30 UTC (permalink / raw)
To: linux-arm-kernel
Hi Felipe,
On 03/31/2011 05:26 PM, ext Felipe Balbi wrote:
> Hi,
>
> On Thu, Mar 31, 2011 at 04:38:12PM +0300, Ameya Palande wrote:
>> +static int rx51_lp5523_setup(void)
>> +{
>> + int err;
>> +
>> + err = gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
>> + "lp5523_enable");
>> + if (err< 0) {
>> + pr_err("Unable to get lp5523_enable GPIO\n");
>> + return err;
>> + }
>> +
>> + return err;
>
> isn't enough to return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO,
> GPIOF_DIR_OUT, "lp5523_enable"); ??
But then we won't know the failure reason for lp5523_probe()
I would prefer printing an error!
Cheers,
Ameya.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv2] omap: rx51: Platform support for lp5523 led chip
2011-03-31 15:30 ` Ameya Palande
@ 2011-03-31 15:44 ` Felipe Balbi
2011-04-01 9:58 ` Ameya Palande
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Felipe Balbi @ 2011-03-31 15:44 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Mar 31, 2011 at 06:30:32PM +0300, Ameya Palande wrote:
> Hi Felipe,
>
> On 03/31/2011 05:26 PM, ext Felipe Balbi wrote:
> >Hi,
> >
> >On Thu, Mar 31, 2011 at 04:38:12PM +0300, Ameya Palande wrote:
> >>+static int rx51_lp5523_setup(void)
> >>+{
> >>+ int err;
> >>+
> >>+ err = gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
> >>+ "lp5523_enable");
> >>+ if (err< 0) {
> >>+ pr_err("Unable to get lp5523_enable GPIO\n");
> >>+ return err;
> >>+ }
> >>+
> >>+ return err;
> >
> >isn't enough to return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO,
> >GPIOF_DIR_OUT, "lp5523_enable"); ??
>
> But then we won't know the failure reason for lp5523_probe()
> I would prefer printing an error!
see that both gpio_request() and gpio_direction_output() have debugging
prints for error cases ;-)
--
balbi
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv2] omap: rx51: Platform support for lp5523 led chip
2011-03-31 15:44 ` Felipe Balbi
@ 2011-04-01 9:58 ` Ameya Palande
2011-04-01 10:16 ` [PATCHv3] " Ameya Palande
2011-04-05 12:00 ` [PATCHv2] " Ameya Palande
2 siblings, 0 replies; 14+ messages in thread
From: Ameya Palande @ 2011-04-01 9:58 UTC (permalink / raw)
To: linux-arm-kernel
Hi Felipe,
On 03/31/2011 06:44 PM, ext Felipe Balbi wrote:
> On Thu, Mar 31, 2011 at 06:30:32PM +0300, Ameya Palande wrote:
>> Hi Felipe,
>>
>> On 03/31/2011 05:26 PM, ext Felipe Balbi wrote:
>>> Hi,
>>>
>>> On Thu, Mar 31, 2011 at 04:38:12PM +0300, Ameya Palande wrote:
>>>> +static int rx51_lp5523_setup(void)
>>>> +{
>>>> + int err;
>>>> +
>>>> + err = gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
>>>> + "lp5523_enable");
>>>> + if (err< 0) {
>>>> + pr_err("Unable to get lp5523_enable GPIO\n");
>>>> + return err;
>>>> + }
>>>> +
>>>> + return err;
>>>
>>> isn't enough to return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO,
>>> GPIOF_DIR_OUT, "lp5523_enable"); ??
>>
>> But then we won't know the failure reason for lp5523_probe()
>> I would prefer printing an error!
>
> see that both gpio_request() and gpio_direction_output() have debugging
> prints for error cases ;-)
Agreed :) Thanks for the review!
Will send v3.
Cheers,
Ameya.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv3] omap: rx51: Platform support for lp5523 led chip
2011-03-31 15:44 ` Felipe Balbi
2011-04-01 9:58 ` Ameya Palande
@ 2011-04-01 10:16 ` Ameya Palande
2011-04-05 12:03 ` Felipe Balbi
2011-05-31 12:55 ` Tony Lindgren
2011-04-05 12:00 ` [PATCHv2] " Ameya Palande
2 siblings, 2 replies; 14+ messages in thread
From: Ameya Palande @ 2011-04-01 10:16 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Signed-off-by: Mathias Nyman <mathias.nyman@nokia.com>
---
arch/arm/mach-omap2/board-rx51-peripherals.c | 66 ++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index bbcb677..d8ec895 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -38,6 +38,7 @@
#include <sound/tpa6130a2-plat.h>
#include <media/radio-si4713.h>
#include <media/si4713.h>
+#include <linux/leds-lp5523.h>
#include <../drivers/staging/iio/light/tsl2563.h>
@@ -51,6 +52,7 @@
#define RX51_WL1251_IRQ_GPIO 42
#define RX51_FMTX_RESET_GPIO 163
#define RX51_FMTX_IRQ 53
+#define RX51_LP5523_CHIP_EN_GPIO 41
/* list all spi devices here */
enum {
@@ -67,6 +69,64 @@ static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
};
#endif
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+static struct lp5523_led_config rx51_lp5523_led_config[] = {
+ {
+ .chan_nr = 0,
+ .led_current = 50,
+ }, {
+ .chan_nr = 1,
+ .led_current = 50,
+ }, {
+ .chan_nr = 2,
+ .led_current = 50,
+ }, {
+ .chan_nr = 3,
+ .led_current = 50,
+ }, {
+ .chan_nr = 4,
+ .led_current = 50,
+ }, {
+ .chan_nr = 5,
+ .led_current = 50,
+ }, {
+ .chan_nr = 6,
+ .led_current = 50,
+ }, {
+ .chan_nr = 7,
+ .led_current = 50,
+ }, {
+ .chan_nr = 8,
+ .led_current = 50,
+ }
+};
+
+static int rx51_lp5523_setup(void)
+{
+ return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
+ "lp5523_enable");
+}
+
+static void rx51_lp5523_release(void)
+{
+ gpio_free(RX51_LP5523_CHIP_EN_GPIO);
+}
+
+static void rx51_lp5523_enable(bool state)
+{
+ gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
+}
+
+static struct lp5523_platform_data rx51_lp5523_platform_data = {
+ .led_config = rx51_lp5523_led_config,
+ .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
+ .clock_mode = LP5523_CLOCK_AUTO,
+ .setup_resources = rx51_lp5523_setup,
+ .release_resources = rx51_lp5523_release,
+ .enable = rx51_lp5523_enable,
+};
+#endif
+
static struct omap2_mcspi_device_config wl1251_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1,
@@ -816,6 +876,12 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
.platform_data = &rx51_tsl2563_platform_data,
},
#endif
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+ {
+ I2C_BOARD_INFO("lp5523", 0x32),
+ .platform_data = &rx51_lp5523_platform_data,
+ },
+#endif
{
I2C_BOARD_INFO("tpa6130a2", 0x60),
.platform_data = &rx51_tpa6130a2_data,
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2] omap: rx51: Platform support for lp5523 led chip
2011-03-31 15:44 ` Felipe Balbi
2011-04-01 9:58 ` Ameya Palande
2011-04-01 10:16 ` [PATCHv3] " Ameya Palande
@ 2011-04-05 12:00 ` Ameya Palande
2011-04-05 12:03 ` Felipe Balbi
2 siblings, 1 reply; 14+ messages in thread
From: Ameya Palande @ 2011-04-05 12:00 UTC (permalink / raw)
To: linux-arm-kernel
Hi Felipe,
On 03/31/2011 06:44 PM, ext Felipe Balbi wrote:
> On Thu, Mar 31, 2011 at 06:30:32PM +0300, Ameya Palande wrote:
>> Hi Felipe,
>>
>> On 03/31/2011 05:26 PM, ext Felipe Balbi wrote:
>>> Hi,
>>>
>>> On Thu, Mar 31, 2011 at 04:38:12PM +0300, Ameya Palande wrote:
>>>> +static int rx51_lp5523_setup(void)
>>>> +{
>>>> + int err;
>>>> +
>>>> + err = gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
>>>> + "lp5523_enable");
>>>> + if (err< 0) {
>>>> + pr_err("Unable to get lp5523_enable GPIO\n");
>>>> + return err;
>>>> + }
>>>> +
>>>> + return err;
>>>
>>> isn't enough to return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO,
>>> GPIOF_DIR_OUT, "lp5523_enable"); ??
>>
>> But then we won't know the failure reason for lp5523_probe()
>> I would prefer printing an error!
>
> see that both gpio_request() and gpio_direction_output() have debugging
> prints for error cases ;-)
Any comments about the version 3 of this patch?
Cheers,
Ameya.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv3] omap: rx51: Platform support for lp5523 led chip
2011-04-01 10:16 ` [PATCHv3] " Ameya Palande
@ 2011-04-05 12:03 ` Felipe Balbi
2011-05-31 12:55 ` Tony Lindgren
1 sibling, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2011-04-05 12:03 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 01, 2011 at 01:16:12PM +0300, Ameya Palande wrote:
> Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
> Signed-off-by: Mathias Nyman <mathias.nyman@nokia.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
> ---
> arch/arm/mach-omap2/board-rx51-peripherals.c | 66 ++++++++++++++++++++++++++
> 1 files changed, 66 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
> index bbcb677..d8ec895 100644
> --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> @@ -38,6 +38,7 @@
> #include <sound/tpa6130a2-plat.h>
> #include <media/radio-si4713.h>
> #include <media/si4713.h>
> +#include <linux/leds-lp5523.h>
>
> #include <../drivers/staging/iio/light/tsl2563.h>
>
> @@ -51,6 +52,7 @@
> #define RX51_WL1251_IRQ_GPIO 42
> #define RX51_FMTX_RESET_GPIO 163
> #define RX51_FMTX_IRQ 53
> +#define RX51_LP5523_CHIP_EN_GPIO 41
>
> /* list all spi devices here */
> enum {
> @@ -67,6 +69,64 @@ static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
> };
> #endif
>
> +#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
> +static struct lp5523_led_config rx51_lp5523_led_config[] = {
> + {
> + .chan_nr = 0,
> + .led_current = 50,
> + }, {
> + .chan_nr = 1,
> + .led_current = 50,
> + }, {
> + .chan_nr = 2,
> + .led_current = 50,
> + }, {
> + .chan_nr = 3,
> + .led_current = 50,
> + }, {
> + .chan_nr = 4,
> + .led_current = 50,
> + }, {
> + .chan_nr = 5,
> + .led_current = 50,
> + }, {
> + .chan_nr = 6,
> + .led_current = 50,
> + }, {
> + .chan_nr = 7,
> + .led_current = 50,
> + }, {
> + .chan_nr = 8,
> + .led_current = 50,
> + }
> +};
> +
> +static int rx51_lp5523_setup(void)
> +{
> + return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
> + "lp5523_enable");
> +}
> +
> +static void rx51_lp5523_release(void)
> +{
> + gpio_free(RX51_LP5523_CHIP_EN_GPIO);
> +}
> +
> +static void rx51_lp5523_enable(bool state)
> +{
> + gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
> +}
> +
> +static struct lp5523_platform_data rx51_lp5523_platform_data = {
> + .led_config = rx51_lp5523_led_config,
> + .num_channels = ARRAY_SIZE(rx51_lp5523_led_config),
> + .clock_mode = LP5523_CLOCK_AUTO,
> + .setup_resources = rx51_lp5523_setup,
> + .release_resources = rx51_lp5523_release,
> + .enable = rx51_lp5523_enable,
> +};
> +#endif
> +
> static struct omap2_mcspi_device_config wl1251_mcspi_config = {
> .turbo_mode = 0,
> .single_channel = 1,
> @@ -816,6 +876,12 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
> .platform_data = &rx51_tsl2563_platform_data,
> },
> #endif
> +#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
> + {
> + I2C_BOARD_INFO("lp5523", 0x32),
> + .platform_data = &rx51_lp5523_platform_data,
> + },
> +#endif
> {
> I2C_BOARD_INFO("tpa6130a2", 0x60),
> .platform_data = &rx51_tpa6130a2_data,
> --
> 1.7.1
>
--
balbi
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv2] omap: rx51: Platform support for lp5523 led chip
2011-04-05 12:00 ` [PATCHv2] " Ameya Palande
@ 2011-04-05 12:03 ` Felipe Balbi
0 siblings, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2011-04-05 12:03 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 05, 2011 at 03:00:11PM +0300, Ameya Palande wrote:
> Hi Felipe,
>
> On 03/31/2011 06:44 PM, ext Felipe Balbi wrote:
> >On Thu, Mar 31, 2011 at 06:30:32PM +0300, Ameya Palande wrote:
> >>Hi Felipe,
> >>
> >>On 03/31/2011 05:26 PM, ext Felipe Balbi wrote:
> >>>Hi,
> >>>
> >>>On Thu, Mar 31, 2011 at 04:38:12PM +0300, Ameya Palande wrote:
> >>>>+static int rx51_lp5523_setup(void)
> >>>>+{
> >>>>+ int err;
> >>>>+
> >>>>+ err = gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
> >>>>+ "lp5523_enable");
> >>>>+ if (err< 0) {
> >>>>+ pr_err("Unable to get lp5523_enable GPIO\n");
> >>>>+ return err;
> >>>>+ }
> >>>>+
> >>>>+ return err;
> >>>
> >>>isn't enough to return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO,
> >>>GPIOF_DIR_OUT, "lp5523_enable"); ??
> >>
> >>But then we won't know the failure reason for lp5523_probe()
> >>I would prefer printing an error!
> >
> >see that both gpio_request() and gpio_direction_output() have debugging
> >prints for error cases ;-)
>
> Any comments about the version 3 of this patch?
looks good to me. Replied with my Reviewed-by tag.
--
balbi
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv3] omap: rx51: Platform support for lp5523 led chip
2011-04-01 10:16 ` [PATCHv3] " Ameya Palande
2011-04-05 12:03 ` Felipe Balbi
@ 2011-05-31 12:55 ` Tony Lindgren
1 sibling, 0 replies; 14+ messages in thread
From: Tony Lindgren @ 2011-05-31 12:55 UTC (permalink / raw)
To: linux-arm-kernel
* Ameya Palande <ameya.palande@nokia.com> [110401 03:13]:
Applying this into devel-board for a future merge window after
we can add new code with "Platform support for lp5523 led chip"
as the patch description.
Regards,
Tony
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-05-31 12:55 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-31 12:17 [PATCH] omap: rx51: Platform support for lp5523 led chip Ameya Palande
2011-03-31 12:27 ` Felipe Balbi
2011-03-31 12:27 ` Aaro Koskinen
2011-03-31 13:38 ` [PATCHv2] " Ameya Palande
2011-03-31 13:50 ` Jarkko Nikula
2011-03-31 14:26 ` Felipe Balbi
2011-03-31 15:30 ` Ameya Palande
2011-03-31 15:44 ` Felipe Balbi
2011-04-01 9:58 ` Ameya Palande
2011-04-01 10:16 ` [PATCHv3] " Ameya Palande
2011-04-05 12:03 ` Felipe Balbi
2011-05-31 12:55 ` Tony Lindgren
2011-04-05 12:00 ` [PATCHv2] " Ameya Palande
2011-04-05 12:03 ` Felipe Balbi
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).