drivers/media/i2c/msp3400-kthreads.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/msp3400-kthreads.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/msp3400-kthreads.c- Extension
.c- Size
- 33510 bytes
- Lines
- 1158
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/i2c.hlinux/freezer.hlinux/videodev2.hmedia/v4l2-common.hmedia/drv-intf/msp3400.hlinux/kthread.hlinux/suspend.hmsp3400-driver.h
Detected Declarations
struct msp3400c_carrier_detectfunction msp_standard_stdfunction msp_set_sourcefunction msp3400c_set_carrierfunction msp3400c_set_modefunction msp3400c_set_audmodefunction msp3400c_print_modefunction msp3400c_detect_stereofunction watch_stereofunction msp3400c_threadfunction msp3410d_threadfunction msp34xxg_modusfunction msp34xxg_set_sourcefunction msp34xxg_set_sourcesfunction msp34xxg_resetfunction msp34xxg_threadfunction msp34xxg_detect_stereofunction msp34xxg_set_audmodefunction msp_set_audmodefunction msp_detect_stereo
Annotated Snippet
struct msp3400c_carrier_detect {
int cdo;
char *name;
};
static struct msp3400c_carrier_detect msp3400c_carrier_detect_main[] = {
/* main carrier */
{ MSP_CARRIER(4.5), "4.5 NTSC" },
{ MSP_CARRIER(5.5), "5.5 PAL B/G" },
{ MSP_CARRIER(6.0), "6.0 PAL I" },
{ MSP_CARRIER(6.5), "6.5 PAL D/K + SAT + SECAM" }
};
static struct msp3400c_carrier_detect msp3400c_carrier_detect_55[] = {
/* PAL B/G */
{ MSP_CARRIER(5.7421875), "5.742 PAL B/G FM-stereo" },
{ MSP_CARRIER(5.85), "5.85 PAL B/G NICAM" }
};
static struct msp3400c_carrier_detect msp3400c_carrier_detect_65[] = {
/* PAL SAT / SECAM */
{ MSP_CARRIER(5.85), "5.85 PAL D/K + SECAM NICAM" },
{ MSP_CARRIER(6.2578125), "6.25 PAL D/K1 FM-stereo" },
{ MSP_CARRIER(6.7421875), "6.74 PAL D/K2 FM-stereo" },
{ MSP_CARRIER(7.02), "7.02 PAL SAT FM-stereo s/b" },
{ MSP_CARRIER(7.20), "7.20 PAL SAT FM-stereo s" },
{ MSP_CARRIER(7.38), "7.38 PAL SAT FM-stereo b" },
};
/* ------------------------------------------------------------------------ */
const char *msp_standard_std_name(int std)
{
int i;
for (i = 0; msp_stdlist[i].name != NULL; i++)
if (msp_stdlist[i].retval == std)
return msp_stdlist[i].name;
return "unknown";
}
static v4l2_std_id msp_standard_std(int std)
{
int i;
for (i = 0; msp_stdlist[i].name != NULL; i++)
if (msp_stdlist[i].retval == std)
return msp_stdlist[i].std;
return V4L2_STD_ALL;
}
static void msp_set_source(struct i2c_client *client, u16 src)
{
struct msp_state *state = to_state(i2c_get_clientdata(client));
if (msp_dolby) {
msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */
msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */
} else {
msp_write_dsp(client, 0x0008, src);
msp_write_dsp(client, 0x0009, src);
}
msp_write_dsp(client, 0x000a, src);
msp_write_dsp(client, 0x000b, src);
msp_write_dsp(client, 0x000c, src);
if (state->has_scart2_out)
msp_write_dsp(client, 0x0041, src);
}
void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2)
{
msp_write_dem(client, 0x0093, cdo1 & 0xfff);
msp_write_dem(client, 0x009b, cdo1 >> 12);
msp_write_dem(client, 0x00a3, cdo2 & 0xfff);
msp_write_dem(client, 0x00ab, cdo2 >> 12);
msp_write_dem(client, 0x0056, 0); /* LOAD_REG_1/2 */
}
void msp3400c_set_mode(struct i2c_client *client, int mode)
{
struct msp_state *state = to_state(i2c_get_clientdata(client));
struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode];
int tuner = (state->route_in >> 3) & 1;
int i;
dev_dbg_lvl(&client->dev, 1, msp_debug, "set_mode: %d\n", mode);
state->mode = mode;
state->rxsubchans = V4L2_TUNER_SUB_MONO;
msp_write_dem(client, 0x00bb, data->ad_cv | (tuner ? 0x100 : 0));
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/i2c.h`, `linux/freezer.h`, `linux/videodev2.h`, `media/v4l2-common.h`, `media/drv-intf/msp3400.h`, `linux/kthread.h`.
- Detected declarations: `struct msp3400c_carrier_detect`, `function msp_standard_std`, `function msp_set_source`, `function msp3400c_set_carrier`, `function msp3400c_set_mode`, `function msp3400c_set_audmode`, `function msp3400c_print_mode`, `function msp3400c_detect_stereo`, `function watch_stereo`, `function msp3400c_thread`.
- 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.