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

backlight: Remove pxa tosa support

The PXA tosa machine was removed, so this backlight driver is no
longer needed.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230105134622.254560-10-arnd@kernel.org

authored by

Arnd Bergmann and committed by
Lee Jones
744fc2da 32fb2588

-480
-14
drivers/video/backlight/Kconfig
··· 90 90 This driver provides a platform-device registered LCD power 91 91 control interface. 92 92 93 - config LCD_TOSA 94 - tristate "Sharp SL-6000 LCD Driver" 95 - depends on I2C && SPI && MACH_TOSA 96 - help 97 - If you have an Sharp SL-6000 Zaurus say Y to enable a driver 98 - for its LCD. 99 - 100 93 config LCD_HP700 101 94 tristate "HP Jornada 700 series LCD Driver" 102 95 depends on SA1100_JORNADA720_SSP && !PREEMPTION ··· 280 287 help 281 288 If you have an Intel-based Apple say Y to enable a driver for its 282 289 backlight. 283 - 284 - config BACKLIGHT_TOSA 285 - tristate "Sharp SL-6000 Backlight Driver" 286 - depends on I2C && MACH_TOSA && LCD_TOSA 287 - help 288 - If you have an Sharp SL-6000 Zaurus say Y to enable a driver 289 - for its backlight 290 290 291 291 config BACKLIGHT_QCOM_WLED 292 292 tristate "Qualcomm PMIC WLED Driver"
-2
drivers/video/backlight/Makefile
··· 15 15 obj-$(CONFIG_LCD_OTM3225A) += otm3225a.o 16 16 obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o 17 17 obj-$(CONFIG_LCD_TDO24M) += tdo24m.o 18 - obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o 19 18 obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o 20 19 21 20 obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o ··· 52 53 obj-$(CONFIG_BACKLIGHT_RT4831) += rt4831-backlight.o 53 54 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o 54 55 obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o 55 - obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o 56 56 obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o 57 57 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o 58 58 obj-$(CONFIG_BACKLIGHT_ARCXCNN) += arcxcnn_bl.o
-172
drivers/video/backlight/tosa_bl.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * LCD / Backlight control code for Sharp SL-6000x (tosa) 4 - * 5 - * Copyright (c) 2005 Dirk Opfer 6 - * Copyright (c) 2007,2008 Dmitry Baryshkov 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/module.h> 11 - #include <linux/device.h> 12 - #include <linux/spi/spi.h> 13 - #include <linux/i2c.h> 14 - #include <linux/gpio/consumer.h> 15 - #include <linux/fb.h> 16 - #include <linux/backlight.h> 17 - #include <linux/slab.h> 18 - 19 - #include <asm/mach/sharpsl_param.h> 20 - 21 - #include "tosa_bl.h" 22 - 23 - #define COMADJ_DEFAULT 97 24 - 25 - #define DAC_CH1 0 26 - #define DAC_CH2 1 27 - 28 - struct tosa_bl_data { 29 - struct i2c_client *i2c; 30 - struct backlight_device *bl; 31 - struct gpio_desc *gpio; 32 - 33 - int comadj; 34 - }; 35 - 36 - static void tosa_bl_set_backlight(struct tosa_bl_data *data, int brightness) 37 - { 38 - struct spi_device *spi = dev_get_platdata(&data->i2c->dev); 39 - 40 - i2c_smbus_write_byte_data(data->i2c, DAC_CH1, data->comadj); 41 - 42 - /* SetBacklightDuty */ 43 - i2c_smbus_write_byte_data(data->i2c, DAC_CH2, (u8)(brightness & 0xff)); 44 - 45 - /* SetBacklightVR */ 46 - gpiod_set_value(data->gpio, brightness & 0x100); 47 - 48 - tosa_bl_enable(spi, brightness); 49 - } 50 - 51 - static int tosa_bl_update_status(struct backlight_device *dev) 52 - { 53 - struct backlight_properties *props = &dev->props; 54 - struct tosa_bl_data *data = bl_get_data(dev); 55 - int power = max(props->power, props->fb_blank); 56 - int brightness = props->brightness; 57 - 58 - if (power) 59 - brightness = 0; 60 - 61 - tosa_bl_set_backlight(data, brightness); 62 - 63 - return 0; 64 - } 65 - 66 - static int tosa_bl_get_brightness(struct backlight_device *dev) 67 - { 68 - struct backlight_properties *props = &dev->props; 69 - 70 - return props->brightness; 71 - } 72 - 73 - static const struct backlight_ops bl_ops = { 74 - .get_brightness = tosa_bl_get_brightness, 75 - .update_status = tosa_bl_update_status, 76 - }; 77 - 78 - static int tosa_bl_probe(struct i2c_client *client) 79 - { 80 - struct backlight_properties props; 81 - struct tosa_bl_data *data; 82 - int ret = 0; 83 - 84 - data = devm_kzalloc(&client->dev, sizeof(struct tosa_bl_data), 85 - GFP_KERNEL); 86 - if (!data) 87 - return -ENOMEM; 88 - 89 - data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj; 90 - data->gpio = devm_gpiod_get(&client->dev, "backlight", GPIOD_OUT_LOW); 91 - ret = PTR_ERR_OR_ZERO(data->gpio); 92 - if (ret) { 93 - dev_dbg(&data->bl->dev, "Unable to request gpio!\n"); 94 - return ret; 95 - } 96 - 97 - i2c_set_clientdata(client, data); 98 - data->i2c = client; 99 - 100 - memset(&props, 0, sizeof(struct backlight_properties)); 101 - props.type = BACKLIGHT_RAW; 102 - props.max_brightness = 512 - 1; 103 - data->bl = devm_backlight_device_register(&client->dev, "tosa-bl", 104 - &client->dev, data, &bl_ops, 105 - &props); 106 - if (IS_ERR(data->bl)) { 107 - ret = PTR_ERR(data->bl); 108 - goto err_reg; 109 - } 110 - 111 - data->bl->props.brightness = 69; 112 - data->bl->props.power = FB_BLANK_UNBLANK; 113 - 114 - backlight_update_status(data->bl); 115 - 116 - return 0; 117 - 118 - err_reg: 119 - data->bl = NULL; 120 - return ret; 121 - } 122 - 123 - static void tosa_bl_remove(struct i2c_client *client) 124 - { 125 - struct tosa_bl_data *data = i2c_get_clientdata(client); 126 - 127 - data->bl = NULL; 128 - } 129 - 130 - #ifdef CONFIG_PM_SLEEP 131 - static int tosa_bl_suspend(struct device *dev) 132 - { 133 - struct tosa_bl_data *data = dev_get_drvdata(dev); 134 - 135 - tosa_bl_set_backlight(data, 0); 136 - 137 - return 0; 138 - } 139 - 140 - static int tosa_bl_resume(struct device *dev) 141 - { 142 - struct tosa_bl_data *data = dev_get_drvdata(dev); 143 - 144 - backlight_update_status(data->bl); 145 - return 0; 146 - } 147 - #endif 148 - 149 - static SIMPLE_DEV_PM_OPS(tosa_bl_pm_ops, tosa_bl_suspend, tosa_bl_resume); 150 - 151 - static const struct i2c_device_id tosa_bl_id[] = { 152 - { "tosa-bl", 0 }, 153 - { }, 154 - }; 155 - MODULE_DEVICE_TABLE(i2c, tosa_bl_id); 156 - 157 - static struct i2c_driver tosa_bl_driver = { 158 - .driver = { 159 - .name = "tosa-bl", 160 - .pm = &tosa_bl_pm_ops, 161 - }, 162 - .probe_new = tosa_bl_probe, 163 - .remove = tosa_bl_remove, 164 - .id_table = tosa_bl_id, 165 - }; 166 - 167 - module_i2c_driver(tosa_bl_driver); 168 - 169 - MODULE_AUTHOR("Dmitry Baryshkov"); 170 - MODULE_LICENSE("GPL v2"); 171 - MODULE_DESCRIPTION("LCD/Backlight control for Sharp SL-6000 PDA"); 172 -
-8
drivers/video/backlight/tosa_bl.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - #ifndef _TOSA_BL_H 3 - #define _TOSA_BL_H 4 - 5 - struct spi_device; 6 - extern int tosa_bl_enable(struct spi_device *spi, int enable); 7 - 8 - #endif
-284
drivers/video/backlight/tosa_lcd.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * LCD / Backlight control code for Sharp SL-6000x (tosa) 4 - * 5 - * Copyright (c) 2005 Dirk Opfer 6 - * Copyright (c) 2007,2008 Dmitry Baryshkov 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/module.h> 11 - #include <linux/device.h> 12 - #include <linux/spi/spi.h> 13 - #include <linux/i2c.h> 14 - #include <linux/slab.h> 15 - #include <linux/gpio/consumer.h> 16 - #include <linux/delay.h> 17 - #include <linux/lcd.h> 18 - #include <linux/fb.h> 19 - 20 - #include <asm/mach/sharpsl_param.h> 21 - 22 - #include "tosa_bl.h" 23 - 24 - #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) 25 - 26 - #define TG_REG0_VQV 0x0001 27 - #define TG_REG0_COLOR 0x0002 28 - #define TG_REG0_UD 0x0004 29 - #define TG_REG0_LR 0x0008 30 - 31 - /* 32 - * Timing Generator 33 - */ 34 - #define TG_PNLCTL 0x00 35 - #define TG_TPOSCTL 0x01 36 - #define TG_DUTYCTL 0x02 37 - #define TG_GPOSR 0x03 38 - #define TG_GPODR1 0x04 39 - #define TG_GPODR2 0x05 40 - #define TG_PINICTL 0x06 41 - #define TG_HPOSCTL 0x07 42 - 43 - 44 - #define DAC_BASE 0x4e 45 - 46 - struct tosa_lcd_data { 47 - struct spi_device *spi; 48 - struct lcd_device *lcd; 49 - struct i2c_client *i2c; 50 - struct gpio_desc *gpiod_tg; 51 - 52 - int lcd_power; 53 - bool is_vga; 54 - }; 55 - 56 - static int tosa_tg_send(struct spi_device *spi, int adrs, uint8_t data) 57 - { 58 - u8 buf[1]; 59 - struct spi_message msg; 60 - struct spi_transfer xfer = { 61 - .len = 1, 62 - .cs_change = 0, 63 - .tx_buf = buf, 64 - }; 65 - 66 - buf[0] = ((adrs & 0x07) << 5) | (data & 0x1f); 67 - spi_message_init(&msg); 68 - spi_message_add_tail(&xfer, &msg); 69 - 70 - return spi_sync(spi, &msg); 71 - } 72 - 73 - int tosa_bl_enable(struct spi_device *spi, int enable) 74 - { 75 - /* bl_enable GP04=1 otherwise GP04=0*/ 76 - return tosa_tg_send(spi, TG_GPODR2, enable ? 0x01 : 0x00); 77 - } 78 - EXPORT_SYMBOL(tosa_bl_enable); 79 - 80 - static void tosa_lcd_tg_init(struct tosa_lcd_data *data) 81 - { 82 - /* TG on */ 83 - gpiod_set_value(data->gpiod_tg, 0); 84 - 85 - mdelay(60); 86 - 87 - /* delayed 0clk TCTL signal for VGA */ 88 - tosa_tg_send(data->spi, TG_TPOSCTL, 0x00); 89 - /* GPOS0=powercontrol, GPOS1=GPIO, GPOS2=TCTL */ 90 - tosa_tg_send(data->spi, TG_GPOSR, 0x02); 91 - } 92 - 93 - static void tosa_lcd_tg_on(struct tosa_lcd_data *data) 94 - { 95 - struct spi_device *spi = data->spi; 96 - int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR; 97 - 98 - if (data->is_vga) 99 - value |= TG_REG0_VQV; 100 - 101 - tosa_tg_send(spi, TG_PNLCTL, value); 102 - 103 - /* TG LCD pannel power up */ 104 - tosa_tg_send(spi, TG_PINICTL, 0x4); 105 - mdelay(50); 106 - 107 - /* TG LCD GVSS */ 108 - tosa_tg_send(spi, TG_PINICTL, 0x0); 109 - 110 - if (IS_ERR_OR_NULL(data->i2c)) { 111 - /* 112 - * after the pannel is powered up the first time, 113 - * we can access the i2c bus so probe for the DAC 114 - */ 115 - struct i2c_adapter *adap = i2c_get_adapter(0); 116 - struct i2c_board_info info = { 117 - .dev_name = "tosa-bl", 118 - .type = "tosa-bl", 119 - .addr = DAC_BASE, 120 - .platform_data = data->spi, 121 - }; 122 - data->i2c = i2c_new_client_device(adap, &info); 123 - } 124 - } 125 - 126 - static void tosa_lcd_tg_off(struct tosa_lcd_data *data) 127 - { 128 - struct spi_device *spi = data->spi; 129 - 130 - /* TG LCD VHSA off */ 131 - tosa_tg_send(spi, TG_PINICTL, 0x4); 132 - mdelay(50); 133 - 134 - /* TG LCD signal off */ 135 - tosa_tg_send(spi, TG_PINICTL, 0x6); 136 - mdelay(50); 137 - 138 - /* TG Off */ 139 - gpiod_set_value(data->gpiod_tg, 1); 140 - mdelay(100); 141 - } 142 - 143 - int tosa_lcd_set_power(struct lcd_device *lcd, int power) 144 - { 145 - struct tosa_lcd_data *data = lcd_get_data(lcd); 146 - 147 - if (POWER_IS_ON(power) && !POWER_IS_ON(data->lcd_power)) 148 - tosa_lcd_tg_on(data); 149 - 150 - if (!POWER_IS_ON(power) && POWER_IS_ON(data->lcd_power)) 151 - tosa_lcd_tg_off(data); 152 - 153 - data->lcd_power = power; 154 - return 0; 155 - } 156 - 157 - static int tosa_lcd_get_power(struct lcd_device *lcd) 158 - { 159 - struct tosa_lcd_data *data = lcd_get_data(lcd); 160 - 161 - return data->lcd_power; 162 - } 163 - 164 - static int tosa_lcd_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) 165 - { 166 - struct tosa_lcd_data *data = lcd_get_data(lcd); 167 - 168 - if (mode->xres == 320 || mode->yres == 320) 169 - data->is_vga = false; 170 - else 171 - data->is_vga = true; 172 - 173 - if (POWER_IS_ON(data->lcd_power)) 174 - tosa_lcd_tg_on(data); 175 - 176 - return 0; 177 - } 178 - 179 - static struct lcd_ops tosa_lcd_ops = { 180 - .set_power = tosa_lcd_set_power, 181 - .get_power = tosa_lcd_get_power, 182 - .set_mode = tosa_lcd_set_mode, 183 - }; 184 - 185 - static int tosa_lcd_probe(struct spi_device *spi) 186 - { 187 - int ret; 188 - struct tosa_lcd_data *data; 189 - 190 - data = devm_kzalloc(&spi->dev, sizeof(struct tosa_lcd_data), 191 - GFP_KERNEL); 192 - if (!data) 193 - return -ENOMEM; 194 - 195 - data->is_vga = true; /* default to VGA mode */ 196 - 197 - /* 198 - * bits_per_word cannot be configured in platform data 199 - */ 200 - spi->bits_per_word = 8; 201 - 202 - ret = spi_setup(spi); 203 - if (ret < 0) 204 - return ret; 205 - 206 - data->spi = spi; 207 - spi_set_drvdata(spi, data); 208 - 209 - data->gpiod_tg = devm_gpiod_get(&spi->dev, "tg #pwr", GPIOD_OUT_LOW); 210 - if (IS_ERR(data->gpiod_tg)) 211 - return PTR_ERR(data->gpiod_tg); 212 - 213 - mdelay(60); 214 - 215 - tosa_lcd_tg_init(data); 216 - 217 - tosa_lcd_tg_on(data); 218 - 219 - data->lcd = devm_lcd_device_register(&spi->dev, "tosa-lcd", &spi->dev, 220 - data, &tosa_lcd_ops); 221 - 222 - if (IS_ERR(data->lcd)) { 223 - ret = PTR_ERR(data->lcd); 224 - data->lcd = NULL; 225 - goto err_register; 226 - } 227 - 228 - return 0; 229 - 230 - err_register: 231 - tosa_lcd_tg_off(data); 232 - return ret; 233 - } 234 - 235 - static void tosa_lcd_remove(struct spi_device *spi) 236 - { 237 - struct tosa_lcd_data *data = spi_get_drvdata(spi); 238 - 239 - i2c_unregister_device(data->i2c); 240 - 241 - tosa_lcd_tg_off(data); 242 - } 243 - 244 - #ifdef CONFIG_PM_SLEEP 245 - static int tosa_lcd_suspend(struct device *dev) 246 - { 247 - struct tosa_lcd_data *data = dev_get_drvdata(dev); 248 - 249 - tosa_lcd_tg_off(data); 250 - 251 - return 0; 252 - } 253 - 254 - static int tosa_lcd_resume(struct device *dev) 255 - { 256 - struct tosa_lcd_data *data = dev_get_drvdata(dev); 257 - 258 - tosa_lcd_tg_init(data); 259 - if (POWER_IS_ON(data->lcd_power)) 260 - tosa_lcd_tg_on(data); 261 - else 262 - tosa_lcd_tg_off(data); 263 - 264 - return 0; 265 - } 266 - #endif 267 - 268 - static SIMPLE_DEV_PM_OPS(tosa_lcd_pm_ops, tosa_lcd_suspend, tosa_lcd_resume); 269 - 270 - static struct spi_driver tosa_lcd_driver = { 271 - .driver = { 272 - .name = "tosa-lcd", 273 - .pm = &tosa_lcd_pm_ops, 274 - }, 275 - .probe = tosa_lcd_probe, 276 - .remove = tosa_lcd_remove, 277 - }; 278 - 279 - module_spi_driver(tosa_lcd_driver); 280 - 281 - MODULE_AUTHOR("Dmitry Baryshkov"); 282 - MODULE_LICENSE("GPL v2"); 283 - MODULE_DESCRIPTION("LCD/Backlight control for Sharp SL-6000 PDA"); 284 - MODULE_ALIAS("spi:tosa-lcd");