aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/dss.c71
-rw-r--r--drivers/video/omap2/dss/dss.h1
2 files changed, 47 insertions, 25 deletions
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 57ce428deb04..4f3de3580f53 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -60,7 +60,7 @@ struct dss_reg {
60static struct { 60static struct {
61 struct platform_device *pdev; 61 struct platform_device *pdev;
62 void __iomem *base; 62 void __iomem *base;
63 int ctx_id; 63 int ctx_loss_cnt;
64 64
65 struct clk *dpll4_m4_ck; 65 struct clk *dpll4_m4_ck;
66 struct clk *dss_ick; 66 struct clk *dss_ick;
@@ -665,34 +665,58 @@ void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select hdmi)
665} 665}
666 666
667/* CONTEXT */ 667/* CONTEXT */
668static int dss_get_ctx_id(void) 668static void dss_init_ctx_loss_count(void)
669{ 669{
670 struct omap_display_platform_data *pdata = dss.pdev->dev.platform_data; 670 struct device *dev = &dss.pdev->dev;
671 int r; 671 struct omap_display_platform_data *pdata = dev->platform_data;
672 struct omap_dss_board_info *board_data = pdata->board_data;
673 int cnt = 0;
672 674
673 if (!pdata->board_data->get_last_off_on_transaction_id) 675 /*
674 return 0; 676 * get_context_loss_count returns negative on error. We'll ignore the
675 r = pdata->board_data->get_last_off_on_transaction_id(&dss.pdev->dev); 677 * error and store the error to ctx_loss_cnt, which will cause
676 if (r < 0) { 678 * dss_need_ctx_restore() call to return true.
677 dev_err(&dss.pdev->dev, "getting transaction ID failed, " 679 */
678 "will force context restore\n"); 680
679 r = -1; 681 if (board_data->get_context_loss_count)
680 } 682 cnt = board_data->get_context_loss_count(dev);
681 return r; 683
684 WARN_ON(cnt < 0);
685
686 dss.ctx_loss_cnt = cnt;
687
688 DSSDBG("initial ctx_loss_cnt %u\n", cnt);
682} 689}
683 690
684int dss_need_ctx_restore(void) 691static bool dss_need_ctx_restore(void)
685{ 692{
686 int id = dss_get_ctx_id(); 693 struct device *dev = &dss.pdev->dev;
694 struct omap_display_platform_data *pdata = dev->platform_data;
695 struct omap_dss_board_info *board_data = pdata->board_data;
696 int cnt;
687 697
688 if (id < 0 || id != dss.ctx_id) { 698 /*
689 DSSDBG("ctx id %d -> id %d\n", 699 * If get_context_loss_count is not available, assume that we need
690 dss.ctx_id, id); 700 * context restore always.
691 dss.ctx_id = id; 701 */
692 return 1; 702 if (!board_data->get_context_loss_count)
693 } else { 703 return true;
694 return 0; 704
705 cnt = board_data->get_context_loss_count(dev);
706 if (cnt < 0) {
707 dev_err(dev, "getting context loss count failed, will force "
708 "context restore\n");
709 dss.ctx_loss_cnt = cnt;
710 return true;
695 } 711 }
712
713 if (cnt == dss.ctx_loss_cnt)
714 return false;
715
716 DSSDBG("ctx_loss_cnt %d -> %d\n", dss.ctx_loss_cnt, cnt);
717 dss.ctx_loss_cnt = cnt;
718
719 return true;
696} 720}
697 721
698static void save_all_ctx(void) 722static void save_all_ctx(void)
@@ -1046,8 +1070,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
1046 1070
1047 dss_clk_enable_all_no_ctx(); 1071 dss_clk_enable_all_no_ctx();
1048 1072
1049 dss.ctx_id = dss_get_ctx_id(); 1073 dss_init_ctx_loss_count();
1050 DSSDBG("initial ctx id %u\n", dss.ctx_id);
1051 1074
1052 /* disable LCD and DIGIT output. This seems to fix the synclost 1075 /* disable LCD and DIGIT output. This seems to fix the synclost
1053 * problem that we get, if the bootloader starts the DSS and 1076 * problem that we get, if the bootloader starts the DSS and
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 0283f48450e6..ceafe8a0e917 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -220,7 +220,6 @@ void dss_restore_context(void);
220void dss_clk_enable(enum dss_clock clks); 220void dss_clk_enable(enum dss_clock clks);
221void dss_clk_disable(enum dss_clock clks); 221void dss_clk_disable(enum dss_clock clks);
222unsigned long dss_clk_get_rate(enum dss_clock clk); 222unsigned long dss_clk_get_rate(enum dss_clock clk);
223int dss_need_ctx_restore(void);
224const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); 223const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);
225void dss_dump_clocks(struct seq_file *s); 224void dss_dump_clocks(struct seq_file *s);
226 225