]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 29 Jan 2014 02:53:01 +0000 (18:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 29 Jan 2014 02:53:01 +0000 (18:53 -0800)
Pull LED subsystem update from Bryan Wu:
 "Basically this cycle is mostly cleanup for LED subsystem"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
  leds: s3c24xx: Remove hardware.h inclusion
  leds: replace list_for_each with list_for_each_entry
  leds: kirkwood: Cleanup in header files
  leds: pwm: Remove a warning on non-DT platforms
  leds: leds-pwm: fix duty time overflow.
  leds: leds-mc13783: Remove unneeded mc13xxx_{un}lock
  leds: leds-mc13783: Remove duplicate field in platform data
  drivers: leds: leds-tca6507: check CONFIG_GPIOLIB whether defined for 'gpio_base'
  leds: lp5523: Support LED MUX configuration on running a pattern
  leds: lp5521/5523: Fix multiple engine usage bug
  LEDS: tca6507 - fix up some comments.
  LEDS: tca6507: add device-tree support for GPIO configuration.
  LEDS: tca6507 - fix bugs in parsing of device-tree configuration.

1  2 
drivers/leds/leds-lp5521.c
drivers/leds/leds-lp5523.c
drivers/leds/leds-s3c24xx.c
include/linux/mfd/mc13xxx.h

index a97263e902ffc6b927db6b935cb290902909f21e,26f89ac15998bab779c117b0d49d4af933d3a005..2ec34cfcedcee613aebd97bae8c06966b826f404
@@@ -152,12 -152,26 +152,26 @@@ static void lp5521_load_engine(struct l
        lp5521_wait_opmode_done();
  }
  
- static void lp5521_stop_engine(struct lp55xx_chip *chip)
+ static void lp5521_stop_all_engines(struct lp55xx_chip *chip)
  {
        lp55xx_write(chip, LP5521_REG_OP_MODE, 0);
        lp5521_wait_opmode_done();
  }
  
+ static void lp5521_stop_engine(struct lp55xx_chip *chip)
+ {
+       enum lp55xx_engine_index idx = chip->engine_idx;
+       u8 mask[] = {
+               [LP55XX_ENGINE_1] = LP5521_MODE_R_M,
+               [LP55XX_ENGINE_2] = LP5521_MODE_G_M,
+               [LP55XX_ENGINE_3] = LP5521_MODE_B_M,
+       };
+       lp55xx_update_bits(chip, LP5521_REG_OP_MODE, mask[idx], 0);
+       lp5521_wait_opmode_done();
+ }
  static void lp5521_run_engine(struct lp55xx_chip *chip, bool start)
  {
        int ret;
@@@ -244,12 -258,18 +258,12 @@@ static int lp5521_update_program_memory
        if (i % 2)
                goto err;
  
 -      mutex_lock(&chip->lock);
 -
        for (i = 0; i < LP5521_PROGRAM_LENGTH; i++) {
                ret = lp55xx_write(chip, addr[idx] + i, pattern[i]);
 -              if (ret) {
 -                      mutex_unlock(&chip->lock);
 +              if (ret)
                        return -EINVAL;
 -              }
        }
  
 -      mutex_unlock(&chip->lock);
 -
        return size;
  
  err:
@@@ -421,17 -441,15 +435,17 @@@ static ssize_t store_engine_load(struc
  {
        struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
        struct lp55xx_chip *chip = led->chip;
 +      int ret;
  
        mutex_lock(&chip->lock);
  
        chip->engine_idx = nr;
        lp5521_load_engine(chip);
 +      ret = lp5521_update_program_memory(chip, buf, len);
  
        mutex_unlock(&chip->lock);
  
 -      return lp5521_update_program_memory(chip, buf, len);
 +      return ret;
  }
  store_load(1)
  store_load(2)
@@@ -564,7 -582,7 +578,7 @@@ static int lp5521_remove(struct i2c_cli
        struct lp55xx_led *led = i2c_get_clientdata(client);
        struct lp55xx_chip *chip = led->chip;
  
-       lp5521_stop_engine(chip);
+       lp5521_stop_all_engines(chip);
        lp55xx_unregister_sysfs(chip);
        lp55xx_unregister_leds(led, chip);
        lp55xx_deinit_device(chip);
index 3a0bc886a87a2c88782c9b075f0eba935271ebc2,2ce172396242932f0c6a977246e30222426a169c..4ade66a2d9d4758b314c45ed52a222ff0cb0aeca
  
  #include "leds-lp55xx-common.h"
  
 -#define LP5523_PROGRAM_LENGTH         32
 +#define LP5523_PROGRAM_LENGTH         32      /* bytes */
 +/* Memory is used like this:
 +   0x00 engine 1 program
 +   0x10 engine 2 program
 +   0x20 engine 3 program
 +   0x30 engine 1 muxing info
 +   0x40 engine 2 muxing info
 +   0x50 engine 3 muxing info
 +*/
  #define LP5523_MAX_LEDS                       9
  
  /* Registers */
@@@ -195,12 -187,26 +195,26 @@@ static void lp5523_load_engine_and_sele
        lp55xx_write(chip, LP5523_REG_PROG_PAGE_SEL, page_sel[idx]);
  }
  
- static void lp5523_stop_engine(struct lp55xx_chip *chip)
+ static void lp5523_stop_all_engines(struct lp55xx_chip *chip)
  {
        lp55xx_write(chip, LP5523_REG_OP_MODE, 0);
        lp5523_wait_opmode_done();
  }
  
+ static void lp5523_stop_engine(struct lp55xx_chip *chip)
+ {
+       enum lp55xx_engine_index idx = chip->engine_idx;
+       u8 mask[] = {
+               [LP55XX_ENGINE_1] = LP5523_MODE_ENG1_M,
+               [LP55XX_ENGINE_2] = LP5523_MODE_ENG2_M,
+               [LP55XX_ENGINE_3] = LP5523_MODE_ENG3_M,
+       };
+       lp55xx_update_bits(chip, LP5523_REG_OP_MODE, mask[idx], 0);
+       lp5523_wait_opmode_done();
+ }
  static void lp5523_turn_off_channels(struct lp55xx_chip *chip)
  {
        int i;
@@@ -311,7 -317,7 +325,7 @@@ static int lp5523_init_program_engine(s
        }
  
  out:
-       lp5523_stop_engine(chip);
+       lp5523_stop_all_engines(chip);
        return ret;
  }
  
@@@ -345,12 -351,18 +359,12 @@@ static int lp5523_update_program_memory
        if (i % 2)
                goto err;
  
 -      mutex_lock(&chip->lock);
 -
        for (i = 0; i < LP5523_PROGRAM_LENGTH; i++) {
                ret = lp55xx_write(chip, LP5523_REG_PROG_MEM + i, pattern[i]);
 -              if (ret) {
 -                      mutex_unlock(&chip->lock);
 +              if (ret)
                        return -EINVAL;
 -              }
        }
  
 -      mutex_unlock(&chip->lock);
 -
        return size;
  
  err:
@@@ -550,17 -562,15 +564,17 @@@ static ssize_t store_engine_load(struc
  {
        struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
        struct lp55xx_chip *chip = led->chip;
 +      int ret;
  
        mutex_lock(&chip->lock);
  
        chip->engine_idx = nr;
        lp5523_load_engine_and_select_page(chip);
 +      ret = lp5523_update_program_memory(chip, buf, len);
  
        mutex_unlock(&chip->lock);
  
 -      return lp5523_update_program_memory(chip, buf, len);
 +      return ret;
  }
  store_load(1)
  store_load(2)
@@@ -782,7 -792,7 +796,7 @@@ static int lp5523_remove(struct i2c_cli
        struct lp55xx_led *led = i2c_get_clientdata(client);
        struct lp55xx_chip *chip = led->chip;
  
-       lp5523_stop_engine(chip);
+       lp5523_stop_all_engines(chip);
        lp55xx_unregister_sysfs(chip);
        lp55xx_unregister_leds(led, chip);
        lp55xx_deinit_device(chip);
index 87cf215af798c97076df857b0609292c1f752cfe,b7876eb09e8c47abca0712f9f1d16850aaaed49a..98174e7240ee9f41b8a4d0cddae494ebff99da65
  #include <linux/gpio.h>
  #include <linux/slab.h>
  #include <linux/module.h>
+ #include <linux/platform_data/leds-s3c24xx.h>
  
- #include <mach/hardware.h>
  #include <mach/regs-gpio.h>
- #include <linux/platform_data/leds-s3c24xx.h>
 +#include <plat/gpio-cfg.h>
  
  /* our context */
  
index 6156686bf108f38b91fcfb09766f73012dac20ea,ac2230561fc865a2fda96fd652d5aa88490dc5a1..ac39d910e70bda7c209d783dc6f01464a836e08a
@@@ -21,6 -21,8 +21,6 @@@ int mc13xxx_reg_write(struct mc13xxx *m
  int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset,
                u32 mask, u32 val);
  
 -int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
 -
  int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq,
                irq_handler_t handler, const char *name, void *dev);
  int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
@@@ -110,9 -112,6 +110,6 @@@ struct mc13xxx_led_platform_data 
        int id;
        const char *name;
        const char *default_trigger;
- /* Three or two bits current selection depending on the led */
-       char max_current;
  };
  
  #define MAX_LED_CONTROL_REGS  6
@@@ -121,7 -120,7 +118,7 @@@ struct mc13xxx_leds_platform_data 
        struct mc13xxx_led_platform_data *led;
        int num_leds;
  
- /* LED Control 0 */
+ /* MC13783 LED Control 0 */
  #define MC13783_LED_C0_ENABLE         (1 << 0)
  #define MC13783_LED_C0_TRIODE_MD      (1 << 7)
  #define MC13783_LED_C0_TRIODE_AD      (1 << 8)
  #define MC13783_LED_C0_BOOST          (1 << 10)
  #define MC13783_LED_C0_ABMODE(x)      (((x) & 0x7) << 11)
  #define MC13783_LED_C0_ABREF(x)               (((x) & 0x3) << 14)
- /* LED Control 1 */
+ /* MC13783 LED Control 1 */
  #define MC13783_LED_C1_TC1HALF                (1 << 18)
  #define MC13783_LED_C1_SLEWLIM                (1 << 23)
- /* LED Control 2 */
+ /* MC13783 LED Control 2 */
+ #define MC13783_LED_C2_CURRENT_MD(x)  (((x) & 0x7) << 0)
+ #define MC13783_LED_C2_CURRENT_AD(x)  (((x) & 0x7) << 3)
+ #define MC13783_LED_C2_CURRENT_KP(x)  (((x) & 0x7) << 6)
  #define MC13783_LED_C2_PERIOD(x)      (((x) & 0x3) << 21)
  #define MC13783_LED_C2_SLEWLIM                (1 << 23)
- /* LED Control 3 */
+ /* MC13783 LED Control 3 */
+ #define MC13783_LED_C3_CURRENT_R1(x)  (((x) & 0x3) << 0)
+ #define MC13783_LED_C3_CURRENT_G1(x)  (((x) & 0x3) << 2)
+ #define MC13783_LED_C3_CURRENT_B1(x)  (((x) & 0x3) << 4)
  #define MC13783_LED_C3_PERIOD(x)      (((x) & 0x3) << 21)
  #define MC13783_LED_C3_TRIODE_TC1     (1 << 23)
- /* LED Control 4 */
+ /* MC13783 LED Control 4 */
+ #define MC13783_LED_C4_CURRENT_R2(x)  (((x) & 0x3) << 0)
+ #define MC13783_LED_C4_CURRENT_G2(x)  (((x) & 0x3) << 2)
+ #define MC13783_LED_C4_CURRENT_B2(x)  (((x) & 0x3) << 4)
  #define MC13783_LED_C4_PERIOD(x)      (((x) & 0x3) << 21)
  #define MC13783_LED_C4_TRIODE_TC2     (1 << 23)
- /* LED Control 5 */
+ /* MC13783 LED Control 5 */
+ #define MC13783_LED_C5_CURRENT_R3(x)  (((x) & 0x3) << 0)
+ #define MC13783_LED_C5_CURRENT_G3(x)  (((x) & 0x3) << 2)
+ #define MC13783_LED_C5_CURRENT_B3(x)  (((x) & 0x3) << 4)
  #define MC13783_LED_C5_PERIOD(x)      (((x) & 0x3) << 21)
  #define MC13783_LED_C5_TRIODE_TC3     (1 << 23)
+ /* MC13892 LED Control 0 */
+ #define MC13892_LED_C0_CURRENT_MD(x)  (((x) & 0x7) << 9)
+ #define MC13892_LED_C0_CURRENT_AD(x)  (((x) & 0x7) << 21)
+ /* MC13892 LED Control 1 */
+ #define MC13892_LED_C1_CURRENT_KP(x)  (((x) & 0x7) << 9)
+ /* MC13892 LED Control 2 */
+ #define MC13892_LED_C2_CURRENT_R(x)   (((x) & 0x7) << 9)
+ #define MC13892_LED_C2_CURRENT_G(x)   (((x) & 0x7) << 21)
+ /* MC13892 LED Control 3 */
+ #define MC13892_LED_C3_CURRENT_B(x)   (((x) & 0x7) << 9)
        u32 led_control[MAX_LED_CONTROL_REGS];
  };