Skip to content

Commit

Permalink
ALSA: wss_lib: use wss detection code instead of ad1848 one
Browse files Browse the repository at this point in the history
Use the wss detection code and kill the ad1848 library.
The library is fully assimilated into the new wss library.

This required reworking of the AD1848 family code
so the code is changed to correctly detect chips from
the AD1848 and CS4231 families.

I have tested it on following cards:
Gallant SC-6600 (codec: AD1848, driver: snd-sc6600)
SoundScape VIVO/90 (codec: AD1845, driver: snd-sscape)
SG Waverider (codec: CS4231A, driver: Rene Herman's snd-galaxy)
Opti930 (codec: built-in - CS4231 compatible, driver: snd-opti93x)
Opti931 (codec: built-in - CS4231 compatible, driver: snd-opti93x)
Gallant SC-70P (chip/codec: CS4237B, driver: snd-cs4236)
Audio Plus 3D (chip/codec: CMI8330A, driver: snd-cmi8330)
Dell Latitude CP (chip/codec: cs4236, driver snd-cs4232)

Sound playback and recording works on all these cards.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Reviewed-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
Krzysztof Helt authored and Jaroslav Kysela committed Aug 6, 2008
1 parent ead893c commit 760fc6b
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 678 deletions.
111 changes: 0 additions & 111 deletions include/sound/ad1848.h
Original file line number Diff line number Diff line change
@@ -1,111 +0,0 @@
#ifndef __SOUND_AD1848_H
#define __SOUND_AD1848_H

/*
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>
* Definitions for AD1847/AD1848/CS4248 chips
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#include "pcm.h"
#include <linux/interrupt.h>

#include "wss.h" /* temporary till the driver is removed */

/* codec registers */

#define AD1848_LEFT_INPUT 0x00 /* left input control */
#define AD1848_RIGHT_INPUT 0x01 /* right input control */
#define AD1848_AUX1_LEFT_INPUT 0x02 /* left AUX1 input control */
#define AD1848_AUX1_RIGHT_INPUT 0x03 /* right AUX1 input control */
#define AD1848_AUX2_LEFT_INPUT 0x04 /* left AUX2 input control */
#define AD1848_AUX2_RIGHT_INPUT 0x05 /* right AUX2 input control */
#define AD1848_LEFT_OUTPUT 0x06 /* left output control register */
#define AD1848_RIGHT_OUTPUT 0x07 /* right output control register */
#define AD1848_DATA_FORMAT 0x08 /* clock and data format - playback/capture - bits 7-0 MCE */
#define AD1848_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */
#define AD1848_PIN_CTRL 0x0a /* pin control */
#define AD1848_TEST_INIT 0x0b /* test and initialization */
#define AD1848_MISC_INFO 0x0c /* miscellaneous information */
#define AD1848_LOOPBACK 0x0d /* loopback control */
#define AD1848_DATA_UPR_CNT 0x0e /* playback/capture upper base count */
#define AD1848_DATA_LWR_CNT 0x0f /* playback/capture lower base count */

/* definitions for codec register select port - CODECP( REGSEL ) */

#define AD1848_INIT 0x80 /* CODEC is initializing */
#define AD1848_MCE 0x40 /* mode change enable */
#define AD1848_TRD 0x20 /* transfer request disable */

/* definitions for codec status register - CODECP( STATUS ) */

#define AD1848_GLOBALIRQ 0x01 /* IRQ is active */

/* definitions for AD1848_LEFT_INPUT and AD1848_RIGHT_INPUT registers */

#define AD1848_ENABLE_MIC_GAIN 0x20

#define AD1848_MIXS_LINE1 0x00
#define AD1848_MIXS_AUX1 0x40
#define AD1848_MIXS_LINE2 0x80
#define AD1848_MIXS_ALL 0xc0

/* definitions for clock and data format register - AD1848_PLAYBK_FORMAT */

#define AD1848_LINEAR_8 0x00 /* 8-bit unsigned data */
#define AD1848_ALAW_8 0x60 /* 8-bit A-law companded */
#define AD1848_ULAW_8 0x20 /* 8-bit U-law companded */
#define AD1848_LINEAR_16 0x40 /* 16-bit twos complement data - little endian */
#define AD1848_STEREO 0x10 /* stereo mode */
/* bits 3-1 define frequency divisor */
#define AD1848_XTAL1 0x00 /* 24.576 crystal */
#define AD1848_XTAL2 0x01 /* 16.9344 crystal */

/* definitions for interface control register - AD1848_IFACE_CTRL */

#define AD1848_CAPTURE_PIO 0x80 /* capture PIO enable */
#define AD1848_PLAYBACK_PIO 0x40 /* playback PIO enable */
#define AD1848_CALIB_MODE 0x18 /* calibration mode bits */
#define AD1848_AUTOCALIB 0x08 /* auto calibrate */
#define AD1848_SINGLE_DMA 0x04 /* use single DMA channel */
#define AD1848_CAPTURE_ENABLE 0x02 /* capture enable */
#define AD1848_PLAYBACK_ENABLE 0x01 /* playback enable */

/* definitions for pin control register - AD1848_PIN_CTRL */

#define AD1848_IRQ_ENABLE 0x02 /* enable IRQ */
#define AD1848_XCTL1 0x40 /* external control #1 */
#define AD1848_XCTL0 0x80 /* external control #0 */

/* definitions for test and init register - AD1848_TEST_INIT */

#define AD1848_CALIB_IN_PROGRESS 0x20 /* auto calibrate in progress */
#define AD1848_DMA_REQUEST 0x10 /* DMA request in progress */

/* exported functions */

void snd_ad1848_out(struct snd_wss *chip, unsigned char reg,
unsigned char value);

int snd_ad1848_create(struct snd_card *card,
unsigned long port,
int irq, int dma,
unsigned short hardware,
struct snd_wss **chip);

#endif /* __SOUND_AD1848_H */
15 changes: 5 additions & 10 deletions sound/isa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ config SND_WSS_LIB
tristate
select SND_PCM

config SND_AD1848_LIB
tristate
select SND_PCM
select SND_WSS_LIB

config SND_SB_COMMON
tristate

Expand Down Expand Up @@ -56,7 +51,7 @@ config SND_AD1816A

config SND_AD1848
tristate "Generic AD1848/CS4248 driver"
select SND_AD1848_LIB
select SND_WSS_LIB
help
Say Y here to include support for AD1848 (Analog Devices) or
CS4248 (Cirrus Logic - Crystal Semiconductors) chips.
Expand Down Expand Up @@ -97,7 +92,7 @@ config SND_AZT2320

config SND_CMI8330
tristate "C-Media CMI8330"
select SND_AD1848_LIB
select SND_WSS_LIB
select SND_SB16_DSP
help
Say Y here to include support for soundcards based on the
Expand Down Expand Up @@ -193,7 +188,7 @@ config SND_ES18XX
config SND_SC6000
tristate "Gallant SC-6000, Audio Excel DSP 16"
depends on HAS_IOPORT
select SND_AD1848_LIB
select SND_WSS_LIB
select SND_OPL3_LIB
select SND_MPU401_UART
help
Expand Down Expand Up @@ -280,7 +275,7 @@ config SND_OPTI92X_AD1848
select SND_OPL3_LIB
select SND_OPL4_LIB
select SND_MPU401_UART
select SND_AD1848_LIB
select SND_WSS_LIB
help
Say Y here to include support for soundcards based on Opti
82C92x or OTI-601 chips and using an AD1848 codec.
Expand Down Expand Up @@ -373,7 +368,7 @@ config SND_SB16_CSP

config SND_SGALAXY
tristate "Aztech Sound Galaxy"
select SND_AD1848_LIB
select SND_WSS_LIB
help
Say Y here to include support for Aztech Sound Galaxy
soundcards.
Expand Down
2 changes: 0 additions & 2 deletions sound/isa/ad1848/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
# Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
#

snd-ad1848-lib-objs := ad1848_lib.o
snd-ad1848-objs := ad1848.o

# Toplevel Module Dependency
obj-$(CONFIG_SND_AD1848) += snd-ad1848.o
obj-$(CONFIG_SND_AD1848_LIB) += snd-ad1848-lib.o

7 changes: 4 additions & 3 deletions sound/isa/ad1848/ad1848.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <linux/wait.h>
#include <linux/moduleparam.h>
#include <sound/core.h>
#include <sound/ad1848.h>
#include <sound/wss.h>
#include <sound/initval.h>

#define CRD_NAME "Generic AD1848/AD1847/CS4248"
Expand Down Expand Up @@ -95,8 +95,9 @@ static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n)
if (!card)
return -EINVAL;

error = snd_ad1848_create(card, port[n], irq[n], dma1[n],
thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT, &chip);
error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1,
thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT,
0, &chip);
if (error < 0)
goto out;

Expand Down
Loading

0 comments on commit 760fc6b

Please sign in to comment.