summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-05-08 00:07:49 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-05-13 09:07:59 -0400
commitdb6668d83a265a15ffd79dbc8432598808b34bb4 (patch)
tree7e0b6aaf31ee2799c6ae8acf074c917591c5de90
parente0defc86423d1b5652826c9317c36dfb6af1cd48 (diff)
fbdev: sh_mobile_hdmi: 32bit register access support
Latest SuperH HDMI allows 32bit access only. But the data is 8bit. So, we can keep compatibility by switching 8/32 bit access. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
-rw-r--r--drivers/video/sh_mobile_hdmi.c38
-rw-r--r--include/video/sh_mobile_hdmi.h5
2 files changed, 40 insertions, 3 deletions
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index 0bc39bc976a8..4d48a805dfe1 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -222,20 +222,45 @@ struct sh_hdmi {
222 struct delayed_work edid_work; 222 struct delayed_work edid_work;
223 struct fb_videomode mode; 223 struct fb_videomode mode;
224 struct fb_monspecs monspec; 224 struct fb_monspecs monspec;
225
226 /* register access functions */
227 void (*write)(struct sh_hdmi *hdmi, u8 data, u8 reg);
228 u8 (*read)(struct sh_hdmi *hdmi, u8 reg);
225}; 229};
226 230
227#define entity_to_sh_hdmi(e) container_of(e, struct sh_hdmi, entity) 231#define entity_to_sh_hdmi(e) container_of(e, struct sh_hdmi, entity)
228 232
229static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg) 233static void __hdmi_write8(struct sh_hdmi *hdmi, u8 data, u8 reg)
230{ 234{
231 iowrite8(data, hdmi->base + reg); 235 iowrite8(data, hdmi->base + reg);
232} 236}
233 237
234static u8 hdmi_read(struct sh_hdmi *hdmi, u8 reg) 238static u8 __hdmi_read8(struct sh_hdmi *hdmi, u8 reg)
235{ 239{
236 return ioread8(hdmi->base + reg); 240 return ioread8(hdmi->base + reg);
237} 241}
238 242
243static void __hdmi_write32(struct sh_hdmi *hdmi, u8 data, u8 reg)
244{
245 iowrite32((u32)data, hdmi->base + (reg * 4));
246 udelay(100);
247}
248
249static u8 __hdmi_read32(struct sh_hdmi *hdmi, u8 reg)
250{
251 return (u8)ioread32(hdmi->base + (reg * 4));
252}
253
254static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
255{
256 hdmi->write(hdmi, data, reg);
257}
258
259static u8 hdmi_read(struct sh_hdmi *hdmi, u8 reg)
260{
261 return hdmi->read(hdmi, reg);
262}
263
239static void hdmi_bit_set(struct sh_hdmi *hdmi, u8 mask, u8 data, u8 reg) 264static void hdmi_bit_set(struct sh_hdmi *hdmi, u8 mask, u8 data, u8 reg)
240{ 265{
241 u8 val = hdmi_read(hdmi, reg); 266 u8 val = hdmi_read(hdmi, reg);
@@ -1148,6 +1173,15 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
1148 goto egetclk; 1173 goto egetclk;
1149 } 1174 }
1150 1175
1176 /* select register access functions */
1177 if (pdata->flags & HDMI_32BIT_REG) {
1178 hdmi->write = __hdmi_write32;
1179 hdmi->read = __hdmi_read32;
1180 } else {
1181 hdmi->write = __hdmi_write8;
1182 hdmi->read = __hdmi_read8;
1183 }
1184
1151 /* An arbitrary relaxed pixclock just to get things started: from standard 480p */ 1185 /* An arbitrary relaxed pixclock just to get things started: from standard 480p */
1152 rate = clk_round_rate(hdmi->hdmi_clk, PICOS2KHZ(37037)); 1186 rate = clk_round_rate(hdmi->hdmi_clk, PICOS2KHZ(37037));
1153 if (rate > 0) 1187 if (rate > 0)
diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h
index 2699635a99ef..ce8a540996c7 100644
--- a/include/video/sh_mobile_hdmi.h
+++ b/include/video/sh_mobile_hdmi.h
@@ -18,10 +18,11 @@ struct clk;
18/* 18/*
19 * flags format 19 * flags format
20 * 20 *
21 * 0x000000BA 21 * 0x00000CBA
22 * 22 *
23 * A: Audio source select 23 * A: Audio source select
24 * B: Int output option 24 * B: Int output option
25 * C: Chip specific option
25 */ 26 */
26 27
27/* Audio source select */ 28/* Audio source select */
@@ -35,6 +36,8 @@ struct clk;
35#define HDMI_OUTPUT_PUSH_PULL (1 << 4) /* System control : output mode */ 36#define HDMI_OUTPUT_PUSH_PULL (1 << 4) /* System control : output mode */
36#define HDMI_OUTPUT_POLARITY_HI (1 << 5) /* System control : output polarity */ 37#define HDMI_OUTPUT_POLARITY_HI (1 << 5) /* System control : output polarity */
37 38
39/* Chip specific option */
40#define HDMI_32BIT_REG (1 << 8)
38 41
39struct sh_mobile_hdmi_info { 42struct sh_mobile_hdmi_info {
40 unsigned int flags; 43 unsigned int flags;