drivers/media/i2c/tda7432.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/tda7432.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/tda7432.c- Extension
.c- Size
- 11258 bytes
- Lines
- 418
- 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
linux/module.hlinux/init.hlinux/kernel.hlinux/string.hlinux/timer.hlinux/delay.hlinux/errno.hlinux/slab.hlinux/videodev2.hlinux/i2c.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/v4l2-ctrls.h
Detected Declarations
struct tda7432function controlfunction tda7432_setfunction tda7432_log_statusfunction tda7432_s_ctrlfunction tda7432_probefunction tda7432_remove
Annotated Snippet
struct tda7432 {
struct v4l2_subdev sd;
struct v4l2_ctrl_handler hdl;
struct {
/* bass/treble cluster */
struct v4l2_ctrl *bass;
struct v4l2_ctrl *treble;
};
struct {
/* mute/balance cluster */
struct v4l2_ctrl *mute;
struct v4l2_ctrl *balance;
};
};
static inline struct tda7432 *to_state(struct v4l2_subdev *sd)
{
return container_of(sd, struct tda7432, sd);
}
static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
{
return &container_of(ctrl->handler, struct tda7432, hdl)->sd;
}
/* The TDA7432 is made by STS-Thompson
* http://www.st.com
* http://us.st.com/stonline/books/pdf/docs/4056.pdf
*
* TDA7432: I2C-bus controlled basic audio processor
*
* The TDA7432 controls basic audio functions like volume, balance,
* and tone control (including loudness). It also has four channel
* output (for front and rear). Since most vidcap cards probably
* don't have 4 channel output, this driver will set front & rear
* together (no independent control).
*/
/* Subaddresses for TDA7432 */
#define TDA7432_IN 0x00 /* Input select */
#define TDA7432_VL 0x01 /* Volume */
#define TDA7432_TN 0x02 /* Bass, Treble (Tone) */
#define TDA7432_LF 0x03 /* Attenuation LF (Left Front) */
#define TDA7432_LR 0x04 /* Attenuation LR (Left Rear) */
#define TDA7432_RF 0x05 /* Attenuation RF (Right Front) */
#define TDA7432_RR 0x06 /* Attenuation RR (Right Rear) */
#define TDA7432_LD 0x07 /* Loudness */
/* Masks for bits in TDA7432 subaddresses */
/* Many of these not used - just for documentation */
/* Subaddress 0x00 - Input selection and bass control */
/* Bits 0,1,2 control input:
* 0x00 - Stereo input
* 0x02 - Mono input
* 0x03 - Mute (Using Attenuators Plays better with modules)
* Mono probably isn't used - I'm guessing only the stereo
* input is connected on most cards, so we'll set it to stereo.
*
* Bit 3 controls bass cut: 0/1 is non-symmetric/symmetric bass cut
* Bit 4 controls bass range: 0/1 is extended/standard bass range
*
* Highest 3 bits not used
*/
#define TDA7432_STEREO_IN 0
#define TDA7432_MONO_IN 2 /* Probably won't be used */
#define TDA7432_BASS_SYM 1 << 3
#define TDA7432_BASS_NORM 1 << 4
/* Subaddress 0x01 - Volume */
/* Lower 7 bits control volume from -79dB to +32dB in 1dB steps
* Recommended maximum is +20 dB
*
* +32dB: 0x00
* +20dB: 0x0c
* 0dB: 0x20
* -79dB: 0x6f
*
* MSB (bit 7) controls loudness: 1/0 is loudness on/off
*/
#define TDA7432_VOL_0DB 0x20
#define TDA7432_LD_ON 1 << 7
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/kernel.h`, `linux/string.h`, `linux/timer.h`, `linux/delay.h`, `linux/errno.h`, `linux/slab.h`.
- Detected declarations: `struct tda7432`, `function control`, `function tda7432_set`, `function tda7432_log_status`, `function tda7432_s_ctrl`, `function tda7432_probe`, `function tda7432_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.