Skip to content

Commit 00928ea

Browse files
committed
OMAPDSS: clean up the omapdss platform data mess
The omapdss pdata handling is a mess. This is more evident when trying to use device tree for DSS, as we don't have platform data anymore in that case. This patch cleans the pdata handling by: - Remove struct omap_display_platform_data. It was used just as a wrapper for struct omap_dss_board_info. - Pass the platform data only to omapdss device. The drivers for omap dss hwmods do not need the platform data. This should also work better for DT, as we can create omapdss device programmatically in generic omap boot code, and thus we can pass the pdata to it. - Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads that the dss hwmod drivers can call. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent e23d83b commit 00928ea

7 files changed

Lines changed: 62 additions & 60 deletions

File tree

‎arch/arm/mach-omap2/display.c‎

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,24 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
191191
struct omap_hwmod *oh;
192192
struct platform_device *pdev;
193193
int i, oh_count;
194-
struct omap_display_platform_data pdata;
195194
const struct omap_dss_hwmod_data *curr_dss_hwmod;
196195

197-
memset(&pdata, 0, sizeof(pdata));
196+
/* create omapdss device */
197+
198+
board_data->dsi_enable_pads = omap_dsi_enable_pads;
199+
board_data->dsi_disable_pads = omap_dsi_disable_pads;
200+
board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
201+
board_data->set_min_bus_tput = omap_dss_set_min_bus_tput;
202+
203+
omap_display_device.dev.platform_data = board_data;
204+
205+
r = platform_device_register(&omap_display_device);
206+
if (r < 0) {
207+
pr_err("Unable to register omapdss device\n");
208+
return r;
209+
}
210+
211+
/* create devices for dss hwmods */
198212

199213
if (cpu_is_omap24xx()) {
200214
curr_dss_hwmod = omap2_dss_hwmod_data;
@@ -207,16 +221,6 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
207221
oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
208222
}
209223

210-
if (board_data->dsi_enable_pads == NULL)
211-
board_data->dsi_enable_pads = omap_dsi_enable_pads;
212-
if (board_data->dsi_disable_pads == NULL)
213-
board_data->dsi_disable_pads = omap_dsi_disable_pads;
214-
215-
pdata.board_data = board_data;
216-
pdata.board_data->get_context_loss_count =
217-
omap_pm_get_dev_context_loss_count;
218-
pdata.board_data->set_min_bus_tput = omap_dss_set_min_bus_tput;
219-
220224
for (i = 0; i < oh_count; i++) {
221225
oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
222226
if (!oh) {
@@ -226,21 +230,16 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
226230
}
227231

228232
pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
229-
curr_dss_hwmod[i].id, oh, &pdata,
230-
sizeof(struct omap_display_platform_data),
233+
curr_dss_hwmod[i].id, oh,
234+
NULL, 0,
231235
NULL, 0, 0);
232236

233237
if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
234238
curr_dss_hwmod[i].oh_name))
235239
return -ENODEV;
236240
}
237-
omap_display_device.dev.platform_data = board_data;
238241

239-
r = platform_device_register(&omap_display_device);
240-
if (r < 0)
241-
printk(KERN_ERR "Unable to register OMAP-Display device\n");
242-
243-
return r;
242+
return 0;
244243
}
245244

246245
static void dispc_disable_outputs(void)

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
8787
return reg;
8888
}
8989

90+
int dss_get_ctx_loss_count(struct device *dev)
91+
{
92+
struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
93+
int cnt;
94+
95+
if (!board_data->get_context_loss_count)
96+
return -ENOENT;
97+
98+
cnt = board_data->get_context_loss_count(dev);
99+
100+
WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt);
101+
102+
return cnt;
103+
}
104+
105+
int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask)
106+
{
107+
struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
108+
109+
if (!board_data->dsi_enable_pads)
110+
return -ENOENT;
111+
112+
return board_data->dsi_enable_pads(dsi_id, lane_mask);
113+
}
114+
115+
void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask)
116+
{
117+
struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
118+
119+
if (!board_data->dsi_enable_pads)
120+
return;
121+
122+
return board_data->dsi_disable_pads(dsi_id, lane_mask);
123+
}
124+
90125
int dss_set_min_bus_tput(struct device *dev, unsigned long tput)
91126
{
92127
struct omap_dss_board_info *pdata = core.pdev->dev.platform_data;

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

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx)
131131
return __raw_readl(dispc.base + idx);
132132
}
133133

134-
static int dispc_get_ctx_loss_count(void)
135-
{
136-
struct device *dev = &dispc.pdev->dev;
137-
struct omap_display_platform_data *pdata = dev->platform_data;
138-
struct omap_dss_board_info *board_data = pdata->board_data;
139-
int cnt;
140-
141-
if (!board_data->get_context_loss_count)
142-
return -ENOENT;
143-
144-
cnt = board_data->get_context_loss_count(dev);
145-
146-
WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt);
147-
148-
return cnt;
149-
}
150-
151134
#define SR(reg) \
152135
dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg)
153136
#define RR(reg) \
@@ -251,7 +234,7 @@ static void dispc_save_context(void)
251234
if (dss_has_feature(FEAT_CORE_CLK_DIV))
252235
SR(DIVISOR);
253236

254-
dispc.ctx_loss_cnt = dispc_get_ctx_loss_count();
237+
dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev);
255238
dispc.ctx_valid = true;
256239

257240
DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt);
@@ -266,7 +249,7 @@ static void dispc_restore_context(void)
266249
if (!dispc.ctx_valid)
267250
return;
268251

269-
ctx = dispc_get_ctx_loss_count();
252+
ctx = dss_get_ctx_loss_count(&dispc.pdev->dev);
270253

271254
if (ctx >= 0 && ctx == dispc.ctx_loss_cnt)
272255
return;

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@ struct dsi_data {
261261
struct clk *dss_clk;
262262
struct clk *sys_clk;
263263

264-
int (*enable_pads)(int dsi_id, unsigned lane_mask);
265-
void (*disable_pads)(int dsi_id, unsigned lane_mask);
266-
267264
struct dsi_clock_info current_cinfo;
268265

269266
bool vdds_dsi_enabled;
@@ -2306,7 +2303,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
23062303

23072304
DSSDBGF();
23082305

2309-
r = dsi->enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
2306+
r = dss_dsi_enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
23102307
if (r)
23112308
return r;
23122309

@@ -2416,21 +2413,20 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
24162413
dsi_cio_disable_lane_override(dsidev);
24172414
err_scp_clk_dom:
24182415
dsi_disable_scp_clk(dsidev);
2419-
dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
2416+
dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
24202417
return r;
24212418
}
24222419

24232420
static void dsi_cio_uninit(struct omap_dss_device *dssdev)
24242421
{
24252422
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
2426-
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
24272423

24282424
/* DDR_CLK_ALWAYS_ON */
24292425
REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13);
24302426

24312427
dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF);
24322428
dsi_disable_scp_clk(dsidev);
2433-
dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
2429+
dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
24342430
}
24352431

24362432
static void dsi_config_tx_fifo(struct platform_device *dsidev,
@@ -4645,8 +4641,6 @@ static void dsi_put_clocks(struct platform_device *dsidev)
46454641
/* DSI1 HW IP initialisation */
46464642
static int omap_dsihw_probe(struct platform_device *dsidev)
46474643
{
4648-
struct omap_display_platform_data *dss_plat_data;
4649-
struct omap_dss_board_info *board_info;
46504644
u32 rev;
46514645
int r, i, dsi_module = dsi_get_dsidev_id(dsidev);
46524646
struct resource *dsi_mem;
@@ -4660,11 +4654,6 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
46604654
dsi_pdev_map[dsi_module] = dsidev;
46614655
dev_set_drvdata(&dsidev->dev, dsi);
46624656

4663-
dss_plat_data = dsidev->dev.platform_data;
4664-
board_info = dss_plat_data->board_data;
4665-
dsi->enable_pads = board_info->dsi_enable_pads;
4666-
dsi->disable_pads = board_info->dsi_disable_pads;
4667-
46684657
spin_lock_init(&dsi->irq_lock);
46694658
spin_lock_init(&dsi->errors_lock);
46704659
dsi->errors = 0;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ struct platform_device;
159159
struct bus_type *dss_get_bus(void);
160160
struct regulator *dss_get_vdds_dsi(void);
161161
struct regulator *dss_get_vdds_sdi(void);
162+
int dss_get_ctx_loss_count(struct device *dev);
163+
int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
164+
void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
162165
int dss_set_min_bus_tput(struct device *dev, unsigned long tput);
163166

164167
/* apply */

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363

6464
static struct {
6565
struct mutex lock;
66-
struct omap_display_platform_data *pdata;
6766
struct platform_device *pdev;
6867
struct hdmi_ip_data ip_data;
6968

@@ -797,7 +796,6 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
797796
struct resource *hdmi_mem;
798797
int r;
799798

800-
hdmi.pdata = pdev->dev.platform_data;
801799
hdmi.pdev = pdev;
802800

803801
mutex_init(&hdmi.lock);

‎include/video/omapdss.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,6 @@ extern int omap_display_init(struct omap_dss_board_info *board_data);
317317
/* HDMI mux init*/
318318
extern int omap_hdmi_init(enum omap_hdmi_flags flags);
319319

320-
struct omap_display_platform_data {
321-
struct omap_dss_board_info *board_data;
322-
/* TODO: Additional members to be added when PM is considered */
323-
};
324-
325320
struct omap_video_timings {
326321
/* Unit: pixels */
327322
u16 x_res;

0 commit comments

Comments
 (0)