Commit 4512d92b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
#include <linux/spi/spi.h>
#include <linux/spi/pxa2xx_spi.h>
#include <linux/spi/libertas_spi.h>
#include <linux/spi/lms283gf05.h>
#include <linux/power_supply.h>
#include <linux/mtd/physmap.h>
#include <linux/gpio.h>
@@ -578,8 +577,13 @@ static struct pxa2xx_spi_chip lms283_chip_info = {
	.gpio_cs	= GPIO88_ZIPITZ2_LCD_CS,
};

static const struct lms283gf05_pdata lms283_pdata = {
	.reset_gpio	= GPIO19_ZIPITZ2_LCD_RESET,
static struct gpiod_lookup_table lms283_gpio_table = {
	.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 = {
@@ -595,7 +599,6 @@ static struct spi_board_info spi_board_info[] __initdata = {
{
	.modalias		= "lms283gf05",
	.controller_data	= &lms283_chip_info,
	.platform_data		= &lms283_pdata,
	.max_speed_hz		= 400000,
	.bus_num		= 2,
	.chip_select		= 0,
@@ -615,6 +618,7 @@ static void __init z2_spi_init(void)
{
	pxa2xx_set_spi_info(1, &pxa_ssp1_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));
}
#else
+3 −9
Original line number Diff line number Diff line
@@ -137,15 +137,7 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
		brightness = max_brightness;
	}

	if (brightness)
		/* 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);
	ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
	if (IS_ERR(ktd253->gpiod)) {
		ret = PTR_ERR(ktd253->gpiod);
		if (ret != -EPROBE_DEFER)
@@ -153,6 +145,8 @@ static int ktd253_backlight_probe(struct platform_device *pdev)
		return ret;
	}
	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,
					    &ktd253_backlight_ops, NULL);
+17 −26
Original line number Diff line number Diff line
@@ -9,16 +9,16 @@
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/lcd.h>

#include <linux/spi/spi.h>
#include <linux/spi/lms283gf05.h>
#include <linux/module.h>

struct lms283gf05_state {
	struct spi_device	*spi;
	struct lcd_device	*ld;
	struct gpio_desc	*reset;
};

struct lms283gf05_seq {
@@ -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);
	gpio_set_value(gpio, inverted);
	gpiod_set_value(gpiod, 1); /* Asserted */
	mdelay(20);
	gpio_set_value(gpio, !inverted);
	gpiod_set_value(gpiod, 0); /* De-asserted */
	mdelay(20);
}

@@ -125,18 +125,15 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power)
{
	struct lms283gf05_state *st = lcd_get_data(ld);
	struct spi_device *spi = st->spi;
	struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev);

	if (power <= FB_BLANK_NORMAL) {
		if (pdata)
			lms283gf05_reset(pdata->reset_gpio,
					pdata->reset_inverted);
		if (st->reset)
			lms283gf05_reset(st->reset);
		lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
	} else {
		lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq));
		if (pdata)
			gpio_set_value(pdata->reset_gpio,
					pdata->reset_inverted);
		if (st->reset)
			gpiod_set_value(st->reset, 1); /* Asserted */
	}

	return 0;
@@ -150,24 +147,18 @@ static struct lcd_ops lms_ops = {
static int lms283gf05_probe(struct spi_device *spi)
{
	struct lms283gf05_state *st;
	struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev);
	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),
				GFP_KERNEL);
	if (st == NULL)
		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,
					&lms_ops);
	if (IS_ERR(ld))
@@ -179,8 +170,8 @@ static int lms283gf05_probe(struct spi_device *spi)
	spi_set_drvdata(spi, st);

	/* kick in the LCD */
	if (pdata)
		lms283gf05_reset(pdata->reset_gpio, pdata->reset_inverted);
	if (st->reset)
		lms283gf05_reset(st->reset);
	lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));

	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -1692,7 +1692,7 @@ static int wled_probe(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);
	cancel_delayed_work_sync(&wled->ovp_work);
+1 −1
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ static int sky81452_bl_probe(struct platform_device *pdev)
	}

	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;
	bd = devm_backlight_device_register(dev, name, dev, regmap,
						&sky81452_bl_ops, &props);
Loading