aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/via')
-rw-r--r--drivers/video/via/accel.c7
-rw-r--r--drivers/video/via/via_i2c.c27
2 files changed, 28 insertions, 6 deletions
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index e44893ea590d..c2f4e6e166f1 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -283,11 +283,12 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height,
283 writel(tmp, engine + 0x1C); 283 writel(tmp, engine + 0x1C);
284 } 284 }
285 285
286 if (op != VIA_BITBLT_COLOR) 286 if (op == VIA_BITBLT_FILL) {
287 writel(fg_color, engine + 0x58);
288 } else if (op == VIA_BITBLT_MONO) {
287 writel(fg_color, engine + 0x4C); 289 writel(fg_color, engine + 0x4C);
288
289 if (op == VIA_BITBLT_MONO)
290 writel(bg_color, engine + 0x50); 290 writel(bg_color, engine + 0x50);
291 }
291 292
292 if (op == VIA_BITBLT_FILL) 293 if (op == VIA_BITBLT_FILL)
293 ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001; 294 ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001;
diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c
index da9e4ca94b17..021112e279de 100644
--- a/drivers/video/via/via_i2c.c
+++ b/drivers/video/via/via_i2c.c
@@ -114,6 +114,7 @@ static void via_i2c_setsda(void *data, int state)
114 114
115int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata) 115int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata)
116{ 116{
117 int ret;
117 u8 mm1[] = {0x00}; 118 u8 mm1[] = {0x00};
118 struct i2c_msg msgs[2]; 119 struct i2c_msg msgs[2];
119 120
@@ -126,11 +127,18 @@ int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata)
126 mm1[0] = index; 127 mm1[0] = index;
127 msgs[0].len = 1; msgs[1].len = 1; 128 msgs[0].len = 1; msgs[1].len = 1;
128 msgs[0].buf = mm1; msgs[1].buf = pdata; 129 msgs[0].buf = mm1; msgs[1].buf = pdata;
129 return i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); 130 ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2);
131 if (ret == 2)
132 ret = 0;
133 else if (ret >= 0)
134 ret = -EIO;
135
136 return ret;
130} 137}
131 138
132int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data) 139int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data)
133{ 140{
141 int ret;
134 u8 msg[2] = { index, data }; 142 u8 msg[2] = { index, data };
135 struct i2c_msg msgs; 143 struct i2c_msg msgs;
136 144
@@ -140,11 +148,18 @@ int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data)
140 msgs.addr = slave_addr / 2; 148 msgs.addr = slave_addr / 2;
141 msgs.len = 2; 149 msgs.len = 2;
142 msgs.buf = msg; 150 msgs.buf = msg;
143 return i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1); 151 ret = i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1);
152 if (ret == 1)
153 ret = 0;
154 else if (ret >= 0)
155 ret = -EIO;
156
157 return ret;
144} 158}
145 159
146int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len) 160int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len)
147{ 161{
162 int ret;
148 u8 mm1[] = {0x00}; 163 u8 mm1[] = {0x00};
149 struct i2c_msg msgs[2]; 164 struct i2c_msg msgs[2];
150 165
@@ -156,7 +171,13 @@ int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len
156 mm1[0] = index; 171 mm1[0] = index;
157 msgs[0].len = 1; msgs[1].len = buff_len; 172 msgs[0].len = 1; msgs[1].len = buff_len;
158 msgs[0].buf = mm1; msgs[1].buf = buff; 173 msgs[0].buf = mm1; msgs[1].buf = buff;
159 return i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); 174 ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2);
175 if (ret == 2)
176 ret = 0;
177 else if (ret >= 0)
178 ret = -EIO;
179
180 return ret;
160} 181}
161 182
162/* 183/*