summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-02-10 01:32:14 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-02-10 01:32:14 +0000
commit3363fb571ebc7cd4b16980e232ca5a37e1a4f6cc (patch)
tree4a95d101c3f7e59bf6dd5a9a31706f75e171d1fa /sys
parent13e4073c821ea2f90aeac5f1754e784b2ade1c24 (diff)
drm/radeon/atom: fix bus probes when hw_i2c is set (v2)
From Alex Deucher 66679b83a6f98615b0e715a156a4cea0456eeb41 in ubuntu 3.8 ffd3d3361d583cb73fa65a5fed3a196ba6f261bb in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/radeon/atombios_i2c.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/radeon/atombios_i2c.c b/sys/dev/pci/drm/radeon/atombios_i2c.c
index 9f705d3f2e7..a5fffa95990 100644
--- a/sys/dev/pci/drm/radeon/atombios_i2c.c
+++ b/sys/dev/pci/drm/radeon/atombios_i2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atombios_i2c.c,v 1.3 2014/02/10 01:14:42 jsg Exp $ */
+/* $OpenBSD: atombios_i2c.c,v 1.4 2014/02/10 01:32:13 jsg Exp $ */
/*
* Copyright 2011 Advanced Micro Devices, Inc.
*
@@ -48,7 +48,7 @@ radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
PROCESS_I2C_CHANNEL_TRANSACTION_PS_ALLOCATION args;
int index = GetIndexIntoMasterTable(COMMAND, ProcessI2cChannelTransaction);
unsigned char *base;
- u16 out;
+ u16 out = cpu_to_le16(0);
memset(&args, 0, sizeof(args));
@@ -59,10 +59,14 @@ radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
DRM_ERROR("hw i2c: tried to write too many bytes (%d vs 2)\n", num);
return -EINVAL;
}
- if (num > 1) {
+ if (buf == NULL)
+ args.ucRegIndex = 0;
+ else
+ args.ucRegIndex = buf[0];
+ if (num)
num--;
+ if (num)
memcpy(&out, &buf[1], num);
- }
args.lpI2CDataOut = cpu_to_le16(out);
#if 0
} else {
@@ -100,14 +104,14 @@ int radeon_atom_hw_i2c_xfer(struct i2c_controller *i2c_adap,
struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap);
struct i2c_msg *p;
int i, remaining, current_count, buffer_offset, max_bytes, ret;
- u8 buf = 0, flags;
+ u8 flags;
/* check for bus probe */
p = &msgs[0];
if ((num == 1) && (p->len == 0)) {
ret = radeon_process_i2c_ch(i2c,
p->addr, HW_I2C_WRITE,
- &buf, 1);
+ NULL, 0);
if (ret)
return ret;
else