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

Commit da644e2e authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branches 'asoc/topic/stac9766', 'asoc/topic/sti',...

Merge remote-tracking branches 'asoc/topic/stac9766', 'asoc/topic/sti', 'asoc/topic/sti-codec', 'asoc/topic/sunxi' and 'asoc/topic/tegra' into asoc-next
Loading
Loading
Loading
Loading
+63 −2
Original line number Diff line number Diff line
* Allwinner A10 Codec

Required properties:
- compatible: must be either "allwinner,sun4i-a10-codec" or
  "allwinner,sun7i-a20-codec"
- compatible: must be one of the following compatibles:
		- "allwinner,sun4i-a10-codec"
		- "allwinner,sun6i-a31-codec"
		- "allwinner,sun7i-a20-codec"
		- "allwinner,sun8i-a23-codec"
		- "allwinner,sun8i-h3-codec"
- reg: must contain the registers location and length
- interrupts: must contain the codec interrupt
- dmas: DMA channels for tx and rx dma. See the DMA client binding,
@@ -17,6 +21,43 @@ Required properties:
Optional properties:
- allwinner,pa-gpios: gpio to enable external amplifier

Required properties for the following compatibles:
		- "allwinner,sun6i-a31-codec"
		- "allwinner,sun8i-a23-codec"
		- "allwinner,sun8i-h3-codec"
- resets: phandle to the reset control for this device
- allwinner,audio-routing: A list of the connections between audio components.
			   Each entry is a pair of strings, the first being the
			   connection's sink, the second being the connection's
			   source. Valid names include:

			   Audio pins on the SoC:
			   "HP"
			   "HPCOM"
			   "LINEIN"
			   "LINEOUT"	(not on sun8i-a23)
			   "MIC1"
			   "MIC2"
			   "MIC3"	(sun6i-a31 only)

			   Microphone biases from the SoC:
			   "HBIAS"
			   "MBIAS"

			   Board connectors:
			   "Headphone"
			   "Headset Mic"
			   "Line In"
			   "Line Out"
			   "Mic"
			   "Speaker"

Required properties for the following compatibles:
		- "allwinner,sun8i-a23-codec"
		- "allwinner,sun8i-h3-codec"
- allwinner,codec-analog-controls: A phandle to the codec analog controls
				   block in the PRCM.

Example:
codec: codec@01c22c00 {
	#sound-dai-cells = <0>;
@@ -28,3 +69,23 @@ codec: codec@01c22c00 {
	dmas = <&dma 0 19>, <&dma 0 19>;
	dma-names = "rx", "tx";
};

codec: codec@01c22c00 {
	#sound-dai-cells = <0>;
	compatible = "allwinner,sun6i-a31-codec";
	reg = <0x01c22c00 0x98>;
	interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
	clocks = <&ccu CLK_APB1_CODEC>, <&ccu CLK_CODEC>;
	clock-names = "apb", "codec";
	resets = <&ccu RST_APB1_CODEC>;
	dmas = <&dma 15>, <&dma 15>;
	dma-names = "rx", "tx";
	allwinner,audio-routing =
		"Headphone", "HP",
		"Speaker", "LINEOUT",
		"LINEIN", "Line In",
		"MIC1",	"MBIAS",
		"MIC1", "Mic",
		"MIC2", "HBIAS",
		"MIC2", "Headset Mic";
};
+16 −0
Original line number Diff line number Diff line
* Allwinner Codec Analog Controls

Required properties:
- compatible: must be one of the following compatibles:
		- "allwinner,sun8i-a23-codec-analog"
		- "allwinner,sun8i-h3-codec-analog"

Required properties if not a sub-node of the PRCM node:
- reg: must contain the registers location and length

Example:
prcm: prcm@01f01400 {
	codec_analog: codec-analog {
		compatible = "allwinner,sun8i-a23-codec-analog";
	};
};
+72 −90
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/regmap.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
@@ -26,31 +27,56 @@
#include <sound/soc.h>
#include <sound/tlv.h>

#include "stac9766.h"

#define STAC9766_VENDOR_ID 0x83847666
#define STAC9766_VENDOR_ID_MASK 0xffffffff

/*
 * STAC9766 register cache
 */
static const u16 stac9766_reg[] = {
	0x6A90, 0x8000, 0x8000, 0x8000, /* 6 */
	0x0000, 0x0000, 0x8008, 0x8008, /* e */
	0x8808, 0x8808, 0x8808, 0x8808, /* 16 */
	0x8808, 0x0000, 0x8000, 0x0000, /* 1e */
	0x0000, 0x0000, 0x0000, 0x000f, /* 26 */
	0x0a05, 0x0400, 0xbb80, 0x0000, /* 2e */
	0x0000, 0xbb80, 0x0000, 0x0000, /* 36 */
	0x0000, 0x2000, 0x0000, 0x0100, /* 3e */
	0x0000, 0x0000, 0x0080, 0x0000, /* 46 */
	0x0000, 0x0000, 0x0003, 0xffff, /* 4e */
	0x0000, 0x0000, 0x0000, 0x0000, /* 56 */
	0x4000, 0x0000, 0x0000, 0x0000, /* 5e */
	0x1201, 0xFFFF, 0xFFFF, 0x0000, /* 66 */
	0x0000, 0x0000, 0x0000, 0x0000, /* 6e */
	0x0000, 0x0000, 0x0000, 0x0006, /* 76 */
	0x0000, 0x0000, 0x0000, 0x0000, /* 7e */
#define AC97_STAC_DA_CONTROL 0x6A
#define AC97_STAC_ANALOG_SPECIAL 0x6E
#define AC97_STAC_STEREO_MIC 0x78

static const struct reg_default stac9766_reg_defaults[] = {
	{ 0x02, 0x8000 },
	{ 0x04, 0x8000 },
	{ 0x06, 0x8000 },
	{ 0x0a, 0x0000 },
	{ 0x0c, 0x8008 },
	{ 0x0e, 0x8008 },
	{ 0x10, 0x8808 },
	{ 0x12, 0x8808 },
	{ 0x14, 0x8808 },
	{ 0x16, 0x8808 },
	{ 0x18, 0x8808 },
	{ 0x1a, 0x0000 },
	{ 0x1c, 0x8000 },
	{ 0x20, 0x0000 },
	{ 0x22, 0x0000 },
	{ 0x28, 0x0a05 },
	{ 0x2c, 0xbb80 },
	{ 0x32, 0xbb80 },
	{ 0x3a, 0x2000 },
	{ 0x3e, 0x0100 },
	{ 0x4c, 0x0300 },
	{ 0x4e, 0xffff },
	{ 0x50, 0x0000 },
	{ 0x52, 0x0000 },
	{ 0x54, 0x0000 },
	{ 0x6a, 0x0000 },
	{ 0x6e, 0x1000 },
	{ 0x72, 0x0000 },
	{ 0x78, 0x0000 },
};

static const struct regmap_config stac9766_regmap_config = {
	.reg_bits = 16,
	.reg_stride = 2,
	.val_bits = 16,
	.max_register = 0x78,
	.cache_type = REGCACHE_RBTREE,

	.volatile_reg = regmap_ac97_default_volatile,

	.reg_defaults = stac9766_reg_defaults,
	.num_reg_defaults = ARRAY_SIZE(stac9766_reg_defaults),
};

static const char *stac9766_record_mux[] = {"Mic", "CD", "Video", "AUX",
@@ -139,71 +165,22 @@ static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = {
	SOC_ENUM("Pop Bypass Mux", stac9766_popbypass_enum),
};

static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg,
			       unsigned int val)
{
	struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
	u16 *cache = codec->reg_cache;

	if (reg > AC97_STAC_PAGE0) {
		stac9766_ac97_write(codec, AC97_INT_PAGING, 0);
		soc_ac97_ops->write(ac97, reg, val);
		stac9766_ac97_write(codec, AC97_INT_PAGING, 1);
		return 0;
	}
	if (reg / 2 >= ARRAY_SIZE(stac9766_reg))
		return -EIO;

	soc_ac97_ops->write(ac97, reg, val);
	cache[reg / 2] = val;
	return 0;
}

static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec,
				       unsigned int reg)
{
	struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
	u16 val = 0, *cache = codec->reg_cache;

	if (reg > AC97_STAC_PAGE0) {
		stac9766_ac97_write(codec, AC97_INT_PAGING, 0);
		val = soc_ac97_ops->read(ac97, reg - AC97_STAC_PAGE0);
		stac9766_ac97_write(codec, AC97_INT_PAGING, 1);
		return val;
	}
	if (reg / 2 >= ARRAY_SIZE(stac9766_reg))
		return -EIO;

	if (reg == AC97_RESET || reg == AC97_GPIO_STATUS ||
		reg == AC97_INT_PAGING || reg == AC97_VENDOR_ID1 ||
		reg == AC97_VENDOR_ID2) {

		val = soc_ac97_ops->read(ac97, reg);
		return val;
	}
	return cache[reg / 2];
}

static int ac97_analog_prepare(struct snd_pcm_substream *substream,
			       struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct snd_pcm_runtime *runtime = substream->runtime;
	unsigned short reg, vra;

	vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
	unsigned short reg;

	vra |= 0x1; /* enable variable rate audio */
	vra &= ~0x4; /* disable SPDIF output */

	stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
	/* enable variable rate audio, disable SPDIF output */
	snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x1);

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
		reg = AC97_PCM_FRONT_DAC_RATE;
	else
		reg = AC97_PCM_LR_ADC_RATE;

	return stac9766_ac97_write(codec, reg, runtime->rate);
	return snd_soc_write(codec, reg, runtime->rate);
}

static int ac97_digital_prepare(struct snd_pcm_substream *substream,
@@ -211,18 +188,16 @@ static int ac97_digital_prepare(struct snd_pcm_substream *substream,
{
	struct snd_soc_codec *codec = dai->codec;
	struct snd_pcm_runtime *runtime = substream->runtime;
	unsigned short reg, vra;

	stac9766_ac97_write(codec, AC97_SPDIF, 0x2002);
	unsigned short reg;

	vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
	vra |= 0x5; /* Enable VRA and SPDIF out */
	snd_soc_write(codec, AC97_SPDIF, 0x2002);

	stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
	/* Enable VRA and SPDIF out */
	snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x5);

	reg = AC97_PCM_FRONT_DAC_RATE;

	return stac9766_ac97_write(codec, reg, runtime->rate);
	return snd_soc_write(codec, reg, runtime->rate);
}

static int stac9766_set_bias_level(struct snd_soc_codec *codec,
@@ -232,11 +207,11 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec,
	case SND_SOC_BIAS_ON: /* full On */
	case SND_SOC_BIAS_PREPARE: /* partial On */
	case SND_SOC_BIAS_STANDBY: /* Off, with power */
		stac9766_ac97_write(codec, AC97_POWERDOWN, 0x0000);
		snd_soc_write(codec, AC97_POWERDOWN, 0x0000);
		break;
	case SND_SOC_BIAS_OFF: /* Off, without power */
		/* disable everything including AC link */
		stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff);
		snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
		break;
	}
	return 0;
@@ -300,21 +275,34 @@ static struct snd_soc_dai_driver stac9766_dai[] = {
static int stac9766_codec_probe(struct snd_soc_codec *codec)
{
	struct snd_ac97 *ac97;
	struct regmap *regmap;
	int ret;

	ac97 = snd_soc_new_ac97_codec(codec, STAC9766_VENDOR_ID,
			STAC9766_VENDOR_ID_MASK);
	if (IS_ERR(ac97))
		return PTR_ERR(ac97);

	regmap = regmap_init_ac97(ac97, &stac9766_regmap_config);
	if (IS_ERR(regmap)) {
		ret = PTR_ERR(regmap);
		goto err_free_ac97;
	}

	snd_soc_codec_init_regmap(codec, regmap);
	snd_soc_codec_set_drvdata(codec, ac97);

	return 0;
err_free_ac97:
	snd_soc_free_ac97_codec(ac97);
	return ret;
}

static int stac9766_codec_remove(struct snd_soc_codec *codec)
{
	struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);

	snd_soc_codec_exit_regmap(codec);
	snd_soc_free_ac97_codec(ac97);
	return 0;
}
@@ -324,17 +312,11 @@ static struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
		.controls		= stac9766_snd_ac97_controls,
		.num_controls		= ARRAY_SIZE(stac9766_snd_ac97_controls),
	},
	.write = stac9766_ac97_write,
	.read = stac9766_ac97_read,
	.set_bias_level = stac9766_set_bias_level,
	.suspend_bias_off = true,
	.probe = stac9766_codec_probe,
	.remove = stac9766_codec_remove,
	.resume = stac9766_codec_resume,
	.reg_cache_size = ARRAY_SIZE(stac9766_reg),
	.reg_word_size = sizeof(u16),
	.reg_cache_step = 2,
	.reg_cache_default = stac9766_reg,
};

static int stac9766_probe(struct platform_device *pdev)

sound/soc/codecs/stac9766.h

deleted100644 → 0
+0 −17
Original line number Diff line number Diff line
/*
 * stac9766.h  --  STAC9766 Soc Audio driver
 */

#ifndef _STAC9766_H
#define _STAC9766_H

#define AC97_STAC_PAGE0 0x1000
#define AC97_STAC_DA_CONTROL (AC97_STAC_PAGE0 | 0x6A)
#define AC97_STAC_ANALOG_SPECIAL (AC97_STAC_PAGE0 | 0x6E)
#define AC97_STAC_STEREO_MIC 0x78

/* STAC9766 DAI ID's */
#define STAC9766_DAI_AC97_ANALOG		0
#define STAC9766_DAI_AC97_DIGITAL		1

#endif
+20 −159
Original line number Diff line number Diff line
@@ -14,28 +14,8 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>

/* chipID supported */
#define CHIPID_STIH416 0
#define CHIPID_STIH407 1

/* DAC definitions */

/* stih416 DAC registers */
/* sysconf 2517: Audio-DAC-Control */
#define STIH416_AUDIO_DAC_CTRL 0x00000814
/* sysconf 2519: Audio-Gue-Control */
#define STIH416_AUDIO_GLUE_CTRL 0x0000081C

#define STIH416_DAC_NOT_STANDBY	0x3
#define STIH416_DAC_SOFTMUTE	0x4
#define STIH416_DAC_ANA_NOT_PWR	0x5
#define STIH416_DAC_NOT_PNDBG	0x6

#define STIH416_DAC_NOT_STANDBY_MASK	BIT(STIH416_DAC_NOT_STANDBY)
#define STIH416_DAC_SOFTMUTE_MASK	BIT(STIH416_DAC_SOFTMUTE)
#define STIH416_DAC_ANA_NOT_PWR_MASK	BIT(STIH416_DAC_ANA_NOT_PWR)
#define STIH416_DAC_NOT_PNDBG_MASK	BIT(STIH416_DAC_NOT_PNDBG)

/* stih407 DAC registers */
/* sysconf 5041: Audio-Gue-Control */
#define STIH407_AUDIO_GLUE_CTRL 0x000000A4
@@ -63,14 +43,9 @@ enum {
	STI_SAS_DAI_ANALOG_OUT,
};

static const struct reg_default stih416_sas_reg_defaults[] = {
	{ STIH407_AUDIO_GLUE_CTRL, 0x00000040 },
	{ STIH407_AUDIO_DAC_CTRL, 0x000000000 },
};

static const struct reg_default stih407_sas_reg_defaults[] = {
	{ STIH416_AUDIO_DAC_CTRL, 0x000000000 },
	{ STIH416_AUDIO_GLUE_CTRL, 0x00000040 },
	{ STIH407_AUDIO_DAC_CTRL, 0x000000000 },
	{ STIH407_AUDIO_GLUE_CTRL, 0x00000040 },
};

struct sti_dac_audio {
@@ -89,7 +64,6 @@ struct sti_spdif_audio {

/* device data structure */
struct sti_sas_dev_data {
	const int chipid; /* IC version */
	const struct regmap_config *regmap;
	const struct snd_soc_dai_ops *dac_ops;  /* DAC function callbacks */
	const struct snd_soc_dapm_widget *dapm_widgets; /* dapms declaration */
@@ -150,13 +124,11 @@ static int sti_sas_init_sas_registers(struct snd_soc_codec *codec,
		ret = snd_soc_update_bits(codec, STIH407_AUDIO_GLUE_CTRL,
					  SPDIF_BIPHASE_IDLE_MASK, 0);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to update SPDIF registers");
		dev_err(codec->dev, "Failed to update SPDIF registers\n");
		return ret;
	}

	/* Init DAC configuration */
	switch (data->dev_data->chipid) {
	case CHIPID_STIH407:
	/* init configuration */
	ret =  snd_soc_update_bits(codec, STIH407_AUDIO_DAC_CTRL,
				   STIH407_DAC_STANDBY_MASK,
@@ -170,31 +142,9 @@ static int sti_sas_init_sas_registers(struct snd_soc_codec *codec,
		ret = snd_soc_update_bits(codec, STIH407_AUDIO_DAC_CTRL,
					  STIH407_DAC_SOFTMUTE_MASK,
					  STIH407_DAC_SOFTMUTE_MASK);
		break;
	case CHIPID_STIH416:
		ret =  snd_soc_update_bits(codec, STIH416_AUDIO_DAC_CTRL,
					   STIH416_DAC_NOT_STANDBY_MASK, 0);
		if (!ret)
			ret =  snd_soc_update_bits(codec,
						   STIH416_AUDIO_DAC_CTRL,
						   STIH416_DAC_ANA_NOT_PWR, 0);
		if (!ret)
			ret =  snd_soc_update_bits(codec,
						   STIH416_AUDIO_DAC_CTRL,
						   STIH416_DAC_NOT_PNDBG_MASK,
						   0);
		if (!ret)
			ret =  snd_soc_update_bits(codec,
						   STIH416_AUDIO_DAC_CTRL,
						   STIH416_DAC_SOFTMUTE_MASK,
						   STIH416_DAC_SOFTMUTE_MASK);
		break;
	default:
		return -EINVAL;
	}

	if (ret < 0) {
		dev_err(codec->dev, "Failed to update DAC registers");
		dev_err(codec->dev, "Failed to update DAC registers\n");
		return ret;
	}

@@ -217,37 +167,6 @@ static int sti_sas_dac_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
	return 0;
}

static int stih416_dac_probe(struct snd_soc_dai *dai)
{
	struct snd_soc_codec *codec = dai->codec;
	struct sti_sas_data *drvdata = dev_get_drvdata(codec->dev);
	struct sti_dac_audio *dac = &drvdata->dac;

	/* Get reset control */
	dac->rst = devm_reset_control_get(codec->dev, "dac_rst");
	if (IS_ERR(dac->rst)) {
		dev_err(dai->codec->dev,
			"%s: ERROR: DAC reset control not defined !\n",
			__func__);
		dac->rst = NULL;
		return -EFAULT;
	}
	/* Put the DAC into reset */
	reset_control_assert(dac->rst);

	return 0;
}

static const struct snd_soc_dapm_widget stih416_sas_dapm_widgets[] = {
	SND_SOC_DAPM_PGA("DAC bandgap", STIH416_AUDIO_DAC_CTRL,
			 STIH416_DAC_NOT_PNDBG_MASK, 0, NULL, 0),
	SND_SOC_DAPM_OUT_DRV("DAC standby ana", STIH416_AUDIO_DAC_CTRL,
			     STIH416_DAC_ANA_NOT_PWR, 0, NULL, 0),
	SND_SOC_DAPM_DAC("DAC standby",  "dac_p", STIH416_AUDIO_DAC_CTRL,
			 STIH416_DAC_NOT_STANDBY, 0),
	SND_SOC_DAPM_OUTPUT("DAC Output"),
};

static const struct snd_soc_dapm_widget stih407_sas_dapm_widgets[] = {
	SND_SOC_DAPM_OUT_DRV("DAC standby ana", STIH407_AUDIO_DAC_CTRL,
			     STIH407_DAC_STANDBY_ANA, 1, NULL, 0),
@@ -256,30 +175,11 @@ static const struct snd_soc_dapm_widget stih407_sas_dapm_widgets[] = {
	SND_SOC_DAPM_OUTPUT("DAC Output"),
};

static const struct snd_soc_dapm_route stih416_sas_route[] = {
	{"DAC Output", NULL, "DAC bandgap"},
	{"DAC Output", NULL, "DAC standby ana"},
	{"DAC standby ana", NULL, "DAC standby"},
};

static const struct snd_soc_dapm_route stih407_sas_route[] = {
	{"DAC Output", NULL, "DAC standby ana"},
	{"DAC standby ana", NULL, "DAC standby"},
};

static int stih416_sas_dac_mute(struct snd_soc_dai *dai, int mute, int stream)
{
	struct snd_soc_codec *codec = dai->codec;

	if (mute) {
		return snd_soc_update_bits(codec, STIH416_AUDIO_DAC_CTRL,
					    STIH416_DAC_SOFTMUTE_MASK,
					    STIH416_DAC_SOFTMUTE_MASK);
	} else {
		return snd_soc_update_bits(codec, STIH416_AUDIO_DAC_CTRL,
					    STIH416_DAC_SOFTMUTE_MASK, 0);
	}
}

static int stih407_sas_dac_mute(struct snd_soc_dai *dai, int mute, int stream)
{
@@ -392,13 +292,13 @@ static int sti_sas_prepare(struct snd_pcm_substream *substream,
	switch (dai->id) {
	case STI_SAS_DAI_SPDIF_OUT:
		if ((drvdata->spdif.mclk / runtime->rate) != 128) {
			dev_err(codec->dev, "unexpected mclk-fs ratio");
			dev_err(codec->dev, "unexpected mclk-fs ratio\n");
			return -EINVAL;
		}
		break;
	case STI_SAS_DAI_ANALOG_OUT:
		if ((drvdata->dac.mclk / runtime->rate) != 256) {
			dev_err(codec->dev, "unexpected mclk-fs ratio");
			dev_err(codec->dev, "unexpected mclk-fs ratio\n");
			return -EINVAL;
		}
		break;
@@ -407,13 +307,6 @@ static int sti_sas_prepare(struct snd_pcm_substream *substream,
	return 0;
}

static const struct snd_soc_dai_ops stih416_dac_ops = {
	.set_fmt = sti_sas_dac_set_fmt,
	.mute_stream = stih416_sas_dac_mute,
	.prepare = sti_sas_prepare,
	.set_sysclk = sti_sas_set_sysclk,
};

static const struct snd_soc_dai_ops stih407_dac_ops = {
	.set_fmt = sti_sas_dac_set_fmt,
	.mute_stream = stih407_sas_dac_mute,
@@ -434,31 +327,7 @@ static const struct regmap_config stih407_sas_regmap = {
	.reg_write = sti_sas_write_reg,
};

static const struct regmap_config stih416_sas_regmap = {
	.reg_bits = 32,
	.val_bits = 32,

	.max_register = STIH416_AUDIO_DAC_CTRL,
	.reg_defaults = stih416_sas_reg_defaults,
	.num_reg_defaults = ARRAY_SIZE(stih416_sas_reg_defaults),
	.volatile_reg = sti_sas_volatile_register,
	.cache_type = REGCACHE_RBTREE,
	.reg_read = sti_sas_read_reg,
	.reg_write = sti_sas_write_reg,
};

static const struct sti_sas_dev_data stih416_data = {
	.chipid = CHIPID_STIH416,
	.regmap = &stih416_sas_regmap,
	.dac_ops = &stih416_dac_ops,
	.dapm_widgets = stih416_sas_dapm_widgets,
	.num_dapm_widgets = ARRAY_SIZE(stih416_sas_dapm_widgets),
	.dapm_routes =	stih416_sas_route,
	.num_dapm_routes = ARRAY_SIZE(stih416_sas_route),
};

static const struct sti_sas_dev_data stih407_data = {
	.chipid = CHIPID_STIH407,
	.regmap = &stih407_sas_regmap,
	.dac_ops = &stih407_dac_ops,
	.dapm_widgets = stih407_sas_dapm_widgets,
@@ -532,10 +401,6 @@ static struct snd_soc_codec_driver sti_sas_driver = {
};

static const struct of_device_id sti_sas_dev_match[] = {
	{
		.compatible = "st,stih416-sas-codec",
		.data = &stih416_data,
	},
	{
		.compatible = "st,stih407-sas-codec",
		.data = &stih407_data,
@@ -558,7 +423,7 @@ static int sti_sas_driver_probe(struct platform_device *pdev)
	/* Populate data structure depending on compatibility */
	of_id = of_match_node(sti_sas_dev_match, pnode);
	if (!of_id->data) {
		dev_err(&pdev->dev, "data associated to device is missing");
		dev_err(&pdev->dev, "data associated to device is missing\n");
		return -EINVAL;
	}

@@ -584,10 +449,6 @@ static int sti_sas_driver_probe(struct platform_device *pdev)
	}
	drvdata->spdif.regmap = drvdata->dac.regmap;

	/* Set DAC dai probe */
	if (drvdata->dev_data->chipid == CHIPID_STIH416)
		sti_sas_dai[STI_SAS_DAI_ANALOG_OUT].probe = stih416_dac_probe;

	sti_sas_dai[STI_SAS_DAI_ANALOG_OUT].ops = drvdata->dev_data->dac_ops;

	/* Set dapms*/
Loading