Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 1 | /* |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 2 | * omap-hdmi-card.c |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 3 | * |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 4 | * OMAP ALSA SoC machine driver for TI OMAP HDMI |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 5 | * 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 Gortmaker | da155d5 | 2011-07-15 12:38:28 -0400 | [diff] [blame] | 24 | #include <linux/module.h> |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 25 | #include <sound/pcm.h> |
| 26 | #include <sound/soc.h> |
| 27 | #include <asm/mach-types.h> |
| 28 | #include <video/omapdss.h> |
| 29 | |
Ricardo Neri | e412ec6 | 2012-05-18 01:42:34 -0500 | [diff] [blame] | 30 | #define DRV_NAME "omap-hdmi-audio" |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 31 | |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 32 | static struct snd_soc_dai_link omap_hdmi_dai = { |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 33 | .name = "HDMI", |
| 34 | .stream_name = "HDMI", |
Ricardo Neri | e412ec6 | 2012-05-18 01:42:34 -0500 | [diff] [blame] | 35 | .cpu_dai_name = "omap-hdmi-audio-dai", |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 36 | .platform_name = "omap-pcm-audio", |
Ricardo Neri | e412ec6 | 2012-05-18 01:42:34 -0500 | [diff] [blame] | 37 | .codec_name = "hdmi-audio-codec", |
| 38 | .codec_dai_name = "omap-hdmi-hifi", |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 39 | }; |
| 40 | |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 41 | static struct snd_soc_card snd_soc_omap_hdmi = { |
| 42 | .name = "OMAPHDMI", |
Axel Lin | b425b88 | 2011-12-22 11:08:59 +0800 | [diff] [blame] | 43 | .owner = THIS_MODULE, |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 44 | .dai_link = &omap_hdmi_dai, |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 45 | .num_links = 1, |
| 46 | }; |
| 47 | |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 48 | static __devinit int omap_hdmi_probe(struct platform_device *pdev) |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 49 | { |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 50 | struct snd_soc_card *card = &snd_soc_omap_hdmi; |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 51 | 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 Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 64 | static int __devexit omap_hdmi_remove(struct platform_device *pdev) |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 65 | { |
| 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 Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 73 | static struct platform_driver omap_hdmi_driver = { |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 74 | .driver = { |
Ricardo Neri | e412ec6 | 2012-05-18 01:42:34 -0500 | [diff] [blame] | 75 | .name = DRV_NAME, |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 76 | .owner = THIS_MODULE, |
| 77 | }, |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 78 | .probe = omap_hdmi_probe, |
| 79 | .remove = __devexit_p(omap_hdmi_remove), |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 80 | }; |
| 81 | |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 82 | module_platform_driver(omap_hdmi_driver); |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 83 | |
| 84 | MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>"); |
Ricardo Neri | aff4833 | 2012-05-18 01:42:42 -0500 | [diff] [blame] | 85 | MODULE_DESCRIPTION("OMAP HDMI machine ASoC driver"); |
Ricardo Neri | 55b95e0 | 2011-06-02 15:44:46 -0500 | [diff] [blame] | 86 | MODULE_LICENSE("GPL"); |
| 87 | MODULE_ALIAS("platform:" DRV_NAME); |