15 #include <linux/module.h>
16 #include <linux/device.h>
20 #include <mach/hardware.h>
29 #include "../codecs/ab8500-codec.h"
31 #define TX_SLOT_MONO 0x0008
32 #define TX_SLOT_STEREO 0x000a
33 #define RX_SLOT_MONO 0x0001
34 #define RX_SLOT_STEREO 0x0003
35 #define TX_SLOT_8CH 0x00FF
36 #define RX_SLOT_8CH 0x00FF
38 #define DEF_TX_SLOTS TX_SLOT_STEREO
39 #define DEF_RX_SLOTS RX_SLOT_MONO
41 #define DRIVERMODE_NORMAL 0
42 #define DRIVERMODE_CODEC_ONLY 1
49 static const char *
const enum_mclk[] = {
69 static inline const char *get_mclk_str(
enum mclk mclk_sel)
81 static int mop500_ab8500_set_mclk(
struct device *
dev,
89 "%s: ERROR: intclk not initialized!\n", __func__);
104 if (IS_ERR(clk_ptr)) {
105 dev_err(dev,
"%s: ERROR: %s not initialized!\n", __func__,
113 "%s: ERROR: Setting intclk parent to %s failed (ret = %d)!",
114 __func__, get_mclk_str(drvdata->
mclk_sel), status);
117 "%s: intclk parent changed to %s.\n",
118 __func__, get_mclk_str(drvdata->
mclk_sel));
127 static int mclk_input_control_get(
struct snd_kcontrol *kcontrol,
132 snd_soc_card_get_drvdata(codec->
card);
139 static int mclk_input_control_put(
struct snd_kcontrol *kcontrol,
144 snd_soc_card_get_drvdata(codec->
card);
145 unsigned int val = ucontrol->
value.enumerated.item[0];
164 mclk_input_control_get, mclk_input_control_put),
166 SOC_SINGLE(
"Digital Interface Master Generator Switch",
169 SOC_SINGLE(
"Digital Interface 0 Bit-clock Switch",
172 SOC_SINGLE(
"Digital Interface 1 Bit-clock Switch",
203 return mop500_ab8500_set_mclk(rtd->
card->dev,
204 snd_soc_card_get_drvdata(rtd->
card));
212 dev_dbg(dev,
"%s: Enter\n", __func__);
230 unsigned int sw_codec, sw_cpu;
233 dev_dbg(dev,
"%s: Enter\n", __func__);
235 dev_dbg(dev,
"%s: substream->pcm->name = %s\n"
236 "substream->pcm->id = %s.\n"
237 "substream->name = %s.\n"
238 "substream->number = %d.\n",
240 substream->
pcm->name,
265 dev_dbg(dev,
"%s: Driver-mode: %s.\n", __func__,
285 "%s: ERROR: snd_soc_dai_set_fmt failed for codec_dai (ret = %d)!\n",
293 "%s: ERROR: snd_soc_dai_set_fmt failed for cpu_dai (ret = %d)!\n",
326 dev_dbg(dev,
"%s: CPU-DAI TDM: TX=0x%04X RX=0x%04x\n", __func__,
333 dev_dbg(dev,
"%s: CODEC-DAI TDM: TX=0x%04X RX=0x%04x\n", __func__,
358 dev_dbg(dev,
"%s Enter.\n", __func__);
363 snd_soc_card_set_drvdata(rtd->
card, drvdata);
369 dev_warn(dev,
"%s: WARNING: clk_get failed for 'sysclk'!\n",
373 dev_warn(dev,
"%s: WARNING: clk_get failed for 'ulpclk'!\n",
377 dev_warn(dev,
"%s: WARNING: clk_get failed for 'intclk'!\n",
382 ret = mop500_ab8500_set_mclk(dev, drvdata);
384 dev_warn(dev,
"%s: WARNING: mop500_ab8500_set_mclk!\n",
393 pr_err(
"%s: Failed to add machine-controls (%d)!\n",
430 snd_soc_card_set_drvdata(card, drvdata);