summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/audio_codec.h
diff options
context:
space:
mode:
authorVaibhav Agarwal <vaibhav.agarwal@linaro.org>2016-01-13 14:07:51 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2016-01-13 16:41:36 -0800
commit6339d2322c47f4b8ebabf9daf0130328ed72648b (patch)
treeadc601e095d625334fdf81fc38508dd73c9ed631 /drivers/staging/greybus/audio_codec.h
parent2a70e49f9183d72287e84ac4d6a4080e3f2a6475 (diff)
greybus: audio: Add topology parser for GB codec
For each GB codec module inserted, DAPM widgets, kcontrols, routes and DAIs can be fetched through greybus in a binary chunk and parsed locally to create & populate DAPM graph for the specific module. It is required by each codec module to populate a minimum set of kcontrols with fixed names to support basic audio usecase. To support advanced features of codec module, the same can be polpulated with existing topology parser. However, to use them for different usecase separate mechanism (may be via MSP) is required to inform userspace about their configuration value & enable/disable sequence. ToDos: Currently, support for enumerated kcontrol/dapm control is hardcoded. Need to add complete logic within the parser. Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Signed-off-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/audio_codec.h')
-rw-r--r--drivers/staging/greybus/audio_codec.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/staging/greybus/audio_codec.h b/drivers/staging/greybus/audio_codec.h
index 39bd995719c2..5051e06dfff6 100644
--- a/drivers/staging/greybus/audio_codec.h
+++ b/drivers/staging/greybus/audio_codec.h
@@ -68,6 +68,19 @@ static const u8 gbcodec_reg_defaults[GBCODEC_REG_COUNT] = {
GBCODEC_APB2_MUX_REG_DEFAULT,
};
+struct gbaudio_widget {
+ __u8 id;
+ const char *name;
+ struct list_head list;
+};
+
+struct gbaudio_control {
+ __u8 id;
+ char *name;
+ const char * const *texts;
+ struct list_head list;
+};
+
struct gbaudio_dai {
__le16 data_cport;
char name[NAME_SIZE];
@@ -87,6 +100,7 @@ struct gbaudio_codec_info {
char vstr[NAME_SIZE];
char pstr[NAME_SIZE];
struct list_head list;
+ struct gb_audio_topology *topology;
char name[NAME_SIZE];
/* soc related data */
@@ -105,6 +119,10 @@ struct gbaudio_codec_info {
int num_kcontrols;
int num_dapm_widgets;
int num_dapm_routes;
+ unsigned long dai_offset;
+ unsigned long widget_offset;
+ unsigned long control_offset;
+ unsigned long route_offset;
struct snd_kcontrol_new *kctls;
struct snd_soc_dapm_widget *widgets;
struct snd_soc_dapm_route *routes;
@@ -112,10 +130,23 @@ struct gbaudio_codec_info {
/* lists */
struct list_head dai_list;
+ struct list_head widget_list;
+ struct list_head codec_ctl_list;
+ struct list_head widget_ctl_list;
struct mutex lock;
};
+struct gbaudio_dai *gbaudio_add_dai(struct gbaudio_codec_info *gbcodec,
+ int data_cport,
+ struct gb_connection *connection,
+ const char *name);
+int gbaudio_tplg_parse_data(struct gbaudio_codec_info *gbcodec,
+ struct gb_audio_topology *tplg_data);
+void gbaudio_tplg_release(struct gbaudio_codec_info *gbcodec);
+
/* protocol related */
+extern int gb_audio_gb_get_topology(struct gb_connection *connection,
+ struct gb_audio_topology **topology);
extern int gb_audio_gb_get_control(struct gb_connection *connection,
uint8_t control_id, uint8_t index,
struct gb_audio_ctl_elem_value *value);