Commit 9fa298dc authored by Tony Lindgren's avatar Tony Lindgren

REMOVE OMAP LEGACY CODE: Delete all old omap specific sound drivers

All omap boards should be using sound/soc. Any development must be
done on the alsa mailing list with linux-omap list cc'd.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent d8376cc4
......@@ -50,68 +50,5 @@ config SND_PXA2XX_AC97
Say Y or M if you want to support any AC97 codec attached to
the PXA2xx AC97 interface.
config SND_OMAP_AIC23
tristate "OMAP AIC23 alsa driver (osk5912)"
depends on ARCH_OMAP && SND
select SND_PCM
#select I2C
#select I2C_OMAP if ARCH_OMAP
select SENSORS_TLV320AIC23
help
Say Y here if you have a OSK platform board
and want to use its AIC23 audio chip.
To compile this driver as a module, choose M here: the module
will be called snd-omap-aic23.
config SND_OMAP_TSC2101
tristate "OMAP TSC2101 alsa driver"
depends on ARCH_OMAP && SND
select SND_PCM
select SPI_TSC2101
help
Say Y here if you have a OMAP platform board
and want to use its TSC2101 audio chip. Driver has
been tested with H2 and iPAQ h6300.
To compile this driver as a module, choose M here: the module
will be called snd-omap-tsc2101.
config SND_SX1
tristate "Siemens SX1 Egold alsa driver"
depends on ARCH_OMAP && SND
select SND_PCM
help
Say Y here if you have a OMAP310 based Siemens SX1.
To compile this driver as a module, choose M here: the module
will be called snd-omap-sx1.
config SND_OMAP_TSC2102
tristate "OMAP TSC2102 alsa driver"
depends on ARCH_OMAP && SND
select SND_PCM
select SPI_TSC2102
help
Say Y here if you have an OMAP platform board
and want to use its TSC2102 audio chip.
To compile this driver as a module, choose M here: the module
will be called snd-omap-tsc2102.
config SND_OMAP24XX_EAC
tristate "Audio driver for OMAP24xx EAC"
depends on SND
help
Audio driver for Enhanced Audio Controller found in TI's OMAP24xx
processors.
Currently contains only low-level support functions for
initializing EAC HW, creating ALSA sound card instance for it
and registering mixer controls implemented by a codec driver.
PCM stream is expected to be under DSP co-processor control.
To compile this driver as a module, choose M here: the module
will be called snd-omap24xx-eac.
endif # SND_ARM
......@@ -17,5 +17,3 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o
obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o
snd-pxa2xx-ac97-objs := pxa2xx-ac97.o
obj-$(CONFIG_SND) += omap/
#
## Makefile for ALSA OMAP
#
#
obj-$(CONFIG_SND_OMAP_AIC23) += snd-omap-alsa-aic23.o
snd-omap-alsa-aic23-objs := omap-alsa.o omap-alsa-dma.o omap-alsa-aic23.o omap-alsa-aic23-mixer.o
obj-$(CONFIG_SND_OMAP_TSC2101) += snd-omap-alsa-tsc2101.o
snd-omap-alsa-tsc2101-objs := omap-alsa.o omap-alsa-dma.o omap-alsa-tsc2101.o omap-alsa-tsc2101-mixer.o
obj-$(CONFIG_SND_OMAP_TSC2102) += snd-omap-alsa-tsc2102.o
snd-omap-alsa-tsc2102-objs := omap-alsa.o omap-alsa-dma.o omap-alsa-tsc2102.o omap-alsa-tsc2102-mixer.o
obj-$(CONFIG_SND_SX1) += snd-omap-alsa-sx1.o
snd-omap-alsa-sx1-objs := omap-alsa.o omap-alsa-dma.o omap-alsa-sx1.o omap-alsa-sx1-mixer.o
obj-$(CONFIG_SND_OMAP24XX_EAC) += snd-omap24xx-eac.o
snd-omap24xx-eac-objs := eac.o
This diff is collapsed.
This diff is collapsed.
/*
* arch/arm/mach-omap1/omap-alsa-aic23.c
*
* Alsa codec Driver for AIC23 chip on OSK5912 platform board
*
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Written by Daniel Petrini, David Cohen, Anderson Briglia
* {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br
*
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* Based in former alsa driver for osk and oss driver
*
* 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 <sound/core.h>
#include <sound/pcm.h>
#include <sound/initval.h>
#include <sound/control.h>
#include <linux/clk.h>
#include <mach/clock.h>
#include <mach/aic23.h>
#include <mach/omap-alsa.h>
#include "omap-alsa-aic23.h"
static struct clk *aic23_mclk;
/* aic23 related */
static const struct aic23_samplerate_reg_info
rate_reg_info[NUMBER_SAMPLE_RATES_SUPPORTED] = {
{4000, 0x06, 1}, /* 4000 */
{8000, 0x06, 0}, /* 8000 */
{16000, 0x0C, 1}, /* 16000 */
{22050, 0x11, 1}, /* 22050 */
{24000, 0x00, 1}, /* 24000 */
{32000, 0x0C, 0}, /* 32000 */
{44100, 0x11, 0}, /* 44100 */
{48000, 0x00, 0}, /* 48000 */
{88200, 0x1F, 0}, /* 88200 */
{96000, 0x0E, 0}, /* 96000 */
};
/*
* Hardware capabilities
*/
/*
* DAC USB-mode sampling rates (MCLK = 12 MHz)
* The rates and rate_reg_into MUST be in the same order
*/
static unsigned int rates[] = {
4000, 8000, 16000, 22050,
24000, 32000, 44100,
48000, 88200, 96000,
};
static struct snd_pcm_hw_constraint_list aic23_hw_constraints_rates = {
.count = ARRAY_SIZE(rates),
.list = rates,
.mask = 0,
};
static struct snd_pcm_hardware aic23_snd_omap_alsa_playback = {
.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
.formats = (SNDRV_PCM_FMTBIT_S16_LE),
.rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |
SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
SNDRV_PCM_RATE_KNOT),
.rate_min = 8000,
.rate_max = 96000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = 128 * 1024,
.period_bytes_min = 32,
.period_bytes_max = 8 * 1024,
.periods_min = 16,
.periods_max = 255,
.fifo_size = 0,
};
static struct snd_pcm_hardware aic23_snd_omap_alsa_capture = {
.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
.formats = (SNDRV_PCM_FMTBIT_S16_LE),
.rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |
SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
SNDRV_PCM_RATE_KNOT),
.rate_min = 8000,
.rate_max = 96000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = 128 * 1024,
.period_bytes_min = 32,
.period_bytes_max = 8 * 1024,
.periods_min = 16,
.periods_max = 255,
.fifo_size = 0,
};
/*
* Codec/mcbsp init and configuration section
* codec dependent code.
*/
/* TLV320AIC23 is a write only device */
void audio_aic23_write(u8 address, u16 data)
{
aic23_write_value(address, data);
}
EXPORT_SYMBOL_GPL(audio_aic23_write);
/*
* Sample rate changing
*/
void aic23_set_samplerate(long rate)
{
u8 count = 0;
u16 data = 0;
/* Fix the rate if it has a wrong value */
if (rate >= 96000)
rate = 96000;
else if (rate >= 88200)
rate = 88200;
else if (rate >= 48000)
rate = 48000;
else if (rate >= 44100)
rate = 44100;
else if (rate >= 32000)
rate = 32000;
else if (rate >= 24000)
rate = 24000;
else if (rate >= 22050)
rate = 22050;
else if (rate >= 16000)
rate = 16000;
else if (rate >= 8000)
rate = 8000;
else
rate = 4000;
/* Search for the right sample rate */
/* Verify what happens if the rate is not supported
* now it goes to 96Khz */
while ((rate_reg_info[count].sample_rate != rate) &&
(count < (NUMBER_SAMPLE_RATES_SUPPORTED - 1))) {
count++;
}
data = (rate_reg_info[count].divider << CLKIN_SHIFT) |
(rate_reg_info[count].control << BOSR_SHIFT) | USB_CLK_ON;
audio_aic23_write(SAMPLE_RATE_CONTROL_ADDR, data);
}
inline void aic23_configure(void)
{
/* Reset codec */
audio_aic23_write(RESET_CONTROL_ADDR, 0);
/* Initialize the AIC23 internal state */
/*
* Analog audio path control, DAC selected,
* delete INSEL_MIC for line-in
*/
audio_aic23_write(ANALOG_AUDIO_CONTROL_ADDR,
DEFAULT_ANALOG_AUDIO_CONTROL);
/* Digital audio path control, de-emphasis control 44.1kHz */
audio_aic23_write(DIGITAL_AUDIO_CONTROL_ADDR, DEEMP_44K);
/* Digital audio interface, master/slave mode, I2S, 16 bit */
#ifdef AIC23_MASTER
audio_aic23_write(DIGITAL_AUDIO_FORMAT_ADDR,
MS_MASTER | IWL_16 | FOR_DSP);
#else
audio_aic23_write(DIGITAL_AUDIO_FORMAT_ADDR, IWL_16 | FOR_DSP);
#endif
/* Enable digital interface */
audio_aic23_write(DIGITAL_INTERFACE_ACT_ADDR, ACT_ON);
}
/*
* OMAP MCBSP clock configuration and Power Management
*
* Here we have some functions that allow clock to be enabled and
* disabled only when needed. Besides doing clock configuration
* it allows turn on/turn off audio when necessary.
*/
/*
* Do clock framework mclk search
*/
void aic23_clock_setup(void)
{
aic23_mclk = clk_get(0, "mclk");
}
/*
* Do some sanity check, set clock rate, starts it and
* turn codec audio on
*/
int aic23_clock_on(void)
{
uint curRate;
if (clk_get_usecount(aic23_mclk) > 0) {
/* MCLK is already in use */
printk(KERN_WARNING
"MCLK in use at %d Hz. We change it to %d Hz\n",
(uint) clk_get_rate(aic23_mclk),
CODEC_CLOCK);
}
curRate = (uint)clk_get_rate(aic23_mclk);
if (curRate != CODEC_CLOCK) {
if (clk_set_rate(aic23_mclk, CODEC_CLOCK)) {
printk(KERN_ERR
"Cannot set MCLK for AIC23 CODEC\n");
return -ECANCELED;
}
}
clk_enable(aic23_mclk);
printk(KERN_DEBUG
"MCLK = %d [%d], usecount = %d\n",
(uint) clk_get_rate(aic23_mclk), CODEC_CLOCK,
clk_get_usecount(aic23_mclk));
/* Now turn the audio on */
audio_aic23_write(POWER_DOWN_CONTROL_ADDR,
~DEVICE_POWER_OFF & ~OUT_OFF & ~DAC_OFF &
~ADC_OFF & ~MIC_OFF & ~LINE_OFF);
return 0;
}
/*
* Do some sanity check, turn clock off and then turn
* codec audio off
*/
int aic23_clock_off(void)
{
if (clk_get_usecount(aic23_mclk) > 0) {
if (clk_get_rate(aic23_mclk) != CODEC_CLOCK) {
printk(KERN_WARNING
"MCLK for audio should be %d Hz. But is %d Hz\n",
(uint) clk_get_rate(aic23_mclk),
CODEC_CLOCK);
}
clk_disable(aic23_mclk);
}
audio_aic23_write(POWER_DOWN_CONTROL_ADDR,
DEVICE_POWER_OFF | OUT_OFF | DAC_OFF |
ADC_OFF | MIC_OFF | LINE_OFF);
return 0;
}
int aic23_get_default_samplerate(void)
{
return DEFAULT_SAMPLE_RATE;
}
static int __devinit snd_omap_alsa_aic23_probe(struct platform_device *pdev)
{
int ret;
struct omap_alsa_codec_config *codec_cfg;
codec_cfg = pdev->dev.platform_data;
if (codec_cfg != NULL) {
codec_cfg->hw_constraints_rates = &aic23_hw_constraints_rates;
codec_cfg->snd_omap_alsa_playback =
&aic23_snd_omap_alsa_playback;
codec_cfg->snd_omap_alsa_capture = &aic23_snd_omap_alsa_capture;
codec_cfg->codec_configure_dev = aic23_configure;
codec_cfg->codec_set_samplerate = aic23_set_samplerate;
codec_cfg->codec_clock_setup = aic23_clock_setup;
codec_cfg->codec_clock_on = aic23_clock_on;
codec_cfg->codec_clock_off = aic23_clock_off;
codec_cfg->get_default_samplerate =
aic23_get_default_samplerate;
ret = snd_omap_alsa_post_probe(pdev, codec_cfg);
} else
ret = -ENODEV;
return ret;
}
static struct platform_driver omap_alsa_driver = {
.probe = snd_omap_alsa_aic23_probe,
.remove = snd_omap_alsa_remove,
.suspend = snd_omap_alsa_suspend,
.resume = snd_omap_alsa_resume,
.driver = {
.name = "omap_alsa_mcbsp",
},
};
static int __init omap_alsa_aic23_init(void)
{
int err;
ADEBUG();
err = platform_driver_register(&omap_alsa_driver);
return err;
}
static void __exit omap_alsa_aic23_exit(void)
{
ADEBUG();
platform_driver_unregister(&omap_alsa_driver);
}
module_init(omap_alsa_aic23_init);
module_exit(omap_alsa_aic23_exit);
/*
* sound/arm/omap-alsa-aic23.h
*
* Alsa Driver for AIC23 codec on OSK5912 platform board
*
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Written by Daniel Petrini, David Cohen, Anderson Briglia
* {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br
*
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* 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 __OMAP_ALSA_AIC23_H
#define __OMAP_ALSA_AIC23_H
#include <mach/dma.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <mach/mcbsp.h>
/* Define to set the AIC23 as the master w.r.t McBSP */
#define AIC23_MASTER
#define NUMBER_SAMPLE_RATES_SUPPORTED 10
/*
* AUDIO related MACROS
*/
#ifndef DEFAULT_BITPERSAMPLE
#define DEFAULT_BITPERSAMPLE 16
#endif
#define DEFAULT_SAMPLE_RATE 44100
#define CODEC_CLOCK 12000000
#define AUDIO_MCBSP OMAP_MCBSP1
#define DEFAULT_OUTPUT_VOLUME 0x60
#define DEFAULT_INPUT_VOLUME 0x00 /* 0 ==> mute line in */
#define OUTPUT_VOLUME_MIN LHV_MIN
#define OUTPUT_VOLUME_MAX LHV_MAX
#define OUTPUT_VOLUME_RANGE (OUTPUT_VOLUME_MAX - OUTPUT_VOLUME_MIN)
#define OUTPUT_VOLUME_MASK OUTPUT_VOLUME_MAX
#define INPUT_VOLUME_MIN LIV_MIN
#define INPUT_VOLUME_MAX LIV_MAX
#define INPUT_VOLUME_RANGE (INPUT_VOLUME_MAX - INPUT_VOLUME_MIN)
#define INPUT_VOLUME_MASK INPUT_VOLUME_MAX
#define SIDETONE_MASK 0x1c0
#define SIDETONE_0 0x100
#define SIDETONE_6 0x000
#define SIDETONE_9 0x040
#define SIDETONE_12 0x080
#define SIDETONE_18 0x0c0
#define DEFAULT_ANALOG_AUDIO_CONTROL (DAC_SELECTED | STE_ENABLED | \
BYPASS_ON | INSEL_MIC | MICB_20DB)
struct aic23_samplerate_reg_info {
u32 sample_rate;
u8 control; /* SR3, SR2, SR1, SR0 and BOSR */
u8 divider; /* if 0 CLKIN = MCLK, if 1 CLKIN = MCLK/2 */
};
extern int aic23_write_value(u8 reg, u16 value);
/*
* Defines codec specific function pointers that can be used from the
* common omap-alsa base driver for all omap codecs. (tsc2101 and aic23)
*/
void audio_aic23_write(u8 address, u16 data);
void define_codec_functions(struct omap_alsa_codec_config *codec_config);
inline void aic23_configure(void);
void aic23_set_samplerate(long rate);
void aic23_clock_setup(void);
int aic23_clock_on(void);
int aic23_clock_off(void);
int aic23_get_default_samplerate(void);
#endif
This diff is collapsed.
/*
* linux/sound/arm/omap/omap-alsa-dma.h
*
* Common audio DMA handling for the OMAP processors
*
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
*
* Copyright (C) 2004 Texas Instruments, Inc.
*
* Copyright (C) 2000, 2001 Nicolas Pitre <nico@cam.org>
*
* This package 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.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* History:
*
*
* 2004/08/12 Nishanth Menon - Modified to integrate Audio requirements on
* 1610, 1710 platforms
*
* 2005/07/25 INdT Kernel Team - Renamed to omap-alsa-dma.h. Ported to Alsa.
*/
#ifndef __OMAP_AUDIO_ALSA_DMA_H
#define __OMAP_AUDIO_ALSA_DMA_H
#include <mach/omap-alsa.h>
/* Global data structures */
typedef void (*dma_callback_t) (int lch, u16 ch_status, void *data);
/* arch specific functions */
void omap_clear_alsa_sound_dma(struct audio_stream *s);
int omap_request_alsa_sound_dma(int device_id, const char *device_name,
void *data, int **channels);
int omap_free_alsa_sound_dma(void *data, int **channels);
int omap_start_alsa_sound_dma(struct audio_stream *s, dma_addr_t dma_ptr,
u_int dma_size);
void omap_stop_alsa_sound_dma(struct audio_stream *s);
#endif
This diff is collapsed.
/*
* sound/arm/omap/omap-alsa-sx1-mixer.h
*
* Alsa codec Driver for Siemens SX1 board.
* based on omap-alsa-tsc2101-mixer.c
*
* Copyright (C) 2006 Vladimir Ananiev (vovan888 at gmail com)
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef OMAPALSASX1MIXER_H_
#define OMAPALSASX1MIXER_H_
#include "omap-alsa-dma.h"
#define PLAYBACK_TARGET_COUNT 0x03
#define PLAYBACK_TARGET_LOUDSPEAKER 0x00
#define PLAYBACK_TARGET_HEADPHONE 0x01
#define PLAYBACK_TARGET_CELLPHONE 0x02
/* following are used for register 03h Mixer PGA control bits
D7-D5 for selecting record source */
#define REC_SRC_TARGET_COUNT 0x08
/* OSS code referred to MIXER_LINE */
#define REC_SRC_SINGLE_ENDED_MICIN_HED 0x00
/* OSS code referred to MIXER_MIC */
#define REC_SRC_SINGLE_ENDED_MICIN_HND 0x01
#define REC_SRC_SINGLE_ENDED_AUX1 0x02
#define REC_SRC_SINGLE_ENDED_AUX2 0x03
#define REC_SRC_MICIN_HED_AND_AUX1 0x04
#define REC_SRC_MICIN_HED_AND_AUX2 0x05
#define REC_SRC_MICIN_HND_AND_AUX1 0x06
#define REC_SRC_MICIN_HND_AND_AUX2 0x07
#define DEFAULT_OUTPUT_VOLUME 5 /* default output volume to dac dgc */
#define DEFAULT_INPUT_VOLUME 2 /* default record volume */
#endif
/*
* Alsa codec Driver for Siemens SX1 board.
* based on omap-alsa-tsc2101.c and cn_test.c example by Evgeniy Polyakov
*
* Copyright (C) 2006 Vladimir Ananiev (vovan888 at gmail com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/delay.h>
#include <linux/soundcard.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/connector.h>
#include <linux/slab.h>
#include <linux/pm.h>
#include <mach/dma.h>
#include <mach/clock.h>
#include <mach/gpio.h>
#include <mach/mcbsp.h>
#include <mach/omap-alsa.h>
#include "omap-alsa-sx1.h"
/* Connector implementation */
static struct cb_id cn_sx1snd_id = { CN_IDX_SX1SND, CN_VAL_SX1SND };
static char cn_sx1snd_name[] = "cn_sx1snd";
static void cn_sx1snd_callback(void *data)
{
struct cn_msg *msg = (struct cn_msg *)data;
printk(KERN_INFO
"%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n",
__func__, jiffies, msg->id.idx, msg->id.val,
msg->seq, msg->ack, msg->len, (char *)msg->data);
}
/* Send IPC message to sound server */
int cn_sx1snd_send(unsigned int cmd, unsigned int arg1, unsigned int arg2)
{
struct cn_msg *m;
unsigned short data[3];
int err;
m = kzalloc(sizeof(*m) + sizeof(data), gfp_any());
if (!m)
return -1;
memcpy(&m->id, &cn_sx1snd_id, sizeof(m->id));
m->seq = 1;
m->len = sizeof(data);
data[0] = (unsigned short)cmd;
data[1] = (unsigned short)arg1;
data[2] = (unsigned short)arg2;
memcpy(m + 1, data, m->len);
err = cn_netlink_send(m, CN_IDX_SX1SND, gfp_any());
snd_printd("sent= %02X %02X %02X, err=%d\n", cmd, arg1, arg2, err);
kfree(m);
if (err == -ESRCH)
return -1; /* there are no listeners on socket */
return 0;
}
/* Hardware capabilities
*
* DAC USB-mode sampling rates (MCLK = 12 MHz)
* The rates and rate_reg_into MUST be in the same order
*/
static unsigned int rates[] = {
8000, 11025, 12000,
16000, 22050, 24000,
32000, 44100, 48000,
};
static struct snd_pcm_hw_constraint_list egold_hw_constraints_rates = {
.count = ARRAY_SIZE(rates),
.list = rates,
.mask = 0,
};
static struct snd_pcm_hardware egold_snd_omap_alsa_playback = {
.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
.formats = (SNDRV_PCM_FMTBIT_S16_LE),
.rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |
SNDRV_PCM_RATE_16000 |
SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |
SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_KNOT),
.rate_min = 8000,
.rate_max = 48000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = 128 * 1024,
.period_bytes_min = 32,
.period_bytes_max = 8 * 1024,
.periods_min = 16,
.periods_max = 255,
.fifo_size = 0,
};
static struct snd_pcm_hardware egold_snd_omap_alsa_capture = {
.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
.formats = (SNDRV_PCM_FMTBIT_S16_LE),
.rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |
SNDRV_PCM_RATE_16000 |
SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |
SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_KNOT),
.rate_min = 8000,
.rate_max = 48000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = 128 * 1024,
.period_bytes_min = 32,
.period_bytes_max = 8 * 1024,
.periods_min = 16,
.periods_max = 255,
.fifo_size = 0,
};
static long current_rate = -1; /* current rate in egold format 0..8 */
/*
* ALSA operations according to board file
*/
/*
* Sample rate changing
*/
static void egold_set_samplerate(long sample_rate)
{
int egold_rate = 0;
int clkgdv = 0;
u16 srgr1, srgr2;
/* Set the sample rate */
#if 0
/* fw15: 5005E490 - divs are different !!! */
clkgdv = CODEC_CLOCK / (sample_rate * (DEFAULT_BITPERSAMPLE * 2 - 1));
#endif
switch (sample_rate) {
case 8000:
clkgdv = 71;
egold_rate = FRQ_8000;
break;
case 11025:
clkgdv = 51;
egold_rate = FRQ_11025;
break;
case 12000:
clkgdv = 47;
egold_rate = FRQ_12000;
break;
case 16000:
clkgdv = 35;
egold_rate = FRQ_16000;
break;
case 22050:
clkgdv = 25;
egold_rate = FRQ_22050;
break;
case 24000:
clkgdv = 23;
egold_rate = FRQ_24000;
break;
case 32000:
clkgdv = 17;
egold_rate = FRQ_32000;
break;
case 44100:
clkgdv = 12;
egold_rate = FRQ_44100;
break;
case 48000:
clkgdv = 11;
egold_rate = FRQ_48000;
break;
}
srgr1 = (FWID(DEFAULT_BITPERSAMPLE - 1) | CLKGDV(clkgdv));
srgr2 = ((FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1)));
OMAP_MCBSP_WRITE(OMAP1510_MCBSP1_BASE, SRGR2, srgr2);
OMAP_MCBSP_WRITE(OMAP1510_MCBSP1_BASE, SRGR1, srgr1);
current_rate = egold_rate;
snd_printd("set samplerate=%ld\n", sample_rate);
}
static void egold_configure(void)
{
}
/*
* Omap MCBSP clock and Power Management configuration
*
* Here we have some functions that allows clock to be enabled and
* disabled only when needed. Besides doing clock configuration
* it allows turn on/turn off audio when necessary.
*/
/*
* Do clock framework mclk search
*/
static void egold_clock_setup(void)
{
omap_request_gpio(OSC_EN);
omap_set_gpio_direction(OSC_EN, 0); /* output */
snd_printd("\n");
}
/*
* Do some sanity check, set clock rate, starts it and turn codec audio on
*/
static int egold_clock_on(void)
{
omap_set_gpio_dataout(OSC_EN, 1);
egold_set_samplerate(44100); /* TODO */
cn_sx1snd_send(DAC_SETAUDIODEVICE, SX1_DEVICE_SPEAKER, 0);
cn_sx1snd_send(DAC_OPEN_DEFAULT, current_rate , 4);
snd_printd("\n");
return 0;
}
/*
* Do some sanity check, turn clock off and then turn codec audio off
*/
static int egold_clock_off(void)
{
cn_sx1snd_send(DAC_CLOSE, 0 , 0);
cn_sx1snd_send(DAC_SETAUDIODEVICE, SX1_DEVICE_PHONE, 0);
omap_set_gpio_dataout(OSC_EN, 0);
snd_printd("\n");
return 0;
}
static int egold_get_default_samplerate(void)
{
snd_printd("\n");
return DEFAULT_SAMPLE_RATE;
}
static int __init snd_omap_alsa_egold_probe(struct platform_device *pdev)
{
int ret;
struct omap_alsa_codec_config *codec_cfg;
codec_cfg = pdev->dev.platform_data;
if (!codec_cfg)
return -ENODEV;
codec_cfg->hw_constraints_rates = &egold_hw_constraints_rates;
codec_cfg->snd_omap_alsa_playback = &egold_snd_omap_alsa_playback;
codec_cfg->snd_omap_alsa_capture = &egold_snd_omap_alsa_capture;
codec_cfg->codec_configure_dev = egold_configure;
codec_cfg->codec_set_samplerate = egold_set_samplerate;
codec_cfg->codec_clock_setup = egold_clock_setup;
codec_cfg->codec_clock_on = egold_clock_on;
codec_cfg->codec_clock_off = egold_clock_off;
codec_cfg->get_default_samplerate = egold_get_default_samplerate;
ret = snd_omap_alsa_post_probe(pdev, codec_cfg);
snd_printd("\n");
return ret;
}
static struct platform_driver omap_alsa_driver = {
.probe = snd_omap_alsa_egold_probe,
.remove = snd_omap_alsa_remove,
.suspend = snd_omap_alsa_suspend,
.resume = snd_omap_alsa_resume,
.driver = {
.name = "omap_alsa_mcbsp",
},
};
static int __init omap_alsa_egold_init(void)
{
int retval;
retval = cn_add_callback(&cn_sx1snd_id, cn_sx1snd_name,
cn_sx1snd_callback);
if (retval)
printk(KERN_WARNING "cn_sx1snd failed to register\n");
return platform_driver_register(&omap_alsa_driver);
}
static void __exit omap_alsa_egold_exit(void)
{
cn_del_callback(&cn_sx1snd_id);
platform_driver_unregister(&omap_alsa_driver);
}
module_init(omap_alsa_egold_init);
module_exit(omap_alsa_egold_exit);
/*
* Based on omap-alsa-tsc2101.h
*
* Alsa Driver for Siemens SX1.
* Copyright (C) 2006 Vladimir Ananiev (vovan888 at gmail com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef OMAP_ALSA_SX1_H_
#define OMAP_ALSA_SX1_H_
#include <linux/types.h>
#define NUMBER_SAMPLE_RATES_SUPPORTED 9
/*
* AUDIO related MACROS
*/
#ifndef DEFAULT_BITPERSAMPLE
#define DEFAULT_BITPERSAMPLE 16
#endif
#define DEFAULT_SAMPLE_RATE 44100
/* fw15: 18356000 */
#define CODEC_CLOCK 18359000
/* McBSP for playing music */
#define AUDIO_MCBSP OMAP_MCBSP1
/* McBSP for record/play audio from phone and mic */
#define AUDIO_MCBSP_PCM OMAP_MCBSP2
/* gpio pin for enable/disable clock */
#define OSC_EN 2
/* Send IPC message to sound server */
extern int cn_sx1snd_send(unsigned int cmd, unsigned int arg1,
unsigned int arg2);
/* cmd for IPC_GROUP_DAC */
#define DAC_VOLUME_UPDATE 0
#define DAC_SETAUDIODEVICE 1
#define DAC_OPEN_RING 2
#define DAC_OPEN_DEFAULT 3
#define DAC_CLOSE 4
#define DAC_FMRADIO_OPEN 5
#define DAC_FMRADIO_CLOSE 6
#define DAC_PLAYTONE 7
/* cmd for IPC_GROUP_PCM */
#define PCM_PLAY (0+8)
#define PCM_RECORD (1+8)
#define PCM_CLOSE (2+8)
/* for DAC_SETAUDIODEVICE */
#define SX1_DEVICE_SPEAKER 0
#define SX1_DEVICE_HEADPHONE 4
#define SX1_DEVICE_PHONE 3
/* frequencies for MdaDacOpenDefaultL, MdaDacOpenRingL */
#define FRQ_8000 0
#define FRQ_11025 1
#define FRQ_12000 2
#define FRQ_16000 3
#define FRQ_22050 4
#define FRQ_24000 5
#define FRQ_32000 6
#define FRQ_44100 7
#define FRQ_48000 8
#endif
This diff is collapsed.
/*
* sound/arm/omap/omap-alsa-tsc2101-mixer.h
*
* Alsa Driver for TSC2101 codec for OMAP platform boards.
*
* Copyright (C) 2005 Mika Laitio <lamikr@cc.jyu.fi> and
* Everett Coleman II <gcc80x86@fuzzyneural.net>
*
* Based on the ideas in omap-aic23.c and sa11xx-uda1341.c
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Copyright (C) 2002 Tomas Kasparek <tomas.kasparek@seznam.cz>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
* History:
*
* 2006-03-01 Mika Laitio - Mixer for the tsc2101 driver used in omap boards.
* Can switch between headset and loudspeaker playback,
* mute and unmute dgc, set dgc volume. Record source switch,
* keyclick, buzzer and headset volume and handset volume control
* are still missing.
*/
#ifndef OMAPALSATSC2101MIXER_H_
#define OMAPALSATSC2101MIXER_H_
#include <asm/hardware/tsc2101.h>
#include "omap-alsa-dma.h"
/* tsc2101 DAC gain control volume specific */
#define OUTPUT_VOLUME_MIN 0x7F /* 1111111 = -63.5 DB */
#define OUTPUT_VOLUME_MAX 0x32 /* 110010 */
#define OUTPUT_VOLUME_RANGE (OUTPUT_VOLUME_MIN - OUTPUT_VOLUME_MAX)
/* use input vol of 75 for 0dB gain */
#define INPUT_VOLUME_MIN 0x0
#define INPUT_VOLUME_MAX 0x7D
#define INPUT_VOLUME_RANGE (INPUT_VOLUME_MAX - INPUT_VOLUME_MIN)
#define PLAYBACK_TARGET_COUNT 0x03
#define PLAYBACK_TARGET_LOUDSPEAKER 0x00
#define PLAYBACK_TARGET_HEADPHONE 0x01
#define PLAYBACK_TARGET_CELLPHONE 0x02
/*
* Following are used for register 03h Mixer PGA control bits D7-D5 for
* selecting record source
*/
#define REC_SRC_TARGET_COUNT 0x08
/* oss code referred to MIXER_LINE */
#define REC_SRC_SINGLE_ENDED_MICIN_HED 0x00
/* oss code referred to MIXER_MIC */
#define REC_SRC_SINGLE_ENDED_MICIN_HND 0x01
#define REC_SRC_SINGLE_ENDED_AUX1 0x02
#define REC_SRC_SINGLE_ENDED_AUX2 0x03
#define REC_SRC_MICIN_HED_AND_AUX1 0x04
#define REC_SRC_MICIN_HED_AND_AUX2 0x05
#define REC_SRC_MICIN_HND_AND_AUX1 0x06
#define REC_SRC_MICIN_HND_AND_AUX2 0x07
/* default output volume to dac dgc */
#define DEFAULT_OUTPUT_VOLUME 90
/* default record volume */
#define DEFAULT_INPUT_VOLUME 20
#define TSC2101_AUDIO_CODEC_REGISTERS_PAGE2 (2)
extern struct mcbsp_dev_info mcbsp_dev;
#endif /*OMAPALSATSC2101MIXER_H_*/
This diff is collapsed.
/*
* sound/arm/omap/omap-alsa-tsc2101.h
*
* Alsa Driver for TSC2101 codec for OMAP platform boards.
*
* Based on former omap-aic23.h and tsc2101 OSS drivers.
* Copyright (C) 2004 Texas Instruments, Inc.
* Written by Nishanth Menon and Sriram Kannan
*
* Copyright (C) 2006 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Alsa modularization by Daniel Petrini (d.pensator@gmail.com)
*
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* 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 OMAP_ALSA_TSC2101_H_
#define OMAP_ALSA_TSC2101_H_
#include <linux/types.h>
/* Define to set the tsc as the master w.r.t McBSP or EAC */
#define TSC_MASTER
#define NUMBER_SAMPLE_RATES_SUPPORTED 16
/*
* AUDIO related MACROS
*/
#ifndef DEFAULT_BITPERSAMPLE
#define DEFAULT_BITPERSAMPLE 16
#endif
#define DEFAULT_SAMPLE_RATE 44100
/* FIXME codec clock rate is board-specific */
#define CODEC_CLOCK 12000000
#define PAGE2_AUDIO_CODEC_REGISTERS (2)
struct mcbsp_dev_info {
struct platform_device *mcbsp_dev;
struct spi_device *tsc2101_dev;
};
struct tsc2101_samplerate_reg_info {
u16 sample_rate;
u8 divisor;
u8 fs_44kHz; /* if 0 48 khz, if 1 44.1 khz fsref */
};
/*
* Defines codec specific function pointers that can be used from the
* common omap-alse base driver for all omap codecs. (tsc2101 and aic23)
*/
inline void tsc2101_configure(void);
void tsc2101_set_samplerate(long rate);
void tsc2101_clock_setup(void);
int tsc2101_clock_on(void);
int tsc2101_clock_off(void);
int tsc2101_get_default_samplerate(void);
#endif /*OMAP_ALSA_TSC2101_H_*/
/*
* sound/arm/omap/omap-alsa-tsc2102-mixer.c
*
* Alsa mixer driver for TSC2102 chip for OMAP platforms.
*
* Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org>
* Code based on the TSC2101 ALSA driver.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/types.h>
#include <linux/spi/tsc2102.h>
#include <mach/omap-alsa.h>
#include <sound/initval.h>
#include <sound/control.h>
#include "omap-alsa-tsc2102.h"
#include "omap-alsa-dma.h"
static int vol[2], mute[2], filter[2];
/*
* Converts the Alsa mixer volume (0 - 100) to actual Digital
* Gain Control (DGC) value that can be written or read from the
* TSC2102 registers.
*
* Note that the number "OUTPUT_VOLUME_MAX" is smaller than
* OUTPUT_VOLUME_MIN because DGC works as a volume decreaser. (The
* higher the value sent to DAC, the more the volume of controlled
* channel is decreased)
*/
static void set_dac_gain_stereo(int left_ch, int right_ch)
{
int lch, rch;
if (left_ch > 100)
vol[0] = 100;
else if (left_ch < 0)
vol[0] = 0;
else
vol[0] = left_ch;
lch = OUTPUT_VOLUME_MIN - vol[0] *
(OUTPUT_VOLUME_MIN - OUTPUT_VOLUME_MAX) / 100;
if (right_ch > 100)
vol[1] = 100;
else if (right_ch < 0)
vol[1] = 0;
else
vol[1] = right_ch;
rch = OUTPUT_VOLUME_MIN - vol[1] *
(OUTPUT_VOLUME_MIN - OUTPUT_VOLUME_MAX) / 100;
tsc2102_set_volume(lch, rch);
}
void init_playback_targets(void)
{
set_dac_gain_stereo(DEFAULT_OUTPUT_VOLUME, DEFAULT_OUTPUT_VOLUME);
/* Unmute */
tsc2102_set_mute(0, 0);
mute[0] = 0;
mute[1] = 0;
filter[0] = 0;
filter[1] = 0;
}
/*
* Initializes TSC 2102 and playback target.
*/
void snd_omap_init_mixer(void)
{
FN_IN;
init_playback_targets();
FN_OUT(0);
}
static int __pcm_playback_volume_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 100;
return 0;
}
static int __pcm_playback_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.integer.value[0] = vol[0]; /* L */
ucontrol->value.integer.value[1] = vol[1]; /* R */
return 0;
}
static int __pcm_playback_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
set_dac_gain_stereo(
ucontrol->value.integer.value[0], /* L */
ucontrol->value.integer.value[1]); /* R */
return 1;
}
static int __pcm_playback_switch_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
}
static int __pcm_playback_switch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.integer.value[0] = !mute[0]; /* L */
ucontrol->value.integer.value[1] = !mute[1]; /* R */
return 0;
}
static int __pcm_playback_switch_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
mute[0] = (ucontrol->value.integer.value[0] == 0); /* L */
mute[1] = (ucontrol->value.integer.value[1] == 0); /* R */
tsc2102_set_mute(mute[0], mute[1]);
return 1;
}
static int __pcm_playback_deemphasis_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
}
static int __pcm_playback_deemphasis_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.integer.value[0] = filter[0];
return 0;
}
static int __pcm_playback_deemphasis_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
filter[0] = (ucontrol->value.integer.value[0] > 0);
tsc2102_set_deemphasis(filter[0]);
return 1;
}
static int __pcm_playback_bassboost_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
}
static int __pcm_playback_bassboost_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.integer.value[0] = filter[1];
return 0;
}
static int __pcm_playback_bassboost_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
filter[1] = (ucontrol->value.integer.value[0] > 0);
tsc2102_set_bassboost(filter[1]);
return 1;
}
static struct snd_kcontrol_new tsc2102_controls[] __devinitdata = {
{
.name = "Master Playback Volume",
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.index = 0,
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
.info = __pcm_playback_volume_info,
.get = __pcm_playback_volume_get,
.put = __pcm_playback_volume_put,
},
{
.name = "Master Playback Switch",
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.index = 0,
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
.info = __pcm_playback_switch_info,
.get = __pcm_playback_switch_get,
.put = __pcm_playback_switch_put,
},
{
.name = "De-emphasis Filter Switch",
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.index = 0,
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
.info = __pcm_playback_deemphasis_info,
.get = __pcm_playback_deemphasis_get,
.put = __pcm_playback_deemphasis_put,
},
{
.name = "Bass-boost Filter Switch",
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.index = 0,
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
.info = __pcm_playback_bassboost_info,
.get = __pcm_playback_bassboost_get,
.put = __pcm_playback_bassboost_put,
},
};
#ifdef CONFIG_PM
void snd_omap_suspend_mixer(void)
{
/* Nothing to do */
}
void snd_omap_resume_mixer(void)
{
/* The chip was reset, restore the last used values */
set_dac_gain_stereo(vol[0], vol[1]);
tsc2102_set_mute(mute[0], mute[1]);
tsc2102_set_deemphasis(filter[0]);
tsc2102_set_bassboost(filter[1]);
}
#endif
int snd_omap_mixer(struct snd_card_omap_codec *tsc2102)
{
int i, err;
if (!tsc2102)
return -EINVAL;
for (i = 0; i < ARRAY_SIZE(tsc2102_controls); i++) {
err = snd_ctl_add(tsc2102->card,
snd_ctl_new1(&tsc2102_controls[i],
tsc2102->card));
if (err < 0)
return err;
}
return 0;
}
This diff is collapsed.
/*
* sound/arm/omap/omap-alsa-tsc2102.h
*
* Alsa codec driver for TSC2102 chip for OMAP platforms.
*
* Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org>
* Code based on the TSC2101 ALSA driver.
*
* 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 OMAP_ALSA_TSC2102_H_
#define OMAP_ALSA_TSC2102_H_
/* Define to set the tsc as the master w.r.t McBSP */
#define TSC_MASTER
/*
* Audio related macros
*/
#ifndef DEFAULT_BITPERSAMPLE
#define DEFAULT_BITPERSAMPLE 16
#endif
#define DEFAULT_SAMPLE_RATE 44100
/* FIXME codec clock rate is board-specific */
#define CODEC_CLOCK 12000000
/*
* ALSA mixer related macros
*/
#define OUTPUT_VOLUME_MIN 0x7f /* 1111111 = -63.5 dB */
#define OUTPUT_VOLUME_MAX 0x00 /* 0000000 */
#define OUTPUT_VOLUME_RANGE (OUTPUT_VOLUME_MIN - OUTPUT_VOLUME_MAX)
#define DEFAULT_OUTPUT_VOLUME 90 /* Default output volume */
#endif /* OMAP_ALSA_TSC2102_H_ */
This diff is collapsed.
......@@ -7,10 +7,6 @@
obj-$(CONFIG_SOUND_OSS) += sound.o
obj-$(CONFIG_SOUND_OMAP) += omap-audio-dma-intfc.o omap-audio.o
obj-$(CONFIG_SOUND_OMAP_TSC2101)+= omap-audio-tsc2101.o
obj-$(CONFIG_SOUND_OMAP_AIC23) += omap-audio-aic23.o
# Please leave it as is, cause the link order is significant !
obj-$(CONFIG_SOUND_SH_DAC_AUDIO) += sh_dac_audio.o
......
This diff is collapsed.
This diff is collapsed.
/*
* linux/sound/oss/omap-audio-dma-intfc.h
*
* Common audio DMA handling for the OMAP processors
*
* Copyright (C) 2004 Texas Instruments, Inc.
*
* Copyright (C) 2000, 2001 Nicolas Pitre <nico@cam.org>
*
* This package 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.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* History:
*
* 2004/08/12 Nishanth Menon - Modified to integrate Audio requirements on 1610,1710 platforms
*/
#ifndef __OMAP_AUDIO_DMA_INTFC_H
#define __OMAP_AUDIO_DMA_INTFC_H
/************************** INCLUDES *************************************/
/* Requires omap-audio.h */
#include "omap-audio.h"
/************************** GLOBAL MACROS *************************************/
/* Provide the Macro interfaces common across platforms */
#define DMA_REQUEST(e,s, cb) {e=omap_request_sound_dma(s->dma_dev, s->id, s, &s->lch);}
#define DMA_FREE(s) omap_free_sound_dma(s, &s->lch)
#define DMA_CLEAR(s) omap_clear_sound_dma(s)
/************************** GLOBAL DATA STRUCTURES *********************************/
typedef void (*dma_callback_t) (int lch, u16 ch_status, void *data);
/************************** GLOBAL FUNCTIONS ***************************************/
dma_callback_t audio_get_dma_callback(void);
int audio_setup_buf(audio_stream_t * s);
int audio_process_dma(audio_stream_t * s);
void audio_prime_rx(audio_state_t * state);
int audio_set_fragments(audio_stream_t * s, int val);
int audio_sync(struct file *file);
void audio_stop_dma(audio_stream_t * s);
u_int audio_get_dma_pos(audio_stream_t * s);
void audio_reset(audio_stream_t * s);
void audio_discard_buf(audio_stream_t * s);
/**************** ARCH SPECIFIC FUNCIONS *******************************************/
void omap_clear_sound_dma(audio_stream_t * s);
int omap_request_sound_dma(int device_id, const char *device_name, void *data,
int **channels);
int omap_free_sound_dma(void *data, int **channels);
#endif /* #ifndef __OMAP_AUDIO_DMA_INTFC_H */
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