blob: eaa2ea0e3f8115eb03bc864708f24a14f20b4d46 [file] [log] [blame]
Ricardo Neri55b95e02011-06-02 15:44:46 -05001/*
Ricardo Neriaff48332012-05-18 01:42:42 -05002 * omap-hdmi-card.c
Ricardo Neri55b95e02011-06-02 15:44:46 -05003 *
Ricardo Neriaff48332012-05-18 01:42:42 -05004 * OMAP ALSA SoC machine driver for TI OMAP HDMI
Ricardo Neri55b95e02011-06-02 15:44:46 -05005 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 * Author: Ricardo Neri <ricardo.neri@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
Paul Gortmakerda155d52011-07-15 12:38:28 -040024#include <linux/module.h>
Ricardo Neri55b95e02011-06-02 15:44:46 -050025#include <sound/pcm.h>
26#include <sound/soc.h>
27#include <asm/mach-types.h>
28#include <video/omapdss.h>
29
Ricardo Nerie412ec62012-05-18 01:42:34 -050030#define DRV_NAME "omap-hdmi-audio"
Ricardo Neri55b95e02011-06-02 15:44:46 -050031
Ricardo Neriaff48332012-05-18 01:42:42 -050032static struct snd_soc_dai_link omap_hdmi_dai = {
Ricardo Neri55b95e02011-06-02 15:44:46 -050033 .name = "HDMI",
34 .stream_name = "HDMI",
Ricardo Nerie412ec62012-05-18 01:42:34 -050035 .cpu_dai_name = "omap-hdmi-audio-dai",
Ricardo Neri55b95e02011-06-02 15:44:46 -050036 .platform_name = "omap-pcm-audio",
Ricardo Nerie412ec62012-05-18 01:42:34 -050037 .codec_name = "hdmi-audio-codec",
38 .codec_dai_name = "omap-hdmi-hifi",
Ricardo Neri55b95e02011-06-02 15:44:46 -050039};
40
Ricardo Neriaff48332012-05-18 01:42:42 -050041static struct snd_soc_card snd_soc_omap_hdmi = {
42 .name = "OMAPHDMI",
Axel Linb425b882011-12-22 11:08:59 +080043 .owner = THIS_MODULE,
Ricardo Neriaff48332012-05-18 01:42:42 -050044 .dai_link = &omap_hdmi_dai,
Ricardo Neri55b95e02011-06-02 15:44:46 -050045 .num_links = 1,
46};
47
Ricardo Neriaff48332012-05-18 01:42:42 -050048static __devinit int omap_hdmi_probe(struct platform_device *pdev)
Ricardo Neri55b95e02011-06-02 15:44:46 -050049{
Ricardo Neriaff48332012-05-18 01:42:42 -050050 struct snd_soc_card *card = &snd_soc_omap_hdmi;
Ricardo Neri55b95e02011-06-02 15:44:46 -050051 int ret;
52
53 card->dev = &pdev->dev;
54
55 ret = snd_soc_register_card(card);
56 if (ret) {
57 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
58 card->dev = NULL;
59 return ret;
60 }
61 return 0;
62}
63
Ricardo Neriaff48332012-05-18 01:42:42 -050064static int __devexit omap_hdmi_remove(struct platform_device *pdev)
Ricardo Neri55b95e02011-06-02 15:44:46 -050065{
66 struct snd_soc_card *card = platform_get_drvdata(pdev);
67
68 snd_soc_unregister_card(card);
69 card->dev = NULL;
70 return 0;
71}
72
Ricardo Neriaff48332012-05-18 01:42:42 -050073static struct platform_driver omap_hdmi_driver = {
Ricardo Neri55b95e02011-06-02 15:44:46 -050074 .driver = {
Ricardo Nerie412ec62012-05-18 01:42:34 -050075 .name = DRV_NAME,
Ricardo Neri55b95e02011-06-02 15:44:46 -050076 .owner = THIS_MODULE,
77 },
Ricardo Neriaff48332012-05-18 01:42:42 -050078 .probe = omap_hdmi_probe,
79 .remove = __devexit_p(omap_hdmi_remove),
Ricardo Neri55b95e02011-06-02 15:44:46 -050080};
81
Ricardo Neriaff48332012-05-18 01:42:42 -050082module_platform_driver(omap_hdmi_driver);
Ricardo Neri55b95e02011-06-02 15:44:46 -050083
84MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
Ricardo Neriaff48332012-05-18 01:42:42 -050085MODULE_DESCRIPTION("OMAP HDMI machine ASoC driver");
Ricardo Neri55b95e02011-06-02 15:44:46 -050086MODULE_LICENSE("GPL");
87MODULE_ALIAS("platform:" DRV_NAME);