/*
 * madera.c - Cirrus Logic Madera class codecs common support
 *
 * Copyright 2015-2016 Cirrus Logic
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/delay.h>
#include <linux/gcd.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>

#include <linux/mfd/madera/core.h>
#include <linux/mfd/madera/registers.h>
#include <linux/mfd/madera/pdata.h>
#include <sound/madera-pdata.h>
#include <linux/extcon/extcon-madera-pdata.h>

#include <dt-bindings/sound/madera.h>

#include "madera.h"

#define MADERA_AIF_BCLK_CTRL		0x00
#define MADERA_AIF_TX_PIN_CTRL		0x01
#define MADERA_AIF_RX_PIN_CTRL		0x02
#define MADERA_AIF_RATE_CTRL		0x03
#define MADERA_AIF_FORMAT		0x04
#define MADERA_AIF_TX_BCLK_RATE		0x05
#define MADERA_AIF_RX_BCLK_RATE		0x06
#define MADERA_AIF_FRAME_CTRL_1		0x07
#define MADERA_AIF_FRAME_CTRL_2		0x08
#define MADERA_AIF_FRAME_CTRL_3		0x09
#define MADERA_AIF_FRAME_CTRL_4		0x0A
#define MADERA_AIF_FRAME_CTRL_5		0x0B
#define MADERA_AIF_FRAME_CTRL_6		0x0C
#define MADERA_AIF_FRAME_CTRL_7		0x0D
#define MADERA_AIF_FRAME_CTRL_8		0x0E
#define MADERA_AIF_FRAME_CTRL_9		0x0F
#define MADERA_AIF_FRAME_CTRL_10	0x10
#define MADERA_AIF_FRAME_CTRL_11	0x11
#define MADERA_AIF_FRAME_CTRL_12	0x12
#define MADERA_AIF_FRAME_CTRL_13	0x13
#define MADERA_AIF_FRAME_CTRL_14	0x14
#define MADERA_AIF_FRAME_CTRL_15	0x15
#define MADERA_AIF_FRAME_CTRL_16	0x16
#define MADERA_AIF_FRAME_CTRL_17	0x17
#define MADERA_AIF_FRAME_CTRL_18	0x18
#define MADERA_AIF_TX_ENABLES		0x19
#define MADERA_AIF_RX_ENABLES		0x1A
#define MADERA_AIF_FORCE_WRITE		0x1B

#define MADERA_DSP_CONFIG_1_OFFS	0x00
#define MADERA_DSP_CONFIG_2_OFFS	0x02

#define MADERA_DSP_CLK_SEL_MASK		0x70000
#define MADERA_DSP_CLK_SEL_SHIFT	16

#define MADERA_DSP_RATE_MASK		0x7800
#define MADERA_DSP_RATE_SHIFT		11

#define MADERA_FLL_VCO_CORNER		141900000
#define MADERA_FLL_MAX_FREF		 13500000
#define MADERA_FLL_MAX_N		     1023
#define MADERA_FLL_MIN_FOUT		 90000000
#define MADERA_FLL_MAX_FOUT		100000000
#define MADERA_FLL_MAX_FRATIO		       16
#define MADERA_FLL_MAX_REFDIV			8
#define MADERA_FLL_OUTDIV			3
#define MADERA_FLL_VCO_MULT			3
#define MADERA_FLLAO_MAX_FREF		 12288000
#define MADERA_FLLAO_MIN_N		        4
#define MADERA_FLLAO_MAX_N		     1023
#define MADERA_FLLAO_MAX_FBDIV		      254

#define MADERA_FLL_SYNCHRONISER_OFFS		0x10
#define CS47L35_FLL_SYNCHRONISER_OFFS		0xE

#define MADERA_FLL_CONTROL_1_OFFS		0x1
#define MADERA_FLL_CONTROL_2_OFFS		0x2
#define MADERA_FLL_CONTROL_3_OFFS		0x3
#define MADERA_FLL_CONTROL_4_OFFS		0x4
#define MADERA_FLL_CONTROL_5_OFFS		0x5
#define MADERA_FLL_CONTROL_6_OFFS		0x6
#define MADERA_FLL_LOOP_FILTER_TEST_1_OFFS	0x7
#define MADERA_FLL_NCO_TEST_0_OFFS		0x8
#define MADERA_FLL_CONTROL_7_OFFS		0x9
#define MADERA_FLL_EFS_2_OFFS			0xA
#define MADERA_FLL_SYNCHRONISER_1_OFFS		0x1
#define MADERA_FLL_SYNCHRONISER_2_OFFS		0x2
#define MADERA_FLL_SYNCHRONISER_3_OFFS		0x3
#define MADERA_FLL_SYNCHRONISER_4_OFFS		0x4
#define MADERA_FLL_SYNCHRONISER_5_OFFS		0x5
#define MADERA_FLL_SYNCHRONISER_6_OFFS		0x6
#define MADERA_FLL_SYNCHRONISER_7_OFFS		0x7
#define MADERA_FLL_SPREAD_SPECTRUM_OFFS		0x9
#define MADERA_FLL_GPIO_CLOCK_OFFS		0xA

#define MADERA_FLLAO_CONTROL_1_OFFS		0x1
#define MADERA_FLLAO_CONTROL_2_OFFS		0x2
#define MADERA_FLLAO_CONTROL_3_OFFS		0x3
#define MADERA_FLLAO_CONTROL_4_OFFS		0x4
#define MADERA_FLLAO_CONTROL_5_OFFS		0x5
#define MADERA_FLLAO_CONTROL_6_OFFS		0x6
#define MADERA_FLLAO_CONTROL_7_OFFS		0x8
#define MADERA_FLLAO_CONTROL_8_OFFS		0xA
#define MADERA_FLLAO_CONTROL_9_OFFS		0xB
#define MADERA_FLLAO_CONTROL_10_OFFS		0xC
#define MADERA_FLLAO_CONTROL_11_OFFS		0xD

#define MADERA_FMT_DSP_MODE_A		0
#define MADERA_FMT_DSP_MODE_B		1
#define MADERA_FMT_I2S_MODE		2
#define MADERA_FMT_LEFT_JUSTIFIED_MODE	3

#define madera_fll_err(_fll, fmt, ...) \
	dev_err(_fll->madera->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
#define madera_fll_warn(_fll, fmt, ...) \
	dev_warn(_fll->madera->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
#define madera_fll_dbg(_fll, fmt, ...) \
	dev_dbg(_fll->madera->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)

#define madera_aif_err(_dai, fmt, ...) \
	dev_err(_dai->dev, "AIF%d: " fmt, _dai->id, ##__VA_ARGS__)
#define madera_aif_warn(_dai, fmt, ...) \
	dev_warn(_dai->dev, "AIF%d: " fmt, _dai->id, ##__VA_ARGS__)
#define madera_aif_dbg(_dai, fmt, ...) \
	dev_dbg(_dai->dev, "AIF%d: " fmt, _dai->id, ##__VA_ARGS__)

static const int madera_dsp_bus_error_irqs[MADERA_MAX_ADSP] = {
	MADERA_IRQ_DSP1_BUS_ERROR,
	MADERA_IRQ_DSP2_BUS_ERROR,
	MADERA_IRQ_DSP3_BUS_ERROR,
	MADERA_IRQ_DSP4_BUS_ERROR,
	MADERA_IRQ_DSP5_BUS_ERROR,
	MADERA_IRQ_DSP6_BUS_ERROR,
	MADERA_IRQ_DSP7_BUS_ERROR,
};

static const unsigned int madera_aif1_inputs[32] = {
	MADERA_AIF1TX1MIX_INPUT_1_SOURCE,
	MADERA_AIF1TX1MIX_INPUT_2_SOURCE,
	MADERA_AIF1TX1MIX_INPUT_3_SOURCE,
	MADERA_AIF1TX1MIX_INPUT_4_SOURCE,
	MADERA_AIF1TX2MIX_INPUT_1_SOURCE,
	MADERA_AIF1TX2MIX_INPUT_2_SOURCE,
	MADERA_AIF1TX2MIX_INPUT_3_SOURCE,
	MADERA_AIF1TX2MIX_INPUT_4_SOURCE,
	MADERA_AIF1TX3MIX_INPUT_1_SOURCE,
	MADERA_AIF1TX3MIX_INPUT_2_SOURCE,
	MADERA_AIF1TX3MIX_INPUT_3_SOURCE,
	MADERA_AIF1TX3MIX_INPUT_4_SOURCE,
	MADERA_AIF1TX4MIX_INPUT_1_SOURCE,
	MADERA_AIF1TX4MIX_INPUT_2_SOURCE,
	MADERA_AIF1TX4MIX_INPUT_3_SOURCE,
	MADERA_AIF1TX4MIX_INPUT_4_SOURCE,
	MADERA_AIF1TX5MIX_INPUT_1_SOURCE,
	MADERA_AIF1TX5MIX_INPUT_2_SOURCE,
	MADERA_AIF1TX5MIX_INPUT_3_SOURCE,
	MADERA_AIF1TX5MIX_INPUT_4_SOURCE,
	MADERA_AIF1TX6MIX_INPUT_1_SOURCE,
	MADERA_AIF1TX6MIX_INPUT_2_SOURCE,
	MADERA_AIF1TX6MIX_INPUT_3_SOURCE,
	MADERA_AIF1TX6MIX_INPUT_4_SOURCE,
	MADERA_AIF1TX7MIX_INPUT_1_SOURCE,
	MADERA_AIF1TX7MIX_INPUT_2_SOURCE,
	MADERA_AIF1TX7MIX_INPUT_3_SOURCE,
	MADERA_AIF1TX7MIX_INPUT_4_SOURCE,
	MADERA_AIF1TX8MIX_INPUT_1_SOURCE,
	MADERA_AIF1TX8MIX_INPUT_2_SOURCE,
	MADERA_AIF1TX8MIX_INPUT_3_SOURCE,
	MADERA_AIF1TX8MIX_INPUT_4_SOURCE,
};

static const unsigned int madera_aif2_inputs[32] = {
	MADERA_AIF2TX1MIX_INPUT_1_SOURCE,
	MADERA_AIF2TX1MIX_INPUT_2_SOURCE,
	MADERA_AIF2TX1MIX_INPUT_3_SOURCE,
	MADERA_AIF2TX1MIX_INPUT_4_SOURCE,
	MADERA_AIF2TX2MIX_INPUT_1_SOURCE,
	MADERA_AIF2TX2MIX_INPUT_2_SOURCE,
	MADERA_AIF2TX2MIX_INPUT_3_SOURCE,
	MADERA_AIF2TX2MIX_INPUT_4_SOURCE,
	MADERA_AIF2TX3MIX_INPUT_1_SOURCE,
	MADERA_AIF2TX3MIX_INPUT_2_SOURCE,
	MADERA_AIF2TX3MIX_INPUT_3_SOURCE,
	MADERA_AIF2TX3MIX_INPUT_4_SOURCE,
	MADERA_AIF2TX4MIX_INPUT_1_SOURCE,
	MADERA_AIF2TX4MIX_INPUT_2_SOURCE,
	MADERA_AIF2TX4MIX_INPUT_3_SOURCE,
	MADERA_AIF2TX4MIX_INPUT_4_SOURCE,
	MADERA_AIF2TX5MIX_INPUT_1_SOURCE,
	MADERA_AIF2TX5MIX_INPUT_2_SOURCE,
	MADERA_AIF2TX5MIX_INPUT_3_SOURCE,
	MADERA_AIF2TX5MIX_INPUT_4_SOURCE,
	MADERA_AIF2TX6MIX_INPUT_1_SOURCE,
	MADERA_AIF2TX6MIX_INPUT_2_SOURCE,
	MADERA_AIF2TX6MIX_INPUT_3_SOURCE,
	MADERA_AIF2TX6MIX_INPUT_4_SOURCE,
	MADERA_AIF2TX7MIX_INPUT_1_SOURCE,
	MADERA_AIF2TX7MIX_INPUT_2_SOURCE,
	MADERA_AIF2TX7MIX_INPUT_3_SOURCE,
	MADERA_AIF2TX7MIX_INPUT_4_SOURCE,
	MADERA_AIF2TX8MIX_INPUT_1_SOURCE,
	MADERA_AIF2TX8MIX_INPUT_2_SOURCE,
	MADERA_AIF2TX8MIX_INPUT_3_SOURCE,
	MADERA_AIF2TX8MIX_INPUT_4_SOURCE,
};

static const unsigned int madera_aif3_inputs[16] = {
	MADERA_AIF3TX1MIX_INPUT_1_SOURCE,
	MADERA_AIF3TX1MIX_INPUT_2_SOURCE,
	MADERA_AIF3TX1MIX_INPUT_3_SOURCE,
	MADERA_AIF3TX1MIX_INPUT_4_SOURCE,
	MADERA_AIF3TX2MIX_INPUT_1_SOURCE,
	MADERA_AIF3TX2MIX_INPUT_2_SOURCE,
	MADERA_AIF3TX2MIX_INPUT_3_SOURCE,
	MADERA_AIF3TX2MIX_INPUT_4_SOURCE,
	MADERA_AIF3TX3MIX_INPUT_1_SOURCE,
	MADERA_AIF3TX3MIX_INPUT_2_SOURCE,
	MADERA_AIF3TX3MIX_INPUT_3_SOURCE,
	MADERA_AIF3TX3MIX_INPUT_4_SOURCE,
	MADERA_AIF3TX4MIX_INPUT_1_SOURCE,
	MADERA_AIF3TX4MIX_INPUT_2_SOURCE,
	MADERA_AIF3TX4MIX_INPUT_3_SOURCE,
	MADERA_AIF3TX4MIX_INPUT_4_SOURCE,
};

static const unsigned int madera_aif4_inputs[8] = {
	MADERA_AIF4TX1MIX_INPUT_1_SOURCE,
	MADERA_AIF4TX1MIX_INPUT_2_SOURCE,
	MADERA_AIF4TX1MIX_INPUT_3_SOURCE,
	MADERA_AIF4TX1MIX_INPUT_4_SOURCE,
	MADERA_AIF4TX2MIX_INPUT_1_SOURCE,
	MADERA_AIF4TX2MIX_INPUT_2_SOURCE,
	MADERA_AIF4TX2MIX_INPUT_3_SOURCE,
	MADERA_AIF4TX2MIX_INPUT_4_SOURCE,
};

static int madera_get_sources(struct snd_soc_dai *dai,
			      const unsigned int **sources, int *lim)
{
	int ret = 0;

	*lim = dai->driver->playback.channels_max * 4;

	switch (dai->driver->base) {
	case MADERA_AIF1_BCLK_CTRL:
		*sources = madera_aif1_inputs;
		break;
	case MADERA_AIF2_BCLK_CTRL:
		*sources = madera_aif2_inputs;
		break;
	case MADERA_AIF3_BCLK_CTRL:
		*sources = madera_aif3_inputs;
		break;
	case MADERA_AIF4_BCLK_CTRL:
		*sources = madera_aif4_inputs;
		break;
	default:
		ret = -EINVAL;
		break;
	}

	return ret;
}

int madera_cache_and_clear_sources(struct madera_priv *priv,
				   const unsigned int *sources,
				   unsigned int *cache, int lim)
{
	struct madera *madera = priv->madera;
	int ret = 0;
	int i;

	memset(cache, 0, lim * sizeof(unsigned int));

	for (i = 0; i < lim; i++) {
		ret = regmap_read(madera->regmap, sources[i], &cache[i]);

		dev_dbg(madera->dev,
			"%s addr: 0x%04x value: 0x%04x\n",
			__func__, sources[i], cache[i]);

		if (ret) {
			dev_err(madera->dev,
				"%s Failed to cache AIF:0x%04x inputs: %d\n",
				__func__, sources[i], ret);
			break;
		}

		/* Don't bother to set to zero if it already is */
		if (!cache[i])
			continue;

		ret = regmap_write(madera->regmap, sources[i], 0);

		if (ret) {
			dev_err(madera->dev,
				"%s Failed to clear AIF:0x%04x inputs: %d\n",
				__func__, sources[i], ret);
			break;
		}
	}

	return ret;
}
EXPORT_SYMBOL_GPL(madera_cache_and_clear_sources);

void madera_spin_sysclk(struct madera_priv *priv)
{
	struct madera *madera = priv->madera;
	unsigned int val;
	int ret, i;

	/* Skip this if the chip is down */
	if (pm_runtime_suspended(madera->dev))
		return;

	/*
	 * Just read a register a few times to ensure the internal
	 * oscillator sends out a few clocks.
	 */
	for (i = 0; i < 4; i++) {
		ret = regmap_read(madera->regmap, MADERA_SOFTWARE_RESET, &val);
		if (ret)
			dev_err(madera->dev,
				"%s Failed to read register: %d (%d)\n",
				__func__, ret, i);
	}

	udelay(300);
}
EXPORT_SYMBOL_GPL(madera_spin_sysclk);

int madera_restore_sources(struct madera_priv *priv,
			   const unsigned int *sources,
			   unsigned int *cache, int lim)
{
	struct madera *madera = priv->madera;
	int i;
	int ret = 0;

	for (i = 0; i < lim; i++) {
		dev_dbg(madera->dev,
			"%s addr: 0x%04x value: 0x%04x\n",
			__func__, sources[i], cache[i]);

		/* All mixers will be at zero no need to write to zero again */
		if (!cache[i])
			continue;

		ret = regmap_write(madera->regmap, sources[i], cache[i]);

		if (ret) {
			dev_err(madera->dev,
				"%s Failed to restore AIF:0x%04x inputs: %d\n",
				__func__, sources[i], ret);
			break;
		}
	}

	return ret;

}
EXPORT_SYMBOL_GPL(madera_restore_sources);

int madera_sysclk_ev(struct snd_soc_dapm_widget *w,
		     struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);

	madera_spin_sysclk(priv);

	return 0;
}
EXPORT_SYMBOL_GPL(madera_sysclk_ev);

static int madera_check_speaker_overheat(struct madera *madera,
					 bool *warn, bool *shutdown)
{
	unsigned int val;
	int ret;

	ret = regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_15, &val);
	if (ret) {
		dev_err(madera->dev, "Failed to read thermal status: %d\n",
			ret);
		return ret;
	}

	*warn = val & MADERA_SPK_OVERHEAT_WARN_STS1 ? true : false;
	*shutdown = val & MADERA_SPK_OVERHEAT_STS1 ? true : false;
	return 0;
}

static int madera_spk_ev(struct snd_soc_dapm_widget *w,
			 struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
	struct madera *madera = dev_get_drvdata(codec->dev->parent);
	bool warn, shutdown;
	int ret;

	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
		ret = madera_check_speaker_overheat(madera, &warn, &shutdown);
		if (ret)
			return ret;

		if (shutdown) {
			dev_crit(madera->dev,
				 "Speaker not enabled due to temperature\n");
			return -EBUSY;
		}

		regmap_update_bits_async(madera->regmap,
					 MADERA_OUTPUT_ENABLES_1,
					 1 << w->shift, 1 << w->shift);
		break;
	case SND_SOC_DAPM_PRE_PMD:
		regmap_update_bits_async(madera->regmap,
					 MADERA_OUTPUT_ENABLES_1,
					 1 << w->shift, 0);
		break;
	default:
		break;
	}

	return 0;
}

static irqreturn_t madera_thermal_warn(int irq, void *data)
{
	struct madera *madera = data;
	bool warn, shutdown;
	int ret;

	ret = madera_check_speaker_overheat(madera, &warn, &shutdown);
	if ((ret == 0) && warn)
		dev_crit(madera->dev, "Thermal warning\n");

	return IRQ_HANDLED;
}

static irqreturn_t madera_thermal_shutdown(int irq, void *data)
{
	struct madera *madera = data;
	bool warn, shutdown;
	int ret;

	ret = madera_check_speaker_overheat(madera, &warn, &shutdown);
	if ((ret == 0) && shutdown) {
		dev_crit(madera->dev, "Thermal shutdown\n");
		ret = regmap_update_bits(madera->regmap,
					 MADERA_OUTPUT_ENABLES_1,
					 MADERA_OUT4L_ENA |
					 MADERA_OUT4R_ENA, 0);
		if (ret != 0)
			dev_crit(madera->dev,
				 "Failed to disable speaker outputs: %d\n",
				 ret);
	}

	return IRQ_HANDLED;
}

static const struct snd_soc_dapm_widget madera_spk[2] = {
	SND_SOC_DAPM_PGA_E("OUT4L", SND_SOC_NOPM,
			   MADERA_OUT4L_ENA_SHIFT, 0, NULL, 0, madera_spk_ev,
			   SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
	SND_SOC_DAPM_PGA_E("OUT4R", SND_SOC_NOPM,
			   MADERA_OUT4R_ENA_SHIFT, 0, NULL, 0, madera_spk_ev,
			   SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
};

int madera_init_spk(struct snd_soc_codec *codec, int n_channels)
{
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	int ret;

	ret = snd_soc_dapm_new_controls(dapm, madera_spk, n_channels);
	if (ret)
		return ret;

	ret = madera_request_irq(madera, MADERA_IRQ_SPK_OVERHEAT_WARN,
				 "Thermal warning", madera_thermal_warn,
				 madera);
	if (ret)
		dev_warn(madera->dev,
			"Failed to get thermal warning IRQ: %d\n", ret);

	ret = madera_request_irq(madera, MADERA_IRQ_SPK_OVERHEAT,
				 "Thermal shutdown", madera_thermal_shutdown,
				 madera);
	if (ret)
		dev_warn(madera->dev,
			"Failed to get thermal shutdown IRQ: %d\n", ret);

	return 0;
}
EXPORT_SYMBOL_GPL(madera_init_spk);

int madera_free_spk(struct snd_soc_codec *codec)
{
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;

	madera_free_irq(madera, MADERA_IRQ_SPK_OVERHEAT_WARN, madera);
	madera_free_irq(madera, MADERA_IRQ_SPK_OVERHEAT, madera);

	return 0;
}
EXPORT_SYMBOL_GPL(madera_free_spk);

static void madera_get_inmode_from_of(struct madera *madera)
{
	struct device_node *np = madera->dev->of_node;
	struct property *tempprop;
	const __be32 *cur;
	u32 val;
	int in_n = 0, ch_n = 0;

	BUILD_BUG_ON(ARRAY_SIZE(madera->pdata.codec.inmode) != MADERA_MAX_INPUT);
	BUILD_BUG_ON(ARRAY_SIZE(madera->pdata.codec.inmode[0]) !=
		     MADERA_MAX_MUXED_CHANNELS);

	of_property_for_each_u32(np, "cirrus,inmode", tempprop, cur, val) {
		madera->pdata.codec.inmode[in_n][ch_n] = val;

		if (++ch_n == MADERA_MAX_MUXED_CHANNELS) {
			ch_n = 0;
			if (++in_n == MADERA_MAX_INPUT)
				break;
		}
	}

	if (ch_n != 0)
		dev_warn(madera->dev, "%s not a multiple of %d entries\n",
			 "cirrus,inmode", MADERA_MAX_MUXED_CHANNELS);
}

static void madera_get_pdata_from_of(struct madera *madera)
{
	struct madera_codec_pdata *pdata = &madera->pdata.codec;
	unsigned int out_mono[ARRAY_SIZE(pdata->out_mono)];
	int i;

	memset(&out_mono, 0, sizeof(out_mono));

	madera_of_read_uint_array(madera, "cirrus,max-channels-clocked", false,
				 pdata->max_channels_clocked,
				0, ARRAY_SIZE(pdata->max_channels_clocked));

	madera_get_inmode_from_of(madera);

	madera_of_read_uint_array(madera, "cirrus,out-mono", false,
				 out_mono,
				 ARRAY_SIZE(out_mono), ARRAY_SIZE(out_mono));
	for (i = 0; i < ARRAY_SIZE(out_mono); ++i)
		pdata->out_mono[i] = !!out_mono[i];

	madera_of_read_uint_array(madera, "cirrus,pdm-fmt", false,
				 pdata->pdm_fmt,
				 ARRAY_SIZE(pdata->pdm_fmt),
				 ARRAY_SIZE(pdata->pdm_fmt));

	madera_of_read_uint_array(madera, "cirrus,pdm-mute", false,
				 pdata->pdm_mute,
				 ARRAY_SIZE(pdata->pdm_mute),
				 ARRAY_SIZE(pdata->pdm_mute));

	madera_of_read_uint_array(madera, "cirrus,dmic-ref", false,
				pdata->dmic_ref,
				0, ARRAY_SIZE(pdata->dmic_ref));

	madera_of_read_uint_array(madera, "cirrus,dmic-clksrc", false,
				pdata->dmic_clksrc,
				0, ARRAY_SIZE(pdata->dmic_clksrc));
}

int madera_core_init(struct madera_priv *priv)
{
	BUILD_BUG_ON(ARRAY_SIZE(madera_mixer_texts) != MADERA_NUM_MIXER_INPUTS);
	BUILD_BUG_ON(ARRAY_SIZE(madera_mixer_values) != MADERA_NUM_MIXER_INPUTS);
	BUILD_BUG_ON(ARRAY_SIZE(priv->aif_sources_cache) <
				ARRAY_SIZE(madera_aif1_inputs));
	BUILD_BUG_ON(madera_sample_rate_text[MADERA_SAMPLE_RATE_ENUM_SIZE - 1]
		     == NULL);
	BUILD_BUG_ON(madera_sample_rate_val[MADERA_SAMPLE_RATE_ENUM_SIZE - 1]
		     == 0);

	if (IS_ENABLED(CONFIG_OF))
		if (!dev_get_platdata(priv->madera->dev))
			madera_get_pdata_from_of(priv->madera);

	mutex_init(&priv->adsp_rate_lock);
	mutex_init(&priv->rate_lock);
	mutex_init(&priv->adsp_fw_lock);

	return 0;
}
EXPORT_SYMBOL_GPL(madera_core_init);

int madera_core_destroy(struct madera_priv *priv)
{
	mutex_destroy(&priv->adsp_rate_lock);
	mutex_destroy(&priv->rate_lock);
	mutex_destroy(&priv->adsp_fw_lock);

	return 0;
}
EXPORT_SYMBOL_GPL(madera_core_destroy);

static bool madera_is_hp_shorted(const struct madera *madera,
				 unsigned int index)
{
	if (index >= MADERA_MAX_ACCESSORY)
		return false;

	return (madera->hp_impedance_x100[index] <=
		madera->pdata.accdet[index].hpdet_short_circuit_imp * 100);
}

int madera_out1_demux_put(struct snd_kcontrol *kcontrol,
			  struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
	struct snd_soc_dapm_context *dapm =
		snd_soc_dapm_kcontrol_dapm(kcontrol);
	struct madera *madera = dev_get_drvdata(codec->dev->parent);
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	unsigned int ep_sel, mux, change;
	unsigned int mask;
	int ret, demux_change_ret;
	bool out_mono, restore_out = true;

	if (ucontrol->value.enumerated.item[0] > e->items - 1)
		return -EINVAL;

	mux = ucontrol->value.enumerated.item[0];
	ep_sel = mux << e->shift_l;
	mask = e->mask << e->shift_l;

	snd_soc_dapm_mutex_lock(dapm);

	change = snd_soc_test_bits(codec, e->reg, mask, ep_sel);

	/* if no change is required, skip */
	if (!change)
		goto end;

	/* EP_SEL should not be modified while HP or EP driver is enabled */
	ret = regmap_update_bits(madera->regmap,
				 MADERA_OUTPUT_ENABLES_1,
				 MADERA_OUT1L_ENA |
				 MADERA_OUT1R_ENA, 0);
	if (ret)
		dev_warn(madera->dev, "Failed to disable outputs: %d\n", ret);

	usleep_range(2000, 3000); /* wait for wseq to complete */

	/* if HP detection clamp is applied while switching to HPOUT
	 * OUT1 should remain disabled and EDRE should be set to manual
	 */
	if (!ep_sel &&
	    (madera->hpdet_clamp[0] || madera_is_hp_shorted(madera, 0)))
		restore_out = false;

	if (!ep_sel && madera->hpdet_clamp[0]) {
		ret = regmap_write(madera->regmap, MADERA_EDRE_MANUAL, 0x3);
		if (ret)
			dev_warn(madera->dev,
				 "Failed to set EDRE Manual: %d\n",
				 ret);
	}

	/* change demux setting */
	demux_change_ret = regmap_update_bits(madera->regmap,
					      MADERA_OUTPUT_ENABLES_1,
					      MADERA_EP_SEL, ep_sel);
	if (demux_change_ret) {
		dev_err(madera->dev, "Failed to set OUT1 demux: %d\n",
			demux_change_ret);
	} else {
		/* apply correct setting for mono mode */
		if (!ep_sel && !madera->pdata.codec.out_mono[0])
			out_mono = false; /* stereo HP */
		else
			out_mono = true; /* EP or mono HP */

		ret = madera_set_output_mode(codec, 1, out_mono);
		if (ret)
			dev_warn(madera->dev,
				 "Failed to set output mode: %d\n", ret);
	}

	/* restore output state if allowed */
	if (restore_out) {
		ret = regmap_update_bits(madera->regmap,
					 MADERA_OUTPUT_ENABLES_1,
					 MADERA_OUT1L_ENA |
					 MADERA_OUT1R_ENA,
					 madera->hp_ena);
		if (ret)
			dev_warn(madera->dev,
				 "Failed to restore earpiece outputs: %d\n",
				 ret);
		else if (madera->hp_ena)
			msleep(34); /* wait for enable wseq */
		else
			usleep_range(2000, 3000); /* wait for disable wseq */
	}

	/* if a switch to EPOUT occurred restore EDRE setting */
	if (ep_sel && !demux_change_ret) {
		ret = regmap_write(madera->regmap, MADERA_EDRE_MANUAL, 0);
		if (ret)
			dev_warn(madera->dev,
				 "Failed to restore EDRE Manual: %d\n",
				 ret);
	}

end:
	snd_soc_dapm_mutex_unlock(dapm);

	return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
}
EXPORT_SYMBOL_GPL(madera_out1_demux_put);


static int madera_inmux_put(struct snd_kcontrol *kcontrol,
			    struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
	struct snd_soc_dapm_context *dapm =
		snd_soc_dapm_kcontrol_dapm(kcontrol);
	struct madera *madera = dev_get_drvdata(codec->dev->parent);
	struct soc_enum *e = (struct soc_enum *) kcontrol->private_value;
	unsigned int mux, src_val, src_mask, gang_reg, dmode_reg, dmode_val;
	unsigned int inmode_a, inmode_gang, inmode;
	bool changed = false;
	int ret;

	mux = ucontrol->value.enumerated.item[0];
	if (mux > 1)
		return -EINVAL;

	src_val = mux << e->shift_l;
	src_mask = e->mask << e->shift_l;

	switch (e->reg) {
	case MADERA_ADC_DIGITAL_VOLUME_1L:
		inmode_a = madera->pdata.codec.inmode[0][0];
		inmode = madera->pdata.codec.inmode[0][2 * mux];
		inmode_gang = madera->pdata.codec.inmode[0][1 + (2 * mux)];
		gang_reg = MADERA_ADC_DIGITAL_VOLUME_1R;
		dmode_reg = MADERA_IN1L_CONTROL;
		break;
	case MADERA_ADC_DIGITAL_VOLUME_1R:
		inmode_a = madera->pdata.codec.inmode[0][0];
		inmode = madera->pdata.codec.inmode[0][1 + (2 * mux)];
		inmode_gang = madera->pdata.codec.inmode[0][2 * mux];
		gang_reg = MADERA_ADC_DIGITAL_VOLUME_1L;
		dmode_reg = MADERA_IN1L_CONTROL;
		break;
	case MADERA_ADC_DIGITAL_VOLUME_2L:
		inmode_a = madera->pdata.codec.inmode[1][0];
		inmode = madera->pdata.codec.inmode[1][2 * mux];
		inmode_gang = madera->pdata.codec.inmode[1][1 + (2 * mux)];
		gang_reg = MADERA_ADC_DIGITAL_VOLUME_2R;
		dmode_reg = MADERA_IN2L_CONTROL;
		break;
	case MADERA_ADC_DIGITAL_VOLUME_2R:
		inmode_a = madera->pdata.codec.inmode[1][0];
		inmode = madera->pdata.codec.inmode[1][1 + (2 * mux)];
		inmode_gang = madera->pdata.codec.inmode[1][2 * mux];
		gang_reg = MADERA_ADC_DIGITAL_VOLUME_2L;
		dmode_reg = MADERA_IN2L_CONTROL;
		break;
	default:
		return -EINVAL;
	}

	/* SE mask and shift is same for all channels */
	src_mask |= MADERA_IN1L_SRC_SE_MASK;
	if (inmode & MADERA_INMODE_SE)
		src_val |= 1 << MADERA_IN1L_SRC_SE_SHIFT;

	dev_dbg(madera->dev,
		"mux=%u reg=0x%x inmode_a=0x%x inmode=0x%x mask=0x%x val=0x%x\n",
		mux, e->reg, inmode_a, inmode, src_mask, src_val);

	ret = snd_soc_component_update_bits(dapm->component,
					    e->reg,
					    src_mask,
					    src_val);
	if (ret < 0)
		return ret;
	else if (ret)
		changed = true;

	/* if the A input is digital we must switch both channels together */
	if (inmode_a == MADERA_INMODE_DMIC) {
		switch (madera->type) {
		case CS47L85:
		case WM1840:
			if (e->reg == MADERA_ADC_DIGITAL_VOLUME_1L)
				goto out;	/* not ganged */
			break;
		case CS47L90:
		case CS47L91:
			if (e->reg == MADERA_ADC_DIGITAL_VOLUME_2L)
				goto out;	/* not ganged */
			break;
		default:
			break;
		}

		/* ganged channels can have different analogue modes */
		if (inmode_gang & MADERA_INMODE_SE)
			src_val |= 1 << MADERA_IN1L_SRC_SE_SHIFT;
		else
			src_val &= ~(1 << MADERA_IN1L_SRC_SE_SHIFT);

		if (mux)
			dmode_val = 0; /* B always analogue */
		else
			dmode_val = 1 << MADERA_IN1_MODE_SHIFT; /* DMIC */

		dev_dbg(madera->dev,
			"gang_reg=0x%x inmode_gang=0x%x gang_val=0x%x dmode_val=0x%x\n",
			gang_reg, inmode_gang, src_val, dmode_val);

		ret = snd_soc_component_update_bits(dapm->component,
						    gang_reg,
						    src_mask,
						    src_val);
		if (ret < 0)
			return ret;
		else if (ret)
			changed |= true;

		ret = snd_soc_component_update_bits(dapm->component,
						    dmode_reg,
						    MADERA_IN1_MODE_MASK,
						    dmode_val);
	}

out:
	if (changed)
		return snd_soc_dapm_mux_update_power(dapm, kcontrol,
						     mux, e, NULL);
	else
		return 0;
}

static const char * const madera_inmux_texts[] = {
	"A",
	"B",
};

static SOC_ENUM_SINGLE_DECL(madera_in1muxl_enum,
			    MADERA_ADC_DIGITAL_VOLUME_1L,
			    MADERA_IN1L_SRC_SHIFT,
			    madera_inmux_texts);

static SOC_ENUM_SINGLE_DECL(madera_in1muxr_enum,
			    MADERA_ADC_DIGITAL_VOLUME_1R,
			    MADERA_IN1R_SRC_SHIFT,
			    madera_inmux_texts);

static SOC_ENUM_SINGLE_DECL(madera_in2muxl_enum,
			    MADERA_ADC_DIGITAL_VOLUME_2L,
			    MADERA_IN2L_SRC_SHIFT,
			    madera_inmux_texts);

static SOC_ENUM_SINGLE_DECL(madera_in2muxr_enum,
			    MADERA_ADC_DIGITAL_VOLUME_2R,
			    MADERA_IN2R_SRC_SHIFT,
			    madera_inmux_texts);

const struct snd_kcontrol_new madera_inmux[] = {
	SOC_DAPM_ENUM_EXT("IN1L Mux", madera_in1muxl_enum,
			  snd_soc_dapm_get_enum_double, madera_inmux_put),
	SOC_DAPM_ENUM_EXT("IN1R Mux", madera_in1muxr_enum,
			  snd_soc_dapm_get_enum_double, madera_inmux_put),
	SOC_DAPM_ENUM_EXT("IN2L Mux", madera_in2muxl_enum,
			  snd_soc_dapm_get_enum_double, madera_inmux_put),
	SOC_DAPM_ENUM_EXT("IN2R Mux", madera_in2muxr_enum,
			  snd_soc_dapm_get_enum_double, madera_inmux_put),
};
EXPORT_SYMBOL_GPL(madera_inmux);

int madera_adsp_rate_get(struct snd_kcontrol *kcontrol,
			 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	unsigned int cached_rate, item;
	const int adsp_num = e->shift_l;
	int ret = -EINVAL;

	mutex_lock(&priv->adsp_rate_lock);

	cached_rate = priv->adsp_rate_cache[adsp_num];

	for (item = 0; item < e->items; item++) {
		if (e->values[item] == cached_rate) {
			ucontrol->value.enumerated.item[0] = item;
			ret = 0;
			break;
		}
	}

	mutex_unlock(&priv->adsp_rate_lock);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_adsp_rate_get);

int madera_adsp_rate_put(struct snd_kcontrol *kcontrol,
			 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	const int adsp_num = e->shift_l;
	const unsigned int item = ucontrol->value.enumerated.item[0];

	if (item >= e->items)
		return -EINVAL;

	mutex_lock(&priv->adsp_rate_lock);

	priv->adsp_rate_cache[adsp_num] = e->values[item];

	mutex_unlock(&priv->adsp_rate_lock);
	return 0;
}
EXPORT_SYMBOL_GPL(madera_adsp_rate_put);

static const struct soc_enum madera_adsp_rate_enum[] = {
	SOC_VALUE_ENUM_SINGLE(SND_SOC_NOPM, 0, 0xf, MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(SND_SOC_NOPM, 1, 0xf, MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(SND_SOC_NOPM, 2, 0xf, MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(SND_SOC_NOPM, 3, 0xf, MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(SND_SOC_NOPM, 4, 0xf, MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(SND_SOC_NOPM, 5, 0xf, MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(SND_SOC_NOPM, 6, 0xf, MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
};

const struct snd_kcontrol_new madera_adsp_rate_controls[] = {
	SOC_ENUM_EXT("DSP1 Rate", madera_adsp_rate_enum[0],
		     madera_adsp_rate_get, madera_adsp_rate_put),
	SOC_ENUM_EXT("DSP2 Rate", madera_adsp_rate_enum[1],
		     madera_adsp_rate_get, madera_adsp_rate_put),
	SOC_ENUM_EXT("DSP3 Rate", madera_adsp_rate_enum[2],
		     madera_adsp_rate_get, madera_adsp_rate_put),
	SOC_ENUM_EXT("DSP4 Rate", madera_adsp_rate_enum[3],
		     madera_adsp_rate_get, madera_adsp_rate_put),
	SOC_ENUM_EXT("DSP5 Rate", madera_adsp_rate_enum[4],
		     madera_adsp_rate_get, madera_adsp_rate_put),
	SOC_ENUM_EXT("DSP6 Rate", madera_adsp_rate_enum[5],
		     madera_adsp_rate_get, madera_adsp_rate_put),
	SOC_ENUM_EXT("DSP7 Rate", madera_adsp_rate_enum[6],
		     madera_adsp_rate_get, madera_adsp_rate_put),
};
EXPORT_SYMBOL_GPL(madera_adsp_rate_controls);

static int madera_write_adsp_clk_setting(struct wm_adsp *dsp, unsigned int freq)
{
	struct madera_priv *priv = snd_soc_codec_get_drvdata(dsp->codec);
	unsigned int mask, val;
	int ret;

	mask = MADERA_DSP_RATE_MASK;
	val = priv->adsp_rate_cache[dsp->num - 1] << MADERA_DSP_RATE_SHIFT;

	switch (priv->madera->type) {
	case CS47L35:
	case CS47L85:
	case WM1840:
		/* use legacy frequency registers */
		mask |= MADERA_DSP_CLK_SEL_MASK;
		val |= (freq << MADERA_DSP_CLK_SEL_SHIFT);
		break;
	default:
		/* Configure exact dsp frequency */
		dev_dbg(priv->madera->dev, "Set DSP frequency to 0x%x\n", freq);

		ret = regmap_write(dsp->regmap,
				   dsp->base + MADERA_DSP_CONFIG_2_OFFS, freq);
		if (ret)
			goto err;
		break;
	}

	ret = regmap_update_bits(dsp->regmap,
				 dsp->base + MADERA_DSP_CONFIG_1_OFFS,
				 mask, val);
	dev_dbg(priv->madera->dev, "Set DSP clocking to 0x%x\n", val);

	return 0;

err:
	dev_err(dsp->dev, "Failed to set DSP%d clock: %d\n", dsp->num, ret);

	return ret;
}

int madera_set_adsp_clk(struct wm_adsp *dsp, unsigned int freq)
{
	struct madera_priv *priv = snd_soc_codec_get_drvdata(dsp->codec);
	struct madera *madera = priv->madera;
	const unsigned int *cur_sources;
	unsigned int cur, new;
	int lim, ret, err;

	ret = regmap_read(dsp->regmap,  dsp->base, &cur);
	if (ret) {
		dev_err(madera->dev,
			"Failed to read current DSP rate: %d\n", ret);
		return ret;
	}

	cur &= MADERA_DSP_RATE_MASK;
	new = priv->adsp_rate_cache[dsp->num - 1] << MADERA_DSP_RATE_SHIFT;

	if (new == cur) {
		dev_dbg(madera->dev, "DSP rate not changed\n");
		return madera_write_adsp_clk_setting(dsp, freq);
	}

	ret = priv->get_sources(dsp->base, &cur_sources, &lim);
	if (ret) {
		dev_err(madera->dev,
			"Failed to get sources for DSP: %d\n", ret);
		return ret;
	}

	mutex_lock(&priv->rate_lock);

	ret = madera_cache_and_clear_sources(priv, cur_sources,
					     priv->mixer_sources_cache, lim);
	if (ret) {
		dev_err(madera->dev,
			"failed to cache and clear DSP sources %d\n", ret);
		goto out;
	}

	madera_spin_sysclk(priv);
	ret = madera_write_adsp_clk_setting(dsp, freq);
	madera_spin_sysclk(priv);

out:
	err = madera_restore_sources(priv, cur_sources,
				     priv->mixer_sources_cache, lim);

	if (err) {
		dev_err(madera->dev,
			"failed to restore DSP sources %d\n", err);
	}

	mutex_unlock(&priv->rate_lock);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_set_adsp_clk);

int madera_rate_put(struct snd_kcontrol *kcontrol,
		    struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	const unsigned int *cur_sources;
	unsigned int mask, val, cur;
	int lim, ret, err;

	if (ucontrol->value.enumerated.item[0] > e->items - 1)
		return -EINVAL;

	val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l;
	mask = e->mask << e->shift_l;

	ret = regmap_read(madera->regmap, e->reg, &cur);
	if (ret) {
		dev_err(madera->dev, "Failed to read current reg: %d\n", ret);
		return ret;
	}

	if ((cur & mask) == (val & mask))
		return 0;

	ret = priv->get_sources(e->reg, &cur_sources, &lim);
	if (ret) {
		dev_err(madera->dev, "Failed to get sources for 0x%08x: %d\n",
			e->reg, ret);
		return ret;
	}

	mutex_lock(&priv->rate_lock);

	ret = madera_cache_and_clear_sources(priv, cur_sources,
					     priv->mixer_sources_cache, lim);
	if (ret) {
		dev_err(madera->dev,
			"%s Failed to cache and clear sources %d\n",
			__func__, ret);
		goto out;
	}

	/* Apply the rate through the original callback */
	madera_spin_sysclk(priv);
	ret = snd_soc_update_bits(codec, e->reg, mask, val);
	if (ret > 0)
		ret = 0; /* snd_soc_update_bits returns 1 if bits changed ok */
	madera_spin_sysclk(priv);

out:
	err = madera_restore_sources(priv, cur_sources,
				     priv->mixer_sources_cache, lim);
	if (err) {
		dev_err(madera->dev,
			"%s Failed to restore sources %d\n",
			__func__, err);
	}

	mutex_unlock(&priv->rate_lock);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_rate_put);

static const struct snd_soc_dapm_route madera_mono_routes[] = {
	{ "OUT1R", NULL, "OUT1L" },
	{ "OUT2R", NULL, "OUT2L" },
	{ "OUT3R", NULL, "OUT3L" },
	{ "OUT4R", NULL, "OUT4L" },
	{ "OUT5R", NULL, "OUT5L" },
	{ "OUT6R", NULL, "OUT6L" },
};

static void madera_configure_input_mode(struct madera *madera)
{
	unsigned int val, dig_mode, ana_mode_l, ana_mode_r, dig_mask;
	int max_analogue_inputs, num_dmic_clksrc, max_dmic_sup, i;

	switch (madera->type) {
	case CS47L35:
		max_dmic_sup = 2;
		max_analogue_inputs = 2;
		num_dmic_clksrc = 0;
		break;
	case CS47L85:
	case WM1840:
		max_dmic_sup = 3;
		max_analogue_inputs = 3;
		num_dmic_clksrc = 0;
		break;
	case CS47L90:
	case CS47L91:
		max_dmic_sup = 2;
		max_analogue_inputs = 2;
		num_dmic_clksrc = 5;
		break;
	default:
		max_dmic_sup = 4;
		max_analogue_inputs = 2;
		num_dmic_clksrc = 4;
		break;
	}

	for (i = 0; i < num_dmic_clksrc; i++) {
		val = madera->pdata.codec.dmic_clksrc[i] <<
			MADERA_IN1_DMICCLK_SRC_SHIFT;
		regmap_update_bits(madera->regmap,
				   MADERA_IN1R_CONTROL + (i * 8),
				   MADERA_IN1_DMICCLK_SRC_MASK, val);
		dev_dbg(madera->dev, "IN%d DMICCLK_SRC=0x%x\n", i + 1, val);
	}

	/* Initialize input modes from the A settings. For muxed inputs the
	 * B settings will be applied if the mux is changed
	 */
	for (i = 0; i < max_dmic_sup; i++) {
		dev_dbg(madera->dev, "IN%d mode %d:%d:%d:%d\n", i + 1,
			madera->pdata.codec.inmode[i][0],
			madera->pdata.codec.inmode[i][1],
			madera->pdata.codec.inmode[i][2],
			madera->pdata.codec.inmode[i][3]);

		dig_mode = madera->pdata.codec.dmic_ref[i] <<
			   MADERA_IN1_DMIC_SUP_SHIFT;

		switch (madera->pdata.codec.inmode[i][0]) {
		case MADERA_INMODE_DIFF:
			ana_mode_l = 0;
			break;
		case MADERA_INMODE_SE:
			ana_mode_l = 1 << MADERA_IN1L_SRC_SE_SHIFT;
			break;
		case MADERA_INMODE_DMIC:
			ana_mode_l = 0;
			dig_mode |= 1 << MADERA_IN1_MODE_SHIFT;
			break;
		default:
			dev_warn(madera->dev,
				 "IN%dAL Illegal inmode %d ignored\n",
				 i + 1, madera->pdata.codec.inmode[i][0]);
			continue;
		}

		switch (madera->pdata.codec.inmode[i][1]) {
		case MADERA_INMODE_DIFF:
		case MADERA_INMODE_DMIC:
			ana_mode_r = 0;
			break;
		case MADERA_INMODE_SE:
			ana_mode_r = 1 << MADERA_IN1R_SRC_SE_SHIFT;
			break;
		default:
			dev_warn(madera->dev,
				 "IN%dAR Illegal inmode %d ignored\n",
				 i + 1, madera->pdata.codec.inmode[i][1]);
			continue;
		}

		dev_dbg(madera->dev,
			"IN%dA DMIC mode=0x%x Analogue mode=0x%x,0x%x\n",
			i + 1, dig_mode, ana_mode_l, ana_mode_r);

		dig_mask = MADERA_IN1_DMIC_SUP_MASK;

		if (i < max_analogue_inputs)
			dig_mask |= MADERA_IN1_MODE_MASK;

		regmap_update_bits(madera->regmap,
				   MADERA_IN1L_CONTROL + (i * 8),
				   dig_mask, dig_mode);

		if (i >= max_analogue_inputs)
			continue;

		regmap_update_bits(madera->regmap,
				   MADERA_ADC_DIGITAL_VOLUME_1L + (i * 8),
				   MADERA_IN1L_SRC_SE_MASK, ana_mode_l);

		regmap_update_bits(madera->regmap,
				   MADERA_ADC_DIGITAL_VOLUME_1R + (i * 8),
				   MADERA_IN1R_SRC_SE_MASK, ana_mode_r);
	}
}

int madera_init_inputs(struct snd_soc_codec *codec,
		       const char * const *dmic_inputs, int n_dmic_inputs,
		       const char * const *dmic_refs, int n_dmic_refs)
{
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	unsigned int ref;
	int i, ret;
	struct snd_soc_dapm_route routes[2];

	memset(&routes, 0, sizeof(routes));

	madera_configure_input_mode(madera);

	for (i = 0; i < n_dmic_inputs / 2; ++i) {
		ref = madera->pdata.codec.dmic_ref[i];
		if (ref >= n_dmic_refs) {
			dev_err(madera->dev,
				"Illegal DMIC ref %u for IN%d\n", ref, i);
			return -EINVAL;
		}

		routes[0].source = dmic_refs[ref];
		routes[1].source = dmic_refs[ref];
		routes[0].sink = dmic_inputs[i * 2];
		routes[1].sink = dmic_inputs[(i * 2) + 1];

		ret = snd_soc_dapm_add_routes(dapm, routes, 2);
	}

	return 0;
}
EXPORT_SYMBOL_GPL(madera_init_inputs);

int madera_init_outputs(struct snd_soc_codec *codec)
{
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	const struct madera_codec_pdata *pdata = &madera->pdata.codec;
	unsigned int val;
	int i;

	for (i = 0; i < ARRAY_SIZE(pdata->out_mono); i++) {
		/* Default is 0 so noop with defaults */
		if (pdata->out_mono[i]) {
			val = MADERA_OUT1_MONO;
			snd_soc_dapm_add_routes(dapm,
						&madera_mono_routes[i], 1);
		} else {
			val = 0;
		}

		regmap_update_bits(madera->regmap,
				   MADERA_OUTPUT_PATH_CONFIG_1L + (i * 8),
				   MADERA_OUT1_MONO, val);

		dev_dbg(madera->dev, "OUT%d mono=0x%x\n", i + 1, val);
	}

	for (i = 0; i < MADERA_MAX_PDM_SPK; i++) {
		dev_dbg(madera->dev, "PDM%d fmt=0x%x mute=0x%x\n", i + 1,
			pdata->pdm_fmt[i], pdata->pdm_mute[i]);

		if (pdata->pdm_mute[i])
			regmap_update_bits(madera->regmap,
					   MADERA_PDM_SPK1_CTRL_1 + (i * 2),
					   MADERA_SPK1_MUTE_ENDIAN_MASK |
					   MADERA_SPK1_MUTE_SEQ1_MASK,
					   pdata->pdm_mute[i]);

		if (pdata->pdm_fmt[i])
			regmap_update_bits(madera->regmap,
					   MADERA_PDM_SPK1_CTRL_2 + (i * 2),
					   MADERA_SPK1_FMT_MASK,
					   pdata->pdm_fmt[i]);
	}

	return 0;
}
EXPORT_SYMBOL_GPL(madera_init_outputs);

int madera_init_drc(struct snd_soc_codec *codec)
{
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	bool enable_drc1 = false, enable_drc2 = false;
	int i;

	for (i = 0; i < ARRAY_SIZE(madera->pdata.gpio_defaults); i++) {
		switch (madera->pdata.gpio_defaults[i] & MADERA_GP1_FN_MASK) {
		case MADERA_GP_FN_DRC1_SIGNAL_DETECT:
			enable_drc1 = true;
			break;
		case MADERA_GP_FN_DRC2_SIGNAL_DETECT:
			enable_drc2 = true;
			break;
		default:
			break;
		}
	}

	if (enable_drc1)
		snd_soc_dapm_enable_pin(dapm, "DRC1 Signal Activity");
	else
		snd_soc_dapm_disable_pin(dapm, "DRC1 Signal Activity");

	if (enable_drc2)
		snd_soc_dapm_enable_pin(dapm, "DRC2 Signal Activity");
	else
		snd_soc_dapm_disable_pin(dapm, "DRC2 Signal Activity");

	return 0;
}
EXPORT_SYMBOL_GPL(madera_init_drc);

int madera_init_aif(struct snd_soc_codec *codec)
{
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	int ret;

	/* Update Sample Rate 1 to 48kHz for cases when no AIF1 hw_params */
	ret = regmap_update_bits(madera->regmap, MADERA_SAMPLE_RATE_1,
				 MADERA_SAMPLE_RATE_1_MASK, 0x03);

	return ret;
}
EXPORT_SYMBOL_GPL(madera_init_aif);

int madera_init_bus_error_irq(struct snd_soc_codec *codec, int dsp_num,
			      irq_handler_t handler)
{
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	int ret;

	ret = madera_request_irq(madera,
				 madera_dsp_bus_error_irqs[dsp_num],
				 "ADSP2 bus error",
				 handler,
				 &priv->adsp[dsp_num]);
	if (ret)
		dev_err(madera->dev,
			"Failed to request DSP Lock region IRQ: %d\n", ret);

	return ret;
}
EXPORT_SYMBOL_GPL(madera_init_bus_error_irq);

void madera_destroy_bus_error_irq(struct snd_soc_codec *codec, int dsp_num)
{
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;

	madera_free_irq(madera,
			madera_dsp_bus_error_irqs[dsp_num],
			&priv->adsp[dsp_num]);
}
EXPORT_SYMBOL_GPL(madera_destroy_bus_error_irq);

const char * const madera_mixer_texts[] = {
	"None",
	"Tone Generator 1",
	"Tone Generator 2",
	"Haptics",
	"AEC1",
	"AEC2",
	"Mic Mute Mixer",
	"Noise Generator",
	"IN1L",
	"IN1R",
	"IN2L",
	"IN2R",
	"IN3L",
	"IN3R",
	"IN4L",
	"IN4R",
	"IN5L",
	"IN5R",
	"IN6L",
	"IN6R",
	"AIF1RX1",
	"AIF1RX2",
	"AIF1RX3",
	"AIF1RX4",
	"AIF1RX5",
	"AIF1RX6",
	"AIF1RX7",
	"AIF1RX8",
	"AIF2RX1",
	"AIF2RX2",
	"AIF2RX3",
	"AIF2RX4",
	"AIF2RX5",
	"AIF2RX6",
	"AIF2RX7",
	"AIF2RX8",
	"AIF3RX1",
	"AIF3RX2",
	"AIF3RX3",
	"AIF3RX4",
	"AIF4RX1",
	"AIF4RX2",
	"SLIMRX1",
	"SLIMRX2",
	"SLIMRX3",
	"SLIMRX4",
	"SLIMRX5",
	"SLIMRX6",
	"SLIMRX7",
	"SLIMRX8",
	"EQ1",
	"EQ2",
	"EQ3",
	"EQ4",
	"DRC1L",
	"DRC1R",
	"DRC2L",
	"DRC2R",
	"LHPF1",
	"LHPF2",
	"LHPF3",
	"LHPF4",
	"DSP1.1",
	"DSP1.2",
	"DSP1.3",
	"DSP1.4",
	"DSP1.5",
	"DSP1.6",
	"DSP2.1",
	"DSP2.2",
	"DSP2.3",
	"DSP2.4",
	"DSP2.5",
	"DSP2.6",
	"DSP3.1",
	"DSP3.2",
	"DSP3.3",
	"DSP3.4",
	"DSP3.5",
	"DSP3.6",
	"DSP4.1",
	"DSP4.2",
	"DSP4.3",
	"DSP4.4",
	"DSP4.5",
	"DSP4.6",
	"DSP5.1",
	"DSP5.2",
	"DSP5.3",
	"DSP5.4",
	"DSP5.5",
	"DSP5.6",
	"DSP6.1",
	"DSP6.2",
	"DSP6.3",
	"DSP6.4",
	"DSP6.5",
	"DSP6.6",
	"DSP7.1",
	"DSP7.2",
	"DSP7.3",
	"DSP7.4",
	"DSP7.5",
	"DSP7.6",
	"ASRC1IN1L",
	"ASRC1IN1R",
	"ASRC1IN2L",
	"ASRC1IN2R",
	"ASRC2IN1L",
	"ASRC2IN1R",
	"ASRC2IN2L",
	"ASRC2IN2R",
	"ISRC1INT1",
	"ISRC1INT2",
	"ISRC1INT3",
	"ISRC1INT4",
	"ISRC1DEC1",
	"ISRC1DEC2",
	"ISRC1DEC3",
	"ISRC1DEC4",
	"ISRC2INT1",
	"ISRC2INT2",
	"ISRC2INT3",
	"ISRC2INT4",
	"ISRC2DEC1",
	"ISRC2DEC2",
	"ISRC2DEC3",
	"ISRC2DEC4",
	"ISRC3INT1",
	"ISRC3INT2",
	"ISRC3INT3",
	"ISRC3INT4",
	"ISRC3DEC1",
	"ISRC3DEC2",
	"ISRC3DEC3",
	"ISRC3DEC4",
	"ISRC4INT1",
	"ISRC4INT2",
	"ISRC4DEC1",
	"ISRC4DEC2",
	"Ultrasonic1",
	"Ultrasonic2",
	"DFC1",
	"DFC2",
	"DFC3",
	"DFC4",
	"DFC5",
	"DFC6",
	"DFC7",
	"DFC8",
};
EXPORT_SYMBOL_GPL(madera_mixer_texts);

unsigned int madera_mixer_values[] = {
	0x00,	/* None */
	0x04,	/* Tone Generator 1 */
	0x05,	/* Tone Generator 2 */
	0x06,	/* Haptics */
	0x08,	/* AEC */
	0x09,	/* AEC2 */
	0x0c,	/* Noise mixer */
	0x0d,	/* Comfort noise */
	0x10,	/* IN1L */
	0x11,
	0x12,
	0x13,
	0x14,
	0x15,
	0x16,
	0x17,
	0x18,
	0x19,
	0x1A,
	0x1B,
	0x20,	/* AIF1RX1 */
	0x21,
	0x22,
	0x23,
	0x24,
	0x25,
	0x26,
	0x27,
	0x28,	/* AIF2RX1 */
	0x29,
	0x2a,
	0x2b,
	0x2c,
	0x2d,
	0x2e,
	0x2f,
	0x30,	/* AIF3RX1 */
	0x31,
	0x32,
	0x33,
	0x34,	/* AIF4RX1 */
	0x35,
	0x38,	/* SLIMRX1 */
	0x39,
	0x3a,
	0x3b,
	0x3c,
	0x3d,
	0x3e,
	0x3f,
	0x50,	/* EQ1 */
	0x51,
	0x52,
	0x53,
	0x58,	/* DRC1L */
	0x59,
	0x5a,
	0x5b,
	0x60,	/* LHPF1 */
	0x61,
	0x62,
	0x63,
	0x68,	/* DSP1.1 */
	0x69,
	0x6a,
	0x6b,
	0x6c,
	0x6d,
	0x70,	/* DSP2.1 */
	0x71,
	0x72,
	0x73,
	0x74,
	0x75,
	0x78,	/* DSP3.1 */
	0x79,
	0x7a,
	0x7b,
	0x7c,
	0x7d,
	0x80,	/* DSP4.1 */
	0x81,
	0x82,
	0x83,
	0x84,
	0x85,
	0x88,	/* DSP5.1 */
	0x89,
	0x8a,
	0x8b,
	0x8c,
	0x8d,
	0xc0,	/* DSP6.1 */
	0xc1,
	0xc2,
	0xc3,
	0xc4,
	0xc5,
	0xc8,	/* DSP7.1 */
	0xc9,
	0xca,
	0xcb,
	0xcc,
	0xcd,
	0x90,	/* ASRC1IN1L */
	0x91,
	0x92,
	0x93,
	0x94,	/* ASRC2IN1L */
	0x95,
	0x96,
	0x97,
	0xa0,	/* ISRC1INT1 */
	0xa1,
	0xa2,
	0xa3,
	0xa4,	/* ISRC1DEC1 */
	0xa5,
	0xa6,
	0xa7,
	0xa8,	/* ISRC2DEC1 */
	0xa9,
	0xaa,
	0xab,
	0xac,	/* ISRC2INT1 */
	0xad,
	0xae,
	0xaf,
	0xb0,	/* ISRC3DEC1 */
	0xb1,
	0xb2,
	0xb3,
	0xb4,	/* ISRC3INT1 */
	0xb5,
	0xb6,
	0xb7,
	0xb8,	/* ISRC4INT1 */
	0xb9,
	0xbc,	/* ISRC4DEC1 */
	0xbd,
	0xf0,	/* Ultrasonic1 */
	0xf1,
	0xf8,	/* DFC1 */
	0xf9,
	0xfa,
	0xfb,
	0xfc,
	0xfd,
	0xfe,
	0xff,	/* DFC8 */
};
EXPORT_SYMBOL_GPL(madera_mixer_values);

const DECLARE_TLV_DB_SCALE(madera_ana_tlv, 0, 100, 0);
EXPORT_SYMBOL_GPL(madera_ana_tlv);

const DECLARE_TLV_DB_SCALE(madera_eq_tlv, -1200, 100, 0);
EXPORT_SYMBOL_GPL(madera_eq_tlv);

const DECLARE_TLV_DB_SCALE(madera_digital_tlv, -6400, 50, 0);
EXPORT_SYMBOL_GPL(madera_digital_tlv);

const DECLARE_TLV_DB_SCALE(madera_noise_tlv, -13200, 600, 0);
EXPORT_SYMBOL_GPL(madera_noise_tlv);

const DECLARE_TLV_DB_SCALE(madera_ng_tlv, -12000, 600, 0);
EXPORT_SYMBOL_GPL(madera_ng_tlv);

const DECLARE_TLV_DB_SCALE(madera_mixer_tlv, -3200, 100, 0);
EXPORT_SYMBOL_GPL(madera_mixer_tlv);

const char * const madera_sample_rate_text[MADERA_SAMPLE_RATE_ENUM_SIZE] = {
	"12kHz", "24kHz", "48kHz", "96kHz", "192kHz", "384kHz",
	"11.025kHz", "22.05kHz", "44.1kHz", "88.2kHz", "176.4kHz", "352.8kHz",
	"4kHz", "8kHz", "16kHz", "32kHz",
};
EXPORT_SYMBOL_GPL(madera_sample_rate_text);

const unsigned int madera_sample_rate_val[MADERA_SAMPLE_RATE_ENUM_SIZE] = {
	0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
	0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
	0x10, 0x11, 0x12, 0x13,
};
EXPORT_SYMBOL_GPL(madera_sample_rate_val);

const char *madera_sample_rate_val_to_name(unsigned int rate_val)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(madera_sample_rate_val); ++i) {
		if (madera_sample_rate_val[i] == rate_val)
			return madera_sample_rate_text[i];
	}

	return "Illegal";
}
EXPORT_SYMBOL_GPL(madera_sample_rate_val_to_name);

const struct soc_enum madera_sample_rate[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_SAMPLE_RATE_2,
			      MADERA_SAMPLE_RATE_2_SHIFT, 0x1f,
			      MADERA_SAMPLE_RATE_ENUM_SIZE,
			      madera_sample_rate_text,
			      madera_sample_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_SAMPLE_RATE_3,
			      MADERA_SAMPLE_RATE_3_SHIFT, 0x1f,
			      MADERA_SAMPLE_RATE_ENUM_SIZE,
			      madera_sample_rate_text,
			      madera_sample_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ASYNC_SAMPLE_RATE_2,
			      MADERA_ASYNC_SAMPLE_RATE_2_SHIFT, 0x1f,
			      MADERA_SAMPLE_RATE_ENUM_SIZE,
			      madera_sample_rate_text,
			      madera_sample_rate_val),

};
EXPORT_SYMBOL_GPL(madera_sample_rate);

const char * const madera_rate_text[MADERA_RATE_ENUM_SIZE] = {
	"SYNCCLK rate 1", "SYNCCLK rate 2", "SYNCCLK rate 3",
	"ASYNCCLK rate 1", "ASYNCCLK rate 2",
};
EXPORT_SYMBOL_GPL(madera_rate_text);

const unsigned int madera_rate_val[MADERA_RATE_ENUM_SIZE] = {
	0x0, 0x1, 0x2, 0x8, 0x9,
};
EXPORT_SYMBOL_GPL(madera_rate_val);

const struct soc_enum madera_output_rate =
	SOC_VALUE_ENUM_SINGLE(MADERA_OUTPUT_RATE_1,
			      MADERA_OUT_RATE_SHIFT,
			      MADERA_OUT_RATE_MASK >> MADERA_OUT_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val);
EXPORT_SYMBOL_GPL(madera_output_rate);

const struct soc_enum madera_output_ext_rate =
	SOC_VALUE_ENUM_SINGLE(MADERA_OUTPUT_RATE_1,
			      MADERA_OUT_RATE_SHIFT,
			      MADERA_OUT_RATE_MASK >> MADERA_OUT_RATE_SHIFT,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val);
EXPORT_SYMBOL_GPL(madera_output_ext_rate);

const struct soc_enum madera_input_rate[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_IN1L_RATE_CONTROL,
			      MADERA_IN1L_RATE_SHIFT,
			      MADERA_IN1L_RATE_MASK >> MADERA_IN1L_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN1R_RATE_CONTROL,
			      MADERA_IN1R_RATE_SHIFT,
			      MADERA_IN1R_RATE_MASK >> MADERA_IN1R_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN2L_RATE_CONTROL,
			      MADERA_IN2L_RATE_SHIFT,
			      MADERA_IN2L_RATE_MASK >> MADERA_IN2L_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN2R_RATE_CONTROL,
			      MADERA_IN2R_RATE_SHIFT,
			      MADERA_IN2R_RATE_MASK >> MADERA_IN2R_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN3L_RATE_CONTROL,
			      MADERA_IN3L_RATE_SHIFT,
			      MADERA_IN3L_RATE_MASK >> MADERA_IN3L_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN3R_RATE_CONTROL,
			      MADERA_IN3R_RATE_SHIFT,
			      MADERA_IN3R_RATE_MASK >> MADERA_IN3R_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN4L_RATE_CONTROL,
			      MADERA_IN4L_RATE_SHIFT,
			      MADERA_IN4L_RATE_MASK >> MADERA_IN4L_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN4R_RATE_CONTROL,
			      MADERA_IN4R_RATE_SHIFT,
			      MADERA_IN4R_RATE_MASK >> MADERA_IN4R_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN5L_RATE_CONTROL,
			      MADERA_IN5L_RATE_SHIFT,
			      MADERA_IN5L_RATE_MASK >> MADERA_IN5L_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_IN5R_RATE_CONTROL,
			      MADERA_IN5R_RATE_SHIFT,
			      MADERA_IN5R_RATE_MASK >> MADERA_IN5R_RATE_SHIFT,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val),
};
EXPORT_SYMBOL_GPL(madera_input_rate);

const char * const madera_dfc_width_text[MADERA_DFC_WIDTH_ENUM_SIZE] = {
	"8bit", "16bit", "20bit", "24bit", "32bit",
};
EXPORT_SYMBOL_GPL(madera_dfc_width_text);

const unsigned int madera_dfc_width_val[MADERA_DFC_WIDTH_ENUM_SIZE] = {
	7, 15, 19, 23, 31,
};
EXPORT_SYMBOL_GPL(madera_dfc_width_val);

const char * const madera_dfc_type_text[MADERA_DFC_TYPE_ENUM_SIZE] = {
	"Fixed", "Unsigned Fixed", "Single Precision Floating",
	"Half Precision Floating", "Arm Alternative Floating",
};
EXPORT_SYMBOL_GPL(madera_dfc_type_text);

const unsigned int madera_dfc_type_val[MADERA_DFC_TYPE_ENUM_SIZE] = {
	0, 1, 2, 4, 5,
};
EXPORT_SYMBOL_GPL(madera_dfc_type_val);

const struct soc_enum madera_dfc_width[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC1_RX,
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_RX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC1_TX,
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_TX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC2_RX,
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_RX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC2_TX,
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_TX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC3_RX,
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_RX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC3_TX,
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_TX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC4_RX,
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_RX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC4_TX,
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_TX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC5_RX,
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_RX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC5_TX,
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_TX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC6_RX,
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_RX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC6_TX,
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_TX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC7_RX,
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_RX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC7_TX,
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_TX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC8_RX,
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_RX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_RX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC8_TX,
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      MADERA_DFC1_TX_DATA_WIDTH_MASK >>
			      MADERA_DFC1_TX_DATA_WIDTH_SHIFT,
			      ARRAY_SIZE(madera_dfc_width_text),
			      madera_dfc_width_text,
			      madera_dfc_width_val),
};
EXPORT_SYMBOL_GPL(madera_dfc_width);

const struct soc_enum madera_dfc_type[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC1_RX,
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_RX_DATA_TYPE_MASK >>
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC1_TX,
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_TX_DATA_TYPE_MASK >>
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC2_RX,
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_RX_DATA_TYPE_MASK >>
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC2_TX,
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_TX_DATA_TYPE_MASK >>
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC3_RX,
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_RX_DATA_TYPE_MASK >>
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC3_TX,
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_TX_DATA_TYPE_MASK >>
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC4_RX,
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_RX_DATA_TYPE_MASK >>
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC4_TX,
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_TX_DATA_TYPE_MASK >>
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC5_RX,
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_RX_DATA_TYPE_MASK >>
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC5_TX,
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_TX_DATA_TYPE_MASK >>
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC6_RX,
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_RX_DATA_TYPE_MASK >>
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC6_TX,
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_TX_DATA_TYPE_MASK >>
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC7_RX,
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_RX_DATA_TYPE_MASK >>
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC7_TX,
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_TX_DATA_TYPE_MASK >>
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC8_RX,
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_RX_DATA_TYPE_MASK >>
			      MADERA_DFC1_RX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DFC8_TX,
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      MADERA_DFC1_TX_DATA_TYPE_MASK >>
			      MADERA_DFC1_TX_DATA_TYPE_SHIFT,
			      ARRAY_SIZE(madera_dfc_type_text),
			      madera_dfc_type_text,
			      madera_dfc_type_val),
};
EXPORT_SYMBOL_GPL(madera_dfc_type);

const struct soc_enum madera_fx_rate =
	SOC_VALUE_ENUM_SINGLE(MADERA_FX_CTRL1,
			      MADERA_FX_RATE_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val);
EXPORT_SYMBOL_GPL(madera_fx_rate);

const struct soc_enum madera_spdif_rate =
	SOC_VALUE_ENUM_SINGLE(MADERA_SPD1_TX_CONTROL,
			      MADERA_SPD1_RATE_SHIFT,
			      0x0f,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text,
			      madera_rate_val);
EXPORT_SYMBOL_GPL(madera_spdif_rate);

const struct soc_enum madera_isrc_fsh[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_1_CTRL_1,
			      MADERA_ISRC1_FSH_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_2_CTRL_1,
			      MADERA_ISRC2_FSH_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_3_CTRL_1,
			      MADERA_ISRC3_FSH_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_4_CTRL_1,
			      MADERA_ISRC4_FSH_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),

};
EXPORT_SYMBOL_GPL(madera_isrc_fsh);

const struct soc_enum madera_isrc_fsl[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_1_CTRL_2,
			      MADERA_ISRC1_FSL_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_2_CTRL_2,
			      MADERA_ISRC2_FSL_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_3_CTRL_2,
			      MADERA_ISRC3_FSL_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ISRC_4_CTRL_2,
			      MADERA_ISRC4_FSL_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),

};
EXPORT_SYMBOL_GPL(madera_isrc_fsl);

const struct soc_enum madera_asrc1_rate[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_ASRC1_RATE1,
			      MADERA_ASRC1_RATE1_SHIFT, 0xf,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ASRC1_RATE2,
			      MADERA_ASRC1_RATE1_SHIFT, 0xf,
			      MADERA_ASYNC_RATE_ENUM_SIZE,
			      madera_rate_text + MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_val + MADERA_SYNC_RATE_ENUM_SIZE),
};
EXPORT_SYMBOL_GPL(madera_asrc1_rate);

const struct soc_enum madera_asrc1_bidir_rate[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_ASRC1_RATE1,
			      MADERA_ASRC1_RATE1_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ASRC1_RATE2,
			      MADERA_ASRC1_RATE2_SHIFT, 0xf,
			      MADERA_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
};
EXPORT_SYMBOL_GPL(madera_asrc1_bidir_rate);

const struct soc_enum madera_asrc2_rate[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_ASRC2_RATE1,
			      MADERA_ASRC2_RATE1_SHIFT, 0xf,
			      MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_text, madera_rate_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_ASRC2_RATE2,
			      MADERA_ASRC2_RATE2_SHIFT, 0xf,
			      MADERA_ASYNC_RATE_ENUM_SIZE,
			      madera_rate_text + MADERA_SYNC_RATE_ENUM_SIZE,
			      madera_rate_val + MADERA_SYNC_RATE_ENUM_SIZE),

};
EXPORT_SYMBOL_GPL(madera_asrc2_rate);

static const char * const madera_vol_ramp_text[] = {
	"0ms/6dB", "0.5ms/6dB", "1ms/6dB", "2ms/6dB", "4ms/6dB", "8ms/6dB",
	"15ms/6dB", "30ms/6dB",
};

SOC_ENUM_SINGLE_DECL(madera_in_vd_ramp,
		     MADERA_INPUT_VOLUME_RAMP,
		     MADERA_IN_VD_RAMP_SHIFT,
		     madera_vol_ramp_text);
EXPORT_SYMBOL_GPL(madera_in_vd_ramp);

SOC_ENUM_SINGLE_DECL(madera_in_vi_ramp,
		     MADERA_INPUT_VOLUME_RAMP,
		     MADERA_IN_VI_RAMP_SHIFT,
		     madera_vol_ramp_text);
EXPORT_SYMBOL_GPL(madera_in_vi_ramp);

SOC_ENUM_SINGLE_DECL(madera_out_vd_ramp,
		     MADERA_OUTPUT_VOLUME_RAMP,
		     MADERA_OUT_VD_RAMP_SHIFT,
		     madera_vol_ramp_text);
EXPORT_SYMBOL_GPL(madera_out_vd_ramp);

SOC_ENUM_SINGLE_DECL(madera_out_vi_ramp,
		     MADERA_OUTPUT_VOLUME_RAMP,
		     MADERA_OUT_VI_RAMP_SHIFT,
		     madera_vol_ramp_text);
EXPORT_SYMBOL_GPL(madera_out_vi_ramp);

static const char * const madera_lhpf_mode_text[] = {
	"Low-pass", "High-pass"
};

SOC_ENUM_SINGLE_DECL(madera_lhpf1_mode,
		     MADERA_HPLPF1_1,
		     MADERA_LHPF1_MODE_SHIFT,
		     madera_lhpf_mode_text);
EXPORT_SYMBOL_GPL(madera_lhpf1_mode);

SOC_ENUM_SINGLE_DECL(madera_lhpf2_mode,
		     MADERA_HPLPF2_1,
		     MADERA_LHPF2_MODE_SHIFT,
		     madera_lhpf_mode_text);
EXPORT_SYMBOL_GPL(madera_lhpf2_mode);

SOC_ENUM_SINGLE_DECL(madera_lhpf3_mode,
		     MADERA_HPLPF3_1,
		     MADERA_LHPF3_MODE_SHIFT,
		     madera_lhpf_mode_text);
EXPORT_SYMBOL_GPL(madera_lhpf3_mode);

SOC_ENUM_SINGLE_DECL(madera_lhpf4_mode,
		     MADERA_HPLPF4_1,
		     MADERA_LHPF4_MODE_SHIFT,
		     madera_lhpf_mode_text);
EXPORT_SYMBOL_GPL(madera_lhpf4_mode);

static const char * const madera_ng_hold_text[] = {
	"30ms", "120ms", "250ms", "500ms",
};

SOC_ENUM_SINGLE_DECL(madera_ng_hold,
		     MADERA_NOISE_GATE_CONTROL,
		     MADERA_NGATE_HOLD_SHIFT,
		     madera_ng_hold_text);
EXPORT_SYMBOL_GPL(madera_ng_hold);

static const char * const madera_in_hpf_cut_text[] = {
	"2.5Hz", "5Hz", "10Hz", "20Hz", "40Hz"
};

SOC_ENUM_SINGLE_DECL(madera_in_hpf_cut_enum,
		     MADERA_HPF_CONTROL,
		     MADERA_IN_HPF_CUT_SHIFT,
		     madera_in_hpf_cut_text);
EXPORT_SYMBOL_GPL(madera_in_hpf_cut_enum);

static const char * const madera_in_dmic_osr_text[MADERA_OSR_ENUM_SIZE] = {
	"384kHz", "768kHz", "1.536MHz", "3.072MHz", "6.144MHz",
};

static const unsigned int madera_in_dmic_osr_val[MADERA_OSR_ENUM_SIZE] = {
	2, 3, 4, 5, 6,
};

const struct soc_enum madera_in_dmic_osr[] = {
	SOC_VALUE_ENUM_SINGLE(MADERA_DMIC1L_CONTROL, MADERA_IN1_OSR_SHIFT,
			      0x7, MADERA_OSR_ENUM_SIZE,
			      madera_in_dmic_osr_text, madera_in_dmic_osr_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DMIC2L_CONTROL, MADERA_IN2_OSR_SHIFT,
			      0x7, MADERA_OSR_ENUM_SIZE,
			      madera_in_dmic_osr_text, madera_in_dmic_osr_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DMIC3L_CONTROL, MADERA_IN3_OSR_SHIFT,
			      0x7, MADERA_OSR_ENUM_SIZE,
			      madera_in_dmic_osr_text, madera_in_dmic_osr_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DMIC4L_CONTROL, MADERA_IN4_OSR_SHIFT,
			      0x7, MADERA_OSR_ENUM_SIZE,
			      madera_in_dmic_osr_text, madera_in_dmic_osr_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DMIC5L_CONTROL, MADERA_IN5_OSR_SHIFT,
			      0x7, MADERA_OSR_ENUM_SIZE,
			      madera_in_dmic_osr_text, madera_in_dmic_osr_val),
	SOC_VALUE_ENUM_SINGLE(MADERA_DMIC6L_CONTROL, MADERA_IN6_OSR_SHIFT,
			      0x7, MADERA_OSR_ENUM_SIZE,
			      madera_in_dmic_osr_text, madera_in_dmic_osr_val),
};
EXPORT_SYMBOL_GPL(madera_in_dmic_osr);

static const char * const madera_anc_input_src_text[] = {
	"None", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6",
};

static const char * const madera_anc_channel_src_text[] = {
	"None", "Left", "Right", "Combine",
};

const struct soc_enum madera_anc_input_src[] = {
	SOC_ENUM_SINGLE(MADERA_ANC_SRC,
			MADERA_IN_RXANCL_SEL_SHIFT,
			ARRAY_SIZE(madera_anc_input_src_text),
			madera_anc_input_src_text),
	SOC_ENUM_SINGLE(MADERA_FCL_ADC_REFORMATTER_CONTROL,
			MADERA_FCL_MIC_MODE_SEL,
			ARRAY_SIZE(madera_anc_channel_src_text),
			madera_anc_channel_src_text),
	SOC_ENUM_SINGLE(MADERA_ANC_SRC,
			MADERA_IN_RXANCR_SEL_SHIFT,
			ARRAY_SIZE(madera_anc_input_src_text),
			madera_anc_input_src_text),
	SOC_ENUM_SINGLE(MADERA_FCR_ADC_REFORMATTER_CONTROL,
			MADERA_FCR_MIC_MODE_SEL,
			ARRAY_SIZE(madera_anc_channel_src_text),
			madera_anc_channel_src_text),
};
EXPORT_SYMBOL_GPL(madera_anc_input_src);

static const char * const madera_anc_ng_texts[] = {
	"None",	"Internal", "External",
};

SOC_ENUM_SINGLE_DECL(madera_anc_ng_enum, SND_SOC_NOPM, 0, madera_anc_ng_texts);
EXPORT_SYMBOL_GPL(madera_anc_ng_enum);

static const char * const madera_out_anc_src_text[] = {
	"None", "RXANCL", "RXANCR",
};

const struct soc_enum madera_output_anc_src[] = {
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_1L,
			MADERA_OUT1L_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_1R,
			MADERA_OUT1R_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_2L,
			MADERA_OUT2L_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_2R,
			MADERA_OUT2R_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_3L,
			MADERA_OUT3L_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_3R,
			MADERA_OUT3R_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_4L,
			MADERA_OUT4L_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_4R,
			MADERA_OUT4R_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_5L,
			MADERA_OUT5L_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_5R,
			MADERA_OUT5R_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_6L,
			MADERA_OUT6L_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
	SOC_ENUM_SINGLE(MADERA_OUTPUT_PATH_CONFIG_6R,
			MADERA_OUT6R_ANC_SRC_SHIFT,
			ARRAY_SIZE(madera_out_anc_src_text),
			madera_out_anc_src_text),
};
EXPORT_SYMBOL_GPL(madera_output_anc_src);

static const char * const madera_ip_mode_text[2] = {
	"Analog", "Digital",
};

const struct soc_enum madera_ip_mode[] = {
	SOC_ENUM_SINGLE(MADERA_IN1L_CONTROL, MADERA_IN1_MODE_SHIFT,
		ARRAY_SIZE(madera_ip_mode_text), madera_ip_mode_text),
	SOC_ENUM_SINGLE(MADERA_IN2L_CONTROL, MADERA_IN2_MODE_SHIFT,
		ARRAY_SIZE(madera_ip_mode_text), madera_ip_mode_text),
	SOC_ENUM_SINGLE(MADERA_IN3L_CONTROL, MADERA_IN3_MODE_SHIFT,
		ARRAY_SIZE(madera_ip_mode_text), madera_ip_mode_text),
};
EXPORT_SYMBOL_GPL(madera_ip_mode);

int madera_ip_mode_put(struct snd_kcontrol *kcontrol,
		       struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	unsigned int reg, ret = 0;

	snd_soc_dapm_mutex_lock(dapm);

	/* Cannot change input mode on an active input*/
	reg = snd_soc_read(codec, MADERA_INPUT_ENABLES);

	switch (e->reg) {
	case MADERA_IN1L_CONTROL:
		if (reg & (MADERA_IN1L_ENA_MASK |MADERA_IN1R_ENA_MASK)) {
			ret = -EBUSY;
			goto exit;
		}
		break;
	case MADERA_IN2L_CONTROL:
		if (reg & (MADERA_IN2L_ENA_MASK |MADERA_IN2R_ENA_MASK)) {
			ret = -EBUSY;
			goto exit;
		}
		break;
	case MADERA_IN3L_CONTROL:
		if (reg & (MADERA_IN3L_ENA_MASK |MADERA_IN3R_ENA_MASK)) {
			ret = -EBUSY;
			goto exit;
		}
		break;
	default:
		ret = -EINVAL;
		goto exit;
		break;
	}

	ret = snd_soc_put_enum_double(kcontrol, ucontrol);
exit:
	snd_soc_dapm_mutex_unlock(dapm);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_ip_mode_put);

int madera_in_rate_put(struct snd_kcontrol *kcontrol,
		       struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	unsigned int reg, mask;
	int ret = 0;

	snd_soc_dapm_mutex_lock(dapm);

	/* Cannot change rate on an active input */
	reg = snd_soc_read(codec, MADERA_INPUT_ENABLES);
	mask = (e->reg - MADERA_IN1L_CONTROL) / 4;
	mask ^= 0x1; /* Flip bottom bit for channel order */

	if ((reg) & (1 << mask)) {
		ret = -EBUSY;
		goto exit;
	}

	ret = snd_soc_put_enum_double(kcontrol, ucontrol);
exit:
	snd_soc_dapm_mutex_unlock(dapm);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_in_rate_put);

int madera_dfc_put(struct snd_kcontrol *kcontrol,
		   struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	unsigned int reg = e->reg;
	unsigned int val;
	int ret = 0;

	reg = ((reg / 6) * 6) - 2;

	snd_soc_dapm_mutex_lock(dapm);

	/* Cannot change dfc settings when its on */
	val = snd_soc_read(codec, reg);
	if (val & MADERA_DFC1_ENA) {
		ret = -EBUSY;
		goto exit;
	}

	ret = snd_soc_put_enum_double(kcontrol, ucontrol);
exit:
	snd_soc_dapm_mutex_unlock(dapm);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_dfc_put);

int madera_lp_mode_put(struct snd_kcontrol *kcontrol,
		       struct snd_ctl_elem_value *ucontrol)
{
	struct soc_mixer_control *mc =
		(struct soc_mixer_control *)kcontrol->private_value;
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	unsigned int reg, mask;
	int ret;

	snd_soc_dapm_mutex_lock(dapm);

	/* Cannot change lp mode on an active input */
	reg = snd_soc_read(codec, MADERA_INPUT_ENABLES);
	mask = (mc->reg - MADERA_ADC_DIGITAL_VOLUME_1L) / 4;
	mask ^= 0x1; /* Flip bottom bit for channel order */

	if ((reg) & (1 << mask)) {
		ret = -EBUSY;
		dev_err(codec->dev,
			"Can't change lp mode on an active input\n");
		goto exit;
	}

	ret = snd_soc_put_volsw(kcontrol, ucontrol);

exit:
	snd_soc_dapm_mutex_unlock(dapm);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_lp_mode_put);

const struct snd_kcontrol_new madera_dsp_trigger_output_mux[] = {
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
};
EXPORT_SYMBOL_GPL(madera_dsp_trigger_output_mux);

const struct snd_kcontrol_new madera_drc_activity_output_mux[] = {
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
	SOC_DAPM_SINGLE("Switch", SND_SOC_NOPM, 0, 1, 0),
};
EXPORT_SYMBOL_GPL(madera_drc_activity_output_mux);

static void madera_in_set_vu(struct madera_priv *priv, bool enable)
{
	unsigned int val;
	int i, ret;

	if (enable)
		val = MADERA_IN_VU;
	else
		val = 0;

	for (i = 0; i < priv->num_inputs; i++) {
		ret = regmap_update_bits(priv->madera->regmap,
				    MADERA_ADC_DIGITAL_VOLUME_1L + (i * 4),
				    MADERA_IN_VU, val);
		if (ret)
			dev_warn(priv->madera->dev,
				 "Failed to modify VU bits: %d\n", ret);
	}
}

int madera_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
		 int event)
{
	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	unsigned int ctrl;
	unsigned int reg;

	if (w->shift % 2) {
		reg = MADERA_ADC_DIGITAL_VOLUME_1L + ((w->shift / 2) * 8);
		ctrl = reg - 1;
	} else {
		reg = MADERA_ADC_DIGITAL_VOLUME_1R + ((w->shift / 2) * 8);
		ctrl = reg - 5;
	}

	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
		priv->in_pending++;
		break;
	case SND_SOC_DAPM_POST_PMU:
		priv->in_pending--;
		snd_soc_update_bits(codec, reg, MADERA_IN1L_MUTE, 0);

		/* If this is the last input pending then allow VU */
		if (priv->in_pending == 0) {
			msleep(1);
			madera_in_set_vu(priv, true);
		}
		break;
	case SND_SOC_DAPM_PRE_PMD:
		snd_soc_update_bits(codec, reg,
				    MADERA_IN1L_MUTE | MADERA_IN_VU,
				    MADERA_IN1L_MUTE | MADERA_IN_VU);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/* Disable volume updates if no inputs are enabled */
		reg = snd_soc_read(codec, MADERA_INPUT_ENABLES);
		if (reg == 0)
			madera_in_set_vu(priv, false);
		break;
	default:
		break;
	}

	return 0;
}
EXPORT_SYMBOL_GPL(madera_in_ev);

int madera_put_dre(struct snd_kcontrol *kcontrol,
		   struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	int ret;

	snd_soc_dapm_mutex_lock(dapm);

	ret = snd_soc_put_volsw(kcontrol, ucontrol);

	snd_soc_dapm_mutex_unlock(dapm);

	return ret;
}
EXPORT_SYMBOL_GPL(madera_put_dre);

int madera_out_ev(struct snd_soc_dapm_widget *w,
		  struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	int out_up_delay;

	switch (madera->type) {
	case CS47L90:
	case CS47L91:
	case CS47L92:
	case CS47L93:
		out_up_delay = 6;
		break;
	default:
		out_up_delay = 17;
		break;
	}

	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
		switch (w->shift) {
		case MADERA_OUT1L_ENA_SHIFT:
		case MADERA_OUT1R_ENA_SHIFT:
		case MADERA_OUT2L_ENA_SHIFT:
		case MADERA_OUT2R_ENA_SHIFT:
		case MADERA_OUT3L_ENA_SHIFT:
		case MADERA_OUT3R_ENA_SHIFT:
			priv->out_up_pending++;
			priv->out_up_delay += out_up_delay;
			break;
		default:
			break;
		}
		break;

	case SND_SOC_DAPM_POST_PMU:
		switch (w->shift) {
		case MADERA_OUT1L_ENA_SHIFT:
		case MADERA_OUT1R_ENA_SHIFT:
		case MADERA_OUT2L_ENA_SHIFT:
		case MADERA_OUT2R_ENA_SHIFT:
		case MADERA_OUT3L_ENA_SHIFT:
		case MADERA_OUT3R_ENA_SHIFT:
			priv->out_up_pending--;
			if (!priv->out_up_pending) {
				if (priv->out_up_delay < 20) {
					int delay = priv->out_up_delay * 1000;

					usleep_range(delay, delay + 1000);
				} else {
					msleep(priv->out_up_delay);
				}
				priv->out_up_delay = 0;
			}
			break;

		default:
			break;
		}
		break;

	case SND_SOC_DAPM_PRE_PMD:
		switch (w->shift) {
		case MADERA_OUT1L_ENA_SHIFT:
		case MADERA_OUT1R_ENA_SHIFT:
		case MADERA_OUT2L_ENA_SHIFT:
		case MADERA_OUT2R_ENA_SHIFT:
		case MADERA_OUT3L_ENA_SHIFT:
		case MADERA_OUT3R_ENA_SHIFT:
			priv->out_down_pending++;
			priv->out_down_delay++;
			break;
		default:
			break;
		}
		break;

	case SND_SOC_DAPM_POST_PMD:
		switch (w->shift) {
		case MADERA_OUT1L_ENA_SHIFT:
		case MADERA_OUT1R_ENA_SHIFT:
		case MADERA_OUT2L_ENA_SHIFT:
		case MADERA_OUT2R_ENA_SHIFT:
		case MADERA_OUT3L_ENA_SHIFT:
		case MADERA_OUT3R_ENA_SHIFT:
			priv->out_down_pending--;
			if (!priv->out_down_pending) {
				msleep(priv->out_down_delay);
				priv->out_down_delay = 0;
			}
			break;
		default:
			break;
		}
		break;
	default:
		break;
	}

	return 0;
}
EXPORT_SYMBOL_GPL(madera_out_ev);

int madera_hp_ev(struct snd_soc_dapm_widget *w,
		 struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	unsigned int mask = 1 << w->shift;
	unsigned int out_num;
	unsigned int val;
	unsigned int ep_sel = 0;

	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
		val = mask;
		break;
	case SND_SOC_DAPM_PRE_PMD:
		val = 0;
		break;
	case SND_SOC_DAPM_PRE_PMU:
	case SND_SOC_DAPM_POST_PMD:
		return madera_out_ev(w, kcontrol, event);
	default:
		return 0;
	}

	for (out_num = 0; out_num < MADERA_MAX_ACCESSORY; out_num++)
		if (madera->pdata.accdet[out_num].output == w->shift / 2 + 1)
			break;

	if (out_num == MADERA_MAX_ACCESSORY) {
		/* No accdet node associated with this output */
		regmap_update_bits_async(madera->regmap,
					 MADERA_OUTPUT_ENABLES_1,
					 mask, val);
		return madera_out_ev(w, kcontrol, event);
	}

	/* Store the desired state for the HP outputs */
	priv->madera->hp_ena &= ~mask;
	priv->madera->hp_ena |= val;

	/* in case of parts with muxed outputs, check if EPOUT is set and do
	 * not disable the muxed output in this case
	 */
	switch (madera->type) {
	case CS47L92:
	case CS47L93:
		if (w->shift != MADERA_OUT3L_ENA_SHIFT &&
		    w->shift != MADERA_OUT3R_ENA_SHIFT)
			break;
		/* fall through if this is the muxed output */
	default:
		regmap_read(priv->madera->regmap, MADERA_OUTPUT_ENABLES_1,
			    &ep_sel);
		ep_sel &= MADERA_EP_SEL_MASK;
		break;
	}

	/* Force off if HPDET clamp is active for this output */
	if ((priv->madera->hpdet_clamp[out_num] ||
	    madera_is_hp_shorted(madera, out_num)) && !ep_sel)
		val = 0;

	regmap_update_bits_async(madera->regmap, MADERA_OUTPUT_ENABLES_1,
				 mask, val);

	return madera_out_ev(w, kcontrol, event);
}
EXPORT_SYMBOL_GPL(madera_hp_ev);

int madera_anc_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
		  int event)
{
	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
	unsigned int val;

	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
		val = 1 << w->shift;
		break;
	case SND_SOC_DAPM_PRE_PMD:
		val = 1 << (w->shift + 1);
		break;
	default:
		return 0;
	}

	snd_soc_write(codec, MADERA_CLOCK_CONTROL, val);

	return 0;
}
EXPORT_SYMBOL_GPL(madera_anc_ev);

static const unsigned int madera_opclk_ref_48k_rates[] = {
	6144000,
	12288000,
	24576000,
	49152000,
};

static const unsigned int madera_opclk_ref_44k1_rates[] = {
	5644800,
	11289600,
	22579200,
	45158400,
};

static int madera_set_opclk(struct snd_soc_codec *codec, unsigned int clk,
			    unsigned int freq)
{
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	unsigned int reg;
	const unsigned int *rates;
	int ref, div, refclk;

	BUILD_BUG_ON(ARRAY_SIZE(madera_opclk_ref_48k_rates) !=
		     ARRAY_SIZE(madera_opclk_ref_44k1_rates));

	switch (clk) {
	case MADERA_CLK_OPCLK:
		reg = MADERA_OUTPUT_SYSTEM_CLOCK;
		refclk = priv->sysclk;
		break;
	case MADERA_CLK_ASYNC_OPCLK:
		reg = MADERA_OUTPUT_ASYNC_CLOCK;
		refclk = priv->asyncclk;
		break;
	default:
		return -EINVAL;
	}

	if (refclk % 4000)
		rates = madera_opclk_ref_44k1_rates;
	else
		rates = madera_opclk_ref_48k_rates;

	for (ref = 0; ref < ARRAY_SIZE(madera_opclk_ref_48k_rates); ++ref) {
		if (rates[ref] > refclk)
			continue;

		div = 2;
		while ((rates[ref] / div >= freq) && (div <= 30)) {
			if (rates[ref] / div == freq) {
				dev_dbg(codec->dev, "Configured %dHz OPCLK\n",
					freq);
				snd_soc_update_bits(codec, reg,
						    MADERA_OPCLK_DIV_MASK |
						    MADERA_OPCLK_SEL_MASK,
						    (div <<
						     MADERA_OPCLK_DIV_SHIFT) |
						    ref);
				return 0;
			}
			div += 2;
		}
	}

	dev_err(codec->dev, "Unable to generate %dHz OPCLK\n", freq);
	return -EINVAL;
}

static int madera_get_sysclk_setting(unsigned int freq)
{
	switch (freq) {
	case 0:
	case 5644800:
	case 6144000:
		return 0;
	case 11289600:
	case 12288000:
		return MADERA_CLK_12MHZ << MADERA_SYSCLK_FREQ_SHIFT;
	case 22579200:
	case 24576000:
		return MADERA_CLK_24MHZ << MADERA_SYSCLK_FREQ_SHIFT;
	case 45158400:
	case 49152000:
		return MADERA_CLK_49MHZ << MADERA_SYSCLK_FREQ_SHIFT;
	case 90316800:
	case 98304000:
		return MADERA_CLK_98MHZ << MADERA_SYSCLK_FREQ_SHIFT;
	default:
		return -EINVAL;
	}
}

int madera_get_legacy_dspclk_setting(struct madera *madera, unsigned int freq)
{
	switch (freq) {
	case 0:
		return 0;
	case 45158400:
	case 49152000:
		switch (madera->type) {
		case CS47L85:
		case WM1840:
			if (madera->rev < 3)
				return -EINVAL;
			else
				return MADERA_CLK_49MHZ <<
				       MADERA_SYSCLK_FREQ_SHIFT;
		default:
			return -EINVAL;
		}
	case 135475200:
	case 147456000:
		return MADERA_DSP_CLK_147MHZ << MADERA_SYSCLK_FREQ_SHIFT;
	default:
		return -EINVAL;
	}
}
EXPORT_SYMBOL_GPL(madera_get_legacy_dspclk_setting);

static int madera_get_dspclk_setting(struct madera *madera,
				     unsigned int freq,
				     unsigned int *clock_2_val)
{
	switch (madera->type) {
	case CS47L35:
	case CS47L85:
	case WM1840:
		*clock_2_val = 0; /* don't use MADERA_DSP_CLOCK_2 */
		return madera_get_legacy_dspclk_setting(madera, freq);
	default:
		if (freq > 150000000)
			return -EINVAL;

		/* Use new exact frequency control */
		*clock_2_val = freq / 15625; /* freq * (2^6) / (10^6) */
		return 0;
	}
}

static int madera_set_outclk(struct snd_soc_codec *codec, unsigned int source,
			      unsigned int freq)
{
	int div, div_inc, rate;

	switch (source) {
	case MADERA_OUTCLK_SYSCLK:
		dev_dbg(codec->dev, "Configured OUTCLK to SYSCLK\n");
		snd_soc_update_bits(codec, MADERA_OUTPUT_RATE_1,
				    MADERA_OUT_CLK_SRC_MASK, source);
		return 0;
	case MADERA_OUTCLK_ASYNCCLK:
		dev_dbg(codec->dev, "Configured OUTCLK to ASYNCCLK\n");
		snd_soc_update_bits(codec, MADERA_OUTPUT_RATE_1,
				    MADERA_OUT_CLK_SRC_MASK, source);
		return 0;
	case MADERA_OUTCLK_MCLK1:
	case MADERA_OUTCLK_MCLK2:
	case MADERA_OUTCLK_MCLK3:
		break;
	default:
		return -EINVAL;
	}

	if (freq % 4000)
		rate = 5644800;
	else
		rate = 6144000;

	div = 1;
	div_inc = 0;
	while (div <= 8) {
		if (freq / div == rate && !(freq % div)) {
			dev_dbg(codec->dev, "Configured %dHz OUTCLK\n", rate);
			snd_soc_update_bits(codec, MADERA_OUTPUT_RATE_1,
					    MADERA_OUT_EXT_CLK_DIV_MASK |
					    MADERA_OUT_CLK_SRC_MASK,
					    (div_inc <<
					     MADERA_OUT_EXT_CLK_DIV_SHIFT) |
					    source);
			return 0;
		}
		div_inc++;
		div *= 2;
	}

	dev_err(codec->dev, "Unable to generate %dHz OUTCLK from %dHz MCLK\n",
		rate, freq);
	return -EINVAL;
}

int madera_set_sysclk(struct snd_soc_codec *codec, int clk_id,
		      int source, unsigned int freq, int dir)
{
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	char *name;
	unsigned int reg, clock_2_val = 0;
	unsigned int mask = MADERA_SYSCLK_FREQ_MASK | MADERA_SYSCLK_SRC_MASK;
	unsigned int val = source << MADERA_SYSCLK_SRC_SHIFT;
	int clk_freq_sel, *clk;
	int ret = 0;

	switch (clk_id) {
	case MADERA_CLK_SYSCLK:
		name = "SYSCLK";
		reg = MADERA_SYSTEM_CLOCK_1;
		clk = &priv->sysclk;
		clk_freq_sel = madera_get_sysclk_setting(freq);
		mask |= MADERA_SYSCLK_FRAC;
		break;
	case MADERA_CLK_ASYNCCLK:
		name = "ASYNCCLK";
		reg = MADERA_ASYNC_CLOCK_1;
		clk = &priv->asyncclk;
		clk_freq_sel = madera_get_sysclk_setting(freq);
		break;
	case MADERA_CLK_OPCLK:
	case MADERA_CLK_ASYNC_OPCLK:
		return madera_set_opclk(codec, clk_id, freq);
	case MADERA_CLK_DSPCLK:
		name = "DSPCLK";
		reg = MADERA_DSP_CLOCK_1;
		clk = &priv->dspclk;
		clk_freq_sel = madera_get_dspclk_setting(madera, freq,
							 &clock_2_val);
		break;
	case MADERA_CLK_OUTCLK:
		return madera_set_outclk(codec, source, freq);
	default:
		return -EINVAL;
	}

	if (clk_freq_sel < 0) {
		dev_err(madera->dev,
			"Failed to get clk setting for %dHZ\n", freq);
		return ret;
	}

	*clk = freq;

	if (freq == 0) {
		dev_dbg(madera->dev, "%s cleared\n", name);
		return 0;
	}

	val |= clk_freq_sel;

	if (clock_2_val) {
		ret = regmap_write(madera->regmap, MADERA_DSP_CLOCK_2,
				   clock_2_val);
		if (ret) {
			dev_err(madera->dev,
				"Failed to write DSP_CONFIG2: %d\n", ret);
			return ret;
		}

		/* We're using the frequency setting in MADERA_DSP_CLOCK_2 so
		 * don't change the frequency select bits in MADERA_DSP_CLOCK_1
		 */
		mask = MADERA_SYSCLK_SRC_MASK;
	}

	if (freq % 6144000)
		val |= MADERA_SYSCLK_FRAC;

	dev_dbg(madera->dev, "%s set to %uHz", name, freq);

	return regmap_update_bits(madera->regmap, reg, mask, val);
}
EXPORT_SYMBOL_GPL(madera_set_sysclk);

static int madera_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{
	struct snd_soc_codec *codec = dai->codec;
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	int lrclk, bclk, mode, base;

	base = dai->driver->base;

	lrclk = 0;
	bclk = 0;

	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
	case SND_SOC_DAIFMT_DSP_A:
		mode = MADERA_FMT_DSP_MODE_A;
		break;
	case SND_SOC_DAIFMT_DSP_B:
		if ((fmt & SND_SOC_DAIFMT_MASTER_MASK)
				!= SND_SOC_DAIFMT_CBM_CFM) {
			madera_aif_err(dai, "DSP_B not valid in slave mode\n");
			return -EINVAL;
		}
		mode = MADERA_FMT_DSP_MODE_B;
		break;
	case SND_SOC_DAIFMT_I2S:
		mode = MADERA_FMT_I2S_MODE;
		break;
	case SND_SOC_DAIFMT_LEFT_J:
		if ((fmt & SND_SOC_DAIFMT_MASTER_MASK)
				!= SND_SOC_DAIFMT_CBM_CFM) {
			madera_aif_err(dai, "LEFT_J not valid in slave mode\n");
			return -EINVAL;
		}
		mode = MADERA_FMT_LEFT_JUSTIFIED_MODE;
		break;
	default:
		madera_aif_err(dai, "Unsupported DAI format %d\n",
				fmt & SND_SOC_DAIFMT_FORMAT_MASK);
		return -EINVAL;
	}

	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
	case SND_SOC_DAIFMT_CBS_CFS:
		break;
	case SND_SOC_DAIFMT_CBS_CFM:
		lrclk |= MADERA_AIF1TX_LRCLK_MSTR;
		break;
	case SND_SOC_DAIFMT_CBM_CFS:
		bclk |= MADERA_AIF1_BCLK_MSTR;
		break;
	case SND_SOC_DAIFMT_CBM_CFM:
		bclk |= MADERA_AIF1_BCLK_MSTR;
		lrclk |= MADERA_AIF1TX_LRCLK_MSTR;
		break;
	default:
		madera_aif_err(dai, "Unsupported master mode %d\n",
				fmt & SND_SOC_DAIFMT_MASTER_MASK);
		return -EINVAL;
	}

	switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
	case SND_SOC_DAIFMT_NB_NF:
		break;
	case SND_SOC_DAIFMT_IB_IF:
		bclk |= MADERA_AIF1_BCLK_INV;
		lrclk |= MADERA_AIF1TX_LRCLK_INV;
		break;
	case SND_SOC_DAIFMT_IB_NF:
		bclk |= MADERA_AIF1_BCLK_INV;
		break;
	case SND_SOC_DAIFMT_NB_IF:
		lrclk |= MADERA_AIF1TX_LRCLK_INV;
		break;
	default:
		return -EINVAL;
	}

	regmap_update_bits_async(madera->regmap, base + MADERA_AIF_BCLK_CTRL,
				 MADERA_AIF1_BCLK_INV |
				 MADERA_AIF1_BCLK_MSTR,
				 bclk);
	regmap_update_bits_async(madera->regmap, base + MADERA_AIF_TX_PIN_CTRL,
				 MADERA_AIF1TX_LRCLK_INV |
				 MADERA_AIF1TX_LRCLK_MSTR, lrclk);
	regmap_update_bits_async(madera->regmap,
				 base + MADERA_AIF_RX_PIN_CTRL,
				 MADERA_AIF1RX_LRCLK_INV |
				 MADERA_AIF1RX_LRCLK_MSTR, lrclk);
	regmap_update_bits(madera->regmap, base + MADERA_AIF_FORMAT,
			   MADERA_AIF1_FMT_MASK, mode);

	return 0;
}

static const int madera_48k_bclk_rates[] = {
	-1,
	48000,
	64000,
	96000,
	128000,
	192000,
	256000,
	384000,
	512000,
	768000,
	1024000,
	1536000,
	2048000,
	3072000,
	4096000,
	6144000,
	8192000,
	12288000,
	24576000,
};

static const int madera_44k1_bclk_rates[] = {
	-1,
	44100,
	58800,
	88200,
	117600,
	177640,
	235200,
	352800,
	470400,
	705600,
	940800,
	1411200,
	1881600,
	2822400,
	3763200,
	5644800,
	7526400,
	11289600,
	22579200,
};

static const unsigned int madera_sr_vals[] = {
	0,
	12000,
	24000,
	48000,
	96000,
	192000,
	384000,
	768000,
	0,
	11025,
	22050,
	44100,
	88200,
	176400,
	352800,
	705600,
	4000,
	8000,
	16000,
	32000,
	64000,
	128000,
	256000,
	512000,
};

#define MADERA_48K_RATE_MASK	0x0F003E
#define MADERA_44K1_RATE_MASK	0x003E00
#define MADERA_RATE_MASK	(MADERA_48K_RATE_MASK | MADERA_44K1_RATE_MASK)

static const struct snd_pcm_hw_constraint_list madera_constraint = {
	.count	= ARRAY_SIZE(madera_sr_vals),
	.list	= madera_sr_vals,
};

static int madera_startup(struct snd_pcm_substream *substream,
			  struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera_dai_priv *dai_priv = &priv->dai[dai->id - 1];
	unsigned int base_rate;

	switch (priv->madera->type) {
	case WM1840:
	case CS47L91:
	case CS47L93:
		return 0;
	default:
		break;
	}

	if (!substream->runtime)
		return 0;

	switch (dai_priv->clk) {
	case MADERA_CLK_SYSCLK:
	case MADERA_CLK_SYSCLK_2:
	case MADERA_CLK_SYSCLK_3:
		base_rate = priv->sysclk;
		break;
	case MADERA_CLK_ASYNCCLK:
	case MADERA_CLK_ASYNCCLK_2:
		base_rate = priv->asyncclk;
		break;
	default:
		return 0;
	}

	if (base_rate == 0)
		dai_priv->constraint.mask = MADERA_RATE_MASK;
	else if (base_rate % 4000)
		dai_priv->constraint.mask = MADERA_44K1_RATE_MASK;
	else
		dai_priv->constraint.mask = MADERA_48K_RATE_MASK;

	return snd_pcm_hw_constraint_list(substream->runtime, 0,
					  SNDRV_PCM_HW_PARAM_RATE,
					  &dai_priv->constraint);
}

static int madera_hw_params_rate(struct snd_pcm_substream *substream,
				 struct snd_pcm_hw_params *params,
				 struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera_dai_priv *dai_priv = &priv->dai[dai->id - 1];
	int base = dai->driver->base;
	int ret = 0, err;
	int i, sr_val, lim = 0;
	const unsigned int *sources = NULL;
	unsigned int cur, tar;
	bool change_rate = true;

	/* currently we use a single sample rate for SYSCLK */
	for (i = 0; i < ARRAY_SIZE(madera_sr_vals); i++)
		if (madera_sr_vals[i] == params_rate(params))
			break;

	if (i == ARRAY_SIZE(madera_sr_vals)) {
		madera_aif_err(dai, "Unsupported sample rate %dHz\n",
				params_rate(params));
		return -EINVAL;
	}
	sr_val = i;

	switch (dai_priv->clk) {
	case MADERA_CLK_SYSCLK:
		tar = 0 << MADERA_AIF1_RATE_SHIFT;
		break;
	case MADERA_CLK_SYSCLK_2:
		tar = 1 << MADERA_AIF1_RATE_SHIFT;
		break;
	case MADERA_CLK_SYSCLK_3:
		tar = 2 << MADERA_AIF1_RATE_SHIFT;
		break;
	case MADERA_CLK_ASYNCCLK:
		tar = 8 << MADERA_AIF1_RATE_SHIFT;
		break;
	case MADERA_CLK_ASYNCCLK_2:
		tar = 9 << MADERA_AIF1_RATE_SHIFT;
		break;
	default:
		return -EINVAL;
	}

	ret = regmap_read(priv->madera->regmap,
			  base + MADERA_AIF_RATE_CTRL, &cur);
	if (ret != 0) {
		madera_aif_err(dai, "Failed to check rate: %d\n", ret);
		return ret;
	}

	if ((cur & MADERA_AIF1_RATE_MASK) == (tar & MADERA_AIF1_RATE_MASK))
		change_rate = false;

	if (change_rate) {
		ret = madera_get_sources(dai, &sources, &lim);
		if (ret != 0) {
			madera_aif_err(dai,
					"Failed to get aif sources %d\n", ret);
			return ret;
		}

		mutex_lock(&priv->rate_lock);

		ret = madera_cache_and_clear_sources(priv, sources,
						     priv->aif_sources_cache,
						     lim);
		if (ret != 0) {
			madera_aif_err(dai,
				"Failed to cache and clear aif sources: %d\n",
				ret);
			goto out;
		}

		madera_spin_sysclk(priv);
	}

	switch (dai_priv->clk) {
	case MADERA_CLK_SYSCLK:
		snd_soc_update_bits(codec, MADERA_SAMPLE_RATE_1,
				    MADERA_SAMPLE_RATE_1_MASK, sr_val);
		if (base)
			snd_soc_update_bits(codec, base + MADERA_AIF_RATE_CTRL,
					    MADERA_AIF1_RATE_MASK,
					    0 << MADERA_AIF1_RATE_SHIFT);
		break;
	case MADERA_CLK_SYSCLK_2:
		snd_soc_update_bits(codec, MADERA_SAMPLE_RATE_2,
				    MADERA_SAMPLE_RATE_2_MASK, sr_val);
		if (base)
			snd_soc_update_bits(codec, base + MADERA_AIF_RATE_CTRL,
					    MADERA_AIF1_RATE_MASK,
					    1 << MADERA_AIF1_RATE_SHIFT);
		break;
	case MADERA_CLK_SYSCLK_3:
		snd_soc_update_bits(codec, MADERA_SAMPLE_RATE_3,
				    MADERA_SAMPLE_RATE_3_MASK, sr_val);
		if (base)
			snd_soc_update_bits(codec, base + MADERA_AIF_RATE_CTRL,
					    MADERA_AIF1_RATE_MASK,
					    2 << MADERA_AIF1_RATE_SHIFT);
		break;
	case MADERA_CLK_ASYNCCLK:
		snd_soc_update_bits(codec, MADERA_ASYNC_SAMPLE_RATE_1,
				    MADERA_ASYNC_SAMPLE_RATE_1_MASK, sr_val);
		if (base)
			snd_soc_update_bits(codec, base + MADERA_AIF_RATE_CTRL,
					    MADERA_AIF1_RATE_MASK,
					    8 << MADERA_AIF1_RATE_SHIFT);
		break;
	case MADERA_CLK_ASYNCCLK_2:
		snd_soc_update_bits(codec, MADERA_ASYNC_SAMPLE_RATE_2,
				    MADERA_ASYNC_SAMPLE_RATE_2_MASK, sr_val);
		if (base)
			snd_soc_update_bits(codec, base + MADERA_AIF_RATE_CTRL,
					    MADERA_AIF1_RATE_MASK,
					    9 << MADERA_AIF1_RATE_SHIFT);
		break;
	default:
		madera_aif_err(dai, "Invalid clock %d\n", dai_priv->clk);
		ret = -EINVAL;
	}

	if (change_rate)
		madera_spin_sysclk(priv);

out:
	if (change_rate) {
		err = madera_restore_sources(priv, sources,
					     priv->aif_sources_cache, lim);
		if (err != 0) {
			madera_aif_err(dai,
					"Failed to restore sources: %d\n", err);
		}

		mutex_unlock(&priv->rate_lock);
	}
	return ret;
}

static bool madera_aif_cfg_changed(struct snd_soc_codec *codec,
				   int base, int bclk, int lrclk, int frame)
{
	int val;

	val = snd_soc_read(codec, base + MADERA_AIF_BCLK_CTRL);
	if (bclk != (val & MADERA_AIF1_BCLK_FREQ_MASK))
		return true;

	val = snd_soc_read(codec, base + MADERA_AIF_TX_BCLK_RATE);
	if (lrclk != (val & MADERA_AIF1TX_BCPF_MASK))
		return true;

	val = snd_soc_read(codec, base + MADERA_AIF_FRAME_CTRL_1);
	if (frame != (val & (MADERA_AIF1TX_WL_MASK |
			     MADERA_AIF1TX_SLOT_LEN_MASK)))
		return true;

	return false;
}

static int madera_hw_params(struct snd_pcm_substream *substream,
			    struct snd_pcm_hw_params *params,
			    struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	int base = dai->driver->base;
	const int *rates;
	int i, ret, val;
	int channels = params_channels(params);
	int chan_limit = madera->pdata.codec.max_channels_clocked[dai->id - 1];
	int tdm_width = priv->tdm_width[dai->id - 1];
	int tdm_slots = priv->tdm_slots[dai->id - 1];
	int bclk, lrclk, wl, frame, bclk_target;
	bool reconfig;
	unsigned int aif_tx_state = 0, aif_rx_state = 0;

	if (params_rate(params) % 4000)
		rates = &madera_44k1_bclk_rates[0];
	else
		rates = &madera_48k_bclk_rates[0];

	wl = snd_pcm_format_width(params_format(params));

	if (tdm_slots) {
		madera_aif_dbg(dai, "Configuring for %d %d bit TDM slots\n",
				tdm_slots, tdm_width);
		bclk_target = tdm_slots * tdm_width * params_rate(params);
		channels = tdm_slots;
	} else {
		bclk_target = snd_soc_params_to_bclk(params);
		tdm_width = wl;
	}

	if (chan_limit && chan_limit < channels) {
		madera_aif_dbg(dai, "Limiting to %d channels\n", chan_limit);
		bclk_target /= channels;
		bclk_target *= chan_limit;
	}

	/* Force multiple of 2 channels for I2S mode */
	val = snd_soc_read(codec, base + MADERA_AIF_FORMAT);
	val &= MADERA_AIF1_FMT_MASK;
	if ((channels & 1) && (val == MADERA_FMT_I2S_MODE)) {
		madera_aif_dbg(dai, "Forcing stereo mode\n");
		bclk_target /= channels;
		bclk_target *= channels + 1;
	}

	for (i = 0; i < ARRAY_SIZE(madera_44k1_bclk_rates); i++) {
		if (rates[i] >= bclk_target &&
		    rates[i] % params_rate(params) == 0) {
			bclk = i;
			break;
		}
	}
	if (i == ARRAY_SIZE(madera_44k1_bclk_rates)) {
		madera_aif_err(dai, "Unsupported sample rate %dHz\n",
				params_rate(params));
		return -EINVAL;
	}

	lrclk = rates[bclk] / params_rate(params);

	madera_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n",
			rates[bclk], rates[bclk] / lrclk);

	frame = wl << MADERA_AIF1TX_WL_SHIFT | tdm_width;

	reconfig = madera_aif_cfg_changed(codec, base, bclk, lrclk, frame);

	if (reconfig) {
		/* Save AIF TX/RX state */
		aif_tx_state = snd_soc_read(codec,
					    base + MADERA_AIF_TX_ENABLES);
		aif_rx_state = snd_soc_read(codec,
					    base + MADERA_AIF_RX_ENABLES);
		/* Disable AIF TX/RX before reconfiguring it */
		regmap_update_bits_async(madera->regmap,
				    base + MADERA_AIF_TX_ENABLES, 0xff, 0x0);
		regmap_update_bits(madera->regmap,
				    base + MADERA_AIF_RX_ENABLES, 0xff, 0x0);
	}

	ret = madera_hw_params_rate(substream, params, dai);
	if (ret != 0)
		goto restore_aif;

	if (reconfig) {
		regmap_update_bits_async(madera->regmap,
					 base + MADERA_AIF_BCLK_CTRL,
					 MADERA_AIF1_BCLK_FREQ_MASK, bclk);
		regmap_update_bits_async(madera->regmap,
					 base + MADERA_AIF_TX_BCLK_RATE,
					 MADERA_AIF1TX_BCPF_MASK, lrclk);
		regmap_update_bits_async(madera->regmap,
					 base + MADERA_AIF_RX_BCLK_RATE,
					 MADERA_AIF1RX_BCPF_MASK, lrclk);
		regmap_update_bits_async(madera->regmap,
					 base + MADERA_AIF_FRAME_CTRL_1,
					 MADERA_AIF1TX_WL_MASK |
					 MADERA_AIF1TX_SLOT_LEN_MASK, frame);
		regmap_update_bits(madera->regmap,
				   base + MADERA_AIF_FRAME_CTRL_2,
				   MADERA_AIF1RX_WL_MASK |
				   MADERA_AIF1RX_SLOT_LEN_MASK, frame);
	}

restore_aif:
	if (reconfig) {
		/* Restore AIF TX/RX state */
		regmap_update_bits_async(madera->regmap,
					 base + MADERA_AIF_TX_ENABLES,
					 0xff, aif_tx_state);
		regmap_update_bits(madera->regmap,
				   base + MADERA_AIF_RX_ENABLES,
				   0xff, aif_rx_state);
	}
	return ret;
}

static const char * const madera_dai_clk_str(int clk_id)
{
	switch (clk_id) {
	case MADERA_CLK_SYSCLK:
	case MADERA_CLK_SYSCLK_2:
	case MADERA_CLK_SYSCLK_3:
		return "SYSCLK";
	case MADERA_CLK_ASYNCCLK:
	case MADERA_CLK_ASYNCCLK_2:
		return "ASYNCCLK";
	default:
		return "Unknown clock";
	}
}

static int madera_dai_set_sysclk(struct snd_soc_dai *dai,
				 int clk_id, unsigned int freq, int dir)
{
	struct snd_soc_codec *codec = dai->codec;
	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera_dai_priv *dai_priv = &priv->dai[dai->id - 1];
	struct snd_soc_dapm_route routes[2];

	switch (clk_id) {
	case MADERA_CLK_SYSCLK:
	case MADERA_CLK_SYSCLK_2:
	case MADERA_CLK_SYSCLK_3:
	case MADERA_CLK_ASYNCCLK:
	case MADERA_CLK_ASYNCCLK_2:
		break;
	default:
		return -EINVAL;
	}

	if (clk_id == dai_priv->clk)
		return 0;

	if (dai->active) {
		dev_err(codec->dev, "Can't change clock on active DAI %d\n",
			dai->id);
		return -EBUSY;
	}

	dev_dbg(codec->dev, "Setting AIF%d to %s\n", dai->id + 1,
		madera_dai_clk_str(clk_id));

	memset(&routes, 0, sizeof(routes));
	routes[0].sink = dai->driver->capture.stream_name;
	routes[1].sink = dai->driver->playback.stream_name;

	switch (clk_id) {
	case MADERA_CLK_SYSCLK:
	case MADERA_CLK_SYSCLK_2:
	case MADERA_CLK_SYSCLK_3:
		routes[0].source = madera_dai_clk_str(dai_priv->clk);
		routes[1].source = madera_dai_clk_str(dai_priv->clk);
		snd_soc_dapm_del_routes(dapm, routes, ARRAY_SIZE(routes));
		break;
	default:
		break;
	}

	switch (clk_id) {
	case MADERA_CLK_ASYNCCLK:
	case MADERA_CLK_ASYNCCLK_2:
		routes[0].source = madera_dai_clk_str(clk_id);
		routes[1].source = madera_dai_clk_str(clk_id);
		snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
		break;
	default:
		break;
	}

	dai_priv->clk = clk_id;

	return snd_soc_dapm_sync(dapm);
}

static int madera_set_tristate(struct snd_soc_dai *dai, int tristate)
{
	struct snd_soc_codec *codec = dai->codec;
	int base = dai->driver->base;
	unsigned int reg;
	int ret;

	if (tristate)
		reg = MADERA_AIF1_TRI;
	else
		reg = 0;

	ret = snd_soc_update_bits(codec, base + MADERA_AIF_RATE_CTRL,
				  MADERA_AIF1_TRI, reg);
	if (ret < 0)
		return ret;
	else
		return 0;
}

static void madera_set_channels_to_mask(struct snd_soc_dai *dai,
					unsigned int base,
					int channels, unsigned int mask)
{
	struct snd_soc_codec *codec = dai->codec;
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	int slot, i;

	for (i = 0; i < channels; ++i) {
		slot = ffs(mask) - 1;
		if (slot < 0)
			return;

		regmap_write(madera->regmap, base + i, slot);

		mask &= ~(1 << slot);
	}

	if (mask)
		madera_aif_warn(dai, "Too many channels in TDM mask\n");
}

static int madera_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
				unsigned int rx_mask, int slots, int slot_width)
{
	struct snd_soc_codec *codec = dai->codec;
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	int base = dai->driver->base;
	int rx_max_chan = dai->driver->playback.channels_max;
	int tx_max_chan = dai->driver->capture.channels_max;

	/* Only support TDM for the physical AIFs */
	if (dai->id > MADERA_MAX_AIF)
		return -ENOTSUPP;

	if (slots == 0) {
		tx_mask = (1 << tx_max_chan) - 1;
		rx_mask = (1 << rx_max_chan) - 1;
	}

	madera_set_channels_to_mask(dai, base + MADERA_AIF_FRAME_CTRL_3,
				    tx_max_chan, tx_mask);
	madera_set_channels_to_mask(dai, base + MADERA_AIF_FRAME_CTRL_11,
				    rx_max_chan, rx_mask);

	priv->tdm_width[dai->id - 1] = slot_width;
	priv->tdm_slots[dai->id - 1] = slots;

	return 0;
}

const struct snd_soc_dai_ops madera_dai_ops = {
	.startup = madera_startup,
	.set_fmt = madera_set_fmt,
	.set_tdm_slot = madera_set_tdm_slot,
	.hw_params = madera_hw_params,
	.set_sysclk = madera_dai_set_sysclk,
	.set_tristate = madera_set_tristate,
};
EXPORT_SYMBOL_GPL(madera_dai_ops);

const struct snd_soc_dai_ops madera_simple_dai_ops = {
	.startup = madera_startup,
	.hw_params = madera_hw_params_rate,
	.set_sysclk = madera_dai_set_sysclk,
};
EXPORT_SYMBOL_GPL(madera_simple_dai_ops);

int madera_init_dai(struct madera_priv *priv, int id)
{
	struct madera_dai_priv *dai_priv = &priv->dai[id];

	dai_priv->clk = MADERA_CLK_SYSCLK;
	dai_priv->constraint = madera_constraint;

	return 0;
}
EXPORT_SYMBOL_GPL(madera_init_dai);

static const struct {
	unsigned int min;
	unsigned int max;
	u16 fratio;
	int ratio;
} fll_sync_fratios[] = {
	{       0,    64000, 4, 16 },
	{   64000,   128000, 3,  8 },
	{  128000,   256000, 2,  4 },
	{  256000,  1000000, 1,  2 },
	{ 1000000, 13500000, 0,  1 },
};

static const unsigned int pseudo_fref_max[MADERA_FLL_MAX_FRATIO] = {
	13500000,
	 6144000,
	 6144000,
	 3072000,
	 3072000,
	 2822400,
	 2822400,
	 1536000,
	 1536000,
	 1536000,
	 1536000,
	 1536000,
	 1536000,
	 1536000,
	 1536000,
	  768000,
};

struct madera_fll_gains {
	unsigned int min;
	unsigned int max;
	int gain;		/* main gain */
	int alt_gain;		/* alternate integer gain */
};

static const struct madera_fll_gains madera_fll_sync_gains[] = {
	{       0,   256000, 0, -1 },
	{  256000,  1000000, 2, -1 },
	{ 1000000, 13500000, 4, -1 },
};

static const struct madera_fll_gains madera_fll_main_gains[] = {
	{       0,   100000, 0, 2 },
	{  100000,   375000, 2, 2 },
	{  375000,   768000, 3, 2 },
	{  768001,  1500000, 3, 3 },
	{ 1500000,  6000000, 4, 3 },
	{ 6000000, 13500000, 5, 3 },
};

static int madera_validate_fll(struct madera_fll *fll,
				unsigned int Fref,
				unsigned int Fout)
{
	switch (fll->madera->type) {
	case WM1840:
	case CS47L91:
	case CS47L93:
		return 0;
	default:
		break;
	}

	if (fll->fout && Fout != fll->fout) {
		madera_fll_err(fll, "Can't change output on active FLL\n");
		return -EINVAL;
	}

	if (Fref / MADERA_FLL_MAX_REFDIV > MADERA_FLL_MAX_FREF) {
		madera_fll_err(fll,
				"Can't scale %dMHz in to <=13.5MHz\n", Fref);
		return -EINVAL;
	}

	return 0;
}

static int madera_find_sync_fratio(unsigned int fref, int *fratio)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(fll_sync_fratios); i++) {
		if (fll_sync_fratios[i].min <= fref &&
		    fref <= fll_sync_fratios[i].max) {
			if (fratio)
				*fratio = fll_sync_fratios[i].fratio;

			return fll_sync_fratios[i].ratio;
		}
	}

	return -EINVAL;
}

static int madera_find_main_fratio(unsigned int fref, unsigned int fout,
				   int *fratio)
{
	int ratio = 1;

	while ((fout / (ratio * fref)) > MADERA_FLL_MAX_N)
		ratio++;

	if (fratio)
		*fratio = ratio - 1;

	return ratio;
}

static int madera_find_fratio(struct madera_fll *fll, unsigned int fref,
			      bool sync, int *fratio)
{
	switch (fll->madera->type) {
	case CS47L35:
		switch(fll->madera->rev) {
		case 0:
			/* rev A0 uses sync calculation for both loops */
			return madera_find_sync_fratio(fref, fratio);
		default:
			if (sync)
				return madera_find_sync_fratio(fref, fratio);
			else
				return madera_find_main_fratio(fref,
							       fll->fout,
							       fratio);
		}
		break;
	case CS47L85:
	case WM1840:
		/* these use the same calculation for main and sync loops */
		return madera_find_sync_fratio(fref, fratio);
	default:
		if (sync)
			return madera_find_sync_fratio(fref, fratio);
		else
			return madera_find_main_fratio(fref, fll->fout, fratio);
	}
}

static int madera_calc_fratio(struct madera_fll *fll,
			      struct madera_fll_cfg *cfg,
			      unsigned int Fref, bool sync)
{
	int init_ratio, ratio;
	int refdiv, div;

	/* Fref must be <=13.5MHz, find initial refdiv */
	div = 1;
	cfg->refdiv = 0;
	while (Fref > MADERA_FLL_MAX_FREF) {
		div *= 2;
		Fref /= 2;
		cfg->refdiv++;

		if (div > MADERA_FLL_MAX_REFDIV)
			return -EINVAL;
	}

	/* Find an appropriate FLL_FRATIO */
	init_ratio = madera_find_fratio(fll, Fref, sync, &cfg->fratio);
	if (init_ratio < 0) {
		madera_fll_err(fll, "Unable to find FRATIO for Fref=%uHz\n",
				Fref);
		return init_ratio;
	}

	if (!sync)
		cfg->fratio = init_ratio - 1;

	switch (fll->madera->type) {
	case CS47L35:
		switch (fll->madera->rev) {
		case 0:
			if (sync)
				return init_ratio;
			break;
		default:
			return init_ratio;
		}
		break;
	case CS47L85:
	case WM1840:
		if (sync)
			return init_ratio;
		break;
	default:
		return init_ratio;
	}

	/* For CS47L35 rev A0, CS47L85 and WM1840 adjust FRATIO/refdiv to avoid
	 * integer mode if possible
	 */
	refdiv = cfg->refdiv;

	while (div <= MADERA_FLL_MAX_REFDIV) {
		/* start from init_ratio because this may already give a
		 * fractional N.K
		 */
		for (ratio = init_ratio; ratio > 0; ratio--) {
			if (fll->fout % (ratio * Fref)) {
				cfg->refdiv = refdiv;
				cfg->fratio = ratio - 1;
				return ratio;
			}
		}

		for (ratio = init_ratio + 1; ratio <= MADERA_FLL_MAX_FRATIO;
		     ratio++) {
			if ((MADERA_FLL_VCO_CORNER / 2) /
			    (MADERA_FLL_VCO_MULT * ratio) < Fref)
				break;

			if (Fref > pseudo_fref_max[ratio - 1])
				break;

			if (fll->fout % (ratio * Fref)) {
				cfg->refdiv = refdiv;
				cfg->fratio = ratio - 1;
				return ratio;
			}
		}

		div *= 2;
		Fref /= 2;
		refdiv++;
		init_ratio = madera_find_fratio(fll, Fref, sync, NULL);
	}

	madera_fll_warn(fll, "Falling back to integer mode operation\n");
	return cfg->fratio + 1;
}

static int madera_find_fll_gain(struct madera_fll *fll,
				struct madera_fll_cfg *cfg,
				unsigned int fref,
				const struct madera_fll_gains *gains,
				int n_gains)
{
	int i;

	for (i = 0; i < n_gains; i++) {
		if (gains[i].min <= fref && fref <= gains[i].max) {
			cfg->gain = gains[i].gain;
			cfg->alt_gain = gains[i].alt_gain;
			return 0;
		}
	}

	madera_fll_err(fll, "Unable to find gain for fref=%uHz\n", fref);

	return -EINVAL;
}

static int madera_calc_fll(struct madera_fll *fll,
			   struct madera_fll_cfg *cfg,
			   unsigned int fref, bool sync)
{
	unsigned int gcd_fll;
	const struct madera_fll_gains *gains;
	int n_gains;
	int ratio, ret;

	madera_fll_dbg(fll, "fref=%u Fout=%u fvco=%u\n",
			fref, fll->fout, fll->fout * MADERA_FLL_VCO_MULT);

	/* Find an appropriate FLL_FRATIO and refdiv */
	ratio = madera_calc_fratio(fll, cfg, fref, sync);
	if (ratio < 0)
		return ratio;

	/* Apply the division for our remaining calculations */
	fref = fref / (1 << cfg->refdiv);

	cfg->n = fll->fout / (ratio * fref);

	if (fll->fout % (ratio * fref)) {
		gcd_fll = gcd(fll->fout, ratio * fref);
		madera_fll_dbg(fll, "GCD=%u\n", gcd_fll);

		cfg->theta = (fll->fout - (cfg->n * ratio * fref))
			/ gcd_fll;
		cfg->lambda = (ratio * fref) / gcd_fll;
	} else {
		cfg->theta = 0;
		cfg->lambda = 0;
	}

	/* Round down to 16bit range with cost of accuracy lost.
	 * Denominator must be bigger than numerator so we only
	 * take care of it.
	 */
	while (cfg->lambda >= (1 << 16)) {
		cfg->theta >>= 1;
		cfg->lambda >>= 1;
	}

	switch (fll->madera->type) {
	case CS47L35:
		switch (fll->madera->rev) {
		case 0:
			/* Rev A0 uses the sync gains for both loops */
			gains = madera_fll_sync_gains,
			n_gains = ARRAY_SIZE(madera_fll_sync_gains);
			break;
		default:
			if (sync) {
				gains = madera_fll_sync_gains,
				n_gains = ARRAY_SIZE(madera_fll_sync_gains);
			} else {
				gains = madera_fll_main_gains;
				n_gains = ARRAY_SIZE(madera_fll_main_gains);
			}
			break;
		}
		break;
	case CS47L85:
	case WM1840:
		/* These use the sync gains for both loops */
		gains = madera_fll_sync_gains,
		n_gains = ARRAY_SIZE(madera_fll_sync_gains);
		break;
	default:
		if (sync) {
			gains = madera_fll_sync_gains,
			n_gains = ARRAY_SIZE(madera_fll_sync_gains);
		} else {
			gains = madera_fll_main_gains;
			n_gains = ARRAY_SIZE(madera_fll_main_gains);
		}
		break;
	}

	ret = madera_find_fll_gain(fll, cfg, fref, gains, n_gains);
	if (ret)
		return ret;

	madera_fll_dbg(fll, "N=%d THETA=%d LAMBDA=%d\n",
			cfg->n, cfg->theta, cfg->lambda);
	madera_fll_dbg(fll, "FRATIO=0x%x(%d) REFCLK_DIV=0x%x(%d)\n",
			cfg->fratio, ratio, cfg->refdiv, 1 << cfg->refdiv);
	madera_fll_dbg(fll, "GAIN=0x%x(%d)\n", cfg->gain, 1 << cfg->gain);

	return 0;

}

static bool madera_apply_fll(struct madera *madera, unsigned int base,
			     struct madera_fll_cfg *cfg, int source,
			     bool sync, int gain)
{
	bool change, fll_change;

	fll_change = false;
	regmap_update_bits_check_async(madera->regmap,
				       base + MADERA_FLL_CONTROL_3_OFFS,
				       MADERA_FLL1_THETA_MASK,
				       cfg->theta, &change);
	fll_change |= change;
	regmap_update_bits_check_async(madera->regmap,
				       base + MADERA_FLL_CONTROL_4_OFFS,
				       MADERA_FLL1_LAMBDA_MASK,
				       cfg->lambda, &change);
	fll_change |= change;
	regmap_update_bits_check_async(madera->regmap,
				       base + MADERA_FLL_CONTROL_5_OFFS,
				       MADERA_FLL1_FRATIO_MASK,
				       cfg->fratio << MADERA_FLL1_FRATIO_SHIFT,
				       &change);
	fll_change |= change;
	regmap_update_bits_check_async(madera->regmap,
				base + MADERA_FLL_CONTROL_6_OFFS,
				MADERA_FLL1_REFCLK_DIV_MASK |
				MADERA_FLL1_REFCLK_SRC_MASK,
				cfg->refdiv << MADERA_FLL1_REFCLK_DIV_SHIFT |
				source << MADERA_FLL1_REFCLK_SRC_SHIFT,
				&change);
	fll_change |= change;

	if (sync) {
		regmap_update_bits_check_async(madera->regmap,
				base + MADERA_FLL_SYNCHRONISER_7_OFFS,
				MADERA_FLL1_GAIN_MASK,
				gain << MADERA_FLL1_GAIN_SHIFT, &change);
		fll_change |= change;
	} else {
		regmap_update_bits_check_async(madera->regmap,
				base + MADERA_FLL_CONTROL_7_OFFS,
				MADERA_FLL1_GAIN_MASK,
				gain << MADERA_FLL1_GAIN_SHIFT, &change);
		fll_change |= change;
	}

	regmap_update_bits_check_async(madera->regmap,
				base + MADERA_FLL_CONTROL_2_OFFS,
				MADERA_FLL1_CTRL_UPD | MADERA_FLL1_N_MASK,
				MADERA_FLL1_CTRL_UPD | cfg->n, &change);
	fll_change |= change;

	return fll_change;
}

static int madera_is_enabled_fll(struct madera_fll *fll)
{
	struct madera *madera = fll->madera;
	unsigned int reg;
	int ret;

	ret = regmap_read(madera->regmap,
			  fll->base + MADERA_FLL_CONTROL_1_OFFS, &reg);
	if (ret != 0) {
		madera_fll_err(fll, "Failed to read current state: %d\n", ret);
		return ret;
	}

	return reg & MADERA_FLL1_ENA;
}

static int madera_wait_for_fll(struct madera_fll *fll, bool requested)
{
	struct madera *madera = fll->madera;
	unsigned int val = 0;
	bool status;
	int i;

	madera_fll_dbg(fll, "Waiting for FLL...\n");

	for (i = 0; i < 30; i++) {
		regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_2, &val);
		status = val & (MADERA_FLL1_LOCK_STS1 << (fll->id - 1));
		if (status == requested)
			return 0;

		switch (i) {
		case 0 ... 5:
			usleep_range(75, 125);
			break;
		case 11 ... 20:
			usleep_range(750, 1250);
			break;
		default:
			msleep(20);
			break;
		}
	}

	madera_fll_warn(fll, "Timed out waiting for lock\n");

	return -ETIMEDOUT;
}

static bool madera_set_fll_phase_integrator(struct madera_fll *fll,
					    struct madera_fll_cfg *ref_cfg,
					    bool sync)
{
	unsigned int val;
	bool reg_change;

	if (!sync && (ref_cfg->theta == 0))
		val = (1 << MADERA_FLL1_PHASE_ENA_SHIFT) |
			(2 << MADERA_FLL1_PHASE_GAIN_SHIFT);
	else
		val = 2 << MADERA_FLL1_PHASE_GAIN_SHIFT;

	regmap_update_bits_check(fll->madera->regmap,
				 fll->base + MADERA_FLL_EFS_2_OFFS,
				 MADERA_FLL1_PHASE_ENA_MASK |
				 MADERA_FLL1_PHASE_GAIN_MASK,
				 val,
				 &reg_change);

	return reg_change;
}

static int madera_enable_fll(struct madera_fll *fll)
{
	struct madera *madera = fll->madera;
	bool have_sync = false;
	int already_enabled = madera_is_enabled_fll(fll);
	struct madera_fll_cfg cfg;
	unsigned int sync_reg_base;
	int gain;
	bool fll_change = false;

	if (already_enabled < 0)
		return already_enabled;	/* error getting current state */

	if ((fll->ref_src < 0) || (fll->ref_freq == 0)) {
		madera_fll_err(fll, "No REFCLK\n");
		return -EINVAL;
	}

	madera_fll_dbg(fll, "Enabling FLL, initially %s\n",
			already_enabled ? "enabled" : "disabled");

	switch (madera->type) {
	case CS47L35:
		sync_reg_base = fll->base + CS47L35_FLL_SYNCHRONISER_OFFS;
		break;
	default:
		sync_reg_base = fll->base + MADERA_FLL_SYNCHRONISER_OFFS;
		break;
	}

	if (already_enabled) {
		/* Facilitate smooth refclk across the transition */
		regmap_update_bits_async(fll->madera->regmap,
					 fll->base + MADERA_FLL_CONTROL_7_OFFS,
					 MADERA_FLL1_GAIN_MASK, 0);
		regmap_update_bits(fll->madera->regmap,
				   fll->base + MADERA_FLL_CONTROL_1_OFFS,
				   MADERA_FLL1_FREERUN,
				   MADERA_FLL1_FREERUN);
		udelay(32);
	}

	/* Apply SYNCCLK setting */
	if (fll->sync_src >= 0) {
		madera_calc_fll(fll, &cfg, fll->sync_freq, true);

		fll_change |= madera_apply_fll(madera, sync_reg_base,
						&cfg, fll->sync_src,
						true, cfg.gain);
		have_sync = true;
	}

	/* Apply REFCLK setting */
	madera_calc_fll(fll, &cfg, fll->ref_freq, false);

	switch (fll->madera->type) {
	case CS47L35:
		switch (fll->madera->rev) {
		case 0:
			break;
		default:
			fll_change |=
				madera_set_fll_phase_integrator(fll, &cfg,
								have_sync);
			break;
		}
		gain = cfg.gain;
		break;
	case CS47L85:
	case WM1840:
		gain = cfg.gain;
		break;
	default:
		fll_change |= madera_set_fll_phase_integrator(fll, &cfg,
							      have_sync);
		if (!have_sync && (cfg.theta == 0))
			gain = cfg.alt_gain;
		else
			gain = cfg.gain;
		break;
	}

	fll_change |= madera_apply_fll(madera, fll->base,
				      &cfg, fll->ref_src,
				      false, gain);

	/*
	 * Increase the bandwidth if we're not using a low frequency
	 * sync source.
	 */
	if (have_sync && fll->sync_freq > 100000)
		regmap_update_bits_async(madera->regmap,
				sync_reg_base + MADERA_FLL_SYNCHRONISER_7_OFFS,
				MADERA_FLL1_SYNC_DFSAT_MASK, 0);
	else
		regmap_update_bits_async(madera->regmap,
				sync_reg_base + MADERA_FLL_SYNCHRONISER_7_OFFS,
				MADERA_FLL1_SYNC_DFSAT_MASK,
				MADERA_FLL1_SYNC_DFSAT);

	if (!already_enabled)
		pm_runtime_get(madera->dev);

	/* Clear any pending completions */
	try_wait_for_completion(&fll->ok);

	regmap_update_bits_async(madera->regmap,
				 fll->base + MADERA_FLL_CONTROL_1_OFFS,
				 MADERA_FLL1_ENA, MADERA_FLL1_ENA);
	if (have_sync)
		regmap_update_bits_async(madera->regmap,
				sync_reg_base + MADERA_FLL_SYNCHRONISER_1_OFFS,
				MADERA_FLL1_SYNC_ENA,
				MADERA_FLL1_SYNC_ENA);

	if (already_enabled)
		regmap_update_bits_async(madera->regmap,
					 fll->base + MADERA_FLL_CONTROL_1_OFFS,
					 MADERA_FLL1_FREERUN, 0);

	if (fll_change || !already_enabled)
		madera_wait_for_fll(fll, true);

	return 0;
}

static void madera_disable_fll(struct madera_fll *fll)
{
	struct madera *madera = fll->madera;
	unsigned int sync_reg_base;
	bool change;

	switch (madera->type) {
	case CS47L35:
		sync_reg_base = fll->base + CS47L35_FLL_SYNCHRONISER_OFFS;
		break;
	default:
		sync_reg_base = fll->base + MADERA_FLL_SYNCHRONISER_OFFS;
		break;
	}

	madera_fll_dbg(fll, "Disabling FLL\n");

	regmap_update_bits_async(madera->regmap,
				 fll->base + MADERA_FLL_CONTROL_1_OFFS,
				 MADERA_FLL1_FREERUN, MADERA_FLL1_FREERUN);
	regmap_update_bits_check(madera->regmap,
				 fll->base + MADERA_FLL_CONTROL_1_OFFS,
				 MADERA_FLL1_ENA, 0, &change);
	regmap_update_bits(madera->regmap,
			   sync_reg_base + MADERA_FLL_SYNCHRONISER_1_OFFS,
			   MADERA_FLL1_SYNC_ENA, 0);
	regmap_update_bits_async(madera->regmap,
				 fll->base + MADERA_FLL_CONTROL_1_OFFS,
				 MADERA_FLL1_FREERUN, 0);

	madera_wait_for_fll(fll, false);

	if (change)
		pm_runtime_put_autosuspend(madera->dev);
}

int madera_set_fll_syncclk(struct madera_fll *fll, int source,
			   unsigned int fref, unsigned int Fout)
{
	int ret = 0;

	if (fll->sync_src == source && fll->sync_freq == fref)
		return 0;

	if (fll->fout && fref > 0) {
		ret = madera_validate_fll(fll, fref, fll->fout);
		if (ret != 0)
			return ret;
	}

	fll->sync_src = source;
	fll->sync_freq = fref;

	if (fll->fout && fref > 0)
		ret = madera_enable_fll(fll);

	return ret;
}
EXPORT_SYMBOL_GPL(madera_set_fll_syncclk);

int madera_set_fll_refclk(struct madera_fll *fll, int source,
			   unsigned int fref, unsigned int fout)
{
	int ret = 0;

	if (fll->ref_src == source &&
	    fll->ref_freq == fref && fll->fout == fout)
		return 0;

	if (fout) {
		if ((fout < MADERA_FLL_MIN_FOUT) ||
		    (fout > MADERA_FLL_MAX_FOUT)) {
			madera_fll_err(fll, "invalid fout %uHz\n", fout);
			return -EINVAL;
		}

		ret = madera_validate_fll(fll, fref, fout);
		if (ret != 0)
			return ret;
	}

	fll->ref_src = source;
	fll->ref_freq = fref;
	fll->fout = fout;

	if (fout)
		ret = madera_enable_fll(fll);
	else
		madera_disable_fll(fll);

	return ret;
}
EXPORT_SYMBOL_GPL(madera_set_fll_refclk);

int madera_init_fll(struct madera *madera, int id, int base,
		    struct madera_fll *fll)
{
	init_completion(&fll->ok);

	fll->id = id;
	fll->base = base;
	fll->madera = madera;
	fll->ref_src = MADERA_FLL_SRC_NONE;
	fll->sync_src = MADERA_FLL_SRC_NONE;

	switch (madera->type) {
	case CS47L92:
	case CS47L93:
		break;
	default:
		regmap_update_bits(madera->regmap,
				   fll->base + MADERA_FLL_CONTROL_1_OFFS,
				   MADERA_FLL1_FREERUN, 0);
		break;
	}

	return 0;
}
EXPORT_SYMBOL_GPL(madera_init_fll);

static struct reg_sequence fll_cs47l90_32K_49M_patch[] = {
	{ 0x2, 0x02EE },
	{ 0x3, 0x0000 },
	{ 0x4, 0x0001 },
	{ 0x5, 0x0002 },
	{ 0x6, 0x8001 },
	{ 0x8, 0x0004 },
	{ 0xA, 0x0077 },
	{ 0xC, 0x06D8 },
	{ 0xD, 0x0085 },
};

static struct reg_sequence fll_cs47l90_32K_45M_patch[] = {
	{ 0x2, 0x02B1 },
	{ 0x3, 0x0001 },
	{ 0x4, 0x0010 },
	{ 0x5, 0x0002 },
	{ 0x6, 0x8001 },
	{ 0x8, 0x0004 },
	{ 0xA, 0x0077 },
	{ 0xC, 0x06D8 },
	{ 0xD, 0x0005 },
};

struct madera_fll_patch {
	unsigned int fin;
	unsigned int fout;
	const struct reg_sequence *patch;
	unsigned int patch_size;
};

static const struct madera_fll_patch fll_cs47l90_settings[] = {
	{
		.fin = 32768,
		.fout = 49152000,
		.patch = fll_cs47l90_32K_49M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l90_32K_49M_patch),
	},
	{
		.fin = 32768,
		.fout = 45158400,
		.patch = fll_cs47l90_32K_45M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l90_32K_45M_patch),
	},
	{}
};

static struct reg_sequence fll_cs47l92_32K7645_49M_patch[] = {
	{ 0x2, 0x0005 },
	{ 0x3, 0x4961 },
	{ 0x4, 0x5553 },
	{ 0x5, 0x0100 },
	{ 0x6, 0x8000 },
	{ 0x8, 0x23F0 },
	{ 0xA, 0xD000 },
	{ 0xB, 0x0005 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_32K768_49M_patch[] = {
	{ 0x2, 0x0177 },
	{ 0x3, 0x0000 },
	{ 0x4, 0x0001 },
	{ 0x5, 0x0004 },
	{ 0x6, 0x8000 },
	{ 0x8, 0x23F0 },
	{ 0xA, 0x1000 },
	{ 0xB, 0x0005 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_19M_49M_patch[] = {
	{ 0x2, 0x0005 },
	{ 0x3, 0x0003 },
	{ 0x4, 0x0019 },
	{ 0x5, 0x0001 },
	{ 0x6, 0x8040 },
	{ 0x8, 0x21F0 },
	{ 0xA, 0xD000 },
	{ 0xB, 0x0011 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_24M_49M_patch[] = {
	{ 0x2, 0x0004 },
	{ 0x3, 0x0000 },
	{ 0x4, 0x0001 },
	{ 0x5, 0x0001 },
	{ 0x6, 0x8040 },
	{ 0x8, 0x21F0 },
	{ 0xA, 0x1000 },
	{ 0xB, 0x0011 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_26M_49M_patch[] = {
	{ 0x2, 0x0003 },
	{ 0x3, 0x04F5 },
	{ 0x4, 0x0659 },
	{ 0x5, 0x0001 },
	{ 0x6, 0x8040 },
	{ 0x8, 0x21FF },
	{ 0xA, 0xD000 },
	{ 0xB, 0x0011 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x72E8 },
};
static struct reg_sequence fll_cs47l92_32K7645_45M_patch[] = {
	{ 0x2, 0x0005 },
	{ 0x3, 0x0AEB },
	{ 0x4, 0x1C71 },
	{ 0x5, 0x0100 },
	{ 0x6, 0x8000 },
	{ 0x8, 0x23F0 },
	{ 0xA, 0xD000 },
	{ 0xB, 0x0005 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_32K768_45M_patch[] = {
	{ 0x2, 0x0005 },
	{ 0x3, 0x0311 },
	{ 0x4, 0x0800 },
	{ 0x5, 0x0100 },
	{ 0x6, 0x8000 },
	{ 0x8, 0x23F0 },
	{ 0xA, 0xD000 },
	{ 0xB, 0x0005 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_19M_45M_patch[] = {
	{ 0x2, 0x0004 },
	{ 0x3, 0x0058 },
	{ 0x4, 0x007D },
	{ 0x5, 0x0001 },
	{ 0x6, 0x8040 },
	{ 0x8, 0x20FF },
	{ 0xA, 0xD000 },
	{ 0xB, 0x0011 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_22M_45M_patch[] = {
	{ 0x2, 0x0004 },
	{ 0x3, 0x0000 },
	{ 0x4, 0x0001 },
	{ 0x5, 0x0001 },
	{ 0x6, 0x8040 },
	{ 0x8, 0x21F0 },
	{ 0xA, 0x1000 },
	{ 0xB, 0x0011 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_24M_45M_patch[] = {
	{ 0x2, 0x0003 },
	{ 0x3, 0x001B },
	{ 0x4, 0x0028 },
	{ 0x5, 0x0001 },
	{ 0x6, 0x8040 },
	{ 0x8, 0x21F0 },
	{ 0xA, 0xD000 },
	{ 0xB, 0x0011 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x32E8 },
};
static struct reg_sequence fll_cs47l92_26M_45M_patch[] = {
	{ 0x2, 0x0003 },
	{ 0x3, 0x0F09 },
	{ 0x4, 0x1FBD },
	{ 0x5, 0x0001 },
	{ 0x6, 0x8040 },
	{ 0x8, 0x21FF },
	{ 0xA, 0xD000 },
	{ 0xB, 0x0011 },
	{ 0xC, 0x2077 },
	{ 0xD, 0x72E8 },
};
static const struct madera_fll_patch fll_cs47l92_settings[] = {
	{
		.fin = 32764,
		.fout = 49152000,
		.patch = fll_cs47l92_32K7645_49M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_32K7645_49M_patch),
	},
	{
		.fin = 32768,
		.fout = 49152000,
		.patch = fll_cs47l92_32K768_49M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_32K768_49M_patch),
	},
	{
		.fin = 19200000,
		.fout = 49152000,
		.patch = fll_cs47l92_19M_49M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_19M_49M_patch),
	},
	{
		.fin = 24576000,
		.fout = 49152000,
		.patch = fll_cs47l92_24M_49M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_24M_49M_patch),
	},
	{
		.fin = 26000000,
		.fout = 49152000,
		.patch = fll_cs47l92_26M_49M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_26M_49M_patch),
	},
	{
		.fin = 32764,
		.fout = 45158400,
		.patch = fll_cs47l92_32K7645_45M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_32K7645_45M_patch),
	},
	{
		.fin = 32768,
		.fout = 45158400,
		.patch = fll_cs47l92_32K768_45M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_32K768_45M_patch),
	},
	{
		.fin = 19200000,
		.fout = 45158400,
		.patch = fll_cs47l92_19M_45M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_19M_45M_patch),
	},
	{
		.fin = 22579200,
		.fout = 45158400,
		.patch = fll_cs47l92_22M_45M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_22M_45M_patch),
	},
	{
		.fin = 24576000,
		.fout = 45158400,
		.patch = fll_cs47l92_24M_45M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_24M_45M_patch),
	},
	{
		.fin = 26000000,
		.fout = 45158400,
		.patch = fll_cs47l92_26M_45M_patch,
		.patch_size = ARRAY_SIZE(fll_cs47l92_26M_45M_patch),
	},
	{}
};

static const struct madera_fll_patch *madera_fllhj_lu(struct madera_fll *fll,
						      unsigned int fin,
						      unsigned int fout)
{
	struct madera *madera = fll->madera;
	const struct madera_fll_patch *settings;

	switch (madera->type) {
	case CS47L90:
	case CS47L91:
		settings = fll_cs47l90_settings;
		break;
	default:
		settings = fll_cs47l92_settings;
		break;
	}

	while (settings->fin) {
		if (settings->fin == fin && settings->fout == fout)
			break;
		settings++;
	}

	if (!settings->fin) {
		madera_fll_err(fll, "No FLL config match for %d => %d\n",
				fin, fout);
		return NULL;
	}

	return settings;
}

static int madera_apply_fllhj(struct madera_fll *fll, int fin)
{
	struct madera *madera = fll->madera;
	const struct reg_sequence *patch;
	unsigned int patch_size, base;
	int i;
	const struct madera_fll_patch *settings;

	settings = madera_fllhj_lu(fll, fin, fll->fout);
	if (!settings)
		return -EINVAL;

	patch = settings->patch;
	patch_size = settings->patch_size;

	base = fll->base;

	for (i = 0; i < patch_size; i++)
		regmap_write(madera->regmap, base + patch[i].reg, patch[i].def);

	return 0;
}

static int madera_enable_fllhj(struct madera_fll *fll)
{
	struct madera *madera = fll->madera;
	int already_enabled = madera_is_enabled_fll(fll);
	unsigned int src_mask, src_shift, src_offset;

	if (already_enabled < 0)
		return already_enabled;

	madera_fll_dbg(fll, "Enabling FLL, initially %s\n",
			already_enabled ? "enabled" : "disabled");

	switch (madera->type) {
	case CS47L90:
	case CS47L91:
		src_mask = MADERA_FLL_AO_REFCLK_SRC_MASK;
		src_shift = MADERA_FLL_AO_REFCLK_SRC_SHIFT;
		src_offset = 6;
		break;
	default:
		src_mask = CS47L92_FLL1_REFCLK_SRC_MASK;
		src_shift = CS47L92_FLL1_REFCLK_SRC_SHIFT;
		src_offset = 1;
		break;
	}

	/* FLLn_HOLD must be set before configuring any registers */
	regmap_update_bits(fll->madera->regmap, fll->base + 1,
			   MADERA_FLL1_HOLD_MASK,
			   MADERA_FLL1_HOLD_MASK);

	/* Apply refclk */
	madera_apply_fllhj(fll, fll->ref_freq);
	regmap_update_bits(madera->regmap, fll->base + src_offset,
			   src_mask, fll->ref_src << src_shift);
	regmap_update_bits(madera->regmap,
			   fll->base + MADERA_FLL_SYNCHRONISER_OFFS
			   + src_offset,
			   src_mask, 0);

	if (!already_enabled)
		pm_runtime_get(madera->dev);

	regmap_update_bits(madera->regmap, fll->base + 2,
			   MADERA_FLL1_CTRL_UPD_MASK,
			   MADERA_FLL1_CTRL_UPD_MASK);

	regmap_update_bits(madera->regmap, fll->base + 1,
			   MADERA_FLL1_ENA_MASK, MADERA_FLL1_ENA_MASK);

	/* Release the hold so that flln locks to external frequency */
	regmap_update_bits(madera->regmap, fll->base + 1,
			   MADERA_FLL1_HOLD_MASK, 0);

	if (!already_enabled)
		madera_wait_for_fll(fll, true);

	return 0;
}

static int madera_disable_fllhj(struct madera_fll *fll)
{
	struct madera *madera = fll->madera;
	bool change;

	madera_fll_dbg(fll, "Disabling FLL\n");

	regmap_update_bits(madera->regmap,
			   fll->base + MADERA_FLLAO_CONTROL_1_OFFS,
			   MADERA_FLL_AO_HOLD, MADERA_FLL_AO_HOLD);
	regmap_update_bits_check(madera->regmap,
				 fll->base + MADERA_FLLAO_CONTROL_1_OFFS,
				 MADERA_FLL_AO_ENA, 0, &change);

	madera_wait_for_fll(fll, false);

	/* ctrl_up gates the writes to all the fll's registers, setting it to 0
	 * here ensures that after a runtime suspend/resume cycle when one
	 * enables the fll then ctrl_up is the last bit that is configured
	 * by the fll enable code rather than the cache sync operation which
	 * would have updated it much earlier before writing out all fll
	 * registers
	 */
	regmap_update_bits(madera->regmap,
			   fll->base + MADERA_FLLAO_CONTROL_2_OFFS,
			   MADERA_FLL_AO_CTRL_UPD_MASK, 0);

	if (change)
		pm_runtime_put_autosuspend(madera->dev);

	return 0;
}

static int madera_validate_fllhj(struct madera_fll *fll,
				 unsigned int sync_in,
				 unsigned int fout)
{
	if (sync_in && !madera_fllhj_lu(fll, sync_in, fout))
		return -EINVAL;
	if (fout && !sync_in) {
		madera_fll_err(fll, "fllout set without valid input clk\n");
		return -EINVAL;
	}

	return 0;
}

int madera_set_fllhj_refclk(struct madera_fll *fll, int source,
			    unsigned int fin, unsigned int fout)
{
	int ret = 0;
	struct madera *madera = fll->madera;

	if (fll->ref_src == source && fll->ref_freq == fin &&
	    fll->fout == fout)
		return 0;

	/* To remain consistent with previous FLLs, we expect fout to be
	 * provided in the form of the expected sysclk rate, which is
	 * 2x the calculated fll out.
	 */
	switch (madera->type) {
	case CS47L90:
	case CS47L91:
		break;
	default:
		if (fout)
			fout /= 2;
		break;
	}

	if (fin && fout && madera_validate_fllhj(fll, fin, fout))
		return -EINVAL;

	fll->ref_src = source;
	fll->ref_freq = fin;
	fll->fout = fout;

	if (fout)
		ret = madera_enable_fllhj(fll);
	else
		madera_disable_fllhj(fll);

	return ret;
}
EXPORT_SYMBOL_GPL(madera_set_fllhj_refclk);

/**
 * madera_set_output_mode - Set the mode of the specified output
 *
 * @codec: Device to configure
 * @output: Output number
 * @diff: True to set the output to differential mode
 *
 * Some systems use external analogue switches to connect more
 * analogue devices to the CODEC than are supported by the device.  In
 * some systems this requires changing the switched output from single
 * ended to differential mode dynamically at runtime, an operation
 * supported using this function.
 *
 * Most systems have a single static configuration and should use
 * platform data instead.
 */
int madera_set_output_mode(struct snd_soc_codec *codec, int output, bool diff)
{
	unsigned int reg, val;
	int ret;

	if (output < 1 || output > MADERA_MAX_OUTPUT)
		return -EINVAL;

	reg = MADERA_OUTPUT_PATH_CONFIG_1L + (output - 1) * 8;

	if (diff)
		val = MADERA_OUT1_MONO;
	else
		val = 0;

	ret = snd_soc_update_bits(codec, reg, MADERA_OUT1_MONO, val);
	if (ret < 0)
		return ret;
	else
		return 0;
}
EXPORT_SYMBOL_GPL(madera_set_output_mode);

int madera_set_custom_jd(struct snd_soc_codec *codec,
			 const struct madera_jd_state *custom_jd,
			 unsigned int index)
{
	struct madera *madera = dev_get_drvdata(codec->dev->parent);

	if (index >= MADERA_MAX_ACCESSORY)
		return -EINVAL;

	madera->pdata.accdet[index].custom_jd = custom_jd;

	return 0;
}
EXPORT_SYMBOL_GPL(madera_set_custom_jd);

struct madera_extcon_info *
madera_get_extcon_info(struct snd_soc_codec *codec)
{
	struct madera *madera = dev_get_drvdata(codec->dev->parent);

	return madera->extcon_info;
}
EXPORT_SYMBOL_GPL(madera_get_extcon_info);

static int madera_set_force_bypass(struct snd_soc_codec *codec, bool set_bypass)
{
	struct madera *madera = dev_get_drvdata(codec->dev->parent);
	struct madera_micbias *micbias = madera->pdata.micbias;
	unsigned int i, cp_bypass = 0, micbias_bypass = 0;
	unsigned int num_micbiases;

	if (set_bypass) {
		cp_bypass = MADERA_CPMIC_BYPASS;
		micbias_bypass = MADERA_MICB1_BYPASS;
	}

	if (madera->micvdd_regulated) {
		if (set_bypass)
			snd_soc_dapm_disable_pin(madera->dapm, "MICSUPP");
		else
			snd_soc_dapm_force_enable_pin(madera->dapm, "MICSUPP");

		snd_soc_dapm_sync(madera->dapm);

		regmap_update_bits(madera->regmap,
				   MADERA_MIC_CHARGE_PUMP_1,
				   MADERA_CPMIC_BYPASS, cp_bypass);
	}

	madera_get_num_micbias(madera, &num_micbiases);

	for (i = 0; i < num_micbiases; i++) {
		if ((set_bypass) ||
			(!micbias[i].bypass && micbias[i].mV))
			regmap_update_bits(madera->regmap,
					   MADERA_MIC_BIAS_CTRL_1 + i,
					   MADERA_MICB1_BYPASS,
					   micbias_bypass);
	}

	return 0;
}

int madera_enable_force_bypass(struct snd_soc_codec *codec)
{
	return madera_set_force_bypass(codec, true);
}
EXPORT_SYMBOL_GPL(madera_enable_force_bypass);

int madera_disable_force_bypass(struct snd_soc_codec *codec)
{
	return madera_set_force_bypass(codec, false);
}
EXPORT_SYMBOL_GPL(madera_disable_force_bypass);

int madera_frf_bytes_put(struct snd_kcontrol *kcontrol,
			 struct snd_ctl_elem_value *ucontrol)
{
	struct soc_bytes *params = (void *)kcontrol->private_value;
	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct madera_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct madera *madera = priv->madera;
	int ret, len;
	void *data;

	len = params->num_regs * component->val_bytes;

	data = kmemdup(ucontrol->value.bytes.data, len, GFP_KERNEL | GFP_DMA);
	if (!data)
		return -ENOMEM;

	mutex_lock(&madera->reg_setting_lock);
	regmap_write(madera->regmap, 0x80, 0x3);

	ret = regmap_raw_write(madera->regmap, params->base, data, len);

	regmap_write(madera->regmap, 0x80, 0x0);
	mutex_unlock(&madera->reg_setting_lock);

	kfree(data);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_frf_bytes_put);

static bool madera_eq_filter_unstable(bool mode, __be16 _a, __be16 _b)
{
	s16 a = be16_to_cpu(_a);
	s16 b = be16_to_cpu(_b);

	if (!mode) {
		return abs(a) >= 4096;
	} else {
		if (abs(b) >= 4096)
			return true;

		return (abs((a << 16) / (4096 - b)) >= 4096 << 4);
	}
}

int madera_eq_coeff_put(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct madera *madera = dev_get_drvdata(codec->dev->parent);
	struct soc_bytes *params = (void *)kcontrol->private_value;
	unsigned int val;
	__be16 *data;
	int len;
	int ret;

	len = params->num_regs * regmap_get_val_bytes(madera->regmap);

	data = kmemdup(ucontrol->value.bytes.data, len, GFP_KERNEL | GFP_DMA);
	if (!data)
		return -ENOMEM;

	data[0] &= cpu_to_be16(MADERA_EQ1_B1_MODE);

	if (madera_eq_filter_unstable(!!data[0], data[1], data[2]) ||
	    madera_eq_filter_unstable(true, data[4], data[5]) ||
	    madera_eq_filter_unstable(true, data[8], data[9]) ||
	    madera_eq_filter_unstable(true, data[12], data[13]) ||
	    madera_eq_filter_unstable(false, data[16], data[17])) {
		dev_err(madera->dev, "Rejecting unstable EQ coefficients\n");
		ret = -EINVAL;
		goto out;
	}

	ret = regmap_read(madera->regmap, params->base, &val);
	if (ret != 0)
		goto out;

	val &= ~MADERA_EQ1_B1_MODE;
	data[0] |= cpu_to_be16(val);

	ret = regmap_raw_write(madera->regmap, params->base, data, len);

out:
	kfree(data);
	return ret;
}
EXPORT_SYMBOL_GPL(madera_eq_coeff_put);

int madera_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
			   struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
	struct madera *madera = dev_get_drvdata(codec->dev->parent);
	__be16 *data = (__be16 *)ucontrol->value.bytes.data;
	s16 val = be16_to_cpu(*data);

	if (abs(val) >= 4096) {
		dev_err(madera->dev, "Rejecting unstable LHPF coefficients\n");
		return -EINVAL;
	}

	return snd_soc_bytes_put(kcontrol, ucontrol);
}
EXPORT_SYMBOL_GPL(madera_lhpf_coeff_put);

int madera_register_notifier(struct snd_soc_codec *codec,
			     struct notifier_block *nb)
{
	struct madera *madera = dev_get_drvdata(codec->dev->parent);

	return blocking_notifier_chain_register(&madera->notifier, nb);
}
EXPORT_SYMBOL_GPL(madera_register_notifier);

int madera_unregister_notifier(struct snd_soc_codec *codec,
			       struct notifier_block *nb)
{
	struct madera *madera = dev_get_drvdata(codec->dev->parent);

	return blocking_notifier_chain_unregister(&madera->notifier, nb);
}
EXPORT_SYMBOL_GPL(madera_unregister_notifier);

struct regmap *madera_get_regmap_dsp(struct snd_soc_codec *codec)
{
	struct madera *madera = dev_get_drvdata(codec->dev->parent);

	return madera->regmap_32bit;
}
EXPORT_SYMBOL_GPL(madera_get_regmap_dsp);

MODULE_DESCRIPTION("ASoC Cirrus Logic Madera codec support");
MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.wolfsonmicro.com>");
MODULE_LICENSE("GPL v2");
