From: Archit Taneja <archit@ti.com>
To: tomi.valkeinen@ti.com
Cc: rohitkc@ti.com, linux-omap@vger.kernel.org,
linux-fbdev@vger.kernel.org, Archit Taneja <archit@ti.com>
Subject: [RFC PATCH 06/29] OMAPDSS: APPLY: Add writeback enable/disable functions
Date: Tue, 27 Dec 2011 12:48:49 +0000 [thread overview]
Message-ID: <1324989432-3625-7-git-send-email-archit@ti.com> (raw)
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>
In writeback capture mode, enabling writeback is similar to enabling an overlay
manager. It leads to an immediate copy of shadow registers to main registers and
starts DISPC DMA for frame transfer to the destination base addresses.
Hence, 'enabled' parameter for writeback is not a part of the writeback_info
struct. Its is maintained as a separate parameter like it's done for an overlay
manager.
Add dss_wb_enable/disable functions. Since we need to be connected to an enabled
manager when enabling writeback. Add checks to ensure that the connected manager
is enabled, add a check in dss_mgr_disable to issue a warning if writeback is in
use.
Call dss_setup_fifos() in dss_wb_enable(), this would be used to configure
writeback FIFOs in the future. Create a dummy dispc_wb_enable() function which
will be later filled up. Call dss_mgr_enable/disable through the dummy writeback
panel's enable/disable ops.
Signed-off-by: Archit Taneja <archit@ti.com>
---
drivers/video/omap2/dss/apply.c | 92 +++++++++++++++++++++++++++++++++-
drivers/video/omap2/dss/dispc.c | 5 ++
drivers/video/omap2/dss/dss.h | 3 +
drivers/video/omap2/dss/writeback.c | 12 ++++-
4 files changed, 108 insertions(+), 4 deletions(-)
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index f40f58c..5263ae7 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -114,6 +114,9 @@ struct wb_priv_data {
/* If true, GO bit is up and shadow registers cannot be written.
* Never true for writeback in memory to memory mode */
bool busy;
+
+ /* If true, someone is using writeback */
+ bool enabled;
};
static struct {
@@ -320,6 +323,9 @@ static bool need_isr(void)
struct omap_dss_writeback *wb = dssdev->wbdev;
struct wb_priv_data *wp = get_wb_priv(wb);
+ if (!wp->enabled)
+ continue;
+
if (wp->busy)
return true;
@@ -621,7 +627,7 @@ static void dss_wb_write_regs(struct omap_dss_writeback *wb)
struct omap_dss_writeback_info *wi;
int r;
- if (!wp->info_dirty)
+ if (!wp->enabled || !wp->info_dirty)
return;
WARN_ON(wp->busy);
@@ -703,7 +709,7 @@ static void dss_write_regs(void)
wp = get_wb_priv(wb);
mp = get_mgr_priv(wb->dssdev->manager);
- if (!mp->enabled)
+ if (!mp->enabled || !wp->enabled)
continue;
if (wp->busy)
@@ -752,7 +758,7 @@ static void dss_set_go_bits(void)
if (!mp->enabled)
continue;
- if (wp->busy)
+ if (!wp->enabled || wp->busy)
continue;
if (!need_wb_go(wb))
@@ -1163,6 +1169,7 @@ err:
void dss_mgr_disable(struct omap_overlay_manager *mgr)
{
struct mgr_priv_data *mp = get_mgr_priv(mgr);
+ struct omap_dss_device *dssdev = mgr->get_writeback(mgr);
unsigned long flags;
mutex_lock(&apply_lock);
@@ -1170,6 +1177,13 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
if (!mp->enabled)
goto out;
+ if (dssdev) {
+ /* if writeback is connected to the manager, issue a warning
+ * if it is enabled */
+ struct wb_priv_data *wp = get_wb_priv(dssdev->wbdev);
+ WARN_ON(wp->enabled);
+ }
+
if (!mgr_manual_update(mgr))
dispc_mgr_enable(mgr->id, false);
@@ -1556,3 +1570,75 @@ void dss_wb_get_info(struct omap_dss_writeback *wb,
spin_unlock_irqrestore(&data_lock, flags);
}
+
+int dss_wb_enable(struct omap_dss_writeback *wb)
+{
+ struct wb_priv_data *wp = get_wb_priv(wb);
+ struct mgr_priv_data *mp;
+ unsigned long flags;
+ int r = 0;
+
+ mutex_lock(&apply_lock);
+
+ /* don't enable if it isn't connected to any manager */
+ if (!wb->dssdev->manager) {
+ r = -EINVAL;
+ goto out;
+ }
+
+ mp = get_mgr_priv(wb->dssdev->manager);
+
+ /* don't enable if the manager WB is connected to is disabled */
+ if (!mp->enabled) {
+ r = -EINVAL;
+ goto out;
+ }
+
+ if (wp->enabled)
+ goto out;
+
+ /* use a simple check for now */
+ r = dss_wb_simple_check(wb, &wp->info);
+ if (r)
+ goto out;
+
+ spin_lock_irqsave(&data_lock, flags);
+
+ wp->enabled = true;
+
+ dss_setup_fifos();
+
+ dss_write_regs();
+ dss_set_go_bits();
+
+ spin_unlock_irqrestore(&data_lock, flags);
+
+ dispc_wb_enable(wb->id, true);
+
+out:
+ mutex_unlock(&apply_lock);
+
+ return r;
+}
+
+void dss_wb_disable(struct omap_dss_writeback *wb)
+{
+ struct wb_priv_data *wp = get_wb_priv(wb);
+ unsigned long flags;
+
+ mutex_lock(&apply_lock);
+
+ if (!wp->enabled)
+ goto out;
+
+ dispc_wb_enable(wb->id, false);
+
+ spin_lock_irqsave(&data_lock, flags);
+
+ wp->enabled = false;
+
+ spin_unlock_irqrestore(&data_lock, flags);
+
+out:
+ mutex_unlock(&apply_lock);
+}
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index d98905f..35ed6ca 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2070,6 +2070,11 @@ void dispc_mgr_enable(enum omap_channel channel, bool enable)
BUG();
}
+void dispc_wb_enable(int id, bool enable)
+{
+ return;
+}
+
void dispc_lcd_enable_signal_polarity(bool act_high)
{
if (!dss_has_feature(FEAT_LCDENABLEPOL))
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 556bc7c..bb25d96 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -195,6 +195,8 @@ int dss_wb_set_info(struct omap_dss_writeback *wb,
struct omap_dss_writeback_info *info);
void dss_wb_get_info(struct omap_dss_writeback *wb,
struct omap_dss_writeback_info *info);
+int dss_wb_enable(struct omap_dss_writeback *wb);
+void dss_wb_disable(struct omap_dss_writeback *wb);
/* display */
int dss_suspend_all_devices(void);
@@ -479,6 +481,7 @@ void dispc_mgr_setup(enum omap_channel channel,
bool dispc_wb_go_busy(int id);
void dispc_wb_go(int id);
int dispc_wb_setup(int id, struct omap_dss_writeback_info *wi);
+void dispc_wb_enable(int id, bool enable);
/* VENC */
#ifdef CONFIG_OMAP2_DSS_VENC
diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c
index 5e54221..eefab4e 100644
--- a/drivers/video/omap2/dss/writeback.c
+++ b/drivers/video/omap2/dss/writeback.c
@@ -38,13 +38,23 @@ static int dss_writeback_enable(struct omap_dss_writeback *wb)
r = dispc_runtime_get();
if (r)
- return r;
+ goto err0;
+
+ r = dss_wb_enable(wb);
+ if (r)
+ goto err1;
return 0;
+err1:
+ dispc_runtime_put();
+err0:
+ return r;
}
static void dss_writeback_disable(struct omap_dss_writeback *wb)
{
+ dss_wb_disable(wb);
+
dispc_runtime_put();
}
--
1.7.4.1
next prev parent reply other threads:[~2011-12-27 12:48 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-27 12:48 [RFC PATCH 00/29] OMAPDSS: Initial Writeback Capture mode support Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 01/29] omapdss/omapfb/omap_vout: Introduce manager output struct Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 02/29] OMAPDSS: Add writeback to omap_dss_mgr_output Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 03/29] OMAPDSS: Writeback: Add writeback interface and panel driver Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 04/29] OMAPDSS: APPLY/Writeback: Add writeback_info Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 05/29] OMAPDSS: APPLY/Writeback: Apply writeback configurations Archit Taneja
2011-12-27 12:48 ` Archit Taneja [this message]
2011-12-27 12:48 ` [RFC PATCH 07/29] OMAPDSS: APPLY: Add extra_info for writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 08/29] OMAPDSS: APPLY: Modify manager unset device op Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 09/29] OMAPDSS: APPLY: Allow manager set/unset_device ops to set/unset writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 10/29] OMAPDSS: APPLY: Calculate channel_in for writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 11/29] OMAPDSS: DISPC: Add writeback as a new plane Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 12/29] OMAPDSS: Writeback: Add check for color_mode in dss_wb_simple_check() Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 13/29] OMAPDSS: APPLY: Configure writeback FIFOs Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 14/29] OMAPDSS: DISPC: Allow both upscaling and downscaling of chroma Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 15/29] OMAPDSS: DISPC: Pass overlay caps as a parameter to DISPC overlay related function Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 16/29] OMAPDSS: OVERLAY: Add position and replication as overlay caps Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 17/29] OMAPDSS: DISPC: Make dispc_ovl_setup call dispc_plane_setup Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 18/29] OMAPDSS: DISPC: Make chroma_upscale an argument to dispc_plane_setup Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 19/29] OMAPDSS: DISPC: Don't set chroma resampling bit for writeback Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 20/29] OMAPDSS: Writeback: Add writeback capabilities Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 21/29] OMAPDSS: DISPC: Configure overlay-like parameters in dispc_wb_setup Archit Taneja
2012-08-02 10:22 ` Chandrabhanu Mahapatra
2011-12-27 12:49 ` [RFC PATCH 22/29] OMAPDSS: DISPC: Setup writeback go, enable and channel_in functions Archit Taneja
2012-08-02 10:07 ` Mahapatra, Chandrabhanu
2011-12-27 12:49 ` [RFC PATCH 23/29] OMAPDSS: Writeback: Configure writeback specific parameters Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 24/29] OMAPDSS: Writeback: Use panel driver ops to configure mirroring rotation and buffe Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 25/29] OMAPDSS: Writeback: Add sysfs attributes to writeback panel Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 26/29] OMAPDSS: DISPLAY: Add a manager apply to sysfs store attributes for writeback Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 27/29] OMAPDSS: MANAGER: Split manager_display_store into smaller functions Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 28/29] OMAPDSS: MANAGER: Add writeback as a sysfs attribute Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 29/29] OMAPDSS: FEATURES: Allow WB panels to attach to managers Archit Taneja
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=1324989432-3625-7-git-send-email-archit@ti.com \
--to=archit@ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rohitkc@ti.com \
--cc=tomi.valkeinen@ti.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).