Re: [PATCH 2/2] leds: lp5024: Add the LP5024/18 RGB LED driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jacek,

On 04/01/2019 23.37, Jacek Anaszewski wrote:
But, aside from that hypothetic issue, we need a solution for
LEDn_BRIGHTNESS feature of lp5024, i.e. setting color intensity
via a single register write. How would you propose to address that?

You could model it to something like this in device tree:

led-module @ <i2c-address> {
	compatible = "lp5024";

	// There is in hardware setup to use either linear or
	// logarithmic scaling:
	//enable-logarithmic-brightness;

	led0 {
		// this will create led instance for LED0 in lp5024
		label = "lp-led0";
		
		// This specifies LED number within lp5024
		led-index = <0>;   // set output-base as 0*3 == 0
		
		element-red {
			// refers to OUT0
			output-offset = <0>;
		};
		
		element-green {
			// refers to OUT1
			output-offset = <1>;
		};
		
		element-blue {
			// refers to OUT2
			output-offset = <2>;
		};
		
	};	

	led1 {
		// this will create led instance for LED1 in lp5024
		label = "lp-led1";
		
		// This specifies LED number within lp5024
		led-index = <1>;   // set output-base as 1*3 == 3

		element-red {
			// refers to OUT3
			output-offset = <0>;
		};
		
		element-green {
			// refers to OUT4
			output-offset = <1>;
		};
		
		element-blue {
			// refers to OUT5
			output-offset = <2>;
		};
		
	};

	bank-led {
		// this will create led instance for bank leds in lp5024
		label = "lp-bank-led";

		// configured bank led configuration
		led-index = <2 3 4 5 6 7>;
		// As here is list of led-indices this entry is
		// assumed to be bank configuration. Bank mode is enable
		// for the indices.

		// set output-base as BANK A

		element-red {
			// refers to BANK A
			output-offset = <0>;
		};
		
		element-green {
			// refers to BANK B
			output-offset = <1>;
		};
		
		element-blue {
			// refers to BANK C
			output-offset = <2>;
		};
	};	
};

This would then create three led instances and each led instance has brightness setting and that goes straight to hardware.

If one would want to override hardware control for brightness then I suppose you would define in led node something like:

	brightness-model = "hsl"

This would then pick red, green and blue elements for hsl calculations and others color elements for linear. LED specific hardware brightness would then be either 0 or 0xFF depending if all of LED color elements are zero or not.

Would that kind of model work?

Thanks,
Vesa Jääskeläinen



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux