30 #define TARGET_HW_I2C_CLOCK 50
33 #define ATOM_MAX_HW_I2C_WRITE 2
34 #define ATOM_MAX_HW_I2C_READ 255
47 memset(&args, 0,
sizeof(args));
49 base = (
unsigned char *)rdev->
mode_info.atom_context->scratch;
53 DRM_ERROR(
"hw i2c: tried to write too many bytes (%d vs 2)\n", num);
60 DRM_ERROR(
"hw i2c: tried to read too many bytes (%d vs 255)\n", num);
67 args.ucTransBytes = num;
68 args.ucSlaveAddr = slave_addr << 1;
69 args.ucLineNumber = chan->
rec.i2c_id;
75 DRM_DEBUG_KMS(
"hw_i2c error\n");
79 if (!(flags & HW_I2C_WRITE))
90 int i, remaining, current_count, buffer_offset,
max_bytes,
ret;
95 if ((num == 1) && (p->
len == 0)) {
96 ret = radeon_process_i2c_ch(i2c,
105 for (i = 0; i < num; i++) {
118 if (remaining > max_bytes)
121 current_count = remaining;
122 ret = radeon_process_i2c_ch(i2c,
124 &p->
buf[buffer_offset], current_count);
127 remaining -= current_count;
128 buffer_offset += current_count;