Commit a8ea54da authored by Mark Brown's avatar Mark Brown

Merge branch 'for-2.6.37' into HEAD

parents 11e16eb3 6424dca2
......@@ -58,7 +58,7 @@
(1000000000 / ((rate * 1000) / samples))
#define US_TO_SAMPLES(rate, us) \
(rate / (1000000 / us))
(rate / (1000000 / (us < 1000000 ? us : 1000000)))
#define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate) \
((samples * 5000) / ((burstrate * 5000) / (burstrate - playrate)))
......@@ -200,7 +200,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
u8 *value)
{
struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
int val;
int val, ret = 0;
*value = reg & 0xff;
......@@ -210,6 +210,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
if (val < 0) {
dev_err(codec->dev, "Read failed (%d)\n", val);
value[0] = dac33_read_reg_cache(codec, reg);
ret = val;
} else {
value[0] = val;
dac33_write_reg_cache(codec, reg, val);
......@@ -218,7 +219,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
value[0] = dac33_read_reg_cache(codec, reg);
}
return 0;
return ret;
}
static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
......@@ -329,13 +330,18 @@ static void dac33_init_chip(struct snd_soc_codec *codec)
dac33_read_reg_cache(codec, DAC33_LINER_TO_RLO_VOL));
}
static inline void dac33_read_id(struct snd_soc_codec *codec)
static inline int dac33_read_id(struct snd_soc_codec *codec)
{
int i, ret = 0;
u8 reg;
dac33_read(codec, DAC33_DEVICE_ID_MSB, &reg);
dac33_read(codec, DAC33_DEVICE_ID_LSB, &reg);
dac33_read(codec, DAC33_DEVICE_REV_ID, &reg);
for (i = 0; i < 3; i++) {
ret = dac33_read(codec, DAC33_DEVICE_ID_MSB + i, &reg);
if (ret < 0)
break;
}
return ret;
}
static inline void dac33_soft_power(struct snd_soc_codec *codec, int power)
......@@ -1076,6 +1082,9 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
/* Number of samples under i2c latency */
dac33->alarm_threshold = US_TO_SAMPLES(rate,
dac33->mode1_latency);
nsample_limit = DAC33_BUFFER_SIZE_SAMPLES -
dac33->alarm_threshold;
if (dac33->auto_fifo_config) {
if (period_size <= dac33->alarm_threshold)
/*
......@@ -1086,6 +1095,8 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
((dac33->alarm_threshold / period_size) +
(dac33->alarm_threshold % period_size ?
1 : 0));
else if (period_size > nsample_limit)
dac33->nsample = nsample_limit;
else
dac33->nsample = period_size;
} else {
......@@ -1097,8 +1108,7 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream)
*/
dac33->nsample_max = substream->runtime->buffer_size -
period_size;
nsample_limit = DAC33_BUFFER_SIZE_SAMPLES -
dac33->alarm_threshold;
if (dac33->nsample_max > nsample_limit)
dac33->nsample_max = nsample_limit;
......@@ -1414,9 +1424,15 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
dev_err(codec->dev, "Failed to power up codec: %d\n", ret);
goto err_power;
}
dac33_read_id(codec);
ret = dac33_read_id(codec);
dac33_hard_power(codec, 0);
if (ret < 0) {
dev_err(codec->dev, "Failed to read chip ID: %d\n", ret);
ret = -ENODEV;
goto err_power;
}
/* Check if the IRQ number is valid and request it */
if (dac33->irq >= 0) {
ret = request_irq(dac33->irq, dac33_interrupt_handler,
......
......@@ -119,13 +119,13 @@ static int tpa6130a2_power(int power)
{
struct tpa6130a2_data *data;
u8 val;
int ret;
int ret = 0;
BUG_ON(tpa6130a2_client == NULL);
data = i2c_get_clientdata(tpa6130a2_client);
mutex_lock(&data->mutex);
if (power) {
if (power && !data->power_state) {
/* Power on */
if (data->power_gpio >= 0)
gpio_set_value(data->power_gpio, 1);
......@@ -153,7 +153,7 @@ static int tpa6130a2_power(int power)
val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
val &= ~TPA6130A2_SWS;
tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
} else {
} else if (!power && data->power_state) {
/* set SWS */
val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
val |= TPA6130A2_SWS;
......
......@@ -3502,8 +3502,11 @@ static ssize_t wm8962_beep_set(struct device *dev,
{
struct wm8962_priv *wm8962 = dev_get_drvdata(dev);
long int time;
int ret;
strict_strtol(buf, 10, &time);
ret = strict_strtol(buf, 10, &time);
if (ret != 0)
return ret;
input_event(wm8962->beep, EV_SND, SND_TONE, time);
......
......@@ -34,8 +34,8 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret;
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
......@@ -79,10 +79,10 @@ static struct snd_soc_ops eukrea_tlv320_snd_ops = {
static struct snd_soc_dai_link eukrea_tlv320_dai = {
.name = "tlv320aic23",
.stream_name = "TLV320AIC23",
.codec_dai = "tlv320aic23-hifi",
.codec_dai_name = "tlv320aic23-hifi",
.platform_name = "imx-pcm-audio.0",
.codec_name = "tlv320aic23-codec.0-001a",
.cpu_dai = "imx-ssi.0",
.cpu_dai_name = "imx-ssi.0",
.ops = &eukrea_tlv320_snd_ops,
};
......
This diff is collapsed.
......@@ -439,7 +439,22 @@ void imx_pcm_free(struct snd_pcm *pcm)
}
EXPORT_SYMBOL_GPL(imx_pcm_free);
static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
{
struct imx_ssi *ssi = dev_get_drvdata(dai->dev);
uint32_t val;
snd_soc_dai_set_drvdata(dai, ssi);
val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) |
SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize);
writel(val, ssi->base + SSI_SFCSR);
return 0;
}
static struct snd_soc_dai_driver imx_ssi_dai = {
.probe = imx_ssi_dai_probe,
.playback = {
.channels_min = 2,
.channels_max = 2,
......@@ -455,20 +470,6 @@ static struct snd_soc_dai_driver imx_ssi_dai = {
.ops = &imx_ssi_pcm_dai_ops,
};
static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
{
struct imx_ssi *ssi = dev_get_drvdata(dai->dev);
uint32_t val;
snd_soc_dai_set_drvdata(dai, ssi);
val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) |
SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize);
writel(val, ssi->base + SSI_SFCSR);
return 0;
}
static struct snd_soc_dai_driver imx_ac97_dai = {
.probe = imx_ssi_dai_probe,
.ac97_control = 1,
......@@ -677,7 +678,17 @@ static int imx_ssi_probe(struct platform_device *pdev)
goto failed_register;
}
ssi->soc_platform_pdev = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
if (!ssi->soc_platform_pdev_fiq)
goto failed_pdev_fiq_alloc;
platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
ret = platform_device_add(ssi->soc_platform_pdev_fiq);
if (ret) {
dev_err(&pdev->dev, "failed to add platform device\n");
goto failed_pdev_fiq_add;
}
ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
if (!ssi->soc_platform_pdev)
goto failed_pdev_alloc;
platform_set_drvdata(ssi->soc_platform_pdev, ssi);
......@@ -692,6 +703,9 @@ static int imx_ssi_probe(struct platform_device *pdev)
failed_pdev_add:
platform_device_put(ssi->soc_platform_pdev);
failed_pdev_alloc:
failed_pdev_fiq_add:
platform_device_put(ssi->soc_platform_pdev_fiq);
failed_pdev_fiq_alloc:
snd_soc_unregister_dai(&pdev->dev);
failed_register:
failed_ac97:
......
......@@ -185,6 +185,9 @@
#define DRV_NAME "imx-ssi"
#include <linux/dmaengine.h>
#include <mach/dma.h>
struct imx_pcm_dma_params {
int dma;
unsigned long dma_addr;
......@@ -212,6 +215,7 @@ struct imx_ssi {
int enabled;
struct platform_device *soc_platform_pdev;
struct platform_device *soc_platform_pdev_fiq;
};
struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev,
......
......@@ -20,9 +20,6 @@
#include <sound/soc-dapm.h>
#include <asm/mach-types.h>
#include "../codecs/wm9712.h"
#include "imx-ssi.h"
static struct snd_soc_card imx_phycore;
static struct snd_soc_ops imx_phycore_hifi_ops = {
......@@ -41,7 +38,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
};
static struct snd_soc_card imx_phycore = {
.name = "PhyCORE-audio",
.name = "PhyCORE-ac97-audio",
.dai_link = imx_phycore_dai_ac97,
.num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
};
......
......@@ -3062,8 +3062,10 @@ int snd_soc_register_dais(struct device *dev,
for (i = 0; i < count; i++) {
dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL);
if (dai == NULL)
return -ENOMEM;
if (dai == NULL) {
ret = -ENOMEM;
goto err;
}
/* create DAI component name */
dai->name = fmt_multiple_name(dev, &dai_drv[i]);
......@@ -3282,9 +3284,6 @@ int snd_soc_register_codec(struct device *dev,
return 0;
error:
for (i--; i >= 0; i--)
snd_soc_unregister_dai(dev);
if (codec->reg_cache)
kfree(codec->reg_cache);
kfree(codec->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment