/*1* ALSA driver for ICEnsemble VT1724 (Envy24HT)2*3* Lowlevel functions for Advanced Micro Peripherals Ltd AUDIO20004*5* Copyright (c) 2000 Jaroslav Kysela <[email protected]>6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation; either version 2 of the License, or10* (at your option) any later version.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this program; if not, write to the Free Software19* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20*21*/2223#include <asm/io.h>24#include <linux/delay.h>25#include <linux/interrupt.h>26#include <linux/init.h>27#include <sound/core.h>2829#include "ice1712.h"30#include "envy24ht.h"31#include "amp.h"3233static void wm_put(struct snd_ice1712 *ice, int reg, unsigned short val)34{35unsigned short cval;36cval = (reg << 9) | val;37snd_vt1724_write_i2c(ice, WM_DEV, cval >> 8, cval & 0xff);38}3940static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice)41{42static const unsigned short wm_inits[] = {43WM_ATTEN_L, 0x0000, /* 0 db */44WM_ATTEN_R, 0x0000, /* 0 db */45WM_DAC_CTRL, 0x0008, /* 24bit I2S */46WM_INT_CTRL, 0x0001, /* 24bit I2S */47};4849unsigned int i;5051/* only use basic functionality for now */5253/* VT1616 6ch codec connected to PSDOUT0 using packed mode */54ice->num_total_dacs = 6;55ice->num_total_adcs = 2;5657/* Chaintech AV-710 has another WM8728 codec connected to PSDOUT458(shared with the SPDIF output). Mixer control for this codec59is not yet supported. */60if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AV710) {61for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2)62wm_put(ice, wm_inits[i], wm_inits[i+1]);63}6465return 0;66}6768static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice)69{70/* we use pins 39 and 41 of the VT1616 for left and right read outputs */71snd_ac97_write_cache(ice->ac97, 0x5a, snd_ac97_read(ice->ac97, 0x5a) & ~0x8000);72return 0;73}747576/* entry point */77struct snd_ice1712_card_info snd_vt1724_amp_cards[] __devinitdata = {78{79.subvendor = VT1724_SUBDEVICE_AV710,80.name = "Chaintech AV-710",81.model = "av710",82.chip_init = snd_vt1724_amp_init,83.build_controls = snd_vt1724_amp_add_controls,84},85{86.subvendor = VT1724_SUBDEVICE_AUDIO2000,87.name = "AMP Ltd AUDIO2000",88.model = "amp2000",89.chip_init = snd_vt1724_amp_init,90.build_controls = snd_vt1724_amp_add_controls,91},92{ } /* terminator */93};94959697