1
0
Fork 0

Merge remote-tracking branches 'asoc/topic/multi-codec', 'asoc/topic/mxs-saif', 'asoc/topic/mxs-sgtl5000', 'asoc/topic/omap' and 'asoc/topic/pxa' into asoc-next

hifive-unleashed-5.1
Mark Brown 2014-12-08 13:12:05 +00:00
10 changed files with 151 additions and 66 deletions

View File

@ -923,6 +923,14 @@ static void __init spitz_i2c_init(void)
static inline void spitz_i2c_init(void) {}
#endif
/******************************************************************************
* Audio devices
******************************************************************************/
static inline void spitz_audio_init(void)
{
platform_device_register_simple("spitz-audio", -1, NULL, 0);
}
/******************************************************************************
* Machine init
******************************************************************************/
@ -970,6 +978,7 @@ static void __init spitz_init(void)
spitz_nor_init();
spitz_nand_init();
spitz_i2c_init();
spitz_audio_init();
}
static void __init spitz_fixup(struct tag *tags, char **cmdline)

View File

@ -1496,6 +1496,9 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
struct device_node **framemaster);
int snd_soc_of_get_dai_name(struct device_node *of_node,
const char **dai_name);
int snd_soc_of_get_dai_link_codecs(struct device *dev,
struct device_node *of_node,
struct snd_soc_dai_link *dai_link);
#include <sound/soc-dai.h>

View File

@ -773,7 +773,7 @@ static int mxs_saif_probe(struct platform_device *pdev)
saif->dev = &pdev->dev;
ret = devm_request_irq(&pdev->dev, saif->irq, mxs_saif_irq, 0,
"mxs-saif", saif);
dev_name(&pdev->dev), saif);
if (ret) {
dev_err(&pdev->dev, "failed to request irq\n");
return ret;

View File

@ -49,13 +49,6 @@ static int mxs_sgtl5000_hw_params(struct snd_pcm_substream *substream,
break;
}
/* Sgtl5000 sysclk should be >= 8MHz and <= 27M */
if (mclk < 8000000 || mclk > 27000000) {
dev_err(codec_dai->dev, "Invalid mclk frequency: %u.%03uMHz\n",
mclk / 1000000, mclk / 1000 % 1000);
return -EINVAL;
}
/* Set SGTL5000's SYSCLK (provided by SAIF MCLK) */
ret = snd_soc_dai_set_sysclk(codec_dai, SGTL5000_SYSCLK, mclk, 0);
if (ret) {

View File

@ -25,15 +25,15 @@ config SND_OMAP_SOC_N810
Say Y if you want to add support for SoC audio on Nokia N810.
config SND_OMAP_SOC_RX51
tristate "SoC Audio support for Nokia RX-51"
depends on SND_OMAP_SOC && ARM && (MACH_NOKIA_RX51 || COMPILE_TEST) && I2C
tristate "SoC Audio support for Nokia N900 (RX-51)"
depends on SND_OMAP_SOC && ARM && I2C
select SND_OMAP_SOC_MCBSP
select SND_SOC_TLV320AIC3X
select SND_SOC_TPA6130A2
depends on GPIOLIB
help
Say Y if you want to add support for SoC audio on Nokia RX-51
hardware. This is also known as Nokia N900 product.
Say Y if you want to add support for SoC audio on Nokia N900
cellphone.
config SND_OMAP_SOC_AMS_DELTA
tristate "SoC Audio support for Amstrad E3 (Delta) videophone"

View File

@ -621,8 +621,7 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
mcbsp->reg_cache = NULL;
spin_unlock(&mcbsp->lock);
if (reg_cache)
kfree(reg_cache);
kfree(reg_cache);
}
/*

View File

@ -127,15 +127,12 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
unsigned short reg;
/* Prepare GPIO8 for rear speaker amplifier */
reg = codec->driver->read(codec, AC97_GPIO_CFG);
codec->driver->write(codec, AC97_GPIO_CFG, reg | 0x0100);
snd_soc_update_bits(codec, AC97_GPIO_CFG, 0x100, 0x100);
/* Prepare MIC input */
reg = codec->driver->read(codec, AC97_3D_CONTROL);
codec->driver->write(codec, AC97_3D_CONTROL, reg | 0xc000);
snd_soc_update_bits(codec, AC97_3D_CONTROL, 0xc000, 0xc000);
return 0;
}

View File

@ -97,7 +97,7 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
int ret = 0;
if (!cpu_dai->active) {
clk_enable(ssp->clk);
clk_prepare_enable(ssp->clk);
pxa_ssp_disable(ssp);
}
@ -121,7 +121,7 @@ static void pxa_ssp_shutdown(struct snd_pcm_substream *substream,
if (!cpu_dai->active) {
pxa_ssp_disable(ssp);
clk_disable(ssp->clk);
clk_disable_unprepare(ssp->clk);
}
kfree(snd_soc_dai_get_dma_data(cpu_dai, substream));
@ -136,7 +136,7 @@ static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai)
struct ssp_device *ssp = priv->ssp;
if (!cpu_dai->active)
clk_enable(ssp->clk);
clk_prepare_enable(ssp->clk);
priv->cr0 = __raw_readl(ssp->mmio_base + SSCR0);
priv->cr1 = __raw_readl(ssp->mmio_base + SSCR1);
@ -144,7 +144,7 @@ static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai)
priv->psp = __raw_readl(ssp->mmio_base + SSPSP);
pxa_ssp_disable(ssp);
clk_disable(ssp->clk);
clk_disable_unprepare(ssp->clk);
return 0;
}
@ -154,7 +154,7 @@ static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai)
struct ssp_device *ssp = priv->ssp;
uint32_t sssr = SSSR_ROR | SSSR_TUR | SSSR_BCE;
clk_enable(ssp->clk);
clk_prepare_enable(ssp->clk);
__raw_writel(sssr, ssp->mmio_base + SSSR);
__raw_writel(priv->cr0 & ~SSCR0_SSE, ssp->mmio_base + SSCR0);
@ -165,7 +165,7 @@ static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai)
if (cpu_dai->active)
pxa_ssp_enable(ssp);
else
clk_disable(ssp->clk);
clk_disable_unprepare(ssp->clk);
return 0;
}
@ -256,11 +256,11 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
/* The SSP clock must be disabled when changing SSP clock mode
* on PXA2xx. On PXA3xx it must be enabled when doing so. */
if (ssp->type != PXA3xx_SSP)
clk_disable(ssp->clk);
clk_disable_unprepare(ssp->clk);
val = pxa_ssp_read_reg(ssp, SSCR0) | sscr0;
pxa_ssp_write_reg(ssp, SSCR0, val);
if (ssp->type != PXA3xx_SSP)
clk_enable(ssp->clk);
clk_prepare_enable(ssp->clk);
return 0;
}

View File

@ -305,19 +305,15 @@ static struct snd_soc_card snd_soc_spitz = {
.num_dapm_routes = ARRAY_SIZE(spitz_audio_map),
};
static struct platform_device *spitz_snd_device;
static int __init spitz_init(void)
static int spitz_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &snd_soc_spitz;
int ret;
if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita()))
return -ENODEV;
if (machine_is_borzoi() || machine_is_spitz())
spitz_mic_gpio = SPITZ_GPIO_MIC_BIAS;
else
if (machine_is_akita())
spitz_mic_gpio = AKITA_GPIO_MIC_BIAS;
else
spitz_mic_gpio = SPITZ_GPIO_MIC_BIAS;
ret = gpio_request(spitz_mic_gpio, "MIC GPIO");
if (ret)
@ -327,37 +323,45 @@ static int __init spitz_init(void)
if (ret)
goto err2;
spitz_snd_device = platform_device_alloc("soc-audio", -1);
if (!spitz_snd_device) {
ret = -ENOMEM;
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
goto err2;
}
platform_set_drvdata(spitz_snd_device, &snd_soc_spitz);
ret = platform_device_add(spitz_snd_device);
if (ret)
goto err3;
return 0;
err3:
platform_device_put(spitz_snd_device);
err2:
gpio_free(spitz_mic_gpio);
err1:
return ret;
}
static void __exit spitz_exit(void)
static int spitz_remove(struct platform_device *pdev)
{
platform_device_unregister(spitz_snd_device);
struct snd_soc_card *card = platform_get_drvdata(pdev);
snd_soc_unregister_card(card);
gpio_free(spitz_mic_gpio);
return 0;
}
module_init(spitz_init);
module_exit(spitz_exit);
static struct platform_driver spitz_driver = {
.driver = {
.name = "spitz-audio",
.owner = THIS_MODULE,
.pm = &snd_soc_pm_ops,
},
.probe = spitz_probe,
.remove = spitz_remove,
};
module_platform_driver(spitz_driver);
MODULE_AUTHOR("Richard Purdie");
MODULE_DESCRIPTION("ALSA SoC Spitz");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:spitz-audio");

View File

@ -3400,36 +3400,30 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
}
EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
int snd_soc_of_get_dai_name(struct device_node *of_node,
const char **dai_name)
static int snd_soc_get_dai_name(struct of_phandle_args *args,
const char **dai_name)
{
struct snd_soc_component *pos;
struct of_phandle_args args;
int ret;
ret = of_parse_phandle_with_args(of_node, "sound-dai",
"#sound-dai-cells", 0, &args);
if (ret)
return ret;
ret = -EPROBE_DEFER;
int ret = -EPROBE_DEFER;
mutex_lock(&client_mutex);
list_for_each_entry(pos, &component_list, list) {
if (pos->dev->of_node != args.np)
if (pos->dev->of_node != args->np)
continue;
if (pos->driver->of_xlate_dai_name) {
ret = pos->driver->of_xlate_dai_name(pos, &args, dai_name);
ret = pos->driver->of_xlate_dai_name(pos,
args,
dai_name);
} else {
int id = -1;
switch (args.args_count) {
switch (args->args_count) {
case 0:
id = 0; /* same as dai_drv[0] */
break;
case 1:
id = args.args[0];
id = args->args[0];
break;
default:
/* not supported */
@ -3451,6 +3445,21 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
break;
}
mutex_unlock(&client_mutex);
return ret;
}
int snd_soc_of_get_dai_name(struct device_node *of_node,
const char **dai_name)
{
struct of_phandle_args args;
int ret;
ret = of_parse_phandle_with_args(of_node, "sound-dai",
"#sound-dai-cells", 0, &args);
if (ret)
return ret;
ret = snd_soc_get_dai_name(&args, dai_name);
of_node_put(args.np);
@ -3458,6 +3467,77 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
}
EXPORT_SYMBOL_GPL(snd_soc_of_get_dai_name);
/*
* snd_soc_of_get_dai_link_codecs - Parse a list of CODECs in the devicetree
* @dev: Card device
* @of_node: Device node
* @dai_link: DAI link
*
* Builds an array of CODEC DAI components from the DAI link property
* 'sound-dai'.
* The array is set in the DAI link and the number of DAIs is set accordingly.
* The device nodes in the array (of_node) must be dereferenced by the caller.
*
* Returns 0 for success
*/
int snd_soc_of_get_dai_link_codecs(struct device *dev,
struct device_node *of_node,
struct snd_soc_dai_link *dai_link)
{
struct of_phandle_args args;
struct snd_soc_dai_link_component *component;
char *name;
int index, num_codecs, ret;
/* Count the number of CODECs */
name = "sound-dai";
num_codecs = of_count_phandle_with_args(of_node, name,
"#sound-dai-cells");
if (num_codecs <= 0) {
if (num_codecs == -ENOENT)
dev_err(dev, "No 'sound-dai' property\n");
else
dev_err(dev, "Bad phandle in 'sound-dai'\n");
return num_codecs;
}
component = devm_kzalloc(dev,
sizeof *component * num_codecs,
GFP_KERNEL);
if (!component)
return -ENOMEM;
dai_link->codecs = component;
dai_link->num_codecs = num_codecs;
/* Parse the list */
for (index = 0, component = dai_link->codecs;
index < dai_link->num_codecs;
index++, component++) {
ret = of_parse_phandle_with_args(of_node, name,
"#sound-dai-cells",
index, &args);
if (ret)
goto err;
component->of_node = args.np;
ret = snd_soc_get_dai_name(&args, &component->dai_name);
if (ret < 0)
goto err;
}
return 0;
err:
for (index = 0, component = dai_link->codecs;
index < dai_link->num_codecs;
index++, component++) {
if (!component->of_node)
break;
of_node_put(component->of_node);
component->of_node = NULL;
}
dai_link->codecs = NULL;
dai_link->num_codecs = 0;
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_of_get_dai_link_codecs);
static int __init snd_soc_init(void)
{
#ifdef CONFIG_DEBUG_FS