wm8711.c (cf0dbba515415bb19b11f9323d5f7bebd7f24fd6) wm8711.c (b2c812e22de88bb79c290c0e718280f10b64a48d)
1/*
2 * wm8711.c -- WM8711 ALSA SoC Audio driver
3 *
4 * Copyright 2006 Wolfson Microelectronics
5 *
6 * Author: Mike Arthur <linux@wolfsonmicro.com>
7 *
8 * Based on wm8731.c by Richard Purdie

--- 6 unchanged lines hidden (view full) ---

15#include <linux/module.h>
16#include <linux/moduleparam.h>
17#include <linux/init.h>
18#include <linux/delay.h>
19#include <linux/pm.h>
20#include <linux/i2c.h>
21#include <linux/platform_device.h>
22#include <linux/spi/spi.h>
1/*
2 * wm8711.c -- WM8711 ALSA SoC Audio driver
3 *
4 * Copyright 2006 Wolfson Microelectronics
5 *
6 * Author: Mike Arthur <linux@wolfsonmicro.com>
7 *
8 * Based on wm8731.c by Richard Purdie

--- 6 unchanged lines hidden (view full) ---

15#include <linux/module.h>
16#include <linux/moduleparam.h>
17#include <linux/init.h>
18#include <linux/delay.h>
19#include <linux/pm.h>
20#include <linux/i2c.h>
21#include <linux/platform_device.h>
22#include <linux/spi/spi.h>
23#include <linux/slab.h>
24#include <sound/core.h>
25#include <sound/pcm.h>
26#include <sound/pcm_params.h>
27#include <sound/soc.h>
28#include <sound/soc-dapm.h>
29#include <sound/tlv.h>
30#include <sound/initval.h>
31

--- 126 unchanged lines hidden (view full) ---

158 return 0;
159}
160
161static int wm8711_hw_params(struct snd_pcm_substream *substream,
162 struct snd_pcm_hw_params *params,
163 struct snd_soc_dai *dai)
164{
165 struct snd_soc_codec *codec = dai->codec;
23#include <sound/core.h>
24#include <sound/pcm.h>
25#include <sound/pcm_params.h>
26#include <sound/soc.h>
27#include <sound/soc-dapm.h>
28#include <sound/tlv.h>
29#include <sound/initval.h>
30

--- 126 unchanged lines hidden (view full) ---

157 return 0;
158}
159
160static int wm8711_hw_params(struct snd_pcm_substream *substream,
161 struct snd_pcm_hw_params *params,
162 struct snd_soc_dai *dai)
163{
164 struct snd_soc_codec *codec = dai->codec;
166 struct wm8711_priv *wm8711 = codec->private_data;
165 struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
167 u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfffc;
168 int i = get_coeff(wm8711->sysclk, params_rate(params));
169 u16 srate = (coeff_div[i].sr << 2) |
170 (coeff_div[i].bosr << 1) | coeff_div[i].usb;
171
172 snd_soc_write(codec, WM8711_SRATE, srate);
173
174 /* bit size */

--- 47 unchanged lines hidden (view full) ---

222
223 return 0;
224}
225
226static int wm8711_set_dai_sysclk(struct snd_soc_dai *codec_dai,
227 int clk_id, unsigned int freq, int dir)
228{
229 struct snd_soc_codec *codec = codec_dai->codec;
166 u16 iface = snd_soc_read(codec, WM8711_IFACE) & 0xfffc;
167 int i = get_coeff(wm8711->sysclk, params_rate(params));
168 u16 srate = (coeff_div[i].sr << 2) |
169 (coeff_div[i].bosr << 1) | coeff_div[i].usb;
170
171 snd_soc_write(codec, WM8711_SRATE, srate);
172
173 /* bit size */

--- 47 unchanged lines hidden (view full) ---

221
222 return 0;
223}
224
225static int wm8711_set_dai_sysclk(struct snd_soc_dai *codec_dai,
226 int clk_id, unsigned int freq, int dir)
227{
228 struct snd_soc_codec *codec = codec_dai->codec;
230 struct wm8711_priv *wm8711 = codec->private_data;
229 struct wm8711_priv *wm8711 = snd_soc_codec_get_drvdata(codec);
231
232 switch (freq) {
233 case 11289600:
234 case 12000000:
235 case 12288000:
236 case 16934400:
237 case 18432000:
238 wm8711->sysclk = freq;

--- 202 unchanged lines hidden (view full) ---

441 dev_err(codec->dev, "Another WM8711 is registered\n");
442 return -EINVAL;
443 }
444
445 mutex_init(&codec->mutex);
446 INIT_LIST_HEAD(&codec->dapm_widgets);
447 INIT_LIST_HEAD(&codec->dapm_paths);
448
230
231 switch (freq) {
232 case 11289600:
233 case 12000000:
234 case 12288000:
235 case 16934400:
236 case 18432000:
237 wm8711->sysclk = freq;

--- 202 unchanged lines hidden (view full) ---

440 dev_err(codec->dev, "Another WM8711 is registered\n");
441 return -EINVAL;
442 }
443
444 mutex_init(&codec->mutex);
445 INIT_LIST_HEAD(&codec->dapm_widgets);
446 INIT_LIST_HEAD(&codec->dapm_paths);
447
449 codec->private_data = wm8711;
448 snd_soc_codec_set_drvdata(codec, wm8711);
450 codec->name = "WM8711";
451 codec->owner = THIS_MODULE;
452 codec->bias_level = SND_SOC_BIAS_OFF;
453 codec->set_bias_level = wm8711_set_bias_level;
454 codec->dai = &wm8711_dai;
455 codec->num_dai = 1;
456 codec->reg_cache_size = WM8711_CACHEREGNUM;
457 codec->reg_cache = &wm8711->reg_cache;

--- 177 unchanged lines hidden ---
449 codec->name = "WM8711";
450 codec->owner = THIS_MODULE;
451 codec->bias_level = SND_SOC_BIAS_OFF;
452 codec->set_bias_level = wm8711_set_bias_level;
453 codec->dai = &wm8711_dai;
454 codec->num_dai = 1;
455 codec->reg_cache_size = WM8711_CACHEREGNUM;
456 codec->reg_cache = &wm8711->reg_cache;

--- 177 unchanged lines hidden ---