Skip to contentSkip to conversation

N900 flashlight

crazy hacks Pavel Machek 1 participant 1 message Sep 15, 2017

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

Hi!

This adds /sys interface to n900 flash. So you can do stuff...

/sys/class/leds/led-controller:flash# echo 0 > ../led-controller\:indicator/brightness

Needs _way_ more work. Also... contains way too much boilerplate, see leds-flash.c . We'll need to figure out how to share more code between drivers.

GPL.

Best regards,

Pavel

arch/arm/boot/dts/omap3-n900.dts +7 -2
index c4e8de7..1b88494 100644
@@ -618,16 +618,21 @@
 	};
 
 	adp1653: led-controller at 30 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+	
 		compatible = "adi,adp1653";
 		reg = <0x30>;
 		enable-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; /* 88 */
 
-		flash {
+		adp_flash: flash at 0 {
+		        reg = <0x0>;
 			flash-timeout-us = <500000>;
 			flash-max-microamp = <320000>;
 			led-max-microamp = <50000>;
 		};
-		indicator {
+		adp_indicator: indicator at 1 {
+		        reg = <0x1>;
 			led-max-microamp = <17500>;
 		};
 	};
drivers/leds/Makefile +3 -0
index b7af41e..78bbcbf 100644
@@ -7,6 +7,9 @@ obj-$(CONFIG_LEDS_CLASS)		+= led-class.o
 obj-$(CONFIG_LEDS_CLASS_FLASH)		+= led-class-flash.o
 obj-$(CONFIG_LEDS_TRIGGERS)		+= led-triggers.o
 
+obj-$(CONFIG_LEDS_CLASS_FLASH) 		+= leds-flash.o
+obj-y					+= leds-adp1653.o
+
 # LED Platform Drivers
 obj-$(CONFIG_LEDS_88PM860X)		+= leds-88pm860x.o
 obj-$(CONFIG_LEDS_AAT1290)		+= leds-aat1290.o
drivers/leds/leds-adp1653.c new file +756 -0

756 lines not on this page · raw message

drivers/leds/leds-flash.c new file +620 -0

620 lines not on this page · raw message

Signature · 9 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170915/16d37d95/attachment-0001.sig>