Lines Matching +full:ext +full:- +full:active +full:- +full:high

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * CIMax2(R) SP2 driver in conjunction with NetUp Dual DVB-S2 CI card
20 bits 31-16
21 +-----------+
23 +-----------+
25 +-------+-------+-------+-------+-------+-------+-------+-------+
27 +-------+-------+-------+-------+-------+-------+-------+-------+
29 +-------+-------+-------+-------+-------+-------+-------+-------+
31 +-------+-------+-------+-------+-------+-------+-------+-------+
106 return -1; in netup_read_i2c()
131 return -EINVAL; in netup_write_i2c()
142 return -1; in netup_write_i2c()
170 struct netup_ci_state *state = en50221->data; in netup_ci_op_cam()
171 struct cx23885_tsport *port = state->priv; in netup_ci_op_cam()
172 struct cx23885_dev *dev = port->dev; in netup_ci_op_cam()
179 return -EINVAL; in netup_ci_op_cam()
181 if (state->current_ci_flag != flag) { in netup_ci_op_cam()
182 ret = netup_read_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_op_cam()
190 ret = netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_op_cam()
195 state->current_ci_flag = flag; in netup_ci_op_cam()
197 mutex_lock(&dev->gpio_lock); in netup_ci_op_cam()
215 (state->ci_i2c_addr == 0x40) ? NETUP_CS0 : NETUP_CS1); in netup_ci_op_cam()
220 mutex_unlock(&dev->gpio_lock); in netup_ci_op_cam()
224 return -EREMOTEIO; in netup_ci_op_cam()
227 (read) ? "read" : "write", state->ci_i2c_addr, addr, in netup_ci_op_cam()
264 struct netup_ci_state *state = en50221->data; in netup_ci_slot_reset()
269 return -EINVAL; in netup_ci_slot_reset()
272 ret = netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_slot_reset()
281 ret = netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_slot_reset()
285 dvb_ca_en50221_camready_irq(&state->ca, 0); in netup_ci_slot_reset()
299 struct netup_ci_state *state = en50221->data; in netup_ci_set_irq()
302 if (irq_mode == state->current_irq_mode) in netup_ci_set_irq()
306 __func__, state->ci_i2c_addr, irq_mode); in netup_ci_set_irq()
307 ret = netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_set_irq()
313 state->current_irq_mode = irq_mode; in netup_ci_set_irq()
320 struct netup_ci_state *state = en50221->data; in netup_ci_slot_ts_ctl()
324 return -EINVAL; in netup_ci_slot_ts_ctl()
326 netup_read_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_slot_ts_ctl()
330 return netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_slot_ts_ctl()
343 dvb_ca_en50221_frda_irq(&state->ca, 0); in netup_read_ci_status()
347 if (time_after(jiffies, state->next_status_checked_time) in netup_read_ci_status()
348 || !state->status) { in netup_read_ci_status()
349 ret = netup_read_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_read_ci_status()
352 state->next_status_checked_time = jiffies in netup_read_ci_status()
359 __func__, state->ci_i2c_addr, 0, buf[0], buf[0]); in netup_read_ci_status()
363 state->status = DVB_CA_EN50221_POLL_CAM_PRESENT | in netup_read_ci_status()
366 state->status = 0; in netup_read_ci_status()
382 port = &dev->ts1; in netup_ci_slot_status()
383 state = port->port_priv; in netup_ci_slot_status()
384 schedule_work(&state->work); in netup_ci_slot_status()
389 port = &dev->ts2; in netup_ci_slot_status()
390 state = port->port_priv; in netup_ci_slot_status()
391 schedule_work(&state->work); in netup_ci_slot_status()
401 struct netup_ci_state *state = en50221->data; in netup_poll_ci_slot_status()
404 return -EINVAL; in netup_poll_ci_slot_status()
409 return state->status; in netup_poll_ci_slot_status()
417 0x00, /* auto select mask high A */ in netup_ci_init()
419 0x00, /* auto select pattern high A */ in netup_ci_init()
426 0x00, /* auto select mask high B */ in netup_ci_init()
428 0x00, /* auto select pattern high B */ in netup_ci_init()
434 0x00, /* auto select mask high Ext */ in netup_ci_init()
435 0x00, /* auto select mask low Ext */ in netup_ci_init()
436 0x00, /* auto select pattern high Ext */ in netup_ci_init()
437 0x00, /* auto select pattern low Ext */ in netup_ci_init()
439 0x02, /* destination - module A */ in netup_ci_init()
444 0x05, /* EXTINT=active-high, INT=push-pull */ in netup_ci_init()
446 0x04, /* ack active low */ in netup_ci_init()
457 ret = -ENOMEM; in netup_ci_init()
461 port->port_priv = state; in netup_ci_init()
463 switch (port->nr) { in netup_ci_init()
465 state->ci_i2c_addr = 0x40; in netup_ci_init()
468 state->ci_i2c_addr = 0x41; in netup_ci_init()
472 state->i2c_adap = &port->dev->i2c_bus[0].i2c_adap; in netup_ci_init()
473 state->ca.owner = THIS_MODULE; in netup_ci_init()
474 state->ca.read_attribute_mem = netup_ci_read_attribute_mem; in netup_ci_init()
475 state->ca.write_attribute_mem = netup_ci_write_attribute_mem; in netup_ci_init()
476 state->ca.read_cam_control = netup_ci_read_cam_ctl; in netup_ci_init()
477 state->ca.write_cam_control = netup_ci_write_cam_ctl; in netup_ci_init()
478 state->ca.slot_reset = netup_ci_slot_reset; in netup_ci_init()
479 state->ca.slot_shutdown = netup_ci_slot_shutdown; in netup_ci_init()
480 state->ca.slot_ts_enable = netup_ci_slot_ts_ctl; in netup_ci_init()
481 state->ca.poll_slot_status = netup_poll_ci_slot_status; in netup_ci_init()
482 state->ca.data = state; in netup_ci_init()
483 state->priv = port; in netup_ci_init()
484 state->current_irq_mode = ci_irq_flags() | NETUP_IRQ_DETAM; in netup_ci_init()
486 ret = netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_init()
489 ret |= netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_init()
492 ret |= netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, in netup_ci_init()
498 ret = dvb_ca_en50221_init(&port->frontends.adapter, in netup_ci_init()
499 &state->ca, in netup_ci_init()
505 INIT_WORK(&state->work, netup_read_ci_status); in netup_ci_init()
506 schedule_work(&state->work); in netup_ci_init()
524 state = (struct netup_ci_state *)port->port_priv; in netup_ci_exit()
528 if (NULL == state->ca.data) in netup_ci_exit()
531 dvb_ca_en50221_release(&state->ca); in netup_ci_exit()