diff options
author | Soumya Managoli <smanag@codeaurora.org> | 2020-01-28 17:22:11 +0530 |
---|---|---|
committer | Shashi Kant Maurya <smaury@codeaurora.org> | 2020-02-10 18:06:28 +0530 |
commit | 7ea0977c1aaffb18fa81a2c65de983c8d50bb456 (patch) | |
tree | 18cf6f3719e30411eaf5ba868e5e69fa0bd0cb13 | |
parent | f03bd8bb943087e78d4bc3d6cb2e7d81abf72ae9 (diff) | |
download | msm-extra-7ea0977c1aaffb18fa81a2c65de983c8d50bb456.tar.gz |
ASoC: msm: Enable WCD interrupt config via LPI TLMM
Configure LPI interrupt registers inorder to setup
WCD interrupt triggered via LPI TLMM as direct apps interrupt.
Change-Id: Id2b450eb930dd0d3d4e69981c663a128e926b14f
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
-rw-r--r-- | asoc/sdm660-common.c | 8 | ||||
-rw-r--r-- | asoc/sdm660-common.h | 9 | ||||
-rw-r--r-- | asoc/sdm660-external.c | 79 | ||||
-rw-r--r-- | asoc/sdm660-external.h | 4 |
4 files changed, 95 insertions, 5 deletions
diff --git a/asoc/sdm660-common.c b/asoc/sdm660-common.c index 1fcb5b16..b0edcea4 100644 --- a/asoc/sdm660-common.c +++ b/asoc/sdm660-common.c @@ -5289,7 +5289,6 @@ static int msm_init_wsa_dev(struct platform_device *pdev, } card->codec_conf = msm_codec_conf; card->aux_dev = msm_aux_dev; - return 0; err_dt_prop: @@ -5465,7 +5464,6 @@ static int msm_asoc_machine_probe(struct platform_device *pdev) ret = snd_soc_of_parse_audio_routing(card, "qcom,audio-routing"); if (ret) goto err; - ret = msm_populate_dai_link_component_of_node(pdata, card); if (ret) { ret = -EPROBE_DEFER; @@ -5516,6 +5514,8 @@ err: gpio_free(pdata->hph_en0_gpio); pdata->hph_en0_gpio = 0; } + if (pdata->snd_card_val != INT_SND_CARD) + msm_ext_cdc_deinit(pdata); devm_kfree(&pdev->dev, pdata); return ret; } @@ -5541,8 +5541,10 @@ static int msm_asoc_machine_remove(struct platform_device *pdev) pdata->hph_en0_gpio = 0; } - if (pdata->snd_card_val != INT_SND_CARD) + if (pdata->snd_card_val != INT_SND_CARD) { audio_notifier_deregister("sdm660"); + msm_ext_cdc_deinit(pdata); + } snd_soc_unregister_card(card); return 0; diff --git a/asoc/sdm660-common.h b/asoc/sdm660-common.h index 09d8ff86..115a6204 100644 --- a/asoc/sdm660-common.h +++ b/asoc/sdm660-common.h @@ -97,6 +97,14 @@ enum { EXT_SND_CARD_TAVIL, }; +struct msm_snd_interrupt { + void __iomem *mpm_wakeup; + void __iomem *intr1_cfg_apps; + void __iomem *lpi_gpio_intr_cfg; + void __iomem *lpi_gpio_cfg; + void __iomem *lpi_gpio_inout; +}; + struct msm_asoc_mach_data { int us_euro_gpio; /* used by gpio driver API */ int usbc_en2_gpio; /* used by gpio driver API */ @@ -126,6 +134,7 @@ struct msm_asoc_mach_data { struct mutex cdc_int_mclk0_mutex; struct delayed_work disable_int_mclk0_work; struct afe_clk_set digital_cdc_core_clk; + struct msm_snd_interrupt msm_snd_intr_lpi; }; int msm_common_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, diff --git a/asoc/sdm660-external.c b/asoc/sdm660-external.c index 8ff98edd..2620e5fc 100644 --- a/asoc/sdm660-external.c +++ b/asoc/sdm660-external.c @@ -25,6 +25,7 @@ #include "codecs/wcd9335.h" #include "codecs/wcd934x/wcd934x.h" #include "codecs/wcd934x/wcd934x-mbhc.h" +#include <soc/qcom/socinfo.h> #define SDM660_SPK_ON 1 #define SDM660_SPK_OFF 0 @@ -34,9 +35,26 @@ #define CODEC_EXT_CLK_RATE 9600000 #define ADSP_STATE_READY_TIMEOUT_MS 3000 +#define TLMM_CENTER_MPM_WAKEUP_INT_EN_0 0x03596000 +#define LPI_GPIO_22_WAKEUP_VAL 0x00000002 + +#define TLMM_LPI_DIR_CONN_INTR1_CFG_APPS 0x0359D004 +#define LPI_GPIO_22_INTR1_CFG_VAL 0x01 +#define LPI_GPIO_22_INTR1_CFG_MASK 0x03 + +#define TLMM_LPI_GPIO_INTR_CFG1 0x0359B004 +#define LPI_GPIO_INTR_CFG1_VAL 0x00000113 + +#define TLMM_LPI_GPIO22_CFG 0x15078040 +#define LPI_GPIO22_CFG_VAL 0x0000009 + +#define TLMM_LPI_GPIO22_INOUT 0x179D1318 +#define LPI_GPIO22_INOUT_VAL 0x0020000 + + #define WSA8810_NAME_1 "wsa881x.20170211" #define WSA8810_NAME_2 "wsa881x.20170212" - +#define SDM660_SOC_MSM_ID 0x13D static int msm_ext_spk_control = 1; static struct wcd_mbhc_config *wcd_mbhc_cfg_ptr; @@ -1215,6 +1233,29 @@ static void msm_afe_clear_config(void) afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG); } +static void msm_snd_interrupt_config(struct msm_asoc_mach_data *pdata) +{ + int val; + + val = ioread32(pdata->msm_snd_intr_lpi.mpm_wakeup); + val |= LPI_GPIO_22_WAKEUP_VAL; + iowrite32(val, pdata->msm_snd_intr_lpi.mpm_wakeup); + + val = ioread32(pdata->msm_snd_intr_lpi.intr1_cfg_apps); + val &= ~(LPI_GPIO_22_INTR1_CFG_MASK); + val |= LPI_GPIO_22_INTR1_CFG_VAL; + iowrite32(val, pdata->msm_snd_intr_lpi.intr1_cfg_apps); + + iowrite32(LPI_GPIO_INTR_CFG1_VAL, + pdata->msm_snd_intr_lpi.lpi_gpio_intr_cfg); + iowrite32(LPI_GPIO22_CFG_VAL, + pdata->msm_snd_intr_lpi.lpi_gpio_cfg); + + val = ioread32(pdata->msm_snd_intr_lpi.lpi_gpio_inout); + val |= LPI_GPIO22_INOUT_VAL; + iowrite32(val, pdata->msm_snd_intr_lpi.lpi_gpio_inout); +} + static int msm_adsp_power_up_config(struct snd_soc_codec *codec, struct snd_card *card) { @@ -1222,7 +1263,10 @@ static int msm_adsp_power_up_config(struct snd_soc_codec *codec, unsigned long timeout; int adsp_ready = 0; bool snd_card_online = 0; + struct snd_soc_card *soc_card = codec->component.card; + struct msm_asoc_mach_data *pdata; + pdata = snd_soc_card_get_drvdata(soc_card); timeout = jiffies + msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS); @@ -1257,6 +1301,10 @@ static int msm_adsp_power_up_config(struct snd_soc_codec *codec, goto err_fail; } + if (socinfo_get_id() == SDM660_SOC_MSM_ID) { + msm_snd_interrupt_config(pdata); + } + ret = msm_afe_set_config(codec); if (ret) pr_err("%s: Failed to set AFE config. err %d\n", @@ -1309,7 +1357,6 @@ static int sdm660_notifier_service_cb(struct notifier_block *this, goto done; } codec = rtd->codec; - ret = msm_adsp_power_up_config(codec, card->snd_card); if (ret < 0) { dev_err(card->dev, @@ -1876,7 +1923,35 @@ int msm_ext_cdc_init(struct platform_device *pdev, ret); ret = 0; } + pdata->msm_snd_intr_lpi.mpm_wakeup = + ioremap(TLMM_CENTER_MPM_WAKEUP_INT_EN_0, 4); + pdata->msm_snd_intr_lpi.intr1_cfg_apps = + ioremap(TLMM_LPI_DIR_CONN_INTR1_CFG_APPS, 4); + pdata->msm_snd_intr_lpi.lpi_gpio_intr_cfg = + ioremap(TLMM_LPI_GPIO_INTR_CFG1, 4); + pdata->msm_snd_intr_lpi.lpi_gpio_cfg = + ioremap(TLMM_LPI_GPIO22_CFG, 4); + pdata->msm_snd_intr_lpi.lpi_gpio_inout = + ioremap(TLMM_LPI_GPIO22_INOUT, 4); err: return ret; } EXPORT_SYMBOL(msm_ext_cdc_init); + +/** + * msm_ext_cdc_deinit - external codec machine specific deinit. + */ +void msm_ext_cdc_deinit(struct msm_asoc_mach_data *pdata) +{ + if (pdata->msm_snd_intr_lpi.mpm_wakeup) + iounmap(pdata->msm_snd_intr_lpi.mpm_wakeup); + if (pdata->msm_snd_intr_lpi.intr1_cfg_apps) + iounmap(pdata->msm_snd_intr_lpi.intr1_cfg_apps); + if (pdata->msm_snd_intr_lpi.lpi_gpio_intr_cfg) + iounmap(pdata->msm_snd_intr_lpi.lpi_gpio_intr_cfg); + if (pdata->msm_snd_intr_lpi.lpi_gpio_cfg) + iounmap(pdata->msm_snd_intr_lpi.lpi_gpio_cfg); + if (pdata->msm_snd_intr_lpi.lpi_gpio_inout) + iounmap(pdata->msm_snd_intr_lpi.lpi_gpio_inout); +} +EXPORT_SYMBOL(msm_ext_cdc_deinit); diff --git a/asoc/sdm660-external.h b/asoc/sdm660-external.h index b81e158b..c234df43 100644 --- a/asoc/sdm660-external.h +++ b/asoc/sdm660-external.h @@ -36,6 +36,7 @@ int msm_snd_card_tasha_late_probe(struct snd_soc_card *card); int msm_ext_cdc_init(struct platform_device *, struct msm_asoc_mach_data *, struct snd_soc_card **, struct wcd_mbhc_config *); void msm_ext_register_audio_notifier(struct platform_device *pdev); +void msm_ext_cdc_deinit(struct msm_asoc_mach_data *pdata); #else inline int msm_ext_cdc_init(struct platform_device *pdev, struct msm_asoc_mach_data *pdata, @@ -48,5 +49,8 @@ inline int msm_ext_cdc_init(struct platform_device *pdev, inline void msm_ext_register_audio_notifier(struct platform_device *pdev) { } +inline void msm_ext_cdc_deinit(void) +{ +} #endif #endif |