Unverified Commit 1c8bc7b3 authored by Robert Jarzmik's avatar Robert Jarzmik Committed by Mark Brown
Browse files

ASoC: pxa: switch to new ac97 bus support



Switch to the new ac97 bus support in sound/ac97 instead of the legacy
snd_ac97 one.

Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8dcb0c90
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -31,7 +31,6 @@ endif # SND_ARM


config SND_PXA2XX_LIB
config SND_PXA2XX_LIB
	tristate
	tristate
	select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
	select SND_DMAENGINE_PCM
	select SND_DMAENGINE_PCM


config SND_PXA2XX_LIB_AC97
config SND_PXA2XX_LIB_AC97
+2 −3
Original line number Original line Diff line number Diff line
@@ -19,14 +19,13 @@ config SND_MMP_SOC


config SND_PXA2XX_AC97
config SND_PXA2XX_AC97
	tristate
	tristate
	select SND_AC97_CODEC


config SND_PXA2XX_SOC_AC97
config SND_PXA2XX_SOC_AC97
	tristate
	tristate
	select AC97_BUS
	select AC97_BUS_NEW
	select SND_PXA2XX_LIB
	select SND_PXA2XX_LIB
	select SND_PXA2XX_LIB_AC97
	select SND_PXA2XX_LIB_AC97
	select SND_SOC_AC97_BUS
	select SND_SOC_AC97_BUS_NEW


config SND_PXA2XX_SOC_I2S
config SND_PXA2XX_SOC_I2S
	select SND_PXA2XX_LIB
	select SND_PXA2XX_LIB
+25 −23
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/dmaengine.h>
#include <linux/dmaengine.h>
#include <linux/dma/pxa-dma.h>
#include <linux/dma/pxa-dma.h>


#include <sound/ac97/controller.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/ac97_codec.h>
#include <sound/ac97_codec.h>
#include <sound/soc.h>
#include <sound/soc.h>
@@ -27,43 +28,35 @@
#include <mach/regs-ac97.h>
#include <mach/regs-ac97.h>
#include <mach/audio.h>
#include <mach/audio.h>


static void pxa2xx_ac97_warm_reset(struct snd_ac97 *ac97)
static void pxa2xx_ac97_warm_reset(struct ac97_controller *adrv)
{
{
	pxa2xx_ac97_try_warm_reset();
	pxa2xx_ac97_try_warm_reset();


	pxa2xx_ac97_finish_reset();
	pxa2xx_ac97_finish_reset();
}
}


static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
static void pxa2xx_ac97_cold_reset(struct ac97_controller *adrv)
{
{
	pxa2xx_ac97_try_cold_reset();
	pxa2xx_ac97_try_cold_reset();


	pxa2xx_ac97_finish_reset();
	pxa2xx_ac97_finish_reset();
}
}


static unsigned short pxa2xx_ac97_legacy_read(struct snd_ac97 *ac97,
static int pxa2xx_ac97_read_actrl(struct ac97_controller *adrv, int slot,
				  unsigned short reg)
				  unsigned short reg)
{
{
	int ret;
	return pxa2xx_ac97_read(slot, reg);

	ret = pxa2xx_ac97_read(ac97->num, reg);
	if (ret < 0)
		return 0;
	else
		return (unsigned short)(ret & 0xffff);
}
}


static void pxa2xx_ac97_legacy_write(struct snd_ac97 *ac97,
static int pxa2xx_ac97_write_actrl(struct ac97_controller *adrv, int slot,
				   unsigned short reg, unsigned short val)
				   unsigned short reg, unsigned short val)
{
{
	int ret;
	return pxa2xx_ac97_write(slot, reg, val);

	ret = pxa2xx_ac97_write(ac97->num, reg, val);
}
}


static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
static struct ac97_controller_ops pxa2xx_ac97_ops = {
	.read	= pxa2xx_ac97_legacy_read,
	.read	= pxa2xx_ac97_read_actrl,
	.write	= pxa2xx_ac97_legacy_write,
	.write	= pxa2xx_ac97_write_actrl,
	.warm_reset	= pxa2xx_ac97_warm_reset,
	.warm_reset	= pxa2xx_ac97_warm_reset,
	.reset	= pxa2xx_ac97_cold_reset,
	.reset	= pxa2xx_ac97_cold_reset,
};
};
@@ -233,6 +226,9 @@ MODULE_DEVICE_TABLE(of, pxa2xx_ac97_dt_ids);
static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
{
{
	int ret;
	int ret;
	struct ac97_controller *ctrl;
	pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;
	void **codecs_pdata;


	if (pdev->id != -1) {
	if (pdev->id != -1) {
		dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n");
		dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n");
@@ -245,10 +241,14 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
		return ret;
		return ret;
	}
	}


	ret = snd_soc_set_ac97_ops(&pxa2xx_ac97_ops);
	codecs_pdata = pdata ? pdata->codec_pdata : NULL;
	if (ret != 0)
	ctrl = snd_ac97_controller_register(&pxa2xx_ac97_ops, &pdev->dev,
		return ret;
					    AC97_SLOTS_AVAILABLE_ALL,
					    codecs_pdata);
	if (IS_ERR(ctrl))
		return PTR_ERR(ctrl);


	platform_set_drvdata(pdev, ctrl);
	/* Punt most of the init to the SoC probe; we may need the machine
	/* Punt most of the init to the SoC probe; we may need the machine
	 * driver to do interesting things with the clocking to get us up
	 * driver to do interesting things with the clocking to get us up
	 * and running.
	 * and running.
@@ -259,8 +259,10 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)


static int pxa2xx_ac97_dev_remove(struct platform_device *pdev)
static int pxa2xx_ac97_dev_remove(struct platform_device *pdev)
{
{
	struct ac97_controller *ctrl = platform_get_drvdata(pdev);

	snd_soc_unregister_component(&pdev->dev);
	snd_soc_unregister_component(&pdev->dev);
	snd_soc_set_ac97_ops(NULL);
	snd_ac97_controller_unregister(ctrl);
	pxa2xx_ac97_hw_remove(pdev);
	pxa2xx_ac97_hw_remove(pdev);
	return 0;
	return 0;
}
}