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

Side by Side Diff: sound/soc/soc-utils.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/soc-jack.c ('k') | sound/soc/tegra/Kconfig » ('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-util.c -- ALSA SoC Audio Layer utility functions 2 * soc-util.c -- ALSA SoC Audio Layer utility functions
3 * 3 *
4 * Copyright 2009 Wolfson Microelectronics PLC. 4 * Copyright 2009 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 * Liam Girdwood <lrg@slimlogic.co.uk> 7 * Liam Girdwood <lrg@slimlogic.co.uk>
8 * 8 *
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
(...skipping 10 matching lines...) Expand all
21 int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots) 21 int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots)
22 { 22 {
23 return sample_size * channels * tdm_slots; 23 return sample_size * channels * tdm_slots;
24 } 24 }
25 EXPORT_SYMBOL_GPL(snd_soc_calc_frame_size); 25 EXPORT_SYMBOL_GPL(snd_soc_calc_frame_size);
26 26
27 int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params) 27 int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params)
28 { 28 {
29 int sample_size; 29 int sample_size;
30 30
31 » switch (params_format(params)) { 31 » sample_size = snd_pcm_format_width(params_format(params));
32 » case SNDRV_PCM_FORMAT_S16_LE: 32 » if (sample_size < 0)
33 » case SNDRV_PCM_FORMAT_S16_BE: 33 » » return sample_size;
34 » » sample_size = 16;
35 » » break;
36 » case SNDRV_PCM_FORMAT_S20_3LE:
37 » case SNDRV_PCM_FORMAT_S20_3BE:
38 » » sample_size = 20;
39 » » break;
40 » case SNDRV_PCM_FORMAT_S24_LE:
41 » case SNDRV_PCM_FORMAT_S24_BE:
42 » » sample_size = 24;
43 » » break;
44 » case SNDRV_PCM_FORMAT_S32_LE:
45 » case SNDRV_PCM_FORMAT_S32_BE:
46 » » sample_size = 32;
47 » » break;
48 » default:
49 » » return -ENOTSUPP;
50 » }
51 34
52 return snd_soc_calc_frame_size(sample_size, params_channels(params), 35 return snd_soc_calc_frame_size(sample_size, params_channels(params),
53 1); 36 1);
54 } 37 }
55 EXPORT_SYMBOL_GPL(snd_soc_params_to_frame_size); 38 EXPORT_SYMBOL_GPL(snd_soc_params_to_frame_size);
56 39
57 int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots) 40 int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots)
58 { 41 {
59 return fs * snd_soc_calc_frame_size(sample_size, channels, tdm_slots); 42 return fs * snd_soc_calc_frame_size(sample_size, channels, tdm_slots);
60 } 43 }
61 EXPORT_SYMBOL_GPL(snd_soc_calc_bclk); 44 EXPORT_SYMBOL_GPL(snd_soc_calc_bclk);
62 45
63 int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params) 46 int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params)
64 { 47 {
65 int ret; 48 int ret;
66 49
67 ret = snd_soc_params_to_frame_size(params); 50 ret = snd_soc_params_to_frame_size(params);
68 51
69 if (ret > 0) 52 if (ret > 0)
70 return ret * params_rate(params); 53 return ret * params_rate(params);
71 else 54 else
72 return ret; 55 return ret;
73 } 56 }
74 EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk); 57 EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
OLDNEW
« no previous file with comments | « sound/soc/soc-jack.c ('k') | sound/soc/tegra/Kconfig » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698