]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
savagefb: rework i2c bit access
authorAntonino A. Daplas <adaplas@gmail.com>
Tue, 8 May 2007 07:38:34 +0000 (00:38 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 8 May 2007 18:15:29 +0000 (11:15 -0700)
Use already defined VGAwCR/VGArCR functions to access the i2c bus.

Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/savage/savagefb-i2c.c

index 8db066ccca6b8ccd314120851f5e9245246199da..35c1ce62b216ac0aeb1ea3fd7cb9d2c1a35b59ca 100644 (file)
 #define SAVAGE4_I2C_SCL_IN     0x00000008
 #define SAVAGE4_I2C_SDA_IN     0x00000010
 
-#define SET_CR_IX(base, val)   writeb((val), base + 0x8000 + VGA_CR_IX)
-#define SET_CR_DATA(base, val) writeb((val), base + 0x8000 + VGA_CR_DATA)
-#define GET_CR_DATA(base)      readb(base + 0x8000 + VGA_CR_DATA)
-
 static void savage4_gpio_setscl(void *data, int val)
 {
        struct savagefb_i2c_chan *chan = data;
@@ -92,15 +88,15 @@ static void prosavage_gpio_setscl(void* data, int val)
        struct savagefb_i2c_chan *chan = data;
        u32                       r;
 
-       SET_CR_IX(chan->ioaddr, chan->reg);
-       r = GET_CR_DATA(chan->ioaddr);
+       r = VGArCR(chan->reg, chan->par);
        r |= PROSAVAGE_I2C_ENAB;
        if (val) {
                r |= PROSAVAGE_I2C_SCL_OUT;
        } else {
                r &= ~PROSAVAGE_I2C_SCL_OUT;
        }
-       SET_CR_DATA(chan->ioaddr, r);
+
+       VGAwCR(chan->reg, r, chan->par);
 }
 
 static void prosavage_gpio_setsda(void* data, int val)
@@ -108,31 +104,29 @@ static void prosavage_gpio_setsda(void* data, int val)
        struct savagefb_i2c_chan *chan = data;
        unsigned int r;
 
-       SET_CR_IX(chan->ioaddr, chan->reg);
-       r = GET_CR_DATA(chan->ioaddr);
+       r = VGArCR(chan->reg, chan->par);
        r |= PROSAVAGE_I2C_ENAB;
        if (val) {
                r |= PROSAVAGE_I2C_SDA_OUT;
        } else {
                r &= ~PROSAVAGE_I2C_SDA_OUT;
        }
-       SET_CR_DATA(chan->ioaddr, r);
+
+       VGAwCR(chan->reg, r, chan->par);
 }
 
 static int prosavage_gpio_getscl(void* data)
 {
        struct savagefb_i2c_chan *chan = data;
 
-       SET_CR_IX(chan->ioaddr, chan->reg);
-       return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN));
+       return (VGArCR(chan->reg, chan->par) & PROSAVAGE_I2C_SCL_IN) ? 1 : 0;
 }
 
 static int prosavage_gpio_getsda(void* data)
 {
        struct savagefb_i2c_chan *chan = data;
 
-       SET_CR_IX(chan->ioaddr, chan->reg);
-       return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN));
+       return (VGArCR(chan->reg, chan->par) & PROSAVAGE_I2C_SDA_IN) ? 1 : 0;
 }
 
 static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,