Skip to content

Commit

Permalink
Merge tag 'leds-next-6.3' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/lee/leds

Pull LED updates from Lee Jones:
 "Removed Drivers:
   - HTC ASIC3 LED

  New Functionality:
   - Provide generic led_get() which can be used by both DT and !DT
     platforms

  Fix-ups:
   - Convert a bunch of I2C subsystem users to the new probing API
   - Explicitly provide missing include files
   - Make use of led_init_default_state_get() and rid the custom
     variants
   - Use simplified fwnode_device_is_compatible() API
   - Provide some Device Tree additions / adaptions
   - Fix some trivial spelling issues

  Bug Fixes:
   - Prevent device refcount leak during led_put() and of_led_get()
   - Clear previous data from temporary led_pwm structure before
     processing next child
   - Fix Clang's warning about incompatible function types when using
     devm_add_action*()"

* tag 'leds-next-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (41 commits)
  leds: Remove ide-disk trigger
  dt-bindings: leds: Add disk write/read and usb-host/usb-gadget
  Documentation: leds: Correct spelling
  dt-bindings: leds: Document Bluetooth and WLAN triggers
  leds: Remove asic3 driver
  leds: simatic-ipc-leds-gpio: Make sure we have the GPIO providing driver
  leds: tca6507: Convert to use fwnode_device_is_compatible()
  leds: syscon: Get rid of custom led_init_default_state_get()
  leds: pm8058: Get rid of custom led_init_default_state_get()
  leds: pca955x: Get rid of custom led_init_default_state_get()
  leds: mt6360: Get rid of custom led_init_default_state_get()
  leds: mt6323: Get rid of custom led_init_default_state_get()
  leds: bcm6358: Get rid of custom led_init_default_state_get()
  leds: bcm6328: Get rid of custom led_init_default_state_get()
  leds: an30259a: Get rid of custom led_init_default_state_get()
  leds: Move led_init_default_state_get() to the global header
  leds: Add missing includes and forward declarations in leds.h
  leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
  leds: turris-omnia: Convert to i2c's .probe_new()
  leds: tlc591xx: Convert to i2c's .probe_new()
  ...
  • Loading branch information
torvalds committed Feb 23, 2023
2 parents 025cf4d + 056f65c commit e4bc158
Show file tree
Hide file tree
Showing 41 changed files with 193 additions and 441 deletions.
15 changes: 10 additions & 5 deletions Documentation/devicetree/bindings/leds/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,22 @@ properties:
- heartbeat
# LED indicates disk activity
- disk-activity
# LED indicates IDE disk activity (deprecated), in new implementations
# use "disk-activity"
- ide-disk
- disk-read
- disk-write
# LED flashes at a fixed, configurable rate
- timer
# LED alters the brightness for the specified duration with one software
# timer (requires "led-pattern" property)
- pattern
# LED is triggered by SD/MMC activity
- pattern: "^mmc[0-9]+$"
- usb-gadget
- usb-host
- pattern: "^cpu[0-9]*$"
- pattern: "^hci[0-9]+-power$"
# LED is triggered by Bluetooth activity
- pattern: "^mmc[0-9]+$"
# LED is triggered by SD/MMC activity
- pattern: "^phy[0-9]+tx$"
# LED is triggered by WLAN activity

led-pattern:
description: |
Expand Down
4 changes: 2 additions & 2 deletions Documentation/leds/leds-qcom-lpg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Specify a hardware pattern for a Qualcomm LPG LED.

The pattern is a series of brightness and hold-time pairs, with the hold-time
expressed in milliseconds. The hold time is a property of the pattern and must
therefor be identical for each element in the pattern (except for the pauses
therefore be identical for each element in the pattern (except for the pauses
described below). As the LPG hardware is not able to perform the linear
transitions expected by the leds-trigger-pattern format, each entry in the
pattern must be followed a zero-length entry of the same brightness.
Expand Down Expand Up @@ -66,7 +66,7 @@ Low-pause pattern::
+----------------------------->
0 5 10 15 20 25 time (100ms)

Similarily, the last entry can be stretched by using a higher hold-time on the
Similarly, the last entry can be stretched by using a higher hold-time on the
last entry.

In order to save space in the shared lookup table the LPG supports "ping-pong"
Expand Down
11 changes: 0 additions & 11 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -623,17 +623,6 @@ config LEDS_NETXBIG
and 5Big Network v2 boards. The LEDs are wired to a CPLD and are
controlled through a GPIO extension bus.

config LEDS_ASIC3
bool "LED support for the HTC ASIC3"
depends on LEDS_CLASS=y
depends on MFD_ASIC3
default y
help
This option enables support for the LEDs on the HTC ASIC3. The HTC
ASIC3 LED GPIOs are inputs, not outputs, thus the leds-gpio driver
cannot be used. This driver supports hardware blinking with an on+off
period from 62ms to 125s. Say Y to enable LEDs on the HP iPAQ hx4700.

config LEDS_TCA6507
tristate "LED Support for TCA6507 I2C chip"
depends on LEDS_CLASS && I2C
Expand Down
1 change: 0 additions & 1 deletion drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
obj-$(CONFIG_LEDS_AN30259A) += leds-an30259a.o
obj-$(CONFIG_LEDS_APU) += leds-apu.o
obj-$(CONFIG_LEDS_ARIEL) += leds-ariel.o
obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o
obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o
obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o
obj-$(CONFIG_LEDS_BCM6358) += leds-bcm6358.o
Expand Down
38 changes: 6 additions & 32 deletions drivers/leds/flash/leds-mt6360.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ enum {
#define MT6360_STRBTO_STEPUS 32000
#define MT6360_STRBTO_MAXUS 2432000

#define STATE_OFF 0
#define STATE_KEEP 1
#define STATE_ON 2

struct mt6360_led {
union {
struct led_classdev isnk;
Expand All @@ -84,7 +80,7 @@ struct mt6360_led {
struct v4l2_flash *v4l2_flash;
struct mt6360_priv *priv;
u32 led_no;
u32 default_state;
enum led_default_state default_state;
};

struct mt6360_priv {
Expand Down Expand Up @@ -405,10 +401,10 @@ static int mt6360_isnk_init_default_state(struct mt6360_led *led)
level = LED_OFF;

switch (led->default_state) {
case STATE_ON:
case LEDS_DEFSTATE_ON:
led->isnk.brightness = led->isnk.max_brightness;
break;
case STATE_KEEP:
case LEDS_DEFSTATE_KEEP:
led->isnk.brightness = min(level, led->isnk.max_brightness);
break;
default:
Expand Down Expand Up @@ -443,10 +439,10 @@ static int mt6360_flash_init_default_state(struct mt6360_led *led)
level = LED_OFF;

switch (led->default_state) {
case STATE_ON:
case LEDS_DEFSTATE_ON:
flash->led_cdev.brightness = flash->led_cdev.max_brightness;
break;
case STATE_KEEP:
case LEDS_DEFSTATE_KEEP:
flash->led_cdev.brightness =
min(level, flash->led_cdev.max_brightness);
break;
Expand Down Expand Up @@ -760,25 +756,6 @@ static int mt6360_init_flash_properties(struct mt6360_led *led,
return 0;
}

static int mt6360_init_common_properties(struct mt6360_led *led,
struct led_init_data *init_data)
{
const char *const states[] = { "off", "keep", "on" };
const char *str;
int ret;

if (!fwnode_property_read_string(init_data->fwnode,
"default-state", &str)) {
ret = match_string(states, ARRAY_SIZE(states), str);
if (ret < 0)
ret = STATE_OFF;

led->default_state = ret;
}

return 0;
}

static void mt6360_v4l2_flash_release(struct mt6360_priv *priv)
{
int i;
Expand Down Expand Up @@ -852,10 +829,7 @@ static int mt6360_led_probe(struct platform_device *pdev)

led->led_no = reg;
led->priv = priv;

ret = mt6360_init_common_properties(led, &init_data);
if (ret)
goto out_flash_release;
led->default_state = led_init_default_state_get(child);

if (reg == MT6360_VIRTUAL_MULTICOLOR ||
reg <= MT6360_LED_ISNKML)
Expand Down
1 change: 1 addition & 0 deletions drivers/leds/led-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ struct led_classdev *of_led_get(struct device_node *np, int index)

led_dev = class_find_device_by_of_node(leds_class, led_node);
of_node_put(led_node);
put_device(led_dev);

return led_module_get(led_dev);
}
Expand Down
21 changes: 4 additions & 17 deletions drivers/leds/leds-an30259a.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,14 @@

#define AN30259A_NAME "an30259a"

#define STATE_OFF 0
#define STATE_KEEP 1
#define STATE_ON 2

struct an30259a;

struct an30259a_led {
struct an30259a *chip;
struct fwnode_handle *fwnode;
struct led_classdev cdev;
u32 num;
u32 default_state;
enum led_default_state default_state;
bool sloping;
};

Expand Down Expand Up @@ -205,7 +201,6 @@ static int an30259a_dt_init(struct i2c_client *client,
struct device_node *np = dev_of_node(&client->dev), *child;
int count, ret;
int i = 0;
const char *str;
struct an30259a_led *led;

count = of_get_available_child_count(np);
Expand All @@ -228,15 +223,7 @@ static int an30259a_dt_init(struct i2c_client *client,
led->num = source;
led->chip = chip;
led->fwnode = of_fwnode_handle(child);

if (!of_property_read_string(child, "default-state", &str)) {
if (!strcmp(str, "on"))
led->default_state = STATE_ON;
else if (!strcmp(str, "keep"))
led->default_state = STATE_KEEP;
else
led->default_state = STATE_OFF;
}
led->default_state = led_init_default_state_get(led->fwnode);

i++;
}
Expand All @@ -261,10 +248,10 @@ static void an30259a_init_default_state(struct an30259a_led *led)
int led_on, err;

switch (led->default_state) {
case STATE_ON:
case LEDS_DEFSTATE_ON:
led->cdev.brightness = LED_FULL;
break;
case STATE_KEEP:
case LEDS_DEFSTATE_KEEP:
err = regmap_read(chip->regmap, AN30259A_REG_LED_ON, &led_on);
if (err)
break;
Expand Down
177 changes: 0 additions & 177 deletions drivers/leds/leds-asic3.c

This file was deleted.

Loading

0 comments on commit e4bc158

Please sign in to comment.