aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_i2c.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-11-10 21:25:07 -0500
committerDave Airlie <airlied@redhat.com>2009-12-01 20:36:40 -0500
commitfcec570b27a47e428a9bfc8572ae4c7c230d0488 (patch)
tree10cbff0900c7de4b0cd6c83df5cc220d5844b8a9 /drivers/gpu/drm/radeon/radeon_i2c.c
parent9b9fe72488a3a637e0550cc888e3f7a8f70e521e (diff)
drm/radeon/kms: add support for external tmds on legacy boards
This enables initialization of external tmds chips on pre-atom and mac systems. Macs are untested. Also, some macs have single link tmds chips while others have dual link tmds chips. We need to figure out which ones have which. This gets external TMDS working on my RS485 and RV380. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_i2c.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_i2c.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index e97a3912d99f..6c645fb4dad8 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -212,3 +212,59 @@ struct drm_encoder *radeon_best_encoder(struct drm_connector *connector)
212{ 212{
213 return NULL; 213 return NULL;
214} 214}
215
216void radeon_i2c_sw_get_byte(struct radeon_i2c_chan *i2c_bus,
217 u8 slave_addr,
218 u8 addr,
219 u8 *val)
220{
221 u8 out_buf[2];
222 u8 in_buf[2];
223 struct i2c_msg msgs[] = {
224 {
225 .addr = slave_addr,
226 .flags = 0,
227 .len = 1,
228 .buf = out_buf,
229 },
230 {
231 .addr = slave_addr,
232 .flags = I2C_M_RD,
233 .len = 1,
234 .buf = in_buf,
235 }
236 };
237
238 out_buf[0] = addr;
239 out_buf[1] = 0;
240
241 if (i2c_transfer(&i2c_bus->adapter, msgs, 2) == 2) {
242 *val = in_buf[0];
243 DRM_DEBUG("val = 0x%02x\n", *val);
244 } else {
245 DRM_ERROR("i2c 0x%02x 0x%02x read failed\n",
246 addr, *val);
247 }
248}
249
250void radeon_i2c_sw_put_byte(struct radeon_i2c_chan *i2c_bus,
251 u8 slave_addr,
252 u8 addr,
253 u8 val)
254{
255 uint8_t out_buf[2];
256 struct i2c_msg msg = {
257 .addr = slave_addr,
258 .flags = 0,
259 .len = 2,
260 .buf = out_buf,
261 };
262
263 out_buf[0] = addr;
264 out_buf[1] = val;
265
266 if (i2c_transfer(&i2c_bus->adapter, &msg, 1) != 1)
267 DRM_ERROR("i2c 0x%02x 0x%02x write failed\n",
268 addr, val);
269}
270