You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'topic/asoc' into to-push
This commit is contained in:
@@ -9,7 +9,7 @@ the audio subsystem with the kernel as a platform device and is represented by
|
||||
the following struct:-
|
||||
|
||||
/* SoC machine */
|
||||
struct snd_soc_machine {
|
||||
struct snd_soc_card {
|
||||
char *name;
|
||||
|
||||
int (*probe)(struct platform_device *pdev);
|
||||
@@ -67,10 +67,10 @@ static struct snd_soc_dai_link corgi_dai = {
|
||||
.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 */
|
||||
static struct snd_soc_machine snd_soc_machine_corgi = {
|
||||
static struct snd_soc_card snd_soc_corgi = {
|
||||
.name = "Corgi",
|
||||
.dai_link = &corgi_dai,
|
||||
.num_links = 1,
|
||||
@@ -90,7 +90,7 @@ static struct wm8731_setup_data corgi_wm8731_setup = {
|
||||
|
||||
/* corgi audio subsystem */
|
||||
static struct snd_soc_device corgi_snd_devdata = {
|
||||
.machine = &snd_soc_machine_corgi,
|
||||
.machine = &snd_soc_corgi,
|
||||
.platform = &pxa2xx_soc_platform,
|
||||
.codec_dev = &soc_codec_dev_wm8731,
|
||||
.codec_data = &corgi_wm8731_setup,
|
||||
|
||||
+1
-1
@@ -3977,7 +3977,7 @@ M: tiwai@suse.de
|
||||
L: alsa-devel@alsa-project.org (subscribers-only)
|
||||
S: Maintained
|
||||
|
||||
SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT
|
||||
SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
|
||||
P: Liam Girdwood
|
||||
M: lrg@slimlogic.co.uk
|
||||
P: Mark Brown
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#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
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -70,9 +70,9 @@
|
||||
#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */
|
||||
|
||||
#define WM8350_VMID_OFF 0
|
||||
#define WM8350_VMID_500K 1
|
||||
#define WM8350_VMID_100K 2
|
||||
#define WM8350_VMID_10K 3
|
||||
#define WM8350_VMID_300K 1
|
||||
#define WM8350_VMID_50K 2
|
||||
#define WM8350_VMID_5K 3
|
||||
|
||||
/*
|
||||
* R40 (0x28) - Clock Control 1
|
||||
@@ -591,8 +591,38 @@
|
||||
#define WM8350_IRQ_CODEC_MICSCD 41
|
||||
#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 platform_device *pdev;
|
||||
struct snd_soc_codec *codec;
|
||||
struct wm8350_audio_platform_data *platform_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#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
|
||||
@@ -0,0 +1,14 @@
|
||||
#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
|
||||
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
* 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,
|
||||
int num);
|
||||
|
||||
/* 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);
|
||||
void snd_soc_dapm_free(struct snd_soc_device *socdev);
|
||||
int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
|
||||
|
||||
+36
-170
@@ -21,8 +21,6 @@
|
||||
#include <sound/control.h>
|
||||
#include <sound/ac97_codec.h>
|
||||
|
||||
#define SND_SOC_VERSION "0.13.2"
|
||||
|
||||
/*
|
||||
* Convenience kcontrol builders
|
||||
*/
|
||||
@@ -145,105 +143,31 @@ enum snd_soc_bias_level {
|
||||
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_pcm_stream;
|
||||
struct snd_soc_ops;
|
||||
struct snd_soc_dai_mode;
|
||||
struct snd_soc_pcm_runtime;
|
||||
struct snd_soc_dai;
|
||||
struct snd_soc_platform;
|
||||
struct snd_soc_codec;
|
||||
struct snd_soc_machine_config;
|
||||
struct soc_enum;
|
||||
struct snd_soc_ac97_ops;
|
||||
struct snd_soc_clock_info;
|
||||
|
||||
typedef int (*hw_write_t)(void *,const char* ,int);
|
||||
typedef int (*hw_read_t)(void *,char* ,int);
|
||||
|
||||
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 */
|
||||
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_register_card(struct snd_soc_device *socdev);
|
||||
int snd_soc_init_card(struct snd_soc_device *socdev);
|
||||
|
||||
/* set runtime hw params */
|
||||
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,
|
||||
struct snd_ac97_bus_ops *ops, int num);
|
||||
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
|
||||
*/
|
||||
@@ -341,66 +244,14 @@ struct snd_soc_ops {
|
||||
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 */
|
||||
struct snd_soc_codec {
|
||||
char *name;
|
||||
struct module *owner;
|
||||
struct mutex mutex;
|
||||
struct device *dev;
|
||||
|
||||
struct list_head list;
|
||||
|
||||
/* callbacks */
|
||||
int (*set_bias_level)(struct snd_soc_codec *,
|
||||
@@ -426,6 +277,7 @@ struct snd_soc_codec {
|
||||
short reg_cache_step;
|
||||
|
||||
/* dapm */
|
||||
u32 pop_time;
|
||||
struct list_head dapm_widgets;
|
||||
struct list_head dapm_paths;
|
||||
enum snd_soc_bias_level bias_level;
|
||||
@@ -435,6 +287,11 @@ struct snd_soc_codec {
|
||||
/* codec DAI's */
|
||||
struct snd_soc_dai *dai;
|
||||
unsigned int num_dai;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs_reg;
|
||||
struct dentry *debugfs_pop_time;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* codec device */
|
||||
@@ -448,13 +305,12 @@ struct snd_soc_codec_device {
|
||||
/* SoC platform interface */
|
||||
struct snd_soc_platform {
|
||||
char *name;
|
||||
struct list_head list;
|
||||
|
||||
int (*probe)(struct platform_device *pdev);
|
||||
int (*remove)(struct platform_device *pdev);
|
||||
int (*suspend)(struct platform_device *pdev,
|
||||
struct snd_soc_dai *dai);
|
||||
int (*resume)(struct platform_device *pdev,
|
||||
struct snd_soc_dai *dai);
|
||||
int (*suspend)(struct snd_soc_dai *dai);
|
||||
int (*resume)(struct snd_soc_dai *dai);
|
||||
|
||||
/* pcm creation and destruction */
|
||||
int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
|
||||
@@ -484,9 +340,14 @@ struct snd_soc_dai_link {
|
||||
struct snd_pcm *pcm;
|
||||
};
|
||||
|
||||
/* SoC machine */
|
||||
struct snd_soc_machine {
|
||||
/* SoC card */
|
||||
struct snd_soc_card {
|
||||
char *name;
|
||||
struct device *dev;
|
||||
|
||||
struct list_head list;
|
||||
|
||||
int instantiated;
|
||||
|
||||
int (*probe)(struct platform_device *pdev);
|
||||
int (*remove)(struct platform_device *pdev);
|
||||
@@ -499,23 +360,26 @@ struct snd_soc_machine {
|
||||
int (*resume_post)(struct platform_device *pdev);
|
||||
|
||||
/* callbacks */
|
||||
int (*set_bias_level)(struct snd_soc_machine *,
|
||||
int (*set_bias_level)(struct snd_soc_card *,
|
||||
enum snd_soc_bias_level level);
|
||||
|
||||
/* CPU <--> Codec DAI links */
|
||||
struct snd_soc_dai_link *dai_link;
|
||||
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 */
|
||||
struct snd_soc_device {
|
||||
struct device *dev;
|
||||
struct snd_soc_machine *machine;
|
||||
struct snd_soc_platform *platform;
|
||||
struct snd_soc_card *card;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_codec_device *codec_dev;
|
||||
struct delayed_work delayed_work;
|
||||
struct work_struct deferred_resume_work;
|
||||
void *codec_data;
|
||||
};
|
||||
|
||||
@@ -542,4 +406,6 @@ struct soc_enum {
|
||||
void *dapm;
|
||||
};
|
||||
|
||||
#include <sound/soc-dai.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 */
|
||||
+6
-7
@@ -22,17 +22,16 @@ if SND_SOC
|
||||
config SND_SOC_AC97_BUS
|
||||
bool
|
||||
|
||||
# All the supported Soc's
|
||||
source "sound/soc/at32/Kconfig"
|
||||
source "sound/soc/at91/Kconfig"
|
||||
# All the supported SoCs
|
||||
source "sound/soc/atmel/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/s3c24xx/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
|
||||
source "sound/soc/codecs/Kconfig"
|
||||
|
||||
+10
-2
@@ -1,5 +1,13 @@
|
||||
snd-soc-core-objs := soc-core.o soc-dapm.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) += omap/ au1x/ blackfin/
|
||||
obj-$(CONFIG_SND_SOC) += codecs/
|
||||
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/
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
config SND_AT32_SOC
|
||||
tristate "SoC Audio for the Atmel AT32 System-on-a-Chip"
|
||||
depends on AVR32 && SND_SOC
|
||||
help
|
||||
Say Y or M if you want to add support for codecs attached to
|
||||
the AT32 SSC interface. You will also need to
|
||||
to select the audio interfaces to support below.
|
||||
|
||||
|
||||
config SND_AT32_SOC_SSC
|
||||
tristate
|
||||
|
||||
|
||||
|
||||
config SND_AT32_SOC_PLAYPAQ
|
||||
tristate "SoC Audio support for PlayPaq with WM8510"
|
||||
depends on SND_AT32_SOC && BOARD_PLAYPAQ
|
||||
select SND_AT32_SOC_SSC
|
||||
select SND_SOC_WM8510
|
||||
help
|
||||
Say Y or M here if you want to add support for SoC audio
|
||||
on the LRS PlayPaq.
|
||||
|
||||
|
||||
|
||||
config SND_AT32_SOC_PLAYPAQ_SLAVE
|
||||
bool "Run CODEC on PlayPaq in slave mode"
|
||||
depends on SND_AT32_SOC_PLAYPAQ
|
||||
default n
|
||||
help
|
||||
Say Y if you want to run with the AT32 SSC generating the BCLK
|
||||
and FRAME signals on the PlayPaq. Unless you want to play
|
||||
with the AT32 as the SSC master, you probably want to say N here,
|
||||
as this will give you better sound quality.
|
||||
@@ -1,11 +0,0 @@
|
||||
# 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
|
||||
@@ -1,492 +0,0 @@
|
||||
/* sound/soc/at32/at32-pcm.c
|
||||
* 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.
|
||||
*
|
||||
* Note that this is basically a port of the sound/soc/at91-pcm.c to
|
||||
* the AVR32 kernel. Thanks to Frank Mandarino for that code.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/atmel_pdc.h>
|
||||
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
#include "at32-pcm.h"
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*\
|
||||
* Hardware definition
|
||||
\*--------------------------------------------------------------------------*/
|
||||
/* TODO: These values were taken from the AT91 platform driver, check
|
||||
* them against real values for AT32
|
||||
*/
|
||||
static const struct snd_pcm_hardware at32_pcm_hardware = {
|
||||
.info = (SNDRV_PCM_INFO_MMAP |
|
||||
SNDRV_PCM_INFO_MMAP_VALID |
|
||||
SNDRV_PCM_INFO_INTERLEAVED |
|
||||
SNDRV_PCM_INFO_BLOCK_TRANSFER |
|
||||
SNDRV_PCM_INFO_PAUSE),
|
||||
|
||||
.formats = SNDRV_PCM_FMTBIT_S16,
|
||||
.period_bytes_min = 32,
|
||||
.period_bytes_max = 8192, /* 512 frames * 16 bytes / frame */
|
||||
.periods_min = 2,
|
||||
.periods_max = 1024,
|
||||
.buffer_bytes_max = 32 * 1024,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*\
|
||||
* Data types
|
||||
\*--------------------------------------------------------------------------*/
|
||||
struct at32_runtime_data {
|
||||
struct at32_pcm_dma_params *params;
|
||||
dma_addr_t dma_buffer; /* physical address of DMA buffer */
|
||||
dma_addr_t dma_buffer_end; /* first address beyond DMA buffer */
|
||||
size_t period_size;
|
||||
|
||||
dma_addr_t period_ptr; /* physical address of next period */
|
||||
int periods; /* period index of period_ptr */
|
||||
|
||||
/* Save PDC registers (for power management) */
|
||||
u32 pdc_xpr_save;
|
||||
u32 pdc_xcr_save;
|
||||
u32 pdc_xnpr_save;
|
||||
u32 pdc_xncr_save;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*\
|
||||
* Helper functions
|
||||
\*--------------------------------------------------------------------------*/
|
||||
static int at32_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
|
||||
{
|
||||
struct snd_pcm_substream *substream = pcm->streams[stream].substream;
|
||||
struct snd_dma_buffer *dmabuf = &substream->dma_buffer;
|
||||
size_t size = at32_pcm_hardware.buffer_bytes_max;
|
||||
|
||||
dmabuf->dev.type = SNDRV_DMA_TYPE_DEV;
|
||||
dmabuf->dev.dev = pcm->card->dev;
|
||||
dmabuf->private_data = NULL;
|
||||
dmabuf->area = dma_alloc_coherent(pcm->card->dev, size,
|
||||
&dmabuf->addr, GFP_KERNEL);
|
||||
pr_debug("at32_pcm: preallocate_dma_buffer: "
|
||||
"area=%p, addr=%p, size=%ld\n",
|
||||
(void *)dmabuf->area, (void *)dmabuf->addr, size);
|
||||
|
||||
if (!dmabuf->area)
|
||||
return -ENOMEM;
|
||||
|
||||
dmabuf->bytes = size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*\
|
||||
* ISR
|
||||
\*--------------------------------------------------------------------------*/
|
||||
static void at32_pcm_dma_irq(u32 ssc_sr, struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *rtd = substream->runtime;
|
||||
struct at32_runtime_data *prtd = rtd->private_data;
|
||||
struct at32_pcm_dma_params *params = prtd->params;
|
||||
static int count;
|
||||
|
||||
count++;
|
||||
if (ssc_sr & params->mask->ssc_endbuf) {
|
||||
pr_warning("at32-pcm: buffer %s on %s (SSC_SR=%#x, count=%d)\n",
|
||||
substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
|
||||
"underrun" : "overrun", params->name, ssc_sr, count);
|
||||
|
||||
/* re-start the PDC */
|
||||
ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
|
||||
params->mask->pdc_disable);
|
||||
prtd->period_ptr += prtd->period_size;
|
||||
if (prtd->period_ptr >= prtd->dma_buffer_end)
|
||||
prtd->period_ptr = prtd->dma_buffer;
|
||||
|
||||
|
||||
ssc_writex(params->ssc->regs, params->pdc->xpr,
|
||||
prtd->period_ptr);
|
||||
ssc_writex(params->ssc->regs, params->pdc->xcr,
|
||||
prtd->period_size / params->pdc_xfer_size);
|
||||
ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
|
||||
params->mask->pdc_enable);
|
||||
}
|
||||
|
||||
|
||||
if (ssc_sr & params->mask->ssc_endx) {
|
||||
/* Load the PDC next pointer and counter registers */
|
||||
prtd->period_ptr += prtd->period_size;
|
||||
if (prtd->period_ptr >= prtd->dma_buffer_end)
|
||||
prtd->period_ptr = prtd->dma_buffer;
|
||||
ssc_writex(params->ssc->regs, params->pdc->xnpr,
|
||||
prtd->period_ptr);
|
||||
ssc_writex(params->ssc->regs, params->pdc->xncr,
|
||||
prtd->period_size / params->pdc_xfer_size);
|
||||
}
|
||||
|
||||
|
||||
snd_pcm_period_elapsed(substream);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*\
|
||||
* PCM operations
|
||||
\*--------------------------------------------------------------------------*/
|
||||
static int at32_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct at32_runtime_data *prtd = runtime->private_data;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
|
||||
/* this may get called several times by oss emulation
|
||||
* with different params
|
||||
*/
|
||||
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
|
||||
runtime->dma_bytes = params_buffer_bytes(params);
|
||||
|
||||
prtd->params = rtd->dai->cpu_dai->dma_data;
|
||||
prtd->params->dma_intr_handler = at32_pcm_dma_irq;
|
||||
|
||||
prtd->dma_buffer = runtime->dma_addr;
|
||||
prtd->dma_buffer_end = runtime->dma_addr + runtime->dma_bytes;
|
||||
prtd->period_size = params_period_bytes(params);
|
||||
|
||||
pr_debug("hw_params: DMA for %s initialized "
|
||||
"(dma_bytes=%ld, period_size=%ld)\n",
|
||||
prtd->params->name, runtime->dma_bytes, prtd->period_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int at32_pcm_hw_free(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct at32_runtime_data *prtd = substream->runtime->private_data;
|
||||
struct at32_pcm_dma_params *params = prtd->params;
|
||||
|
||||
if (params != NULL) {
|
||||
ssc_writex(params->ssc->regs, SSC_PDC_PTCR,
|
||||
params->mask->pdc_disable);
|
||||
prtd->params->dma_intr_handler = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int at32_pcm_prepare(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct at32_runtime_data *prtd = substream->runtime->private_data;
|
||||
struct at32_pcm_dma_params *params = prtd->params;
|
||||
|
||||
ssc_writex(params->ssc->regs, SSC_IDR,
|
||||
params->mask->ssc_endx | params->mask->ssc_endbuf);
|
||||
ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
|
||||
params->mask->pdc_disable);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int at32_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
{
|
||||
struct snd_pcm_runtime *rtd = substream->runtime;
|
||||
struct at32_runtime_data *prtd = rtd->private_data;
|
||||
struct at32_pcm_dma_params *params = prtd->params;
|
||||
int ret = 0;
|
||||
|
||||
pr_debug("at32_pcm_trigger: buffer_size = %ld, "
|
||||
"dma_area = %p, dma_bytes = %ld\n",
|
||||
rtd->buffer_size, rtd->dma_area, rtd->dma_bytes);
|
||||
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
prtd->period_ptr = prtd->dma_buffer;
|
||||
|
||||
ssc_writex(params->ssc->regs, params->pdc->xpr,
|
||||
prtd->period_ptr);
|
||||
ssc_writex(params->ssc->regs, params->pdc->xcr,
|
||||
prtd->period_size / params->pdc_xfer_size);
|
||||
|
||||
prtd->period_ptr += prtd->period_size;
|
||||
ssc_writex(params->ssc->regs, params->pdc->xnpr,
|
||||
prtd->period_ptr);
|
||||
ssc_writex(params->ssc->regs, params->pdc->xncr,
|
||||
prtd->period_size / params->pdc_xfer_size);
|
||||
|
||||
pr_debug("trigger: period_ptr=%lx, xpr=%x, "
|
||||
"xcr=%d, xnpr=%x, xncr=%d\n",
|
||||
(unsigned long)prtd->period_ptr,
|
||||
ssc_readx(params->ssc->regs, params->pdc->xpr),
|
||||
ssc_readx(params->ssc->regs, params->pdc->xcr),
|
||||
ssc_readx(params->ssc->regs, params->pdc->xnpr),
|
||||
ssc_readx(params->ssc->regs, params->pdc->xncr));
|
||||
|
||||
ssc_writex(params->ssc->regs, SSC_IER,
|
||||
params->mask->ssc_endx | params->mask->ssc_endbuf);
|
||||
ssc_writex(params->ssc->regs, SSC_PDC_PTCR,
|
||||
params->mask->pdc_enable);
|
||||
|
||||
pr_debug("sr=%x, imr=%x\n",
|
||||
ssc_readx(params->ssc->regs, SSC_SR),
|
||||
ssc_readx(params->ssc->regs, SSC_IER));
|
||||
break; /* SNDRV_PCM_TRIGGER_START */
|
||||
|
||||
|
||||
|
||||
case SNDRV_PCM_TRIGGER_STOP:
|
||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
|
||||
params->mask->pdc_disable);
|
||||
break;
|
||||
|
||||
|
||||
case SNDRV_PCM_TRIGGER_RESUME:
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||
ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
|
||||
params->mask->pdc_enable);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static snd_pcm_uframes_t at32_pcm_pointer(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct at32_runtime_data *prtd = runtime->private_data;
|
||||
struct at32_pcm_dma_params *params = prtd->params;
|
||||
dma_addr_t ptr;
|
||||
snd_pcm_uframes_t x;
|
||||
|
||||
ptr = (dma_addr_t) ssc_readx(params->ssc->regs, params->pdc->xpr);
|
||||
x = bytes_to_frames(runtime, ptr - prtd->dma_buffer);
|
||||
|
||||
if (x == runtime->buffer_size)
|
||||
x = 0;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int at32_pcm_open(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct at32_runtime_data *prtd;
|
||||
int ret = 0;
|
||||
|
||||
snd_soc_set_runtime_hwparams(substream, &at32_pcm_hardware);
|
||||
|
||||
/* ensure that buffer size is a multiple of period size */
|
||||
ret = snd_pcm_hw_constraint_integer(runtime,
|
||||
SNDRV_PCM_HW_PARAM_PERIODS);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
|
||||
if (prtd == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
runtime->private_data = prtd;
|
||||
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int at32_pcm_close(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct at32_runtime_data *prtd = substream->runtime->private_data;
|
||||
|
||||
kfree(prtd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int at32_pcm_mmap(struct snd_pcm_substream *substream,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return remap_pfn_range(vma, vma->vm_start,
|
||||
substream->dma_buffer.addr >> PAGE_SHIFT,
|
||||
vma->vm_end - vma->vm_start, vma->vm_page_prot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct snd_pcm_ops at32_pcm_ops = {
|
||||
.open = at32_pcm_open,
|
||||
.close = at32_pcm_close,
|
||||
.ioctl = snd_pcm_lib_ioctl,
|
||||
.hw_params = at32_pcm_hw_params,
|
||||
.hw_free = at32_pcm_hw_free,
|
||||
.prepare = at32_pcm_prepare,
|
||||
.trigger = at32_pcm_trigger,
|
||||
.pointer = at32_pcm_pointer,
|
||||
.mmap = at32_pcm_mmap,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*\
|
||||
* ASoC platform driver
|
||||
\*--------------------------------------------------------------------------*/
|
||||
static u64 at32_pcm_dmamask = 0xffffffff;
|
||||
|
||||
static int at32_pcm_new(struct snd_card *card,
|
||||
struct snd_soc_dai *dai,
|
||||
struct snd_pcm *pcm)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!card->dev->dma_mask)
|
||||
card->dev->dma_mask = &at32_pcm_dmamask;
|
||||
if (!card->dev->coherent_dma_mask)
|
||||
card->dev->coherent_dma_mask = 0xffffffff;
|
||||
|
||||
if (dai->playback.channels_min) {
|
||||
ret = at32_pcm_preallocate_dma_buffer(
|
||||
pcm, SNDRV_PCM_STREAM_PLAYBACK);
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (dai->capture.channels_min) {
|
||||
pr_debug("at32-pcm: Allocating PCM capture DMA buffer\n");
|
||||
ret = at32_pcm_preallocate_dma_buffer(
|
||||
pcm, SNDRV_PCM_STREAM_CAPTURE);
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void at32_pcm_free_dma_buffers(struct snd_pcm *pcm)
|
||||
{
|
||||
struct snd_pcm_substream *substream;
|
||||
struct snd_dma_buffer *buf;
|
||||
int stream;
|
||||
|
||||
for (stream = 0; stream < 2; stream++) {
|
||||
substream = pcm->streams[stream].substream;
|
||||
if (substream == NULL)
|
||||
continue;
|
||||
|
||||
buf = &substream->dma_buffer;
|
||||
if (!buf->area)
|
||||
continue;
|
||||
dma_free_coherent(pcm->card->dev, buf->bytes,
|
||||
buf->area, buf->addr);
|
||||
buf->area = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int at32_pcm_suspend(struct platform_device *pdev,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = dai->runtime;
|
||||
struct at32_runtime_data *prtd;
|
||||
struct at32_pcm_dma_params *params;
|
||||
|
||||
if (runtime == NULL)
|
||||
return 0;
|
||||
prtd = runtime->private_data;
|
||||
params = prtd->params;
|
||||
|
||||
/* Disable the PDC and save the PDC registers */
|
||||
ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
|
||||
params->mask->pdc_disable);
|
||||
|
||||
prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr);
|
||||
prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr);
|
||||
prtd->pdc_xnpr_save = ssc_readx(params->ssc->regs, params->pdc->xnpr);
|
||||
prtd->pdc_xncr_save = ssc_readx(params->ssc->regs, params->pdc->xncr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int at32_pcm_resume(struct platform_device *pdev,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = dai->runtime;
|
||||
struct at32_runtime_data *prtd;
|
||||
struct at32_pcm_dma_params *params;
|
||||
|
||||
if (runtime == NULL)
|
||||
return 0;
|
||||
prtd = runtime->private_data;
|
||||
params = prtd->params;
|
||||
|
||||
/* Restore the PDC registers and enable the PDC */
|
||||
ssc_writex(params->ssc->regs, params->pdc->xpr, prtd->pdc_xpr_save);
|
||||
ssc_writex(params->ssc->regs, params->pdc->xcr, prtd->pdc_xcr_save);
|
||||
ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save);
|
||||
ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save);
|
||||
|
||||
ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR, params->mask->pdc_enable);
|
||||
return 0;
|
||||
}
|
||||
#else /* CONFIG_PM */
|
||||
# define at32_pcm_suspend NULL
|
||||
# define at32_pcm_resume NULL
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
|
||||
|
||||
struct snd_soc_platform at32_soc_platform = {
|
||||
.name = "at32-audio",
|
||||
.pcm_ops = &at32_pcm_ops,
|
||||
.pcm_new = at32_pcm_new,
|
||||
.pcm_free = at32_pcm_free_dma_buffers,
|
||||
.suspend = at32_pcm_suspend,
|
||||
.resume = at32_pcm_resume,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(at32_soc_platform);
|
||||
|
||||
|
||||
|
||||
MODULE_AUTHOR("Geoffrey Wossum <gwossum@acm.org>");
|
||||
MODULE_DESCRIPTION("Atmel AT32 PCM module");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -1,79 +0,0 @@
|
||||
/* 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 */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,59 +0,0 @@
|
||||
/* 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 */
|
||||
@@ -1,10 +0,0 @@
|
||||
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
|
||||
@@ -1,6 +0,0 @@
|
||||
# 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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user