Lines Matching +full:enable +full:- +full:remote +full:- +full:sense
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * USB1.1 DVB-T receiver.
9 * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
17 "set debugging level (1=info,xfer=2,rc=4,reg=8,i2c=16,fw=32 (or-able))."
19 /* enable obnoxious led */
22 MODULE_PARM_DESC(led, "enable led (default: 1).");
31 /* remote control decoder */
48 struct af9005_device_state *st = d->priv; in af9005_generic_read_write()
53 err("generic read/write, less than 1 byte. Makes no sense."); in af9005_generic_read_write()
54 return -EINVAL; in af9005_generic_read_write()
58 return -EINVAL; in af9005_generic_read_write()
61 mutex_lock(&d->data_mutex); in af9005_generic_read_write()
62 st->data[0] = 14; /* rest of buffer length low */ in af9005_generic_read_write()
63 st->data[1] = 0; /* rest of buffer length high */ in af9005_generic_read_write()
65 st->data[2] = AF9005_REGISTER_RW; /* register operation */ in af9005_generic_read_write()
66 st->data[3] = 12; /* rest of buffer length */ in af9005_generic_read_write()
68 st->data[4] = seq = st->sequence++; /* sequence number */ in af9005_generic_read_write()
70 st->data[5] = (u8) (reg >> 8); /* register address */ in af9005_generic_read_write()
71 st->data[6] = (u8) (reg & 0xff); in af9005_generic_read_write()
81 AF9005_CMD_BURST | AF9005_CMD_AUTOINC | (len - 1) << 3; in af9005_generic_read_write()
85 st->data[8 + i] = values[i]; in af9005_generic_read_write()
88 st->data[8] = values[0]; in af9005_generic_read_write()
89 st->data[7] = command; in af9005_generic_read_write()
91 ret = dvb_usb_generic_rw(d, st->data, 16, st->data, 17, 0); in af9005_generic_read_write()
96 if (st->data[2] != AF9005_REGISTER_RW_ACK) { in af9005_generic_read_write()
98 ret = -EIO; in af9005_generic_read_write()
101 if (st->data[3] != 0x0d) { in af9005_generic_read_write()
103 ret = -EIO; in af9005_generic_read_write()
106 if (st->data[4] != seq) { in af9005_generic_read_write()
108 ret = -EIO; in af9005_generic_read_write()
113 * identical values for st->data[5] to st->data[8]. in af9005_generic_read_write()
118 if (st->data[16] != 0x01) { in af9005_generic_read_write()
120 ret = -EIO; in af9005_generic_read_write()
126 values[i] = st->data[8 + i]; in af9005_generic_read_write()
129 mutex_unlock(&d->data_mutex); in af9005_generic_read_write()
206 *value = (temp >> pos) & regmask[len - 1]; in af9005_read_register_bits()
223 mask = regmask[len - 1] << pos; in af9005_write_register_bits()
265 done = temp & (regmask[i2c_m_status_wdat_done_len - 1] in af9005_write_tuner_registers()
269 fail = temp & (regmask[i2c_m_status_wdat_fail_len - 1] in af9005_write_tuner_registers()
276 return -ETIMEDOUT; in af9005_write_tuner_registers()
284 return -EIO; in af9005_write_tuner_registers()
334 return -ETIMEDOUT; in af9005_read_tuner_registers()
410 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) in af9005_i2c_xfer()
411 return -EAGAIN; in af9005_i2c_xfer()
426 ret = -EOPNOTSUPP; in af9005_i2c_xfer()
433 ret = af9005_i2c_write(d, addr, reg, value, msg[0].len - 1); in af9005_i2c_xfer()
439 mutex_unlock(&d->i2c_mutex); in af9005_i2c_xfer()
456 struct af9005_device_state *st = d->priv; in af9005_send_command()
462 err("send command, wlen less than 0 bytes. Makes no sense."); in af9005_send_command()
463 return -EINVAL; in af9005_send_command()
467 return -EINVAL; in af9005_send_command()
471 return -EINVAL; in af9005_send_command()
475 mutex_lock(&d->data_mutex); in af9005_send_command()
477 st->data[0] = (u8) (packet_len & 0xff); in af9005_send_command()
478 st->data[1] = (u8) ((packet_len & 0xff00) >> 8); in af9005_send_command()
480 st->data[2] = 0x26; /* packet type */ in af9005_send_command()
481 st->data[3] = wlen + 3; in af9005_send_command()
482 st->data[4] = seq = st->sequence++; in af9005_send_command()
483 st->data[5] = command; in af9005_send_command()
484 st->data[6] = wlen; in af9005_send_command()
486 st->data[7 + i] = wbuf[i]; in af9005_send_command()
487 ret = dvb_usb_generic_rw(d, st->data, wlen + 7, st->data, rlen + 7, 0); in af9005_send_command()
488 if (st->data[2] != 0x27) { in af9005_send_command()
490 ret = -EIO; in af9005_send_command()
491 } else if (st->data[4] != seq) { in af9005_send_command()
493 ret = -EIO; in af9005_send_command()
494 } else if (st->data[5] != 0x01) { in af9005_send_command()
496 ret = -EIO; in af9005_send_command()
497 } else if (st->data[6] != rlen) { in af9005_send_command()
499 ret = -EIO; in af9005_send_command()
503 rbuf[i] = st->data[i + 7]; in af9005_send_command()
506 mutex_unlock(&d->data_mutex); in af9005_send_command()
513 struct af9005_device_state *st = d->priv; in af9005_read_eeprom()
517 mutex_lock(&d->data_mutex); in af9005_read_eeprom()
519 memset(st->data, 0, sizeof(st->data)); in af9005_read_eeprom()
521 st->data[0] = 14; /* length of rest of packet low */ in af9005_read_eeprom()
522 st->data[1] = 0; /* length of rest of packer high */ in af9005_read_eeprom()
524 st->data[2] = 0x2a; /* read/write eeprom */ in af9005_read_eeprom()
526 st->data[3] = 12; /* size */ in af9005_read_eeprom()
528 st->data[4] = seq = st->sequence++; in af9005_read_eeprom()
530 st->data[5] = 0; /* read */ in af9005_read_eeprom()
532 st->data[6] = len; in af9005_read_eeprom()
533 st->data[7] = address; in af9005_read_eeprom()
534 ret = dvb_usb_generic_rw(d, st->data, 16, st->data, 14, 0); in af9005_read_eeprom()
535 if (st->data[2] != 0x2b) { in af9005_read_eeprom()
537 ret = -EIO; in af9005_read_eeprom()
538 } else if (st->data[3] != 10) { in af9005_read_eeprom()
540 ret = -EIO; in af9005_read_eeprom()
541 } else if (st->data[4] != seq) { in af9005_read_eeprom()
543 ret = -EIO; in af9005_read_eeprom()
544 } else if (st->data[5] != 1) { in af9005_read_eeprom()
546 ret = -EIO; in af9005_read_eeprom()
551 values[i] = st->data[6 + i]; in af9005_read_eeprom()
553 mutex_unlock(&d->data_mutex); in af9005_read_eeprom()
603 return -EINVAL; in af9005_boot_packet()
615 ret = act_len != FW_BULKOUT_SIZE + 2 ? -1 : 0; in af9005_boot_packet()
632 return -EIO; in af9005_boot_packet()
636 return -EIO; in af9005_boot_packet()
640 return -EIO; in af9005_boot_packet()
644 return -EIO; in af9005_boot_packet()
650 return -EIO; in af9005_boot_packet()
657 return -EIO; in af9005_boot_packet()
661 return -EIO; in af9005_boot_packet()
665 return -EIO; in af9005_boot_packet()
669 return -EIO; in af9005_boot_packet()
675 return -EIO; in af9005_boot_packet()
682 return -EIO; in af9005_boot_packet()
686 return -EIO; in af9005_boot_packet()
690 return -EIO; in af9005_boot_packet()
694 return -EIO; in af9005_boot_packet()
698 return -EIO; in af9005_boot_packet()
704 return -EIO; in af9005_boot_packet()
722 return -ENOMEM; in af9005_download_firmware()
730 ret = -EIO; in af9005_download_firmware()
733 packets = fw->size / FW_BULKOUT_SIZE; in af9005_download_firmware()
737 memcpy(&buf[2], fw->data + i * FW_BULKOUT_SIZE, in af9005_download_firmware()
755 ret = -EIO; in af9005_download_firmware()
768 ret = -EIO; in af9005_download_firmware()
780 struct af9005_device_state *st = d->priv; in af9005_led_control()
787 if (st->led_state != temp) { in af9005_led_control()
800 st->led_state = temp; in af9005_led_control()
812 what it is done in dvb-usb-init.c. in af9005_frontend_attach()
814 struct usb_device *udev = adap->dev->udev; in af9005_frontend_attach()
820 af9005_read_eeprom(adap->dev, i, buf, 8); in af9005_frontend_attach()
824 adap->fe_adap[0].fe = af9005_fe_attach(adap->dev); in af9005_frontend_attach()
830 struct af9005_device_state *st = d->priv; in af9005_rc_query()
840 mutex_lock(&d->data_mutex); in af9005_rc_query()
843 st->data[0] = 3; /* rest of packet length low */ in af9005_rc_query()
844 st->data[1] = 0; /* rest of packet length high */ in af9005_rc_query()
845 st->data[2] = 0x40; /* read remote */ in af9005_rc_query()
846 st->data[3] = 1; /* rest of packet length */ in af9005_rc_query()
847 st->data[4] = seq = st->sequence++; /* sequence number */ in af9005_rc_query()
848 ret = dvb_usb_generic_rw(d, st->data, 5, st->data, 256, 0); in af9005_rc_query()
853 if (st->data[2] != 0x41) { in af9005_rc_query()
855 ret = -EIO; in af9005_rc_query()
857 } else if (st->data[4] != seq) { in af9005_rc_query()
859 ret = -EIO; in af9005_rc_query()
862 len = st->data[5]; in af9005_rc_query()
865 ret = -EIO; in af9005_rc_query()
870 debug_dump((st->data + 6), len, deb_rc); in af9005_rc_query()
871 ret = rc_decode(d, &st->data[6], len, event, state); in af9005_rc_query()
878 *event = d->last_event; in af9005_rc_query()
883 mutex_unlock(&d->data_mutex); in af9005_rc_query()
899 af9005_write_ofdm_register(adap->dev, XD_MP2IF_DMX_CTRL, 1); in af9005_pid_filter_control()
903 af9005_write_register_bits(adap->dev, in af9005_pid_filter_control()
908 af9005_write_ofdm_register(adap->dev, XD_MP2IF_DMX_CTRL, 1); in af9005_pid_filter_control()
911 af9005_write_ofdm_register(adap->dev, XD_MP2IF_DMX_CTRL, 0); in af9005_pid_filter_control()
928 if (adap->feedcount == 1) { in af9005_pid_filter()
929 deb_info("first pid set, enable pid table\n"); in af9005_pid_filter()
935 af9005_write_ofdm_register(adap->dev, in af9005_pid_filter()
941 af9005_write_ofdm_register(adap->dev, in af9005_pid_filter()
948 if (adap->feedcount == 0) { in af9005_pid_filter()
955 ret = af9005_write_ofdm_register(adap->dev, XD_MP2IF_PID_IDX, cmd); in af9005_pid_filter()
972 return -ENOMEM; in af9005_identify_state()
984 ret = -EIO; in af9005_identify_state()
1040 /* parameter for the MPEG2-data transfer */
1071 {.name = "Afatech DVB-T USB1.1 stick",
1079 {.name = "Ansonic DVB-T USB1.1 stick",
1110 err("af9005_rc_decode function not found, disabling remote"); in af9005_usb_module_init()
1137 MODULE_DESCRIPTION("Driver for Afatech 9005 DVB-T USB1.1 stick");