Skip to content

Commit

Permalink
Merge tag 'backlight-next-4.18' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/lee/backlight

Pull backlight updates from Lee Jones:
 "Core Frameworks
   - Provide helpers to enable/disable backlight
   - Provide standard and devres versions OF find helpers

  New Drivers:
   - Add support for the Zodiac Inflight Innovations RAVE Supervisory
     Processor

  New Functionality:
   - Allow pwm-on/pwm-off delay to be specified via DT

  Bug Fixes:
   - Fix ordering of the power {en,dis}able and PWM {en,dis}able
     signals
   - Fix Device Tree node look-up"

* tag 'backlight-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
  backlight: as3711_bl: Fix Device Tree node leaks
  backlight: tps65217_bl: Fix Device Tree node lookup
  backlight: max8925_bl: Fix Device Tree node lookup
  backlight: as3711_bl: Fix Device Tree node lookup
  MAINTAINERS: Add dri-devel for backlight subsystem patches
  backlight: Nuke BL_CORE_DRIVER1
  staging: fbtft: Stop using BL_CORE_DRIVER1
  backlight: pandora: Stop using BL_CORE_DRIVER1
  backlight: generic-bl: Remove DRIVER1 state
  backlight: Nuke unused backlight.props.state states
  backlight: otm3225a: Add support for ORISE OTM3225A LCD SoC
  backlight: pwm_bl: Don't use GPIOF_* with gpiod_get_direction
  pwm-backlight: Add support for PWM delays proprieties.
  dt-bindings: pwm-backlight: Add PWM delay proprieties.
  pwm-backlight: Enable/disable the PWM before/after LCD enable toggle.
  dt-bindings: backlight: Add binding for RAVE SP backlight driver
  backlight: Add RAVE SP backlight driver
  • Loading branch information
torvalds committed Jun 11, 2018
2 parents 883cad5 + d5318d3 commit 0f105cf
Show file tree
Hide file tree
Showing 19 changed files with 466 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Optional properties:
"pwms" property (see PWM binding[0])
- enable-gpios: contains a single GPIO specifier for the GPIO which enables
and disables the backlight (see GPIO binding[1])
- post-pwm-on-delay-ms: Delay in ms between setting an initial (non-zero) PWM
and enabling the backlight using GPIO.
- pwm-off-delay-ms: Delay in ms between disabling the backlight using GPIO
and setting PWM value to 0.

[0]: Documentation/devicetree/bindings/pwm/pwm.txt
[1]: Documentation/devicetree/bindings/gpio/gpio.txt
Expand All @@ -32,4 +36,6 @@ Example:

power-supply = <&vdd_bl_reg>;
enable-gpios = <&gpio 58 0>;
post-pwm-on-delay-ms = <10>;
pwm-off-delay-ms = <10>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Zodiac Inflight Innovations RAVE Supervisory Processor Backlight Bindings

RAVE SP backlight device is a "MFD cell" device corresponding to
backlight functionality of RAVE Supervisory Processor. It is expected
that its Device Tree node is specified as a child of the node
corresponding to the parent RAVE SP device (as documented in
Documentation/devicetree/bindings/mfd/zii,rave-sp.txt)

Required properties:

- compatible: Should be "zii,rave-sp-backlight"

Example:

rave-sp {
compatible = "zii,rave-sp-rdu1";
current-speed = <38400>;

backlight {
compatible = "zii,rave-sp-backlight";
};
}

1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,7 @@ BACKLIGHT CLASS/SUBSYSTEM
M: Lee Jones <lee.jones@linaro.org>
M: Daniel Thompson <daniel.thompson@linaro.org>
M: Jingoo Han <jingoohan1@gmail.com>
L: dri-devel@lists.freedesktop.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
S: Maintained
F: drivers/video/backlight/
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/fbtft/fbtft-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par)
static int fbtft_backlight_update_status(struct backlight_device *bd)
{
struct fbtft_par *par = bl_get_data(bd);
bool polarity = !!(bd->props.state & BL_CORE_DRIVER1);
bool polarity = par->polarity;

fbtft_par_dbg(DEBUG_BACKLIGHT, par,
"%s: polarity=%d, power=%d, fb_blank=%d\n",
Expand Down Expand Up @@ -296,7 +296,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
/* Assume backlight is off, get polarity from current state of pin */
bl_props.power = FB_BLANK_POWERDOWN;
if (!gpio_get_value(par->gpio.led[0]))
bl_props.state |= BL_CORE_DRIVER1;
par->polarity = true;

bd = backlight_device_register(dev_driver_string(par->info->device),
par->info->device, par,
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/fbtft/fbtft.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ struct fbtft_par {
ktime_t update_time;
bool bgr;
void *extra;
bool polarity;
};

#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int))
Expand Down
13 changes: 13 additions & 0 deletions drivers/video/backlight/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ config LCD_HX8357
If you have a HX-8357 LCD panel, say Y to enable its LCD control
driver.

config LCD_OTM3225A
tristate "ORISE Technology OTM3225A support"
depends on SPI
help
If you have a panel based on the OTM3225A controller
chip then say y to include a driver for it.

endif # LCD_CLASS_DEVICE

#
Expand Down Expand Up @@ -467,6 +474,12 @@ config BACKLIGHT_ARCXCNN
If you have an ARCxCnnnn family backlight say Y to enable
the backlight driver.

config BACKLIGHT_RAVE_SP
tristate "RAVE SP Backlight driver"
depends on RAVE_SP_CORE
help
Support for backlight control on RAVE SP device.

endif # BACKLIGHT_CLASS_DEVICE

endif # BACKLIGHT_LCD_SUPPORT
2 changes: 2 additions & 0 deletions drivers/video/backlight/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ obj-$(CONFIG_LCD_LD9040) += ld9040.o
obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o
obj-$(CONFIG_LCD_LMS501KF03) += lms501kf03.o
obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o
obj-$(CONFIG_LCD_OTM3225A) += otm3225a.o
obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o
obj-$(CONFIG_LCD_S6E63M0) += s6e63m0.o
obj-$(CONFIG_LCD_TDO24M) += tdo24m.o
Expand Down Expand Up @@ -57,3 +58,4 @@ obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
obj-$(CONFIG_BACKLIGHT_ARCXCNN) += arcxcnn_bl.o
obj-$(CONFIG_BACKLIGHT_RAVE_SP) += rave-sp-backlight.o
45 changes: 29 additions & 16 deletions drivers/video/backlight/as3711_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ enum as3711_bl_type {

struct as3711_bl_data {
bool powered;
const char *fb_name;
struct device *fb_dev;
enum as3711_bl_type type;
int brightness;
struct backlight_device *bl;
Expand Down Expand Up @@ -262,37 +260,41 @@ static int as3711_bl_register(struct platform_device *pdev,
static int as3711_backlight_parse_dt(struct device *dev)
{
struct as3711_bl_pdata *pdata = dev_get_platdata(dev);
struct device_node *bl =
of_find_node_by_name(dev->parent->of_node, "backlight"), *fb;
struct device_node *bl, *fb;
int ret;

bl = of_get_child_by_name(dev->parent->of_node, "backlight");
if (!bl) {
dev_dbg(dev, "backlight node not found\n");
return -ENODEV;
}

fb = of_parse_phandle(bl, "su1-dev", 0);
if (fb) {
pdata->su1_fb = fb->full_name;
of_node_put(fb);

pdata->su1_fb = true;

ret = of_property_read_u32(bl, "su1-max-uA", &pdata->su1_max_uA);
if (pdata->su1_max_uA <= 0)
ret = -EINVAL;
if (ret < 0)
return ret;
goto err_put_bl;
}

fb = of_parse_phandle(bl, "su2-dev", 0);
if (fb) {
int count = 0;

pdata->su2_fb = fb->full_name;
of_node_put(fb);

pdata->su2_fb = true;

ret = of_property_read_u32(bl, "su2-max-uA", &pdata->su2_max_uA);
if (pdata->su2_max_uA <= 0)
ret = -EINVAL;
if (ret < 0)
return ret;
goto err_put_bl;

if (of_find_property(bl, "su2-feedback-voltage", NULL)) {
pdata->su2_feedback = AS3711_SU2_VOLTAGE;
Expand All @@ -314,8 +316,10 @@ static int as3711_backlight_parse_dt(struct device *dev)
pdata->su2_feedback = AS3711_SU2_CURR_AUTO;
count++;
}
if (count != 1)
return -EINVAL;
if (count != 1) {
ret = -EINVAL;
goto err_put_bl;
}

count = 0;
if (of_find_property(bl, "su2-fbprot-lx-sd4", NULL)) {
Expand All @@ -334,8 +338,10 @@ static int as3711_backlight_parse_dt(struct device *dev)
pdata->su2_fbprot = AS3711_SU2_GPIO4;
count++;
}
if (count != 1)
return -EINVAL;
if (count != 1) {
ret = -EINVAL;
goto err_put_bl;
}

count = 0;
if (of_find_property(bl, "su2-auto-curr1", NULL)) {
Expand All @@ -355,11 +361,20 @@ static int as3711_backlight_parse_dt(struct device *dev)
* At least one su2-auto-curr* must be specified iff
* AS3711_SU2_CURR_AUTO is used
*/
if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO))
return -EINVAL;
if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO)) {
ret = -EINVAL;
goto err_put_bl;
}
}

of_node_put(bl);

return 0;

err_put_bl:
of_node_put(bl);

return ret;
}

static int as3711_backlight_probe(struct platform_device *pdev)
Expand Down Expand Up @@ -412,7 +427,6 @@ static int as3711_backlight_probe(struct platform_device *pdev)

if (pdata->su1_fb) {
su = &supply->su1;
su->fb_name = pdata->su1_fb;
su->type = AS3711_BL_SU1;

max_brightness = min(pdata->su1_max_uA, 31);
Expand All @@ -423,7 +437,6 @@ static int as3711_backlight_probe(struct platform_device *pdev)

if (pdata->su2_fb) {
su = &supply->su2;
su->fb_name = pdata->su2_fb;
su->type = AS3711_BL_SU2;

switch (pdata->su2_fbprot) {
Expand Down
5 changes: 0 additions & 5 deletions drivers/video/backlight/generic_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ static int genericbl_intensity;
static struct backlight_device *generic_backlight_device;
static struct generic_bl_info *bl_machinfo;

/* Flag to signal when the battery is low */
#define GENERICBL_BATTLOW BL_CORE_DRIVER1

static int genericbl_send_intensity(struct backlight_device *bd)
{
int intensity = bd->props.brightness;
Expand All @@ -34,8 +31,6 @@ static int genericbl_send_intensity(struct backlight_device *bd)
intensity = 0;
if (bd->props.state & BL_CORE_SUSPENDED)
intensity = 0;
if (bd->props.state & GENERICBL_BATTLOW)
intensity &= bl_machinfo->limit_mask;

bl_machinfo->set_bl_intensity(intensity);

Expand Down
4 changes: 3 additions & 1 deletion drivers/video/backlight/max8925_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static void max8925_backlight_dt_init(struct platform_device *pdev)
if (!pdata)
return;

np = of_find_node_by_name(nproot, "backlight");
np = of_get_child_by_name(nproot, "backlight");
if (!np) {
dev_err(&pdev->dev, "failed to find backlight node\n");
return;
Expand All @@ -125,6 +125,8 @@ static void max8925_backlight_dt_init(struct platform_device *pdev)
if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val))
pdata->dual_string = val;

of_node_put(np);

pdev->dev.platform_data = pdata;
}

Expand Down
Loading

0 comments on commit 0f105cf

Please sign in to comment.