aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2012-06-29 05:07:03 -0400
committerArchit Taneja <archit@ti.com>2012-06-29 06:57:42 -0400
commitf476ae9dab3234532d41d36beb4ba7be838fa786 (patch)
treeaee514d49e1ccbc1aabd1cf74f4ff603c35d00b2 /drivers/video
parent37a579903efaf25b74fcf1fd645817af94d36152 (diff)
OMAPDSS: APPLY: Remove DISPC writes to manager's lcd parameters in interface drivers
Replace the DISPC fuctions used to configure LCD channel related manager parameters with dss_mgr_set_lcd_config() in APPLY. This function ensures that the DISPC registers are written at the right time by using the shadow register programming model. The LCD manager configurations is stored as a private data of manager in APPLY. It is treated as an extra info as it's the panel drivers which trigger this apply via interface drivers, and not a DSS2 user like omapfb or omapdrm. Storing LCD manager related properties in APPLY also prevents the need to refer to the panel connected to the manager for information. This helps in making the DSS driver less dependent on panel. A helper function is added to check whether the manager is LCD or TV. The direct DISPC register writes are removed from the interface drivers. Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/apply.c68
-rw-r--r--drivers/video/omap2/dss/dpi.c16
-rw-r--r--drivers/video/omap2/dss/dsi.c17
-rw-r--r--drivers/video/omap2/dss/dss.h11
-rw-r--r--drivers/video/omap2/dss/rfbi.c13
-rw-r--r--drivers/video/omap2/dss/sdi.c15
6 files changed, 83 insertions, 57 deletions
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 3ce7a3ec6224..30915bdcb237 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -104,6 +104,7 @@ struct mgr_priv_data {
104 bool shadow_extra_info_dirty; 104 bool shadow_extra_info_dirty;
105 105
106 struct omap_video_timings timings; 106 struct omap_video_timings timings;
107 struct dss_lcd_mgr_config lcd_config;
107}; 108};
108 109
109static struct { 110static struct {
@@ -137,6 +138,7 @@ static struct mgr_priv_data *get_mgr_priv(struct omap_overlay_manager *mgr)
137void dss_apply_init(void) 138void dss_apply_init(void)
138{ 139{
139 const int num_ovls = dss_feat_get_num_ovls(); 140 const int num_ovls = dss_feat_get_num_ovls();
141 struct mgr_priv_data *mp;
140 int i; 142 int i;
141 143
142 spin_lock_init(&data_lock); 144 spin_lock_init(&data_lock);
@@ -168,6 +170,16 @@ void dss_apply_init(void)
168 170
169 op->user_info = op->info; 171 op->user_info = op->info;
170 } 172 }
173
174 /*
175 * Initialize some of the lcd_config fields for TV manager, this lets
176 * us prevent checking if the manager is LCD or TV at some places
177 */
178 mp = &dss_data.mgr_priv_data_array[OMAP_DSS_CHANNEL_DIGIT];
179
180 mp->lcd_config.video_port_width = 24;
181 mp->lcd_config.clock_info.lck_div = 1;
182 mp->lcd_config.clock_info.pck_div = 1;
171} 183}
172 184
173static bool ovl_manual_update(struct omap_overlay *ovl) 185static bool ovl_manual_update(struct omap_overlay *ovl)
@@ -633,6 +645,24 @@ static void dss_mgr_write_regs_extra(struct omap_overlay_manager *mgr)
633 645
634 dispc_mgr_set_timings(mgr->id, &mp->timings); 646 dispc_mgr_set_timings(mgr->id, &mp->timings);
635 647
648 /* lcd_config parameters */
649 if (dss_mgr_is_lcd(mgr->id)) {
650 dispc_mgr_set_io_pad_mode(mp->lcd_config.io_pad_mode);
651
652 dispc_mgr_enable_stallmode(mgr->id, mp->lcd_config.stallmode);
653 dispc_mgr_enable_fifohandcheck(mgr->id,
654 mp->lcd_config.fifohandcheck);
655
656 dispc_mgr_set_clock_div(mgr->id, &mp->lcd_config.clock_info);
657
658 dispc_mgr_set_tft_data_lines(mgr->id,
659 mp->lcd_config.video_port_width);
660
661 dispc_lcd_enable_signal_polarity(mp->lcd_config.lcden_sig_polarity);
662
663 dispc_mgr_set_lcd_type_tft(mgr->id);
664 }
665
636 mp->extra_info_dirty = false; 666 mp->extra_info_dirty = false;
637 if (mp->updating) 667 if (mp->updating)
638 mp->shadow_extra_info_dirty = true; 668 mp->shadow_extra_info_dirty = true;
@@ -1292,6 +1322,44 @@ void dss_mgr_set_timings(struct omap_overlay_manager *mgr,
1292 mutex_unlock(&apply_lock); 1322 mutex_unlock(&apply_lock);
1293} 1323}
1294 1324
1325static void dss_apply_mgr_lcd_config(struct omap_overlay_manager *mgr,
1326 const struct dss_lcd_mgr_config *config)
1327{
1328 struct mgr_priv_data *mp = get_mgr_priv(mgr);
1329
1330 mp->lcd_config = *config;
1331 mp->extra_info_dirty = true;
1332}
1333
1334void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr,
1335 const struct dss_lcd_mgr_config *config)
1336{
1337 unsigned long flags;
1338 struct mgr_priv_data *mp = get_mgr_priv(mgr);
1339
1340 mutex_lock(&apply_lock);
1341
1342 if (mp->enabled) {
1343 DSSERR("cannot apply lcd config for %s: manager needs to be disabled\n",
1344 mgr->name);
1345 goto out;
1346 }
1347
1348 spin_lock_irqsave(&data_lock, flags);
1349
1350 dss_apply_mgr_lcd_config(mgr, config);
1351
1352 dss_write_regs();
1353 dss_set_go_bits();
1354
1355 spin_unlock_irqrestore(&data_lock, flags);
1356
1357 wait_pending_extra_info_updates();
1358
1359out:
1360 mutex_unlock(&apply_lock);
1361}
1362
1295int dss_ovl_set_info(struct omap_overlay *ovl, 1363int dss_ovl_set_info(struct omap_overlay *ovl,
1296 struct omap_overlay_info *info) 1364 struct omap_overlay_info *info)
1297{ 1365{
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 6664775c3e45..3266be23fc0d 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -162,21 +162,7 @@ static void dpi_config_lcd_manager(struct omap_dss_device *dssdev)
162 162
163 dpi.mgr_config.lcden_sig_polarity = 0; 163 dpi.mgr_config.lcden_sig_polarity = 0;
164 164
165 dispc_mgr_set_io_pad_mode(dpi.mgr_config.io_pad_mode); 165 dss_mgr_set_lcd_config(dssdev->manager, &dpi.mgr_config);
166 dispc_mgr_enable_stallmode(dssdev->manager->id,
167 dpi.mgr_config.stallmode);
168 dispc_mgr_enable_fifohandcheck(dssdev->manager->id,
169 dpi.mgr_config.fifohandcheck);
170
171 dispc_mgr_set_tft_data_lines(dssdev->manager->id,
172 dpi.mgr_config.video_port_width);
173
174 dispc_mgr_set_clock_div(dssdev->manager->id,
175 &dpi.mgr_config.clock_info);
176
177 dispc_lcd_enable_signal_polarity(dpi.mgr_config.lcden_sig_polarity);
178
179 dispc_mgr_set_lcd_type_tft(dssdev->manager->id);
180} 166}
181 167
182int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) 168int omapdss_dpi_display_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index f51df30d8c15..b07e8864f82f 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4425,22 +4425,7 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
4425 dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt); 4425 dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
4426 dsi->mgr_config.lcden_sig_polarity = 0; 4426 dsi->mgr_config.lcden_sig_polarity = 0;
4427 4427
4428 dispc_mgr_set_io_pad_mode(dsi->mgr_config.io_pad_mode); 4428 dss_mgr_set_lcd_config(dssdev->manager, &dsi->mgr_config);
4429
4430 dispc_mgr_enable_stallmode(dssdev->manager->id,
4431 dsi->mgr_config.stallmode);
4432 dispc_mgr_enable_fifohandcheck(dssdev->manager->id,
4433 dsi->mgr_config.fifohandcheck);
4434
4435 dispc_mgr_set_clock_div(dssdev->manager->id,
4436 &dsi->mgr_config.clock_info);
4437
4438 dispc_mgr_set_tft_data_lines(dssdev->manager->id,
4439 dsi->mgr_config.video_port_width);
4440
4441 dispc_lcd_enable_signal_polarity(dsi->mgr_config.lcden_sig_polarity);
4442
4443 dispc_mgr_set_lcd_type_tft(dssdev->manager->id);
4444 4429
4445 return 0; 4430 return 0;
4446err1: 4431err1:
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 061c95e20d49..80ed88f53c19 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -207,6 +207,8 @@ int dss_mgr_set_device(struct omap_overlay_manager *mgr,
207int dss_mgr_unset_device(struct omap_overlay_manager *mgr); 207int dss_mgr_unset_device(struct omap_overlay_manager *mgr);
208void dss_mgr_set_timings(struct omap_overlay_manager *mgr, 208void dss_mgr_set_timings(struct omap_overlay_manager *mgr,
209 struct omap_video_timings *timings); 209 struct omap_video_timings *timings);
210void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr,
211 const struct dss_lcd_mgr_config *config);
210const struct omap_video_timings *dss_mgr_get_timings(struct omap_overlay_manager *mgr); 212const struct omap_video_timings *dss_mgr_get_timings(struct omap_overlay_manager *mgr);
211 213
212bool dss_ovl_is_enabled(struct omap_overlay *ovl); 214bool dss_ovl_is_enabled(struct omap_overlay *ovl);
@@ -244,6 +246,15 @@ int dss_mgr_check(struct omap_overlay_manager *mgr,
244 const struct omap_video_timings *mgr_timings, 246 const struct omap_video_timings *mgr_timings,
245 struct omap_overlay_info **overlay_infos); 247 struct omap_overlay_info **overlay_infos);
246 248
249static inline bool dss_mgr_is_lcd(enum omap_channel id)
250{
251 if (id == OMAP_DSS_CHANNEL_LCD || id == OMAP_DSS_CHANNEL_LCD2 ||
252 id == OMAP_DSS_CHANNEL_LCD3)
253 return true;
254 else
255 return false;
256}
257
247/* overlay */ 258/* overlay */
248void dss_init_overlays(struct platform_device *pdev); 259void dss_init_overlays(struct platform_device *pdev);
249void dss_uninit_overlays(struct platform_device *pdev); 260void dss_uninit_overlays(struct platform_device *pdev);
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 0dc8dac1c07c..cc22426144cb 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -872,18 +872,7 @@ static void rfbi_config_lcd_manager(struct omap_dss_device *dssdev)
872 mgr_config.video_port_width = dssdev->ctrl.pixel_size; 872 mgr_config.video_port_width = dssdev->ctrl.pixel_size;
873 mgr_config.lcden_sig_polarity = 0; 873 mgr_config.lcden_sig_polarity = 0;
874 874
875 dispc_mgr_set_io_pad_mode(mgr_config.io_pad_mode); 875 dss_mgr_set_lcd_config(dssdev->manager, &mgr_config);
876
877 dispc_mgr_enable_stallmode(dssdev->manager->id, mgr_config.stallmode);
878 dispc_mgr_enable_fifohandcheck(dssdev->manager->id,
879 mgr_config.fifohandcheck);
880
881 dispc_mgr_set_tft_data_lines(dssdev->manager->id,
882 mgr_config.video_port_width);
883
884 dispc_lcd_enable_signal_polarity(mgr_config.lcden_sig_polarity);
885
886 dispc_mgr_set_lcd_type_tft(dssdev->manager->id);
887} 876}
888 877
889int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) 878int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index f102eae6e2af..5d31699fbd3c 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -46,20 +46,7 @@ static void sdi_config_lcd_manager(struct omap_dss_device *dssdev)
46 sdi.mgr_config.video_port_width = 24; 46 sdi.mgr_config.video_port_width = 24;
47 sdi.mgr_config.lcden_sig_polarity = 1; 47 sdi.mgr_config.lcden_sig_polarity = 1;
48 48
49 dispc_mgr_set_io_pad_mode(sdi.mgr_config.io_pad_mode); 49 dss_mgr_set_lcd_config(dssdev->manager, &sdi.mgr_config);
50 dispc_mgr_enable_stallmode(dssdev->manager->id,
51 sdi.mgr_config.stallmode);
52 dispc_mgr_enable_fifohandcheck(dssdev->manager->id,
53 sdi.mgr_config.fifohandcheck);
54
55 dispc_mgr_set_clock_div(dssdev->manager->id,
56 &sdi.mgr_config.clock_info);
57
58 dispc_mgr_set_tft_data_lines(dssdev->manager->id,
59 sdi.mgr_config.video_port_width);
60 dispc_lcd_enable_signal_polarity(sdi.mgr_config.lcden_sig_polarity);
61
62 dispc_mgr_set_lcd_type_tft(dssdev->manager->id);
63} 50}
64 51
65int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) 52int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)