* [PATCH 0/8] updtes to few nokia drivers @ 2008-10-14 13:01 Felipe Balbi 2008-10-14 13:01 ` [PATCH 1/8] i2c: lp5521: remove dead code Felipe Balbi 0 siblings, 1 reply; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi The following patches updates a few nokia drivers. These 4 drivers are ready to go upstream and a patch will be made as soon as they get applied to linux-omap. Felipe Balbi (8): i2c: lp5521: remove dead code i2c: lp5521: cosmetic fixes lp5521: move to drivers/leds leds: lp5521: simplify mode setting leds: lp5521: register separate leds tsl2563: move tsl2563 to drivers/hwmon input: lm8323: get rid of global pdata pointer input: tsc2005: move to gpiolib drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/{i2c/chips => hwmon}/tsl2563.c | 2 +- drivers/i2c/chips/Kconfig | 17 - drivers/i2c/chips/Makefile | 2 - drivers/input/keyboard/lm8323.c | 4 +- drivers/input/touchscreen/tsc2005.c | 15 +- drivers/leds/Kconfig | 7 + drivers/leds/Makefile | 1 + drivers/{i2c/chips/lp5521.c => leds/leds-lp5521.c} | 379 +++++++++++++------- 10 files changed, 280 insertions(+), 158 deletions(-) rename drivers/{i2c/chips => hwmon}/tsl2563.c (99%) rename drivers/{i2c/chips/lp5521.c => leds/leds-lp5521.c} (62%) ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 1/8] i2c: lp5521: remove dead code 2008-10-14 13:01 [PATCH 0/8] updtes to few nokia drivers Felipe Balbi @ 2008-10-14 13:01 ` Felipe Balbi 2008-10-14 13:01 ` [PATCH 2/8] i2c: lp5521: cosmetic fixes Felipe Balbi 0 siblings, 1 reply; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Richard Purdie That LED_CONNECTED_WRONG was never defined so removing. If someone needs those hooks, add back via proper platform_data instead of nasty ifdefery. Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- drivers/i2c/chips/lp5521.c | 22 ---------------------- 1 files changed, 0 insertions(+), 22 deletions(-) diff --git a/drivers/i2c/chips/lp5521.c b/drivers/i2c/chips/lp5521.c index c0862d9..7fb8091 100644 --- a/drivers/i2c/chips/lp5521.c +++ b/drivers/i2c/chips/lp5521.c @@ -28,13 +28,8 @@ #define LP5521_DRIVER_NAME "lp5521" -#ifdef LED_CONNECTED_WRONG -#define LP5521_REG_R_PWM 0x04 -#define LP5521_REG_B_PWM 0x02 -#else #define LP5521_REG_R_PWM 0x02 #define LP5521_REG_B_PWM 0x04 -#endif #define LP5521_REG_ENABLE 0x00 #define LP5521_REG_OP_MODE 0x01 #define LP5521_REG_G_PWM 0x03 @@ -200,22 +195,12 @@ static ssize_t show_active_channels(struct device *dev, char channels[4]; int pos = 0; -#ifdef LED_CONNECTED_WRONG - if (chip->blue) - pos += sprintf(channels + pos, "r"); - if (chip->green) - pos += sprintf(channels + pos, "g"); - if (chip->red) - pos += sprintf(channels + pos, "b"); - -#else if (chip->red) pos += sprintf(channels + pos, "r"); if (chip->green) pos += sprintf(channels + pos, "g"); if (chip->blue) pos += sprintf(channels + pos, "b"); -#endif channels[pos] = '\0'; @@ -232,17 +217,10 @@ static ssize_t store_active_channels(struct device *dev, chip->green = 0; chip->blue = 0; -#ifdef LED_CONNECTED_WRONG - if (strchr(buf, 'r') != NULL) - chip->blue = 1; - if (strchr(buf, 'b') != NULL) - chip->red = 1; -#else if (strchr(buf, 'r') != NULL) chip->red = 1; if (strchr(buf, 'b') != NULL) chip->blue = 1; -#endif if (strchr(buf, 'g') != NULL) chip->green = 1; -- 1.6.0.2.307.gc427 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/8] i2c: lp5521: cosmetic fixes 2008-10-14 13:01 ` [PATCH 1/8] i2c: lp5521: remove dead code Felipe Balbi @ 2008-10-14 13:01 ` Felipe Balbi 2008-10-14 13:01 ` [PATCH 3/8] lp5521: move to drivers/leds Felipe Balbi 0 siblings, 1 reply; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Richard Purdie General cleanup to the code. Preparing to send it to mainline. Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- drivers/i2c/chips/lp5521.c | 159 ++++++++++++++++++++------------------------ 1 files changed, 73 insertions(+), 86 deletions(-) diff --git a/drivers/i2c/chips/lp5521.c b/drivers/i2c/chips/lp5521.c index 7fb8091..e040c4d 100644 --- a/drivers/i2c/chips/lp5521.c +++ b/drivers/i2c/chips/lp5521.c @@ -1,5 +1,5 @@ /* - * drivers/i2c/chips/lp5521.c + * lp5521.c - LP5521 LED Driver * * Copyright (C) 2007 Nokia Corporation * @@ -24,7 +24,6 @@ #include <linux/init.h> #include <linux/i2c.h> #include <linux/mutex.h> -#include <mach/gpio.h> #define LP5521_DRIVER_NAME "lp5521" @@ -71,6 +70,7 @@ #define LP5521_PROGRAM_LENGTH 32 /* in bytes */ struct lp5521_chip { + /* device lock */ struct mutex lock; struct i2c_client *client; char *mode; @@ -81,20 +81,14 @@ struct lp5521_chip { static int lp5521_set_mode(struct lp5521_chip *chip, char *mode); -static int lp5521_write(struct i2c_client *client, u8 reg, u8 value) +static inline int lp5521_write(struct i2c_client *client, u8 reg, u8 value) { return i2c_smbus_write_byte_data(client, reg, value); } -static int lp5521_read(struct i2c_client *client, u8 reg, u8 *buf) +static inline int lp5521_read(struct i2c_client *client, u8 reg) { - s32 ret = i2c_smbus_read_byte_data(client, reg); - - if (ret < 0) - return -EIO; - - *buf = ret; - return 0; + return i2c_smbus_read_byte_data(client, reg); } static int lp5521_configure(struct i2c_client *client) @@ -136,19 +130,19 @@ static int lp5521_load_program(struct lp5521_chip *chip, u8 *pattern) if (chip->red) ret |= i2c_smbus_write_i2c_block_data(client, - LP5521_REG_R_PROG_MEM, - LP5521_PROGRAM_LENGTH, - pattern); + LP5521_REG_R_PROG_MEM, + LP5521_PROGRAM_LENGTH, + pattern); if (chip->green) ret |= i2c_smbus_write_i2c_block_data(client, - LP5521_REG_G_PROG_MEM, - LP5521_PROGRAM_LENGTH, - pattern); + LP5521_REG_G_PROG_MEM, + LP5521_PROGRAM_LENGTH, + pattern); if (chip->blue) ret |= i2c_smbus_write_i2c_block_data(client, - LP5521_REG_B_PROG_MEM, - LP5521_PROGRAM_LENGTH, - pattern); + LP5521_REG_B_PROG_MEM, + LP5521_PROGRAM_LENGTH, + pattern); return ret; } @@ -156,31 +150,33 @@ static int lp5521_load_program(struct lp5521_chip *chip, u8 *pattern) static int lp5521_run_program(struct lp5521_chip *chip) { struct i2c_client *client = chip->client; - int ret; + int reg; u8 mask = 0xc0; u8 exec_state = 0; - u8 enable_reg; - ret = lp5521_read(client, LP5521_REG_ENABLE, &enable_reg); - if (ret) - goto fail; + reg = lp5521_read(client, LP5521_REG_ENABLE); + if (reg < 0) + return reg; - enable_reg &= mask; + reg &= mask; /* set all active channels exec state to countinous run*/ - exec_state |= (chip->red << 5); + exec_state |= (chip->red << 5); exec_state |= (chip->green << 3); - exec_state |= (chip->blue << 1); + exec_state |= (chip->blue << 1); - enable_reg |= exec_state; + reg |= exec_state; - ret |= lp5521_write(client, LP5521_REG_ENABLE, enable_reg); + if (lp5521_write(client, LP5521_REG_ENABLE, reg)) + dev_dbg(&client->dev, "failed writing to register %02x\n", + LP5521_REG_ENABLE); /* set op-mode to run for active channels, disabled for others */ - ret |= lp5521_write(client, LP5521_REG_OP_MODE, exec_state); + if (lp5521_write(client, LP5521_REG_OP_MODE, exec_state)) + dev_dbg(&client->dev, "failed writing to register %02x\n", + LP5521_REG_OP_MODE); -fail: - return ret; + return 0; } /*--------------------------------------------------------------*/ @@ -188,8 +184,8 @@ fail: /*--------------------------------------------------------------*/ static ssize_t show_active_channels(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { struct lp5521_chip *chip = dev_get_drvdata(dev); char channels[4]; @@ -208,8 +204,8 @@ static ssize_t show_active_channels(struct device *dev, } static ssize_t store_active_channels(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct lp5521_chip *chip = dev_get_drvdata(dev); @@ -228,26 +224,25 @@ static ssize_t store_active_channels(struct device *dev, } static ssize_t show_color(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { struct i2c_client *client = to_i2c_client(dev); - int ret = 0; - u8 r, g, b; + int r, g, b; - ret |= lp5521_read(client, LP5521_REG_R_PWM, &r); - ret |= lp5521_read(client, LP5521_REG_G_PWM, &g); - ret |= lp5521_read(client, LP5521_REG_B_PWM, &b); + r = lp5521_read(client, LP5521_REG_R_PWM); + g = lp5521_read(client, LP5521_REG_G_PWM); + b = lp5521_read(client, LP5521_REG_B_PWM); - if (ret) - return ret; + if (r < 0 || g < 0 || b < 0) + return -EINVAL; return sprintf(buf, "%.2x:%.2x:%.2x\n", r, g, b); } static ssize_t store_color(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct i2c_client *client = to_i2c_client(dev); struct lp5521_chip *chip = i2c_get_clientdata(client); @@ -271,8 +266,8 @@ static ssize_t store_color(struct device *dev, } static ssize_t store_load(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct lp5521_chip *chip = dev_get_drvdata(dev); int ret, nrchars, offset = 0, i = 0; @@ -314,8 +309,8 @@ fail: } static ssize_t show_mode(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { struct lp5521_chip *chip = dev_get_drvdata(dev); @@ -323,8 +318,8 @@ static ssize_t show_mode(struct device *dev, } static ssize_t store_mode(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct lp5521_chip *chip = dev_get_drvdata(dev); @@ -343,33 +338,29 @@ static ssize_t store_mode(struct device *dev, } static ssize_t show_current(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { struct i2c_client *client = to_i2c_client(dev); - int ret = 0; - u8 r_curr, g_curr, b_curr; + int r, g, b; - ret |= lp5521_read(client, LP5521_REG_R_CNTRL, &r_curr); - ret |= lp5521_read(client, LP5521_REG_G_CNTRL, &g_curr); - ret |= lp5521_read(client, LP5521_REG_B_CNTRL, &b_curr); + r = lp5521_read(client, LP5521_REG_R_CNTRL); + g = lp5521_read(client, LP5521_REG_G_CNTRL); + b = lp5521_read(client, LP5521_REG_B_CNTRL); - if (ret) - return ret; + if (r < 0 || g < 0 || b < 0) + return -EINVAL; - r_curr = r_curr >> 4; - g_curr = g_curr >> 4; - b_curr = b_curr >> 4; + r >>= 4; + g >>= 4; + b >>= 4; - if (r_curr == g_curr && g_curr == b_curr) - return sprintf(buf, "%x\n", r_curr); - else - return sprintf(buf, "%x %x %x\n", r_curr, g_curr, b_curr); + return sprintf(buf, "%x %x %x\n", r, g, b); } static ssize_t store_current(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct lp5521_chip *chip = dev_get_drvdata(dev); struct i2c_client *client = chip->client; @@ -398,7 +389,7 @@ static DEVICE_ATTR(color, S_IRUGO | S_IWUGO, show_color, store_color); static DEVICE_ATTR(load, S_IWUGO, NULL, store_load); static DEVICE_ATTR(mode, S_IRUGO | S_IWUGO, show_mode, store_mode); static DEVICE_ATTR(active_channels, S_IRUGO | S_IWUGO, - show_active_channels, store_active_channels); + show_active_channels, store_active_channels); static DEVICE_ATTR(led_current, S_IRUGO | S_IWUGO, show_current, store_current); static int lp5521_register_sysfs(struct i2c_client *client) @@ -421,6 +412,7 @@ static int lp5521_register_sysfs(struct i2c_client *client) ret = device_create_file(dev, &dev_attr_led_current); if (ret) goto fail5; + return 0; fail5: @@ -437,16 +429,13 @@ fail1: static void lp5521_unregister_sysfs(struct i2c_client *client) { - struct lp5521_chip *chip = i2c_get_clientdata(client); struct device *dev = &client->dev; device_remove_file(dev, &dev_attr_led_current); device_remove_file(dev, &dev_attr_mode); device_remove_file(dev, &dev_attr_active_channels); device_remove_file(dev, &dev_attr_color); - - if (!strcmp(chip->mode, LP5521_MODE_LOAD)) - device_remove_file(dev, &dev_attr_load); + device_remove_file(dev, &dev_attr_load); } /*--------------------------------------------------------------*/ @@ -479,9 +468,8 @@ static int lp5521_set_mode(struct lp5521_chip *chip, char *mode) /*--------------------------------------------------------------*/ /* Probe, Attach, Remove */ /*--------------------------------------------------------------*/ -static struct i2c_driver lp5521_driver; -static int lp5521_probe(struct i2c_client *client, +static int __init lp5521_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct lp5521_chip *chip; @@ -491,7 +479,7 @@ static int lp5521_probe(struct i2c_client *client, if (!chip) return -ENOMEM; - chip->client = client; + chip->client = client; strncpy(client->name, LP5521_DRIVER_NAME, I2C_NAME_SIZE); i2c_set_clientdata(client, chip); @@ -520,7 +508,7 @@ fail1: return ret; } -static int lp5521_remove(struct i2c_client *client) +static int __exit lp5521_remove(struct i2c_client *client) { struct lp5521_chip *chip = i2c_get_clientdata(client); @@ -537,11 +525,11 @@ static const struct i2c_device_id lp5521_id[] = { MODULE_DEVICE_TABLE(i2c, lp5521_id); static struct i2c_driver lp5521_driver = { - .driver = { + .driver = { .name = LP5521_DRIVER_NAME, }, .probe = lp5521_probe, - .remove = __devexit_p(lp5521_remove), + .remove = __exit_p(lp5521_remove), .id_table = lp5521_id, }; @@ -549,15 +537,14 @@ static int __init lp5521_init(void) { return i2c_add_driver(&lp5521_driver); } +module_init(lp5521_init); static void __exit lp5521_exit(void) { i2c_del_driver(&lp5521_driver); } +module_exit(lp5521_exit); MODULE_AUTHOR("Mathias Nyman <mathias.nyman@nokia.com>"); MODULE_DESCRIPTION("lp5521 LED driver"); MODULE_LICENSE("GPL"); - -module_init(lp5521_init); -module_exit(lp5521_exit); -- 1.6.0.2.307.gc427 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 3/8] lp5521: move to drivers/leds 2008-10-14 13:01 ` [PATCH 2/8] i2c: lp5521: cosmetic fixes Felipe Balbi @ 2008-10-14 13:01 ` Felipe Balbi 2008-10-14 13:01 ` [PATCH 4/8] leds: lp5521: simplify mode setting Felipe Balbi 2008-10-14 15:53 ` [PATCH 3/8] lp5521: move to drivers/leds David Brownell 0 siblings, 2 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Richard Purdie This driver should be sitting together with the other led drivers. Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- drivers/i2c/chips/Kconfig | 7 ------- drivers/i2c/chips/Makefile | 1 - drivers/leds/Kconfig | 7 +++++++ drivers/leds/Makefile | 1 + drivers/{i2c/chips/lp5521.c => leds/leds-lp5521.c} | 0 5 files changed, 8 insertions(+), 8 deletions(-) rename drivers/{i2c/chips/lp5521.c => leds/leds-lp5521.c} (100%) diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index d803c41..0aed293 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig @@ -219,13 +219,6 @@ config SENSORS_TSL2563 This driver can also be built as a module. If so, the module will be called tsl2563. -config LP5521 - tristate "LP5521 LED driver chip" - depends on I2C - help - If you say yes here you get support for the National Semiconductor - LP5521 LED driver. - config MENELAUS bool "TWL92330/Menelaus PM chip" depends on I2C=y && ARCH_OMAP24XX diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index ba41a57..5e17df3 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile @@ -30,7 +30,6 @@ obj-$(CONFIG_TWL4030_POWEROFF) += twl4030-poweroff.o obj-$(CONFIG_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o obj-$(CONFIG_TWL4030_MADC) += twl4030-madc.o obj-$(CONFIG_RTC_X1205_I2C) += x1205.o -obj-$(CONFIG_LP5521) += lp5521.o ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) EXTRA_CFLAGS += -DDEBUG diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 6a2f441..d61cdf0 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -146,6 +146,13 @@ config LEDS_CM_X270 help This option enables support for the CM-X270 LEDs. +config LEDS_LP5521 + tristate "LP5521 LED driver chip" + depends on LEDS_CLASS && I2C + help + If you say yes here you get support for the National Semiconductor + LP5521 LED driver used in n8x0 boards. + config LEDS_CLEVO_MAIL tristate "Mail LED on Clevo notebook (EXPERIMENTAL)" depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index fd6316e..ce5c8cd 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o obj-$(CONFIG_LEDS_PCA9532) += leds-pca9532.o obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o +obj-$(CONFIG_LEDS_LP5521) += leds-lp5521.o obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o obj-$(CONFIG_LEDS_FSG) += leds-fsg.o diff --git a/drivers/i2c/chips/lp5521.c b/drivers/leds/leds-lp5521.c similarity index 100% rename from drivers/i2c/chips/lp5521.c rename to drivers/leds/leds-lp5521.c -- 1.6.0.2.307.gc427 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 4/8] leds: lp5521: simplify mode setting 2008-10-14 13:01 ` [PATCH 3/8] lp5521: move to drivers/leds Felipe Balbi @ 2008-10-14 13:01 ` Felipe Balbi 2008-10-14 13:01 ` [PATCH 5/8] leds: lp5521: register separate leds Felipe Balbi 2008-10-14 15:53 ` [PATCH 3/8] lp5521: move to drivers/leds David Brownell 1 sibling, 1 reply; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Richard Purdie Avoid using string magic and use integer for comparisson Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- drivers/leds/leds-lp5521.c | 52 ++++++++++++++++++++++++++++++++----------- 1 files changed, 38 insertions(+), 14 deletions(-) diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index e040c4d..9e94ff8 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -46,10 +46,6 @@ #define LP5521_REG_G_PROG_MEM 0x30 #define LP5521_REG_B_PROG_MEM 0x50 -#define LP5521_MODE_LOAD "load" -#define LP5521_MODE_RUN "run" -#define LP5521_MODE_DIRECT_CONTROL "direct" - #define LP5521_CURRENT_1m5 0x0f #define LP5521_CURRENT_3m1 0x1f #define LP5521_CURRENT_4m7 0x2f @@ -69,17 +65,23 @@ #define LP5521_PROGRAM_LENGTH 32 /* in bytes */ +enum lp5521_mode { + LP5521_MODE_LOAD, + LP5521_MODE_RUN, + LP5521_MODE_DIRECT_CONTROL, +}; + struct lp5521_chip { /* device lock */ struct mutex lock; struct i2c_client *client; - char *mode; + enum lp5521_mode mode; int red; int green; int blue; }; -static int lp5521_set_mode(struct lp5521_chip *chip, char *mode); +static int lp5521_set_mode(struct lp5521_chip *chip, enum lp5521_mode mode); static inline int lp5521_write(struct i2c_client *client, u8 reg, u8 value) { @@ -313,8 +315,25 @@ static ssize_t show_mode(struct device *dev, char *buf) { struct lp5521_chip *chip = dev_get_drvdata(dev); + char *mode; + + mutex_lock(&chip->lock); + switch (chip->mode) { + case LP5521_MODE_RUN: + mode = "run"; + break; + case LP5521_MODE_LOAD: + mode = "load"; + break; + case LP5521_MODE_DIRECT_CONTROL: + mode = "direct"; + break; + default: + mode = "undefined"; + } + mutex_unlock(&chip->lock); - return sprintf(buf, "%s\n", chip->mode); + return sprintf(buf, "%s\n", mode); } static ssize_t store_mode(struct device *dev, @@ -442,23 +461,28 @@ static void lp5521_unregister_sysfs(struct i2c_client *client) /* Set chip operating mode */ /*--------------------------------------------------------------*/ -static int lp5521_set_mode(struct lp5521_chip *chip, char *mode) +static int lp5521_set_mode(struct lp5521_chip *chip, enum lp5521_mode mode) { struct i2c_client *client = chip->client ; int ret = 0; /* if in that mode already do nothing, except for run */ - if (!strcmp(mode, chip->mode) && strcmp(mode, LP5521_MODE_RUN)) + if (chip->mode == mode && mode != LP5521_MODE_RUN) return 0; - if (!strcmp(mode, LP5521_MODE_RUN)) + switch (mode) { + case LP5521_MODE_RUN: ret = lp5521_run_program(chip); - - if (!strcmp(mode, LP5521_MODE_LOAD)) + break; + case LP5521_MODE_LOAD: ret |= lp5521_write(client, LP5521_REG_OP_MODE, 0x15); - - if (!strcmp(mode, LP5521_MODE_DIRECT_CONTROL)) + break; + case LP5521_MODE_DIRECT_CONTROL: ret |= lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); + break; + default: + dev_dbg(&client->dev, "unsupported mode %d\n", mode); + } chip->mode = mode; -- 1.6.0.2.307.gc427 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 5/8] leds: lp5521: register separate leds 2008-10-14 13:01 ` [PATCH 4/8] leds: lp5521: simplify mode setting Felipe Balbi @ 2008-10-14 13:01 ` Felipe Balbi 2008-10-14 13:01 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Felipe Balbi 2008-10-14 15:55 ` [PATCH 5/8] leds: lp5521: register separate leds David Brownell 0 siblings, 2 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Richard Purdie Register three separate leds for lp5521 and allow them to be controlled separately while keeping backwards compatibility with userspace programs based on old implementation. Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- drivers/leds/leds-lp5521.c | 146 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 144 insertions(+), 2 deletions(-) diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 9e94ff8..a5c3425 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -4,6 +4,7 @@ * Copyright (C) 2007 Nokia Corporation * * Written by Mathias Nyman <mathias.nyman@nokia.com> + * Updated by Felipe Balbi <felipe.balbi@nokia.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +24,9 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/i2c.h> +#include <linux/leds.h> #include <linux/mutex.h> +#include <linux/workqueue.h> #define LP5521_DRIVER_NAME "lp5521" @@ -75,7 +78,17 @@ struct lp5521_chip { /* device lock */ struct mutex lock; struct i2c_client *client; + + struct work_struct red_work; + struct work_struct green_work; + struct work_struct blue_work; + + struct led_classdev ledr; + struct led_classdev ledg; + struct led_classdev ledb; + enum lp5521_mode mode; + int red; int green; int blue; @@ -489,6 +502,87 @@ static int lp5521_set_mode(struct lp5521_chip *chip, enum lp5521_mode mode) return ret; } +static void lp5521_red_work(struct work_struct *work) +{ + struct lp5521_chip *chip = container_of(work, struct lp5521_chip, red_work); + int ret; + + ret = lp5521_configure(chip->client); + if (ret) { + dev_dbg(&chip->client->dev, "could not configure lp5521, %d\n", + ret); + return; + } + + ret = lp5521_write(chip->client, LP5521_REG_R_PWM, chip->red); + if (ret) + dev_dbg(&chip->client->dev, "could not set brightness, %d\n", + ret); +} + +static void lp5521_red_set(struct led_classdev *led, + enum led_brightness value) +{ + struct lp5521_chip *chip = container_of(led, struct lp5521_chip, ledr); + + chip->red = value; + schedule_work(&chip->red_work); +} + +static void lp5521_green_work(struct work_struct *work) +{ + struct lp5521_chip *chip = container_of(work, struct lp5521_chip, green_work); + int ret; + + ret = lp5521_configure(chip->client); + if (ret) { + dev_dbg(&chip->client->dev, "could not configure lp5521, %d\n", + ret); + return; + } + + ret = lp5521_write(chip->client, LP5521_REG_G_PWM, chip->green); + if (ret) + dev_dbg(&chip->client->dev, "could not set brightness, %d\n", + ret); +} + +static void lp5521_green_set(struct led_classdev *led, + enum led_brightness value) +{ + struct lp5521_chip *chip = container_of(led, struct lp5521_chip, ledg); + + chip->green = value; + schedule_work(&chip->green_work); +} + +static void lp5521_blue_work(struct work_struct *work) +{ + struct lp5521_chip *chip = container_of(work, struct lp5521_chip, blue_work); + int ret; + + ret = lp5521_configure(chip->client); + if (ret) { + dev_dbg(&chip->client->dev, "could not configure lp5521, %d\n", + ret); + return; + } + + ret = lp5521_write(chip->client, LP5521_REG_B_PWM, chip->blue); + if (ret) + dev_dbg(&chip->client->dev, "could not set brightness, %d\n", + ret); +} + +static void lp5521_blue_set(struct led_classdev *led, + enum led_brightness value) +{ + struct lp5521_chip *chip = container_of(led, struct lp5521_chip, ledb); + + chip->blue = value; + schedule_work(&chip->blue_work); +} + /*--------------------------------------------------------------*/ /* Probe, Attach, Remove */ /*--------------------------------------------------------------*/ @@ -509,6 +603,10 @@ static int __init lp5521_probe(struct i2c_client *client, mutex_init(&chip->lock); + INIT_WORK(&chip->red_work, lp5521_red_work); + INIT_WORK(&chip->green_work, lp5521_green_work); + INIT_WORK(&chip->blue_work, lp5521_blue_work); + ret = lp5521_configure(client); if (ret < 0) { dev_err(&client->dev, "lp5521 error configuring chip \n"); @@ -521,14 +619,52 @@ static int __init lp5521_probe(struct i2c_client *client, chip->green = 1; chip->blue = 1; + chip->ledr.brightness_set = lp5521_red_set; + chip->ledr.default_trigger = NULL; + chip->ledr.name = "lp5521:red"; + ret = led_classdev_register(&client->dev, &chip->ledr); + if (ret < 0) { + dev_dbg(&client->dev, "failed to register red led, %d\n", ret); + goto fail1; + } + + chip->ledg.brightness_set = lp5521_green_set; + chip->ledg.default_trigger = NULL; + chip->ledg.name = "lp5521:green"; + ret = led_classdev_register(&client->dev, &chip->ledg); + if (ret < 0) { + dev_dbg(&client->dev, "failed to register green led, %d\n", + ret); + goto fail2; + } + + chip->ledb.brightness_set = lp5521_blue_set; + chip->ledb.default_trigger = NULL; + chip->ledb.name = "lp5521:blue"; + ret = led_classdev_register(&client->dev, &chip->ledb); + if (ret < 0) { + dev_dbg(&client->dev, "failed to register blue led, %d\n", ret); + goto fail3; + } + ret = lp5521_register_sysfs(client); - if (ret) + if (ret) { dev_err(&client->dev, "lp5521 registering sysfs failed \n"); + goto fail4; + } - return ret; + return 0; +fail4: + led_classdev_unregister(&chip->ledb); +fail3: + led_classdev_unregister(&chip->ledg); +fail2: + led_classdev_unregister(&chip->ledr); fail1: + i2c_set_clientdata(client, NULL); kfree(chip); + return ret; } @@ -537,6 +673,12 @@ static int __exit lp5521_remove(struct i2c_client *client) struct lp5521_chip *chip = i2c_get_clientdata(client); lp5521_unregister_sysfs(client); + i2c_set_clientdata(client, NULL); + + led_classdev_unregister(&chip->ledb); + led_classdev_unregister(&chip->ledg); + led_classdev_unregister(&chip->ledr); + kfree(chip); return 0; -- 1.6.0.2.307.gc427 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 13:01 ` [PATCH 5/8] leds: lp5521: register separate leds Felipe Balbi @ 2008-10-14 13:01 ` Felipe Balbi 2008-10-14 13:01 ` [PATCH 7/8] input: lm8323: get rid of global pdata pointer Felipe Balbi 2008-10-14 13:38 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Jean Delvare 2008-10-14 15:55 ` [PATCH 5/8] leds: lp5521: register separate leds David Brownell 1 sibling, 2 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Jean Delvare Moving the driver to where it should sit. No functional changes. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- drivers/hwmon/Kconfig | 10 ++++++++++ drivers/hwmon/Makefile | 1 + drivers/{i2c/chips => hwmon}/tsl2563.c | 2 +- drivers/i2c/chips/Kconfig | 10 ---------- drivers/i2c/chips/Makefile | 1 - 5 files changed, 12 insertions(+), 12 deletions(-) rename drivers/{i2c/chips => hwmon}/tsl2563.c (99%) diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 390c6fa..dabc148 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -670,6 +670,16 @@ config SENSORS_THMC50 This driver can also be built as a module. If so, the module will be called thmc50. +config SENSORS_TSL2563 + tristate "Taos TSL2563 ambient light sensor" + depends on I2C && HWMON + help + If you say yes here you get support for the Taos TSL2563 + ambient light sensor. + + This driver can also be built as a module. If so, the module + will be called tsl2563. + config SENSORS_VIA686A tristate "VIA686A" depends on PCI diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 2580d5d..28990a5 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -68,6 +68,7 @@ obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o obj-$(CONFIG_SENSORS_THMC50) += thmc50.o +obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o obj-$(CONFIG_SENSORS_VIA686A) += via686a.o obj-$(CONFIG_SENSORS_VT1211) += vt1211.o obj-$(CONFIG_SENSORS_VT8231) += vt8231.o diff --git a/drivers/i2c/chips/tsl2563.c b/drivers/hwmon/tsl2563.c similarity index 99% rename from drivers/i2c/chips/tsl2563.c rename to drivers/hwmon/tsl2563.c index e05b880..afc3265 100644 --- a/drivers/i2c/chips/tsl2563.c +++ b/drivers/hwmon/tsl2563.c @@ -1,5 +1,5 @@ /* - * drivers/i2c/chips/tsl2563.c + * tsl2563.c - TSL2563 Ambient Light Sensor * * Copyright (C) 2008 Nokia Corporation * diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index 0aed293..d1ad80b 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig @@ -209,16 +209,6 @@ config SENSORS_TSL2550 This driver can also be built as a module. If so, the module will be called tsl2550. -config SENSORS_TSL2563 - tristate "Taos TSL2563 ambient light sensor" - depends on I2C && HWMON - help - If you say yes here you get support for the Taos TSL2563 - ambient light sensor. - - This driver can also be built as a module. If so, the module - will be called tsl2563. - config MENELAUS bool "TWL92330/Menelaus PM chip" depends on I2C=y && ARCH_OMAP24XX diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index 5e17df3..919013c 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile @@ -23,7 +23,6 @@ obj-$(CONFIG_SENSORS_TLV320AIC23) += tlv320aic23.o obj-$(CONFIG_GPIOEXPANDER_OMAP) += gpio_expander_omap.o obj-$(CONFIG_MENELAUS) += menelaus.o obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o -obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o obj-$(CONFIG_TWL4030_CORE) += twl4030-pwrirq.o twl4030-power.o obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o obj-$(CONFIG_TWL4030_POWEROFF) += twl4030-poweroff.o -- 1.6.0.2.307.gc427 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 7/8] input: lm8323: get rid of global pdata pointer 2008-10-14 13:01 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Felipe Balbi @ 2008-10-14 13:01 ` Felipe Balbi 2008-10-14 13:01 ` [PATCH 8/8] input: tsc2005: move to gpiolib Felipe Balbi 2008-10-14 13:38 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Jean Delvare 1 sibling, 1 reply; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Dmitry Torokhov pdata is only used during probe to initialize a few fields from lm8323 device structure. Moving pdata pointer to probe won't harm anybody. Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- drivers/input/keyboard/lm8323.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c index 72bb587..b6f464c 100644 --- a/drivers/input/keyboard/lm8323.c +++ b/drivers/input/keyboard/lm8323.c @@ -184,9 +184,6 @@ static struct lm8323_chip *pwm_to_lm8323(struct lm8323_pwm *pwm) } } -static struct lm8323_platform_data *lm8323_pdata; - - #define LM8323_MAX_DATA 8 /* @@ -673,6 +670,7 @@ static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable); static int lm8323_probe(struct i2c_client *client, const struct i2c_device_id *id) { + struct lm8323_platform_data *lm8323_pdata; struct input_dev *idev; struct lm8323_chip *lm; int i, err = 0; -- 1.6.0.2.307.gc427 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 8/8] input: tsc2005: move to gpiolib 2008-10-14 13:01 ` [PATCH 7/8] input: lm8323: get rid of global pdata pointer Felipe Balbi @ 2008-10-14 13:01 ` Felipe Balbi 0 siblings, 0 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:01 UTC (permalink / raw) To: linux-omap; +Cc: Felipe Balbi, Dmitry Torokhov get rid of omap-specific gpio calls and switch over to gpiolib. Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> --- drivers/input/touchscreen/tsc2005.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 7fb107e..c9f8f5c 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c @@ -534,16 +534,14 @@ static int __devinit tsc2005_ts_init(struct tsc2005 *ts, ts->dav_gpio = dav_gpio; dev_dbg(&ts->spi->dev, "TSC2005: DAV GPIO = %d\n", dav_gpio); -#ifdef CONFIG_ARCH_OMAP - r = omap_request_gpio(dav_gpio); + r = gpio_request(dav_gpio, "dav_gpio"); if (r < 0) { dev_err(&ts->spi->dev, "unable to get DAV GPIO"); goto err1; } - omap_set_gpio_direction(dav_gpio, 1); + gpio_direction_input(dav_gpio); ts->irq = OMAP_GPIO_IRQ(dav_gpio); dev_dbg(&ts->spi->dev, "TSC2005: DAV IRQ = %d\n", ts->irq); -#endif init_timer(&ts->penup_timer); setup_timer(&ts->penup_timer, tsc2005_ts_penup_timer_handler, (unsigned long)ts); @@ -612,9 +610,7 @@ err3: tsc2005_stop_scan(ts); input_free_device(idev); err2: -#ifdef CONFIG_ARCH_OMAP - omap_free_gpio(dav_gpio); -#endif + gpio_free(dav_gpio); err1: return r; } @@ -671,10 +667,7 @@ static int __devexit tsc2005_remove(struct spi_device *spi) free_irq(ts->irq, ts); input_unregister_device(ts->idev); - -#ifdef CONFIG_ARCH_OMAP - omap_free_gpio(ts->dav_gpio); -#endif + gpio_free(ts->dav_gpio); kfree(ts); return 0; -- 1.6.0.2.307.gc427 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 13:01 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Felipe Balbi 2008-10-14 13:01 ` [PATCH 7/8] input: lm8323: get rid of global pdata pointer Felipe Balbi @ 2008-10-14 13:38 ` Jean Delvare 2008-10-14 13:52 ` Felipe Balbi 1 sibling, 1 reply; 24+ messages in thread From: Jean Delvare @ 2008-10-14 13:38 UTC (permalink / raw) To: Felipe Balbi; +Cc: linux-omap Hi Felipe, On Tue, 14 Oct 2008 16:01:38 +0300, Felipe Balbi wrote: > Moving the driver to where it should sit. No functional > changes. > > Cc: Jean Delvare <khali@linux-fr.org> > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > --- > drivers/hwmon/Kconfig | 10 ++++++++++ > drivers/hwmon/Makefile | 1 + > drivers/{i2c/chips => hwmon}/tsl2563.c | 2 +- > drivers/i2c/chips/Kconfig | 10 ---------- > drivers/i2c/chips/Makefile | 1 - > 5 files changed, 12 insertions(+), 12 deletions(-) > rename drivers/{i2c/chips => hwmon}/tsl2563.c (99%) > > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig > index 390c6fa..dabc148 100644 > --- a/drivers/hwmon/Kconfig > +++ b/drivers/hwmon/Kconfig > @@ -670,6 +670,16 @@ config SENSORS_THMC50 > This driver can also be built as a module. If so, the module > will be called thmc50. > > +config SENSORS_TSL2563 > + tristate "Taos TSL2563 ambient light sensor" > + depends on I2C && HWMON > + help > + If you say yes here you get support for the Taos TSL2563 > + ambient light sensor. > + > + This driver can also be built as a module. If so, the module > + will be called tsl2563. > + > config SENSORS_VIA686A > tristate "VIA686A" > depends on PCI Nack. Light sensors have nothing to do with hardware monitoring. The only light sensor driver in the kernel tree at the moment is drivers/i2c/chips/tsl2550.c. But I'm not very happy with this either, as my ultimate goal is to delete the drivers/i2c/chips directory completely. So we should find a new home for light sensors. Maybe they should go into the new "industrial I/O" subsystem. Or if not, their own drivers/sensors/light directory. -- Jean Delvare ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 13:38 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Jean Delvare @ 2008-10-14 13:52 ` Felipe Balbi 2008-10-14 14:14 ` Jean Delvare 2008-10-14 16:00 ` David Brownell 0 siblings, 2 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 13:52 UTC (permalink / raw) To: ext Jean Delvare; +Cc: Felipe Balbi, linux-omap, Andrew Morton On Tue, Oct 14, 2008 at 03:38:24PM +0200, ext Jean Delvare wrote: > Hi Felipe, > > On Tue, 14 Oct 2008 16:01:38 +0300, Felipe Balbi wrote: > > Moving the driver to where it should sit. No functional > > changes. > > > > Cc: Jean Delvare <khali@linux-fr.org> > > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > > --- > > drivers/hwmon/Kconfig | 10 ++++++++++ > > drivers/hwmon/Makefile | 1 + > > drivers/{i2c/chips => hwmon}/tsl2563.c | 2 +- > > drivers/i2c/chips/Kconfig | 10 ---------- > > drivers/i2c/chips/Makefile | 1 - > > 5 files changed, 12 insertions(+), 12 deletions(-) > > rename drivers/{i2c/chips => hwmon}/tsl2563.c (99%) > > > > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig > > index 390c6fa..dabc148 100644 > > --- a/drivers/hwmon/Kconfig > > +++ b/drivers/hwmon/Kconfig > > @@ -670,6 +670,16 @@ config SENSORS_THMC50 > > This driver can also be built as a module. If so, the module > > will be called thmc50. > > > > +config SENSORS_TSL2563 > > + tristate "Taos TSL2563 ambient light sensor" > > + depends on I2C && HWMON > > + help > > + If you say yes here you get support for the Taos TSL2563 > > + ambient light sensor. > > + > > + This driver can also be built as a module. If so, the module > > + will be called tsl2563. > > + > > config SENSORS_VIA686A > > tristate "VIA686A" > > depends on PCI > > Nack. Light sensors have nothing to do with hardware monitoring. > > The only light sensor driver in the kernel tree at the moment > is drivers/i2c/chips/tsl2550.c. But I'm not very happy with this > either, as my ultimate goal is to delete the drivers/i2c/chips > directory completely. So we should find a new home for light sensors. and that's why I'm moving nokia drivers out of drivers/i2c/chips directory. > Maybe they should go into the new "industrial I/O" subsystem. Or if > not, their own drivers/sensors/light directory. Well, could be. We might need someone else, like Andrew, to answer that question. Andrew, do you have any comments if we should create a directory for light sensors ? In that case, looks like we're gonna need some abstraction layer, right ? -- balbi ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 13:52 ` Felipe Balbi @ 2008-10-14 14:14 ` Jean Delvare 2008-10-14 14:38 ` Felipe Balbi 2008-10-14 16:00 ` David Brownell 1 sibling, 1 reply; 24+ messages in thread From: Jean Delvare @ 2008-10-14 14:14 UTC (permalink / raw) To: felipe.balbi; +Cc: linux-omap, Andrew Morton, Jonathan Cameron On Tue, 14 Oct 2008 16:52:30 +0300, Felipe Balbi wrote: > On Tue, Oct 14, 2008 at 03:38:24PM +0200, ext Jean Delvare wrote: > > Hi Felipe, > > > > On Tue, 14 Oct 2008 16:01:38 +0300, Felipe Balbi wrote: > > > Moving the driver to where it should sit. No functional > > > changes. > > > > > > Cc: Jean Delvare <khali@linux-fr.org> > > > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> > > > --- > > > drivers/hwmon/Kconfig | 10 ++++++++++ > > > drivers/hwmon/Makefile | 1 + > > > drivers/{i2c/chips => hwmon}/tsl2563.c | 2 +- > > > drivers/i2c/chips/Kconfig | 10 ---------- > > > drivers/i2c/chips/Makefile | 1 - > > > 5 files changed, 12 insertions(+), 12 deletions(-) > > > rename drivers/{i2c/chips => hwmon}/tsl2563.c (99%) > > > > > > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig > > > index 390c6fa..dabc148 100644 > > > --- a/drivers/hwmon/Kconfig > > > +++ b/drivers/hwmon/Kconfig > > > @@ -670,6 +670,16 @@ config SENSORS_THMC50 > > > This driver can also be built as a module. If so, the module > > > will be called thmc50. > > > > > > +config SENSORS_TSL2563 > > > + tristate "Taos TSL2563 ambient light sensor" > > > + depends on I2C && HWMON > > > + help > > > + If you say yes here you get support for the Taos TSL2563 > > > + ambient light sensor. > > > + > > > + This driver can also be built as a module. If so, the module > > > + will be called tsl2563. > > > + > > > config SENSORS_VIA686A > > > tristate "VIA686A" > > > depends on PCI > > > > Nack. Light sensors have nothing to do with hardware monitoring. > > > > The only light sensor driver in the kernel tree at the moment > > is drivers/i2c/chips/tsl2550.c. But I'm not very happy with this > > either, as my ultimate goal is to delete the drivers/i2c/chips > > directory completely. So we should find a new home for light sensors. > > and that's why I'm moving nokia drivers out of drivers/i2c/chips > directory. > > > Maybe they should go into the new "industrial I/O" subsystem. Or if > > not, their own drivers/sensors/light directory. > > Well, could be. We might need someone else, like Andrew, to answer that > question. I'd rather ask the question to Jonathan Cameron (Cc'd.) > Andrew, do you have any comments if we should create a directory for > light sensors ? In that case, looks like we're gonna need some > abstraction layer, right ? I've implied a sysfs interface with my tsl2550 driver, essentially derived from the hwmon sysfs interface. I hope you followed it in your driver if possible. When these drivers have a new home, we can document the sysfs interface. Or, if these drivers end up in the industrial I/O subsystem, maybe a completely different interface will be used instead (but then it's in Jonathan's hands.) -- Jean Delvare ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 14:14 ` Jean Delvare @ 2008-10-14 14:38 ` Felipe Balbi 0 siblings, 0 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 14:38 UTC (permalink / raw) To: ext Jean Delvare Cc: felipe.balbi, linux-omap, Andrew Morton, Jonathan Cameron On Tue, Oct 14, 2008 at 04:14:26PM +0200, ext Jean Delvare wrote: > I've implied a sysfs interface with my tsl2550 driver, essentially > derived from the hwmon sysfs interface. I hope you followed it in your > driver if possible. When these drivers have a new home, we can document > the sysfs interface. Or, if these drivers end up in the industrial I/O > subsystem, maybe a completely different interface will be used instead > (but then it's in Jonathan's hands.) Hmm, I didn't really write the driver, I'm just fixing a few stuff to prepare for submission to mainline. If we end up with your sysfs interface, I can change that, no problem. -- balbi ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 13:52 ` Felipe Balbi 2008-10-14 14:14 ` Jean Delvare @ 2008-10-14 16:00 ` David Brownell 2008-10-14 21:20 ` Felipe Balbi 1 sibling, 1 reply; 24+ messages in thread From: David Brownell @ 2008-10-14 16:00 UTC (permalink / raw) To: felipe.balbi; +Cc: ext Jean Delvare, linux-omap, Andrew Morton On Tuesday 14 October 2008, Felipe Balbi wrote: > > > Nack. Light sensors have nothing to do with hardware monitoring. > > > > The only light sensor driver in the kernel tree at the moment > > is drivers/i2c/chips/tsl2550.c. But I'm not very happy with this > > either, as my ultimate goal is to delete the drivers/i2c/chips > > directory completely. So we should find a new home for light sensors. > > and that's why I'm moving nokia drivers out of drivers/i2c/chips > directory. > > > Maybe they should go into the new "industrial I/O" subsystem. Or if > > not, their own drivers/sensors/light directory. > > Well, could be. We might need someone else, like Andrew, to answer that > question. My two cents: leave them where they are until a "good" answer exists. Or if drivers/i2c/chips is sufficiently annoying ... drivers/misc may be a good interim site. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 16:00 ` David Brownell @ 2008-10-14 21:20 ` Felipe Balbi 2008-10-14 21:44 ` David Brownell 0 siblings, 1 reply; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 21:20 UTC (permalink / raw) To: David Brownell; +Cc: felipe.balbi, ext Jean Delvare, linux-omap, Andrew Morton On Tue, Oct 14, 2008 at 09:00:55AM -0700, David Brownell wrote: > On Tuesday 14 October 2008, Felipe Balbi wrote: > > > > > Nack. Light sensors have nothing to do with hardware monitoring. > > > > > > The only light sensor driver in the kernel tree at the moment > > > is drivers/i2c/chips/tsl2550.c. But I'm not very happy with this > > > either, as my ultimate goal is to delete the drivers/i2c/chips > > > directory completely. So we should find a new home for light sensors. > > > > and that's why I'm moving nokia drivers out of drivers/i2c/chips > > directory. > > > > > Maybe they should go into the new "industrial I/O" subsystem. Or if > > > not, their own drivers/sensors/light directory. > > > > Well, could be. We might need someone else, like Andrew, to answer that > > question. > > My two cents: leave them where they are until a "good" answer exists. > Or if drivers/i2c/chips is sufficiently annoying ... drivers/misc may > be a good interim site. I'd say that if it goes to the "wrong" place and doesn't bother anyone, will get forgotten. Just like the whole bunch of other drivers sitting in linux-omap. They don't bother anyone (probably they bother Tony when API changes upstream and a few defconfigs don't build anymore) so they got forgotten and still sitting in linux-omap. Funny that most of such drivers are for nokia tablets :-p -- balbi ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 21:20 ` Felipe Balbi @ 2008-10-14 21:44 ` David Brownell 2008-10-14 21:50 ` Felipe Balbi 2008-10-15 8:26 ` Jean Delvare 0 siblings, 2 replies; 24+ messages in thread From: David Brownell @ 2008-10-14 21:44 UTC (permalink / raw) To: me; +Cc: felipe.balbi, ext Jean Delvare, linux-omap, Andrew Morton On Tuesday 14 October 2008, Felipe Balbi wrote: > I'd say that if it goes to the "wrong" place and doesn't bother anyone, > will get forgotten. Just like the whole bunch of other drivers sitting > in linux-omap... I thought the point was to have them sit in mainline. ;) > Funny that most of such drivers are for nokia tablets :-p Some of these drivers are first-of-a-kind, so these questions wouldn't necessarily have come up before. That's one of the obstacles to mainline merge that isn't always acknowledged. - Dave ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 21:44 ` David Brownell @ 2008-10-14 21:50 ` Felipe Balbi 2008-10-15 8:26 ` Jean Delvare 1 sibling, 0 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 21:50 UTC (permalink / raw) To: David Brownell Cc: me, felipe.balbi, ext Jean Delvare, linux-omap, Andrew Morton On Tue, Oct 14, 2008 at 02:44:51PM -0700, David Brownell wrote: > On Tuesday 14 October 2008, Felipe Balbi wrote: > > I'd say that if it goes to the "wrong" place and doesn't bother anyone, > > will get forgotten. Just like the whole bunch of other drivers sitting > > in linux-omap... > > I thought the point was to have them sit in mainline. ;) Exactly :-) > Some of these drivers are first-of-a-kind, so these questions wouldn't > necessarily have come up before. That's one of the obstacles to > mainline merge that isn't always acknowledged. That's also true, but then again most of those drivers got forgotten and never made their way to mainline. If you look at mainline archives, you'll see that most of omap drivers never "tried" to go upstream. -- balbi ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon 2008-10-14 21:44 ` David Brownell 2008-10-14 21:50 ` Felipe Balbi @ 2008-10-15 8:26 ` Jean Delvare 1 sibling, 0 replies; 24+ messages in thread From: Jean Delvare @ 2008-10-15 8:26 UTC (permalink / raw) To: David Brownell; +Cc: Felipe Balbi, linux-omap, Andrew Morton Hi Felipe, David, On Tue, 14 Oct 2008 14:44:51 -0700, David Brownell wrote: > On Tuesday 14 October 2008, Felipe Balbi wrote: > > I'd say that if it goes to the "wrong" place and doesn't bother anyone, > > will get forgotten. Just like the whole bunch of other drivers sitting > > in linux-omap... You're not merging drivers upstream just to bother people, are you? There's nothing wrong with drivers being forgotten. Each driver gets the level of attention it deserves depending on how broken and useful it is. > I thought the point was to have them sit in mainline. ;) > > > Funny that most of such drivers are for nokia tablets :-p > > Some of these drivers are first-of-a-kind, so these questions wouldn't > necessarily have come up before. That's one of the obstacles to > mainline merge that isn't always acknowledged. Well, as you said before, it seems we have drivers/misc exactly for that case. -- Jean Delvare ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 5/8] leds: lp5521: register separate leds 2008-10-14 13:01 ` [PATCH 5/8] leds: lp5521: register separate leds Felipe Balbi 2008-10-14 13:01 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Felipe Balbi @ 2008-10-14 15:55 ` David Brownell 2008-10-14 17:09 ` Felipe Balbi 1 sibling, 1 reply; 24+ messages in thread From: David Brownell @ 2008-10-14 15:55 UTC (permalink / raw) To: Felipe Balbi; +Cc: linux-omap, Richard Purdie On Tuesday 14 October 2008, Felipe Balbi wrote: > @@ -23,7 +24,9 @@ > #include <linux/module.h> > #include <linux/init.h> > #include <linux/i2c.h> > +#include <linux/leds.h> > #include <linux/mutex.h> > +#include <linux/workqueue.h> > > #define LP5521_DRIVER_NAME "lp5521" > Ah, *here* it converts to use the LED framework. The patch comment should probably focus on that ... "separate leds" is just an artifact of that conversion, as I interpret things. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 5/8] leds: lp5521: register separate leds 2008-10-14 15:55 ` [PATCH 5/8] leds: lp5521: register separate leds David Brownell @ 2008-10-14 17:09 ` Felipe Balbi 0 siblings, 0 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 17:09 UTC (permalink / raw) To: David Brownell; +Cc: Felipe Balbi, linux-omap, Richard Purdie On Tue, Oct 14, 2008 at 08:55:21AM -0700, David Brownell wrote: > On Tuesday 14 October 2008, Felipe Balbi wrote: > > @@ -23,7 +24,9 @@ > > #include <linux/module.h> > > #include <linux/init.h> > > #include <linux/i2c.h> > > +#include <linux/leds.h> > > #include <linux/mutex.h> > > +#include <linux/workqueue.h> > > > > #define LP5521_DRIVER_NAME "lp5521" > > > > Ah, *here* it converts to use the LED framework. The patch > comment should probably focus on that ... "separate leds" is > just an artifact of that conversion, as I interpret things. Sure, I'll update and resend tomorrow. The ambient light sensor, I'll drop from now and leave it pending until we have a good answer for where it should go. -- balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/8] lp5521: move to drivers/leds 2008-10-14 13:01 ` [PATCH 3/8] lp5521: move to drivers/leds Felipe Balbi 2008-10-14 13:01 ` [PATCH 4/8] leds: lp5521: simplify mode setting Felipe Balbi @ 2008-10-14 15:53 ` David Brownell 2008-10-14 17:11 ` Felipe Balbi 1 sibling, 1 reply; 24+ messages in thread From: David Brownell @ 2008-10-14 15:53 UTC (permalink / raw) To: Felipe Balbi; +Cc: linux-omap, Richard Purdie On Tuesday 14 October 2008, Felipe Balbi wrote: > This driver should be sitting together with the other > led drivers. ... iff it actually uses the LED framework. Which it doesn't, yet, even for simple operations. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/8] lp5521: move to drivers/leds 2008-10-14 15:53 ` [PATCH 3/8] lp5521: move to drivers/leds David Brownell @ 2008-10-14 17:11 ` Felipe Balbi 2008-10-14 17:19 ` David Brownell 0 siblings, 1 reply; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 17:11 UTC (permalink / raw) To: David Brownell; +Cc: Felipe Balbi, linux-omap, Richard Purdie On Tue, Oct 14, 2008 at 08:53:28AM -0700, David Brownell wrote: > On Tuesday 14 October 2008, Felipe Balbi wrote: > > This driver should be sitting together with the other > > led drivers. > > ... iff it actually uses the LED framework. Which it > doesn't, yet, even for simple operations. Should I change the order of the patches ? The patch going to Richard is only the final version of it, so there wouldn't be any difference for him I'd say. -- balbi ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/8] lp5521: move to drivers/leds 2008-10-14 17:11 ` Felipe Balbi @ 2008-10-14 17:19 ` David Brownell 2008-10-14 17:32 ` Felipe Balbi 0 siblings, 1 reply; 24+ messages in thread From: David Brownell @ 2008-10-14 17:19 UTC (permalink / raw) To: me; +Cc: Felipe Balbi, linux-omap, Richard Purdie On Tuesday 14 October 2008, Felipe Balbi wrote: > On Tue, Oct 14, 2008 at 08:53:28AM -0700, David Brownell wrote: > > On Tuesday 14 October 2008, Felipe Balbi wrote: > > > This driver should be sitting together with the other > > > led drivers. > > > > ... iff it actually uses the LED framework. Which it > > doesn't, yet, even for simple operations. > > Should I change the order of the patches ? The patch going to Richard is > only the final version of it, so there wouldn't be any difference for > him I'd say. The rule of thumb is to preserve bisectability. That may be less important inside the OMAP tree. The sequencing is fine, but it'd be less confusing to patch-at-a-time review to at least see the comment that a *later* patch makes it use the LED framework. - Dave ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 3/8] lp5521: move to drivers/leds 2008-10-14 17:19 ` David Brownell @ 2008-10-14 17:32 ` Felipe Balbi 0 siblings, 0 replies; 24+ messages in thread From: Felipe Balbi @ 2008-10-14 17:32 UTC (permalink / raw) To: David Brownell; +Cc: me, Felipe Balbi, linux-omap, Richard Purdie On Tue, Oct 14, 2008 at 10:19:52AM -0700, David Brownell wrote: > On Tuesday 14 October 2008, Felipe Balbi wrote: > > On Tue, Oct 14, 2008 at 08:53:28AM -0700, David Brownell wrote: > > > On Tuesday 14 October 2008, Felipe Balbi wrote: > > > > This driver should be sitting together with the other > > > > led drivers. > > > > > > ... iff it actually uses the LED framework. Which it > > > doesn't, yet, even for simple operations. > > > > Should I change the order of the patches ? The patch going to Richard is > > only the final version of it, so there wouldn't be any difference for > > him I'd say. > > The rule of thumb is to preserve bisectability. That may be less > important inside the OMAP tree. The sequencing is fine, but it'd > be less confusing to patch-at-a-time review to at least see the > comment that a *later* patch makes it use the LED framework. makes sense, I'll put a comment to patch 2. -- balbi ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2008-10-15 8:26 UTC | newest] Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-10-14 13:01 [PATCH 0/8] updtes to few nokia drivers Felipe Balbi 2008-10-14 13:01 ` [PATCH 1/8] i2c: lp5521: remove dead code Felipe Balbi 2008-10-14 13:01 ` [PATCH 2/8] i2c: lp5521: cosmetic fixes Felipe Balbi 2008-10-14 13:01 ` [PATCH 3/8] lp5521: move to drivers/leds Felipe Balbi 2008-10-14 13:01 ` [PATCH 4/8] leds: lp5521: simplify mode setting Felipe Balbi 2008-10-14 13:01 ` [PATCH 5/8] leds: lp5521: register separate leds Felipe Balbi 2008-10-14 13:01 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Felipe Balbi 2008-10-14 13:01 ` [PATCH 7/8] input: lm8323: get rid of global pdata pointer Felipe Balbi 2008-10-14 13:01 ` [PATCH 8/8] input: tsc2005: move to gpiolib Felipe Balbi 2008-10-14 13:38 ` [PATCH 6/8] tsl2563: move tsl2563 to drivers/hwmon Jean Delvare 2008-10-14 13:52 ` Felipe Balbi 2008-10-14 14:14 ` Jean Delvare 2008-10-14 14:38 ` Felipe Balbi 2008-10-14 16:00 ` David Brownell 2008-10-14 21:20 ` Felipe Balbi 2008-10-14 21:44 ` David Brownell 2008-10-14 21:50 ` Felipe Balbi 2008-10-15 8:26 ` Jean Delvare 2008-10-14 15:55 ` [PATCH 5/8] leds: lp5521: register separate leds David Brownell 2008-10-14 17:09 ` Felipe Balbi 2008-10-14 15:53 ` [PATCH 3/8] lp5521: move to drivers/leds David Brownell 2008-10-14 17:11 ` Felipe Balbi 2008-10-14 17:19 ` David Brownell 2008-10-14 17:32 ` Felipe Balbi
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.