Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: sound/soc/pxa/magician.c

Issue 6577007: CHROMIUM: ASoC: Import entire upstream ASoC tree (Closed)
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sound/soc/pxa/em-x270.c ('k') | sound/soc/pxa/mioa701_wm9713.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * SoC audio for HTC Magician 2 * SoC audio for HTC Magician
3 * 3 *
4 * Copyright (c) 2006 Philipp Zabel <philipp.zabel@gmail.com> 4 * Copyright (c) 2006 Philipp Zabel <philipp.zabel@gmail.com>
5 * 5 *
6 * based on spitz.c, 6 * based on spitz.c,
7 * Authors: Liam Girdwood <lrg@slimlogic.co.uk> 7 * Authors: Liam Girdwood <lrg@slimlogic.co.uk>
8 * Richard Purdie <richard@openedhand.com> 8 * Richard Purdie <richard@openedhand.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your 12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version. 13 * option) any later version.
14 * 14 *
15 */ 15 */
16 16
17 #include <linux/module.h> 17 #include <linux/module.h>
18 #include <linux/timer.h> 18 #include <linux/timer.h>
19 #include <linux/interrupt.h> 19 #include <linux/interrupt.h>
20 #include <linux/platform_device.h> 20 #include <linux/platform_device.h>
21 #include <linux/delay.h> 21 #include <linux/delay.h>
22 #include <linux/gpio.h> 22 #include <linux/gpio.h>
23 #include <linux/i2c.h> 23 #include <linux/i2c.h>
24 24
25 #include <sound/core.h> 25 #include <sound/core.h>
26 #include <sound/pcm.h> 26 #include <sound/pcm.h>
27 #include <sound/pcm_params.h> 27 #include <sound/pcm_params.h>
28 #include <sound/soc.h> 28 #include <sound/soc.h>
29 #include <sound/soc-dapm.h>
30 #include <sound/uda1380.h> 29 #include <sound/uda1380.h>
31 30
32 #include <mach/magician.h> 31 #include <mach/magician.h>
33 #include <asm/mach-types.h> 32 #include <asm/mach-types.h>
34 #include "../codecs/uda1380.h" 33 #include "../codecs/uda1380.h"
35 #include "pxa2xx-i2s.h" 34 #include "pxa2xx-i2s.h"
36 #include "pxa-ssp.h" 35 #include "pxa-ssp.h"
37 36
38 #define MAGICIAN_MIC 0 37 #define MAGICIAN_MIC 0
39 #define MAGICIAN_MIC_EXT 1 38 #define MAGICIAN_MIC_EXT 1
40 39
41 static int magician_hp_switch; 40 static int magician_hp_switch;
42 static int magician_spk_switch = 1; 41 static int magician_spk_switch = 1;
43 static int magician_in_sel = MAGICIAN_MIC; 42 static int magician_in_sel = MAGICIAN_MIC;
44 43
45 static void magician_ext_control(struct snd_soc_codec *codec) 44 static void magician_ext_control(struct snd_soc_codec *codec)
46 { 45 {
46 struct snd_soc_dapm_context *dapm = &codec->dapm;
47
47 if (magician_spk_switch) 48 if (magician_spk_switch)
48 » » snd_soc_dapm_enable_pin(codec, "Speaker"); 49 » » snd_soc_dapm_enable_pin(dapm, "Speaker");
49 else 50 else
50 » » snd_soc_dapm_disable_pin(codec, "Speaker"); 51 » » snd_soc_dapm_disable_pin(dapm, "Speaker");
51 if (magician_hp_switch) 52 if (magician_hp_switch)
52 » » snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 53 » » snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
53 else 54 else
54 » » snd_soc_dapm_disable_pin(codec, "Headphone Jack"); 55 » » snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
55 56
56 switch (magician_in_sel) { 57 switch (magician_in_sel) {
57 case MAGICIAN_MIC: 58 case MAGICIAN_MIC:
58 » » snd_soc_dapm_disable_pin(codec, "Headset Mic"); 59 » » snd_soc_dapm_disable_pin(dapm, "Headset Mic");
59 » » snd_soc_dapm_enable_pin(codec, "Call Mic"); 60 » » snd_soc_dapm_enable_pin(dapm, "Call Mic");
60 break; 61 break;
61 case MAGICIAN_MIC_EXT: 62 case MAGICIAN_MIC_EXT:
62 » » snd_soc_dapm_disable_pin(codec, "Call Mic"); 63 » » snd_soc_dapm_disable_pin(dapm, "Call Mic");
63 » » snd_soc_dapm_enable_pin(codec, "Headset Mic"); 64 » » snd_soc_dapm_enable_pin(dapm, "Headset Mic");
64 break; 65 break;
65 } 66 }
66 67
67 » snd_soc_dapm_sync(codec); 68 » snd_soc_dapm_sync(dapm);
68 } 69 }
69 70
70 static int magician_startup(struct snd_pcm_substream *substream) 71 static int magician_startup(struct snd_pcm_substream *substream)
71 { 72 {
72 struct snd_soc_pcm_runtime *rtd = substream->private_data; 73 struct snd_soc_pcm_runtime *rtd = substream->private_data;
73 struct snd_soc_codec *codec = rtd->codec; 74 struct snd_soc_codec *codec = rtd->codec;
74 75
75 mutex_lock(&codec->mutex); 76 mutex_lock(&codec->mutex);
76 77
77 /* check the jack status at stream startup */ 78 /* check the jack status at stream startup */
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 SOC_ENUM_EXT("Input Select", magician_in_sel_enum, 393 SOC_ENUM_EXT("Input Select", magician_in_sel_enum,
393 magician_get_input, magician_set_input), 394 magician_get_input, magician_set_input),
394 }; 395 };
395 396
396 /* 397 /*
397 * Logic for a uda1380 as connected on a HTC Magician 398 * Logic for a uda1380 as connected on a HTC Magician
398 */ 399 */
399 static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd) 400 static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
400 { 401 {
401 struct snd_soc_codec *codec = rtd->codec; 402 struct snd_soc_codec *codec = rtd->codec;
403 struct snd_soc_dapm_context *dapm = &codec->dapm;
402 int err; 404 int err;
403 405
404 /* NC codec pins */ 406 /* NC codec pins */
405 » snd_soc_dapm_nc_pin(codec, "VOUTLHP"); 407 » snd_soc_dapm_nc_pin(dapm, "VOUTLHP");
406 » snd_soc_dapm_nc_pin(codec, "VOUTRHP"); 408 » snd_soc_dapm_nc_pin(dapm, "VOUTRHP");
407 409
408 /* FIXME: is anything connected here? */ 410 /* FIXME: is anything connected here? */
409 » snd_soc_dapm_nc_pin(codec, "VINL"); 411 » snd_soc_dapm_nc_pin(dapm, "VINL");
410 » snd_soc_dapm_nc_pin(codec, "VINR"); 412 » snd_soc_dapm_nc_pin(dapm, "VINR");
411 413
412 /* Add magician specific controls */ 414 /* Add magician specific controls */
413 err = snd_soc_add_controls(codec, uda1380_magician_controls, 415 err = snd_soc_add_controls(codec, uda1380_magician_controls,
414 ARRAY_SIZE(uda1380_magician_controls)); 416 ARRAY_SIZE(uda1380_magician_controls));
415 if (err < 0) 417 if (err < 0)
416 return err; 418 return err;
417 419
418 /* Add magician specific widgets */ 420 /* Add magician specific widgets */
419 » snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets, 421 » snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
420 ARRAY_SIZE(uda1380_dapm_widgets)); 422 ARRAY_SIZE(uda1380_dapm_widgets));
421 423
422 /* Set up magician specific audio path interconnects */ 424 /* Set up magician specific audio path interconnects */
423 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 425 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
424 426
425 » snd_soc_dapm_sync(codec); 427 » snd_soc_dapm_sync(dapm);
426 return 0; 428 return 0;
427 } 429 }
428 430
429 /* magician digital audio interface glue - connects codec <--> CPU */ 431 /* magician digital audio interface glue - connects codec <--> CPU */
430 static struct snd_soc_dai_link magician_dai[] = { 432 static struct snd_soc_dai_link magician_dai[] = {
431 { 433 {
432 .name = "uda1380", 434 .name = "uda1380",
433 .stream_name = "UDA1380 Playback", 435 .stream_name = "UDA1380 Playback",
434 .cpu_dai_name = "pxa-ssp-dai.0", 436 .cpu_dai_name = "pxa-ssp-dai.0",
435 .codec_dai_name = "uda1380-hifi-playback", 437 .codec_dai_name = "uda1380-hifi-playback",
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 gpio_free(EGPIO_MAGICIAN_EP_POWER); 555 gpio_free(EGPIO_MAGICIAN_EP_POWER);
554 gpio_free(EGPIO_MAGICIAN_SPK_POWER); 556 gpio_free(EGPIO_MAGICIAN_SPK_POWER);
555 } 557 }
556 558
557 module_init(magician_init); 559 module_init(magician_init);
558 module_exit(magician_exit); 560 module_exit(magician_exit);
559 561
560 MODULE_AUTHOR("Philipp Zabel"); 562 MODULE_AUTHOR("Philipp Zabel");
561 MODULE_DESCRIPTION("ALSA SoC Magician"); 563 MODULE_DESCRIPTION("ALSA SoC Magician");
562 MODULE_LICENSE("GPL"); 564 MODULE_LICENSE("GPL");
OLDNEW
« no previous file with comments | « sound/soc/pxa/em-x270.c ('k') | sound/soc/pxa/mioa701_wm9713.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698