Skip to content

Commit db6668d

Browse files
morimotoschandinat
authored andcommitted
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>
1 parent e0defc8 commit db6668d

2 files changed

Lines changed: 40 additions & 3 deletions

File tree

‎drivers/video/sh_mobile_hdmi.c‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,45 @@ struct sh_hdmi {
222222
struct delayed_work edid_work;
223223
struct fb_videomode mode;
224224
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);
225229
};
226230

227231
#define entity_to_sh_hdmi(e) container_of(e, struct sh_hdmi, entity)
228232

229-
static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
233+
static void __hdmi_write8(struct sh_hdmi *hdmi, u8 data, u8 reg)
230234
{
231235
iowrite8(data, hdmi->base + reg);
232236
}
233237

234-
static u8 hdmi_read(struct sh_hdmi *hdmi, u8 reg)
238+
static u8 __hdmi_read8(struct sh_hdmi *hdmi, u8 reg)
235239
{
236240
return ioread8(hdmi->base + reg);
237241
}
238242

243+
static 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+
249+
static u8 __hdmi_read32(struct sh_hdmi *hdmi, u8 reg)
250+
{
251+
return (u8)ioread32(hdmi->base + (reg * 4));
252+
}
253+
254+
static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
255+
{
256+
hdmi->write(hdmi, data, reg);
257+
}
258+
259+
static u8 hdmi_read(struct sh_hdmi *hdmi, u8 reg)
260+
{
261+
return hdmi->read(hdmi, reg);
262+
}
263+
239264
static void hdmi_bit_set(struct sh_hdmi *hdmi, u8 mask, u8 data, u8 reg)
240265
{
241266
u8 val = hdmi_read(hdmi, reg);
@@ -1148,6 +1173,15 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
11481173
goto egetclk;
11491174
}
11501175

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+
11511185
/* An arbitrary relaxed pixclock just to get things started: from standard 480p */
11521186
rate = clk_round_rate(hdmi->hdmi_clk, PICOS2KHZ(37037));
11531187
if (rate > 0)

‎include/video/sh_mobile_hdmi.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ struct clk;
1818
/*
1919
* flags format
2020
*
21-
* 0x000000BA
21+
* 0x00000CBA
2222
*
2323
* A: Audio source select
2424
* B: Int output option
25+
* C: Chip specific option
2526
*/
2627

2728
/* Audio source select */
@@ -35,6 +36,8 @@ struct clk;
3536
#define HDMI_OUTPUT_PUSH_PULL (1 << 4) /* System control : output mode */
3637
#define HDMI_OUTPUT_POLARITY_HI (1 << 5) /* System control : output polarity */
3738

39+
/* Chip specific option */
40+
#define HDMI_32BIT_REG (1 << 8)
3841

3942
struct sh_mobile_hdmi_info {
4043
unsigned int flags;

0 commit comments

Comments
 (0)