Skip to contentSkip to conversation

OMAP: DSS2: Overlay Manager LCD2 support in DISPC

PATCH Superseded Archit Taneja 2 participants 16 messages Nov 22, 2010 – Dec 2, 2010

Subsystems (3)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover OMAP: DSS2: Overlay Manager LCD2 support in DISPC

This patch series which incorporates changes in DSS2 to enable omap_dss_device instances to use the new Overlay Manager LCD2 in DISPC.

On OMAP4, we have a new DISPC channel for Overlay Manager LCD2. This channel's video port is a source port for RFBI, DSI2 and DPI. The Primary channel's video port is connected to RFBI and DSI1.

There is a set of regsiters for LCD2 channel similar to the existing LCD channel, like DISPC_CONTROL2, DISPC_DIVISOR2, DISPC_CONFIG2 and so on.

In order to decide which LCD Overlay Manager to configure(LCD/LCD2), there is a need for the omap_dss_device instances to tell the interface drivers(DSI, DPI, RFBI etc) which LCD channel they want to connect to, so that the corresponding registers get configured. Therefore, a new enum omap_channel member is introduced to omap_dss_device.

This design was made keeping in mind the possible addition of more Overlay Managers in future OMAPs, this code is also backward compatible with OMAP3 as omap_dss_device instances in OMAP3 will stick only with OMAP_DSS_CHANNEL_LCD.

Archit Taneja (2):
OMAP: DSS2: Add dss_features for omap4 and overlay manager related
features
OMAP: DSS2: Use dss_features to handle DISPC bits removed on OMAP4

Sumit Semwal (5):
OMAP: DSS2: Represent DISPC register defines with channel as
parameter
OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter
OMAP: DSS2: Change remaining Dispc functions for new 'channel'
argument
OMAP: DSS2: LCD2 Channel Changes for DISPC
OMAP: DSS2: Add new Overlay Manager

 arch/arm/plat-omap/include/plat/display.h |    8 +
 drivers/video/omap2/dss/dispc.c           |  558 ++++++++++++++++++++---------
 drivers/video/omap2/dss/dpi.c             |   40 ++-
 drivers/video/omap2/dss/dsi.c             |   25 +-
 drivers/video/omap2/dss/dss.h             |   36 ++-
 drivers/video/omap2/dss/dss_features.c    |   43 +++-
 drivers/video/omap2/dss/dss_features.h    |    7 +-
 drivers/video/omap2/dss/manager.c         |   77 +++--
 drivers/video/omap2/dss/overlay.c         |   14 +-
 drivers/video/omap2/dss/rfbi.c            |   20 +-
 drivers/video/omap2/dss/sdi.c             |   24 +-
 11 files changed, 586 insertions(+), 266 deletions(-)

--
Version 5:
- Replaced dssdev->channel with dssdev->manager->id in interface driver calls, dssdev->channel is only used once in dss_recheck_connections() to set up the connection between panel device and dispc managers
- DISPC_CONTROL and DISPC_CONFIG registers are not defined with channel as a parameter.
Version 4:
- Broken into smaller patches in order to build in between patches.
- Some basic cleanup
Version 3:
- Patches are reworked over dss2 features framework. Number of patches are reduced.
Version 2:
- The DISPC_BASE macro now isn't changed for OMAP4, a future hwmod patch will take care of this dynamically.
- Supported_displays member of manager is now assigned correctly for OMAP2.
- DISPC Registers common to LCD and LCD2 channels are not defined separately, now there is a parameter which differentiates between the 2 channels.
- Secondary LCD manager is now named as lcd2 instead of 2lcd, the patch given in the link below allows DSS2 interpret this correctly. Version 1:
http://www.mail-archive.com/[email protected]/msg31458.html

#1 lore raw

PATCH v5 1/7 OMAP: DSS2: Add dss_features for omap4 and overlay manager related features

Add support for LCD2 manager through introducing a new has_feature, Initialize a dss_features struct for omap4.

---
 drivers/video/omap2/dss/dss_features.c |   43 ++++++++++++++++++++++++++++++-
 drivers/video/omap2/dss/dss_features.h |    7 ++++-
 2 files changed, 47 insertions(+), 3 deletions(-)
drivers/video/omap2/dss/dss_features.c +41 -2
index 854deba..8ab54ab 100644
@@ -82,6 +82,18 @@ static const enum omap_display_type omap3_dss_supported_displays[] = {
 	OMAP_DISPLAY_TYPE_VENC,
 };
 
+static const enum omap_display_type omap4_dss_supported_displays[] = {
+	/* OMAP_DSS_CHANNEL_LCD */
+	OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
+
+	/* OMAP_DSS_CHANNEL_DIGIT */
+	OMAP_DISPLAY_TYPE_VENC,
+
+	/* OMAP_DSS_CHANNEL_LCD2 */
+	OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
+	OMAP_DISPLAY_TYPE_DSI,
+};
+
 static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
 	/* OMAP_DSS_GFX */
 	OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
@@ -127,6 +139,10 @@ static struct omap_dss_features omap2_dss_features = {
 	.reg_fields = omap2_dss_reg_fields,
 	.num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
 
+	.has_feature	=
+		FEAT_LCDENABLEPOL | FEAT_LCDENABLESIGNAL |
+		FEAT_PCKFREEENABLE | FEAT_FUNCGATED,
+
 	.num_mgrs = 2,
 	.num_ovls = 3,
 	.supported_displays = omap2_dss_supported_displays,
@@ -138,7 +154,10 @@ static struct omap_dss_features omap3430_dss_features = {
 	.reg_fields = omap3_dss_reg_fields,
 	.num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
 
-	.has_feature	= FEAT_GLOBAL_ALPHA,
+	.has_feature	=
+		FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL |
+		FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE |
+		FEAT_FUNCGATED,
 
 	.num_mgrs = 2,
 	.num_ovls = 3,
@@ -150,7 +169,10 @@ static struct omap_dss_features omap3630_dss_features = {
 	.reg_fields = omap3_dss_reg_fields,
 	.num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
 
-	.has_feature    = FEAT_GLOBAL_ALPHA | FEAT_PRE_MULT_ALPHA,
+	.has_feature    =
+		FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL |
+		FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE |
+		FEAT_PRE_MULT_ALPHA | FEAT_FUNCGATED,
 
 	.num_mgrs = 2,
 	.num_ovls = 3,
@@ -158,6 +180,21 @@ static struct omap_dss_features omap3630_dss_features = {
 	.supported_color_modes = omap3_dss_supported_color_modes,
 };
 
+/* OMAP4 DSS Features */
+static struct omap_dss_features omap4_dss_features = {
+	.reg_fields = omap3_dss_reg_fields,
+	.num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
+
+	.has_feature	=
+		FEAT_GLOBAL_ALPHA | FEAT_PRE_MULT_ALPHA |
+		FEAT_MGR_LCD2,
+
+	.num_mgrs = 3,
+	.num_ovls = 3,
+	.supported_displays = omap4_dss_supported_displays,
+	.supported_color_modes = omap3_dss_supported_color_modes,
+};
+
 /* Functions returning values related to a DSS feature */
 int dss_feat_get_num_mgrs(void)
 {
@@ -202,4 +239,6 @@ void dss_features_init(void)
 		omap_current_dss_features = &omap3630_dss_features;
 	else if (cpu_is_omap34xx())
 		omap_current_dss_features = &omap3430_dss_features;
+	else
+		omap_current_dss_features = &omap4_dss_features;
 }
drivers/video/omap2/dss/dss_features.h +6 -1
index aeb2eea..161d378 100644
@@ -20,7 +20,7 @@
 #ifndef __OMAP2_DSS_FEATURES_H
 #define __OMAP2_DSS_FEATURES_H
 
-#define MAX_DSS_MANAGERS	2
+#define MAX_DSS_MANAGERS	3
 #define MAX_DSS_OVERLAYS	3
 
 /* DSS has feature id */
@@ -28,6 +28,11 @@ enum dss_feat_id {
 	FEAT_GLOBAL_ALPHA	= 1 << 0,
 	FEAT_GLOBAL_ALPHA_VID1	= 1 << 1,
 	FEAT_PRE_MULT_ALPHA	= 1 << 2,
+	FEAT_LCDENABLEPOL	= 1 << 3,
+	FEAT_LCDENABLESIGNAL	= 1 << 4,
+	FEAT_PCKFREEENABLE	= 1 << 5,
+	FEAT_FUNCGATED		= 1 << 6,
+	FEAT_MGR_LCD2		= 1 << 7,
 };
 
 /* DSS register field id */
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v5 2/7 OMAP: DSS2: Represent DISPC register defines with channel as parameter

In reply to Archit Taneja

From: Sumit Semwal <[email protected]>

Introduce new enum members for LCD2 Channel and corresponding Overlay Manager.

Represent some of the DISPC register defines with channel as a parameter to differentiate between LCD, DIGIT and LCD2 channels. Replace the existing reads/writes to these registers in this new way.

---
 arch/arm/plat-omap/include/plat/display.h |    2 +
 drivers/video/omap2/dss/dispc.c           |  170 ++++++++++++++---------------
 2 files changed, 84 insertions(+), 88 deletions(-)
arch/arm/plat-omap/include/plat/display.h +2 -0
index d433baf..586944d 100644
@@ -64,6 +64,7 @@ enum omap_plane {
 enum omap_channel {
 	OMAP_DSS_CHANNEL_LCD	= 0,
 	OMAP_DSS_CHANNEL_DIGIT	= 1,
+	OMAP_DSS_CHANNEL_LCD2	= 2,
 };
 
 enum omap_color_mode {
@@ -142,6 +143,7 @@ enum omap_dss_display_state {
 enum omap_dss_overlay_managers {
 	OMAP_DSS_OVL_MGR_LCD,
 	OMAP_DSS_OVL_MGR_TV,
+	OMAP_DSS_OVL_MGR_LCD2,
 };
 
 enum omap_dss_rotation_type {
drivers/video/omap2/dss/dispc.c +82 -88

338 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v5 3/7 OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

In reply to Archit Taneja

From: Sumit Semwal <[email protected]>

A new member 'channel' is introduced in omap_dss_device structure to determine which channel the panel uses. The dss_recheck_connections() called in dss_driver_probe() to set the correct manager to the corresponding omap_dss_device. The interface drivers (dsi.c, sdi.c etc) now call dispc functions with dssdev->manager->id as a parameter to specify the DISPC channel.

The following dispc functions are changed to incorporate channel as an argument:

	-dispc_enable_fifohandcheck()
	-dispc_set_lcd_size()
	-dispc_set_parallel_interface_mode()
	-dispc_set_tft_data_lines()
	-dispc_set_lcd_display_type()
	-dispc_set_lcd_timings()
---
 arch/arm/plat-omap/include/plat/display.h |    2 +
 drivers/video/omap2/dss/dispc.c           |   38 ++++++++++++++++------------
 drivers/video/omap2/dss/dpi.c             |   12 +++++----
 drivers/video/omap2/dss/dsi.c             |   14 ++++++----
 drivers/video/omap2/dss/dss.h             |   19 ++++++++------
 drivers/video/omap2/dss/rfbi.c            |   20 ++++++++-------
 drivers/video/omap2/dss/sdi.c             |   16 +++++++----
 7 files changed, 71 insertions(+), 50 deletions(-)
arch/arm/plat-omap/include/plat/display.h +2 -0
index 586944d..f184003 100644
@@ -354,6 +354,8 @@ struct omap_dss_device {
 
 	enum omap_display_type type;
 
+	enum omap_channel channel;
+
 	union {
 		struct {
 			u8 data_lines;
drivers/video/omap2/dss/dispc.c +22 -16
index ca072fe..d855da2 100644
@@ -941,13 +941,13 @@ void dispc_enable_replication(enum omap_plane plane, bool enable)
 	enable_clocks(0);
 }
 
-void dispc_set_lcd_size(u16 width, u16 height)
+void dispc_set_lcd_size(enum omap_channel channel, u16 width, u16 height)
 {
 	u32 val;
 	BUG_ON((width > (1 << 11)) || (height > (1 << 11)));
 	val = FLD_VAL(height - 1, 26, 16) | FLD_VAL(width - 1, 10, 0);
 	enable_clocks(1);
-	dispc_write_reg(DISPC_SIZE_LCD(OMAP_DSS_CHANNEL_LCD), val);
+	dispc_write_reg(DISPC_SIZE_LCD(channel), val);
 	enable_clocks(0);
 }
 
@@ -1886,7 +1886,7 @@ void dispc_pck_free_enable(bool enable)
 	enable_clocks(0);
 }
 
-void dispc_enable_fifohandcheck(bool enable)
+void dispc_enable_fifohandcheck(enum omap_channel channel, bool enable)
 {
 	enable_clocks(1);
 	REG_FLD_MOD(DISPC_CONFIG, enable ? 1 : 0, 16, 16);
@@ -1894,7 +1894,8 @@ void dispc_enable_fifohandcheck(bool enable)
 }
 
 
-void dispc_set_lcd_display_type(enum omap_lcd_display_type type)
+void dispc_set_lcd_display_type(enum omap_channel channel,
+		enum omap_lcd_display_type type)
 {
 	int mode;
 
@@ -2037,7 +2038,7 @@ bool dispc_trans_key_enabled(enum omap_channel ch)
 }
 
 
-void dispc_set_tft_data_lines(u8 data_lines)
+void dispc_set_tft_data_lines(enum omap_channel channel, u8 data_lines)
 {
 	int code;
 
@@ -2064,7 +2065,8 @@ void dispc_set_tft_data_lines(u8 data_lines)
 	enable_clocks(0);
 }
 
-void dispc_set_parallel_interface_mode(enum omap_parallel_interface_mode mode)
+void dispc_set_parallel_interface_mode(enum omap_channel channel,
+		enum omap_parallel_interface_mode mode)
 {
 	u32 l;
 	int stallmode;
@@ -2097,9 +2099,11 @@ void dispc_set_parallel_interface_mode(enum omap_parallel_interface_mode mode)
 	l = dispc_read_reg(DISPC_CONTROL);
 
 	l = FLD_MOD(l, stallmode, 11, 11);
-	l = FLD_MOD(l, gpout0, 15, 15);
-	l = FLD_MOD(l, gpout1, 16, 16);
 
+	if (channel == OMAP_DSS_CHANNEL_LCD) {
+		l = FLD_MOD(l, gpout0, 15, 15);
+		l = FLD_MOD(l, gpout1, 16, 16);
+	}
 	dispc_write_reg(DISPC_CONTROL, l);
 
 	enable_clocks(0);
@@ -2136,8 +2140,8 @@ bool dispc_lcd_timings_ok(struct omap_video_timings *timings)
 			timings->vfp, timings->vbp);
 }
 
-static void _dispc_set_lcd_timings(int hsw, int hfp, int hbp,
-				   int vsw, int vfp, int vbp)
+static void _dispc_set_lcd_timings(enum omap_channel channel, int hsw,
+		int hfp, int hbp, int vsw, int vfp, int vbp)
 {
 	u32 timing_h, timing_v;
 
@@ -2156,13 +2160,14 @@ static void _dispc_set_lcd_timings(int hsw, int hfp, int hbp,
 	}
 
 	enable_clocks(1);
-	dispc_write_reg(DISPC_TIMING_H(OMAP_DSS_CHANNEL_LCD), timing_h);
-	dispc_write_reg(DISPC_TIMING_V(OMAP_DSS_CHANNEL_LCD), timing_v);
+	dispc_write_reg(DISPC_TIMING_H(channel), timing_h);
+	dispc_write_reg(DISPC_TIMING_V(channel), timing_v);
 	enable_clocks(0);
 }
 
 /* change name to mode? */
-void dispc_set_lcd_timings(struct omap_video_timings *timings)
+void dispc_set_lcd_timings(enum omap_channel channel,
+		struct omap_video_timings *timings)
 {
 	unsigned xtot, ytot;
 	unsigned long ht, vt;
@@ -2172,10 +2177,11 @@ void dispc_set_lcd_timings(struct omap_video_timings *timings)
 				timings->vfp, timings->vbp))
 		BUG();
 
-	_dispc_set_lcd_timings(timings->hsw, timings->hfp, timings->hbp,
-			timings->vsw, timings->vfp, timings->vbp);
+	_dispc_set_lcd_timings(channel, timings->hsw, timings->hfp,
+			timings->hbp, timings->vsw, timings->vfp,
+			timings->vbp);
 
-	dispc_set_lcd_size(timings->x_res, timings->y_res);
+	dispc_set_lcd_size(channel, timings->x_res, timings->y_res);
 
 	xtot = timings->x_res + timings->hfp + timings->hsw + timings->hbp;
 	ytot = timings->y_res + timings->vfp + timings->vsw + timings->vbp;
drivers/video/omap2/dss/dpi.c +7 -5
index 960e977..08b497f 100644
@@ -132,7 +132,7 @@ static int dpi_set_mode(struct omap_dss_device *dssdev)
 		t->pixel_clock = pck;
 	}
 
-	dispc_set_lcd_timings(t);
+	dispc_set_lcd_timings(dssdev->manager->id, t);
 
 err0:
 	dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
@@ -145,10 +145,12 @@ static int dpi_basic_init(struct omap_dss_device *dssdev)
 
 	is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0;
 
-	dispc_set_parallel_interface_mode(OMAP_DSS_PARALLELMODE_BYPASS);
-	dispc_set_lcd_display_type(is_tft ? OMAP_DSS_LCD_DISPLAY_TFT :
-			OMAP_DSS_LCD_DISPLAY_STN);
-	dispc_set_tft_data_lines(dssdev->phy.dpi.data_lines);
+	dispc_set_parallel_interface_mode(dssdev->manager->id,
+			OMAP_DSS_PARALLELMODE_BYPASS);
+	dispc_set_lcd_display_type(dssdev->manager->id, is_tft ?
+			OMAP_DSS_LCD_DISPLAY_TFT : OMAP_DSS_LCD_DISPLAY_STN);
+	dispc_set_tft_data_lines(dssdev->manager->id,
+			dssdev->phy.dpi.data_lines);
 
 	return 0;
 }
drivers/video/omap2/dss/dsi.c +8 -6
index aa4f7a5..acd36ca 100644
@@ -2888,7 +2888,7 @@ int omap_dsi_prepare_update(struct omap_dss_device *dssdev,
 	if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) {
 		dss_setup_partial_planes(dssdev, x, y, w, h,
 				enlarge_update_area);
-		dispc_set_lcd_size(*w, *h);
+		dispc_set_lcd_size(dssdev->manager->id, *w, *h);
 	}
 
 	return 0;
@@ -2947,12 +2947,14 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
 		return r;
 	}
 
-	dispc_set_lcd_display_type(OMAP_DSS_LCD_DISPLAY_TFT);
+	dispc_set_lcd_display_type(dssdev->manager->id,
+			OMAP_DSS_LCD_DISPLAY_TFT);
 
-	dispc_set_parallel_interface_mode(OMAP_DSS_PARALLELMODE_DSI);
-	dispc_enable_fifohandcheck(1);
+	dispc_set_parallel_interface_mode(dssdev->manager->id,
+			OMAP_DSS_PARALLELMODE_DSI);
+	dispc_enable_fifohandcheck(dssdev->manager->id, 1);
 
-	dispc_set_tft_data_lines(dssdev->ctrl.pixel_size);
+	dispc_set_tft_data_lines(dssdev->manager->id, dssdev->ctrl.pixel_size);
 
 	{
 		struct omap_video_timings timings = {
@@ -2964,7 +2966,7 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
 			.vbp		= 0,
 		};
 
-		dispc_set_lcd_timings(&timings);
+		dispc_set_lcd_timings(dssdev->manager->id, &timings);
 	}
 
 	return 0;
drivers/video/omap2/dss/dss.h +11 -8
index 2bb515c..7dee4c3 100644
@@ -333,9 +333,9 @@ void dispc_disable_sidle(void);
 void dispc_lcd_enable_signal_polarity(bool act_high);
 void dispc_lcd_enable_signal(bool enable);
 void dispc_pck_free_enable(bool enable);
-void dispc_enable_fifohandcheck(bool enable);
+void dispc_enable_fifohandcheck(enum omap_channel channel, bool enable);
 
-void dispc_set_lcd_size(u16 width, u16 height);
+void dispc_set_lcd_size(enum omap_channel channel, u16 width, u16 height);
 void dispc_set_digit_size(u16 width, u16 height);
 u32 dispc_get_plane_fifo_size(enum omap_plane plane);
 void dispc_setup_plane_fifo(enum omap_plane plane, u32 low, u32 high);
@@ -369,9 +369,11 @@ bool dispc_is_channel_enabled(enum omap_channel channel);
 int dispc_enable_plane(enum omap_plane plane, bool enable);
 void dispc_enable_replication(enum omap_plane plane, bool enable);
 
-void dispc_set_parallel_interface_mode(enum omap_parallel_interface_mode mode);
-void dispc_set_tft_data_lines(u8 data_lines);
-void dispc_set_lcd_display_type(enum omap_lcd_display_type type);
+void dispc_set_parallel_interface_mode(enum omap_channel channel,
+		enum omap_parallel_interface_mode mode);
+void dispc_set_tft_data_lines(enum omap_channel channel, u8 data_lines);
+void dispc_set_lcd_display_type(enum omap_channel channel,
+		enum omap_lcd_display_type type);
 void dispc_set_loadmode(enum omap_dss_load_mode mode);
 
 void dispc_set_default_color(enum omap_channel channel, u32 color);
@@ -388,7 +390,8 @@ bool dispc_trans_key_enabled(enum omap_channel ch);
 bool dispc_alpha_blending_enabled(enum omap_channel ch);
 
 bool dispc_lcd_timings_ok(struct omap_video_timings *timings);
-void dispc_set_lcd_timings(struct omap_video_timings *timings);
+void dispc_set_lcd_timings(enum omap_channel channel,
+		struct omap_video_timings *timings);
 unsigned long dispc_fclk_rate(void);
 unsigned long dispc_lclk_rate(void);
 unsigned long dispc_pclk_rate(void);
@@ -425,8 +428,8 @@ void rfbi_dump_regs(struct seq_file *s);
 
 int rfbi_configure(int rfbi_module, int bpp, int lines);
 void rfbi_enable_rfbi(bool enable);
-void rfbi_transfer_area(u16 width, u16 height,
-			     void (callback)(void *data), void *data);
+void rfbi_transfer_area(omap_dss_device *dssdev, u16 width,
+		u16 height, void (callback)(void *data), void *data);
 void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t);
 unsigned long rfbi_get_max_tx_rate(void);
 int rfbi_init_display(struct omap_dss_device *display);
drivers/video/omap2/dss/rfbi.c +11 -9
index bbe6246..c20a185 100644
@@ -301,8 +301,8 @@ void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
 }
 EXPORT_SYMBOL(omap_rfbi_write_pixels);
 
-void rfbi_transfer_area(u16 width, u16 height,
-			     void (callback)(void *data), void *data)
+void rfbi_transfer_area(omap_dss_device *dssdev, u16 width,
+		u16 height, void (*callback)(void *data), void *data)
 {
 	u32 l;
 
@@ -311,9 +311,9 @@ void rfbi_transfer_area(u16 width, u16 height,
 
 	DSSDBG("rfbi_transfer_area %dx%d\n", width, height);
 
-	dispc_set_lcd_size(width, height);
+	dispc_set_lcd_size(dssdev->manager->id, width, height);
 
-	dispc_enable_channel(OMAP_DSS_CHANNEL_LCD, true);
+	dispc_enable_channel(dssdev->manager->id, true);
 
 	rfbi.framedone_callback = callback;
 	rfbi.framedone_callback_data = data;
@@ -887,7 +887,7 @@ int omap_rfbi_prepare_update(struct omap_dss_device *dssdev,
 
 	if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) {
 		dss_setup_partial_planes(dssdev, x, y, w, h, true);
-		dispc_set_lcd_size(*w, *h);
+		dispc_set_lcd_size(dssdev->manager->id, *w, *h);
 	}
 
 	return 0;
@@ -899,7 +899,7 @@ int omap_rfbi_update(struct omap_dss_device *dssdev,
 		void (*callback)(void *), void *data)
 {
 	if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) {
-		rfbi_transfer_area(w, h, callback, data);
+		rfbi_transfer_area(dssdev, w, h, callback, data);
 	} else {
 		struct omap_overlay *ovl;
 		void __iomem *addr;
@@ -1018,11 +1018,13 @@ int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev)
 		goto err1;
 	}
 
-	dispc_set_lcd_display_type(OMAP_DSS_LCD_DISPLAY_TFT);
+	dispc_set_lcd_display_type(dssdev->manager->id,
+			OMAP_DSS_LCD_DISPLAY_TFT);
 
-	dispc_set_parallel_interface_mode(OMAP_DSS_PARALLELMODE_RFBI);
+	dispc_set_parallel_interface_mode(dssdev->manager->id,
+			OMAP_DSS_PARALLELMODE_RFBI);
 
-	dispc_set_tft_data_lines(dssdev->ctrl.pixel_size);
+	dispc_set_tft_data_lines(dssdev->manager->id, dssdev->ctrl.pixel_size);
 
 	rfbi_configure(dssdev->phy.rfbi.channel,
 			       dssdev->ctrl.pixel_size,
drivers/video/omap2/dss/sdi.c +10 -6
index ee07a3c..19443b1 100644
@@ -35,12 +35,16 @@ static struct {
 	struct regulator *vdds_sdi_reg;
 } sdi;
 
-static void sdi_basic_init(void)
+static void sdi_basic_init(struct omap_dss_device *dssdev)
+
 {
-	dispc_set_parallel_interface_mode(OMAP_DSS_PARALLELMODE_BYPASS);
+	dispc_set_parallel_interface_mode(dssdev->manager->id,
+			OMAP_DSS_PARALLELMODE_BYPASS);
+
+	dispc_set_lcd_display_type(dssdev->manager->id,
+			OMAP_DSS_LCD_DISPLAY_TFT);
 
-	dispc_set_lcd_display_type(OMAP_DSS_LCD_DISPLAY_TFT);
-	dispc_set_tft_data_lines(24);
+	dispc_set_tft_data_lines(dssdev->manager->id, 24);
 	dispc_lcd_enable_signal_polarity(1);
 }
 
@@ -68,7 +72,7 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
 	if (!sdi.skip_init)
 		dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
 
-	sdi_basic_init();
+	sdi_basic_init(dssdev);
 
 	/* 15.5.9.1.2 */
 	dssdev->panel.config |= OMAP_DSS_LCD_RF | OMAP_DSS_LCD_ONOFF;
@@ -102,7 +106,7 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
 	}
 
 
-	dispc_set_lcd_timings(t);
+	dispc_set_lcd_timings(dssdev->manager->id, t);
 
 	r = dss_set_clock_div(&dss_cinfo);
 	if (r)
Signature · 1 line
1.7.0.4
#4 lore raw

Re: [PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

Hi,

Quoted 8 lines · ext Archit Taneja

From: Sumit Semwal <[email protected]>

A new member 'channel' is introduced in omap_dss_device structure to determine which channel the panel uses. The dss_recheck_connections() called in dss_driver_probe() to set the correct manager to the corresponding omap_dss_device. The interface drivers (dsi.c, sdi.c etc) now call dispc functions with dssdev->manager->id as a parameter to specify the DISPC channel.

Quoted 7 lines

The following dispc functions are changed to incorporate channel as an argument:

	-dispc_enable_fifohandcheck()
	-dispc_set_lcd_size()
	-dispc_set_parallel_interface_mode()
	-dispc_set_tft_data_lines()
	-dispc_set_lcd_display_type()
	-dispc_set_lcd_timings()

This patch combines two separate things: 1) the new channel-field + related changes (dss_recheck_connections), and 2) converting dispc functions to accept channel as a parameter.

Generally about the whole patch set, I think this is starting to look ok. But two things, which are cosmetical:

- I wouldn't mind a bit more verbose commit descriptions. Of course it's easy to say "write better descriptions", and I don't have any direct advice for this. However, remember that the 0000-patch won't be in the git log, so all important information should be available also from the patch descriptions.

- The files are getting quite crowded with code that checks for the channel and then do the work with bits/irqs depending on the channel. This makes the code a bit difficult to read. I don't have any clear ideas right now how to make it clearer, but some methods to generalize these kinds of functions would be nice. But this is not so important for the time being, and we can improve it later.

Tomi

#5 lore raw

RE: [PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

Hi,

Quoted 25 lines · Tomi Valkeinen

Hi,

Quoted 7 lines · ext Archit Taneja

From: Sumit Semwal <[email protected]>

A new member 'channel' is introduced in omap_dss_device structure to determine which channel the panel uses. The dss_recheck_connections() called in dss_driver_probe() to set the correct manager to the corresponding omap_dss_device. The interface drivers (dsi.c, sdi.c etc) now call dispc functions with dssdev->manager->id as a

parameter to specify the DISPC channel.

Quoted 9 lines

The following dispc functions are changed to incorporate channel as an argument:

	-dispc_enable_fifohandcheck()
	-dispc_set_lcd_size()
	-dispc_set_parallel_interface_mode()
	-dispc_set_tft_data_lines()
	-dispc_set_lcd_display_type()
	-dispc_set_lcd_timings()

This patch combines two separate things: 1) the new channel-field + related changes (dss_recheck_connections), and 2) converting dispc functions to accept channel as a parameter.

Quoted 8 lines

Generally about the whole patch set, I think this is starting to look ok. But two things, which are cosmetical:

- I wouldn't mind a bit more verbose commit descriptions. Of course it's easy to say "write better descriptions", and I don't have any direct advice for this. However, remember that the 0000-patch won't be in the git log, so all important information should be available also from the patch descriptions.

I will update the comments.

Quoted 8 lines

- The files are getting quite crowded with code that checks
for the channel and then do the work with bits/irqs depending
on the channel.
This makes the code a bit difficult to read. I don't have any clear ideas right now how to make it clearer, but some
methods to generalize these kinds of functions would be nice.
But this is not so important for the time being, and we can improve it later.

I am assuming that you are referring to 'DISPC_IRQ_MASK_ERROR' and the registering/unregistering of irq masks in manager.c

I guess we could have a dss_features function which could return the mask based on what omap it is. But this way the mask values/contents would be totally invisble in manager.c and dispc.c, one would need to check it in dss_features.c, which also isn't readable.

One thing which I would like to add is that this series doesn't need to touch any board file for now. The present dss_recheck_connections() doesn't try to differentiate between LCD and DIGIT channels, it just uses 'omap_display_type' to differentiate between them. Only a panel which needs to connect to LCD2 has to do this, This method wouldn't have worked if we didn't switch to uniform use of dssdev->manager->id instead of dssdev->channel. We will need to change dss_recheck_connections() in the future to make it more uniform.

Regards,
Archit

#6 lore raw

RE: [PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

Quoted 14 lines · Archit

Hi,

Quoted 10 lines · Tomi Valkeinen

Hi,

- The files are getting quite crowded with code that checks
for the channel and then do the work with bits/irqs depending
on the channel.
This makes the code a bit difficult to read. I don't have any clear ideas right now how to make it clearer, but some
methods to generalize these kinds of functions would be nice.
But this is not so important for the time being, and we can improve it later.

Quoted 2 lines

I am assuming that you are referring to 'DISPC_IRQ_MASK_ERROR' and the registering/unregistering of irq masks in manager.c

Not only the irqs, but also, for example, code like this:

        if (channel == OMAP_DSS_CHANNEL_LCD ||
                        channel == OMAP_DSS_CHANNEL_LCD2)
                bit = 5; /* GOLCD */
        else
                bit = 6; /* GODIGIT */

        if (channel == OMAP_DSS_CHANNEL_LCD2)
                return REG_GET(DISPC_CONTROL2, bit, bit) == 1;
        else
                return REG_GET(DISPC_CONTROL, bit, bit) == 1;

So lots of the functions contain ifs based on the channel. I don't know right now what would be the best way to make the code cleaner (probably some kinds of look-up tables, but they incur some overhead), and as I said, it's cosmetical and can be cleaned up later (presuming we come up with a good way).

Quoted 3 lines

I guess we could have a dss_features function which could return the mask based on what omap it is. But this way the mask values/contents would be totally invisble in manager.c and dispc.c, one would need to check it in dss_features.c, which also isn't readable.

Right. I agree that that solution isn't perhaps the best one either.

Quoted 5 lines

One thing which I would like to add is that this series doesn't need to touch any board file for now. The present dss_recheck_connections() doesn't try to differentiate between LCD and DIGIT channels, it just uses 'omap_display_type' to differentiate between them. Only a panel which needs to connect to LCD2 has to do this, This method wouldn't have worked if we didn't switch to uniform use of dssdev->manager->id instead of dssdev->channel. We will need to change dss_recheck_connections() in the future to make it more uniform.

Ok.

If you can split this patch into the two parts I suggested (if that's ok for you, you didn't comment on that one), and check if there's anything to add to the commit descriptions, I think we can go and apply this patch set.

Btw, on what platforms have you tested this (or generally any patches you send?). I only have 3430SDP currently that I can easily use to test, so my testing is a bit limited.

Tomi

#7 lore raw

RE: [PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

Hi,

[snip]

Quoted 6 lines
Quoted 2 lines

I am assuming that you are referring to 'DISPC_IRQ_MASK_ERROR' and the registering/unregistering of irq masks in manager.c

Not only the irqs, but also, for example, code like this:

Quoted 10 lines
        if (channel == OMAP_DSS_CHANNEL_LCD ||
                        channel == OMAP_DSS_CHANNEL_LCD2)
                bit = 5; /* GOLCD */
        else
                bit = 6; /* GODIGIT */

        if (channel == OMAP_DSS_CHANNEL_LCD2)
                return REG_GET(DISPC_CONTROL2, bit, bit) == 1;         else
                return REG_GET(DISPC_CONTROL, bit, bit) == 1;

Things would be bad only for DISPC_CONTROL and DISPC_CONFIG since we couldn't parametrize them based on channel. Others look scalable, I don't know if there will be more such registers on OMAP5, but we can ask HW Team to keep them specific to the channel.

Quoted 21 lines

So lots of the functions contain ifs based on the channel. I don't know right now what would be the best way to make the code cleaner (probably some kinds of look-up tables, but they incur some overhead), and as I said, it's cosmetical and can be cleaned up later (presuming we come up with a good way).

Quoted 3 lines

I guess we could have a dss_features function which could return the mask based on what omap it is. But this way the mask values/contents would be totally invisble in manager.c and dispc.c, one

would need to check it in dss_features.c, which also isn't readable.

Right. I agree that that solution isn't perhaps the best one either.

Quoted 1 line

One thing which I would like to add is that this series

doesn't need to touch any board file for now.

Quoted 6 lines

The present dss_recheck_connections() doesn't try to differentiate between LCD and DIGIT channels, it just uses 'omap_display_type' to differentiate between them. Only a panel which needs to connect to LCD2 has to do this, This method wouldn't have worked if we didn't switch to uniform use of dssdev->manager->id instead of dssdev->channel. We will need to change

Quoted 8 lines

dss_recheck_connections() in the future to make it more uniform.

Ok.

If you can split this patch into the two parts I suggested (if that's ok for you, you didn't comment on that one), and check if there's anything to add to the commit descriptions, I think we can go and apply this patch set.

If I split this into 2 parts, the first patch will be just a line addition in display.h, I was beaten up by the community because of this in the previous version. One line patches in a series aren't taken very kindly :|. What I can do is clearly mention the 2 sets of things which this commit does, if you think that is good enough.

Quoted 5 lines

Btw, on what platforms have you tested this (or generally any patches you send?). I only have 3430SDP currently that I can easily use to test, so my testing is a bit limited.

This one I had tested throughly on 3430SDP, bootup on zoom2 and zoom3. I couldn't test on omap2, we have a n800 board but we don't know what panel driver we need to use, board-n8x0.c doesn't tell anything about. If you can tell me what panel driver to use etc I can try out.

Archit

#8 lore raw

RE: [PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

Quoted 7 lines · Archit

Hi,

Quoted 4 lines

If you can split this patch into the two parts I suggested (if that's ok for you, you didn't comment on that one), and check if there's anything to add to the commit descriptions, I think we can go and apply this patch set.

Quoted 5 lines

If I split this into 2 parts, the first patch will be just a line addition in display.h, I was beaten up by the community because of this in the previous version. One line patches in a series aren't taken very kindly :|. What I can do is clearly mention the 2 sets of things which this commit does, if you think that is good enough.

Ah, hmm... I thought this patch also changed dss_recheck_connections() to use the new field, but now that I look at it, it doesn't. Why do you add the new channel-member here, if it's not used? Shouldn't it be added later, together with dss_recheck_connections()?

Quoted 9 lines
Quoted 4 lines

Btw, on what platforms have you tested this (or generally any patches you send?). I only have 3430SDP currently that I can easily use to test, so my testing is a bit limited.

This one I had tested throughly on 3430SDP, bootup on zoom2 and zoom3. I couldn't test on omap2, we have a n800 board but we don't know what panel driver we need to use, board-n8x0.c doesn't tell anything about. If you can tell me what panel driver to use etc I can try out.

Unfortunately the panel driver for N800 has not been ported to DSS2.

Tomi

#9 lore raw

RE: [PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

Hi,

Quoted 14 lines · Tomi Valkeinen
Quoted 7 lines · Archit

Hi,

Quoted 4 lines

If you can split this patch into the two parts I suggested (if that's ok for you, you didn't comment on that one), and check if there's anything to add to the commit descriptions, I think we can go and apply this patch set.

Quoted 5 lines

If I split this into 2 parts, the first patch will be just a line addition in display.h, I was beaten up by the community because of this in the previous version. One line patches in a series aren't taken very kindly :|. What I can do is clearly mention the 2 sets of things which this commit does, if you think that is good enough.

Quoted 5 lines

Ah, hmm... I thought this patch also changed dss_recheck_connections() to use the new field, but now that I look at it, it doesn't. Why do you add the new channel-member here, if it's not used? Shouldn't it be added later, together with dss_recheck_connections()?

Yes, that makes more sense now, I had to introduce it early because I used to call dssdev->channel and not dssdev->manager->id before.

The new version can have it with the dss_recheck_connections() change

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Btw, on what platforms have you tested this (or generally any patches you send?). I only have 3430SDP currently that I can easily use to test, so my testing is a bit limited.

Quoted 6 lines
Quoted 4 lines

This one I had tested throughly on 3430SDP, bootup on zoom2 and zoom3. I couldn't test on omap2, we have a n800 board but we don't know what panel driver we need to use, board-n8x0.c doesn't tell anything about. If you can tell me what panel driver to use etc I can try out.

Unfortunately the panel driver for N800 has not been ported to DSS2.

I can possibly try with a 2430sdp, but I don't see the "omapdss" platform_device board-2430dsp.c. Are you aware of any omap2 setup which I can use to test?

Archit

#10 lore raw

RE: [PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

Quoted 6 lines · Archit

Hi,

Quoted 1 line

Unfortunately the panel driver for N800 has not been ported to DSS2.

I can possibly try with a 2430sdp, but I don't see the "omapdss" platform_device board-2430dsp.c. Are you aware of any omap2 setup which I can use to test?

Hmm, I guess no OMAP2 board has been ported to use DSS2. I have 2430SDP, but unfortunately it's been broken for long time now.

I believe 2430SDP would be easy to port, but as it's been quite a while since I ran DSS2 on OMAP2, it may well be that there are some DSS bugs with OMAP2.

If you want, you can try to get 2430sdp running, and at some point it would be very good to have at least one OMAP2 board with DSS2 running. But perhaps it's not so important right now.

Tomi

Ps. I'll be on vacation tomorrow and next week.

#11 lore raw

RE: [PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter

Hi,

Quoted 12 lines · Tomi Valkeinen
Quoted 7 lines · Archit

Hi,

Quoted 1 line

Unfortunately the panel driver for N800 has not been ported to DSS2.

I can possibly try with a 2430sdp, but I don't see the "omapdss" platform_device board-2430dsp.c. Are you aware of any omap2 setup which I can use to test?

Hmm, I guess no OMAP2 board has been ported to use DSS2. I have 2430SDP, but unfortunately it's been broken for long time now.

Quoted 8 lines

I believe 2430SDP would be easy to port, but as it's been quite a while since I ran DSS2 on OMAP2, it may well be that there are some DSS bugs with OMAP2.

If you want, you can try to get 2430sdp running, and at some point it would be very good to have at least one OMAP2 board with DSS2 running.
But perhaps it's not so important right now.

Okay, so I'll push a new patch set with your suggestions soon.

Regards,
Archit

Quoted 4 lines

Tomi

Ps. I'll be on vacation tomorrow and next week.

#12 lore raw

PATCH v5 4/7 OMAP: DSS2: Change remaining Dispc functions for new 'channel' argument

In reply to Archit Taneja

From: Sumit Semwal <[email protected]>

The following dispc functions are changed to incorporate channel as an argument:

	-dispc_lclk_rate()
	-dispc_pclk_rate()
	-dispc_set_pol_freq()
	-dispc_set_clock_div()
	-dispc_get_clock_div()
---
 drivers/video/omap2/dss/dispc.c |   62 ++++++++++++++++++++++-----------------
 drivers/video/omap2/dss/dpi.c   |   26 +++++++++-------
 drivers/video/omap2/dss/dsi.c   |   11 ++++---
 drivers/video/omap2/dss/dss.h   |   13 +++++---
 drivers/video/omap2/dss/sdi.c   |    8 ++--
 5 files changed, 67 insertions(+), 53 deletions(-)
drivers/video/omap2/dss/dispc.c +35 -27
index d855da2..82499e6 100644
@@ -1444,12 +1444,13 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror,
 	}
 }
 
-static unsigned long calc_fclk_five_taps(u16 width, u16 height,
-		u16 out_width, u16 out_height, enum omap_color_mode color_mode)
+static unsigned long calc_fclk_five_taps(enum omap_channel channel, u16 width,
+		u16 height, u16 out_width, u16 out_height,
+		enum omap_color_mode color_mode)
 {
 	u32 fclk = 0;
 	/* FIXME venc pclk? */
-	u64 tmp, pclk = dispc_pclk_rate();
+	u64 tmp, pclk = dispc_pclk_rate(channel);
 
 	if (height > out_height) {
 		/* FIXME get real display PPL */
@@ -1481,8 +1482,8 @@ static unsigned long calc_fclk_five_taps(u16 width, u16 height,
 	return fclk;
 }
 
-static unsigned long calc_fclk(u16 width, u16 height,
-		u16 out_width, u16 out_height)
+static unsigned long calc_fclk(enum omap_channel channel, u16 width,
+		u16 height, u16 out_width, u16 out_height)
 {
 	unsigned int hf, vf;
 
@@ -1506,7 +1507,7 @@ static unsigned long calc_fclk(u16 width, u16 height,
 		vf = 1;
 
 	/* FIXME venc pclk? */
-	return dispc_pclk_rate() * vf * hf;
+	return dispc_pclk_rate(channel) * vf * hf;
 }
 
 void dispc_set_channel_out(enum omap_plane plane, enum omap_channel channel_out)
@@ -1625,7 +1626,7 @@ static int _dispc_setup_plane(enum omap_plane plane,
 		five_taps = height > out_height * 2;
 
 		if (!five_taps) {
-			fclk = calc_fclk(width, height,
+			fclk = calc_fclk(OMAP_DSS_CHANNEL_LCD, width, height,
 					out_width, out_height);
 
 			/* Try 5-tap filter if 3-tap fclk is too high */
@@ -1640,8 +1641,9 @@ static int _dispc_setup_plane(enum omap_plane plane,
 		}
 
 		if (five_taps)
-			fclk = calc_fclk_five_taps(width, height,
-					out_width, out_height, color_mode);
+			fclk = calc_fclk_five_taps(OMAP_DSS_CHANNEL_LCD, width,
+					height, out_width, out_height,
+					color_mode);
 
 		DSSDBG("required fclk rate = %lu Hz\n", fclk);
 		DSSDBG("current fclk rate = %lu Hz\n", dispc_fclk_rate());
@@ -2198,13 +2200,14 @@ void dispc_set_lcd_timings(enum omap_channel channel,
 	DSSDBG("hsync %luHz, vsync %luHz\n", ht, vt);
 }
 
-static void dispc_set_lcd_divisor(u16 lck_div, u16 pck_div)
+static void dispc_set_lcd_divisor(enum omap_channel channel, u16 lck_div,
+		u16 pck_div)
 {
 	BUG_ON(lck_div < 1);
 	BUG_ON(pck_div < 2);
 
 	enable_clocks(1);
-	dispc_write_reg(DISPC_DIVISOR(OMAP_DSS_CHANNEL_LCD),
+	dispc_write_reg(DISPC_DIVISOR(channel),
 			FLD_VAL(lck_div, 23, 16) | FLD_VAL(pck_div, 7, 0));
 	enable_clocks(0);
 }
@@ -2232,13 +2235,13 @@ unsigned long dispc_fclk_rate(void)
 	return r;
 }
 
-unsigned long dispc_lclk_rate(void)
+unsigned long dispc_lclk_rate(enum omap_channel channel)
 {
 	int lcd;
 	unsigned long r;
 	u32 l;
 
-	l = dispc_read_reg(DISPC_DIVISOR(OMAP_DSS_CHANNEL_LCD));
+	l = dispc_read_reg(DISPC_DIVISOR(channel));
 
 	lcd = FLD_GET(l, 23, 16);
 
@@ -2247,13 +2250,13 @@ unsigned long dispc_lclk_rate(void)
 	return r / lcd;
 }
 
-unsigned long dispc_pclk_rate(void)
+unsigned long dispc_pclk_rate(enum omap_channel channel)
 {
 	int lcd, pcd;
 	unsigned long r;
 	u32 l;
 
-	l = dispc_read_reg(DISPC_DIVISOR(OMAP_DSS_CHANNEL_LCD));
+	l = dispc_read_reg(DISPC_DIVISOR(channel));
 
 	lcd = FLD_GET(l, 23, 16);
 	pcd = FLD_GET(l, 7, 0);
@@ -2278,8 +2281,10 @@ void dispc_dump_clocks(struct seq_file *s)
 			"dss1_alwon_fclk" : "dsi1_pll_fclk");
 
 	seq_printf(s, "fck\t\t%-16lu\n", dispc_fclk_rate());
-	seq_printf(s, "lck\t\t%-16lulck div\t%u\n", dispc_lclk_rate(), lcd);
-	seq_printf(s, "pck\t\t%-16lupck div\t%u\n", dispc_pclk_rate(), pcd);
+	seq_printf(s, "lck\t\t%-16lulck div\t%u\n",
+			dispc_lclk_rate(OMAP_DSS_CHANNEL_LCD), lcd);
+	seq_printf(s, "pck\t\t%-16lupck div\t%u\n",
+			dispc_pclk_rate(OMAP_DSS_CHANNEL_LCD), pcd);
 
 	enable_clocks(0);
 }
@@ -2471,8 +2476,8 @@ void dispc_dump_regs(struct seq_file *s)
 #undef DUMPREG
 }
 
-static void _dispc_set_pol_freq(bool onoff, bool rf, bool ieo, bool ipc,
-				bool ihs, bool ivs, u8 acbi, u8 acb)
+static void _dispc_set_pol_freq(enum omap_channel channel, bool onoff, bool rf,
+		bool ieo, bool ipc, bool ihs, bool ivs, u8 acbi, u8 acb)
 {
 	u32 l = 0;
 
@@ -2489,13 +2494,14 @@ static void _dispc_set_pol_freq(bool onoff, bool rf, bool ieo, bool ipc,
 	l |= FLD_VAL(acb, 7, 0);
 
 	enable_clocks(1);
-	dispc_write_reg(DISPC_POL_FREQ(OMAP_DSS_CHANNEL_LCD), l);
+	dispc_write_reg(DISPC_POL_FREQ(channel), l);
 	enable_clocks(0);
 }
 
-void dispc_set_pol_freq(enum omap_panel_config config, u8 acbi, u8 acb)
+void dispc_set_pol_freq(enum omap_channel channel,
+		enum omap_panel_config config, u8 acbi, u8 acb)
 {
-	_dispc_set_pol_freq((config & OMAP_DSS_LCD_ONOFF) != 0,
+	_dispc_set_pol_freq(channel, (config & OMAP_DSS_LCD_ONOFF) != 0,
 			(config & OMAP_DSS_LCD_RF) != 0,
 			(config & OMAP_DSS_LCD_IEO) != 0,
 			(config & OMAP_DSS_LCD_IPC) != 0,
@@ -2564,24 +2570,26 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
 	return 0;
 }
 
-int dispc_set_clock_div(struct dispc_clock_info *cinfo)
+int dispc_set_clock_div(enum omap_channel channel,
+		struct dispc_clock_info *cinfo)
 {
 	DSSDBG("lck = %lu (%u)\n", cinfo->lck, cinfo->lck_div);
 	DSSDBG("pck = %lu (%u)\n", cinfo->pck, cinfo->pck_div);
 
-	dispc_set_lcd_divisor(cinfo->lck_div, cinfo->pck_div);
+	dispc_set_lcd_divisor(channel, cinfo->lck_div, cinfo->pck_div);
 
 	return 0;
 }
 
-int dispc_get_clock_div(struct dispc_clock_info *cinfo)
+int dispc_get_clock_div(enum omap_channel channel,
+		struct dispc_clock_info *cinfo)
 {
 	unsigned long fck;
 
 	fck = dispc_fclk_rate();
 
-	cinfo->lck_div = REG_GET(DISPC_DIVISOR(OMAP_DSS_CHANNEL_LCD), 23, 16);
-	cinfo->pck_div = REG_GET(DISPC_DIVISOR(OMAP_DSS_CHANNEL_LCD), 7, 0);
+	cinfo->lck_div = REG_GET(DISPC_DIVISOR(channel), 23, 16);
+	cinfo->pck_div = REG_GET(DISPC_DIVISOR(channel), 7, 0);
 
 	cinfo->lck = fck / cinfo->lck_div;
 	cinfo->pck = cinfo->lck / cinfo->pck_div;
drivers/video/omap2/dss/dpi.c +14 -12
index 08b497f..8c61e87 100644
@@ -40,8 +40,9 @@ static struct {
 } dpi;
 
 #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL
-static int dpi_set_dsi_clk(bool is_tft, unsigned long pck_req,
-		unsigned long *fck, int *lck_div, int *pck_div)
+static int dpi_set_dsi_clk(struct omap_dss_device *dssdev, bool is_tft,
+		unsigned long pck_req, unsigned long *fck, int *lck_div,
+		int *pck_div)
 {
 	struct dsi_clock_info dsi_cinfo;
 	struct dispc_clock_info dispc_cinfo;
@@ -58,7 +59,7 @@ static int dpi_set_dsi_clk(bool is_tft, unsigned long pck_req,
 
 	dss_select_dispc_clk_source(DSS_SRC_DSI1_PLL_FCLK);
 
-	r = dispc_set_clock_div(&dispc_cinfo);
+	r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo);
 	if (r)
 		return r;
 
@@ -69,8 +70,9 @@ static int dpi_set_dsi_clk(bool is_tft, unsigned long pck_req,
 	return 0;
 }
 #else
-static int dpi_set_dispc_clk(bool is_tft, unsigned long pck_req,
-		unsigned long *fck, int *lck_div, int *pck_div)
+static int dpi_set_dispc_clk(struct omap_dss_device *dssdev, bool is_tft,
+		unsigned long pck_req, unsigned long *fck, int *lck_div,
+		int *pck_div)
 {
 	struct dss_clock_info dss_cinfo;
 	struct dispc_clock_info dispc_cinfo;
@@ -84,7 +86,7 @@ static int dpi_set_dispc_clk(bool is_tft, unsigned long pck_req,
 	if (r)
 		return r;
 
-	r = dispc_set_clock_div(&dispc_cinfo);
+	r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo);
 	if (r)
 		return r;
 
@@ -107,17 +109,17 @@ static int dpi_set_mode(struct omap_dss_device *dssdev)
 
 	dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
 
-	dispc_set_pol_freq(dssdev->panel.config, dssdev->panel.acbi,
-			dssdev->panel.acb);
+	dispc_set_pol_freq(dssdev->manager->id, dssdev->panel.config,
+			dssdev->panel.acbi, dssdev->panel.acb);
 
 	is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0;
 
 #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL
-	r = dpi_set_dsi_clk(is_tft, t->pixel_clock * 1000,
-			&fck, &lck_div, &pck_div);
+	r = dpi_set_dsi_clk(dssdev, is_tft, t->pixel_clock * 1000, &fck,
+			&lck_div, &pck_div);
 #else
-	r = dpi_set_dispc_clk(is_tft, t->pixel_clock * 1000,
-			&fck, &lck_div, &pck_div);
+	r = dpi_set_dispc_clk(dssdev, is_tft, t->pixel_clock * 1000, &fck,
+			&lck_div, &pck_div);
 #endif
 	if (r)
 		goto err0;
drivers/video/omap2/dss/dsi.c +6 -5
index acd36ca..f00ebb3 100644
@@ -792,7 +792,8 @@ static int dsi_pll_power(enum dsi_pll_power_state state)
 }
 
 /* calculate clock rates using dividers in cinfo */
-static int dsi_calc_clock_rates(struct dsi_clock_info *cinfo)
+static int dsi_calc_clock_rates(struct omap_dss_device *dssdev,
+		struct dsi_clock_info *cinfo)
 {
 	if (cinfo->regn == 0 || cinfo->regn > REGN_MAX)
 		return -EINVAL;
@@ -812,7 +813,7 @@ static int dsi_calc_clock_rates(struct dsi_clock_info *cinfo)
 		 * with DSS2_FCK source also */
 		cinfo->highfreq = 0;
 	} else {
-		cinfo->clkin = dispc_pclk_rate();
+		cinfo->clkin = dispc_pclk_rate(dssdev->manager->id);
 
 		if (cinfo->clkin < 32000000)
 			cinfo->highfreq = 0;
@@ -1206,8 +1207,8 @@ void dsi_dump_clocks(struct seq_file *s)
 
 	seq_printf(s,	"VP_CLK\t\t%lu\n"
 			"VP_PCLK\t\t%lu\n",
-			dispc_lclk_rate(),
-			dispc_pclk_rate());
+			dispc_lclk_rate(OMAP_DSS_CHANNEL_LCD),
+			dispc_pclk_rate(OMAP_DSS_CHANNEL_LCD));
 
 	enable_clocks(0);
 }
@@ -3021,7 +3022,7 @@ static int dsi_configure_dispc_clocks(struct omap_dss_device *dssdev)
 		return r;
 	}
 
-	r = dispc_set_clock_div(&dispc_cinfo);
+	r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo);
 	if (r) {
 		DSSERR("Failed to set dispc clocks\n");
 		return r;
drivers/video/omap2/dss/dss.h +8 -5
index 7dee4c3..2959f82 100644
@@ -393,15 +393,18 @@ bool dispc_lcd_timings_ok(struct omap_video_timings *timings);
 void dispc_set_lcd_timings(enum omap_channel channel,
 		struct omap_video_timings *timings);
 unsigned long dispc_fclk_rate(void);
-unsigned long dispc_lclk_rate(void);
-unsigned long dispc_pclk_rate(void);
-void dispc_set_pol_freq(enum omap_panel_config config, u8 acbi, u8 acb);
+unsigned long dispc_lclk_rate(enum omap_channel channel);
+unsigned long dispc_pclk_rate(enum omap_channel channel);
+void dispc_set_pol_freq(enum omap_channel channel,
+		enum omap_panel_config config, u8 acbi, u8 acb);
 void dispc_find_clk_divs(bool is_tft, unsigned long req_pck, unsigned long fck,
 		struct dispc_clock_info *cinfo);
 int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
 		struct dispc_clock_info *cinfo);
-int dispc_set_clock_div(struct dispc_clock_info *cinfo);
-int dispc_get_clock_div(struct dispc_clock_info *cinfo);
+int dispc_set_clock_div(enum omap_channel channel,
+		struct dispc_clock_info *cinfo);
+int dispc_get_clock_div(enum omap_channel channel,
+		struct dispc_clock_info *cinfo);
 
 
 /* VENC */
drivers/video/omap2/dss/sdi.c +4 -4
index 19443b1..b64adf7 100644
@@ -77,15 +77,15 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
 	/* 15.5.9.1.2 */
 	dssdev->panel.config |= OMAP_DSS_LCD_RF | OMAP_DSS_LCD_ONOFF;
 
-	dispc_set_pol_freq(dssdev->panel.config, dssdev->panel.acbi,
-			dssdev->panel.acb);
+	dispc_set_pol_freq(dssdev->manager->id, dssdev->panel.config,
+			dssdev->panel.acbi, dssdev->panel.acb);
 
 	if (!sdi.skip_init) {
 		r = dss_calc_clock_div(1, t->pixel_clock * 1000,
 				&dss_cinfo, &dispc_cinfo);
 	} else {
 		r = dss_get_clock_div(&dss_cinfo);
-		r = dispc_get_clock_div(&dispc_cinfo);
+		r = dispc_get_clock_div(dssdev->manager->id, &dispc_cinfo);
 	}
 
 	if (r)
@@ -112,7 +112,7 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
 	if (r)
 		goto err2;
 
-	r = dispc_set_clock_div(&dispc_cinfo);
+	r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo);
 	if (r)
 		goto err2;
 
Signature · 1 line
1.7.0.4
#13 lore raw

PATCH v5 5/7 OMAP: DSS2: LCD2 Channel Changes for DISPC

In reply to Archit Taneja

From: Sumit Semwal <[email protected]>

Modify DISPC functions to work with LCD2 as the DISPC Channel.

---
 arch/arm/plat-omap/include/plat/display.h |    4 +
 drivers/video/omap2/dss/dispc.c           |  281 +++++++++++++++++++++++++----
 drivers/video/omap2/dss/dpi.c             |    2 +-
 3 files changed, 247 insertions(+), 40 deletions(-)
arch/arm/plat-omap/include/plat/display.h +4 -0
index f184003..537f4e4 100644
@@ -42,6 +42,10 @@
 #define DISPC_IRQ_SYNC_LOST		(1 << 14)
 #define DISPC_IRQ_SYNC_LOST_DIGIT	(1 << 15)
 #define DISPC_IRQ_WAKEUP		(1 << 16)
+#define DISPC_IRQ_SYNC_LOST2		(1 << 17)
+#define DISPC_IRQ_VSYNC2		(1 << 18)
+#define DISPC_IRQ_ACBIAS_COUNT_STAT2	(1 << 21)
+#define DISPC_IRQ_FRAMEDONE2		(1 << 22)
 
 struct omap_dss_device;
 struct omap_overlay_manager;
drivers/video/omap2/dss/dispc.c +242 -39

549 lines not on this page · raw message

drivers/video/omap2/dss/dpi.c +1 -1
index 8c61e87..75fb0a5 100644
@@ -238,7 +238,7 @@ void dpi_set_timings(struct omap_dss_device *dssdev,
 	dssdev->panel.timings = *timings;
 	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
 		dpi_set_mode(dssdev);
-		dispc_go(OMAP_DSS_CHANNEL_LCD);
+		dispc_go(dssdev->manager->id);
 	}
 }
 EXPORT_SYMBOL(dpi_set_timings);
Signature · 1 line
1.7.0.4
#14 lore raw

PATCH v5 6/7 OMAP: DSS2: Use dss_features to handle DISPC bits removed on OMAP4

In reply to Archit Taneja

DISPC_CONFIG bits LCDENABLEPOL, LCDENABLESIGNAL, PCKFREEENABLE and FUNCGATED have been removed from OMAP4, use dss_features to handle them correctly.

---
 drivers/video/omap2/dss/dispc.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/video/omap2/dss/dispc.c +11 -1
index 6c06160..ad8fbcc 100644
@@ -1965,6 +1965,9 @@ void dispc_enable_channel(enum omap_channel channel, bool enable)
 
 void dispc_lcd_enable_signal_polarity(bool act_high)
 {
+	if (!dss_has_feature(FEAT_LCDENABLEPOL))
+		return;
+
 	enable_clocks(1);
 	REG_FLD_MOD(DISPC_CONTROL, act_high ? 1 : 0, 29, 29);
 	enable_clocks(0);
@@ -1972,6 +1975,9 @@ void dispc_lcd_enable_signal_polarity(bool act_high)
 
 void dispc_lcd_enable_signal(bool enable)
 {
+	if (!dss_has_feature(FEAT_LCDENABLESIGNAL))
+		return;
+
 	enable_clocks(1);
 	REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 28, 28);
 	enable_clocks(0);
@@ -1979,6 +1985,9 @@ void dispc_lcd_enable_signal(bool enable)
 
 void dispc_pck_free_enable(bool enable)
 {
+	if (!dss_has_feature(FEAT_PCKFREEENABLE))
+		return;
+
 	enable_clocks(1);
 	REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 27, 27);
 	enable_clocks(0);
@@ -3289,7 +3298,8 @@ static void _omap_dispc_initial_config(void)
 	dispc_write_reg(DISPC_SYSCONFIG, l);
 
 	/* FUNCGATED */
-	REG_FLD_MOD(DISPC_CONFIG, 1, 9, 9);
+	if (dss_has_feature(FEAT_FUNCGATED))
+		REG_FLD_MOD(DISPC_CONFIG, 1, 9, 9);
 
 	/* L3 firewall setting: enable access to OCM RAM */
 	/* XXX this should be somewhere in plat-omap */
Signature · 1 line
1.7.0.4
#15 lore raw

PATCH v5 7/7 OMAP: DSS2: Add new Overlay Manager

In reply to Archit Taneja

From: Sumit Semwal <[email protected]>

Add new Overlay Manager in manager.c, make changes needed for LCD2 channel.

---
 drivers/video/omap2/dss/dispc.c   |   21 +++++-----
 drivers/video/omap2/dss/dss.h     |    4 +-
 drivers/video/omap2/dss/manager.c |   77 +++++++++++++++++++++++--------------
 drivers/video/omap2/dss/overlay.c |   14 ++++++-
 4 files changed, 72 insertions(+), 44 deletions(-)
drivers/video/omap2/dss/dispc.c +10 -11
index ad8fbcc..1863bce 100644
@@ -1610,8 +1610,8 @@ static int _dispc_setup_plane(enum omap_plane plane,
 		bool ilace,
 		enum omap_dss_rotation_type rotation_type,
 		u8 rotation, int mirror,
-		u8 global_alpha,
-		u8 pre_mult_alpha)
+		u8 global_alpha, u8 pre_mult_alpha,
+		enum omap_channel channel)
 {
 	const int maxdownscale = cpu_is_omap34xx() ? 4 : 2;
 	bool five_taps = 0;
@@ -1710,8 +1710,8 @@ static int _dispc_setup_plane(enum omap_plane plane,
 		five_taps = height > out_height * 2;
 
 		if (!five_taps) {
-			fclk = calc_fclk(OMAP_DSS_CHANNEL_LCD, width, height,
-					out_width, out_height);
+			fclk = calc_fclk(channel, width, height, out_width,
+					out_height);
 
 			/* Try 5-tap filter if 3-tap fclk is too high */
 			if (cpu_is_omap34xx() && height > out_height &&
@@ -1725,9 +1725,8 @@ static int _dispc_setup_plane(enum omap_plane plane,
 		}
 
 		if (five_taps)
-			fclk = calc_fclk_five_taps(OMAP_DSS_CHANNEL_LCD, width,
-					height, out_width, out_height,
-					color_mode);
+			fclk = calc_fclk_five_taps(channel, width, height,
+					out_width, out_height, color_mode);
 
 		DSSDBG("required fclk rate = %lu Hz\n", fclk);
 		DSSDBG("current fclk rate = %lu Hz\n", dispc_fclk_rate());
@@ -3374,17 +3373,17 @@ int dispc_setup_plane(enum omap_plane plane,
 		       bool ilace,
 		       enum omap_dss_rotation_type rotation_type,
 		       u8 rotation, bool mirror, u8 global_alpha,
-		       u8 pre_mult_alpha)
+		       u8 pre_mult_alpha, enum omap_channel channel)
 {
 	int r = 0;
 
 	DSSDBG("dispc_setup_plane %d, pa %x, sw %d, %d,%d, %dx%d -> "
-	       "%dx%d, ilace %d, cmode %x, rot %d, mir %d\n",
+	       "%dx%d, ilace %d, cmode %x, rot %d, mir %d chan %d\n",
 	       plane, paddr, screen_width, pos_x, pos_y,
 	       width, height,
 	       out_width, out_height,
 	       ilace, color_mode,
-	       rotation, mirror);
+	       rotation, mirror, channel);
 
 	enable_clocks(1);
 
@@ -3397,7 +3396,7 @@ int dispc_setup_plane(enum omap_plane plane,
 			   rotation_type,
 			   rotation, mirror,
 			   global_alpha,
-			   pre_mult_alpha);
+			   pre_mult_alpha, channel);
 
 	enable_clocks(0);
 
drivers/video/omap2/dss/dss.h +2 -2
index 2959f82..dd51d3f 100644
@@ -359,8 +359,8 @@ int dispc_setup_plane(enum omap_plane plane,
 		      bool ilace,
 		      enum omap_dss_rotation_type rotation_type,
 		      u8 rotation, bool mirror,
-		      u8 global_alpha,
-		      u8 pre_mult_alpha);
+		      u8 global_alpha, u8 pre_mult_alpha,
+		      enum omap_channel channel);
 
 bool dispc_go_busy(enum omap_channel channel);
 void dispc_go(enum omap_channel channel);
drivers/video/omap2/dss/manager.c +48 -29

167 lines not on this page · raw message

drivers/video/omap2/dss/overlay.c +12 -2
index 41a2902..456efef 100644
@@ -664,12 +664,22 @@ void dss_recheck_connections(struct omap_dss_device *dssdev, bool force)
 	int i;
 	struct omap_overlay_manager *lcd_mgr;
 	struct omap_overlay_manager *tv_mgr;
+	struct omap_overlay_manager *lcd2_mgr = NULL;
 	struct omap_overlay_manager *mgr = NULL;
 
 	lcd_mgr = omap_dss_get_overlay_manager(OMAP_DSS_OVL_MGR_LCD);
 	tv_mgr = omap_dss_get_overlay_manager(OMAP_DSS_OVL_MGR_TV);
-
-	if (dssdev->type != OMAP_DISPLAY_TYPE_VENC) {
+	if (dss_has_feature(FEAT_MGR_LCD2))
+		lcd2_mgr = omap_dss_get_overlay_manager(OMAP_DSS_OVL_MGR_LCD2);
+
+	if (dssdev->channel == OMAP_DSS_CHANNEL_LCD2) {
+		if (!lcd2_mgr->device || force) {
+			if (lcd2_mgr->device)
+				lcd2_mgr->unset_device(lcd2_mgr);
+			lcd2_mgr->set_device(lcd2_mgr, dssdev);
+			mgr = lcd2_mgr;
+		}
+	} else if (dssdev->type != OMAP_DISPLAY_TYPE_VENC) {
 		if (!lcd_mgr->device || force) {
 			if (lcd_mgr->device)
 				lcd_mgr->unset_device(lcd_mgr);
Signature · 1 line
1.7.0.4