~ubuntu-branches/ubuntu/precise/alsa-driver/precise-proposed

« back to all changes in this revision

Viewing changes to alsa-kernel/soc/codecs/ad73311.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2011-02-21 18:06:40 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20110221180640-a8p2yxtvgf7xbxub
Tags: 1.0.24+dfsg-0ubuntu1
* New upstream release
* Refreshed patches:
  - distinguish_kernel_makefile_and_source_dirs.patch
  - debian_dfsg_configure.patch
* debian/control: Update Vcs-bzr field to point to new branch location

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include "ad73311.h"
25
25
 
26
 
struct snd_soc_dai ad73311_dai = {
27
 
        .name = "AD73311",
 
26
static struct snd_soc_dai_driver ad73311_dai = {
 
27
        .name = "ad73311-hifi",
28
28
        .playback = {
29
29
                .stream_name = "Playback",
30
30
                .channels_min = 1,
38
38
                .rates = SNDRV_PCM_RATE_8000,
39
39
                .formats = SNDRV_PCM_FMTBIT_S16_LE, },
40
40
};
41
 
EXPORT_SYMBOL_GPL(ad73311_dai);
42
 
 
43
 
static int ad73311_soc_probe(struct platform_device *pdev)
 
41
 
 
42
static struct snd_soc_codec_driver soc_codec_dev_ad73311;
 
43
 
 
44
static int ad73311_probe(struct platform_device *pdev)
44
45
{
45
 
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
46
 
        struct snd_soc_codec *codec;
47
 
        int ret = 0;
48
 
 
49
 
        codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
50
 
        if (codec == NULL)
51
 
                return -ENOMEM;
52
 
        mutex_init(&codec->mutex);
53
 
        codec->name = "AD73311";
54
 
        codec->owner = THIS_MODULE;
55
 
        codec->dai = &ad73311_dai;
56
 
        codec->num_dai = 1;
57
 
        socdev->card->codec = codec;
58
 
        INIT_LIST_HEAD(&codec->dapm_widgets);
59
 
        INIT_LIST_HEAD(&codec->dapm_paths);
60
 
 
61
 
        /* register pcms */
62
 
        ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
63
 
        if (ret < 0) {
64
 
                printk(KERN_ERR "ad73311: failed to create pcms\n");
65
 
                goto pcm_err;
66
 
        }
67
 
 
68
 
        return ret;
69
 
 
70
 
pcm_err:
71
 
        kfree(socdev->card->codec);
72
 
        socdev->card->codec = NULL;
73
 
        return ret;
 
46
        return snd_soc_register_codec(&pdev->dev,
 
47
                        &soc_codec_dev_ad73311, &ad73311_dai, 1);
74
48
}
75
49
 
76
 
static int ad73311_soc_remove(struct platform_device *pdev)
 
50
static int __devexit ad73311_remove(struct platform_device *pdev)
77
51
{
78
 
        struct snd_soc_device *socdev = platform_get_drvdata(pdev);
79
 
        struct snd_soc_codec *codec = socdev->card->codec;
80
 
 
81
 
        if (codec == NULL)
82
 
                return 0;
83
 
        snd_soc_free_pcms(socdev);
84
 
        kfree(codec);
 
52
        snd_soc_unregister_codec(&pdev->dev);
85
53
        return 0;
86
54
}
87
55
 
88
 
struct snd_soc_codec_device soc_codec_dev_ad73311 = {
89
 
        .probe =        ad73311_soc_probe,
90
 
        .remove =       ad73311_soc_remove,
 
56
static struct platform_driver ad73311_codec_driver = {
 
57
        .driver = {
 
58
                        .name = "ad73311-codec",
 
59
                        .owner = THIS_MODULE,
 
60
        },
 
61
 
 
62
        .probe = ad73311_probe,
 
63
        .remove = __devexit_p(ad73311_remove),
91
64
};
92
 
EXPORT_SYMBOL_GPL(soc_codec_dev_ad73311);
93
65
 
94
66
static int __init ad73311_init(void)
95
67
{
96
 
        return snd_soc_register_dai(&ad73311_dai);
 
68
        return platform_driver_register(&ad73311_codec_driver);
97
69
}
98
70
module_init(ad73311_init);
99
71
 
100
72
static void __exit ad73311_exit(void)
101
73
{
102
 
        snd_soc_unregister_dai(&ad73311_dai);
 
74
        platform_driver_unregister(&ad73311_codec_driver);
103
75
}
104
76
module_exit(ad73311_exit);
105
77