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
     

31 Oct, 2017

1 commit


01 Jul, 2017

1 commit


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
     

26 May, 2015

1 commit

  • This patch introduces 4 new attributes:
    master_fader_leds
    master_fader1
    master_fader2
    master_fader3

    Fo example, to map channel 0,6 to master_fader1,
    map channel 1,7 to master_fader2,
    map channel 2,8 to master_fader3, and
    map channel 3,4,5 to none

    echo "123000123" > master_fader_leds

    A different factor can be set to each master_fader:

    echo 255 > master_fader1
    echo 100 > master_fader2
    echo 0 > master_fader3

    Signed-off-by: Toshi Kikuchi
    Acked-by: Milo Kim
    Tested-by: Milo Kim
    Acked-by: Jacek Anaszewski
    Signed-off-by: Bryan Wu

    Toshi Kikuchi
     

08 May, 2014

1 commit


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
     

23 Jan, 2014

1 commit

  • Pull trivial tree updates from Jiri Kosina:
    "Usual rocket science stuff from trivial.git"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    neighbour.h: fix comment
    sched: Fix warning on make htmldocs caused by wait.h
    slab: struct kmem_cache is protected by slab_mutex
    doc: Fix typo in USB Gadget Documentation
    of/Kconfig: Spelling s/one/once/
    mkregtable: Fix sscanf handling
    lp5523, lp8501: comment improvements
    thermal: rcar: comment spelling
    treewide: fix comments and printk msgs
    IXP4xx: remove '1 &&' from a condition check in ixp4xx_restart()
    Documentation: update /proc/uptime field description
    Documentation: Fix size parameter for snprintf
    arm: fix comment header and macro name
    asm-generic: uaccess: Spelling s/a ny/any/
    mtd: onenand: fix comment header
    doc: driver-model/platform.txt: fix a typo
    drivers: fix typo in DEVTMPFS_MOUNT Kconfig help text
    doc: Fix typo (acces_process_vm -> access_process_vm)
    treewide: Fix typos in printk
    drivers/gpu/drm/qxl/Kconfig: reformat the help text
    ...

    Linus Torvalds
     

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
     

10 Jan, 2014

1 commit


23 Oct, 2013

1 commit


27 Aug, 2013

5 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 db6eaf8388a413a5ee1b4547ce78506b9c6456b0
    (leds-lp5523: use generic firmware interface) causes an application conflict.
    This interface should be maintained for compatibility.

    Restored device attributes are 'engineN_mode', 'engineN_load' and
    'engineN_leds'. (N = 1, 2 or 3)
    A 'selftest' attribute macro is replaced with LP55xx common macro.
    Those are accessed when a LED pattern is run by an application.

    Use a mutex in lp5523_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, lp5523_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.

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

    Milo Kim
     
  • LED MUX start and stop address should be updated in the program memory
    on LP5523 initialization.
    LED pattern doesn't work without additional MUX address configuration.
    This handling is done by new function, lp5523_init_program_engine().
    Eventually, it's called during device initialization, lp5523_post_init_device().

    This is a conflict after git commit 632418bf65503405df3f9a6a1616f5a95f91db85
    (leds-lp5523: clean up lp5523_configure()).
    So it should be fixed.

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

    Milo Kim
     
  • lp5523_load_engine()
    It is called whenever the operation mode is changed to 'load'.
    It is used for simple operation mode change.
    It will be used when engine mode and LED selection is updated in later patch.

    lp5523_load_engine_and_select_page()
    Change the operation mode to 'load' and select program page number.
    This is used for programming a LED pattern at a time.
    So load_engine() is replaced with new API, load_engine_and_select_page()
    in lp5523_firmware_loaded().

    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


07 Feb, 2013

18 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
    engine1_leds
    engine2_leds
    engine3_leds

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

    New engine functions:
    lp5523_load/stop/run_engine(), lp5523_update_program_memory() and
    lp5523_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