diff options
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | drivers/video/backlight/Makefile | 1 | ||||
-rw-r--r-- | drivers/video/backlight/ili922x.c | 3 | ||||
-rw-r--r-- | drivers/video/backlight/pwm_bl.c | 7 | ||||
-rw-r--r-- | drivers/video/backlight/tps65217_bl.c | 17 |
4 files changed, 11 insertions, 17 deletions
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 8905129691e8..5e28f01c8391 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # Backlight & LCD drivers obj-$(CONFIG_LCD_AMS369FG06) += ams369fg06.o diff --git a/drivers/video/backlight/ili922x.c b/drivers/video/backlight/ili922x.c index a9e9cef20ed6..2b6c6aaf4e14 100644 --- a/drivers/video/backlight/ili922x.c +++ b/drivers/video/backlight/ili922x.c @@ -251,7 +251,7 @@ static int ili922x_write(struct spi_device *spi, u8 reg, u16 value) struct spi_transfer xfer_regindex, xfer_regvalue; unsigned char tbuf[CMD_BUFSIZE]; unsigned char rbuf[CMD_BUFSIZE]; - int ret, len = 0; + int ret; memset(&xfer_regindex, 0, sizeof(struct spi_transfer)); memset(&xfer_regvalue, 0, sizeof(struct spi_transfer)); @@ -273,7 +273,6 @@ static int ili922x_write(struct spi_device *spi, u8 reg, u16 value) ret = spi_sync(spi, &msg); spi_message_init(&msg); - len = 0; tbuf[0] = set_tx_byte(START_BYTE(ili922x_id, START_RS_REG, START_RW_WRITE)); tbuf[1] = set_tx_byte((value & 0xFF00) >> 8); diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 9bd17682655a..1c2289ddd555 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -79,14 +79,17 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness) { unsigned int lth = pb->lth_brightness; - int duty_cycle; + u64 duty_cycle; if (pb->levels) duty_cycle = pb->levels[brightness]; else duty_cycle = brightness; - return (duty_cycle * (pb->period - lth) / pb->scale) + lth; + duty_cycle *= pb->period - lth; + do_div(duty_cycle, pb->scale); + + return duty_cycle + lth; } static int pwm_backlight_update_status(struct backlight_device *bl) diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c index fd524ad860a5..380917c86276 100644 --- a/drivers/video/backlight/tps65217_bl.c +++ b/drivers/video/backlight/tps65217_bl.c @@ -239,8 +239,7 @@ tps65217_bl_parse_dt(struct platform_device *pdev) } if (!of_property_read_u32(node, "default-brightness", &val)) { - if (val < 0 || - val > 100) { + if (val > 100) { dev_err(&pdev->dev, "invalid 'default-brightness' value in the device tree\n"); err = ERR_PTR(-EINVAL); @@ -275,17 +274,9 @@ static int tps65217_bl_probe(struct platform_device *pdev) struct tps65217_bl_pdata *pdata; struct backlight_properties bl_props; - if (tps->dev->of_node) { - pdata = tps65217_bl_parse_dt(pdev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - } else { - pdata = dev_get_platdata(&pdev->dev); - if (!pdata) { - dev_err(&pdev->dev, "no platform data provided\n"); - return -EINVAL; - } - } + pdata = tps65217_bl_parse_dt(pdev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl), GFP_KERNEL); |