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

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

Merge "ASoC: Audio bringup fixes for SDM660"

parents 849aea7c 5faffa09
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016 The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -108,6 +108,7 @@ static const u32 lpi_offset[] = {
	0x00000000,
	0x00001000,
	0x00002000,
	0x00002010,
	0x00003000,
	0x00003010,
	0x00004000,
@@ -592,7 +593,7 @@ static int lpi_pinctrl_probe(struct platform_device *pdev)
		goto err_range;
	}

	lpi_dev_up = false;
	lpi_dev_up = true;
	ret = audio_notifier_register("lpi_tlmm", AUDIO_NOTIFIER_ADSP_DOMAIN,
				      &service_nb);
	if (ret < 0) {
+16 −13
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2383,6 +2383,7 @@ static int msm_anlg_cdc_codec_enable_dig_clk(struct snd_soc_dapm_widget *w,
	case SND_SOC_DAPM_PRE_PMU:
		msm_anlg_cdc_codec_enable_clock_block(codec, 1);
		snd_soc_update_bits(codec, w->reg, 0x80, 0x80);
		msm_anlg_cdc_boost_mode_sequence(codec, SPK_PMU);
		break;
	case SND_SOC_DAPM_POST_PMD:
		if (sdm660_cdc->rx_bias_count == 0)
@@ -4016,6 +4017,7 @@ int msm_anlg_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
	struct snd_info_entry *version_entry;
	struct sdm660_cdc_priv *sdm660_cdc_priv;
	struct snd_soc_card *card;
	int ret;

	if (!codec_root || !codec)
		return -EINVAL;
@@ -4023,7 +4025,7 @@ int msm_anlg_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
	sdm660_cdc_priv = snd_soc_codec_get_drvdata(codec);
	card = codec->component.card;
	sdm660_cdc_priv->entry = snd_register_module_info(codec_root->module,
							     "pmic_analog",
							     "spmi0-03",
							     codec_root);
	if (!sdm660_cdc_priv->entry) {
		dev_dbg(codec->dev, "%s: failed to create pmic_analog entry\n",
@@ -4050,6 +4052,16 @@ int msm_anlg_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
		return -ENOMEM;
	}
	sdm660_cdc_priv->version_entry = version_entry;
	sdm660_cdc_priv->audio_ssr_nb.notifier_call =
				sdm660_cdc_notifier_service_cb;
	ret = audio_notifier_register("pmic_analog_cdc",
				      AUDIO_NOTIFIER_ADSP_DOMAIN,
				      &sdm660_cdc_priv->audio_ssr_nb);
	if (ret < 0) {
		pr_err("%s: Audio notifier register failed ret = %d\n",
			__func__, ret);
		return ret;
	}
	return 0;
}
EXPORT_SYMBOL(msm_anlg_codec_info_create_codec_entry);
@@ -4176,17 +4188,6 @@ static int msm_anlg_cdc_soc_probe(struct snd_soc_codec *codec)

	/* Set initial cap mode */
	msm_anlg_cdc_configure_cap(codec, false, false);
	sdm660_cdc_priv->audio_ssr_nb.notifier_call =
				sdm660_cdc_notifier_service_cb;
	ret = audio_notifier_register("pmic_analog_cdc",
				      AUDIO_NOTIFIER_ADSP_DOMAIN,
				      &sdm660_cdc_priv->audio_ssr_nb);
	if (ret < 0) {
		pr_err("%s: Audio notifier register failed ret = %d\n",
			__func__, ret);
		wcd_mbhc_deinit(&sdm660_cdc_priv->mbhc);
		return ret;
	}
	return 0;
}

@@ -4586,6 +4587,8 @@ static int msm_anlg_cdc_probe(struct platform_device *pdev)
	usleep_range(5, 6);

	dev_set_drvdata(&pdev->dev, sdm660_cdc);
	wcd9xxx_spmi_set_dev(pdev, 0);
	wcd9xxx_spmi_set_dev(pdev, 1);
	if (wcd9xxx_spmi_irq_init()) {
		dev_err(&pdev->dev,
			"%s: irq initialization failed\n", __func__);
+15 −14
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -815,7 +815,7 @@ static int msm_dig_cdc_codec_enable_dmic(struct snd_soc_dapm_widget *w,
		}
		snd_soc_update_bits(codec,
			MSM89XX_CDC_CORE_TX1_DMIC_CTL + (dmic - 1) * 0x20,
			0x07, 0x01);
			0x07, 0x02);
		break;
	case SND_SOC_DAPM_POST_PMD:
		(*dmic_clk_cnt)--;
@@ -1132,7 +1132,7 @@ int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
	msm_dig = snd_soc_codec_get_drvdata(codec);
	card = codec->component.card;
	msm_dig->entry = snd_register_module_info(codec_root->module,
						  "msm_digital",
						  "msm_digital_codec",
						  codec_root);
	if (!msm_dig->entry) {
		dev_dbg(codec->dev, "%s: failed to create msm_digital entry\n",
@@ -1202,9 +1202,8 @@ static int msm_dig_cdc_soc_probe(struct snd_soc_codec *codec)
			return ret;
		}
	}
	if (msm_dig_cdc->get_cdc_version)
		dig_cdc->version = msm_dig_cdc->get_cdc_version(
							msm_dig_cdc->handle);
	/* Assign to DRAX_CDC for initial version */
	dig_cdc->version = DRAX_CDC;
	registered_digcodec = codec;
	return 0;
}
@@ -1557,16 +1556,18 @@ static const struct snd_soc_dapm_widget msm_dig_dapm_widgets[] = {
	SND_SOC_DAPM_MIXER("RX1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
	SND_SOC_DAPM_MIXER("RX2 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),

	SND_SOC_DAPM_MIXER_E("RX1 CHAIN", MSM89XX_CDC_CORE_RX1_B6_CTL,
			     MSM89XX_RX1, 0, NULL, 0,
	SND_SOC_DAPM_MIXER_E("RX1 CHAIN", SND_SOC_NOPM,
			     0, 0, NULL, 0,
			     msm_dig_cdc_codec_enable_rx_chain,
			     SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_MIXER_E("RX2 CHAIN", SND_SOC_NOPM,
			     0, 0, NULL, 0,
			     msm_dig_cdc_codec_enable_rx_chain,
			     SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_MIXER_E("RX3 CHAIN", SND_SOC_NOPM,
			     0, 0, NULL, 0,
			     msm_dig_cdc_codec_enable_rx_chain,
			     SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_MIXER_E("RX2 CHAIN", MSM89XX_CDC_CORE_RX2_B6_CTL,
		MSM89XX_RX2, 0, NULL, 0,
		msm_dig_cdc_codec_enable_rx_chain, SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_MIXER_E("RX3 CHAIN", MSM89XX_CDC_CORE_RX3_B6_CTL,
		MSM89XX_RX3, 0, NULL, 0,
		msm_dig_cdc_codec_enable_rx_chain, SND_SOC_DAPM_POST_PMD),

	SND_SOC_DAPM_MUX("RX1 MIX1 INP1", SND_SOC_NOPM, 0, 0,
		&rx_mix1_inp1_mux),
+8 −36
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -13,6 +13,7 @@
#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/of_irq.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>
@@ -83,7 +84,7 @@ struct wcd9xxx_spmi_map {
	uint8_t mask[NUM_IRQ_REGS];
	int linuxirq[MAX_NUM_IRQS];
	irq_handler_t handler[MAX_NUM_IRQS];
	struct spmi_device *spmi[NUM_IRQ_REGS];
	struct platform_device *spmi[NUM_IRQ_REGS];
	struct snd_soc_codec *codec;

	enum wcd9xxx_spmi_pm_state pm_state;
@@ -99,22 +100,6 @@ struct wcd9xxx_spmi_map map;
void wcd9xxx_spmi_enable_irq(int irq)
{
	pr_debug("%s: irqno =%d\n", __func__, irq);
	if ((irq >= 0) && (irq <= 7)) {
		snd_soc_update_bits(map.codec,
				MSM89XX_PMIC_DIGITAL_INT_EN_CLR,
				(0x01 << irq), 0x00);
		snd_soc_update_bits(map.codec,
				MSM89XX_PMIC_DIGITAL_INT_EN_SET,
				(0x01 << irq), (0x01 << irq));
	}
	if ((irq > 7) && (irq <= 15)) {
		snd_soc_update_bits(map.codec,
				MSM89XX_PMIC_ANALOG_INT_EN_CLR,
				(0x01 << (irq - 8)), 0x00);
		snd_soc_update_bits(map.codec,
				MSM89XX_PMIC_ANALOG_INT_EN_SET,
				(0x01 << (irq - 8)), (0x01 << (irq - 8)));
	}

	if (!(map.mask[BIT_BYTE(irq)] & (BYTE_BIT_MASK(irq))))
		return;
@@ -128,23 +113,6 @@ void wcd9xxx_spmi_enable_irq(int irq)
void wcd9xxx_spmi_disable_irq(int irq)
{
	pr_debug("%s: irqno =%d\n", __func__, irq);
	if ((irq >= 0) && (irq <= 7)) {
		snd_soc_update_bits(map.codec,
				MSM89XX_PMIC_DIGITAL_INT_EN_SET,
				(0x01 << (irq)), 0x00);
		snd_soc_update_bits(map.codec,
				MSM89XX_PMIC_DIGITAL_INT_EN_CLR,
				(0x01 << irq), (0x01 << irq));
	}

	if ((irq > 7) && (irq <= 15)) {
		snd_soc_update_bits(map.codec,
				MSM89XX_PMIC_ANALOG_INT_EN_SET,
				(0x01 << (irq - 8)), 0x00);
		snd_soc_update_bits(map.codec,
				MSM89XX_PMIC_ANALOG_INT_EN_CLR,
				(0x01 << (irq - 8)), (0x01 << (irq - 8)));
	}

	if (map.mask[BIT_BYTE(irq)] & (BYTE_BIT_MASK(irq)))
		return;
@@ -161,6 +129,10 @@ int wcd9xxx_spmi_request_irq(int irq, irq_handler_t handler,
	int rc;
	unsigned long irq_flags;

	map.linuxirq[irq] =
		platform_get_irq_byname(map.spmi[BIT_BYTE(irq)],
					irq_names[irq]);

	if (strcmp(name, "mbhc sw intr"))
		irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
			IRQF_ONESHOT;
@@ -414,7 +386,7 @@ void wcd9xxx_spmi_set_codec(struct snd_soc_codec *codec)
	map.codec = codec;
}

void wcd9xxx_spmi_set_dev(struct spmi_device *spmi, int i)
void wcd9xxx_spmi_set_dev(struct platform_device *spmi, int i)
{
	if (i < NUM_IRQ_REGS)
		map.spmi[i] = spmi;
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015, 2017 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -24,7 +24,7 @@ extern int wcd9xxx_spmi_request_irq(int irq, irq_handler_t handler,
				const char *name, void *priv);
extern int wcd9xxx_spmi_free_irq(int irq, void *priv);
extern void wcd9xxx_spmi_set_codec(struct snd_soc_codec *codec);
extern void wcd9xxx_spmi_set_dev(struct spmi_device *spmi, int i);
extern void wcd9xxx_spmi_set_dev(struct platform_device *spmi, int i);
extern int wcd9xxx_spmi_irq_init(void);
extern int wcd9xxx_spmi_suspend(pm_message_t);
extern int wcd9xxx_spmi_resume(void);
Loading