OMAP: DSS2: Taal panel driver updates
Subsystems (3)
v3 cover OMAP: DSS2: Taal panel driver updates
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
PATCH v3 1/21 OMAP: DSS2: Taal: Add panel hardware reset
From: Jani Nikula <[email protected]>
Issue a proper reset pulse on the reset line instead of just doing power on/off.
--- drivers/video/omap2/displays/panel-taal.c | 44 ++++++++++++++++++++++++++-- 1 files changed, 40 insertions(+), 4 deletions(-)
drivers/video/omap2/displays/panel-taal.c +40 -4
@@ -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 ();
Signature · 1 line
1.6.5.2
PATCH v3 2/21 OMAP: DSS2: Taal: add locks to taal_bl_update_status
From: Valkeinen Tomi (Nokia-D/Helsinki) <[email protected]>
From: Tomi Valkeinen <[email protected]>
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.
--- drivers/video/omap2/displays/panel-taal.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-)
drivers/video/omap2/displays/panel-taal.c +10 -8
@@ -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)
Signature · 1 line
1.6.5.2
PATCH v3 3/21 OMAP: DSS2: Taal: Add locks to protect taal data access
From: Jani Nikula <[email protected]>
Avoid potential race conditions in sysfs access to taal data.
--- drivers/video/omap2/displays/panel-taal.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/video/omap2/displays/panel-taal.c +12 -0
@@ -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; }
Signature · 1 line
1.6.5.2
PATCH v3 4/21 OMAP: DSS2: Taal: Cosmetic improvement to backlight properties initialization
From: Jani Nikula <[email protected]>
Let the compiler worry about the type for us.
--- drivers/video/omap2/displays/panel-taal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/omap2/displays/panel-taal.c +1 -1
@@ -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;
Signature · 1 line
1.6.5.2
PATCH v3 5/21 OMAP: DSS2: Taal: Remove platform enable/disable
From: Jani Nikula <[email protected]>
After the addition of proper hardware reset, taal_hw_reset(), there's no need for an additional platform enable/disable. Remove them.
--- drivers/video/omap2/displays/panel-taal.c | 11 ----------- 1 files changed, 0 insertions(+), 11 deletions(-)
drivers/video/omap2/displays/panel-taal.c +0 -11
@@ -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 ();
Signature · 1 line
1.6.5.2
PATCH v3 6/21 OMAP: DSS2: Taal: Fix request_irq() error handling
From: Jani Nikula <[email protected]>
Separate gpio_request() and request_irq() error handling.
--- drivers/video/omap2/displays/panel-taal.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/video/omap2/displays/panel-taal.c +7 -7
@@ -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:
Signature · 1 line
1.6.5.2
PATCH v3 7/21 OMAP: DSS2: Taal: Remove ESD work cancel from driver probe error handling
From: Jani Nikula <[email protected]>
ESD work is never queued in probe, no need to cancel it on probe error.
--- drivers/video/omap2/displays/panel-taal.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/video/omap2/displays/panel-taal.c +0 -1
@@ -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);
Signature · 1 line
1.6.5.2
PATCH v3 8/21 OMAP: DSS2: Taal: Improve taal_power_on() error handling
From: Jani Nikula <[email protected]>
Check return values and bail out on errors.
--- drivers/video/omap2/displays/panel-taal.c | 30 ++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 7 deletions(-)
drivers/video/omap2/displays/panel-taal.c +23 -7
@@ -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)
Signature · 1 line
1.6.5.2
PATCH v3 9/21 OMAP: DSS2: Taal: Ensure panel is enabled in enable_te() and run_test()
From: Jani Nikula <[email protected]>
Bail out from taal_enable_te() and taal_run_test() if panel is not enabled.
--- drivers/video/omap2/displays/panel-taal.c | 31 +++++++++++++++++++++------- 1 files changed, 23 insertions(+), 8 deletions(-)
drivers/video/omap2/displays/panel-taal.c +23 -8
@@ -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; }
Signature · 1 line
1.6.5.2
PATCH v3 10/21 OMAP: DSS2: Taal: Change DSI bus locking to avoid deadlock in ESD work
From: Jani Nikula <[email protected]>
Move dsi_bus_lock/unlock() out of taal_power_on/off() to avoid deadlock in taal_esd_work().
--- drivers/video/omap2/displays/panel-taal.c | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-)
drivers/video/omap2/displays/panel-taal.c +19 -10
@@ -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);
Signature · 1 line
1.6.5.2
PATCH v3 11/21 OMAP: DSS2: Taal: Check taal_power_on() return value in taal_resume()
From: Jani Nikula <[email protected]>
Change state only if power on was succesful.
--- drivers/video/omap2/displays/panel-taal.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/video/omap2/displays/panel-taal.c +4 -1
@@ -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);
Signature · 1 line
1.6.5.2
PATCH v3 12/21 OMAP: DSS2: Taal: Change ESD work management
From: Jani Nikula <[email protected]>
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.
--- drivers/video/omap2/displays/panel-taal.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-)
drivers/video/omap2/displays/panel-taal.c +16 -9
@@ -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);
Signature · 1 line
1.6.5.2
PATCH v3 13/21 OMAP: DSS2: Taal: Change probe error handling labels
From: Jani Nikula <[email protected]>
Switch from numbered to named labels to make it easier to add new labels for error handling.
--- drivers/video/omap2/displays/panel-taal.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
drivers/video/omap2/displays/panel-taal.c +12 -12
@@ -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; }
Signature · 1 line
1.6.5.2
PATCH v3 14/21 OMAP: DSS2: Taal: Add proper external TE support
From: Jani Nikula <[email protected]>
Add gpio irq based external TE support with timeout.
--- drivers/video/omap2/displays/panel-taal.c | 93 +++++++++++++++++++++++------ 1 files changed, 75 insertions(+), 18 deletions(-)
drivers/video/omap2/displays/panel-taal.c +75 -18
@@ -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 */
Signature · 1 line
1.6.5.2
PATCH v3 15/21 OMAP: DSS2: Add Nokia DSI command mode panel configuration struct
From: Jani Nikula <[email protected]>
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).
--- 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
arch/arm/plat-omap/include/plat/nokia-dsi-panel.h new file +31 -0
@@ -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 */
Signature · 1 line
1.6.5.2
PATCH v3 16/21 OMAP: DSS2: Taal: Use Nokia DSI panel data
From: Jani Nikula <[email protected]>
Get board specific information from the Nokia DSI panel data structure instead of the DSS.
--- drivers/video/omap2/displays/panel-taal.c | 59 ++++++++++++++++++---------- 1 files changed, 38 insertions(+), 21 deletions(-)
drivers/video/omap2/displays/panel-taal.c +38 -21
@@ -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;
Signature · 1 line
1.6.5.2
PATCH v3 17/21 OMAP: DSS2: Taal: Configure ESD check in DSI panel data
From: Jani Nikula <[email protected]>
Make ESD check usage configurable in DSI panel data, as opposed to a
--- drivers/video/omap2/displays/panel-taal.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/video/omap2/displays/panel-taal.c +8 -8
@@ -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);
Signature · 1 line
1.6.5.2
PATCH v3 18/21 OMAP: DSS2: Taal: Add panel specific configuration structure
From: Jani Nikula <[email protected]>
Add a structure for panel specific configration to be able to support more than one panel in the future.
--- drivers/video/omap2/displays/panel-taal.c | 108 +++++++++++++++++++++++------ 1 files changed, 87 insertions(+), 21 deletions(-)
drivers/video/omap2/displays/panel-taal.c +87 -21
@@ -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; }
Signature · 1 line
1.6.5.2
PATCH v3 19/21 OMAP: DSS2: Taal: Print panel name in addition to revision
From: Jani Nikula <[email protected]>
The driver will support other panels in addition to Taal, print also the name.
--- drivers/video/omap2/displays/panel-taal.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/video/omap2/displays/panel-taal.c +2 -2
@@ -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" );
Signature · 1 line
1.6.5.2
PATCH v3 20/21 OMAP: DSS2: Taal: Add regulator configuration support
From: Jani Nikula <[email protected]>
Add support for configuring regulators in the panel specific configuration data.
--- drivers/video/omap2/displays/panel-taal.c | 83 +++++++++++++++++++++++++++++ 1 files changed, 83 insertions(+), 0 deletions(-)
drivers/video/omap2/displays/panel-taal.c +83 -0
@@ -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); }
Signature · 1 line
1.6.5.2
PATCH v3 21/21 OMAP: DSS2: Taal: CABC workaround is Taal specific
From: Jani Nikula <[email protected]>
Prepare for supporting panels other than Taal in this driver.
--- drivers/video/omap2/displays/panel-taal.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/video/omap2/displays/panel-taal.c +3 -2
@@ -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 );
Signature · 1 line
1.6.5.2