Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e106ce90 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: Remove i2s_pcm config settings in sdm660"

parents f413e767 9a4f615f
Loading
Loading
Loading
Loading
+13 −11
Original line number Original line Diff line number Diff line
@@ -834,17 +834,6 @@ Example:
Required properties:
Required properties:
- compatible : "qcom,msm8974-audio-taiko"
- compatible : "qcom,msm8974-audio-taiko"
- qcom,model : The user-visible name of this sound card.
- qcom,model : The user-visible name of this sound card.
- reg : Offset and length of the register region(s) for MI2S/PCM MUX
- reg-names : Register region name(s) referenced in reg above
	 Required register resource entries are:
	 "lpaif_pri_mode_muxsel": Physical address of MUX to select between
				  Primary PCM and Primary MI2S
	 "lpaif_sec_mode_muxsel": Physical address of MUX to select between
				  Secondary PCM and Secondary MI2S
	 "lpaif_tert_mode_muxsel": Physical address of MUX to select between
				   Primary PCM and Tertiary MI2S
	 "lpaif_quat_mode_muxsel": Physical address of MUX to select between
				   Secondary PCM and Quarternary MI2S
- qcom,audio-routing : A list of the connections between audio components.
- qcom,audio-routing : A list of the connections between audio components.
  Each entry is a pair of strings, the first being the connection's sink,
  Each entry is a pair of strings, the first being the connection's sink,
  the second being the connection's source.
  the second being the connection's source.
@@ -882,6 +871,19 @@ Required properties:
		    codec dai names should match to that of the phandle order given
		    codec dai names should match to that of the phandle order given
		    in "asoc-codec".
		    in "asoc-codec".
Optional properties:
Optional properties:
- reg : Offset and length of the register region(s) for MI2S/PCM MUX.
	Not applicable for all targets.
- reg-names : Register region name(s) referenced in reg above.
	      Not applicable for all targets.
	 Required register resource entries are:
	 "lpaif_pri_mode_muxsel": Physical address of MUX to select between
				  Primary PCM and Primary MI2S
	 "lpaif_sec_mode_muxsel": Physical address of MUX to select between
				  Secondary PCM and Secondary MI2S
	 "lpaif_tert_mode_muxsel": Physical address of MUX to select between
				   Primary PCM and Tertiary MI2S
	 "lpaif_quat_mode_muxsel": Physical address of MUX to select between
				   Secondary PCM and Quarternary MI2S
- qcom,hdmi-audio-rx: specifies if HDMI audio support is enabled or not.
- qcom,hdmi-audio-rx: specifies if HDMI audio support is enabled or not.
- qcom,ext-ult-spk-amp-gpio : GPIO for enabling of speaker path amplifier.
- qcom,ext-ult-spk-amp-gpio : GPIO for enabling of speaker path amplifier.


+0 −30
Original line number Original line Diff line number Diff line
@@ -593,16 +593,6 @@
		qcom,mi2s-audio-intf;
		qcom,mi2s-audio-intf;
		qcom,auxpcm-audio-intf;
		qcom,auxpcm-audio-intf;
		qcom,msm-mi2s-master = <1>, <1>, <1>, <1>;
		qcom,msm-mi2s-master = <1>, <1>, <1>, <1>;

		reg = <0x1508a000 0x4>,
		      <0x1508b000 0x4>,
		      <0x1508c000 0x4>,
		      <0x1508d000 0x4>;
		reg-names = "lpaif_pri_mode_muxsel",
			    "lpaif_sec_mode_muxsel",
			    "lpaif_tert_mode_muxsel",
			    "lpaif_quat_mode_muxsel";

		qcom,audio-routing =
		qcom,audio-routing =
			"AIF4 VI", "MCLK",
			"AIF4 VI", "MCLK",
			"RX_BIAS", "MCLK",
			"RX_BIAS", "MCLK",
@@ -705,16 +695,6 @@
		qcom,mi2s-audio-intf;
		qcom,mi2s-audio-intf;
		qcom,auxpcm-audio-intf;
		qcom,auxpcm-audio-intf;
		qcom,msm-mi2s-master = <1>, <1>, <1>, <1>;
		qcom,msm-mi2s-master = <1>, <1>, <1>, <1>;

		reg = <0x1508a000 0x4>,
		      <0x1508b000 0x4>,
		      <0x1508c000 0x4>,
		      <0x1508d000 0x4>;
		reg-names = "lpaif_pri_mode_muxsel",
			    "lpaif_sec_mode_muxsel",
			    "lpaif_tert_mode_muxsel",
			    "lpaif_quat_mode_muxsel";

		qcom,audio-routing =
		qcom,audio-routing =
			"RX_BIAS", "MCLK",
			"RX_BIAS", "MCLK",
			"MADINPUT", "MCLK",
			"MADINPUT", "MCLK",
@@ -815,16 +795,6 @@
		qcom,mi2s-audio-intf;
		qcom,mi2s-audio-intf;
		qcom,auxpcm-audio-intf;
		qcom,auxpcm-audio-intf;
		qcom,msm-mi2s-master = <1>, <1>, <1>, <1>;
		qcom,msm-mi2s-master = <1>, <1>, <1>, <1>;

		reg = <0x1508a000 0x4>,
		      <0x1508b000 0x4>,
		      <0x1508c000 0x4>,
		      <0x1508d000 0x4>;
		reg-names = "lpaif_pri_mode_muxsel",
			    "lpaif_sec_mode_muxsel",
			    "lpaif_tert_mode_muxsel",
			    "lpaif_quat_mode_muxsel";

		qcom,msm-mclk-freq = <9600000>;
		qcom,msm-mclk-freq = <9600000>;
		qcom,msm-mbhc-hphl-swh = <1>;
		qcom,msm-mbhc-hphl-swh = <1>;
		qcom,msm-mbhc-gnd-swh = <1>;
		qcom,msm-mbhc-gnd-swh = <1>;
+2 −122
Original line number Original line Diff line number Diff line
@@ -160,11 +160,6 @@ enum {
	PCM_I2S_SEL_MAX,
	PCM_I2S_SEL_MAX,
};
};


struct mi2s_aux_pcm_common_conf {
	struct mutex lock;
	void *pcm_i2s_sel_vt_addr;
};

struct mi2s_conf {
struct mi2s_conf {
	struct mutex lock;
	struct mutex lock;
	u32 ref_cnt;
	u32 ref_cnt;
@@ -172,11 +167,6 @@ struct mi2s_conf {
	u32 msm_is_ext_mclk;
	u32 msm_is_ext_mclk;
};
};


struct auxpcm_conf {
	struct mutex lock;
	u32 ref_cnt;
};

static u32 mi2s_ebit_clk[MI2S_MAX] = {
static u32 mi2s_ebit_clk[MI2S_MAX] = {
	Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT,
	Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT,
	Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT,
	Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT,
@@ -383,11 +373,7 @@ static struct afe_clk_set mi2s_mclk[MI2S_MAX] = {
	}
	}
};
};




static struct mi2s_aux_pcm_common_conf mi2s_auxpcm_conf[PCM_I2S_SEL_MAX];
static struct mi2s_conf mi2s_intf_conf[MI2S_MAX];
static struct mi2s_conf mi2s_intf_conf[MI2S_MAX];
static struct auxpcm_conf auxpcm_intf_conf[AUX_PCM_MAX];


static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
static int proxy_rx_ch_get(struct snd_kcontrol *kcontrol,
			       struct snd_ctl_elem_value *ucontrol)
			       struct snd_ctl_elem_value *ucontrol)
@@ -1945,46 +1931,14 @@ EXPORT_SYMBOL(msm_common_be_hw_params_fixup);
 */
 */
int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream)
int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream)
{
{
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int index = cpu_dai->id - 1;
	return ret = 0;


	dev_dbg(rtd->card->dev,
	dev_dbg(rtd->card->dev,
		"%s: substream = %s  stream = %d, dai name %s, dai ID %d\n",
		"%s: substream = %s  stream = %d, dai name %s, dai ID %d\n",
		__func__, substream->name, substream->stream,
		__func__, substream->name, substream->stream,
		cpu_dai->name, cpu_dai->id);
		rtd->cpu_dai->name, rtd->cpu_dai->id);

	if (index < PRIM_AUX_PCM || index > QUAT_AUX_PCM) {
		ret = -EINVAL;
		dev_err(rtd->card->dev,
			"%s: CPU DAI id (%d) out of range\n",
			__func__, cpu_dai->id);
		goto done;
	}

	mutex_lock(&auxpcm_intf_conf[index].lock);
	if (++auxpcm_intf_conf[index].ref_cnt == 1) {
		if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) {
			mutex_lock(&mi2s_auxpcm_conf[index].lock);
			iowrite32(1,
				mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr);
			mutex_unlock(&mi2s_auxpcm_conf[index].lock);
		} else {
			dev_err(rtd->card->dev,
				"%s lpaif_tert_muxsel_virt_addr is NULL\n",
				__func__);
			ret = -EINVAL;
		}
	}
	if (IS_ERR_VALUE(ret))
		auxpcm_intf_conf[index].ref_cnt--;

	mutex_unlock(&auxpcm_intf_conf[index].lock);


done:
	return 0;
	return ret;
}
}
EXPORT_SYMBOL(msm_aux_pcm_snd_startup);
EXPORT_SYMBOL(msm_aux_pcm_snd_startup);


@@ -1996,36 +1950,12 @@ EXPORT_SYMBOL(msm_aux_pcm_snd_startup);
void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream)
void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream)
{
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	int index = rtd->cpu_dai->id - 1;


	dev_dbg(rtd->card->dev,
	dev_dbg(rtd->card->dev,
		"%s: substream = %s  stream = %d, dai name %s, dai ID %d\n",
		"%s: substream = %s  stream = %d, dai name %s, dai ID %d\n",
		__func__,
		__func__,
		substream->name, substream->stream,
		substream->name, substream->stream,
		rtd->cpu_dai->name, rtd->cpu_dai->id);
		rtd->cpu_dai->name, rtd->cpu_dai->id);

	if (index < PRIM_AUX_PCM || index > QUAT_AUX_PCM) {
		dev_err(rtd->card->dev,
			"%s: CPU DAI id (%d) out of range\n",
			__func__, rtd->cpu_dai->id);
		return;
	}

	mutex_lock(&auxpcm_intf_conf[index].lock);
	if (--auxpcm_intf_conf[index].ref_cnt == 0) {
		if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) {
			mutex_lock(&mi2s_auxpcm_conf[index].lock);
			iowrite32(0,
				mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr);
			mutex_unlock(&mi2s_auxpcm_conf[index].lock);
		} else {
			dev_err(rtd->card->dev,
				"%s lpaif_tert_muxsel_virt_addr is NULL\n",
				__func__);
			auxpcm_intf_conf[index].ref_cnt++;
		}
	}
	mutex_unlock(&auxpcm_intf_conf[index].lock);
}
}
EXPORT_SYMBOL(msm_aux_pcm_snd_shutdown);
EXPORT_SYMBOL(msm_aux_pcm_snd_shutdown);


@@ -2186,18 +2116,6 @@ int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
				__func__, ret);
				__func__, ret);
			goto clean_up;
			goto clean_up;
		}
		}
		if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) {
			mutex_lock(&mi2s_auxpcm_conf[index].lock);
			iowrite32(0,
				mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr);
			mutex_unlock(&mi2s_auxpcm_conf[index].lock);
		} else {
			dev_err(rtd->card->dev,
				"%s lpaif_muxsel_virt_addr is NULL for dai %d\n",
				__func__, index);
			ret = -EINVAL;
			goto clk_off;
		}
		ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
		ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
		if (IS_ERR_VALUE(ret)) {
		if (IS_ERR_VALUE(ret)) {
			dev_err(rtd->card->dev,
			dev_err(rtd->card->dev,
@@ -2683,42 +2601,16 @@ static void msm_free_auxdev_mem(struct platform_device *pdev)


static void i2s_auxpcm_init(struct platform_device *pdev)
static void i2s_auxpcm_init(struct platform_device *pdev)
{
{
	struct resource *muxsel;
	int count;
	int count;
	u32 mi2s_master_slave[MI2S_MAX];
	u32 mi2s_master_slave[MI2S_MAX];
	u32 mi2s_ext_mclk[MI2S_MAX];
	u32 mi2s_ext_mclk[MI2S_MAX];
	int ret;
	int ret;
	char *str[PCM_I2S_SEL_MAX] = {
		"lpaif_pri_mode_muxsel",
		"lpaif_sec_mode_muxsel",
		"lpaif_tert_mode_muxsel",
		"lpaif_quat_mode_muxsel"
	};


	for (count = 0; count < MI2S_MAX; count++) {
	for (count = 0; count < MI2S_MAX; count++) {
		mutex_init(&mi2s_intf_conf[count].lock);
		mutex_init(&mi2s_intf_conf[count].lock);
		mi2s_intf_conf[count].ref_cnt = 0;
		mi2s_intf_conf[count].ref_cnt = 0;
	}
	}


	for (count = 0; count < AUX_PCM_MAX; count++) {
		mutex_init(&auxpcm_intf_conf[count].lock);
		auxpcm_intf_conf[count].ref_cnt = 0;
	}

	for (count = 0; count < PCM_I2S_SEL_MAX; count++) {
		mutex_init(&mi2s_auxpcm_conf[count].lock);
		mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr = NULL;
	}

	for (count = 0; count < PCM_I2S_SEL_MAX; count++) {
		muxsel = platform_get_resource_byname(pdev, IORESOURCE_MEM,
						      str[count]);
		if (muxsel) {
			mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr
				= ioremap(muxsel->start, resource_size(muxsel));
		}
	}

	ret = of_property_read_u32_array(pdev->dev.of_node,
	ret = of_property_read_u32_array(pdev->dev.of_node,
					 "qcom,msm-mi2s-master",
					 "qcom,msm-mi2s-master",
					 mi2s_master_slave, MI2S_MAX);
					 mi2s_master_slave, MI2S_MAX);
@@ -2745,17 +2637,6 @@ static void i2s_auxpcm_init(struct platform_device *pdev)
	}
	}
}
}


static void i2s_auxpcm_deinit(void)
{
	int count;

	for (count = 0; count < PCM_I2S_SEL_MAX; count++)
		if (mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr !=
			NULL)
			iounmap(
			mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr);
}

static const struct of_device_id sdm660_asoc_machine_of_match[]  = {
static const struct of_device_id sdm660_asoc_machine_of_match[]  = {
	{ .compatible = "qcom,sdm660-asoc-snd",
	{ .compatible = "qcom,sdm660-asoc-snd",
	  .data = "internal_codec"},
	  .data = "internal_codec"},
@@ -2929,7 +2810,6 @@ static int msm_asoc_machine_remove(struct platform_device *pdev)
	gpio_free(pdata->us_euro_gpio);
	gpio_free(pdata->us_euro_gpio);
	gpio_free(pdata->hph_en1_gpio);
	gpio_free(pdata->hph_en1_gpio);
	gpio_free(pdata->hph_en0_gpio);
	gpio_free(pdata->hph_en0_gpio);
	i2s_auxpcm_deinit();
	snd_soc_unregister_card(card);
	snd_soc_unregister_card(card);
	return 0;
	return 0;
}
}