1 // SPDX-License-Identifier: GPL-2.0-only
3 * simone.c -- ASoC audio for Simplemachines Sim.One board
5 * Copyright (c) 2010 Mika Westerberg
7 * Based on snappercl15 machine driver by Ryan Mallon.
10 #include <linux/init.h>
11 #include <linux/module.h>
12 #include <linux/platform_device.h>
13 #include <linux/soc/cirrus/ep93xx.h>
15 #include <sound/core.h>
16 #include <sound/pcm.h>
17 #include <sound/soc.h>
19 #include <asm/mach-types.h>
21 SND_SOC_DAILINK_DEFS(hifi
,
22 DAILINK_COMP_ARRAY(COMP_CPU("ep93xx-ac97")),
23 DAILINK_COMP_ARRAY(COMP_CODEC("ac97-codec", "ac97-hifi")),
24 DAILINK_COMP_ARRAY(COMP_PLATFORM("ep93xx-ac97")));
26 static struct snd_soc_dai_link simone_dai
= {
28 .stream_name
= "AC97 HiFi",
29 SND_SOC_DAILINK_REG(hifi
),
32 static struct snd_soc_card snd_soc_simone
= {
35 .dai_link
= &simone_dai
,
39 static struct platform_device
*simone_snd_ac97_device
;
41 static int simone_probe(struct platform_device
*pdev
)
43 struct snd_soc_card
*card
= &snd_soc_simone
;
46 simone_snd_ac97_device
= platform_device_register_simple("ac97-codec",
48 if (IS_ERR(simone_snd_ac97_device
))
49 return PTR_ERR(simone_snd_ac97_device
);
51 card
->dev
= &pdev
->dev
;
53 ret
= snd_soc_register_card(card
);
55 dev_err(&pdev
->dev
, "snd_soc_register_card() failed: %d\n",
57 platform_device_unregister(simone_snd_ac97_device
);
63 static int simone_remove(struct platform_device
*pdev
)
65 struct snd_soc_card
*card
= platform_get_drvdata(pdev
);
67 snd_soc_unregister_card(card
);
68 platform_device_unregister(simone_snd_ac97_device
);
73 static struct platform_driver simone_driver
= {
75 .name
= "simone-audio",
77 .probe
= simone_probe
,
78 .remove
= simone_remove
,
81 module_platform_driver(simone_driver
);
83 MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
84 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
85 MODULE_LICENSE("GPL");
86 MODULE_ALIAS("platform:simone-audio");