drivers/media/dvb-frontends/rtl2830.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/rtl2830.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/rtl2830.c- Extension
.c- Size
- 20849 bytes
- Lines
- 899
- 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.
- 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
rtl2830_priv.h
Detected Declarations
function Copyrightfunction rtl2830_update_bitsfunction rtl2830_bulk_readfunction rtl2830_initfunction rtl2830_sleepfunction rtl2830_get_tune_settingsfunction rtl2830_set_frontendfunction rtl2830_get_frontendfunction rtl2830_read_statusfunction rtl2830_read_snrfunction rtl2830_read_berfunction rtl2830_read_ucblocksfunction rtl2830_read_signal_strengthfunction rtl2830_pid_filter_ctrlfunction rtl2830_pid_filterfunction __i2c_transferfunction rtl2830_regmap_readfunction rtl2830_regmap_writefunction rtl2830_regmap_gather_writefunction rtl2830_probefunction rtl2830_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Realtek RTL2830 DVB-T demodulator driver
*
* Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
*/
#include "rtl2830_priv.h"
/* Our regmap is bypassing I2C adapter lock, thus we do it! */
static int rtl2830_bulk_write(struct i2c_client *client, unsigned int reg,
const void *val, size_t val_count)
{
struct rtl2830_dev *dev = i2c_get_clientdata(client);
int ret;
i2c_lock_bus(client->adapter, I2C_LOCK_SEGMENT);
ret = regmap_bulk_write(dev->regmap, reg, val, val_count);
i2c_unlock_bus(client->adapter, I2C_LOCK_SEGMENT);
return ret;
}
static int rtl2830_update_bits(struct i2c_client *client, unsigned int reg,
unsigned int mask, unsigned int val)
{
struct rtl2830_dev *dev = i2c_get_clientdata(client);
int ret;
i2c_lock_bus(client->adapter, I2C_LOCK_SEGMENT);
ret = regmap_update_bits(dev->regmap, reg, mask, val);
i2c_unlock_bus(client->adapter, I2C_LOCK_SEGMENT);
return ret;
}
static int rtl2830_bulk_read(struct i2c_client *client, unsigned int reg,
void *val, size_t val_count)
{
struct rtl2830_dev *dev = i2c_get_clientdata(client);
int ret;
i2c_lock_bus(client->adapter, I2C_LOCK_SEGMENT);
ret = regmap_bulk_read(dev->regmap, reg, val, val_count);
i2c_unlock_bus(client->adapter, I2C_LOCK_SEGMENT);
return ret;
}
static int rtl2830_init(struct dvb_frontend *fe)
{
struct i2c_client *client = fe->demodulator_priv;
struct rtl2830_dev *dev = i2c_get_clientdata(client);
struct dtv_frontend_properties *c = &dev->fe.dtv_property_cache;
int ret, i;
struct rtl2830_reg_val_mask tab[] = {
{0x00d, 0x01, 0x03},
{0x00d, 0x10, 0x10},
{0x104, 0x00, 0x1e},
{0x105, 0x80, 0x80},
{0x110, 0x02, 0x03},
{0x110, 0x08, 0x0c},
{0x17b, 0x00, 0x40},
{0x17d, 0x05, 0x0f},
{0x17d, 0x50, 0xf0},
{0x18c, 0x08, 0x0f},
{0x18d, 0x00, 0xc0},
{0x188, 0x05, 0x0f},
{0x189, 0x00, 0xfc},
{0x2d5, 0x02, 0x02},
{0x2f1, 0x02, 0x06},
{0x2f1, 0x20, 0xf8},
{0x16d, 0x00, 0x01},
{0x1a6, 0x00, 0x80},
{0x106, dev->pdata->vtop, 0x3f},
{0x107, dev->pdata->krf, 0x3f},
{0x112, 0x28, 0xff},
{0x103, dev->pdata->agc_targ_val, 0xff},
{0x00a, 0x02, 0x07},
{0x140, 0x0c, 0x3c},
{0x140, 0x40, 0xc0},
{0x15b, 0x05, 0x07},
{0x15b, 0x28, 0x38},
{0x15c, 0x05, 0x07},
{0x15c, 0x28, 0x38},
{0x115, dev->pdata->spec_inv, 0x01},
{0x16f, 0x01, 0x07},
{0x170, 0x18, 0x38},
{0x172, 0x0f, 0x0f},
{0x173, 0x08, 0x38},
{0x175, 0x01, 0x07},
{0x176, 0x00, 0xc0},
};
Annotation
- Immediate include surface: `rtl2830_priv.h`.
- Detected declarations: `function Copyright`, `function rtl2830_update_bits`, `function rtl2830_bulk_read`, `function rtl2830_init`, `function rtl2830_sleep`, `function rtl2830_get_tune_settings`, `function rtl2830_set_frontend`, `function rtl2830_get_frontend`, `function rtl2830_read_status`, `function rtl2830_read_snr`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.