Skip to contentSkip to conversation

leds: driver for O2 Micro LED IC

PATCH In review [email protected] 4 participants 6 messages Nov 6, 2024 – Nov 8, 2024

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

PATCH 1/1 leds: driver for O2 Micro LED IC

From: Anish Kumar <[email protected]>

LED Driver for O2 Micro LED IC

---
 .../devicetree/bindings/leds/leds-ozl003.txt  |  23 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 drivers/leds/Kconfig                          |   6 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/leds-ozl003.c                    | 306 ++++++++++++++++++
 5 files changed, 338 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-ozl003.txt
 create mode 100644 drivers/leds/leds-ozl003.c
Documentation/devicetree/bindings/leds/leds-ozl003.txt new file +23 -0
new file mode 100644
index 000000000000..9dbd78ed1093
@@ -0,0 +1,23 @@
+*O2 Micro Compact LED Strobe Light Controller
+
+Compact LED strobe light controller, can be controlled by I2C or via a
+PWM gpio controlled.
+
+Required properties:
+- compatible : "o2micro,ozl003"
+- #address-cells: must be 1
+- #size-cells: must be 0
+- reg: I2C slave address. depends on the model.
+
+Optional properties:
+- gpio-mode: if set then controlled via gpio
+
+Examples:
+
+irled: ozl003@4b {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+	compatible = "o2micro,ozl003";
+	reg = <0x4B>;
+};
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index f6064d84a424..06453649c0e7 100644
@@ -796,6 +796,8 @@ patternProperties:
     description: NVIDIA
   "^nxp,.*":
     description: NXP Semiconductors
+  "^o2micro,.*":
+    description: O2Micro Ltd.
   "^oceanic,.*":
     description: Oceanic Systems (UK) Ltd.
   "^oct,.*":
drivers/leds/Kconfig +6 -0
index b6742b4231bf..ddc5bc0886af 100644
@@ -732,6 +732,12 @@ config LEDS_OT200
 	  This option enables support for the LEDs on the Bachmann OT200.
 	  Say Y to enable LEDs on the Bachmann OT200.
 
+config LEDS_OZL003
+	tristate "O2 Micro OZL003 Compact LED Strobe Light Controller"
+	depends on LEDS_CLASS && I2C
+	help
+	  This option enables support for O2 Micro LED IC.
+
 config LEDS_MENF21BMC
 	tristate "LED support for the MEN 14F021P00 BMC"
 	depends on LEDS_CLASS && MFD_MENF21BMC
drivers/leds/Makefile +1 -0
index 2a698df9da57..b89c8747466d 100644
@@ -73,6 +73,7 @@ obj-$(CONFIG_LEDS_NETXBIG)		+= leds-netxbig.o
 obj-$(CONFIG_LEDS_NIC78BX)		+= leds-nic78bx.o
 obj-$(CONFIG_LEDS_NS2)			+= leds-ns2.o
 obj-$(CONFIG_LEDS_OT200)		+= leds-ot200.o
+obj-$(CONFIG_LEDS_OZL003)		+= leds-ozl003.o
 obj-$(CONFIG_LEDS_PCA9532)		+= leds-pca9532.o
 obj-$(CONFIG_LEDS_PCA955X)		+= leds-pca955x.o
 obj-$(CONFIG_LEDS_PCA963X)		+= leds-pca963x.o
drivers/leds/leds-ozl003.c new file +306 -0

306 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 9 lines · On 06/11/2024 02:54, [email protected] wrote:

From: Anish Kumar <[email protected]>

LED Driver for O2 Micro LED IC

---
 .../devicetree/bindings/leds/leds-ozl003.txt  |  23 ++

1. Please run scripts/checkpatch.pl and fix reported warnings. Then please run scripts/checkpatch.pl --strict and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

2. No bindings in TXT. They must com ine DT schema. It is no 2017 anymore. Please reach to your colleagues in Amazon for some internal guidance on upstreaming. Such big companies should perform basic internal review instead of asking community to explain that basic stuff.

3. Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries.

...

drivers/leds/leds-ozl003.c line 291

Quoted 4 lines
drivers/leds/leds-ozl003.c new file +4 -0
+
+static struct i2c_driver ozl003_driver = {
+	.driver = {
+		.owner = THIS_MODULE,

Please do no send downstream, junk code. This was fixed years ago.

Quoted 8 lines
drivers/leds/leds-ozl003.c new file +8 -0
+		.name = "ozl003",
+		.of_match_table = ozl003_match_table,
+	},
+	.id_table = ozl003_id,
+	.probe = ozl003_probe,
+	.remove = ozl003_remove,
+};
+

...

drivers/leds/leds-ozl003.c line 306

Quoted 2 lines
drivers/leds/leds-ozl003.c new file +2 -0
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:ozl003-led");

Drop as well. Useless or incorrect.

Best regards,
Krzysztof

#2 lore raw
Quoted 12 lines · Krzysztof Kozlowski
Quoted 9 lines · On 06/11/2024 02:54, [email protected] wrote:

From: Anish Kumar <[email protected]>

LED Driver for O2 Micro LED IC

---
 .../devicetree/bindings/leds/leds-ozl003.txt  |  23 ++
Quoted 5 lines

1. Please run scripts/checkpatch.pl and fix reported warnings. Then please run scripts/checkpatch.pl --strict and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

It was run on the code but not on this text file. Missed that.

Quoted 5 lines

2. No bindings in TXT. They must com ine DT schema. It is no 2017 anymore. Please reach to your colleagues in Amazon for some internal guidance on upstreaming. Such big companies should perform basic internal review instead of asking community to explain that basic stuff.

Will convert this to YAML and send.

Quoted 5 lines

3. Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

We did but our mistake is we cloned the wrong git, we cloned
git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git

Quoted 7 lines

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

./get_maintainers returned wrong values because of wrong tree.

Quoted 4 lines

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

will add that.

Quoted 2 lines

Please kindly resend and include all necessary To/Cc entries.

Will do. Thanks for review.

Quoted 6 lines

...

Quoted 6 lines

drivers/leds/leds-ozl003.c line 291

Quoted 4 lines
drivers/leds/leds-ozl003.c new file +4 -0
+
+static struct i2c_driver ozl003_driver = {
+     .driver = {
+             .owner = THIS_MODULE,

Please do no send downstream, junk code. This was fixed years ago.

ok.

Quoted 12 lines
Quoted 9 lines
drivers/leds/leds-ozl003.c new file +8 -0
+             .name = "ozl003",
+             .of_match_table = ozl003_match_table,
+     },
+     .id_table = ozl003_id,
+     .probe = ozl003_probe,
+     .remove = ozl003_remove,
+};
+

...

Quoted 4 lines

drivers/leds/leds-ozl003.c line 306

Quoted 2 lines
drivers/leds/leds-ozl003.c new file +2 -0
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:ozl003-led");

Drop as well. Useless or incorrect.

ok.

Quoted 4 lines

Best regards,
Krzysztof

#3 lore raw
In reply to [email protected]

Hi!

Documentation/devicetree/bindings/leds/leds-ozl003.txt line 7

Quoted 9 lines

+++ b/Documentation/devicetree/bindings/leds/leds-ozl003.txt

Documentation/devicetree/bindings/leds/leds-ozl003.txt new file +7 -0
@@ -0,0 +1,23 @@
+*O2 Micro Compact LED Strobe Light Controller
+
+Compact LED strobe light controller, can be controlled by I2C or via a
+PWM gpio controlled.
+
+Required properties:
+- compatible : "o2micro,ozl003"

o2micro needs to be registered as a prefix somewhere.

Best regards,
Pavel

Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
#4 lore raw
Quoted 14 lines · Pavel Machek

Hi!

Documentation/devicetree/bindings/leds/leds-ozl003.txt line 7

Quoted 9 lines

+++ b/Documentation/devicetree/bindings/leds/leds-ozl003.txt

Documentation/devicetree/bindings/leds/leds-ozl003.txt new file +7 -0
@@ -0,0 +1,23 @@
+*O2 Micro Compact LED Strobe Light Controller
+
+Compact LED strobe light controller, can be controlled by I2C or via a
+PWM gpio controlled.
+
+Required properties:
+- compatible : "o2micro,ozl003"

o2micro needs to be registered as a prefix somewhere.

Wondering if adding hereDocumentation/devicetree/bindings/vendor-prefixes.yaml not sufficient? I added that in the same patch though, I guess
I will have to split the patch to add that first and then the driver.

Quoted 5 lines

Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.

#5 lore raw
Quoted 16 lines · anish kumar
Quoted 14 lines · Pavel Machek

Hi!

Documentation/devicetree/bindings/leds/leds-ozl003.txt line 7

Quoted 9 lines

+++ b/Documentation/devicetree/bindings/leds/leds-ozl003.txt

Documentation/devicetree/bindings/leds/leds-ozl003.txt new file +7 -0
@@ -0,0 +1,23 @@
+*O2 Micro Compact LED Strobe Light Controller
+
+Compact LED strobe light controller, can be controlled by I2C or via a
+PWM gpio controlled.
+
+Required properties:
+- compatible : "o2micro,ozl003"

o2micro needs to be registered as a prefix somewhere.

Quoted 4 lines

Wondering if adding hereDocumentation/devicetree/bindings/vendor-prefixes.yaml not sufficient? I added that in the same patch though, I guess
I will have to split the patch to add that first and then the driver.

Doing that in same patch is ok, sorry if I missed that.

BR,
Pavel

Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.