Skip to content

Commit e86d456

Browse files
chandrabhanu-mahapatratomba
authored andcommitted
OMAPDSS: Add LCD3 overlay manager and Clock and IRQ support
The support for LCD3 manager has been added into the manager module. LCD3 panel has registers as DISPC_CONTROL3 and DISPC_CONFIG3 just like those in LCD and LCD2 panels. These registers control the Display Controller (DISPC) module for LCD3 output. The three LCDs support Display Serial Interface (DSI), Remote Frame Buffer Interface (RFBI) and Parallel CMOS Output Interface (DPI). These LCDs can be connected through parallel output interface using DISPC and RFBI or DPI. For serial interface DSS uses DSI. The LCD3 panel, just like LCD and LCD2 panels, has a clock switch in DSS_CTRL register which has been enabled. The clock switch chooses between DSS_CLK and DPLL_DSI1_C_CLK1 as source for LCD3_CLK. New IRQs as DISPC_IRQ_VSYNC3, DISPC_IRQ_FRAMEDONE3, DISPC_IRQ_ACBIAS_COUNT_STAT3 and DISPC_IRQ_SYNC_LOST3 have been added specific to the new manager. Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent ff6331e commit e86d456

7 files changed

Lines changed: 78 additions & 9 deletions

File tree

‎drivers/video/omap2/dss/dispc.c‎

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,23 @@ static const struct {
191191
[DISPC_MGR_FLD_FIFOHANDCHECK] = { DISPC_CONFIG2, 16, 16 },
192192
},
193193
},
194+
[OMAP_DSS_CHANNEL_LCD3] = {
195+
.name = "LCD3",
196+
.vsync_irq = DISPC_IRQ_VSYNC3,
197+
.framedone_irq = DISPC_IRQ_FRAMEDONE3,
198+
.sync_lost_irq = DISPC_IRQ_SYNC_LOST3,
199+
.reg_desc = {
200+
[DISPC_MGR_FLD_ENABLE] = { DISPC_CONTROL3, 0, 0 },
201+
[DISPC_MGR_FLD_STNTFT] = { DISPC_CONTROL3, 3, 3 },
202+
[DISPC_MGR_FLD_GO] = { DISPC_CONTROL3, 5, 5 },
203+
[DISPC_MGR_FLD_TFTDATALINES] = { DISPC_CONTROL3, 9, 8 },
204+
[DISPC_MGR_FLD_STALLMODE] = { DISPC_CONTROL3, 11, 11 },
205+
[DISPC_MGR_FLD_TCKENABLE] = { DISPC_CONFIG3, 10, 10 },
206+
[DISPC_MGR_FLD_TCKSELECTION] = { DISPC_CONFIG3, 11, 11 },
207+
[DISPC_MGR_FLD_CPR] = { DISPC_CONFIG3, 15, 15 },
208+
[DISPC_MGR_FLD_FIFOHANDCHECK] = { DISPC_CONFIG3, 16, 16 },
209+
},
210+
},
194211
};
195212

196213
static void _omap_dispc_set_irqs(void);
@@ -239,6 +256,10 @@ static void dispc_save_context(void)
239256
SR(CONTROL2);
240257
SR(CONFIG2);
241258
}
259+
if (dss_has_feature(FEAT_MGR_LCD3)) {
260+
SR(CONTROL3);
261+
SR(CONFIG3);
262+
}
242263

243264
for (i = 0; i < dss_feat_get_num_mgrs(); i++) {
244265
SR(DEFAULT_COLOR(i));
@@ -352,6 +373,8 @@ static void dispc_restore_context(void)
352373
RR(GLOBAL_ALPHA);
353374
if (dss_has_feature(FEAT_MGR_LCD2))
354375
RR(CONFIG2);
376+
if (dss_has_feature(FEAT_MGR_LCD3))
377+
RR(CONFIG3);
355378

356379
for (i = 0; i < dss_feat_get_num_mgrs(); i++) {
357380
RR(DEFAULT_COLOR(i));
@@ -437,6 +460,8 @@ static void dispc_restore_context(void)
437460
RR(CONTROL);
438461
if (dss_has_feature(FEAT_MGR_LCD2))
439462
RR(CONTROL2);
463+
if (dss_has_feature(FEAT_MGR_LCD3))
464+
RR(CONTROL3);
440465
/* clear spurious SYNC_LOST_DIGIT interrupts */
441466
dispc_write_reg(DISPC_IRQSTATUS, DISPC_IRQ_SYNC_LOST_DIGIT);
442467

@@ -476,7 +501,8 @@ void dispc_runtime_put(void)
476501
static inline bool dispc_mgr_is_lcd(enum omap_channel channel)
477502
{
478503
if (channel == OMAP_DSS_CHANNEL_LCD ||
479-
channel == OMAP_DSS_CHANNEL_LCD2)
504+
channel == OMAP_DSS_CHANNEL_LCD2 ||
505+
channel == OMAP_DSS_CHANNEL_LCD3)
480506
return true;
481507
else
482508
return false;
@@ -867,6 +893,15 @@ void dispc_ovl_set_channel_out(enum omap_plane plane, enum omap_channel channel)
867893
chan = 0;
868894
chan2 = 1;
869895
break;
896+
case OMAP_DSS_CHANNEL_LCD3:
897+
if (dss_has_feature(FEAT_MGR_LCD3)) {
898+
chan = 0;
899+
chan2 = 2;
900+
} else {
901+
BUG();
902+
return;
903+
}
904+
break;
870905
default:
871906
BUG();
872907
return;
@@ -902,7 +937,14 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane plane)
902937

903938
val = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane));
904939

905-
if (dss_has_feature(FEAT_MGR_LCD2)) {
940+
if (dss_has_feature(FEAT_MGR_LCD3)) {
941+
if (FLD_GET(val, 31, 30) == 0)
942+
channel = FLD_GET(val, shift, shift);
943+
else if (FLD_GET(val, 31, 30) == 1)
944+
channel = OMAP_DSS_CHANNEL_LCD2;
945+
else
946+
channel = OMAP_DSS_CHANNEL_LCD3;
947+
} else if (dss_has_feature(FEAT_MGR_LCD2)) {
906948
if (FLD_GET(val, 31, 30) == 0)
907949
channel = FLD_GET(val, shift, shift);
908950
else
@@ -3587,6 +3629,8 @@ static void _omap_dispc_initialize_irq(void)
35873629
dispc.irq_error_mask = DISPC_IRQ_MASK_ERROR;
35883630
if (dss_has_feature(FEAT_MGR_LCD2))
35893631
dispc.irq_error_mask |= DISPC_IRQ_SYNC_LOST2;
3632+
if (dss_has_feature(FEAT_MGR_LCD3))
3633+
dispc.irq_error_mask |= DISPC_IRQ_SYNC_LOST3;
35903634
if (dss_feat_get_num_ovls() > 3)
35913635
dispc.irq_error_mask |= DISPC_IRQ_VID3_FIFO_UNDERFLOW;
35923636

‎drivers/video/omap2/dss/dispc.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#define DISPC_CONTROL2 0x0238
3737
#define DISPC_CONFIG2 0x0620
3838
#define DISPC_DIVISOR 0x0804
39+
#define DISPC_CONTROL3 0x0848
40+
#define DISPC_CONFIG3 0x084C
3941

4042
/* DISPC overlay registers */
4143
#define DISPC_OVL_BA0(n) (DISPC_OVL_BASE(n) + \

‎drivers/video/omap2/dss/dss.c‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ void dss_select_lcd_clk_source(enum omap_channel channel,
388388
dsi_wait_pll_hsdiv_dispc_active(dsidev);
389389
break;
390390
case OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC:
391-
BUG_ON(channel != OMAP_DSS_CHANNEL_LCD2);
391+
BUG_ON(channel != OMAP_DSS_CHANNEL_LCD2 &&
392+
channel != OMAP_DSS_CHANNEL_LCD3);
392393
b = 1;
393394
dsidev = dsi_get_dsidev_from_id(1);
394395
dsi_wait_pll_hsdiv_dispc_active(dsidev);
@@ -398,10 +399,12 @@ void dss_select_lcd_clk_source(enum omap_channel channel,
398399
return;
399400
}
400401

401-
pos = channel == OMAP_DSS_CHANNEL_LCD ? 0 : 12;
402+
pos = channel == OMAP_DSS_CHANNEL_LCD ? 0 :
403+
(channel == OMAP_DSS_CHANNEL_LCD2 ? 12 : 19);
402404
REG_FLD_MOD(DSS_CONTROL, b, pos, pos); /* LCDx_CLK_SWITCH */
403405

404-
ix = channel == OMAP_DSS_CHANNEL_LCD ? 0 : 1;
406+
ix = channel == OMAP_DSS_CHANNEL_LCD ? 0 :
407+
(channel == OMAP_DSS_CHANNEL_LCD2 ? 1 : 2);
405408
dss.lcd_clk_source[ix] = clk_src;
406409
}
407410

@@ -418,7 +421,8 @@ enum omap_dss_clk_source dss_get_dsi_clk_source(int dsi_module)
418421
enum omap_dss_clk_source dss_get_lcd_clk_source(enum omap_channel channel)
419422
{
420423
if (dss_has_feature(FEAT_LCD_CLK_SRC)) {
421-
int ix = channel == OMAP_DSS_CHANNEL_LCD ? 0 : 1;
424+
int ix = channel == OMAP_DSS_CHANNEL_LCD ? 0 :
425+
(channel == OMAP_DSS_CHANNEL_LCD2 ? 1 : 2);
422426
return dss.lcd_clk_source[ix];
423427
} else {
424428
/* LCD_CLK source is the same as DISPC_FCLK source for

‎drivers/video/omap2/dss/dss_features.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
#include "ti_hdmi.h"
2525
#endif
2626

27-
#define MAX_DSS_MANAGERS 3
27+
#define MAX_DSS_MANAGERS 4
2828
#define MAX_DSS_OVERLAYS 4
29-
#define MAX_DSS_LCD_MANAGERS 2
29+
#define MAX_DSS_LCD_MANAGERS 3
3030
#define MAX_NUM_DSI 2
3131

3232
/* DSS has feature id */
@@ -36,6 +36,7 @@ enum dss_feat_id {
3636
FEAT_PCKFREEENABLE,
3737
FEAT_FUNCGATED,
3838
FEAT_MGR_LCD2,
39+
FEAT_MGR_LCD3,
3940
FEAT_LINEBUFFERSPLIT,
4041
FEAT_ROWREPEATENABLE,
4142
FEAT_RESIZECONF,

‎drivers/video/omap2/dss/manager.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,10 @@ int dss_init_overlay_managers(struct platform_device *pdev)
541541
mgr->name = "lcd2";
542542
mgr->id = OMAP_DSS_CHANNEL_LCD2;
543543
break;
544+
case 3:
545+
mgr->name = "lcd3";
546+
mgr->id = OMAP_DSS_CHANNEL_LCD3;
547+
break;
544548
}
545549

546550
mgr->set_device = &dss_mgr_set_device;

‎drivers/video/omap2/dss/overlay.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,14 +528,24 @@ void dss_recheck_connections(struct omap_dss_device *dssdev, bool force)
528528
struct omap_overlay_manager *lcd_mgr;
529529
struct omap_overlay_manager *tv_mgr;
530530
struct omap_overlay_manager *lcd2_mgr = NULL;
531+
struct omap_overlay_manager *lcd3_mgr = NULL;
531532
struct omap_overlay_manager *mgr = NULL;
532533

533534
lcd_mgr = omap_dss_get_overlay_manager(OMAP_DSS_CHANNEL_LCD);
534535
tv_mgr = omap_dss_get_overlay_manager(OMAP_DSS_CHANNEL_DIGIT);
536+
if (dss_has_feature(FEAT_MGR_LCD3))
537+
lcd3_mgr = omap_dss_get_overlay_manager(OMAP_DSS_CHANNEL_LCD3);
535538
if (dss_has_feature(FEAT_MGR_LCD2))
536539
lcd2_mgr = omap_dss_get_overlay_manager(OMAP_DSS_CHANNEL_LCD2);
537540

538-
if (dssdev->channel == OMAP_DSS_CHANNEL_LCD2) {
541+
if (dssdev->channel == OMAP_DSS_CHANNEL_LCD3) {
542+
if (!lcd3_mgr->device || force) {
543+
if (lcd3_mgr->device)
544+
lcd3_mgr->unset_device(lcd3_mgr);
545+
lcd3_mgr->set_device(lcd3_mgr, dssdev);
546+
mgr = lcd3_mgr;
547+
}
548+
} else if (dssdev->channel == OMAP_DSS_CHANNEL_LCD2) {
539549
if (!lcd2_mgr->device || force) {
540550
if (lcd2_mgr->device)
541551
lcd2_mgr->unset_device(lcd2_mgr);

‎include/video/omapdss.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
#define DISPC_IRQ_FRAMEDONEWB (1 << 23)
4949
#define DISPC_IRQ_FRAMEDONETV (1 << 24)
5050
#define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
51+
#define DISPC_IRQ_FRAMEDONE3 (1 << 26)
52+
#define DISPC_IRQ_VSYNC3 (1 << 27)
53+
#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 28)
54+
#define DISPC_IRQ_SYNC_LOST3 (1 << 29)
5155

5256
struct omap_dss_device;
5357
struct omap_overlay_manager;

0 commit comments

Comments
 (0)