* [PATCH v3 00/21] OMAP: DSS2: Taal panel driver updates
@ 2010-05-05 14:27 Jani Nikula
2010-05-05 14:27 ` [PATCH v3 01/21] OMAP: DSS2: Taal: Add panel hardware reset Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
Hi -
This set of patches, on top of [1], contains assorted fixes and cleanups to the
Taal panel driver (01-14), configures board/platform specific things in a new
Nokia DSI command mode panel specific struct instead of DSS structs (15-17), and
makes it feasible to add support for similar DSI command mode panels in the same
driver (18-21).
v3:
- patch 01: move taal_hw_reset() earlier than request_irq() in probe to be ready
to handle the irqs
- patch 07: add panel enabled check also to taal_enable_te(), not just
taal_run_test()
v2:
- No functional changes since v1, just filled in some missing commit messages
(thanks Tony for your feedback!)
[1] git://gitorious.org/linux-omap-dss2/linux.git
BR,
Jani.
Jani Nikula (20):
OMAP: DSS2: Taal: Add panel hardware reset
OMAP: DSS2: Taal: Add locks to protect taal data access
OMAP: DSS2: Taal: Cosmetic improvement to backlight properties
initialization
OMAP: DSS2: Taal: Remove platform enable/disable
OMAP: DSS2: Taal: Fix request_irq() error handling
OMAP: DSS2: Taal: Remove ESD work cancel from driver probe error
handling
OMAP: DSS2: Taal: Improve taal_power_on() error handling
OMAP: DSS2: Taal: Ensure panel is enabled in enable_te() and
run_test()
OMAP: DSS2: Taal: Change DSI bus locking to avoid deadlock in ESD
work
OMAP: DSS2: Taal: Check taal_power_on() return value in taal_resume()
OMAP: DSS2: Taal: Change ESD work management
OMAP: DSS2: Taal: Change probe error handling labels
OMAP: DSS2: Taal: Add proper external TE support
OMAP: DSS2: Add Nokia DSI command mode panel configuration struct
OMAP: DSS2: Taal: Use Nokia DSI panel data
OMAP: DSS2: Taal: Configure ESD check in DSI panel data
OMAP: DSS2: Taal: Add panel specific configuration structure
OMAP: DSS2: Taal: Print panel name in addition to revision
OMAP: DSS2: Taal: Add regulator configuration support
OMAP: DSS2: Taal: CABC workaround is Taal specific
Valkeinen Tomi (Nokia-D/Helsinki) (1):
OMAP: DSS2: Taal: add locks to taal_bl_update_status
arch/arm/plat-omap/include/plat/nokia-dsi-panel.h | 31 ++
drivers/video/omap2/displays/panel-taal.c | 552 ++++++++++++++++-----
2 files changed, 463 insertions(+), 120 deletions(-)
create mode 100644 arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 01/21] OMAP: DSS2: Taal: Add panel hardware reset
2010-05-05 14:27 [PATCH v3 00/21] OMAP: DSS2: Taal panel driver updates Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 02/21] OMAP: DSS2: Taal: add locks to taal_bl_update_status Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Issue a proper reset pulse on the reset line instead of just doing power
on/off.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 44 ++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index aaf5d30..181dfe4 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -488,6 +488,22 @@ static struct attribute_group taal_attr_group = {
.attrs = taal_attrs,
};
+static void taal_hw_reset(struct omap_dss_device *dssdev)
+{
+ if (dssdev->reset_gpio = -1)
+ return;
+
+ gpio_set_value(dssdev->reset_gpio, 1);
+ udelay(10);
+ /* reset the panel */
+ gpio_set_value(dssdev->reset_gpio, 0);
+ /* assert reset for at least 10us */
+ udelay(10);
+ gpio_set_value(dssdev->reset_gpio, 1);
+ /* wait 5ms after releasing reset */
+ msleep(5);
+}
+
static int taal_probe(struct omap_dss_device *dssdev)
{
struct backlight_properties props;
@@ -525,6 +541,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
dev_set_drvdata(&dssdev->dev, td);
+ taal_hw_reset(dssdev);
+
/* if no platform set_backlight() defined, presume DSI backlight
* control */
memset(&props, 0, sizeof(struct backlight_properties));
@@ -626,6 +644,9 @@ static void taal_remove(struct omap_dss_device *dssdev)
cancel_delayed_work_sync(&td->esd_work);
destroy_workqueue(td->esd_wq);
+ /* reset, to be sure that the panel is in a valid state */
+ taal_hw_reset(dssdev);
+
kfree(td);
}
@@ -652,6 +673,8 @@ static int taal_power_on(struct omap_dss_device *dssdev)
goto err0;
}
+ taal_hw_reset(dssdev);
+
omapdss_dsi_vc_enable_hs(TCH, false);
r = taal_sleep_out(td);
@@ -702,6 +725,10 @@ static int taal_power_on(struct omap_dss_device *dssdev)
return 0;
err:
+ dev_err(&dssdev->dev, "error while enabling panel, issuing HW reset\n");
+
+ taal_hw_reset(dssdev);
+
omapdss_dsi_display_disable(dssdev);
err0:
dsi_bus_unlock();
@@ -714,16 +741,24 @@ err0:
static void taal_power_off(struct omap_dss_device *dssdev)
{
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+ int r;
dsi_bus_lock();
cancel_delayed_work(&td->esd_work);
- taal_dcs_write_0(DCS_DISPLAY_OFF);
- taal_sleep_in(td);
+ r = taal_dcs_write_0(DCS_DISPLAY_OFF);
+ if (!r) {
+ r = taal_sleep_in(td);
+ /* wait a bit so that the message goes through */
+ msleep(10);
+ }
- /* wait a bit so that the message goes through */
- msleep(10);
+ if (r) {
+ dev_err(&dssdev->dev,
+ "error disabling panel, issuing HW reset\n");
+ taal_hw_reset(dssdev);
+ }
omapdss_dsi_display_disable(dssdev);
@@ -1184,6 +1219,7 @@ err:
dev_err(&dssdev->dev, "performing LCD reset\n");
taal_power_off(dssdev);
+ taal_hw_reset(dssdev);
taal_power_on(dssdev);
dsi_bus_unlock();
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 02/21] OMAP: DSS2: Taal: add locks to taal_bl_update_status
2010-05-05 14:27 ` [PATCH v3 01/21] OMAP: DSS2: Taal: Add panel hardware reset Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 03/21] OMAP: DSS2: Taal: Add locks to protect taal data access Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Valkeinen Tomi (Nokia-D/Helsinki) <Tomi.Valkeinen@nokia.com>
From: Tomi Valkeinen <tomi.valkeinen@nokia.com>
taal_bl_update_status was missing locks to protect taal_data. This caused
a kernel crash randomly, as the code attempted to set the brightness while
the OMAP's DSI block was actually disabled.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 181dfe4..8fbb94e 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -290,24 +290,26 @@ static int taal_bl_update_status(struct backlight_device *dev)
dev_dbg(&dssdev->dev, "update brightness to %d\n", level);
+ mutex_lock(&td->lock);
+
if (td->use_dsi_bl) {
if (td->enabled) {
dsi_bus_lock();
r = taal_dcs_write_1(DCS_BRIGHTNESS, level);
dsi_bus_unlock();
- if (r)
- return r;
+ } else {
+ r = 0;
}
} else {
if (!dssdev->set_backlight)
- return -EINVAL;
-
- r = dssdev->set_backlight(dssdev, level);
- if (r)
- return r;
+ r = -EINVAL;
+ else
+ r = dssdev->set_backlight(dssdev, level);
}
- return 0;
+ mutex_unlock(&td->lock);
+
+ return r;
}
static int taal_bl_get_intensity(struct backlight_device *dev)
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 03/21] OMAP: DSS2: Taal: Add locks to protect taal data access
2010-05-05 14:27 ` [PATCH v3 02/21] OMAP: DSS2: Taal: add locks to taal_bl_update_status Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 04/21] OMAP: DSS2: Taal: Cosmetic improvement to backlight properties initialization Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Avoid potential race conditions in sysfs access to taal data.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 8fbb94e..0eed328 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -364,6 +364,8 @@ static ssize_t taal_num_errors_show(struct device *dev,
u8 errors;
int r;
+ mutex_lock(&td->lock);
+
if (td->enabled) {
dsi_bus_lock();
r = taal_dcs_read_1(DCS_READ_NUM_ERRORS, &errors);
@@ -372,6 +374,8 @@ static ssize_t taal_num_errors_show(struct device *dev,
r = -ENODEV;
}
+ mutex_unlock(&td->lock);
+
if (r)
return r;
@@ -386,6 +390,8 @@ static ssize_t taal_hw_revision_show(struct device *dev,
u8 id1, id2, id3;
int r;
+ mutex_lock(&td->lock);
+
if (td->enabled) {
dsi_bus_lock();
r = taal_get_id(&id1, &id2, &id3);
@@ -394,6 +400,8 @@ static ssize_t taal_hw_revision_show(struct device *dev,
r = -ENODEV;
}
+ mutex_unlock(&td->lock);
+
if (r)
return r;
@@ -443,6 +451,8 @@ static ssize_t store_cabc_mode(struct device *dev,
if (i = ARRAY_SIZE(cabc_modes))
return -EINVAL;
+ mutex_lock(&td->lock);
+
if (td->enabled) {
dsi_bus_lock();
if (!td->cabc_broken)
@@ -452,6 +462,8 @@ static ssize_t store_cabc_mode(struct device *dev,
td->cabc_mode = i;
+ mutex_unlock(&td->lock);
+
return count;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 04/21] OMAP: DSS2: Taal: Cosmetic improvement to backlight properties initialization
2010-05-05 14:27 ` [PATCH v3 03/21] OMAP: DSS2: Taal: Add locks to protect taal data access Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 05/21] OMAP: DSS2: Taal: Remove platform enable/disable Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Let the compiler worry about the type for us.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 0eed328..53fc369 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -559,7 +559,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
/* if no platform set_backlight() defined, presume DSI backlight
* control */
- memset(&props, 0, sizeof(struct backlight_properties));
+ memset(&props, 0, sizeof(props));
if (!dssdev->set_backlight)
td->use_dsi_bl = true;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 05/21] OMAP: DSS2: Taal: Remove platform enable/disable
2010-05-05 14:27 ` [PATCH v3 04/21] OMAP: DSS2: Taal: Cosmetic improvement to backlight properties initialization Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 06/21] OMAP: DSS2: Taal: Fix request_irq() error handling Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
After the addition of proper hardware reset, taal_hw_reset(), there's no
need for an additional platform enable/disable. Remove them.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 11 -----------
1 files changed, 0 insertions(+), 11 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 53fc369..b7d1275 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -670,12 +670,6 @@ static int taal_power_on(struct omap_dss_device *dssdev)
u8 id1, id2, id3;
int r;
- if (dssdev->platform_enable) {
- r = dssdev->platform_enable(dssdev);
- if (r)
- return r;
- }
-
/* it seems we have to wait a bit until taal is ready */
msleep(5);
@@ -746,8 +740,6 @@ err:
omapdss_dsi_display_disable(dssdev);
err0:
dsi_bus_unlock();
- if (dssdev->platform_disable)
- dssdev->platform_disable(dssdev);
return r;
}
@@ -776,9 +768,6 @@ static void taal_power_off(struct omap_dss_device *dssdev)
omapdss_dsi_display_disable(dssdev);
- if (dssdev->platform_disable)
- dssdev->platform_disable(dssdev);
-
td->enabled = 0;
dsi_bus_unlock();
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 06/21] OMAP: DSS2: Taal: Fix request_irq() error handling
2010-05-05 14:27 ` [PATCH v3 05/21] OMAP: DSS2: Taal: Remove platform enable/disable Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 07/21] OMAP: DSS2: Taal: Remove ESD work cancel from driver probe " Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Separate gpio_request() and request_irq() error handling.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index b7d1275..788aa91 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -603,7 +603,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
if (r) {
dev_err(&dssdev->dev, "IRQ request failed\n");
gpio_free(gpio);
- goto err3;
+ goto err4;
}
init_completion(&td->te_completion);
@@ -614,16 +614,16 @@ static int taal_probe(struct omap_dss_device *dssdev)
r = sysfs_create_group(&dssdev->dev.kobj, &taal_attr_group);
if (r) {
dev_err(&dssdev->dev, "failed to create sysfs files\n");
- goto err4;
+ goto err5;
}
return 0;
+err5:
+ if (td->use_ext_te)
+ free_irq(gpio_to_irq(dssdev->phy.dsi.ext_te_gpio), dssdev);
err4:
- if (td->use_ext_te) {
- int gpio = dssdev->phy.dsi.ext_te_gpio;
- free_irq(gpio_to_irq(gpio), dssdev);
- gpio_free(gpio);
- }
+ if (td->use_ext_te)
+ gpio_free(dssdev->phy.dsi.ext_te_gpio);
err3:
backlight_device_unregister(bldev);
err2:
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 07/21] OMAP: DSS2: Taal: Remove ESD work cancel from driver probe error handling
2010-05-05 14:27 ` [PATCH v3 06/21] OMAP: DSS2: Taal: Fix request_irq() error handling Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 08/21] OMAP: DSS2: Taal: Improve taal_power_on() " Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
ESD work is never queued in probe, no need to cancel it on probe error.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 788aa91..d0701e2 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -627,7 +627,6 @@ err4:
err3:
backlight_device_unregister(bldev);
err2:
- cancel_delayed_work_sync(&td->esd_work);
destroy_workqueue(td->esd_wq);
err1:
kfree(td);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 08/21] OMAP: DSS2: Taal: Improve taal_power_on() error handling
2010-05-05 14:27 ` [PATCH v3 07/21] OMAP: DSS2: Taal: Remove ESD work cancel from driver probe " Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 09/21] OMAP: DSS2: Taal: Ensure panel is enabled in enable_te() and run_test() Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Check return values and bail out on errors.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 30 ++++++++++++++++++++++------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index d0701e2..a093eda 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -696,16 +696,32 @@ static int taal_power_on(struct omap_dss_device *dssdev)
if (id2 = 0x00 || id2 = 0xff || id2 = 0x81)
td->cabc_broken = true;
- taal_dcs_write_1(DCS_BRIGHTNESS, 0xff);
- taal_dcs_write_1(DCS_CTRL_DISPLAY, (1<<2) | (1<<5)); /* BL | BCTRL */
+ r = taal_dcs_write_1(DCS_BRIGHTNESS, 0xff);
+ if (r)
+ goto err;
- taal_dcs_write_1(DCS_PIXEL_FORMAT, 0x7); /* 24bit/pixel */
+ r = taal_dcs_write_1(DCS_CTRL_DISPLAY,
+ (1<<2) | (1<<5)); /* BL | BCTRL */
+ if (r)
+ goto err;
- taal_set_addr_mode(td->rotate, td->mirror);
- if (!td->cabc_broken)
- taal_dcs_write_1(DCS_WRITE_CABC, td->cabc_mode);
+ r = taal_dcs_write_1(DCS_PIXEL_FORMAT, 0x7); /* 24bit/pixel */
+ if (r)
+ goto err;
- taal_dcs_write_0(DCS_DISPLAY_ON);
+ r = taal_set_addr_mode(td->rotate, td->mirror);
+ if (r)
+ goto err;
+
+ if (!td->cabc_broken) {
+ r = taal_dcs_write_1(DCS_WRITE_CABC, td->cabc_mode);
+ if (r)
+ goto err;
+ }
+
+ r = taal_dcs_write_0(DCS_DISPLAY_ON);
+ if (r)
+ goto err;
r = _taal_enable_te(dssdev, td->te_enabled);
if (r)
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 09/21] OMAP: DSS2: Taal: Ensure panel is enabled in enable_te() and run_test()
2010-05-05 14:27 ` [PATCH v3 08/21] OMAP: DSS2: Taal: Improve taal_power_on() " Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 10/21] OMAP: DSS2: Taal: Change DSI bus locking to avoid deadlock in ESD work Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Bail out from taal_enable_te() and taal_run_test() if panel is not
enabled.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 31 +++++++++++++++++++++-------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index a093eda..214d3cf 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -946,11 +946,8 @@ static int taal_sync(struct omap_dss_device *dssdev)
static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
{
- struct taal_data *td = dev_get_drvdata(&dssdev->dev);
int r;
- td->te_enabled = enable;
-
if (enable)
r = taal_dcs_write_1(DCS_TEAR_ON, 0);
else
@@ -973,11 +970,22 @@ static int taal_enable_te(struct omap_dss_device *dssdev, bool enable)
mutex_lock(&td->lock);
dsi_bus_lock();
- r = _taal_enable_te(dssdev, enable);
+ if (td->enabled) {
+ r = _taal_enable_te(dssdev, enable);
+ if (r)
+ goto err;
+ }
+
+ td->te_enabled = enable;
dsi_bus_unlock();
mutex_unlock(&td->lock);
+ return 0;
+err:
+ dsi_bus_unlock();
+ mutex_unlock(&td->lock);
+
return r;
}
@@ -1077,23 +1085,30 @@ static int taal_run_test(struct omap_dss_device *dssdev, int test_num)
int r;
mutex_lock(&td->lock);
+
+ if (!td->enabled) {
+ r = -ENODEV;
+ goto err1;
+ }
+
dsi_bus_lock();
r = taal_dcs_read_1(DCS_GET_ID1, &id1);
if (r)
- goto err;
+ goto err2;
r = taal_dcs_read_1(DCS_GET_ID2, &id2);
if (r)
- goto err;
+ goto err2;
r = taal_dcs_read_1(DCS_GET_ID3, &id3);
if (r)
- goto err;
+ goto err2;
dsi_bus_unlock();
mutex_unlock(&td->lock);
return 0;
-err:
+err2:
dsi_bus_unlock();
+err1:
mutex_unlock(&td->lock);
return r;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 10/21] OMAP: DSS2: Taal: Change DSI bus locking to avoid deadlock in ESD work
2010-05-05 14:27 ` [PATCH v3 09/21] OMAP: DSS2: Taal: Ensure panel is enabled in enable_te() and run_test() Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 11/21] OMAP: DSS2: Taal: Check taal_power_on() return value in taal_resume() Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Move dsi_bus_lock/unlock() out of taal_power_on/off() to avoid deadlock
in taal_esd_work().
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 214d3cf..af159c1 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -672,8 +672,6 @@ static int taal_power_on(struct omap_dss_device *dssdev)
/* it seems we have to wait a bit until taal is ready */
msleep(5);
- dsi_bus_lock();
-
r = omapdss_dsi_display_enable(dssdev);
if (r) {
dev_err(&dssdev->dev, "failed to enable DSI\n");
@@ -744,8 +742,6 @@ static int taal_power_on(struct omap_dss_device *dssdev)
omapdss_dsi_vc_enable_hs(TCH, true);
- dsi_bus_unlock();
-
return 0;
err:
dev_err(&dssdev->dev, "error while enabling panel, issuing HW reset\n");
@@ -754,8 +750,6 @@ err:
omapdss_dsi_display_disable(dssdev);
err0:
- dsi_bus_unlock();
-
return r;
}
@@ -764,8 +758,6 @@ static void taal_power_off(struct omap_dss_device *dssdev)
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
int r;
- dsi_bus_lock();
-
cancel_delayed_work(&td->esd_work);
r = taal_dcs_write_0(DCS_DISPLAY_OFF);
@@ -784,8 +776,6 @@ static void taal_power_off(struct omap_dss_device *dssdev)
omapdss_dsi_display_disable(dssdev);
td->enabled = 0;
-
- dsi_bus_unlock();
}
static int taal_enable(struct omap_dss_device *dssdev)
@@ -802,7 +792,12 @@ static int taal_enable(struct omap_dss_device *dssdev)
goto err;
}
+ dsi_bus_lock();
+
r = taal_power_on(dssdev);
+
+ dsi_bus_unlock();
+
if (r)
goto err;
@@ -825,9 +820,13 @@ static void taal_disable(struct omap_dss_device *dssdev)
mutex_lock(&td->lock);
+ dsi_bus_lock();
+
if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
taal_power_off(dssdev);
+ dsi_bus_unlock();
+
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
mutex_unlock(&td->lock);
@@ -847,7 +846,12 @@ static int taal_suspend(struct omap_dss_device *dssdev)
goto err;
}
+ dsi_bus_lock();
+
taal_power_off(dssdev);
+
+ dsi_bus_unlock();
+
dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
mutex_unlock(&td->lock);
@@ -872,7 +876,12 @@ static int taal_resume(struct omap_dss_device *dssdev)
goto err;
}
+ dsi_bus_lock();
+
r = taal_power_on(dssdev);
+
+ dsi_bus_unlock();
+
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
mutex_unlock(&td->lock);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 11/21] OMAP: DSS2: Taal: Check taal_power_on() return value in taal_resume()
2010-05-05 14:27 ` [PATCH v3 10/21] OMAP: DSS2: Taal: Change DSI bus locking to avoid deadlock in ESD work Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 12/21] OMAP: DSS2: Taal: Change ESD work management Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Change state only if power on was succesful.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index af159c1..7b5f845 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -882,7 +882,10 @@ static int taal_resume(struct omap_dss_device *dssdev)
dsi_bus_unlock();
- dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+ if (r)
+ dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+ else
+ dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
mutex_unlock(&td->lock);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 12/21] OMAP: DSS2: Taal: Change ESD work management
2010-05-05 14:27 ` [PATCH v3 11/21] OMAP: DSS2: Taal: Check taal_power_on() return value in taal_resume() Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 13/21] OMAP: DSS2: Taal: Change probe error handling labels Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Move ESD work queuing and cancelling out of taal_power_on/off() to avoid
problems related to taal_esd_work() calling the power on/off functions.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 7b5f845..fa4c67b 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -654,7 +654,7 @@ static void taal_remove(struct omap_dss_device *dssdev)
taal_bl_update_status(bldev);
backlight_device_unregister(bldev);
- cancel_delayed_work_sync(&td->esd_work);
+ cancel_delayed_work(&td->esd_work);
destroy_workqueue(td->esd_wq);
/* reset, to be sure that the panel is in a valid state */
@@ -725,10 +725,6 @@ static int taal_power_on(struct omap_dss_device *dssdev)
if (r)
goto err;
-#ifdef TAAL_USE_ESD_CHECK
- queue_delayed_work(td->esd_wq, &td->esd_work, TAAL_ESD_CHECK_PERIOD);
-#endif
-
td->enabled = 1;
if (!td->intro_printed) {
@@ -758,8 +754,6 @@ static void taal_power_off(struct omap_dss_device *dssdev)
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
int r;
- cancel_delayed_work(&td->esd_work);
-
r = taal_dcs_write_0(DCS_DISPLAY_OFF);
if (!r) {
r = taal_sleep_in(td);
@@ -801,6 +795,10 @@ static int taal_enable(struct omap_dss_device *dssdev)
if (r)
goto err;
+#ifdef TAAL_USE_ESD_CHECK
+ queue_delayed_work(td->esd_wq, &td->esd_work, TAAL_ESD_CHECK_PERIOD);
+#endif
+
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
mutex_unlock(&td->lock);
@@ -820,6 +818,8 @@ static void taal_disable(struct omap_dss_device *dssdev)
mutex_lock(&td->lock);
+ cancel_delayed_work(&td->esd_work);
+
dsi_bus_lock();
if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
@@ -846,6 +846,8 @@ static int taal_suspend(struct omap_dss_device *dssdev)
goto err;
}
+ cancel_delayed_work(&td->esd_work);
+
dsi_bus_lock();
taal_power_off(dssdev);
@@ -882,10 +884,15 @@ static int taal_resume(struct omap_dss_device *dssdev)
dsi_bus_unlock();
- if (r)
+ if (r) {
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
- else
+ } else {
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+#ifdef TAAL_USE_ESD_CHECK
+ queue_delayed_work(td->esd_wq, &td->esd_work,
+ TAAL_ESD_CHECK_PERIOD);
+#endif
+ }
mutex_unlock(&td->lock);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 13/21] OMAP: DSS2: Taal: Change probe error handling labels
2010-05-05 14:27 ` [PATCH v3 12/21] OMAP: DSS2: Taal: Change ESD work management Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 14/21] OMAP: DSS2: Taal: Add proper external TE support Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Switch from numbered to named labels to make it easier to add new
labels for error handling.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index fa4c67b..e32424c 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -539,7 +539,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
td = kzalloc(sizeof(*td), GFP_KERNEL);
if (!td) {
r = -ENOMEM;
- goto err0;
+ goto err;
}
td->dssdev = dssdev;
@@ -549,7 +549,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
if (td->esd_wq = NULL) {
dev_err(&dssdev->dev, "can't create ESD workqueue\n");
r = -ENOMEM;
- goto err1;
+ goto err_wq;
}
INIT_DELAYED_WORK_DEFERRABLE(&td->esd_work, taal_esd_work);
@@ -571,7 +571,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
&taal_bl_ops, &props);
if (IS_ERR(bldev)) {
r = PTR_ERR(bldev);
- goto err2;
+ goto err_bl;
}
td->bldev = bldev;
@@ -591,7 +591,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
r = gpio_request(gpio, "taal irq");
if (r) {
dev_err(&dssdev->dev, "GPIO request failed\n");
- goto err3;
+ goto err_gpio;
}
gpio_direction_input(gpio);
@@ -603,7 +603,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
if (r) {
dev_err(&dssdev->dev, "IRQ request failed\n");
gpio_free(gpio);
- goto err4;
+ goto err_irq;
}
init_completion(&td->te_completion);
@@ -614,23 +614,23 @@ static int taal_probe(struct omap_dss_device *dssdev)
r = sysfs_create_group(&dssdev->dev.kobj, &taal_attr_group);
if (r) {
dev_err(&dssdev->dev, "failed to create sysfs files\n");
- goto err5;
+ goto err_sysfs;
}
return 0;
-err5:
+err_sysfs:
if (td->use_ext_te)
free_irq(gpio_to_irq(dssdev->phy.dsi.ext_te_gpio), dssdev);
-err4:
+err_irq:
if (td->use_ext_te)
gpio_free(dssdev->phy.dsi.ext_te_gpio);
-err3:
+err_gpio:
backlight_device_unregister(bldev);
-err2:
+err_bl:
destroy_workqueue(td->esd_wq);
-err1:
+err_wq:
kfree(td);
-err0:
+err:
return r;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 14/21] OMAP: DSS2: Taal: Add proper external TE support
2010-05-05 14:27 ` [PATCH v3 13/21] OMAP: DSS2: Taal: Change probe error handling labels Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 15/21] OMAP: DSS2: Add Nokia DSI command mode panel configuration struct Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Add gpio irq based external TE support with timeout.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 93 +++++++++++++++++++++++------
1 files changed, 75 insertions(+), 18 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index e32424c..0c259ab 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -28,7 +28,6 @@
#include <linux/fb.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
-#include <linux/completion.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/mutex.h>
@@ -65,6 +64,8 @@
/* #define TAAL_USE_ESD_CHECK */
#define TAAL_ESD_CHECK_PERIOD msecs_to_jiffies(5000)
+static irqreturn_t taal_te_isr(int irq, void *data);
+static void taal_te_timeout_work_callback(struct work_struct *work);
static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable);
struct taal_data {
@@ -85,7 +86,15 @@ struct taal_data {
bool te_enabled;
bool use_ext_te;
- struct completion te_completion;
+
+ atomic_t do_update;
+ struct {
+ u16 x;
+ u16 y;
+ u16 w;
+ u16 h;
+ } update_region;
+ struct delayed_work te_timeout_work;
bool use_dsi_bl;
@@ -346,16 +355,6 @@ static void taal_get_resolution(struct omap_dss_device *dssdev,
}
}
-static irqreturn_t taal_te_isr(int irq, void *data)
-{
- struct omap_dss_device *dssdev = data;
- struct taal_data *td = dev_get_drvdata(&dssdev->dev);
-
- complete_all(&td->te_completion);
-
- return IRQ_HANDLED;
-}
-
static ssize_t taal_num_errors_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -545,6 +544,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
mutex_init(&td->lock);
+ atomic_set(&td->do_update, 0);
+
td->esd_wq = create_singlethread_workqueue("taal_esd");
if (td->esd_wq = NULL) {
dev_err(&dssdev->dev, "can't create ESD workqueue\n");
@@ -606,9 +607,12 @@ static int taal_probe(struct omap_dss_device *dssdev)
goto err_irq;
}
- init_completion(&td->te_completion);
+ INIT_DELAYED_WORK_DEFERRABLE(&td->te_timeout_work,
+ taal_te_timeout_work_callback);
td->use_ext_te = true;
+
+ dev_dbg(&dssdev->dev, "Using GPIO TE\n");
}
r = sysfs_create_group(&dssdev->dev.kobj, &taal_attr_group);
@@ -909,6 +913,47 @@ static void taal_framedone_cb(int err, void *data)
dsi_bus_unlock();
}
+static irqreturn_t taal_te_isr(int irq, void *data)
+{
+ struct omap_dss_device *dssdev = data;
+ struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+ int old;
+ int r;
+
+ old = atomic_cmpxchg(&td->do_update, 1, 0);
+
+ if (old) {
+ cancel_delayed_work(&td->te_timeout_work);
+
+ r = omap_dsi_update(dssdev, TCH,
+ td->update_region.x,
+ td->update_region.y,
+ td->update_region.w,
+ td->update_region.h,
+ taal_framedone_cb, dssdev);
+ if (r)
+ goto err;
+ }
+
+ return IRQ_HANDLED;
+err:
+ dev_err(&dssdev->dev, "start update failed\n");
+ dsi_bus_unlock();
+ return IRQ_HANDLED;
+}
+
+static void taal_te_timeout_work_callback(struct work_struct *work)
+{
+ struct taal_data *td = container_of(work, struct taal_data,
+ te_timeout_work.work);
+ struct omap_dss_device *dssdev = td->dssdev;
+
+ dev_err(&dssdev->dev, "TE not received for 250ms!\n");
+
+ atomic_set(&td->do_update, 0);
+ dsi_bus_unlock();
+}
+
static int taal_update(struct omap_dss_device *dssdev,
u16 x, u16 y, u16 w, u16 h)
{
@@ -933,10 +978,21 @@ static int taal_update(struct omap_dss_device *dssdev,
if (r)
goto err;
- r = omap_dsi_update(dssdev, TCH, x, y, w, h,
- taal_framedone_cb, dssdev);
- if (r)
- goto err;
+ if (td->te_enabled && td->use_ext_te) {
+ td->update_region.x = x;
+ td->update_region.y = y;
+ td->update_region.w = w;
+ td->update_region.h = h;
+ barrier();
+ schedule_delayed_work(&td->te_timeout_work,
+ msecs_to_jiffies(250));
+ atomic_set(&td->do_update, 1);
+ } else {
+ r = omap_dsi_update(dssdev, TCH, x, y, w, h,
+ taal_framedone_cb, dssdev);
+ if (r)
+ goto err;
+ }
/* note: no bus_unlock here. unlock is in framedone_cb */
mutex_unlock(&td->lock);
@@ -972,7 +1028,8 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
else
r = taal_dcs_write_0(DCS_TEAR_OFF);
- omapdss_dsi_enable_te(dssdev, enable);
+ if (!td->use_ext_te)
+ omapdss_dsi_enable_te(dssdev, enable);
/* XXX for some reason, DSI TE breaks if we don't wait here.
* Panel bug? Needs more studying */
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 15/21] OMAP: DSS2: Add Nokia DSI command mode panel configuration struct
2010-05-05 14:27 ` [PATCH v3 14/21] OMAP: DSS2: Taal: Add proper external TE support Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 16/21] OMAP: DSS2: Taal: Use Nokia DSI panel data Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Introduce a configuration struct for platform/board specific information
of Nokia DSI command mode panels, to be used in addition to struct
omap_dss_device (passed via the 'void *data' member).
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
arch/arm/plat-omap/include/plat/nokia-dsi-panel.h | 31 +++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
diff --git a/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h b/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
new file mode 100644
index 0000000..01ab657
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
@@ -0,0 +1,31 @@
+#ifndef __ARCH_ARM_PLAT_OMAP_NOKIA_DSI_PANEL_H
+#define __ARCH_ARM_PLAT_OMAP_NOKIA_DSI_PANEL_H
+
+#include "display.h"
+
+/**
+ * struct nokia_dsi_panel_data - Nokia DSI panel driver configuration
+ * @name: panel name
+ * @use_ext_te: use external TE
+ * @ext_te_gpio: external TE GPIO
+ * @use_esd_check: perform ESD checks
+ * @max_backlight_level: maximum backlight level
+ * @set_backlight: pointer to backlight set function
+ * @get_backlight: pointer to backlight get function
+ */
+struct nokia_dsi_panel_data {
+ const char *name;
+
+ int reset_gpio;
+
+ bool use_ext_te;
+ int ext_te_gpio;
+
+ bool use_esd_check;
+
+ int max_backlight_level;
+ int (*set_backlight)(struct omap_dss_device *dssdev, int level);
+ int (*get_backlight)(struct omap_dss_device *dssdev);
+};
+
+#endif /* __ARCH_ARM_PLAT_OMAP_NOKIA_DSI_PANEL_H */
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 16/21] OMAP: DSS2: Taal: Use Nokia DSI panel data
2010-05-05 14:27 ` [PATCH v3 15/21] OMAP: DSS2: Add Nokia DSI command mode panel configuration struct Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 17/21] OMAP: DSS2: Taal: Configure ESD check in " Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Get board specific information from the Nokia DSI panel data structure
instead of the DSS.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 59 ++++++++++++++++++----------
1 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 0c259ab..538829b 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -33,6 +33,7 @@
#include <linux/mutex.h>
#include <plat/display.h>
+#include <plat/nokia-dsi-panel.h>
/* DSI Virtual channel. Hardcoded for now. */
#define TCH 0
@@ -85,7 +86,6 @@ struct taal_data {
bool mirror;
bool te_enabled;
- bool use_ext_te;
atomic_t do_update;
struct {
@@ -107,6 +107,12 @@ struct taal_data {
struct delayed_work esd_work;
};
+static inline struct nokia_dsi_panel_data
+*get_panel_data(const struct omap_dss_device *dssdev)
+{
+ return (struct nokia_dsi_panel_data *) dssdev->data;
+}
+
static void taal_esd_work(struct work_struct *work);
static void hw_guard_start(struct taal_data *td, int guard_msec)
@@ -288,6 +294,7 @@ static int taal_bl_update_status(struct backlight_device *dev)
{
struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev);
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r;
int level;
@@ -310,10 +317,10 @@ static int taal_bl_update_status(struct backlight_device *dev)
r = 0;
}
} else {
- if (!dssdev->set_backlight)
+ if (!panel_data->set_backlight)
r = -EINVAL;
else
- r = dssdev->set_backlight(dssdev, level);
+ r = panel_data->set_backlight(dssdev, level);
}
mutex_unlock(&td->lock);
@@ -503,16 +510,18 @@ static struct attribute_group taal_attr_group = {
static void taal_hw_reset(struct omap_dss_device *dssdev)
{
- if (dssdev->reset_gpio = -1)
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
+
+ if (panel_data->reset_gpio = -1)
return;
- gpio_set_value(dssdev->reset_gpio, 1);
+ gpio_set_value(panel_data->reset_gpio, 1);
udelay(10);
/* reset the panel */
- gpio_set_value(dssdev->reset_gpio, 0);
+ gpio_set_value(panel_data->reset_gpio, 0);
/* assert reset for at least 10us */
udelay(10);
- gpio_set_value(dssdev->reset_gpio, 1);
+ gpio_set_value(panel_data->reset_gpio, 1);
/* wait 5ms after releasing reset */
msleep(5);
}
@@ -522,6 +531,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
struct backlight_properties props;
struct taal_data *td;
struct backlight_device *bldev;
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r;
const struct omap_video_timings taal_panel_timings = {
@@ -531,6 +541,11 @@ static int taal_probe(struct omap_dss_device *dssdev)
dev_dbg(&dssdev->dev, "probe\n");
+ if (!panel_data || !panel_data->name) {
+ r = -EINVAL;
+ goto err;
+ }
+
dssdev->panel.config = OMAP_DSS_LCD_TFT;
dssdev->panel.timings = taal_panel_timings;
dssdev->ctrl.pixel_size = 24;
@@ -561,7 +576,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
/* if no platform set_backlight() defined, presume DSI backlight
* control */
memset(&props, 0, sizeof(props));
- if (!dssdev->set_backlight)
+ if (!panel_data->set_backlight)
td->use_dsi_bl = true;
if (td->use_dsi_bl)
@@ -586,8 +601,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
taal_bl_update_status(bldev);
- if (dssdev->phy.dsi.ext_te) {
- int gpio = dssdev->phy.dsi.ext_te_gpio;
+ if (panel_data->use_ext_te) {
+ int gpio = panel_data->ext_te_gpio;
r = gpio_request(gpio, "taal irq");
if (r) {
@@ -610,8 +625,6 @@ static int taal_probe(struct omap_dss_device *dssdev)
INIT_DELAYED_WORK_DEFERRABLE(&td->te_timeout_work,
taal_te_timeout_work_callback);
- td->use_ext_te = true;
-
dev_dbg(&dssdev->dev, "Using GPIO TE\n");
}
@@ -623,11 +636,11 @@ static int taal_probe(struct omap_dss_device *dssdev)
return 0;
err_sysfs:
- if (td->use_ext_te)
- free_irq(gpio_to_irq(dssdev->phy.dsi.ext_te_gpio), dssdev);
+ if (panel_data->use_ext_te)
+ free_irq(gpio_to_irq(panel_data->ext_te_gpio), dssdev);
err_irq:
- if (td->use_ext_te)
- gpio_free(dssdev->phy.dsi.ext_te_gpio);
+ if (panel_data->use_ext_te)
+ gpio_free(panel_data->ext_te_gpio);
err_gpio:
backlight_device_unregister(bldev);
err_bl:
@@ -641,14 +654,15 @@ err:
static void taal_remove(struct omap_dss_device *dssdev)
{
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
struct backlight_device *bldev;
dev_dbg(&dssdev->dev, "remove\n");
sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group);
- if (td->use_ext_te) {
- int gpio = dssdev->phy.dsi.ext_te_gpio;
+ if (panel_data->use_ext_te) {
+ int gpio = panel_data->ext_te_gpio;
free_irq(gpio_to_irq(gpio), dssdev);
gpio_free(gpio);
}
@@ -958,6 +972,7 @@ static int taal_update(struct omap_dss_device *dssdev,
u16 x, u16 y, u16 w, u16 h)
{
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r;
dev_dbg(&dssdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
@@ -978,7 +993,7 @@ static int taal_update(struct omap_dss_device *dssdev,
if (r)
goto err;
- if (td->te_enabled && td->use_ext_te) {
+ if (td->te_enabled && panel_data->use_ext_te) {
td->update_region.x = x;
td->update_region.y = y;
td->update_region.w = w;
@@ -1021,6 +1036,7 @@ static int taal_sync(struct omap_dss_device *dssdev)
static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
{
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r;
if (enable)
@@ -1028,7 +1044,7 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
else
r = taal_dcs_write_0(DCS_TEAR_OFF);
- if (!td->use_ext_te)
+ if (!panel_data->use_ext_te)
omapdss_dsi_enable_te(dssdev, enable);
/* XXX for some reason, DSI TE breaks if we don't wait here.
@@ -1272,6 +1288,7 @@ static void taal_esd_work(struct work_struct *work)
struct taal_data *td = container_of(work, struct taal_data,
esd_work.work);
struct omap_dss_device *dssdev = td->dssdev;
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
u8 state1, state2;
int r;
@@ -1312,7 +1329,7 @@ static void taal_esd_work(struct work_struct *work)
}
/* Self-diagnostics result is also shown on TE GPIO line. We need
* to re-enable TE after self diagnostics */
- if (td->use_ext_te && td->te_enabled) {
+ if (td->te_enabled && panel_data->use_ext_te) {
r = taal_dcs_write_1(DCS_TEAR_ON, 0);
if (r)
goto err;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 17/21] OMAP: DSS2: Taal: Configure ESD check in DSI panel data
2010-05-05 14:27 ` [PATCH v3 16/21] OMAP: DSS2: Taal: Use Nokia DSI panel data Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 18/21] OMAP: DSS2: Taal: Add panel specific configuration structure Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Make ESD check usage configurable in DSI panel data, as opposed to a
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 538829b..9502a4d 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -62,7 +62,6 @@
#define DCS_GET_ID2 0xdb
#define DCS_GET_ID3 0xdc
-/* #define TAAL_USE_ESD_CHECK */
#define TAAL_ESD_CHECK_PERIOD msecs_to_jiffies(5000)
static irqreturn_t taal_te_isr(int irq, void *data);
@@ -793,6 +792,7 @@ static void taal_power_off(struct omap_dss_device *dssdev)
static int taal_enable(struct omap_dss_device *dssdev)
{
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r;
dev_dbg(&dssdev->dev, "enable\n");
@@ -813,9 +813,9 @@ static int taal_enable(struct omap_dss_device *dssdev)
if (r)
goto err;
-#ifdef TAAL_USE_ESD_CHECK
- queue_delayed_work(td->esd_wq, &td->esd_work, TAAL_ESD_CHECK_PERIOD);
-#endif
+ if (panel_data->use_esd_check)
+ queue_delayed_work(td->esd_wq, &td->esd_work,
+ TAAL_ESD_CHECK_PERIOD);
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
@@ -885,6 +885,7 @@ err:
static int taal_resume(struct omap_dss_device *dssdev)
{
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+ struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r;
dev_dbg(&dssdev->dev, "resume\n");
@@ -906,10 +907,9 @@ static int taal_resume(struct omap_dss_device *dssdev)
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
} else {
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-#ifdef TAAL_USE_ESD_CHECK
- queue_delayed_work(td->esd_wq, &td->esd_work,
- TAAL_ESD_CHECK_PERIOD);
-#endif
+ if (panel_data->use_esd_check)
+ queue_delayed_work(td->esd_wq, &td->esd_work,
+ TAAL_ESD_CHECK_PERIOD);
}
mutex_unlock(&td->lock);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 18/21] OMAP: DSS2: Taal: Add panel specific configuration structure
2010-05-05 14:27 ` [PATCH v3 17/21] OMAP: DSS2: Taal: Configure ESD check in " Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 19/21] OMAP: DSS2: Taal: Print panel name in addition to revision Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Add a structure for panel specific configration to be able to support
more than one panel in the future.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 108 +++++++++++++++++++++++------
1 files changed, 87 insertions(+), 21 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 9502a4d..9f40f32 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -68,6 +68,58 @@ static irqreturn_t taal_te_isr(int irq, void *data);
static void taal_te_timeout_work_callback(struct work_struct *work);
static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable);
+/**
+ * struct panel_config - panel configuration
+ * @name: panel name
+ * @type: panel type
+ * @timings: panel resolution
+ * @sleep: various panel specific delays, passed to msleep() if non-zero
+ * @reset_sequence: reset sequence timings, passed to udelay() if non-zero
+ */
+struct panel_config {
+ const char *name;
+ int type;
+
+ struct omap_video_timings timings;
+
+ struct {
+ unsigned int sleep_in;
+ unsigned int sleep_out;
+ unsigned int hw_reset;
+ unsigned int enable_te;
+ } sleep;
+
+ struct {
+ unsigned int high;
+ unsigned int low;
+ } reset_sequence;
+};
+
+enum {
+ PANEL_TAAL,
+};
+
+static struct panel_config panel_configs[] = {
+ {
+ .name = "taal",
+ .type = PANEL_TAAL,
+ .timings = {
+ .x_res = 864,
+ .y_res = 480,
+ },
+ .sleep = {
+ .sleep_in = 5,
+ .sleep_out = 5,
+ .hw_reset = 5,
+ .enable_te = 100, /* possible panel bug */
+ },
+ .reset_sequence = {
+ .high = 10,
+ .low = 10,
+ },
+ },
+};
+
struct taal_data {
struct mutex lock;
@@ -104,6 +156,8 @@ struct taal_data {
struct workqueue_struct *esd_wq;
struct delayed_work esd_work;
+
+ struct panel_config *panel_config;
};
static inline struct nokia_dsi_panel_data
@@ -173,7 +227,8 @@ static int taal_sleep_in(struct taal_data *td)
hw_guard_start(td, 120);
- msleep(5);
+ if (td->panel_config->sleep.sleep_in)
+ msleep(td->panel_config->sleep.sleep_in);
return 0;
}
@@ -190,7 +245,8 @@ static int taal_sleep_out(struct taal_data *td)
hw_guard_start(td, 120);
- msleep(5);
+ if (td->panel_config->sleep.sleep_out)
+ msleep(td->panel_config->sleep.sleep_out);
return 0;
}
@@ -509,20 +565,24 @@ static struct attribute_group taal_attr_group = {
static void taal_hw_reset(struct omap_dss_device *dssdev)
{
+ struct taal_data *td = dev_get_drvdata(&dssdev->dev);
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
if (panel_data->reset_gpio = -1)
return;
gpio_set_value(panel_data->reset_gpio, 1);
- udelay(10);
+ if (td->panel_config->reset_sequence.high)
+ udelay(td->panel_config->reset_sequence.high);
/* reset the panel */
gpio_set_value(panel_data->reset_gpio, 0);
- /* assert reset for at least 10us */
- udelay(10);
+ /* assert reset */
+ if (td->panel_config->reset_sequence.low)
+ udelay(td->panel_config->reset_sequence.low);
gpio_set_value(panel_data->reset_gpio, 1);
- /* wait 5ms after releasing reset */
- msleep(5);
+ /* wait after releasing reset */
+ if (td->panel_config->sleep.hw_reset)
+ msleep(td->panel_config->sleep.hw_reset);
}
static int taal_probe(struct omap_dss_device *dssdev)
@@ -531,12 +591,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
struct taal_data *td;
struct backlight_device *bldev;
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
- int r;
-
- const struct omap_video_timings taal_panel_timings = {
- .x_res = 864,
- .y_res = 480,
- };
+ struct panel_config *panel_config = NULL;
+ int r, i;
dev_dbg(&dssdev->dev, "probe\n");
@@ -545,8 +601,20 @@ static int taal_probe(struct omap_dss_device *dssdev)
goto err;
}
+ for (i = 0; i < ARRAY_SIZE(panel_configs); i++) {
+ if (strcmp(panel_data->name, panel_configs[i].name) = 0) {
+ panel_config = &panel_configs[i];
+ break;
+ }
+ }
+
+ if (!panel_config) {
+ r = -EINVAL;
+ goto err;
+ }
+
dssdev->panel.config = OMAP_DSS_LCD_TFT;
- dssdev->panel.timings = taal_panel_timings;
+ dssdev->panel.timings = panel_config->timings;
dssdev->ctrl.pixel_size = 24;
td = kzalloc(sizeof(*td), GFP_KERNEL);
@@ -555,6 +623,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
goto err;
}
td->dssdev = dssdev;
+ td->panel_config = panel_config;
mutex_init(&td->lock);
@@ -686,9 +755,6 @@ static int taal_power_on(struct omap_dss_device *dssdev)
u8 id1, id2, id3;
int r;
- /* it seems we have to wait a bit until taal is ready */
- msleep(5);
-
r = omapdss_dsi_display_enable(dssdev);
if (r) {
dev_err(&dssdev->dev, "failed to enable DSI\n");
@@ -774,7 +840,7 @@ static void taal_power_off(struct omap_dss_device *dssdev)
r = taal_dcs_write_0(DCS_DISPLAY_OFF);
if (!r) {
r = taal_sleep_in(td);
- /* wait a bit so that the message goes through */
+ /* HACK: wait a bit so that the message goes through */
msleep(10);
}
@@ -1036,6 +1102,7 @@ static int taal_sync(struct omap_dss_device *dssdev)
static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
{
+ struct taal_data *td = dev_get_drvdata(&dssdev->dev);
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
int r;
@@ -1047,9 +1114,8 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
if (!panel_data->use_ext_te)
omapdss_dsi_enable_te(dssdev, enable);
- /* XXX for some reason, DSI TE breaks if we don't wait here.
- * Panel bug? Needs more studying */
- msleep(100);
+ if (td->panel_config->sleep.enable_te)
+ msleep(td->panel_config->sleep.enable_te);
return r;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 19/21] OMAP: DSS2: Taal: Print panel name in addition to revision
2010-05-05 14:27 ` [PATCH v3 18/21] OMAP: DSS2: Taal: Add panel specific configuration structure Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 20/21] OMAP: DSS2: Taal: Add regulator configuration support Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
The driver will support other panels in addition to Taal, print also the
name.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 9f40f32..b73cd12 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -811,8 +811,8 @@ static int taal_power_on(struct omap_dss_device *dssdev)
td->enabled = 1;
if (!td->intro_printed) {
- dev_info(&dssdev->dev, "revision %02x.%02x.%02x\n",
- id1, id2, id3);
+ dev_info(&dssdev->dev, "%s panel revision %02x.%02x.%02x\n",
+ td->panel_config->name, id1, id2, id3);
if (td->cabc_broken)
dev_info(&dssdev->dev,
"old Taal version, CABC disabled\n");
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 20/21] OMAP: DSS2: Taal: Add regulator configuration support
2010-05-05 14:27 ` [PATCH v3 19/21] OMAP: DSS2: Taal: Print panel name in addition to revision Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
2010-05-05 14:27 ` [PATCH v3 21/21] OMAP: DSS2: Taal: CABC workaround is Taal specific Jani Nikula
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Add support for configuring regulators in the panel specific
configuration data.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 83 +++++++++++++++++++++++++++++
1 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index b73cd12..617723b 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -30,6 +30,7 @@
#include <linux/gpio.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
+#include <linux/regulator/consumer.h>
#include <linux/mutex.h>
#include <plat/display.h>
@@ -68,6 +69,73 @@ static irqreturn_t taal_te_isr(int irq, void *data);
static void taal_te_timeout_work_callback(struct work_struct *work);
static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable);
+struct panel_regulator {
+ struct regulator *regulator;
+ const char *name;
+ int min_uV;
+ int max_uV;
+};
+
+static void free_regulators(struct panel_regulator *regulators, int n)
+{
+ int i;
+
+ for (i = 0; i < n; i++) {
+ /* disable/put in reverse order */
+ regulator_disable(regulators[n - i - 1].regulator);
+ regulator_put(regulators[n - i - 1].regulator);
+ }
+}
+
+static int init_regulators(struct omap_dss_device *dssdev,
+ struct panel_regulator *regulators, int n)
+{
+ int r, i, v;
+
+ for (i = 0; i < n; i++) {
+ struct regulator *reg;
+
+ reg = regulator_get(&dssdev->dev, regulators[i].name);
+ if (IS_ERR(reg)) {
+ dev_err(&dssdev->dev, "failed to get regulator %s\n",
+ regulators[i].name);
+ r = PTR_ERR(reg);
+ goto err;
+ }
+
+ /* FIXME: better handling of fixed vs. variable regulators */
+ v = regulator_get_voltage(reg);
+ if (v < regulators[i].min_uV || v > regulators[i].max_uV) {
+ r = regulator_set_voltage(reg, regulators[i].min_uV,
+ regulators[i].max_uV);
+ if (r) {
+ dev_err(&dssdev->dev,
+ "failed to set regulator %s voltage\n",
+ regulators[i].name);
+ regulator_put(reg);
+ goto err;
+ }
+ }
+
+ r = regulator_enable(reg);
+ if (r) {
+ dev_err(&dssdev->dev, "failed to enable regulator %s\n",
+ regulators[i].name);
+ regulator_put(reg);
+ goto err;
+ }
+
+ regulators[i].regulator = reg;
+ }
+
+ return 0;
+
+err:
+ free_regulators(regulators, i);
+
+ return r;
+}
+
/**
* struct panel_config - panel configuration
* @name: panel name
@@ -75,6 +143,8 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable);
* @timings: panel resolution
* @sleep: various panel specific delays, passed to msleep() if non-zero
* @reset_sequence: reset sequence timings, passed to udelay() if non-zero
+ * @regulators: array of panel regulators
+ * @num_regulators: number of regulators in the array
*/
struct panel_config {
const char *name;
@@ -93,6 +163,9 @@ struct panel_config {
unsigned int high;
unsigned int low;
} reset_sequence;
+
+ struct panel_regulator *regulators;
+ int num_regulators;
};
enum {
@@ -629,6 +702,11 @@ static int taal_probe(struct omap_dss_device *dssdev)
atomic_set(&td->do_update, 0);
+ r = init_regulators(dssdev, panel_config->regulators,
+ panel_config->num_regulators);
+ if (r)
+ goto err_reg;
+
td->esd_wq = create_singlethread_workqueue("taal_esd");
if (td->esd_wq = NULL) {
dev_err(&dssdev->dev, "can't create ESD workqueue\n");
@@ -714,6 +792,8 @@ err_gpio:
err_bl:
destroy_workqueue(td->esd_wq);
err_wq:
+ free_regulators(panel_config->regulators, panel_config->num_regulators);
+err_reg:
kfree(td);
err:
return r;
@@ -746,6 +826,9 @@ static void taal_remove(struct omap_dss_device *dssdev)
/* reset, to be sure that the panel is in a valid state */
taal_hw_reset(dssdev);
+ free_regulators(td->panel_config->regulators,
+ td->panel_config->num_regulators);
+
kfree(td);
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 21/21] OMAP: DSS2: Taal: CABC workaround is Taal specific
2010-05-05 14:27 ` [PATCH v3 20/21] OMAP: DSS2: Taal: Add regulator configuration support Jani Nikula
@ 2010-05-05 14:27 ` Jani Nikula
0 siblings, 0 replies; 22+ messages in thread
From: Jani Nikula @ 2010-05-05 14:27 UTC (permalink / raw)
To: Tomi.Valkeinen, tony; +Cc: linux-omap, linux-fbdev, ext-jani.1.nikula
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
Prepare for supporting panels other than Taal in this driver.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
drivers/video/omap2/displays/panel-taal.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 617723b..981e38d 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -856,8 +856,9 @@ static int taal_power_on(struct omap_dss_device *dssdev)
if (r)
goto err;
- /* on early revisions CABC is broken */
- if (id2 = 0x00 || id2 = 0xff || id2 = 0x81)
+ /* on early Taal revisions CABC is broken */
+ if (td->panel_config->type = PANEL_TAAL &&
+ (id2 = 0x00 || id2 = 0xff || id2 = 0x81))
td->cabc_broken = true;
r = taal_dcs_write_1(DCS_BRIGHTNESS, 0xff);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2010-05-05 14:27 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05 14:27 [PATCH v3 00/21] OMAP: DSS2: Taal panel driver updates Jani Nikula
2010-05-05 14:27 ` [PATCH v3 01/21] OMAP: DSS2: Taal: Add panel hardware reset Jani Nikula
2010-05-05 14:27 ` [PATCH v3 02/21] OMAP: DSS2: Taal: add locks to taal_bl_update_status Jani Nikula
2010-05-05 14:27 ` [PATCH v3 03/21] OMAP: DSS2: Taal: Add locks to protect taal data access Jani Nikula
2010-05-05 14:27 ` [PATCH v3 04/21] OMAP: DSS2: Taal: Cosmetic improvement to backlight properties initialization Jani Nikula
2010-05-05 14:27 ` [PATCH v3 05/21] OMAP: DSS2: Taal: Remove platform enable/disable Jani Nikula
2010-05-05 14:27 ` [PATCH v3 06/21] OMAP: DSS2: Taal: Fix request_irq() error handling Jani Nikula
2010-05-05 14:27 ` [PATCH v3 07/21] OMAP: DSS2: Taal: Remove ESD work cancel from driver probe " Jani Nikula
2010-05-05 14:27 ` [PATCH v3 08/21] OMAP: DSS2: Taal: Improve taal_power_on() " Jani Nikula
2010-05-05 14:27 ` [PATCH v3 09/21] OMAP: DSS2: Taal: Ensure panel is enabled in enable_te() and run_test() Jani Nikula
2010-05-05 14:27 ` [PATCH v3 10/21] OMAP: DSS2: Taal: Change DSI bus locking to avoid deadlock in ESD work Jani Nikula
2010-05-05 14:27 ` [PATCH v3 11/21] OMAP: DSS2: Taal: Check taal_power_on() return value in taal_resume() Jani Nikula
2010-05-05 14:27 ` [PATCH v3 12/21] OMAP: DSS2: Taal: Change ESD work management Jani Nikula
2010-05-05 14:27 ` [PATCH v3 13/21] OMAP: DSS2: Taal: Change probe error handling labels Jani Nikula
2010-05-05 14:27 ` [PATCH v3 14/21] OMAP: DSS2: Taal: Add proper external TE support Jani Nikula
2010-05-05 14:27 ` [PATCH v3 15/21] OMAP: DSS2: Add Nokia DSI command mode panel configuration struct Jani Nikula
2010-05-05 14:27 ` [PATCH v3 16/21] OMAP: DSS2: Taal: Use Nokia DSI panel data Jani Nikula
2010-05-05 14:27 ` [PATCH v3 17/21] OMAP: DSS2: Taal: Configure ESD check in " Jani Nikula
2010-05-05 14:27 ` [PATCH v3 18/21] OMAP: DSS2: Taal: Add panel specific configuration structure Jani Nikula
2010-05-05 14:27 ` [PATCH v3 19/21] OMAP: DSS2: Taal: Print panel name in addition to revision Jani Nikula
2010-05-05 14:27 ` [PATCH v3 20/21] OMAP: DSS2: Taal: Add regulator configuration support Jani Nikula
2010-05-05 14:27 ` [PATCH v3 21/21] OMAP: DSS2: Taal: CABC workaround is Taal specific Jani Nikula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).