sound/soc/codecs/peb2466.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/peb2466.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/peb2466.c- Extension
.c- Size
- 56187 bytes
- Lines
- 2067
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/unaligned.hlinux/clk.hlinux/firmware.hlinux/gpio/consumer.hlinux/gpio/driver.hlinux/module.hlinux/mutex.hlinux/slab.hlinux/spi/spi.hsound/pcm_params.hsound/soc.hsound/tlv.h
Detected Declarations
struct peb2466_lookupstruct peb2466_lkup_ctrlstruct peb2466struct peb2466_fw_tag_defenum peb2466_tone_freqfunction peb2466_write_bytefunction peb2466_read_bytefunction peb2466_write_buffunction peb2466_reg_writefunction peb2466_write_buffunction peb2466_reg_readfunction peb2466_lkup_ctrl_infofunction peb2466_lkup_ctrl_getfunction peb2466_lkup_ctrl_putfunction peb2466_add_lkup_ctrlfunction peb2466_tg_freq_getfunction peb2466_tg_freq_putfunction peb2466_dai_set_tdm_slotfunction peb2466_dai_set_fmtfunction peb2466_dai_hw_paramsfunction peb2466_dai_startupfunction peb2466_reset_audiofunction peb2466_fw_parse_thfilterfunction peb2466_fw_parse_imr1filterfunction peb2466_fw_parse_frxfilterfunction peb2466_fw_parse_frrfilterfunction peb2466_fw_parse_axfilterfunction peb2466_fw_parse_arfilterfunction peb2466_fw_parse_axtablefunction peb2466_fw_parse_artablefunction peb2466_fw_parsefunction peb2466_load_coeffsfunction peb2466_component_probefunction peb2466_chip_gpio_offset_to_data_regmaskfunction peb2466_chip_gpio_offset_to_dir_regmaskfunction peb2466_chip_gpio_update_bitsfunction peb2466_chip_gpio_setfunction peb2466_chip_gpio_getfunction peb2466_chip_get_directionfunction peb2466_chip_direction_inputfunction peb2466_chip_direction_outputfunction peb2466_reset_gpiofunction peb2466_gpio_initfunction peb2466_spi_probe
Annotated Snippet
struct peb2466_lookup {
u8 (*table)[4];
unsigned int count;
};
#define PEB2466_TLV_SIZE ARRAY_SIZE(((unsigned int[]){TLV_DB_SCALE_ITEM(0, 0, 0)}))
struct peb2466_lkup_ctrl {
int reg;
unsigned int index;
const struct peb2466_lookup *lookup;
unsigned int tlv_array[PEB2466_TLV_SIZE];
};
struct peb2466 {
struct spi_device *spi;
struct clk *mclk;
struct gpio_desc *reset_gpio;
u8 spi_tx_buf[2 + 8]; /* Cannot use stack area for SPI (dma-safe memory) */
u8 spi_rx_buf[2 + 8]; /* Cannot use stack area for SPI (dma-safe memory) */
struct regmap *regmap;
struct {
struct peb2466_lookup ax_lookup;
struct peb2466_lookup ar_lookup;
struct peb2466_lkup_ctrl ax_lkup_ctrl;
struct peb2466_lkup_ctrl ar_lkup_ctrl;
unsigned int tg1_freq_item;
unsigned int tg2_freq_item;
} ch[PEB2466_NB_CHANNEL];
int max_chan_playback;
int max_chan_capture;
struct {
struct gpio_chip gpio_chip;
struct mutex lock;
struct {
unsigned int xr0;
unsigned int xr1;
unsigned int xr2;
unsigned int xr3;
} cache;
} gpio;
};
#define PEB2466_CMD_R (1 << 5)
#define PEB2466_CMD_W (0 << 5)
#define PEB2466_CMD_MASK 0x18
#define PEB2466_CMD_XOP 0x18 /* XOP is 0bxxx11xxx */
#define PEB2466_CMD_SOP 0x10 /* SOP is 0bxxx10xxx */
#define PEB2466_CMD_COP 0x00 /* COP is 0bxxx0xxxx, handle 0bxxx00xxx */
#define PEB2466_CMD_COP1 0x08 /* COP is 0bxxx0xxxx, handle 0bxxx01xxx */
#define PEB2466_MAKE_XOP(_lsel) (PEB2466_CMD_XOP | (_lsel))
#define PEB2466_MAKE_SOP(_ad, _lsel) (PEB2466_CMD_SOP | ((_ad) << 6) | (_lsel))
#define PEB2466_MAKE_COP(_ad, _code) (PEB2466_CMD_COP | ((_ad) << 6) | (_code))
#define PEB2466_CR0(_ch) PEB2466_MAKE_SOP(_ch, 0x0)
#define PEB2466_CR0_TH (1 << 7)
#define PEB2466_CR0_IMR1 (1 << 6)
#define PEB2466_CR0_FRX (1 << 5)
#define PEB2466_CR0_FRR (1 << 4)
#define PEB2466_CR0_AX (1 << 3)
#define PEB2466_CR0_AR (1 << 2)
#define PEB2466_CR0_THSEL_MASK (0x3 << 0)
#define PEB2466_CR0_THSEL(_set) ((_set) << 0)
#define PEB2466_CR1(_ch) PEB2466_MAKE_SOP(_ch, 0x1)
#define PEB2466_CR1_ETG2 (1 << 7)
#define PEB2466_CR1_ETG1 (1 << 6)
#define PEB2466_CR1_PTG2 (1 << 5)
#define PEB2466_CR1_PTG1 (1 << 4)
#define PEB2466_CR1_LAW_MASK (1 << 3)
#define PEB2466_CR1_LAW_ALAW (0 << 3)
#define PEB2466_CR1_LAW_MULAW (1 << 3)
#define PEB2466_CR1_PU (1 << 0)
#define PEB2466_CR2(_ch) PEB2466_MAKE_SOP(_ch, 0x2)
#define PEB2466_CR3(_ch) PEB2466_MAKE_SOP(_ch, 0x3)
#define PEB2466_CR4(_ch) PEB2466_MAKE_SOP(_ch, 0x4)
#define PEB2466_CR5(_ch) PEB2466_MAKE_SOP(_ch, 0x5)
#define PEB2466_XR0 PEB2466_MAKE_XOP(0x0)
#define PEB2466_XR1 PEB2466_MAKE_XOP(0x1)
#define PEB2466_XR2 PEB2466_MAKE_XOP(0x2)
#define PEB2466_XR3 PEB2466_MAKE_XOP(0x3)
#define PEB2466_XR4 PEB2466_MAKE_XOP(0x4)
#define PEB2466_XR5 PEB2466_MAKE_XOP(0x5)
#define PEB2466_XR5_MCLK_1536 (0x0 << 6)
#define PEB2466_XR5_MCLK_2048 (0x1 << 6)
#define PEB2466_XR5_MCLK_4096 (0x2 << 6)
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/clk.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/gpio/driver.h`, `linux/module.h`, `linux/mutex.h`, `linux/slab.h`.
- Detected declarations: `struct peb2466_lookup`, `struct peb2466_lkup_ctrl`, `struct peb2466`, `struct peb2466_fw_tag_def`, `enum peb2466_tone_freq`, `function peb2466_write_byte`, `function peb2466_read_byte`, `function peb2466_write_buf`, `function peb2466_reg_write`, `function peb2466_write_buf`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.