Merge "ASoC: msm: Include interrupt registers in pdata" into msm-4.9
diff --git a/sound/soc/msm/sdm660-common.c b/sound/soc/msm/sdm660-common.c
index 4c9812b..5ec73d0 100644
--- a/sound/soc/msm/sdm660-common.c
+++ b/sound/soc/msm/sdm660-common.c
@@ -2909,7 +2909,7 @@
}
devm_kfree(&pdev->dev, pdata);
if (pdata->snd_card_val != INT_SND_CARD)
- msm_ext_cdc_deinit();
+ msm_ext_cdc_deinit(pdata);
return ret;
}
@@ -2921,7 +2921,7 @@
if (pdata->snd_card_val == INT_SND_CARD)
mutex_destroy(&pdata->cdc_int_mclk0_mutex);
else
- msm_ext_cdc_deinit();
+ msm_ext_cdc_deinit(pdata);
msm_free_auxdev_mem(pdev);
gpio_free(pdata->us_euro_gpio);
diff --git a/sound/soc/msm/sdm660-common.h b/sound/soc/msm/sdm660-common.h
index 36c2d9b..5742c85 100644
--- a/sound/soc/msm/sdm660-common.h
+++ b/sound/soc/msm/sdm660-common.h
@@ -78,6 +78,14 @@
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 hph_en1_gpio;
@@ -105,6 +113,7 @@
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/sound/soc/msm/sdm660-external.c b/sound/soc/msm/sdm660-external.c
index 59b28fa..0089e33 100644
--- a/sound/soc/msm/sdm660-external.c
+++ b/sound/soc/msm/sdm660-external.c
@@ -67,16 +67,6 @@
static struct msm_asoc_wcd93xx_codec msm_codec_fn;
static struct platform_device *spdev;
-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;
-};
-
-static struct msm_snd_interrupt msm_snd_intr_lpi;
-
static bool is_initial_boot;
static void *def_ext_mbhc_cal(void);
@@ -1220,25 +1210,25 @@
afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG);
}
-static void msm_snd_interrupt_config(void)
+static void msm_snd_interrupt_config(struct msm_asoc_mach_data *pdata)
{
int val;
- val = ioread32(msm_snd_intr_lpi.mpm_wakeup);
+ val = ioread32(pdata->msm_snd_intr_lpi.mpm_wakeup);
val |= LPI_GPIO_22_WAKEUP_VAL;
- iowrite32(val, msm_snd_intr_lpi.mpm_wakeup);
+ iowrite32(val, pdata->msm_snd_intr_lpi.mpm_wakeup);
- val = ioread32(msm_snd_intr_lpi.intr1_cfg_apps);
+ 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, msm_snd_intr_lpi.intr1_cfg_apps);
+ iowrite32(val, pdata->msm_snd_intr_lpi.intr1_cfg_apps);
iowrite32(LPI_GPIO_INTR_CFG1_VAL,
- msm_snd_intr_lpi.lpi_gpio_intr_cfg);
+ pdata->msm_snd_intr_lpi.lpi_gpio_intr_cfg);
iowrite32(LPI_GPIO22_CFG_VAL,
- msm_snd_intr_lpi.lpi_gpio_cfg);
+ pdata->msm_snd_intr_lpi.lpi_gpio_cfg);
iowrite32(LPI_GPIO22_INOUT_VAL,
- msm_snd_intr_lpi.lpi_gpio_inout);
+ pdata->msm_snd_intr_lpi.lpi_gpio_inout);
}
static int msm_adsp_power_up_config(struct snd_soc_codec *codec)
@@ -1246,7 +1236,10 @@
int ret = 0;
unsigned long timeout;
int adsp_ready = 0;
+ struct snd_soc_card *card = codec->component.card;
+ struct msm_asoc_mach_data *pdata;
+ pdata = snd_soc_card_get_drvdata(card);
timeout = jiffies +
msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS);
@@ -1269,7 +1262,7 @@
ret = -ETIMEDOUT;
goto err_fail;
}
- msm_snd_interrupt_config();
+ msm_snd_interrupt_config(pdata);
ret = msm_afe_set_config(codec);
if (ret)
@@ -1817,15 +1810,15 @@
ret);
ret = 0;
}
- msm_snd_intr_lpi.mpm_wakeup =
+ pdata->msm_snd_intr_lpi.mpm_wakeup =
ioremap(TLMM_CENTER_MPM_WAKEUP_INT_EN_0, 4);
- msm_snd_intr_lpi.intr1_cfg_apps =
+ pdata->msm_snd_intr_lpi.intr1_cfg_apps =
ioremap(TLMM_LPI_DIR_CONN_INTR1_CFG_APPS, 4);
- msm_snd_intr_lpi.lpi_gpio_intr_cfg =
+ pdata->msm_snd_intr_lpi.lpi_gpio_intr_cfg =
ioremap(TLMM_LPI_GPIO_INTR_CFG1, 4);
- msm_snd_intr_lpi.lpi_gpio_cfg =
+ pdata->msm_snd_intr_lpi.lpi_gpio_cfg =
ioremap(TLMM_LPI_GPIO22_CFG, 4);
- msm_snd_intr_lpi.lpi_gpio_inout =
+ pdata->msm_snd_intr_lpi.lpi_gpio_inout =
ioremap(TLMM_LPI_GPIO22_INOUT, 4);
err:
return ret;
@@ -1835,17 +1828,18 @@
/**
* msm_ext_cdc_deinit - external codec machine specific deinit.
*/
-void msm_ext_cdc_deinit(void)
+void msm_ext_cdc_deinit(struct msm_asoc_mach_data *pdata)
{
- if (msm_snd_intr_lpi.mpm_wakeup)
- iounmap(msm_snd_intr_lpi.mpm_wakeup);
- if (msm_snd_intr_lpi.intr1_cfg_apps)
- iounmap(msm_snd_intr_lpi.intr1_cfg_apps);
- if (msm_snd_intr_lpi.lpi_gpio_intr_cfg)
- iounmap(msm_snd_intr_lpi.lpi_gpio_intr_cfg);
- if (msm_snd_intr_lpi.lpi_gpio_cfg)
- iounmap(msm_snd_intr_lpi.lpi_gpio_cfg);
- if (msm_snd_intr_lpi.lpi_gpio_inout)
- iounmap(msm_snd_intr_lpi.lpi_gpio_inout);
+ 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/sound/soc/msm/sdm660-external.h b/sound/soc/msm/sdm660-external.h
index 7625a24..acf5735 100644
--- a/sound/soc/msm/sdm660-external.h
+++ b/sound/soc/msm/sdm660-external.h
@@ -34,7 +34,7 @@
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(void);
+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,