Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+45 -72
+8 -4
arch/arm/mach-pxa/z2.c
··· 20 20 #include <linux/spi/spi.h> 21 21 #include <linux/spi/pxa2xx_spi.h> 22 22 #include <linux/spi/libertas_spi.h> 23 - #include <linux/spi/lms283gf05.h> 24 23 #include <linux/power_supply.h> 25 24 #include <linux/mtd/physmap.h> 26 25 #include <linux/gpio.h> ··· 577 578 .gpio_cs = GPIO88_ZIPITZ2_LCD_CS, 578 579 }; 579 580 580 - static const struct lms283gf05_pdata lms283_pdata = { 581 - .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET, 581 + static struct gpiod_lookup_table lms283_gpio_table = { 582 + .dev_id = "spi2.0", /* SPI bus 2 chip select 0 */ 583 + .table = { 584 + GPIO_LOOKUP("gpio-pxa", GPIO19_ZIPITZ2_LCD_RESET, 585 + "reset", GPIO_ACTIVE_LOW), 586 + { }, 587 + }, 582 588 }; 583 589 584 590 static struct spi_board_info spi_board_info[] __initdata = { ··· 599 595 { 600 596 .modalias = "lms283gf05", 601 597 .controller_data = &lms283_chip_info, 602 - .platform_data = &lms283_pdata, 603 598 .max_speed_hz = 400000, 604 599 .bus_num = 2, 605 600 .chip_select = 0, ··· 618 615 { 619 616 pxa2xx_set_spi_info(1, &pxa_ssp1_master_info); 620 617 pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); 618 + gpiod_add_lookup_table(&lms283_gpio_table); 621 619 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); 622 620 } 623 621 #else
+3 -9
drivers/video/backlight/ktd253-backlight.c
··· 137 137 brightness = max_brightness; 138 138 } 139 139 140 - if (brightness) 141 - /* This will be the default ratio when the KTD253 is enabled */ 142 - ktd253->ratio = KTD253_MAX_RATIO; 143 - else 144 - ktd253->ratio = 0; 145 - 146 - ktd253->gpiod = devm_gpiod_get(dev, "enable", 147 - brightness ? GPIOD_OUT_HIGH : 148 - GPIOD_OUT_LOW); 140 + ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); 149 141 if (IS_ERR(ktd253->gpiod)) { 150 142 ret = PTR_ERR(ktd253->gpiod); 151 143 if (ret != -EPROBE_DEFER) ··· 145 153 return ret; 146 154 } 147 155 gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev)); 156 + /* Bring backlight to a known off state */ 157 + msleep(KTD253_T_OFF_MS); 148 158 149 159 bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253, 150 160 &ktd253_backlight_ops, NULL);
+17 -26
drivers/video/backlight/lms283gf05.c
··· 9 9 #include <linux/kernel.h> 10 10 #include <linux/delay.h> 11 11 #include <linux/slab.h> 12 - #include <linux/gpio.h> 12 + #include <linux/gpio/consumer.h> 13 13 #include <linux/lcd.h> 14 14 15 15 #include <linux/spi/spi.h> 16 - #include <linux/spi/lms283gf05.h> 17 16 #include <linux/module.h> 18 17 19 18 struct lms283gf05_state { 20 19 struct spi_device *spi; 21 20 struct lcd_device *ld; 21 + struct gpio_desc *reset; 22 22 }; 23 23 24 24 struct lms283gf05_seq { ··· 90 90 }; 91 91 92 92 93 - static void lms283gf05_reset(unsigned long gpio, bool inverted) 93 + static void lms283gf05_reset(struct gpio_desc *gpiod) 94 94 { 95 - gpio_set_value(gpio, !inverted); 95 + gpiod_set_value(gpiod, 0); /* De-asserted */ 96 96 mdelay(100); 97 - gpio_set_value(gpio, inverted); 97 + gpiod_set_value(gpiod, 1); /* Asserted */ 98 98 mdelay(20); 99 - gpio_set_value(gpio, !inverted); 99 + gpiod_set_value(gpiod, 0); /* De-asserted */ 100 100 mdelay(20); 101 101 } 102 102 ··· 125 125 { 126 126 struct lms283gf05_state *st = lcd_get_data(ld); 127 127 struct spi_device *spi = st->spi; 128 - struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev); 129 128 130 129 if (power <= FB_BLANK_NORMAL) { 131 - if (pdata) 132 - lms283gf05_reset(pdata->reset_gpio, 133 - pdata->reset_inverted); 130 + if (st->reset) 131 + lms283gf05_reset(st->reset); 134 132 lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); 135 133 } else { 136 134 lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq)); 137 - if (pdata) 138 - gpio_set_value(pdata->reset_gpio, 139 - pdata->reset_inverted); 135 + if (st->reset) 136 + gpiod_set_value(st->reset, 1); /* Asserted */ 140 137 } 141 138 142 139 return 0; ··· 147 150 static int lms283gf05_probe(struct spi_device *spi) 148 151 { 149 152 struct lms283gf05_state *st; 150 - struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev); 151 153 struct lcd_device *ld; 152 - int ret = 0; 153 - 154 - if (pdata != NULL) { 155 - ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio, 156 - GPIOF_DIR_OUT | (!pdata->reset_inverted ? 157 - GPIOF_INIT_HIGH : GPIOF_INIT_LOW), 158 - "LMS283GF05 RESET"); 159 - if (ret) 160 - return ret; 161 - } 162 154 163 155 st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state), 164 156 GFP_KERNEL); 165 157 if (st == NULL) 166 158 return -ENOMEM; 159 + 160 + st->reset = gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_LOW); 161 + if (IS_ERR(st->reset)) 162 + return PTR_ERR(st->reset); 163 + gpiod_set_consumer_name(st->reset, "LMS283GF05 RESET"); 167 164 168 165 ld = devm_lcd_device_register(&spi->dev, "lms283gf05", &spi->dev, st, 169 166 &lms_ops); ··· 170 179 spi_set_drvdata(spi, st); 171 180 172 181 /* kick in the LCD */ 173 - if (pdata) 174 - lms283gf05_reset(pdata->reset_gpio, pdata->reset_inverted); 182 + if (st->reset) 183 + lms283gf05_reset(st->reset); 175 184 lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); 176 185 177 186 return 0;
+1 -1
drivers/video/backlight/qcom-wled.c
··· 1692 1692 1693 1693 static int wled_remove(struct platform_device *pdev) 1694 1694 { 1695 - struct wled *wled = dev_get_drvdata(&pdev->dev); 1695 + struct wled *wled = platform_get_drvdata(pdev); 1696 1696 1697 1697 mutex_destroy(&wled->lock); 1698 1698 cancel_delayed_work_sync(&wled->ovp_work);
+1 -1
drivers/video/backlight/sky81452-backlight.c
··· 291 291 } 292 292 293 293 memset(&props, 0, sizeof(props)); 294 - props.max_brightness = SKY81452_MAX_BRIGHTNESS, 294 + props.max_brightness = SKY81452_MAX_BRIGHTNESS; 295 295 name = pdata->name ? pdata->name : SKY81452_DEFAULT_NAME; 296 296 bd = devm_backlight_device_register(dev, name, dev, regmap, 297 297 &sky81452_bl_ops, &props);
+2 -2
drivers/video/fbdev/amifb.c
··· 3736 3736 if (err) 3737 3737 goto free_irq; 3738 3738 3739 - dev_set_drvdata(&pdev->dev, info); 3739 + platform_set_drvdata(pdev, info); 3740 3740 3741 3741 err = register_framebuffer(info); 3742 3742 if (err) ··· 3764 3764 3765 3765 static int __exit amifb_remove(struct platform_device *pdev) 3766 3766 { 3767 - struct fb_info *info = dev_get_drvdata(&pdev->dev); 3767 + struct fb_info *info = platform_get_drvdata(pdev); 3768 3768 3769 3769 unregister_framebuffer(info); 3770 3770 fb_dealloc_cmap(&info->cmap);
+2 -2
drivers/video/fbdev/da8xx-fb.c
··· 1066 1066 1067 1067 static int fb_remove(struct platform_device *dev) 1068 1068 { 1069 - struct fb_info *info = dev_get_drvdata(&dev->dev); 1069 + struct fb_info *info = platform_get_drvdata(dev); 1070 1070 struct da8xx_fb_par *par = info->par; 1071 1071 int ret; 1072 1072 ··· 1482 1482 da8xx_fb_var.activate = FB_ACTIVATE_FORCE; 1483 1483 fb_set_var(da8xx_fb_info, &da8xx_fb_var); 1484 1484 1485 - dev_set_drvdata(&device->dev, da8xx_fb_info); 1485 + platform_set_drvdata(device, da8xx_fb_info); 1486 1486 1487 1487 /* initialize the vsync wait queue */ 1488 1488 init_waitqueue_head(&par->vsync_wait);
+1 -1
drivers/video/fbdev/imxfb.c
··· 657 657 static int imxfb_init_fbinfo(struct platform_device *pdev) 658 658 { 659 659 struct imx_fb_platform_data *pdata = dev_get_platdata(&pdev->dev); 660 - struct fb_info *info = dev_get_drvdata(&pdev->dev); 660 + struct fb_info *info = platform_get_drvdata(pdev); 661 661 struct imxfb_info *fbi = info->par; 662 662 struct device_node *np; 663 663
+3 -3
drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c
··· 239 239 static int lb035q02_probe_of(struct spi_device *spi) 240 240 { 241 241 struct device_node *node = spi->dev.of_node; 242 - struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); 242 + struct panel_drv_data *ddata = spi_get_drvdata(spi); 243 243 struct omap_dss_device *in; 244 244 struct gpio_desc *gpio; 245 245 ··· 277 277 if (ddata == NULL) 278 278 return -ENOMEM; 279 279 280 - dev_set_drvdata(&spi->dev, ddata); 280 + spi_set_drvdata(spi, ddata); 281 281 282 282 ddata->spi = spi; 283 283 ··· 318 318 319 319 static int lb035q02_panel_spi_remove(struct spi_device *spi) 320 320 { 321 - struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); 321 + struct panel_drv_data *ddata = spi_get_drvdata(spi); 322 322 struct omap_dss_device *dssdev = &ddata->dssdev; 323 323 struct omap_dss_device *in = ddata->in; 324 324
+2 -2
drivers/video/fbdev/omap2/omapfb/dss/dpi.c
··· 55 55 /* only used in non-DT mode */ 56 56 static struct dpi_data *dpi_get_data_from_pdev(struct platform_device *pdev) 57 57 { 58 - return dev_get_drvdata(&pdev->dev); 58 + return platform_get_drvdata(pdev); 59 59 } 60 60 61 61 static struct dss_pll *dpi_get_pll(enum omap_channel channel) ··· 784 784 785 785 dpi->pdev = pdev; 786 786 787 - dev_set_drvdata(&pdev->dev, dpi); 787 + platform_set_drvdata(pdev, dpi); 788 788 789 789 mutex_init(&dpi->lock); 790 790
+2 -2
drivers/video/fbdev/omap2/omapfb/dss/dsi.c
··· 399 399 400 400 static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dsidev) 401 401 { 402 - return dev_get_drvdata(&dsidev->dev); 402 + return platform_get_drvdata(dsidev); 403 403 } 404 404 405 405 static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev) ··· 5266 5266 return -ENOMEM; 5267 5267 5268 5268 dsi->pdev = dsidev; 5269 - dev_set_drvdata(&dsidev->dev, dsi); 5269 + platform_set_drvdata(dsidev, dsi); 5270 5270 5271 5271 spin_lock_init(&dsi->irq_lock); 5272 5272 spin_lock_init(&dsi->errors_lock);
+1 -1
drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c
··· 672 672 int irq; 673 673 674 674 hdmi.pdev = pdev; 675 - dev_set_drvdata(&pdev->dev, &hdmi); 675 + platform_set_drvdata(pdev, &hdmi); 676 676 677 677 mutex_init(&hdmi.lock); 678 678 spin_lock_init(&hdmi.audio_playing_lock);
+1 -1
drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c
··· 713 713 int irq; 714 714 715 715 hdmi.pdev = pdev; 716 - dev_set_drvdata(&pdev->dev, &hdmi); 716 + platform_set_drvdata(pdev, &hdmi); 717 717 718 718 mutex_init(&hdmi.lock); 719 719 spin_lock_init(&hdmi.audio_playing_lock);
+1 -1
drivers/video/fbdev/xilinxfb.c
··· 472 472 if (of_find_property(pdev->dev.of_node, "rotate-display", NULL)) 473 473 pdata.rotate_screen = 1; 474 474 475 - dev_set_drvdata(&pdev->dev, drvdata); 475 + platform_set_drvdata(pdev, drvdata); 476 476 return xilinxfb_assign(pdev, drvdata, &pdata); 477 477 } 478 478
-16
include/linux/spi/lms283gf05.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * lms283gf05.h - Platform glue for Samsung LMS283GF05 LCD 4 - * 5 - * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com> 6 - */ 7 - 8 - #ifndef _INCLUDE_LINUX_SPI_LMS283GF05_H_ 9 - #define _INCLUDE_LINUX_SPI_LMS283GF05_H_ 10 - 11 - struct lms283gf05_pdata { 12 - unsigned long reset_gpio; 13 - bool reset_inverted; 14 - }; 15 - 16 - #endif /* _INCLUDE_LINUX_SPI_LMS283GF05_H_ */