Commit e8158535 authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Added ICE1724 - ESI Juli@ code (not complete) + AK4114 code + AK4358

Serial BUS drivers,AK4114 receiver,AK4XXX AD/DA converters
ICE1712 driver,ICE1724 driver
Initial incomplete driver for ESI Juli@ cardcards based on ICE1724, AK4114,
AK4358 and AK5385. The ICE1724 and ICE1712 main files plus some drivers are
also updated (cleanups and new callbacks).
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent f2e84c94
This diff is collapsed.
......@@ -50,7 +50,8 @@ struct snd_akm4xxx {
/* template should fill the following fields */
unsigned int idx_offset; /* control index offset */
enum {
SND_AK4524, SND_AK4528, SND_AK4529, SND_AK4355, SND_AK4381
SND_AK4524, SND_AK4528, SND_AK4529,
SND_AK4355, SND_AK4358, SND_AK4381
} type;
struct snd_ak4xxx_ops ops;
};
......
......@@ -3,6 +3,7 @@
# Copyright (c) 2003 by Jaroslav Kysela <perex@suse.cz>
#
snd-ak4114-objs := ak4114.o
snd-ak4117-objs := ak4117.o
snd-ak4xxx-adda-objs := ak4xxx-adda.o
snd-tea575x-tuner-objs := tea575x-tuner.o
......@@ -11,4 +12,5 @@ snd-tea575x-tuner-objs := tea575x-tuner.o
obj-$(CONFIG_SND_PDAUDIOCF) += snd-ak4117.o
obj-$(CONFIG_SND_ICE1712) += snd-ak4xxx-adda.o
obj-$(CONFIG_SND_ICE1724) += snd-ak4xxx-adda.o
obj-$(CONFIG_SND_ICE1724) += snd-ak4114.o
obj-$(CONFIG_SND_FM801_TEA575X) += snd-tea575x-tuner.o
This diff is collapsed.
/*
* ALSA driver for AK4524 / AK4528 / AK4529 / AK4355 / AK4381
* ALSA driver for AK4524 / AK4528 / AK4529 / AK4355 / AK4358 / AK4381
* AD and DA converters
*
* Copyright (c) 2000-2003 Jaroslav Kysela <perex@suse.cz>,
* Copyright (c) 2000-2004 Jaroslav Kysela <perex@suse.cz>,
* Takashi Iwai <tiwai@suse.de>
*
* This program is free software; you can redistribute it and/or modify
......@@ -84,6 +84,7 @@ void snd_akm4xxx_reset(akm4xxx_t *ak, int state)
/* FIXME: needed for ak4529? */
break;
case SND_AK4355:
case SND_AK4358:
if (state) {
snd_akm4xxx_write(ak, 0, 0x01, 0x02); /* reset and soft-mute */
return;
......@@ -166,6 +167,24 @@ void snd_akm4xxx_init(akm4xxx_t *ak)
0x01, 0x01, /* 1: un-reset, unmute */
0xff, 0xff
};
static unsigned char inits_ak4358[] = {
0x01, 0x02, /* 1: reset and soft-mute */
0x00, 0x06, /* 0: mode3(i2s), disable auto-clock detect, disable DZF, sharp roll-off, RSTN#=0 */
0x02, 0x0e, /* 2: DA's power up, normal speed, RSTN#=0 */
// 0x02, 0x2e, /* quad speed */
0x03, 0x01, /* 3: de-emphasis off */
0x04, 0x00, /* 4: LOUT1 volume muted */
0x05, 0x00, /* 5: ROUT1 volume muted */
0x06, 0x00, /* 6: LOUT2 volume muted */
0x07, 0x00, /* 7: ROUT2 volume muted */
0x08, 0x00, /* 8: LOUT3 volume muted */
0x09, 0x00, /* 9: ROUT3 volume muted */
0x0b, 0x00, /* b: LOUT4 volume muted */
0x0c, 0x00, /* c: ROUT4 volume muted */
0x0a, 0x00, /* a: DATT speed=0, ignore DZF */
0x01, 0x01, /* 1: un-reset, unmute */
0xff, 0xff
};
static unsigned char inits_ak4381[] = {
0x00, 0x0c, /* 0: mode3(i2s), disable auto-clock detect */
0x01, 0x02, /* 1: de-emphasis off, normal speed, sharp roll-off, DZF off */
......@@ -197,6 +216,10 @@ void snd_akm4xxx_init(akm4xxx_t *ak)
inits = inits_ak4355;
num_chips = 1;
break;
case SND_AK4358:
inits = inits_ak4358;
num_chips = 1;
break;
case SND_AK4381:
inits = inits_ak4381;
num_chips = ak->num_dacs / 2;
......@@ -370,6 +393,12 @@ int snd_akm4xxx_build_controls(akm4xxx_t *ak)
case SND_AK4355:
ctl.private_value = AK_COMPOSE(0, idx + 4, 0, 255); /* register 4-9, chip #0 only */
break;
case SND_AK4358:
if (idx >= 6)
ctl.private_value = AK_COMPOSE(0, idx + 5, 0, 255); /* register 4-9, chip #0 only */
else
ctl.private_value = AK_COMPOSE(0, idx + 4, 0, 255); /* register 4-9, chip #0 only */
break;
case SND_AK4381:
ctl.private_value = AK_COMPOSE(idx/2, (idx%2) + 3, 0, 255); /* register 3 & 4 */
break;
......@@ -407,7 +436,7 @@ int snd_akm4xxx_build_controls(akm4xxx_t *ak)
if ((err = snd_ctl_add(ak->card, snd_ctl_new(&ctl, SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE))) < 0)
return err;
}
if (ak->type == SND_AK4355)
if (ak->type == SND_AK4355 || ak->type == SND_AK4358)
num_emphs = 1;
else
num_emphs = ak->num_dacs / 2;
......@@ -432,6 +461,7 @@ int snd_akm4xxx_build_controls(akm4xxx_t *ak)
break;
}
case SND_AK4355:
case SND_AK4358:
ctl.private_value = AK_COMPOSE(idx, 3, 0, 0);
break;
case SND_AK4381:
......
......@@ -5,7 +5,7 @@
snd-ice17xx-ak4xxx-objs := ak4xxx.o
snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o
snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o
snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o juli.o
# Toplevel Module Dependency
obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o snd-ice17xx-ak4xxx.o
......
......@@ -126,12 +126,16 @@ int snd_ice1712_akm4xxx_init(akm4xxx_t *ak, const akm4xxx_t *temp,
{
struct snd_ak4xxx_private *priv;
priv = kmalloc(sizeof(*priv), GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
if (_priv != NULL) {
priv = kmalloc(sizeof(*priv), GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
*priv = *_priv;
} else {
priv = NULL;
}
*ak = *temp;
ak->card = ice->card;
*priv = *_priv;
ak->private_value[0] = (unsigned long)priv;
ak->private_data[0] = ice;
if (ak->ops.lock == NULL)
......
......@@ -106,7 +106,7 @@ enum {
#define VT1724_REG_I2C_BYTE_ADDR 0x11 /* byte */
#define VT1724_REG_I2C_DATA 0x12 /* byte */
#define VT1724_REG_I2C_CTRL 0x13 /* byte */
#define VT1724_I2C_EEPROM 0x80 /* EEPROM exists */
#define VT1724_I2C_EEPROM 0x80 /* 1 = EEPROM exists */
#define VT1724_I2C_BUSY 0x01 /* busy bit */
#define VT1724_REG_GPIO_DATA 0x14 /* word */
......
......@@ -1014,21 +1014,9 @@ static int snd_ice1712_pro_trigger(snd_pcm_substream_t *substream,
static void snd_ice1712_set_pro_rate(ice1712_t *ice, unsigned int rate, int force)
{
unsigned long flags;
unsigned char val;
unsigned char val, old;
unsigned int i;
spin_lock_irqsave(&ice->reg_lock, flags);
if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
ICE1712_PLAYBACK_PAUSE|
ICE1712_PLAYBACK_START)) {
spin_unlock_irqrestore(&ice->reg_lock, flags);
return;
}
if (!force && is_pro_rate_locked(ice)) {
spin_unlock_irqrestore(&ice->reg_lock, flags);
return;
}
switch (rate) {
case 8000: val = 6; break;
case 9600: val = 3; break;
......@@ -1049,8 +1037,22 @@ static void snd_ice1712_set_pro_rate(ice1712_t *ice, unsigned int rate, int forc
rate = 48000;
break;
}
outb(val, ICEMT(ice, RATE));
spin_lock_irqsave(&ice->reg_lock, flags);
if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW|
ICE1712_PLAYBACK_PAUSE|
ICE1712_PLAYBACK_START)) {
__out:
spin_unlock_irqrestore(&ice->reg_lock, flags);
return;
}
if (!force && is_pro_rate_locked(ice))
goto __out;
old = inb(ICEMT(ice, RATE));
if (!force && old == val)
goto __out;
outb(val, ICEMT(ice, RATE));
spin_unlock_irqrestore(&ice->reg_lock, flags);
if (ice->gpio.set_pro_rate)
......@@ -2405,6 +2407,7 @@ static int __devinit snd_ice1712_chip_init(ice1712_t *ice)
udelay(200);
snd_ice1712_write(ice, ICE1712_IREG_CONSUMER_POWERDOWN, 0);
}
snd_ice1712_set_pro_rate(ice, 48000, 1);
return 0;
}
......@@ -2545,6 +2548,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card,
ice->cs8427_timeout = cs8427_timeout;
spin_lock_init(&ice->reg_lock);
init_MUTEX(&ice->gpio_mutex);
init_MUTEX(&ice->i2c_mutex);
init_MUTEX(&ice->open_mutex);
ice->gpio.set_mask = snd_ice1712_set_gpio_mask;
ice->gpio.set_dir = snd_ice1712_set_gpio_dir;
......
......@@ -27,6 +27,7 @@
#include <sound/rawmidi.h>
#include <sound/i2c.h>
#include <sound/ak4xxx-adda.h>
#include <sound/ak4114.h>
#include <sound/pcm.h>
......@@ -340,6 +341,7 @@ struct _snd_ice1712 {
akm4xxx_t *akm;
struct snd_ice1712_spdif spdif;
struct semaphore i2c_mutex; /* I2C mutex for ICE1724 registers */
snd_i2c_bus_t *i2c; /* I2C bus */
snd_i2c_device_t *cs8427; /* CS8427 I2C device */
unsigned int cs8427_timeout; /* CS8427 reset timeout in HZ/100 */
......@@ -355,12 +357,13 @@ struct _snd_ice1712 {
unsigned int (*get_data)(ice1712_t *ice);
/* misc operators - move to another place? */
void (*set_pro_rate)(ice1712_t *ice, unsigned int rate);
void (*i2s_mclk_changed)(ice1712_t *ice);
} gpio;
struct semaphore gpio_mutex;
/* other board-specific data */
union {
/* additional i2c devices for EWS boards*/
/* additional i2c devices for EWS boards */
snd_i2c_device_t *i2cdevs[3];
/* AC97 register cache for Aureon */
struct aureon_spec {
......@@ -375,6 +378,10 @@ struct _snd_ice1712 {
unsigned int config;
unsigned short boxconfig[4];
} hoontech;
struct {
ak4114_t *ak4114;
unsigned int analog: 1;
} juli;
} spec;
};
......
......@@ -47,6 +47,7 @@
#include "vt1720_mobo.h"
#include "pontis.h"
#include "prodigy192.h"
#include "juli.h"
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
......@@ -59,6 +60,7 @@ MODULE_SUPPORTED_DEVICE("{"
VT1720_MOBO_DEVICE_DESC
PONTIS_DEVICE_DESC
PRODIGY192_DEVICE_DESC
JULI_DEVICE_DESC
"{VIA,VT1720},"
"{VIA,VT1724},"
"{ICEnsemble,Generic ICE1724},"
......@@ -401,23 +403,11 @@ static void snd_vt1724_set_pro_rate(ice1712_t *ice, unsigned int rate, int force
{
unsigned long flags;
unsigned char val, old;
unsigned int i;
unsigned int i, mclk_change;
if (rate > get_max_rate(ice))
return;
spin_lock_irqsave(&ice->reg_lock, flags);
if ((inb(ICEMT1724(ice, DMA_CONTROL)) & DMA_STARTS) ||
(inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) {
/* running? we cannot change the rate now... */
spin_unlock_irqrestore(&ice->reg_lock, flags);
return;
}
if (!force && is_pro_rate_locked(ice)) {
spin_unlock_irqrestore(&ice->reg_lock, flags);
return;
}
switch (rate) {
case 8000: val = 6; break;
case 9600: val = 3; break;
......@@ -439,8 +429,21 @@ static void snd_vt1724_set_pro_rate(ice1712_t *ice, unsigned int rate, int force
val = 0;
break;
}
spin_lock_irqsave(&ice->reg_lock, flags);
if ((inb(ICEMT1724(ice, DMA_CONTROL)) & DMA_STARTS) ||
(inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) {
/* running? we cannot change the rate now... */
spin_unlock_irqrestore(&ice->reg_lock, flags);
return;
}
if (!force && is_pro_rate_locked(ice)) {
spin_unlock_irqrestore(&ice->reg_lock, flags);
return;
}
old = inb(ICEMT1724(ice, RATE));
if (old != val)
if (force || old != val)
outb(val, ICEMT1724(ice, RATE));
else if (rate == ice->cur_rate) {
spin_unlock_irqrestore(&ice->reg_lock, flags);
......@@ -450,6 +453,7 @@ static void snd_vt1724_set_pro_rate(ice1712_t *ice, unsigned int rate, int force
ice->cur_rate = rate;
/* check MT02 */
mclk_change = 0;
if (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S) {
val = old = inb(ICEMT1724(ice, I2S_FORMAT));
if (rate > 96000)
......@@ -458,25 +462,23 @@ static void snd_vt1724_set_pro_rate(ice1712_t *ice, unsigned int rate, int force
val &= ~VT1724_MT_I2S_MCLK_128X; /* 256x MCLK */
if (val != old) {
outb(val, ICEMT1724(ice, I2S_FORMAT));
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_REVOLUTION71) {
/* FIXME: is this revo only? */
/* assert PRST# to converters; MT05 bit 7 */
outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
spin_unlock_irqrestore(&ice->reg_lock, flags);
mdelay(5);
spin_lock_irqsave(&ice->reg_lock, flags);
/* deassert PRST# */
outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
}
mclk_change = 1;
}
}
spin_unlock_irqrestore(&ice->reg_lock, flags);
if (mclk_change && ice->gpio.i2s_mclk_changed)
ice->gpio.i2s_mclk_changed(ice);
if (ice->gpio.set_pro_rate)
ice->gpio.set_pro_rate(ice, rate);
/* set up codecs */
for (i = 0; i < ice->akm_codecs; i++) {
if (ice->akm[i].ops.set_rate_val)
ice->akm[i].ops.set_rate_val(&ice->akm[i], rate);
}
if (ice->spdif.ops.setup_rate)
ice->spdif.ops.setup_rate(ice, rate);
}
static int snd_vt1724_pcm_hw_params(snd_pcm_substream_t * substream,
......@@ -1866,6 +1868,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
snd_vt1720_mobo_cards,
snd_vt1720_pontis_cards,
snd_vt1724_prodigy192_cards,
snd_vt1724_juli_cards,
NULL,
};
......@@ -1878,23 +1881,34 @@ static void wait_i2c_busy(ice1712_t *ice)
int t = 0x10000;
while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--)
;
if (t == -1)
printk(KERN_ERR "ice1724: i2c busy timeout\n");
}
unsigned char snd_vt1724_read_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr)
{
unsigned char val;
down(&ice->i2c_mutex);
outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
outb(dev & ~VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
wait_i2c_busy(ice);
return inb(ICEREG1724(ice, I2C_DATA));
val = inb(ICEREG1724(ice, I2C_DATA));
up(&ice->i2c_mutex);
//printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
return val;
}
void snd_vt1724_write_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr, unsigned char data)
{
down(&ice->i2c_mutex);
wait_i2c_busy(ice);
//printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
outb(data, ICEREG1724(ice, I2C_DATA));
outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
wait_i2c_busy(ice);
up(&ice->i2c_mutex);
}
static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelname)
......@@ -1906,7 +1920,8 @@ static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelnam
if (! modelname || ! *modelname) {
ice->eeprom.subvendor = 0;
if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) != 0)
ice->eeprom.subvendor = (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) |
ice->eeprom.subvendor =
(snd_vt1724_read_i2c(ice, dev, 0x00) << 0) |
(snd_vt1724_read_i2c(ice, dev, 0x01) << 8) |
(snd_vt1724_read_i2c(ice, dev, 0x02) << 16) |
(snd_vt1724_read_i2c(ice, dev, 0x03) << 24);
......@@ -2114,6 +2129,7 @@ static int __devinit snd_vt1724_create(snd_card_t * card,
spin_lock_init(&ice->reg_lock);
init_MUTEX(&ice->gpio_mutex);
init_MUTEX(&ice->open_mutex);
init_MUTEX(&ice->i2c_mutex);
ice->gpio.set_mask = snd_vt1724_set_gpio_mask;
ice->gpio.set_dir = snd_vt1724_set_gpio_dir;
ice->gpio.set_data = snd_vt1724_set_gpio_data;
......
/*
* ALSA driver for ICEnsemble VT1724 (Envy24HT)
*
* Lowlevel functions for ESI Juli@ cards
*
* Copyright (c) 2004 Jaroslav Kysela <perex@suse.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 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 <sound/driver.h>
#include <asm/io.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <sound/core.h>
#include "ice1712.h"
#include "envy24ht.h"
#include "juli.h"
/*
* chip addresses on I2C bus
*/
#define AK4114_ADDR 0x20 /* S/PDIF receiver */
#define AK4358_ADDR 0x22 /* DAC */
/*
* GPIO pins
*/
#define GPIO_FREQ_MASK (3<<0)
#define GPIO_FREQ_32KHZ (0<<0)
#define GPIO_FREQ_44KHZ (1<<0)
#define GPIO_FREQ_48KHZ (2<<0)
#define GPIO_MULTI_MASK (3<<2)
#define GPIO_MULTI_4X (0<<2)
#define GPIO_MULTI_2X (1<<2)
#define GPIO_MULTI_1X (2<<2) /* also external */
#define GPIO_MULTI_HALF (3<<2)
#define GPIO_INTERNAL_CLOCK (1<<4)
#define GPIO_ANALOG_PRESENT (1<<5) /* RO only: 0 = present */
#define GPIO_RXMCLK_SEL (1<<7) /* must be 0 */
#define GPIO_AK5385A_CKS0 (1<<8)
#define GPIO_AK5385A_DFS0 (1<<9) /* swapped with DFS1 according doc? */
#define GPIO_AK5385A_DFS1 (1<<10)
#define GPIO_DIGOUT_MONITOR (1<<11) /* 1 = active */
#define GPIO_DIGIN_MONITOR (1<<12) /* 1 = active */
#define GPIO_ANAIN_MONITOR (1<<13) /* 1 = active */
#define GPIO_AK5385A_MCLK (1<<14) /* must be 0 */
#define GPIO_MUTE_CONTROL (1<<15) /* 0 = off, 1 = on */
static void juli_ak4114_write(void *private_data, unsigned char reg, unsigned char val)
{
snd_vt1724_write_i2c((ice1712_t *)private_data, AK4114_ADDR, reg, val);
}
static unsigned char juli_ak4114_read(void *private_data, unsigned char reg)
{
return snd_vt1724_read_i2c((ice1712_t *)private_data, AK4114_ADDR, reg);
}
/*
* AK4358 section
*/
static void juli_akm_lock(akm4xxx_t *ak, int chip)
{
}
static void juli_akm_unlock(akm4xxx_t *ak, int chip)
{
}
static void juli_akm_write(akm4xxx_t *ak, int chip,
unsigned char addr, unsigned char data)
{
ice1712_t *ice = ak->private_data[0];
snd_assert(chip == 0, return);
snd_vt1724_write_i2c(ice, AK4358_ADDR, addr, data);
}
/*
* change the rate of envy24HT, AK4358
*/
static void juli_akm_set_rate_val(akm4xxx_t *ak, unsigned int rate)
{
unsigned char old, tmp, dfs;
if (rate == 0) /* no hint - S/PDIF input is master, simply return */
return;
/* adjust DFS on codecs */
if (rate > 96000)
dfs = 2;
else if (rate > 48000)
dfs = 1;
else
dfs = 0;
tmp = snd_akm4xxx_get(ak, 0, 2);
old = (tmp >> 4) & 0x03;
if (old == dfs)
return;
/* reset DFS */
snd_akm4xxx_reset(ak, 1);
tmp = snd_akm4xxx_get(ak, 0, 2);
tmp &= ~(0x03 << 4);
tmp |= dfs << 4;
snd_akm4xxx_set(ak, 0, 2, tmp);
snd_akm4xxx_reset(ak, 0);
}
static akm4xxx_t akm_juli_dac __devinitdata = {
.type = SND_AK4358,
.num_dacs = 2,
.ops = {
.lock = juli_akm_lock,
.unlock = juli_akm_unlock,
.write = juli_akm_write,
.set_rate_val = juli_akm_set_rate_val
}
};
static int __devinit juli_add_controls(ice1712_t *ice)
{
return snd_ice1712_akm4xxx_build_controls(ice);
}
/*
* initialize the chip
*/
static int __devinit juli_init(ice1712_t *ice)
{
static unsigned char ak4114_init_vals[] = {
/* AK4117_REG_PWRDN */ AK4114_RST | AK4114_PWN | AK4114_OCKS0 | AK4114_OCKS1,
/* AK4114_REQ_FORMAT */ AK4114_DIF_I24I2S,
/* AK4114_REG_IO0 */ AK4114_TX1E,
/* AK4114_REG_IO1 */ AK4114_EFH_1024 | AK4114_DIT | AK4114_IPS(1),
/* AK4114_REG_INT0_MASK */ 0,
/* AK4114_REG_INT1_MASK */ 0
};
static unsigned char ak4114_init_txcsb[] = {
0x41, 0x02, 0x2c, 0x00, 0x00
};
int err;
akm4xxx_t *ak;
#if 0
for (err = 0; err < 0x20; err++)
juli_ak4114_read(ice, err);
juli_ak4114_write(ice, 0, 0x0f);
juli_ak4114_read(ice, 0);
juli_ak4114_read(ice, 1);
#endif
err = snd_ak4114_create(ice->card,
juli_ak4114_read,
juli_ak4114_write,
ak4114_init_vals, ak4114_init_txcsb,
ice, &ice->spec.juli.ak4114);
if (err < 0)
return err;
ice->spec.juli.analog = ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT;
if (ice->spec.juli.analog) {
printk(KERN_INFO "juli@: analog I/O detected\n");
ice->num_total_dacs = 2;
ice->num_total_adcs = 2;
ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL);
if (! ak)
return -ENOMEM;
ice->akm_codecs = 1;
if ((err = snd_ice1712_akm4xxx_init(ak, &akm_juli_dac, NULL, ice)) < 0)
return err;
}
return 0;
}
/*
* Juli@ boards don't provide the EEPROM data except for the vendor IDs.
* hence the driver needs to sets up it properly.
*/
static unsigned char juli_eeprom[] __devinitdata = {
0x20, /* SYSCONF: clock 512, mpu401, 1xADC, 1xDACs */
0x80, /* ACLINK: I2S */
0xf8, /* I2S: vol, 96k, 24bit, 192k */
0xc3, /* SPDIF: out-en, out-int, spdif-in */
0x9f, /* GPIO_DIR */
0xff, /* GPIO_DIR1 */
0x7f, /* GPIO_DIR2 */
0x9f, /* GPIO_MASK */
0xff, /* GPIO_MASK1 */
0x7f, /* GPIO_MASK2 */
0x16, /* GPIO_STATE: internal clock, multiple 1x, 48kHz */
0x80, /* GPIO_STATE1: mute */
0x00, /* GPIO_STATE2 */
};
/* entry point */
struct snd_ice1712_card_info snd_vt1724_juli_cards[] __devinitdata = {
{
.subvendor = VT1724_SUBDEVICE_JULI,
.name = "ESI Juli@",
.model = "juli",
.chip_init = juli_init,
.build_controls = juli_add_controls,
.eeprom_size = sizeof(juli_eeprom),
.eeprom_data = juli_eeprom,
},
{ } /* terminator */
};
#ifndef __SOUND_JULI_H
#define __SOUND_JULI_H
#define JULI_DEVICE_DESC "{ESI,Juli@},"
#define VT1724_SUBDEVICE_JULI 0x31305345 /* Juli@ */
extern struct snd_ice1712_card_info snd_vt1724_juli_cards[];
#endif /* __SOUND_JULI_H */
......@@ -36,12 +36,12 @@
#include "prodigy192.h"
#include "stac946x.h"
static void stac9460_put(ice1712_t *ice, int reg, unsigned char val)
static inline void stac9460_put(ice1712_t *ice, int reg, unsigned char val)
{
snd_vt1724_write_i2c(ice, PRODIGY192_STAC9460_ADDR, reg, val);
}
static unsigned char stac9460_get(ice1712_t *ice, int reg)
static inline unsigned char stac9460_get(ice1712_t *ice, int reg)
{
return snd_vt1724_read_i2c(ice, PRODIGY192_STAC9460_ADDR, reg);
}
......
......@@ -33,6 +33,15 @@
#include "envy24ht.h"
#include "revo.h"
static void revo_i2s_mclk_changed(ice1712_t *ice)
{
/* assert PRST# to converters; MT05 bit 7 */
outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
mdelay(5);
/* deassert PRST# */
outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
}
/*
* change the rate of envy24HT, AK4355 and AK4381
*/
......@@ -135,6 +144,8 @@ static int __devinit revo_init(ice1712_t *ice)
return -EINVAL;
}
ice->gpio.i2s_mclk_changed = revo_i2s_mclk_changed;
/* second stage of initialization, analog parts and others */
ak = ice->akm = kcalloc(2, sizeof(akm4xxx_t), GFP_KERNEL);
if (! ak)
......
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