Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull LED updates from Pavel Machek:
"Lee Jones offered his help with maintaining LEDs, thanks a lot.

Plus, there are some bugfixes as a bonus"

* tag 'leds-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds:
leds: MAINTAINERS: include dt-bindings headers
leds: qcom,pm8058-led: Convert to DT schema
leds: use sysfs_emit() to instead of scnprintf()
leds: is31fl319x: Fix setting current limit for is31fl319{0,1,3}
MAINTAINERS: Add additional co-maintainer to LEDs
leds: lp5523: fix out-of-bounds bug in lp5523_selftest()
dt-bindings: leds: Add 'cpuX' to 'linux,default-trigger'
led: qcom-lpg: Fix sleeping in atomic
leds: max8997: Don't error if there is no pdata
leds: lp55xx: remove variable j
leds-pca955x: Remove the unused function pca95xx_num_led_regs()

+108 -115
+1
Documentation/devicetree/bindings/leds/common.yaml
··· 100 100 - pattern 101 101 # LED is triggered by SD/MMC activity 102 102 - pattern: "^mmc[0-9]+$" 103 + - pattern: "^cpu[0-9]*$" 103 104 104 105 led-pattern: 105 106 description: |
-67
Documentation/devicetree/bindings/leds/leds-pm8058.txt
··· 1 - Qualcomm PM8058 LED driver 2 - 3 - The Qualcomm PM8058 is a multi-functional device which contains 4 - an LED driver block for up to six LEDs: three normal LEDs, two 5 - "flash" LEDs and one "keypad backlight" LED. The names are 6 - quoted because sometimes these LED drivers are used for wildly 7 - different things than flash or keypad backlight: their names 8 - are more of a suggestion than a hard-wired usecase. 9 - 10 - Hardware-wise the different LEDs support slightly different 11 - output currents. The "flash" LEDs do not need to charge nor 12 - do they support external triggers. They are just powerful LED 13 - drivers. 14 - 15 - The LEDs appear as children to the PM8058 device, with the 16 - proper compatible string. For the PM8058 bindings see: 17 - mfd/qcom-pm8xxx.txt. 18 - 19 - Each LED is represented as a sub-node of the syscon device. Each 20 - node's name represents the name of the corresponding LED. 21 - 22 - LED sub-node properties: 23 - 24 - Required properties: 25 - - compatible: one of 26 - "qcom,pm8058-led" (for the normal LEDs at 0x131, 0x132 and 0x133) 27 - "qcom,pm8058-keypad-led" (for the "keypad" LED at 0x48) 28 - "qcom,pm8058-flash-led" (for the "flash" LEDs at 0x49 and 0xFB) 29 - 30 - Optional properties: 31 - - label: see Documentation/devicetree/bindings/leds/common.txt 32 - - default-state: see Documentation/devicetree/bindings/leds/common.txt 33 - - linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt 34 - 35 - Example: 36 - 37 - qcom,ssbi@500000 { 38 - pmicintc: pmic@0 { 39 - compatible = "qcom,pm8058"; 40 - led@48 { 41 - compatible = "qcom,pm8058-keypad-led"; 42 - reg = <0x48>; 43 - label = "pm8050:white:keypad"; 44 - default-state = "off"; 45 - }; 46 - led@131 { 47 - compatible = "qcom,pm8058-led"; 48 - reg = <0x131>; 49 - label = "pm8058:red"; 50 - default-state = "off"; 51 - }; 52 - led@132 { 53 - compatible = "qcom,pm8058-led"; 54 - reg = <0x132>; 55 - label = "pm8058:yellow"; 56 - default-state = "off"; 57 - linux,default-trigger = "mmc0"; 58 - }; 59 - led@133 { 60 - compatible = "qcom,pm8058-led"; 61 - reg = <0x133>; 62 - label = "pm8058:green"; 63 - default-state = "on"; 64 - linux,default-trigger = "heartbeat"; 65 - }; 66 - }; 67 - };
+57
Documentation/devicetree/bindings/leds/qcom,pm8058-led.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/leds/qcom,pm8058-led.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Qualcomm PM8058 PMIC LED 8 + 9 + maintainers: 10 + - Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> 11 + 12 + description: | 13 + The Qualcomm PM8058 contains an LED block for up to six LEDs:: three normal 14 + LEDs, two "flash" LEDs and one "keypad backlight" LED. The names are quoted 15 + because sometimes these LED drivers are used for wildly different things than 16 + flash or keypad backlight:: their names are more of a suggestion than a 17 + hard-wired usecase. 18 + 19 + Hardware-wise the different LEDs support slightly different output currents. 20 + The "flash" LEDs do not need to charge nor do they support external triggers. 21 + They are just powerful LED drivers. 22 + 23 + allOf: 24 + - $ref: common.yaml# 25 + 26 + properties: 27 + compatible: 28 + enum: 29 + - qcom,pm8058-led 30 + - qcom,pm8058-keypad-led 31 + - qcom,pm8058-flash-led 32 + 33 + reg: 34 + maxItems: 1 35 + 36 + required: 37 + - compatible 38 + - reg 39 + 40 + unevaluatedProperties: false 41 + 42 + examples: 43 + - | 44 + #include <dt-bindings/leds/common.h> 45 + 46 + pmic { 47 + #address-cells = <1>; 48 + #size-cells = <0>; 49 + 50 + led@131 { 51 + compatible = "qcom,pm8058-led"; 52 + reg = <0x131>; 53 + label = "pm8058:red"; 54 + color = <LED_COLOR_ID_RED>; 55 + default-state = "off"; 56 + }; 57 + };
+4
Documentation/devicetree/bindings/mfd/qcom-pm8xxx.yaml
··· 39 39 interrupt-controller: true 40 40 41 41 patternProperties: 42 + "led@[0-9a-f]+$": 43 + type: object 44 + $ref: /schemas/leds/qcom,pm8058-led.yaml# 45 + 42 46 "rtc@[0-9a-f]+$": 43 47 type: object 44 48 $ref: "../rtc/qcom-pm8xxx-rtc.yaml"
+2
MAINTAINERS
··· 11732 11732 11733 11733 LED SUBSYSTEM 11734 11734 M: Pavel Machek <pavel@ucw.cz> 11735 + M: Lee Jones <lee@kernel.org> 11735 11736 L: linux-leds@vger.kernel.org 11736 11737 S: Maintained 11737 11738 T: git git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git 11738 11739 F: Documentation/devicetree/bindings/leds/ 11739 11740 F: drivers/leds/ 11741 + F: include/dt-bindings/leds/ 11740 11742 F: include/linux/leds.h 11741 11743 11742 11744 LEGACY EEPROM DRIVER
+4 -4
drivers/leds/leds-blinkm.c
··· 139 139 return ret; 140 140 switch (color) { 141 141 case RED: 142 - return scnprintf(buf, PAGE_SIZE, "%02X\n", data->red); 142 + return sysfs_emit(buf, "%02X\n", data->red); 143 143 case GREEN: 144 - return scnprintf(buf, PAGE_SIZE, "%02X\n", data->green); 144 + return sysfs_emit(buf, "%02X\n", data->green); 145 145 case BLUE: 146 - return scnprintf(buf, PAGE_SIZE, "%02X\n", data->blue); 146 + return sysfs_emit(buf, "%02X\n", data->blue); 147 147 default: 148 148 return -EINVAL; 149 149 } ··· 253 253 static ssize_t test_show(struct device *dev, struct device_attribute *attr, 254 254 char *buf) 255 255 { 256 - return scnprintf(buf, PAGE_SIZE, 256 + return sysfs_emit(buf, 257 257 "#Write into test to start test sequence!#\n"); 258 258 } 259 259
+2 -1
drivers/leds/leds-is31fl319x.c
··· 38 38 #define IS31FL3190_CURRENT_uA_MIN 5000 39 39 #define IS31FL3190_CURRENT_uA_DEFAULT 42000 40 40 #define IS31FL3190_CURRENT_uA_MAX 42000 41 + #define IS31FL3190_CURRENT_SHIFT 2 41 42 #define IS31FL3190_CURRENT_MASK GENMASK(4, 2) 42 43 #define IS31FL3190_CURRENT_5_mA 0x02 43 44 #define IS31FL3190_CURRENT_10_mA 0x01 ··· 554 553 is31fl3196_db_to_gain(is31->audio_gain_db)); 555 554 else 556 555 regmap_update_bits(is31->regmap, IS31FL3190_CURRENT, IS31FL3190_CURRENT_MASK, 557 - is31fl3190_microamp_to_cs(dev, aggregated_led_microamp)); 556 + is31fl3190_microamp_to_cs(dev, aggregated_led_microamp) << IS31FL3190_CURRENT_SHIFT); 558 557 559 558 for (i = 0; i < is31->cdef->num_leds; i++) { 560 559 struct is31fl319x_led *led = &is31->leds[i];
+6 -6
drivers/leds/leds-lm3533.c
··· 314 314 struct led_classdev *led_cdev = dev_get_drvdata(dev); 315 315 struct lm3533_led *led = to_lm3533_led(led_cdev); 316 316 317 - return scnprintf(buf, PAGE_SIZE, "%d\n", led->id); 317 + return sysfs_emit(buf, "%d\n", led->id); 318 318 } 319 319 320 320 /* ··· 344 344 if (ret) 345 345 return ret; 346 346 347 - return scnprintf(buf, PAGE_SIZE, "%x\n", val); 347 + return sysfs_emit(buf, "%x\n", val); 348 348 } 349 349 350 350 static ssize_t show_risetime(struct device *dev, ··· 415 415 416 416 channel = (val & LM3533_REG_CTRLBANK_BCONF_ALS_CHANNEL_MASK) + 1; 417 417 418 - return scnprintf(buf, PAGE_SIZE, "%u\n", channel); 418 + return sysfs_emit(buf, "%u\n", channel); 419 419 } 420 420 421 421 static ssize_t store_als_channel(struct device *dev, ··· 465 465 466 466 enable = val & LM3533_REG_CTRLBANK_BCONF_ALS_EN_MASK; 467 467 468 - return scnprintf(buf, PAGE_SIZE, "%d\n", enable); 468 + return sysfs_emit(buf, "%d\n", enable); 469 469 } 470 470 471 471 static ssize_t store_als_en(struct device *dev, ··· 518 518 else 519 519 linear = 0; 520 520 521 - return scnprintf(buf, PAGE_SIZE, "%x\n", linear); 521 + return sysfs_emit(buf, "%x\n", linear); 522 522 } 523 523 524 524 static ssize_t store_linear(struct device *dev, ··· 564 564 if (ret) 565 565 return ret; 566 566 567 - return scnprintf(buf, PAGE_SIZE, "%u\n", val); 567 + return sysfs_emit(buf, "%u\n", val); 568 568 } 569 569 570 570 static ssize_t store_pwm(struct device *dev,
+1 -1
drivers/leds/leds-lp5521.c
··· 469 469 ret = lp5521_run_selftest(chip, buf); 470 470 mutex_unlock(&chip->lock); 471 471 472 - return scnprintf(buf, PAGE_SIZE, "%s\n", ret ? "FAIL" : "OK"); 472 + return sysfs_emit(buf, "%s\n", ret ? "FAIL" : "OK"); 473 473 } 474 474 475 475 /* device attributes */
+15 -12
drivers/leds/leds-lp5523.c
··· 581 581 struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev)); 582 582 struct lp55xx_chip *chip = led->chip; 583 583 struct lp55xx_platform_data *pdata = chip->pdata; 584 - int i, ret, pos = 0; 585 - u8 status, adc, vdd; 584 + int ret, pos = 0; 585 + u8 status, adc, vdd, i; 586 586 587 587 mutex_lock(&chip->lock); 588 588 ··· 612 612 613 613 vdd--; /* There may be some fluctuation in measurement */ 614 614 615 - for (i = 0; i < LP5523_MAX_LEDS; i++) { 616 - /* Skip non-existing channels */ 615 + for (i = 0; i < pdata->num_channels; i++) { 616 + /* Skip disabled channels */ 617 617 if (pdata->led_config[i].led_current == 0) 618 618 continue; 619 619 620 620 /* Set default current */ 621 - lp55xx_write(chip, LP5523_REG_LED_CURRENT_BASE + i, 621 + lp55xx_write(chip, LP5523_REG_LED_CURRENT_BASE + led->chan_nr, 622 622 pdata->led_config[i].led_current); 623 623 624 - lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + i, 0xff); 624 + lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + led->chan_nr, 625 + 0xff); 625 626 /* let current stabilize 2 - 4ms before measurements start */ 626 627 usleep_range(2000, 4000); 627 628 lp55xx_write(chip, LP5523_REG_LED_TEST_CTRL, 628 - LP5523_EN_LEDTEST | i); 629 + LP5523_EN_LEDTEST | led->chan_nr); 629 630 /* ADC conversion time is 2.7 ms typically */ 630 631 usleep_range(3000, 6000); 631 632 ret = lp55xx_read(chip, LP5523_REG_STATUS, &status); ··· 634 633 goto fail; 635 634 636 635 if (!(status & LP5523_LEDTEST_DONE)) 637 - usleep_range(3000, 6000);/* Was not ready. Wait. */ 636 + usleep_range(3000, 6000); /* Was not ready. Wait. */ 638 637 639 638 ret = lp55xx_read(chip, LP5523_REG_LED_TEST_ADC, &adc); 640 639 if (ret < 0) 641 640 goto fail; 642 641 643 642 if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) 644 - pos += sprintf(buf + pos, "LED %d FAIL\n", i); 643 + pos += sprintf(buf + pos, "LED %d FAIL\n", 644 + led->chan_nr); 645 645 646 - lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + i, 0x00); 646 + lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + led->chan_nr, 647 + 0x00); 647 648 648 649 /* Restore current */ 649 - lp55xx_write(chip, LP5523_REG_LED_CURRENT_BASE + i, 650 - led->led_current); 650 + lp55xx_write(chip, LP5523_REG_LED_CURRENT_BASE + led->chan_nr, 651 + led->led_current); 651 652 led++; 652 653 } 653 654 if (pos == 0)
+3 -4
drivers/leds/leds-lp55xx-common.c
··· 88 88 { 89 89 struct lp55xx_led *led = dev_to_lp55xx_led(dev); 90 90 91 - return scnprintf(buf, PAGE_SIZE, "%d\n", led->led_current); 91 + return sysfs_emit(buf, "%d\n", led->led_current); 92 92 } 93 93 94 94 static ssize_t led_current_store(struct device *dev, ··· 121 121 { 122 122 struct lp55xx_led *led = dev_to_lp55xx_led(dev); 123 123 124 - return scnprintf(buf, PAGE_SIZE, "%d\n", led->max_current); 124 + return sysfs_emit(buf, "%d\n", led->max_current); 125 125 } 126 126 127 127 static DEVICE_ATTR_RW(led_current); ··· 166 166 struct mc_subled *mc_led_info; 167 167 struct led_classdev *led_cdev; 168 168 char name[32]; 169 - int i, j = 0; 169 + int i; 170 170 int ret; 171 171 172 172 if (chan >= max_channel) { ··· 201 201 pdata->led_config[chan].color_id[i]; 202 202 mc_led_info[i].channel = 203 203 pdata->led_config[chan].output_num[i]; 204 - j++; 205 204 } 206 205 207 206 led->mc_cdev.subled_info = mc_led_info;
+1 -6
drivers/leds/leds-max8997.c
··· 238 238 char name[20]; 239 239 int ret = 0; 240 240 241 - if (pdata == NULL) { 242 - dev_err(&pdev->dev, "no platform data\n"); 243 - return -ENODEV; 244 - } 245 - 246 241 led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); 247 242 if (led == NULL) 248 243 return -ENOMEM; ··· 253 258 led->iodev = iodev; 254 259 255 260 /* initialize mode and brightness according to platform_data */ 256 - if (pdata->led_pdata) { 261 + if (pdata && pdata->led_pdata) { 257 262 u8 mode = 0, brightness = 0; 258 263 259 264 mode = pdata->led_pdata->mode[led->id];
-6
drivers/leds/leds-pca955x.c
··· 145 145 return (bits + 7) / 8; 146 146 } 147 147 148 - /* 4 bits per LED selector register */ 149 - static inline int pca95xx_num_led_regs(int bits) 150 - { 151 - return (bits + 3) / 4; 152 - } 153 - 154 148 /* 155 149 * Return an LED selector register value based on an existing one, with 156 150 * the appropriate 2-bit state value set for the given LED number (0-3).
+11 -7
drivers/leds/rgb/leds-qcom-lpg.c
··· 602 602 lpg_lut_sync(lpg, lut_mask); 603 603 } 604 604 605 - static void lpg_brightness_single_set(struct led_classdev *cdev, 606 - enum led_brightness value) 605 + static int lpg_brightness_single_set(struct led_classdev *cdev, 606 + enum led_brightness value) 607 607 { 608 608 struct lpg_led *led = container_of(cdev, struct lpg_led, cdev); 609 609 struct mc_subled info; ··· 614 614 lpg_brightness_set(led, cdev, &info); 615 615 616 616 mutex_unlock(&led->lpg->lock); 617 + 618 + return 0; 617 619 } 618 620 619 - static void lpg_brightness_mc_set(struct led_classdev *cdev, 620 - enum led_brightness value) 621 + static int lpg_brightness_mc_set(struct led_classdev *cdev, 622 + enum led_brightness value) 621 623 { 622 624 struct led_classdev_mc *mc = lcdev_to_mccdev(cdev); 623 625 struct lpg_led *led = container_of(mc, struct lpg_led, mcdev); ··· 630 628 lpg_brightness_set(led, cdev, mc->subled_info); 631 629 632 630 mutex_unlock(&led->lpg->lock); 631 + 632 + return 0; 633 633 } 634 634 635 635 static int lpg_blink_set(struct lpg_led *led, ··· 1122 1118 led->mcdev.num_colors = num_channels; 1123 1119 1124 1120 cdev = &led->mcdev.led_cdev; 1125 - cdev->brightness_set = lpg_brightness_mc_set; 1121 + cdev->brightness_set_blocking = lpg_brightness_mc_set; 1126 1122 cdev->blink_set = lpg_blink_mc_set; 1127 1123 1128 1124 /* Register pattern accessors only if we have a LUT block */ ··· 1136 1132 return ret; 1137 1133 1138 1134 cdev = &led->cdev; 1139 - cdev->brightness_set = lpg_brightness_single_set; 1135 + cdev->brightness_set_blocking = lpg_brightness_single_set; 1140 1136 cdev->blink_set = lpg_blink_single_set; 1141 1137 1142 1138 /* Register pattern accessors only if we have a LUT block */ ··· 1155 1151 else 1156 1152 cdev->brightness = LED_OFF; 1157 1153 1158 - cdev->brightness_set(cdev, cdev->brightness); 1154 + cdev->brightness_set_blocking(cdev, cdev->brightness); 1159 1155 1160 1156 init_data.fwnode = of_fwnode_handle(np); 1161 1157
+1 -1
drivers/leds/trigger/ledtrig-pattern.c
··· 155 155 156 156 mutex_unlock(&data->lock); 157 157 158 - return scnprintf(buf, PAGE_SIZE, "%d\n", repeat); 158 + return sysfs_emit(buf, "%d\n", repeat); 159 159 } 160 160 161 161 static ssize_t repeat_store(struct device *dev, struct device_attribute *attr,