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 Oct 6, 2014
2 parents 832a941 + b2d9de5 commit 5bcaca4
Show file tree
Hide file tree
Showing 18 changed files with 760 additions and 519 deletions.
1 change: 0 additions & 1 deletion include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ 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_card *card; /* parent card */

/* used during DAPM updates */
Expand Down
94 changes: 59 additions & 35 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,28 @@ struct snd_soc_compr_ops {
struct snd_soc_component_driver {
const char *name;

/* Default control and setup, added after probe() is run */
const struct snd_kcontrol_new *controls;
unsigned int num_controls;
const struct snd_soc_dapm_widget *dapm_widgets;
unsigned int num_dapm_widgets;
const struct snd_soc_dapm_route *dapm_routes;
unsigned int num_dapm_routes;

int (*probe)(struct snd_soc_component *);
void (*remove)(struct snd_soc_component *);

/* DT */
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);

/* probe ordering - for components with runtime dependencies */
int probe_order;
int remove_order;
};

struct snd_soc_component {
Expand All @@ -710,6 +725,7 @@ struct snd_soc_component {

unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
unsigned int registered_as_component:1;
unsigned int probed:1;

struct list_head list;

Expand All @@ -728,9 +744,35 @@ struct snd_soc_component {

struct mutex io_mutex;

#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_root;
#endif

/*
* DO NOT use any of the fields below in drivers, they are temporary and
* are going to be removed again soon. If you use them in driver code 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_ptr;

const struct snd_kcontrol_new *controls;
unsigned int num_controls;
const struct snd_soc_dapm_widget *dapm_widgets;
unsigned int num_dapm_widgets;
const struct snd_soc_dapm_route *dapm_routes;
unsigned int num_dapm_routes;
struct snd_soc_codec *codec;

int (*probe)(struct snd_soc_component *);
void (*remove)(struct snd_soc_component *);

#ifdef CONFIG_DEBUG_FS
void (*init_debugfs)(struct snd_soc_component *component);
const char *debugfs_prefix;
#endif
};

/* SoC Audio Codec device */
Expand All @@ -746,11 +788,9 @@ struct snd_soc_codec {
struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
unsigned int cache_bypass:1; /* Suppress access to the cache */
unsigned int suspended:1; /* Codec is in suspend PM state */
unsigned int probed:1; /* Codec has been probed */
unsigned int ac97_registered:1; /* Codec has been AC97 registered */
unsigned int ac97_created:1; /* Codec has been created by SoC */
unsigned int cache_init:1; /* codec cache has been initialized */
u32 cache_only; /* Suppress writes to hardware */
u32 cache_sync; /* Cache needs to be synced to hardware */

/* codec IO */
Expand All @@ -766,7 +806,6 @@ struct snd_soc_codec {
struct snd_soc_dapm_context dapm;

#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_codec_root;
struct dentry *debugfs_reg;
#endif
};
Expand Down Expand Up @@ -813,10 +852,6 @@ struct snd_soc_codec_driver {
enum snd_soc_dapm_type, int);

bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */

/* probe ordering - for components with runtime dependencies */
int probe_order;
int remove_order;
};

/* SoC platform interface */
Expand All @@ -832,14 +867,6 @@ struct snd_soc_platform_driver {
int (*pcm_new)(struct snd_soc_pcm_runtime *);
void (*pcm_free)(struct snd_pcm *);

/* Default control and setup, added after probe() is run */
const struct snd_kcontrol_new *controls;
int num_controls;
const struct snd_soc_dapm_widget *dapm_widgets;
int num_dapm_widgets;
const struct snd_soc_dapm_route *dapm_routes;
int num_dapm_routes;

/*
* For platform caused delay reporting.
* Optional.
Expand All @@ -853,13 +880,6 @@ struct snd_soc_platform_driver {
/* platform stream compress ops */
const struct snd_compr_ops *compr_ops;

/* probe ordering - for components with runtime dependencies */
int probe_order;
int remove_order;

/* platform IO - used for platform DAPM */
unsigned int (*read)(struct snd_soc_platform *, unsigned int);
int (*write)(struct snd_soc_platform *, unsigned int, unsigned int);
int (*bespoke_trigger)(struct snd_pcm_substream *, int);
};

Expand All @@ -874,15 +894,10 @@ struct snd_soc_platform {
const struct snd_soc_platform_driver *driver;

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

struct list_head list;

struct snd_soc_component component;

#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_platform_root;
#endif
};

struct snd_soc_dai_link {
Expand Down Expand Up @@ -994,7 +1009,7 @@ struct snd_soc_aux_dev {
const struct device_node *codec_of_node;

/* codec/machine specific init - e.g. add machine controls */
int (*init)(struct snd_soc_dapm_context *dapm);
int (*init)(struct snd_soc_component *component);
};

/* SoC card */
Expand Down Expand Up @@ -1112,6 +1127,7 @@ struct snd_soc_pcm_runtime {
struct snd_soc_platform *platform;
struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai;
struct snd_soc_component *component; /* Only valid for AUX dev rtds */

struct snd_soc_dai **codec_dais;
unsigned int num_codecs;
Expand Down Expand Up @@ -1260,9 +1276,6 @@ void snd_soc_component_async_complete(struct snd_soc_component *component);
int snd_soc_component_test_bits(struct snd_soc_component *component,
unsigned int reg, unsigned int mask, unsigned int value);

int snd_soc_component_init_io(struct snd_soc_component *component,
struct regmap *regmap);

/* device driver data */

static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
Expand All @@ -1276,26 +1289,37 @@ static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
return card->drvdata;
}

static inline void snd_soc_component_set_drvdata(struct snd_soc_component *c,
void *data)
{
dev_set_drvdata(c->dev, data);
}

static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c)
{
return dev_get_drvdata(c->dev);
}

static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
void *data)
{
dev_set_drvdata(codec->dev, data);
snd_soc_component_set_drvdata(&codec->component, data);
}

static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
{
return dev_get_drvdata(codec->dev);
return snd_soc_component_get_drvdata(&codec->component);
}

static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform,
void *data)
{
dev_set_drvdata(platform->dev, data);
snd_soc_component_set_drvdata(&platform->component, data);
}

static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform)
{
return dev_get_drvdata(platform->dev);
return snd_soc_component_get_drvdata(&platform->component);
}

static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/wm8350.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static void wm8350_pga_work(struct work_struct *work)
{
struct snd_soc_dapm_context *dapm =
container_of(work, struct snd_soc_dapm_context, delayed_work.work);
struct snd_soc_codec *codec = dapm->codec;
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
struct wm8350_output *out1 = &wm8350_data->out1,
*out2 = &wm8350_data->out2;
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/wm8753.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ static void wm8753_work(struct work_struct *work)
struct snd_soc_dapm_context *dapm =
container_of(work, struct snd_soc_dapm_context,
delayed_work.work);
struct snd_soc_codec *codec = dapm->codec;
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
wm8753_set_bias_level(codec, dapm->bias_level);
}

Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/wm8971.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ static void wm8971_work(struct work_struct *work)
struct snd_soc_dapm_context *dapm =
container_of(work, struct snd_soc_dapm_context,
delayed_work.work);
struct snd_soc_codec *codec = dapm->codec;
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
wm8971_set_bias_level(codec, codec->dapm.bias_level);
}

Expand Down
3 changes: 2 additions & 1 deletion sound/soc/intel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
snd-soc-sst-dsp-objs := sst-dsp.o sst-firmware.o
snd-soc-sst-acpi-objs := sst-acpi.o

snd-soc-sst-mfld-platform-objs := sst-mfld-platform-pcm.o sst-mfld-platform-compress.o
snd-soc-sst-mfld-platform-objs := sst-mfld-platform-pcm.o \
sst-mfld-platform-compress.o sst-atom-controls.o
snd-soc-mfld-machine-objs := mfld_machine.o

obj-$(CONFIG_SND_SST_MFLD_PLATFORM) += snd-soc-sst-mfld-platform.o
Expand Down
39 changes: 39 additions & 0 deletions sound/soc/intel/sst-atom-controls.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* sst-atom-controls.c - Intel MID Platform driver DPCM ALSA controls for Mrfld
*
* Copyright (C) 2013-14 Intel Corp
* Author: Omair Mohammed Abdullah <omair.m.abdullah@intel.com>
* Vinod Koul <vinod.koul@intel.com>
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/slab.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include "sst-mfld-platform.h"
#include "sst-atom-controls.h"

int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform)
{
int ret = 0;
struct sst_data *drv = snd_soc_platform_get_drvdata(platform);

drv->byte_stream = devm_kzalloc(platform->dev,
SST_MAX_BIN_BYTES, GFP_KERNEL);
if (!drv->byte_stream)
return -ENOMEM;

return ret;
}
Loading

0 comments on commit 5bcaca4

Please sign in to comment.