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

Side by Side Diff: sound/soc/codecs/ak4642.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/codecs/ak4535.c ('k') | sound/soc/codecs/ak4671.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 * ak4642.c -- AK4642/AK4643 ALSA Soc Audio driver 2 * ak4642.c -- AK4642/AK4643 ALSA Soc Audio driver
3 * 3 *
4 * Copyright (C) 2009 Renesas Solutions Corp. 4 * Copyright (C) 2009 Renesas Solutions Corp.
5 * Kuninori Morimoto <morimoto.kuninori@renesas.com> 5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
6 * 6 *
7 * Based on wm8731.c by Richard Purdie 7 * Based on wm8731.c by Richard Purdie
8 * Based on ak4535.c by Richard Purdie 8 * Based on ak4535.c by Richard Purdie
9 * Based on wm8753.c by Liam Girdwood 9 * Based on wm8753.c by Liam Girdwood
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15
16 /* ** CAUTION ** 16 /* ** CAUTION **
17 * 17 *
18 * This is very simple driver. 18 * This is very simple driver.
19 * It can use headphone output / stereo input only 19 * It can use headphone output / stereo input only
20 * 20 *
21 * AK4642 is not tested. 21 * AK4642 is not tested.
22 * AK4643 is tested. 22 * AK4643 is tested.
23 */ 23 */
24 24
25 #include <linux/delay.h> 25 #include <linux/delay.h>
26 #include <linux/i2c.h> 26 #include <linux/i2c.h>
27 #include <linux/platform_device.h> 27 #include <linux/platform_device.h>
28 #include <linux/slab.h> 28 #include <linux/slab.h>
29 #include <sound/soc-dapm.h> 29 #include <sound/soc.h>
30 #include <sound/initval.h> 30 #include <sound/initval.h>
31 #include <sound/tlv.h> 31 #include <sound/tlv.h>
32 32
33 #define AK4642_VERSION "0.0.1" 33 #define AK4642_VERSION "0.0.1"
34 34
35 #define PW_MGMT1 0x00 35 #define PW_MGMT1 0x00
36 #define PW_MGMT2 0x01 36 #define PW_MGMT2 0x01
37 #define SG_SL1 0x02 37 #define SG_SL1 0x02
38 #define SG_SL2 0x03 38 #define SG_SL2 0x03
39 #define MD_CTL1 0x04 39 #define MD_CTL1 0x04
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 /* MD_CTL1 */ 109 /* MD_CTL1 */
110 #define PLL3 (1 << 7) 110 #define PLL3 (1 << 7)
111 #define PLL2 (1 << 6) 111 #define PLL2 (1 << 6)
112 #define PLL1 (1 << 5) 112 #define PLL1 (1 << 5)
113 #define PLL0 (1 << 4) 113 #define PLL0 (1 << 4)
114 #define PLL_MASK (PLL3 | PLL2 | PLL1 | PLL0) 114 #define PLL_MASK (PLL3 | PLL2 | PLL1 | PLL0)
115 115
116 #define BCKO_MASK (1 << 3) 116 #define BCKO_MASK (1 << 3)
117 #define BCKO_64 BCKO_MASK 117 #define BCKO_64 BCKO_MASK
118 118
119 #define DIF_MASK (3 << 0)
120 #define DSP (0 << 0)
121 #define RIGHT_J (1 << 0)
122 #define LEFT_J (2 << 0)
123 #define I2S (3 << 0)
124
119 /* MD_CTL2 */ 125 /* MD_CTL2 */
120 #define FS0 (1 << 0) 126 #define FS0 (1 << 0)
121 #define FS1 (1 << 1) 127 #define FS1 (1 << 1)
122 #define FS2 (1 << 2) 128 #define FS2 (1 << 2)
123 #define FS3 (1 << 5) 129 #define FS3 (1 << 5)
124 #define FS_MASK (FS0 | FS1 | FS2 | FS3) 130 #define FS_MASK (FS0 | FS1 | FS2 | FS3)
125 131
126 /* MD_CTL3 */ 132 /* MD_CTL3 */
127 #define BST1 (1 << 3) 133 #define BST1 (1 << 3)
128 134
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 bcko = BCKO_64; 353 bcko = BCKO_64;
348 break; 354 break;
349 case SND_SOC_DAIFMT_CBS_CFS: 355 case SND_SOC_DAIFMT_CBS_CFS:
350 break; 356 break;
351 default: 357 default:
352 return -EINVAL; 358 return -EINVAL;
353 } 359 }
354 snd_soc_update_bits(codec, PW_MGMT2, MS, data); 360 snd_soc_update_bits(codec, PW_MGMT2, MS, data);
355 snd_soc_update_bits(codec, MD_CTL1, BCKO_MASK, bcko); 361 snd_soc_update_bits(codec, MD_CTL1, BCKO_MASK, bcko);
356 362
363 /* format type */
364 data = 0;
365 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
366 case SND_SOC_DAIFMT_LEFT_J:
367 data = LEFT_J;
368 break;
369 case SND_SOC_DAIFMT_I2S:
370 data = I2S;
371 break;
372 /* FIXME
373 * Please add RIGHT_J / DSP support here
374 */
375 default:
376 return -EINVAL;
377 break;
378 }
379 snd_soc_update_bits(codec, MD_CTL1, DIF_MASK, data);
380
357 return 0; 381 return 0;
358 } 382 }
359 383
360 static int ak4642_dai_hw_params(struct snd_pcm_substream *substream, 384 static int ak4642_dai_hw_params(struct snd_pcm_substream *substream,
361 struct snd_pcm_hw_params *params, 385 struct snd_pcm_hw_params *params,
362 struct snd_soc_dai *dai) 386 struct snd_soc_dai *dai)
363 { 387 {
364 struct snd_soc_codec *codec = dai->codec; 388 struct snd_soc_codec *codec = dai->codec;
365 u8 rate; 389 u8 rate;
366 390
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 555 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
532 i2c_del_driver(&ak4642_i2c_driver); 556 i2c_del_driver(&ak4642_i2c_driver);
533 #endif 557 #endif
534 558
535 } 559 }
536 module_exit(ak4642_exit); 560 module_exit(ak4642_exit);
537 561
538 MODULE_DESCRIPTION("Soc AK4642 driver"); 562 MODULE_DESCRIPTION("Soc AK4642 driver");
539 MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); 563 MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
540 MODULE_LICENSE("GPL"); 564 MODULE_LICENSE("GPL");
OLDNEW
« no previous file with comments | « sound/soc/codecs/ak4535.c ('k') | sound/soc/codecs/ak4671.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698