28 Feb, 2014

1 commit


29 Jan, 2014

1 commit

  • 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.

    Linus Torvalds
     

28 Jan, 2014

1 commit

  • Whenever the engine is loaded by the user-application, the operation mode is
    reset first. But it has a problem in case of multiple engine used because
    previous engine settings are cleared.
    The driver should update not whole 8bits but each engine bit by masking.

    On the other hands, whole engines should be reset when the driver is unloaded
    and on initializing the LP5523 driver.
    So, new functions are used for this handling - lp5521/5523_stop_all_engines().

    Cc: Pali Rohár
    Signed-off-by: Milo Kim
    Signed-off-by: Bryan Wu

    Milo Kim
     

11 Jan, 2014

1 commit

  • It can be a problem when a pattern is loaded via the firmware interface.
    LP55xx common driver has already locked the mutex in 'lp55xx_firmware_loaded()'.
    So it should be deleted.

    On the other hand, locks are required in store_engine_load()
    on updating program memory.

    Reported-by: Pali Rohár
    Reported-by: Pavel Machek
    Signed-off-by: Milo Kim
    Signed-off-by: Bryan Wu
    Cc:

    Milo Kim
     

27 Aug, 2013

3 commits

  • This patch reduces the number of programming commands.

    (Count of sending commands)
    Old code: 32 + program size (32 counts for clearing program memory)
    New code: 32

    Pattern buffer is initialized to 0 in this function.
    Just update new program data and remaining buffers are filled with 0.
    So it's needless to clear whole area.

    Signed-off-by: Milo Kim
    Signed-off-by: Bryan Wu

    Milo Kim
     
  • git commit 9ce7cb170f97f83a78dc948bf7d25690f15e1328
    may cause an application confict, engineN_mode and engineN_load.
    This interface should be maintained for compatibility.

    Restored device attributes are 'engineN_mode' and 'engineN_load'.
    A 'selftest' attribute macro is replaced with LP55xx common macro.

    Use a mutex in lp5521_update_program_memory()
    : This function is called when an user-application writes a 'engineN_load' file
    or pattern data is loaded from generic firmware interface.
    So, writing program memory should be protected.
    If an error occurs on accessing this area, just it returns as -EINVAL quickly.
    This error code is exact same as old driver function, lp5521_do_store_load()
    because it should be kept for an user-application compatibility.
    Even the driver is changed, we can use the application without re-compiling
    sources.

    'led_pattern' attribute is not included
    : engineN_mode and _load were created for custom user-application.
    'led_pattern' is an exception. I added this attribute not for custom application
    but for simple test. Now it is used only in LP5562 driver, not LP5521.

    Signed-off-by: Milo Kim
    Signed-off-by: Bryan Wu

    Milo Kim
     
  • Use the wrapper function for retrieving the platform data instead of
    accessing dev->platform_data directly.

    Signed-off-by: Jingoo Han
    Signed-off-by: Bryan Wu

    Jingoo Han
     

21 Jun, 2013

2 commits


02 Apr, 2013

2 commits

  • Now LP55xx provides automatic clock detection API, lp55xx_is_extclk_used().
    The clock configuration can be done by the driver itself.

    (a) Concept
    The default value is set by each driver with clock selection.
    The internal clock selection bit is updated in case that the external clock
    is not detected or clock rate is not 32KHz.

    (b) Change on LP55xx platform data
    The clock configuration is done automatically, so no need to define
    'update_config' in the platform side.
    Correlated information are removed in the documentations and header.

    (c) Definitions moved from header to driver files
    CONFIG register values are moved each driver, LP5521 and LP5562.
    Not necessary definitions are removed also.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Kim, Milo
     
  • According to a sysfs documentation(Documentation/filesystem/sysfs.txt),
    scnprintf() should be used in a read operation method.
    It guarantees safe buffer size(PAGE_SIZE) which is allocated by the sysfs.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Kim, Milo
     

07 Feb, 2013

28 commits

  • Now LP5521 and LP5523 drivers are based on new lp55xx structure.
    So the author and copyrights are updated.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • Remove unused headers and sort them alphabetically

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • Remove unused definitions and change hex values to capital letters

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • Old data structures and I2C function are not used any more.
    Each driver uses the lp55xx common data and functions.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • Replace lp5521/5523_unregister_sysfs() with lp55xx_unregister_sysfs().

    On unloading the driver, running engines should be stopped.
    Use explicit driver function, lp5521/5523_stop_engine().

    Unused functions are removed.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • LP5521 and LP5523 have a selftest function which is run via the sysfs.
    Use lp55xx driver data and R/W functions rather than lp5521/5523 private data
    and functions.
    Additionally, if-statements are changed for code simplicity.
    Unused functions, lp5521/5523_read() are removed.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • lp5521/5523_register_sysfs() are replaced with lp55xx common driver function,
    lp55xx_register_sysfs().
    Chip specific device attributes are configurable using 'dev_attr_group'.

    Error condition name is changed:
    use specific error condition, 'err_register_sysfs' rather than unclear name,
    'fail2'.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • LP55xx common driver provides generic firmware interface
    for running a LED pattern.
    LP5521 and LP5523 have many device attributes for running patterns.
    This patch cleans up those complex code.

    Removed device attributes:
    engine1_mode
    engine2_mode
    engine3_mode
    engine1_load
    engine2_load
    engine3_load
    led_pattern

    All device attributes and functions are replaced with two callback functions,
    'firmware_cb' and 'run_engine'.

    New engine functions:
    lp5521_load/stop/run_engine(), lp5521_update_program_memory() and
    lp5521_wait_opmode_done()

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    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: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • LED current is configurable via the sysfs.
    Max current is a read-only attribute.
    These attributes code can be shared in lp55xx common driver.

    Device attributes: 'led_current' and 'max_current'
    move to lp55xx common driver

    Replaced functions:
    show_max_current() => lp55xx_show_max_current()
    show_current() => lp55xx_show_current()
    store_current() => lp55xx_store_current()

    LED setting function: set_led_current()
    Current registers are device specific, so configurable function is added
    in each driver.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • lp5521_set_brightness() and lp5523_set_brightness() are replaced with
    common function, lp55xx_set_brightness().
    This function is invoked when the brightness of each LED channel is updated.
    LP5521 and LP5523 have different register address for the brightness control,
    so this work is done by chip specific brightness_work_fn().

    lp5521/5523_led_brightness_work():
    use lp55xx_led and lp55xx_chip data structure.
    use lp55xx write function.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    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: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    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: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    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: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • lp5521/5523_init_device() are replaced with lp55xx common function,
    lp55xx_init_device().

    Error handler in init_device:
    deinit function are matched with 'err_post_init' section in
    lp55xx_init_device().

    Remove LP5523 engine intialization code:
    Engine functionality is not mandatory but optional.
    Moreover engine initialization is done internally with device reset command.
    Therefore, this code is unnecessary.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    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: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    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: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    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: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    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: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • This patch is a preceding step for making common lp55xx init function.

    LP5521_REG_R_CURRENT register code moved:
    Chip specific code moved from lp5521_init_device() to lp5521_configure().

    Remove engine init function:
    LP5521 has internal program engines which are used for running LED patterns.
    (blinking, ramp up/down and other emotional visual effects)
    Engine initialization is done by reset command in lp5521_init_device().
    Remove this duplicate code.

    Return code:
    Do not use 'OR' arithmetic for the result.
    If some error occus, just return it.

    Enable latency:
    Use explicit named function, lp5521_wait_enable_done().
    According to the datasheet, 500us is guaranteed time.
    Thus wait time is changed from 1000us to 500us.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • LP5521 and LP5523 data structures have common features.
    Use common lp55xx data structures rather than chip specific data.
    Legacy code in probe is replaced with this new data structures.

    lp55xx_chip : Common data between lp5521_chip and lp5523_chip
    lp55xx_led : Common LED structure between lp5521_led and lp5523_led
    lp55xx_platform_data : Common platform data between lp5521_platform_data and
    lp5523_platform_data

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • Change the name of chip data structure and platform data.
    This patch is a preceding step for cleaning up lp5521/5523 probe and remove.
    These data will be replaced with new lp55xx common data structures
    in next patch.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • Chip specific function is configured when the device is initialized.
    So _configure() is moved to each device init function.

    If chip configuration gets failed, the device is de-initialized in
    each _init_device(), not probe().

    For compile error fix, function type declarations are added.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • Use explicit each driver function rather than raw command.
    These function will be merged into the lp55xx common driver.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • To make LED unregistration code simple, new function, _unregister_leds()
    is added in each driver.
    This patch is a preceding step for lp55xx common driver architecture.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • To make LED initialization code simple, new function, _register_leds()
    is added at each driver.
    This patch is a preceding step for lp55xx common driver architecture.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • Device de-initialization code is moved to _deinit_device() at each driver.
    This patch is a preceding step for lp55xx common driver architecture.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     
  • To make _probe() simple, device initialization code is moved to
    _init_device() at each driver.
    This patch is a preceding step for lp55xx common driver architecture.

    leds-lp5521:
    When 'lp5521_init_device()' gets failed, error handling should be 'fail1'
    rather than 'fail2'.
    fail1: releasing platform resource and return code
    fail2: releasing allocated LED devices with handling 'fail1'
    The 'lp5521_init_device()' is called before creating LED devices.
    Thus, 'goto fail1' is proper error handler of this function.

    Signed-off-by: Milo(Woogyom) Kim
    Signed-off-by: Bryan Wu

    Milo(Woogyom) Kim
     

16 Dec, 2012

1 commit

  • Pull LED subsystem update from Bryan Wu.

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (47 commits)
    leds: leds-lp5521: return an error code on error in probe()
    leds: leds-clevo-mail: Use pr_* instead of printks
    leds: leds-rb532: Fix checkpatch errors
    leds: led-triggers: Fix checkpatch warnings
    leds: ledtrig-backlight: Fix checkpatch error
    leds: leds-wrap: Use instead of
    leds: leds-wm8350: Use dev_err instead of printk
    leds: leds-pwm: Fix checkpatch warning
    leds: leds-pca955x: Use dev_info instead of printk
    leds: leds-net48xx: Use linux/io.h instead of asm/io.h
    leds: leds-lt3593: Fix checkpatch warnings
    leds: leds-gpio: Use dev_info instead of printk
    leds: leds-da903x: Fix checkpatch error and warnings
    leds: leds-bd2802: Fix checkpatch warnings
    leds: leds-adp5520: Fix checkpatch warnings
    leds: led-class: Fix checkpatch warning
    leds: leds-ns2: use devm_gpio_request_one
    leds: leds-lt3593: use devm_gpio_request_one
    leds: leds-gpio: use devm_gpio_request_one
    leds: lp3944: Fix return value
    ...

    Linus Torvalds