16 #include <linux/module.h>
40 static struct clk *pclk;
48 static unsigned int rates[33 * 2];
67 pr_debug(
"%s %d\n", __func__, clk_users);
69 xtal =
clk_get(&s3c24xx_uda134x_snd_device->
dev,
"xtal");
74 pclk =
clk_get(&s3c24xx_uda134x_snd_device->
dev,
86 for (i = 0; i < 2; i++) {
87 int fs = i ? 256 : 384;
90 for (j = 1; j < 33; j++)
102 &hw_constraints_rates);
114 pr_debug(
"%s %d\n", __func__, clk_users);
116 if (clk_users == 0) {
131 unsigned int clk = 0;
141 for (i = 0; i < 2*33; i++) {
142 cerr = rates[
i] -
rate;
161 pr_debug(
"%s desired rate %lu, %d\n", __func__, rate, bi);
164 pr_debug(
"%s will use: %s %s %d sysclk %d err %ld\n", __func__,
169 if ((err * 100 / rate) > 5) {
171 "too different from desired (%ld%%)\n",
215 .startup = s3c24xx_uda134x_startup,
216 .shutdown = s3c24xx_uda134x_shutdown,
217 .hw_params = s3c24xx_uda134x_hw_params,
222 .stream_name =
"UDA134X",
223 .codec_name =
"uda134x-codec",
224 .codec_dai_name =
"uda134x-hifi",
225 .cpu_dai_name =
"s3c24xx-iis",
226 .ops = &s3c24xx_uda134x_ops,
227 .platform_name =
"samsung-audio",
231 .name =
"S3C24XX_UDA134X",
233 .dai_link = &s3c24xx_uda134x_dai_link,
239 static void setdat(
int v)
244 static void setclk(
int v)
269 static int s3c24xx_uda134x_setup_pin(
int pin,
char *
fun)
273 "l3 %s pin already in use", fun);
286 s3c24xx_uda134x_l3_pins = pdev->
dev.platform_data;
287 if (s3c24xx_uda134x_l3_pins ==
NULL) {
289 "unable to find platform data\n");
292 s3c24xx_uda134x.
power = s3c24xx_uda134x_l3_pins->
power;
293 s3c24xx_uda134x.
model = s3c24xx_uda134x_l3_pins->
model;
295 if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->
l3_data,
298 if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->
l3_clk,
303 if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->
l3_mode,
311 if (!s3c24xx_uda134x_snd_device) {
313 "Unable to register\n");
317 platform_set_drvdata(s3c24xx_uda134x_snd_device,
318 &snd_soc_s3c24xx_uda134x);
339 .probe = s3c24xx_uda134x_probe,
340 .remove = s3c24xx_uda134x_remove,
342 .name =
"s3c24xx_uda134x",