Skip to content

Commit 1c8bc7b

Browse files
rjarzmikbroonie
authored andcommitted
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: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8dcb0c9 commit 1c8bc7b

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

sound/arm/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ endif # SND_ARM
3131

3232
config SND_PXA2XX_LIB
3333
tristate
34-
select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
3534
select SND_DMAENGINE_PCM
3635

3736
config SND_PXA2XX_LIB_AC97

sound/soc/pxa/Kconfig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ config SND_MMP_SOC
1919

2020
config SND_PXA2XX_AC97
2121
tristate
22-
select SND_AC97_CODEC
2322

2423
config SND_PXA2XX_SOC_AC97
2524
tristate
26-
select AC97_BUS
25+
select AC97_BUS_NEW
2726
select SND_PXA2XX_LIB
2827
select SND_PXA2XX_LIB_AC97
29-
select SND_SOC_AC97_BUS
28+
select SND_SOC_AC97_BUS_NEW
3029

3130
config SND_PXA2XX_SOC_I2S
3231
select SND_PXA2XX_LIB

sound/soc/pxa/pxa2xx-ac97.c

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/dmaengine.h>
1818
#include <linux/dma/pxa-dma.h>
1919

20+
#include <sound/ac97/controller.h>
2021
#include <sound/core.h>
2122
#include <sound/ac97_codec.h>
2223
#include <sound/soc.h>
@@ -27,43 +28,35 @@
2728
#include <mach/regs-ac97.h>
2829
#include <mach/audio.h>
2930

30-
static void pxa2xx_ac97_warm_reset(struct snd_ac97 *ac97)
31+
static void pxa2xx_ac97_warm_reset(struct ac97_controller *adrv)
3132
{
3233
pxa2xx_ac97_try_warm_reset();
3334

3435
pxa2xx_ac97_finish_reset();
3536
}
3637

37-
static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
38+
static void pxa2xx_ac97_cold_reset(struct ac97_controller *adrv)
3839
{
3940
pxa2xx_ac97_try_cold_reset();
4041

4142
pxa2xx_ac97_finish_reset();
4243
}
4344

44-
static unsigned short pxa2xx_ac97_legacy_read(struct snd_ac97 *ac97,
45-
unsigned short reg)
45+
static int pxa2xx_ac97_read_actrl(struct ac97_controller *adrv, int slot,
46+
unsigned short reg)
4647
{
47-
int ret;
48-
49-
ret = pxa2xx_ac97_read(ac97->num, reg);
50-
if (ret < 0)
51-
return 0;
52-
else
53-
return (unsigned short)(ret & 0xffff);
48+
return pxa2xx_ac97_read(slot, reg);
5449
}
5550

56-
static void pxa2xx_ac97_legacy_write(struct snd_ac97 *ac97,
57-
unsigned short reg, unsigned short val)
51+
static int pxa2xx_ac97_write_actrl(struct ac97_controller *adrv, int slot,
52+
unsigned short reg, unsigned short val)
5853
{
59-
int ret;
60-
61-
ret = pxa2xx_ac97_write(ac97->num, reg, val);
54+
return pxa2xx_ac97_write(slot, reg, val);
6255
}
6356

64-
static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
65-
.read = pxa2xx_ac97_legacy_read,
66-
.write = pxa2xx_ac97_legacy_write,
57+
static struct ac97_controller_ops pxa2xx_ac97_ops = {
58+
.read = pxa2xx_ac97_read_actrl,
59+
.write = pxa2xx_ac97_write_actrl,
6760
.warm_reset = pxa2xx_ac97_warm_reset,
6861
.reset = pxa2xx_ac97_cold_reset,
6962
};
@@ -233,6 +226,9 @@ MODULE_DEVICE_TABLE(of, pxa2xx_ac97_dt_ids);
233226
static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
234227
{
235228
int ret;
229+
struct ac97_controller *ctrl;
230+
pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;
231+
void **codecs_pdata;
236232

237233
if (pdev->id != -1) {
238234
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)
245241
return ret;
246242
}
247243

248-
ret = snd_soc_set_ac97_ops(&pxa2xx_ac97_ops);
249-
if (ret != 0)
250-
return ret;
244+
codecs_pdata = pdata ? pdata->codec_pdata : NULL;
245+
ctrl = snd_ac97_controller_register(&pxa2xx_ac97_ops, &pdev->dev,
246+
AC97_SLOTS_AVAILABLE_ALL,
247+
codecs_pdata);
248+
if (IS_ERR(ctrl))
249+
return PTR_ERR(ctrl);
251250

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

260260
static int pxa2xx_ac97_dev_remove(struct platform_device *pdev)
261261
{
262+
struct ac97_controller *ctrl = platform_get_drvdata(pdev);
263+
262264
snd_soc_unregister_component(&pdev->dev);
263-
snd_soc_set_ac97_ops(NULL);
265+
snd_ac97_controller_unregister(ctrl);
264266
pxa2xx_ac97_hw_remove(pdev);
265267
return 0;
266268
}

0 commit comments

Comments
 (0)