diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-06-29 07:13:07 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-06-29 07:13:07 -0400 |
commit | 974a65825e0b5fbda49605f0416a2c975d66e9e6 (patch) | |
tree | 72188f07c300e04f30d059bf502f651d2cbeb829 /drivers/video/omap2/dss/apply.c | |
parent | 465698ee7bf457d1a3f35f0cb6e1e8fa144946f5 (diff) | |
parent | 6c6f510afb86e3c77c351dfa20cbb8ca834abad9 (diff) |
Merge "Apply LCD manager related parameters" from Archit
The LCD interface drivers(DPI, DSI, RFBI, SDI) do some direct DISPC register
writes to configure LCD manager related fields. This series groups these fields
into a single struct, and let's the interface driver apply these parameters.
This allows us to:
- Check the LCD manager related parameters before applying them.
- Remove some omap_dss_device references as APPLY holds the applied parameters.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/apply.c')
-rw-r--r-- | drivers/video/omap2/dss/apply.c | 85 |
1 files changed, 81 insertions, 4 deletions
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index 3ce7a3ec6224..0fefc68372b9 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 | ||
109 | static struct { | 110 | static struct { |
@@ -137,6 +138,7 @@ static struct mgr_priv_data *get_mgr_priv(struct omap_overlay_manager *mgr) | |||
137 | void dss_apply_init(void) | 138 | void 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,16 +170,35 @@ 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 | ||
185 | /* | ||
186 | * A LCD manager's stallmode decides whether it is in manual or auto update. TV | ||
187 | * manager is always auto update, stallmode field for TV manager is false by | ||
188 | * default | ||
189 | */ | ||
173 | static bool ovl_manual_update(struct omap_overlay *ovl) | 190 | static bool ovl_manual_update(struct omap_overlay *ovl) |
174 | { | 191 | { |
175 | return ovl->manager->device->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; | 192 | struct mgr_priv_data *mp = get_mgr_priv(ovl->manager); |
193 | |||
194 | return mp->lcd_config.stallmode; | ||
176 | } | 195 | } |
177 | 196 | ||
178 | static bool mgr_manual_update(struct omap_overlay_manager *mgr) | 197 | static bool mgr_manual_update(struct omap_overlay_manager *mgr) |
179 | { | 198 | { |
180 | return mgr->device->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; | 199 | struct mgr_priv_data *mp = get_mgr_priv(mgr); |
200 | |||
201 | return mp->lcd_config.stallmode; | ||
181 | } | 202 | } |
182 | 203 | ||
183 | static int dss_check_settings_low(struct omap_overlay_manager *mgr, | 204 | static int dss_check_settings_low(struct omap_overlay_manager *mgr, |
@@ -214,7 +235,7 @@ static int dss_check_settings_low(struct omap_overlay_manager *mgr, | |||
214 | ois[ovl->id] = oi; | 235 | ois[ovl->id] = oi; |
215 | } | 236 | } |
216 | 237 | ||
217 | return dss_mgr_check(mgr, mi, &mp->timings, ois); | 238 | return dss_mgr_check(mgr, mi, &mp->timings, &mp->lcd_config, ois); |
218 | } | 239 | } |
219 | 240 | ||
220 | /* | 241 | /* |
@@ -550,7 +571,7 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl) | |||
550 | 571 | ||
551 | mp = get_mgr_priv(ovl->manager); | 572 | mp = get_mgr_priv(ovl->manager); |
552 | 573 | ||
553 | replication = dss_use_replication(ovl->manager->device, oi->color_mode); | 574 | replication = dss_ovl_use_replication(mp->lcd_config, oi->color_mode); |
554 | 575 | ||
555 | r = dispc_ovl_setup(ovl->id, oi, replication, &mp->timings); | 576 | r = dispc_ovl_setup(ovl->id, oi, replication, &mp->timings); |
556 | if (r) { | 577 | if (r) { |
@@ -633,6 +654,24 @@ static void dss_mgr_write_regs_extra(struct omap_overlay_manager *mgr) | |||
633 | 654 | ||
634 | dispc_mgr_set_timings(mgr->id, &mp->timings); | 655 | dispc_mgr_set_timings(mgr->id, &mp->timings); |
635 | 656 | ||
657 | /* lcd_config parameters */ | ||
658 | if (dss_mgr_is_lcd(mgr->id)) { | ||
659 | dispc_mgr_set_io_pad_mode(mp->lcd_config.io_pad_mode); | ||
660 | |||
661 | dispc_mgr_enable_stallmode(mgr->id, mp->lcd_config.stallmode); | ||
662 | dispc_mgr_enable_fifohandcheck(mgr->id, | ||
663 | mp->lcd_config.fifohandcheck); | ||
664 | |||
665 | dispc_mgr_set_clock_div(mgr->id, &mp->lcd_config.clock_info); | ||
666 | |||
667 | dispc_mgr_set_tft_data_lines(mgr->id, | ||
668 | mp->lcd_config.video_port_width); | ||
669 | |||
670 | dispc_lcd_enable_signal_polarity(mp->lcd_config.lcden_sig_polarity); | ||
671 | |||
672 | dispc_mgr_set_lcd_type_tft(mgr->id); | ||
673 | } | ||
674 | |||
636 | mp->extra_info_dirty = false; | 675 | mp->extra_info_dirty = false; |
637 | if (mp->updating) | 676 | if (mp->updating) |
638 | mp->shadow_extra_info_dirty = true; | 677 | mp->shadow_extra_info_dirty = true; |
@@ -1292,6 +1331,44 @@ void dss_mgr_set_timings(struct omap_overlay_manager *mgr, | |||
1292 | mutex_unlock(&apply_lock); | 1331 | mutex_unlock(&apply_lock); |
1293 | } | 1332 | } |
1294 | 1333 | ||
1334 | static void dss_apply_mgr_lcd_config(struct omap_overlay_manager *mgr, | ||
1335 | const struct dss_lcd_mgr_config *config) | ||
1336 | { | ||
1337 | struct mgr_priv_data *mp = get_mgr_priv(mgr); | ||
1338 | |||
1339 | mp->lcd_config = *config; | ||
1340 | mp->extra_info_dirty = true; | ||
1341 | } | ||
1342 | |||
1343 | void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, | ||
1344 | const struct dss_lcd_mgr_config *config) | ||
1345 | { | ||
1346 | unsigned long flags; | ||
1347 | struct mgr_priv_data *mp = get_mgr_priv(mgr); | ||
1348 | |||
1349 | mutex_lock(&apply_lock); | ||
1350 | |||
1351 | if (mp->enabled) { | ||
1352 | DSSERR("cannot apply lcd config for %s: manager needs to be disabled\n", | ||
1353 | mgr->name); | ||
1354 | goto out; | ||
1355 | } | ||
1356 | |||
1357 | spin_lock_irqsave(&data_lock, flags); | ||
1358 | |||
1359 | dss_apply_mgr_lcd_config(mgr, config); | ||
1360 | |||
1361 | dss_write_regs(); | ||
1362 | dss_set_go_bits(); | ||
1363 | |||
1364 | spin_unlock_irqrestore(&data_lock, flags); | ||
1365 | |||
1366 | wait_pending_extra_info_updates(); | ||
1367 | |||
1368 | out: | ||
1369 | mutex_unlock(&apply_lock); | ||
1370 | } | ||
1371 | |||
1295 | int dss_ovl_set_info(struct omap_overlay *ovl, | 1372 | int dss_ovl_set_info(struct omap_overlay *ovl, |
1296 | struct omap_overlay_info *info) | 1373 | struct omap_overlay_info *info) |
1297 | { | 1374 | { |