From: Archit Taneja <archit@ti.com>
To: tomi.valkeinen@ti.com
Cc: linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org,
Archit Taneja <archit@ti.com>
Subject: [RFC 05/11] OMAPDSS: APPLY: Add writeback enable/disable funcs
Date: Wed, 07 Nov 2012 14:56:23 +0000 [thread overview]
Message-ID: <1352299469-17609-6-git-send-email-archit@ti.com> (raw)
In-Reply-To: <1352299469-17609-1-git-send-email-archit@ti.com>
Add dss_wb_enable/dss_wb_disable funcs in APPLY similar to that of manager's
enable/disable functions. Since, these functions support only writeback in
memory to memory mode, their job is reduced to just setting the private enable
parameter correctly.
Writeback can't be enabled if the manager it is connected to is not enabled
first. dss_wb_enable makes sure that the connected manager is enabled,
dss_wb_disable doesn't have much dependency on whether the connected manager
is disabled before or after.
Add corresponding enable/disable functions in the output driver which the
writeback user will use. The output driver enable function also takes the
responsibility of configuring and enabling the connected manager. The function
writeback_configure_manager configures the manager in stall mode and sets
the dimensions to the desired writeback input size. The output driver disable
functions disables both manager and writeback.
Signed-off-by: Archit Taneja <archit@ti.com>
---
drivers/video/omap2/dss/apply.c | 70 +++++++++++++++++++++++++++++++++++
drivers/video/omap2/dss/dss.h | 2 +
drivers/video/omap2/dss/writeback.c | 63 +++++++++++++++++++++++++++++++
include/video/omapdss.h | 2 +
4 files changed, 137 insertions(+)
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 8fe7fce..1ab1755 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -1593,3 +1593,73 @@ end:
return 0;
}
+
+int dss_wb_enable(struct omap_dss_output *wb)
+{
+ struct wb_priv_data *wp = get_wb_priv(wb);
+ struct mgr_priv_data *mp;
+ unsigned long flags;
+ int r;
+
+ mutex_lock(&apply_lock);
+
+ if (wp->enabled) {
+ r = 0;
+ goto out;
+ }
+
+ if (wb->manager = NULL) {
+ DSSERR("can't enable writeback without a manager\n");
+ r = -EINVAL;
+ goto out;
+ }
+
+ mp = get_mgr_priv(wb->manager);
+
+ spin_lock_irqsave(&data_lock, flags);
+
+ if (!mp->enabled) {
+ DSSERR("can't enable writeback with a disabled manager\n");
+ r = -EINVAL;
+ goto err;
+ }
+
+ wp->enabled = true;
+
+ /*
+ * TODO: check settings here, if we fail, set wp->enabled back to
+ * false
+ */
+
+ spin_unlock_irqrestore(&data_lock, flags);
+
+ mutex_unlock(&apply_lock);
+
+ return 0;
+err:
+ spin_unlock_irqrestore(&data_lock, flags);
+out:
+ mutex_unlock(&apply_lock);
+
+ return r;
+}
+
+void dss_wb_disable(struct omap_dss_output *wb)
+{
+ struct wb_priv_data *wp = get_wb_priv(wb);
+ unsigned long flags;
+
+ mutex_lock(&apply_lock);
+
+ if (!wp->enabled)
+ goto out;
+
+ spin_lock_irqsave(&data_lock, flags);
+
+ wp->updating = false;
+ wp->enabled = false;
+
+ spin_unlock_irqrestore(&data_lock, flags);
+out:
+ mutex_unlock(&apply_lock);
+}
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 1b9c936..6238895 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -215,6 +215,8 @@ int dss_wb_set_info(struct omap_dss_output *wb,
void dss_wb_get_info(struct omap_dss_output *wb,
struct omap_dss_writeback_info *info);
int omap_dss_wb_apply(struct omap_dss_output *wb);
+int dss_wb_enable(struct omap_dss_output *wb);
+void dss_wb_disable(struct omap_dss_output *wb);
/* output */
void dss_register_output(struct omap_dss_output *out);
diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c
index 9a80f72..598defd 100644
--- a/drivers/video/omap2/dss/writeback.c
+++ b/drivers/video/omap2/dss/writeback.c
@@ -65,6 +65,69 @@ void omapdss_writeback_set_input_size(struct omap_dss_output *wb, u16 w, u16 h)
}
EXPORT_SYMBOL(omapdss_writeback_set_input_size);
+static void writeback_config_manager(struct omap_dss_output *wb)
+{
+ struct platform_device *wbdev = writeback_get_wbdev_from_output(wb);
+ struct writeback_data *wb_data = writeback_get_drv_data(wbdev);
+ struct dss_lcd_mgr_config lcd_config;
+
+ dss_mgr_set_timings(wb->manager, &wb_data->input_timings);
+
+ lcd_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
+ lcd_config.stallmode = true;
+ lcd_config.fifohandcheck = false;
+ lcd_config.clock_info.lck_div = 1;
+ lcd_config.clock_info.pck_div = 1;
+ lcd_config.video_port_width = 24;
+ lcd_config.lcden_sig_polarity = false;
+
+ /*
+ * apply lcd_config such that manager appears to be in stallmode, this
+ * makes the manager operate in manual update mode
+ */
+ dss_mgr_set_lcd_config(wb->manager, &lcd_config);
+
+ dss_mgr_enable(wb->manager);
+}
+
+int omapdss_writeback_enable(struct omap_dss_output *wb)
+{
+ struct platform_device *wbdev = writeback_get_wbdev_from_output(wb);
+ struct writeback_data *wb_data = writeback_get_drv_data(wbdev);
+ int r;
+
+ mutex_lock(&wb_data->lock);
+
+ r = dispc_runtime_get();
+ if (r)
+ goto err;
+
+ writeback_config_manager(wb);
+
+ r = dss_wb_enable(wb);
+err:
+ mutex_unlock(&wb_data->lock);
+
+ return r;
+}
+EXPORT_SYMBOL(omapdss_writeback_enable);
+
+void omapdss_writeback_disable(struct omap_dss_output *wb)
+{
+ struct platform_device *wbdev = writeback_get_wbdev_from_output(wb);
+ struct writeback_data *wb_data = writeback_get_drv_data(wbdev);
+
+ mutex_lock(&wb_data->lock);
+
+ dss_wb_disable(wb);
+ dss_mgr_disable(wb->manager);
+
+ dispc_runtime_put();
+
+ mutex_unlock(&wb_data->lock);
+}
+EXPORT_SYMBOL(omapdss_writeback_disable);
+
int omapdss_writeback_apply(struct omap_dss_output *wb)
{
return omap_dss_wb_apply(wb);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index d8064ed..f63c0cb 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -837,6 +837,8 @@ void omapdss_rfbi_set_data_lines(struct omap_dss_device *dssdev,
void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev,
struct rfbi_timings *timings);
+int omapdss_writeback_enable(struct omap_dss_output *wb);
+void omapdss_writeback_disable(struct omap_dss_output *wb);
void omapdss_writeback_set_input_size(struct omap_dss_output *wb, u16 w, u16 h);
int omapdss_writeback_apply(struct omap_dss_output *wb);
int omapdss_writeback_set_info(struct omap_dss_output *wb,
--
1.7.9.5
next prev parent reply other threads:[~2012-11-07 14:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-07 14:56 [RFC 00/11] OMAPDSS: Add writeback mem to mem mode support Archit Taneja
2012-11-07 14:56 ` [RFC 01/11] OMAPDSS: Add writeback output driver Archit Taneja
2012-11-07 14:56 ` [RFC 02/11] OMAPDSS: APPLY: Add get/set info functions for writeback Archit Taneja
2012-11-07 14:56 ` [RFC 03/11] OMAPDSS: APPLY: Apply writeback configurations Archit Taneja
2012-11-07 14:56 ` [RFC 04/11] OMAPDSS: writeback: Configure writeback input size Archit Taneja
2012-11-07 14:56 ` Archit Taneja [this message]
2012-11-07 14:56 ` [RFC 06/11] OMAPDSS: APPLY: configure channel_in for writeback Archit Taneja
2012-11-07 14:56 ` [RFC 07/11] OMAPDSS: writeback: add mechanism to do mem to mem updates Archit Taneja
2012-11-07 14:56 ` [RFC 08/11] OMAPDSS: APPLY: Check if overlay is connected in mem to mem mode Archit Taneja
2012-11-07 14:56 ` [RFC 09/11] OMAPDSS: FEATURES: Add writeback as supported outputs for OMAP4 managers Archit Taneja
2012-11-07 14:56 ` [RFC 10/11] ARCH: ARM: OMAP: Create a platform device for writeback Archit Taneja
2012-11-07 14:56 ` [RFC 11/11] Example: OMAPFB: clear framebuffers using writeback 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=1352299469-17609-6-git-send-email-archit@ti.com \
--to=archit@ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--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).