| OLD | NEW |
| 1 /* | 1 /* |
| 2 * rx1950.c -- ALSA Soc Audio Layer | 2 * rx1950.c -- ALSA Soc Audio Layer |
| 3 * | 3 * |
| 4 * Copyright (c) 2010 Vasily Khoruzhick <anarsoul@gmail.com> | 4 * Copyright (c) 2010 Vasily Khoruzhick <anarsoul@gmail.com> |
| 5 * | 5 * |
| 6 * Based on smdk2440.c and magician.c | 6 * Based on smdk2440.c and magician.c |
| 7 * | 7 * |
| 8 * Authors: Graeme Gregory graeme.gregory@wolfsonmicro.com | 8 * Authors: Graeme Gregory graeme.gregory@wolfsonmicro.com |
| 9 * Philipp Zabel <philipp.zabel@gmail.com> | 9 * Philipp Zabel <philipp.zabel@gmail.com> |
| 10 * Denis Grigoriev <dgreenday@gmail.com> | 10 * Denis Grigoriev <dgreenday@gmail.com> |
| 11 * Vasily Khoruzhick <anarsoul@gmail.com> | 11 * Vasily Khoruzhick <anarsoul@gmail.com> |
| 12 * | 12 * |
| 13 * This program is free software; you can redistribute it and/or modify it | 13 * This program is free software; you can redistribute it and/or modify it |
| 14 * under the terms of the GNU General Public License as published by the | 14 * under the terms of the GNU General Public License as published by the |
| 15 * Free Software Foundation; either version 2 of the License, or (at your | 15 * Free Software Foundation; either version 2 of the License, or (at your |
| 16 * option) any later version. | 16 * option) any later version. |
| 17 * | 17 * |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #include <linux/module.h> | |
| 21 #include <linux/moduleparam.h> | |
| 22 #include <linux/platform_device.h> | |
| 23 #include <linux/i2c.h> | |
| 24 #include <linux/gpio.h> | 20 #include <linux/gpio.h> |
| 25 #include <linux/clk.h> | |
| 26 | 21 |
| 27 #include <sound/soc.h> | 22 #include <sound/soc.h> |
| 28 #include <sound/soc-dapm.h> | |
| 29 #include <sound/uda1380.h> | |
| 30 #include <sound/jack.h> | 23 #include <sound/jack.h> |
| 31 | 24 |
| 32 #include <plat/regs-iis.h> | 25 #include <plat/regs-iis.h> |
| 33 | |
| 34 #include <mach/regs-clock.h> | |
| 35 | |
| 36 #include <asm/mach-types.h> | 26 #include <asm/mach-types.h> |
| 37 | 27 |
| 38 #include "s3c-dma.h" | |
| 39 #include "s3c24xx-i2s.h" | 28 #include "s3c24xx-i2s.h" |
| 40 #include "../codecs/uda1380.h" | |
| 41 | 29 |
| 42 static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd); | 30 static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd); |
| 43 static int rx1950_startup(struct snd_pcm_substream *substream); | 31 static int rx1950_startup(struct snd_pcm_substream *substream); |
| 44 static int rx1950_hw_params(struct snd_pcm_substream *substream, | 32 static int rx1950_hw_params(struct snd_pcm_substream *substream, |
| 45 struct snd_pcm_hw_params *params); | 33 struct snd_pcm_hw_params *params); |
| 46 static int rx1950_spk_power(struct snd_soc_dapm_widget *w, | 34 static int rx1950_spk_power(struct snd_soc_dapm_widget *w, |
| 47 struct snd_kcontrol *kcontrol, int event); | 35 struct snd_kcontrol *kcontrol, int event); |
| 48 | 36 |
| 49 static unsigned int rates[] = { | 37 static unsigned int rates[] = { |
| 50 16000, | 38 16000, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 }; | 76 }; |
| 89 | 77 |
| 90 /* s3c24xx digital audio interface glue - connects codec <--> CPU */ | 78 /* s3c24xx digital audio interface glue - connects codec <--> CPU */ |
| 91 static struct snd_soc_dai_link rx1950_uda1380_dai[] = { | 79 static struct snd_soc_dai_link rx1950_uda1380_dai[] = { |
| 92 { | 80 { |
| 93 .name = "uda1380", | 81 .name = "uda1380", |
| 94 .stream_name = "UDA1380 Duplex", | 82 .stream_name = "UDA1380 Duplex", |
| 95 .cpu_dai_name = "s3c24xx-iis", | 83 .cpu_dai_name = "s3c24xx-iis", |
| 96 .codec_dai_name = "uda1380-hifi", | 84 .codec_dai_name = "uda1380-hifi", |
| 97 .init = rx1950_uda1380_init, | 85 .init = rx1950_uda1380_init, |
| 98 » » .platform_name» = "s3c24xx-pcm-audio", | 86 » » .platform_name» = "samsung-audio", |
| 99 .codec_name = "uda1380-codec.0-001a", | 87 .codec_name = "uda1380-codec.0-001a", |
| 100 .ops = &rx1950_ops, | 88 .ops = &rx1950_ops, |
| 101 }, | 89 }, |
| 102 }; | 90 }; |
| 103 | 91 |
| 104 static struct snd_soc_card rx1950_asoc = { | 92 static struct snd_soc_card rx1950_asoc = { |
| 105 .name = "rx1950", | 93 .name = "rx1950", |
| 106 .dai_link = rx1950_uda1380_dai, | 94 .dai_link = rx1950_uda1380_dai, |
| 107 .num_links = ARRAY_SIZE(rx1950_uda1380_dai), | 95 .num_links = ARRAY_SIZE(rx1950_uda1380_dai), |
| 108 }; | 96 }; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 S3C24XX_PRESCALE(div, div)); | 209 S3C24XX_PRESCALE(div, div)); |
| 222 if (ret < 0) | 210 if (ret < 0) |
| 223 return ret; | 211 return ret; |
| 224 | 212 |
| 225 return 0; | 213 return 0; |
| 226 } | 214 } |
| 227 | 215 |
| 228 static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd) | 216 static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd) |
| 229 { | 217 { |
| 230 struct snd_soc_codec *codec = rtd->codec; | 218 struct snd_soc_codec *codec = rtd->codec; |
| 219 struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 231 int err; | 220 int err; |
| 232 | 221 |
| 233 /* Add rx1950 specific widgets */ | 222 /* Add rx1950 specific widgets */ |
| 234 » err = snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, | 223 » err = snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets, |
| 235 ARRAY_SIZE(uda1380_dapm_widgets)); | 224 ARRAY_SIZE(uda1380_dapm_widgets)); |
| 236 | 225 |
| 237 if (err) | 226 if (err) |
| 238 return err; | 227 return err; |
| 239 | 228 |
| 240 /* Set up rx1950 specific audio path audio_mapnects */ | 229 /* Set up rx1950 specific audio path audio_mapnects */ |
| 241 » err = snd_soc_dapm_add_routes(codec, audio_map, | 230 » err = snd_soc_dapm_add_routes(dapm, audio_map, |
| 242 ARRAY_SIZE(audio_map)); | 231 ARRAY_SIZE(audio_map)); |
| 243 | 232 |
| 244 if (err) | 233 if (err) |
| 245 return err; | 234 return err; |
| 246 | 235 |
| 247 » snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | 236 » snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); |
| 248 » snd_soc_dapm_enable_pin(codec, "Speaker"); | 237 » snd_soc_dapm_enable_pin(dapm, "Speaker"); |
| 238 » snd_soc_dapm_enable_pin(dapm, "Mic Jack"); |
| 249 | 239 |
| 250 » snd_soc_dapm_sync(codec); | 240 » snd_soc_dapm_sync(dapm); |
| 251 | 241 |
| 252 snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, | 242 snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, |
| 253 &hp_jack); | 243 &hp_jack); |
| 254 | 244 |
| 255 snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins), | 245 snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins), |
| 256 hp_jack_pins); | 246 hp_jack_pins); |
| 257 | 247 |
| 258 snd_soc_jack_add_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), | 248 snd_soc_jack_add_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), |
| 259 hp_jack_gpios); | 249 hp_jack_gpios); |
| 260 | 250 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 gpio_free(S3C2410_GPA(1)); | 300 gpio_free(S3C2410_GPA(1)); |
| 311 } | 301 } |
| 312 | 302 |
| 313 module_init(rx1950_init); | 303 module_init(rx1950_init); |
| 314 module_exit(rx1950_exit); | 304 module_exit(rx1950_exit); |
| 315 | 305 |
| 316 /* Module information */ | 306 /* Module information */ |
| 317 MODULE_AUTHOR("Vasily Khoruzhick"); | 307 MODULE_AUTHOR("Vasily Khoruzhick"); |
| 318 MODULE_DESCRIPTION("ALSA SoC RX1950"); | 308 MODULE_DESCRIPTION("ALSA SoC RX1950"); |
| 319 MODULE_LICENSE("GPL"); | 309 MODULE_LICENSE("GPL"); |
| OLD | NEW |