10 May, 2013

1 commit

  • Pull removal of GENERIC_GPIO from Grant Likely:
    "GENERIC_GPIO now synonymous with GPIOLIB. There are no longer any
    valid cases for enableing GENERIC_GPIO without GPIOLIB, even though it
    is possible to do so which has been causing confusion and breakage.
    This branch does the work to completely eliminate GENERIC_GPIO."

    * tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux:
    gpio: update gpio Chinese documentation
    Remove GENERIC_GPIO config option
    Convert selectors of GENERIC_GPIO to GPIOLIB
    blackfin: force use of gpiolib
    m68k: coldfire: use gpiolib
    mips: pnx833x: remove requirement for GENERIC_GPIO
    openrisc: default GENERIC_GPIO to false
    avr32: default GENERIC_GPIO to false
    xtensa: remove explicit selection of GENERIC_GPIO
    sh: replace CONFIG_GENERIC_GPIO by CONFIG_GPIOLIB
    powerpc: remove redundant GENERIC_GPIO selection
    unicore32: default GENERIC_GPIO to false
    unicore32: remove unneeded select GENERIC_GPIO
    arm: plat-orion: use GPIO driver on CONFIG_GPIOLIB
    arm: remove redundant GENERIC_GPIO selection
    mips: alchemy: require gpiolib
    mips: txx9: change GENERIC_GPIO to GPIOLIB
    mips: loongson: use GPIO driver on CONFIG_GPIOLIB
    mips: remove redundant GENERIC_GPIO select

    Linus Torvalds
     

16 Apr, 2013

1 commit


02 Apr, 2013

18 commits

  • Switch to using SIMPLE_DEV_PM_OPS macro to declare the driver's
    pm_ops. It reduces code size. Also, CONFIG_PM_SLEEP is added to
    suspend/ resume functions to prevent build warnings when
    CONFIG_PM_SLEEP is not selected.

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

    Jingoo Han
     
  • Add CONFIG_PM_SLEEP to suspend/resume functions to fix the following
    build warning when CONFIG_PM_SLEEP is not selected. This is because
    sleep PM callbacks defined by SIMPLE_DEV_PM_OPS are only used when
    the CONFIG_PM_SLEEP is enabled.

    drivers/leds/leds-bd2802.c:766:12: warning: 'bd2802_suspend' defined but not used [-Wunused-function]
    drivers/leds/leds-bd2802.c:776:12: warning: 'bd2802_resume' defined but not used [-Wunused-function]

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

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

    Kim, Milo
     
  • This patch fixes a regression introduced by commit 72052fcc10
    ("leds: leds-ns2: add device tree binding").

    When the driver is initialized with device tree data, platform_data
    pointer is NULL. This causes a kernel oops at removal.

    To fix this bug, num_leds is moved into driver_data and platform_data
    is not longer used from ns2_led_remove().

    Signed-off-by: Simon Guinot
    Signed-off-by: Bryan Wu

    Simon Guinot
     
  • Call to led_pwm_set() can happen inside atomic context, like triggers.
    If the PWM call can sleep, defer using a worker.

    Signed-off-by: Florian Vaussard
    Reviewed-by: Peter Ujfalusi
    Acked-by: Thierry Reding
    Signed-off-by: Bryan Wu

    Florian Vaussard
     
  • 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
     
  • LM355x and LM3642 support flash and torch functionality.

    (Camera driver) (LED trigger for camera) (LED driver)
    Turn on the flash ...> ledtrig_flash_ctrl(true) ...> LM355x or LM3642
    brightness ctrl

    Flash/torch LEDs are controlled by other driver using LED camera trigger
    APIs, ledtrig_flash_ctrl()/ledtrig_torch_ctrl().
    Then, actual device control is activated by each LED driver such like
    LM355x or LM3642.

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

    Kim, Milo
     
  • Some LED devices support flash/torch functionality through the LED subsystem.
    This patch enables direct LED trigger controls by the driver.
    Flash on/off and torch on/off can be done simply by other driver space.
    Two trigger APIs are added, ledtrig_flash_ctrl() and ledtrig_torch_ctrl().

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

    Kim, Milo
     
  • This eliminates having an #ifdef returning NULL for the case
    when OF is disabled.

    Signed-off-by: Sachin Kamat
    Signed-off-by: Bryan Wu

    Sachin Kamat
     
  • Provide some trace, though the hardware is most likely non-functional if
    this happens.

    Signed-off-by: Mark Brown
    Signed-off-by: Bryan Wu

    Mark Brown
     
  • The gpio_request_one() flags parameter was set to:

    GPIOF_DIR_OUT | !!brightness

    GPIOF_DIR_OUT and GPIOF_DIR_IN are defined as below:
    GPIOF_DIR_OUT (0 << 0)
    GPIOF_DIR_IN (1 << 0)

    So, when '!!brightness' is 1, the gpio pin can be set as input,
    instead of output.

    To prevent this problem, GPIOF_OUT_INIT flags should be used when
    using gpio_request_one().

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

    Jingoo Han
     
  • The devm_gpio_request_one() flags parameter was set to:

    GPIOF_DIR_OUT | gpio_get_value(template->cmd)

    GPIOF_DIR_OUT and GPIOF_DIR_IN are defined as below:

    GPIOF_DIR_OUT (0 << 0)
    GPIOF_DIR_IN (1 << 0)

    So, when 'gpio_get_value(template->cmd)' is 1, the gpio pin can
    be set as input, instead of output.

    To prevent this problem, GPIOF_OUT_INIT flags should be used when
    using devm_gpio_request_one().

    Same goes for 'gpio_get_value(template->slow)' case.

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

    Jingoo Han
     
  • The devm_gpio_request_one() flags parameter was set to:

    GPIOF_DIR_OUT | state

    GPIOF_DIR_OUT and GPIOF_DIR_IN are defined as below:

    GPIOF_DIR_OUT (0 << 0)
    GPIOF_DIR_IN (1 << 0)

    So, when 'state' is 1, the gpio pin can be set as input, instead
    of output.

    To prevent this problem, GPIOF_OUT_INIT flags should be used when
    using devm_gpio_request_one().

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

    Jingoo Han
     
  • CONFIG_HOTPLUG was removed, so __devexit or __exit of remove()
    should not be used.

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

    Jingoo Han
     
  • CONFIG_HOTPLUG was removed, so __devexit or __exit of remove()
    should not be used.

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

    Jingoo Han
     
  • For better driver management, new subdirectory, 'trigger' is created.
    All LED trigger drivers are moved into this directory.

    Internal header, 'leds.h' is included in each LED trigger drivers.
    Fix the location of header file, "leds.h" -> "../leds.h" in driver files.
    One exception is here, 'ledtrig-timer.c'.
    There is no need to include 'leds.h'. so '#include "leds.h"' line was removed.

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

    Kim, Milo
     
  • LP5562 can drive up to 4 channels, RGB and White.
    LEDs can be controlled directly via the led class control interface.

    LP55xx common driver
    LP5562 is one of LP55xx family device, so LP55xx common code are used.
    On the other hand, chip specific configuration is defined in the structure
    'lp55xx_device_config'

    LED pattern data
    LP5562 has also internal program memory which is used for running various LED
    patterns. LP5562 driver supports the firmware interface and the predefined
    pattern data as well.

    LP5562 device attributes: 'led_pattern' and 'engine_mux'
    A 'led_pattern' is an index code which runs the predefined pattern data.
    And 'engine_mux' is updated with the firmware interface is activated.
    Detailed description has been updated in the documentation files,
    'leds-lp55xx.txt' and 'leds-lp5562.txt'.

    Changes on the header file
    LP5562 configurable definitions are added.
    Pattern RGB data is fixed as constant value.
    (No side effect on other devices, LP5521 or LP5523.)

    (cooloney@gmail.com: remove redundant mutex_unlock(). Reported by Dan
    Carpenter )

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

    Kim, Milo
     

27 Feb, 2013

1 commit

  • Pull LED subsystem update from Bryan Wu.

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (61 commits)
    leds: leds-sunfire: use dev_err()/pr_err() instead of printk()
    leds: 88pm860x: Add missing of_node_put()
    leds: tca6507: Use of_get_child_count()
    leds: leds-pwm: make it depend on PWM and not HAVE_PWM
    Documentation: leds: update LP55xx family devices
    leds-lp55xx: fix problem on removing LED attributes
    leds-lp5521/5523: add author and copyright description
    leds-lp5521/5523: use new lp55xx common header
    leds-lp55xx: clean up headers
    leds-lp55xx: clean up definitions
    leds-lp55xx: clean up unused data and functions
    leds-lp55xx: clean up _remove()
    leds-lp55xx: add new function for removing device attribtues
    leds-lp55xx: code refactoring on selftest function
    leds-lp55xx: use common device attribute driver function
    leds-lp55xx: support device specific attributes
    leds-lp5523: use generic firmware interface
    leds-lp5521: use generic firmware interface
    leds-lp55xx: support firmware interface
    leds-lp55xx: add new lp55xx_register_sysfs() for the firmware interface
    ...

    Linus Torvalds
     

07 Feb, 2013

19 commits

  • Fixed the checkpatch errors and warnings as below:

    ERROR: spaces required around that '=' (ctx:VxW)
    WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

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

    Jingoo Han
     
  • of_find_node_by_name() returns a node pointer with refcount incremented, use
    of_node_put() on it when done.

    of_find_node_by_name() will call of_node_put() against from parameter,
    thus we also need to call of_node_get(from) before calling
    of_find_node_by_name().

    Signed-off-by: Axel Lin
    Signed-off-by: Bryan Wu

    Axel Lin
     
  • Signed-off-by: Axel Lin
    Signed-off-by: Bryan Wu

    Axel Lin
     
  • The correct dependency for the leds-pwm is PWM and not HAVE_PWM
    since PWM drivers now have their own subsystem.

    Signed-off-by: Peter Ujfalusi
    Signed-off-by: Bryan Wu

    Peter Ujfalusi
     
  • LP55XX common device attributes, 'led_current' and 'max_current' are created
    while loading the driver.
    Those are LED device attributes which are removed automatically on releasing
    led class devices - led_classdev_unregister().
    Therefore, this duplicate code should be removed.

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

    Milo(Woogyom) Kim
     
  • 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
     
  • lp55xx_unregister_sysfs() is used for removing lp55xx device attributes.
    Chip specific and engine attributes are removed on unloading the driver.

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

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

    Milo(Woogyom) Kim
     
  • Use lp55xx_unregister_leds() rather than duplicate code.

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

    Milo(Woogyom) Kim