asoc: pineapple: add fsa node handle

add fsa node handle in machine driver to
differentiate between fsa and wcd_usbss.

Change-Id: I3604f77440c8265306ace910ed37c2757f299665
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
This commit is contained in:
Prasad Kumpatla
2023-12-27 16:06:22 +05:30
parent 27110b4fb5
commit 1ffe08fc12

View File

@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/input.h>
#include <linux/of_device.h>
#include <linux/soc/qcom/fsa4480-i2c.h>
#if IS_ENABLED(CONFIG_QCOM_WCD_USBSS_I2C)
#include <linux/soc/qcom/wcd939x-i2c.h>
#endif
@@ -81,6 +82,7 @@ struct msm_asoc_mach_data {
struct device_node *dmic67_gpio_p; /* used by pinctrl API */
struct pinctrl *usbc_en2_gpio_p; /* used by pinctrl API */
bool is_afe_config_done;
struct device_node *fsa_handle;
struct device_node *wcd_usbss_handle;
struct clk *lpass_audio_hw_vote;
int core_audio_vote_count;
@@ -140,23 +142,30 @@ static struct wcd_mbhc_config wcd_mbhc_cfg = {
static bool msm_usbc_swap_gnd_mic(struct snd_soc_component *component, bool active)
{
bool ret = false;
int ret = 0;
struct snd_soc_card *card = component->card;
struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(card);
if (!pdata->wcd_usbss_handle)
if (!pdata->fsa_handle && !pdata->wcd_usbss_handle)
return false;
if (pdata->fsa_handle) {
ret = fsa4480_switch_event(pdata->fsa_handle, FSA_MIC_GND_SWAP);
} else {
#if IS_ENABLED(CONFIG_QCOM_WCD_USBSS_I2C)
if (wcd_mbhc_cfg.usbss_hsj_connect_enable)
ret = wcd_usbss_switch_update(WCD_USBSS_GND_MIC_SWAP_HSJ,
if (wcd_mbhc_cfg.usbss_hsj_connect_enable)
ret = wcd_usbss_switch_update(WCD_USBSS_GND_MIC_SWAP_HSJ,
WCD_USBSS_CABLE_CONNECT);
else if (wcd_mbhc_cfg.enable_usbc_analog)
ret = wcd_usbss_switch_update(WCD_USBSS_GND_MIC_SWAP_AATC,
else if (wcd_mbhc_cfg.enable_usbc_analog)
ret = wcd_usbss_switch_update(WCD_USBSS_GND_MIC_SWAP_AATC,
WCD_USBSS_CABLE_CONNECT);
}
#endif
return ret;
if (ret == 0)
return true;
else
return false;
}
static void msm_parse_upd_configuration(struct platform_device *pdev,
@@ -2294,6 +2303,12 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
if (wcd_mbhc_cfg.enable_usbc_analog)
wcd_mbhc_cfg.swap_gnd_mic = msm_usbc_swap_gnd_mic;
pdata->fsa_handle = of_parse_phandle(pdev->dev.of_node,
"fsa4480-i2c-handle", 0);
if (!pdata->fsa_handle)
dev_dbg(&pdev->dev, "property %s not detected in node %s\n",
"fsa4480-i2c-handle", pdev->dev.of_node->full_name);
pdata->wcd_usbss_handle = of_parse_phandle(pdev->dev.of_node,
"wcd939x-i2c-handle", 0);
if (!pdata->wcd_usbss_handle)