This is very quiet release for LEDs, pca963 got blinking support and

that's pretty much it.
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCY0leQwAKCRAw5/Bqldv6
 8qGYAJwJ3HPp5PldDKtGr9+90yEJK4SFKgCfTOZenbAe/pESkCGnKJszvHdOupk=
 =aZ15
 -----END PGP SIGNATURE-----

Merge tag 'leds-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds

Pull LED updates from Pavel Machek:
 "This is very quiet release for LEDs, pca963 got blinking support and
  that's pretty much it"

* tag 'leds-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds:
  leds: pca963: fix misleading indentation
  dt-bindings: leds: Document mmc trigger
  leds: pca963x: fix blink with hw acceleration
This commit is contained in:
Linus Torvalds 2022-10-14 13:14:03 -07:00
commit 5964c927b4
2 changed files with 41 additions and 20 deletions

View File

@ -79,24 +79,27 @@ properties:
the LED. the LED.
$ref: /schemas/types.yaml#/definitions/string $ref: /schemas/types.yaml#/definitions/string
enum: oneOf:
# LED will act as a back-light, controlled by the framebuffer system - enum:
- backlight # LED will act as a back-light, controlled by the framebuffer system
# LED will turn on (but for leds-gpio see "default-state" property in - backlight
# Documentation/devicetree/bindings/leds/leds-gpio.yaml) # LED will turn on (but for leds-gpio see "default-state" property in
- default-on # Documentation/devicetree/bindings/leds/leds-gpio.yaml)
# LED "double" flashes at a load average based rate - default-on
- heartbeat # LED "double" flashes at a load average based rate
# LED indicates disk activity - heartbeat
- disk-activity # LED indicates disk activity
# LED indicates IDE disk activity (deprecated), in new implementations - disk-activity
# use "disk-activity" # LED indicates IDE disk activity (deprecated), in new implementations
- ide-disk # use "disk-activity"
# LED flashes at a fixed, configurable rate - ide-disk
- timer # LED flashes at a fixed, configurable rate
# LED alters the brightness for the specified duration with one software - timer
# timer (requires "led-pattern" property) # LED alters the brightness for the specified duration with one software
- pattern # timer (requires "led-pattern" property)
- pattern
# LED is triggered by SD/MMC activity
- pattern: "^mmc[0-9]+$"
led-pattern: led-pattern:
description: | description: |

View File

@ -101,6 +101,7 @@ struct pca963x_led {
struct pca963x *chip; struct pca963x *chip;
struct led_classdev led_cdev; struct led_classdev led_cdev;
int led_num; /* 0 .. 15 potentially */ int led_num; /* 0 .. 15 potentially */
bool blinking;
u8 gdc; u8 gdc;
u8 gfrq; u8 gfrq;
}; };
@ -129,12 +130,21 @@ static int pca963x_brightness(struct pca963x_led *led,
switch (brightness) { switch (brightness) {
case LED_FULL: case LED_FULL:
val = (ledout & ~mask) | (PCA963X_LED_ON << shift); if (led->blinking) {
val = (ledout & ~mask) | (PCA963X_LED_GRP_PWM << shift);
ret = i2c_smbus_write_byte_data(client,
PCA963X_PWM_BASE +
led->led_num,
LED_FULL);
} else {
val = (ledout & ~mask) | (PCA963X_LED_ON << shift);
}
ret = i2c_smbus_write_byte_data(client, ledout_addr, val); ret = i2c_smbus_write_byte_data(client, ledout_addr, val);
break; break;
case LED_OFF: case LED_OFF:
val = ledout & ~mask; val = ledout & ~mask;
ret = i2c_smbus_write_byte_data(client, ledout_addr, val); ret = i2c_smbus_write_byte_data(client, ledout_addr, val);
led->blinking = false;
break; break;
default: default:
ret = i2c_smbus_write_byte_data(client, ret = i2c_smbus_write_byte_data(client,
@ -144,7 +154,11 @@ static int pca963x_brightness(struct pca963x_led *led,
if (ret < 0) if (ret < 0)
return ret; return ret;
val = (ledout & ~mask) | (PCA963X_LED_PWM << shift); if (led->blinking)
val = (ledout & ~mask) | (PCA963X_LED_GRP_PWM << shift);
else
val = (ledout & ~mask) | (PCA963X_LED_PWM << shift);
ret = i2c_smbus_write_byte_data(client, ledout_addr, val); ret = i2c_smbus_write_byte_data(client, ledout_addr, val);
break; break;
} }
@ -181,6 +195,7 @@ static void pca963x_blink(struct pca963x_led *led)
} }
mutex_unlock(&led->chip->mutex); mutex_unlock(&led->chip->mutex);
led->blinking = true;
} }
static int pca963x_power_state(struct pca963x_led *led) static int pca963x_power_state(struct pca963x_led *led)
@ -275,6 +290,8 @@ static int pca963x_blink_set(struct led_classdev *led_cdev,
led->gfrq = gfrq; led->gfrq = gfrq;
pca963x_blink(led); pca963x_blink(led);
led->led_cdev.brightness = LED_FULL;
pca963x_led_set(led_cdev, LED_FULL);
*delay_on = time_on; *delay_on = time_on;
*delay_off = time_off; *delay_off = time_off;
@ -337,6 +354,7 @@ static int pca963x_register_leds(struct i2c_client *client,
led->led_cdev.brightness_set_blocking = pca963x_led_set; led->led_cdev.brightness_set_blocking = pca963x_led_set;
if (hw_blink) if (hw_blink)
led->led_cdev.blink_set = pca963x_blink_set; led->led_cdev.blink_set = pca963x_blink_set;
led->blinking = false;
init_data.fwnode = child; init_data.fwnode = child;
/* for backwards compatibility */ /* for backwards compatibility */