[U-Boot] [PATCH 2/3] lcd: add DataImage SCF0403x LCD panel support
Igor Grinberg
grinberg at compulab.co.il
Mon Oct 14 16:34:18 CEST 2013
Hi Nikita,
On 10/09/13 16:46, Nikita Kiryanov wrote:
> Add SPI-based driver for DataImage SCF0403852GGU04 and SCF0403526GGU20
> LCD panels.
>
> Cc: Tom Rini <trini at ti.com>
> Cc: Anatolij Gustschin <agust at denx.de>
> Cc: Igor Grinberg <grinberg at compulab.co.il>
> Signed-off-by: Nikita Kiryanov <nikita at compulab.co.il>
> ---
> drivers/video/Makefile | 1 +
> drivers/video/scf0403_lcd.c | 298 ++++++++++++++++++++++++++++++++++++++++++++
> include/scf0403_lcd.h | 22 ++++
> include/spi.h | 1 +
> 4 files changed, 322 insertions(+)
> create mode 100644 drivers/video/scf0403_lcd.c
> create mode 100644 include/scf0403_lcd.h
[...]
> diff --git a/drivers/video/scf0403_lcd.c b/drivers/video/scf0403_lcd.c
> new file mode 100644
> index 0000000..1d1c3ff
> --- /dev/null
> +++ b/drivers/video/scf0403_lcd.c
> @@ -0,0 +1,298 @@
[...]
> +static void scf0403_gpio_reset(unsigned int gpio)
> +{
> + if (!gpio_is_valid(gpio))
> + return;
> +
> + gpio_set_value(gpio, 1);
> + mdelay(100);
> + gpio_set_value(gpio, 0);
> + mdelay(40);
> + gpio_set_value(gpio, 1);
> + mdelay(100);
> +}
[...]
> +int scf0403_init(int reset_gpio)
> +{
> + int error;
> +
> + if (!gpio_is_valid(reset_gpio)) {
> + printf("scf0403 reset_gpio not valid\n");
> + return -1;
The LCD reset pin does not have to be connected to a GPIO.
Instead, it can be handled in another manner (e.g. by hardware).
So, I don't think you should fail the LCD initialization if
some kind of -EINVAL is passed.
> + }
> +
> + priv.reset_gpio = reset_gpio;
> + error = scf0403_request_reset_gpio(reset_gpio);
> + if (error) {
> + printf("Failed requesting reset GPIO%d: %d\n",
> + reset_gpio, error);
> + return error;
> + }
> +
> + priv.spi = spi_setup_slave(3, 0, 1000000, SPI_MODE_0);
> + error = spi_claim_bus(priv.spi);
> + if (error) {
> + gpio_free(priv.reset_gpio);
> + return error;
> + }
> +
> + /* reset LCD */
> + scf0403_gpio_reset(reset_gpio);
> +
> + error = scf0403_spi_read_rddid(priv.spi, &priv.rddid);
> + if (error) {
> + printf("IDs read failed\n");
> + gpio_free(priv.reset_gpio);
> + spi_release_bus(priv.spi);
> +
> + return error;
> + }
> +
> + if (priv.rddid == SCF0403852GGU04_ID) {
> + priv.init_seq = scf0403_initseq_sn04;
> + priv.seq_size = ARRAY_SIZE(scf0403_initseq_sn04);
> + } else {
> + priv.init_seq = scf0403_initseq_sn20;
> + priv.seq_size = ARRAY_SIZE(scf0403_initseq_sn20);
> + }
> +
> + scf0403_lcd_init(&priv);
> +
> + /* Start operation */
> + scf0403_spi_transfer(priv.spi, &scf0403_cmd_dison);
> + mdelay(100);
> + scf0403_spi_transfer(priv.spi, &scf0403_cmd_slpout);
> + spi_release_bus(priv.spi);
> +
> + return 0;
> +}
[...]
> diff --git a/include/spi.h b/include/spi.h
> index ae318ff..4441527 100644
> --- a/include/spi.h
> +++ b/include/spi.h
> @@ -27,6 +27,7 @@
> /* SPI transfer flags */
> #define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */
> #define SPI_XFER_END 0x02 /* Deassert CS after transfer */
> +#define SPI_XFER_ONCE (SPI_XFER_BEGIN | SPI_XFER_END)
This bit does not belong to the patch.
>
> /* Header byte that marks the start of the message */
> #define SPI_PREAMBLE_END_BYTE 0xec
>
--
Regards,
Igor.
More information about the U-Boot
mailing list