Skip to content

Commit 28d79f3

Browse files
pinchartltomba
authored andcommitted
drm: omapdrm: dss: Pass omap_dss_device pointer to dss_mgr_*() functions
The dss_mgr_*() functions take a channel argument to identify the channel they operate on. This prevents the functions from accessing driver data structures without resorting to global variables. In an effort to remove global variables, pass the omap_dss_device pointer associated with the channel instead. This will be used to look up the omap_drm_private data structure to pass to the dss_mgr_ops. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
1 parent f81b0fd commit 28d79f3

File tree

8 files changed

+88
-124
lines changed

8 files changed

+88
-124
lines changed

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

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -343,17 +343,15 @@ static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req,
343343

344344
static int dpi_set_mode(struct dpi_data *dpi)
345345
{
346-
struct omap_dss_device *out = &dpi->output;
347-
enum omap_channel channel = out->dispc_channel;
348346
struct videomode *vm = &dpi->vm;
349347
int lck_div = 0, pck_div = 0;
350348
unsigned long fck = 0;
351349
unsigned long pck;
352350
int r = 0;
353351

354352
if (dpi->pll)
355-
r = dpi_set_pll_clk(dpi, channel, vm->pixelclock, &fck,
356-
&lck_div, &pck_div);
353+
r = dpi_set_pll_clk(dpi, dpi->output.dispc_channel,
354+
vm->pixelclock, &fck, &lck_div, &pck_div);
357355
else
358356
r = dpi_set_dispc_clk(dpi, vm->pixelclock, &fck,
359357
&lck_div, &pck_div);
@@ -369,16 +367,13 @@ static int dpi_set_mode(struct dpi_data *dpi)
369367
vm->pixelclock = pck;
370368
}
371369

372-
dss_mgr_set_timings(channel, vm);
370+
dss_mgr_set_timings(&dpi->output, vm);
373371

374372
return 0;
375373
}
376374

377375
static void dpi_config_lcd_manager(struct dpi_data *dpi)
378376
{
379-
struct omap_dss_device *out = &dpi->output;
380-
enum omap_channel channel = out->dispc_channel;
381-
382377
dpi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
383378

384379
dpi->mgr_config.stallmode = false;
@@ -388,14 +383,13 @@ static void dpi_config_lcd_manager(struct dpi_data *dpi)
388383

389384
dpi->mgr_config.lcden_sig_polarity = 0;
390385

391-
dss_mgr_set_lcd_config(channel, &dpi->mgr_config);
386+
dss_mgr_set_lcd_config(&dpi->output, &dpi->mgr_config);
392387
}
393388

394389
static int dpi_display_enable(struct omap_dss_device *dssdev)
395390
{
396391
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
397392
struct omap_dss_device *out = &dpi->output;
398-
enum omap_channel channel = out->dispc_channel;
399393
int r;
400394

401395
mutex_lock(&dpi->lock);
@@ -416,7 +410,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
416410
if (r)
417411
goto err_get_dispc;
418412

419-
r = dss_dpi_select_source(dpi->dss, out->port_num, channel);
413+
r = dss_dpi_select_source(dpi->dss, out->port_num, out->dispc_channel);
420414
if (r)
421415
goto err_src_sel;
422416

@@ -434,7 +428,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
434428

435429
mdelay(2);
436430

437-
r = dss_mgr_enable(channel);
431+
r = dss_mgr_enable(&dpi->output);
438432
if (r)
439433
goto err_mgr_enable;
440434

@@ -461,14 +455,14 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
461455
static void dpi_display_disable(struct omap_dss_device *dssdev)
462456
{
463457
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
464-
enum omap_channel channel = dpi->output.dispc_channel;
465458

466459
mutex_lock(&dpi->lock);
467460

468-
dss_mgr_disable(channel);
461+
dss_mgr_disable(&dpi->output);
469462

470463
if (dpi->pll) {
471-
dss_select_lcd_clk_source(dpi->dss, channel, DSS_CLK_SRC_FCK);
464+
dss_select_lcd_clk_source(dpi->dss, dpi->output.dispc_channel,
465+
DSS_CLK_SRC_FCK);
472466
dss_pll_disable(dpi->pll);
473467
}
474468

@@ -658,7 +652,6 @@ static int dpi_connect(struct omap_dss_device *dssdev,
658652
struct omap_dss_device *dst)
659653
{
660654
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
661-
enum omap_channel channel = dpi->output.dispc_channel;
662655
int r;
663656

664657
r = dpi_init_regulator(dpi);
@@ -667,15 +660,15 @@ static int dpi_connect(struct omap_dss_device *dssdev,
667660

668661
dpi_init_pll(dpi);
669662

670-
r = dss_mgr_connect(channel, dssdev);
663+
r = dss_mgr_connect(&dpi->output, dssdev);
671664
if (r)
672665
return r;
673666

674667
r = omapdss_output_set_device(dssdev, dst);
675668
if (r) {
676669
DSSERR("failed to connect output to new device: %s\n",
677670
dst->name);
678-
dss_mgr_disconnect(channel, dssdev);
671+
dss_mgr_disconnect(&dpi->output, dssdev);
679672
return r;
680673
}
681674

@@ -686,7 +679,6 @@ static void dpi_disconnect(struct omap_dss_device *dssdev,
686679
struct omap_dss_device *dst)
687680
{
688681
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
689-
enum omap_channel channel = dpi->output.dispc_channel;
690682

691683
WARN_ON(dst != dssdev->dst);
692684

@@ -695,7 +687,7 @@ static void dpi_disconnect(struct omap_dss_device *dssdev,
695687

696688
omapdss_output_unset_device(dssdev);
697689

698-
dss_mgr_disconnect(channel, dssdev);
690+
dss_mgr_disconnect(&dpi->output, dssdev);
699691
}
700692

701693
static const struct omapdss_dpi_ops dpi_ops = {

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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,7 +3831,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
38313831
static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
38323832
{
38333833
struct dsi_data *dsi = to_dsi_data(dssdev);
3834-
enum omap_channel dispc_channel = dssdev->dispc_channel;
38353834
int bpp = dsi_get_pixel_size(dsi->pix_fmt);
38363835
struct omap_dss_device *out = &dsi->output;
38373836
u8 data_type;
@@ -3881,7 +3880,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
38813880
dsi_if_enable(dsi, true);
38823881
}
38833882

3884-
r = dss_mgr_enable(dispc_channel);
3883+
r = dss_mgr_enable(&dsi->output);
38853884
if (r)
38863885
goto err_mgr_enable;
38873886

@@ -3901,7 +3900,6 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
39013900
static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
39023901
{
39033902
struct dsi_data *dsi = to_dsi_data(dssdev);
3904-
enum omap_channel dispc_channel = dssdev->dispc_channel;
39053903

39063904
if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
39073905
dsi_if_enable(dsi, false);
@@ -3914,14 +3912,13 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel
39143912
dsi_if_enable(dsi, true);
39153913
}
39163914

3917-
dss_mgr_disable(dispc_channel);
3915+
dss_mgr_disable(&dsi->output);
39183916

39193917
dsi_display_uninit_dispc(dsi);
39203918
}
39213919

39223920
static void dsi_update_screen_dispc(struct dsi_data *dsi)
39233921
{
3924-
enum omap_channel dispc_channel = dsi->output.dispc_channel;
39253922
unsigned int bytespp;
39263923
unsigned int bytespl;
39273924
unsigned int bytespf;
@@ -3983,9 +3980,9 @@ static void dsi_update_screen_dispc(struct dsi_data *dsi)
39833980
msecs_to_jiffies(250));
39843981
BUG_ON(r == 0);
39853982

3986-
dss_mgr_set_timings(dispc_channel, &dsi->vm);
3983+
dss_mgr_set_timings(&dsi->output, &dsi->vm);
39873984

3988-
dss_mgr_start_update(dispc_channel);
3985+
dss_mgr_start_update(&dsi->output);
39893986

39903987
if (dsi->te_enabled) {
39913988
/* disable LP_RX_TO, so that we can receive TE. Time to wait
@@ -4112,7 +4109,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
41124109
DSS_CLK_SRC_PLL2_1);
41134110

41144111
if (dsi->mode == OMAP_DSS_DSI_CMD_MODE) {
4115-
r = dss_mgr_register_framedone_handler(channel,
4112+
r = dss_mgr_register_framedone_handler(&dsi->output,
41164113
dsi_framedone_irq_callback, dsi);
41174114
if (r) {
41184115
DSSERR("can't register FRAMEDONE handler\n");
@@ -4142,7 +4139,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
41424139
dsi->vm.flags &= ~DISPLAY_FLAGS_SYNC_POSEDGE;
41434140
dsi->vm.flags |= DISPLAY_FLAGS_SYNC_NEGEDGE;
41444141

4145-
dss_mgr_set_timings(channel, &dsi->vm);
4142+
dss_mgr_set_timings(&dsi->output, &dsi->vm);
41464143

41474144
r = dsi_configure_dispc_clocks(dsi);
41484145
if (r)
@@ -4153,12 +4150,12 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
41534150
dsi_get_pixel_size(dsi->pix_fmt);
41544151
dsi->mgr_config.lcden_sig_polarity = 0;
41554152

4156-
dss_mgr_set_lcd_config(channel, &dsi->mgr_config);
4153+
dss_mgr_set_lcd_config(&dsi->output, &dsi->mgr_config);
41574154

41584155
return 0;
41594156
err1:
41604157
if (dsi->mode == OMAP_DSS_DSI_CMD_MODE)
4161-
dss_mgr_unregister_framedone_handler(channel,
4158+
dss_mgr_unregister_framedone_handler(&dsi->output,
41624159
dsi_framedone_irq_callback, dsi);
41634160
err:
41644161
dss_select_lcd_clk_source(dsi->dss, channel, DSS_CLK_SRC_FCK);
@@ -4170,7 +4167,7 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi)
41704167
enum omap_channel channel = dsi->output.dispc_channel;
41714168

41724169
if (dsi->mode == OMAP_DSS_DSI_CMD_MODE)
4173-
dss_mgr_unregister_framedone_handler(channel,
4170+
dss_mgr_unregister_framedone_handler(&dsi->output,
41744171
dsi_framedone_irq_callback, dsi);
41754172

41764173
dss_select_lcd_clk_source(dsi->dss, channel, DSS_CLK_SRC_FCK);
@@ -4965,22 +4962,21 @@ static int dsi_connect(struct omap_dss_device *dssdev,
49654962
struct omap_dss_device *dst)
49664963
{
49674964
struct dsi_data *dsi = to_dsi_data(dssdev);
4968-
enum omap_channel dispc_channel = dssdev->dispc_channel;
49694965
int r;
49704966

49714967
r = dsi_regulator_init(dsi);
49724968
if (r)
49734969
return r;
49744970

4975-
r = dss_mgr_connect(dispc_channel, dssdev);
4971+
r = dss_mgr_connect(&dsi->output, dssdev);
49764972
if (r)
49774973
return r;
49784974

49794975
r = omapdss_output_set_device(dssdev, dst);
49804976
if (r) {
49814977
DSSERR("failed to connect output to new device: %s\n",
49824978
dssdev->name);
4983-
dss_mgr_disconnect(dispc_channel, dssdev);
4979+
dss_mgr_disconnect(&dsi->output, dssdev);
49844980
return r;
49854981
}
49864982

@@ -4990,7 +4986,7 @@ static int dsi_connect(struct omap_dss_device *dssdev,
49904986
static void dsi_disconnect(struct omap_dss_device *dssdev,
49914987
struct omap_dss_device *dst)
49924988
{
4993-
enum omap_channel dispc_channel = dssdev->dispc_channel;
4989+
struct dsi_data *dsi = to_dsi_data(dssdev);
49944990

49954991
WARN_ON(dst != dssdev->dst);
49964992

@@ -4999,7 +4995,7 @@ static void dsi_disconnect(struct omap_dss_device *dssdev,
49994995

50004996
omapdss_output_unset_device(dssdev);
50014997

5002-
dss_mgr_disconnect(dispc_channel, dssdev);
4998+
dss_mgr_disconnect(&dsi->output, dssdev);
50034999
}
50045000

50055001
static const struct omapdss_dsi_ops dsi_ops = {

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
177177
{
178178
int r;
179179
struct videomode *vm;
180-
enum omap_channel channel = dssdev->dispc_channel;
181180
struct hdmi_wp_data *wp = &hdmi.wp;
182181
struct dss_pll_clock_info hdmi_cinfo = { 0 };
183182
unsigned int pc;
@@ -231,9 +230,9 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
231230
hdmi4_configure(&hdmi.core, &hdmi.wp, &hdmi.cfg);
232231

233232
/* tv size */
234-
dss_mgr_set_timings(channel, vm);
233+
dss_mgr_set_timings(&hdmi.output, vm);
235234

236-
r = dss_mgr_enable(channel);
235+
r = dss_mgr_enable(&hdmi.output);
237236
if (r)
238237
goto err_mgr_enable;
239238

@@ -247,7 +246,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
247246
return 0;
248247

249248
err_vid_enable:
250-
dss_mgr_disable(channel);
249+
dss_mgr_disable(&hdmi.output);
251250
err_mgr_enable:
252251
hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF);
253252
err_phy_pwr:
@@ -261,13 +260,11 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev)
261260

262261
static void hdmi_power_off_full(struct omap_dss_device *dssdev)
263262
{
264-
enum omap_channel channel = dssdev->dispc_channel;
265-
266263
hdmi_wp_clear_irqenable(&hdmi.wp, ~HDMI_IRQ_CORE);
267264

268265
hdmi_wp_video_stop(&hdmi.wp);
269266

270-
dss_mgr_disable(channel);
267+
dss_mgr_disable(&hdmi.output);
271268

272269
hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF);
273270

@@ -451,22 +448,21 @@ void hdmi4_core_disable(struct omap_dss_device *dssdev)
451448
static int hdmi_connect(struct omap_dss_device *dssdev,
452449
struct omap_dss_device *dst)
453450
{
454-
enum omap_channel channel = dssdev->dispc_channel;
455451
int r;
456452

457453
r = hdmi_init_regulator();
458454
if (r)
459455
return r;
460456

461-
r = dss_mgr_connect(channel, dssdev);
457+
r = dss_mgr_connect(&hdmi.output, dssdev);
462458
if (r)
463459
return r;
464460

465461
r = omapdss_output_set_device(dssdev, dst);
466462
if (r) {
467463
DSSERR("failed to connect output to new device: %s\n",
468464
dst->name);
469-
dss_mgr_disconnect(channel, dssdev);
465+
dss_mgr_disconnect(&hdmi.output, dssdev);
470466
return r;
471467
}
472468

@@ -476,16 +472,14 @@ static int hdmi_connect(struct omap_dss_device *dssdev,
476472
static void hdmi_disconnect(struct omap_dss_device *dssdev,
477473
struct omap_dss_device *dst)
478474
{
479-
enum omap_channel channel = dssdev->dispc_channel;
480-
481475
WARN_ON(dst != dssdev->dst);
482476

483477
if (dst != dssdev->dst)
484478
return;
485479

486480
omapdss_output_unset_device(dssdev);
487481

488-
dss_mgr_disconnect(channel, dssdev);
482+
dss_mgr_disconnect(&hdmi.output, dssdev);
489483
}
490484

491485
static int hdmi_read_edid(struct omap_dss_device *dssdev,

0 commit comments

Comments
 (0)