~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to sound/soc/ep93xx/edb93xx.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <linux/platform_device.h>
23
23
#include <linux/gpio.h>
 
24
#include <linux/module.h>
24
25
#include <sound/core.h>
25
26
#include <sound/pcm.h>
26
27
#include <sound/soc.h>
28
29
#include <mach/hardware.h>
29
30
#include "ep93xx-pcm.h"
30
31
 
31
 
#define edb93xx_has_audio() (machine_is_edb9301() ||    \
32
 
                             machine_is_edb9302() ||    \
33
 
                             machine_is_edb9302a() ||   \
34
 
                             machine_is_edb9307a() ||   \
35
 
                             machine_is_edb9315a())
36
 
 
37
32
static int edb93xx_hw_params(struct snd_pcm_substream *substream,
38
33
                             struct snd_pcm_hw_params *params)
39
34
{
94
89
        .num_links      = 1,
95
90
};
96
91
 
97
 
static struct platform_device *edb93xx_snd_device;
98
 
 
99
 
static int __init edb93xx_init(void)
 
92
static int __devinit edb93xx_probe(struct platform_device *pdev)
100
93
{
 
94
        struct snd_soc_card *card = &snd_soc_edb93xx;
101
95
        int ret;
102
96
 
103
 
        if (!edb93xx_has_audio())
104
 
                return -ENODEV;
105
 
 
106
97
        ret = ep93xx_i2s_acquire(EP93XX_SYSCON_DEVCFG_I2SONAC97,
107
98
                                 EP93XX_SYSCON_I2SCLKDIV_ORIDE |
108
99
                                 EP93XX_SYSCON_I2SCLKDIV_SPOL);
109
100
        if (ret)
110
101
                return ret;
111
102
 
112
 
        edb93xx_snd_device = platform_device_alloc("soc-audio", -1);
113
 
        if (!edb93xx_snd_device) {
114
 
                ret = -ENOMEM;
115
 
                goto free_i2s;
 
103
        card->dev = &pdev->dev;
 
104
 
 
105
        ret = snd_soc_register_card(card);
 
106
        if (ret) {
 
107
                dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
 
108
                        ret);
 
109
                ep93xx_i2s_release();
116
110
        }
117
111
 
118
 
        platform_set_drvdata(edb93xx_snd_device, &snd_soc_edb93xx);
119
 
        ret = platform_device_add(edb93xx_snd_device);
120
 
        if (ret)
121
 
                goto device_put;
 
112
        return ret;
 
113
}
 
114
 
 
115
static int __devexit edb93xx_remove(struct platform_device *pdev)
 
116
{
 
117
        struct snd_soc_card *card = platform_get_drvdata(pdev);
 
118
 
 
119
        snd_soc_unregister_card(card);
 
120
        ep93xx_i2s_release();
122
121
 
123
122
        return 0;
124
 
 
125
 
device_put:
126
 
        platform_device_put(edb93xx_snd_device);
127
 
free_i2s:
128
 
        ep93xx_i2s_release();
129
 
        return ret;
 
123
}
 
124
 
 
125
static struct platform_driver edb93xx_driver = {
 
126
        .driver         = {
 
127
                .name   = "edb93xx-audio",
 
128
                .owner  = THIS_MODULE,
 
129
        },
 
130
        .probe          = edb93xx_probe,
 
131
        .remove         = __devexit_p(edb93xx_remove),
 
132
};
 
133
 
 
134
static int __init edb93xx_init(void)
 
135
{
 
136
        return platform_driver_register(&edb93xx_driver);
130
137
}
131
138
module_init(edb93xx_init);
132
139
 
133
140
static void __exit edb93xx_exit(void)
134
141
{
135
 
        platform_device_unregister(edb93xx_snd_device);
136
 
        ep93xx_i2s_release();
 
142
        platform_driver_unregister(&edb93xx_driver);
137
143
}
138
144
module_exit(edb93xx_exit);
139
145
 
140
146
MODULE_AUTHOR("Alexander Sverdlin <subaparts@yandex.ru>");
141
147
MODULE_DESCRIPTION("ALSA SoC EDB93xx");
142
148
MODULE_LICENSE("GPL");
 
149
MODULE_ALIAS("platform:edb93xx-audio");