~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to sound/soc/mxs/mxs-sgtl5000.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include <linux/module.h>
20
20
#include <linux/device.h>
 
21
#include <linux/of.h>
 
22
#include <linux/of_device.h>
21
23
#include <sound/core.h>
22
24
#include <sound/pcm.h>
23
25
#include <sound/soc.h>
90
92
                .codec_dai_name = "sgtl5000",
91
93
                .codec_name     = "sgtl5000.0-000a",
92
94
                .cpu_dai_name   = "mxs-saif.0",
93
 
                .platform_name  = "mxs-pcm-audio.0",
 
95
                .platform_name  = "mxs-saif.0",
94
96
                .ops            = &mxs_sgtl5000_hifi_ops,
95
97
        }, {
96
98
                .name           = "HiFi Rx",
98
100
                .codec_dai_name = "sgtl5000",
99
101
                .codec_name     = "sgtl5000.0-000a",
100
102
                .cpu_dai_name   = "mxs-saif.1",
101
 
                .platform_name  = "mxs-pcm-audio.1",
 
103
                .platform_name  = "mxs-saif.1",
102
104
                .ops            = &mxs_sgtl5000_hifi_ops,
103
105
        },
104
106
};
110
112
        .num_links      = ARRAY_SIZE(mxs_sgtl5000_dai),
111
113
};
112
114
 
 
115
static int __devinit mxs_sgtl5000_probe_dt(struct platform_device *pdev)
 
116
{
 
117
        struct device_node *np = pdev->dev.of_node;
 
118
        struct device_node *saif_np[2], *codec_np;
 
119
        int i, ret = 0;
 
120
 
 
121
        if (!np)
 
122
                return 1; /* no device tree */
 
123
 
 
124
        saif_np[0] = of_parse_phandle(np, "saif-controllers", 0);
 
125
        saif_np[1] = of_parse_phandle(np, "saif-controllers", 1);
 
126
        codec_np = of_parse_phandle(np, "audio-codec", 0);
 
127
        if (!saif_np[0] || !saif_np[1] || !codec_np) {
 
128
                dev_err(&pdev->dev, "phandle missing or invalid\n");
 
129
                return -EINVAL;
 
130
        }
 
131
 
 
132
        for (i = 0; i < 2; i++) {
 
133
                mxs_sgtl5000_dai[i].codec_name = NULL;
 
134
                mxs_sgtl5000_dai[i].codec_of_node = codec_np;
 
135
                mxs_sgtl5000_dai[i].cpu_dai_name = NULL;
 
136
                mxs_sgtl5000_dai[i].cpu_dai_of_node = saif_np[i];
 
137
                mxs_sgtl5000_dai[i].platform_name = NULL;
 
138
                mxs_sgtl5000_dai[i].platform_of_node = saif_np[i];
 
139
        }
 
140
 
 
141
        of_node_put(codec_np);
 
142
        of_node_put(saif_np[0]);
 
143
        of_node_put(saif_np[1]);
 
144
 
 
145
        return ret;
 
146
}
 
147
 
113
148
static int __devinit mxs_sgtl5000_probe(struct platform_device *pdev)
114
149
{
115
150
        struct snd_soc_card *card = &mxs_sgtl5000;
116
151
        int ret;
117
152
 
 
153
        ret = mxs_sgtl5000_probe_dt(pdev);
 
154
        if (ret < 0)
 
155
                return ret;
 
156
 
118
157
        /*
119
158
         * Set an init clock(11.28Mhz) for sgtl5000 initialization(i2c r/w).
120
159
         * The Sgtl5000 sysclk is derived from saif0 mclk and it's range
148
187
        return 0;
149
188
}
150
189
 
 
190
static const struct of_device_id mxs_sgtl5000_dt_ids[] = {
 
191
        { .compatible = "fsl,mxs-audio-sgtl5000", },
 
192
        { /* sentinel */ }
 
193
};
 
194
MODULE_DEVICE_TABLE(of, mxs_sgtl5000_dt_ids);
 
195
 
151
196
static struct platform_driver mxs_sgtl5000_audio_driver = {
152
197
        .driver = {
153
198
                .name = "mxs-sgtl5000",
154
199
                .owner = THIS_MODULE,
 
200
                .of_match_table = mxs_sgtl5000_dt_ids,
155
201
        },
156
202
        .probe = mxs_sgtl5000_probe,
157
203
        .remove = __devexit_p(mxs_sgtl5000_remove),