aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig2
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c21
2 files changed, 6 insertions, 17 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 3b54b3940178..7e2c9774f08f 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1867,7 +1867,7 @@ config FB_W100
1867 1867
1868config FB_SH_MOBILE_LCDC 1868config FB_SH_MOBILE_LCDC
1869 tristate "SuperH Mobile LCDC framebuffer support" 1869 tristate "SuperH Mobile LCDC framebuffer support"
1870 depends on FB && SUPERH 1870 depends on FB && SUPERH && HAVE_CLK
1871 select FB_SYS_FILLRECT 1871 select FB_SYS_FILLRECT
1872 select FB_SYS_COPYAREA 1872 select FB_SYS_COPYAREA
1873 select FB_SYS_IMAGEBLIT 1873 select FB_SYS_IMAGEBLIT
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 07f22b625632..fc3f9662ceae 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -42,11 +42,9 @@ struct sh_mobile_lcdc_chan {
42struct sh_mobile_lcdc_priv { 42struct sh_mobile_lcdc_priv {
43 void __iomem *base; 43 void __iomem *base;
44 int irq; 44 int irq;
45#ifdef CONFIG_HAVE_CLK
46 atomic_t clk_usecnt; 45 atomic_t clk_usecnt;
47 struct clk *dot_clk; 46 struct clk *dot_clk;
48 struct clk *clk; 47 struct clk *clk;
49#endif
50 unsigned long lddckr; 48 unsigned long lddckr;
51 struct sh_mobile_lcdc_chan ch[2]; 49 struct sh_mobile_lcdc_chan ch[2];
52 int started; 50 int started;
@@ -156,6 +154,7 @@ static void lcdc_sys_write_index(void *handle, unsigned long data)
156 lcdc_write(ch->lcdc, _LDDWD0R, data | 0x10000000); 154 lcdc_write(ch->lcdc, _LDDWD0R, data | 0x10000000);
157 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0); 155 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
158 lcdc_write(ch->lcdc, _LDDWAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0)); 156 lcdc_write(ch->lcdc, _LDDWAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
157 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
159} 158}
160 159
161static void lcdc_sys_write_data(void *handle, unsigned long data) 160static void lcdc_sys_write_data(void *handle, unsigned long data)
@@ -165,6 +164,7 @@ static void lcdc_sys_write_data(void *handle, unsigned long data)
165 lcdc_write(ch->lcdc, _LDDWD0R, data | 0x11000000); 164 lcdc_write(ch->lcdc, _LDDWD0R, data | 0x11000000);
166 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0); 165 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
167 lcdc_write(ch->lcdc, _LDDWAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0)); 166 lcdc_write(ch->lcdc, _LDDWAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
167 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
168} 168}
169 169
170static unsigned long lcdc_sys_read_data(void *handle) 170static unsigned long lcdc_sys_read_data(void *handle)
@@ -175,8 +175,9 @@ static unsigned long lcdc_sys_read_data(void *handle)
175 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0); 175 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
176 lcdc_write(ch->lcdc, _LDDRAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0)); 176 lcdc_write(ch->lcdc, _LDDRAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
177 udelay(1); 177 udelay(1);
178 lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
178 179
179 return lcdc_read(ch->lcdc, _LDDRDR) & 0xffff; 180 return lcdc_read(ch->lcdc, _LDDRDR) & 0x3ffff;
180} 181}
181 182
182struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = { 183struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
@@ -185,7 +186,6 @@ struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
185 lcdc_sys_read_data, 186 lcdc_sys_read_data,
186}; 187};
187 188
188#ifdef CONFIG_HAVE_CLK
189static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv) 189static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
190{ 190{
191 if (atomic_inc_and_test(&priv->clk_usecnt)) { 191 if (atomic_inc_and_test(&priv->clk_usecnt)) {
@@ -203,10 +203,6 @@ static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
203 clk_disable(priv->clk); 203 clk_disable(priv->clk);
204 } 204 }
205} 205}
206#else
207static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv) {}
208static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv) {}
209#endif
210 206
211static int sh_mobile_lcdc_sginit(struct fb_info *info, 207static int sh_mobile_lcdc_sginit(struct fb_info *info,
212 struct list_head *pagelist) 208 struct list_head *pagelist)
@@ -520,7 +516,6 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
520 board_cfg = &ch->cfg.board_cfg; 516 board_cfg = &ch->cfg.board_cfg;
521 if (board_cfg->display_off) 517 if (board_cfg->display_off)
522 board_cfg->display_off(board_cfg->board_data); 518 board_cfg->display_off(board_cfg->board_data);
523
524 } 519 }
525 520
526 /* stop the lcdc */ 521 /* stop the lcdc */
@@ -579,9 +574,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
579 int clock_source, 574 int clock_source,
580 struct sh_mobile_lcdc_priv *priv) 575 struct sh_mobile_lcdc_priv *priv)
581{ 576{
582#ifdef CONFIG_HAVE_CLK
583 char clk_name[8]; 577 char clk_name[8];
584#endif
585 char *str; 578 char *str;
586 int icksel; 579 int icksel;
587 580
@@ -595,7 +588,6 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
595 588
596 priv->lddckr = icksel << 16; 589 priv->lddckr = icksel << 16;
597 590
598#ifdef CONFIG_HAVE_CLK
599 atomic_set(&priv->clk_usecnt, -1); 591 atomic_set(&priv->clk_usecnt, -1);
600 snprintf(clk_name, sizeof(clk_name), "lcdc%d", pdev->id); 592 snprintf(clk_name, sizeof(clk_name), "lcdc%d", pdev->id);
601 priv->clk = clk_get(&pdev->dev, clk_name); 593 priv->clk = clk_get(&pdev->dev, clk_name);
@@ -603,7 +595,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
603 dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); 595 dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name);
604 return PTR_ERR(priv->clk); 596 return PTR_ERR(priv->clk);
605 } 597 }
606 598
607 if (str) { 599 if (str) {
608 priv->dot_clk = clk_get(&pdev->dev, str); 600 priv->dot_clk = clk_get(&pdev->dev, str);
609 if (IS_ERR(priv->dot_clk)) { 601 if (IS_ERR(priv->dot_clk)) {
@@ -612,7 +604,6 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
612 return PTR_ERR(priv->dot_clk); 604 return PTR_ERR(priv->dot_clk);
613 } 605 }
614 } 606 }
615#endif
616 607
617 return 0; 608 return 0;
618} 609}
@@ -947,11 +938,9 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
947 framebuffer_release(info); 938 framebuffer_release(info);
948 } 939 }
949 940
950#ifdef CONFIG_HAVE_CLK
951 if (priv->dot_clk) 941 if (priv->dot_clk)
952 clk_put(priv->dot_clk); 942 clk_put(priv->dot_clk);
953 clk_put(priv->clk); 943 clk_put(priv->clk);
954#endif
955 944
956 if (priv->base) 945 if (priv->base)
957 iounmap(priv->base); 946 iounmap(priv->base);