Commit 4512d92b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'backlight-next-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight

Pull backlight updates from Lee Jones:
 "New Functionality:
   - Convert to GPIO descriptors

  Fix-ups:
   - Trivial: fix coding style in sky81452-backlight
   - Ensure backlight state is known on bring-up in ktd253
   - Use common platform API in qcom-wled and fbdev"

* tag 'backlight-next-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
  backlight/video: Use Platform getter/setter functions
  backlight: ktd253: Bring up in a known state
  backlight: sky81452-backlight: Convert comma to semicolon
  backlight: lms283gf05: Convert to GPIO descriptors
parents 66615c4e 0b5e0f45
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/pxa2xx_spi.h> #include <linux/spi/pxa2xx_spi.h>
#include <linux/spi/libertas_spi.h> #include <linux/spi/libertas_spi.h>
#include <linux/spi/lms283gf05.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/gpio.h> #include <linux/gpio.h>
...@@ -578,8 +577,13 @@ static struct pxa2xx_spi_chip lms283_chip_info = { ...@@ -578,8 +577,13 @@ static struct pxa2xx_spi_chip lms283_chip_info = {
.gpio_cs = GPIO88_ZIPITZ2_LCD_CS, .gpio_cs = GPIO88_ZIPITZ2_LCD_CS,
}; };
static const struct lms283gf05_pdata lms283_pdata = { static struct gpiod_lookup_table lms283_gpio_table = {
.reset_gpio = GPIO19_ZIPITZ2_LCD_RESET, .dev_id = "spi2.0", /* SPI bus 2 chip select 0 */
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO19_ZIPITZ2_LCD_RESET,
"reset", GPIO_ACTIVE_LOW),
{ },
},
}; };
static struct spi_board_info spi_board_info[] __initdata = { static struct spi_board_info spi_board_info[] __initdata = {
...@@ -595,7 +599,6 @@ static struct spi_board_info spi_board_info[] __initdata = { ...@@ -595,7 +599,6 @@ static struct spi_board_info spi_board_info[] __initdata = {
{ {
.modalias = "lms283gf05", .modalias = "lms283gf05",
.controller_data = &lms283_chip_info, .controller_data = &lms283_chip_info,
.platform_data = &lms283_pdata,
.max_speed_hz = 400000, .max_speed_hz = 400000,
.bus_num = 2, .bus_num = 2,
.chip_select = 0, .chip_select = 0,
...@@ -615,6 +618,7 @@ static void __init z2_spi_init(void) ...@@ -615,6 +618,7 @@ static void __init z2_spi_init(void)
{ {
pxa2xx_set_spi_info(1, &pxa_ssp1_master_info); pxa2xx_set_spi_info(1, &pxa_ssp1_master_info);
pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
gpiod_add_lookup_table(&lms283_gpio_table);
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
} }
#else #else
......
...@@ -137,15 +137,7 @@ static int ktd253_backlight_probe(struct platform_device *pdev) ...@@ -137,15 +137,7 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
brightness = max_brightness; brightness = max_brightness;
} }
if (brightness) ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
/* This will be the default ratio when the KTD253 is enabled */
ktd253->ratio = KTD253_MAX_RATIO;
else
ktd253->ratio = 0;
ktd253->gpiod = devm_gpiod_get(dev, "enable",
brightness ? GPIOD_OUT_HIGH :
GPIOD_OUT_LOW);
if (IS_ERR(ktd253->gpiod)) { if (IS_ERR(ktd253->gpiod)) {
ret = PTR_ERR(ktd253->gpiod); ret = PTR_ERR(ktd253->gpiod);
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
...@@ -153,6 +145,8 @@ static int ktd253_backlight_probe(struct platform_device *pdev) ...@@ -153,6 +145,8 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
return ret; return ret;
} }
gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev)); gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev));
/* Bring backlight to a known off state */
msleep(KTD253_T_OFF_MS);
bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253, bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253,
&ktd253_backlight_ops, NULL); &ktd253_backlight_ops, NULL);
......
...@@ -9,16 +9,16 @@ ...@@ -9,16 +9,16 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/gpio.h> #include <linux/gpio/consumer.h>
#include <linux/lcd.h> #include <linux/lcd.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/lms283gf05.h>
#include <linux/module.h> #include <linux/module.h>
struct lms283gf05_state { struct lms283gf05_state {
struct spi_device *spi; struct spi_device *spi;
struct lcd_device *ld; struct lcd_device *ld;
struct gpio_desc *reset;
}; };
struct lms283gf05_seq { struct lms283gf05_seq {
...@@ -90,13 +90,13 @@ static const struct lms283gf05_seq disp_pdwnseq[] = { ...@@ -90,13 +90,13 @@ static const struct lms283gf05_seq disp_pdwnseq[] = {
}; };
static void lms283gf05_reset(unsigned long gpio, bool inverted) static void lms283gf05_reset(struct gpio_desc *gpiod)
{ {
gpio_set_value(gpio, !inverted); gpiod_set_value(gpiod, 0); /* De-asserted */
mdelay(100); mdelay(100);
gpio_set_value(gpio, inverted); gpiod_set_value(gpiod, 1); /* Asserted */
mdelay(20); mdelay(20);
gpio_set_value(gpio, !inverted); gpiod_set_value(gpiod, 0); /* De-asserted */
mdelay(20); mdelay(20);
} }
...@@ -125,18 +125,15 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power) ...@@ -125,18 +125,15 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power)
{ {
struct lms283gf05_state *st = lcd_get_data(ld); struct lms283gf05_state *st = lcd_get_data(ld);
struct spi_device *spi = st->spi; struct spi_device *spi = st->spi;
struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev);
if (power <= FB_BLANK_NORMAL) { if (power <= FB_BLANK_NORMAL) {
if (pdata) if (st->reset)
lms283gf05_reset(pdata->reset_gpio, lms283gf05_reset(st->reset);
pdata->reset_inverted);
lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
} else { } else {
lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq)); lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq));
if (pdata) if (st->reset)
gpio_set_value(pdata->reset_gpio, gpiod_set_value(st->reset, 1); /* Asserted */
pdata->reset_inverted);
} }
return 0; return 0;
...@@ -150,24 +147,18 @@ static struct lcd_ops lms_ops = { ...@@ -150,24 +147,18 @@ static struct lcd_ops lms_ops = {
static int lms283gf05_probe(struct spi_device *spi) static int lms283gf05_probe(struct spi_device *spi)
{ {
struct lms283gf05_state *st; struct lms283gf05_state *st;
struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev);
struct lcd_device *ld; struct lcd_device *ld;
int ret = 0;
if (pdata != NULL) {
ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
GPIOF_DIR_OUT | (!pdata->reset_inverted ?
GPIOF_INIT_HIGH : GPIOF_INIT_LOW),
"LMS283GF05 RESET");
if (ret)
return ret;
}
st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state), st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
GFP_KERNEL); GFP_KERNEL);
if (st == NULL) if (st == NULL)
return -ENOMEM; return -ENOMEM;
st->reset = gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(st->reset))
return PTR_ERR(st->reset);
gpiod_set_consumer_name(st->reset, "LMS283GF05 RESET");
ld = devm_lcd_device_register(&spi->dev, "lms283gf05", &spi->dev, st, ld = devm_lcd_device_register(&spi->dev, "lms283gf05", &spi->dev, st,
&lms_ops); &lms_ops);
if (IS_ERR(ld)) if (IS_ERR(ld))
...@@ -179,8 +170,8 @@ static int lms283gf05_probe(struct spi_device *spi) ...@@ -179,8 +170,8 @@ static int lms283gf05_probe(struct spi_device *spi)
spi_set_drvdata(spi, st); spi_set_drvdata(spi, st);
/* kick in the LCD */ /* kick in the LCD */
if (pdata) if (st->reset)
lms283gf05_reset(pdata->reset_gpio, pdata->reset_inverted); lms283gf05_reset(st->reset);
lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
return 0; return 0;
......
...@@ -1692,7 +1692,7 @@ static int wled_probe(struct platform_device *pdev) ...@@ -1692,7 +1692,7 @@ static int wled_probe(struct platform_device *pdev)
static int wled_remove(struct platform_device *pdev) static int wled_remove(struct platform_device *pdev)
{ {
struct wled *wled = dev_get_drvdata(&pdev->dev); struct wled *wled = platform_get_drvdata(pdev);
mutex_destroy(&wled->lock); mutex_destroy(&wled->lock);
cancel_delayed_work_sync(&wled->ovp_work); cancel_delayed_work_sync(&wled->ovp_work);
......
...@@ -291,7 +291,7 @@ static int sky81452_bl_probe(struct platform_device *pdev) ...@@ -291,7 +291,7 @@ static int sky81452_bl_probe(struct platform_device *pdev)
} }
memset(&props, 0, sizeof(props)); memset(&props, 0, sizeof(props));
props.max_brightness = SKY81452_MAX_BRIGHTNESS, props.max_brightness = SKY81452_MAX_BRIGHTNESS;
name = pdata->name ? pdata->name : SKY81452_DEFAULT_NAME; name = pdata->name ? pdata->name : SKY81452_DEFAULT_NAME;
bd = devm_backlight_device_register(dev, name, dev, regmap, bd = devm_backlight_device_register(dev, name, dev, regmap,
&sky81452_bl_ops, &props); &sky81452_bl_ops, &props);
......
...@@ -3736,7 +3736,7 @@ static int __init amifb_probe(struct platform_device *pdev) ...@@ -3736,7 +3736,7 @@ static int __init amifb_probe(struct platform_device *pdev)
if (err) if (err)
goto free_irq; goto free_irq;
dev_set_drvdata(&pdev->dev, info); platform_set_drvdata(pdev, info);
err = register_framebuffer(info); err = register_framebuffer(info);
if (err) if (err)
...@@ -3764,7 +3764,7 @@ static int __init amifb_probe(struct platform_device *pdev) ...@@ -3764,7 +3764,7 @@ static int __init amifb_probe(struct platform_device *pdev)
static int __exit amifb_remove(struct platform_device *pdev) static int __exit amifb_remove(struct platform_device *pdev)
{ {
struct fb_info *info = dev_get_drvdata(&pdev->dev); struct fb_info *info = platform_get_drvdata(pdev);
unregister_framebuffer(info); unregister_framebuffer(info);
fb_dealloc_cmap(&info->cmap); fb_dealloc_cmap(&info->cmap);
......
...@@ -1066,7 +1066,7 @@ static void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par) ...@@ -1066,7 +1066,7 @@ static void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par)
static int fb_remove(struct platform_device *dev) static int fb_remove(struct platform_device *dev)
{ {
struct fb_info *info = dev_get_drvdata(&dev->dev); struct fb_info *info = platform_get_drvdata(dev);
struct da8xx_fb_par *par = info->par; struct da8xx_fb_par *par = info->par;
int ret; int ret;
...@@ -1482,7 +1482,7 @@ static int fb_probe(struct platform_device *device) ...@@ -1482,7 +1482,7 @@ static int fb_probe(struct platform_device *device)
da8xx_fb_var.activate = FB_ACTIVATE_FORCE; da8xx_fb_var.activate = FB_ACTIVATE_FORCE;
fb_set_var(da8xx_fb_info, &da8xx_fb_var); fb_set_var(da8xx_fb_info, &da8xx_fb_var);
dev_set_drvdata(&device->dev, da8xx_fb_info); platform_set_drvdata(device, da8xx_fb_info);
/* initialize the vsync wait queue */ /* initialize the vsync wait queue */
init_waitqueue_head(&par->vsync_wait); init_waitqueue_head(&par->vsync_wait);
......
...@@ -657,7 +657,7 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf ...@@ -657,7 +657,7 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
static int imxfb_init_fbinfo(struct platform_device *pdev) static int imxfb_init_fbinfo(struct platform_device *pdev)
{ {
struct imx_fb_platform_data *pdata = dev_get_platdata(&pdev->dev); struct imx_fb_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct fb_info *info = dev_get_drvdata(&pdev->dev); struct fb_info *info = platform_get_drvdata(pdev);
struct imxfb_info *fbi = info->par; struct imxfb_info *fbi = info->par;
struct device_node *np; struct device_node *np;
......
...@@ -239,7 +239,7 @@ static struct omap_dss_driver lb035q02_ops = { ...@@ -239,7 +239,7 @@ static struct omap_dss_driver lb035q02_ops = {
static int lb035q02_probe_of(struct spi_device *spi) static int lb035q02_probe_of(struct spi_device *spi)
{ {
struct device_node *node = spi->dev.of_node; struct device_node *node = spi->dev.of_node;
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = spi_get_drvdata(spi);
struct omap_dss_device *in; struct omap_dss_device *in;
struct gpio_desc *gpio; struct gpio_desc *gpio;
...@@ -277,7 +277,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) ...@@ -277,7 +277,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
if (ddata == NULL) if (ddata == NULL)
return -ENOMEM; return -ENOMEM;
dev_set_drvdata(&spi->dev, ddata); spi_set_drvdata(spi, ddata);
ddata->spi = spi; ddata->spi = spi;
...@@ -318,7 +318,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) ...@@ -318,7 +318,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
static int lb035q02_panel_spi_remove(struct spi_device *spi) static int lb035q02_panel_spi_remove(struct spi_device *spi)
{ {
struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct panel_drv_data *ddata = spi_get_drvdata(spi);
struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in = ddata->in;
......
...@@ -55,7 +55,7 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev) ...@@ -55,7 +55,7 @@ static struct dpi_data *dpi_get_data_from_dssdev(struct omap_dss_device *dssdev)
/* only used in non-DT mode */ /* only used in non-DT mode */
static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev) static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev)
{ {
return dev_get_drvdata(&pdev->dev); return platform_get_drvdata(pdev);
} }
static struct dss_pll *dpi_get_pll(enum omap_channel channel) static struct dss_pll *dpi_get_pll(enum omap_channel channel)
...@@ -784,7 +784,7 @@ static int dpi_bind(struct device *dev, struct device *master, void *data) ...@@ -784,7 +784,7 @@ static int dpi_bind(struct device *dev, struct device *master, void *data)
dpi->pdev = pdev; dpi->pdev = pdev;
dev_set_drvdata(&pdev->dev, dpi); platform_set_drvdata(pdev, dpi);
mutex_init(&dpi->lock); mutex_init(&dpi->lock);
......
...@@ -399,7 +399,7 @@ module_param(dsi_perf, bool, 0644); ...@@ -399,7 +399,7 @@ module_param(dsi_perf, bool, 0644);
static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dsidev) static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dsidev)
{ {
return dev_get_drvdata(&dsidev->dev); return platform_get_drvdata(dsidev);
} }
static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev) static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev)
...@@ -5266,7 +5266,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -5266,7 +5266,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
return -ENOMEM; return -ENOMEM;
dsi->pdev = dsidev; dsi->pdev = dsidev;
dev_set_drvdata(&dsidev->dev, dsi); platform_set_drvdata(dsidev, dsi);
spin_lock_init(&dsi->irq_lock); spin_lock_init(&dsi->irq_lock);
spin_lock_init(&dsi->errors_lock); spin_lock_init(&dsi->errors_lock);
......
...@@ -672,7 +672,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data) ...@@ -672,7 +672,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
int irq; int irq;
hdmi.pdev = pdev; hdmi.pdev = pdev;
dev_set_drvdata(&pdev->dev, &hdmi); platform_set_drvdata(pdev, &hdmi);
mutex_init(&hdmi.lock); mutex_init(&hdmi.lock);
spin_lock_init(&hdmi.audio_playing_lock); spin_lock_init(&hdmi.audio_playing_lock);
......
...@@ -713,7 +713,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data) ...@@ -713,7 +713,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)
int irq; int irq;
hdmi.pdev = pdev; hdmi.pdev = pdev;
dev_set_drvdata(&pdev->dev, &hdmi); platform_set_drvdata(pdev, &hdmi);
mutex_init(&hdmi.lock); mutex_init(&hdmi.lock);
spin_lock_init(&hdmi.audio_playing_lock); spin_lock_init(&hdmi.audio_playing_lock);
......
...@@ -472,7 +472,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev) ...@@ -472,7 +472,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
if (of_find_property(pdev->dev.of_node, "rotate-display", NULL)) if (of_find_property(pdev->dev.of_node, "rotate-display", NULL))
pdata.rotate_screen = 1; pdata.rotate_screen = 1;
dev_set_drvdata(&pdev->dev, drvdata); platform_set_drvdata(pdev, drvdata);
return xilinxfb_assign(pdev, drvdata, &pdata); return xilinxfb_assign(pdev, drvdata, &pdata);
} }
......
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* lms283gf05.h - Platform glue for Samsung LMS283GF05 LCD
*
* Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com>
*/
#ifndef _INCLUDE_LINUX_SPI_LMS283GF05_H_
#define _INCLUDE_LINUX_SPI_LMS283GF05_H_
struct lms283gf05_pdata {
unsigned long reset_gpio;
bool reset_inverted;
};
#endif /* _INCLUDE_LINUX_SPI_LMS283GF05_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment