blob: e9c5061e57fa367cb6cce0e1f50875626e51e196 [file] [log] [blame]
Qualcomm QPNP Leds
QPNP (Qualcomm Plug N Play) LEDs driver is used for
controlling LEDs that are part of PMIC on Qualcomm reference
platforms. The PMIC is connected to Host processor via
SPMI bus. This driver supports various LED modules such as
Keypad backlight, WLED (white LED), RGB LED and flash LED.
Each LED module is represented as a node of "leds-qpnp". This
node will further contain the type of LED supported and its
properties. At least one child node is required for each LED
module. Each must have the required properties below, in addition
to the properties for the LED type, WLED, Flash or RGB.
Required properties for each child node, WLED, Flash and RGB:
- compatible : should be "qcom,leds-qpnp"
- qcom,id : must be one of values supported in enum qpnp_led
- label : type of led that will be used, ie "wled"
- qcom,max-current : maximum current that the LED can sustain
- linux,name : name of the led that is used in led framework
WLED is primarily used as display backlight. Display subsystem uses
LED triggers for WLED to control the brightness as needed.
Optional properties for WLED:
- qcom,num-strings: number of wled strings supported
- qcom,ovp-val: over voltage protection threshold,
follows enum wled_ovp_threshold
- qcom,boost-curr-lim: boot currnet limit, follows enum wled_current_bost_limit
- qcom,ctrl-delay-us: delay in activation of led
- qcom,dig-mod-gen-en: digital module generator
- qcom,cs-out-en: current sink output enable
- qcom,op-fdbck: selection of output as feedback for the boost, 00 = automatic selection, 01 = select LED1 output, 02 = select LED2 output, 03 = select LED3 output
- qcom,cp-select: high pole capacitance
- linux,default-trigger: trigger the led from external modules such as display
- qcom,default-state: default state of the led, should be "on" or "off"
Flash is used primarily as a camera or video flash.
Optional properties for flash:
- qcom,headroom: headroom to use, mV
- qcom,duration: duration of the flash, ms
- qcom,clamp-curr: current to clamp at, mA
- qcom,startup-dly: delay before flashing after flash executed, us
- qcom,saftey-timer: include for safety timer use, otherwise watchdog timer will be used
- linux,default-trigger: trigger the led from external modules such as display
- qcom,default-state: default state of the led, should be "on" or "off"
- qcom,torch-enable: set flash led to torch mode
- flash_boost-supply: SMBB regulator for LED flash mode
RGB Led is a tri-colored led, Red, Blue & Green.
Required properties for RGB led:
- qcom,mode: mode the led should operate in, options "pwm" and "lpg"
- qcom,pwm-channel: pwm channel the led will operate on
Required properties for PWM mode only:
- qcom,pwm-us: time the pwm device will modulate at (us)
Required properties for LPG mode only:
- qcom,duty-pcts: array of values for duty cycle to go through
- qcom,start-idx: starting point duty-pcts array
Optional properties for LPG mode only:
- qcom,pause-lo: pause at low end of cycle
- qcom,pause-hi: pause at high end of cycle
- qcom,ramp-step-ms: step between each cycle (ms)
- qcom,lut-flags: flags to be used in lut configuration
Optional properties for RGB led:
- linux,default-trigger: trigger the led from external modules such as display
- qcom,default-state: default state of the led, should be "on" or "off"
- qcom,turn-off-delay-ms: delay in millisecond for turning off the led when its default-state is "on". Value is being ignored in case default-state is "off".
- qcom,use-blink: Use blink sysfs entry for switching into lpg mode. For optimal use, set default mode to pwm. All required lpg parameters must be supplied.
MPP LED is an LED controled through a Multi Purpose Pin.
Optional properties for MPP LED:
- linux,default-trigger: trigger the led from external modules such as display
- qcom,default-state: default state of the led, should be "on" or "off"
- qcom,source-sel: select power source, default 1 (enabled)
- qcom,mode-ctrl: select operation mode, default 0x60 = Mode Sink
- qcom,mode: mode the led should operate in, options "pwm", "lpg" and "manual"
- qcom,vin-ctrl: select input source, supported values are 0 to 3
- qcom,use-blink: Use blink sysfs entry for switching into lpg mode. For optimal use, set default mode to pwm. All required lpg parameters must be supplied.
- qcom,min-brightness - Lowest possible brightness supported on this LED other than 0.
Required properties for PWM mode only:
- qcom,pwm-channel: pwm channel the led will operate on
- qcom,pwm-us: time the pwm device will modulate at (us)
Required properties for LPG mode only:
- qcom,pwm-channel: pwm channel the led will operate on
- qcom,duty-pcts: array of values for duty cycle to go through
- qcom,start-idx: starting point duty-pcts array
Optional properties for LPG mode only:
- qcom,pause-lo: pause at low end of cycle
- qcom,pause-hi: pause at high end of cycle
- qcom,ramp-step-ms: step between each cycle (ms)
- qcom,lut-flags: flags to be used in lut configuration
Keypad backlight is a backlight source for buttons. It supports four rows
and the required rows are enabled by specifying values in the properties.
Required properties for keypad backlight:
- qcom,mode: mode the led should operate in, options "pwm" and "lpg"
- qcom,pwm-channel: pwm channel the led will operate on
- qcom,pwm-us: time the pwm device will modulate at (us)
- qcom,row-src-sel-val: select source for rows. One bit is used for each row.
Specify 0 for vph_pwr and 1 for vbst for each row.
- qcom,row-scan-val: select rows for scanning
- qcom,row-scan-en: row scan enable
Required properties for PWM mode only:
- qcom,pwm-us: time the pwm device will modulate at (us)
Required properties for LPG mode only:
- qcom,duty-pcts: array of values for duty cycle to go through
- qcom,start-idx: starting point duty-pcts array
Optional properties for LPG mode only:
- qcom,pause-lo: pause at low end of cycle
- qcom,pause-hi: pause at high end of cycle
- qcom,ramp-step-ms: step between each cycle (ms)
- qcom,lut-flags: flags to be used in lut configuration
Example:
qcom,leds@a200 {
status = "okay";
qcom,led_mpp_3 {
label = "mpp";
linux,name = "wled-backlight";
linux-default-trigger = "none";
qcom,default-state = "on";
qcom,max-current = <40>;
qcom,id = <6>;
qcom,source-sel = <1>;
qcom,mode-ctrl = <0x10>;
qcom,vin-ctrl = <0x03>;
qcom,min-brightness = <20>;
};
};
qcom,leds@a300 {
status = "okay";
qcom,led_mpp_pwm {
label = "mpp";
linux,name = "green";
linux,default-trigger = "none";
qcom,default-state = "off";
qcom,max-current = <40>;
qcom,current-setting = <5>;
qcom,id = <6>;
qcom,mode = "pwm";
qcom,source-sel = <8>;
qcom,mode-ctrl = <0x60>;
qcom,pwm-channel = <0>;
qcom,pwm-us = <1000>;
};
};
qcom,leds@d000 {
status = "okay";
qcom,rgb_pwm {
label = "rgb";
linux,name = "led:rgb_red";
qcom,mode = "pwm";
qcom,pwm-us = <1000>;
qcom,pwm-channel = <6>;
qcom,max-current = <12>;
qcom,default-state = "off";
qcom,id = <3>;
linux,default-trigger =
"battery-charging";
};
qcom,rgb_lpg {
label = "rgb";
linux,name = "led:rgb_green";
qcom,mode = "lpg";
qcom,pwm-channel = <5>;
qcom,duty-ms = <20>;
qcom,start-idx = <1>;
qcom,idx-len = <10>;
qcom,duty-pcts = [00 19 32 4B 64
64 4B 32 19 00];
qcom,max-current = <12>;
qcom,default-state = "off";
qcom,id = <3>;
linux,default-trigger =
"battery-charging";
};
qcom,rgb_blink {
label = "rgb";
linux,name = "led:rgb_blue";
qcom,mode = "pwm";
qcom,pwm-channel = <4>;
qcom,start-idx = <1>;
qcom,idx-len = <10>;
qcom,duty-pcts = [00 19 32 4B 64
64 4B 32 19 00];
qcom,lut-flags = <3>;
qcom,pause-lo = <0>;
qcom,pause-hi = <0>;
qcom,ramp-step-ms = <255>;
qcom,max-current = <12>;
qcom,default-state = "on";
qcom,turn-off-delay-ms = <500>;
qcom,id = <5>;
linux,default-trigger = "none";
qcom,pwm-us = <1000>;
qcom,use-blink;
};
};
qcom,leds@d300 {
compatible = "qcom,leds-qpnp";
status = "okay";
flash_boost-supply = <&pm8941_chg_boost>;
qcom,flash_0 {
qcom,max-current = <1000>;
qcom,default-state = "off";
qcom,headroom = <0>;
qcom,duration = <200>;
qcom,clamp-curr = <200>;
qcom,startup-dly = <1>;
qcom,safety-timer;
label = "flash";
linux,default-trigger =
"flash0_trigger";
linux,name = "led:flash_0";
qcom,current = <625>;
qcom,id = <1>;
};
};
qcom,leds@d800 {
compatible = "qcom,leds-qpnp";
status = "okay";
qcom,wled_0 {
linux,default-trigger = "bkl-trigger"
label = "wled";
qcom,cs-out-en;
qcom,op-fdbck = <1>;
qcom,default-state "off";
qcom,max-current = <25>;
qcom,ctrl-delay-us = <0>;
qcom,boost-curr-lim = <3>;
qcom,cp-sel = <0>;
qcom,switch-freq = <2>;
qcom,ovp-val = <2>;
qcom,num-strings = <1>;
qcom,id = <0>;
linux,name = "led:wled_backlight";
};
};
qcom,leds@e200 {
status = "okay";
qcom,kpdbl {
label = "kpdbl";
linux,name = "button-backlight";
qcom,mode = <0>;
qcom,pwm-channel = <8>;
qcom,pwm-us = <1000>;
qcom,id = <7>;
qcom,max-current = <20>;
qcom,row-src-sel-val = <0x00>;
qcom,row-scan-en = <0x01>;
qcom,row-scan-val = <0x01>;
};
};