1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
/*
* Purpose: Low level routines for AC97 based Envy24HT boards (mainly Envy24-PT).
*/
/*
*
* This file is part of Open Sound System.
*
* Copyright (C) 4Front Technologies 1996-2008.
*
* This this source file is released under GPL v2 license (no other versions).
* See the COPYING file included in the main directory of this source
* distribution for the license terms and conditions.
*
*/
#include "oss_envy24ht_cfg.h"
#include "spdif.h"
#include "envy24ht.h"
#define AKM_ADDRESS 0x10
#if 0
# define PRT_STATUS(v) outb(v&0xff, 0x378)
#else
# define PRT_STATUS(v)
#endif
#if 0
static unsigned char
i2c_read (envy24ht_devc * devc, unsigned char addr, unsigned char pos)
{
int i;
unsigned char data;
oss_native_word flags;
MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags);
OUTB (devc->osdev, pos, devc->ccs_base + 0x11); /* Offset */
OUTB (devc->osdev, addr << 1, devc->ccs_base + 0x10); /* Read address */
for (i = 0; i < 2000; i++)
{
unsigned char status = INB (devc->osdev, devc->ccs_base + 0x13);
if (!(status & 1))
break;
}
oss_udelay (1);
data = INB (devc->osdev, devc->ccs_base + 0x12);
MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
return data;
}
static void
i2c_write (envy24ht_devc * devc, unsigned char addr, unsigned char pos,
unsigned char data)
{
int i;
oss_native_word flags;
MUTEX_ENTER_IRQDISABLE (devc->low_mutex, flags);
OUTB (devc->osdev, pos, devc->ccs_base + 0x11); /* Offset */
OUTB (devc->osdev, data, devc->ccs_base + 0x12); /* Data */
OUTB (devc->osdev, (addr << 1) | 1, devc->ccs_base + 0x10); /* Write address */
for (i = 0; i < 2000; i++)
{
unsigned char status = INB (devc->osdev, devc->ccs_base + 0x13);
if (!(status & 1))
break;
}
MUTEX_EXIT_IRQRESTORE (devc->low_mutex, flags);
}
#endif
/*ARGSUSED*/
static void
init_cs8415a (envy24ht_devc * devc)
{
}
/*ARGSUSED*/
static void
init_wm8728 (envy24ht_devc * devc)
{
#if 0
printk ("Regs=");
for (i = 0; i < 0x18; i++)
{
PRT_STATUS (2);
printk ("%02x ", i2c_read (devc, addr, i));
PRT_STATUS (0);
}
printk ("\n");
#endif
}
static void
ac97_card_init (envy24ht_devc * devc)
{
PRT_STATUS (0);
PRT_STATUS (0x01);
PRT_STATUS (0);
OUTW (devc->osdev, 0x000f, devc->ccs_base + 0x14); /* GPIO */
oss_udelay (1000);
devc->recsrc = 0;
init_cs8415a (devc);
init_wm8728 (devc);
}
/*ARGSUSED*/
static int
ac97_mixer_init (envy24ht_devc * devc, int dev, int group)
{
return 0;
}
#if 0
static int
ac97_private1 (envy24ht_devc * devc, int value)
{
i2c_write (devc, AKM_ADDRESS, (value >> 8) & 0xff, value & 0xff);
return 0;
}
#endif
envy24ht_auxdrv_t envy24ht_ac97_auxdrv = {
ac97_card_init,
ac97_mixer_init
};
|