wm8961.c (cf0dbba515415bb19b11f9323d5f7bebd7f24fd6) wm8961.c (b2c812e22de88bb79c290c0e718280f10b64a48d)
1/*
2 * wm8961.c -- WM8961 ALSA SoC Audio driver
3 *
4 * Author: Mark Brown
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

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

13
14#include <linux/module.h>
15#include <linux/moduleparam.h>
16#include <linux/init.h>
17#include <linux/delay.h>
18#include <linux/pm.h>
19#include <linux/i2c.h>
20#include <linux/platform_device.h>
1/*
2 * wm8961.c -- WM8961 ALSA SoC Audio driver
3 *
4 * Author: Mark Brown
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

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

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

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

626 { 8000, 5 },
627};
628
629static int wm8961_hw_params(struct snd_pcm_substream *substream,
630 struct snd_pcm_hw_params *params,
631 struct snd_soc_dai *dai)
632{
633 struct snd_soc_codec *codec = dai->codec;
21#include <sound/core.h>
22#include <sound/pcm.h>
23#include <sound/pcm_params.h>
24#include <sound/soc.h>
25#include <sound/soc-dapm.h>
26#include <sound/initval.h>
27#include <sound/tlv.h>
28

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

625 { 8000, 5 },
626};
627
628static int wm8961_hw_params(struct snd_pcm_substream *substream,
629 struct snd_pcm_hw_params *params,
630 struct snd_soc_dai *dai)
631{
632 struct snd_soc_codec *codec = dai->codec;
634 struct wm8961_priv *wm8961 = codec->private_data;
633 struct wm8961_priv *wm8961 = snd_soc_codec_get_drvdata(codec);
635 int i, best, target, fs;
636 u16 reg;
637
638 fs = params_rate(params);
639
640 if (!wm8961->sysclk) {
641 dev_err(codec->dev, "MCLK has not been specified\n");
642 return -EINVAL;

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

717 return 0;
718}
719
720static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id,
721 unsigned int freq,
722 int dir)
723{
724 struct snd_soc_codec *codec = dai->codec;
634 int i, best, target, fs;
635 u16 reg;
636
637 fs = params_rate(params);
638
639 if (!wm8961->sysclk) {
640 dev_err(codec->dev, "MCLK has not been specified\n");
641 return -EINVAL;

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

716 return 0;
717}
718
719static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id,
720 unsigned int freq,
721 int dir)
722{
723 struct snd_soc_codec *codec = dai->codec;
725 struct wm8961_priv *wm8961 = codec->private_data;
724 struct wm8961_priv *wm8961 = snd_soc_codec_get_drvdata(codec);
726 u16 reg = snd_soc_read(codec, WM8961_CLOCKING1);
727
728 if (freq > 33000000) {
729 dev_err(codec->dev, "MCLK must be <33MHz\n");
730 return -EINVAL;
731 }
732
733 if (freq > 16500000) {

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

1060 ret = -EINVAL;
1061 goto err;
1062 }
1063
1064 mutex_init(&codec->mutex);
1065 INIT_LIST_HEAD(&codec->dapm_widgets);
1066 INIT_LIST_HEAD(&codec->dapm_paths);
1067
725 u16 reg = snd_soc_read(codec, WM8961_CLOCKING1);
726
727 if (freq > 33000000) {
728 dev_err(codec->dev, "MCLK must be <33MHz\n");
729 return -EINVAL;
730 }
731
732 if (freq > 16500000) {

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

1059 ret = -EINVAL;
1060 goto err;
1061 }
1062
1063 mutex_init(&codec->mutex);
1064 INIT_LIST_HEAD(&codec->dapm_widgets);
1065 INIT_LIST_HEAD(&codec->dapm_paths);
1066
1068 codec->private_data = wm8961;
1067 snd_soc_codec_set_drvdata(codec, wm8961);
1069 codec->name = "WM8961";
1070 codec->owner = THIS_MODULE;
1071 codec->dai = &wm8961_dai;
1072 codec->num_dai = 1;
1073 codec->reg_cache_size = ARRAY_SIZE(wm8961->reg_cache);
1074 codec->reg_cache = &wm8961->reg_cache;
1075 codec->bias_level = SND_SOC_BIAS_OFF;
1076 codec->set_bias_level = wm8961_set_bias_level;

--- 166 unchanged lines hidden ---
1068 codec->name = "WM8961";
1069 codec->owner = THIS_MODULE;
1070 codec->dai = &wm8961_dai;
1071 codec->num_dai = 1;
1072 codec->reg_cache_size = ARRAY_SIZE(wm8961->reg_cache);
1073 codec->reg_cache = &wm8961->reg_cache;
1074 codec->bias_level = SND_SOC_BIAS_OFF;
1075 codec->set_bias_level = wm8961_set_bias_level;

--- 166 unchanged lines hidden ---