Ejemplo n.º 1
0
static int __devexit bfin_tdm_remove(struct platform_device *pdev)
{
	struct sport_device *sport_handle = platform_get_drvdata(pdev);

	snd_soc_unregister_dai(&pdev->dev);
	sport_done(sport_handle);

	return 0;
}
Ejemplo n.º 2
0
static int __devexit bf5xx_i2s_remove(struct platform_device *pdev)
{
	struct sport_device *sport_handle = platform_get_drvdata(pdev);

	pr_debug("%s enter\n", __func__);

	snd_soc_unregister_dai(&pdev->dev);
	sport_done(sport_handle);

	return 0;
}
Ejemplo n.º 3
0
static int __devexit asoc_bfin_ac97_remove(struct platform_device *pdev)
{
	struct sport_device *sport_handle = platform_get_drvdata(pdev);

	snd_soc_unregister_dai(&pdev->dev);
	sport_done(sport_handle);
#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
	gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
#endif

	return 0;
}
Ejemplo n.º 4
0
static int __devinit bfin_tdm_probe(struct platform_device *pdev)
{
	struct sport_device *sport_handle;
	int ret;

	/* configure SPORT for TDM */
	sport_handle = sport_init(pdev, 4, 8 * sizeof(u32),
		sizeof(struct bf5xx_tdm_port));
	if (!sport_handle)
		return -ENODEV;

	/* SPORT works in TDM mode */
	ret = sport_set_multichannel(sport_handle, 8, 0xFF, 1);
	if (ret) {
		pr_err("SPORT is busy!\n");
		ret = -EBUSY;
		goto sport_config_err;
	}

	ret = sport_config_rx(sport_handle, 0, 0x1F, 0, 0);
	if (ret) {
		pr_err("SPORT is busy!\n");
		ret = -EBUSY;
		goto sport_config_err;
	}

	ret = sport_config_tx(sport_handle, 0, 0x1F, 0, 0);
	if (ret) {
		pr_err("SPORT is busy!\n");
		ret = -EBUSY;
		goto sport_config_err;
	}

	ret = snd_soc_register_dai(&pdev->dev, &bf5xx_tdm_dai);
	if (ret) {
		pr_err("Failed to register DAI: %d\n", ret);
		goto sport_config_err;
	}

	return 0;

sport_config_err:
	sport_done(sport_handle);
	return ret;
}
Ejemplo n.º 5
0
static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
{
	struct snd_pcm_substream *substream;
	struct snd_dma_buffer *buf;
	int stream;

	for (stream = 0; stream < 2; stream++) {
		substream = pcm->streams[stream].substream;
		if (!substream)
			continue;

		buf = &substream->dma_buffer;
		if (!buf->area)
			continue;
		dma_free_coherent(NULL, buf->bytes, buf->area, 0);
		buf->area = NULL;
	}
	if (sport_handle)
		sport_done(sport_handle);
}
Ejemplo n.º 6
0
static int __devinit bf5xx_i2s_probe(struct platform_device *pdev)
{
	struct sport_device *sport_handle;
	int ret;

	/* configure SPORT for I2S */
	sport_handle = sport_init(pdev, 4, 2 * sizeof(u32),
		sizeof(struct bf5xx_i2s_port));
	if (!sport_handle)
		return -ENODEV;

	/* register with the ASoC layers */
	ret = snd_soc_register_dai(&pdev->dev, &bf5xx_i2s_dai);
	if (ret) {
		pr_err("Failed to register DAI: %d\n", ret);
		sport_done(sport_handle);
		return ret;
	}

	return 0;
}
Ejemplo n.º 7
0
static int __devinit asoc_bfin_ac97_probe(struct platform_device *pdev)
{
	struct sport_device *sport_handle;
	int ret;

#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
	/* Request PB3 as reset pin */
	if (gpio_request(CONFIG_SND_BF5XX_RESET_GPIO_NUM, "SND_AD198x RESET")) {
		pr_err("Failed to request GPIO_%d for reset\n",
				CONFIG_SND_BF5XX_RESET_GPIO_NUM);
		ret =  -1;
		goto gpio_err;
	}
	gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1);
#endif

	sport_handle = sport_init(pdev, 2, sizeof(struct ac97_frame),
		PAGE_SIZE);
	if (!sport_handle) {
		ret = -ENODEV;
		goto sport_err;
	}

	/*SPORT works in TDM mode to simulate AC97 transfers*/
#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
	ret = sport_set_multichannel(sport_handle, 16, 0x3FF, 1);
#else
	ret = sport_set_multichannel(sport_handle, 16, 0x1F, 1);
#endif
	if (ret) {
		pr_err("SPORT is busy!\n");
		ret = -EBUSY;
		goto sport_config_err;
	}

	ret = sport_config_rx(sport_handle, IRFS, 0xF, 0, (16*16-1));
	if (ret) {
		pr_err("SPORT is busy!\n");
		ret = -EBUSY;
		goto sport_config_err;
	}

	ret = sport_config_tx(sport_handle, ITFS, 0xF, 0, (16*16-1));
	if (ret) {
		pr_err("SPORT is busy!\n");
		ret = -EBUSY;
		goto sport_config_err;
	}

	ret = snd_soc_register_dai(&pdev->dev, &bfin_ac97_dai);
	if (ret) {
		pr_err("Failed to register DAI: %d\n", ret);
		goto sport_config_err;
	}

	ac97_sport_handle = sport_handle;

	return 0;

sport_config_err:
	sport_done(sport_handle);
sport_err:
#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
	gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
gpio_err:
#endif

	return ret;
}