Skip to content

Commit

Permalink
Merge remote-tracking branches 'asoc/topic/ab8500', 'asoc/topic/adau1…
Browse files Browse the repository at this point in the history
…7x1', 'asoc/topic/ads117x', 'asoc/topic/adsp' and 'asoc/topic/arizona' into asoc-next
  • Loading branch information
broonie committed Mar 13, 2016
6 parents 17bcf09 + 22363e7 + aaf0f3a + 4f2bf0a + 5602a64 + 2595b7f commit 343b890
Show file tree
Hide file tree
Showing 20 changed files with 474 additions and 145 deletions.
24 changes: 24 additions & 0 deletions Documentation/devicetree/bindings/sound/adi,adau17x1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Analog Devices ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781

Required properties:

- compatible: Should contain one of the following:
"adi,adau1361"
"adi,adau1461"
"adi,adau1761"
"adi,adau1961"
"adi,adau1381"
"adi,adau1781"

- reg: The i2c address. Value depends on the state of ADDR0
and ADDR1, as wired in hardware.

Examples:
#include <dt-bindings/sound/adau17x1.h>

i2c_bus {
adau1361@38 {
compatible = "adi,adau1761";
reg = <0x38>;
};
};
11 changes: 11 additions & 0 deletions Documentation/devicetree/bindings/sound/ti,ads117x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Texas Intstruments ADS117x ADC

Required properties:

- compatible : "ti,ads1174" or "ti,ads1178"

Example:

ads1178 {
compatible = "ti,ads1178";
};
2 changes: 1 addition & 1 deletion include/linux/platform_data/adau17x1.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961/ADAU1781/ADAU1781 codecs
* Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781 codecs
*
* Copyright 2011-2014 Analog Devices Inc.
* Author: Lars-Peter Clausen <[email protected]>
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/ab8500-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,6 @@ static int ab8500_codec_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
"%s: ERROR: Unsupporter master mask 0x%x\n",
__func__, fmt & SND_SOC_DAIFMT_MASTER_MASK);
return -EINVAL;
break;
}

snd_soc_update_bits(codec, AB8500_DIGIFCONF3, mask, val);
Expand Down
14 changes: 13 additions & 1 deletion sound/soc/codecs/adau1761-i2c.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961 codec
* Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961 codec
*
* Copyright 2014 Analog Devices Inc.
* Author: Lars-Peter Clausen <[email protected]>
Expand Down Expand Up @@ -44,9 +44,21 @@ static const struct i2c_device_id adau1761_i2c_ids[] = {
};
MODULE_DEVICE_TABLE(i2c, adau1761_i2c_ids);

#if defined(CONFIG_OF)
static const struct of_device_id adau1761_i2c_dt_ids[] = {
{ .compatible = "adi,adau1361", },
{ .compatible = "adi,adau1461", },
{ .compatible = "adi,adau1761", },
{ .compatible = "adi,adau1961", },
{ },
};
MODULE_DEVICE_TABLE(of, adau1761_i2c_dt_ids);
#endif

static struct i2c_driver adau1761_i2c_driver = {
.driver = {
.name = "adau1761",
.of_match_table = of_match_ptr(adau1761_i2c_dt_ids),
},
.probe = adau1761_i2c_probe,
.remove = adau1761_i2c_remove,
Expand Down
14 changes: 13 additions & 1 deletion sound/soc/codecs/adau1761-spi.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961 codec
* Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961 codec
*
* Copyright 2014 Analog Devices Inc.
* Author: Lars-Peter Clausen <[email protected]>
Expand Down Expand Up @@ -61,9 +61,21 @@ static const struct spi_device_id adau1761_spi_id[] = {
};
MODULE_DEVICE_TABLE(spi, adau1761_spi_id);

#if defined(CONFIG_OF)
static const struct of_device_id adau1761_spi_dt_ids[] = {
{ .compatible = "adi,adau1361", },
{ .compatible = "adi,adau1461", },
{ .compatible = "adi,adau1761", },
{ .compatible = "adi,adau1961", },
{ },
};
MODULE_DEVICE_TABLE(of, adau1761_spi_dt_ids);
#endif

static struct spi_driver adau1761_spi_driver = {
.driver = {
.name = "adau1761",
.of_match_table = of_match_ptr(adau1761_spi_dt_ids),
},
.probe = adau1761_spi_probe,
.remove = adau1761_spi_remove,
Expand Down
10 changes: 9 additions & 1 deletion sound/soc/codecs/adau1761.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961 codec
* Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961 codec
*
* Copyright 2011-2013 Analog Devices Inc.
* Author: Lars-Peter Clausen <[email protected]>
Expand Down Expand Up @@ -456,13 +456,17 @@ static int adau1761_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
regcache_cache_only(adau->regmap, false);
regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL,
ADAU17X1_CLOCK_CONTROL_SYSCLK_EN,
ADAU17X1_CLOCK_CONTROL_SYSCLK_EN);
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF)
regcache_sync(adau->regmap);
break;
case SND_SOC_BIAS_OFF:
regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL,
ADAU17X1_CLOCK_CONTROL_SYSCLK_EN, 0);
regcache_cache_only(adau->regmap, true);
break;

}
Expand Down Expand Up @@ -783,6 +787,10 @@ int adau1761_probe(struct device *dev, struct regmap *regmap,
if (ret)
return ret;

/* Enable cache only mode as we could miss writes before bias level
* reaches standby and the core clock is enabled */
regcache_cache_only(regmap, true);

return snd_soc_register_codec(dev, &adau1761_codec_driver, dai_drv, 1);
}
EXPORT_SYMBOL_GPL(adau1761_probe);
Expand Down
10 changes: 10 additions & 0 deletions sound/soc/codecs/adau1781-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,19 @@ static const struct i2c_device_id adau1781_i2c_ids[] = {
};
MODULE_DEVICE_TABLE(i2c, adau1781_i2c_ids);

#if defined(CONFIG_OF)
static const struct of_device_id adau1781_i2c_dt_ids[] = {
{ .compatible = "adi,adau1381", },
{ .compatible = "adi,adau1781", },
{ },
};
MODULE_DEVICE_TABLE(of, adau1781_i2c_dt_ids);
#endif

static struct i2c_driver adau1781_i2c_driver = {
.driver = {
.name = "adau1781",
.of_match_table = of_match_ptr(adau1781_i2c_dt_ids),
},
.probe = adau1781_i2c_probe,
.remove = adau1781_i2c_remove,
Expand Down
10 changes: 10 additions & 0 deletions sound/soc/codecs/adau1781-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,19 @@ static const struct spi_device_id adau1781_spi_id[] = {
};
MODULE_DEVICE_TABLE(spi, adau1781_spi_id);

#if defined(CONFIG_OF)
static const struct of_device_id adau1781_spi_dt_ids[] = {
{ .compatible = "adi,adau1381", },
{ .compatible = "adi,adau1781", },
{ },
};
MODULE_DEVICE_TABLE(of, adau1781_spi_dt_ids);
#endif

static struct spi_driver adau1781_spi_driver = {
.driver = {
.name = "adau1781",
.of_match_table = of_match_ptr(adau1781_spi_dt_ids),
},
.probe = adau1781_spi_probe,
.remove = adau1781_spi_remove,
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/adau1781.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Driver for ADAU1781/ADAU1781 codec
* Driver for ADAU1381/ADAU1781 codec
*
* Copyright 2011-2013 Analog Devices Inc.
* Author: Lars-Peter Clausen <[email protected]>
Expand Down
12 changes: 12 additions & 0 deletions sound/soc/codecs/ads117x.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <sound/initval.h>
#include <sound/soc.h>

#include <linux/of.h>

#define ADS117X_RATES (SNDRV_PCM_RATE_8000_48000)
#define ADS117X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE)

Expand Down Expand Up @@ -75,9 +77,19 @@ static int ads117x_remove(struct platform_device *pdev)
return 0;
}

#if defined(CONFIG_OF)
static const struct of_device_id ads117x_dt_ids[] = {
{ .compatible = "ti,ads1174" },
{ .compatible = "ti,ads1178" },
{ },
};
MODULE_DEVICE_TABLE(of, ads117x_dt_ids);
#endif

static struct platform_driver ads117x_codec_driver = {
.driver = {
.name = "ads117x-codec",
.of_match_table = of_match_ptr(ads117x_dt_ids),
},

.probe = ads117x_probe,
Expand Down
71 changes: 21 additions & 50 deletions sound/soc/codecs/arizona.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,29 +1398,6 @@ static const int arizona_48k_bclk_rates[] = {
24576000,
};

static const unsigned int arizona_48k_rates[] = {
12000,
24000,
48000,
96000,
192000,
384000,
768000,
4000,
8000,
16000,
32000,
64000,
128000,
256000,
512000,
};

static const struct snd_pcm_hw_constraint_list arizona_48k_constraint = {
.count = ARRAY_SIZE(arizona_48k_rates),
.list = arizona_48k_rates,
};

static const int arizona_44k1_bclk_rates[] = {
-1,
44100,
Expand All @@ -1443,22 +1420,7 @@ static const int arizona_44k1_bclk_rates[] = {
22579200,
};

static const unsigned int arizona_44k1_rates[] = {
11025,
22050,
44100,
88200,
176400,
352800,
705600,
};

static const struct snd_pcm_hw_constraint_list arizona_44k1_constraint = {
.count = ARRAY_SIZE(arizona_44k1_rates),
.list = arizona_44k1_rates,
};

static int arizona_sr_vals[] = {
static const unsigned int arizona_sr_vals[] = {
0,
12000,
24000,
Expand All @@ -1485,13 +1447,21 @@ static int arizona_sr_vals[] = {
512000,
};

#define ARIZONA_48K_RATE_MASK 0x0F003E
#define ARIZONA_44K1_RATE_MASK 0x003E00
#define ARIZONA_RATE_MASK (ARIZONA_48K_RATE_MASK | ARIZONA_44K1_RATE_MASK)

static const struct snd_pcm_hw_constraint_list arizona_constraint = {
.count = ARRAY_SIZE(arizona_sr_vals),
.list = arizona_sr_vals,
};

static int arizona_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1];
const struct snd_pcm_hw_constraint_list *constraint;
unsigned int base_rate;

if (!substream->runtime)
Expand All @@ -1509,16 +1479,15 @@ static int arizona_startup(struct snd_pcm_substream *substream,
}

if (base_rate == 0)
return 0;

if (base_rate % 8000)
constraint = &arizona_44k1_constraint;
dai_priv->constraint.mask = ARIZONA_RATE_MASK;
else if (base_rate % 8000)
dai_priv->constraint.mask = ARIZONA_44K1_RATE_MASK;
else
constraint = &arizona_48k_constraint;
dai_priv->constraint.mask = ARIZONA_48K_RATE_MASK;

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

static void arizona_wm5102_set_dac_comp(struct snd_soc_codec *codec,
Expand Down Expand Up @@ -1911,6 +1880,7 @@ int arizona_init_dai(struct arizona_priv *priv, int id)
struct arizona_dai_priv *dai_priv = &priv->dai[id];

dai_priv->clk = ARIZONA_CLK_SYSCLK;
dai_priv->constraint = arizona_constraint;

return 0;
}
Expand Down Expand Up @@ -2179,11 +2149,12 @@ static int arizona_calc_fll(struct arizona_fll *fll,
return -EINVAL;
}

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

return 0;

Expand Down
4 changes: 3 additions & 1 deletion sound/soc/codecs/arizona.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#define ARIZONA_CLK_98MHZ 5
#define ARIZONA_CLK_147MHZ 6

#define ARIZONA_MAX_DAI 8
#define ARIZONA_MAX_DAI 10
#define ARIZONA_MAX_ADSP 4

#define ARIZONA_DVFS_SR1_RQ 0x001
Expand All @@ -68,6 +68,8 @@ struct wm_adsp;

struct arizona_dai_priv {
int clk;

struct snd_pcm_hw_constraint_list constraint;
};

struct arizona_priv {
Expand Down
Loading

0 comments on commit 343b890

Please sign in to comment.