Skip to content

Commit 8a7eda7

Browse files
pinchartltomba
authored andcommitted
drm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API functions
This removes the need to access the global DISPC private data in those functions (both for the current accesses and the future ones that will be introduced when allocating the DISPC private data dynamically). Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
1 parent 50638ae commit 8a7eda7

File tree

9 files changed

+133
-110
lines changed

9 files changed

+133
-110
lines changed

drivers/gpu/drm/omapdrm/dss/dispc.c

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
704704
return mgr_desc[channel].sync_lost_irq;
705705
}
706706

707-
u32 dispc_wb_get_framedone_irq(void)
707+
u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
708708
{
709709
return DISPC_IRQ_FRAMEDONEWB;
710710
}
@@ -739,12 +739,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
739739
mgr_fld_write(channel, DISPC_MGR_FLD_GO, 1);
740740
}
741741

742-
bool dispc_wb_go_busy(void)
742+
bool dispc_wb_go_busy(struct dispc_device *dispc)
743743
{
744744
return REG_GET(DISPC_CONTROL2, 6, 6) == 1;
745745
}
746746

747-
void dispc_wb_go(void)
747+
void dispc_wb_go(struct dispc_device *dispc)
748748
{
749749
enum omap_plane_id plane = OMAP_DSS_WB;
750750
bool enable, go;
@@ -1196,7 +1196,8 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane_id plane)
11961196
}
11971197
}
11981198

1199-
void dispc_wb_set_channel_in(enum dss_writeback_channel channel)
1199+
void dispc_wb_set_channel_in(struct dispc_device *dispc,
1200+
enum dss_writeback_channel channel)
12001201
{
12011202
enum omap_plane_id plane = OMAP_DSS_WB;
12021203

@@ -1371,21 +1372,22 @@ static void dispc_init_fifos(void)
13711372
const bool use_fifomerge = false;
13721373
const bool manual_update = false;
13731374

1374-
dispc_ovl_compute_fifo_thresholds(i, &low, &high,
1375+
dispc_ovl_compute_fifo_thresholds(&dispc, i, &low, &high,
13751376
use_fifomerge, manual_update);
13761377

1377-
dispc_ovl_set_fifo_threshold(i, low, high);
1378+
dispc_ovl_set_fifo_threshold(&dispc, i, low, high);
13781379
}
13791380

13801381
if (dispc.feat->has_writeback) {
13811382
u32 low, high;
13821383
const bool use_fifomerge = false;
13831384
const bool manual_update = false;
13841385

1385-
dispc_ovl_compute_fifo_thresholds(OMAP_DSS_WB, &low, &high,
1386-
use_fifomerge, manual_update);
1386+
dispc_ovl_compute_fifo_thresholds(&dispc, OMAP_DSS_WB,
1387+
&low, &high,
1388+
use_fifomerge, manual_update);
13871389

1388-
dispc_ovl_set_fifo_threshold(OMAP_DSS_WB, low, high);
1390+
dispc_ovl_set_fifo_threshold(&dispc, OMAP_DSS_WB, low, high);
13891391
}
13901392
}
13911393

@@ -1402,13 +1404,14 @@ static u32 dispc_ovl_get_fifo_size(enum omap_plane_id plane)
14021404
return size;
14031405
}
14041406

1405-
void dispc_ovl_set_fifo_threshold(enum omap_plane_id plane, u32 low,
1406-
u32 high)
1407+
void dispc_ovl_set_fifo_threshold(struct dispc_device *dispc,
1408+
enum omap_plane_id plane,
1409+
u32 low, u32 high)
14071410
{
14081411
u8 hi_start, hi_end, lo_start, lo_end;
14091412
u32 unit;
14101413

1411-
unit = dispc.feat->buffer_size_unit;
1414+
unit = dispc->feat->buffer_size_unit;
14121415

14131416
WARN_ON(low % unit != 0);
14141417
WARN_ON(high % unit != 0);
@@ -1436,12 +1439,12 @@ void dispc_ovl_set_fifo_threshold(enum omap_plane_id plane, u32 low,
14361439
* large for the preload field, set the threshold to the maximum value
14371440
* that can be held by the preload register
14381441
*/
1439-
if (dispc_has_feature(FEAT_PRELOAD) && dispc.feat->set_max_preload &&
1442+
if (dispc_has_feature(FEAT_PRELOAD) && dispc->feat->set_max_preload &&
14401443
plane != OMAP_DSS_WB)
14411444
dispc_write_reg(DISPC_OVL_PRELOAD(plane), min(high, 0xfffu));
14421445
}
14431446

1444-
void dispc_enable_fifomerge(bool enable)
1447+
void dispc_enable_fifomerge(struct dispc_device *dispc, bool enable)
14451448
{
14461449
if (!dispc_has_feature(FEAT_FIFO_MERGE)) {
14471450
WARN_ON(enable);
@@ -1452,15 +1455,16 @@ void dispc_enable_fifomerge(bool enable)
14521455
REG_FLD_MOD(DISPC_CONFIG, enable ? 1 : 0, 14, 14);
14531456
}
14541457

1455-
void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane,
1456-
u32 *fifo_low, u32 *fifo_high, bool use_fifomerge,
1457-
bool manual_update)
1458+
void dispc_ovl_compute_fifo_thresholds(struct dispc_device *dispc,
1459+
enum omap_plane_id plane,
1460+
u32 *fifo_low, u32 *fifo_high,
1461+
bool use_fifomerge, bool manual_update)
14581462
{
14591463
/*
14601464
* All sizes are in bytes. Both the buffer and burst are made of
14611465
* buffer_units, and the fifo thresholds must be buffer_unit aligned.
14621466
*/
1463-
unsigned int buf_unit = dispc.feat->buffer_size_unit;
1467+
unsigned int buf_unit = dispc->feat->buffer_size_unit;
14641468
unsigned int ovl_fifo_size, total_fifo_size, burst_size;
14651469
int i;
14661470

@@ -1469,7 +1473,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane,
14691473

14701474
if (use_fifomerge) {
14711475
total_fifo_size = 0;
1472-
for (i = 0; i < dispc_get_num_ovls(&dispc); ++i)
1476+
for (i = 0; i < dispc_get_num_ovls(dispc); ++i)
14731477
total_fifo_size += dispc_ovl_get_fifo_size(i);
14741478
} else {
14751479
total_fifo_size = ovl_fifo_size;
@@ -2665,8 +2669,9 @@ static int dispc_ovl_setup(struct dispc_device *dispc,
26652669
return r;
26662670
}
26672671

2668-
int dispc_wb_setup(const struct omap_dss_writeback_info *wi,
2669-
bool mem_to_mem, const struct videomode *vm)
2672+
int dispc_wb_setup(struct dispc_device *dispc,
2673+
const struct omap_dss_writeback_info *wi,
2674+
bool mem_to_mem, const struct videomode *vm)
26702675
{
26712676
int r;
26722677
u32 l;
@@ -2757,15 +2762,15 @@ static void dispc_lcd_enable_signal_polarity(bool act_high)
27572762
REG_FLD_MOD(DISPC_CONTROL, act_high ? 1 : 0, 29, 29);
27582763
}
27592764

2760-
void dispc_lcd_enable_signal(bool enable)
2765+
void dispc_lcd_enable_signal(struct dispc_device *dispc, bool enable)
27612766
{
27622767
if (!dispc_has_feature(FEAT_LCDENABLESIGNAL))
27632768
return;
27642769

27652770
REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 28, 28);
27662771
}
27672772

2768-
void dispc_pck_free_enable(bool enable)
2773+
void dispc_pck_free_enable(struct dispc_device *dispc, bool enable)
27692774
{
27702775
if (!dispc_has_feature(FEAT_PCKFREEENABLE))
27712776
return;
@@ -2904,7 +2909,7 @@ static void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
29042909
dispc_mgr_enable_stallmode(channel, config->stallmode);
29052910
dispc_mgr_enable_fifohandcheck(channel, config->fifohandcheck);
29062911

2907-
dispc_mgr_set_clock_div(channel, &config->clock_info);
2912+
dispc_mgr_set_clock_div(dispc, channel, &config->clock_info);
29082913

29092914
dispc_mgr_set_tft_data_lines(channel, config->video_port_width);
29102915

@@ -2941,7 +2946,8 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel,
29412946
return pclk <= dispc.feat->max_tv_pclk;
29422947
}
29432948

2944-
bool dispc_mgr_timings_ok(enum omap_channel channel, const struct videomode *vm)
2949+
bool dispc_mgr_timings_ok(struct dispc_device *dispc, enum omap_channel channel,
2950+
const struct videomode *vm)
29452951
{
29462952
if (!_dispc_mgr_size_ok(vm->hactive, vm->vactive))
29472953
return false;
@@ -3062,7 +3068,7 @@ static void dispc_mgr_set_timings(struct dispc_device *dispc,
30623068

30633069
DSSDBG("channel %d xres %u yres %u\n", channel, t.hactive, t.vactive);
30643070

3065-
if (!dispc_mgr_timings_ok(channel, &t)) {
3071+
if (!dispc_mgr_timings_ok(dispc, channel, &t)) {
30663072
BUG();
30673073
return;
30683074
}
@@ -3195,9 +3201,9 @@ static unsigned long dispc_mgr_pclk_rate(enum omap_channel channel)
31953201
}
31963202
}
31973203

3198-
void dispc_set_tv_pclk(unsigned long pclk)
3204+
void dispc_set_tv_pclk(struct dispc_device *dispc, unsigned long pclk)
31993205
{
3200-
dispc.tv_pclk_rate = pclk;
3206+
dispc->tv_pclk_rate = pclk;
32013207
}
32023208

32033209
static unsigned long dispc_core_clk_rate(void)
@@ -3249,17 +3255,18 @@ static void dispc_dump_clocks_channel(struct seq_file *s, enum omap_channel chan
32493255
dispc_mgr_pclk_rate(channel), pcd);
32503256
}
32513257

3252-
void dispc_dump_clocks(struct seq_file *s)
3258+
void dispc_dump_clocks(struct dispc_device *dispc, struct seq_file *s)
32533259
{
3260+
enum dss_clk_source dispc_clk_src;
32543261
int lcd;
32553262
u32 l;
3256-
enum dss_clk_source dispc_clk_src = dss_get_dispc_clk_source(dispc.dss);
32573263

3258-
if (dispc_runtime_get(&dispc))
3264+
if (dispc_runtime_get(dispc))
32593265
return;
32603266

32613267
seq_printf(s, "- DISPC -\n");
32623268

3269+
dispc_clk_src = dss_get_dispc_clk_source(dispc->dss);
32633270
seq_printf(s, "dispc fclk source = %s\n",
32643271
dss_get_clk_source_name(dispc_clk_src));
32653272

@@ -3281,7 +3288,7 @@ void dispc_dump_clocks(struct seq_file *s)
32813288
if (dispc_has_feature(FEAT_MGR_LCD3))
32823289
dispc_dump_clocks_channel(s, OMAP_DSS_CHANNEL_LCD3);
32833290

3284-
dispc_runtime_put(&dispc);
3291+
dispc_runtime_put(dispc);
32853292
}
32863293

32873294
static int dispc_dump_regs(struct seq_file *s, void *p)
@@ -3482,8 +3489,9 @@ static int dispc_dump_regs(struct seq_file *s, void *p)
34823489
}
34833490

34843491
/* calculate clock rates using dividers in cinfo */
3485-
int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
3486-
struct dispc_clock_info *cinfo)
3492+
int dispc_calc_clock_rates(struct dispc_device *dispc,
3493+
unsigned long dispc_fclk_rate,
3494+
struct dispc_clock_info *cinfo)
34873495
{
34883496
if (cinfo->lck_div > 255 || cinfo->lck_div == 0)
34893497
return -EINVAL;
@@ -3496,9 +3504,9 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
34963504
return 0;
34973505
}
34983506

3499-
bool dispc_div_calc(unsigned long dispc_freq,
3500-
unsigned long pck_min, unsigned long pck_max,
3501-
dispc_div_calc_func func, void *data)
3507+
bool dispc_div_calc(struct dispc_device *dispc, unsigned long dispc_freq,
3508+
unsigned long pck_min, unsigned long pck_max,
3509+
dispc_div_calc_func func, void *data)
35023510
{
35033511
int lckd, lckd_start, lckd_stop;
35043512
int pckd, pckd_start, pckd_stop;
@@ -3514,10 +3522,10 @@ bool dispc_div_calc(unsigned long dispc_freq,
35143522
min_fck_per_pck = 0;
35153523
#endif
35163524

3517-
pckd_hw_min = dispc.feat->min_pcd;
3525+
pckd_hw_min = dispc->feat->min_pcd;
35183526
pckd_hw_max = 255;
35193527

3520-
lck_max = dss_get_max_fck_rate(dispc.dss);
3528+
lck_max = dss_get_max_fck_rate(dispc->dss);
35213529

35223530
pck_min = pck_min ? pck_min : 1;
35233531
pck_max = pck_max ? pck_max : ULONG_MAX;
@@ -3556,17 +3564,19 @@ bool dispc_div_calc(unsigned long dispc_freq,
35563564
return false;
35573565
}
35583566

3559-
void dispc_mgr_set_clock_div(enum omap_channel channel,
3560-
const struct dispc_clock_info *cinfo)
3567+
void dispc_mgr_set_clock_div(struct dispc_device *dispc,
3568+
enum omap_channel channel,
3569+
const struct dispc_clock_info *cinfo)
35613570
{
35623571
DSSDBG("lck = %lu (%u)\n", cinfo->lck, cinfo->lck_div);
35633572
DSSDBG("pck = %lu (%u)\n", cinfo->pck, cinfo->pck_div);
35643573

35653574
dispc_mgr_set_lcd_divisor(channel, cinfo->lck_div, cinfo->pck_div);
35663575
}
35673576

3568-
int dispc_mgr_get_clock_div(enum omap_channel channel,
3569-
struct dispc_clock_info *cinfo)
3577+
int dispc_mgr_get_clock_div(struct dispc_device *dispc,
3578+
enum omap_channel channel,
3579+
struct dispc_clock_info *cinfo)
35703580
{
35713581
unsigned long fck;
35723582

@@ -3604,12 +3614,12 @@ static void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
36043614
dispc_read_reg(DISPC_IRQENABLE);
36053615
}
36063616

3607-
void dispc_enable_sidle(void)
3617+
void dispc_enable_sidle(struct dispc_device *dispc)
36083618
{
36093619
REG_FLD_MOD(DISPC_SYSCONFIG, 2, 4, 3); /* SIDLEMODE: smart idle */
36103620
}
36113621

3612-
void dispc_disable_sidle(void)
3622+
void dispc_disable_sidle(struct dispc_device *dispc)
36133623
{
36143624
REG_FLD_MOD(DISPC_SYSCONFIG, 1, 4, 3); /* SIDLEMODE: no idle */
36153625
}
@@ -4482,7 +4492,7 @@ static void dispc_errata_i734_wa(void)
44824492

44834493
/* Set up and enable display manager for LCD1 */
44844494
dispc_mgr_setup(&dispc, OMAP_DSS_CHANNEL_LCD, &i734.mgri);
4485-
dispc_calc_clock_rates(dss_get_dispc_clk_rate(dispc.dss),
4495+
dispc_calc_clock_rates(&dispc, dss_get_dispc_clk_rate(dispc.dss),
44864496
&lcd_conf.clock_info);
44874497
dispc_mgr_set_lcd_config(&dispc, OMAP_DSS_CHANNEL_LCD, &lcd_conf);
44884498
dispc_mgr_set_timings(&dispc, OMAP_DSS_CHANNEL_LCD, &i734.vm);

drivers/gpu/drm/omapdrm/dss/dpi.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ static bool dpi_calc_hsdiv_cb(int m_dispc, unsigned long dispc,
191191
ctx->pll_cinfo.mX[ctx->clkout_idx] = m_dispc;
192192
ctx->pll_cinfo.clkout[ctx->clkout_idx] = dispc;
193193

194-
return dispc_div_calc(dispc, ctx->pck_min, ctx->pck_max,
195-
dpi_calc_dispc_cb, ctx);
194+
return dispc_div_calc(ctx->pll->dss->dispc, dispc,
195+
ctx->pck_min, ctx->pck_max,
196+
dpi_calc_dispc_cb, ctx);
196197
}
197198

198199

@@ -218,8 +219,9 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data)
218219

219220
ctx->fck = fck;
220221

221-
return dispc_div_calc(fck, ctx->pck_min, ctx->pck_max,
222-
dpi_calc_dispc_cb, ctx);
222+
return dispc_div_calc(ctx->pll->dss->dispc, fck,
223+
ctx->pck_min, ctx->pck_max,
224+
dpi_calc_dispc_cb, ctx);
223225
}
224226

225227
static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck,
@@ -514,7 +516,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
514516
if (vm->hactive % 8 != 0)
515517
return -EINVAL;
516518

517-
if (!dispc_mgr_timings_ok(channel, vm))
519+
if (!dispc_mgr_timings_ok(dpi->dss->dispc, channel, vm))
518520
return -EINVAL;
519521

520522
if (vm->pixelclock == 0)

0 commit comments

Comments
 (0)