drivers/media/usb/dvb-usb-v2/anysee.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb-v2/anysee.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb-v2/anysee.c- Extension
.c- Size
- 33975 bytes
- Lines
- 1406
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
anysee.hdvb-pll.htda1002x.hmt352.hmt352_priv.hzl10353.htda18212.hcx24116.hstv0900.hstv6110.hisl6423.hcxd2820r.h
Detected Declarations
function anysee_ctrl_msgfunction anysee_read_regfunction anysee_write_regfunction anysee_wr_reg_maskfunction anysee_rd_reg_maskfunction anysee_get_hw_infofunction anysee_streaming_ctrlfunction anysee_led_ctrlfunction anysee_ir_ctrlfunction anysee_master_xferfunction anysee_i2c_funcfunction anysee_mt352_demod_initfunction anysee_read_configfunction anysee_i2c_gate_ctrlfunction anysee_frontend_ctrlfunction anysee_add_i2c_devfunction anysee_del_i2c_devfunction anysee_frontend_attachfunction anysee_tuner_attachfunction anysee_rc_queryfunction anysee_get_rc_configfunction anysee_ci_read_attribute_memfunction anysee_ci_write_attribute_memfunction anysee_ci_read_cam_controlfunction anysee_ci_write_cam_controlfunction anysee_ci_slot_resetfunction anysee_ci_slot_shutdownfunction anysee_ci_slot_ts_enablefunction anysee_ci_poll_slot_statusfunction anysee_ci_initfunction anysee_ci_releasefunction anysee_initfunction anysee_exit
Annotated Snippet
if (ret) {
dev_dbg(&d->udev->dev,
"%s: recv bulk message failed=%d\n",
__func__, ret);
} else {
dev_dbg(&d->udev->dev, "%s: <<< %*ph\n", __func__,
rlen, state->buf);
if (state->buf[63] != 0x4f)
dev_dbg(&d->udev->dev,
"%s: cmd failed\n", __func__);
break;
}
}
if (ret) {
/* all retries failed, it is fatal */
dev_err(&d->udev->dev, "%s: recv bulk message failed=%d\n",
KBUILD_MODNAME, ret);
goto error_unlock;
}
/* read request, copy returned data to return buf */
if (rbuf && rlen)
memcpy(rbuf, state->buf, rlen);
error_unlock:
mutex_unlock(&d->usb_mutex);
return ret;
}
static int anysee_read_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
{
u8 buf[] = {CMD_REG_READ, reg >> 8, reg & 0xff, 0x01};
int ret;
ret = anysee_ctrl_msg(d, buf, sizeof(buf), val, 1);
dev_dbg(&d->udev->dev, "%s: reg=%04x val=%02x\n", __func__, reg, *val);
return ret;
}
static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val)
{
u8 buf[] = {CMD_REG_WRITE, reg >> 8, reg & 0xff, 0x01, val};
dev_dbg(&d->udev->dev, "%s: reg=%04x val=%02x\n", __func__, reg, val);
return anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0);
}
/* write single register with mask */
static int anysee_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
u8 mask)
{
int ret;
u8 tmp;
/* no need for read if whole reg is written */
if (mask != 0xff) {
ret = anysee_read_reg(d, reg, &tmp);
if (ret)
return ret;
val &= mask;
tmp &= ~mask;
val |= tmp;
}
return anysee_write_reg(d, reg, val);
}
/* read single register with mask */
static int anysee_rd_reg_mask(struct dvb_usb_device *d, u16 reg, u8 *val,
u8 mask)
{
int ret, i;
u8 tmp;
ret = anysee_read_reg(d, reg, &tmp);
if (ret)
return ret;
tmp &= mask;
/* find position of the first bit */
for (i = 0; i < 8; i++) {
if ((mask >> i) & 0x01)
break;
}
*val = tmp >> i;
return 0;
}
Annotation
- Immediate include surface: `anysee.h`, `dvb-pll.h`, `tda1002x.h`, `mt352.h`, `mt352_priv.h`, `zl10353.h`, `tda18212.h`, `cx24116.h`.
- Detected declarations: `function anysee_ctrl_msg`, `function anysee_read_reg`, `function anysee_write_reg`, `function anysee_wr_reg_mask`, `function anysee_rd_reg_mask`, `function anysee_get_hw_info`, `function anysee_streaming_ctrl`, `function anysee_led_ctrl`, `function anysee_ir_ctrl`, `function anysee_master_xfer`.
- 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.