diff options
| author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-05-31 06:39:31 -0400 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-06-17 07:33:18 -0400 |
| commit | 6077ce8d5901a07c3047fa7973cce5b98142ab2b (patch) | |
| tree | 8aee379513dd9c05609d80e4a57d409bc72c667d | |
| parent | 2e1def0c215cfca76af77cb9655a902bc4e7ba3b (diff) | |
OMAPDSS: Add NEC NL8048HL11 panel driver
Add NEC NL8048HL11 panel driver which uses the new DSS device model
and DSS ops.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
| -rw-r--r-- | drivers/video/omap2/displays-new/Kconfig | 8 | ||||
| -rw-r--r-- | drivers/video/omap2/displays-new/Makefile | 1 | ||||
| -rw-r--r-- | drivers/video/omap2/displays-new/panel-nec-nl8048hl11.c | 394 | ||||
| -rw-r--r-- | include/video/omap-panel-data.h | 18 |
4 files changed, 421 insertions, 0 deletions
diff --git a/drivers/video/omap2/displays-new/Kconfig b/drivers/video/omap2/displays-new/Kconfig index c66ecb23e3d9..7ad34ac7a816 100644 --- a/drivers/video/omap2/displays-new/Kconfig +++ b/drivers/video/omap2/displays-new/Kconfig | |||
| @@ -62,4 +62,12 @@ config DISPLAY_PANEL_TPO_TD043MTEA1 | |||
| 62 | help | 62 | help |
| 63 | LCD Panel used in OMAP3 Pandora | 63 | LCD Panel used in OMAP3 Pandora |
| 64 | 64 | ||
| 65 | config DISPLAY_PANEL_NEC_NL8048HL11 | ||
| 66 | tristate "NEC NL8048HL11 Panel" | ||
| 67 | depends on SPI | ||
| 68 | depends on BACKLIGHT_CLASS_DEVICE | ||
| 69 | help | ||
| 70 | This NEC NL8048HL11 panel is TFT LCD used in the | ||
| 71 | Zoom2/3/3630 sdp boards. | ||
| 72 | |||
| 65 | endmenu | 73 | endmenu |
diff --git a/drivers/video/omap2/displays-new/Makefile b/drivers/video/omap2/displays-new/Makefile index 628ea3e7bb69..5aeb11b8fcd5 100644 --- a/drivers/video/omap2/displays-new/Makefile +++ b/drivers/video/omap2/displays-new/Makefile | |||
| @@ -9,3 +9,4 @@ obj-$(CONFIG_DISPLAY_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o | |||
| 9 | obj-$(CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o | 9 | obj-$(CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o |
| 10 | obj-$(CONFIG_DISPLAY_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o | 10 | obj-$(CONFIG_DISPLAY_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o |
| 11 | obj-$(CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o | 11 | obj-$(CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o |
| 12 | obj-$(CONFIG_DISPLAY_PANEL_NEC_NL8048HL11) += panel-nec-nl8048hl11.o | ||
diff --git a/drivers/video/omap2/displays-new/panel-nec-nl8048hl11.c b/drivers/video/omap2/displays-new/panel-nec-nl8048hl11.c new file mode 100644 index 000000000000..bb217da65c5f --- /dev/null +++ b/drivers/video/omap2/displays-new/panel-nec-nl8048hl11.c | |||
| @@ -0,0 +1,394 @@ | |||
| 1 | /* | ||
| 2 | * NEC NL8048HL11 Panel driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010 Texas Instruments Inc. | ||
| 5 | * Author: Erik Gilling <konkers@android.com> | ||
| 6 | * Converted to new DSS device model: Tomi Valkeinen <tomi.valkeinen@ti.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2 of the License, or | ||
| 11 | * (at your option) any later version. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/module.h> | ||
| 15 | #include <linux/delay.h> | ||
| 16 | #include <linux/spi/spi.h> | ||
| 17 | #include <linux/fb.h> | ||
| 18 | #include <linux/gpio.h> | ||
| 19 | |||
| 20 | #include <video/omapdss.h> | ||
| 21 | #include <video/omap-panel-data.h> | ||
| 22 | |||
| 23 | struct panel_drv_data { | ||
| 24 | struct omap_dss_device dssdev; | ||
| 25 | struct omap_dss_device *in; | ||
| 26 | |||
| 27 | struct omap_video_timings videomode; | ||
| 28 | |||
| 29 | int data_lines; | ||
| 30 | |||
| 31 | int res_gpio; | ||
| 32 | int qvga_gpio; | ||
| 33 | |||
| 34 | struct spi_device *spi; | ||
| 35 | }; | ||
| 36 | |||
| 37 | #define LCD_XRES 800 | ||
| 38 | #define LCD_YRES 480 | ||
| 39 | /* | ||
| 40 | * NEC PIX Clock Ratings | ||
| 41 | * MIN:21.8MHz TYP:23.8MHz MAX:25.7MHz | ||
| 42 | */ | ||
| 43 | #define LCD_PIXEL_CLOCK 23800 | ||
| 44 | |||
| 45 | static const struct { | ||
| 46 | unsigned char addr; | ||
| 47 | unsigned char dat; | ||
| 48 | } nec_8048_init_seq[] = { | ||
| 49 | { 3, 0x01 }, { 0, 0x00 }, { 1, 0x01 }, { 4, 0x00 }, { 5, 0x14 }, | ||
| 50 | { 6, 0x24 }, { 16, 0xD7 }, { 17, 0x00 }, { 18, 0x00 }, { 19, 0x55 }, | ||
| 51 | { 20, 0x01 }, { 21, 0x70 }, { 22, 0x1E }, { 23, 0x25 }, { 24, 0x25 }, | ||
| 52 | { 25, 0x02 }, { 26, 0x02 }, { 27, 0xA0 }, { 32, 0x2F }, { 33, 0x0F }, | ||
| 53 | { 34, 0x0F }, { 35, 0x0F }, { 36, 0x0F }, { 37, 0x0F }, { 38, 0x0F }, | ||
| 54 | { 39, 0x00 }, { 40, 0x02 }, { 41, 0x02 }, { 42, 0x02 }, { 43, 0x0F }, | ||
| 55 | { 44, 0x0F }, { 45, 0x0F }, { 46, 0x0F }, { 47, 0x0F }, { 48, 0x0F }, | ||
| 56 | { 49, 0x0F }, { 50, 0x00 }, { 51, 0x02 }, { 52, 0x02 }, { 53, 0x02 }, | ||
| 57 | { 80, 0x0C }, { 83, 0x42 }, { 84, 0x42 }, { 85, 0x41 }, { 86, 0x14 }, | ||
| 58 | { 89, 0x88 }, { 90, 0x01 }, { 91, 0x00 }, { 92, 0x02 }, { 93, 0x0C }, | ||
| 59 | { 94, 0x1C }, { 95, 0x27 }, { 98, 0x49 }, { 99, 0x27 }, { 102, 0x76 }, | ||
| 60 | { 103, 0x27 }, { 112, 0x01 }, { 113, 0x0E }, { 114, 0x02 }, | ||
| 61 | { 115, 0x0C }, { 118, 0x0C }, { 121, 0x30 }, { 130, 0x00 }, | ||
| 62 | { 131, 0x00 }, { 132, 0xFC }, { 134, 0x00 }, { 136, 0x00 }, | ||
| 63 | { 138, 0x00 }, { 139, 0x00 }, { 140, 0x00 }, { 141, 0xFC }, | ||
| 64 | { 143, 0x00 }, { 145, 0x00 }, { 147, 0x00 }, { 148, 0x00 }, | ||
| 65 | { 149, 0x00 }, { 150, 0xFC }, { 152, 0x00 }, { 154, 0x00 }, | ||
| 66 | { 156, 0x00 }, { 157, 0x00 }, { 2, 0x00 }, | ||
| 67 | }; | ||
| 68 | |||
| 69 | static const struct omap_video_timings nec_8048_panel_timings = { | ||
| 70 | .x_res = LCD_XRES, | ||
| 71 | .y_res = LCD_YRES, | ||
| 72 | .pixel_clock = LCD_PIXEL_CLOCK, | ||
| 73 | .hfp = 6, | ||
| 74 | .hsw = 1, | ||
| 75 | .hbp = 4, | ||
| 76 | .vfp = 3, | ||
| 77 | .vsw = 1, | ||
| 78 | .vbp = 4, | ||
| 79 | |||
| 80 | .vsync_level = OMAPDSS_SIG_ACTIVE_LOW, | ||
| 81 | .hsync_level = OMAPDSS_SIG_ACTIVE_LOW, | ||
| 82 | .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE, | ||
| 83 | .de_level = OMAPDSS_SIG_ACTIVE_HIGH, | ||
| 84 | .sync_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE, | ||
| 85 | }; | ||
| 86 | |||
| 87 | #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev) | ||
| 88 | |||
| 89 | static int nec_8048_spi_send(struct spi_device *spi, unsigned char reg_addr, | ||
| 90 | unsigned char reg_data) | ||
| 91 | { | ||
| 92 | int ret = 0; | ||
| 93 | unsigned int cmd = 0, data = 0; | ||
| 94 | |||
| 95 | cmd = 0x0000 | reg_addr; /* register address write */ | ||
| 96 | data = 0x0100 | reg_data; /* register data write */ | ||
| 97 | data = (cmd << 16) | data; | ||
| 98 | |||
| 99 | ret = spi_write(spi, (unsigned char *)&data, 4); | ||
| 100 | if (ret) | ||
| 101 | pr_err("error in spi_write %x\n", data); | ||
| 102 | |||
| 103 | return ret; | ||
| 104 | } | ||
| 105 | |||
| 106 | static int init_nec_8048_wvga_lcd(struct spi_device *spi) | ||
| 107 | { | ||
| 108 | unsigned int i; | ||
| 109 | /* Initialization Sequence */ | ||
| 110 | /* nec_8048_spi_send(spi, REG, VAL) */ | ||
| 111 | for (i = 0; i < (ARRAY_SIZE(nec_8048_init_seq) - 1); i++) | ||
| 112 | nec_8048_spi_send(spi, nec_8048_init_seq[i].addr, | ||
| 113 | nec_8048_init_seq[i].dat); | ||
| 114 | udelay(20); | ||
| 115 | nec_8048_spi_send(spi, nec_8048_init_seq[i].addr, | ||
| 116 | nec_8048_init_seq[i].dat); | ||
| 117 | return 0; | ||
| 118 | } | ||
| 119 | |||
| 120 | static int nec_8048_connect(struct omap_dss_device *dssdev) | ||
| 121 | { | ||
| 122 | struct panel_drv_data *ddata = to_panel_data(dssdev); | ||
| 123 | struct omap_dss_device *in = ddata->in; | ||
| 124 | int r; | ||
| 125 | |||
| 126 | if (omapdss_device_is_connected(dssdev)) | ||
| 127 | return 0; | ||
| 128 | |||
| 129 | r = in->ops.dpi->connect(in, dssdev); | ||
| 130 | if (r) | ||
| 131 | return r; | ||
| 132 | |||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | |||
| 136 | static void nec_8048_disconnect(struct omap_dss_device *dssdev) | ||
| 137 | { | ||
| 138 | struct panel_drv_data *ddata = to_panel_data(dssdev); | ||
| 139 | struct omap_dss_device *in = ddata->in; | ||
| 140 | |||
| 141 | if (!omapdss_device_is_connected(dssdev)) | ||
| 142 | return; | ||
| 143 | |||
| 144 | in->ops.dpi->disconnect(in, dssdev); | ||
| 145 | } | ||
| 146 | |||
| 147 | static int nec_8048_enable(struct omap_dss_device *dssdev) | ||
| 148 | { | ||
| 149 | struct panel_drv_data *ddata = to_panel_data(dssdev); | ||
