Commit e296927b authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds

nvidiafb: access CRT registers safely

Use Read/WriteCrtc() to access CRTC registers in nv_i2c.c.  These are safer
  because it uses the correct CRTC base (0x3bx or 0x3dx).
Signed-off-by: default avatarAntonino Daplas <adaplas@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b9b2696d
...@@ -30,16 +30,14 @@ static void nvidia_gpio_setscl(void *data, int state) ...@@ -30,16 +30,14 @@ static void nvidia_gpio_setscl(void *data, int state)
struct nvidia_par *par = chan->par; struct nvidia_par *par = chan->par;
u32 val; u32 val;
VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base + 1); val = NVReadCrtc(par, chan->ddc_base + 1) & 0xf0;
val = VGA_RD08(par->PCIO, 0x3d5) & 0xf0;
if (state) if (state)
val |= 0x20; val |= 0x20;
else else
val &= ~0x20; val &= ~0x20;
VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base + 1); NVWriteCrtc(par, chan->ddc_base + 1, val | 0x01);
VGA_WR08(par->PCIO, 0x3d5, val | 0x1);
} }
static void nvidia_gpio_setsda(void *data, int state) static void nvidia_gpio_setsda(void *data, int state)
...@@ -48,16 +46,14 @@ static void nvidia_gpio_setsda(void *data, int state) ...@@ -48,16 +46,14 @@ static void nvidia_gpio_setsda(void *data, int state)
struct nvidia_par *par = chan->par; struct nvidia_par *par = chan->par;
u32 val; u32 val;
VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base + 1); val = NVReadCrtc(par, chan->ddc_base + 1) & 0xf0;
val = VGA_RD08(par->PCIO, 0x3d5) & 0xf0;
if (state) if (state)
val |= 0x10; val |= 0x10;
else else
val &= ~0x10; val &= ~0x10;
VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base + 1); NVWriteCrtc(par, chan->ddc_base + 1, val | 0x01);
VGA_WR08(par->PCIO, 0x3d5, val | 0x1);
} }
static int nvidia_gpio_getscl(void *data) static int nvidia_gpio_getscl(void *data)
...@@ -66,8 +62,7 @@ static int nvidia_gpio_getscl(void *data) ...@@ -66,8 +62,7 @@ static int nvidia_gpio_getscl(void *data)
struct nvidia_par *par = chan->par; struct nvidia_par *par = chan->par;
u32 val = 0; u32 val = 0;
VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base); if (NVReadCrtc(par, chan->ddc_base) & 0x04)
if (VGA_RD08(par->PCIO, 0x3d5) & 0x04)
val = 1; val = 1;
return val; return val;
...@@ -79,8 +74,7 @@ static int nvidia_gpio_getsda(void *data) ...@@ -79,8 +74,7 @@ static int nvidia_gpio_getsda(void *data)
struct nvidia_par *par = chan->par; struct nvidia_par *par = chan->par;
u32 val = 0; u32 val = 0;
VGA_WR08(par->PCIO, 0x3d4, chan->ddc_base); if (NVReadCrtc(par, chan->ddc_base) & 0x08)
if (VGA_RD08(par->PCIO, 0x3d5) & 0x08)
val = 1; val = 1;
return val; return val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment