drivers/mfd/si476x-cmd.c
Source file repositories/reference/linux-study-clean/drivers/mfd/si476x-cmd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/si476x-cmd.c- Extension
.c- Size
- 46812 bytes
- Lines
- 1545
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/completion.hlinux/delay.hlinux/atomic.hlinux/i2c.hlinux/device.hlinux/gpio.hlinux/videodev2.hlinux/mfd/si476x-core.hlinux/unaligned.h
Detected Declarations
enum si476x_acf_status_report_bitsenum si476x_agc_status_report_bitsenum si476x_errorsfunction si476x_core_parse_and_nag_about_errorfunction si476x_core_send_commandfunction si476x_cmd_clear_stcfunction si476x_cmd_tune_seek_freqfunction si476x_core_cmd_func_infofunction si476x_core_cmd_set_propertyfunction si476x_core_cmd_get_propertyfunction si476x_core_cmd_dig_audio_pin_cfgfunction si476x_core_cmd_zif_pin_cfgfunction modefunction si476x_core_cmd_ana_audio_pin_cfgfunction si476x_core_cmd_intb_pin_cfg_a10function si476x_core_cmd_intb_pin_cfg_a20function si476x_core_cmd_am_rsq_statusfunction si476x_core_cmd_fm_acf_statusfunction si476x_core_cmd_am_acf_statusfunction si476x_core_cmd_fm_seek_startfunction si476x_core_cmd_fm_rds_statusfunction si476x_core_cmd_fm_rds_blockcountfunction si476x_core_cmd_fm_phase_diversityfunction si476x_core_cmd_fm_phase_div_statusfunction si476x_core_cmd_am_seek_startfunction si476x_core_cmd_power_up_a10function si476x_core_cmd_power_up_a20function si476x_core_cmd_power_down_a10function si476x_core_cmd_power_down_a20function si476x_core_cmd_am_tune_freq_a10function si476x_core_cmd_am_tune_freq_a20function si476x_core_cmd_fm_rsq_status_a10function si476x_core_cmd_fm_rsq_status_a20function si476x_core_cmd_fm_rsq_status_a30function si476x_core_cmd_fm_tune_freq_a10function si476x_core_cmd_fm_tune_freq_a20function si476x_core_cmd_agc_status_a20function si476x_core_cmd_agc_status_a10function si476x_core_cmd_power_upfunction si476x_core_cmd_power_downfunction si476x_core_cmd_fm_tune_freqfunction si476x_core_cmd_am_tune_freqfunction si476x_core_cmd_fm_rsq_statusfunction si476x_core_cmd_agc_statusfunction si476x_core_cmd_intb_pin_cfgexport si476x_core_cmd_func_infoexport si476x_core_cmd_set_propertyexport si476x_core_cmd_get_property
Annotated Snippet
if (err == sizeof(buffer)) {
switch (buffer[1]) {
case SI476X_ERR_BAD_COMMAND:
cause = "Bad command";
err = -EINVAL;
break;
case SI476X_ERR_BAD_ARG1:
cause = "Bad argument #1";
err = -EINVAL;
break;
case SI476X_ERR_BAD_ARG2:
cause = "Bad argument #2";
err = -EINVAL;
break;
case SI476X_ERR_BAD_ARG3:
cause = "Bad argument #3";
err = -EINVAL;
break;
case SI476X_ERR_BAD_ARG4:
cause = "Bad argument #4";
err = -EINVAL;
break;
case SI476X_ERR_BUSY:
cause = "Chip is busy";
err = -EBUSY;
break;
case SI476X_ERR_BAD_INTERNAL_MEMORY:
cause = "Bad internal memory";
err = -EIO;
break;
case SI476X_ERR_BAD_PATCH:
cause = "Bad patch";
err = -EINVAL;
break;
case SI476X_ERR_BAD_BOOT_MODE:
cause = "Bad boot mode";
err = -EINVAL;
break;
case SI476X_ERR_BAD_PROPERTY:
cause = "Bad property";
err = -EINVAL;
break;
default:
cause = "Unknown";
err = -EIO;
}
dev_err(&core->client->dev,
"[Chip error status]: %s\n", cause);
} else {
dev_err(&core->client->dev,
"Failed to fetch error code\n");
err = (err >= 0) ? -EIO : err;
}
} else {
err = -EIO;
}
return err;
}
/**
* si476x_core_send_command() - sends a command to si476x and waits its
* response
* @core: si476x_device structure for the device we are
* communicating with
* @command: command id
* @args: command arguments we are sending
* @argn: actual size of @args
* @resp: buffer to place the expected response from the device
* @respn: actual size of @resp
* @usecs: amount of time to wait before reading the response (in
* usecs)
*
* Function returns 0 on success and negative error code on
* failure
*/
static int si476x_core_send_command(struct si476x_core *core,
const u8 command,
const u8 args[],
const int argn,
u8 resp[],
const int respn,
const int usecs)
{
struct i2c_client *client = core->client;
int err;
u8 data[CMD_MAX_ARGS_COUNT + 1];
if (argn > CMD_MAX_ARGS_COUNT) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/completion.h`, `linux/delay.h`, `linux/atomic.h`, `linux/i2c.h`, `linux/device.h`, `linux/gpio.h`, `linux/videodev2.h`.
- Detected declarations: `enum si476x_acf_status_report_bits`, `enum si476x_agc_status_report_bits`, `enum si476x_errors`, `function si476x_core_parse_and_nag_about_error`, `function si476x_core_send_command`, `function si476x_cmd_clear_stc`, `function si476x_cmd_tune_seek_freq`, `function si476x_core_cmd_func_info`, `function si476x_core_cmd_set_property`, `function si476x_core_cmd_get_property`.
- 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.
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.