Skip to contentSkip to conversation

Add support for charger LED for AXP813 and TBS A711 Tablet

PATCH In review Ondrej Jirman 5 participants 14 messages Feb 23, 2020 – Feb 26, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Add support for charger LED for AXP813 and TBS A711 Tablet

The tablet has a charger LED exposed on the top. This LED is controlled by AXP813 PMIC. Add support for enabling the LED and using it either for charging indication (handled by PMIC automatically) or for other uses via user control.

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (4):
dt-bindings: leds: Add a binding for AXP813 charger led
leds: axp20x: Support charger LED on AXP20x like PMICs
ARM: dts: axp813: Add charger LED
ARM: dts: sun8i-a83t-tbs-a711: Enable charging LED

 .../devicetree/bindings/leds/leds-axp20x.yaml |  24 ++
 arch/arm/boot/dts/axp81x.dtsi                 |   5 +
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts     |   4 +
 drivers/leds/Kconfig                          |   7 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/leds-axp20x.c                    | 240 ++++++++++++++++++
 drivers/mfd/axp20x.c                          |   3 +
 7 files changed, 284 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.yaml
 create mode 100644 drivers/leds/leds-axp20x.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 dt-bindings: leds: Add a binding for AXP813 charger led

The AXP813 PMIC can control one LED. Add binding to represent the LED.

---
 .../devicetree/bindings/leds/leds-axp20x.yaml | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.yaml
Documentation/devicetree/bindings/leds/leds-axp20x.yaml new file +24 -0
new file mode 100644
index 0000000000000..79282d55764bf
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-axp20x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for AXP813 PMIC from X-Powers.
+
+maintainers:
+  - Ondrej Jirman <[email protected]>
+
+description: |
+  This module is part of the AXP20x MFD device. For more details
+  see Documentation/devicetree/bindings/mfd/axp20x.txt.
+
+  The LED controller is represented as a sub-node of the PMIC node on
+  the device tree.
+
+properties:
+  compatible:
+    const: x-powers,axp813-charger-led
+
+required:
+  - compatible
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/4] dt-bindings: leds: Add a binding for AXP813 charger led

Ondrej

Quoted 28 lines · Ondrej Jirman

The AXP813 PMIC can control one LED. Add binding to represent the LED.

---
  .../devicetree/bindings/leds/leds-axp20x.yaml | 24 +++++++++++++++++++
  1 file changed, 24 insertions(+)

create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.yaml

Documentation/devicetree/bindings/leds/leds-axp20x.yaml new file +14 -0
new file mode 100644
index 0000000000000..79282d55764bf
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-axp20x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for AXP813 PMIC from X-Powers.
+
+maintainers:
+  - Ondrej Jirman <[email protected]>
+
+description: |
+  This module is part of the AXP20x MFD device. For more details
+  see Documentation/devicetree/bindings/mfd/axp20x.txt.

Documentation/devicetree/bindings/leds/leds-axp20x.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-axp20x.yaml new file +10 -0
+
+  The LED controller is represented as a sub-node of the PMIC node on
+  the device tree.
+
+properties:
+  compatible:
+    const: x-powers,axp813-charger-led
+
+required:
+  - compatible

You need to add the color and function properties for proper LED device name presentation per the bindings/leds/common.yaml binding.

Dan

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#3 lore raw

Re: [PATCH 1/4] dt-bindings: leds: Add a binding for AXP813 charger led

In reply to Ondrej Jirman
Quoted 14 lines · Ondrej Jirman

The AXP813 PMIC can control one LED. Add binding to represent the LED.

---
 .../devicetree/bindings/leds/leds-axp20x.yaml | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.yaml
Documentation/devicetree/bindings/leds/leds-axp20x.yaml new file +0 -0
new file mode 100644
index 0000000000000..79282d55764bf

Documentation/devicetree/bindings/leds/leds-axp20x.yaml line 1

Quoted 1 line
Documentation/devicetree/bindings/leds/leds-axp20x.yaml new file +1 -0
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0

Dual license new bindings please:

(GPL-2.0-only OR BSD-2-Clause)

Documentation/devicetree/bindings/leds/leds-axp20x.yaml line 14

Quoted 13 lines
Documentation/devicetree/bindings/leds/leds-axp20x.yaml new file +13 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/leds-axp20x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LED driver for AXP813 PMIC from X-Powers.
+
+maintainers:
+  - Ondrej Jirman <[email protected]>
+
+description: |
+  This module is part of the AXP20x MFD device. For more details
+  see Documentation/devicetree/bindings/mfd/axp20x.txt.

Really, we should convert this first as this should either just be referenced from the MFD schema or just directly put into it.

Rob

#4 lore raw

PATCH 2/4 leds: axp20x: Support charger LED on AXP20x like PMICs

In reply to Ondrej Jirman

There is single LED that can be turned on and off by the user, or set to be controlled by the charger in 2 different modes.

The driver initializes the LED to be controlled by the charger, but allows to switch it to user control, and change the mode of charging indication via a sysfs.

The driver was developed on AXP813, but should work on other PMICs like that without changes.

---
 drivers/leds/Kconfig       |   7 ++
 drivers/leds/Makefile      |   1 +
 drivers/leds/leds-axp20x.c | 240 +++++++++++++++++++++++++++++++++++++
 drivers/mfd/axp20x.c       |   3 +
 4 files changed, 251 insertions(+)
 create mode 100644 drivers/leds/leds-axp20x.c
drivers/leds/Kconfig +7 -0
index d82f1dea37111..80a3f31f6f4c3 100644
@@ -846,6 +846,13 @@ config LEDS_TPS6105X
 	  It is a single boost converter primarily for white LEDs and
 	  audio amplifiers.
 
+config LEDS_AXP20X
+	tristate "Charger LED support for AXP20X-like PMICs (AXP813, ...)"
+	depends on LEDS_CLASS && MFD_AXP20X
+	help
+	  This option enables support for on-chip LED driver on
+	  AXP20X-like PMICs.
+
 comment "LED Triggers"
 source "drivers/leds/trigger/Kconfig"
 
drivers/leds/Makefile +1 -0
index d7e1107753fb1..80ea1bc4744b0 100644
@@ -86,6 +86,7 @@ obj-$(CONFIG_LEDS_TI_LMU_COMMON)	+= leds-ti-lmu-common.o
 obj-$(CONFIG_LEDS_LM3697)		+= leds-lm3697.o
 obj-$(CONFIG_LEDS_LM36274)		+= leds-lm36274.o
 obj-$(CONFIG_LEDS_TPS6105X)		+= leds-tps6105x.o
+obj-$(CONFIG_LEDS_AXP20X)		+= leds-axp20x.o
 
 # LED SPI Drivers
 obj-$(CONFIG_LEDS_CR0014114)		+= leds-cr0014114.o
drivers/leds/leds-axp20x.c new file +240 -0

240 lines not on this page · raw message

drivers/mfd/axp20x.c +3 -0
index aa59496e43768..dcd68397b9d23 100644
@@ -806,6 +806,9 @@ static const struct mfd_cell axp813_cells[] = {
 		.num_resources	= ARRAY_SIZE(axp803_usb_power_supply_resources),
 		.resources	= axp803_usb_power_supply_resources,
 		.of_compatible	= "x-powers,axp813-usb-power-supply",
+	}, {
+		.name		= "axp20x-charger-led",
+		.of_compatible	= "x-powers,axp813-charger-led",
 	},
 };
 
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH 2/4] leds: axp20x: Support charger LED on AXP20x like PMICs

Ondrej

Quoted 212 lines · Ondrej Jirman

There is single LED that can be turned on and off by the user, or set to be controlled by the charger in 2 different modes.

The driver initializes the LED to be controlled by the charger, but allows to switch it to user control, and change the mode of charging indication via a sysfs.

The driver was developed on AXP813, but should work on other PMICs like that without changes.

---
  drivers/leds/Kconfig       |   7 ++
  drivers/leds/Makefile      |   1 +
  drivers/leds/leds-axp20x.c | 240 +++++++++++++++++++++++++++++++++++++
  drivers/mfd/axp20x.c       |   3 +
  4 files changed, 251 insertions(+)

create mode 100644 drivers/leds/leds-axp20x.c

drivers/leds/Kconfig +7 -0
index d82f1dea37111..80a3f31f6f4c3 100644
@@ -846,6 +846,13 @@ config LEDS_TPS6105X
  	  It is a single boost converter primarily for white LEDs and
  	  audio amplifiers.
 
+config LEDS_AXP20X
+	tristate "Charger LED support for AXP20X-like PMICs (AXP813, ...)"
+	depends on LEDS_CLASS && MFD_AXP20X
+	help
+	  This option enables support for on-chip LED driver on
+	  AXP20X-like PMICs.
+
  comment "LED Triggers"
  source "drivers/leds/trigger/Kconfig"
 
drivers/leds/Makefile +1 -0
index d7e1107753fb1..80ea1bc4744b0 100644
@@ -86,6 +86,7 @@ obj-$(CONFIG_LEDS_TI_LMU_COMMON)	+= leds-ti-lmu-common.o
  obj-$(CONFIG_LEDS_LM3697)		+= leds-lm3697.o
  obj-$(CONFIG_LEDS_LM36274)		+= leds-lm36274.o
  obj-$(CONFIG_LEDS_TPS6105X)		+= leds-tps6105x.o
+obj-$(CONFIG_LEDS_AXP20X)		+= leds-axp20x.o
 
  # LED SPI Drivers
  obj-$(CONFIG_LEDS_CR0014114)		+= leds-cr0014114.o
drivers/leds/leds-axp20x.c new file +157 -0
new file mode 100644
index 0000000000000..e6c9853b84d52
@@ -0,0 +1,240 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * LED Driver for X-Powers AXP813 PMIC and similar.
+ *
+ * Copyright(c) 2020 Ondrej Jirman <[email protected]>
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/mfd/axp20x.h>
+
+#define AXP20X_CHGLED_CTRL_MASK		BIT(3)
+#define AXP20X_CHGLED_CTRL_CHARGER	BIT(3)
+#define AXP20X_CHGLED_CTRL_USER		0
+
+#define AXP20X_CHRG_CTRL2_MODE		BIT(4)
+
+#define AXP20X_CHGLED_USER_STATE_MASK		GENMASK(5, 4)
+#define AXP20X_CHGLED_USER_STATE_OFF		(0 << 4)
+#define AXP20X_CHGLED_USER_STATE_BLINK_SLOW	(1 << 4)
+#define AXP20X_CHGLED_USER_STATE_BLINK_FAST	(2 << 4)
+#define AXP20X_CHGLED_USER_STATE_ON		(3 << 4)
+
+struct axp20x_led {
+	struct led_classdev cdev;
+	struct regmap *regmap;
+};
+
+static int axp20x_led_set(struct led_classdev *led_cdev,
+			   enum led_brightness value)
+{
+	struct axp20x_led *led =
+			container_of(led_cdev, struct axp20x_led, cdev);
+	unsigned int val;
+
+	val = value == LED_OFF ? AXP20X_CHGLED_USER_STATE_OFF :
+		AXP20X_CHGLED_USER_STATE_ON;
+
+	return regmap_update_bits(led->regmap, AXP20X_OFF_CTRL,
+				  AXP20X_CHGLED_USER_STATE_MASK, val);
+
+}
+
+static ssize_t charger_control_show(struct device *dev,
+				    struct device_attribute *attr, char *buf)
+{
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
+	struct axp20x_led *led =
+		container_of(led_cdev, struct axp20x_led, cdev);
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(led->regmap, AXP20X_OFF_CTRL, &val);
+	if (ret)
+		return ret;
+
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
+			 val & AXP20X_CHGLED_CTRL_MASK ? 1 : 0);
+}
+
+static ssize_t charger_control_store(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t len)
+{
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
+	struct axp20x_led *led =
+			container_of(led_cdev, struct axp20x_led, cdev);
+	bool status;
+	int ret;
+
+	ret = kstrtobool(buf, &status);
+	if (ret)
+		return ret;
+
+	ret = regmap_update_bits(led->regmap, AXP20X_OFF_CTRL,
+				 AXP20X_CHGLED_CTRL_MASK,
+				 status ? AXP20X_CHGLED_CTRL_CHARGER :
+				 AXP20X_CHGLED_CTRL_USER);
+	if (ret)
+		return ret;
+
+	return len;
+}
+
+static ssize_t charger_mode_show(struct device *dev,
+				 struct device_attribute *attr, char *buf)
+{
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
+	struct axp20x_led *led =
+		container_of(led_cdev, struct axp20x_led, cdev);
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(led->regmap, AXP20X_CHRG_CTRL2, &val);
+	if (ret)
+		return ret;
+
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
+			 val & AXP20X_CHRG_CTRL2_MODE ? 1 : 0);
+}
+
+static ssize_t charger_mode_store(struct device *dev,
+				  struct device_attribute *attr,
+				  const char *buf, size_t len)
+{
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
+	struct axp20x_led *led =
+		container_of(led_cdev, struct axp20x_led, cdev);
+	unsigned int mode;
+	int ret;
+
+	ret = kstrtouint(buf, 0, &mode);
+	if (ret)
+		return ret;
+
+	if (mode > 1)
+		return -ERANGE;
+
+	ret = regmap_update_bits(led->regmap, AXP20X_CHRG_CTRL2,
+				 AXP20X_CHRG_CTRL2_MODE,
+				 mode ? AXP20X_CHRG_CTRL2_MODE : 0);
+	if (ret)
+		return ret;
+
+	return len;
+}
+
+static DEVICE_ATTR_RW(charger_control);
+static DEVICE_ATTR_RW(charger_mode);
+
+static struct attribute *axp20x_led_attrs[] = {
+	&dev_attr_charger_control.attr,
+	&dev_attr_charger_mode.attr,
+	NULL,
+};
+
+ATTRIBUTE_GROUPS(axp20x_led);
+
+static int axp20x_led_probe(struct platform_device *pdev)
+{
+	struct axp20x_dev *axp20x;
+	struct axp20x_led *led;
+	int ret;
+
+	if (!of_device_is_available(pdev->dev.of_node))
+		return -ENODEV;
+
+	axp20x = dev_get_drvdata(pdev->dev.parent);
+	if (!axp20x)
+		return -EINVAL;
+
+	led = devm_kzalloc(&pdev->dev,

drivers/leds/leds-axp20x.c line 167

Quoted 10 lines
drivers/leds/leds-axp20x.c new file +10 -0
+			   sizeof(struct axp20x_led),
+			   GFP_KERNEL);
+	if (!led)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, led);
+
+	led->regmap = axp20x->regmap;
+
+	led->cdev.name = "axp20x-chgarger-led";

This does not follow the LED device naming convention please refer to the leds-class.rst document

https://elixir.bootlin.com/linux/latest/source/Documentation/leds/leds-class.rst

Dan

#6 lore raw

Re: [PATCH 2/4] leds: axp20x: Support charger LED on AXP20x like PMICs

In reply to Ondrej Jirman

Hi!

Quoted 6 lines

There is single LED that can be turned on and off by the user, or set to be controlled by the charger in 2 different modes.

The driver initializes the LED to be controlled by the charger, but allows to switch it to user control, and change the mode of charging indication via a sysfs.

You'd need to document new "control" file.

But hold on, it is not an only driver with this "user-or-hardware" feature, and we want to have a common solution. And that solution is probably to have "hw-charger" trigger _just for this_ LED.

I can easily take a driver that always handles it as a "user" LED, if you can get ACKs from device tree people on the documentation patches.

drivers/leds/leds-axp20x.c line 167

Quoted 3 lines
drivers/leds/leds-axp20x.c new file +3 -0
+	led->regmap = axp20x->regmap;
+
+	led->cdev.name = "axp20x-chgarger-led";

typo.

drivers/leds/leds-axp20x.c line 203

Quoted 7 lines
drivers/leds/leds-axp20x.c new file +7 -0
+static void axp20x_led_shutdown(struct platform_device *pdev)
+{
+	struct axp20x_led *led = platform_get_drvdata(pdev);
+
+	/* On shutdown, we want to give LED control back to the PMIC,
+	 * so that it doesn't stay on, while the system is off.
+	 */

Comment style.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#7 lore raw

PATCH 3/4 ARM: dts: axp813: Add charger LED

In reply to Ondrej Jirman

PMIC supports charging status indication via a LED. Add support for it.

---
 arch/arm/boot/dts/axp81x.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/axp81x.dtsi +5 -0
index 1dfeeceabf4c3..00b092f94433d 100644
@@ -175,4 +175,9 @@ reg_drivevbus: drivevbus {
 	usb_power_supply: usb-power-supply {
 		compatible = "x-powers,axp813-usb-power-supply";
 	};
+
+	charger_led: charger-led {
+		compatible = "x-powers,axp813-charger-led";
+		status = "disabled";
+	};
 };
Signature · 1 line
2.25.1
#8 lore raw

Re: [PATCH 3/4] ARM: dts: axp813: Add charger LED

Ondrej

Quoted 13 lines · Ondrej Jirman

PMIC supports charging status indication via a LED. Add support for it.

---
  arch/arm/boot/dts/axp81x.dtsi | 5 +++++
  1 file changed, 5 insertions(+)
arch/arm/boot/dts/axp81x.dtsi +0 -0
index 1dfeeceabf4c3..00b092f94433d 100644

arch/arm/boot/dts/axp81x.dtsi reg_drivevbus: drivevbus { · line 181

Quoted 7 lines
arch/arm/boot/dts/axp81x.dtsi +4 -0
@@ -175,4 +175,9 @@ reg_drivevbus: drivevbus {
  	usb_power_supply: usb-power-supply {
  		compatible = "x-powers,axp813-usb-power-supply";
  	};
+
+	charger_led: charger-led {
+		compatible = "x-powers,axp813-charger-led";
+		status = "disabled";

As I commented before you need to add function and color to this node and read it from the driver.  Or you can add them to the over ride for the specific use case.

Another question is is this LED only used for charging or can it be multi purpose?

Dan

arch/arm/boot/dts/axp81x.dtsi reg_drivevbus: drivevbus { · line 183

Quoted 2 lines
arch/arm/boot/dts/axp81x.dtsi +1 -0
+	};
  };

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#9 lore raw

PATCH 4/4 ARM: dts: sun8i-a83t-tbs-a711: Enable charging LED

In reply to Ondrej Jirman

The tablet has a LED connected to the PMIC. The LED is visible in the top right corner of the tablet. Enable it.

---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +4 -0
index 2fd31a0a0b344..40911b5d3f323 100644
@@ -300,6 +300,10 @@ &battery_power_supply {
 	status = "okay";
 };
 
+&charger_led {
+	status = "okay";
+};
+
 &reg_aldo1 {
 	regulator-min-microvolt = <1800000>;
 	regulator-max-microvolt = <1800000>;
Signature · 1 line
2.25.1
#10 lore raw
In reply to Ondrej Jirman
Quoted 4 lines · megous hlavni

The tablet has a charger LED exposed on the top. This LED is controlled by AXP813 PMIC. Add support for enabling the LED and using it either for charging indication (handled by PMIC automatically) or for other uses via user control.

Dang, I just noticed someone sent a similar driver recently, although I had this one prepared for quite some time (since 2017) in my tree. I guess I should have sent it earlier.

Please ignore.

regards,

	o.
Quoted 25 lines

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (4):
dt-bindings: leds: Add a binding for AXP813 charger led
leds: axp20x: Support charger LED on AXP20x like PMICs
ARM: dts: axp813: Add charger LED
ARM: dts: sun8i-a83t-tbs-a711: Enable charging LED

 .../devicetree/bindings/leds/leds-axp20x.yaml |  24 ++
 arch/arm/boot/dts/axp81x.dtsi                 |   5 +
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts     |   4 +
 drivers/leds/Kconfig                          |   7 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/leds-axp20x.c                    | 240 ++++++++++++++++++
 drivers/mfd/axp20x.c                          |   3 +
 7 files changed, 284 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.yaml
 create mode 100644 drivers/leds/leds-axp20x.c
Signature · 1 line
2.25.1
#11 lore raw
Quoted 11 lines · megous hlavni
Quoted 4 lines · megous hlavni

The tablet has a charger LED exposed on the top. This LED is controlled by AXP813 PMIC. Add support for enabling the LED and using it either for charging indication (handled by PMIC automatically) or for other uses via user control.

Dang, I just noticed someone sent a similar driver recently, although I had this one prepared for quite some time (since 2017) in my tree. I guess I should have sent it earlier.

Please ignore.

Though the meaning of "recently" is a bit relative. The other work was sent in a year ago. Here's a reference:

https://lore.kernel.org/patchwork/cover/1042764/

Quoted 29 lines

regards,

	o.
Quoted 25 lines

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (4):
dt-bindings: leds: Add a binding for AXP813 charger led
leds: axp20x: Support charger LED on AXP20x like PMICs
ARM: dts: axp813: Add charger LED
ARM: dts: sun8i-a83t-tbs-a711: Enable charging LED

 .../devicetree/bindings/leds/leds-axp20x.yaml |  24 ++
 arch/arm/boot/dts/axp81x.dtsi                 |   5 +
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts     |   4 +
 drivers/leds/Kconfig                          |   7 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/leds-axp20x.c                    | 240 ++++++++++++++++++
 drivers/mfd/axp20x.c                          |   3 +
 7 files changed, 284 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.yaml
 create mode 100644 drivers/leds/leds-axp20x.c
Signature · 1 line
2.25.1
#12 lore raw
Quoted 10 lines · Ondřej Jirman
Quoted 9 lines · megous hlavni
Quoted 4 lines · megous hlavni

The tablet has a charger LED exposed on the top. This LED is controlled by AXP813 PMIC. Add support for enabling the LED and using it either for charging indication (handled by PMIC automatically) or for other uses via user control.

Dang, I just noticed someone sent a similar driver recently, although I had this one prepared for quite some time (since 2017) in my tree. I guess I should have sent it earlier.

Quoted 5 lines
Quoted 1 line

Please ignore.

Though the meaning of "recently" is a bit relative. The other work was sent in a year ago. Here's a reference:

   https://lore.kernel.org/patchwork/cover/1042764/

Hi,

I'm the author of the 'other' work. I don't know the full story here, but I don't mind someone else submitting this patch as his.

When I submitted the last patch, there was the proposal to use the ledtrig-pattern instead of sysfs entries. Also AXP209 has inverted CTRL bit.

Please read the the 'other' discussion.

Best regards,
Stefan Mavrodiev

Quoted 30 lines
Quoted 30 lines

regards,

	o.
Quoted 25 lines

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (4):
dt-bindings: leds: Add a binding for AXP813 charger led
leds: axp20x: Support charger LED on AXP20x like PMICs
ARM: dts: axp813: Add charger LED
ARM: dts: sun8i-a83t-tbs-a711: Enable charging LED

  .../devicetree/bindings/leds/leds-axp20x.yaml |  24 ++
  arch/arm/boot/dts/axp81x.dtsi                 |   5 +
  arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts     |   4 +
  drivers/leds/Kconfig                          |   7 +
  drivers/leds/Makefile                         |   1 +
  drivers/leds/leds-axp20x.c                    | 240 ++++++++++++++++++
  drivers/mfd/axp20x.c                          |   3 +
  7 files changed, 284 insertions(+)

create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.yaml create mode 100644 drivers/leds/leds-axp20x.c

Signature · 1 line
2.25.1
#13 lore raw
Quoted 16 lines · Stefan Mavrodiev
Quoted 14 lines · Ondřej Jirman
Quoted 10 lines · megous hlavni
Quoted 4 lines · megous hlavni

The tablet has a charger LED exposed on the top. This LED is controlled by AXP813 PMIC. Add support for enabling the LED and using it either for charging indication (handled by PMIC automatically) or for other uses via user control.

Dang, I just noticed someone sent a similar driver recently, although I had this one prepared for quite some time (since 2017) in my tree. I guess I should have sent it earlier.

Please ignore.

Though the meaning of "recently" is a bit relative. The other work was sent in a year ago. Here's a reference:

Quoted 7 lines
Quoted 1 line
   https://lore.kernel.org/patchwork/cover/1042764/

Hi,

I'm the author of the 'other' work. I don't know the full story here, but I don't
mind someone else submitting this patch as his.

Hello Stefan,

There's really no story. Just me being a bit anoyed at myself, for not checking the mailing lists prior to spending some time cleaning up and extending some old patches to upstream them, and wasting quite a bit of time in the process.

https://megous.com/git/linux/commit/?h=linux-tbs&id=737eec64565d328cab98b75879e3f9eb1cf2f609

Quoted 5 lines

When I submitted the last patch, there was the proposal to use the ledtrig-pattern instead
of sysfs entries. Also AXP209 has inverted CTRL bit.

Please read the the 'other' discussion.

Thanks, I'll check it out.

regards,

	o.
Quoted 38 lines

Best regards,
Stefan Mavrodiev

Quoted 27 lines
Quoted 27 lines

regards,

	o.
Quoted 22 lines

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (4):
dt-bindings: leds: Add a binding for AXP813 charger led
leds: axp20x: Support charger LED on AXP20x like PMICs
ARM: dts: axp813: Add charger LED
ARM: dts: sun8i-a83t-tbs-a711: Enable charging LED

  .../devicetree/bindings/leds/leds-axp20x.yaml |  24 ++
  arch/arm/boot/dts/axp81x.dtsi                 |   5 +
  arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts     |   4 +
  drivers/leds/Kconfig                          |   7 +
  drivers/leds/Makefile                         |   1 +
  drivers/leds/leds-axp20x.c                    | 240 ++++++++++++++++++
  drivers/mfd/axp20x.c                          |   3 +
  7 files changed, 284 insertions(+)

create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.yaml create mode 100644 drivers/leds/leds-axp20x.c

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.25.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel