drivers/media/dvb-frontends/stv6110x.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/stv6110x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/stv6110x.c- Extension
.c- Size
- 13106 bytes
- Lines
- 493
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
linux/init.hlinux/kernel.hlinux/module.hlinux/slab.hlinux/string.hmedia/dvb_frontend.hstv6110x_reg.hstv6110x.hstv6110x_priv.h
Detected Declarations
function stv6110x_read_regfunction stv6110x_write_regsfunction stv6110x_write_regfunction stv6110x_initfunction stv6110x_set_frequencyfunction stv6110x_get_frequencyfunction stv6110x_set_bandwidthfunction stv6110x_get_bandwidthfunction stv6110x_set_refclockfunction stv6110x_get_bbgainfunction stv6110x_set_bbgainfunction stv6110x_set_modefunction stv6110x_sleepfunction stv6110x_get_statusfunction stv6110x_releasefunction st6110x_init_regsfunction stv6110x_setup_dividerfunction stv6110x_set_frontend_optsfunction stv6110x_probefunction stv6110x_removeexport stv6110x_attach
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
STV6110(A) Silicon tuner driver
Copyright (C) Manu Abraham <abraham.manu@gmail.com>
Copyright (C) ST Microelectronics
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <media/dvb_frontend.h>
#include "stv6110x_reg.h"
#include "stv6110x.h"
#include "stv6110x_priv.h"
/* Max transfer size done by I2C transfer functions */
#define MAX_XFER_SIZE 64
static unsigned int verbose;
module_param(verbose, int, 0644);
MODULE_PARM_DESC(verbose, "Set Verbosity level");
static int stv6110x_read_reg(struct stv6110x_state *stv6110x, u8 reg, u8 *data)
{
int ret;
const struct stv6110x_config *config = stv6110x->config;
u8 b0[] = { reg };
u8 b1[] = { 0 };
struct i2c_msg msg[] = {
{ .addr = config->addr, .flags = 0, .buf = b0, .len = 1 },
{ .addr = config->addr, .flags = I2C_M_RD, .buf = b1, .len = 1 }
};
ret = i2c_transfer(stv6110x->i2c, msg, 2);
if (ret != 2) {
dprintk(FE_ERROR, 1, "I/O Error");
return -EREMOTEIO;
}
*data = b1[0];
return 0;
}
static int stv6110x_write_regs(struct stv6110x_state *stv6110x, int start, u8 data[], int len)
{
int ret;
const struct stv6110x_config *config = stv6110x->config;
u8 buf[MAX_XFER_SIZE];
struct i2c_msg msg = {
.addr = config->addr,
.flags = 0,
.buf = buf,
.len = len + 1
};
if (1 + len > sizeof(buf)) {
printk(KERN_WARNING
"%s: i2c wr: len=%d is too big!\n",
KBUILD_MODNAME, len);
return -EINVAL;
}
if (start + len > 8)
return -EINVAL;
buf[0] = start;
memcpy(&buf[1], data, len);
ret = i2c_transfer(stv6110x->i2c, &msg, 1);
if (ret != 1) {
dprintk(FE_ERROR, 1, "I/O Error");
return -EREMOTEIO;
}
return 0;
}
static int stv6110x_write_reg(struct stv6110x_state *stv6110x, u8 reg, u8 data)
{
u8 tmp = data; /* see gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 */
return stv6110x_write_regs(stv6110x, reg, &tmp, 1);
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/string.h`, `media/dvb_frontend.h`, `stv6110x_reg.h`, `stv6110x.h`.
- Detected declarations: `function stv6110x_read_reg`, `function stv6110x_write_regs`, `function stv6110x_write_reg`, `function stv6110x_init`, `function stv6110x_set_frequency`, `function stv6110x_get_frequency`, `function stv6110x_set_bandwidth`, `function stv6110x_get_bandwidth`, `function stv6110x_set_refclock`, `function stv6110x_get_bbgain`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
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.