diff options
| author | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2009-12-09 11:19:42 -0500 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2009-12-09 11:19:42 -0500 |
| commit | 3b8f29b4152899e91c210186a38bffb37ea1a226 (patch) | |
| tree | c572a968b164d0af30f99ed5ee0f42e8bc07b736 | |
| parent | b39a982ddecf1d95ed96f8457c39d3ea11df93f6 (diff) | |
OMAP: DSS2: Add generic and Sharp panel drivers
Add Generic panel (user for DVI output) and Sharp LS037V7DW01 LCD panel.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
| -rw-r--r-- | drivers/video/omap2/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/video/omap2/Makefile | 1 | ||||
| -rw-r--r-- | drivers/video/omap2/displays/Kconfig | 16 | ||||
| -rw-r--r-- | drivers/video/omap2/displays/Makefile | 2 | ||||
| -rw-r--r-- | drivers/video/omap2/displays/panel-generic.c | 104 | ||||
| -rw-r--r-- | drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | 153 |
6 files changed, 277 insertions, 0 deletions
diff --git a/drivers/video/omap2/Kconfig b/drivers/video/omap2/Kconfig index 3e60d7e88540..d877c361abda 100644 --- a/drivers/video/omap2/Kconfig +++ b/drivers/video/omap2/Kconfig | |||
| @@ -6,3 +6,4 @@ config OMAP2_VRFB | |||
| 6 | 6 | ||
| 7 | source "drivers/video/omap2/dss/Kconfig" | 7 | source "drivers/video/omap2/dss/Kconfig" |
| 8 | source "drivers/video/omap2/omapfb/Kconfig" | 8 | source "drivers/video/omap2/omapfb/Kconfig" |
| 9 | source "drivers/video/omap2/displays/Kconfig" | ||
diff --git a/drivers/video/omap2/Makefile b/drivers/video/omap2/Makefile index 3ba6ef5e30d4..d853d05dad31 100644 --- a/drivers/video/omap2/Makefile +++ b/drivers/video/omap2/Makefile | |||
| @@ -3,3 +3,4 @@ obj-$(CONFIG_OMAP2_VRFB) += vrfb.o | |||
| 3 | 3 | ||
| 4 | obj-y += dss/ | 4 | obj-y += dss/ |
| 5 | obj-y += omapfb/ | 5 | obj-y += omapfb/ |
| 6 | obj-y += displays/ | ||
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig new file mode 100644 index 000000000000..2a39bfeca11d --- /dev/null +++ b/drivers/video/omap2/displays/Kconfig | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | menu "OMAP2/3 Display Device Drivers" | ||
| 2 | depends on OMAP2_DSS | ||
| 3 | |||
| 4 | config PANEL_GENERIC | ||
| 5 | tristate "Generic Panel" | ||
| 6 | help | ||
| 7 | Generic panel driver. | ||
| 8 | Used for DVI output for Beagle and OMAP3 SDP. | ||
| 9 | |||
| 10 | config PANEL_SHARP_LS037V7DW01 | ||
| 11 | tristate "Sharp LS037V7DW01 LCD Panel" | ||
| 12 | depends on OMAP2_DSS | ||
| 13 | help | ||
| 14 | LCD Panel used in TI's SDP3430 and EVM boards | ||
| 15 | |||
| 16 | endmenu | ||
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile new file mode 100644 index 000000000000..12dd37c227df --- /dev/null +++ b/drivers/video/omap2/displays/Makefile | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | obj-$(CONFIG_PANEL_GENERIC) += panel-generic.o | ||
| 2 | obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o | ||
diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c new file mode 100644 index 000000000000..eb48d1afd800 --- /dev/null +++ b/drivers/video/omap2/displays/panel-generic.c | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | /* | ||
| 2 | * Generic panel support | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Nokia Corporation | ||
| 5 | * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 14 | * more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License along with | ||
| 17 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/module.h> | ||
| 21 | #include <linux/delay.h> | ||
| 22 | |||
| 23 | #include <plat/display.h> | ||
| 24 | |||
| 25 | static struct omap_video_timings generic_panel_timings = { | ||
| 26 | /* 640 x 480 @ 60 Hz Reduced blanking VESA CVT 0.31M3-R */ | ||
| 27 | .x_res = 640, | ||
| 28 | .y_res = 480, | ||
| 29 | .pixel_clock = 23500, | ||
| 30 | .hfp = 48, | ||
| 31 | .hsw = 32, | ||
| 32 | .hbp = 80, | ||
| 33 | .vfp = 3, | ||
| 34 | .vsw = 4, | ||
| 35 | .vbp = 7, | ||
| 36 | }; | ||
| 37 | |||
| 38 | static int generic_panel_probe(struct omap_dss_device *dssdev) | ||
| 39 | { | ||
| 40 | dssdev->panel.config = OMAP_DSS_LCD_TFT; | ||
| 41 | dssdev->panel.timings = generic_panel_timings; | ||
| 42 | |||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | static void generic_panel_remove(struct omap_dss_device *dssdev) | ||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | static int generic_panel_enable(struct omap_dss_device *dssdev) | ||
| 51 | { | ||
| 52 | int r = 0; | ||
| 53 | |||
| 54 | if (dssdev->platform_enable) | ||
| 55 | r = dssdev->platform_enable(dssdev); | ||
| 56 | |||
| 57 | return r; | ||
| 58 | } | ||
| 59 | |||
| 60 | static void generic_panel_disable(struct omap_dss_device *dssdev) | ||
| 61 | { | ||
| 62 | if (dssdev->platform_disable) | ||
| 63 | dssdev->platform_disable(dssdev); | ||
| 64 | } | ||
| 65 | |||
| 66 | static int generic_panel_suspend(struct omap_dss_device *dssdev) | ||
| 67 | { | ||
| 68 | generic_panel_disable(dssdev); | ||
| 69 | return 0; | ||
| 70 | } | ||
| 71 | |||
| 72 | static int generic_panel_resume(struct omap_dss_device *dssdev) | ||
| 73 | { | ||
| 74 | return generic_panel_enable(dssdev); | ||
| 75 | } | ||
| 76 | |||
| 77 | static struct omap_dss_driver generic_driver = { | ||
| 78 | .probe = generic_panel_probe, | ||
| 79 | .remove = generic_panel_remove, | ||
| 80 | |||
| 81 | .enable = generic_panel_enable, | ||
| 82 | .disable = generic_panel_disable, | ||
| 83 | .suspend = generic_panel_suspend, | ||
| 84 | .resume = generic_panel_resume, | ||
| 85 | |||
| 86 | .driver = { | ||
| 87 | .name = "generic_panel", | ||
| 88 | .owner = THIS_MODULE, | ||
| 89 | }, | ||
| 90 | }; | ||
| 91 | |||
| 92 | static int __init generic_panel_drv_init(void) | ||
| 93 | { | ||
| 94 | return omap_dss_register_driver(&generic_driver); | ||
| 95 | } | ||
| 96 | |||
| 97 | static void __exit generic_panel_drv_exit(void) | ||
| 98 | { | ||
| 99 | omap_dss_unregister_driver(&generic_driver); | ||
| 100 | } | ||
| 101 | |||
| 102 | module_init(generic_panel_drv_init); | ||
| 103 | module_exit(generic_panel_drv_exit); | ||
| 104 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c new file mode 100644 index 000000000000..bbe880bbe795 --- /dev/null +++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | /* | ||
| 2 | * LCD panel driver for Sharp LS037V7DW01 | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Nokia Corporation | ||
| 5 | * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 14 | * more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License along with | ||
| 17 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/module.h> | ||
| 21 | #include <linux/delay.h> | ||
| 22 | #include <linux/device.h> | ||
| 23 | #include <linux/regulator/consumer.h> | ||
| 24 | #include <linux/err.h> | ||
| 25 | |||
| 26 | #include <plat/display.h> | ||
| 27 | |||
| 28 | struct sharp_data { | ||
| 29 | /* XXX This regulator should actually be in SDP board file, not here, | ||
| 30 | * as it doesn't actually power the LCD, but something else that | ||
| 31 | * affects the output to LCD (I think. Somebody clarify). It doesn't do | ||
| 32 | * harm here, as SDP is the only board using this currently */ | ||
| 33 | struct regulator *vdvi_reg; | ||
| 34 | }; | ||
| 35 | |||
| 36 | static struct omap_video_timings sharp_ls_timings = { | ||
| 37 | .x_res = 480, | ||
| 38 | .y_res = 640, | ||
| 39 | |||
| 40 | .pixel_clock = 19200, | ||
| 41 | |||
| 42 | .hsw = 2, | ||
| 43 | .hfp = 1, | ||
| 44 | .hbp = 28, | ||
| 45 | |||
| 46 | .vsw = 1, | ||
| 47 | .vfp = 1, | ||
| 48 | .vbp = 1, | ||
| 49 | }; | ||
| 50 | |||
| 51 | static int sharp_ls_panel_probe(struct omap_dss_device *dssdev) | ||
| 52 | { | ||
| 53 | struct sharp_data *sd; | ||
| 54 | |||
| 55 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
| 56 | OMAP_DSS_LCD_IHS; | ||
| 57 | dssdev->panel.acb = 0x28; | ||
| 58 | dssdev->panel.timings = sharp_ls_timings; | ||
| 59 | |||
| 60 | sd = kzalloc(sizeof(*sd), GFP_KERNEL); | ||
| 61 | if (!sd) | ||
| 62 | return -ENOMEM; | ||
| 63 | |||
| 64 | dev_set_drvdata(&dssdev->dev, sd); | ||
| 65 | |||
| 66 | sd->vdvi_reg = regulator_get(&dssdev->dev, "vdvi"); | ||
| 67 | if (IS_ERR(sd->vdvi_reg)) { | ||
| 68 | kfree(sd); | ||
| 69 | pr_err("failed to get VDVI regulator\n"); | ||
| 70 | return PTR_ERR(sd->vdvi_reg); | ||
| 71 | } | ||
| 72 | |||
| 73 | return 0; | ||
| 74 | } | ||
| 75 | |||
| 76 | static void sharp_ls_panel_remove(struct omap_dss_device *dssdev) | ||
| 77 | { | ||
| 78 | struct sharp_data *sd = dev_get_drvdata(&dssdev->dev); | ||
| 79 | |||
| 80 | regulator_put(sd->vdvi_reg); | ||
| 81 | |||
| 82 | kfree(sd); | ||
| 83 | } | ||
| 84 | |||
| 85 | static int sharp_ls_panel_enable(struct omap_dss_device *dssdev) | ||
| 86 | { | ||
| 87 | struct sharp_data *sd = dev_get_drvdata(&dssdev->dev); | ||
| 88 | int r = 0; | ||
| 89 | |||
| 90 | /* wait couple of vsyncs until enabling the LCD */ | ||
| 91 | msleep(50); | ||
| 92 | |||
| 93 | regulator_enable(sd->vdvi_reg); | ||
| 94 | |||
| 95 | if (dssdev->platform_enable) | ||
| 96 | r = dssdev->platform_enable(dssdev); | ||
| 97 | |||
| 98 | return r; | ||
| 99 | } | ||
| 100 | |||
| 101 | static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) | ||
| 102 | { | ||
| 103 | struct sharp_data *sd = dev_get_drvdata(&dssdev->dev); | ||
| 104 | |||
| 105 | if (dssdev->platform_disable) | ||
| 106 | dssdev->platform_disable(dssdev); | ||
| 107 | |||
| 108 | regulator_disable(sd->vdvi_reg); | ||
| 109 | |||
| 110 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
| 111 | |||
| 112 | msleep(100); | ||
| 113 | } | ||
| 114 | |||
| 115 | static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev) | ||
| 116 | { | ||
| 117 | sharp_ls_panel_disable(dssdev); | ||
| 118 | return 0; | ||
| 119 | } | ||
| 120 | |||
| 121 | static int sharp_ls_panel_resume(struct omap_dss_device *dssdev) | ||
| 122 | { | ||
| 123 | return sharp_ls_panel_enable(dssdev); | ||
| 124 | } | ||
| 125 | |||
| 126 | static struct omap_dss_driver sharp_ls_driver = { | ||
| 127 | .probe = sharp_ls_panel_probe, | ||
| 128 | .remove = sharp_ls_panel_remove, | ||
| 129 | |||
| 130 | .enable = sharp_ls_panel_enable, | ||
| 131 | .disable = sharp_ls_panel_disable, | ||
| 132 | .suspend = sharp_ls_panel_suspend, | ||
| 133 | .resume = sharp_ls_panel_resume, | ||
| 134 | |||
| 135 | .driver = { | ||
| 136 | .name = "sharp_ls_panel", | ||
| 137 | .owner = THIS_MODULE, | ||
| 138 | }, | ||
| 139 | }; | ||
| 140 | |||
| 141 | static int __init sharp_ls_panel_drv_init(void) | ||
| 142 | { | ||
| 143 | return omap_dss_register_driver(&sharp_ls_driver); | ||
| 144 | } | ||
| 145 | |||
| 146 | static void __exit sharp_ls_panel_drv_exit(void) | ||
| 147 | { | ||
| 148 | omap_dss_unregister_driver(&sharp_ls_driver); | ||
| 149 | } | ||
| 150 | |||
| 151 | module_init(sharp_ls_panel_drv_init); | ||
| 152 | module_exit(sharp_ls_panel_drv_exit); | ||
| 153 | MODULE_LICENSE("GPL"); | ||
