Commit b574beb6 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull backlight updates from Lee Jones:
 "Switch pwm_bl and corgi_lcd drivers to use GPIO descriptors"

* tag 'backlight-next-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
  backlight: corgi: Convert to use GPIO descriptors
  backlight: pwm_bl: Switch to full GPIO descriptor
parents 38e2c63e ee0c8e49
...@@ -312,7 +312,6 @@ static struct pwm_lookup cm_x300_pwm_lookup[] = { ...@@ -312,7 +312,6 @@ static struct pwm_lookup cm_x300_pwm_lookup[] = {
static struct platform_pwm_backlight_data cm_x300_backlight_data = { static struct platform_pwm_backlight_data cm_x300_backlight_data = {
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.enable_gpio = -1,
}; };
static struct platform_device cm_x300_backlight_device = { static struct platform_device cm_x300_backlight_device = {
......
...@@ -202,7 +202,6 @@ static struct pwm_lookup income_pwm_lookup[] = { ...@@ -202,7 +202,6 @@ static struct pwm_lookup income_pwm_lookup[] = {
static struct platform_pwm_backlight_data income_backlight_data = { static struct platform_pwm_backlight_data income_backlight_data = {
.max_brightness = 0x3ff, .max_brightness = 0x3ff,
.dft_brightness = 0x1ff, .dft_brightness = 0x1ff,
.enable_gpio = -1,
}; };
static struct platform_device income_backlight = { static struct platform_device income_backlight = {
......
...@@ -563,13 +563,20 @@ static void corgi_bl_kick_battery(void) ...@@ -563,13 +563,20 @@ static void corgi_bl_kick_battery(void)
} }
} }
static struct gpiod_lookup_table corgi_lcdcon_gpio_table = {
.dev_id = "spi1.1",
.table = {
GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_BACKLIGHT_CONT,
"BL_CONT", GPIO_ACTIVE_HIGH),
{ },
},
};
static struct corgi_lcd_platform_data corgi_lcdcon_info = { static struct corgi_lcd_platform_data corgi_lcdcon_info = {
.init_mode = CORGI_LCD_MODE_VGA, .init_mode = CORGI_LCD_MODE_VGA,
.max_intensity = 0x2f, .max_intensity = 0x2f,
.default_intensity = 0x1f, .default_intensity = 0x1f,
.limit_mask = 0x0b, .limit_mask = 0x0b,
.gpio_backlight_cont = CORGI_GPIO_BACKLIGHT_CONT,
.gpio_backlight_on = -1,
.kick_battery = corgi_bl_kick_battery, .kick_battery = corgi_bl_kick_battery,
}; };
...@@ -609,6 +616,7 @@ static struct spi_board_info corgi_spi_devices[] = { ...@@ -609,6 +616,7 @@ static struct spi_board_info corgi_spi_devices[] = {
static void __init corgi_init_spi(void) static void __init corgi_init_spi(void)
{ {
pxa2xx_set_spi_info(1, &corgi_spi_info); pxa2xx_set_spi_info(1, &corgi_spi_info);
gpiod_add_lookup_table(&corgi_lcdcon_gpio_table);
spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices)); spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices));
} }
#else #else
......
...@@ -55,7 +55,6 @@ static struct pwm_lookup ezx_pwm_lookup[] __maybe_unused = { ...@@ -55,7 +55,6 @@ static struct pwm_lookup ezx_pwm_lookup[] __maybe_unused = {
static struct platform_pwm_backlight_data ezx_backlight_data = { static struct platform_pwm_backlight_data ezx_backlight_data = {
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 1023, .dft_brightness = 1023,
.enable_gpio = -1,
}; };
static struct platform_device ezx_backlight_device = { static struct platform_device ezx_backlight_device = {
......
...@@ -556,7 +556,6 @@ static struct platform_device hx4700_lcd = { ...@@ -556,7 +556,6 @@ static struct platform_device hx4700_lcd = {
static struct platform_pwm_backlight_data backlight_data = { static struct platform_pwm_backlight_data backlight_data = {
.max_brightness = 200, .max_brightness = 200,
.dft_brightness = 100, .dft_brightness = 100,
.enable_gpio = -1,
}; };
static struct platform_device backlight = { static struct platform_device backlight = {
......
...@@ -277,7 +277,6 @@ static struct pwm_lookup lpd270_pwm_lookup[] = { ...@@ -277,7 +277,6 @@ static struct pwm_lookup lpd270_pwm_lookup[] = {
static struct platform_pwm_backlight_data lpd270_backlight_data = { static struct platform_pwm_backlight_data lpd270_backlight_data = {
.max_brightness = 1, .max_brightness = 1,
.dft_brightness = 1, .dft_brightness = 1,
.enable_gpio = -1,
}; };
static struct platform_device lpd270_backlight_device = { static struct platform_device lpd270_backlight_device = {
......
...@@ -401,7 +401,6 @@ static void magician_backlight_exit(struct device *dev) ...@@ -401,7 +401,6 @@ static void magician_backlight_exit(struct device *dev)
static struct platform_pwm_backlight_data backlight_data = { static struct platform_pwm_backlight_data backlight_data = {
.max_brightness = 272, .max_brightness = 272,
.dft_brightness = 100, .dft_brightness = 100,
.enable_gpio = -1,
.init = magician_backlight_init, .init = magician_backlight_init,
.notify = magician_backlight_notify, .notify = magician_backlight_notify,
.exit = magician_backlight_exit, .exit = magician_backlight_exit,
......
...@@ -256,7 +256,6 @@ static struct pwm_lookup mainstone_pwm_lookup[] = { ...@@ -256,7 +256,6 @@ static struct pwm_lookup mainstone_pwm_lookup[] = {
static struct platform_pwm_backlight_data mainstone_backlight_data = { static struct platform_pwm_backlight_data mainstone_backlight_data = {
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 1023, .dft_brightness = 1023,
.enable_gpio = -1,
}; };
static struct platform_device mainstone_backlight_device = { static struct platform_device mainstone_backlight_device = {
......
...@@ -176,7 +176,6 @@ static struct pwm_lookup mioa701_pwm_lookup[] = { ...@@ -176,7 +176,6 @@ static struct pwm_lookup mioa701_pwm_lookup[] = {
static struct platform_pwm_backlight_data mioa701_backlight_data = { static struct platform_pwm_backlight_data mioa701_backlight_data = {
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 50, .dft_brightness = 50,
.enable_gpio = -1,
}; };
/* /*
......
...@@ -318,7 +318,6 @@ static void palm27x_backlight_exit(struct device *dev) ...@@ -318,7 +318,6 @@ static void palm27x_backlight_exit(struct device *dev)
static struct platform_pwm_backlight_data palm27x_backlight_data = { static struct platform_pwm_backlight_data palm27x_backlight_data = {
.max_brightness = 0xfe, .max_brightness = 0xfe,
.dft_brightness = 0x7e, .dft_brightness = 0x7e,
.enable_gpio = -1,
.init = palm27x_backlight_init, .init = palm27x_backlight_init,
.notify = palm27x_backlight_notify, .notify = palm27x_backlight_notify,
.exit = palm27x_backlight_exit, .exit = palm27x_backlight_exit,
......
...@@ -174,6 +174,15 @@ static inline void palmtc_keys_init(void) {} ...@@ -174,6 +174,15 @@ static inline void palmtc_keys_init(void) {}
* Backlight * Backlight
******************************************************************************/ ******************************************************************************/
#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
static struct gpiod_lookup_table palmtc_pwm_bl_gpio_table = {
.dev_id = "pwm-backlight.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_BL_POWER,
"enable", GPIO_ACTIVE_HIGH),
},
};
static struct pwm_lookup palmtc_pwm_lookup[] = { static struct pwm_lookup palmtc_pwm_lookup[] = {
PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS, PWM_LOOKUP("pxa25x-pwm.1", 0, "pwm-backlight.0", NULL, PALMTC_PERIOD_NS,
PWM_POLARITY_NORMAL), PWM_POLARITY_NORMAL),
...@@ -182,7 +191,6 @@ static struct pwm_lookup palmtc_pwm_lookup[] = { ...@@ -182,7 +191,6 @@ static struct pwm_lookup palmtc_pwm_lookup[] = {
static struct platform_pwm_backlight_data palmtc_backlight_data = { static struct platform_pwm_backlight_data palmtc_backlight_data = {
.max_brightness = PALMTC_MAX_INTENSITY, .max_brightness = PALMTC_MAX_INTENSITY,
.dft_brightness = PALMTC_MAX_INTENSITY, .dft_brightness = PALMTC_MAX_INTENSITY,
.enable_gpio = GPIO_NR_PALMTC_BL_POWER,
}; };
static struct platform_device palmtc_backlight = { static struct platform_device palmtc_backlight = {
...@@ -195,6 +203,7 @@ static struct platform_device palmtc_backlight = { ...@@ -195,6 +203,7 @@ static struct platform_device palmtc_backlight = {
static void __init palmtc_pwm_init(void) static void __init palmtc_pwm_init(void)
{ {
gpiod_add_lookup_table(&palmtc_pwm_bl_gpio_table);
pwm_add_table(palmtc_pwm_lookup, ARRAY_SIZE(palmtc_pwm_lookup)); pwm_add_table(palmtc_pwm_lookup, ARRAY_SIZE(palmtc_pwm_lookup));
platform_device_register(&palmtc_backlight); platform_device_register(&palmtc_backlight);
} }
......
...@@ -175,7 +175,6 @@ static void palmte2_backlight_exit(struct device *dev) ...@@ -175,7 +175,6 @@ static void palmte2_backlight_exit(struct device *dev)
static struct platform_pwm_backlight_data palmte2_backlight_data = { static struct platform_pwm_backlight_data palmte2_backlight_data = {
.max_brightness = PALMTE2_MAX_INTENSITY, .max_brightness = PALMTE2_MAX_INTENSITY,
.dft_brightness = PALMTE2_MAX_INTENSITY, .dft_brightness = PALMTE2_MAX_INTENSITY,
.enable_gpio = -1,
.init = palmte2_backlight_init, .init = palmte2_backlight_init,
.notify = palmte2_backlight_notify, .notify = palmte2_backlight_notify,
.exit = palmte2_backlight_exit, .exit = palmte2_backlight_exit,
......
...@@ -154,7 +154,6 @@ static struct pwm_lookup pcm990_pwm_lookup[] = { ...@@ -154,7 +154,6 @@ static struct pwm_lookup pcm990_pwm_lookup[] = {
static struct platform_pwm_backlight_data pcm990_backlight_data = { static struct platform_pwm_backlight_data pcm990_backlight_data = {
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 1023, .dft_brightness = 1023,
.enable_gpio = -1,
}; };
static struct platform_device pcm990_backlight_device = { static struct platform_device pcm990_backlight_device = {
......
...@@ -525,13 +525,33 @@ static void spitz_bl_kick_battery(void) ...@@ -525,13 +525,33 @@ static void spitz_bl_kick_battery(void)
} }
} }
static struct gpiod_lookup_table spitz_lcdcon_gpio_table = {
.dev_id = "spi2.1",
.table = {
GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_CONT,
"BL_CONT", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_BACKLIGHT_ON,
"BL_ON", GPIO_ACTIVE_HIGH),
{ },
},
};
static struct gpiod_lookup_table akita_lcdcon_gpio_table = {
.dev_id = "spi2.1",
.table = {
GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_CONT,
"BL_CONT", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", AKITA_GPIO_BACKLIGHT_ON,
"BL_ON", GPIO_ACTIVE_HIGH),
{ },
},
};
static struct corgi_lcd_platform_data spitz_lcdcon_info = { static struct corgi_lcd_platform_data spitz_lcdcon_info = {
.init_mode = CORGI_LCD_MODE_VGA, .init_mode = CORGI_LCD_MODE_VGA,
.max_intensity = 0x2f, .max_intensity = 0x2f,
.default_intensity = 0x1f, .default_intensity = 0x1f,
.limit_mask = 0x0b, .limit_mask = 0x0b,
.gpio_backlight_cont = SPITZ_GPIO_BACKLIGHT_CONT,
.gpio_backlight_on = SPITZ_GPIO_BACKLIGHT_ON,
.kick_battery = spitz_bl_kick_battery, .kick_battery = spitz_bl_kick_battery,
}; };
...@@ -574,12 +594,10 @@ static struct pxa2xx_spi_controller spitz_spi_info = { ...@@ -574,12 +594,10 @@ static struct pxa2xx_spi_controller spitz_spi_info = {
static void __init spitz_spi_init(void) static void __init spitz_spi_init(void)
{ {
struct corgi_lcd_platform_data *lcd_data = &spitz_lcdcon_info; if (machine_is_akita())
gpiod_add_lookup_table(&akita_lcdcon_gpio_table);
if (machine_is_akita()) { else
lcd_data->gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; gpiod_add_lookup_table(&spitz_lcdcon_gpio_table);
lcd_data->gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON;
}
pxa2xx_set_spi_info(2, &spitz_spi_info); pxa2xx_set_spi_info(2, &spitz_spi_info);
spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
......
...@@ -178,13 +178,11 @@ static struct platform_pwm_backlight_data tavorevb_backlight_data[] = { ...@@ -178,13 +178,11 @@ static struct platform_pwm_backlight_data tavorevb_backlight_data[] = {
/* primary backlight */ /* primary backlight */
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.enable_gpio = -1,
}, },
[1] = { [1] = {
/* secondary backlight */ /* secondary backlight */
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.enable_gpio = -1,
}, },
}; };
......
...@@ -404,7 +404,6 @@ static void viper_backlight_exit(struct device *dev) ...@@ -404,7 +404,6 @@ static void viper_backlight_exit(struct device *dev)
static struct platform_pwm_backlight_data viper_backlight_data = { static struct platform_pwm_backlight_data viper_backlight_data = {
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.enable_gpio = -1,
.init = viper_backlight_init, .init = viper_backlight_init,
.notify = viper_backlight_notify, .notify = viper_backlight_notify,
.exit = viper_backlight_exit, .exit = viper_backlight_exit,
......
...@@ -210,13 +210,11 @@ static struct platform_pwm_backlight_data z2_backlight_data[] = { ...@@ -210,13 +210,11 @@ static struct platform_pwm_backlight_data z2_backlight_data[] = {
/* Keypad Backlight */ /* Keypad Backlight */
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 0, .dft_brightness = 0,
.enable_gpio = -1,
}, },
[1] = { [1] = {
/* LCD Backlight */ /* LCD Backlight */
.max_brightness = 1023, .max_brightness = 1023,
.dft_brightness = 512, .dft_brightness = 512,
.enable_gpio = -1,
}, },
}; };
......
...@@ -117,7 +117,6 @@ static struct pwm_lookup zylonite_pwm_lookup[] = { ...@@ -117,7 +117,6 @@ static struct pwm_lookup zylonite_pwm_lookup[] = {
static struct platform_pwm_backlight_data zylonite_backlight_data = { static struct platform_pwm_backlight_data zylonite_backlight_data = {
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.enable_gpio = -1,
}; };
static struct platform_device zylonite_backlight_device = { static struct platform_device zylonite_backlight_device = {
......
...@@ -516,7 +516,6 @@ static void h1940_backlight_exit(struct device *dev) ...@@ -516,7 +516,6 @@ static void h1940_backlight_exit(struct device *dev)
static struct platform_pwm_backlight_data backlight_data = { static struct platform_pwm_backlight_data backlight_data = {
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 50, .dft_brightness = 50,
.enable_gpio = -1,
.init = h1940_backlight_init, .init = h1940_backlight_init,
.notify = h1940_backlight_notify, .notify = h1940_backlight_notify,
.exit = h1940_backlight_exit, .exit = h1940_backlight_exit,
......
...@@ -534,7 +534,6 @@ static int rx1950_backlight_notify(struct device *dev, int brightness) ...@@ -534,7 +534,6 @@ static int rx1950_backlight_notify(struct device *dev, int brightness)
static struct platform_pwm_backlight_data rx1950_backlight_data = { static struct platform_pwm_backlight_data rx1950_backlight_data = {
.max_brightness = 24, .max_brightness = 24,
.dft_brightness = 4, .dft_brightness = 4,
.enable_gpio = -1,
.init = rx1950_backlight_init, .init = rx1950_backlight_init,
.notify = rx1950_backlight_notify, .notify = rx1950_backlight_notify,
.exit = rx1950_backlight_exit, .exit = rx1950_backlight_exit,
......
...@@ -65,7 +65,6 @@ static struct samsung_bl_drvdata samsung_dfl_bl_data __initdata = { ...@@ -65,7 +65,6 @@ static struct samsung_bl_drvdata samsung_dfl_bl_data __initdata = {
.plat_data = { .plat_data = {
.max_brightness = 255, .max_brightness = 255,
.dft_brightness = 255, .dft_brightness = 255,
.enable_gpio = -1,
.init = samsung_bl_init, .init = samsung_bl_init,
.exit = samsung_bl_exit, .exit = samsung_bl_exit,
}, },
...@@ -111,8 +110,6 @@ void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info, ...@@ -111,8 +110,6 @@ void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
samsung_bl_data->dft_brightness = bl_data->dft_brightness; samsung_bl_data->dft_brightness = bl_data->dft_brightness;
if (bl_data->lth_brightness) if (bl_data->lth_brightness)
samsung_bl_data->lth_brightness = bl_data->lth_brightness; samsung_bl_data->lth_brightness = bl_data->lth_brightness;
if (bl_data->enable_gpio >= 0)
samsung_bl_data->enable_gpio = bl_data->enable_gpio;
if (bl_data->init) if (bl_data->init)
samsung_bl_data->init = bl_data->init; samsung_bl_data->init = bl_data->init;
if (bl_data->notify) if (bl_data->notify)
......
...@@ -114,7 +114,6 @@ static struct pwm_lookup crag6410_pwm_lookup[] = { ...@@ -114,7 +114,6 @@ static struct pwm_lookup crag6410_pwm_lookup[] = {
static struct platform_pwm_backlight_data crag6410_backlight_data = { static struct platform_pwm_backlight_data crag6410_backlight_data = {
.max_brightness = 1000, .max_brightness = 1000,
.dft_brightness = 600, .dft_brightness = 600,
.enable_gpio = -1,
}; };
static struct platform_device crag6410_backlight_device = { static struct platform_device crag6410_backlight_device = {
......
...@@ -115,7 +115,6 @@ static void hmt_bl_exit(struct device *dev) ...@@ -115,7 +115,6 @@ static void hmt_bl_exit(struct device *dev)
static struct platform_pwm_backlight_data hmt_backlight_data = { static struct platform_pwm_backlight_data hmt_backlight_data = {
.max_brightness = 100 * 256, .max_brightness = 100 * 256,
.dft_brightness = 40 * 256, .dft_brightness = 40 * 256,
.enable_gpio = -1,
.init = hmt_bl_init, .init = hmt_bl_init,
.notify = hmt_bl_notify, .notify = hmt_bl_notify,
.exit = hmt_bl_exit, .exit = hmt_bl_exit,
......
...@@ -150,7 +150,6 @@ static int smartq_bl_init(struct device *dev) ...@@ -150,7 +150,6 @@ static int smartq_bl_init(struct device *dev)
static struct platform_pwm_backlight_data smartq_backlight_data = { static struct platform_pwm_backlight_data smartq_backlight_data = {
.max_brightness = 1000, .max_brightness = 1000,
.dft_brightness = 600, .dft_brightness = 600,
.enable_gpio = -1,
.init = smartq_bl_init, .init = smartq_bl_init,
}; };
......
...@@ -623,7 +623,7 @@ static struct pwm_lookup smdk6410_pwm_lookup[] = { ...@@ -623,7 +623,7 @@ static struct pwm_lookup smdk6410_pwm_lookup[] = {
}; };
static struct platform_pwm_backlight_data smdk6410_bl_data = { static struct platform_pwm_backlight_data smdk6410_bl_data = {
.enable_gpio = -1, /* Intentionally blank */
}; };
static struct dwc2_hsotg_plat smdk6410_hsotg_pdata; static struct dwc2_hsotg_plat smdk6410_hsotg_pdata;
......
...@@ -55,7 +55,6 @@ static struct pwm_lookup nb0916_pwm_lookup[] = { ...@@ -55,7 +55,6 @@ static struct pwm_lookup nb0916_pwm_lookup[] = {
static struct platform_pwm_backlight_data nb0916_backlight_data = { static struct platform_pwm_backlight_data nb0916_backlight_data = {
.max_brightness = 100, .max_brightness = 100,
.dft_brightness = 100, .dft_brightness = 100,
.enable_gpio = -1,
}; };
static struct gpio_keys_button nb0916_gpio_keys[] = { static struct gpio_keys_button nb0916_gpio_keys[] = {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h> #include <linux/gpio/consumer.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/lcd.h> #include <linux/lcd.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
...@@ -90,9 +90,8 @@ struct corgi_lcd { ...@@ -90,9 +90,8 @@ struct corgi_lcd {
int mode; int mode;
char buf[2]; char buf[2];
int gpio_backlight_on; struct gpio_desc *backlight_on;
int gpio_backlight_cont; struct gpio_desc *backlight_cont;
int gpio_backlight_cont_inverted;
void (*kick_battery)(void); void (*kick_battery)(void);
}; };
...@@ -403,13 +402,13 @@ static int corgi_bl_set_intensity(struct corgi_lcd *lcd, int intensity) ...@@ -403,13 +402,13 @@ static int corgi_bl_set_intensity(struct corgi_lcd *lcd, int intensity)
corgi_ssp_lcdtg_send(lcd, DUTYCTRL_ADRS, intensity); corgi_ssp_lcdtg_send(lcd, DUTYCTRL_ADRS, intensity);
/* Bit 5 via GPIO_BACKLIGHT_CONT */ /* Bit 5 via GPIO_BACKLIGHT_CONT */
cont = !!(intensity & 0x20) ^ lcd->gpio_backlight_cont_inverted; cont = !!(intensity & 0x20);
if (gpio_is_valid(lcd->gpio_backlight_cont)) if (lcd->backlight_cont)
gpio_set_value_cansleep(lcd->gpio_backlight_cont, cont); gpiod_set_value_cansleep(lcd->backlight_cont, cont);
if (gpio_is_valid(lcd->gpio_backlight_on)) if (lcd->backlight_on)
gpio_set_value_cansleep(lcd->gpio_backlight_on, intensity); gpiod_set_value_cansleep(lcd->backlight_on, intensity);
if (lcd->kick_battery) if (lcd->kick_battery)
lcd->kick_battery(); lcd->kick_battery();
...@@ -482,48 +481,17 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd, ...@@ -482,48 +481,17 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
struct corgi_lcd_platform_data *pdata) struct corgi_lcd_platform_data *pdata)
{ {
struct spi_device *spi = lcd->spi_dev; struct spi_device *spi = lcd->spi_dev;
int err;
lcd->gpio_backlight_on = -1;
lcd->gpio_backlight_cont = -1;
if (gpio_is_valid(pdata->gpio_backlight_on)) {
err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_on,
"BL_ON");
if (err) {
dev_err(&spi->dev,
"failed to request GPIO%d for backlight_on\n",
pdata->gpio_backlight_on);
return err;
}
lcd->gpio_backlight_on = pdata->gpio_backlight_on;
gpio_direction_output(lcd->gpio_backlight_on, 0);
}
if (gpio_is_valid(pdata->gpio_backlight_cont)) { lcd->backlight_on = devm_gpiod_get_optional(&spi->dev,
err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_cont, "BL_ON", GPIOD_OUT_LOW);
"BL_CONT"); if (IS_ERR(lcd->backlight_on))
if (err) { return PTR_ERR(lcd->backlight_on);
dev_err(&spi->dev,
"failed to request GPIO%d for backlight_cont\n", lcd->backlight_cont = devm_gpiod_get_optional(&spi->dev, "BL_CONT",
pdata->gpio_backlight_cont); GPIOD_OUT_LOW);
return err; if (IS_ERR(lcd->backlight_cont))
} return PTR_ERR(lcd->backlight_cont);
lcd->gpio_backlight_cont = pdata->gpio_backlight_cont;
/* spitz and akita use both GPIOs for backlight, and
* have inverted polarity of GPIO_BACKLIGHT_CONT
*/
if (gpio_is_valid(lcd->gpio_backlight_on)) {
lcd->gpio_backlight_cont_inverted = 1;
gpio_direction_output(lcd->gpio_backlight_cont, 1);
} else {
lcd->gpio_backlight_cont_inverted = 0;
gpio_direction_output(lcd->gpio_backlight_cont, 0);
}
}
return 0; return 0;
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -258,8 +257,6 @@ static int pwm_backlight_parse_dt(struct device *dev, ...@@ -258,8 +257,6 @@ static int pwm_backlight_parse_dt(struct device *dev,
&data->post_pwm_on_delay); &data->post_pwm_on_delay);
of_property_read_u32(node, "pwm-off-delay-ms", &data->pwm_off_delay); of_property_read_u32(node, "pwm-off-delay-ms", &data->pwm_off_delay);
data->enable_gpio = -EINVAL;
/* /*
* Determine the number of brightness levels, if this property is not * Determine the number of brightness levels, if this property is not
* set a default table of brightness levels will be used. * set a default table of brightness levels will be used.
...@@ -502,22 +499,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -502,22 +499,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
goto err_alloc; goto err_alloc;
} }
/*
* Compatibility fallback for drivers still using the integer GPIO
* platform data. Must go away soon.
*/
if (!pb->enable_gpio && gpio_is_valid(data->enable_gpio)) {
ret = devm_gpio_request_one(&pdev->dev, data->enable_gpio,
GPIOF_OUT_INIT_HIGH, "enable");
if (ret < 0) {
dev_err(&pdev->dev, "failed to request GPIO#%d: %d\n",
data->enable_gpio, ret);
goto err_alloc;
}
pb->enable_gpio = gpio_to_desc(data->enable_gpio);
}
/* /*
* If the GPIO is not known to be already configured as output, that * If the GPIO is not known to be already configured as output, that
* is, if gpiod_get_direction returns either 1 or -EINVAL, change the * is, if gpiod_get_direction returns either 1 or -EINVAL, change the
......
...@@ -16,8 +16,6 @@ struct platform_pwm_backlight_data { ...@@ -16,8 +16,6 @@ struct platform_pwm_backlight_data {
unsigned int *levels; unsigned int *levels;
unsigned int post_pwm_on_delay; unsigned int post_pwm_on_delay;
unsigned int pwm_off_delay; unsigned int pwm_off_delay;
/* TODO remove once all users are switched to gpiod_* API */
int enable_gpio;
int (*init)(struct device *dev); int (*init)(struct device *dev);
int (*notify)(struct device *dev, int brightness); int (*notify)(struct device *dev, int brightness);
void (*notify_after)(struct device *dev, int brightness); void (*notify_after)(struct device *dev, int brightness);
......
...@@ -11,9 +11,6 @@ struct corgi_lcd_platform_data { ...@@ -11,9 +11,6 @@ struct corgi_lcd_platform_data {
int default_intensity; int default_intensity;
int limit_mask; int limit_mask;
int gpio_backlight_on; /* -1 if n/a */
int gpio_backlight_cont; /* -1 if n/a */
void (*notify)(int intensity); void (*notify)(int intensity);
void (*kick_battery)(void); void (*kick_battery)(void);
}; };
......
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