Re: [PATCH v2] OMAP: DSS2: Add NEC NL8048HL11-01B display panel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 21, 2010 at 3:25 PM, Samreen <samreen@xxxxxx> wrote:
> From: Erik Gilling <konkers@xxxxxxxxxxx>
>
> NEC WVGA LCD NL8048HL11-01B panel support has been added.
> This panel is being used in zoom2/zoom3/3630 sdp boards.
>

<snip>

> diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
> new file mode 100644
> index 0000000..0327731
> --- /dev/null
> +++ b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c

<snip>

> +static int spi_send(struct spi_device *spi, unsigned char reg_addr,
> +                       unsigned char reg_data)

you could be more consistent and name it nec_8048_spi_send.

> +{
> +       int ret = 0;
> +       unsigned int cmd = 0, data = 0;
> +
> +       cmd = 0x0000 | reg_addr; /* register address write */
> +       data = 0x0100 | reg_data ; /* register data write */
> +       data = (cmd << 16) | data;
> +
> +       ret = spi_write(spi, (unsigned char *)&data, 4);
> +       if (ret)
> +               pr_err("error in spi_write %x\n", data);
> +
> +       return ret;
> +}
> +
> +

one blank line is enough

> +static int init_nec_8048_wvga_lcd(struct spi_device *spi)
> +{
> +       /* Initialization Sequence */
> +       /* spi_send(spi, REG, VAL) */
> +       spi_send(spi, 3, 0x01);
> +       spi_send(spi, 0, 0x00);
> +       spi_send(spi, 1, 0x01);    /* R1 = 0x01 (normal), 0x03 (reversed) */
> +       spi_send(spi, 4, 0x00);
> +       spi_send(spi, 5, 0x14);
> +       spi_send(spi, 6, 0x24);

This code wastes quite a bit of space (at least 3 mov and one bl
instruction for every such write on ARM), you could better do
something like:

static const struct {
  u8 address;
  u8 value;
} nec_8048_init_seq[] = {
  { 3, 0x01 },
  { 0, 0x00 },
  { 1, 0x01 },
  ...
};

static int init_nec_8048_wvga_lcd(struct spi_device *spi)
{
  int i, ret;
  for (i = 0; i < ARRAY_SIZE(nec_8048_init_seq); i++) {
    ret = nec_8048_spi_send(spi, nec_8048_init_seq[i].address,
nec_8048_init_seq[i].value);
    if (ret < 0)
      break;
  }
  udelay(20);
  nec_8048_spi_send(spi, 2, 0x00);
}


> +MODULE_DESCRIPTION("Nec Driver");

could use more complete description here.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux