Skip to content

Commit

Permalink
Merge remote-tracking branch 'asoc/topic/component' into asoc-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Brown committed Aug 4, 2014
2 parents 7c08152 + 0f2780a commit a1cb98a
Show file tree
Hide file tree
Showing 23 changed files with 1,125 additions and 749 deletions.
5 changes: 4 additions & 1 deletion include/sound/soc-dai.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ struct snd_soc_dai {

struct snd_soc_dapm_widget *playback_widget;
struct snd_soc_dapm_widget *capture_widget;
struct snd_soc_dapm_context dapm;

/* DAI DMA data */
void *playback_dma_data;
Expand All @@ -273,6 +272,10 @@ struct snd_soc_dai {
struct snd_soc_codec *codec;
struct snd_soc_component *component;

/* CODEC TDM slot masks and params (for fixup) */
unsigned int tx_mask;
unsigned int rx_mask;

struct snd_soc_card *card;

struct list_head list;
Expand Down
8 changes: 5 additions & 3 deletions include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
const char *pin);
int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
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 */
void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
Expand All @@ -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_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 */
enum snd_soc_dapm_type {
Expand Down Expand Up @@ -524,7 +526,6 @@ struct snd_soc_dapm_widget {
const char *name; /* widget name */
const char *sname; /* stream name */
struct snd_soc_codec *codec;
struct snd_soc_platform *platform;
struct list_head list;
struct snd_soc_dapm_context *dapm;

Expand Down Expand Up @@ -593,14 +594,15 @@ struct snd_soc_dapm_context {
struct device *dev; /* from parent - for debug */
struct snd_soc_component *component; /* parent component */
struct snd_soc_codec *codec; /* parent codec */
struct snd_soc_platform *platform; /* parent platform */
struct snd_soc_card *card; /* parent card */

/* used during DAPM updates */
enum snd_soc_bias_level target_bias_level;
struct list_head list;

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
struct dentry *debugfs_dapm;
Expand Down
78 changes: 57 additions & 21 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_platform *platform);

int soc_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai);

/* Jack reporting */
int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
struct snd_soc_jack *jack);
Expand Down Expand Up @@ -503,10 +507,12 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
const char *prefix);
struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
const char *name);
int snd_soc_add_component_controls(struct snd_soc_component *component,
const struct snd_kcontrol_new *controls, unsigned int num_controls);
int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
const struct snd_kcontrol_new *controls, int num_controls);
const struct snd_kcontrol_new *controls, unsigned int num_controls);
int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
const struct snd_kcontrol_new *controls, int num_controls);
const struct snd_kcontrol_new *controls, unsigned int num_controls);
int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
const struct snd_kcontrol_new *controls, int num_controls);
int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
Expand Down Expand Up @@ -677,12 +683,17 @@ struct snd_soc_component_driver {
int (*of_xlate_dai_name)(struct snd_soc_component *component,
struct of_phandle_args *args,
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 {
const char *name;
int id;
const char *name_prefix;
struct device *dev;
struct snd_soc_card *card;

unsigned int active;

Expand All @@ -705,18 +716,18 @@ struct snd_soc_component {
int val_bytes;

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 */
struct snd_soc_codec {
const char *name;
const char *name_prefix;
int id;
struct device *dev;
const struct snd_soc_codec_driver *driver;

struct mutex mutex;
struct snd_soc_card *card;
struct list_head list;
struct list_head card_list;

Expand Down Expand Up @@ -790,9 +801,6 @@ struct snd_soc_codec_driver {
void (*seq_notifier)(struct snd_soc_dapm_context *,
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 */

/* probe ordering - for components with runtime dependencies */
Expand Down Expand Up @@ -834,9 +842,6 @@ struct snd_soc_platform_driver {
/* platform stream compress 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 */
int probe_order;
int remove_order;
Expand All @@ -847,23 +852,23 @@ struct snd_soc_platform_driver {
int (*bespoke_trigger)(struct snd_pcm_substream *, int);
};

struct snd_soc_platform {
struct snd_soc_dai_link_component {
const char *name;
int id;
const struct device_node *of_node;
const char *dai_name;
};

struct snd_soc_platform {
struct device *dev;
const struct snd_soc_platform_driver *driver;

unsigned int suspended:1; /* platform is suspended */
unsigned int probed:1;

struct snd_soc_card *card;
struct list_head list;
struct list_head card_list;

struct snd_soc_component component;

struct snd_soc_dapm_context dapm;

#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_platform_root;
#endif
Expand Down Expand Up @@ -896,6 +901,10 @@ struct snd_soc_dai_link {
const struct device_node *codec_of_node;
/* You MUST specify the DAI name within the codec */
const char *codec_dai_name;

struct snd_soc_dai_link_component *codecs;
unsigned int num_codecs;

/*
* You MAY specify the link's platform/PCM/DMA driver, either by
* device name, or by DT/OF node, but not both. Some forms of link
Expand Down Expand Up @@ -1047,7 +1056,6 @@ struct snd_soc_card {

/* lists of probed devices belonging to this card */
struct list_head codec_dev_list;
struct list_head platform_dev_list;

struct list_head widgets;
struct list_head paths;
Expand Down Expand Up @@ -1094,6 +1102,9 @@ struct snd_soc_pcm_runtime {
struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai;

struct snd_soc_dai **codec_dais;
unsigned int num_codecs;

struct delayed_work delayed_work;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_dpcm_root;
Expand Down Expand Up @@ -1164,6 +1175,21 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform(
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
* @dapm: The DAPM context to cast to the CODEC
Expand All @@ -1188,7 +1214,18 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
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 */
Expand Down Expand Up @@ -1261,7 +1298,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
{
INIT_LIST_HEAD(&card->codec_dev_list);
INIT_LIST_HEAD(&card->platform_dev_list);
INIT_LIST_HEAD(&card->widgets);
INIT_LIST_HEAD(&card->paths);
INIT_LIST_HEAD(&card->dapm_list);
Expand Down
6 changes: 3 additions & 3 deletions include/trace/events/asoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,17 @@ TRACE_EVENT(snd_soc_cache_sync,
TP_ARGS(codec, type, status),

TP_STRUCT__entry(
__string( name, codec->name )
__string( name, codec->component.name)
__string( status, status )
__string( type, type )
__field( int, id )
),

TP_fast_assign(
__assign_str(name, codec->name);
__assign_str(name, codec->component.name);
__assign_str(status, status);
__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),
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/codecs/ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ static int ac97_soc_probe(struct snd_soc_codec *codec)
int ret;

/* add codec as bus device for standard ac97 */
ret = snd_ac97_bus(codec->card->snd_card, 0, soc_ac97_ops, NULL,
&ac97_bus);
ret = snd_ac97_bus(codec->component.card->snd_card, 0, soc_ac97_ops,
NULL, &ac97_bus);
if (ret < 0)
return ret;

Expand Down
6 changes: 3 additions & 3 deletions sound/soc/codecs/cx20442.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static void v253_close(struct tty_struct *tty)
/* Prevent the codec driver from further accessing the modem */
codec->hw_write = NULL;
cx20442->control_data = NULL;
codec->card->pop_time = 0;
codec->component.card->pop_time = 0;
}

/* Line discipline .hangup() */
Expand Down Expand Up @@ -281,7 +281,7 @@ static void v253_receive(struct tty_struct *tty,
/* Set up codec driver access to modem controls */
cx20442->control_data = tty;
codec->hw_write = (hw_write_t)tty->ops->write;
codec->card->pop_time = 1;
codec->component.card->pop_time = 1;
}
}

Expand Down Expand Up @@ -372,7 +372,7 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)

snd_soc_codec_set_drvdata(codec, cx20442);
codec->hw_write = NULL;
codec->card->pop_time = 0;
codec->component.card->pop_time = 0;

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/tlv320dac33.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
if (dac33->irq >= 0) {
ret = request_irq(dac33->irq, dac33_interrupt_handler,
IRQF_TRIGGER_RISING,
codec->name, codec);
codec->component.name, codec);
if (ret < 0) {
dev_err(codec->dev, "Could not request IRQ%d (%d)\n",
dac33->irq, ret);
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/uda134x.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ static struct snd_soc_dai_driver uda134x_dai = {
static int uda134x_soc_probe(struct snd_soc_codec *codec)
{
struct uda134x_priv *uda134x;
struct uda134x_platform_data *pd = codec->card->dev->platform_data;
struct uda134x_platform_data *pd = codec->component.card->dev->platform_data;
const struct snd_soc_dapm_widget *widgets;
unsigned num_widgets;

Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/wm8960.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec)
* list each time to find the desired power state do so now
* and save the result.
*/
list_for_each_entry(w, &codec->card->widgets, list) {
list_for_each_entry(w, &codec->component.card->widgets, list) {
if (w->dapm != &codec->dapm)
continue;
if (strcmp(w->name, "LOUT1 PGA") == 0)
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/codecs/wm_adsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
int ret;
int val;

dsp->card = codec->card;
dsp->card = codec->component.card;

switch (event) {
case SND_SOC_DAPM_POST_PMU:
Expand Down Expand Up @@ -1617,7 +1617,7 @@ int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
struct wm_adsp *dsp = &dsps[w->shift];

dsp->card = codec->card;
dsp->card = codec->component.card;

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/omap/ams-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static int cx81801_open(struct tty_struct *tty)
static void cx81801_close(struct tty_struct *tty)
{
struct snd_soc_codec *codec = tty->disc_data;
struct snd_soc_dapm_context *dapm = &codec->card->dapm;
struct snd_soc_dapm_context *dapm = &codec->component.card->dapm;

del_timer_sync(&cx81801_timer);

Expand Down
7 changes: 3 additions & 4 deletions sound/soc/soc-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
mutex_init(&codec->cache_rw_mutex);

dev_dbg(codec->dev, "ASoC: Initializing cache for %s codec\n",
codec->name);
codec->component.name);

if (codec_drv->reg_cache_default)
codec->reg_cache = kmemdup(codec_drv->reg_cache_default,
Expand All @@ -98,8 +98,7 @@ int snd_soc_cache_init(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",
codec->name);

codec->component.name);
kfree(codec->reg_cache);
codec->reg_cache = NULL;
return 0;
Expand Down Expand Up @@ -192,7 +191,7 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
return 0;

dev_dbg(codec->dev, "ASoC: Syncing cache for %s codec\n",
codec->name);
codec->component.name);
trace_snd_soc_cache_sync(codec, name, "start");
ret = snd_soc_flat_cache_sync(codec);
if (!ret)
Expand Down
Loading

0 comments on commit a1cb98a

Please sign in to comment.