/* Default control and setup, added after probe() is run */ conststructsnd_kcontrol_new *controls; unsignedint num_controls; conststructsnd_soc_dapm_widget *dapm_widgets; unsignedint num_dapm_widgets; conststructsnd_soc_dapm_route *dapm_routes; unsignedint num_dapm_routes;
int (*probe)(struct snd_soc_component *component); void (*remove)(struct snd_soc_component *component); int (*suspend)(struct snd_soc_component *component); int (*resume)(struct snd_soc_component *component);
/* pcm creation and destruction */ int (*pcm_new)(struct snd_soc_pcm_runtime *rtd); void (*pcm_free)(struct snd_pcm *pcm);
/* component wide operations */ int (*set_sysclk)(struct snd_soc_component *component, int clk_id, int source, unsignedint freq, int dir); int (*set_pll)(struct snd_soc_component *component, int pll_id, int source, unsignedint freq_in, unsignedint freq_out); int (*set_jack)(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data);
/* DT */ int (*of_xlate_dai_name)(struct snd_soc_component *component, struct of_phandle_args *args, constchar **dai_name); int (*of_xlate_dai_id)(struct snd_soc_component *comment, struct device_node *endpoint); void (*seq_notifier)(struct snd_soc_component *component, enum snd_soc_dapm_type type, int subseq); int (*stream_event)(struct snd_soc_component *component, int event); int (*set_bias_level)(struct snd_soc_component *component, enum snd_soc_bias_level level);
/* probe ordering - for components with runtime dependencies */ int probe_order; int remove_order;
/* * signal if the module handling the component should not be removed * if a pcm is open. Setting this would prevent the module * refcount being incremented in probe() but allow it be incremented * when a pcm is opened and decremented when it is closed. */ unsignedint module_get_upon_open:1;
/* bits */ unsignedint idle_bias_on:1; unsignedint suspend_bias_off:1; unsignedint use_pmdown_time:1; /* care pmdown_time at stop */ unsignedint endianness:1; unsignedint non_legacy_dai_naming:1;
/* this component uses topology and ignore machine driver FEs */ constchar *ignore_machine; constchar *topology_name_prefix; int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params); bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */ int be_pcm_base; /* base device ID for all BE PCMs */ };
/* DAI driver callbacks */ int (*probe)(struct snd_soc_dai *dai); int (*remove)(struct snd_soc_dai *dai); int (*suspend)(struct snd_soc_dai *dai); int (*resume)(struct snd_soc_dai *dai); /* compress dai */ int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num); /* Optional Callback used at pcm creation*/ int (*pcm_new)(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
/* DAI capabilities */ structsnd_soc_pcm_streamcapture; structsnd_soc_pcm_streamplayback; unsignedint symmetric_rates:1; unsignedint symmetric_channels:1; unsignedint symmetric_samplebits:1; unsignedint bus_control:1; /* DAI is also used for the control bus */
/* probe ordering - for components with runtime dependencies */ int probe_order; int remove_order; };
structsnd_soc_dai_ops { /* * DAI clocking configuration, all optional. * Called by soc_card drivers, normally in their hw_params. */ int (*set_sysclk)(struct snd_soc_dai *dai, int clk_id, unsignedint freq, int dir); int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source, unsignedint freq_in, unsignedint freq_out); int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsignedint ratio);
/* * DAI format configuration * Called by soc_card drivers, normally in their hw_params. */ int (*set_fmt)(struct snd_soc_dai *dai, unsignedint fmt); int (*xlate_tdm_slot_mask)(unsignedint slots, unsignedint *tx_mask, unsignedint *rx_mask); int (*set_tdm_slot)(struct snd_soc_dai *dai, unsignedint tx_mask, unsignedint rx_mask, int slots, int slot_width); int (*set_channel_map)(struct snd_soc_dai *dai, unsignedint tx_num, unsignedint *tx_slot, unsignedint rx_num, unsignedint *rx_slot); int (*get_channel_map)(struct snd_soc_dai *dai, unsignedint *tx_num, unsignedint *tx_slot, unsignedint *rx_num, unsignedint *rx_slot); int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
int (*set_sdw_stream)(struct snd_soc_dai *dai, void *stream, int direction); /* * DAI digital mute - optional. * Called by soc-core to minimise any pops. */ int (*digital_mute)(struct snd_soc_dai *dai, int mute); int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream);
/* * ALSA PCM audio operations - all optional. * Called by soc-core during audio PCM operations. */ int (*startup)(struct snd_pcm_substream *, struct snd_soc_dai *); void (*shutdown)(struct snd_pcm_substream *, struct snd_soc_dai *); int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *, struct snd_soc_dai *); int (*hw_free)(struct snd_pcm_substream *, struct snd_soc_dai *); int (*prepare)(struct snd_pcm_substream *, struct snd_soc_dai *); /* * NOTE: Commands passed to the trigger function are not necessarily * compatible with the current state of the dai. For example this * sequence of commands is possible: START STOP STOP. * So do not unconditionally use refcounting functions in the trigger * function, e.g. clk_enable/disable. */ int (*trigger)(struct snd_pcm_substream *, int, struct snd_soc_dai *); int (*bespoke_trigger)(struct snd_pcm_substream *, int, struct snd_soc_dai *); /* * For hardware based FIFO caused delay reporting. * Optional. */ snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, struct snd_soc_dai *); };
structsnd_soc_dapm_widget { enumsnd_soc_dapm_typeid; constchar *name; /* widget name */ constchar *sname; /* stream name */ structlist_headlist; structsnd_soc_dapm_context *dapm;
void *priv; /* widget specific data */ structregulator *regulator;/* attached regulator */ structpinctrl *pinctrl;/* attached pinctrl */
/* dapm control */ int reg; /* negative reg = no direct dapm */ unsignedchar shift; /* bits to shift */ unsignedint mask; /* non-shifted mask */ unsignedint on_val; /* on state value */ unsignedint off_val; /* off state value */ unsignedchar power:1; /* block power status */ unsignedchar active:1; /* active stream on DAC, ADC's */ unsignedchar connected:1; /* connected codec pin */ unsignedchar new:1; /* cnew complete */ unsignedchar force:1; /* force state */ unsignedchar ignore_suspend:1; /* kept enabled over suspend */ unsignedchar new_power:1; /* power from this run */ unsignedchar power_checked:1; /* power checked this run */ unsignedchar is_supply:1; /* Widget is a supply type widget */ unsignedchar is_ep:2; /* Widget is a endpoint type widget */ int subseq; /* sort within widget type */
int (*power_check)(struct snd_soc_dapm_widget *w);
/* external events */ unsignedshort event_flags; /* flags to specify event types */ int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int);
/* kcontrols that relate to this widget */ int num_kcontrols; conststructsnd_kcontrol_new *kcontrol_news; structsnd_kcontrol **kcontrols; structsnd_soc_dobjdobj;
/* widget input and output edges */ structlist_headedges[2];
/* used during DAPM updates */ structlist_headwork_list; structlist_headpower_list; structlist_headdirty; int endpoints[2];
/* Note: currently only supported for links where source is a supply */ int (*connected)(struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink);