Commit 8b35ad62 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'leds-for-5.2-rc1' of...

Merge tag 'leds-for-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds

Pull LED updates from Jacek Anaszewski:
 "LED core fixes and improvements:

      - avoid races with workqueue
      - Kconfig: pedantic cleanup
      - small fixes for Flash class description

  leds-lt3593:

      - remove unneeded assignment in lt3593_led_probe
      - drop pdata handling code

  leds-blinkm:

      - clean up double assignment to data->i2c_addr

  leds-pca955x, leds-pca963x:

      - revert ACPI support, as it turned out that there is no evidence
          of officially registered ACPI IDs for these devices.
      - make use of device property API

  leds-as3645a:

      - switch to fwnode property API

  LED related addition to ACPI documentation:

      - document how to refer to LEDs from remote nodes

  LED related fix to ALSA line6/toneport driver:

      - avoid polluting led_* namespace

  And lm3532 driver relocation from MFD to LED subsystem, accompanied by
  various improvements and optimizations; it entails also a change in
  omap4-droid4-xt894.dts:

      - leds: lm3532: Introduce the lm3532 LED driver
      - mfd: ti-lmu: Remove LM3532 backlight driver references
      - ARM: dts: omap4-droid4: Update backlight dt properties
      - dt: lm3532: Add lm3532 dt doc and update ti_lmu doc"

* tag 'leds-for-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
  leds: avoid races with workqueue
  ALSA: line6: Avoid polluting led_* namespace
  leds: lm3532: Introduce the lm3532 LED driver
  mfd: ti-lmu: Remove LM3532 backlight driver references
  ARM: dts: omap4-droid4: Update backlight dt properties
  dt: lm3532: Add lm3532 dt doc and update ti_lmu doc
  leds: Small fixes for Flash class description
  leds: blinkm: clean up double assignment to data->i2c_addr
  leds: pca963x: Make use of device property API
  leds: pca955x: Make use of device property API
  leds: lt3593: Remove unneeded assignment in lt3593_led_probe
  leds: lt3593: drop pdata handling code
  leds: pca955x: Revert "Add ACPI support"
  leds: pca963x: Revert "Add ACPI support"
  drivers: leds: Kconfig: pedantic cleanups
  ACPI: Document how to refer to LEDs from remote nodes
  leds: as3645a: Switch to fwnode property API
parents f678d6da 0db37915
Describing and referring to LEDs in ACPI
Individual LEDs are described by hierarchical data extension [6] nodes under the
device node, the LED driver chip. The "reg" property in the LED specific nodes
tells the numerical ID of each individual LED output to which the LEDs are
connected. [3] The hierarchical data nodes are named "led@X", where X is the
number of the LED output.
Referring to LEDs in Device tree is documented in [4], in "flash-leds" property
documentation. In short, LEDs are directly referred to by using phandles.
While Device tree allows referring to any node in the tree[1], in ACPI
references are limited to device nodes only [2]. For this reason using the same
mechanism on ACPI is not possible. A mechanism to refer to non-device ACPI nodes
is documented in [7].
ACPI allows (as does DT) using integer arguments after the reference. A
combination of the LED driver device reference and an integer argument,
referring to the "reg" property of the relevant LED, is used to identify
individual LEDs. The value of the "reg" property is a contract between the
firmware and software, it uniquely identifies the LED driver outputs.
Under the LED driver device, The first hierarchical data extension package list
entry shall contain the string "led@" followed by the number of the LED,
followed by the referred object name. That object shall be named "LED" followed
by the number of the LED.
An ASL example of a camera sensor device and a LED driver device for two LEDs.
Objects not relevant for LEDs or the references to them have been omitted.
Device (LED)
{
Name (_DSD, Package () {
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package () {
Package () { "led@0", LED0 },
Package () { "led@1", LED1 },
}
})
Name (LED0, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "reg", 0 },
Package () { "flash-max-microamp", 1000000 },
Package () { "flash-timeout-us", 200000 },
Package () { "led-max-microamp", 100000 },
Package () { "label", "white:flash" },
}
})
Name (LED1, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "reg", 1 },
Package () { "led-max-microamp", 10000 },
Package () { "label", "red:indicator" },
}
})
}
Device (SEN)
{
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {
"flash-leds",
Package () { ^LED, "led@0", ^LED, "led@1" },
}
}
})
}
where
LED LED driver device
LED0 First LED
LED1 Second LED
SEN Camera sensor device (or another device the LED is
related to)
[1] Device tree. <URL:http://www.devicetree.org>, referenced 2019-02-21.
[2] Advanced Configuration and Power Interface Specification.
<URL:https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf>,
referenced 2019-02-21.
[3] Documentation/devicetree/bindings/leds/common.txt
[4] Documentation/devicetree/bindings/media/video-interfaces.txt
[5] Device Properties UUID For _DSD.
<URL:http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>,
referenced 2019-02-21.
[6] Hierarchical Data Extension UUID For _DSD.
<URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
referenced 2019-02-21.
[7] Documentation/acpi/dsd/data-node-reference.txt
* Texas Instruments - lm3532 White LED driver with ambient light sensing
capability.
The LM3532 provides the 3 high-voltage, low-side current sinks. The device is
programmable over an I2C-compatible interface and has independent
current control for all three channels. The adaptive current regulation
method allows for different LED currents in each current sink thus allowing
for a wide variety of backlight and keypad applications.
The main features of the LM3532 include dual ambient light sensor inputs
each with 32 internal voltage setting resistors, 8-bit logarithmic and linear
brightness control, dual external PWM brightness control inputs, and up to
1000:1 dimming ratio with programmable fade in and fade out settings.
Required properties:
- compatible : "ti,lm3532"
- reg : I2C slave address
- #address-cells : 1
- #size-cells : 0
Optional properties:
- enable-gpios : gpio pin to enable (active high)/disable the device.
- ramp-up-us - The Run time ramp rates/step are from one current
set-point to another after the device has reached its
initial target set point from turn-on
- ramp-down-us - The Run time ramp rates/step are from one current
set-point to another after the device has reached its
initial target set point from turn-on
Range for ramp settings: 8us - 65536us
Optional properties if ALS mode is used:
- ti,als-vmin - Minimum ALS voltage defined in Volts
- ti,als-vmax - Maximum ALS voltage defined in Volts
Per the data sheet the max ALS voltage is 2V and the min is 0V
- ti,als1-imp-sel - ALS1 impedance resistor selection in Ohms
- ti,als2-imp-sel - ALS2 impedance resistor selection in Ohms
Range for impedance select: 37000 Ohms - 1190 Ohms
Values above 37kohms will be set to the "High Impedance" setting
- ti,als-avrg-time-us - Determines the length of time the device needs to
average the two ALS inputs. This is only used if
the input mode is LM3532_ALS_INPUT_AVRG.
Range: 17920us - 2293760us
- ti,als-input-mode - Determines how the device uses the attached ALS
devices.
0x00 - ALS1 and ALS2 input average
0x01 - ALS1 Input
0x02 - ALS2 Input
0x03 - Max of ALS1 and ALS2
Required child properties:
- reg : Indicates control bank the LED string is controlled by
- led-sources : see Documentation/devicetree/bindings/leds/common.txt
- ti,led-mode : Defines if the LED strings are manually controlled or
if the LED strings are controlled by the ALS.
0x00 - LED strings are I2C controlled via full scale
brightness control register
0x01 - LED strings are ALS controlled
Optional LED child properties:
- label : see Documentation/devicetree/bindings/leds/common.txt
- linux,default-trigger :
see Documentation/devicetree/bindings/leds/common.txt
Example:
led-controller@38 {
compatible = "ti,lm3532";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x38>;
enable-gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>;
ramp-up-us = <1024>;
ramp-down-us = <65536>;
ti,als-vmin = <0>;
ti,als-vmax = <2000>;
ti,als1-imp-sel = <4110>;
ti,als2-imp-sel = <2180>;
ti,als-avrg-time-us = <17920>;
ti,als-input-mode = <0x00>;
led@0 {
reg = <0>;
led-sources = <2>;
ti,led-mode = <1>;
label = ":backlight";
linux,default-trigger = "backlight";
};
led@1 {
reg = <1>;
led-sources = <1>;
ti,led-mode = <0>;
label = ":kbd_backlight";
};
};
For more product information please see the links below:
http://www.ti.com/product/LM3532
...@@ -4,7 +4,6 @@ TI LMU driver supports lighting devices below. ...@@ -4,7 +4,6 @@ TI LMU driver supports lighting devices below.
Name Child nodes Name Child nodes
------ --------------------------------- ------ ---------------------------------
LM3532 Backlight
LM3631 Backlight and regulator LM3631 Backlight and regulator
LM3632 Backlight and regulator LM3632 Backlight and regulator
LM3633 Backlight, LED and fault monitor LM3633 Backlight, LED and fault monitor
...@@ -13,7 +12,6 @@ TI LMU driver supports lighting devices below. ...@@ -13,7 +12,6 @@ TI LMU driver supports lighting devices below.
Required properties: Required properties:
- compatible: Should be one of: - compatible: Should be one of:
"ti,lm3532"
"ti,lm3631" "ti,lm3631"
"ti,lm3632" "ti,lm3632"
"ti,lm3633" "ti,lm3633"
...@@ -23,7 +21,6 @@ Required properties: ...@@ -23,7 +21,6 @@ Required properties:
0x11 for LM3632 0x11 for LM3632
0x29 for LM3631 0x29 for LM3631
0x36 for LM3633, LM3697 0x36 for LM3633, LM3697
0x38 for LM3532
0x63 for LM3695 0x63 for LM3695
Optional property: Optional property:
...@@ -47,23 +44,6 @@ Optional nodes: ...@@ -47,23 +44,6 @@ Optional nodes:
[2] ../leds/leds-lm3633.txt [2] ../leds/leds-lm3633.txt
[3] ../regulator/lm363x-regulator.txt [3] ../regulator/lm363x-regulator.txt
lm3532@38 {
compatible = "ti,lm3532";
reg = <0x38>;
enable-gpios = <&pioC 2 GPIO_ACTIVE_HIGH>;
backlight {
compatible = "ti,lm3532-backlight";
lcd {
led-sources = <0 1 2>;
ramp-up-msec = <30>;
ramp-down-msec = <0>;
};
};
};
lm3631@29 { lm3631@29 {
compatible = "ti,lm3631"; compatible = "ti,lm3631";
reg = <0x29>; reg = <0x29>;
......
...@@ -214,7 +214,6 @@ lcd0: display { ...@@ -214,7 +214,6 @@ lcd0: display {
width-mm = <50>; width-mm = <50>;
height-mm = <89>; height-mm = <89>;
backlight = <&lcd_backlight>;
panel-timing { panel-timing {
clock-frequency = <0>; /* Calculated by dsi */ clock-frequency = <0>; /* Calculated by dsi */
...@@ -383,20 +382,30 @@ wlcore: wlcore@2 { ...@@ -383,20 +382,30 @@ wlcore: wlcore@2 {
}; };
&i2c1 { &i2c1 {
lm3532@38 { led-controller@38 {
compatible = "ti,lm3532"; compatible = "ti,lm3532";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x38>; reg = <0x38>;
enable-gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>; enable-gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>;
lcd_backlight: backlight { ramp-up-us = <1024>;
compatible = "ti,lm3532-backlight"; ramp-down-us = <8193>;
lcd { led@0 {
led-sources = <0 1 2>; reg = <0>;
ramp-up-msec = <1>; led-sources = <2>;
ramp-down-msec = <0>; ti,led-mode = <0>;
}; label = ":backlight";
linux,default-trigger = "backlight";
};
led@1 {
reg = <1>;
led-sources = <1>;
ti,led-mode = <0>;
label = ":kbd_backlight";
}; };
}; };
}; };
......
...@@ -23,8 +23,8 @@ config LEDS_CLASS_FLASH ...@@ -23,8 +23,8 @@ config LEDS_CLASS_FLASH
tristate "LED Flash Class Support" tristate "LED Flash Class Support"
depends on LEDS_CLASS depends on LEDS_CLASS
help help
This option enables the flash led sysfs class in /sys/class/leds. This option enables the flash LED sysfs class in /sys/class/leds.
It wrapps LED Class and adds flash LEDs specific sysfs attributes It wraps LED Class and adds flash LEDs specific sysfs attributes
and kernel internal API to it. You'll need this to provide support and kernel internal API to it. You'll need this to provide support
for the flash related features of a LED device. It can be built for the flash related features of a LED device. It can be built
as a module. as a module.
...@@ -56,7 +56,7 @@ config LEDS_AAT1290 ...@@ -56,7 +56,7 @@ config LEDS_AAT1290
depends on OF depends on OF
depends on PINCTRL depends on PINCTRL
help help
This option enables support for the LEDs on the AAT1290. This option enables support for the LEDs on the AAT1290.
config LEDS_AN30259A config LEDS_AN30259A
tristate "LED support for Panasonic AN30259A" tristate "LED support for Panasonic AN30259A"
...@@ -138,6 +138,16 @@ config LEDS_LM3530 ...@@ -138,6 +138,16 @@ config LEDS_LM3530
controlled manually or using PWM input or using ambient controlled manually or using PWM input or using ambient
light automatically. light automatically.
config LEDS_LM3532
tristate "LCD Backlight driver for LM3532"
depends on LEDS_CLASS
depends on I2C
help
This option enables support for the LCD backlight using
LM3532 ambient light sensor chip. This ALS chip can be
controlled manually or using PWM input or using ambient
light automatically.
config LEDS_LM3533 config LEDS_LM3533
tristate "LED support for LM3533" tristate "LED support for LM3533"
depends on LEDS_CLASS depends on LEDS_CLASS
...@@ -413,13 +423,13 @@ config LEDS_CLEVO_MAIL ...@@ -413,13 +423,13 @@ config LEDS_CLEVO_MAIL
This module can drive the mail LED for the following notebooks: This module can drive the mail LED for the following notebooks:
Clevo D400P Clevo D400P
Clevo D410J Clevo D410J
Clevo D410V Clevo D410V
Clevo D400V/D470V (not tested, but might work) Clevo D400V/D470V (not tested, but might work)
Clevo M540N Clevo M540N
Clevo M5x0N (not tested, but might work) Clevo M5x0N (not tested, but might work)
Positivo Mobile (Clevo M5x0V) Positivo Mobile (Clevo M5x0V)
If your model is not listed here you can try the "nodetect" If your model is not listed here you can try the "nodetect"
module parameter. module parameter.
...@@ -462,7 +472,7 @@ config LEDS_WM831X_STATUS ...@@ -462,7 +472,7 @@ config LEDS_WM831X_STATUS
depends on MFD_WM831X depends on MFD_WM831X
help help
This option enables support for the status LEDs of the WM831x This option enables support for the status LEDs of the WM831x
series of PMICs. series of PMICs.
config LEDS_WM8350 config LEDS_WM8350
tristate "LED Support for WM8350 AudioPlus PMIC" tristate "LED Support for WM8350 AudioPlus PMIC"
...@@ -533,6 +543,7 @@ config LEDS_LT3593 ...@@ -533,6 +543,7 @@ config LEDS_LT3593
tristate "LED driver for LT3593 controllers" tristate "LED driver for LT3593 controllers"
depends on LEDS_CLASS depends on LEDS_CLASS
depends on GPIOLIB || COMPILE_TEST depends on GPIOLIB || COMPILE_TEST
depends on OF
help help
This option enables support for LEDs driven by a Linear Technology This option enables support for LEDs driven by a Linear Technology
LT3593 controller. This controller uses a special one-wire pulse LT3593 controller. This controller uses a special one-wire pulse
......
...@@ -18,6 +18,7 @@ obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o ...@@ -18,6 +18,7 @@ obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o
obj-$(CONFIG_LEDS_CPCAP) += leds-cpcap.o obj-$(CONFIG_LEDS_CPCAP) += leds-cpcap.o
obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o
obj-$(CONFIG_LEDS_LM3532) += leds-lm3532.o
obj-$(CONFIG_LEDS_LM3533) += leds-lm3533.o obj-$(CONFIG_LEDS_LM3533) += leds-lm3533.o
obj-$(CONFIG_LEDS_LM3642) += leds-lm3642.o obj-$(CONFIG_LEDS_LM3642) += leds-lm3642.o
obj-$(CONFIG_LEDS_MIKROTIK_RB532) += leds-rb532.o obj-$(CONFIG_LEDS_MIKROTIK_RB532) += leds-rb532.o
......
...@@ -57,6 +57,7 @@ static ssize_t brightness_store(struct device *dev, ...@@ -57,6 +57,7 @@ static ssize_t brightness_store(struct device *dev,
if (state == LED_OFF) if (state == LED_OFF)
led_trigger_remove(led_cdev); led_trigger_remove(led_cdev);
led_set_brightness(led_cdev, state); led_set_brightness(led_cdev, state);
flush_work(&led_cdev->set_brightness_work);
ret = size; ret = size;
unlock: unlock:
......
...@@ -164,6 +164,11 @@ static void led_blink_setup(struct led_classdev *led_cdev, ...@@ -164,6 +164,11 @@ static void led_blink_setup(struct led_classdev *led_cdev,
unsigned long *delay_on, unsigned long *delay_on,
unsigned long *delay_off) unsigned long *delay_off)
{ {
/*
* If "set brightness to 0" is pending in workqueue, we don't
* want that to be reordered after blink_set()
*/
flush_work(&led_cdev->set_brightness_work);
if (!test_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags) && if (!test_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags) &&
led_cdev->blink_set && led_cdev->blink_set &&
!led_cdev->blink_set(led_cdev, delay_on, delay_off)) !led_cdev->blink_set(led_cdev, delay_on, delay_off))
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/of.h> #include <linux/property.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <media/v4l2-flash-led-class.h> #include <media/v4l2-flash-led-class.h>
...@@ -148,8 +148,8 @@ struct as3645a { ...@@ -148,8 +148,8 @@ struct as3645a {
struct v4l2_flash *vf; struct v4l2_flash *vf;
struct v4l2_flash *vfind; struct v4l2_flash *vfind;
struct device_node *flash_node; struct fwnode_handle *flash_node;
struct device_node *indicator_node; struct fwnode_handle *indicator_node;
struct as3645a_config cfg; struct as3645a_config cfg;
...@@ -493,30 +493,31 @@ static int as3645a_detect(struct as3645a *flash) ...@@ -493,30 +493,31 @@ static int as3645a_detect(struct as3645a *flash)
static int as3645a_parse_node(struct as3645a *flash, static int as3645a_parse_node(struct as3645a *flash,
struct as3645a_names *names, struct as3645a_names *names,
struct device_node *node) struct fwnode_handle *fwnode)
{ {
struct as3645a_config *cfg = &flash->cfg; struct as3645a_config *cfg = &flash->cfg;
struct device_node *child; struct fwnode_handle *child;
const char *name; const char *name;
int rval; int rval;
for_each_child_of_node(node, child) { fwnode_for_each_child_node(fwnode, child) {
u32 id = 0; u32 id = 0;
of_property_read_u32(child, "reg", &id); fwnode_property_read_u32(child, "reg", &id);
switch (id) { switch (id) {
case AS_LED_FLASH: case AS_LED_FLASH:
flash->flash_node = of_node_get(child); flash->flash_node = child;
break; break;
case AS_LED_INDICATOR: case AS_LED_INDICATOR:
flash->indicator_node = of_node_get(child); flash->indicator_node = child;
break; break;
default: default:
dev_warn(&flash->client->dev, dev_warn(&flash->client->dev,
"unknown LED %u encountered, ignoring\n", id); "unknown LED %u encountered, ignoring\n", id);
break; break;
} }
fwnode_handle_get(child);
} }
if (!flash->flash_node) { if (!flash->flash_node) {
...@@ -524,42 +525,46 @@ static int as3645a_parse_node(struct as3645a *flash, ...@@ -524,42 +525,46 @@ static int as3645a_parse_node(struct as3645a *flash,
return -ENODEV; return -ENODEV;
} }
rval = of_property_read_string(flash->flash_node, "label", &name); rval = fwnode_property_read_string(flash->flash_node, "label", &name);
if (!rval) if (!rval) {
strlcpy(names->flash, name, sizeof(names->flash)); strlcpy(names->flash, name, sizeof(names->flash));
else } else if (is_of_node(fwnode)) {
snprintf(names->flash, sizeof(names->flash), snprintf(names->flash, sizeof(names->flash),
"%pOFn:flash", node); "%pOFn:flash", to_of_node(fwnode));
} else {
dev_err(&flash->client->dev, "flash node has no label!\n");
return -EINVAL;
}
rval = of_property_read_u32(flash->flash_node, "flash-timeout-us", rval = fwnode_property_read_u32(flash->flash_node, "flash-timeout-us",
&cfg->flash_timeout_us); &cfg->flash_timeout_us);
if (rval < 0) { if (rval < 0) {
dev_err(&flash->client->dev, dev_err(&flash->client->dev,
"can't read flash-timeout-us property for flash\n"); "can't read flash-timeout-us property for flash\n");
goto out_err; goto out_err;
} }
rval = of_property_read_u32(flash->flash_node, "flash-max-microamp", rval = fwnode_property_read_u32(flash->flash_node, "flash-max-microamp",
&cfg->flash_max_ua); &cfg->flash_max_ua);
if (rval < 0) { if (rval < 0) {
dev_err(&flash->client->dev, dev_err(&flash->client->dev,
"can't read flash-max-microamp property for flash\n"); "can't read flash-max-microamp property for flash\n");
goto out_err; goto out_err;
} }
rval = of_property_read_u32(flash->flash_node, "led-max-microamp", rval = fwnode_property_read_u32(flash->flash_node, "led-max-microamp",
&cfg->assist_max_ua); &cfg->assist_max_ua);
if (rval < 0) { if (rval < 0) {
dev_err(&flash->client->dev, dev_err(&flash->client->dev,
"can't read led-max-microamp property for flash\n"); "can't read led-max-microamp property for flash\n");
goto out_err; goto out_err;
} }
of_property_read_u32(flash->flash_node, "voltage-reference", fwnode_property_read_u32(flash->flash_node, "voltage-reference",
&cfg->voltage_reference); &cfg->voltage_reference);
of_property_read_u32(flash->flash_node, "ams,input-max-microamp", fwnode_property_read_u32(flash->flash_node, "ams,input-max-microamp",
&cfg->peak); &cfg->peak);
cfg->peak = AS_PEAK_mA_TO_REG(cfg->peak); cfg->peak = AS_PEAK_mA_TO_REG(cfg->peak);
if (!flash->indicator_node) { if (!flash->indicator_node) {
...@@ -568,15 +573,21 @@ static int as3645a_parse_node(struct as3645a *flash, ...@@ -568,15 +573,21 @@ static int as3645a_parse_node(struct as3645a *flash,
goto out_err; goto out_err;
} }
rval = of_property_read_string(flash->indicator_node, "label", &name); rval = fwnode_property_read_string(flash->indicator_node, "label",
if (!rval) &name);
if (!rval) {
strlcpy(names->indicator, name, sizeof(names->indicator)); strlcpy(names->indicator, name, sizeof(names->indicator));
else } else if (is_of_node(fwnode)) {
snprintf(names->indicator, sizeof(names->indicator), snprintf(names->indicator, sizeof(names->indicator),
"%pOFn:indicator", node); "%pOFn:indicator", to_of_node(fwnode));
} else {
dev_err(&flash->client->dev, "indicator node has no label!\n");
return -EINVAL;
}
rval = of_property_read_u32(flash->indicator_node, "led-max-microamp", rval = fwnode_property_read_u32(flash->indicator_node,
&cfg->indicator_max_ua); "led-max-microamp",
&cfg->indicator_max_ua);
if (rval < 0) { if (rval < 0) {
dev_err(&flash->client->dev, dev_err(&flash->client->dev,
"can't read led-max-microamp property for indicator\n"); "can't read led-max-microamp property for indicator\n");
...@@ -586,8 +597,8 @@ static int as3645a_parse_node(struct as3645a *flash, ...@@ -586,8 +597,8 @@ static int as3645a_parse_node(struct as3645a *flash,
return 0; return 0;
out_err: out_err:
of_node_put(flash->flash_node); fwnode_handle_put(flash->flash_node);
of_node_put(flash->indicator_node); fwnode_handle_put(flash->indicator_node);
return rval; return rval;
} }
...@@ -668,14 +679,14 @@ static int as3645a_v4l2_setup(struct as3645a *flash) ...@@ -668,14 +679,14 @@ static int as3645a_v4l2_setup(struct as3645a *flash)
strlcpy(cfgind.dev_name, flash->iled_cdev.name, sizeof(cfg.dev_name)); strlcpy(cfgind.dev_name, flash->iled_cdev.name, sizeof(cfg.dev_name));
flash->vf = v4l2_flash_init( flash->vf = v4l2_flash_init(
&flash->client->dev, of_fwnode_handle(flash->flash_node), &flash->client->dev, flash->flash_node, &flash->fled, NULL,
&flash->fled, NULL, &cfg); &cfg);
if (IS_ERR(flash->vf)) if (IS_ERR(flash->vf))
return PTR_ERR(flash->vf); return PTR_ERR(flash->vf);
flash->vfind = v4l2_flash_indicator_init( flash->vfind = v4l2_flash_indicator_init(
&flash->client->dev, of_fwnode_handle(flash->indicator_node), &flash->client->dev, flash->indicator_node, &flash->iled_cdev,
&flash->iled_cdev, &cfgind); &cfgind);
if (IS_ERR(flash->vfind)) { if (IS_ERR(flash->vfind)) {
v4l2_flash_release(flash->vf); v4l2_flash_release(flash->vf);
return PTR_ERR(flash->vfind); return PTR_ERR(flash->vfind);
...@@ -690,7 +701,7 @@ static int as3645a_probe(struct i2c_client *client) ...@@ -690,7 +701,7 @@ static int as3645a_probe(struct i2c_client *client)
struct as3645a *flash; struct as3645a *flash;
int rval; int rval;
if (client->dev.of_node == NULL) if (!dev_fwnode(&client->dev))
return -ENODEV; return -ENODEV;
flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL); flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL);
...@@ -699,7 +710,7 @@ static int as3645a_probe(struct i2c_client *client) ...@@ -699,7 +710,7 @@ static int as3645a_probe(struct i2c_client *client)
flash->client = client; flash->client = client;
rval = as3645a_parse_node(flash, &names, client->dev.of_node); rval = as3645a_parse_node(flash, &names, dev_fwnode(&client->dev));
if (rval < 0) if (rval < 0)
return rval; return rval;
...@@ -731,8 +742,8 @@ static int as3645a_probe(struct i2c_client *client) ...@@ -731,8 +742,8 @@ static int as3645a_probe(struct i2c_client *client)
mutex_destroy(&flash->mutex); mutex_destroy(&flash->mutex);
out_put_nodes: out_put_nodes:
of_node_put(flash->flash_node); fwnode_handle_put(flash->flash_node);
of_node_put(flash->indicator_node); fwnode_handle_put(flash->indicator_node);
return rval; return rval;
} }
...@@ -751,8 +762,8 @@ static int as3645a_remove(struct i2c_client *client) ...@@ -751,8 +762,8 @@ static int as3645a_remove(struct i2c_client *client)
mutex_destroy(&flash->mutex); mutex_destroy(&flash->mutex);
of_node_put(flash->flash_node); fwnode_handle_put(flash->flash_node);
of_node_put(flash->indicator_node); fwnode_handle_put(flash->indicator_node);
return 0; return 0;
} }
......
...@@ -594,7 +594,6 @@ static int blinkm_probe(struct i2c_client *client, ...@@ -594,7 +594,6 @@ static int blinkm_probe(struct i2c_client *client,
goto exit; goto exit;
} }
data->i2c_addr = 0x09;
data->i2c_addr = 0x08; data->i2c_addr = 0x08;
/* i2c addr - use fake addr of 0x08 initially (real is 0x09) */ /* i2c addr - use fake addr of 0x08 initially (real is 0x09) */
data->fw_ver = 0xfe; data->fw_ver = 0xfe;
......
This diff is collapsed.
...@@ -60,67 +60,14 @@ static int lt3593_led_set(struct led_classdev *led_cdev, ...@@ -60,67 +60,14 @@ static int lt3593_led_set(struct led_classdev *led_cdev,
return 0; return 0;
} }
static struct lt3593_led_data *lt3593_led_probe_pdata(struct device *dev)
{
struct gpio_led_platform_data *pdata = dev_get_platdata(dev);
const struct gpio_led *template = &pdata->leds[0];
struct lt3593_led_data *led_data;
int ret, state;
if (pdata->num_leds != 1)
return ERR_PTR(-EINVAL);
led_data = devm_kzalloc(dev, sizeof(*led_data), GFP_KERNEL);
if (!led_data)
return ERR_PTR(-ENOMEM);
led_data->cdev.name = template->name;
led_data->cdev.default_trigger = template->default_trigger;
led_data->cdev.brightness_set_blocking = lt3593_led_set;
state = (template->default_state == LEDS_GPIO_DEFSTATE_ON);
led_data->cdev.brightness = state ? LED_FULL : LED_OFF;
if (!template->retain_state_suspended)
led_data->cdev.flags |= LED_CORE_SUSPENDRESUME;
ret = devm_gpio_request_one(dev, template->gpio, state ?
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
template->name);
if (ret < 0)
return ERR_PTR(ret);
led_data->gpiod = gpio_to_desc(template->gpio);
if (!led_data->gpiod)
return ERR_PTR(-EPROBE_DEFER);
ret = devm_led_classdev_register(dev, &led_data->cdev);
if (ret < 0)
return ERR_PTR(ret);
dev_info(dev, "registered LT3593 LED '%s' at GPIO %d\n",
template->name, template->gpio);
return led_data;
}
static int lt3593_led_probe(struct platform_device *pdev) static int lt3593_led_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct lt3593_led_data *led_data; struct lt3593_led_data *led_data;
struct fwnode_handle *child; struct fwnode_handle *child;
int ret, state = LEDS_GPIO_DEFSTATE_OFF; int ret, state = LEDS_GPIO_DEFSTATE_OFF;
enum gpiod_flags flags = GPIOD_OUT_LOW;
const char *tmp; const char *tmp;
if (dev_get_platdata(dev)) {
led_data = lt3593_led_probe_pdata(dev);
if (IS_ERR(led_data))
return PTR_ERR(led_data);
goto out;
}
if (!dev->of_node) if (!dev->of_node)
return -ENODEV; return -ENODEV;
...@@ -151,13 +98,8 @@ static int lt3593_led_probe(struct platform_device *pdev) ...@@ -151,13 +98,8 @@ static int lt3593_led_probe(struct platform_device *pdev)
&led_data->cdev.default_trigger); &led_data->cdev.default_trigger);
if (!fwnode_property_read_string(child, "default-state", &tmp)) { if (!fwnode_property_read_string(child, "default-state", &tmp)) {
if (!strcmp(tmp, "keep")) { if (!strcmp(tmp, "on"))
state = LEDS_GPIO_DEFSTATE_KEEP;
flags = GPIOD_ASIS;
} else if (!strcmp(tmp, "on")) {
state = LEDS_GPIO_DEFSTATE_ON; state = LEDS_GPIO_DEFSTATE_ON;
flags = GPIOD_OUT_HIGH;
}
} }
led_data->cdev.name = led_data->name; led_data->cdev.name = led_data->name;
...@@ -171,20 +113,16 @@ static int lt3593_led_probe(struct platform_device *pdev) ...@@ -171,20 +113,16 @@ static int lt3593_led_probe(struct platform_device *pdev)
} }
led_data->cdev.dev->of_node = dev->of_node; led_data->cdev.dev->of_node = dev->of_node;
out:
platform_set_drvdata(pdev, led_data); platform_set_drvdata(pdev, led_data);
return 0; return 0;
} }
#ifdef CONFIG_OF
static const struct of_device_id of_lt3593_leds_match[] = { static const struct of_device_id of_lt3593_leds_match[] = {
{ .compatible = "lltc,lt3593", }, { .compatible = "lltc,lt3593", },
{}, {},
}; };
MODULE_DEVICE_TABLE(of, of_lt3593_leds_match); MODULE_DEVICE_TABLE(of, of_lt3593_leds_match);
#endif
static struct platform_driver lt3593_led_driver = { static struct platform_driver lt3593_led_driver = {
.probe = lt3593_led_probe, .probe = lt3593_led_probe,
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
* bits the chip supports. * bits the chip supports.
*/ */
#include <linux/acpi.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -48,8 +47,8 @@ ...@@ -48,8 +47,8 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/property.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -110,15 +109,6 @@ static const struct i2c_device_id pca955x_id[] = { ...@@ -110,15 +109,6 @@ static const struct i2c_device_id pca955x_id[] = {
}; };
MODULE_DEVICE_TABLE(i2c, pca955x_id); MODULE_DEVICE_TABLE(i2c, pca955x_id);
static const struct acpi_device_id pca955x_acpi_ids[] = {
{ "PCA9550", pca9550 },
{ "PCA9551", pca9551 },
{ "PCA9552", pca9552 },
{ "PCA9553", pca9553 },
{ }
};
MODULE_DEVICE_TABLE(acpi, pca955x_acpi_ids);
struct pca955x { struct pca955x {
struct mutex lock; struct mutex lock;
struct pca955x_led *leds; struct pca955x_led *leds;
...@@ -373,16 +363,14 @@ static int pca955x_gpio_direction_output(struct gpio_chip *gc, ...@@ -373,16 +363,14 @@ static int pca955x_gpio_direction_output(struct gpio_chip *gc,
} }
#endif /* CONFIG_LEDS_PCA955X_GPIO */ #endif /* CONFIG_LEDS_PCA955X_GPIO */
#if IS_ENABLED(CONFIG_OF)
static struct pca955x_platform_data * static struct pca955x_platform_data *
pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip) pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip)
{ {
struct device_node *np = client->dev.of_node;
struct device_node *child;
struct pca955x_platform_data *pdata; struct pca955x_platform_data *pdata;
struct fwnode_handle *child;
int count; int count;
count = of_get_child_count(np); count = device_get_child_node_count(&client->dev);
if (!count || count > chip->bits) if (!count || count > chip->bits)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
...@@ -396,24 +384,25 @@ pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip) ...@@ -396,24 +384,25 @@ pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip)
if (!pdata->leds) if (!pdata->leds)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
for_each_child_of_node(np, child) { device_for_each_child_node(&client->dev, child) {
const char *name; const char *name;
u32 reg; u32 reg;
int res; int res;
res = of_property_read_u32(child, "reg", &reg); res = fwnode_property_read_u32(child, "reg", &reg);
if ((res != 0) || (reg >= chip->bits)) if ((res != 0) || (reg >= chip->bits))
continue; continue;
if (of_property_read_string(child, "label", &name)) res = fwnode_property_read_string(child, "label", &name);
name = child->name; if ((res != 0) && is_of_node(child))
name = to_of_node(child)->name;
snprintf(pdata->leds[reg].name, sizeof(pdata->leds[reg].name), snprintf(pdata->leds[reg].name, sizeof(pdata->leds[reg].name),
"%s", name); "%s", name);
pdata->leds[reg].type = PCA955X_TYPE_LED; pdata->leds[reg].type = PCA955X_TYPE_LED;
of_property_read_u32(child, "type", &pdata->leds[reg].type); fwnode_property_read_u32(child, "type", &pdata->leds[reg].type);
of_property_read_string(child, "linux,default-trigger", fwnode_property_read_string(child, "linux,default-trigger",
&pdata->leds[reg].default_trigger); &pdata->leds[reg].default_trigger);
} }
...@@ -429,15 +418,7 @@ static const struct of_device_id of_pca955x_match[] = { ...@@ -429,15 +418,7 @@ static const struct of_device_id of_pca955x_match[] = {
{ .compatible = "nxp,pca9553", .data = (void *)pca9553 }, { .compatible = "nxp,pca9553", .data = (void *)pca9553 },
{}, {},
}; };
MODULE_DEVICE_TABLE(of, of_pca955x_match); MODULE_DEVICE_TABLE(of, of_pca955x_match);
#else
static struct pca955x_platform_data *
pca955x_pdata_of_init(struct i2c_client *client, struct pca955x_chipdef *chip)
{
return ERR_PTR(-ENODEV);
}
#endif
static int pca955x_probe(struct i2c_client *client, static int pca955x_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
...@@ -450,20 +431,11 @@ static int pca955x_probe(struct i2c_client *client, ...@@ -450,20 +431,11 @@ static int pca955x_probe(struct i2c_client *client,
struct pca955x_platform_data *pdata; struct pca955x_platform_data *pdata;
int ngpios = 0; int ngpios = 0;
if (id) { chip = &pca955x_chipdefs[id->driver_data];
chip = &pca955x_chipdefs[id->driver_data];
} else {
const struct acpi_device_id *acpi_id;
acpi_id = acpi_match_device(pca955x_acpi_ids, &client->dev);
if (!acpi_id)
return -ENODEV;
chip = &pca955x_chipdefs[acpi_id->driver_data];
}
adapter = to_i2c_adapter(client->dev.parent); adapter = to_i2c_adapter(client->dev.parent);
pdata = dev_get_platdata(&client->dev); pdata = dev_get_platdata(&client->dev);
if (!pdata) { if (!pdata) {
pdata = pca955x_pdata_of_init(client, chip); pdata = pca955x_get_pdata(client, chip);
if (IS_ERR(pdata)) if (IS_ERR(pdata))
return PTR_ERR(pdata); return PTR_ERR(pdata);
} }
...@@ -602,8 +574,7 @@ static int pca955x_probe(struct i2c_client *client, ...@@ -602,8 +574,7 @@ static int pca955x_probe(struct i2c_client *client,
static struct i2c_driver pca955x_driver = { static struct i2c_driver pca955x_driver = {
.driver = { .driver = {
.name = "leds-pca955x", .name = "leds-pca955x",
.acpi_match_table = ACPI_PTR(pca955x_acpi_ids), .of_match_table = of_pca955x_match,
.of_match_table = of_match_ptr(of_pca955x_match),
}, },
.probe = pca955x_probe, .probe = pca955x_probe,
.id_table = pca955x_id, .id_table = pca955x_id,
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
* or by adding the 'nxp,hw-blink' property to the DTS. * or by adding the 'nxp,hw-blink' property to the DTS.
*/ */
#include <linux/acpi.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -33,6 +32,7 @@ ...@@ -33,6 +32,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/property.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_data/leds-pca963x.h> #include <linux/platform_data/leds-pca963x.h>
...@@ -97,15 +97,6 @@ static const struct i2c_device_id pca963x_id[] = { ...@@ -97,15 +97,6 @@ static const struct i2c_device_id pca963x_id[] = {
}; };
MODULE_DEVICE_TABLE(i2c, pca963x_id); MODULE_DEVICE_TABLE(i2c, pca963x_id);
static const struct acpi_device_id pca963x_acpi_ids[] = {
{ "PCA9632", pca9633 },
{ "PCA9633", pca9633 },
{ "PCA9634", pca9634 },
{ "PCA9635", pca9635 },
{ }
};
MODULE_DEVICE_TABLE(acpi, pca963x_acpi_ids);
struct pca963x_led; struct pca963x_led;
struct pca963x { struct pca963x {
...@@ -287,16 +278,15 @@ static int pca963x_blink_set(struct led_classdev *led_cdev, ...@@ -287,16 +278,15 @@ static int pca963x_blink_set(struct led_classdev *led_cdev,
return 0; return 0;
} }
#if IS_ENABLED(CONFIG_OF)
static struct pca963x_platform_data * static struct pca963x_platform_data *
pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip) pca963x_get_pdata(struct i2c_client *client, struct pca963x_chipdef *chip)
{ {
struct device_node *np = client->dev.of_node, *child;
struct pca963x_platform_data *pdata; struct pca963x_platform_data *pdata;
struct led_info *pca963x_leds; struct led_info *pca963x_leds;
struct fwnode_handle *child;
int count; int count;
count = of_get_child_count(np); count = device_get_child_node_count(&client->dev);
if (!count || count > chip->n_leds) if (!count || count > chip->n_leds)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
...@@ -305,18 +295,22 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip) ...@@ -305,18 +295,22 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip)
if (!pca963x_leds) if (!pca963x_leds)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
for_each_child_of_node(np, child) { device_for_each_child_node(&client->dev, child) {
struct led_info led = {}; struct led_info led = {};
u32 reg; u32 reg;
int res; int res;
res = of_property_read_u32(child, "reg", &reg); res = fwnode_property_read_u32(child, "reg", &reg);
if ((res != 0) || (reg >= chip->n_leds)) if ((res != 0) || (reg >= chip->n_leds))
continue; continue;
led.name =
of_get_property(child, "label", NULL) ? : child->name; res = fwnode_property_read_string(child, "label", &led.name);
led.default_trigger = if ((res != 0) && is_of_node(child))
of_get_property(child, "linux,default-trigger", NULL); led.name = to_of_node(child)->name;
fwnode_property_read_string(child, "linux,default-trigger",
&led.default_trigger);
pca963x_leds[reg] = led; pca963x_leds[reg] = led;
} }
pdata = devm_kzalloc(&client->dev, pdata = devm_kzalloc(&client->dev,
...@@ -328,22 +322,23 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip) ...@@ -328,22 +322,23 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip)
pdata->leds.num_leds = chip->n_leds; pdata->leds.num_leds = chip->n_leds;
/* default to open-drain unless totem pole (push-pull) is specified */ /* default to open-drain unless totem pole (push-pull) is specified */
if (of_property_read_bool(np, "nxp,totem-pole")) if (device_property_read_bool(&client->dev, "nxp,totem-pole"))
pdata->outdrv = PCA963X_TOTEM_POLE; pdata->outdrv = PCA963X_TOTEM_POLE;
else else
pdata->outdrv = PCA963X_OPEN_DRAIN; pdata->outdrv = PCA963X_OPEN_DRAIN;
/* default to software blinking unless hardware blinking is specified */ /* default to software blinking unless hardware blinking is specified */
if (of_property_read_bool(np, "nxp,hw-blink")) if (device_property_read_bool(&client->dev, "nxp,hw-blink"))
pdata->blink_type = PCA963X_HW_BLINK; pdata->blink_type = PCA963X_HW_BLINK;
else else
pdata->blink_type = PCA963X_SW_BLINK; pdata->blink_type = PCA963X_SW_BLINK;
if (of_property_read_u32(np, "nxp,period-scale", &chip->scaling)) if (device_property_read_u32(&client->dev, "nxp,period-scale",
&chip->scaling))
chip->scaling = 1000; chip->scaling = 1000;
/* default to non-inverted output, unless inverted is specified */ /* default to non-inverted output, unless inverted is specified */
if (of_property_read_bool(np, "nxp,inverted-out")) if (device_property_read_bool(&client->dev, "nxp,inverted-out"))
pdata->dir = PCA963X_INVERTED; pdata->dir = PCA963X_INVERTED;
else else
pdata->dir = PCA963X_NORMAL; pdata->dir = PCA963X_NORMAL;
...@@ -359,13 +354,6 @@ static const struct of_device_id of_pca963x_match[] = { ...@@ -359,13 +354,6 @@ static const struct of_device_id of_pca963x_match[] = {
{}, {},
}; };
MODULE_DEVICE_TABLE(of, of_pca963x_match); MODULE_DEVICE_TABLE(of, of_pca963x_match);
#else
static struct pca963x_platform_data *
pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip)
{
return ERR_PTR(-ENODEV);
}
#endif
static int pca963x_probe(struct i2c_client *client, static int pca963x_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
...@@ -376,20 +364,11 @@ static int pca963x_probe(struct i2c_client *client, ...@@ -376,20 +364,11 @@ static int pca963x_probe(struct i2c_client *client,
struct pca963x_chipdef *chip; struct pca963x_chipdef *chip;
int i, err; int i, err;
if (id) { chip = &pca963x_chipdefs[id->driver_data];
chip = &pca963x_chipdefs[id->driver_data];
} else {
const struct acpi_device_id *acpi_id;
acpi_id = acpi_match_device(pca963x_acpi_ids, &client->dev);
if (!acpi_id)
return -ENODEV;
chip = &pca963x_chipdefs[acpi_id->driver_data];
}
pdata = dev_get_platdata(&client->dev); pdata = dev_get_platdata(&client->dev);
if (!pdata) { if (!pdata) {
pdata = pca963x_dt_init(client, chip); pdata = pca963x_get_pdata(client, chip);
if (IS_ERR(pdata)) { if (IS_ERR(pdata)) {
dev_warn(&client->dev, "could not parse configuration\n"); dev_warn(&client->dev, "could not parse configuration\n");
pdata = NULL; pdata = NULL;
...@@ -495,8 +474,7 @@ static int pca963x_remove(struct i2c_client *client) ...@@ -495,8 +474,7 @@ static int pca963x_remove(struct i2c_client *client)
static struct i2c_driver pca963x_driver = { static struct i2c_driver pca963x_driver = {
.driver = { .driver = {
.name = "leds-pca963x", .name = "leds-pca963x",
.of_match_table = of_match_ptr(of_pca963x_match), .of_match_table = of_pca963x_match,
.acpi_match_table = ACPI_PTR(pca963x_acpi_ids),
}, },
.probe = pca963x_probe, .probe = pca963x_probe,
.remove = pca963x_remove, .remove = pca963x_remove,
......
...@@ -54,14 +54,6 @@ static void ti_lmu_disable_hw(void *data) ...@@ -54,14 +54,6 @@ static void ti_lmu_disable_hw(void *data)
gpiod_set_value(lmu->en_gpio, 0); gpiod_set_value(lmu->en_gpio, 0);
} }
static const struct mfd_cell lm3532_devices[] = {
{
.name = "ti-lmu-backlight",
.id = LM3532,
.of_compatible = "ti,lm3532-backlight",
},
};
#define LM363X_REGULATOR(_id) \ #define LM363X_REGULATOR(_id) \
{ \ { \
.name = "lm363x-regulator", \ .name = "lm363x-regulator", \
...@@ -141,7 +133,6 @@ static const struct ti_lmu_data chip##_data = \ ...@@ -141,7 +133,6 @@ static const struct ti_lmu_data chip##_data = \
.max_register = max_reg, \ .max_register = max_reg, \
} \ } \
TI_LMU_DATA(lm3532, LM3532_MAX_REG);
TI_LMU_DATA(lm3631, LM3631_MAX_REG); TI_LMU_DATA(lm3631, LM3631_MAX_REG);
TI_LMU_DATA(lm3632, LM3632_MAX_REG); TI_LMU_DATA(lm3632, LM3632_MAX_REG);
TI_LMU_DATA(lm3633, LM3633_MAX_REG); TI_LMU_DATA(lm3633, LM3633_MAX_REG);
...@@ -211,7 +202,6 @@ static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id) ...@@ -211,7 +202,6 @@ static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id)
} }
static const struct of_device_id ti_lmu_of_match[] = { static const struct of_device_id ti_lmu_of_match[] = {
{ .compatible = "ti,lm3532", .data = &lm3532_data },
{ .compatible = "ti,lm3631", .data = &lm3631_data }, { .compatible = "ti,lm3631", .data = &lm3631_data },
{ .compatible = "ti,lm3632", .data = &lm3632_data }, { .compatible = "ti,lm3632", .data = &lm3632_data },
{ .compatible = "ti,lm3633", .data = &lm3633_data }, { .compatible = "ti,lm3633", .data = &lm3633_data },
...@@ -222,7 +212,6 @@ static const struct of_device_id ti_lmu_of_match[] = { ...@@ -222,7 +212,6 @@ static const struct of_device_id ti_lmu_of_match[] = {
MODULE_DEVICE_TABLE(of, ti_lmu_of_match); MODULE_DEVICE_TABLE(of, ti_lmu_of_match);
static const struct i2c_device_id ti_lmu_ids[] = { static const struct i2c_device_id ti_lmu_ids[] = {
{ "lm3532", LM3532 },
{ "lm3631", LM3631 }, { "lm3631", LM3631 },
{ "lm3632", LM3632 }, { "lm3632", LM3632 },
{ "lm3633", LM3633 }, { "lm3633", LM3633 },
......
...@@ -15,50 +15,6 @@ ...@@ -15,50 +15,6 @@
#include <linux/bitops.h> #include <linux/bitops.h>
/* LM3532 */
#define LM3532_REG_OUTPUT_CFG 0x10
#define LM3532_ILED1_CFG_MASK 0x03
#define LM3532_ILED2_CFG_MASK 0x0C
#define LM3532_ILED3_CFG_MASK 0x30
#define LM3532_ILED1_CFG_SHIFT 0
#define LM3532_ILED2_CFG_SHIFT 2
#define LM3532_ILED3_CFG_SHIFT 4
#define LM3532_REG_RAMPUP 0x12
#define LM3532_REG_RAMPDN LM3532_REG_RAMPUP
#define LM3532_RAMPUP_MASK 0x07
#define LM3532_RAMPUP_SHIFT 0
#define LM3532_RAMPDN_MASK 0x38
#define LM3532_RAMPDN_SHIFT 3
#define LM3532_REG_ENABLE 0x1D
#define LM3532_REG_PWM_A_CFG 0x13
#define LM3532_PWM_A_MASK 0x05 /* zone 0 */
#define LM3532_PWM_ZONE_0 BIT(2)
#define LM3532_REG_PWM_B_CFG 0x14
#define LM3532_PWM_B_MASK 0x09 /* zone 1 */
#define LM3532_PWM_ZONE_1 BIT(3)
#define LM3532_REG_PWM_C_CFG 0x15
#define LM3532_PWM_C_MASK 0x11 /* zone 2 */
#define LM3532_PWM_ZONE_2 BIT(4)
#define LM3532_REG_ZONE_CFG_A 0x16
#define LM3532_REG_ZONE_CFG_B 0x18
#define LM3532_REG_ZONE_CFG_C 0x1A
#define LM3532_ZONE_MASK (BIT(2) | BIT(3) | BIT(4))
#define LM3532_ZONE_0 0
#define LM3532_ZONE_1 BIT(2)
#define LM3532_ZONE_2 BIT(3)
#define LM3532_REG_BRT_A 0x70 /* zone 0 */
#define LM3532_REG_BRT_B 0x76 /* zone 1 */
#define LM3532_REG_BRT_C 0x7C /* zone 2 */
#define LM3532_MAX_REG 0x7E
/* LM3631 */ /* LM3631 */
#define LM3631_REG_DEVCTRL 0x00 #define LM3631_REG_DEVCTRL 0x00
#define LM3631_LCD_EN_MASK BIT(1) #define LM3631_LCD_EN_MASK BIT(1)
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#define LMU_EVENT_MONITOR_DONE 0x01 #define LMU_EVENT_MONITOR_DONE 0x01
enum ti_lmu_id { enum ti_lmu_id {
LM3532,
LM3631, LM3631,
LM3632, LM3632,
LM3633, LM3633,
......
...@@ -291,8 +291,8 @@ static bool toneport_has_led(struct usb_line6_toneport *toneport) ...@@ -291,8 +291,8 @@ static bool toneport_has_led(struct usb_line6_toneport *toneport)
} }
} }
static const char * const led_colors[2] = { "red", "green" }; static const char * const toneport_led_colors[2] = { "red", "green" };
static const int led_init_vals[2] = { 0x00, 0x26 }; static const int toneport_led_init_vals[2] = { 0x00, 0x26 };
static void toneport_update_led(struct usb_line6_toneport *toneport) static void toneport_update_led(struct usb_line6_toneport *toneport)
{ {
...@@ -320,9 +320,9 @@ static int toneport_init_leds(struct usb_line6_toneport *toneport) ...@@ -320,9 +320,9 @@ static int toneport_init_leds(struct usb_line6_toneport *toneport)
led->toneport = toneport; led->toneport = toneport;
snprintf(led->name, sizeof(led->name), "%s::%s", snprintf(led->name, sizeof(led->name), "%s::%s",
dev_name(dev), led_colors[i]); dev_name(dev), toneport_led_colors[i]);
leddev->name = led->name; leddev->name = led->name;
leddev->brightness = led_init_vals[i]; leddev->brightness = toneport_led_init_vals[i];
leddev->max_brightness = 0x26; leddev->max_brightness = 0x26;
leddev->brightness_set = toneport_led_brightness_set; leddev->brightness_set = toneport_led_brightness_set;
err = led_classdev_register(dev, leddev); err = led_classdev_register(dev, leddev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment