Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

OMAPDSS: Use only "omapdss_dss" platform device to get context lost count

When enabling a hwmod, omap_hwmod refers to the register mentioned in the
hwmod struct's member 'prcm.omap4.context_offs' to see whether context was
lost or not. It increments the context lost count for the hwmod and then clears
the register.

All the DSS hwmods have the same register(RM_DSS_DSS_CONTEXT) as context_offs.
When DSS is enabled, the first hwmod to be enabled is the "dss_core" hwmod since
it's corresponding platform device is the parent platform device("omapdss_dss").
The dss_core hwmod updates it's context lost count correctly and clears the
register. When the hwmods corresponding to the children platform devices are
enabled, they see that the register is clear, and don't increment their context
lost count. Therefore, all the children platform devices never report a loss in
context.

The DISPC driver currently gets the context lost count for DSS power domain from
it's corresponding platform device instance("omapdss_dispc"). The DISPC platform
device is one of the child devices, and it's corresponding hwmod("dss_dispc")
doesn't report the context lost count correctly.

Modify dss_get_ctx_loss_count() such that it always takes the "omapdss_dss"
platform device as it's input, move the function to dss.c so that it has access
to that platform device.

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Archit Taneja and committed by
Tomi Valkeinen
bdb736ab 8f46efad

+19 -18
-15
drivers/video/omap2/dss/core.c
··· 101 101 return reg; 102 102 } 103 103 104 - int dss_get_ctx_loss_count(struct device *dev) 105 - { 106 - struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; 107 - int cnt; 108 - 109 - if (!board_data->get_context_loss_count) 110 - return -ENOENT; 111 - 112 - cnt = board_data->get_context_loss_count(dev); 113 - 114 - WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); 115 - 116 - return cnt; 117 - } 118 - 119 104 int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask) 120 105 { 121 106 struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
+2 -2
drivers/video/omap2/dss/dispc.c
··· 382 382 if (dss_has_feature(FEAT_CORE_CLK_DIV)) 383 383 SR(DIVISOR); 384 384 385 - dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev); 385 + dispc.ctx_loss_cnt = dss_get_ctx_loss_count(); 386 386 dispc.ctx_valid = true; 387 387 388 388 DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); ··· 397 397 if (!dispc.ctx_valid) 398 398 return; 399 399 400 - ctx = dss_get_ctx_loss_count(&dispc.pdev->dev); 400 + ctx = dss_get_ctx_loss_count(); 401 401 402 402 if (ctx >= 0 && ctx == dispc.ctx_loss_cnt) 403 403 return;
+15
drivers/video/omap2/dss/dss.c
··· 154 154 #undef SR 155 155 #undef RR 156 156 157 + int dss_get_ctx_loss_count(void) 158 + { 159 + struct omap_dss_board_info *board_data = dss.pdev->dev.platform_data; 160 + int cnt; 161 + 162 + if (!board_data->get_context_loss_count) 163 + return -ENOENT; 164 + 165 + cnt = board_data->get_context_loss_count(&dss.pdev->dev); 166 + 167 + WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); 168 + 169 + return cnt; 170 + } 171 + 157 172 void dss_sdi_init(int datapairs) 158 173 { 159 174 u32 l;
+2 -1
drivers/video/omap2/dss/dss.h
··· 164 164 struct bus_type *dss_get_bus(void); 165 165 struct regulator *dss_get_vdds_dsi(void); 166 166 struct regulator *dss_get_vdds_sdi(void); 167 - int dss_get_ctx_loss_count(struct device *dev); 168 167 int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask); 169 168 void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask); 170 169 int dss_set_min_bus_tput(struct device *dev, unsigned long tput); ··· 282 283 #if defined(CONFIG_OMAP2_DSS_DEBUGFS) 283 284 void dss_debug_dump_clocks(struct seq_file *s); 284 285 #endif 286 + 287 + int dss_get_ctx_loss_count(void); 285 288 286 289 void dss_sdi_init(int datapairs); 287 290 int dss_sdi_enable(void);