From: Jani Nikula <ext-jani.1.nikula@nokia.com> 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 v2 14/21] OMAP: DSS2: Taal: Add proper external TE support Date: Mon, 03 May 2010 06:18:34 +0000 [thread overview] Message-ID: <5a5dc1e253df571477551b8f63560ad9d1a3ab2b.1272621452.git.ext-jani.1.nikula@nokia.com> (raw) In-Reply-To: <b88e1b382ddf14870c7a44e7ca620ad84d883b50.1272621452.git.ext-jani.1.nikula@nokia.com> 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 | 94 +++++++++++++++++++++++------ 1 files changed, 76 insertions(+), 18 deletions(-) diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 0f62c96..c326e51 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"); @@ -604,9 +605,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); @@ -615,6 +619,7 @@ static int taal_probe(struct omap_dss_device *dssdev) goto err_sysfs; } + taal_hw_reset(dssdev); return 0; @@ -909,6 +914,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 +979,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); @@ -975,7 +1032,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
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <ext-jani.1.nikula@nokia.com> 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 v2 14/21] OMAP: DSS2: Taal: Add proper external TE support Date: Mon, 3 May 2010 09:18:34 +0300 [thread overview] Message-ID: <5a5dc1e253df571477551b8f63560ad9d1a3ab2b.1272621452.git.ext-jani.1.nikula@nokia.com> (raw) In-Reply-To: <b88e1b382ddf14870c7a44e7ca620ad84d883b50.1272621452.git.ext-jani.1.nikula@nokia.com> In-Reply-To: <cover.1272621452.git.ext-jani.1.nikula@nokia.com> 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 | 94 +++++++++++++++++++++++------ 1 files changed, 76 insertions(+), 18 deletions(-) diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 0f62c96..c326e51 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"); @@ -604,9 +605,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); @@ -615,6 +619,7 @@ static int taal_probe(struct omap_dss_device *dssdev) goto err_sysfs; } + taal_hw_reset(dssdev); return 0; @@ -909,6 +914,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 +979,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); @@ -975,7 +1032,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
next prev parent reply other threads:[~2010-05-03 6:18 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-05-03 6:18 [PATCH v2 00/21] OMAP: DSS2: Taal panel driver updates Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 01/21] OMAP: DSS2: Taal: Add panel hardware reset Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 02/21] OMAP: DSS2: Taal: add locks to taal_bl_update_status Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 03/21] OMAP: DSS2: Taal: Add locks to protect taal data access Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 04/21] OMAP: DSS2: Taal: Cosmetic improvement to backlight properties initialization Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 05/21] OMAP: DSS2: Taal: Remove platform enable/disable Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 06/21] OMAP: DSS2: Taal: Fix request_irq() error handling Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 07/21] OMAP: DSS2: Taal: Remove ESD work cancel from driver probe " Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 08/21] OMAP: DSS2: Taal: Improve taal_power_on() " Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 09/21] OMAP: DSS2: Taal: Bail out from taal_run_test() if panel is not enabled Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 10/21] OMAP: DSS2: Taal: Change DSI bus locking to avoid deadlock in ESD work Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 11/21] OMAP: DSS2: Taal: Check taal_power_on() return value in taal_resume() Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 12/21] OMAP: DSS2: Taal: Change ESD work management Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 13/21] OMAP: DSS2: Taal: Change probe error handling labels Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` Jani Nikula [this message] 2010-05-03 6:18 ` [PATCH v2 14/21] OMAP: DSS2: Taal: Add proper external TE support Jani Nikula 2010-05-03 6:18 ` [PATCH v2 15/21] OMAP: DSS2: Add Nokia DSI command mode panel configuration struct Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 16/21] OMAP: DSS2: Taal: Use Nokia DSI panel data Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 17/21] OMAP: DSS2: Taal: Configure ESD check in " Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 18/21] OMAP: DSS2: Taal: Add panel specific configuration structure Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 19/21] OMAP: DSS2: Taal: Print panel name in addition to revision Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 20/21] OMAP: DSS2: Taal: Add regulator configuration support Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 21/21] OMAP: DSS2: Taal: CABC workaround is Taal specific Jani Nikula 2010-05-03 6:18 ` Jani Nikula
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=5a5dc1e253df571477551b8f63560ad9d1a3ab2b.1272621452.git.ext-jani.1.nikula@nokia.com \ --to=ext-jani.1.nikula@nokia.com \ --cc=Tomi.Valkeinen@nokia.com \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=tony@atomide.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.