sound/soc/codecs/ts3a227e.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/ts3a227e.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/ts3a227e.c- Extension
.c- Size
- 12444 bytes
- Lines
- 462
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- 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/i2c.hlinux/init.hlinux/input.hlinux/module.hlinux/regmap.hlinux/acpi.hsound/core.hsound/jack.hsound/soc.hts3a227e.h
Detected Declarations
struct ts3a227efunction ts3a227e_readable_regfunction ts3a227e_writeable_regfunction ts3a227e_volatile_regfunction ts3a227e_jack_reportfunction ts3a227e_new_jack_statefunction ts3a227e_interruptfunction ts3a227e_enable_jack_detectfunction ts3a227e_set_jackfunction ts3a227e_get_jack_typefunction ts3a227e_parse_device_propertyfunction ts3a227e_i2c_probefunction ts3a227e_suspendfunction ts3a227e_resumeexport ts3a227e_enable_jack_detect
Annotated Snippet
struct ts3a227e {
struct device *dev;
struct regmap *regmap;
struct snd_soc_jack *jack;
bool plugged;
bool mic_present;
unsigned int buttons_held;
int irq;
};
/* Button values to be reported on the jack */
static const int ts3a227e_buttons[] = {
SND_JACK_BTN_0,
SND_JACK_BTN_1,
SND_JACK_BTN_2,
SND_JACK_BTN_3,
};
#define TS3A227E_NUM_BUTTONS 4
#define TS3A227E_JACK_MASK (SND_JACK_HEADPHONE | \
SND_JACK_MICROPHONE | \
SND_JACK_BTN_0 | \
SND_JACK_BTN_1 | \
SND_JACK_BTN_2 | \
SND_JACK_BTN_3)
/* TS3A227E registers */
#define TS3A227E_REG_DEVICE_ID 0x00
#define TS3A227E_REG_INTERRUPT 0x01
#define TS3A227E_REG_KP_INTERRUPT 0x02
#define TS3A227E_REG_INTERRUPT_DISABLE 0x03
#define TS3A227E_REG_SETTING_1 0x04
#define TS3A227E_REG_SETTING_2 0x05
#define TS3A227E_REG_SETTING_3 0x06
#define TS3A227E_REG_SWITCH_CONTROL_1 0x07
#define TS3A227E_REG_SWITCH_CONTROL_2 0x08
#define TS3A227E_REG_SWITCH_STATUS_1 0x09
#define TS3A227E_REG_SWITCH_STATUS_2 0x0a
#define TS3A227E_REG_ACCESSORY_STATUS 0x0b
#define TS3A227E_REG_ADC_OUTPUT 0x0c
#define TS3A227E_REG_KP_THRESHOLD_1 0x0d
#define TS3A227E_REG_KP_THRESHOLD_2 0x0e
#define TS3A227E_REG_KP_THRESHOLD_3 0x0f
/* TS3A227E_REG_INTERRUPT 0x01 */
#define INS_REM_EVENT 0x01
#define DETECTION_COMPLETE_EVENT 0x02
/* TS3A227E_REG_KP_INTERRUPT 0x02 */
#define PRESS_MASK(idx) (0x01 << (2 * (idx)))
#define RELEASE_MASK(idx) (0x02 << (2 * (idx)))
/* TS3A227E_REG_INTERRUPT_DISABLE 0x03 */
#define INS_REM_INT_DISABLE 0x01
#define DETECTION_COMPLETE_INT_DISABLE 0x02
#define ADC_COMPLETE_INT_DISABLE 0x04
#define INTB_DISABLE 0x08
/* TS3A227E_REG_SETTING_1 0x4 */
#define DEBOUNCE_INSERTION_SETTING_SFT (0)
#define DEBOUNCE_INSERTION_SETTING_MASK (0x7 << DEBOUNCE_PRESS_SETTING_SFT)
/* TS3A227E_REG_SETTING_2 0x05 */
#define KP_ENABLE 0x04
/* TS3A227E_REG_SETTING_3 0x06 */
#define MICBIAS_SETTING_SFT 3
#define MICBIAS_SETTING_MASK (0x7 << MICBIAS_SETTING_SFT)
#define DEBOUNCE_RELEASE_SETTING_SFT 2
#define DEBOUNCE_RELEASE_SETTING_MASK (0x1 << DEBOUNCE_RELEASE_SETTING_SFT)
#define DEBOUNCE_PRESS_SETTING_SFT 0
#define DEBOUNCE_PRESS_SETTING_MASK (0x3 << DEBOUNCE_PRESS_SETTING_SFT)
/* TS3A227E_REG_ACCESSORY_STATUS 0x0b */
#define TYPE_3_POLE 0x01
#define TYPE_4_POLE_OMTP 0x02
#define TYPE_4_POLE_STANDARD 0x04
#define JACK_INSERTED 0x08
#define EITHER_MIC_MASK (TYPE_4_POLE_OMTP | TYPE_4_POLE_STANDARD)
static const struct reg_default ts3a227e_reg_defaults[] = {
{ TS3A227E_REG_DEVICE_ID, 0x10 },
{ TS3A227E_REG_INTERRUPT, 0x00 },
{ TS3A227E_REG_KP_INTERRUPT, 0x00 },
{ TS3A227E_REG_INTERRUPT_DISABLE, 0x08 },
{ TS3A227E_REG_SETTING_1, 0x23 },
{ TS3A227E_REG_SETTING_2, 0x00 },
{ TS3A227E_REG_SETTING_3, 0x0e },
{ TS3A227E_REG_SWITCH_CONTROL_1, 0x00 },
{ TS3A227E_REG_SWITCH_CONTROL_2, 0x00 },
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/init.h`, `linux/input.h`, `linux/module.h`, `linux/regmap.h`, `linux/acpi.h`, `sound/core.h`, `sound/jack.h`.
- Detected declarations: `struct ts3a227e`, `function ts3a227e_readable_reg`, `function ts3a227e_writeable_reg`, `function ts3a227e_volatile_reg`, `function ts3a227e_jack_report`, `function ts3a227e_new_jack_state`, `function ts3a227e_interrupt`, `function ts3a227e_enable_jack_detect`, `function ts3a227e_set_jack`, `function ts3a227e_get_jack_type`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- 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.