mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:44:45 +01:00
ASoC: capsuling struct snd_soc_dapm_context
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>: Now, all DAPM users are using function to handling it. We can capsuling it. This patchset moves struct snd_soc_dapm_context into soc-dapm.c, and remove un-used functions. Link: https://lore.kernel.org/r/87zf7jrx52.wl-kuninori.morimoto.gx@renesas.com
This commit is contained in:
commit
b4ee17729a
7 changed files with 202 additions and 321 deletions
|
|
@ -237,8 +237,7 @@ struct snd_soc_component {
|
|||
* the driver will be marked as BROKEN when these fields are removed.
|
||||
*/
|
||||
|
||||
/* Don't use these, use snd_soc_component_get_dapm() */
|
||||
struct snd_soc_dapm_context dapm;
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
|
||||
/* machine specific init */
|
||||
int (*init)(struct snd_soc_component *component);
|
||||
|
|
@ -268,12 +267,9 @@ struct snd_soc_component {
|
|||
static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm(
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
return &component->dapm;
|
||||
return component->dapm;
|
||||
}
|
||||
|
||||
// FIXME
|
||||
#define snd_soc_component_get_dapm snd_soc_component_to_dapm
|
||||
|
||||
/**
|
||||
* snd_soc_component_cache_sync() - Sync the register cache with the hardware
|
||||
* @component: COMPONENT to sync
|
||||
|
|
@ -368,27 +364,6 @@ snd_soc_component_active(struct snd_soc_component *component)
|
|||
return component->active;
|
||||
}
|
||||
|
||||
/* component pin */
|
||||
int snd_soc_component_enable_pin(struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
int snd_soc_component_disable_pin(struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
int snd_soc_component_nc_pin(struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
int snd_soc_component_get_pin_status(struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
int snd_soc_component_force_enable_pin_unlocked(
|
||||
struct snd_soc_component *component,
|
||||
const char *pin);
|
||||
|
||||
/* component controls */
|
||||
struct snd_kcontrol *snd_soc_component_get_kcontrol(struct snd_soc_component *component,
|
||||
const char * const ctl);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ struct regulator;
|
|||
struct soc_enum;
|
||||
struct snd_pcm_substream;
|
||||
struct snd_soc_pcm_runtime;
|
||||
struct snd_soc_dapm_context;
|
||||
|
||||
/* widget has no PM register bit */
|
||||
#define SND_SOC_NOPM -1
|
||||
|
|
@ -579,28 +580,6 @@ struct snd_soc_dapm_update {
|
|||
bool has_second_set;
|
||||
};
|
||||
|
||||
/* DAPM context */
|
||||
struct snd_soc_dapm_context {
|
||||
enum snd_soc_bias_level bias_level;
|
||||
|
||||
bool idle_bias; /* Use BIAS_OFF instead of STANDBY when false */
|
||||
|
||||
struct device *dev; /* from parent - for debug */ /* REMOVE ME */
|
||||
struct snd_soc_component *component; /* parent component */
|
||||
struct snd_soc_card *card; /* parent card */
|
||||
|
||||
/* used during DAPM updates */
|
||||
enum snd_soc_bias_level target_bias_level;
|
||||
struct list_head list;
|
||||
|
||||
struct snd_soc_dapm_widget *wcache_sink;
|
||||
struct snd_soc_dapm_widget *wcache_source;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs_dapm;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* A list of widgets associated with an object, typically a snd_kcontrol */
|
||||
struct snd_soc_dapm_widget_list {
|
||||
int num_widgets;
|
||||
|
|
@ -628,6 +607,8 @@ enum snd_soc_dapm_direction {
|
|||
#define SND_SOC_DAPM_EP_SOURCE SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_IN)
|
||||
#define SND_SOC_DAPM_EP_SINK SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_OUT)
|
||||
|
||||
struct snd_soc_dapm_context *snd_soc_dapm_alloc(struct device *dev);
|
||||
|
||||
int snd_soc_dapm_regulator_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
|
||||
int snd_soc_dapm_clock_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
|
||||
int snd_soc_dapm_pinctrl_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event);
|
||||
|
|
@ -705,16 +686,6 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, co
|
|||
int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, const char *pin);
|
||||
void snd_soc_dapm_mark_endpoints_dirty(struct snd_soc_card *card);
|
||||
|
||||
/*
|
||||
* Marks the specified pin as being not connected, disabling it along
|
||||
* any parent or child widgets. At present this is identical to
|
||||
* snd_soc_dapm_disable_pin[_unlocked]() but in future it will be extended to do
|
||||
* additional things such as disabling controls which only affect
|
||||
* paths through the pin.
|
||||
*/
|
||||
#define snd_soc_dapm_nc_pin snd_soc_dapm_disable_pin
|
||||
#define snd_soc_dapm_nc_pin_unlocked snd_soc_dapm_disable_pin_unlocked
|
||||
|
||||
/* dapm path query */
|
||||
int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
|
||||
struct snd_soc_dapm_widget_list **list,
|
||||
|
|
@ -730,15 +701,6 @@ int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, enum snd_so
|
|||
enum snd_soc_bias_level snd_soc_dapm_get_bias_level(struct snd_soc_dapm_context *dapm);
|
||||
void snd_soc_dapm_init_bias_level(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level);
|
||||
|
||||
// REMOVE ME !!
|
||||
#define snd_soc_component_force_bias_level(c, l) snd_soc_dapm_force_bias_level(&(c)->dapm, l)
|
||||
#define snd_soc_component_get_bias_level(c) snd_soc_dapm_get_bias_level(&(c)->dapm)
|
||||
#define snd_soc_component_init_bias_level(c, l) snd_soc_dapm_init_bias_level(&(c)->dapm, l)
|
||||
#define snd_soc_dapm_kcontrol_widget snd_soc_dapm_kcontrol_to_widget
|
||||
#define snd_soc_dapm_kcontrol_dapm snd_soc_dapm_kcontrol_to_dapm
|
||||
#define dapm_kcontrol_get_value snd_soc_dapm_kcontrol_get_value
|
||||
#define snd_soc_dapm_kcontrol_component snd_soc_dapm_kcontrol_to_component
|
||||
|
||||
#define for_each_dapm_widgets(list, i, widget) \
|
||||
for ((i) = 0; \
|
||||
(i) < list->num_widgets && (widget = list->widgets[i]); \
|
||||
|
|
|
|||
|
|
@ -1076,7 +1076,7 @@ struct snd_soc_card {
|
|||
struct list_head dobj_list;
|
||||
|
||||
/* Generic DAPM context for the card */
|
||||
struct snd_soc_dapm_context dapm;
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
struct snd_soc_dapm_stats dapm_stats;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
|
@ -1136,7 +1136,7 @@ static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
|
|||
|
||||
static inline struct snd_soc_dapm_context *snd_soc_card_to_dapm(struct snd_soc_card *card)
|
||||
{
|
||||
return &card->dapm;
|
||||
return card->dapm;
|
||||
}
|
||||
|
||||
/* SoC machine DAI configuration, glues a codec and cpu DAI together */
|
||||
|
|
|
|||
|
|
@ -1188,8 +1188,8 @@ static int adcx140_set_bias_level(struct snd_soc_component *component,
|
|||
enum snd_soc_bias_level level)
|
||||
{
|
||||
struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
|
||||
enum snd_soc_bias_level prev_level
|
||||
= snd_soc_component_get_bias_level(component);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
|
||||
enum snd_soc_bias_level prev_level = snd_soc_dapm_get_bias_level(dapm);
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
|
|
|
|||
|
|
@ -142,88 +142,6 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component,
|
|||
return soc_component_ret(component, ret);
|
||||
}
|
||||
|
||||
int snd_soc_component_enable_pin(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_enable_pin(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin);
|
||||
|
||||
int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_enable_pin_unlocked(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin_unlocked);
|
||||
|
||||
int snd_soc_component_disable_pin(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_disable_pin(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin);
|
||||
|
||||
int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_disable_pin_unlocked(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin_unlocked);
|
||||
|
||||
int snd_soc_component_nc_pin(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_nc_pin(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin);
|
||||
|
||||
int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_nc_pin_unlocked(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin_unlocked);
|
||||
|
||||
int snd_soc_component_get_pin_status(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_get_pin_status(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_get_pin_status);
|
||||
|
||||
int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_force_enable_pin(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin);
|
||||
|
||||
int snd_soc_component_force_enable_pin_unlocked(
|
||||
struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_force_enable_pin_unlocked(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked);
|
||||
|
||||
static void soc_get_kcontrol_name(struct snd_soc_component *component,
|
||||
char *buf, int size, const char * const ctl)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2556,6 +2556,10 @@ int snd_soc_register_card(struct snd_soc_card *card)
|
|||
if (!card->name || !card->dev)
|
||||
return -EINVAL;
|
||||
|
||||
card->dapm = snd_soc_dapm_alloc(card->dev);
|
||||
if (!card->dapm)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_set_drvdata(card->dev, card);
|
||||
|
||||
INIT_LIST_HEAD(&card->widgets);
|
||||
|
|
@ -2840,6 +2844,10 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
|
|||
const struct snd_soc_component_driver *driver,
|
||||
struct device *dev)
|
||||
{
|
||||
component->dapm = snd_soc_dapm_alloc(dev);
|
||||
if (!component->dapm)
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_LIST_HEAD(&component->dai_list);
|
||||
INIT_LIST_HEAD(&component->dobj_list);
|
||||
INIT_LIST_HEAD(&component->card_list);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue