32 #define CX18_REG_I2C_1_WR 0xf15000
33 #define CX18_REG_I2C_1_RD 0xf15008
34 #define CX18_REG_I2C_2_WR 0xf25100
35 #define CX18_REG_I2C_2_RD 0xf25108
37 #define SETSCL_BIT 0x0001
38 #define SETSDL_BIT 0x0002
39 #define GETSCL_BIT 0x0004
40 #define GETSDL_BIT 0x0008
42 #define CX18_CS5345_I2C_ADDR 0x4c
43 #define CX18_Z8F0811_IR_TX_I2C_ADDR 0x70
44 #define CX18_Z8F0811_IR_RX_I2C_ADDR 0x71
47 static const u8 hw_addrs[] = {
61 static const u8 hw_bus[] = {
74 static const char *
const hw_devicenames[] = {
103 info.platform_data = init_data;
116 const char *type = hw_devicenames[
idx];
125 adap, type, 0, cx->
card_i2c->radio);
129 adap, type, 0, cx->
card_i2c->demod);
136 return sd !=
NULL ? 0 : -1;
140 return cx18_i2c_new_ir(cx, adap, hw, type, hw_addrs[idx]);
151 return sd !=
NULL ? 0 : -1;
171 static void cx18_setscl(
void *
data,
int state)
176 u32 r = cx18_read_reg(cx, addr);
184 static void cx18_setsda(
void *data,
int state)
189 u32 r = cx18_read_reg(cx, addr);
197 static int cx18_getscl(
void *data)
206 static int cx18_getsda(
void *data)
216 static struct i2c_adapter cx18_i2c_adap_template = {
217 .name =
"cx18 i2c driver",
223 #define CX18_SCL_PERIOD (10)
224 #define CX18_ALGO_BIT_TIMEOUT (2)
227 .setsda = cx18_setsda,
228 .setscl = cx18_setscl,
229 .getsda = cx18_getsda,
230 .getscl = cx18_getscl,
241 for (i = 0; i < 2; i++) {
262 cx18_write_reg_expect(cx, 0x10000000, 0xc71004,
263 0x00000000, 0x10001000);
265 cx18_write_reg_expect(cx, 0x10001000, 0xc71024,
266 0x00001000, 0x10001000);
269 cx18_write_reg_expect(cx, 0x00c00000, 0xc7001c, 0x00000000, 0x00c000c0);
271 cx18_write_reg_expect(cx, 0x00c000c0, 0xc7001c, 0x000000c0, 0x00c000c0);
273 cx18_write_reg_expect(cx, 0x00c00000, 0xc7001c, 0x00000000, 0x00c000c0);
277 cx18_write_reg(cx, 0x00c00000, 0xc730c8);
318 for (i = 0; i < 2; i++) {