30 Dec, 2020

3 commits

  • [ Upstream commit 98650b0874171cc443251f7b369d3b1544db9d4e ]

    LED core does not allow LED_COLOR_ID_MULTI for now and instead for RGB
    LEDs prefers LED_COLOR_ID_RGB.

    Signed-off-by: Marek Behún
    Fixes: 77dce3a22e89 ("leds: disallow /sys/class/leds/*:multi:* for now")
    Signed-off-by: Pavel Machek
    Signed-off-by: Sasha Levin

    Marek Behún
     
  • [ Upstream commit 6d8d014c7dcf85a79da71ef586d06d03d2cae558 ]

    In case of memory allocation failure, we must release some resources as
    done in all other error handling paths of the function.

    'goto child_out' instead of a direct return so that 'fwnode_handle_put()'
    is called when we break out of a 'device_for_each_child_node' loop.

    Fixes: 242b81170fb8 ("leds: lp50xx: Add the LP50XX family of the RGB LED driver")
    Signed-off-by: Christophe JAILLET
    Acked-by: Dan Murphy
    Signed-off-by: Pavel Machek
    Signed-off-by: Sasha Levin

    Christophe JAILLET
     
  • [ Upstream commit 311066aa9ebcd6f1789c829da5039ca02f2dfe46 ]

    if of_find_device_by_node() succeed, netxbig_leds_get_of_pdata() doesn't
    have a corresponding put_device(). Thus add jump target to fix the
    exception handling for this function implementation.

    Fixes: 2976b1798909 ("leds: netxbig: add device tree binding")
    Signed-off-by: Yu Kuai
    Signed-off-by: Pavel Machek
    Signed-off-by: Sasha Levin

    Yu Kuai
     

07 Oct, 2020

1 commit

  • Since commit 141f15c66d94 ("leds: pwm: remove header") that platform
    interface is not usable from outside and there seems to be no in tree
    user anymore. All in-tree users of the leds-pwm driver seem to use DT
    currently. Getting rid of the old platform interface allows the
    leds-pwm driver to switch over from 'devm_led_classdev_register()' to
    'devm_led_classdev_register_ext()'.

    Signed-off-by: Alexander Dahl
    Cc: Denis Osterland-Heim
    Reviewed-by: Marek Behún
    Signed-off-by: Pavel Machek

    Alexander Dahl
     

06 Oct, 2020

1 commit

  • If both LED banks aren't used in device tree, an out-of-bounds
    condition in lm3697_init occurs because of the for loop assuming that
    all the banks are used. Fix it by adding a variable that contains the
    number of used banks.

    Signed-off-by: Gabriel David
    [removed extra rename, minor tweaks]
    Signed-off-by: Pavel Machek
    Cc: stable@kernel.org

    Gabriel David
     

01 Oct, 2020

23 commits


27 Sep, 2020

12 commits

  • Do the parsing of `linux,default-trigger` DT property to LED core.
    Currently it is done in many different drivers and the code is repeated.

    This patch removes the parsing from 23 drivers:
    an30259a, aw2013, bcm6328, bcm6358, cr0014114, el15203000, gpio,
    is31fl32xx, lm3532, lm36274, lm3692x, lm3697, lp50xx, lp8860, lt3593,
    max77650, mt6323, ns2, pm8058, pwm, syscon, tlc591xx and turris-omnia.

    There is one driver in drivers/input which parses this property on it's
    own. I shall send a separate patch there after this is applied.

    There are still 8 drivers that parse this property on their own because
    they do not pass the led_init_data structure to the registering
    function. I will try to refactor those in the future.

    Signed-off-by: Marek Behún
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • By using struct led_init_data when registering we do not need to parse
    `label` DT property. Moreover `label` is deprecated and if it is not
    present but `color` and `function` are, LED core will compose a name
    from these properties instead.

    Signed-off-by: Marek Behún
    Cc: Linus Walleij
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • This driver uses extended LED registration, so we do not need to parse
    the `label` DT property on our own.

    Signed-off-by: Marek Behún
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • Now that the potential use-after-free issue is resolved we can use
    devres for LED registration in this driver.

    By using devres version of LED registering function we can remove the
    .remove method from this driver.

    Signed-off-by: Marek Behún
    Tested-by: Dan Murphy
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • Instead of registering LED under the MFD device, this driver sets the
    parent of the LED it is registering to the parent of the MFD device (the
    I2C client device).

    Because of this we cannot use devres for LED registration, since it can
    result in use-after-free, see commit
    a0972fff0947 ("leds: lm36274: fix use-after-free on unbind").

    The only other in-tree driver that also registers under the MFD device
    (drivers/regulator/lm363x-regulator.c) sets the parent to the MFD
    device.

    Set the parent of this LED to the MFD device, instead of the I2C client
    device.

    Signed-off-by: Marek Behún
    Tested-by: Dan Murphy
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • These settings are not parsed from DT and therefore semantically should
    not be set in function with a name lm36274_parse_dt.

    Signed-off-by: Marek Behún
    Tested-by: Dan Murphy
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • By using struct led_init_data when registering we do not need to parse
    `label` DT property. Moreover `label` is deprecated and if it is not
    present but `color` and `function` are, LED core will compose a name
    from these properties instead.

    Previously if the `label` DT property was not present, the code composed
    name for the LED in the form
    "parent_name::"
    For backwards compatibility we therefore set
    init_data->default_label = ":";
    so that the LED will not get a different name if `label` property is not
    present, nor are `color` and `function`.

    Signed-off-by: Marek Behún
    Tested-by: Dan Murphy
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • Do not use device_for_each_child_node. Since this driver works only with
    once child node present, use device_get_next_child_node instead.
    This also saves one level of indentation.

    Signed-off-by: Marek Behún
    Reviewed-by: Dan Murphy
    Tested-by: Dan Murphy
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • Rename this variable so that it is easier to read and easier to write in
    80 columns. Also rename variable of this type in lm36274_brightness_set
    from led to chip, to be consistent.

    Signed-off-by: Marek Behún
    Tested-by: Dan Murphy
    Signed-off-by: Pavel Machek

    Marek Behún
     
  • Acer Iconia Tab A500 is an Android tablet device which has two LEDs
    embedded into the Power Button. Orange LED indicates "battery charging"
    status and white LED indicates "wake-up/charge-done" status. The new LED
    driver provides control over both LEDs to userspace.

    Signed-off-by: Dmitry Osipenko
    Signed-off-by: Pavel Machek

    Dmitry Osipenko
     
  • Simplify the return expression.

    Signed-off-by: Liu Shixin
    Signed-off-by: Pavel Machek

    Liu Shixin
     
  • By using struct led_init_data when registering we do not need to parse
    `label` DT property. Moreover `label` is deprecated and if it is not
    present but `color` and `function` are, LED core will compose a name
    from these properties instead.

    Signed-off-by: Marek Behún
    Cc: Simon Guinot
    Cc: Simon Guinot
    Cc: Vincent Donnefort
    Cc: Thomas Petazzoni
    Cc: Linus Walleij
    Signed-off-by: Pavel Machek

    Marek Behún