drivers/media/usb/dvb-usb/technisat-usb2.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb/technisat-usb2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb/technisat-usb2.c- Extension
.c- Size
- 20086 bytes
- Lines
- 812
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dvb-usb.hstv6110x.hstv090x.h
Detected Declarations
struct technisat_usb2_stateenum technisat_usb2_led_statefunction technisat_usb2_i2c_accessfunction technisat_usb2_i2c_xferfunction technisat_usb2_i2c_funcfunction technisat_usb2_frontend_resetfunction technisat_usb2_set_ledfunction technisat_usb2_set_led_timerfunction technisat_usb2_green_led_controlfunction technisat_usb2_identify_statefunction technisat_usb2_power_ctrlfunction technisat_usb2_eeprom_dumpfunction technisat_usb2_calc_lrcfunction technisat_usb2_eeprom_lrc_readfunction technisat_usb2_read_mac_addressfunction technisat_usb2_set_voltagefunction technisat_usb2_frontend_attachfunction technisat_usb2_get_irfunction technisat_usb2_rc_queryfunction technisat_usb2_probefunction technisat_usb2_disconnect
Annotated Snippet
struct technisat_usb2_state {
struct dvb_usb_device *dev;
struct delayed_work green_led_work;
u8 power_state;
u16 last_scan_code;
u8 buf[64];
};
/* debug print helpers */
#define deb_info(args...) dprintk(debug, 0x01, args)
#define deb_eeprom(args...) dprintk(debug, 0x02, args)
#define deb_i2c(args...) dprintk(debug, 0x04, args)
#define deb_rc(args...) dprintk(debug, 0x08, args)
/* vendor requests */
#define SET_IFCLK_TO_EXTERNAL_TSCLK_VENDOR_REQUEST 0xB3
#define SET_FRONT_END_RESET_VENDOR_REQUEST 0xB4
#define GET_VERSION_INFO_VENDOR_REQUEST 0xB5
#define SET_GREEN_LED_VENDOR_REQUEST 0xB6
#define SET_RED_LED_VENDOR_REQUEST 0xB7
#define GET_IR_DATA_VENDOR_REQUEST 0xB8
#define SET_LED_TIMER_DIVIDER_VENDOR_REQUEST 0xB9
#define SET_USB_REENUMERATION 0xBA
/* i2c-access methods */
#define I2C_SPEED_100KHZ_BIT 0x40
#define I2C_STATUS_NAK 7
#define I2C_STATUS_OK 8
static int technisat_usb2_i2c_access(struct usb_device *udev,
u8 device_addr, u8 *tx, u8 txlen, u8 *rx, u8 rxlen)
{
u8 *b;
int ret, actual_length;
b = kmalloc(64, GFP_KERNEL);
if (!b)
return -ENOMEM;
deb_i2c("i2c-access: %02x, tx: ", device_addr);
debug_dump(tx, txlen, deb_i2c);
deb_i2c(" ");
if (txlen > 62) {
err("i2c TX buffer can't exceed 62 bytes (dev 0x%02x)",
device_addr);
txlen = 62;
}
if (rxlen > 62) {
err("i2c RX buffer can't exceed 62 bytes (dev 0x%02x)",
device_addr);
rxlen = 62;
}
b[0] = I2C_SPEED_100KHZ_BIT;
b[1] = device_addr << 1;
if (rx != NULL) {
b[0] |= rxlen;
b[1] |= 1;
}
memcpy(&b[2], tx, txlen);
ret = usb_bulk_msg(udev,
usb_sndbulkpipe(udev, 0x01),
b, 2 + txlen,
NULL, 1000);
if (ret < 0) {
err("i2c-error: out failed %02x = %d", device_addr, ret);
goto err;
}
ret = usb_bulk_msg(udev,
usb_rcvbulkpipe(udev, 0x01),
b, 64, &actual_length, 1000);
if (ret < 0) {
err("i2c-error: in failed %02x = %d", device_addr, ret);
goto err;
}
if (b[0] != I2C_STATUS_OK) {
err("i2c-error: %02x = %d", device_addr, b[0]);
/* handle tuner-i2c-nak */
if (!(b[0] == I2C_STATUS_NAK &&
device_addr == 0x60
/* && device_is_technisat_usb2 */))
Annotation
- Immediate include surface: `dvb-usb.h`, `stv6110x.h`, `stv090x.h`.
- Detected declarations: `struct technisat_usb2_state`, `enum technisat_usb2_led_state`, `function technisat_usb2_i2c_access`, `function technisat_usb2_i2c_xfer`, `function technisat_usb2_i2c_func`, `function technisat_usb2_frontend_reset`, `function technisat_usb2_set_led`, `function technisat_usb2_set_led_timer`, `function technisat_usb2_green_led_control`, `function technisat_usb2_identify_state`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.