linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 10/29] OMAPDSS: APPLY: Calculate channel_in for writeback
Date: Tue, 27 Dec 2011 18:06:53 +0530	[thread overview]
Message-ID: <1324989432-3625-11-git-send-email-archit@ti.com> (raw)
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>

Add channel_in as a parameter in writeback's private data. This sets the
extra_info_dirty flag as this parameter is configured when we set/unset the
dummy writeback panel's manager unlike the other parameter which are
configured through set/unset_wb_info ops by the DSS2 user.

Add a helper function dss_mgr_set_writeback() which is called by the manager
set/unset_device ops to configure the channel_in parameter and set the
extra_info_dirty flags. It returns an error if we try to unset writeback when
it is enabled.

Add a dummy dispc_wb_set_channel_in() function. This will be filled up later.

Signed-off-by: Archit Taneja <archit@ti.com>
---
 drivers/video/omap2/dss/apply.c     |   59 +++++++++++++++++++++++++++++-----
 drivers/video/omap2/dss/dispc.c     |    5 +++
 drivers/video/omap2/dss/dss.h       |   12 +++++++
 drivers/video/omap2/dss/writeback.c |   15 +++++++++
 4 files changed, 82 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index aee0420..9f3c174 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -114,6 +114,8 @@ struct wb_priv_data {
 	bool extra_info_dirty;
 	bool shadow_extra_info_dirty;
 
+	enum dss_writeback_channel_in channel_in;
+
 	/* If true, GO bit is up and shadow registers cannot be written.
 	 * Never true for writeback in memory to memory mode */
 	bool busy;
@@ -137,6 +139,8 @@ static DEFINE_MUTEX(apply_lock);
 static DECLARE_COMPLETION(extra_updated_completion);
 
 static void dss_register_vsync_isr(void);
+static int dss_mgr_set_writeback(struct omap_overlay_manager *mgr,
+		struct omap_dss_writeback *wb, bool set);
 
 static struct ovl_priv_data *get_ovl_priv(struct omap_overlay *ovl)
 {
@@ -682,7 +686,7 @@ static void dss_wb_write_regs_extra(struct omap_dss_writeback *wb)
 	if (!wp->extra_info_dirty)
 		return;
 
-	/* Write extra registers here */
+	dispc_wb_set_channel_in(wb->id, wp->channel_in);
 
 	wp->extra_info_dirty = false;
 	wp->shadow_extra_info_dirty = true;
@@ -1282,6 +1286,7 @@ int dss_mgr_set_device(struct omap_overlay_manager *mgr,
 		struct omap_dss_device *dssdev)
 {
 	int r;
+	struct omap_dss_writeback *wb = dssdev->wbdev;
 
 	mutex_lock(&apply_lock);
 
@@ -1301,10 +1306,13 @@ int dss_mgr_set_device(struct omap_overlay_manager *mgr,
 
 	dssdev->manager = mgr;
 
-	if (dssdev->wbdev)
-		mgr->output->writeback = dssdev;
-	else
+	if (wb) {
+		r = dss_mgr_set_writeback(mgr, wb, true);
+		if (r)
+			goto err;
+	} else {
 		mgr->output->device = dssdev;
+	}
 
 	mutex_unlock(&apply_lock);
 
@@ -1319,11 +1327,11 @@ int dss_mgr_unset_device(struct omap_overlay_manager *mgr,
 {
 	int r;
 	struct omap_dss_device *curr_dssdev;
+	struct omap_dss_writeback *wb = dssdev->wbdev;
 
 	mutex_lock(&apply_lock);
 
-	curr_dssdev = dssdev->wbdev ? mgr->get_writeback(mgr) :
-			mgr->get_display(mgr);
+	curr_dssdev = wb ? mgr->get_writeback(mgr) : mgr->get_display(mgr);
 
 	if (!curr_dssdev) {
 		DSSERR("failed to unset device, device not set.\n");
@@ -1342,10 +1350,13 @@ int dss_mgr_unset_device(struct omap_overlay_manager *mgr,
 
 	curr_dssdev->manager = NULL;
 
-	if (dssdev->wbdev)
-		mgr->output->writeback = NULL;
-	else
+	if (wb) {
+		r = dss_mgr_set_writeback(mgr, wb, false);
+		if (r)
+			goto err;
+	} else {
 		mgr->output->device = NULL;
+	}
 
 	mutex_unlock(&apply_lock);
 
@@ -1593,6 +1604,36 @@ err:
 	return r;
 }
 
+static int dss_mgr_set_writeback(struct omap_overlay_manager *mgr,
+		struct omap_dss_writeback *wb, bool set)
+{
+	struct wb_priv_data *wp = get_wb_priv(wb);
+	unsigned long flags;
+
+	spin_lock_irqsave(&data_lock, flags);
+
+	if (set) {
+		wp->channel_in = dss_wb_calc_channel_in(wb);
+		wp->extra_info_dirty = true;
+		mgr->output->writeback = wb->dssdev;
+
+	} else {
+		if (wp->enabled) {
+			DSSERR("Failed to unset writeback%d from manager%d\n",
+				wb->id, mgr->id);
+			spin_unlock_irqrestore(&data_lock, flags);
+			return -EINVAL;
+		}
+
+		wp->channel_in = -1;
+		mgr->output->writeback = NULL;
+	}
+
+	spin_unlock_irqrestore(&data_lock, flags);
+
+	return 0;
+}
+
 int dss_wb_set_info(struct omap_dss_writeback *wb,
 		struct omap_dss_writeback_info *info)
 {
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 35ed6ca..a4d5504 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -899,6 +899,11 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane plane)
 	return channel;
 }
 
+void dispc_wb_set_channel_in(int id, enum dss_writeback_channel_in ch_in)
+{
+	return;
+}
+
 static void dispc_ovl_set_burst_size(enum omap_plane plane,
 		enum omap_burst_size burst_size)
 {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index b4b60fc..1b128f1 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -113,6 +113,16 @@ enum dss_dsi_content_type {
 	DSS_DSI_CONTENT_GENERIC,
 };
 
+enum dss_writeback_channel_in {
+	OMAP_DSS_WB_LCD1_MGR	= 0,
+	OMAP_DSS_WB_LCD2_MGR	= 1,
+	OMAP_DSS_WB_TV_MGR	= 2,
+	OMAP_DSS_WB_OVL0	= 3,
+	OMAP_DSS_WB_OVL1	= 4,
+	OMAP_DSS_WB_OVL2	= 5,
+	OMAP_DSS_WB_OVL3	= 6,
+};
+
 struct dss_clock_info {
 	/* rates that we get with dividers below */
 	unsigned long fck;
@@ -238,6 +248,7 @@ int dss_ovl_check(struct omap_overlay *ovl,
 void dss_init_writeback(void);
 void dss_uninit_writeback(void);
 int writeback_init_display(struct omap_dss_device *dssdev);
+enum dss_writeback_channel_in dss_wb_calc_channel_in(struct omap_dss_writeback *wb);
 int dss_wb_simple_check(struct omap_dss_writeback *wb,
 		const struct omap_dss_writeback_info *info);
 
@@ -483,6 +494,7 @@ 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);
+void dispc_wb_set_channel_in(int id, enum dss_writeback_channel_in ch_in);
 
 /* VENC */
 #ifdef CONFIG_OMAP2_DSS_VENC
diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c
index eefab4e..89738a4 100644
--- a/drivers/video/omap2/dss/writeback.c
+++ b/drivers/video/omap2/dss/writeback.c
@@ -122,6 +122,21 @@ int writeback_init_display(struct omap_dss_device *dssdev)
 	return 0;
 }
 
+enum dss_writeback_channel_in dss_wb_calc_channel_in(struct omap_dss_writeback *wb)
+{
+	struct omap_overlay_manager *mgr = wb->dssdev->manager;
+
+	switch (mgr->id) {
+	case OMAP_DSS_CHANNEL_LCD2:
+		return OMAP_DSS_WB_LCD2_MGR;
+	case OMAP_DSS_CHANNEL_DIGIT:
+		return OMAP_DSS_WB_TV_MGR;
+	case OMAP_DSS_CHANNEL_LCD:
+	default:
+		return OMAP_DSS_WB_LCD1_MGR;
+	}
+}
+
 int dss_wb_simple_check(struct omap_dss_writeback *wb,
 		const struct omap_dss_writeback_info *info)
 {
-- 
1.7.4.1


  parent reply	other threads:[~2011-12-27 12:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-27 12:36 [RFC PATCH 00/29] OMAPDSS: Initial Writeback Capture mode support Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 01/29] omapdss/omapfb/omap_vout: Introduce manager output struct Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 02/29] OMAPDSS: Add writeback to omap_dss_mgr_output Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 03/29] OMAPDSS: Writeback: Add writeback interface and panel driver Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 04/29] OMAPDSS: APPLY/Writeback: Add writeback_info Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 05/29] OMAPDSS: APPLY/Writeback: Apply writeback configurations Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 06/29] OMAPDSS: APPLY: Add writeback enable/disable functions Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 07/29] OMAPDSS: APPLY: Add extra_info for writeback Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 08/29] OMAPDSS: APPLY: Modify manager unset device op Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 09/29] OMAPDSS: APPLY: Allow manager set/unset_device ops to set/unset writeback Archit Taneja
2011-12-27 12:36 ` Archit Taneja [this message]
2011-12-27 12:36 ` [RFC PATCH 11/29] OMAPDSS: DISPC: Add writeback as a new plane Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 12/29] OMAPDSS: Writeback: Add check for color_mode in dss_wb_simple_check() Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 13/29] OMAPDSS: APPLY: Configure writeback FIFOs Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 14/29] OMAPDSS: DISPC: Allow both upscaling and downscaling of chroma Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 15/29] OMAPDSS: DISPC: Pass overlay caps as a parameter to DISPC overlay related functions Archit Taneja
2011-12-27 12:36 ` [RFC PATCH 16/29] OMAPDSS: OVERLAY: Add position and replication as overlay caps Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 17/29] OMAPDSS: DISPC: Make dispc_ovl_setup call dispc_plane_setup Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 18/29] OMAPDSS: DISPC: Make chroma_upscale an argument to dispc_plane_setup Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 19/29] OMAPDSS: DISPC: Don't set chroma resampling bit for writeback Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 20/29] OMAPDSS: Writeback: Add writeback capabilities Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 21/29] OMAPDSS: DISPC: Configure overlay-like parameters in dispc_wb_setup Archit Taneja
2012-08-02 10:10   ` Chandrabhanu Mahapatra
2011-12-27 12:37 ` [RFC PATCH 22/29] OMAPDSS: DISPC: Setup writeback go, enable and channel_in functions Archit Taneja
2012-08-02  9:55   ` Mahapatra, Chandrabhanu
2011-12-27 12:37 ` [RFC PATCH 23/29] OMAPDSS: Writeback: Configure writeback specific parameters Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 24/29] OMAPDSS: Writeback: Use panel driver ops to configure mirroring rotation and buffer size Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 25/29] OMAPDSS: Writeback: Add sysfs attributes to writeback panel Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 26/29] OMAPDSS: DISPLAY: Add a manager apply to sysfs store attributes for writeback Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 27/29] OMAPDSS: MANAGER: Split manager_display_store into smaller functions Archit Taneja
2011-12-27 12:37 ` [RFC PATCH 28/29] OMAPDSS: MANAGER: Add writeback as a sysfs attribute Archit Taneja
2011-12-27 12:37 ` [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-11-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).