Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e38aed40 authored by Ramprasad Katkam's avatar Ramprasad Katkam
Browse files

Asoc: swr: Bus Driver changes to support new master driver



soundwire bus driver changes to support new soundwire
master driver for Talos/vipertooth.

Change-Id: I70e52a72edd80abc72ccb99b29b1a642debec257
Signed-off-by: default avatarRamprasad Katkam <katkam@codeaurora.org>
parent 0bf1f57c
Loading
Loading
Loading
Loading
+39 −16
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -71,6 +71,7 @@ struct swr_port {
	u8 ch_mask;
	u32 ch_rate;
	u8 num_ch;
	u8 port_type;
};

enum {
@@ -753,7 +754,8 @@ static const struct snd_kcontrol_new swr_dac_port[] = {
};

static int wsa881x_set_port(struct snd_soc_codec *codec, int port_idx,
			u8 *port_id, u8 *num_ch, u8 *ch_mask, u32 *ch_rate)
			u8 *port_id, u8 *num_ch, u8 *ch_mask, u32 *ch_rate,
			u8 *port_type)
{
	struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);

@@ -761,6 +763,7 @@ static int wsa881x_set_port(struct snd_soc_codec *codec, int port_idx,
	*num_ch = wsa881x->port[port_idx].num_ch;
	*ch_mask = wsa881x->port[port_idx].ch_mask;
	*ch_rate = wsa881x->port[port_idx].ch_rate;
	*port_type = wsa881x->port[port_idx].port_type;
	return 0;
}

@@ -773,6 +776,7 @@ static int wsa881x_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
	u8 num_ch[WSA881X_MAX_SWR_PORTS];
	u8 ch_mask[WSA881X_MAX_SWR_PORTS];
	u32 ch_rate[WSA881X_MAX_SWR_PORTS];
	u8 port_type[WSA881X_MAX_SWR_PORTS];
	u8 num_port = 0;

	dev_dbg(codec->dev, "%s: event %d name %s\n", __func__,
@@ -784,53 +788,69 @@ static int wsa881x_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
	case SND_SOC_DAPM_PRE_PMU:
		wsa881x_set_port(codec, SWR_DAC_PORT,
				&port_id[num_port], &num_ch[num_port],
				&ch_mask[num_port], &ch_rate[num_port]);
				&ch_mask[num_port], &ch_rate[num_port],
				&port_type[num_port]);
		++num_port;

		if (wsa881x->comp_enable) {
			wsa881x_set_port(codec, SWR_COMP_PORT,
					&port_id[num_port], &num_ch[num_port],
					&ch_mask[num_port], &ch_rate[num_port]);
					&ch_mask[num_port], &ch_rate[num_port],
					&port_type[num_port]);
			++num_port;
		}
		if (wsa881x->boost_enable) {
			wsa881x_set_port(codec, SWR_BOOST_PORT,
					&port_id[num_port], &num_ch[num_port],
					&ch_mask[num_port], &ch_rate[num_port]);
					&ch_mask[num_port], &ch_rate[num_port],
					&port_type[num_port]);
			++num_port;
		}
		if (wsa881x->visense_enable) {
			wsa881x_set_port(codec, SWR_VISENSE_PORT,
					&port_id[num_port], &num_ch[num_port],
					&ch_mask[num_port], &ch_rate[num_port]);
					&ch_mask[num_port], &ch_rate[num_port],
					&port_type[num_port]);
			++num_port;
		}
		swr_connect_port(wsa881x->swr_slave, &port_id[0], num_port,
				&ch_mask[0], &ch_rate[0], &num_ch[0]);
				&ch_mask[0], &ch_rate[0], &num_ch[0],
					&port_type[0]);
		break;
	case SND_SOC_DAPM_POST_PMU:
		break;
	case SND_SOC_DAPM_PRE_PMD:
		break;
	case SND_SOC_DAPM_POST_PMD:
		port_id[num_port] = wsa881x->port[SWR_DAC_PORT].port_id;
		wsa881x_set_port(codec, SWR_DAC_PORT,
				&port_id[num_port], &num_ch[num_port],
				&ch_mask[num_port], &ch_rate[num_port],
				&port_type[num_port]);
		++num_port;

		if (wsa881x->comp_enable) {
			port_id[num_port] =
				wsa881x->port[SWR_COMP_PORT].port_id;
			wsa881x_set_port(codec, SWR_COMP_PORT,
					&port_id[num_port], &num_ch[num_port],
					&ch_mask[num_port], &ch_rate[num_port],
					&port_type[num_port]);
			++num_port;
		}
		if (wsa881x->boost_enable) {
			port_id[num_port] =
				wsa881x->port[SWR_BOOST_PORT].port_id;
			wsa881x_set_port(codec, SWR_BOOST_PORT,
					&port_id[num_port], &num_ch[num_port],
					&ch_mask[num_port], &ch_rate[num_port],
					&port_type[num_port]);
			++num_port;
		}
		if (wsa881x->visense_enable) {
			port_id[num_port] =
				wsa881x->port[SWR_VISENSE_PORT].port_id;
			wsa881x_set_port(codec, SWR_VISENSE_PORT,
					&port_id[num_port], &num_ch[num_port],
					&ch_mask[num_port], &ch_rate[num_port],
					&port_type[num_port]);
			++num_port;
		}
		swr_disconnect_port(wsa881x->swr_slave, &port_id[0], num_port);
		swr_disconnect_port(wsa881x->swr_slave, &port_id[0], num_port,
				&ch_mask[0], &port_type[0]);
		break;
	default:
		break;
@@ -1001,7 +1021,8 @@ static const struct snd_soc_dapm_route wsa881x_audio_map[] = {
};

int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port, u8 num_port,
				unsigned int *ch_mask, unsigned int *ch_rate)
				unsigned int *ch_mask, unsigned int *ch_rate,
					u8 *port_type)
{
	struct wsa881x_priv *wsa881x = snd_soc_codec_get_drvdata(codec);
	int i;
@@ -1018,6 +1039,8 @@ int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port, u8 num_port,
		wsa881x->port[i].ch_mask = ch_mask[i];
		wsa881x->port[i].ch_rate = ch_rate[i];
		wsa881x->port[i].num_ch = __sw_hweight8(ch_mask[i]);
		if (port_type)
			wsa881x->port[i].port_type = port_type[i];
	}
	return 0;
}
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -23,7 +23,7 @@
#if IS_ENABLED(CONFIG_SND_SOC_WSA881X)
extern int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port,
				   u8 num_port, unsigned int *ch_mask,
				   unsigned int *ch_rate);
				   unsigned int *ch_rate, u8 *port_type);

extern const u8 wsa881x_reg_readable[WSA881X_CACHE_SIZE];
extern struct regmap_config wsa881x_regmap_config;
@@ -35,7 +35,7 @@ void wsa881x_regmap_defaults(struct regmap *regmap, u8 version);
#else
extern int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port,
				   u8 num_port, unsigned int *ch_mask,
				   unsigned int *ch_rate)
				   unsigned int *ch_rate, u8 *port_type);
{
	return 0;
}
+3 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -6975,7 +6975,7 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
			__func__, codec->component.name);
		wsa881x_set_channel_map(codec, &spkleft_ports[0],
				WSA881X_MAX_SWR_PORTS, &ch_mask[0],
				&ch_rate[0]);
				&ch_rate[0], NULL);
		if (dapm->component) {
			snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft IN");
			snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
@@ -6985,7 +6985,7 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
			__func__, codec->component.name);
		wsa881x_set_channel_map(codec, &spkright_ports[0],
				WSA881X_MAX_SWR_PORTS, &ch_mask[0],
				&ch_rate[0]);
				&ch_rate[0], NULL);
		if (dapm->component) {
			snd_soc_dapm_ignore_suspend(dapm, "SpkrRight IN");
			snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
+2 −2
Original line number Diff line number Diff line
@@ -3075,7 +3075,7 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
				__func__, codec->component.name);
		wsa881x_set_channel_map(codec, &spkleft_ports[0],
				WSA881X_MAX_SWR_PORTS, &ch_mask[0],
				&ch_rate[0]);
				&ch_rate[0], NULL);
		if (dapm->component) {
			snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft IN");
			snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
@@ -3085,7 +3085,7 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
				__func__, codec->component.name);
		wsa881x_set_channel_map(codec, &spkright_ports[0],
				WSA881X_MAX_SWR_PORTS, &ch_mask[0],
				&ch_rate[0]);
				&ch_rate[0], NULL);
		if (dapm->component) {
			snd_soc_dapm_ignore_suspend(dapm, "SpkrRight IN");
			snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
+3 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -6603,7 +6603,7 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
			__func__, codec->component.name);
		wsa881x_set_channel_map(codec, &spkleft_ports[0],
				WSA881X_MAX_SWR_PORTS, &ch_mask[0],
				&ch_rate[0]);
				&ch_rate[0], NULL);
		if (dapm->component) {
			snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft IN");
			snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
@@ -6613,7 +6613,7 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
			__func__, codec->component.name);
		wsa881x_set_channel_map(codec, &spkright_ports[0],
				WSA881X_MAX_SWR_PORTS, &ch_mask[0],
				&ch_rate[0]);
				&ch_rate[0], NULL);
		if (dapm->component) {
			snd_soc_dapm_ignore_suspend(dapm, "SpkrRight IN");
			snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
Loading