Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccf9901f authored by Maxime Ripard's avatar Maxime Ripard Committed by Tomi Valkeinen
Browse files

video: hx8357: Make IM pins optional



The IM pins of the HX8357 controller are used to define the interface
used to feed pixel stream to the LCD panel.

Most of the time, these pins are directly routed to either the ground or
the VCC to set their values.

Remove the need to assign GPIOs to these pins when we are in such a case.

Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent dbb5ff4c
Loading
Loading
Loading
Loading
+31 −21
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ struct hx8357_data {
	unsigned		reset;
	struct spi_device	*spi;
	int			state;
	bool			use_im_pins;
};

static u8 hx8357_seq_power[] = {
@@ -250,9 +251,11 @@ static int hx8357_lcd_init(struct lcd_device *lcdev)
	 * Set the interface selection pins to SPI mode, with three
	 * wires
	 */
	if (lcd->use_im_pins) {
		gpio_set_value_cansleep(lcd->im_pins[0], 1);
		gpio_set_value_cansleep(lcd->im_pins[1], 0);
		gpio_set_value_cansleep(lcd->im_pins[2], 1);
	}

	/* Reset the screen */
	gpio_set_value(lcd->reset, 1);
@@ -424,6 +427,9 @@ static int hx8357_probe(struct spi_device *spi)
		return -EINVAL;
	}

	if (of_find_property(spi->dev.of_node, "im-gpios", NULL)) {
		lcd->use_im_pins = 1;

		for (i = 0; i < HX8357_NUM_IM_PINS; i++) {
			lcd->im_pins[i] = of_get_named_gpio(spi->dev.of_node,
							    "im-gpios", i);
@@ -437,13 +443,17 @@ static int hx8357_probe(struct spi_device *spi)
			}

			ret = devm_gpio_request_one(&spi->dev, lcd->im_pins[i],
					GPIOF_OUT_INIT_LOW, "im_pins");
						    GPIOF_OUT_INIT_LOW,
						    "im_pins");
			if (ret) {
				dev_err(&spi->dev, "failed to request gpio %d: %d\n",
					lcd->im_pins[i], ret);
				return -EINVAL;
			}
		}
	} else {
		lcd->use_im_pins = 0;
	}

	lcdev = lcd_device_register("mxsfb", &spi->dev, lcd, &hx8357_ops);
	if (IS_ERR(lcdev)) {