Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Motorola Surnia Backlight Driver V2 #296

Draft
wants to merge 4 commits into
base: msm8916/6.2-rc5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions Documentation/devicetree/bindings/leds/rohm,bd65b60.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/rohm,bd65b60.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: ROHM BD65B60 LED driver

maintainers:
- Bogdan Ionescu <[email protected]>

description: |
BD65B60 is a white LED driver IC that integrates PWM
step-up DC/DC converter with boost-capability of up to
maximum 28.5V and current driver with drive capability of up
to 25mA(Typ.) maximum setting. Precise brightness can be
controlled at wide ranges through the external PWM pulse
input.

properties:
compatible:
const: rohm,bd65b60

reg:
maxItems: 1

led-sources:
description: Select with outputs are enabled.
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 2
items:
minimum: 1
maximum: 2

rohm,ovp-microvolt:
description:
Select Over-Voltage-Portection level in microvolts.
The only valid values are 25000000uV, 30000000uV and 35000000uV.
default: 35000000


required:
- compatible
- reg
- led-sources

additionalProperties: false

examples:
- |
#include <dt-bindings/leds/common.h>

i2c {
#address-cells = <1>;
#size-cells = <0>;

backlight@64 {
compatible = "rohm,bd65b60";
reg = <0x64>;

led-sources = <1>;
function = LED_FUNCTION_BACKLIGHT;
color = <LED_COLOR_ID_WHITE>;

rohm,ovp-microvolt = <30000000>;
};
};

...
31 changes: 31 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8916-motorola-osprey.dts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include <dt-bindings/leds/common.h>

/ {
model = "Motorola Moto G 2015 (osprey)";
Expand Down Expand Up @@ -80,6 +81,12 @@
startup-delay-us = <300>;
vin-supply = <&pm8916_l16>;
};

backlight: backlight {
compatible = "led-backlight";
leds = <&backlight_led>;
default-brightness-level = <192>;
};
};

&blsp_i2c1 {
Expand Down Expand Up @@ -125,6 +132,21 @@
regulator-active-discharge = <1>;
};
};

backlight_led: backlight@64 {
compatible = "rohm,bd65b60";
reg = <0x64>;

led-sources = <2>;
function = LED_FUNCTION_BACKLIGHT;
color = <LED_COLOR_ID_WHITE>;

default-state = "keep";
linux,default-trigger = "backlight";

pinctrl-0 = <&backlight_reset_default>;
pinctrl-names = "default";
};
};

&blsp_i2c2 {
Expand Down Expand Up @@ -172,6 +194,7 @@
compatible = "motorola,osprey-panel";
reg = <0>;

backlight = <&backlight>;
vsp-supply = <&reg_lcd_pos>;
vsn-supply = <&reg_lcd_neg>;
vddio-supply = <&reg_panel_vddio>;
Expand Down Expand Up @@ -370,6 +393,14 @@
bias-pull-up;
};

backlight_reset_default: backlight-reset-default-state {
pins = "gpio113";
function = "gpio";
drive-strength = <2>;
bias-pull-down;
output-high;
};

gpio_keys_default: gpio-keys-default-state {
pins = "gpio107";
function = "gpio";
Expand Down
36 changes: 35 additions & 1 deletion arch/arm64/boot/dts/qcom/msm8916-motorola-surnia.dts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/leds/common.h>

/ {
model = "Motorola Moto E 2015 LTE (surnia)";
Expand Down Expand Up @@ -57,6 +58,31 @@
pinctrl-1 = <&usb_id_sleep>;
pinctrl-names = "default", "sleep";
};

BogdanTheGeek marked this conversation as resolved.
Show resolved Hide resolved
backlight: backlight {
compatible = "led-backlight";
leds = <&backlight_led>;
default-brightness-level = <192>;
};
};

&blsp_i2c1 {
status = "okay";

backlight_led: led-controller@64 {
compatible = "rohm,bd65b60";
reg = <0x64>;

led-sources = <1>;
function = LED_FUNCTION_BACKLIGHT;
color = <LED_COLOR_ID_WHITE>;

default-state = "keep";
linux,default-trigger = "backlight";

pinctrl-0 = <&backlight_reset_default>;
pinctrl-names = "default";
};
};

&blsp_i2c2 {
Expand Down Expand Up @@ -124,7 +150,7 @@
panel@0 {
compatible = "motorola,surnia-panel";
reg = <0>;

backlight = <&backlight>;
power-supply = <&pm8916_l17>;
reset-gpios = <&msmgpio 78 GPIO_ACTIVE_LOW>;

Expand Down Expand Up @@ -320,6 +346,14 @@
bias-pull-up;
};

backlight_reset_default: backlight-reset-default-state {
pins = "gpio36";
function = "gpio";
drive-strength = <2>;
bias-pull-down;
output-high;
};

gpio_keys_default: gpio-keys-default-state {
pins = "gpio107";
function = "gpio";
Expand Down
11 changes: 11 additions & 0 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,17 @@ config LEDS_BLINKM
This option enables support for the BlinkM RGB LED connected
through I2C. Say Y to enable support for the BlinkM LED.

config LEDS_BD65B60
tristate "LED Driver for BD65B60"
depends on LEDS_CLASS
depends on I2C
help
If you have a LCD backlight connected to the ROHM BD65B60,
say Y here to enable this driver.

To compile this driver as a module, choose M here: the module will
be called leds-bd65b60.

config LEDS_POWERNV
tristate "LED support for PowerNV Platform"
depends on LEDS_CLASS
Expand Down
1 change: 1 addition & 0 deletions drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o
obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o
obj-$(CONFIG_LEDS_BCM6358) += leds-bcm6358.o
obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o
obj-$(CONFIG_LEDS_BD65B60) += leds-bd65b60.o
obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o
obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o
obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o
Expand Down
Loading