22 Jul, 2020

3 commits


05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to the free
    software foundation inc 51 franklin st fifth floor boston ma 02110
    1301 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 246 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190530000436.674189849@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

13 Jun, 2018

1 commit

  • The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
    This patch replaces cases of:

    devm_kzalloc(handle, a * b, gfp)

    with:
    devm_kcalloc(handle, a * b, gfp)

    as well as handling cases of:

    devm_kzalloc(handle, a * b * c, gfp)

    with:

    devm_kzalloc(handle, array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    devm_kcalloc(handle, array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    devm_kzalloc(handle, 4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    Some manual whitespace fixes were needed in this patch, as Coccinelle
    really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    expression HANDLE;
    type TYPE;
    expression THING, E;
    @@

    (
    devm_kzalloc(HANDLE,
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression HANDLE;
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    expression HANDLE;
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    expression HANDLE;
    identifier SIZE, COUNT;
    @@

    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression HANDLE;
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression HANDLE;
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    expression HANDLE;
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression HANDLE;
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression HANDLE;
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
    |
    devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2, ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

30 Aug, 2017

1 commit

  • Don't populate the arrays on the stack, instead make them static const.
    Makes the object code smaller by over 120 bytes:

    Before:
    text data bss dec hex filename
    8999 4176 64 13239 33b7 drivers/leds/leds-lp5521.o

    After:
    text data bss dec hex filename
    8554 4496 64 13114 333a drivers/leds/leds-lp5521.o

    Signed-off-by: Colin Ian King
    Signed-off-by: Jacek Anaszewski

    Colin Ian King
     

09 May, 2017

1 commit


04 Jan, 2016

1 commit


28 Aug, 2015

1 commit

  • Currently, lp55xx_of_populate_pdata() allocates lp55xx_platform_data if
    it's null. And it parses the DT and copies values into the
    'client->dev.platform_data'. This may have architectural issue.
    Platform data is configurable through the DT or I2C board info inside the
    platform area. However, lp55xx common driver changes this configuration
    when it is loaded. So 'client->dev.platform_data' is not null anymore.
    Eventually, the driver initialization is not identical when it's unloaded
    and loaded again.
    The lp55xx common driver should use the private data, 'lp55xx_chip->pdata'
    instead of changing the original platform data.

    So, lp55xx_of_populate_pdata() is modified as follows.
    * Do not update 'dev->platform_data'. Return the pointer of new allocated
    lp55xx_platform_data. Then the driver points it to private data,
    'lp55xx_chip->pdata'.
    * Each lp55xx driver checks the pointer and handles an error case.

    Then, original platform data configuration will be kept regardless of
    loading or unloading the driver.
    The driver allocates the memory and copies them from the DT if it's NULL.
    After the driver is loaded again, 'client->dev.platform_data' is same as
    initial load, so the driver is initialized identically.

    Cc: Toshi Kikuchi
    Cc: linux-leds@vger.kernel.org
    Signed-off-by: Milo Kim
    Signed-off-by: Jacek Anaszewski

    Milo Kim
     

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

20 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