drivers/mfd/si476x-i2c.c
Source file repositories/reference/linux-study-clean/drivers/mfd/si476x-i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/si476x-i2c.c- Extension
.c- Size
- 22295 bytes
- Lines
- 879
- Domain
- Driver Families
- Bucket
- drivers/mfd
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/module.hlinux/slab.hlinux/interrupt.hlinux/delay.hlinux/gpio.hlinux/regulator/consumer.hlinux/i2c.hlinux/err.hlinux/mfd/si476x-core.h
Detected Declarations
function Copyrightfunction si476x_core_schedule_polling_workfunction si476x_core_startfunction si476x_core_stopfunction si476x_core_set_power_statefunction si476x_core_report_drainer_stopfunction si476x_core_start_rds_drainer_oncefunction si476x_core_drain_rds_fifofunction si476x_core_pronounce_deadfunction si476x_core_i2c_xferfunction si476x_core_get_statusfunction si476x_core_get_and_signal_statusfunction si476x_core_poll_loopfunction si476x_core_interruptfunction si476x_core_fwver_to_revisionfunction si476x_core_get_revision_infofunction si476x_core_has_amfunction si476x_core_has_diversityfunction si476x_core_is_a_secondary_tunerfunction si476x_core_is_a_primary_tunerfunction si476x_core_is_in_am_receiver_modefunction si476x_core_is_powered_upfunction si476x_core_probefunction si476x_core_removeexport si476x_core_startexport si476x_core_stopexport si476x_core_set_power_stateexport si476x_core_i2c_xferexport si476x_core_has_amexport si476x_core_has_diversityexport si476x_core_is_a_secondary_tunerexport si476x_core_is_a_primary_tunerexport si476x_core_is_in_am_receiver_modeexport si476x_core_is_powered_up
Annotated Snippet
if (!client->irq) {
atomic_set(&core->is_alive, 1);
si476x_core_schedule_polling_work(core);
}
} else {
if (client->irq)
enable_irq(client->irq);
else {
atomic_set(&core->is_alive, 1);
si476x_core_schedule_polling_work(core);
}
}
err = si476x_core_cmd_power_up(core,
&core->power_up_parameters);
if (err < 0) {
dev_err(&core->client->dev,
"Power up failure(err = %d)\n",
err);
goto disable_irq;
}
if (client->irq)
atomic_set(&core->is_alive, 1);
err = si476x_core_config_pinmux(core);
if (err < 0) {
dev_err(&core->client->dev,
"Failed to configure pinmux(err = %d)\n",
err);
goto disable_irq;
}
if (client->irq) {
err = regmap_write(core->regmap,
SI476X_PROP_INT_CTL_ENABLE,
SI476X_RDSIEN |
SI476X_STCIEN |
SI476X_CTSIEN);
if (err < 0) {
dev_err(&core->client->dev,
"Failed to configure interrupt sources"
"(err = %d)\n", err);
goto disable_irq;
}
}
return 0;
disable_irq:
if (err == -ENODEV)
atomic_set(&core->is_alive, 0);
if (client->irq)
disable_irq(client->irq);
else
cancel_delayed_work_sync(&core->status_monitor);
if (gpio_is_valid(core->gpio_reset))
gpio_set_value_cansleep(core->gpio_reset, 0);
return err;
}
EXPORT_SYMBOL_GPL(si476x_core_start);
/**
* si476x_core_stop() - chip power-down function
* @core: Core device structure
* @soft: When set, function sends a POWER_DOWN command instead of
* bringing reset line low
*
* Power down the chip by performing following actions:
* 1. Disable IRQ or stop the polling worker
* 2. Send the POWER_DOWN command if the power down is soft or bring
* reset line low if not.
*
* The function returns zero in case of success or negative error code
* otherwise.
*/
int si476x_core_stop(struct si476x_core *core, bool soft)
{
int err = 0;
atomic_set(&core->is_alive, 0);
if (soft) {
/* TODO: This probably shoud be a configurable option,
* so it is possible to have the chips keep their
* oscillators running
*/
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/gpio.h`, `linux/regulator/consumer.h`, `linux/i2c.h`, `linux/err.h`.
- Detected declarations: `function Copyright`, `function si476x_core_schedule_polling_work`, `function si476x_core_start`, `function si476x_core_stop`, `function si476x_core_set_power_state`, `function si476x_core_report_drainer_stop`, `function si476x_core_start_rds_drainer_once`, `function si476x_core_drain_rds_fifo`, `function si476x_core_pronounce_dead`, `function si476x_core_i2c_xfer`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.