asoc: codecs: Update SWR Ports with CPS & PBR
Reflecting latest hardware SWR updates. Change-Id: I8a4c647e3a0a4e4b958dd102efa04a66fbce4618 Signed-off-by: Matthew Rice <mrice@codeaurora.org>
This commit is contained in:

committed by
Matthew Rice

parent
e9193b07c0
commit
da73d84e5a
@@ -58,9 +58,9 @@ enum {
|
|||||||
SWR_DAC_PORT,
|
SWR_DAC_PORT,
|
||||||
SWR_COMP_PORT,
|
SWR_COMP_PORT,
|
||||||
SWR_BOOST_PORT,
|
SWR_BOOST_PORT,
|
||||||
|
SWR_PBR_PORT,
|
||||||
SWR_VISENSE_PORT,
|
SWR_VISENSE_PORT,
|
||||||
SWR_CPS_PORT,
|
SWR_CPS_PORT
|
||||||
SWR_PBRPORT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wsa_ctrl_platform_data {
|
struct wsa_ctrl_platform_data {
|
||||||
@@ -91,6 +91,8 @@ struct wsa884x_priv {
|
|||||||
struct snd_soc_component *component;
|
struct snd_soc_component *component;
|
||||||
bool comp_enable;
|
bool comp_enable;
|
||||||
bool visense_enable;
|
bool visense_enable;
|
||||||
|
bool cps_enable;
|
||||||
|
bool pbr_enable;
|
||||||
bool ext_vdd_spk;
|
bool ext_vdd_spk;
|
||||||
bool dapm_bias_off;
|
bool dapm_bias_off;
|
||||||
struct swr_port port[WSA884X_MAX_SWR_PORTS];
|
struct swr_port port[WSA884X_MAX_SWR_PORTS];
|
||||||
|
@@ -13,7 +13,7 @@ enum {
|
|||||||
RD_WR_REG,
|
RD_WR_REG,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define WSA884X_BASE 0x0
|
#define WSA884X_BASE 0x3000
|
||||||
#define WSA884X_REG(reg) (reg - WSA884X_BASE)
|
#define WSA884X_REG(reg) (reg - WSA884X_BASE)
|
||||||
|
|
||||||
#define WSA884X_BG_TSADC_BASE (WSA884X_BASE+0x01)
|
#define WSA884X_BG_TSADC_BASE (WSA884X_BASE+0x01)
|
||||||
|
@@ -907,6 +907,56 @@ static int wsa884x_set_visense(struct snd_kcontrol *kcontrol,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int wsa884x_get_pbr(struct snd_kcontrol *kcontrol,
|
||||||
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
|
{
|
||||||
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_kcontrol_component(kcontrol);
|
||||||
|
struct wsa884x_priv *wsa884x = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
|
ucontrol->value.integer.value[0] = wsa884x->pbr_enable;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int wsa884x_set_pbr(struct snd_kcontrol *kcontrol,
|
||||||
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
|
{
|
||||||
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_kcontrol_component(kcontrol);
|
||||||
|
struct wsa884x_priv *wsa884x = snd_soc_component_get_drvdata(component);
|
||||||
|
int value = ucontrol->value.integer.value[0];
|
||||||
|
|
||||||
|
dev_dbg(component->dev, "%s: VIsense enable current %d, new %d\n",
|
||||||
|
__func__, wsa884x->pbr_enable, value);
|
||||||
|
wsa884x->pbr_enable = value;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int wsa884x_get_cps(struct snd_kcontrol *kcontrol,
|
||||||
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
|
{
|
||||||
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_kcontrol_component(kcontrol);
|
||||||
|
struct wsa884x_priv *wsa884x = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
|
ucontrol->value.integer.value[0] = wsa884x->cps_enable;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int wsa884x_set_cps(struct snd_kcontrol *kcontrol,
|
||||||
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
|
{
|
||||||
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_kcontrol_component(kcontrol);
|
||||||
|
struct wsa884x_priv *wsa884x = snd_soc_component_get_drvdata(component);
|
||||||
|
int value = ucontrol->value.integer.value[0];
|
||||||
|
|
||||||
|
dev_dbg(component->dev, "%s: VIsense enable current %d, new %d\n",
|
||||||
|
__func__, wsa884x->cps_enable, value);
|
||||||
|
wsa884x->cps_enable = value;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int wsa884x_get_ext_vdd_spk(struct snd_kcontrol *kcontrol,
|
static int wsa884x_get_ext_vdd_spk(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
@@ -959,6 +1009,12 @@ static const struct snd_kcontrol_new wsa884x_snd_controls[] = {
|
|||||||
SOC_SINGLE_EXT("VISENSE Switch", SND_SOC_NOPM, 0, 1, 0,
|
SOC_SINGLE_EXT("VISENSE Switch", SND_SOC_NOPM, 0, 1, 0,
|
||||||
wsa884x_get_visense, wsa884x_set_visense),
|
wsa884x_get_visense, wsa884x_set_visense),
|
||||||
|
|
||||||
|
SOC_SINGLE_EXT("PBR Switch", SND_SOC_NOPM, 0, 1, 0,
|
||||||
|
wsa884x_get_pbr, wsa884x_set_pbr),
|
||||||
|
|
||||||
|
SOC_SINGLE_EXT("CPS Switch", SND_SOC_NOPM, 0, 1, 0,
|
||||||
|
wsa884x_get_cps, wsa884x_set_cps),
|
||||||
|
|
||||||
SOC_SINGLE_EXT("External VDD_SPK", SND_SOC_NOPM, 0, 1, 0,
|
SOC_SINGLE_EXT("External VDD_SPK", SND_SOC_NOPM, 0, 1, 0,
|
||||||
wsa884x_get_ext_vdd_spk, wsa884x_put_ext_vdd_spk),
|
wsa884x_get_ext_vdd_spk, wsa884x_put_ext_vdd_spk),
|
||||||
};
|
};
|
||||||
@@ -1014,6 +1070,13 @@ static int wsa884x_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
|
|||||||
&port_type[num_port]);
|
&port_type[num_port]);
|
||||||
++num_port;
|
++num_port;
|
||||||
}
|
}
|
||||||
|
if (wsa884x->pbr_enable) {
|
||||||
|
wsa884x_set_port(component, SWR_PBR_PORT,
|
||||||
|
&port_id[num_port], &num_ch[num_port],
|
||||||
|
&ch_mask[num_port], &ch_rate[num_port],
|
||||||
|
&port_type[num_port]);
|
||||||
|
++num_port;
|
||||||
|
}
|
||||||
if (wsa884x->visense_enable) {
|
if (wsa884x->visense_enable) {
|
||||||
wsa884x_set_port(component, SWR_VISENSE_PORT,
|
wsa884x_set_port(component, SWR_VISENSE_PORT,
|
||||||
&port_id[num_port], &num_ch[num_port],
|
&port_id[num_port], &num_ch[num_port],
|
||||||
@@ -1021,6 +1084,13 @@ static int wsa884x_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
|
|||||||
&port_type[num_port]);
|
&port_type[num_port]);
|
||||||
++num_port;
|
++num_port;
|
||||||
}
|
}
|
||||||
|
if (wsa884x->cps_enable) {
|
||||||
|
wsa884x_set_port(component, SWR_CPS_PORT,
|
||||||
|
&port_id[num_port], &num_ch[num_port],
|
||||||
|
&ch_mask[num_port], &ch_rate[num_port],
|
||||||
|
&port_type[num_port]);
|
||||||
|
++num_port;
|
||||||
|
}
|
||||||
swr_connect_port(wsa884x->swr_slave, &port_id[0], num_port,
|
swr_connect_port(wsa884x->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]);
|
&port_type[0]);
|
||||||
@@ -1042,6 +1112,13 @@ static int wsa884x_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
|
|||||||
&port_type[num_port]);
|
&port_type[num_port]);
|
||||||
++num_port;
|
++num_port;
|
||||||
}
|
}
|
||||||
|
if (wsa884x->pbr_enable) {
|
||||||
|
wsa884x_set_port(component, SWR_PBR_PORT,
|
||||||
|
&port_id[num_port], &num_ch[num_port],
|
||||||
|
&ch_mask[num_port], &ch_rate[num_port],
|
||||||
|
&port_type[num_port]);
|
||||||
|
++num_port;
|
||||||
|
}
|
||||||
if (wsa884x->visense_enable) {
|
if (wsa884x->visense_enable) {
|
||||||
wsa884x_set_port(component, SWR_VISENSE_PORT,
|
wsa884x_set_port(component, SWR_VISENSE_PORT,
|
||||||
&port_id[num_port], &num_ch[num_port],
|
&port_id[num_port], &num_ch[num_port],
|
||||||
@@ -1049,6 +1126,13 @@ static int wsa884x_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
|
|||||||
&port_type[num_port]);
|
&port_type[num_port]);
|
||||||
++num_port;
|
++num_port;
|
||||||
}
|
}
|
||||||
|
if (wsa884x->cps_enable) {
|
||||||
|
wsa884x_set_port(component, SWR_CPS_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(wsa884x->swr_slave, &port_id[0], num_port,
|
swr_disconnect_port(wsa884x->swr_slave, &port_id[0], num_port,
|
||||||
&ch_mask[0], &port_type[0]);
|
&ch_mask[0], &port_type[0]);
|
||||||
break;
|
break;
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#include "wsa884x-reg-shifts.h"
|
#include "wsa884x-reg-shifts.h"
|
||||||
|
|
||||||
|
|
||||||
#define WSA884X_MAX_SWR_PORTS 4
|
#define WSA884X_MAX_SWR_PORTS 6
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_SND_SOC_WSA884X)
|
#if IS_ENABLED(CONFIG_SND_SOC_WSA884X)
|
||||||
int wsa884x_set_channel_map(struct snd_soc_component *component,
|
int wsa884x_set_channel_map(struct snd_soc_component *component,
|
||||||
|
Reference in New Issue
Block a user