From patchwork Wed May 5 14:27:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 97103 X-Patchwork-Delegate: tomi.valkeinen@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o45ES5P7002693 for ; Wed, 5 May 2010 14:28:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934752Ab0EEO2D (ORCPT ); Wed, 5 May 2010 10:28:03 -0400 Received: from smtp.nokia.com ([192.100.122.230]:64971 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932234Ab0EEO15 (ORCPT ); Wed, 5 May 2010 10:27:57 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o45ERrlT008227; Wed, 5 May 2010 17:27:53 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 5 May 2010 17:27:46 +0300 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 5 May 2010 17:27:45 +0300 Received: from localhost.localdomain (esdhcp04142.research.nokia.com [172.21.41.42]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o45ERfR3016232; Wed, 5 May 2010 17:27:44 +0300 From: Jani Nikula To: Tomi.Valkeinen@nokia.com, tony@atomide.com Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, ext-jani.1.nikula@nokia.com Subject: [PATCH v3 01/21] OMAP: DSS2: Taal: Add panel hardware reset Date: Wed, 5 May 2010 17:27:21 +0300 Message-Id: X-Mailer: git-send-email 1.6.5.2 In-Reply-To: References: In-Reply-To: References: X-OriginalArrivalTime: 05 May 2010 14:27:45.0539 (UTC) FILETIME=[2121C530:01CAEC5F] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 05 May 2010 14:28:08 +0000 (UTC) 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();