Commit 7ec298df authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/asoc' into for-linus

parents 02e5fbf6 de0853c0
...@@ -5854,7 +5854,7 @@ F: include/sound/ ...@@ -5854,7 +5854,7 @@ F: include/sound/
F: sound/ F: sound/
SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC) SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
M: Liam Girdwood <lrg@slimlogic.co.uk> M: Liam Girdwood <lrg@ti.com>
M: Mark Brown <broonie@opensource.wolfsonmicro.com> M: Mark Brown <broonie@opensource.wolfsonmicro.com>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6.git
L: alsa-devel@alsa-project.org (moderated for non-subscribers) L: alsa-devel@alsa-project.org (moderated for non-subscribers)
...@@ -6105,7 +6105,7 @@ F: drivers/mmc/host/tifm_sd.c ...@@ -6105,7 +6105,7 @@ F: drivers/mmc/host/tifm_sd.c
F: include/linux/tifm.h F: include/linux/tifm.h
TI TWL4030 SERIES SOC CODEC DRIVER TI TWL4030 SERIES SOC CODEC DRIVER
M: Peter Ujfalusi <peter.ujfalusi@nokia.com> M: Peter Ujfalusi <peter.ujfalusi@ti.com>
L: alsa-devel@alsa-project.org (moderated for non-subscribers) L: alsa-devel@alsa-project.org (moderated for non-subscribers)
S: Maintained S: Maintained
F: sound/soc/codecs/twl4030* F: sound/soc/codecs/twl4030*
...@@ -6749,7 +6749,7 @@ F: drivers/scsi/vmw_pvscsi.c ...@@ -6749,7 +6749,7 @@ F: drivers/scsi/vmw_pvscsi.c
F: drivers/scsi/vmw_pvscsi.h F: drivers/scsi/vmw_pvscsi.h
VOLTAGE AND CURRENT REGULATOR FRAMEWORK VOLTAGE AND CURRENT REGULATOR FRAMEWORK
M: Liam Girdwood <lrg@slimlogic.co.uk> M: Liam Girdwood <lrg@ti.com>
M: Mark Brown <broonie@opensource.wolfsonmicro.com> M: Mark Brown <broonie@opensource.wolfsonmicro.com>
W: http://opensource.wolfsonmicro.com/node/15 W: http://opensource.wolfsonmicro.com/node/15
W: http://www.slimlogic.co.uk/?p=48 W: http://www.slimlogic.co.uk/?p=48
......
...@@ -27,12 +27,14 @@ comment "Tegra board type" ...@@ -27,12 +27,14 @@ comment "Tegra board type"
config MACH_HARMONY config MACH_HARMONY
bool "Harmony board" bool "Harmony board"
select MACH_HAS_SND_SOC_TEGRA_WM8903
help help
Support for nVidia Harmony development platform Support for nVidia Harmony development platform
config MACH_KAEN config MACH_KAEN
bool "Kaen board" bool "Kaen board"
select MACH_SEABOARD select MACH_SEABOARD
select MACH_HAS_SND_SOC_TEGRA_WM8903
help help
Support for the Kaen version of Seaboard Support for the Kaen version of Seaboard
...@@ -43,6 +45,7 @@ config MACH_PAZ00 ...@@ -43,6 +45,7 @@ config MACH_PAZ00
config MACH_SEABOARD config MACH_SEABOARD
bool "Seaboard board" bool "Seaboard board"
select MACH_HAS_SND_SOC_TEGRA_WM8903
help help
Support for nVidia Seaboard development platform. It will Support for nVidia Seaboard development platform. It will
also be included for some of the derivative boards that also be included for some of the derivative boards that
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <mach/harmony_audio.h> #include <mach/tegra_wm8903_pdata.h>
#include <mach/iomap.h> #include <mach/iomap.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/sdhci.h> #include <mach/sdhci.h>
...@@ -67,15 +67,16 @@ static struct platform_device debug_uart = { ...@@ -67,15 +67,16 @@ static struct platform_device debug_uart = {
}, },
}; };
static struct harmony_audio_platform_data harmony_audio_pdata = { static struct tegra_wm8903_platform_data harmony_audio_pdata = {
.gpio_spkr_en = TEGRA_GPIO_SPKR_EN, .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
.gpio_hp_det = TEGRA_GPIO_HP_DET, .gpio_hp_det = TEGRA_GPIO_HP_DET,
.gpio_hp_mute = -1,
.gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN, .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN,
.gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN, .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN,
}; };
static struct platform_device harmony_audio_device = { static struct platform_device harmony_audio_device = {
.name = "tegra-snd-harmony", .name = "tegra-snd-wm8903",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &harmony_audio_pdata, .platform_data = &harmony_audio_pdata,
......
/* /*
* arch/arm/mach-tegra/include/mach/harmony_audio.h * arch/arm/mach-tegra/include/mach/tegra_wm8903_pdata.h
* *
* Copyright 2011 NVIDIA, Inc. * Copyright 2011 NVIDIA, Inc.
* *
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
* *
*/ */
struct harmony_audio_platform_data { struct tegra_wm8903_platform_data {
int gpio_spkr_en; int gpio_spkr_en;
int gpio_hp_det; int gpio_hp_det;
int gpio_hp_mute;
int gpio_int_mic_en; int gpio_int_mic_en;
int gpio_ext_mic_en; int gpio_ext_mic_en;
}; };
...@@ -508,7 +508,6 @@ int register_sst_card(struct intel_sst_card_ops *card) ...@@ -508,7 +508,6 @@ int register_sst_card(struct intel_sst_card_ops *card)
sst_drv_ctx->pmic_state = SND_MAD_INIT_DONE; sst_drv_ctx->pmic_state = SND_MAD_INIT_DONE;
sst_drv_ctx->rx_time_slot_status = 0; /*default AMIC*/ sst_drv_ctx->rx_time_slot_status = 0; /*default AMIC*/
card->pcm_control = sst_pmic_ops.pcm_control; card->pcm_control = sst_pmic_ops.pcm_control;
sst_drv_ctx->scard_ops->card_status = SND_CARD_UN_INIT;
return 0; return 0;
} else { } else {
pr_err("strcmp fail %s\n", card->module_name); pr_err("strcmp fail %s\n", card->module_name);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/firmware.h>
#include <sound/control.h> #include <sound/control.h>
#include <asm/mrst.h> #include <asm/mrst.h>
#include <sound/pcm.h> #include <sound/pcm.h>
...@@ -40,6 +41,8 @@ ...@@ -40,6 +41,8 @@
#include <sound/initval.h> #include <sound/initval.h>
#include "intel_sst.h" #include "intel_sst.h"
#include "intel_sst_ioctl.h" #include "intel_sst_ioctl.h"
#include "intel_sst_fw_ipc.h"
#include "intel_sst_common.h"
#include "intelmid_snd_control.h" #include "intelmid_snd_control.h"
#include "intelmid.h" #include "intelmid.h"
...@@ -802,6 +805,7 @@ static int __devinit snd_intelmad_sst_register( ...@@ -802,6 +805,7 @@ static int __devinit snd_intelmad_sst_register(
pr_err("sst card registration failed\n"); pr_err("sst card registration failed\n");
return ret_val; return ret_val;
} }
sst_drv_ctx->scard_ops->card_status = SND_CARD_UN_INIT;
sst_card_vendor_id = intelmaddata->sstdrv_ops->vendor_id; sst_card_vendor_id = intelmaddata->sstdrv_ops->vendor_id;
intelmaddata->pmic_status = PMIC_UNINIT; intelmaddata->pmic_status = PMIC_UNINIT;
......
...@@ -32,6 +32,10 @@ struct wm8994_ldo_pdata { ...@@ -32,6 +32,10 @@ struct wm8994_ldo_pdata {
#define WM8994_EQ_REGS 20 #define WM8994_EQ_REGS 20
#define WM8958_MBC_CUTOFF_REGS 20 #define WM8958_MBC_CUTOFF_REGS 20
#define WM8958_MBC_COEFF_REGS 48 #define WM8958_MBC_COEFF_REGS 48
#define WM8958_MBC_COMBINED_REGS 56
#define WM8958_VSS_HPF_REGS 2
#define WM8958_VSS_REGS 148
#define WM8958_ENH_EQ_REGS 32
/** /**
* DRC configurations are specified with a label and a set of register * DRC configurations are specified with a label and a set of register
...@@ -71,6 +75,42 @@ struct wm8958_mbc_cfg { ...@@ -71,6 +75,42 @@ struct wm8958_mbc_cfg {
const char *name; const char *name;
u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS]; u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
u16 coeff_regs[WM8958_MBC_COEFF_REGS]; u16 coeff_regs[WM8958_MBC_COEFF_REGS];
/* Coefficient layout when using MBC+VSS firmware */
u16 combined_regs[WM8958_MBC_COMBINED_REGS];
};
/**
* VSS HPF configurations are specified with a label and two values to
* write. Configurations are expected to be generated using the
* multiband compressor configuration panel in WISCE - see
* http://www.wolfsonmicro.com/wisce/
*/
struct wm8958_vss_hpf_cfg {
const char *name;
u16 regs[WM8958_VSS_HPF_REGS];
};
/**
* VSS configurations are specified with a label and array of values
* to write. Configurations are expected to be generated using the
* multiband compressor configuration panel in WISCE - see
* http://www.wolfsonmicro.com/wisce/
*/
struct wm8958_vss_cfg {
const char *name;
u16 regs[WM8958_VSS_REGS];
};
/**
* Enhanced EQ configurations are specified with a label and array of
* values to write. Configurations are expected to be generated using
* the multiband compressor configuration panel in WISCE - see
* http://www.wolfsonmicro.com/wisce/
*/
struct wm8958_enh_eq_cfg {
const char *name;
u16 regs[WM8958_ENH_EQ_REGS];
}; };
struct wm8994_pdata { struct wm8994_pdata {
...@@ -95,6 +135,15 @@ struct wm8994_pdata { ...@@ -95,6 +135,15 @@ struct wm8994_pdata {
int num_mbc_cfgs; int num_mbc_cfgs;
struct wm8958_mbc_cfg *mbc_cfgs; struct wm8958_mbc_cfg *mbc_cfgs;
int num_vss_cfgs;
struct wm8958_vss_cfg *vss_cfgs;
int num_vss_hpf_cfgs;
struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;
int num_enh_eq_cfgs;
struct wm8958_enh_eq_cfg *enh_eq_cfgs;
/* LINEOUT can be differential or single ended */ /* LINEOUT can be differential or single ended */
unsigned int lineout1_diff:1; unsigned int lineout1_diff:1;
unsigned int lineout2_diff:1; unsigned int lineout2_diff:1;
......
/*
* AK4641 ALSA SoC Codec driver
*
* Copyright 2009 Philipp Zabel
*
* 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 __AK4641_H
#define __AK4641_H
/**
* struct ak4641_platform_data - platform specific AK4641 configuration
* @gpio_power: GPIO to control external power to AK4641
* @gpio_npdn: GPIO connected to AK4641 nPDN pin
*
* Both GPIO parameters are optional.
*/
struct ak4641_platform_data {
int gpio_power;
int gpio_npdn;
};
#endif /* __AK4641_H */
/*
* Platform data for MAX98095
*
* Copyright 2011 Maxim Integrated Products
*
* 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 __SOUND_MAX98095_PDATA_H__
#define __SOUND_MAX98095_PDATA_H__
/* Equalizer filter response configuration */
struct max98095_eq_cfg {
const char *name;
unsigned int rate;
u16 band1[5];
u16 band2[5];
u16 band3[5];
u16 band4[5];
u16 band5[5];
};
/* Biquad filter response configuration */
struct max98095_biquad_cfg {
const char *name;
unsigned int rate;
u16 band1[5];
u16 band2[5];
};
/* codec platform data */
struct max98095_pdata {
/* Equalizers for DAI1 and DAI2 */
struct max98095_eq_cfg *eq_cfg;
unsigned int eq_cfgcnt;
/* Biquad filter for DAI1 and DAI2 */
struct max98095_biquad_cfg *bq_cfg;
unsigned int bq_cfgcnt;
/* Analog/digital microphone configuration:
* 0 = analog microphone input (normal setting)
* 1 = digital microphone input
*/
unsigned int digmic_left_mode:1;
unsigned int digmic_right_mode:1;
};
#endif
This diff is collapsed.
...@@ -248,7 +248,7 @@ typedef int (*hw_write_t)(void *,const char* ,int); ...@@ -248,7 +248,7 @@ typedef int (*hw_write_t)(void *,const char* ,int);
extern struct snd_ac97_bus_ops soc_ac97_ops; extern struct snd_ac97_bus_ops soc_ac97_ops;
enum snd_soc_control_type { enum snd_soc_control_type {
SND_SOC_CUSTOM, SND_SOC_CUSTOM = 1,
SND_SOC_I2C, SND_SOC_I2C,
SND_SOC_SPI, SND_SOC_SPI,
}; };
...@@ -278,6 +278,10 @@ int snd_soc_register_codec(struct device *dev, ...@@ -278,6 +278,10 @@ int snd_soc_register_codec(struct device *dev,
void snd_soc_unregister_codec(struct device *dev); void snd_soc_unregister_codec(struct device *dev);
int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
unsigned int reg); unsigned int reg);
int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
unsigned int reg);
int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
unsigned int reg);
int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
int addr_bits, int data_bits, int addr_bits, int data_bits,
enum snd_soc_control_type control); enum snd_soc_control_type control);
...@@ -292,6 +296,8 @@ int snd_soc_default_volatile_register(struct snd_soc_codec *codec, ...@@ -292,6 +296,8 @@ int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
unsigned int reg); unsigned int reg);
int snd_soc_default_readable_register(struct snd_soc_codec *codec, int snd_soc_default_readable_register(struct snd_soc_codec *codec,
unsigned int reg); unsigned int reg);
int snd_soc_default_writable_register(struct snd_soc_codec *codec,
unsigned int reg);
/* Utility functions to get clock rates from various things */ /* Utility functions to get clock rates from various things */
int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
...@@ -523,6 +529,7 @@ struct snd_soc_codec { ...@@ -523,6 +529,7 @@ struct snd_soc_codec {
size_t reg_size; /* reg_cache_size * reg_word_size */ size_t reg_size; /* reg_cache_size * reg_word_size */
int (*volatile_register)(struct snd_soc_codec *, unsigned int); int (*volatile_register)(struct snd_soc_codec *, unsigned int);
int (*readable_register)(struct snd_soc_codec *, unsigned int); int (*readable_register)(struct snd_soc_codec *, unsigned int);
int (*writable_register)(struct snd_soc_codec *, unsigned int);
/* runtime */ /* runtime */
struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
...@@ -539,10 +546,12 @@ struct snd_soc_codec { ...@@ -539,10 +546,12 @@ struct snd_soc_codec {
/* codec IO */ /* codec IO */
void *control_data; /* codec control (i2c/3wire) data */ void *control_data; /* codec control (i2c/3wire) data */
enum snd_soc_control_type control_type;
hw_write_t hw_write; hw_write_t hw_write;
unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
unsigned int (*read)(struct snd_soc_codec *, unsigned int); unsigned int (*read)(struct snd_soc_codec *, unsigned int);
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
int (*bulk_write_raw)(struct snd_soc_codec *, unsigned int, const void *, size_t);
void *reg_cache; void *reg_cache;
const void *reg_def_copy; const void *reg_def_copy;
const struct snd_soc_cache_ops *cache_ops; const struct snd_soc_cache_ops *cache_ops;
...@@ -568,7 +577,9 @@ struct snd_soc_codec_driver { ...@@ -568,7 +577,9 @@ struct snd_soc_codec_driver {
pm_message_t state); pm_message_t state);
int (*resume)(struct snd_soc_codec *); int (*resume)(struct snd_soc_codec *);
/* Default DAPM setup, added after probe() is run */ /* Default control and setup, added after probe() is run */
const struct snd_kcontrol_new *controls;
int num_controls;
const struct snd_soc_dapm_widget *dapm_widgets; const struct snd_soc_dapm_widget *dapm_widgets;
int num_dapm_widgets; int num_dapm_widgets;
const struct snd_soc_dapm_route *dapm_routes; const struct snd_soc_dapm_route *dapm_routes;
...@@ -587,6 +598,7 @@ struct snd_soc_codec_driver { ...@@ -587,6 +598,7 @@ struct snd_soc_codec_driver {
size_t, unsigned int); size_t, unsigned int);
int (*volatile_register)(struct snd_soc_codec *, unsigned int); int (*volatile_register)(struct snd_soc_codec *, unsigned int);
int (*readable_register)(struct snd_soc_codec *, unsigned int); int (*readable_register)(struct snd_soc_codec *, unsigned int);
int (*writable_register)(struct snd_soc_codec *, unsigned int);
short reg_cache_size; short reg_cache_size;
short reg_cache_step; short reg_cache_step;
short reg_word_size; short reg_word_size;
...@@ -690,6 +702,8 @@ struct snd_soc_aux_dev { ...@@ -690,6 +702,8 @@ struct snd_soc_aux_dev {
/* SoC card */ /* SoC card */
struct snd_soc_card { struct snd_soc_card {
const char *name; const char *name;
const char *long_name;
const char *driver_name;
struct device *dev; struct device *dev;
struct snd_card *snd_card; struct snd_card *snd_card;
struct module *owner; struct module *owner;
...@@ -737,12 +751,15 @@ struct snd_soc_card { ...@@ -737,12 +751,15 @@ struct snd_soc_card {
struct snd_soc_pcm_runtime *rtd_aux; struct snd_soc_pcm_runtime *rtd_aux;
int num_aux_rtd; int num_aux_rtd;
const struct snd_kcontrol_new *controls;
int num_controls;
/* /*
* Card-specific routes and widgets. * Card-specific routes and widgets.
*/ */
struct snd_soc_dapm_widget *dapm_widgets; const struct snd_soc_dapm_widget *dapm_widgets;
int num_dapm_widgets; int num_dapm_widgets;
struct snd_soc_dapm_route *dapm_routes; const struct snd_soc_dapm_route *dapm_routes;
int num_dapm_routes; int num_dapm_routes;
struct work_struct deferred_resume_work; struct work_struct deferred_resume_work;
...@@ -805,7 +822,7 @@ struct soc_enum { ...@@ -805,7 +822,7 @@ struct soc_enum {
unsigned char shift_r; unsigned char shift_r;
unsigned int max; unsigned int max;
unsigned int mask; unsigned int mask;
const char **texts; const char * const *texts;
const unsigned int *values; const unsigned int *values;
void *dapm; void *dapm;
}; };
...@@ -814,6 +831,8 @@ struct soc_enum { ...@@ -814,6 +831,8 @@ struct soc_enum {
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
unsigned int snd_soc_write(struct snd_soc_codec *codec, unsigned int snd_soc_write(struct snd_soc_codec *codec,
unsigned int reg, unsigned int val); unsigned int reg, unsigned int val);
unsigned int snd_soc_bulk_write_raw(struct snd_soc_codec *codec,
unsigned int reg, const void *data, size_t len);
/* device driver data */ /* device driver data */
...@@ -871,6 +890,9 @@ static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) ...@@ -871,6 +890,9 @@ static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
INIT_LIST_HEAD(&card->dapm_list); INIT_LIST_HEAD(&card->dapm_list);
} }
int snd_soc_util_init(void);
void snd_soc_util_exit(void);
#include <sound/soc-dai.h> #include <sound/soc-dai.h>
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
......
/* /*
* Platform header for Texas Instruments TLV320DAC33 codec driver * Platform header for Texas Instruments TLV320DAC33 codec driver
* *
* Author: Peter Ujfalusi <peter.ujfalusi@nokia.com> * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
* *
* Copyright: (C) 2009 Nokia Corporation * Copyright: (C) 2009 Nokia Corporation
* *
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) Nokia Corporation * Copyright (C) Nokia Corporation
* *
* Written by Peter Ujfalusi <peter.ujfalusi@nokia.com> * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
......
/*
* linux/sound/wm8915.h -- Platform data for WM8915
*
* Copyright 2011 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.
*/
#ifndef __LINUX_SND_WM8903_H
#define __LINUX_SND_WM8903_H
enum wm8915_inmode {
WM8915_DIFFERRENTIAL_1 = 0, /* IN1xP - IN1xN */
WM8915_INVERTING = 1, /* IN1xN */
WM8915_NON_INVERTING = 2, /* IN1xP */
WM8915_DIFFERENTIAL_2 = 3, /* IN2xP - IN2xP */
};
/**
* ReTune Mobile configurations are specified with a label, sample
* rate and set of values to write (the enable bits will be ignored).
*
* Configurations are expected to be generated using the ReTune Mobile
* control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
*/
struct wm8915_retune_mobile_config {
const char *name;
int rate;
u16 regs[20];
};
#define WM8915_SET_DEFAULT 0x10000
struct wm8915_pdata {
int irq_flags; /** Set IRQ trigger flags; default active low */
int ldo_ena; /** GPIO for LDO1; -1 for none */
int micdet_def; /** Default MICDET_SRC/HP1FB_SRC/MICD_BIAS */
enum wm8915_inmode inl_mode;
enum wm8915_inmode inr_mode;
u32 spkmute_seq; /** Value for register 0x802 */
int gpio_base;
u32 gpio_default[5];
int num_retune_mobile_cfgs;
struct wm8915_retune_mobile_config *retune_mobile_cfgs;
};
#endif
...@@ -14,6 +14,28 @@ ...@@ -14,6 +14,28 @@
/* Use to set GPIO default values to zero */ /* Use to set GPIO default values to zero */
#define WM8962_GPIO_SET 0x10000 #define WM8962_GPIO_SET 0x10000
#define WM8962_GPIO_FN_CLKOUT 0
#define WM8962_GPIO_FN_LOGIC 1
#define WM8962_GPIO_FN_SDOUT 2
#define WM8962_GPIO_FN_IRQ 3
#define WM8962_GPIO_FN_THERMAL 4
#define WM8962_GPIO_FN_PLL2_LOCK 6
#define WM8962_GPIO_FN_PLL3_LOCK 7
#define WM8962_GPIO_FN_FLL_LOCK 9
#define WM8962_GPIO_FN_DRC_ACT 10
#define WM8962_GPIO_FN_WSEQ_DONE 11
#define WM8962_GPIO_FN_ALC_NG_ACT 12
#define WM8962_GPIO_FN_ALC_PEAK_LIMIT 13
#define WM8962_GPIO_FN_ALC_SATURATION 14
#define WM8962_GPIO_FN_ALC_LEVEL_THR 15
#define WM8962_GPIO_FN_ALC_LEVEL_LOCK 16
#define WM8962_GPIO_FN_FIFO_ERR 17
#define WM8962_GPIO_FN_OPCLK 18
#define WM8962_GPIO_FN_DMICCLK 19
#define WM8962_GPIO_FN_DMICDAT 20
#define WM8962_GPIO_FN_MICD 21
#define WM8962_GPIO_FN_MICSCD 22
struct wm8962_pdata { struct wm8962_pdata {
int gpio_base; int gpio_base;
u32 gpio_init[WM8962_MAX_GPIO]; u32 gpio_init[WM8962_MAX_GPIO];
......
...@@ -184,7 +184,7 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = { ...@@ -184,7 +184,7 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = {
.codec_dai_name = "wm8731-hifi", .codec_dai_name = "wm8731-hifi",
.init = at91sam9g20ek_wm8731_init, .init = at91sam9g20ek_wm8731_init,
.platform_name = "atmel-pcm-audio", .platform_name = "atmel-pcm-audio",
.codec_name = "wm8731-codec.0-001b", .codec_name = "wm8731.0-001b",
.ops = &at91sam9g20ek_ops, .ops = &at91sam9g20ek_ops,
}; };
......
...@@ -77,7 +77,7 @@ static struct snd_soc_dai_link db1200_i2s_dai = { ...@@ -77,7 +77,7 @@ static struct snd_soc_dai_link db1200_i2s_dai = {
.codec_dai_name = "wm8731-hifi", .codec_dai_name = "wm8731-hifi",
.cpu_dai_name = "au1xpsc_i2s.1", .cpu_dai_name = "au1xpsc_i2s.1",
.platform_name = "au1xpsc-pcm.1", .platform_name = "au1xpsc-pcm.1",
.codec_name = "wm8731-codec.0-001b", .codec_name = "wm8731.0-001b",
.ops = &db1200_i2s_wm8731_ops, .ops = &db1200_i2s_wm8731_ops,
}; };
......
...@@ -243,6 +243,9 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) ...@@ -243,6 +243,9 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)
static int bf5xx_pcm_open(struct snd_pcm_substream *substream) static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int ret; int ret;
...@@ -314,6 +317,9 @@ static struct snd_pcm_ops bf5xx_pcm_ac97_ops = { ...@@ -314,6 +317,9 @@ static struct snd_pcm_ops bf5xx_pcm_ac97_ops = {
static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
{ {
struct snd_soc_pcm_runtime *rtd = pcm->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
struct snd_pcm_substream *substream = pcm->streams[stream].substream; struct snd_pcm_substream *substream = pcm->streams[stream].substream;
struct snd_dma_buffer *buf = &substream->dma_buffer; struct snd_dma_buffer *buf = &substream->dma_buffer;
size_t size = bf5xx_pcm_hardware.buffer_bytes_max size_t size = bf5xx_pcm_hardware.buffer_bytes_max
...@@ -377,6 +383,9 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) ...@@ -377,6 +383,9 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
struct snd_dma_buffer *buf; struct snd_dma_buffer *buf;
int stream; int stream;
#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) #if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT)
struct snd_soc_pcm_runtime *rtd = pcm->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
size_t size = bf5xx_pcm_hardware.buffer_bytes_max * size_t size = bf5xx_pcm_hardware.buffer_bytes_max *
sizeof(struct ac97_frame) / 4; sizeof(struct ac97_frame) / 4;
#endif #endif
...@@ -405,8 +414,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) ...@@ -405,8 +414,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
} }
#endif #endif
} }
if (sport_handle)
sport_done(sport_handle);
} }
static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
...@@ -458,7 +465,7 @@ static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev) ...@@ -458,7 +465,7 @@ static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev)
static struct platform_driver bf5xx_pcm_driver = { static struct platform_driver bf5xx_pcm_driver = {
.driver = { .driver = {
.name = "bf5xx-pcm-audio", .name = "bfin-ac97-pcm-audio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
......
...@@ -41,48 +41,7 @@ ...@@ -41,48 +41,7 @@
* anomaly does not affect blackfin sound drivers. * anomaly does not affect blackfin sound drivers.
*/ */
static int *cmd_count; static struct sport_device *ac97_sport_handle;
static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM;
#define SPORT_REQ(x) \
[x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}
static u16 sport_req[][7] = {
#ifdef SPORT0_TCR1
SPORT_REQ(0),
#endif
#ifdef SPORT1_TCR1
SPORT_REQ(1),
#endif
#ifdef SPORT2_TCR1
SPORT_REQ(2),
#endif
#ifdef SPORT3_TCR1
SPORT_REQ(3),
#endif
};
#define SPORT_PARAMS(x) \
[x] = { \
.dma_rx_chan = CH_SPORT##x##_RX, \
.dma_tx_chan = CH_SPORT##x##_TX, \
.err_irq = IRQ_SPORT##x##_ERROR, \
.regs = (struct sport_register *)SPORT##x##_TCR1, \
}
static struct sport_param sport_params[4] = {
#ifdef SPORT0_TCR1
SPORT_PARAMS(0),
#endif
#ifdef SPORT1_TCR1
SPORT_PARAMS(1),
#endif
#ifdef SPORT2_TCR1
SPORT_PARAMS(2),
#endif
#ifdef SPORT3_TCR1
SPORT_PARAMS(3),
#endif
};
void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src,
size_t count, unsigned int chan_mask) size_t count, unsigned int chan_mask)
...@@ -140,7 +99,8 @@ static unsigned int sport_tx_curr_frag(struct sport_device *sport) ...@@ -140,7 +99,8 @@ static unsigned int sport_tx_curr_frag(struct sport_device *sport)
static void enqueue_cmd(struct snd_ac97 *ac97, __u16 addr, __u16 data) static void enqueue_cmd(struct snd_ac97 *ac97, __u16 addr, __u16 data)
{ {
struct sport_device *sport = sport_handle; struct sport_device *sport = ac97_sport_handle;
int *cmd_count = sport->private_data;
int nextfrag = sport_tx_curr_frag(sport); int nextfrag = sport_tx_curr_frag(sport);
struct ac97_frame *nextwrite; struct ac97_frame *nextwrite;
...@@ -161,6 +121,7 @@ static void enqueue_cmd(struct snd_ac97 *ac97, __u16 addr, __u16 data) ...@@ -161,6 +121,7 @@ static void enqueue_cmd(struct snd_ac97 *ac97, __u16 addr, __u16 data)
static unsigned short bf5xx_ac97_read(struct snd_ac97 *ac97, static unsigned short bf5xx_ac97_read(struct snd_ac97 *ac97,
unsigned short reg) unsigned short reg)
{ {
struct sport_device *sport_handle = ac97_sport_handle;
struct ac97_frame out_frame[2], in_frame[2]; struct ac97_frame out_frame[2], in_frame[2];
pr_debug("%s enter 0x%x\n", __func__, reg); pr_debug("%s enter 0x%x\n", __func__, reg);
...@@ -185,6 +146,8 @@ static unsigned short bf5xx_ac97_read(struct snd_ac97 *ac97, ...@@ -185,6 +146,8 @@ static unsigned short bf5xx_ac97_read(struct snd_ac97 *ac97,
void bf5xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, void bf5xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
unsigned short val) unsigned short val)
{ {
struct sport_device *sport_handle = ac97_sport_handle;
pr_debug("%s enter 0x%x:0x%04x\n", __func__, reg, val); pr_debug("%s enter 0x%x:0x%04x\n", __func__, reg, val);
if (sport_handle->tx_run) { if (sport_handle->tx_run) {
...@@ -203,28 +166,19 @@ void bf5xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, ...@@ -203,28 +166,19 @@ void bf5xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
static void bf5xx_ac97_warm_reset(struct snd_ac97 *ac97) static void bf5xx_ac97_warm_reset(struct snd_ac97 *ac97)
{ {
#if defined(CONFIG_BF54x) || defined(CONFIG_BF561) || \ struct sport_device *sport_handle = ac97_sport_handle;
(defined(BF537_FAMILY) && (CONFIG_SND_BF5XX_SPORT_NUM == 1)) u16 gpio = P_IDENT(sport_handle->pin_req[3]);
#define CONCAT(a, b, c) a ## b ## c
#define BFIN_SPORT_RFS(x) CONCAT(P_SPORT, x, _RFS)
u16 per = BFIN_SPORT_RFS(CONFIG_SND_BF5XX_SPORT_NUM);
u16 gpio = P_IDENT(BFIN_SPORT_RFS(CONFIG_SND_BF5XX_SPORT_NUM));
pr_debug("%s enter\n", __func__); pr_debug("%s enter\n", __func__);
peripheral_free(per); peripheral_free_list(sport_handle->pin_req);
gpio_request(gpio, "bf5xx-ac97"); gpio_request(gpio, "bf5xx-ac97");
gpio_direction_output(gpio, 1); gpio_direction_output(gpio, 1);
udelay(2); udelay(2);
gpio_set_value(gpio, 0); gpio_set_value(gpio, 0);
udelay(1); udelay(1);
gpio_free(gpio); gpio_free(gpio);
peripheral_request(per, "soc-audio"); peripheral_request_list(sport_handle->pin_req, "soc-audio");
#else
pr_info("%s: Not implemented\n", __func__);
#endif
} }
static void bf5xx_ac97_cold_reset(struct snd_ac97 *ac97) static void bf5xx_ac97_cold_reset(struct snd_ac97 *ac97)
...@@ -306,18 +260,32 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai) ...@@ -306,18 +260,32 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai)
#define bf5xx_ac97_resume NULL #define bf5xx_ac97_resume NULL
#endif #endif
static int bf5xx_ac97_probe(struct snd_soc_dai *dai) static struct snd_soc_dai_driver bfin_ac97_dai = {
.ac97_control = 1,
.suspend = bf5xx_ac97_suspend,
.resume = bf5xx_ac97_resume,
.playback = {
.stream_name = "AC97 Playback",
.channels_min = 2,
#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
.channels_max = 6,
#else
.channels_max = 2,
#endif
.rates = SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE, },
.capture = {
.stream_name = "AC97 Capture",
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE, },
};
static int __devinit asoc_bfin_ac97_probe(struct platform_device *pdev)
{ {
int ret = 0; struct sport_device *sport_handle;
cmd_count = (int *)get_zeroed_page(GFP_KERNEL); int ret;
if (cmd_count == NULL)
return -ENOMEM;
if (peripheral_request_list(sport_req[sport_num], "soc-audio")) {
pr_err("Requesting Peripherals failed\n");
ret = -EFAULT;
goto peripheral_err;
}
#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
/* Request PB3 as reset pin */ /* Request PB3 as reset pin */
...@@ -329,12 +297,14 @@ static int bf5xx_ac97_probe(struct snd_soc_dai *dai) ...@@ -329,12 +297,14 @@ static int bf5xx_ac97_probe(struct snd_soc_dai *dai)
} }
gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1); gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1);
#endif #endif
sport_handle = sport_init(&sport_params[sport_num], 2, \
sizeof(struct ac97_frame), NULL); sport_handle = sport_init(pdev, 2, sizeof(struct ac97_frame),
PAGE_SIZE);
if (!sport_handle) { if (!sport_handle) {
ret = -ENODEV; ret = -ENODEV;
goto sport_err; goto sport_err;
} }
/*SPORT works in TDM mode to simulate AC97 transfers*/ /*SPORT works in TDM mode to simulate AC97 transfers*/
#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT) #if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
ret = sport_set_multichannel(sport_handle, 16, 0x3FF, 1); ret = sport_set_multichannel(sport_handle, 16, 0x3FF, 1);
...@@ -361,67 +331,37 @@ static int bf5xx_ac97_probe(struct snd_soc_dai *dai) ...@@ -361,67 +331,37 @@ static int bf5xx_ac97_probe(struct snd_soc_dai *dai)
goto sport_config_err; goto sport_config_err;
} }
ret = snd_soc_register_dai(&pdev->dev, &bfin_ac97_dai);
if (ret) {
pr_err("Failed to register DAI: %d\n", ret);
goto sport_config_err;
}
ac97_sport_handle = sport_handle;
return 0; return 0;
sport_config_err: sport_config_err:
kfree(sport_handle); sport_done(sport_handle);
sport_err: sport_err:
#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
gpio_err: gpio_err:
#endif #endif
peripheral_free_list(sport_req[sport_num]);
peripheral_err:
free_page((unsigned long)cmd_count);
cmd_count = NULL;
return ret; return ret;
} }
static int bf5xx_ac97_remove(struct snd_soc_dai *dai) static int __devexit asoc_bfin_ac97_remove(struct platform_device *pdev)
{ {
free_page((unsigned long)cmd_count); struct sport_device *sport_handle = platform_get_drvdata(pdev);
cmd_count = NULL;
peripheral_free_list(sport_req[sport_num]); snd_soc_unregister_dai(&pdev->dev);
sport_done(sport_handle);
#ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM);
#endif #endif
return 0;
}
struct snd_soc_dai_driver bfin_ac97_dai = {
.ac97_control = 1,
.probe = bf5xx_ac97_probe,
.remove = bf5xx_ac97_remove,
.suspend = bf5xx_ac97_suspend,
.resume = bf5xx_ac97_resume,
.playback = {
.stream_name = "AC97 Playback",
.channels_min = 2,
#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
.channels_max = 6,
#else
.channels_max = 2,
#endif
.rates = SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE, },
.capture = {
.stream_name = "AC97 Capture",
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE, },
};
EXPORT_SYMBOL_GPL(bfin_ac97_dai);
static __devinit int asoc_bfin_ac97_probe(struct platform_device *pdev)
{
return snd_soc_register_dai(&pdev->dev, &bfin_ac97_dai);
}
static int __devexit asoc_bfin_ac97_remove(struct platform_device *pdev)
{
snd_soc_unregister_dai(&pdev->dev);
return 0; return 0;
} }
......
...@@ -29,22 +29,12 @@ ...@@ -29,22 +29,12 @@
#include <asm/portmux.h> #include <asm/portmux.h>
#include "../codecs/ad1836.h" #include "../codecs/ad1836.h"
#include "bf5xx-sport.h"
#include "bf5xx-tdm-pcm.h" #include "bf5xx-tdm-pcm.h"
#include "bf5xx-tdm.h" #include "bf5xx-tdm.h"
static struct snd_soc_card bf5xx_ad1836; static struct snd_soc_card bf5xx_ad1836;
static int bf5xx_ad1836_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
return 0;
}
static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream, static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -75,23 +65,33 @@ static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream, ...@@ -75,23 +65,33 @@ static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream,
} }
static struct snd_soc_ops bf5xx_ad1836_ops = { static struct snd_soc_ops bf5xx_ad1836_ops = {
.startup = bf5xx_ad1836_startup,
.hw_params = bf5xx_ad1836_hw_params, .hw_params = bf5xx_ad1836_hw_params,
}; };
static struct snd_soc_dai_link bf5xx_ad1836_dai = { static struct snd_soc_dai_link bf5xx_ad1836_dai[] = {
.name = "ad1836", {
.stream_name = "AD1836", .name = "ad1836",
.cpu_dai_name = "bf5xx-tdm", .stream_name = "AD1836",
.codec_dai_name = "ad1836-hifi", .cpu_dai_name = "bfin-tdm.0",
.platform_name = "bf5xx-tdm-pcm-audio", .codec_dai_name = "ad1836-hifi",
.codec_name = "ad1836-codec.0", .platform_name = "bfin-tdm-pcm-audio",
.ops = &bf5xx_ad1836_ops, .codec_name = "ad1836.0",
.ops = &bf5xx_ad1836_ops,
},
{
.name = "ad1836",
.stream_name = "AD1836",
.cpu_dai_name = "bfin-tdm.1",
.codec_dai_name = "ad1836-hifi",
.platform_name = "bfin-tdm-pcm-audio",
.codec_name = "ad1836.0",
.ops = &bf5xx_ad1836_ops,
},
}; };
static struct snd_soc_card bf5xx_ad1836 = { static struct snd_soc_card bf5xx_ad1836 = {
.name = "bf5xx_ad1836", .name = "bfin-ad1836",
.dai_link = &bf5xx_ad1836_dai, .dai_link = &bf5xx_ad1836_dai[CONFIG_SND_BF5XX_SPORT_NUM],
.num_links = 1, .num_links = 1,
}; };
......
...@@ -38,30 +38,28 @@ ...@@ -38,30 +38,28 @@
#include <asm/portmux.h> #include <asm/portmux.h>
#include "../codecs/ad193x.h" #include "../codecs/ad193x.h"
#include "bf5xx-sport.h"
#include "bf5xx-tdm-pcm.h" #include "bf5xx-tdm-pcm.h"
#include "bf5xx-tdm.h" #include "bf5xx-tdm.h"
static struct snd_soc_card bf5xx_ad193x; static struct snd_soc_card bf5xx_ad193x;
static int bf5xx_ad193x_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
return 0;
}
static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream, static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
unsigned int clk = 0;
unsigned int channel_map[] = {0, 1, 2, 3, 4, 5, 6, 7}; unsigned int channel_map[] = {0, 1, 2, 3, 4, 5, 6, 7};
int ret = 0; int ret = 0;
switch (params_rate(params)) {
case 48000:
clk = 12288000;
break;
}
/* set cpu DAI configuration */ /* set cpu DAI configuration */
ret = snd_soc_dai_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_IB_IF | SND_SOC_DAIFMT_CBM_CFM); SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM);
...@@ -74,6 +72,12 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream, ...@@ -74,6 +72,12 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
if (ret < 0) if (ret < 0)
return ret; return ret;
/* set the codec system clock for DAC and ADC */
ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk,
SND_SOC_CLOCK_IN);
if (ret < 0)
return ret;
/* set codec DAI slots, 8 channels, all channels are enabled */ /* set codec DAI slots, 8 channels, all channels are enabled */
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xFF, 0xFF, 8, 32); ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xFF, 0xFF, 8, 32);
if (ret < 0) if (ret < 0)
...@@ -89,23 +93,33 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream, ...@@ -89,23 +93,33 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
} }
static struct snd_soc_ops bf5xx_ad193x_ops = { static struct snd_soc_ops bf5xx_ad193x_ops = {
.startup = bf5xx_ad193x_startup,
.hw_params = bf5xx_ad193x_hw_params, .hw_params = bf5xx_ad193x_hw_params,
}; };
static struct snd_soc_dai_link bf5xx_ad193x_dai = { static struct snd_soc_dai_link bf5xx_ad193x_dai[] = {
.name = "ad193x", {
.stream_name = "AD193X", .name = "ad193x",
.cpu_dai_name = "bf5xx-tdm", .stream_name = "AD193X",
.codec_dai_name ="ad193x-hifi", .cpu_dai_name = "bfin-tdm.0",
.platform_name = "bf5xx-tdm-pcm-audio", .codec_dai_name ="ad193x-hifi",
.codec_name = "ad193x-codec.5", .platform_name = "bfin-tdm-pcm-audio",
.ops = &bf5xx_ad193x_ops, .codec_name = "ad193x.5",
.ops = &bf5xx_ad193x_ops,
},
{
.name = "ad193x",
.stream_name = "AD193X",
.cpu_dai_name = "bfin-tdm.1",
.codec_dai_name ="ad193x-hifi",
.platform_name = "bfin-tdm-pcm-audio",
.codec_name = "ad193x.5",
.ops = &bf5xx_ad193x_ops,
},
}; };
static struct snd_soc_card bf5xx_ad193x = { static struct snd_soc_card bf5xx_ad193x = {
.name = "bf5xx_ad193x", .name = "bfin-ad193x",
.dai_link = &bf5xx_ad193x_dai, .dai_link = &bf5xx_ad193x_dai[CONFIG_SND_BF5XX_SPORT_NUM],
.num_links = 1, .num_links = 1,
}; };
......
...@@ -47,39 +47,34 @@ ...@@ -47,39 +47,34 @@
#include <asm/portmux.h> #include <asm/portmux.h>
#include "../codecs/ad1980.h" #include "../codecs/ad1980.h"
#include "bf5xx-sport.h"
#include "bf5xx-ac97-pcm.h" #include "bf5xx-ac97-pcm.h"
#include "bf5xx-ac97.h" #include "bf5xx-ac97.h"
static struct snd_soc_card bf5xx_board; static struct snd_soc_card bf5xx_board;
static int bf5xx_board_startup(struct snd_pcm_substream *substream) static struct snd_soc_dai_link bf5xx_board_dai[] = {
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; .name = "AC97",
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; .stream_name = "AC97 HiFi",
.cpu_dai_name = "bfin-ac97.0",
pr_debug("%s enter\n", __func__); .codec_dai_name = "ad1980-hifi",
snd_soc_dai_set_drvdata(cpu_dai, sport_handle); .platform_name = "bfin-ac97-pcm-audio",
return 0; .codec_name = "ad1980",
} },
{
static struct snd_soc_ops bf5xx_board_ops = { .name = "AC97",
.startup = bf5xx_board_startup, .stream_name = "AC97 HiFi",
}; .cpu_dai_name = "bfin-ac97.1",
.codec_dai_name = "ad1980-hifi",
static struct snd_soc_dai_link bf5xx_board_dai = { .platform_name = "bfin-ac97-pcm-audio",
.name = "AC97", .codec_name = "ad1980",
.stream_name = "AC97 HiFi", },
.cpu_dai_name = "bfin-ac97",
.codec_dai_name = "ad1980-hifi",
.platform_name = "bfin-pcm-audio",
.codec_name = "ad1980-codec",
.ops = &bf5xx_board_ops,
}; };
static struct snd_soc_card bf5xx_board = { static struct snd_soc_card bf5xx_board = {
.name = "bf5xx-board", .name = "bfin-ad1980",
.dai_link = &bf5xx_board_dai, .dai_link = &bf5xx_board_dai[CONFIG_SND_BF5XX_SPORT_NUM],
.num_links = 1, .num_links = 1,
}; };
......
...@@ -145,16 +145,6 @@ static int bf5xx_probe(struct platform_device *pdev) ...@@ -145,16 +145,6 @@ static int bf5xx_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int bf5xx_ad73311_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
pr_debug("%s enter\n", __func__);
snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
return 0;
}
static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream, static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -176,24 +166,34 @@ static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream, ...@@ -176,24 +166,34 @@ static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream,
static struct snd_soc_ops bf5xx_ad73311_ops = { static struct snd_soc_ops bf5xx_ad73311_ops = {
.startup = bf5xx_ad73311_startup,
.hw_params = bf5xx_ad73311_hw_params, .hw_params = bf5xx_ad73311_hw_params,
}; };
static struct snd_soc_dai_link bf5xx_ad73311_dai = { static struct snd_soc_dai_link bf5xx_ad73311_dai[] = {
.name = "ad73311", {
.stream_name = "AD73311", .name = "ad73311",
.cpu_dai_name = "bf5xx-i2s", .stream_name = "AD73311",
.codec_dai_name = "ad73311-hifi", .cpu_dai_name = "bfin-i2s.0",
.platform_name = "bfin-pcm-audio", .codec_dai_name = "ad73311-hifi",
.codec_name = "ad73311-codec", .platform_name = "bfin-i2s-pcm-audio",
.ops = &bf5xx_ad73311_ops, .codec_name = "ad73311",
.ops = &bf5xx_ad73311_ops,
},
{
.name = "ad73311",
.stream_name = "AD73311",
.cpu_dai_name = "bfin-i2s.1",
.codec_dai_name = "ad73311-hifi",
.platform_name = "bfin-i2s-pcm-audio",
.codec_name = "ad73311",
.ops = &bf5xx_ad73311_ops,
},
}; };
static struct snd_soc_card bf5xx_ad73311 = { static struct snd_soc_card bf5xx_ad73311 = {
.name = "bf5xx_ad73311", .name = "bfin-ad73311",
.probe = bf5xx_probe, .probe = bf5xx_probe,
.dai_link = &bf5xx_ad73311_dai, .dai_link = &bf5xx_ad73311_dai[CONFIG_SND_BF5XX_SPORT_NUM],
.num_links = 1, .num_links = 1,
}; };
......
...@@ -148,10 +148,15 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) ...@@ -148,10 +148,15 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)
static int bf5xx_pcm_open(struct snd_pcm_substream *substream) static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dma_buffer *buf = &substream->dma_buffer;
int ret; int ret;
pr_debug("%s enter\n", __func__); pr_debug("%s enter\n", __func__);
snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware);
ret = snd_pcm_hw_constraint_integer(runtime, \ ret = snd_pcm_hw_constraint_integer(runtime, \
...@@ -159,9 +164,14 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream) ...@@ -159,9 +164,14 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
if (ret < 0) if (ret < 0)
goto out; goto out;
if (sport_handle != NULL) if (sport_handle != NULL) {
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
sport_handle->tx_buf = buf->area;
else
sport_handle->rx_buf = buf->area;
runtime->private_data = sport_handle; runtime->private_data = sport_handle;
else { } else {
pr_err("sport_handle is NULL\n"); pr_err("sport_handle is NULL\n");
return -1; return -1;
} }
...@@ -214,11 +224,6 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) ...@@ -214,11 +224,6 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
pr_debug("%s, area:%p, size:0x%08lx\n", __func__, pr_debug("%s, area:%p, size:0x%08lx\n", __func__,
buf->area, buf->bytes); buf->area, buf->bytes);
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
sport_handle->tx_buf = buf->area;
else
sport_handle->rx_buf = buf->area;
return 0; return 0;
} }
...@@ -239,8 +244,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) ...@@ -239,8 +244,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
dma_free_coherent(NULL, buf->bytes, buf->area, 0); dma_free_coherent(NULL, buf->bytes, buf->area, 0);
buf->area = NULL; buf->area = NULL;
} }
if (sport_handle)
sport_done(sport_handle);
} }
static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
...@@ -292,7 +295,7 @@ static int __devexit bfin_i2s_soc_platform_remove(struct platform_device *pdev) ...@@ -292,7 +295,7 @@ static int __devexit bfin_i2s_soc_platform_remove(struct platform_device *pdev)
static struct platform_driver bfin_i2s_pcm_driver = { static struct platform_driver bfin_i2s_pcm_driver = {
.driver = { .driver = {
.name = "bfin-pcm-audio", .name = "bfin-i2s-pcm-audio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
......
...@@ -51,59 +51,24 @@ struct bf5xx_i2s_port { ...@@ -51,59 +51,24 @@ struct bf5xx_i2s_port {
int configured; int configured;
}; };
static struct bf5xx_i2s_port bf5xx_i2s;
static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM;
static struct sport_param sport_params[2] = {
{
.dma_rx_chan = CH_SPORT0_RX,
.dma_tx_chan = CH_SPORT0_TX,
.err_irq = IRQ_SPORT0_ERROR,
.regs = (struct sport_register *)SPORT0_TCR1,
},
{
.dma_rx_chan = CH_SPORT1_RX,
.dma_tx_chan = CH_SPORT1_TX,
.err_irq = IRQ_SPORT1_ERROR,
.regs = (struct sport_register *)SPORT1_TCR1,
}
};
/*
* Setting the TFS pin selector for SPORT 0 based on whether the selected
* port id F or G. If the port is F then no conflict should exist for the
* TFS. When Port G is selected and EMAC then there is a conflict between
* the PHY interrupt line and TFS. Current settings prevent the conflict
* by ignoring the TFS pin when Port G is selected. This allows both
* codecs and EMAC using Port G concurrently.
*/
#ifdef CONFIG_BF527_SPORT0_PORTG
#define LOCAL_SPORT0_TFS (0)
#else
#define LOCAL_SPORT0_TFS (P_SPORT0_TFS)
#endif
static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
P_SPORT0_DRPRI, P_SPORT0_RSCLK, LOCAL_SPORT0_TFS, 0},
{P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, P_SPORT1_DRPRI,
P_SPORT1_RSCLK, P_SPORT1_TFS, 0} };
static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
unsigned int fmt) unsigned int fmt)
{ {
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
struct bf5xx_i2s_port *bf5xx_i2s = sport_handle->private_data;
int ret = 0; int ret = 0;
/* interface format:support I2S,slave mode */ /* interface format:support I2S,slave mode */
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
bf5xx_i2s.tcr1 |= TFSR | TCKFE; bf5xx_i2s->tcr1 |= TFSR | TCKFE;
bf5xx_i2s.rcr1 |= RFSR | RCKFE; bf5xx_i2s->rcr1 |= RFSR | RCKFE;
bf5xx_i2s.tcr2 |= TSFSE; bf5xx_i2s->tcr2 |= TSFSE;
bf5xx_i2s.rcr2 |= RSFSE; bf5xx_i2s->rcr2 |= RSFSE;
break; break;
case SND_SOC_DAIFMT_DSP_A: case SND_SOC_DAIFMT_DSP_A:
bf5xx_i2s.tcr1 |= TFSR; bf5xx_i2s->tcr1 |= TFSR;
bf5xx_i2s.rcr1 |= RFSR; bf5xx_i2s->rcr1 |= RFSR;
break; break;
case SND_SOC_DAIFMT_LEFT_J: case SND_SOC_DAIFMT_LEFT_J:
ret = -EINVAL; ret = -EINVAL;
...@@ -135,29 +100,35 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -135,29 +100,35 @@ static int bf5xx_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 snd_soc_dai *dai)
{ {
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(dai);
struct bf5xx_i2s_port *bf5xx_i2s = sport_handle->private_data;
int ret = 0; int ret = 0;
bf5xx_i2s.tcr2 &= ~0x1f; bf5xx_i2s->tcr2 &= ~0x1f;
bf5xx_i2s.rcr2 &= ~0x1f; bf5xx_i2s->rcr2 &= ~0x1f;
switch (params_format(params)) { switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
bf5xx_i2s->tcr2 |= 7;
bf5xx_i2s->rcr2 |= 7;
sport_handle->wdsize = 1;
case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_LE:
bf5xx_i2s.tcr2 |= 15; bf5xx_i2s->tcr2 |= 15;
bf5xx_i2s.rcr2 |= 15; bf5xx_i2s->rcr2 |= 15;
sport_handle->wdsize = 2; sport_handle->wdsize = 2;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
bf5xx_i2s.tcr2 |= 23; bf5xx_i2s->tcr2 |= 23;
bf5xx_i2s.rcr2 |= 23; bf5xx_i2s->rcr2 |= 23;
sport_handle->wdsize = 3; sport_handle->wdsize = 3;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S32_LE:
bf5xx_i2s.tcr2 |= 31; bf5xx_i2s->tcr2 |= 31;
bf5xx_i2s.rcr2 |= 31; bf5xx_i2s->rcr2 |= 31;
sport_handle->wdsize = 4; sport_handle->wdsize = 4;
break; break;
} }
if (!bf5xx_i2s.configured) { if (!bf5xx_i2s->configured) {
/* /*
* TX and RX are not independent,they are enabled at the * TX and RX are not independent,they are enabled at the
* same time, even if only one side is running. So, we * same time, even if only one side is running. So, we
...@@ -166,16 +137,16 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -166,16 +137,16 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
* *
* CPU DAI:slave mode. * CPU DAI:slave mode.
*/ */
bf5xx_i2s.configured = 1; bf5xx_i2s->configured = 1;
ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1, ret = sport_config_rx(sport_handle, bf5xx_i2s->rcr1,
bf5xx_i2s.rcr2, 0, 0); bf5xx_i2s->rcr2, 0, 0);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
} }
ret = sport_config_tx(sport_handle, bf5xx_i2s.tcr1, ret = sport_config_tx(sport_handle, bf5xx_i2s->tcr1,
bf5xx_i2s.tcr2, 0, 0); bf5xx_i2s->tcr2, 0, 0);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
...@@ -188,41 +159,19 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -188,41 +159,19 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream, static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(dai);
struct bf5xx_i2s_port *bf5xx_i2s = sport_handle->private_data;
pr_debug("%s enter\n", __func__); pr_debug("%s enter\n", __func__);
/* No active stream, SPORT is allowed to be configured again. */ /* No active stream, SPORT is allowed to be configured again. */
if (!dai->active) if (!dai->active)
bf5xx_i2s.configured = 0; bf5xx_i2s->configured = 0;
}
static int bf5xx_i2s_probe(struct snd_soc_dai *dai)
{
pr_debug("%s enter\n", __func__);
if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) {
pr_err("Requesting Peripherals failed\n");
return -EFAULT;
}
/* request DMA for SPORT */
sport_handle = sport_init(&sport_params[sport_num], 4, \
2 * sizeof(u32), NULL);
if (!sport_handle) {
peripheral_free_list(&sport_req[sport_num][0]);
return -ENODEV;
}
return 0;
}
static int bf5xx_i2s_remove(struct snd_soc_dai *dai)
{
pr_debug("%s enter\n", __func__);
peripheral_free_list(&sport_req[sport_num][0]);
return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int bf5xx_i2s_suspend(struct snd_soc_dai *dai) static int bf5xx_i2s_suspend(struct snd_soc_dai *dai)
{ {
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(dai);
pr_debug("%s : sport %d\n", __func__, dai->id); pr_debug("%s : sport %d\n", __func__, dai->id);
...@@ -235,19 +184,21 @@ static int bf5xx_i2s_suspend(struct snd_soc_dai *dai) ...@@ -235,19 +184,21 @@ static int bf5xx_i2s_suspend(struct snd_soc_dai *dai)
static int bf5xx_i2s_resume(struct snd_soc_dai *dai) static int bf5xx_i2s_resume(struct snd_soc_dai *dai)
{ {
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(dai);
struct bf5xx_i2s_port *bf5xx_i2s = sport_handle->private_data;
int ret; int ret;
pr_debug("%s : sport %d\n", __func__, dai->id); pr_debug("%s : sport %d\n", __func__, dai->id);
ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1, ret = sport_config_rx(sport_handle, bf5xx_i2s->rcr1,
bf5xx_i2s.rcr2, 0, 0); bf5xx_i2s->rcr2, 0, 0);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
} }
ret = sport_config_tx(sport_handle, bf5xx_i2s.tcr1, ret = sport_config_tx(sport_handle, bf5xx_i2s->tcr1,
bf5xx_i2s.tcr2, 0, 0); bf5xx_i2s->tcr2, 0, 0);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
...@@ -266,8 +217,11 @@ static int bf5xx_i2s_resume(struct snd_soc_dai *dai) ...@@ -266,8 +217,11 @@ static int bf5xx_i2s_resume(struct snd_soc_dai *dai)
SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | \ SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | \
SNDRV_PCM_RATE_96000) SNDRV_PCM_RATE_96000)
#define BF5XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |\ #define BF5XX_I2S_FORMATS \
SNDRV_PCM_FMTBIT_S32_LE) (SNDRV_PCM_FMTBIT_S8 | \
SNDRV_PCM_FMTBIT_S16_LE | \
SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_S32_LE)
static struct snd_soc_dai_ops bf5xx_i2s_dai_ops = { static struct snd_soc_dai_ops bf5xx_i2s_dai_ops = {
.shutdown = bf5xx_i2s_shutdown, .shutdown = bf5xx_i2s_shutdown,
...@@ -276,8 +230,6 @@ static struct snd_soc_dai_ops bf5xx_i2s_dai_ops = { ...@@ -276,8 +230,6 @@ static struct snd_soc_dai_ops bf5xx_i2s_dai_ops = {
}; };
static struct snd_soc_dai_driver bf5xx_i2s_dai = { static struct snd_soc_dai_driver bf5xx_i2s_dai = {
.probe = bf5xx_i2s_probe,
.remove = bf5xx_i2s_remove,
.suspend = bf5xx_i2s_suspend, .suspend = bf5xx_i2s_suspend,
.resume = bf5xx_i2s_resume, .resume = bf5xx_i2s_resume,
.playback = { .playback = {
...@@ -293,23 +245,45 @@ static struct snd_soc_dai_driver bf5xx_i2s_dai = { ...@@ -293,23 +245,45 @@ static struct snd_soc_dai_driver bf5xx_i2s_dai = {
.ops = &bf5xx_i2s_dai_ops, .ops = &bf5xx_i2s_dai_ops,
}; };
static int bfin_i2s_drv_probe(struct platform_device *pdev) static int __devinit bf5xx_i2s_probe(struct platform_device *pdev)
{ {
return snd_soc_register_dai(&pdev->dev, &bf5xx_i2s_dai); struct sport_device *sport_handle;
int ret;
/* configure SPORT for I2S */
sport_handle = sport_init(pdev, 4, 2 * sizeof(u32),
sizeof(struct bf5xx_i2s_port));
if (!sport_handle)
return -ENODEV;
/* register with the ASoC layers */
ret = snd_soc_register_dai(&pdev->dev, &bf5xx_i2s_dai);
if (ret) {
pr_err("Failed to register DAI: %d\n", ret);
sport_done(sport_handle);
return ret;
}
return 0;
} }
static int __devexit bfin_i2s_drv_remove(struct platform_device *pdev) static int __devexit bf5xx_i2s_remove(struct platform_device *pdev)
{ {
struct sport_device *sport_handle = platform_get_drvdata(pdev);
pr_debug("%s enter\n", __func__);
snd_soc_unregister_dai(&pdev->dev); snd_soc_unregister_dai(&pdev->dev);
sport_done(sport_handle);
return 0; return 0;
} }
static struct platform_driver bfin_i2s_driver = { static struct platform_driver bfin_i2s_driver = {
.probe = bfin_i2s_drv_probe, .probe = bf5xx_i2s_probe,
.remove = __devexit_p(bfin_i2s_drv_remove), .remove = __devexit_p(bf5xx_i2s_remove),
.driver = { .driver = {
.name = "bf5xx-i2s", .name = "bfin-i2s",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
}; };
......
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
/* delay between frame sync pulse and first data bit in multichannel mode */ /* delay between frame sync pulse and first data bit in multichannel mode */
#define FRAME_DELAY (1<<12) #define FRAME_DELAY (1<<12)
struct sport_device *sport_handle;
EXPORT_SYMBOL(sport_handle);
/* note: multichannel is in units of 8 channels, /* note: multichannel is in units of 8 channels,
* tdm_count is # channels NOT / 8 ! */ * tdm_count is # channels NOT / 8 ! */
int sport_set_multichannel(struct sport_device *sport, int sport_set_multichannel(struct sport_device *sport,
...@@ -798,86 +796,164 @@ int sport_set_err_callback(struct sport_device *sport, ...@@ -798,86 +796,164 @@ int sport_set_err_callback(struct sport_device *sport,
} }
EXPORT_SYMBOL(sport_set_err_callback); EXPORT_SYMBOL(sport_set_err_callback);
struct sport_device *sport_init(struct sport_param *param, unsigned wdsize, static int sport_config_pdev(struct platform_device *pdev, struct sport_param *param)
unsigned dummy_count, void *private_data)
{ {
int ret; /* Extract settings from platform data */
struct device *dev = &pdev->dev;
struct bfin_snd_platform_data *pdata = dev->platform_data;
struct resource *res;
param->num = pdev->id;
if (!pdata) {
dev_err(dev, "no platform_data\n");
return -ENODEV;
}
param->pin_req = pdata->pin_req;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(dev, "no MEM resource\n");
return -ENODEV;
}
param->regs = (struct sport_register *)res->start;
/* first RX, then TX */
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) {
dev_err(dev, "no rx DMA resource\n");
return -ENODEV;
}
param->dma_rx_chan = res->start;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!res) {
dev_err(dev, "no tx DMA resource\n");
return -ENODEV;
}
param->dma_tx_chan = res->start;
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(dev, "no irq resource\n");
return -ENODEV;
}
param->err_irq = res->start;
return 0;
}
struct sport_device *sport_init(struct platform_device *pdev,
unsigned int wdsize, unsigned int dummy_count, size_t priv_size)
{
struct device *dev = &pdev->dev;
struct sport_param param;
struct sport_device *sport; struct sport_device *sport;
pr_debug("%s enter\n", __func__); int ret;
BUG_ON(param == NULL);
BUG_ON(wdsize == 0 || dummy_count == 0); dev_dbg(dev, "%s enter\n", __func__);
sport = kmalloc(sizeof(struct sport_device), GFP_KERNEL);
if (!sport) { param.wdsize = wdsize;
pr_err("Failed to allocate for sport device\n"); param.dummy_count = dummy_count;
BUG_ON(param.wdsize == 0 || param.dummy_count == 0);
ret = sport_config_pdev(pdev, &param);
if (ret)
return NULL;
if (peripheral_request_list(param.pin_req, "soc-audio")) {
dev_err(dev, "requesting Peripherals failed\n");
return NULL; return NULL;
} }
memset(sport, 0, sizeof(struct sport_device)); sport = kzalloc(sizeof(*sport), GFP_KERNEL);
sport->dma_rx_chan = param->dma_rx_chan; if (!sport) {
sport->dma_tx_chan = param->dma_tx_chan; dev_err(dev, "failed to allocate for sport device\n");
sport->err_irq = param->err_irq; goto __init_err0;
sport->regs = param->regs; }
sport->private_data = private_data;
sport->num = param.num;
sport->dma_rx_chan = param.dma_rx_chan;
sport->dma_tx_chan = param.dma_tx_chan;
sport->err_irq = param.err_irq;
sport->regs = param.regs;
sport->pin_req = param.pin_req;
if (request_dma(sport->dma_rx_chan, "SPORT RX Data") == -EBUSY) { if (request_dma(sport->dma_rx_chan, "SPORT RX Data") == -EBUSY) {
pr_err("Failed to request RX dma %d\n", \ dev_err(dev, "failed to request RX dma %d\n", sport->dma_rx_chan);
sport->dma_rx_chan);
goto __init_err1; goto __init_err1;
} }
if (set_dma_callback(sport->dma_rx_chan, rx_handler, sport) != 0) { if (set_dma_callback(sport->dma_rx_chan, rx_handler, sport) != 0) {
pr_err("Failed to request RX irq %d\n", \ dev_err(dev, "failed to request RX irq %d\n", sport->dma_rx_chan);
sport->dma_rx_chan);
goto __init_err2; goto __init_err2;
} }
if (request_dma(sport->dma_tx_chan, "SPORT TX Data") == -EBUSY) { if (request_dma(sport->dma_tx_chan, "SPORT TX Data") == -EBUSY) {
pr_err("Failed to request TX dma %d\n", \ dev_err(dev, "failed to request TX dma %d\n", sport->dma_tx_chan);
sport->dma_tx_chan);
goto __init_err2; goto __init_err2;
} }
if (set_dma_callback(sport->dma_tx_chan, tx_handler, sport) != 0) { if (set_dma_callback(sport->dma_tx_chan, tx_handler, sport) != 0) {
pr_err("Failed to request TX irq %d\n", \ dev_err(dev, "failed to request TX irq %d\n", sport->dma_tx_chan);
sport->dma_tx_chan);
goto __init_err3; goto __init_err3;
} }
if (request_irq(sport->err_irq, err_handler, IRQF_SHARED, "SPORT err", if (request_irq(sport->err_irq, err_handler, IRQF_SHARED, "SPORT err",
sport) < 0) { sport) < 0) {
pr_err("Failed to request err irq:%d\n", \ dev_err(dev, "failed to request err irq %d\n", sport->err_irq);
sport->err_irq);
goto __init_err3; goto __init_err3;
} }
pr_err("dma rx:%d tx:%d, err irq:%d, regs:%p\n", dev_info(dev, "dma rx:%d tx:%d, err irq:%d, regs:%p\n",
sport->dma_rx_chan, sport->dma_tx_chan, sport->dma_rx_chan, sport->dma_tx_chan,
sport->err_irq, sport->regs); sport->err_irq, sport->regs);
sport->wdsize = wdsize; sport->wdsize = param.wdsize;
sport->dummy_count = dummy_count; sport->dummy_count = param.dummy_count;
sport->private_data = kzalloc(priv_size, GFP_KERNEL);
if (!sport->private_data) {
dev_err(dev, "could not alloc priv data %zu bytes\n", priv_size);
goto __init_err4;
}
if (L1_DATA_A_LENGTH) if (L1_DATA_A_LENGTH)
sport->dummy_buf = l1_data_sram_zalloc(dummy_count * 2); sport->dummy_buf = l1_data_sram_zalloc(param.dummy_count * 2);
else else
sport->dummy_buf = kzalloc(dummy_count * 2, GFP_KERNEL); sport->dummy_buf = kzalloc(param.dummy_count * 2, GFP_KERNEL);
if (sport->dummy_buf == NULL) { if (sport->dummy_buf == NULL) {
pr_err("Failed to allocate dummy buffer\n"); dev_err(dev, "failed to allocate dummy buffer\n");
goto __error; goto __error1;
} }
ret = sport_config_rx_dummy(sport); ret = sport_config_rx_dummy(sport);
if (ret) { if (ret) {
pr_err("Failed to config rx dummy ring\n"); dev_err(dev, "failed to config rx dummy ring\n");
goto __error; goto __error2;
} }
ret = sport_config_tx_dummy(sport); ret = sport_config_tx_dummy(sport);
if (ret) { if (ret) {
pr_err("Failed to config tx dummy ring\n"); dev_err(dev, "failed to config tx dummy ring\n");
goto __error; goto __error3;
} }
platform_set_drvdata(pdev, sport);
return sport; return sport;
__error: __error3:
if (L1_DATA_A_LENGTH)
l1_data_sram_free(sport->dummy_rx_desc);
else
dma_free_coherent(NULL, 2*sizeof(struct dmasg),
sport->dummy_rx_desc, 0);
__error2:
if (L1_DATA_A_LENGTH)
l1_data_sram_free(sport->dummy_buf);
else
kfree(sport->dummy_buf);
__error1:
kfree(sport->private_data);
__init_err4:
free_irq(sport->err_irq, sport); free_irq(sport->err_irq, sport);
__init_err3: __init_err3:
free_dma(sport->dma_tx_chan); free_dma(sport->dma_tx_chan);
...@@ -885,6 +961,8 @@ struct sport_device *sport_init(struct sport_param *param, unsigned wdsize, ...@@ -885,6 +961,8 @@ struct sport_device *sport_init(struct sport_param *param, unsigned wdsize,
free_dma(sport->dma_rx_chan); free_dma(sport->dma_rx_chan);
__init_err1: __init_err1:
kfree(sport); kfree(sport);
__init_err0:
peripheral_free_list(param.pin_req);
return NULL; return NULL;
} }
EXPORT_SYMBOL(sport_init); EXPORT_SYMBOL(sport_init);
...@@ -917,8 +995,9 @@ void sport_done(struct sport_device *sport) ...@@ -917,8 +995,9 @@ void sport_done(struct sport_device *sport)
free_dma(sport->dma_tx_chan); free_dma(sport->dma_tx_chan);
free_irq(sport->err_irq, sport); free_irq(sport->err_irq, sport);
kfree(sport->private_data);
peripheral_free_list(sport->pin_req);
kfree(sport); kfree(sport);
sport = NULL;
} }
EXPORT_SYMBOL(sport_done); EXPORT_SYMBOL(sport_done);
......
/* /*
* File: bf5xx_ac97_sport.h * File: bf5xx_sport.h
* Based on: * Based on:
* Author: Roy Huang <roy.huang@analog.com> * Author: Roy Huang <roy.huang@analog.com>
* *
...@@ -33,15 +33,18 @@ ...@@ -33,15 +33,18 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/platform_device.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/bfin_sport.h> #include <asm/bfin_sport.h>
#define DESC_ELEMENT_COUNT 9 #define DESC_ELEMENT_COUNT 9
struct sport_device { struct sport_device {
int num;
int dma_rx_chan; int dma_rx_chan;
int dma_tx_chan; int dma_tx_chan;
int err_irq; int err_irq;
const unsigned short *pin_req;
struct sport_register *regs; struct sport_register *regs;
unsigned char *rx_buf; unsigned char *rx_buf;
...@@ -103,17 +106,20 @@ struct sport_device { ...@@ -103,17 +106,20 @@ struct sport_device {
void *private_data; void *private_data;
}; };
extern struct sport_device *sport_handle;
struct sport_param { struct sport_param {
int num;
int dma_rx_chan; int dma_rx_chan;
int dma_tx_chan; int dma_tx_chan;
int err_irq; int err_irq;
const unsigned short *pin_req;
struct sport_register *regs; struct sport_register *regs;
unsigned int wdsize;
unsigned int dummy_count;
void *private_data;
}; };
struct sport_device *sport_init(struct sport_param *param, unsigned wdsize, struct sport_device *sport_init(struct platform_device *pdev,
unsigned dummy_count, void *private_data); unsigned int wdsize, unsigned int dummy_count, size_t priv_size);
void sport_done(struct sport_device *sport); void sport_done(struct sport_device *sport);
......
...@@ -44,16 +44,6 @@ ...@@ -44,16 +44,6 @@
static struct snd_soc_card bf5xx_ssm2602; static struct snd_soc_card bf5xx_ssm2602;
static int bf5xx_ssm2602_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
pr_debug("%s enter\n", __func__);
snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
return 0;
}
static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream, static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -109,23 +99,33 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream, ...@@ -109,23 +99,33 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
} }
static struct snd_soc_ops bf5xx_ssm2602_ops = { static struct snd_soc_ops bf5xx_ssm2602_ops = {
.startup = bf5xx_ssm2602_startup,
.hw_params = bf5xx_ssm2602_hw_params, .hw_params = bf5xx_ssm2602_hw_params,
}; };
static struct snd_soc_dai_link bf5xx_ssm2602_dai = { static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = {
.name = "ssm2602", {
.stream_name = "SSM2602", .name = "ssm2602",
.cpu_dai_name = "bf5xx-i2s", .stream_name = "SSM2602",
.codec_dai_name = "ssm2602-hifi", .cpu_dai_name = "bfin-i2s.0",
.platform_name = "bf5xx-pcm-audio", .codec_dai_name = "ssm2602-hifi",
.codec_name = "ssm2602-codec.0-001b", .platform_name = "bfin-i2s-pcm-audio",
.ops = &bf5xx_ssm2602_ops, .codec_name = "ssm2602.0-001b",
.ops = &bf5xx_ssm2602_ops,
},
{
.name = "ssm2602",
.stream_name = "SSM2602",
.cpu_dai_name = "bfin-i2s.1",
.codec_dai_name = "ssm2602-hifi",
.platform_name = "bfin-i2s-pcm-audio",
.codec_name = "ssm2602.0-001b",
.ops = &bf5xx_ssm2602_ops,
},
}; };
static struct snd_soc_card bf5xx_ssm2602 = { static struct snd_soc_card bf5xx_ssm2602 = {
.name = "bf5xx_ssm2602", .name = "bfin-ssm2602",
.dai_link = &bf5xx_ssm2602_dai, .dai_link = &bf5xx_ssm2602_dai[CONFIG_SND_BF5XX_SPORT_NUM],
.num_links = 1, .num_links = 1,
}; };
......
...@@ -154,7 +154,12 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) ...@@ -154,7 +154,12 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)
static int bf5xx_pcm_open(struct snd_pcm_substream *substream) static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dma_buffer *buf = &substream->dma_buffer;
int ret = 0; int ret = 0;
snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware);
...@@ -164,9 +169,14 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream) ...@@ -164,9 +169,14 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
if (ret < 0) if (ret < 0)
goto out; goto out;
if (sport_handle != NULL) if (sport_handle != NULL) {
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
sport_handle->tx_buf = buf->area;
else
sport_handle->rx_buf = buf->area;
runtime->private_data = sport_handle; runtime->private_data = sport_handle;
else { } else {
pr_err("sport_handle is NULL\n"); pr_err("sport_handle is NULL\n");
ret = -ENODEV; ret = -ENODEV;
} }
...@@ -249,11 +259,6 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) ...@@ -249,11 +259,6 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
} }
buf->bytes = size; buf->bytes = size;
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
sport_handle->tx_buf = buf->area;
else
sport_handle->rx_buf = buf->area;
return 0; return 0;
} }
...@@ -274,8 +279,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) ...@@ -274,8 +279,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
dma_free_coherent(NULL, buf->bytes, buf->area, 0); dma_free_coherent(NULL, buf->bytes, buf->area, 0);
buf->area = NULL; buf->area = NULL;
} }
if (sport_handle)
sport_done(sport_handle);
} }
static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
...@@ -326,7 +329,7 @@ static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev) ...@@ -326,7 +329,7 @@ static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev)
static struct platform_driver bfin_tdm_driver = { static struct platform_driver bfin_tdm_driver = {
.driver = { .driver = {
.name = "bf5xx-tdm-pcm-audio", .name = "bfin-tdm-pcm-audio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
......
...@@ -46,43 +46,6 @@ ...@@ -46,43 +46,6 @@
#include "bf5xx-sport.h" #include "bf5xx-sport.h"
#include "bf5xx-tdm.h" #include "bf5xx-tdm.h"
static struct bf5xx_tdm_port bf5xx_tdm;
static int sport_num = CONFIG_SND_BF5XX_SPORT_NUM;
static struct sport_param sport_params[2] = {
{
.dma_rx_chan = CH_SPORT0_RX,
.dma_tx_chan = CH_SPORT0_TX,
.err_irq = IRQ_SPORT0_ERROR,
.regs = (struct sport_register *)SPORT0_TCR1,
},
{
.dma_rx_chan = CH_SPORT1_RX,
.dma_tx_chan = CH_SPORT1_TX,
.err_irq = IRQ_SPORT1_ERROR,
.regs = (struct sport_register *)SPORT1_TCR1,
}
};
/*
* Setting the TFS pin selector for SPORT 0 based on whether the selected
* port id F or G. If the port is F then no conflict should exist for the
* TFS. When Port G is selected and EMAC then there is a conflict between
* the PHY interrupt line and TFS. Current settings prevent the conflict
* by ignoring the TFS pin when Port G is selected. This allows both
* codecs and EMAC using Port G concurrently.
*/
#ifdef CONFIG_BF527_SPORT0_PORTG
#define LOCAL_SPORT0_TFS (0)
#else
#define LOCAL_SPORT0_TFS (P_SPORT0_TFS)
#endif
static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
P_SPORT0_DRPRI, P_SPORT0_RSCLK, LOCAL_SPORT0_TFS, 0},
{P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, P_SPORT1_DRPRI,
P_SPORT1_RSCLK, P_SPORT1_TFS, 0} };
static int bf5xx_tdm_set_dai_fmt(struct snd_soc_dai *cpu_dai, static int bf5xx_tdm_set_dai_fmt(struct snd_soc_dai *cpu_dai,
unsigned int fmt) unsigned int fmt)
{ {
...@@ -119,14 +82,16 @@ static int bf5xx_tdm_hw_params(struct snd_pcm_substream *substream, ...@@ -119,14 +82,16 @@ static int bf5xx_tdm_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 snd_soc_dai *dai)
{ {
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(dai);
struct bf5xx_tdm_port *bf5xx_tdm = sport_handle->private_data;
int ret = 0; int ret = 0;
bf5xx_tdm.tcr2 &= ~0x1f; bf5xx_tdm->tcr2 &= ~0x1f;
bf5xx_tdm.rcr2 &= ~0x1f; bf5xx_tdm->rcr2 &= ~0x1f;
switch (params_format(params)) { switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S32_LE:
bf5xx_tdm.tcr2 |= 31; bf5xx_tdm->tcr2 |= 31;
bf5xx_tdm.rcr2 |= 31; bf5xx_tdm->rcr2 |= 31;
sport_handle->wdsize = 4; sport_handle->wdsize = 4;
break; break;
/* at present, we only support 32bit transfer */ /* at present, we only support 32bit transfer */
...@@ -136,7 +101,7 @@ static int bf5xx_tdm_hw_params(struct snd_pcm_substream *substream, ...@@ -136,7 +101,7 @@ static int bf5xx_tdm_hw_params(struct snd_pcm_substream *substream,
break; break;
} }
if (!bf5xx_tdm.configured) { if (!bf5xx_tdm->configured) {
/* /*
* TX and RX are not independent,they are enabled at the * TX and RX are not independent,they are enabled at the
* same time, even if only one side is running. So, we * same time, even if only one side is running. So, we
...@@ -145,21 +110,21 @@ static int bf5xx_tdm_hw_params(struct snd_pcm_substream *substream, ...@@ -145,21 +110,21 @@ static int bf5xx_tdm_hw_params(struct snd_pcm_substream *substream,
* *
* CPU DAI:slave mode. * CPU DAI:slave mode.
*/ */
ret = sport_config_rx(sport_handle, bf5xx_tdm.rcr1, ret = sport_config_rx(sport_handle, bf5xx_tdm->rcr1,
bf5xx_tdm.rcr2, 0, 0); bf5xx_tdm->rcr2, 0, 0);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
} }
ret = sport_config_tx(sport_handle, bf5xx_tdm.tcr1, ret = sport_config_tx(sport_handle, bf5xx_tdm->tcr1,
bf5xx_tdm.tcr2, 0, 0); bf5xx_tdm->tcr2, 0, 0);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
} }
bf5xx_tdm.configured = 1; bf5xx_tdm->configured = 1;
} }
return 0; return 0;
...@@ -168,15 +133,20 @@ static int bf5xx_tdm_hw_params(struct snd_pcm_substream *substream, ...@@ -168,15 +133,20 @@ static int bf5xx_tdm_hw_params(struct snd_pcm_substream *substream,
static void bf5xx_tdm_shutdown(struct snd_pcm_substream *substream, static void bf5xx_tdm_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(dai);
struct bf5xx_tdm_port *bf5xx_tdm = sport_handle->private_data;
/* No active stream, SPORT is allowed to be configured again. */ /* No active stream, SPORT is allowed to be configured again. */
if (!dai->active) if (!dai->active)
bf5xx_tdm.configured = 0; bf5xx_tdm->configured = 0;
} }
static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai, static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai,
unsigned int tx_num, unsigned int *tx_slot, unsigned int tx_num, unsigned int *tx_slot,
unsigned int rx_num, unsigned int *rx_slot) unsigned int rx_num, unsigned int *rx_slot)
{ {
struct sport_device *sport_handle = snd_soc_dai_get_drvdata(dai);
struct bf5xx_tdm_port *bf5xx_tdm = sport_handle->private_data;
int i; int i;
unsigned int slot; unsigned int slot;
unsigned int tx_mapped = 0, rx_mapped = 0; unsigned int tx_mapped = 0, rx_mapped = 0;
...@@ -189,7 +159,7 @@ static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai, ...@@ -189,7 +159,7 @@ static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai,
slot = tx_slot[i]; slot = tx_slot[i];
if ((slot < BFIN_TDM_DAI_MAX_SLOTS) && if ((slot < BFIN_TDM_DAI_MAX_SLOTS) &&
(!(tx_mapped & (1 << slot)))) { (!(tx_mapped & (1 << slot)))) {
bf5xx_tdm.tx_map[i] = slot; bf5xx_tdm->tx_map[i] = slot;
tx_mapped |= 1 << slot; tx_mapped |= 1 << slot;
} else } else
return -EINVAL; return -EINVAL;
...@@ -198,7 +168,7 @@ static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai, ...@@ -198,7 +168,7 @@ static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai,
slot = rx_slot[i]; slot = rx_slot[i];
if ((slot < BFIN_TDM_DAI_MAX_SLOTS) && if ((slot < BFIN_TDM_DAI_MAX_SLOTS) &&
(!(rx_mapped & (1 << slot)))) { (!(rx_mapped & (1 << slot)))) {
bf5xx_tdm.rx_map[i] = slot; bf5xx_tdm->rx_map[i] = slot;
rx_mapped |= 1 << slot; rx_mapped |= 1 << slot;
} else } else
return -EINVAL; return -EINVAL;
...@@ -212,12 +182,14 @@ static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) ...@@ -212,12 +182,14 @@ static int bf5xx_tdm_suspend(struct snd_soc_dai *dai)
{ {
struct sport_device *sport = snd_soc_dai_get_drvdata(dai); struct sport_device *sport = snd_soc_dai_get_drvdata(dai);
if (!dai->active)
return 0;
if (dai->capture_active)
sport_rx_stop(sport);
if (dai->playback_active) if (dai->playback_active)
sport_tx_stop(sport); sport_tx_stop(sport);
if (dai->capture_active)
sport_rx_stop(sport);
/* isolate sync/clock pins from codec while sports resume */
peripheral_free_list(sport->pin_req);
return 0; return 0;
} }
...@@ -226,9 +198,6 @@ static int bf5xx_tdm_resume(struct snd_soc_dai *dai) ...@@ -226,9 +198,6 @@ static int bf5xx_tdm_resume(struct snd_soc_dai *dai)
int ret; int ret;
struct sport_device *sport = snd_soc_dai_get_drvdata(dai); struct sport_device *sport = snd_soc_dai_get_drvdata(dai);
if (!dai->active)
return 0;
ret = sport_set_multichannel(sport, 8, 0xFF, 1); ret = sport_set_multichannel(sport, 8, 0xFF, 1);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
...@@ -247,6 +216,8 @@ static int bf5xx_tdm_resume(struct snd_soc_dai *dai) ...@@ -247,6 +216,8 @@ static int bf5xx_tdm_resume(struct snd_soc_dai *dai)
ret = -EBUSY; ret = -EBUSY;
} }
peripheral_request_list(sport->pin_req, "soc-audio");
return 0; return 0;
} }
...@@ -280,20 +251,14 @@ static struct snd_soc_dai_driver bf5xx_tdm_dai = { ...@@ -280,20 +251,14 @@ static struct snd_soc_dai_driver bf5xx_tdm_dai = {
static int __devinit bfin_tdm_probe(struct platform_device *pdev) static int __devinit bfin_tdm_probe(struct platform_device *pdev)
{ {
int ret = 0; struct sport_device *sport_handle;
int ret;
if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) {
pr_err("Requesting Peripherals failed\n");
return -EFAULT;
}
/* request DMA for SPORT */ /* configure SPORT for TDM */
sport_handle = sport_init(&sport_params[sport_num], 4, \ sport_handle = sport_init(pdev, 4, 8 * sizeof(u32),
8 * sizeof(u32), NULL); sizeof(struct bf5xx_tdm_port));
if (!sport_handle) { if (!sport_handle)
peripheral_free_list(&sport_req[sport_num][0]);
return -ENODEV; return -ENODEV;
}
/* SPORT works in TDM mode */ /* SPORT works in TDM mode */
ret = sport_set_multichannel(sport_handle, 8, 0xFF, 1); ret = sport_set_multichannel(sport_handle, 8, 0xFF, 1);
...@@ -323,18 +288,19 @@ static int __devinit bfin_tdm_probe(struct platform_device *pdev) ...@@ -323,18 +288,19 @@ static int __devinit bfin_tdm_probe(struct platform_device *pdev)
goto sport_config_err; goto sport_config_err;
} }
sport_handle->private_data = &bf5xx_tdm;
return 0; return 0;
sport_config_err: sport_config_err:
peripheral_free_list(&sport_req[sport_num][0]); sport_done(sport_handle);
return ret; return ret;
} }
static int __devexit bfin_tdm_remove(struct platform_device *pdev) static int __devexit bfin_tdm_remove(struct platform_device *pdev)
{ {
peripheral_free_list(&sport_req[sport_num][0]); struct sport_device *sport_handle = platform_get_drvdata(pdev);
snd_soc_unregister_dai(&pdev->dev); snd_soc_unregister_dai(&pdev->dev);
sport_done(sport_handle);
return 0; return 0;
} }
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
*/ */
#define PM860X_DAPM_OUTPUT(wname, wevent) \ #define PM860X_DAPM_OUTPUT(wname, wevent) \
{ .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \ { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \
.shift = 0, .invert = 0, .kcontrols = NULL, \ .shift = 0, .invert = 0, .kcontrol_news = NULL, \
.num_kcontrols = 0, .event = wevent, \ .num_kcontrols = 0, .event = wevent, \
.event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD, } .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD, }
......
...@@ -16,10 +16,11 @@ config SND_SOC_ALL_CODECS ...@@ -16,10 +16,11 @@ config SND_SOC_ALL_CODECS
select SND_SOC_AD1836 if SPI_MASTER select SND_SOC_AD1836 if SPI_MASTER
select SND_SOC_AD193X if SND_SOC_I2C_AND_SPI select SND_SOC_AD193X if SND_SOC_I2C_AND_SPI
select SND_SOC_AD1980 if SND_SOC_AC97_BUS select SND_SOC_AD1980 if SND_SOC_AC97_BUS
select SND_SOC_AD73311
select SND_SOC_ADS117X select SND_SOC_ADS117X
select SND_SOC_AD73311 if I2C
select SND_SOC_AK4104 if SPI_MASTER select SND_SOC_AK4104 if SPI_MASTER
select SND_SOC_AK4535 if I2C select SND_SOC_AK4535 if I2C
select SND_SOC_AK4641 if I2C
select SND_SOC_AK4642 if I2C select SND_SOC_AK4642 if I2C
select SND_SOC_AK4671 if I2C select SND_SOC_AK4671 if I2C
select SND_SOC_ALC5623 if I2C select SND_SOC_ALC5623 if I2C
...@@ -33,13 +34,14 @@ config SND_SOC_ALL_CODECS ...@@ -33,13 +34,14 @@ config SND_SOC_ALL_CODECS
select SND_SOC_JZ4740_CODEC if SOC_JZ4740 select SND_SOC_JZ4740_CODEC if SOC_JZ4740
select SND_SOC_LM4857 if I2C select SND_SOC_LM4857 if I2C
select SND_SOC_MAX98088 if I2C select SND_SOC_MAX98088 if I2C
select SND_SOC_MAX98095 if I2C
select SND_SOC_MAX9850 if I2C select SND_SOC_MAX9850 if I2C
select SND_SOC_MAX9877 if I2C select SND_SOC_MAX9877 if I2C
select SND_SOC_PCM3008 select SND_SOC_PCM3008
select SND_SOC_SGTL5000 if I2C select SND_SOC_SGTL5000 if I2C
select SND_SOC_SN95031 if INTEL_SCU_IPC select SND_SOC_SN95031 if INTEL_SCU_IPC
select SND_SOC_SPDIF select SND_SOC_SPDIF
select SND_SOC_SSM2602 if I2C select SND_SOC_SSM2602 if SND_SOC_I2C_AND_SPI
select SND_SOC_STAC9766 if SND_SOC_AC97_BUS select SND_SOC_STAC9766 if SND_SOC_AC97_BUS
select SND_SOC_TLV320AIC23 if I2C select SND_SOC_TLV320AIC23 if I2C
select SND_SOC_TLV320AIC26 if SPI_MASTER select SND_SOC_TLV320AIC26 if SPI_MASTER
...@@ -52,6 +54,7 @@ config SND_SOC_ALL_CODECS ...@@ -52,6 +54,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_UDA134X select SND_SOC_UDA134X
select SND_SOC_UDA1380 if I2C select SND_SOC_UDA1380 if I2C
select SND_SOC_WL1273 if MFD_WL1273_CORE select SND_SOC_WL1273 if MFD_WL1273_CORE
select SND_SOC_WM1250_EV1 if I2C
select SND_SOC_WM2000 if I2C select SND_SOC_WM2000 if I2C
select SND_SOC_WM8350 if MFD_WM8350 select SND_SOC_WM8350 if MFD_WM8350
select SND_SOC_WM8400 if MFD_WM8400 select SND_SOC_WM8400 if MFD_WM8400
...@@ -72,6 +75,7 @@ config SND_SOC_ALL_CODECS ...@@ -72,6 +75,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_WM8900 if I2C select SND_SOC_WM8900 if I2C
select SND_SOC_WM8903 if I2C select SND_SOC_WM8903 if I2C
select SND_SOC_WM8904 if I2C select SND_SOC_WM8904 if I2C
select SND_SOC_WM8915 if I2C
select SND_SOC_WM8940 if I2C select SND_SOC_WM8940 if I2C
select SND_SOC_WM8955 if I2C select SND_SOC_WM8955 if I2C
select SND_SOC_WM8960 if I2C select SND_SOC_WM8960 if I2C
...@@ -136,6 +140,9 @@ config SND_SOC_AK4104 ...@@ -136,6 +140,9 @@ config SND_SOC_AK4104
config SND_SOC_AK4535 config SND_SOC_AK4535
tristate tristate
config SND_SOC_AK4641
tristate
config SND_SOC_AK4642 config SND_SOC_AK4642
tristate tristate
...@@ -187,6 +194,9 @@ config SND_SOC_DMIC ...@@ -187,6 +194,9 @@ config SND_SOC_DMIC
config SND_SOC_MAX98088 config SND_SOC_MAX98088
tristate tristate
config SND_SOC_MAX98095
tristate
config SND_SOC_MAX9850 config SND_SOC_MAX9850
tristate tristate
...@@ -241,6 +251,9 @@ config SND_SOC_UDA1380 ...@@ -241,6 +251,9 @@ config SND_SOC_UDA1380
config SND_SOC_WL1273 config SND_SOC_WL1273
tristate tristate
config SND_SOC_WM1250_EV1
tristate
config SND_SOC_WM8350 config SND_SOC_WM8350
tristate tristate
...@@ -298,6 +311,9 @@ config SND_SOC_WM8903 ...@@ -298,6 +311,9 @@ config SND_SOC_WM8903
config SND_SOC_WM8904 config SND_SOC_WM8904
tristate tristate
config SND_SOC_WM8915
tristate
config SND_SOC_WM8940 config SND_SOC_WM8940
tristate tristate
......
...@@ -7,6 +7,7 @@ snd-soc-ad73311-objs := ad73311.o ...@@ -7,6 +7,7 @@ snd-soc-ad73311-objs := ad73311.o
snd-soc-ads117x-objs := ads117x.o snd-soc-ads117x-objs := ads117x.o
snd-soc-ak4104-objs := ak4104.o snd-soc-ak4104-objs := ak4104.o
snd-soc-ak4535-objs := ak4535.o snd-soc-ak4535-objs := ak4535.o
snd-soc-ak4641-objs := ak4641.o
snd-soc-ak4642-objs := ak4642.o snd-soc-ak4642-objs := ak4642.o
snd-soc-ak4671-objs := ak4671.o snd-soc-ak4671-objs := ak4671.o
snd-soc-cq93vc-objs := cq93vc.o snd-soc-cq93vc-objs := cq93vc.o
...@@ -19,6 +20,7 @@ snd-soc-dfbmcs320-objs := dfbmcs320.o ...@@ -19,6 +20,7 @@ snd-soc-dfbmcs320-objs := dfbmcs320.o
snd-soc-dmic-objs := dmic.o snd-soc-dmic-objs := dmic.o
snd-soc-l3-objs := l3.o snd-soc-l3-objs := l3.o
snd-soc-max98088-objs := max98088.o snd-soc-max98088-objs := max98088.o
snd-soc-max98095-objs := max98095.o
snd-soc-max9850-objs := max9850.o snd-soc-max9850-objs := max9850.o
snd-soc-pcm3008-objs := pcm3008.o snd-soc-pcm3008-objs := pcm3008.o
snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-sgtl5000-objs := sgtl5000.o
...@@ -37,6 +39,7 @@ snd-soc-twl6040-objs := twl6040.o ...@@ -37,6 +39,7 @@ snd-soc-twl6040-objs := twl6040.o
snd-soc-uda134x-objs := uda134x.o snd-soc-uda134x-objs := uda134x.o
snd-soc-uda1380-objs := uda1380.o snd-soc-uda1380-objs := uda1380.o
snd-soc-wl1273-objs := wl1273.o snd-soc-wl1273-objs := wl1273.o
snd-soc-wm1250-ev1-objs := wm1250-ev1.o
snd-soc-wm8350-objs := wm8350.o snd-soc-wm8350-objs := wm8350.o
snd-soc-wm8400-objs := wm8400.o snd-soc-wm8400-objs := wm8400.o
snd-soc-wm8510-objs := wm8510.o snd-soc-wm8510-objs := wm8510.o
...@@ -56,6 +59,7 @@ snd-soc-wm8804-objs := wm8804.o ...@@ -56,6 +59,7 @@ snd-soc-wm8804-objs := wm8804.o
snd-soc-wm8900-objs := wm8900.o snd-soc-wm8900-objs := wm8900.o
snd-soc-wm8903-objs := wm8903.o snd-soc-wm8903-objs := wm8903.o
snd-soc-wm8904-objs := wm8904.o snd-soc-wm8904-objs := wm8904.o
snd-soc-wm8915-objs := wm8915.o
snd-soc-wm8940-objs := wm8940.o snd-soc-wm8940-objs := wm8940.o
snd-soc-wm8955-objs := wm8955.o snd-soc-wm8955-objs := wm8955.o
snd-soc-wm8960-objs := wm8960.o snd-soc-wm8960-objs := wm8960.o
...@@ -69,7 +73,7 @@ snd-soc-wm8988-objs := wm8988.o ...@@ -69,7 +73,7 @@ snd-soc-wm8988-objs := wm8988.o
snd-soc-wm8990-objs := wm8990.o snd-soc-wm8990-objs := wm8990.o
snd-soc-wm8991-objs := wm8991.o snd-soc-wm8991-objs := wm8991.o
snd-soc-wm8993-objs := wm8993.o snd-soc-wm8993-objs := wm8993.o
snd-soc-wm8994-objs := wm8994.o wm8994-tables.o snd-soc-wm8994-objs := wm8994.o wm8994-tables.o wm8958-dsp2.o
snd-soc-wm8995-objs := wm8995.o snd-soc-wm8995-objs := wm8995.o
snd-soc-wm9081-objs := wm9081.o snd-soc-wm9081-objs := wm9081.o
snd-soc-wm9705-objs := wm9705.o snd-soc-wm9705-objs := wm9705.o
...@@ -94,6 +98,7 @@ obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o ...@@ -94,6 +98,7 @@ obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o
obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o
obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o
obj-$(CONFIG_SND_SOC_AK4641) += snd-soc-ak4641.o
obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o
obj-$(CONFIG_SND_SOC_AK4671) += snd-soc-ak4671.o obj-$(CONFIG_SND_SOC_AK4671) += snd-soc-ak4671.o
obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o
...@@ -108,6 +113,7 @@ obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o ...@@ -108,6 +113,7 @@ obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o
obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o
obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o
obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o
obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o
obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o
...@@ -125,6 +131,7 @@ obj-$(CONFIG_SND_SOC_TWL6040) += snd-soc-twl6040.o ...@@ -125,6 +131,7 @@ obj-$(CONFIG_SND_SOC_TWL6040) += snd-soc-twl6040.o
obj-$(CONFIG_SND_SOC_UDA134X) += snd-soc-uda134x.o obj-$(CONFIG_SND_SOC_UDA134X) += snd-soc-uda134x.o
obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o
obj-$(CONFIG_SND_SOC_WL1273) += snd-soc-wl1273.o obj-$(CONFIG_SND_SOC_WL1273) += snd-soc-wl1273.o
obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o
obj-$(CONFIG_SND_SOC_WM8350) += snd-soc-wm8350.o obj-$(CONFIG_SND_SOC_WM8350) += snd-soc-wm8350.o
obj-$(CONFIG_SND_SOC_WM8400) += snd-soc-wm8400.o obj-$(CONFIG_SND_SOC_WM8400) += snd-soc-wm8400.o
obj-$(CONFIG_SND_SOC_WM8510) += snd-soc-wm8510.o obj-$(CONFIG_SND_SOC_WM8510) += snd-soc-wm8510.o
...@@ -144,6 +151,7 @@ obj-$(CONFIG_SND_SOC_WM8804) += snd-soc-wm8804.o ...@@ -144,6 +151,7 @@ obj-$(CONFIG_SND_SOC_WM8804) += snd-soc-wm8804.o
obj-$(CONFIG_SND_SOC_WM8900) += snd-soc-wm8900.o obj-$(CONFIG_SND_SOC_WM8900) += snd-soc-wm8900.o
obj-$(CONFIG_SND_SOC_WM8903) += snd-soc-wm8903.o obj-$(CONFIG_SND_SOC_WM8903) += snd-soc-wm8903.o
obj-$(CONFIG_SND_SOC_WM8904) += snd-soc-wm8904.o obj-$(CONFIG_SND_SOC_WM8904) += snd-soc-wm8904.o
obj-$(CONFIG_SND_SOC_WM8915) += snd-soc-wm8915.o
obj-$(CONFIG_SND_SOC_WM8940) += snd-soc-wm8940.o obj-$(CONFIG_SND_SOC_WM8940) += snd-soc-wm8940.o
obj-$(CONFIG_SND_SOC_WM8955) += snd-soc-wm8955.o obj-$(CONFIG_SND_SOC_WM8955) += snd-soc-wm8955.o
obj-$(CONFIG_SND_SOC_WM8960) += snd-soc-wm8960.o obj-$(CONFIG_SND_SOC_WM8960) += snd-soc-wm8960.o
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
/* codec private data */ /* codec private data */
struct ad193x_priv { struct ad193x_priv {
enum snd_soc_control_type bus_type; enum snd_soc_control_type control_type;
void *control_data;
int sysclk; int sysclk;
}; };
...@@ -354,14 +353,12 @@ static int ad193x_probe(struct snd_soc_codec *codec) ...@@ -354,14 +353,12 @@ static int ad193x_probe(struct snd_soc_codec *codec)
struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret; int ret;
codec->control_data = ad193x->control_data; if (ad193x->control_type == SND_SOC_I2C)
if (ad193x->bus_type == SND_SOC_I2C) ret = snd_soc_codec_set_cache_io(codec, 8, 8, ad193x->control_type);
ret = snd_soc_codec_set_cache_io(codec, 8, 8, ad193x->bus_type);
else else
ret = snd_soc_codec_set_cache_io(codec, 16, 8, ad193x->bus_type); ret = snd_soc_codec_set_cache_io(codec, 16, 8, ad193x->control_type);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "failed to set cache I/O: %d\n", dev_err(codec->dev, "failed to set cache I/O: %d\n", ret);
ret);
return ret; return ret;
} }
...@@ -408,8 +405,7 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi) ...@@ -408,8 +405,7 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi)
return -ENOMEM; return -ENOMEM;
spi_set_drvdata(spi, ad193x); spi_set_drvdata(spi, ad193x);
ad193x->control_data = spi; ad193x->control_type = SND_SOC_SPI;
ad193x->bus_type = SND_SOC_SPI;
ret = snd_soc_register_codec(&spi->dev, ret = snd_soc_register_codec(&spi->dev,
&soc_codec_dev_ad193x, &ad193x_dai, 1); &soc_codec_dev_ad193x, &ad193x_dai, 1);
...@@ -427,7 +423,7 @@ static int __devexit ad193x_spi_remove(struct spi_device *spi) ...@@ -427,7 +423,7 @@ static int __devexit ad193x_spi_remove(struct spi_device *spi)
static struct spi_driver ad193x_spi_driver = { static struct spi_driver ad193x_spi_driver = {
.driver = { .driver = {
.name = "ad193x-codec", .name = "ad193x",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = ad193x_spi_probe, .probe = ad193x_spi_probe,
...@@ -454,8 +450,7 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client, ...@@ -454,8 +450,7 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client,
return -ENOMEM; return -ENOMEM;
i2c_set_clientdata(client, ad193x); i2c_set_clientdata(client, ad193x);
ad193x->control_data = client; ad193x->control_type = SND_SOC_I2C;
ad193x->bus_type = SND_SOC_I2C;
ret = snd_soc_register_codec(&client->dev, ret = snd_soc_register_codec(&client->dev,
&soc_codec_dev_ad193x, &ad193x_dai, 1); &soc_codec_dev_ad193x, &ad193x_dai, 1);
...@@ -473,7 +468,7 @@ static int __devexit ad193x_i2c_remove(struct i2c_client *client) ...@@ -473,7 +468,7 @@ static int __devexit ad193x_i2c_remove(struct i2c_client *client)
static struct i2c_driver ad193x_i2c_driver = { static struct i2c_driver ad193x_i2c_driver = {
.driver = { .driver = {
.name = "ad193x-codec", .name = "ad193x",
}, },
.probe = ad193x_i2c_probe, .probe = ad193x_i2c_probe,
.remove = __devexit_p(ad193x_i2c_remove), .remove = __devexit_p(ad193x_i2c_remove),
......
...@@ -266,7 +266,7 @@ static int __devexit ad1980_remove(struct platform_device *pdev) ...@@ -266,7 +266,7 @@ static int __devexit ad1980_remove(struct platform_device *pdev)
static struct platform_driver ad1980_codec_driver = { static struct platform_driver ad1980_codec_driver = {
.driver = { .driver = {
.name = "ad1980-codec", .name = "ad1980",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
......
...@@ -55,7 +55,7 @@ static int __devexit ad73311_remove(struct platform_device *pdev) ...@@ -55,7 +55,7 @@ static int __devexit ad73311_remove(struct platform_device *pdev)
static struct platform_driver ad73311_codec_driver = { static struct platform_driver ad73311_codec_driver = {
.driver = { .driver = {
.name = "ad73311-codec", .name = "ad73311",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
......
...@@ -230,7 +230,7 @@ static const struct snd_soc_dapm_widget ak4535_dapm_widgets[] = { ...@@ -230,7 +230,7 @@ static const struct snd_soc_dapm_widget ak4535_dapm_widgets[] = {
SND_SOC_DAPM_INPUT("AIN"), SND_SOC_DAPM_INPUT("AIN"),
}; };
static const struct snd_soc_dapm_route audio_map[] = { static const struct snd_soc_dapm_route ak4535_audio_map[] = {
/*stereo mixer */ /*stereo mixer */
{"Stereo Mixer", "Playback Switch", "DAC"}, {"Stereo Mixer", "Playback Switch", "DAC"},
{"Stereo Mixer", "Mic Sidetone Switch", "Mic"}, {"Stereo Mixer", "Mic Sidetone Switch", "Mic"},
...@@ -287,17 +287,6 @@ static const struct snd_soc_dapm_route audio_map[] = { ...@@ -287,17 +287,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
{"Input Mixer", "Aux Capture Switch", "Aux In"}, {"Input Mixer", "Aux Capture Switch", "Aux In"},
}; };
static int ak4535_add_widgets(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, ak4535_dapm_widgets,
ARRAY_SIZE(ak4535_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0;
}
static int ak4535_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int ak4535_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
...@@ -457,8 +446,6 @@ static int ak4535_probe(struct snd_soc_codec *codec) ...@@ -457,8 +446,6 @@ static int ak4535_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, ak4535_snd_controls, snd_soc_add_controls(codec, ak4535_snd_controls,
ARRAY_SIZE(ak4535_snd_controls)); ARRAY_SIZE(ak4535_snd_controls));
ak4535_add_widgets(codec);
return 0; return 0;
} }
...@@ -480,6 +467,10 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4535 = { ...@@ -480,6 +467,10 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
.reg_cache_size = ARRAY_SIZE(ak4535_reg), .reg_cache_size = ARRAY_SIZE(ak4535_reg),
.reg_word_size = sizeof(u8), .reg_word_size = sizeof(u8),
.reg_cache_default = ak4535_reg, .reg_cache_default = ak4535_reg,
.dapm_widgets = ak4535_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets),
.dapm_routes = ak4535_audio_map,
.num_dapm_routes = ARRAY_SIZE(ak4535_audio_map),
}; };
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
......
This diff is collapsed.
/*
* ak4641.h -- AK4641 SoC Audio driver
*
* Copyright 2008 Harald Welte <laforge@gnufiish.org>
*
* Based on ak4535.h
*
* 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 _AK4641_H
#define _AK4641_H
/* AK4641 register space */
#define AK4641_PM1 0x00
#define AK4641_PM2 0x01
#define AK4641_SIG1 0x02
#define AK4641_SIG2 0x03
#define AK4641_MODE1 0x04
#define AK4641_MODE2 0x05
#define AK4641_DAC 0x06
#define AK4641_MIC 0x07
#define AK4641_TIMER 0x08
#define AK4641_ALC1 0x09
#define AK4641_ALC2 0x0a
#define AK4641_PGA 0x0b
#define AK4641_LATT 0x0c
#define AK4641_RATT 0x0d
#define AK4641_VOL 0x0e
#define AK4641_STATUS 0x0f
#define AK4641_EQLO 0x10
#define AK4641_EQMID 0x11
#define AK4641_EQHI 0x12
#define AK4641_BTIF 0x13
#define AK4641_CACHEREGNUM 0x14
#define AK4641_DAI_HIFI 0
#define AK4641_DAI_VOICE 1
#endif
...@@ -352,7 +352,7 @@ static const struct snd_soc_dapm_widget ak4671_dapm_widgets[] = { ...@@ -352,7 +352,7 @@ static const struct snd_soc_dapm_widget ak4671_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("PMPLL", AK4671_PLL_MODE_SELECT1, 0, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("PMPLL", AK4671_PLL_MODE_SELECT1, 0, 0, NULL, 0),
}; };
static const struct snd_soc_dapm_route intercon[] = { static const struct snd_soc_dapm_route ak4671_intercon[] = {
{"DAC Left", "NULL", "PMPLL"}, {"DAC Left", "NULL", "PMPLL"},
{"DAC Right", "NULL", "PMPLL"}, {"DAC Right", "NULL", "PMPLL"},
{"ADC Left", "NULL", "PMPLL"}, {"ADC Left", "NULL", "PMPLL"},
...@@ -433,17 +433,6 @@ static const struct snd_soc_dapm_route intercon[] = { ...@@ -433,17 +433,6 @@ static const struct snd_soc_dapm_route intercon[] = {
{"ROUT3 Mixer", "RINS4", "RIN4 Mixing Circuit"}, {"ROUT3 Mixer", "RINS4", "RIN4 Mixing Circuit"},
}; };
static int ak4671_add_widgets(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, ak4671_dapm_widgets,
ARRAY_SIZE(ak4671_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0;
}
static int ak4671_hw_params(struct snd_pcm_substream *substream, static int ak4671_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 snd_soc_dai *dai)
...@@ -650,7 +639,6 @@ static int ak4671_probe(struct snd_soc_codec *codec) ...@@ -650,7 +639,6 @@ static int ak4671_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, ak4671_snd_controls, snd_soc_add_controls(codec, ak4671_snd_controls,
ARRAY_SIZE(ak4671_snd_controls)); ARRAY_SIZE(ak4671_snd_controls));
ak4671_add_widgets(codec);
ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY); ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
...@@ -670,6 +658,10 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4671 = { ...@@ -670,6 +658,10 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4671 = {
.reg_cache_size = AK4671_CACHEREGNUM, .reg_cache_size = AK4671_CACHEREGNUM,
.reg_word_size = sizeof(u8), .reg_word_size = sizeof(u8),
.reg_cache_default = ak4671_reg, .reg_cache_default = ak4671_reg,
.dapm_widgets = ak4671_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ak4671_dapm_widgets),
.dapm_routes = ak4671_intercon,
.num_dapm_routes = ARRAY_SIZE(ak4671_intercon),
}; };
static int __devinit ak4671_i2c_probe(struct i2c_client *client, static int __devinit ak4671_i2c_probe(struct i2c_client *client,
......
...@@ -86,18 +86,6 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = { ...@@ -86,18 +86,6 @@ static const struct snd_soc_dapm_route cx20442_audio_map[] = {
{"ADC", NULL, "Input Mixer"}, {"ADC", NULL, "Input Mixer"},
}; };
static int cx20442_add_widgets(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, cx20442_dapm_widgets,
ARRAY_SIZE(cx20442_dapm_widgets));
snd_soc_dapm_add_routes(dapm, cx20442_audio_map,
ARRAY_SIZE(cx20442_audio_map));
return 0;
}
static unsigned int cx20442_read_reg_cache(struct snd_soc_codec *codec, static unsigned int cx20442_read_reg_cache(struct snd_soc_codec *codec,
unsigned int reg) unsigned int reg)
{ {
...@@ -344,8 +332,6 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec) ...@@ -344,8 +332,6 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
return -ENOMEM; return -ENOMEM;
snd_soc_codec_set_drvdata(codec, cx20442); snd_soc_codec_set_drvdata(codec, cx20442);
cx20442_add_widgets(codec);
cx20442->control_data = NULL; cx20442->control_data = NULL;
codec->hw_write = NULL; codec->hw_write = NULL;
codec->card->pop_time = 0; codec->card->pop_time = 0;
...@@ -377,6 +363,10 @@ static struct snd_soc_codec_driver cx20442_codec_dev = { ...@@ -377,6 +363,10 @@ static struct snd_soc_codec_driver cx20442_codec_dev = {
.reg_word_size = sizeof(u8), .reg_word_size = sizeof(u8),
.read = cx20442_read_reg_cache, .read = cx20442_read_reg_cache,
.write = cx20442_write, .write = cx20442_write,
.dapm_widgets = cx20442_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(cx20442_dapm_widgets),
.dapm_routes = cx20442_audio_map,
.num_dapm_routes = ARRAY_SIZE(cx20442_audio_map),
}; };
static int cx20442_platform_probe(struct platform_device *pdev) static int cx20442_platform_probe(struct platform_device *pdev)
......
...@@ -39,7 +39,31 @@ static struct snd_soc_dai_driver dmic_dai = { ...@@ -39,7 +39,31 @@ static struct snd_soc_dai_driver dmic_dai = {
}, },
}; };
static struct snd_soc_codec_driver soc_dmic = {}; static const struct snd_soc_dapm_widget dmic_dapm_widgets[] = {
SND_SOC_DAPM_AIF_OUT("DMIC AIF", "Capture", 0,
SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_INPUT("DMic"),
};
static const struct snd_soc_dapm_route intercon[] = {
{"DMIC AIF", NULL, "DMic"},
};
static int dmic_probe(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, dmic_dapm_widgets,
ARRAY_SIZE(dmic_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
snd_soc_dapm_new_widgets(dapm);
return 0;
}
static struct snd_soc_codec_driver soc_dmic = {
.probe = dmic_probe,
};
static int __devinit dmic_dev_probe(struct platform_device *pdev) static int __devinit dmic_dev_probe(struct platform_device *pdev)
{ {
......
...@@ -294,20 +294,9 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, ...@@ -294,20 +294,9 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) static int jz4740_codec_dev_probe(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, snd_soc_update_bits(codec, JZ4740_REG_CODEC_1,
JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE);
snd_soc_add_controls(codec, jz4740_codec_controls,
ARRAY_SIZE(jz4740_codec_controls));
snd_soc_dapm_new_controls(dapm, jz4740_codec_dapm_widgets,
ARRAY_SIZE(jz4740_codec_dapm_widgets));
snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes,
ARRAY_SIZE(jz4740_codec_dapm_routes));
jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY); jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0; return 0;
...@@ -348,6 +337,13 @@ static struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = { ...@@ -348,6 +337,13 @@ static struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = {
.reg_cache_default = jz4740_codec_regs, .reg_cache_default = jz4740_codec_regs,
.reg_word_size = sizeof(u32), .reg_word_size = sizeof(u32),
.reg_cache_size = 2, .reg_cache_size = 2,
.controls = jz4740_codec_controls,
.num_controls = ARRAY_SIZE(jz4740_codec_controls),
.dapm_widgets = jz4740_codec_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(jz4740_codec_dapm_widgets),
.dapm_routes = jz4740_codec_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes),
}; };
static int __devinit jz4740_codec_probe(struct platform_device *pdev) static int __devinit jz4740_codec_probe(struct platform_device *pdev)
......
...@@ -656,8 +656,6 @@ static const struct soc_enum max98088_exmode_enum = ...@@ -656,8 +656,6 @@ static const struct soc_enum max98088_exmode_enum =
ARRAY_SIZE(max98088_exmode_texts), ARRAY_SIZE(max98088_exmode_texts),
max98088_exmode_texts, max98088_exmode_texts,
max98088_exmode_values); max98088_exmode_values);
static const struct snd_kcontrol_new max98088_exmode_controls =
SOC_DAPM_VALUE_ENUM("Route", max98088_exmode_enum);
static const char *max98088_ex_thresh[] = { /* volts PP */ static const char *max98088_ex_thresh[] = { /* volts PP */
"0.6", "1.2", "1.8", "2.4", "3.0", "3.6", "4.2", "4.8"}; "0.6", "1.2", "1.8", "2.4", "3.0", "3.6", "4.2", "4.8"};
...@@ -783,6 +781,7 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = { ...@@ -783,6 +781,7 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = {
SOC_SINGLE("EQ1 Switch", M98088_REG_49_CFG_LEVEL, 0, 1, 0), SOC_SINGLE("EQ1 Switch", M98088_REG_49_CFG_LEVEL, 0, 1, 0),
SOC_SINGLE("EQ2 Switch", M98088_REG_49_CFG_LEVEL, 1, 1, 0), SOC_SINGLE("EQ2 Switch", M98088_REG_49_CFG_LEVEL, 1, 1, 0),
SOC_ENUM("EX Limiter Mode", max98088_exmode_enum),
SOC_ENUM("EX Limiter Threshold", max98088_ex_thresh_enum), SOC_ENUM("EX Limiter Threshold", max98088_ex_thresh_enum),
SOC_ENUM("DAI1 Filter Mode", max98088_filter_mode_enum), SOC_ENUM("DAI1 Filter Mode", max98088_filter_mode_enum),
...@@ -808,10 +807,10 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = { ...@@ -808,10 +807,10 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = {
/* Left speaker mixer switch */ /* Left speaker mixer switch */
static const struct snd_kcontrol_new max98088_left_speaker_mixer_controls[] = { static const struct snd_kcontrol_new max98088_left_speaker_mixer_controls[] = {
SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 7, 1, 0), SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 0, 1, 0),
SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 0, 1, 0), SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 7, 1, 0),
SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 7, 1, 0), SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 0, 1, 0),
SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 0, 1, 0), SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 7, 1, 0),
SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 5, 1, 0), SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 5, 1, 0),
SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 6, 1, 0), SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 6, 1, 0),
SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 1, 1, 0), SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 1, 1, 0),
...@@ -836,10 +835,10 @@ static const struct snd_kcontrol_new max98088_right_speaker_mixer_controls[] = { ...@@ -836,10 +835,10 @@ static const struct snd_kcontrol_new max98088_right_speaker_mixer_controls[] = {
/* Left headphone mixer switch */ /* Left headphone mixer switch */
static const struct snd_kcontrol_new max98088_left_hp_mixer_controls[] = { static const struct snd_kcontrol_new max98088_left_hp_mixer_controls[] = {
SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_25_MIX_HP_LEFT, 7, 1, 0), SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_25_MIX_HP_LEFT, 0, 1, 0),
SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_25_MIX_HP_LEFT, 0, 1, 0), SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_25_MIX_HP_LEFT, 7, 1, 0),
SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_25_MIX_HP_LEFT, 7, 1, 0), SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_25_MIX_HP_LEFT, 0, 1, 0),
SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_25_MIX_HP_LEFT, 0, 1, 0), SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_25_MIX_HP_LEFT, 7, 1, 0),
SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_25_MIX_HP_LEFT, 5, 1, 0), SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_25_MIX_HP_LEFT, 5, 1, 0),
SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_25_MIX_HP_LEFT, 6, 1, 0), SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_25_MIX_HP_LEFT, 6, 1, 0),
SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_25_MIX_HP_LEFT, 1, 1, 0), SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_25_MIX_HP_LEFT, 1, 1, 0),
...@@ -864,10 +863,10 @@ static const struct snd_kcontrol_new max98088_right_hp_mixer_controls[] = { ...@@ -864,10 +863,10 @@ static const struct snd_kcontrol_new max98088_right_hp_mixer_controls[] = {
/* Left earpiece/receiver mixer switch */ /* Left earpiece/receiver mixer switch */
static const struct snd_kcontrol_new max98088_left_rec_mixer_controls[] = { static const struct snd_kcontrol_new max98088_left_rec_mixer_controls[] = {
SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_28_MIX_REC_LEFT, 7, 1, 0), SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_28_MIX_REC_LEFT, 0, 1, 0),
SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_28_MIX_REC_LEFT, 0, 1, 0), SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_28_MIX_REC_LEFT, 7, 1, 0),
SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_28_MIX_REC_LEFT, 7, 1, 0), SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_28_MIX_REC_LEFT, 0, 1, 0),
SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_28_MIX_REC_LEFT, 0, 1, 0), SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_28_MIX_REC_LEFT, 7, 1, 0),
SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_28_MIX_REC_LEFT, 5, 1, 0), SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_28_MIX_REC_LEFT, 5, 1, 0),
SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_28_MIX_REC_LEFT, 6, 1, 0), SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_28_MIX_REC_LEFT, 6, 1, 0),
SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_28_MIX_REC_LEFT, 1, 1, 0), SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_28_MIX_REC_LEFT, 1, 1, 0),
...@@ -1094,9 +1093,6 @@ static const struct snd_soc_dapm_widget max98088_dapm_widgets[] = { ...@@ -1094,9 +1093,6 @@ static const struct snd_soc_dapm_widget max98088_dapm_widgets[] = {
SND_SOC_DAPM_MICBIAS("MICBIAS", M98088_REG_4C_PWR_EN_IN, 3, 0), SND_SOC_DAPM_MICBIAS("MICBIAS", M98088_REG_4C_PWR_EN_IN, 3, 0),
SND_SOC_DAPM_MUX("EX Limiter Mode", SND_SOC_NOPM, 0, 0,
&max98088_exmode_controls),
SND_SOC_DAPM_OUTPUT("HPL"), SND_SOC_DAPM_OUTPUT("HPL"),
SND_SOC_DAPM_OUTPUT("HPR"), SND_SOC_DAPM_OUTPUT("HPR"),
SND_SOC_DAPM_OUTPUT("SPKL"), SND_SOC_DAPM_OUTPUT("SPKL"),
...@@ -1112,7 +1108,7 @@ static const struct snd_soc_dapm_widget max98088_dapm_widgets[] = { ...@@ -1112,7 +1108,7 @@ static const struct snd_soc_dapm_widget max98088_dapm_widgets[] = {
SND_SOC_DAPM_INPUT("INB2"), SND_SOC_DAPM_INPUT("INB2"),
}; };
static const struct snd_soc_dapm_route audio_map[] = { static const struct snd_soc_dapm_route max98088_audio_map[] = {
/* Left headphone output mixer */ /* Left headphone output mixer */
{"Left HP Mixer", "Left DAC1 Switch", "DACL1"}, {"Left HP Mixer", "Left DAC1 Switch", "DACL1"},
{"Left HP Mixer", "Left DAC2 Switch", "DACL2"}, {"Left HP Mixer", "Left DAC2 Switch", "DACL2"},
...@@ -1226,22 +1222,6 @@ static const struct snd_soc_dapm_route audio_map[] = { ...@@ -1226,22 +1222,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
{"MIC2 Input", NULL, "MIC2"}, {"MIC2 Input", NULL, "MIC2"},
}; };
static int max98088_add_widgets(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, max98088_dapm_widgets,
ARRAY_SIZE(max98088_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
snd_soc_add_controls(codec, max98088_snd_controls,
ARRAY_SIZE(max98088_snd_controls));
snd_soc_dapm_new_widgets(dapm);
return 0;
}
/* codec mclk clock divider coefficients */ /* codec mclk clock divider coefficients */
static const struct { static const struct {
u32 rate; u32 rate;
...@@ -1586,6 +1566,36 @@ static int max98088_dai2_set_fmt(struct snd_soc_dai *codec_dai, ...@@ -1586,6 +1566,36 @@ static int max98088_dai2_set_fmt(struct snd_soc_dai *codec_dai,
return 0; return 0;
} }
static int max98088_dai1_digital_mute(struct snd_soc_dai *codec_dai, int mute)
{
struct snd_soc_codec *codec = codec_dai->codec;
int reg;
if (mute)
reg = M98088_DAI_MUTE;
else
reg = 0;
snd_soc_update_bits(codec, M98088_REG_2F_LVL_DAI1_PLAY,
M98088_DAI_MUTE_MASK, reg);
return 0;
}
static int max98088_dai2_digital_mute(struct snd_soc_dai *codec_dai, int mute)
{
struct snd_soc_codec *codec = codec_dai->codec;
int reg;
if (mute)
reg = M98088_DAI_MUTE;
else
reg = 0;
snd_soc_update_bits(codec, M98088_REG_31_LVL_DAI2_PLAY,
M98088_DAI_MUTE_MASK, reg);
return 0;
}
static void max98088_sync_cache(struct snd_soc_codec *codec) static void max98088_sync_cache(struct snd_soc_codec *codec)
{ {
u16 *reg_cache = codec->reg_cache; u16 *reg_cache = codec->reg_cache;
...@@ -1647,12 +1657,14 @@ static struct snd_soc_dai_ops max98088_dai1_ops = { ...@@ -1647,12 +1657,14 @@ static struct snd_soc_dai_ops max98088_dai1_ops = {
.set_sysclk = max98088_dai_set_sysclk, .set_sysclk = max98088_dai_set_sysclk,
.set_fmt = max98088_dai1_set_fmt, .set_fmt = max98088_dai1_set_fmt,
.hw_params = max98088_dai1_hw_params, .hw_params = max98088_dai1_hw_params,
.digital_mute = max98088_dai1_digital_mute,
}; };
static struct snd_soc_dai_ops max98088_dai2_ops = { static struct snd_soc_dai_ops max98088_dai2_ops = {
.set_sysclk = max98088_dai_set_sysclk, .set_sysclk = max98088_dai_set_sysclk,
.set_fmt = max98088_dai2_set_fmt, .set_fmt = max98088_dai2_set_fmt,
.hw_params = max98088_dai2_hw_params, .hw_params = max98088_dai2_hw_params,
.digital_mute = max98088_dai2_digital_mute,
}; };
static struct snd_soc_dai_driver max98088_dai[] = { static struct snd_soc_dai_driver max98088_dai[] = {
...@@ -2010,7 +2022,8 @@ static int max98088_probe(struct snd_soc_codec *codec) ...@@ -2010,7 +2022,8 @@ static int max98088_probe(struct snd_soc_codec *codec)
max98088_handle_pdata(codec); max98088_handle_pdata(codec);
max98088_add_widgets(codec); snd_soc_add_controls(codec, max98088_snd_controls,
ARRAY_SIZE(max98088_snd_controls));
err_access: err_access:
return ret; return ret;
...@@ -2036,6 +2049,10 @@ static struct snd_soc_codec_driver soc_codec_dev_max98088 = { ...@@ -2036,6 +2049,10 @@ static struct snd_soc_codec_driver soc_codec_dev_max98088 = {
.reg_word_size = sizeof(u8), .reg_word_size = sizeof(u8),
.reg_cache_default = max98088_reg, .reg_cache_default = max98088_reg,
.volatile_register = max98088_volatile_register, .volatile_register = max98088_volatile_register,
.dapm_widgets = max98088_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(max98088_dapm_widgets),
.dapm_routes = max98088_audio_map,
.num_dapm_routes = ARRAY_SIZE(max98088_audio_map),
}; };
static int max98088_i2c_probe(struct i2c_client *i2c, static int max98088_i2c_probe(struct i2c_client *i2c,
......
...@@ -133,6 +133,19 @@ ...@@ -133,6 +133,19 @@
#define M98088_REC_LINEMODE (1<<7) #define M98088_REC_LINEMODE (1<<7)
#define M98088_REC_LINEMODE_MASK (1<<7) #define M98088_REC_LINEMODE_MASK (1<<7)
/* M98088_REG_2D_MIX_SPK_CNTL */
#define M98088_MIX_SPKR_GAIN_MASK (3<<2)
#define M98088_MIX_SPKR_GAIN_SHIFT 2
#define M98088_MIX_SPKL_GAIN_MASK (3<<0)
#define M98088_MIX_SPKL_GAIN_SHIFT 0
/* M98088_REG_2F_LVL_DAI1_PLAY, M98088_REG_31_LVL_DAI2_PLAY */
#define M98088_DAI_MUTE (1<<7)
#define M98088_DAI_MUTE_MASK (1<<7)
#define M98088_DAI_VOICE_GAIN_MASK (3<<4)
#define M98088_DAI_ATTENUATION_MASK (0xF<<0)
#define M98088_DAI_ATTENUATION_SHIFT 0
/* M98088_REG_35_LVL_MIC1, M98088_REG_36_LVL_MIC2 */ /* M98088_REG_35_LVL_MIC1, M98088_REG_36_LVL_MIC2 */
#define M98088_MICPRE_MASK (3<<5) #define M98088_MICPRE_MASK (3<<5)
#define M98088_MICPRE_SHIFT 5 #define M98088_MICPRE_SHIFT 5
......
This diff is collapsed.
This diff is collapsed.
...@@ -827,8 +827,6 @@ EXPORT_SYMBOL_GPL(sn95031_jack_detection); ...@@ -827,8 +827,6 @@ EXPORT_SYMBOL_GPL(sn95031_jack_detection);
/* codec registration */ /* codec registration */
static int sn95031_codec_probe(struct snd_soc_codec *codec) static int sn95031_codec_probe(struct snd_soc_codec *codec)
{ {
int ret;
pr_debug("codec_probe called\n"); pr_debug("codec_probe called\n");
codec->dapm.bias_level = SND_SOC_BIAS_OFF; codec->dapm.bias_level = SND_SOC_BIAS_OFF;
...@@ -879,16 +877,7 @@ static int sn95031_codec_probe(struct snd_soc_codec *codec) ...@@ -879,16 +877,7 @@ static int sn95031_codec_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, sn95031_snd_controls, snd_soc_add_controls(codec, sn95031_snd_controls,
ARRAY_SIZE(sn95031_snd_controls)); ARRAY_SIZE(sn95031_snd_controls));
ret = snd_soc_dapm_new_controls(&codec->dapm, sn95031_dapm_widgets, return 0;
ARRAY_SIZE(sn95031_dapm_widgets));
if (ret)
pr_err("soc_dapm_new_control failed %d", ret);
ret = snd_soc_dapm_add_routes(&codec->dapm, sn95031_audio_map,
ARRAY_SIZE(sn95031_audio_map));
if (ret)
pr_err("soc_dapm_add_routes failed %d", ret);
return ret;
} }
static int sn95031_codec_remove(struct snd_soc_codec *codec) static int sn95031_codec_remove(struct snd_soc_codec *codec)
...@@ -905,6 +894,10 @@ struct snd_soc_codec_driver sn95031_codec = { ...@@ -905,6 +894,10 @@ struct snd_soc_codec_driver sn95031_codec = {
.read = sn95031_read, .read = sn95031_read,
.write = sn95031_write, .write = sn95031_write,
.set_bias_level = sn95031_set_vaud_bias, .set_bias_level = sn95031_set_vaud_bias,
.dapm_widgets = sn95031_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(sn95031_dapm_widgets),
.dapm_routes = sn95031_audio_map,
.num_dapm_routes = ARRAY_SIZE(sn95031_audio_map),
}; };
static int __devinit sn95031_device_probe(struct platform_device *pdev) static int __devinit sn95031_device_probe(struct platform_device *pdev)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/initval.h> #include <sound/initval.h>
MODULE_LICENSE("GPL"); #define DRV_NAME "spdif-dit"
#define STUB_RATES SNDRV_PCM_RATE_8000_96000 #define STUB_RATES SNDRV_PCM_RATE_8000_96000
#define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE #define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE
...@@ -56,7 +56,7 @@ static struct platform_driver spdif_dit_driver = { ...@@ -56,7 +56,7 @@ static struct platform_driver spdif_dit_driver = {
.probe = spdif_dit_probe, .probe = spdif_dit_probe,
.remove = spdif_dit_remove, .remove = spdif_dit_remove,
.driver = { .driver = {
.name = "spdif-dit", .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
}; };
...@@ -74,3 +74,7 @@ static void __exit dit_exit(void) ...@@ -74,3 +74,7 @@ static void __exit dit_exit(void)
module_init(dit_modinit); module_init(dit_modinit);
module_exit(dit_exit); module_exit(dit_exit);
MODULE_AUTHOR("Steve Chen <schen@mvista.com>");
MODULE_DESCRIPTION("SPDIF dummy codec driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRV_NAME);
This diff is collapsed.
...@@ -117,11 +117,5 @@ ...@@ -117,11 +117,5 @@
#define SSM2602_CACHEREGNUM 10 #define SSM2602_CACHEREGNUM 10
#define SSM2602_SYSCLK 0 #define SSM2602_SYSCLK 0
#define SSM2602_DAI 0
struct ssm2602_setup_data {
int i2c_bus;
unsigned short i2c_address;
};
#endif #endif
...@@ -212,7 +212,7 @@ static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = { ...@@ -212,7 +212,7 @@ static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = {
SND_SOC_DAPM_INPUT("MICIN"), SND_SOC_DAPM_INPUT("MICIN"),
}; };
static const struct snd_soc_dapm_route intercon[] = { static const struct snd_soc_dapm_route tlv320aic23_intercon[] = {
/* Output Mixer */ /* Output Mixer */
{"Output Mixer", "Line Bypass Switch", "Line Input"}, {"Output Mixer", "Line Bypass Switch", "Line Input"},
{"Output Mixer", "Playback Switch", "DAC"}, {"Output Mixer", "Playback Switch", "DAC"},
...@@ -388,18 +388,6 @@ static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk, ...@@ -388,18 +388,6 @@ static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk,
return 0; return 0;
} }
static int tlv320aic23_add_widgets(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
ARRAY_SIZE(tlv320aic23_dapm_widgets));
/* set up audio path interconnects */
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0;
}
static int tlv320aic23_hw_params(struct snd_pcm_substream *substream, static int tlv320aic23_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 snd_soc_dai *dai)
...@@ -676,7 +664,6 @@ static int tlv320aic23_probe(struct snd_soc_codec *codec) ...@@ -676,7 +664,6 @@ static int tlv320aic23_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, tlv320aic23_snd_controls, snd_soc_add_controls(codec, tlv320aic23_snd_controls,
ARRAY_SIZE(tlv320aic23_snd_controls)); ARRAY_SIZE(tlv320aic23_snd_controls));
tlv320aic23_add_widgets(codec);
return 0; return 0;
} }
...@@ -698,6 +685,10 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320aic23 = { ...@@ -698,6 +685,10 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320aic23 = {
.read = tlv320aic23_read_reg_cache, .read = tlv320aic23_read_reg_cache,
.write = tlv320aic23_write, .write = tlv320aic23_write,
.set_bias_level = tlv320aic23_set_bias_level, .set_bias_level = tlv320aic23_set_bias_level,
.dapm_widgets = tlv320aic23_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(tlv320aic23_dapm_widgets),
.dapm_routes = tlv320aic23_intercon,
.num_dapm_routes = ARRAY_SIZE(tlv320aic23_intercon),
}; };
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
......
...@@ -157,7 +157,8 @@ static int aic3x_read(struct snd_soc_codec *codec, unsigned int reg, ...@@ -157,7 +157,8 @@ static int aic3x_read(struct snd_soc_codec *codec, unsigned int reg,
static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
struct soc_mixer_control *mc = struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value; (struct soc_mixer_control *)kcontrol->private_value;
unsigned int reg = mc->reg; unsigned int reg = mc->reg;
......
/* /*
* ALSA SoC Texas Instruments TLV320DAC33 codec driver * ALSA SoC Texas Instruments TLV320DAC33 codec driver
* *
* Author: Peter Ujfalusi <peter.ujfalusi@nokia.com> * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
* *
* Copyright: (C) 2009 Nokia Corporation * Copyright: (C) 2009 Nokia Corporation
* *
...@@ -587,6 +587,9 @@ static const struct snd_soc_dapm_widget dac33_dapm_widgets[] = { ...@@ -587,6 +587,9 @@ static const struct snd_soc_dapm_widget dac33_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("Right DAC Power", SND_SOC_DAPM_SUPPLY("Right DAC Power",
DAC33_RDAC_PWR_CTRL, 2, 0, NULL, 0), DAC33_RDAC_PWR_CTRL, 2, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("Codec Power",
DAC33_PWR_CTRL, 4, 0, NULL, 0),
SND_SOC_DAPM_PRE("Pre Playback", dac33_playback_event), SND_SOC_DAPM_PRE("Pre Playback", dac33_playback_event),
SND_SOC_DAPM_POST("Post Playback", dac33_playback_event), SND_SOC_DAPM_POST("Post Playback", dac33_playback_event),
}; };
...@@ -619,6 +622,9 @@ static const struct snd_soc_dapm_route audio_map[] = { ...@@ -619,6 +622,9 @@ static const struct snd_soc_dapm_route audio_map[] = {
/* output */ /* output */
{"LEFT_LO", NULL, "Output Left Amplifier"}, {"LEFT_LO", NULL, "Output Left Amplifier"},
{"RIGHT_LO", NULL, "Output Right Amplifier"}, {"RIGHT_LO", NULL, "Output Right Amplifier"},
{"LEFT_LO", NULL, "Codec Power"},
{"RIGHT_LO", NULL, "Codec Power"},
}; };
static int dac33_add_widgets(struct snd_soc_codec *codec) static int dac33_add_widgets(struct snd_soc_codec *codec)
...@@ -636,13 +642,10 @@ static int dac33_add_widgets(struct snd_soc_codec *codec) ...@@ -636,13 +642,10 @@ static int dac33_add_widgets(struct snd_soc_codec *codec)
static int dac33_set_bias_level(struct snd_soc_codec *codec, static int dac33_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
int ret; int ret;
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
if (!dac33->substream)
dac33_soft_power(codec, 1);
break; break;
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
break; break;
...@@ -943,8 +946,8 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) ...@@ -943,8 +946,8 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream)
/* Write registers 0x08 and 0x09 (MSB, LSB) */ /* Write registers 0x08 and 0x09 (MSB, LSB) */
dac33_write16(codec, DAC33_INT_OSC_FREQ_RAT_A, oscset); dac33_write16(codec, DAC33_INT_OSC_FREQ_RAT_A, oscset);
/* calib time: 128 is a nice number ;) */ /* OSC calibration time */
dac33_write(codec, DAC33_CALIB_TIME, 128); dac33_write(codec, DAC33_CALIB_TIME, 96);
/* adjustment treshold & step */ /* adjustment treshold & step */
dac33_write(codec, DAC33_INT_OSC_CTRL_B, DAC33_ADJTHRSHLD(2) | dac33_write(codec, DAC33_INT_OSC_CTRL_B, DAC33_ADJTHRSHLD(2) |
...@@ -1655,5 +1658,5 @@ module_exit(dac33_module_exit); ...@@ -1655,5 +1658,5 @@ module_exit(dac33_module_exit);
MODULE_DESCRIPTION("ASoC TLV320DAC33 codec driver"); MODULE_DESCRIPTION("ASoC TLV320DAC33 codec driver");
MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@nokia.com>"); MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* /*
* ALSA SoC Texas Instruments TLV320DAC33 codec driver * ALSA SoC Texas Instruments TLV320DAC33 codec driver
* *
* Author: Peter Ujfalusi <peter.ujfalusi@nokia.com> * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
* *
* Copyright: (C) 2009 Nokia Corporation * Copyright: (C) 2009 Nokia Corporation
* *
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) Nokia Corporation * Copyright (C) Nokia Corporation
* *
* Author: Peter Ujfalusi <peter.ujfalusi@nokia.com> * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -495,7 +495,7 @@ static void __exit tpa6130a2_exit(void) ...@@ -495,7 +495,7 @@ static void __exit tpa6130a2_exit(void)
i2c_del_driver(&tpa6130a2_i2c_driver); i2c_del_driver(&tpa6130a2_i2c_driver);
} }
MODULE_AUTHOR("Peter Ujfalusi"); MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
MODULE_DESCRIPTION("TPA6130A2 Headphone amplifier driver"); MODULE_DESCRIPTION("TPA6130A2 Headphone amplifier driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) Nokia Corporation * Copyright (C) Nokia Corporation
* *
* Author: Peter Ujfalusi <peter.ujfalusi@nokia.com> * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
......
...@@ -960,9 +960,9 @@ static DECLARE_TLV_DB_SCALE(mic_amp_tlv, -600, 600, 0); ...@@ -960,9 +960,9 @@ static DECLARE_TLV_DB_SCALE(mic_amp_tlv, -600, 600, 0);
/* /*
* AFMGAIN volume control: * AFMGAIN volume control:
* from 18 to 24 dB in 6 dB steps * from -18 to 24 dB in 6 dB steps
*/ */
static DECLARE_TLV_DB_SCALE(afm_amp_tlv, 1800, 600, 0); static DECLARE_TLV_DB_SCALE(afm_amp_tlv, -1800, 600, 0);
/* /*
* HSGAIN volume control: * HSGAIN volume control:
...@@ -1049,7 +1049,7 @@ static const struct snd_kcontrol_new twl6040_snd_controls[] = { ...@@ -1049,7 +1049,7 @@ static const struct snd_kcontrol_new twl6040_snd_controls[] = {
/* AFM gains */ /* AFM gains */
SOC_DOUBLE_TLV("Aux FM Volume", SOC_DOUBLE_TLV("Aux FM Volume",
TWL6040_REG_LINEGAIN, 0, 4, 0xF, 0, afm_amp_tlv), TWL6040_REG_LINEGAIN, 0, 3, 7, 0, afm_amp_tlv),
/* Playback gains */ /* Playback gains */
SOC_TWL6040_DOUBLE_TLV("Headset Playback Volume", SOC_TWL6040_DOUBLE_TLV("Headset Playback Volume",
......
...@@ -601,9 +601,7 @@ static struct snd_soc_codec_driver soc_codec_dev_uda134x = { ...@@ -601,9 +601,7 @@ static struct snd_soc_codec_driver soc_codec_dev_uda134x = {
.reg_cache_step = 1, .reg_cache_step = 1,
.read = uda134x_read_reg_cache, .read = uda134x_read_reg_cache,
.write = uda134x_write, .write = uda134x_write,
#ifdef POWER_OFF_ON_STANDBY
.set_bias_level = uda134x_set_bias_level, .set_bias_level = uda134x_set_bias_level,
#endif
}; };
static int __devinit uda134x_codec_probe(struct platform_device *pdev) static int __devinit uda134x_codec_probe(struct platform_device *pdev)
......
/*
* Driver for the 1250-EV1 audio I/O module
*
* Copyright 2011 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.
*
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
static const struct snd_soc_dapm_widget wm1250_ev1_dapm_widgets[] = {
SND_SOC_DAPM_ADC("ADC", "wm1250-ev1 Capture", SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_DAC("DAC", "wm1250-ev1 Playback", SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_INPUT("WM1250 Input"),
SND_SOC_DAPM_INPUT("WM1250 Output"),
};
static const struct snd_soc_dapm_route wm1250_ev1_dapm_routes[] = {
{ "ADC", NULL, "WM1250 Input" },
{ "WM1250 Output", NULL, "DAC" },
};
static struct snd_soc_dai_driver wm1250_ev1_dai = {
.name = "wm1250-ev1",
.playback = {
.stream_name = "Playback",
.channels_min = 1,
.channels_max = 1,
.rates = SNDRV_PCM_RATE_8000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
},
.capture = {
.stream_name = "Capture",
.channels_min = 1,
.channels_max = 1,
.rates = SNDRV_PCM_RATE_8000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
},
};
static struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = {
.dapm_widgets = wm1250_ev1_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm1250_ev1_dapm_widgets),
.dapm_routes = wm1250_ev1_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm1250_ev1_dapm_routes),
};
static int __devinit wm1250_ev1_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm1250_ev1,
&wm1250_ev1_dai, 1);
}
static int __devexit wm1250_ev1_remove(struct i2c_client *i2c)
{
snd_soc_unregister_codec(&i2c->dev);
return 0;
}
static const struct i2c_device_id wm1250_ev1_i2c_id[] = {
{ "wm1250-ev1", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, wm1250_ev1_i2c_id);
static struct i2c_driver wm1250_ev1_i2c_driver = {
.driver = {
.name = "wm1250-ev1",
.owner = THIS_MODULE,
},
.probe = wm1250_ev1_probe,
.remove = __devexit_p(wm1250_ev1_remove),
.id_table = wm1250_ev1_i2c_id,
};
static int __init wm1250_ev1_modinit(void)
{
int ret = 0;
ret = i2c_add_driver(&wm1250_ev1_i2c_driver);
if (ret != 0)
pr_err("Failed to register WM1250-EV1 I2C driver: %d\n", ret);
return ret;
}
module_init(wm1250_ev1_modinit);
static void __exit wm1250_ev1_exit(void)
{
i2c_del_driver(&wm1250_ev1_i2c_driver);
}
module_exit(wm1250_ev1_exit);
MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
MODULE_DESCRIPTION("WM1250-EV1 audio I/O module driver");
MODULE_LICENSE("GPL");
...@@ -77,7 +77,7 @@ SND_SOC_DAPM_OUTPUT("ROUT"), ...@@ -77,7 +77,7 @@ SND_SOC_DAPM_OUTPUT("ROUT"),
SND_SOC_DAPM_OUTPUT("RHPOUT"), SND_SOC_DAPM_OUTPUT("RHPOUT"),
}; };
static const struct snd_soc_dapm_route intercon[] = { static const struct snd_soc_dapm_route wm8711_intercon[] = {
/* output mixer */ /* output mixer */
{"Output Mixer", "Line Bypass Switch", "Line Input"}, {"Output Mixer", "Line Bypass Switch", "Line Input"},
{"Output Mixer", "HiFi Playback Switch", "DAC"}, {"Output Mixer", "HiFi Playback Switch", "DAC"},
...@@ -89,17 +89,6 @@ static const struct snd_soc_dapm_route intercon[] = { ...@@ -89,17 +89,6 @@ static const struct snd_soc_dapm_route intercon[] = {
{"LOUT", NULL, "Output Mixer"}, {"LOUT", NULL, "Output Mixer"},
}; };
static int wm8711_add_widgets(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, wm8711_dapm_widgets,
ARRAY_SIZE(wm8711_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0;
}
struct _coeff_div { struct _coeff_div {
u32 mclk; u32 mclk;
u32 rate; u32 rate;
...@@ -398,7 +387,6 @@ static int wm8711_probe(struct snd_soc_codec *codec) ...@@ -398,7 +387,6 @@ static int wm8711_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, wm8711_snd_controls, snd_soc_add_controls(codec, wm8711_snd_controls,
ARRAY_SIZE(wm8711_snd_controls)); ARRAY_SIZE(wm8711_snd_controls));
wm8711_add_widgets(codec);
return ret; return ret;
...@@ -420,6 +408,10 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8711 = { ...@@ -420,6 +408,10 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8711 = {
.reg_cache_size = ARRAY_SIZE(wm8711_reg), .reg_cache_size = ARRAY_SIZE(wm8711_reg),
.reg_word_size = sizeof(u16), .reg_word_size = sizeof(u16),
.reg_cache_default = wm8711_reg, .reg_cache_default = wm8711_reg,
.dapm_widgets = wm8711_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8711_dapm_widgets),
.dapm_routes = wm8711_intercon,
.num_dapm_routes = ARRAY_SIZE(wm8711_intercon),
}; };
#if defined(CONFIG_SPI_MASTER) #if defined(CONFIG_SPI_MASTER)
......
...@@ -65,22 +65,11 @@ SND_SOC_DAPM_OUTPUT("VOUTL"), ...@@ -65,22 +65,11 @@ SND_SOC_DAPM_OUTPUT("VOUTL"),
SND_SOC_DAPM_OUTPUT("VOUTR"), SND_SOC_DAPM_OUTPUT("VOUTR"),
}; };
static const struct snd_soc_dapm_route intercon[] = { static const struct snd_soc_dapm_route wm8728_intercon[] = {
{"VOUTL", NULL, "DAC"}, {"VOUTL", NULL, "DAC"},
{"VOUTR", NULL, "DAC"}, {"VOUTR", NULL, "DAC"},
}; };
static int wm8728_add_widgets(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, wm8728_dapm_widgets,
ARRAY_SIZE(wm8728_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0;
}
static int wm8728_mute(struct snd_soc_dai *dai, int mute) static int wm8728_mute(struct snd_soc_dai *dai, int mute)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
...@@ -255,7 +244,6 @@ static int wm8728_probe(struct snd_soc_codec *codec) ...@@ -255,7 +244,6 @@ static int wm8728_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, wm8728_snd_controls, snd_soc_add_controls(codec, wm8728_snd_controls,
ARRAY_SIZE(wm8728_snd_controls)); ARRAY_SIZE(wm8728_snd_controls));
wm8728_add_widgets(codec);
return ret; return ret;
} }
...@@ -275,6 +263,10 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8728 = { ...@@ -275,6 +263,10 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8728 = {
.reg_cache_size = ARRAY_SIZE(wm8728_reg_defaults), .reg_cache_size = ARRAY_SIZE(wm8728_reg_defaults),
.reg_word_size = sizeof(u16), .reg_word_size = sizeof(u16),
.reg_cache_default = wm8728_reg_defaults, .reg_cache_default = wm8728_reg_defaults,
.dapm_widgets = wm8728_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8728_dapm_widgets),
.dapm_routes = wm8728_intercon,
.num_dapm_routes = ARRAY_SIZE(wm8728_intercon),
}; };
#if defined(CONFIG_SPI_MASTER) #if defined(CONFIG_SPI_MASTER)
......
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.
...@@ -246,7 +246,6 @@ static struct snd_soc_dai_link goni_dai[] = { ...@@ -246,7 +246,6 @@ static struct snd_soc_dai_link goni_dai[] = {
.stream_name = "Voice", .stream_name = "Voice",
.cpu_dai_name = "goni-voice-dai", .cpu_dai_name = "goni-voice-dai",
.codec_dai_name = "wm8994-aif2", .codec_dai_name = "wm8994-aif2",
.platform_name = "samsung-audio",
.codec_name = "wm8994-codec.0-001a", .codec_name = "wm8994-codec.0-001a",
.ops = &goni_voice_ops, .ops = &goni_voice_ops,
}, },
......
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