Commit 2a70e49f authored by Vaibhav Agarwal's avatar Vaibhav Agarwal Committed by Greg Kroah-Hartman

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: default avatarVaibhav Agarwal <vaibhav.agarwal@linaro.org>
Signed-off-by: default avatarMark Greer <mgreer@animalcreek.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 86a685dd
This diff is collapsed.
......@@ -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);
......
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