diff options
author | Jerome Glisse <glisse@freedesktop.org> | 2007-07-18 19:07:34 +0200 |
---|---|---|
committer | Jerome Glisse <glisse@freedesktop.org> | 2007-07-18 19:07:34 +0200 |
commit | 559b7019a736c6fff19b63e4c4f3e646f00b5717 (patch) | |
tree | 5085efac4b0e40aa66df1e098c37ad83da81bac2 | |
parent | d779065b5ad8d3b30e4c91c8a3ad8935292e05c1 (diff) |
avivo: push missing bits from last commit.
-rw-r--r-- | xorg/avivo_i2c.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/xorg/avivo_i2c.c b/xorg/avivo_i2c.c index 12979b0..8bc696f 100644 --- a/xorg/avivo_i2c.c +++ b/xorg/avivo_i2c.c @@ -28,3 +28,59 @@ #include "avivo.h" #include "radeon_reg.h" #include <stdint.h> + +void +avivo_i2c_gpio0_get_bits(I2CBusPtr b, int *Clock, int *data) +{ + ScrnInfoPtr screen_info = xf86Screens[b->scrnIndex]; + struct avivo_info *avivo = avivo_get_info(screen_info); + unsigned long val; + + /* Get the result */ + val = INREG(b->DriverPrivate.uval + 0xC); + *Clock = (val & (1<<19)) != 0; + *data = (val & (1<<18)) != 0; +} + +void +avivo_i2c_gpio0_put_bits(I2CBusPtr b, int Clock, int data) +{ + ScrnInfoPtr screen_info = xf86Screens[b->scrnIndex]; + struct avivo_info *avivo = avivo_get_info(screen_info); + unsigned long val; + + val = 0; + val |= (Clock ? 0:(1<<19)); + val |= (data ? 0:(1<<18)); + OUTREG(b->DriverPrivate.uval + 0x8, val); + /* read back to improve reliability on some cards. */ + val = INREG(b->DriverPrivate.uval + 0x8); +} + +void +avivo_i2c_gpio123_get_bits(I2CBusPtr b, int *Clock, int *data) +{ + ScrnInfoPtr screen_info = xf86Screens[b->scrnIndex]; + struct avivo_info *avivo = avivo_get_info(screen_info); + unsigned long val; + + /* Get the result */ + val = INREG(b->DriverPrivate.uval + 0xC); + *Clock = (val & (1<<0)) != 0; + *data = (val & (1<<8)) != 0; +} + +void +avivo_i2c_gpio123_put_bits(I2CBusPtr b, int Clock, int data) +{ + ScrnInfoPtr screen_info = xf86Screens[b->scrnIndex]; + struct avivo_info *avivo = avivo_get_info(screen_info); + unsigned long val; + + val = 0; + val |= (Clock ? 0:(1<<0)); + val |= (data ? 0:(1<<8)); + OUTREG(b->DriverPrivate.uval + 0x8, val); + /* read back to improve reliability on some cards. */ + val = INREG(b->DriverPrivate.uval + 0x8); +} |