PebbleOS v4.47.0-1075-g013613c8a
Loading...
Searching...
No Matches
SF32LB audio codec

Audio DAIs of the SF32LB audio codec: its DAC and its ADC. More...

Data Structures

struct  pbl_audio_sf32lb_audcodec
 Audio codec. More...
 

Macros

#define PBL_AUDIO_SF32LB_AUDCODEC_DAI(dac, idx)    (&((const struct pbl_audio_sf32lb_audcodec *)(dac))->dai[(idx)])
 Get a DAI of an audio codec, as its sound-dai cell selects it.
 
#define PBL_AUDIO_SF32LB_AUDCODEC_DEFINE(sym, _name, _base, _clk, _dac_dma, _adc1_dma, _adc2_dma, _pinctrl, _pmuc)
 Define an audio codec: its DAC, a playback DAI, and its ADC, a capture DAI.
 

Detailed Description

Audio DAIs of the SF32LB audio codec: its DAC and its ADC.

The audio codec (AUDCODEC) plays mono through its DAC, with its analog bias, PLL and output stage, at 8 to 48 kHz; its digital gain runs from -36 to 0 dB. Its ADC records one or two analog microphones, powered from its microphone bias, at the same rates: mono takes the first ADC, stereo both, the second with a DMA channel of its own. The ADC gain runs from -60 to +30 dB. Both stream through cyclic DMA channels, so rings have two periods, of a multiple of 4 bytes per channel. The CPU does not enter deep sleep while they stream.

In the devicetree, the codec takes one cell in sound-dai: 0 for the DAC, 1 for the ADC.


Data Structure Documentation

◆ pbl_audio_sf32lb_audcodec

struct pbl_audio_sf32lb_audcodec

Audio codec.

Data Fields
const struct pbl_dma_chan * adc_dma[2] DMA channels of the first and second ADC, NULL for an ADC not recorded.
uintptr_t base Register base address.
struct pbl_clk clk Clock.
const struct pbl_dma_chan * dac_dma DAC DMA channel.
struct pbl_audio_dai dai[2] DAIs, by direction: the DAC, then the ADC.
struct pbl_pinctrl pinctrl Pins of the analog inputs and the microphone bias.
uintptr_t pmuc PMUC registers, holding the HXT48 buffer to the codec.
struct pbl_audio_sf32lb_audcodec_state * state Driver runtime state.

Macro Definition Documentation

◆ PBL_AUDIO_SF32LB_AUDCODEC_DAI

#define PBL_AUDIO_SF32LB_AUDCODEC_DAI (   dac,
  idx 
)     (&((const struct pbl_audio_sf32lb_audcodec *)(dac))->dai[(idx)])

Get a DAI of an audio codec, as its sound-dai cell selects it.

Parameters
dacDAC of the codec, the symbol PBL_AUDIO_SF32LB_AUDCODEC_DEFINE() defines.
idx0 for the DAC, 1 for the ADC.

◆ PBL_AUDIO_SF32LB_AUDCODEC_DEFINE

#define PBL_AUDIO_SF32LB_AUDCODEC_DEFINE (   sym,
  _name,
  _base,
  _clk,
  _dac_dma,
  _adc1_dma,
  _adc2_dma,
  _pinctrl,
  _pmuc 
)
Value:
PBL_AUDIO_DAI_STATE_DEFINE(sym##_adc); \
static struct pbl_audio_sf32lb_audcodec_state sym##_audcodec_state = { \
}; \
PBL_DEVICE_INSTANCE(sym, struct pbl_audio_sf32lb_audcodec, struct pbl_audio_dai, \
.dai = \
{ \
sym, _name, nullptr, &pbl_audio_sf32lb_audcodec_dac_ops, PBL_AUDIO_PLAYBACK), \
PBL_AUDIO_DAI_INIT(sym##_adc, _name "-adc", nullptr, \
&pbl_audio_sf32lb_audcodec_adc_ops, PBL_AUDIO_CAPTURE), \
}, \
.base = (_base), \
.clk = _clk, \
.dac_dma = (_dac_dma), \
.adc_dma = {(_adc1_dma), (_adc2_dma)}, \
.pinctrl = PBL_PINCTRL(_pinctrl, nullptr, 0), \
.pmuc = (_pmuc), \
.state = &sym##_audcodec_state, \
}; \
PBL_DEVICE_REGISTER(sym##_adc, &sym##_inst.dai[PBL_AUDIO_CAPTURE].dev)
Audio codec.
Definition sf32lb.h:47
A digital audio interface of the SoC, streaming one direction.
Definition audio.h:355
#define PBL_AUDIO_DAI_INIT(sym, _name, _parent, _ops, _dir)
Initializer for a struct pbl_audio_dai.
Definition audio.h:409
#define PBL_AUDIO_DAI_STATE_DEFINE(sym)
Define the class state of a DAI.
Definition audio.h:396
@ PBL_AUDIO_PLAYBACK
From memory to the hardware.
Definition audio.h:90
@ PBL_AUDIO_CAPTURE
From the hardware to memory.
Definition audio.h:92
#define PBL_PINCTRL(_default, _sleep, _reg)
Initializer for a struct pbl_pinctrl.
Definition pinctrl.h:132
#define PBL_MUTEX_INITIALIZER
Static initializer for an unlocked mutex.
Definition mutex.h:50

Define an audio codec: its DAC, a playback DAI, and its ADC, a capture DAI.

Parameters
symSymbol of the DAC; the ADC is reached with PBL_AUDIO_SF32LB_AUDCODEC_DAI().
_nameDevice name.
_baseRegister base address.
_clkClock, from PBL_CLK().
_dac_dmaDAC DMA channel.
_adc1_dmaDMA channel of the first ADC, or NULL.
_adc2_dmaDMA channel of the second ADC, or NULL.
_pinctrlDefault state of the analog pins, or NULL.
_pmucPMUC registers.