Lines Matching refs:s
17 static int sp2_read_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) in sp2_read_i2c() argument
20 struct i2c_client *client = s->client; in sp2_read_i2c()
47 dev_dbg(&s->client->dev, "addr=0x%04x, reg = 0x%02x, data = %02x\n", in sp2_read_i2c()
53 static int sp2_write_i2c(struct sp2 *s, u8 reg, u8 *buf, int len) in sp2_write_i2c() argument
57 struct i2c_client *client = s->client; in sp2_write_i2c()
86 dev_dbg(&s->client->dev, "addr=0x%04x, reg = 0x%02x, data = %*ph\n", in sp2_write_i2c()
95 struct sp2 *s = en50221->data; in sp2_ci_op_cam() local
98 int (*ci_op_cam)(void*, u8, int, u8, int*) = s->ci_control; in sp2_ci_op_cam()
107 if (s->module_access_type != acs) { in sp2_ci_op_cam()
108 ret = sp2_read_i2c(s, 0x00, &store, 1); in sp2_ci_op_cam()
116 ret = sp2_write_i2c(s, 0x00, &store, 1); in sp2_ci_op_cam()
121 s->module_access_type = acs; in sp2_ci_op_cam()
125 ret = ci_op_cam(s->priv, read, addr, data, &mem); in sp2_ci_op_cam()
127 dev_err(&s->client->dev, "callback not defined"); in sp2_ci_op_cam()
134 dev_dbg(&s->client->dev, "%s: slot=%d, addr=0x%04x, %s, data=%x", in sp2_ci_op_cam()
176 struct sp2 *s = en50221->data; in sp2_ci_slot_reset() local
180 dev_dbg(&s->client->dev, "slot: %d\n", slot); in sp2_ci_slot_reset()
187 ret = sp2_write_i2c(s, 0x00, &buf, 1); in sp2_ci_slot_reset()
196 ret = sp2_write_i2c(s, 0x00, &buf, 1); in sp2_ci_slot_reset()
208 struct sp2 *s = en50221->data; in sp2_ci_slot_shutdown() local
210 dev_dbg(&s->client->dev, "slot:%d\n", slot); in sp2_ci_slot_shutdown()
218 struct sp2 *s = en50221->data; in sp2_ci_slot_ts_enable() local
221 dev_dbg(&s->client->dev, "slot:%d\n", slot); in sp2_ci_slot_ts_enable()
226 sp2_read_i2c(s, 0x00, &buf, 1); in sp2_ci_slot_ts_enable()
230 return sp2_write_i2c(s, 0, &buf, 1); in sp2_ci_slot_ts_enable()
236 struct sp2 *s = en50221->data; in sp2_ci_poll_slot_status() local
240 dev_dbg(&s->client->dev, "slot:%d open:%d\n", slot, open); in sp2_ci_poll_slot_status()
246 if (time_after(jiffies, s->next_status_checked_time)) { in sp2_ci_poll_slot_status()
247 ret = sp2_read_i2c(s, 0x00, buf, 1); in sp2_ci_poll_slot_status()
248 s->next_status_checked_time = jiffies + msecs_to_jiffies(1000); in sp2_ci_poll_slot_status()
254 s->status = DVB_CA_EN50221_POLL_CAM_PRESENT | in sp2_ci_poll_slot_status()
257 s->status = 0; in sp2_ci_poll_slot_status()
260 return s->status; in sp2_ci_poll_slot_status()
263 static int sp2_init(struct sp2 *s) in sp2_init() argument
304 dev_dbg(&s->client->dev, "\n"); in sp2_init()
306 s->ca.owner = THIS_MODULE; in sp2_init()
307 s->ca.read_attribute_mem = sp2_ci_read_attribute_mem; in sp2_init()
308 s->ca.write_attribute_mem = sp2_ci_write_attribute_mem; in sp2_init()
309 s->ca.read_cam_control = sp2_ci_read_cam_control; in sp2_init()
310 s->ca.write_cam_control = sp2_ci_write_cam_control; in sp2_init()
311 s->ca.slot_reset = sp2_ci_slot_reset; in sp2_init()
312 s->ca.slot_shutdown = sp2_ci_slot_shutdown; in sp2_init()
313 s->ca.slot_ts_enable = sp2_ci_slot_ts_enable; in sp2_init()
314 s->ca.poll_slot_status = sp2_ci_poll_slot_status; in sp2_init()
315 s->ca.data = s; in sp2_init()
316 s->module_access_type = 0; in sp2_init()
319 ret = sp2_write_i2c(s, 0x00, &cimax_init[0], 34); in sp2_init()
325 ret = sp2_write_i2c(s, 0x1f, &buf, 1); in sp2_init()
330 ret = sp2_write_i2c(s, 0x18, &buf, 1); in sp2_init()
334 ret = dvb_ca_en50221_init(s->dvb_adap, &s->ca, 0, 1); in sp2_init()
341 dev_dbg(&s->client->dev, "init failed=%d\n", ret); in sp2_init()
347 struct sp2 *s; in sp2_exit() local
354 s = i2c_get_clientdata(client); in sp2_exit()
355 if (!s) in sp2_exit()
358 if (!s->ca.data) in sp2_exit()
361 dvb_ca_en50221_release(&s->ca); in sp2_exit()
370 struct sp2 *s; in sp2_probe() local
375 s = kzalloc(sizeof(*s), GFP_KERNEL); in sp2_probe()
376 if (!s) { in sp2_probe()
381 s->client = client; in sp2_probe()
382 s->dvb_adap = cfg->dvb_adap; in sp2_probe()
383 s->priv = cfg->priv; in sp2_probe()
384 s->ci_control = cfg->ci_control; in sp2_probe()
386 i2c_set_clientdata(client, s); in sp2_probe()
388 ret = sp2_init(s); in sp2_probe()
392 dev_info(&s->client->dev, "CIMaX SP2 successfully attached\n"); in sp2_probe()
396 kfree(s); in sp2_probe()
403 struct sp2 *s = i2c_get_clientdata(client); in sp2_remove() local
407 kfree(s); in sp2_remove()