From: Igor Grinberg <grinberg@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] lcd: add DataImage SCF0403x LCD panel support
Date: Mon, 14 Oct 2013 16:34:18 +0200 [thread overview]
Message-ID: <525C00EA.5080907@compulab.co.il> (raw)
In-Reply-To: <1381329965-7775-3-git-send-email-nikita@compulab.co.il>
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@ti.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Signed-off-by: Nikita Kiryanov <nikita@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.
next prev parent reply other threads:[~2013-10-14 14:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 14:46 [U-Boot] [PATCH 0/3] Add support for SPI based DataImage LCD panel Nikita Kiryanov
2013-10-09 14:46 ` [U-Boot] [PATCH 1/3] spi: omap3: add support for more word lengths Nikita Kiryanov
2013-10-10 15:26 ` Gerhard Sittig
2013-10-14 14:18 ` Igor Grinberg
2013-10-15 11:09 ` Nikita Kiryanov
2013-10-09 14:46 ` [U-Boot] [PATCH 2/3] lcd: add DataImage SCF0403x LCD panel support Nikita Kiryanov
2013-10-10 16:57 ` Anatolij Gustschin
2013-10-14 14:34 ` Igor Grinberg [this message]
2013-10-09 14:46 ` [U-Boot] [PATCH 3/3] cm_t35: use scf0403 driver Nikita Kiryanov
2013-10-10 17:01 ` Anatolij Gustschin
2013-10-15 6:38 ` Igor Grinberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=525C00EA.5080907@compulab.co.il \
--to=grinberg@compulab.co.il \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.