Skip to content

Commit

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

Pull LED updates from Lee Jones:
 "Core Frameworks:
   - Ensure seldom updated triggers have a brightness value before first
     update

  New Device Support:
   - Add support for Simatic IPC Device BX_59A to IPC LEDs Core
   - Add support for Qualcomm PMI8950 PWM to LPG Core

  New Functionality:
   - Add a bunch of new LED function identifiers
   - Add support for High Resolution Timers in LED Trigger Patten

  Fix-ups:
   - Shift out Audio Trigger to the Sound subsystem
   - Convert suitable calls to devm_* managed resources
   - Device Tree binding adaptions/conversions/creation
   - Remove superfluous code/variables/attributes and simplify overall
   - Use/convert to new/better APIs/helpers/MACROs instead of
     hand-rolling implementations

  Bug Fixes:
   - Repair enabling Torch Mode from V4L2 on the second LED
   - Ensure PWM is disabled when suspending"

* tag 'leds-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (28 commits)
  leds: mt6370: Remove unused field 'reg_cfgs' from 'struct mt6370_priv'
  leds: lp50xx: Remove unused field 'num_of_banked_leds' from 'struct lp50xx'
  leds: lp50xx: Remove unused field 'bank_modules' from 'struct lp50xx_led'
  leds: aat1290: Remove unused field 'torch_brightness' from 'struct aat1290_led'
  leds: sun50i-a100: Use match_string() helper to simplify the code
  leds: pwm: Disable PWM when going to suspend
  leds: trigger: pattern: Add support for hrtimer
  leds: mt6360: Fix the second LED can not enable torch mode by V4L2
  dt-bindings: leds: leds-qcom-lpg: Add support for PMI8950 PWM
  leds: qcom-lpg: Add support for PMI8950 PWM
  leds: apu: Remove duplicate DMI lookup data
  leds: trigger: netdev: Remove not needed call to led_set_brightness in deactivate
  dt-bindings: leds: Add LED_FUNCTION_SPEED_* for link speed on LAN/WAN
  dt-bindings: leds: Add LED_FUNCTION_MOBILE for mobile network
  leds: simatic-ipc-leds-gpio: Add support for module BX-59A
  dt-bindings: leds: qcom-lpg: Document PM6150L compatible
  dt-bindings: leds: pca963x: Convert text bindings to YAML
  leds: an30259a: Use devm_mutex_init() for mutex initialization
  leds: mlxreg: Use devm_mutex_init() for mutex initialization
  leds: nic78bx: Use devm API to cleanup module's resources
  ...
  • Loading branch information
torvalds committed May 22, 2024
2 parents 7eae27c + f2994f5 commit f3033eb
Show file tree
Hide file tree
Showing 34 changed files with 501 additions and 275 deletions.
10 changes: 10 additions & 0 deletions Documentation/ABI/testing/sysfs-class-led-trigger-pattern
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ Description:
The exact format is described in:
Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt

What: /sys/class/leds/<led>/hr_pattern
Date: April 2024
Description:
Specify a software pattern for the LED, that supports altering
the brightness for the specified duration with one software
timer. It can do gradual dimming and step change of brightness.

Unlike the /sys/class/leds/<led>/pattern, this attribute runs
a pattern on high-resolution timer (hrtimer).

What: /sys/class/leds/<led>/hw_pattern
Date: September 2018
KernelVersion: 4.20
Expand Down
8 changes: 6 additions & 2 deletions Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ properties:
- qcom,pm8994-lpg
- qcom,pmc8180c-lpg
- qcom,pmi632-lpg
- qcom,pmi8950-pwm
- qcom,pmi8994-lpg
- qcom,pmi8998-lpg
- qcom,pmk8550-pwm
- items:
- enum:
- qcom,pm6150l-lpg
- const: qcom,pm8150l-lpg
- items:
- enum:
- qcom,pm8550-pwm
Expand Down Expand Up @@ -142,6 +147,7 @@ allOf:
- qcom,pm8941-lpg
- qcom,pm8994-lpg
- qcom,pmc8180c-lpg
- qcom,pmi8950-pwm
- qcom,pmi8994-lpg
- qcom,pmi8998-lpg
- qcom,pmk8550-pwm
Expand Down Expand Up @@ -290,5 +296,3 @@ examples:
label = "blue";
};
};
...
140 changes: 140 additions & 0 deletions Documentation/devicetree/bindings/leds/nxp,pca963x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/nxp,pca963x.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NXP PCA963x LED controllers

maintainers:
- Laurent Pinchart <[email protected]>

description: |
The NXP PCA963x are I2C-controlled LED drivers optimized for
Red/Green/Blue/Amber (RGBA) color mixing applications. Each LED is
individually controllable and has its own PWM controller.
Datasheets are available at
- https://www.nxp.com/docs/en/data-sheet/PCA9632.pdf
- https://www.nxp.com/docs/en/data-sheet/PCA9633.pdf
- https://www.nxp.com/docs/en/data-sheet/PCA9634.pdf
- https://www.nxp.com/docs/en/data-sheet/PCA9635.pdf
properties:
compatible:
enum:
- nxp,pca9632
- nxp,pca9633
- nxp,pca9634
- nxp,pca9635

reg:
maxItems: 1

"#address-cells":
const: 1

"#size-cells":
const: 0

nxp,hw-blink:
type: boolean
description:
Use hardware blinking instead of software blinking

nxp,inverted-out:
type: boolean
description:
Invert the polarity of the generated PWM.

nxp,period-scale:
$ref: /schemas/types.yaml#/definitions/uint32
description:
In some configurations, the chip blinks faster than expected. This
parameter provides a scaling ratio (fixed point, decimal divided by 1000)
to compensate, e.g. 1300=1.3x and 750=0.75x.

nxp,totem-pole:
type: boolean
description:
Use totem pole (push-pull) instead of open-drain (pca9632 defaults to
open-drain, newer chips to totem pole).

patternProperties:
"^led@[0-9a-f]+$":
type: object
$ref: common.yaml#
unevaluatedProperties: false

properties:
reg:
minimum: 0

required:
- reg

allOf:
- if:
properties:
compatible:
contains:
enum:
- nxp,pca9632
- nxp,pca9633
then:
patternProperties:
"^led@[0-9a-f]+$":
properties:
reg:
maximum: 3
else:
patternProperties:
"^led@[0-9a-f]+$":
properties:
reg:
maximum: 7

additionalProperties: false

examples:
- |
#include <dt-bindings/leds/common.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
led-controller@62 {
compatible = "nxp,pca9632";
reg = <0x62>;
#address-cells = <1>;
#size-cells = <0>;
led@0 {
reg = <0>;
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_STATUS;
};
led@1 {
reg = <1>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
};
led@2 {
reg = <2>;
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_STATUS;
};
led@3 {
reg = <3>;
color = <LED_COLOR_ID_WHITE>;
function = LED_FUNCTION_STATUS;
};
};
};
...
52 changes: 0 additions & 52 deletions Documentation/devicetree/bindings/leds/pca963x.txt

This file was deleted.

1 change: 0 additions & 1 deletion arch/mips/configs/ci20_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ CONFIG_LEDS_TRIGGER_CAMERA=m
CONFIG_LEDS_TRIGGER_PANIC=y
CONFIG_LEDS_TRIGGER_NETDEV=y
CONFIG_LEDS_TRIGGER_PATTERN=y
CONFIG_LEDS_TRIGGER_AUDIO=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_JZ4740=y
CONFIG_DMADEVICES=y
Expand Down
2 changes: 0 additions & 2 deletions drivers/leds/flash/leds-aat1290.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ struct aat1290_led {
int *mm_current_scale;
/* device mode */
bool movie_mode;
/* brightness cache */
unsigned int torch_brightness;
};

static struct aat1290_led *fled_cdev_to_led(
Expand Down
12 changes: 11 additions & 1 deletion drivers/leds/flash/leds-mt6360.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,20 @@ static int mt6360_strobe_set(struct led_classdev_flash *fl_cdev, bool state)
u32 enable_mask = MT6360_STROBEN_MASK | MT6360_FLCSEN_MASK(led->led_no);
u32 val = state ? MT6360_FLCSEN_MASK(led->led_no) : 0;
u32 prev = priv->fled_strobe_used, curr;
int ret;
int ret = 0;

mutex_lock(&priv->lock);

/*
* If the state of the upcoming change is the same as the current LED
* device state, then skip the subsequent code to avoid conflict
* with the flow of turning on LED torch mode in V4L2.
*/
if (state == !!(BIT(led->led_no) & prev)) {
dev_info(lcdev->dev, "No change in strobe state [0x%x]\n", prev);
goto unlock;
}

/*
* Only one set of flash control logic, use the flag to avoid torch is
* currently used
Expand Down
6 changes: 4 additions & 2 deletions drivers/leds/led-triggers.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
spin_unlock(&trig->leddev_list_lock);
led_cdev->trigger = trig;

ret = 0;
if (trig->activate)
ret = trig->activate(led_cdev);
else
ret = 0;

led_set_brightness(led_cdev, trig->brightness);
if (ret)
goto err_activate;

Expand Down Expand Up @@ -387,6 +387,8 @@ void led_trigger_event(struct led_trigger *trig,
if (!trig)
return;

trig->brightness = brightness;

rcu_read_lock();
list_for_each_entry_rcu(led_cdev, &trig->led_cdevs, trig_list)
led_set_brightness(led_cdev, brightness);
Expand Down
14 changes: 4 additions & 10 deletions drivers/leds/leds-an30259a.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,10 @@ static int an30259a_probe(struct i2c_client *client)
if (err < 0)
return err;

mutex_init(&chip->mutex);
err = devm_mutex_init(&client->dev, &chip->mutex);
if (err)
return err;

chip->client = client;
i2c_set_clientdata(client, chip);

Expand Down Expand Up @@ -317,17 +320,9 @@ static int an30259a_probe(struct i2c_client *client)
return 0;

exit:
mutex_destroy(&chip->mutex);
return err;
}

static void an30259a_remove(struct i2c_client *client)
{
struct an30259a *chip = i2c_get_clientdata(client);

mutex_destroy(&chip->mutex);
}

static const struct of_device_id an30259a_match_table[] = {
{ .compatible = "panasonic,an30259a", },
{ /* sentinel */ },
Expand All @@ -347,7 +342,6 @@ static struct i2c_driver an30259a_driver = {
.of_match_table = an30259a_match_table,
},
.probe = an30259a_probe,
.remove = an30259a_remove,
.id_table = an30259a_id,
};

Expand Down
3 changes: 1 addition & 2 deletions drivers/leds/leds-apu.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ static int __init apu_led_init(void)
struct platform_device *pdev;
int err;

if (!(dmi_match(DMI_SYS_VENDOR, "PC Engines") &&
(dmi_match(DMI_PRODUCT_NAME, "APU") || dmi_match(DMI_PRODUCT_NAME, "apu1")))) {
if (!dmi_check_system(apu_led_dmi_table)) {
pr_err("No PC Engines APUv1 board detected. For APUv2,3 support, enable CONFIG_PCENGINES_APU2\n");
return -ENODEV;
}
Expand Down
Loading

0 comments on commit f3033eb

Please sign in to comment.