drivers/media/dvb-frontends/lgs8gxx.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/lgs8gxx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/lgs8gxx.c- Extension
.c- Size
- 23307 bytes
- Lines
- 1052
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- 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
asm/div64.hlinux/firmware.hmedia/dvb_frontend.hlgs8gxx.hlgs8gxx_priv.h
Detected Declarations
function lgs8gxx_write_regfunction lgs8gxx_read_regfunction lgs8gxx_soft_resetfunction wait_reg_maskfunction lgs8gxx_set_ad_modefunction lgs8gxx_set_if_freqfunction lgs8gxx_get_afc_phasefunction lgs8gxx_set_mode_autofunction lgs8gxx_set_mode_manualfunction lgs8gxx_is_lockedfunction lgs8gxx_wait_ca_lockfunction lgs8gxx_is_autodetect_finishedfunction lgs8gxx_autolock_gifunction lgs8gxx_auto_detectfunction lgs8gxx_auto_lockfunction lgs8gxx_set_mpeg_modefunction lgs8g75_set_adc_vppfunction lgs8913_initfunction lgs8g75_init_datafunction lgs8gxx_initfunction lgs8gxx_releasefunction lgs8gxx_writefunction lgs8gxx_set_fefunction lgs8gxx_get_tune_settingsfunction lgs8gxx_read_statusfunction lgs8gxx_read_signal_agcfunction lgs8913_read_signal_strengthfunction lgs8g75_read_signal_strengthfunction lgs8gxx_read_signal_strengthfunction lgs8gxx_read_snrfunction lgs8gxx_read_ucblocksfunction packet_counter_startfunction packet_counter_stopfunction lgs8gxx_read_berfunction lgs8gxx_i2c_gate_ctrlexport lgs8gxx_attach
Annotated Snippet
if (((t&0x03) == 0x01) && (t2&0x01)) {
lgs8gxx_write_reg(priv, 0x6E, 0x05);
lgs8gxx_write_reg(priv, 0x39, 0x02);
lgs8gxx_write_reg(priv, 0x39, 0x03);
lgs8gxx_write_reg(priv, 0x3D, 0x05);
lgs8gxx_write_reg(priv, 0x3E, 0x28);
lgs8gxx_write_reg(priv, 0x53, 0x80);
} else {
lgs8gxx_write_reg(priv, 0x6E, 0x3F);
lgs8gxx_write_reg(priv, 0x39, 0x00);
lgs8gxx_write_reg(priv, 0x3D, 0x04);
}
lgs8gxx_soft_reset(priv);
return 0;
}
/* turn off auto-detect; manual settings */
lgs8gxx_write_reg(priv, 0x7E, 0);
if (priv->config->prod == LGS8GXX_PROD_LGS8913)
lgs8gxx_write_reg(priv, 0xC1, 0);
lgs8gxx_read_reg(priv, 0xC5, &t);
t = (t & 0xE0) | 0x06;
lgs8gxx_write_reg(priv, 0xC5, t);
lgs8gxx_soft_reset(priv);
return 0;
}
static int lgs8gxx_is_locked(struct lgs8gxx_state *priv, u8 *locked)
{
int ret = 0;
u8 t;
if (priv->config->prod == LGS8GXX_PROD_LGS8G75)
ret = lgs8gxx_read_reg(priv, 0x13, &t);
else
ret = lgs8gxx_read_reg(priv, 0x4B, &t);
if (ret != 0)
return ret;
if (priv->config->prod == LGS8GXX_PROD_LGS8G75)
*locked = ((t & 0x80) == 0x80) ? 1 : 0;
else
*locked = ((t & 0xC0) == 0xC0) ? 1 : 0;
return 0;
}
/* Wait for Code Acquisition Lock */
static int lgs8gxx_wait_ca_lock(struct lgs8gxx_state *priv, u8 *locked)
{
int ret = 0;
u8 reg, mask, val;
if (priv->config->prod == LGS8GXX_PROD_LGS8G75) {
reg = 0x13;
mask = 0x80;
val = 0x80;
} else {
reg = 0x4B;
mask = 0xC0;
val = 0xC0;
}
ret = wait_reg_mask(priv, reg, mask, val, 50, 40);
*locked = (ret == 0) ? 1 : 0;
return 0;
}
static int lgs8gxx_is_autodetect_finished(struct lgs8gxx_state *priv,
u8 *finished)
{
int ret = 0;
u8 reg, mask, val;
if (priv->config->prod == LGS8GXX_PROD_LGS8G75) {
reg = 0x1f;
mask = 0xC0;
val = 0x80;
} else {
reg = 0xA4;
mask = 0x03;
val = 0x01;
}
ret = wait_reg_mask(priv, reg, mask, val, 10, 20);
*finished = (ret == 0) ? 1 : 0;
Annotation
- Immediate include surface: `asm/div64.h`, `linux/firmware.h`, `media/dvb_frontend.h`, `lgs8gxx.h`, `lgs8gxx_priv.h`.
- Detected declarations: `function lgs8gxx_write_reg`, `function lgs8gxx_read_reg`, `function lgs8gxx_soft_reset`, `function wait_reg_mask`, `function lgs8gxx_set_ad_mode`, `function lgs8gxx_set_if_freq`, `function lgs8gxx_get_afc_phase`, `function lgs8gxx_set_mode_auto`, `function lgs8gxx_set_mode_manual`, `function lgs8gxx_is_locked`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.