Commit f7acb369 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/component' into asoc-multi

parents c8dd1fec 5f3484ac
...@@ -257,7 +257,6 @@ struct snd_soc_dai { ...@@ -257,7 +257,6 @@ struct snd_soc_dai {
struct snd_soc_dapm_widget *playback_widget; struct snd_soc_dapm_widget *playback_widget;
struct snd_soc_dapm_widget *capture_widget; struct snd_soc_dapm_widget *capture_widget;
struct snd_soc_dapm_context dapm;
/* DAI DMA data */ /* DAI DMA data */
void *playback_dma_data; void *playback_dma_data;
......
...@@ -431,7 +431,7 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, ...@@ -431,7 +431,7 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
const char *pin); const char *pin);
int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
const char *pin); const char *pin);
void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
/* Mostly internal - should not normally be used */ /* Mostly internal - should not normally be used */
void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm); void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
...@@ -441,6 +441,8 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, ...@@ -441,6 +441,8 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
struct snd_soc_dapm_widget_list **list); struct snd_soc_dapm_widget_list **list);
struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol); struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
struct snd_kcontrol *kcontrol);
/* dapm widget types */ /* dapm widget types */
enum snd_soc_dapm_type { enum snd_soc_dapm_type {
...@@ -524,7 +526,6 @@ struct snd_soc_dapm_widget { ...@@ -524,7 +526,6 @@ struct snd_soc_dapm_widget {
const char *name; /* widget name */ const char *name; /* widget name */
const char *sname; /* stream name */ const char *sname; /* stream name */
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct snd_soc_platform *platform;
struct list_head list; struct list_head list;
struct snd_soc_dapm_context *dapm; struct snd_soc_dapm_context *dapm;
...@@ -593,7 +594,6 @@ struct snd_soc_dapm_context { ...@@ -593,7 +594,6 @@ struct snd_soc_dapm_context {
struct device *dev; /* from parent - for debug */ struct device *dev; /* from parent - for debug */
struct snd_soc_component *component; /* parent component */ struct snd_soc_component *component; /* parent component */
struct snd_soc_codec *codec; /* parent codec */ struct snd_soc_codec *codec; /* parent codec */
struct snd_soc_platform *platform; /* parent platform */
struct snd_soc_card *card; /* parent card */ struct snd_soc_card *card; /* parent card */
/* used during DAPM updates */ /* used during DAPM updates */
...@@ -601,6 +601,8 @@ struct snd_soc_dapm_context { ...@@ -601,6 +601,8 @@ struct snd_soc_dapm_context {
struct list_head list; struct list_head list;
int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
int (*set_bias_level)(struct snd_soc_dapm_context *dapm,
enum snd_soc_bias_level level);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_dapm; struct dentry *debugfs_dapm;
......
...@@ -677,11 +677,15 @@ struct snd_soc_component_driver { ...@@ -677,11 +677,15 @@ struct snd_soc_component_driver {
int (*of_xlate_dai_name)(struct snd_soc_component *component, int (*of_xlate_dai_name)(struct snd_soc_component *component,
struct of_phandle_args *args, struct of_phandle_args *args,
const char **dai_name); const char **dai_name);
void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
int subseq);
int (*stream_event)(struct snd_soc_component *, int event);
}; };
struct snd_soc_component { struct snd_soc_component {
const char *name; const char *name;
int id; int id;
const char *name_prefix;
struct device *dev; struct device *dev;
unsigned int active; unsigned int active;
...@@ -705,13 +709,14 @@ struct snd_soc_component { ...@@ -705,13 +709,14 @@ struct snd_soc_component {
int val_bytes; int val_bytes;
struct mutex io_mutex; struct mutex io_mutex;
/* Don't use these, use snd_soc_component_get_dapm() */
struct snd_soc_dapm_context dapm;
struct snd_soc_dapm_context *dapm_ptr;
}; };
/* SoC Audio Codec device */ /* SoC Audio Codec device */
struct snd_soc_codec { struct snd_soc_codec {
const char *name;
const char *name_prefix;
int id;
struct device *dev; struct device *dev;
const struct snd_soc_codec_driver *driver; const struct snd_soc_codec_driver *driver;
...@@ -790,9 +795,6 @@ struct snd_soc_codec_driver { ...@@ -790,9 +795,6 @@ struct snd_soc_codec_driver {
void (*seq_notifier)(struct snd_soc_dapm_context *, void (*seq_notifier)(struct snd_soc_dapm_context *,
enum snd_soc_dapm_type, int); enum snd_soc_dapm_type, int);
/* codec stream completion event */
int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
/* probe ordering - for components with runtime dependencies */ /* probe ordering - for components with runtime dependencies */
...@@ -834,9 +836,6 @@ struct snd_soc_platform_driver { ...@@ -834,9 +836,6 @@ struct snd_soc_platform_driver {
/* platform stream compress ops */ /* platform stream compress ops */
const struct snd_compr_ops *compr_ops; const struct snd_compr_ops *compr_ops;
/* platform stream completion event */
int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
/* probe ordering - for components with runtime dependencies */ /* probe ordering - for components with runtime dependencies */
int probe_order; int probe_order;
int remove_order; int remove_order;
...@@ -848,8 +847,6 @@ struct snd_soc_platform_driver { ...@@ -848,8 +847,6 @@ struct snd_soc_platform_driver {
}; };
struct snd_soc_platform { struct snd_soc_platform {
const char *name;
int id;
struct device *dev; struct device *dev;
const struct snd_soc_platform_driver *driver; const struct snd_soc_platform_driver *driver;
...@@ -862,8 +859,6 @@ struct snd_soc_platform { ...@@ -862,8 +859,6 @@ struct snd_soc_platform {
struct snd_soc_component component; struct snd_soc_component component;
struct snd_soc_dapm_context dapm;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_platform_root; struct dentry *debugfs_platform_root;
#endif #endif
...@@ -1164,6 +1159,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform( ...@@ -1164,6 +1159,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform(
return container_of(component, struct snd_soc_platform, component); return container_of(component, struct snd_soc_platform, component);
} }
/**
* snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
* embedded in
* @dapm: The DAPM context to cast to the component
*
* This function must only be used on DAPM contexts that are known to be part of
* a component (e.g. in a component driver). Otherwise the behavior is
* undefined.
*/
static inline struct snd_soc_component *snd_soc_dapm_to_component(
struct snd_soc_dapm_context *dapm)
{
return container_of(dapm, struct snd_soc_component, dapm);
}
/** /**
* snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in
* @dapm: The DAPM context to cast to the CODEC * @dapm: The DAPM context to cast to the CODEC
...@@ -1188,7 +1198,18 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec( ...@@ -1188,7 +1198,18 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
static inline struct snd_soc_platform *snd_soc_dapm_to_platform( static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
struct snd_soc_dapm_context *dapm) struct snd_soc_dapm_context *dapm)
{ {
return container_of(dapm, struct snd_soc_platform, dapm); return snd_soc_component_to_platform(snd_soc_dapm_to_component(dapm));
}
/**
* snd_soc_component_get_dapm() - Returns the DAPM context associated with a
* component
* @component: The component for which to get the DAPM context
*/
static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
struct snd_soc_component *component)
{
return component->dapm_ptr;
} }
/* codec IO */ /* codec IO */
......
...@@ -296,17 +296,17 @@ TRACE_EVENT(snd_soc_cache_sync, ...@@ -296,17 +296,17 @@ TRACE_EVENT(snd_soc_cache_sync,
TP_ARGS(codec, type, status), TP_ARGS(codec, type, status),
TP_STRUCT__entry( TP_STRUCT__entry(
__string( name, codec->name ) __string( name, codec->component.name)
__string( status, status ) __string( status, status )
__string( type, type ) __string( type, type )
__field( int, id ) __field( int, id )
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(name, codec->name); __assign_str(name, codec->component.name);
__assign_str(status, status); __assign_str(status, status);
__assign_str(type, type); __assign_str(type, type);
__entry->id = codec->id; __entry->id = codec->component.id;
), ),
TP_printk("codec=%s.%d type=%s status=%s", __get_str(name), TP_printk("codec=%s.%d type=%s status=%s", __get_str(name),
......
...@@ -1404,7 +1404,7 @@ static int dac33_soc_probe(struct snd_soc_codec *codec) ...@@ -1404,7 +1404,7 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
if (dac33->irq >= 0) { if (dac33->irq >= 0) {
ret = request_irq(dac33->irq, dac33_interrupt_handler, ret = request_irq(dac33->irq, dac33_interrupt_handler,
IRQF_TRIGGER_RISING, IRQF_TRIGGER_RISING,
codec->name, codec); codec->component.name, codec);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Could not request IRQ%d (%d)\n", dev_err(codec->dev, "Could not request IRQ%d (%d)\n",
dac33->irq, ret); dac33->irq, ret);
......
...@@ -78,7 +78,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec) ...@@ -78,7 +78,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
mutex_init(&codec->cache_rw_mutex); mutex_init(&codec->cache_rw_mutex);
dev_dbg(codec->dev, "ASoC: Initializing cache for %s codec\n", dev_dbg(codec->dev, "ASoC: Initializing cache for %s codec\n",
codec->name); codec->component.name);
if (codec_drv->reg_cache_default) if (codec_drv->reg_cache_default)
codec->reg_cache = kmemdup(codec_drv->reg_cache_default, codec->reg_cache = kmemdup(codec_drv->reg_cache_default,
...@@ -98,8 +98,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec) ...@@ -98,8 +98,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
int snd_soc_cache_exit(struct snd_soc_codec *codec) int snd_soc_cache_exit(struct snd_soc_codec *codec)
{ {
dev_dbg(codec->dev, "ASoC: Destroying cache for %s codec\n", dev_dbg(codec->dev, "ASoC: Destroying cache for %s codec\n",
codec->name); codec->component.name);
kfree(codec->reg_cache); kfree(codec->reg_cache);
codec->reg_cache = NULL; codec->reg_cache = NULL;
return 0; return 0;
...@@ -192,7 +191,7 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec) ...@@ -192,7 +191,7 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
return 0; return 0;
dev_dbg(codec->dev, "ASoC: Syncing cache for %s codec\n", dev_dbg(codec->dev, "ASoC: Syncing cache for %s codec\n",
codec->name); codec->component.name);
trace_snd_soc_cache_sync(codec, name, "start"); trace_snd_soc_cache_sync(codec, name, "start");
ret = snd_soc_flat_cache_sync(codec); ret = snd_soc_flat_cache_sync(codec);
if (!ret) if (!ret)
......
...@@ -37,7 +37,8 @@ static int soc_compr_open(struct snd_compr_stream *cstream) ...@@ -37,7 +37,8 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
if (platform->driver->compr_ops && platform->driver->compr_ops->open) { if (platform->driver->compr_ops && platform->driver->compr_ops->open) {
ret = platform->driver->compr_ops->open(cstream); ret = platform->driver->compr_ops->open(cstream);
if (ret < 0) { if (ret < 0) {
pr_err("compress asoc: can't open platform %s\n", platform->name); pr_err("compress asoc: can't open platform %s\n",
platform->component.name);
goto out; goto out;
} }
} }
...@@ -84,7 +85,8 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) ...@@ -84,7 +85,8 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
if (platform->driver->compr_ops && platform->driver->compr_ops->open) { if (platform->driver->compr_ops && platform->driver->compr_ops->open) {
ret = platform->driver->compr_ops->open(cstream); ret = platform->driver->compr_ops->open(cstream);
if (ret < 0) { if (ret < 0) {
pr_err("compress asoc: can't open platform %s\n", platform->name); pr_err("compress asoc: can't open platform %s\n",
platform->component.name);
goto out; goto out;
} }
} }
...@@ -680,7 +682,7 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -680,7 +682,7 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
ret = snd_compress_new(rtd->card->snd_card, num, direction, compr); ret = snd_compress_new(rtd->card->snd_card, num, direction, compr);
if (ret < 0) { if (ret < 0) {
pr_err("compress asoc: can't create compress for codec %s\n", pr_err("compress asoc: can't create compress for codec %s\n",
codec->name); codec->component.name);
goto compr_err; goto compr_err;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -390,7 +390,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -390,7 +390,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
ret = platform->driver->ops->open(substream); ret = platform->driver->ops->open(substream);
if (ret < 0) { if (ret < 0) {
dev_err(platform->dev, "ASoC: can't open platform" dev_err(platform->dev, "ASoC: can't open platform"
" %s: %d\n", platform->name, ret); " %s: %d\n", platform->component.name, ret);
goto platform_err; goto platform_err;
} }
} }
...@@ -720,7 +720,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -720,7 +720,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
ret = platform->driver->ops->hw_params(substream, params); ret = platform->driver->ops->hw_params(substream, params);
if (ret < 0) { if (ret < 0) {
dev_err(platform->dev, "ASoC: %s hw params failed: %d\n", dev_err(platform->dev, "ASoC: %s hw params failed: %d\n",
platform->name, ret); platform->component.name, ret);
goto platform_err; goto platform_err;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment