drivers/media/dvb-frontends/a8293.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/a8293.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/a8293.c- Extension
.c- Size
- 5827 bytes
- Lines
- 279
- 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
a8293.h
Detected Declarations
struct a8293_devfunction a8293_set_voltage_slewfunction a8293_set_voltage_noslewfunction a8293_set_voltagefunction a8293_probefunction a8293_remove
Annotated Snippet
struct a8293_dev {
struct i2c_client *client;
u8 reg[2];
int volt_slew_nanos_per_mv;
};
/*
* When increasing voltage, do so in minimal steps over time, minimizing
* risk of vIN undervoltage.
*/
static int a8293_set_voltage_slew(struct a8293_dev *dev,
struct i2c_client *client,
enum fe_sec_voltage fe_sec_voltage,
int min_nanos_per_mv)
{
int ret;
u8 reg0, reg1;
int new_volt_idx;
const int idx_to_mv[] = {
0, 12709, 13042, 13375, 14042, 15042, 18042, 18709, 19042
};
const u8 idx_to_reg[] = {
0x00, 0x20, 0x21, 0x22, 0x24, 0x27, 0x28, 0x2A, 0x2B
};
int this_volt_idx;
u8 status;
int prev_volt_idx;
dev_dbg(&client->dev, "set_voltage_slew fe_sec_voltage=%d\n",
fe_sec_voltage);
/* Read status register to clear any stale faults. */
ret = i2c_master_recv(client, &status, 1);
if (ret < 0)
goto err;
/* Determine previous voltage */
switch (dev->reg[0] & 0x2F) {
case 0x00:
prev_volt_idx = 0;
break;
case 0x20:
prev_volt_idx = 1;
break;
case 0x21:
prev_volt_idx = 2;
break;
case 0x22:
prev_volt_idx = 3;
break;
case 0x24:
prev_volt_idx = 4;
break;
case 0x27:
prev_volt_idx = 5;
break;
case 0x28:
prev_volt_idx = 6;
break;
case 0x2A:
prev_volt_idx = 7;
break;
case 0x2B:
prev_volt_idx = 8;
break;
default:
prev_volt_idx = 0;
}
/* Determine new voltage */
switch (fe_sec_voltage) {
case SEC_VOLTAGE_OFF:
new_volt_idx = 0;
break;
case SEC_VOLTAGE_13:
new_volt_idx = 2;
break;
case SEC_VOLTAGE_18:
new_volt_idx = 6;
break;
default:
ret = -EINVAL;
goto err;
}
/* Slew to new voltage if new voltage is greater than current voltage */
this_volt_idx = prev_volt_idx;
if (this_volt_idx < new_volt_idx) {
while (this_volt_idx < new_volt_idx) {
Annotation
- Immediate include surface: `a8293.h`.
- Detected declarations: `struct a8293_dev`, `function a8293_set_voltage_slew`, `function a8293_set_voltage_noslew`, `function a8293_set_voltage`, `function a8293_probe`, `function a8293_remove`.
- 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.