diff options
author | Vaibhav Agarwal <vaibhav.agarwal@linaro.org> | 2016-01-13 14:07:50 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-01-13 16:20:20 -0800 |
commit | 2a70e49f9183d72287e84ac4d6a4080e3f2a6475 (patch) | |
tree | 96944aac0351584f116e78dcf1ba9aad8ec82ef9 /drivers/staging/greybus/audio_codec.h | |
parent | 86a685dd453547431794a5c332a9ed742916c9d4 (diff) | |
download | op-kernel-dev-2a70e49f9183d72287e84ac4d6a4080e3f2a6475.zip op-kernel-dev-2a70e49f9183d72287e84ac4d6a4080e3f2a6475.tar.gz |
greybus: audio: Use greybus connection device for codec registration
Use GB Audio mgmt, data protocol ids to register codec module with
GB protocol. And in response to mgmt->connection_init(), register
GB codec driver with ASoC.
Now, using msm8994 machine to register DAI link dynamically on
codec insertion.
ToDos:
- snd_soc_register_codec() uses driver->name to identify device id.
However, for GB device, .driver{} is not yet populated by GB core.
Thus, defining dummy structure within codec driver. This should
come from GB core itself.
Even existing .driver{} may cause problem in case of multiple
modules inserted or inserted at a different slot.
- Fix logic for gbcodec->dais & gbcodec->dailinks. Current
implementation contains some hard coded data with assumption of
count=1.
- Evaluate definition of 'gbaudio_dailink.be_id' in case of multiple
DAI links.
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.h | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/drivers/staging/greybus/audio_codec.h b/drivers/staging/greybus/audio_codec.h index f8597b3..39bd995 100644 --- a/drivers/staging/greybus/audio_codec.h +++ b/drivers/staging/greybus/audio_codec.h @@ -15,6 +15,7 @@ #include "greybus_protocols.h" #define NAME_SIZE 32 +#define MAX_DAIS 2 /* APB1, APB2 */ enum { APB1_PCM = 0, @@ -67,24 +68,54 @@ static const u8 gbcodec_reg_defaults[GBCODEC_REG_COUNT] = { GBCODEC_APB2_MUX_REG_DEFAULT, }; +struct gbaudio_dai { + __le16 data_cport; + char name[NAME_SIZE]; + struct gb_connection *connection; + struct list_head list; +}; + struct gbaudio_codec_info { + /* module info */ + int dev_id; /* check if it should be bundle_id/hd_cport_id */ + int vid; + int pid; + int slot; + int type; + int dai_added; + int codec_registered; + char vstr[NAME_SIZE]; + char pstr[NAME_SIZE]; + struct list_head list; + char name[NAME_SIZE]; + + /* soc related data */ struct snd_soc_codec *codec; - - bool usable; + struct device *dev; u8 reg[GBCODEC_REG_COUNT]; - int registered; + /* dai_link related */ + char card_name[NAME_SIZE]; + char *dailink_name[MAX_DAIS]; + int num_dai_links; + + /* topology related */ + struct gb_connection *mgmt_connection; + int num_dais; int num_kcontrols; int num_dapm_widgets; int num_dapm_routes; struct snd_kcontrol_new *kctls; struct snd_soc_dapm_widget *widgets; struct snd_soc_dapm_route *routes; + struct snd_soc_dai_driver *dais; + + /* lists */ + struct list_head dai_list; struct mutex lock; }; -extern int gb_audio_gb_get_topology(struct gb_connection *connection, - struct gb_audio_topology **topology); +/* protocol related */ 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); |