1. 02 4月, 2013 1 次提交
    • K
      leds: lp55xx: use common clock framework when external clock is used · 53b41922
      Kim, Milo 提交于
      Program execution is timed with 32768Hz clock in the LP55xx family devices.
      To run LED functionalities, LP55xx devices provide two options.
      One is using internal clock. The other is using external clock.
      This patch enables external clock detection automatically.
      If external clock is not detected, then the internal clock will be used in the
      LP55xx driver.
      
      Valid clock rate is 32768Hz in LP55xx devices.
      
      This new API is used in each LP55xx driver like LP5521 and LP5562.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      53b41922
  2. 07 2月, 2013 13 次提交
    • M
      leds-lp55xx: add new function for removing device attribtues · ba6fa846
      Milo(Woogyom) Kim 提交于
       lp55xx_unregister_sysfs() is used for removing lp55xx device attributes.
       Chip specific and engine attributes are removed on unloading the driver.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      ba6fa846
    • M
      leds-lp55xx: support device specific attributes · 240085e2
      Milo(Woogyom) Kim 提交于
       To support device specific attributes, new common driver function is added.
       Eventually those are created on registering the sysfs with common dev attrs.
       Furthermore, this patch makes adding device attributes simple in each driver.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      240085e2
    • M
      leds-lp55xx: support firmware interface · 10c06d17
      Milo(Woogyom) Kim 提交于
       This patch provides additional device attributes which enable
       loading the firmware. ('select_engine' and 'run_engine')
       To run a LED pattern, two parts of driver should be enabled.
      
       Common features : lp55xx-common
       ===============================
       Firmware interface for loading LED patterns
      
       Chip specific features : leds-lp5521, leds-lp5523
       =================================================
       Register addresses for loading firmware data
       Register addresses for running selected engine
      
       Pattern programming sequence
       ============================
       LP55xx chips have three program engines.
       To load and run a LED pattern, the programming sequence is as follows.
       (1) Select an engine number (1/2/3)
       (2) Set engine mode to load
       (3) Write pattern data into selected area
       (4) Set engine mode to run
      
       This sequence is almost same as the firmware interface.
       (1) Select an engine number               : 'select_engine' dev attribute
       (2) Mode change to load                   : 'loading' of firmware class
       (3) Write pattern data into selected area : 'data' of firmware class
       (4) Mode change to run                    : 'run_engine' dev attribute
      
       (1) and (4) are device specific features which provide callback functions
       (2) and (3) are common features.
      
       For example,
       echo 1 or 2 or 3 > /sys/bus/i2c/devices/xxxx/select_engine
       echo 1 > /sys/class/firmware/lp5521/loading
       echo "4000600040FF6000" > /sys/class/firmware/lp5521/data
       echo 0 > /sys/class/firmware/lp5521/loading
       echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
      
       As soon as 'loading' is set to 0, registered callback is called.
       Inside the callback, the selected engine is loaded and memory is updated.
       To run programmed pattern, 'run_engine' attribute should be enabled.
      
       Device specific data structure
       ==============================
       o Firmware callback
         load selected engine and update program memory
       o Run engine
         change the engine mode
       o 'engine_idx' and firmware data, 'fw'
         Those are used in the driver internally with callback functions
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      10c06d17
    • M
      leds-lp55xx: add new lp55xx_register_sysfs() for the firmware interface · b3b6f811
      Milo(Woogyom) Kim 提交于
       LP55xx family chips have internal program memory which run various patterns.
       Using this memory, LEDs continue on blinking/dimming without continuous I2C
       commands. That means the I2C HOST can be entered into sleep once the memory
       is updated.
      
       An application can get hex data from a file and write them into
       the program memory through the I2C. This is general firwmare interface.
      
       This patch is the initial step for adding the firmware interface.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      b3b6f811
    • M
      leds-lp55xx: use lp55xx_unregister_leds() · c3a68ebf
      Milo(Woogyom) Kim 提交于
       To unregister led class devices and sysfs attributes,
       LP5521 and LP5523 have each driver function.
       This patch makes both drivers simple using common driver function,
       lp55xx_unregister_leds().
      
       And some unused variables are removed.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      c3a68ebf
    • M
      leds-lp55xx: use lp55xx_init_led() common function · 0e202346
      Milo(Woogyom) Kim 提交于
       lp5521_init_led() and lp5523_init_led() are replaced with one common function,
       lp55xx_init_led().
       Max channels is configurable, so it's used in lp55xx_init_led().
      
       'LP5523_LEDS' are changed to 'LP5523_MAX_LEDS'.
      
       lp55xx_set_brightness, lp55xx_led_attributes: skeleton
       Will be filled in next patches.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      0e202346
    • M
      leds-lp55xx: use lp55xx common led registration function · 9e9b3db1
      Milo(Woogyom) Kim 提交于
       LED class devices are registered in lp5521_register_leds() and
       lp5523_register_leds().
       Two separate functions are merged into consolidated lp55xx function,
       lp55xx_register_leds().
      
       Error handling fix:
       Unregistering LEDS are handled in lp55xx_register_leds() when LED registration
       failure occurs. So each driver error handler is changed to 'err_register_leds'
      
       Chip dependency: 'brightness_work_fn' and 'set_led_current'
       To make the structure abstract, both functions are configured in each driver.
       Those functions should be done by each driver because register control is
       chip-dependant work.
      
       lp55xx_init_led: skeleton
       Will be filled in next patch
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      9e9b3db1
    • M
      leds-lp55xx: use lp55xx common deinit function · 6ce61762
      Milo(Woogyom) Kim 提交于
       Two separate de-init functions are merged into one common function.
       And it is used in err_post_init of lp55xx_init_device().
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      6ce61762
    • M
      leds-lp55xx: use lp55xx common init function - post int · ffbdccdb
      Milo(Woogyom) Kim 提交于
       LP5521/5523 chip configuration is replaced with lp55xx common function,
       lp55xx_post_init_device().
      
       Name change:
       lp5521/5523_configure() to lp5521/5523_post_init_device()
       These are called in init function.
      
       Register access function
       Argument type is changed from 'i2c_client' to 'lp55xx_chip'.
       Use exported R/W functions of lp55xx common driver.
      
       Temporary variables in lp5521/5523_init_device()
       These functions will be removed but temporary variables are needed for
       blocking build warnings - incompatible pointer.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      ffbdccdb
    • M
      leds-lp55xx: use lp55xx common init function - detect · e3a700d8
      Milo(Woogyom) Kim 提交于
       LP5521/5523 chip detection functions are replaced with lp55xx common function,
       lp55xx_detect_device().
       Chip dependent address and values are configurable in each driver.
       In init function, chip detection is executed.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      e3a700d8
    • M
      leds-lp55xx: use lp55xx common init function - reset · 48068d5d
      Milo(Woogyom) Kim 提交于
       LP5521/5523 reset device functions are moved to lp55xx common driver.
       Value of register address and value are chip dependent.
       Those are configured in each driver.
       In init function, reset command is executed.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      48068d5d
    • M
      leds-lp55xx: use lp55xx common init function - platform data · a85908dd
      Milo(Woogyom) Kim 提交于
       LP5521/5523 platform data functions are moved to lp55xx common driver.
       New init function, lp55xx_init_device() is created.
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      a85908dd
    • M
      leds-lp55xx: add new common driver for lp5521/5523 · c93d08fa
      Milo(Woogyom) Kim 提交于
       This patch supports basic common driver code for LP5521, LP5523/55231 devices.
      
       ( Driver Structure Data )
      
       lp55xx_led and lp55xx_chip
       In lp55xx common driver, two different data structure is used.
       o lp55xx_led
         control multi output LED channels such as led current, channel index.
       o lp55xx_chip
         general chip control such like the I2C and platform data.
      
       For example, LP5521 has maximum 3 LED channels.
       LP5523/55231 has 9 output channels.
      
       lp55xx_chip for LP5521 ... lp55xx_led #1
                                  lp55xx_led #2
                                  lp55xx_led #3
      
       lp55xx_chip for LP5523 ... lp55xx_led #1
                                  lp55xx_led #2
                                  .
                                  .
                                  lp55xx_led #9
      
       ( Platform Data )
      
       LP5521 and LP5523/55231 have own specific platform data.
       However, this data can be handled with just one platform data structure.
       The lp55xx platform data is declared in the header.
       This structure is derived from leds-lp5521.h and leds-lp5523.h
      Signed-off-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      c93d08fa