Lines Matching defs:mst
11 static int dibx000_write_word(struct dibx000_i2c_master *mst, u16 reg, u16 val)
18 .addr = mst->i2c_addr,.flags = 0,.buf = b,.len = 4
20 return i2c_transfer(mst->i2c_adap, &msg, 1) != 1 ? -EREMOTEIO : 0;
24 static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst,
27 if (mst->device_rev > DIB3000MC && mst->selected_interface != intf) {
29 mst->selected_interface = intf;
30 return dibx000_write_word(mst, mst->base_reg + 4, intf);
35 static int dibx000_i2c_gate_ctrl(struct dibx000_i2c_master *mst, u8 tx[4],
46 if (mst->device_rev > DIB7000)
49 tx[0] = (((mst->base_reg + 1) >> 8) & 0xff);
50 tx[1] = ((mst->base_reg + 1) & 0xff);
65 struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap);
71 dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_TUNER);
73 dibx000_i2c_gate_ctrl(mst, tx_open, msg[0].addr, 1);
74 m[0].addr = mst->i2c_addr;
80 dibx000_i2c_gate_ctrl(mst, tx_close, 0, 0);
81 m[num + 1].addr = mst->i2c_addr;
85 return i2c_transfer(mst->i2c_adap, m, 2 + num) == 2 + num ? num : -EIO;
93 struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst,
102 i2c = &mst->gated_tuner_i2c_adap;
114 void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst)
118 struct i2c_msg m = {.addr = mst->i2c_addr,.buf = tx,.len = 4 };
120 dibx000_i2c_gate_ctrl(mst, tx, 0, 0);
121 i2c_transfer(mst->i2c_adap, &m, 1);
122 mst->selected_interface = 0xff; // the first time force a select of the I2C
123 dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_TUNER);
130 struct dibx000_i2c_master *mst)
135 i2c_set_adapdata(i2c_adap, mst);
141 int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev,
147 mst->device_rev = device_rev;
148 mst->i2c_adap = i2c_adap;
149 mst->i2c_addr = i2c_addr >> 1;
152 mst->base_reg = 1024;
154 mst->base_reg = 768;
157 (&mst->gated_tuner_i2c_adap, &dibx000_i2c_gated_tuner_algo,
158 "DiBX000 tuner I2C bus", mst) != 0)
163 dibx000_i2c_gate_ctrl(mst, tx, 0, 0);
170 void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst)
172 i2c_del_adapter(&mst->gated_tuner_i2c_adap);