ASoC: kalama: Add support for WSA883X speaker amp
Add support for WSA883X speaker amp on kalama platform. Change-Id: I922b5aeaf264ae9b430f20e83ec99e3ced509dcc
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
#include <sound/tlv.h>
|
#include <sound/tlv.h>
|
||||||
#include <asoc/msm-cdc-pinctrl.h>
|
#include <asoc/msm-cdc-pinctrl.h>
|
||||||
#include <asoc/msm-cdc-supply.h>
|
#include <asoc/msm-cdc-supply.h>
|
||||||
|
#include "wsa883x-registers.h"
|
||||||
#include "wsa883x.h"
|
#include "wsa883x.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "asoc/bolero-slave-internal.h"
|
#include "asoc/bolero-slave-internal.h"
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include "wsa883x-registers.h"
|
|
||||||
|
|
||||||
#define WSA883X_MAX_SWR_PORTS 4
|
#define WSA883X_MAX_SWR_PORTS 4
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include <sound/tlv.h>
|
#include <sound/tlv.h>
|
||||||
#include <asoc/msm-cdc-pinctrl.h>
|
#include <asoc/msm-cdc-pinctrl.h>
|
||||||
#include <asoc/msm-cdc-supply.h>
|
#include <asoc/msm-cdc-supply.h>
|
||||||
|
#include "wsa884x-registers.h"
|
||||||
#include "wsa884x.h"
|
#include "wsa884x.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "asoc/bolero-slave-internal.h"
|
#include "asoc/bolero-slave-internal.h"
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include "wsa884x-registers.h"
|
|
||||||
#include "wsa884x-reg-masks.h"
|
#include "wsa884x-reg-masks.h"
|
||||||
#include "wsa884x-reg-shifts.h"
|
#include "wsa884x-reg-shifts.h"
|
||||||
|
|
||||||
|
106
asoc/kalama.c
106
asoc/kalama.c
@@ -32,6 +32,7 @@
|
|||||||
#include "asoc/wcd-mbhc-v2.h"
|
#include "asoc/wcd-mbhc-v2.h"
|
||||||
#include "codecs/wcd938x/wcd938x-mbhc.h"
|
#include "codecs/wcd938x/wcd938x-mbhc.h"
|
||||||
#include "codecs/wsa884x/wsa884x.h"
|
#include "codecs/wsa884x/wsa884x.h"
|
||||||
|
#include "codecs/wsa883x/wsa883x.h"
|
||||||
#include "codecs/wcd938x/wcd938x.h"
|
#include "codecs/wcd938x/wcd938x.h"
|
||||||
#include "codecs/lpass-cdc/lpass-cdc.h"
|
#include "codecs/lpass-cdc/lpass-cdc.h"
|
||||||
#include <bindings/audio-codec-port-types.h>
|
#include <bindings/audio-codec-port-types.h>
|
||||||
@@ -92,6 +93,8 @@ static void *def_wcd_mbhc_cal(void);
|
|||||||
|
|
||||||
static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime*);
|
static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime*);
|
||||||
static int msm_int_wsa_init(struct snd_soc_pcm_runtime*);
|
static int msm_int_wsa_init(struct snd_soc_pcm_runtime*);
|
||||||
|
static int msm_int_wsa884x_init(struct snd_soc_pcm_runtime*);
|
||||||
|
static int msm_int_wsa883x_init(struct snd_soc_pcm_runtime*);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need to report LINEIN
|
* Need to report LINEIN
|
||||||
@@ -137,6 +140,7 @@ static void msm_parse_upd_configuration(struct platform_device *pdev,
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
u32 dt_values[2];
|
u32 dt_values[2];
|
||||||
|
struct snd_soc_card *card = NULL;
|
||||||
|
|
||||||
if (!pdev || !pdata)
|
if (!pdev || !pdata)
|
||||||
return;
|
return;
|
||||||
@@ -149,10 +153,15 @@ static void msm_parse_upd_configuration(struct platform_device *pdev,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(pdata->upd_config.backend_used, "wsa"))
|
if (!strcmp(pdata->upd_config.backend_used, "wsa")) {
|
||||||
pdata->get_dev_num = wsa884x_codec_get_dev_num;
|
card = (struct snd_soc_card *)platform_get_drvdata(pdev);
|
||||||
else
|
if (strstr(card->name, "wsa883x"))
|
||||||
|
pdata->get_dev_num = wsa883x_codec_get_dev_num;
|
||||||
|
else
|
||||||
|
pdata->get_dev_num = wsa884x_codec_get_dev_num;
|
||||||
|
} else {
|
||||||
pdata->get_dev_num = wcd938x_codec_get_dev_num;
|
pdata->get_dev_num = wcd938x_codec_get_dev_num;
|
||||||
|
}
|
||||||
|
|
||||||
ret = of_property_read_u32_array(pdev->dev.of_node,
|
ret = of_property_read_u32_array(pdev->dev.of_node,
|
||||||
"qcom,upd_lpass_reg_addr", dt_values, MAX_EARPA_REG);
|
"qcom,upd_lpass_reg_addr", dt_values, MAX_EARPA_REG);
|
||||||
@@ -1442,7 +1451,88 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev, int w
|
|||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
static int msm_int_wsa883x_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
|
{
|
||||||
|
u8 spkleft_ports[WSA883X_MAX_SWR_PORTS] = {0, 1, 2, 3};
|
||||||
|
u8 spkright_ports[WSA883X_MAX_SWR_PORTS] = {0, 1, 2, 3};
|
||||||
|
u8 spkleft_port_types[WSA883X_MAX_SWR_PORTS] = {SPKR_L, SPKR_L_COMP,
|
||||||
|
SPKR_L_BOOST, SPKR_L_VI};
|
||||||
|
u8 spkright_port_types[WSA883X_MAX_SWR_PORTS] = {SPKR_R, SPKR_R_COMP,
|
||||||
|
SPKR_R_BOOST, SPKR_R_VI};
|
||||||
|
unsigned int ch_rate[WSA883X_MAX_SWR_PORTS] = {SWR_CLK_RATE_2P4MHZ, SWR_CLK_RATE_0P6MHZ,
|
||||||
|
SWR_CLK_RATE_0P3MHZ, SWR_CLK_RATE_1P2MHZ};
|
||||||
|
unsigned int ch_mask[WSA883X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
|
||||||
|
struct snd_soc_component *component = NULL;
|
||||||
|
struct msm_asoc_mach_data *pdata =
|
||||||
|
snd_soc_card_get_drvdata(rtd->card);
|
||||||
|
|
||||||
|
if (pdata->wsa_max_devs > 0) {
|
||||||
|
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.1");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: wsa-codec.1 component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wsa883x_set_channel_map(component, &spkleft_ports[0],
|
||||||
|
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
|
&ch_rate[0], &spkleft_port_types[0]);
|
||||||
|
|
||||||
|
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
|
component);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If current platform has more than one WSA */
|
||||||
|
if (pdata->wsa_max_devs > 1) {
|
||||||
|
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.2");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: wsa-codec.2 component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wsa883x_set_channel_map(component, &spkright_ports[0],
|
||||||
|
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
|
&ch_rate[0], &spkright_port_types[0]);
|
||||||
|
|
||||||
|
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
|
component);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pdata->wsa_max_devs > 2) {
|
||||||
|
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.3");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: wsa-codec.3 component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wsa883x_set_channel_map(component, &spkleft_ports[0],
|
||||||
|
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
|
&ch_rate[0], &spkleft_port_types[0]);
|
||||||
|
|
||||||
|
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
|
component);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pdata->wsa_max_devs > 3) {
|
||||||
|
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.4");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: wsa-codec.4 component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wsa883x_set_channel_map(component, &spkright_ports[0],
|
||||||
|
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
|
&ch_rate[0], &spkright_port_types[0]);
|
||||||
|
|
||||||
|
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
|
component);
|
||||||
|
}
|
||||||
|
|
||||||
|
msm_common_dai_link_init(rtd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int msm_int_wsa884x_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
u8 spkleft_ports[WSA884X_MAX_SWR_PORTS] = {0, 1, 2, 3, 4, 5};
|
u8 spkleft_ports[WSA884X_MAX_SWR_PORTS] = {0, 1, 2, 3, 4, 5};
|
||||||
u8 spkright_ports[WSA884X_MAX_SWR_PORTS] = {0, 1, 2, 3, 4, 5};
|
u8 spkright_ports[WSA884X_MAX_SWR_PORTS] = {0, 1, 2, 3, 4, 5};
|
||||||
@@ -1526,6 +1616,14 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
|
{
|
||||||
|
if (strstr(rtd->card->name, "wsa883x"))
|
||||||
|
return msm_int_wsa883x_init(rtd);
|
||||||
|
|
||||||
|
return msm_int_wsa884x_init(rtd);
|
||||||
|
}
|
||||||
|
|
||||||
static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
|
static int msm_rx_tx_codec_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
int codec_variant = -1;
|
int codec_variant = -1;
|
||||||
|
Reference in New Issue
Block a user