Commit 5c8261e4 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/asoc' into to-push

parents facef868 472346da
...@@ -9,7 +9,7 @@ the audio subsystem with the kernel as a platform device and is represented by ...@@ -9,7 +9,7 @@ the audio subsystem with the kernel as a platform device and is represented by
the following struct:- the following struct:-
/* SoC machine */ /* SoC machine */
struct snd_soc_machine { struct snd_soc_card {
char *name; char *name;
int (*probe)(struct platform_device *pdev); int (*probe)(struct platform_device *pdev);
...@@ -67,10 +67,10 @@ static struct snd_soc_dai_link corgi_dai = { ...@@ -67,10 +67,10 @@ static struct snd_soc_dai_link corgi_dai = {
.ops = &corgi_ops, .ops = &corgi_ops,
}; };
struct snd_soc_machine then sets up the machine with it's DAIs. e.g. struct snd_soc_card then sets up the machine with it's DAIs. e.g.
/* corgi audio machine driver */ /* corgi audio machine driver */
static struct snd_soc_machine snd_soc_machine_corgi = { static struct snd_soc_card snd_soc_corgi = {
.name = "Corgi", .name = "Corgi",
.dai_link = &corgi_dai, .dai_link = &corgi_dai,
.num_links = 1, .num_links = 1,
...@@ -90,7 +90,7 @@ static struct wm8731_setup_data corgi_wm8731_setup = { ...@@ -90,7 +90,7 @@ static struct wm8731_setup_data corgi_wm8731_setup = {
/* corgi audio subsystem */ /* corgi audio subsystem */
static struct snd_soc_device corgi_snd_devdata = { static struct snd_soc_device corgi_snd_devdata = {
.machine = &snd_soc_machine_corgi, .machine = &snd_soc_corgi,
.platform = &pxa2xx_soc_platform, .platform = &pxa2xx_soc_platform,
.codec_dev = &soc_codec_dev_wm8731, .codec_dev = &soc_codec_dev_wm8731,
.codec_data = &corgi_wm8731_setup, .codec_data = &corgi_wm8731_setup,
......
...@@ -3977,7 +3977,7 @@ M: tiwai@suse.de ...@@ -3977,7 +3977,7 @@ M: tiwai@suse.de
L: alsa-devel@alsa-project.org (subscribers-only) L: alsa-devel@alsa-project.org (subscribers-only)
S: Maintained S: Maintained
SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
P: Liam Girdwood P: Liam Girdwood
M: lrg@slimlogic.co.uk M: lrg@slimlogic.co.uk
P: Mark Brown P: Mark Brown
......
#ifndef _INCLUDE_PALMASOC_H_
#define _INCLUDE_PALMASOC_H_
struct palm27x_asoc_info {
int jack_gpio;
};
#ifdef CONFIG_SND_PXA2XX_SOC_PALM27X
void __init palm27x_asoc_set_pdata(struct palm27x_asoc_info *data);
#else
static inline void palm27x_asoc_set_pdata(struct palm27x_asoc_info *data) {}
#endif
#endif
/* /*
* audio.h -- Audio Driver for Wolfson WM8350 PMIC * audio.h -- Audio Driver for Wolfson WM8350 PMIC
* *
* Copyright 2007 Wolfson Microelectronics PLC * Copyright 2007, 2008 Wolfson Microelectronics PLC
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
...@@ -70,9 +70,9 @@ ...@@ -70,9 +70,9 @@
#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */ #define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */
#define WM8350_VMID_OFF 0 #define WM8350_VMID_OFF 0
#define WM8350_VMID_500K 1 #define WM8350_VMID_300K 1
#define WM8350_VMID_100K 2 #define WM8350_VMID_50K 2
#define WM8350_VMID_10K 3 #define WM8350_VMID_5K 3
/* /*
* R40 (0x28) - Clock Control 1 * R40 (0x28) - Clock Control 1
...@@ -591,8 +591,38 @@ ...@@ -591,8 +591,38 @@
#define WM8350_IRQ_CODEC_MICSCD 41 #define WM8350_IRQ_CODEC_MICSCD 41
#define WM8350_IRQ_CODEC_MICD 42 #define WM8350_IRQ_CODEC_MICD 42
/*
* WM8350 Platform data.
*
* This must be initialised per platform for best audio performance.
* Please see WM8350 datasheet for information.
*/
struct wm8350_audio_platform_data {
int vmid_discharge_msecs; /* VMID --> OFF discharge time */
int drain_msecs; /* OFF drain time */
int cap_discharge_msecs; /* Cap ON (from OFF) discharge time */
int vmid_charge_msecs; /* vmid power up time */
u32 vmid_s_curve:2; /* vmid enable s curve speed */
u32 dis_out4:2; /* out4 discharge speed */
u32 dis_out3:2; /* out3 discharge speed */
u32 dis_out2:2; /* out2 discharge speed */
u32 dis_out1:2; /* out1 discharge speed */
u32 vroi_out4:1; /* out4 tie off */
u32 vroi_out3:1; /* out3 tie off */
u32 vroi_out2:1; /* out2 tie off */
u32 vroi_out1:1; /* out1 tie off */
u32 vroi_enable:1; /* enable tie off */
u32 codec_current_on:2; /* current level ON */
u32 codec_current_standby:2; /* current level STANDBY */
u32 codec_current_charge:2; /* codec current @ vmid charge */
};
struct snd_soc_codec;
struct wm8350_codec { struct wm8350_codec {
struct platform_device *pdev; struct platform_device *pdev;
struct snd_soc_codec *codec;
struct wm8350_audio_platform_data *platform_data;
}; };
#endif #endif
#ifndef _L3_H_
#define _L3_H_ 1
struct l3_pins {
void (*setdat)(int);
void (*setclk)(int);
void (*setmode)(int);
int data_hold;
int data_setup;
int clock_high;
int mode_hold;
int mode;
int mode_setup;
};
int l3_write(struct l3_pins *adap, u8 addr, u8 *data, int len);
#endif
#ifndef _S3C24XX_UDA134X_H_
#define _S3C24XX_UDA134X_H_ 1
#include <sound/uda134x.h>
struct s3c24xx_uda134x_platform_data {
int l3_clk;
int l3_mode;
int l3_data;
void (*power) (int);
int model;
};
#endif
/*
* linux/sound/soc-dai.h -- ALSA SoC Layer
*
* Copyright: 2005-2008 Wolfson Microelectronics. PLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Digital Audio Interface (DAI) API.
*/
#ifndef __LINUX_SND_SOC_DAI_H
#define __LINUX_SND_SOC_DAI_H
#include <linux/list.h>
struct snd_pcm_substream;
/*
* DAI hardware audio formats.
*
* Describes the physical PCM data formating and clocking. Add new formats
* to the end.
*/
#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */
#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right Justified mode */
#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */
#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM LRC */
#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM LRC */
#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
/* left and right justified also known as MSB and LSB respectively */
#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
#define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J
/*
* DAI Clock gating.
*
* DAI bit clocks can be be gated (disabled) when not the DAI is not
* sending or receiving PCM data in a frame. This can be used to save power.
*/
#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */
#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated */
/*
* DAI Left/Right Clocks.
*
* Specifies whether the DAI can support different samples for similtanious
* playback and capture. This usually requires a seperate physical frame
* clock for playback and capture.
*/
#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
/*
* TDM
*
* Time Division Multiplexing. Allows PCM data to be multplexed with other
* data on the DAI.
*/
#define SND_SOC_DAIFMT_TDM (1 << 6)
/*
* DAI hardware signal inversions.
*
* Specifies whether the DAI can also support inverted clocks for the specified
* format.
*/
#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */
#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
/*
* DAI hardware clock masters.
*
* This is wrt the codec, the inverse is true for the interface
* i.e. if the codec is clk and frm master then the interface is
* clk and frame slave.
*/
#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */
#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */
#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */
#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */
#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
#define SND_SOC_DAIFMT_INV_MASK 0x0f00
#define SND_SOC_DAIFMT_MASTER_MASK 0xf000
/*
* Master Clock Directions
*/
#define SND_SOC_CLOCK_IN 0
#define SND_SOC_CLOCK_OUT 1
struct snd_soc_dai_ops;
struct snd_soc_dai;
struct snd_ac97_bus_ops;
/* Digital Audio Interface registration */
int snd_soc_register_dai(struct snd_soc_dai *dai);
void snd_soc_unregister_dai(struct snd_soc_dai *dai);
int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count);
void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count);
/* Digital Audio Interface clocking API.*/
int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir);
int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
int div_id, int div);
int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
int pll_id, unsigned int freq_in, unsigned int freq_out);
/* Digital Audio interface formatting */
int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int mask, int slots);
int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
/* Digital Audio Interface mute */
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
/*
* Digital Audio Interface.
*
* Describes the Digital Audio Interface in terms of it's ALSA, DAI and AC97
* operations an capabilities. Codec and platfom drivers will register a this
* structure for every DAI they have.
*
* This structure covers the clocking, formating and ALSA operations for each
* interface a
*/
struct snd_soc_dai_ops {
/*
* DAI clocking configuration, all optional.
* Called by soc_card drivers, normally in their hw_params.
*/
int (*set_sysclk)(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir);
int (*set_pll)(struct snd_soc_dai *dai,
int pll_id, unsigned int freq_in, unsigned int freq_out);
int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
/*
* DAI format configuration
* Called by soc_card drivers, normally in their hw_params.
*/
int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
int (*set_tdm_slot)(struct snd_soc_dai *dai,
unsigned int mask, int slots);
int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
/*
* DAI digital mute - optional.
* Called by soc-core to minimise any pops.
*/
int (*digital_mute)(struct snd_soc_dai *dai, int mute);
/*
* ALSA PCM audio operations - all optional.
* Called by soc-core during audio PCM operations.
*/
int (*startup)(struct snd_pcm_substream *,
struct snd_soc_dai *);
void (*shutdown)(struct snd_pcm_substream *,
struct snd_soc_dai *);
int (*hw_params)(struct snd_pcm_substream *,
struct snd_pcm_hw_params *, struct snd_soc_dai *);
int (*hw_free)(struct snd_pcm_substream *,
struct snd_soc_dai *);
int (*prepare)(struct snd_pcm_substream *,
struct snd_soc_dai *);
int (*trigger)(struct snd_pcm_substream *, int,
struct snd_soc_dai *);
};
/*
* Digital Audio Interface runtime data.
*
* Holds runtime data for a DAI.
*/
struct snd_soc_dai {
/* DAI description */
char *name;
unsigned int id;
int ac97_control;
struct device *dev;
/* DAI callbacks */
int (*probe)(struct platform_device *pdev,
struct snd_soc_dai *dai);
void (*remove)(struct platform_device *pdev,
struct snd_soc_dai *dai);
int (*suspend)(struct snd_soc_dai *dai);
int (*resume)(struct snd_soc_dai *dai);
/* ops */
struct snd_soc_dai_ops ops;
/* DAI capabilities */
struct snd_soc_pcm_stream capture;
struct snd_soc_pcm_stream playback;
/* DAI runtime info */
struct snd_pcm_runtime *runtime;
struct snd_soc_codec *codec;
unsigned int active;
unsigned char pop_wait:1;
void *dma_data;
/* DAI private data */
void *private_data;
/* parent codec/platform */
union {
struct snd_soc_codec *codec;
struct snd_soc_platform *platform;
};
struct list_head list;
};
#endif
...@@ -221,8 +221,6 @@ int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, ...@@ -221,8 +221,6 @@ int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
int num); int num);
/* dapm path setup */ /* dapm path setup */
int __deprecated snd_soc_dapm_connect_input(struct snd_soc_codec *codec,
const char *sink_name, const char *control_name, const char *src_name);
int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec);
void snd_soc_dapm_free(struct snd_soc_device *socdev); void snd_soc_dapm_free(struct snd_soc_device *socdev);
int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <sound/control.h> #include <sound/control.h>
#include <sound/ac97_codec.h> #include <sound/ac97_codec.h>
#define SND_SOC_VERSION "0.13.2"
/* /*
* Convenience kcontrol builders * Convenience kcontrol builders
*/ */
...@@ -145,105 +143,31 @@ enum snd_soc_bias_level { ...@@ -145,105 +143,31 @@ enum snd_soc_bias_level {
SND_SOC_BIAS_OFF, SND_SOC_BIAS_OFF,
}; };
/*
* Digital Audio Interface (DAI) types
*/
#define SND_SOC_DAI_AC97 0x1
#define SND_SOC_DAI_I2S 0x2
#define SND_SOC_DAI_PCM 0x4
#define SND_SOC_DAI_AC97_BUS 0x8 /* for custom i.e. non ac97_codec.c */
/*
* DAI hardware audio formats
*/
#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */
#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right justified mode */
#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */
#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM or LRC */
#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM or LRC */
#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
#define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J
/*
* DAI Gating
*/
#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */
#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */
/*
* DAI Sync
* Synchronous LR (Left Right) clocks and Frame signals.
*/
#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
/*
* TDM
*/
#define SND_SOC_DAIFMT_TDM (1 << 6)
/*
* DAI hardware signal inversions
*/
#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bclk + frm */
#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
/*
* DAI hardware clock masters
* This is wrt the codec, the inverse is true for the interface
* i.e. if the codec is clk and frm master then the interface is
* clk and frame slave.
*/
#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */
#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */
#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */
#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */
#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
#define SND_SOC_DAIFMT_INV_MASK 0x0f00
#define SND_SOC_DAIFMT_MASTER_MASK 0xf000
/*
* Master Clock Directions
*/
#define SND_SOC_CLOCK_IN 0
#define SND_SOC_CLOCK_OUT 1
/*
* AC97 codec ID's bitmask
*/
#define SND_SOC_DAI_AC97_ID0 (1 << 0)
#define SND_SOC_DAI_AC97_ID1 (1 << 1)
#define SND_SOC_DAI_AC97_ID2 (1 << 2)
#define SND_SOC_DAI_AC97_ID3 (1 << 3)
struct snd_soc_device; struct snd_soc_device;
struct snd_soc_pcm_stream; struct snd_soc_pcm_stream;
struct snd_soc_ops; struct snd_soc_ops;
struct snd_soc_dai_mode; struct snd_soc_dai_mode;
struct snd_soc_pcm_runtime; struct snd_soc_pcm_runtime;
struct snd_soc_dai; struct snd_soc_dai;
struct snd_soc_platform;
struct snd_soc_codec; struct snd_soc_codec;
struct snd_soc_machine_config;
struct soc_enum; struct soc_enum;
struct snd_soc_ac97_ops; struct snd_soc_ac97_ops;
struct snd_soc_clock_info;
typedef int (*hw_write_t)(void *,const char* ,int); typedef int (*hw_write_t)(void *,const char* ,int);
typedef int (*hw_read_t)(void *,char* ,int); typedef int (*hw_read_t)(void *,char* ,int);
extern struct snd_ac97_bus_ops soc_ac97_ops; extern struct snd_ac97_bus_ops soc_ac97_ops;
int snd_soc_register_platform(struct snd_soc_platform *platform);
void snd_soc_unregister_platform(struct snd_soc_platform *platform);
int snd_soc_register_codec(struct snd_soc_codec *codec);
void snd_soc_unregister_codec(struct snd_soc_codec *codec);
/* pcm <-> DAI connect */ /* pcm <-> DAI connect */
void snd_soc_free_pcms(struct snd_soc_device *socdev); void snd_soc_free_pcms(struct snd_soc_device *socdev);
int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid); int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
int snd_soc_register_card(struct snd_soc_device *socdev); int snd_soc_init_card(struct snd_soc_device *socdev);
/* set runtime hw params */ /* set runtime hw params */
int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
...@@ -263,27 +187,6 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, ...@@ -263,27 +187,6 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
struct snd_ac97_bus_ops *ops, int num); struct snd_ac97_bus_ops *ops, int num);
void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
/* Digital Audio Interface clocking API.*/
int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir);
int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
int div_id, int div);
int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
int pll_id, unsigned int freq_in, unsigned int freq_out);
/* Digital Audio interface formatting */
int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int mask, int slots);
int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
/* Digital Audio Interface mute */
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
/* /*
*Controls *Controls
*/ */
...@@ -341,66 +244,14 @@ struct snd_soc_ops { ...@@ -341,66 +244,14 @@ struct snd_soc_ops {
int (*trigger)(struct snd_pcm_substream *, int); int (*trigger)(struct snd_pcm_substream *, int);
}; };
/* ASoC DAI ops */
struct snd_soc_dai_ops {
/* DAI clocking configuration */
int (*set_sysclk)(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir);
int (*set_pll)(struct snd_soc_dai *dai,
int pll_id, unsigned int freq_in, unsigned int freq_out);
int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
/* DAI format configuration */
int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
int (*set_tdm_slot)(struct snd_soc_dai *dai,
unsigned int mask, int slots);
int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
/* digital mute */
int (*digital_mute)(struct snd_soc_dai *dai, int mute);
};
/* SoC DAI (Digital Audio Interface) */
struct snd_soc_dai {
/* DAI description */
char *name;
unsigned int id;
unsigned char type;
/* DAI callbacks */
int (*probe)(struct platform_device *pdev,
struct snd_soc_dai *dai);
void (*remove)(struct platform_device *pdev,
struct snd_soc_dai *dai);
int (*suspend)(struct platform_device *pdev,
struct snd_soc_dai *dai);
int (*resume)(struct platform_device *pdev,
struct snd_soc_dai *dai);
/* ops */
struct snd_soc_ops ops;
struct snd_soc_dai_ops dai_ops;
/* DAI capabilities */
struct snd_soc_pcm_stream capture;
struct snd_soc_pcm_stream playback;
/* DAI runtime info */
struct snd_pcm_runtime *runtime;
struct snd_soc_codec *codec;
unsigned int active;
unsigned char pop_wait:1;
void *dma_data;
/* DAI private data */
void *private_data;
};
/* SoC Audio Codec */ /* SoC Audio Codec */
struct snd_soc_codec { struct snd_soc_codec {
char *name; char *name;
struct module *owner; struct module *owner;
struct mutex mutex; struct mutex mutex;
struct device *dev;
struct list_head list;
/* callbacks */ /* callbacks */
int (*set_bias_level)(struct snd_soc_codec *, int (*set_bias_level)(struct snd_soc_codec *,
...@@ -426,6 +277,7 @@ struct snd_soc_codec { ...@@ -426,6 +277,7 @@ struct snd_soc_codec {
short reg_cache_step; short reg_cache_step;
/* dapm */ /* dapm */
u32 pop_time;
struct list_head dapm_widgets; struct list_head dapm_widgets;
struct list_head dapm_paths; struct list_head dapm_paths;
enum snd_soc_bias_level bias_level; enum snd_soc_bias_level bias_level;
...@@ -435,6 +287,11 @@ struct snd_soc_codec { ...@@ -435,6 +287,11 @@ struct snd_soc_codec {
/* codec DAI's */ /* codec DAI's */
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
unsigned int num_dai; unsigned int num_dai;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_reg;
struct dentry *debugfs_pop_time;
#endif
}; };
/* codec device */ /* codec device */
...@@ -448,13 +305,12 @@ struct snd_soc_codec_device { ...@@ -448,13 +305,12 @@ struct snd_soc_codec_device {
/* SoC platform interface */ /* SoC platform interface */
struct snd_soc_platform { struct snd_soc_platform {
char *name; char *name;
struct list_head list;
int (*probe)(struct platform_device *pdev); int (*probe)(struct platform_device *pdev);
int (*remove)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev);
int (*suspend)(struct platform_device *pdev, int (*suspend)(struct snd_soc_dai *dai);
struct snd_soc_dai *dai); int (*resume)(struct snd_soc_dai *dai);
int (*resume)(struct platform_device *pdev,
struct snd_soc_dai *dai);
/* pcm creation and destruction */ /* pcm creation and destruction */
int (*pcm_new)(struct snd_card *, struct snd_soc_dai *, int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
...@@ -484,9 +340,14 @@ struct snd_soc_dai_link { ...@@ -484,9 +340,14 @@ struct snd_soc_dai_link {
struct snd_pcm *pcm; struct snd_pcm *pcm;
}; };
/* SoC machine */ /* SoC card */
struct snd_soc_machine { struct snd_soc_card {
char *name; char *name;
struct device *dev;
struct list_head list;
int instantiated;
int (*probe)(struct platform_device *pdev); int (*probe)(struct platform_device *pdev);
int (*remove)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev);
...@@ -499,23 +360,26 @@ struct snd_soc_machine { ...@@ -499,23 +360,26 @@ struct snd_soc_machine {
int (*resume_post)(struct platform_device *pdev); int (*resume_post)(struct platform_device *pdev);
/* callbacks */ /* callbacks */
int (*set_bias_level)(struct snd_soc_machine *, int (*set_bias_level)(struct snd_soc_card *,
enum snd_soc_bias_level level); enum snd_soc_bias_level level);
/* CPU <--> Codec DAI links */ /* CPU <--> Codec DAI links */
struct snd_soc_dai_link *dai_link; struct snd_soc_dai_link *dai_link;
int num_links; int num_links;
struct snd_soc_device *socdev;
struct snd_soc_platform *platform;
struct delayed_work delayed_work;
struct work_struct deferred_resume_work;
}; };
/* SoC Device - the audio subsystem */ /* SoC Device - the audio subsystem */
struct snd_soc_device { struct snd_soc_device {
struct device *dev; struct device *dev;
struct snd_soc_machine *machine; struct snd_soc_card *card;
struct snd_soc_platform *platform;
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct snd_soc_codec_device *codec_dev; struct snd_soc_codec_device *codec_dev;
struct delayed_work delayed_work;
struct work_struct deferred_resume_work;
void *codec_data; void *codec_data;
}; };
...@@ -542,4 +406,6 @@ struct soc_enum { ...@@ -542,4 +406,6 @@ struct soc_enum {
void *dapm; void *dapm;
}; };
#include <sound/soc-dai.h>
#endif #endif
/*
* uda134x.h -- UDA134x ALSA SoC Codec driver
*
* Copyright 2007 Dension Audio Systems Ltd.
* Author: Zoltan Devai
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _UDA134X_H
#define _UDA134X_H
#include <sound/l3.h>
struct uda134x_platform_data {
struct l3_pins l3;
void (*power) (int);
int model;
#define UDA134X_UDA1340 1
#define UDA134X_UDA1341 2
#define UDA134X_UDA1344 3
};
#endif /* _UDA134X_H */
...@@ -22,17 +22,16 @@ if SND_SOC ...@@ -22,17 +22,16 @@ if SND_SOC
config SND_SOC_AC97_BUS config SND_SOC_AC97_BUS
bool bool
# All the supported Soc's # All the supported SoCs
source "sound/soc/at32/Kconfig" source "sound/soc/atmel/Kconfig"
source "sound/soc/at91/Kconfig"
source "sound/soc/au1x/Kconfig" source "sound/soc/au1x/Kconfig"
source "sound/soc/blackfin/Kconfig"
source "sound/soc/davinci/Kconfig"
source "sound/soc/fsl/Kconfig"
source "sound/soc/omap/Kconfig"
source "sound/soc/pxa/Kconfig" source "sound/soc/pxa/Kconfig"
source "sound/soc/s3c24xx/Kconfig" source "sound/soc/s3c24xx/Kconfig"
source "sound/soc/sh/Kconfig" source "sound/soc/sh/Kconfig"
source "sound/soc/fsl/Kconfig"
source "sound/soc/davinci/Kconfig"
source "sound/soc/omap/Kconfig"
source "sound/soc/blackfin/Kconfig"
# Supported codecs # Supported codecs
source "sound/soc/codecs/Kconfig" source "sound/soc/codecs/Kconfig"
......
snd-soc-core-objs := soc-core.o soc-dapm.o snd-soc-core-objs := soc-core.o soc-dapm.o
obj-$(CONFIG_SND_SOC) += snd-soc-core.o obj-$(CONFIG_SND_SOC) += snd-soc-core.o
obj-$(CONFIG_SND_SOC) += codecs/ at32/ at91/ pxa/ s3c24xx/ sh/ fsl/ davinci/ obj-$(CONFIG_SND_SOC) += codecs/
obj-$(CONFIG_SND_SOC) += omap/ au1x/ blackfin/ obj-$(CONFIG_SND_SOC) += atmel/
obj-$(CONFIG_SND_SOC) += au1x/
obj-$(CONFIG_SND_SOC) += blackfin/
obj-$(CONFIG_SND_SOC) += davinci/
obj-$(CONFIG_SND_SOC) += fsl/
obj-$(CONFIG_SND_SOC) += omap/
obj-$(CONFIG_SND_SOC) += pxa/
obj-$(CONFIG_SND_SOC) += s3c24xx/
obj-$(CONFIG_SND_SOC) += sh/
# AT32 Platform Support
snd-soc-at32-objs := at32-pcm.o
snd-soc-at32-ssc-objs := at32-ssc.o
obj-$(CONFIG_SND_AT32_SOC) += snd-soc-at32.o
obj-$(CONFIG_SND_AT32_SOC_SSC) += snd-soc-at32-ssc.o
# AT32 Machine Support
snd-soc-playpaq-objs := playpaq_wm8510.o
obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o
/* sound/soc/at32/at32-pcm.h
* ASoC PCM interface for Atmel AT32 SoC
*
* Copyright (C) 2008 Long Range Systems
* Geoffrey Wossum <gwossum@acm.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __SOUND_SOC_AT32_AT32_PCM_H
#define __SOUND_SOC_AT32_AT32_PCM_H __FILE__
#include <linux/atmel-ssc.h>
/*
* Registers and status bits that are required by the PCM driver
* TODO: Is ptcr really used?
*/
struct at32_pdc_regs {
u32 xpr; /* PDC RX/TX pointer */
u32 xcr; /* PDC RX/TX counter */
u32 xnpr; /* PDC next RX/TX pointer */
u32 xncr; /* PDC next RX/TX counter */
u32 ptcr; /* PDC transfer control */
};
/*
* SSC mask info
*/
struct at32_ssc_mask {
u32 ssc_enable; /* SSC RX/TX enable */
u32 ssc_disable; /* SSC RX/TX disable */
u32 ssc_endx; /* SSC ENDTX or ENDRX */
u32 ssc_endbuf; /* SSC TXBUFF or RXBUFF */
u32 pdc_enable; /* PDC RX/TX enable */
u32 pdc_disable; /* PDC RX/TX disable */
};
/*
* This structure, shared between the PCM driver and the interface,
* contains all information required by the PCM driver to perform the
* PDC DMA operation. All fields except dma_intr_handler() are initialized
* by the interface. The dms_intr_handler() pointer is set by the PCM
* driver and called by the interface SSC interrupt handler if it is
* non-NULL.
*/
struct at32_pcm_dma_params {
char *name; /* stream identifier */
int pdc_xfer_size; /* PDC counter increment in bytes */
struct ssc_device *ssc; /* SSC device for stream */
struct at32_pdc_regs *pdc; /* PDC register info */
struct at32_ssc_mask *mask; /* SSC mask info */
struct snd_pcm_substream *substream;
void (*dma_intr_handler) (u32, struct snd_pcm_substream *);
};
/*
* The AT32 ASoC platform driver
*/
extern struct snd_soc_platform at32_soc_platform;
/*
* SSC register access (since ssc_writel() / ssc_readl() require literal name)
*/
#define ssc_readx(base, reg) (__raw_readl((base) + (reg)))
#define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg))
#endif /* __SOUND_SOC_AT32_AT32_PCM_H */
This diff is collapsed.
/* sound/soc/at32/at32-ssc.h
* ASoC SSC interface for Atmel AT32 SoC
*
* Copyright (C) 2008 Long Range Systems
* Geoffrey Wossum <gwossum@acm.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __SOUND_SOC_AT32_AT32_SSC_H
#define __SOUND_SOC_AT32_AT32_SSC_H __FILE__
#include <linux/types.h>
#include <linux/atmel-ssc.h>
#include "at32-pcm.h"
struct at32_ssc_state {
u32 ssc_cmr;
u32 ssc_rcmr;
u32 ssc_rfmr;
u32 ssc_tcmr;
u32 ssc_tfmr;
u32 ssc_sr;
u32 ssc_imr;
};
struct at32_ssc_info {
char *name;
struct ssc_device *ssc;
spinlock_t lock; /* lock for dir_mask */
unsigned short dir_mask; /* 0=unused, 1=playback, 2=capture */
unsigned short initialized; /* true if SSC has been initialized */
unsigned short daifmt;
unsigned short cmr_div;
unsigned short tcmr_period;
unsigned short rcmr_period;
struct at32_pcm_dma_params *dma_params[2];
struct at32_ssc_state ssc_state;
};
/* SSC divider ids */
#define AT32_SSC_CMR_DIV 0 /* MCK divider for BCLK */
#define AT32_SSC_TCMR_PERIOD 1 /* BCLK divider for transmit FS */
#define AT32_SSC_RCMR_PERIOD 2 /* BCLK divider for receive FS */
extern struct snd_soc_dai at32_ssc_dai[];
#endif /* __SOUND_SOC_AT32_AT32_SSC_H */
config SND_AT91_SOC
tristate "SoC Audio for the Atmel AT91 System-on-Chip"
depends on ARCH_AT91
help
Say Y or M if you want to add support for codecs attached to
the AT91 SSC interface. You will also need
to select the audio interfaces to support below.
config SND_AT91_SOC_SSC
tristate
# AT91 Platform Support
snd-soc-at91-objs := at91-pcm.o
snd-soc-at91-ssc-objs := at91-ssc.o
obj-$(CONFIG_SND_AT91_SOC) += snd-soc-at91.o
obj-$(CONFIG_SND_AT91_SOC_SSC) += snd-soc-at91-ssc.o
This diff is collapsed.
/*
* at91-ssc.h - ALSA SSC interface for the Atmel AT91 SoC
*
* Author: Frank Mandarino <fmandarino@endrelia.com>
* Endrelia Technologies Inc.
* Created: Jan 9, 2007
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _AT91_SSC_H
#define _AT91_SSC_H
/* SSC system clock ids */
#define AT91_SYSCLK_MCK 0 /* SSC uses AT91 MCK as system clock */
/* SSC divider ids */
#define AT91SSC_CMR_DIV 0 /* MCK divider for BCLK */
#define AT91SSC_TCMR_PERIOD 1 /* BCLK divider for transmit FS */
#define AT91SSC_RCMR_PERIOD 2 /* BCLK divider for receive FS */
extern struct snd_soc_dai at91_ssc_dai[];
#endif /* _AT91_SSC_H */
config SND_AT32_SOC config SND_ATMEL_SOC
tristate "SoC Audio for the Atmel AT32 System-on-a-Chip" tristate "SoC Audio for the Atmel System-on-Chip"
depends on AVR32 && SND_SOC depends on ARCH_AT91 || AVR32
help help
Say Y or M if you want to add support for codecs attached to Say Y or M if you want to add support for codecs attached to
the AT32 SSC interface. You will also need to the ATMEL SSC interface. You will also need
to select the audio interfaces to support below. to select the audio interfaces to support below.
config SND_ATMEL_SOC_SSC
config SND_AT32_SOC_SSC tristate
tristate depends on SND_ATMEL_SOC
help
Say Y or M if you want to add support for codecs the
ATMEL SSC interface. You will also needs to select the individual
machine drivers to support below.
config SND_AT91_SOC_SAM9G20_WM8731
tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC
select SND_ATMEL_SOC_SSC
select SND_SOC_WM8731
help
Say Y if you want to add support for SoC audio on WM8731-based
AT91sam9g20 evaluation board.
config SND_AT32_SOC_PLAYPAQ config SND_AT32_SOC_PLAYPAQ
tristate "SoC Audio support for PlayPaq with WM8510" tristate "SoC Audio support for PlayPaq with WM8510"
depends on SND_AT32_SOC && BOARD_PLAYPAQ depends on SND_ATMEL_SOC && BOARD_PLAYPAQ
select SND_AT32_SOC_SSC select SND_ATMEL_SOC_SSC
select SND_SOC_WM8510 select SND_SOC_WM8510
help help
Say Y or M here if you want to add support for SoC audio Say Y or M here if you want to add support for SoC audio
on the LRS PlayPaq. on the LRS PlayPaq.
config SND_AT32_SOC_PLAYPAQ_SLAVE config SND_AT32_SOC_PLAYPAQ_SLAVE
bool "Run CODEC on PlayPaq in slave mode" bool "Run CODEC on PlayPaq in slave mode"
depends on SND_AT32_SOC_PLAYPAQ depends on SND_AT32_SOC_PLAYPAQ
......
# AT91 Platform Support
snd-soc-atmel-pcm-objs := atmel-pcm.o
snd-soc-atmel_ssc_dai-objs := atmel_ssc_dai.o
obj-$(CONFIG_SND_ATMEL_SOC) += snd-soc-atmel-pcm.o
obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o
# AT91 Machine Support
snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o
# AT32 Machine Support
snd-soc-playpaq-objs := playpaq_wm8510.o
obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o
obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o
/* /*
* at91-pcm.h - ALSA PCM interface for the Atmel AT91 SoC * at91-pcm.h - ALSA PCM interface for the Atmel AT91 SoC.
* *
* Author: Frank Mandarino <fmandarino@endrelia.com> * Copyright (C) 2005 SAN People
* Endrelia Technologies Inc. * Copyright (C) 2008 Atmel
* Created: Mar 3, 2006
* *
* Based on pxa2xx-pcm.h by: * Authors: Sedji Gaouaou <sedji.gaouaou@atmel.com>
*
* Based on at91-pcm. by:
* Frank Mandarino <fmandarino@endrelia.com>
* Copyright 2006 Endrelia Technologies Inc.
*
* Based on pxa2xx-pcm.c by:
* *
* Author: Nicolas Pitre * Author: Nicolas Pitre
* Created: Nov 30, 2004 * Created: Nov 30, 2004
* Copyright: MontaVista Software, Inc. * Copyright: (C) 2004 MontaVista Software, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License as published by
* published by the Free Software Foundation. * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef _AT91_PCM_H #ifndef _ATMEL_PCM_H
#define _AT91_PCM_H #define _ATMEL_PCM_H
#include <mach/hardware.h> #include <linux/atmel-ssc.h>
struct at91_ssc_periph {
void __iomem *base;
u32 pid;
};
/* /*
* Registers and status bits that are required by the PCM driver. * Registers and status bits that are required by the PCM driver.
*/ */
struct at91_pdc_regs { struct atmel_pdc_regs {
unsigned int xpr; /* PDC recv/trans pointer */ unsigned int xpr; /* PDC recv/trans pointer */
unsigned int xcr; /* PDC recv/trans counter */ unsigned int xcr; /* PDC recv/trans counter */
unsigned int xnpr; /* PDC next recv/trans pointer */ unsigned int xnpr; /* PDC next recv/trans pointer */
...@@ -37,7 +47,7 @@ struct at91_pdc_regs { ...@@ -37,7 +47,7 @@ struct at91_pdc_regs {
unsigned int ptcr; /* PDC transfer control */ unsigned int ptcr; /* PDC transfer control */
}; };
struct at91_ssc_mask { struct atmel_ssc_mask {
u32 ssc_enable; /* SSC recv/trans enable */ u32 ssc_enable; /* SSC recv/trans enable */
u32 ssc_disable; /* SSC recv/trans disable */ u32 ssc_disable; /* SSC recv/trans disable */
u32 ssc_endx; /* SSC ENDTX or ENDRX */ u32 ssc_endx; /* SSC ENDTX or ENDRX */
...@@ -54,19 +64,23 @@ struct at91_ssc_mask { ...@@ -54,19 +64,23 @@ struct at91_ssc_mask {
* driver and called by the interface SSC interrupt handler if it is * driver and called by the interface SSC interrupt handler if it is
* non-NULL. * non-NULL.
*/ */
struct at91_pcm_dma_params { struct atmel_pcm_dma_params {
char *name; /* stream identifier */ char *name; /* stream identifier */
int pdc_xfer_size; /* PDC counter increment in bytes */ int pdc_xfer_size; /* PDC counter increment in bytes */
void __iomem *ssc_base; /* SSC base address */ struct ssc_device *ssc; /* SSC device for stream */
struct at91_pdc_regs *pdc; /* PDC receive or transmit registers */ struct atmel_pdc_regs *pdc; /* PDC receive or transmit registers */
struct at91_ssc_mask *mask;/* SSC & PDC status bits */ struct atmel_ssc_mask *mask; /* SSC & PDC status bits */
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
void (*dma_intr_handler)(u32, struct snd_pcm_substream *); void (*dma_intr_handler)(u32, struct snd_pcm_substream *);
}; };
extern struct snd_soc_platform at91_soc_platform; extern struct snd_soc_platform atmel_soc_platform;
#define at91_ssc_read(a) ((unsigned long) __raw_readl(a)) /*
#define at91_ssc_write(a,v) __raw_writel((v),(a)) * SSC register access (since ssc_writel() / ssc_readl() require literal name)
*/
#define ssc_readx(base, reg) (__raw_readl((base) + (reg)))
#define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg))
#endif /* _AT91_PCM_H */ #endif /* _ATMEL_PCM_H */
/*
* atmel_ssc_dai.h - ALSA SSC interface for the Atmel SoC
*
* Copyright (C) 2005 SAN People
* Copyright (C) 2008 Atmel
*
* Author: Sedji Gaouaou <sedji.gaouaou@atmel.com>
* ATMEL CORP.
*
* Based on at91-ssc.c by
* Frank Mandarino <fmandarino@endrelia.com>
* Based on pxa2xx Platform drivers by
* Liam Girdwood <liam.girdwood@wolfsonmicro.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _ATMEL_SSC_DAI_H
#define _ATMEL_SSC_DAI_H
#include <linux/types.h>
#include <linux/atmel-ssc.h>
#include "atmel-pcm.h"
/* SSC system clock ids */
#define ATMEL_SYSCLK_MCK 0 /* SSC uses AT91 MCK as system clock */
/* SSC divider ids */
#define ATMEL_SSC_CMR_DIV 0 /* MCK divider for BCLK */
#define ATMEL_SSC_TCMR_PERIOD 1 /* BCLK divider for transmit FS */
#define ATMEL_SSC_RCMR_PERIOD 2 /* BCLK divider for receive FS */
/*
* SSC direction masks
*/
#define SSC_DIR_MASK_UNUSED 0
#define SSC_DIR_MASK_PLAYBACK 1
#define SSC_DIR_MASK_CAPTURE 2
/*
* SSC register values that Atmel left out of <linux/atmel-ssc.h>. These
* are expected to be used with SSC_BF
*/
/* START bit field values */
#define SSC_START_CONTINUOUS 0
#define SSC_START_TX_RX 1
#define SSC_START_LOW_RF 2
#define SSC_START_HIGH_RF 3
#define SSC_START_FALLING_RF 4
#define SSC_START_RISING_RF 5
#define SSC_START_LEVEL_RF 6
#define SSC_START_EDGE_RF 7
#define SSS_START_COMPARE_0 8
/* CKI bit field values */
#define SSC_CKI_FALLING 0
#define SSC_CKI_RISING 1
/* CKO bit field values */
#define SSC_CKO_NONE 0
#define SSC_CKO_CONTINUOUS 1
#define SSC_CKO_TRANSFER 2
/* CKS bit field values */
#define SSC_CKS_DIV 0
#define SSC_CKS_CLOCK 1
#define SSC_CKS_PIN 2
/* FSEDGE bit field values */
#define SSC_FSEDGE_POSITIVE 0
#define SSC_FSEDGE_NEGATIVE 1
/* FSOS bit field values */
#define SSC_FSOS_NONE 0
#define SSC_FSOS_NEGATIVE 1
#define SSC_FSOS_POSITIVE 2
#define SSC_FSOS_LOW 3
#define SSC_FSOS_HIGH 4
#define SSC_FSOS_TOGGLE 5
#define START_DELAY 1
struct atmel_ssc_state {
u32 ssc_cmr;
u32 ssc_rcmr;
u32 ssc_rfmr;
u32 ssc_tcmr;
u32 ssc_tfmr;
u32 ssc_sr;
u32 ssc_imr;
};
struct atmel_ssc_info {
char *name;
struct ssc_device *ssc;
spinlock_t lock; /* lock for dir_mask */
unsigned short dir_mask; /* 0=unused, 1=playback, 2=capture */
unsigned short initialized; /* true if SSC has been initialized */
unsigned short daifmt;
unsigned short cmr_div;
unsigned short tcmr_period;
unsigned short rcmr_period;
struct atmel_pcm_dma_params *dma_params[2];
struct atmel_ssc_state ssc_state;
};
extern struct snd_soc_dai atmel_ssc_dai[];
#endif /* _AT91_SSC_DAI_H */
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/clk.h> #include <linux/clk.h>
...@@ -40,8 +39,8 @@ ...@@ -40,8 +39,8 @@
#include <mach/portmux.h> #include <mach/portmux.h>
#include "../codecs/wm8510.h" #include "../codecs/wm8510.h"
#include "at32-pcm.h" #include "atmel-pcm.h"
#include "at32-ssc.h" #include "atmel_ssc_dai.h"
/*-------------------------------------------------------------------------*\ /*-------------------------------------------------------------------------*\
...@@ -362,8 +361,9 @@ static struct snd_soc_dai_link playpaq_wm8510_dai = { ...@@ -362,8 +361,9 @@ static struct snd_soc_dai_link playpaq_wm8510_dai = {
static struct snd_soc_machine snd_soc_machine_playpaq = { static struct snd_soc_card snd_soc_playpaq = {
.name = "LRS_PlayPaq_WM8510", .name = "LRS_PlayPaq_WM8510",
.platform = &at32_soc_platform,
.dai_link = &playpaq_wm8510_dai, .dai_link = &playpaq_wm8510_dai,
.num_links = 1, .num_links = 1,
}; };
...@@ -378,8 +378,7 @@ static struct wm8510_setup_data playpaq_wm8510_setup = { ...@@ -378,8 +378,7 @@ static struct wm8510_setup_data playpaq_wm8510_setup = {
static struct snd_soc_device playpaq_wm8510_snd_devdata = { static struct snd_soc_device playpaq_wm8510_snd_devdata = {
.machine = &snd_soc_machine_playpaq, .card = &snd_soc_playpaq,
.platform = &at32_soc_platform,
.codec_dev = &soc_codec_dev_wm8510, .codec_dev = &soc_codec_dev_wm8510,
.codec_data = &playpaq_wm8510_setup, .codec_data = &playpaq_wm8510_setup,
}; };
......
/*
* sam9g20_wm8731 -- SoC audio for AT91SAM9G20-based
* ATMEL AT91SAM9G20ek board.
*
* Copyright (C) 2005 SAN People
* Copyright (C) 2008 Atmel
*
* Authors: Sedji Gaouaou <sedji.gaouaou@atmel.com>
*
* Based on ati_b1_wm8731.c by:
* Frank Mandarino <fmandarino@endrelia.com>
* Copyright 2006 Endrelia Technologies Inc.
* Based on corgi.c by:
* Copyright 2005 Wolfson Microelectronics PLC.
* Copyright 2005 Openedhand Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/clk.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/atmel-ssc.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <mach/hardware.h>
#include <mach/gpio.h>
#include "../codecs/wm8731.h"
#include "atmel-pcm.h"
#include "atmel_ssc_dai.h"
static int at91sam9g20ek_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
int ret;
/* codec system clock is supplied by PCK0, set to 12MHz */
ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK,
12000000, SND_SOC_CLOCK_IN);
if (ret < 0)
return ret;
return 0;
}
static void at91sam9g20ek_shutdown(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
dev_dbg(rtd->socdev->dev, "shutdown");
}
static int at91sam9g20ek_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
struct atmel_ssc_info *ssc_p = cpu_dai->private_data;
struct ssc_device *ssc = ssc_p->ssc;
int ret;
unsigned int rate;
int cmr_div, period;
if (ssc == NULL) {
printk(KERN_INFO "at91sam9g20ek_hw_params: ssc is NULL!\n");
return -EINVAL;
}
/* set codec DAI configuration */
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
if (ret < 0)
return ret;
/* set cpu DAI configuration */
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
if (ret < 0)
return ret;
/*
* The SSC clock dividers depend on the sample rate. The CMR.DIV
* field divides the system master clock MCK to drive the SSC TK
* signal which provides the codec BCLK. The TCMR.PERIOD and
* RCMR.PERIOD fields further divide the BCLK signal to drive
* the SSC TF and RF signals which provide the codec DACLRC and
* ADCLRC clocks.
*
* The dividers were determined through trial and error, where a
* CMR.DIV value is chosen such that the resulting BCLK value is
* divisible, or almost divisible, by (2 * sample rate), and then
* the TCMR.PERIOD or RCMR.PERIOD is BCLK / (2 * sample rate) - 1.
*/
rate = params_rate(params);
switch (rate) {
case 8000:
cmr_div = 55; /* BCLK = 133MHz/(2*55) = 1.209MHz */
period = 74; /* LRC = BCLK/(2*(74+1)) ~= 8060,6Hz */
break;
case 11025:
cmr_div = 67; /* BCLK = 133MHz/(2*60) = 1.108MHz */
period = 45; /* LRC = BCLK/(2*(49+1)) = 11083,3Hz */
break;
case 16000:
cmr_div = 63; /* BCLK = 133MHz/(2*63) = 1.055MHz */
period = 32; /* LRC = BCLK/(2*(32+1)) = 15993,2Hz */
break;
case 22050:
cmr_div = 52; /* BCLK = 133MHz/(2*52) = 1.278MHz */
period = 28; /* LRC = BCLK/(2*(28+1)) = 22049Hz */
break;
case 32000:
cmr_div = 66; /* BCLK = 133MHz/(2*66) = 1.007MHz */
period = 15; /* LRC = BCLK/(2*(15+1)) = 31486,742Hz */
break;
case 44100:
cmr_div = 29; /* BCLK = 133MHz/(2*29) = 2.293MHz */
period = 25; /* LRC = BCLK/(2*(25+1)) = 44098Hz */
break;
case 48000:
cmr_div = 33; /* BCLK = 133MHz/(2*33) = 2.015MHz */
period = 20; /* LRC = BCLK/(2*(20+1)) = 47979,79Hz */
break;
case 88200:
cmr_div = 29; /* BCLK = 133MHz/(2*29) = 2.293MHz */
period = 12; /* LRC = BCLK/(2*(12+1)) = 88196Hz */
break;
case 96000:
cmr_div = 23; /* BCLK = 133MHz/(2*23) = 2.891MHz */
period = 14; /* LRC = BCLK/(2*(14+1)) = 96376Hz */
break;
default:
printk(KERN_WARNING "unsupported rate %d"
" on at91sam9g20ek board\n", rate);
return -EINVAL;
}
/* set the MCK divider for BCLK */
ret = snd_soc_dai_set_clkdiv(cpu_dai, ATMEL_SSC_CMR_DIV, cmr_div);
if (ret < 0)
return ret;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
/* set the BCLK divider for DACLRC */
ret = snd_soc_dai_set_clkdiv(cpu_dai,
ATMEL_SSC_TCMR_PERIOD, period);
} else {
/* set the BCLK divider for ADCLRC */
ret = snd_soc_dai_set_clkdiv(cpu_dai,
ATMEL_SSC_RCMR_PERIOD, period);
}
if (ret < 0)
return ret;
return 0;
}
static struct snd_soc_ops at91sam9g20ek_ops = {
.startup = at91sam9g20ek_startup,
.hw_params = at91sam9g20ek_hw_params,
.shutdown = at91sam9g20ek_shutdown,
};
static const struct snd_soc_dapm_widget at91sam9g20ek_dapm_widgets[] = {
SND_SOC_DAPM_MIC("Int Mic", NULL),
SND_SOC_DAPM_SPK("Ext Spk", NULL),
};
static const struct snd_soc_dapm_route intercon[] = {
/* speaker connected to LHPOUT */
{"Ext Spk", NULL, "LHPOUT"},
/* mic is connected to Mic Jack, with WM8731 Mic Bias */
{"MICIN", NULL, "Mic Bias"},
{"Mic Bias", NULL, "Int Mic"},
};
/*
* Logic for a wm8731 as connected on a at91sam9g20ek board.
*/
static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec)
{
printk(KERN_DEBUG
"at91sam9g20ek_wm8731 "
": at91sam9g20ek_wm8731_init() called\n");
/* Add specific widgets */
snd_soc_dapm_new_controls(codec, at91sam9g20ek_dapm_widgets,
ARRAY_SIZE(at91sam9g20ek_dapm_widgets));
/* Set up specific audio path interconnects */
snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon));
/* not connected */
snd_soc_dapm_disable_pin(codec, "RLINEIN");
snd_soc_dapm_disable_pin(codec, "LLINEIN");
/* always connected */
snd_soc_dapm_enable_pin(codec, "Int Mic");
snd_soc_dapm_enable_pin(codec, "Ext Spk");
snd_soc_dapm_sync(codec);
return 0;
}
static struct snd_soc_dai_link at91sam9g20ek_dai = {
.name = "WM8731",
.stream_name = "WM8731 PCM",
.cpu_dai = &atmel_ssc_dai[0],
.codec_dai = &wm8731_dai,
.init = at91sam9g20ek_wm8731_init,
.ops = &at91sam9g20ek_ops,
};
static struct snd_soc_card snd_soc_at91sam9g20ek = {
.name = "WM8731",
.platform = &atmel_soc_platform,
.dai_link = &at91sam9g20ek_dai,
.num_links = 1,
};
static struct wm8731_setup_data at91sam9g20ek_wm8731_setup = {
.i2c_bus = 0,
.i2c_address = 0x1b,
};
static struct snd_soc_device at91sam9g20ek_snd_devdata = {
.card = &snd_soc_at91sam9g20ek,
.codec_dev = &soc_codec_dev_wm8731,
.codec_data = &at91sam9g20ek_wm8731_setup,
};
static struct platform_device *at91sam9g20ek_snd_device;
static int __init at91sam9g20ek_init(void)
{
struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data;
struct ssc_device *ssc = NULL;
int ret;
/*
* Request SSC device
*/
ssc = ssc_request(0);
if (IS_ERR(ssc)) {
ret = PTR_ERR(ssc);
ssc = NULL;
goto err_ssc;
}
ssc_p->ssc = ssc;
at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1);
if (!at91sam9g20ek_snd_device) {
printk(KERN_DEBUG
"platform device allocation failed\n");
ret = -ENOMEM;
}
platform_set_drvdata(at91sam9g20ek_snd_device,
&at91sam9g20ek_snd_devdata);
at91sam9g20ek_snd_devdata.dev = &at91sam9g20ek_snd_device->dev;
ret = platform_device_add(at91sam9g20ek_snd_device);
if (ret) {
printk(KERN_DEBUG
"platform device allocation failed\n");
platform_device_put(at91sam9g20ek_snd_device);
}
return ret;
err_ssc:
return ret;
}
static void __exit at91sam9g20ek_exit(void)
{
struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data;
struct ssc_device *ssc;
if (ssc_p != NULL) {
ssc = ssc_p->ssc;
if (ssc != NULL)
ssc_free(ssc);
ssc_p->ssc = NULL;
}
platform_device_unregister(at91sam9g20ek_snd_device);
at91sam9g20ek_snd_device = NULL;
}
module_init(at91sam9g20ek_init);
module_exit(at91sam9g20ek_exit);
/* Module information */
MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>");
MODULE_DESCRIPTION("ALSA SoC AT91SAM9G20EK_WM8731");
MODULE_LICENSE("GPL");
...@@ -406,11 +406,12 @@ static int __init au1xpsc_audio_dbdma_init(void) ...@@ -406,11 +406,12 @@ static int __init au1xpsc_audio_dbdma_init(void)
{ {
au1xpsc_audio_pcmdma[PCM_TX] = NULL; au1xpsc_audio_pcmdma[PCM_TX] = NULL;
au1xpsc_audio_pcmdma[PCM_RX] = NULL; au1xpsc_audio_pcmdma[PCM_RX] = NULL;
return 0; return snd_soc_register_platform(&au1xpsc_soc_platform);
} }
static void __exit au1xpsc_audio_dbdma_exit(void) static void __exit au1xpsc_audio_dbdma_exit(void)
{ {
snd_soc_unregister_platform(&au1xpsc_soc_platform);
} }
module_init(au1xpsc_audio_dbdma_init); module_init(au1xpsc_audio_dbdma_init);
......
...@@ -160,7 +160,8 @@ struct snd_ac97_bus_ops soc_ac97_ops = { ...@@ -160,7 +160,8 @@ struct snd_ac97_bus_ops soc_ac97_ops = {
EXPORT_SYMBOL_GPL(soc_ac97_ops); EXPORT_SYMBOL_GPL(soc_ac97_ops);
static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream, static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ {
/* FIXME */ /* FIXME */
struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata; struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
...@@ -210,7 +211,7 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream, ...@@ -210,7 +211,7 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
} }
static int au1xpsc_ac97_trigger(struct snd_pcm_substream *substream, static int au1xpsc_ac97_trigger(struct snd_pcm_substream *substream,
int cmd) int cmd, struct snd_soc_dai *dai)
{ {
/* FIXME */ /* FIXME */
struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata; struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
...@@ -313,8 +314,7 @@ static void au1xpsc_ac97_remove(struct platform_device *pdev, ...@@ -313,8 +314,7 @@ static void au1xpsc_ac97_remove(struct platform_device *pdev,
au1xpsc_ac97_workdata = NULL; au1xpsc_ac97_workdata = NULL;
} }
static int au1xpsc_ac97_suspend(struct platform_device *pdev, static int au1xpsc_ac97_suspend(struct snd_soc_dai *dai)
struct snd_soc_dai *dai)
{ {
/* save interesting registers and disable PSC */ /* save interesting registers and disable PSC */
au1xpsc_ac97_workdata->pm[0] = au1xpsc_ac97_workdata->pm[0] =
...@@ -328,8 +328,7 @@ static int au1xpsc_ac97_suspend(struct platform_device *pdev, ...@@ -328,8 +328,7 @@ static int au1xpsc_ac97_suspend(struct platform_device *pdev,
return 0; return 0;
} }
static int au1xpsc_ac97_resume(struct platform_device *pdev, static int au1xpsc_ac97_resume(struct snd_soc_dai *dai)
struct snd_soc_dai *dai)
{ {
/* restore PSC clock config */ /* restore PSC clock config */
au_writel(au1xpsc_ac97_workdata->pm[0] | PSC_SEL_PS_AC97MODE, au_writel(au1xpsc_ac97_workdata->pm[0] | PSC_SEL_PS_AC97MODE,
...@@ -345,7 +344,7 @@ static int au1xpsc_ac97_resume(struct platform_device *pdev, ...@@ -345,7 +344,7 @@ static int au1xpsc_ac97_resume(struct platform_device *pdev,
struct snd_soc_dai au1xpsc_ac97_dai = { struct snd_soc_dai au1xpsc_ac97_dai = {
.name = "au1xpsc_ac97", .name = "au1xpsc_ac97",
.type = SND_SOC_DAI_AC97, .ac97_control = 1,
.probe = au1xpsc_ac97_probe, .probe = au1xpsc_ac97_probe,
.remove = au1xpsc_ac97_remove, .remove = au1xpsc_ac97_remove,
.suspend = au1xpsc_ac97_suspend, .suspend = au1xpsc_ac97_suspend,
...@@ -372,11 +371,12 @@ EXPORT_SYMBOL_GPL(au1xpsc_ac97_dai); ...@@ -372,11 +371,12 @@ EXPORT_SYMBOL_GPL(au1xpsc_ac97_dai);
static int __init au1xpsc_ac97_init(void) static int __init au1xpsc_ac97_init(void)
{ {
au1xpsc_ac97_workdata = NULL; au1xpsc_ac97_workdata = NULL;
return 0; return snd_soc_register_dai(&au1xpsc_ac97_dai);
} }
static void __exit au1xpsc_ac97_exit(void) static void __exit au1xpsc_ac97_exit(void)
{ {
snd_soc_unregister_dai(&au1xpsc_ac97_dai);
} }
module_init(au1xpsc_ac97_init); module_init(au1xpsc_ac97_init);
......
...@@ -116,7 +116,8 @@ static int au1xpsc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, ...@@ -116,7 +116,8 @@ static int au1xpsc_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
} }
static int au1xpsc_i2s_hw_params(struct snd_pcm_substream *substream, static int au1xpsc_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{ {
struct au1xpsc_audio_data *pscdata = au1xpsc_i2s_workdata; struct au1xpsc_audio_data *pscdata = au1xpsc_i2s_workdata;
...@@ -240,7 +241,8 @@ static int au1xpsc_i2s_stop(struct au1xpsc_audio_data *pscdata, int stype) ...@@ -240,7 +241,8 @@ static int au1xpsc_i2s_stop(struct au1xpsc_audio_data *pscdata, int stype)
return 0; return 0;
} }
static int au1xpsc_i2s_trigger(struct snd_pcm_substream *substream, int cmd) static int au1xpsc_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{ {
struct au1xpsc_audio_data *pscdata = au1xpsc_i2s_workdata; struct au1xpsc_audio_data *pscdata = au1xpsc_i2s_workdata;
int ret, stype = SUBSTREAM_TYPE(substream); int ret, stype = SUBSTREAM_TYPE(substream);
...@@ -337,8 +339,7 @@ static void au1xpsc_i2s_remove(struct platform_device *pdev, ...@@ -337,8 +339,7 @@ static void au1xpsc_i2s_remove(struct platform_device *pdev,
au1xpsc_i2s_workdata = NULL; au1xpsc_i2s_workdata = NULL;
} }
static int au1xpsc_i2s_suspend(struct platform_device *pdev, static int au1xpsc_i2s_suspend(struct snd_soc_dai *cpu_dai)
struct snd_soc_dai *cpu_dai)
{ {
/* save interesting register and disable PSC */ /* save interesting register and disable PSC */
au1xpsc_i2s_workdata->pm[0] = au1xpsc_i2s_workdata->pm[0] =
...@@ -352,8 +353,7 @@ static int au1xpsc_i2s_suspend(struct platform_device *pdev, ...@@ -352,8 +353,7 @@ static int au1xpsc_i2s_suspend(struct platform_device *pdev,
return 0; return 0;
} }
static int au1xpsc_i2s_resume(struct platform_device *pdev, static int au1xpsc_i2s_resume(struct snd_soc_dai *cpu_dai)
struct snd_soc_dai *cpu_dai)
{ {
/* select I2S mode and PSC clock */ /* select I2S mode and PSC clock */
au_writel(PSC_CTRL_DISABLE, PSC_CTRL(au1xpsc_i2s_workdata)); au_writel(PSC_CTRL_DISABLE, PSC_CTRL(au1xpsc_i2s_workdata));
...@@ -369,7 +369,6 @@ static int au1xpsc_i2s_resume(struct platform_device *pdev, ...@@ -369,7 +369,6 @@ static int au1xpsc_i2s_resume(struct platform_device *pdev,
struct snd_soc_dai au1xpsc_i2s_dai = { struct snd_soc_dai au1xpsc_i2s_dai = {
.name = "au1xpsc_i2s", .name = "au1xpsc_i2s",
.type = SND_SOC_DAI_I2S,
.probe = au1xpsc_i2s_probe, .probe = au1xpsc_i2s_probe,
.remove = au1xpsc_i2s_remove, .remove = au1xpsc_i2s_remove,
.suspend = au1xpsc_i2s_suspend, .suspend = au1xpsc_i2s_suspend,
...@@ -389,8 +388,6 @@ struct snd_soc_dai au1xpsc_i2s_dai = { ...@@ -389,8 +388,6 @@ struct snd_soc_dai au1xpsc_i2s_dai = {
.ops = { .ops = {
.trigger = au1xpsc_i2s_trigger, .trigger = au1xpsc_i2s_trigger,
.hw_params = au1xpsc_i2s_hw_params, .hw_params = au1xpsc_i2s_hw_params,
},
.dai_ops = {
.set_fmt = au1xpsc_i2s_set_fmt, .set_fmt = au1xpsc_i2s_set_fmt,
}, },
}; };
...@@ -399,11 +396,12 @@ EXPORT_SYMBOL(au1xpsc_i2s_dai); ...@@ -399,11 +396,12 @@ EXPORT_SYMBOL(au1xpsc_i2s_dai);
static int __init au1xpsc_i2s_init(void) static int __init au1xpsc_i2s_init(void)
{ {
au1xpsc_i2s_workdata = NULL; au1xpsc_i2s_workdata = NULL;
return 0; return snd_soc_register_dai(&au1xpsc_i2s_dai);
} }
static void __exit au1xpsc_i2s_exit(void) static void __exit au1xpsc_i2s_exit(void)
{ {
snd_soc_unregister_dai(&au1xpsc_i2s_dai);
} }
module_init(au1xpsc_i2s_init); module_init(au1xpsc_i2s_init);
......
...@@ -42,14 +42,14 @@ static struct snd_soc_dai_link au1xpsc_sample_ac97_dai = { ...@@ -42,14 +42,14 @@ static struct snd_soc_dai_link au1xpsc_sample_ac97_dai = {
.ops = NULL, .ops = NULL,
}; };
static struct snd_soc_machine au1xpsc_sample_ac97_machine = { static struct snd_soc_card au1xpsc_sample_ac97_machine = {
.name = "Au1xxx PSC AC97 Audio", .name = "Au1xxx PSC AC97 Audio",
.dai_link = &au1xpsc_sample_ac97_dai, .dai_link = &au1xpsc_sample_ac97_dai,
.num_links = 1, .num_links = 1,
}; };
static struct snd_soc_device au1xpsc_sample_ac97_devdata = { static struct snd_soc_device au1xpsc_sample_ac97_devdata = {
.machine = &au1xpsc_sample_ac97_machine, .card = &au1xpsc_sample_ac97_machine,
.platform = &au1xpsc_soc_platform, /* see dbdma2.c */ .platform = &au1xpsc_soc_platform, /* see dbdma2.c */
.codec_dev = &soc_codec_dev_ac97, .codec_dev = &soc_codec_dev_ac97,
}; };
......
config SND_BF5XX_I2S config SND_BF5XX_I2S
tristate "SoC I2S Audio for the ADI BF5xx chip" tristate "SoC I2S Audio for the ADI BF5xx chip"
depends on BLACKFIN && SND_SOC depends on BLACKFIN
help help
Say Y or M if you want to add support for codecs attached to Say Y or M if you want to add support for codecs attached to
the Blackfin SPORT (synchronous serial ports) interface in I2S the Blackfin SPORT (synchronous serial ports) interface in I2S
...@@ -13,7 +13,6 @@ config SND_BF5XX_SOC_SSM2602 ...@@ -13,7 +13,6 @@ config SND_BF5XX_SOC_SSM2602
select SND_BF5XX_SOC_I2S select SND_BF5XX_SOC_I2S
select SND_SOC_SSM2602 select SND_SOC_SSM2602
select I2C select I2C
select I2C_BLACKFIN_TWI
help help
Say Y if you want to add support for SoC audio on BF527-EZKIT. Say Y if you want to add support for SoC audio on BF527-EZKIT.
...@@ -35,7 +34,7 @@ config SND_BFIN_AD73311_SE ...@@ -35,7 +34,7 @@ config SND_BFIN_AD73311_SE
config SND_BF5XX_AC97 config SND_BF5XX_AC97
tristate "SoC AC97 Audio for the ADI BF5xx chip" tristate "SoC AC97 Audio for the ADI BF5xx chip"
depends on BLACKFIN && SND_SOC depends on BLACKFIN
help help
Say Y or M if you want to add support for codecs attached to Say Y or M if you want to add support for codecs attached to
the Blackfin SPORT (synchronous serial ports) interface in slot 16 the Blackfin SPORT (synchronous serial ports) interface in slot 16
...@@ -47,7 +46,7 @@ config SND_BF5XX_AC97 ...@@ -47,7 +46,7 @@ config SND_BF5XX_AC97
properly with this driver. This driver is known to work with the properly with this driver. This driver is known to work with the
Analog Devices line of AC97 codecs. Analog Devices line of AC97 codecs.
config SND_MMAP_SUPPORT config SND_BF5XX_MMAP_SUPPORT
bool "Enable MMAP Support" bool "Enable MMAP Support"
depends on SND_BF5XX_AC97 depends on SND_BF5XX_AC97
default y default y
...@@ -55,9 +54,17 @@ config SND_MMAP_SUPPORT ...@@ -55,9 +54,17 @@ config SND_MMAP_SUPPORT
Say y if you want AC97 driver to support mmap mode. Say y if you want AC97 driver to support mmap mode.
We introduce an intermediate buffer to simulate mmap. We introduce an intermediate buffer to simulate mmap.
config SND_BF5XX_MULTICHAN_SUPPORT
bool "Enable Multichannel Support"
depends on SND_BF5XX_AC97
default n
help
Say y if you want AC97 driver to support up to 5.1 channel audio.
this mode will consume much more memory for DMA.
config SND_BF5XX_SOC_SPORT config SND_BF5XX_SOC_SPORT
tristate tristate
config SND_BF5XX_SOC_I2S config SND_BF5XX_SOC_I2S
tristate tristate
select SND_BF5XX_SOC_SPORT select SND_BF5XX_SOC_SPORT
...@@ -80,7 +87,7 @@ config SND_BF5XX_SPORT_NUM ...@@ -80,7 +87,7 @@ config SND_BF5XX_SPORT_NUM
int "Set a SPORT for Sound chip" int "Set a SPORT for Sound chip"
depends on (SND_BF5XX_I2S || SND_BF5XX_AC97) depends on (SND_BF5XX_I2S || SND_BF5XX_AC97)
range 0 3 if BF54x range 0 3 if BF54x
range 0 1 if (BF53x || BF561) range 0 1 if !BF54x
default 0 default 0
help help
Set the correct SPORT for sound chip. Set the correct SPORT for sound chip.
...@@ -90,12 +97,13 @@ config SND_BF5XX_HAVE_COLD_RESET ...@@ -90,12 +97,13 @@ config SND_BF5XX_HAVE_COLD_RESET
depends on SND_BF5XX_AC97 depends on SND_BF5XX_AC97
default y if BFIN548_EZKIT default y if BFIN548_EZKIT
default n if !BFIN548_EZKIT default n if !BFIN548_EZKIT
config SND_BF5XX_RESET_GPIO_NUM config SND_BF5XX_RESET_GPIO_NUM
int "Set a GPIO for cold reset" int "Set a GPIO for cold reset"
depends on SND_BF5XX_HAVE_COLD_RESET depends on SND_BF5XX_HAVE_COLD_RESET
range 0 159 range 0 159
default 19 if BFIN548_EZKIT default 19 if BFIN548_EZKIT
default 5 if BFIN537_STAMP default 5 if BFIN537_STAMP
default 0
help help
Set the correct GPIO for RESET the sound chip. Set the correct GPIO for RESET the sound chip.
This diff is collapsed.
This diff is collapsed.
...@@ -16,21 +16,46 @@ struct ac97_frame { ...@@ -16,21 +16,46 @@ struct ac97_frame {
u16 ac97_tag; /* slot 0 */ u16 ac97_tag; /* slot 0 */
u16 ac97_addr; /* slot 1 */ u16 ac97_addr; /* slot 1 */
u16 ac97_data; /* slot 2 */ u16 ac97_data; /* slot 2 */
u32 ac97_pcm; /* slot 3 and 4: left and right pcm data */ u16 ac97_pcm_l; /*slot 3:front left*/
u16 ac97_pcm_r; /*slot 4:front left*/
#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
u16 ac97_mdm_l1;
u16 ac97_center; /*slot 6:center*/
u16 ac97_sl; /*slot 7:surround left*/
u16 ac97_sr; /*slot 8:surround right*/
u16 ac97_lfe; /*slot 9:lfe*/
#endif
} __attribute__ ((packed)); } __attribute__ ((packed));
/* Speaker location */
#define SP_FL 0x0001
#define SP_FR 0x0010
#define SP_FC 0x0002
#define SP_LFE 0x0020
#define SP_SL 0x0004
#define SP_SR 0x0040
#define SP_STEREO (SP_FL | SP_FR)
#define SP_2DOT1 (SP_FL | SP_FR | SP_LFE)
#define SP_QUAD (SP_FL | SP_FR | SP_SL | SP_SR)
#define SP_5DOT1 (SP_FL | SP_FR | SP_FC | SP_LFE | SP_SL | SP_SR)
#define TAG_VALID 0x8000 #define TAG_VALID 0x8000
#define TAG_CMD 0x6000 #define TAG_CMD 0x6000
#define TAG_PCM_LEFT 0x1000 #define TAG_PCM_LEFT 0x1000
#define TAG_PCM_RIGHT 0x0800 #define TAG_PCM_RIGHT 0x0800
#define TAG_PCM (TAG_PCM_LEFT | TAG_PCM_RIGHT) #define TAG_PCM_MDM_L1 0x0400
#define TAG_PCM_CENTER 0x0200
#define TAG_PCM_SL 0x0100
#define TAG_PCM_SR 0x0080
#define TAG_PCM_LFE 0x0040
extern struct snd_soc_dai bfin_ac97_dai; extern struct snd_soc_dai bfin_ac97_dai;
void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u32 *src, \ void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, \
size_t count); size_t count, unsigned int chan_mask);
void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u32 *dst, \ void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u16 *dst, \
size_t count); size_t count);
#endif #endif
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "bf5xx-ac97-pcm.h" #include "bf5xx-ac97-pcm.h"
#include "bf5xx-ac97.h" #include "bf5xx-ac97.h"
static struct snd_soc_machine bf5xx_board; static struct snd_soc_card bf5xx_board;
static int bf5xx_board_startup(struct snd_pcm_substream *substream) static int bf5xx_board_startup(struct snd_pcm_substream *substream)
{ {
...@@ -67,15 +67,15 @@ static struct snd_soc_dai_link bf5xx_board_dai = { ...@@ -67,15 +67,15 @@ static struct snd_soc_dai_link bf5xx_board_dai = {
.ops = &bf5xx_board_ops, .ops = &bf5xx_board_ops,
}; };
static struct snd_soc_machine bf5xx_board = { static struct snd_soc_card bf5xx_board = {
.name = "bf5xx-board", .name = "bf5xx-board",
.platform = &bf5xx_ac97_soc_platform,
.dai_link = &bf5xx_board_dai, .dai_link = &bf5xx_board_dai,
.num_links = 1, .num_links = 1,
}; };
static struct snd_soc_device bf5xx_board_snd_devdata = { static struct snd_soc_device bf5xx_board_snd_devdata = {
.machine = &bf5xx_board, .card = &bf5xx_board,
.platform = &bf5xx_ac97_soc_platform,
.codec_dev = &soc_codec_dev_ad1980, .codec_dev = &soc_codec_dev_ad1980,
}; };
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#define GPIO_SE CONFIG_SND_BFIN_AD73311_SE #define GPIO_SE CONFIG_SND_BFIN_AD73311_SE
static struct snd_soc_machine bf5xx_ad73311; static struct snd_soc_card bf5xx_ad73311;
static int snd_ad73311_startup(void) static int snd_ad73311_startup(void)
{ {
...@@ -168,7 +168,7 @@ static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream, ...@@ -168,7 +168,7 @@ static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream,
params_format(params)); params_format(params));
/* set cpu DAI configuration */ /* set cpu DAI configuration */
ret = cpu_dai->dai_ops.set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -190,16 +190,16 @@ static struct snd_soc_dai_link bf5xx_ad73311_dai = { ...@@ -190,16 +190,16 @@ static struct snd_soc_dai_link bf5xx_ad73311_dai = {
.ops = &bf5xx_ad73311_ops, .ops = &bf5xx_ad73311_ops,
}; };
static struct snd_soc_machine bf5xx_ad73311 = { static struct snd_soc_card bf5xx_ad73311 = {
.name = "bf5xx_ad73311", .name = "bf5xx_ad73311",
.platform = &bf5xx_i2s_soc_platform,
.probe = bf5xx_probe, .probe = bf5xx_probe,
.dai_link = &bf5xx_ad73311_dai, .dai_link = &bf5xx_ad73311_dai,
.num_links = 1, .num_links = 1,
}; };
static struct snd_soc_device bf5xx_ad73311_snd_devdata = { static struct snd_soc_device bf5xx_ad73311_snd_devdata = {
.machine = &bf5xx_ad73311, .card = &bf5xx_ad73311,
.platform = &bf5xx_i2s_soc_platform,
.codec_dev = &soc_codec_dev_ad73311, .codec_dev = &soc_codec_dev_ad73311,
}; };
......
...@@ -283,6 +283,18 @@ struct snd_soc_platform bf5xx_i2s_soc_platform = { ...@@ -283,6 +283,18 @@ struct snd_soc_platform bf5xx_i2s_soc_platform = {
}; };
EXPORT_SYMBOL_GPL(bf5xx_i2s_soc_platform); EXPORT_SYMBOL_GPL(bf5xx_i2s_soc_platform);
static int __init bfin_i2s_init(void)
{
return snd_soc_register_platform(&bf5xx_i2s_soc_platform);
}
module_init(bfin_i2s_init);
static void __exit bfin_i2s_exit(void)
{
snd_soc_unregister_platform(&bf5xx_i2s_soc_platform);
}
module_exit(bfin_i2s_exit);
MODULE_AUTHOR("Cliff Cai"); MODULE_AUTHOR("Cliff Cai");
MODULE_DESCRIPTION("ADI Blackfin I2S PCM DMA module"); MODULE_DESCRIPTION("ADI Blackfin I2S PCM DMA module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
This diff is collapsed.
...@@ -116,7 +116,7 @@ struct sport_device { ...@@ -116,7 +116,7 @@ struct sport_device {
void *err_data; void *err_data;
unsigned char *tx_dma_buf; unsigned char *tx_dma_buf;
unsigned char *rx_dma_buf; unsigned char *rx_dma_buf;
#ifdef CONFIG_SND_MMAP_SUPPORT #ifdef CONFIG_SND_BF5XX_MMAP_SUPPORT
dma_addr_t tx_dma_phy; dma_addr_t tx_dma_phy;
dma_addr_t rx_dma_phy; dma_addr_t rx_dma_phy;
int tx_pos;/*pcm sample count*/ int tx_pos;/*pcm sample count*/
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include "bf5xx-i2s-pcm.h" #include "bf5xx-i2s-pcm.h"
#include "bf5xx-i2s.h" #include "bf5xx-i2s.h"
static struct snd_soc_machine bf5xx_ssm2602; static struct snd_soc_card bf5xx_ssm2602;
static int bf5xx_ssm2602_startup(struct snd_pcm_substream *substream) static int bf5xx_ssm2602_startup(struct snd_pcm_substream *substream)
{ {
...@@ -92,17 +92,17 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream, ...@@ -92,17 +92,17 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
*/ */
/* set codec DAI configuration */ /* set codec DAI configuration */
ret = codec_dai->dai_ops.set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
if (ret < 0) if (ret < 0)
return ret; return ret;
/* set cpu DAI configuration */ /* set cpu DAI configuration */
ret = cpu_dai->dai_ops.set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = codec_dai->dai_ops.set_sysclk(codec_dai, SSM2602_SYSCLK, clk, ret = snd_soc_dai_set_sysclk(codec_dai, SSM2602_SYSCLK, clk,
SND_SOC_CLOCK_IN); SND_SOC_CLOCK_IN);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -135,15 +135,15 @@ static struct ssm2602_setup_data bf5xx_ssm2602_setup = { ...@@ -135,15 +135,15 @@ static struct ssm2602_setup_data bf5xx_ssm2602_setup = {
.i2c_address = 0x1b, .i2c_address = 0x1b,
}; };
static struct snd_soc_machine bf5xx_ssm2602 = { static struct snd_soc_card bf5xx_ssm2602 = {
.name = "bf5xx_ssm2602", .name = "bf5xx_ssm2602",
.platform = &bf5xx_i2s_soc_platform,
.dai_link = &bf5xx_ssm2602_dai, .dai_link = &bf5xx_ssm2602_dai,
.num_links = 1, .num_links = 1,
}; };
static struct snd_soc_device bf5xx_ssm2602_snd_devdata = { static struct snd_soc_device bf5xx_ssm2602_snd_devdata = {
.machine = &bf5xx_ssm2602, .card = &bf5xx_ssm2602,
.platform = &bf5xx_i2s_soc_platform,
.codec_dev = &soc_codec_dev_ssm2602, .codec_dev = &soc_codec_dev_ssm2602,
.codec_data = &bf5xx_ssm2602_setup, .codec_data = &bf5xx_ssm2602_setup,
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* wm8350.h - WM8903 audio codec interface
*
* Copyright 2008 Wolfson Microelectronics PLC.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef _WM8350_H
#define _WM8350_H
#include <sound/soc.h>
extern struct snd_soc_dai wm8350_dai;
extern struct snd_soc_codec_device soc_codec_dev_wm8350;
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment