From: John Paul Lorenti <jpl31@columbia.edu>
To: alsa-devel@lists.sourceforge.net
Subject: Patch to get ali5451 to work on the Sharp MM10
Date: Sun, 18 May 2003 06:53:57 -0400 [thread overview]
Message-ID: <3EC76645.2010303@columbia.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
I have a Sharp MM10 laptop and it freezes when I try to load the ali5451
driver. After no solutions were found on alsa-user, I spent some time
hacking the driver, and found that commenting out the spdif support
stopped the freezing without losing any functionality. The laptop has no
jacks to take advantage of spdif. Attached is a quick and dirty patch
against alsa-driver-0.9.3a/alsa-kernel/pci/ali5451/ali5451.c from
alsa-driver-0.9.3a.tar.bz2 which makes the driver run perfectly for me.
Maybe one of the developers can clean it up and make some load time
option out of it.
John Paul
[-- Attachment #2: ali5451_patch --]
[-- Type: text/plain, Size: 4570 bytes --]
--- ali5451.c 2003-05-18 06:23:21.000000000 -0400
+++ ali5451_terse.c 2003-05-18 06:17:18.000000000 -0400
@@ -673,10 +673,11 @@
// recording
if (rec) {
- if (inl(ALI_REG(codec, ALI_GLOBAL_CONTROL)) & (1<<11) &&
+ /*JPL SPDIF if (inl(ALI_REG(codec, ALI_GLOBAL_CONTROL)) & (1<<11) &&
( codec->revision == ALI_5451_V02 ))
idx = ALI_SPDIF_IN_CHANNEL;
else
+ JPL SPDIF */
idx = ALI_PCM_IN_CHANNEL;
if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0) {
@@ -688,6 +689,7 @@
}
//playback...
+ /* JPL SPDIF
if (inl(ALI_REG(codec, ALI_GLOBAL_CONTROL)) & (1<<15)) {
idx = ALI_SPDIF_OUT_CHANNEL;
if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0) {
@@ -696,7 +698,7 @@
snd_printk("ali_find_free_channel: S/PDIF out channel is in busy now.\n");
}
}
-
+ JPL SPDIF */
for (idx = 0; idx < ALI_CHANNELS; idx++) {
if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0)
return result;
@@ -748,6 +750,9 @@
static void snd_ali_delay(ali_t *codec,int interval)
{
unsigned long begintimer,currenttimer;
+ printk("In snd_ali_delay\n");
+ /*
+
begintimer = inl(ALI_REG(codec, ALI_STIMER));
currenttimer = inl(ALI_REG(codec, ALI_STIMER));
@@ -757,6 +762,7 @@
break;
currenttimer = inl(ALI_REG(codec, ALI_STIMER));
}
+ */
}
static void snd_ali_detect_spdif_rate(ali_t *codec)
@@ -764,6 +770,9 @@
u16 wval = 0;
u16 count = 0;
u8 bval = 0, R1 = 0, R2 = 0;
+ printk("In snd_ali_detect_spdif_rate\n");
+ /*
+
bval = inb(ALI_REG(codec,ALI_SPDIF_CTRL + 1));
bval |= 0x1F;
@@ -811,12 +820,15 @@
bval = inb(ALI_REG(codec,ALI_SPDIF_CS +3)) & 0xF0;
outb(bval|0x03,ALI_REG(codec,ALI_SPDIF_CS + 3));
}
+ */
}
static unsigned int snd_ali_get_spdif_in_rate(ali_t *codec)
{
u32 dwRate = 0;
u8 bval = 0;
+ printk("In snd_ali_get_spdif_in_rate\n");
+ /*
bval = inb(ALI_REG(codec,ALI_SPDIF_CTRL));
bval &= 0x7F;
@@ -827,7 +839,7 @@
bval = inb(ALI_REG(codec,ALI_SPDIF_CS + 3));
bval &= 0x0F;
-
+ */
if (bval == 0) dwRate = 44100;
if (bval == 1) dwRate = 48000;
if (bval == 2) dwRate = 32000;
@@ -838,6 +850,8 @@
static void snd_ali_enable_spdif_in(ali_t *codec)
{
unsigned int dwVal;
+ printk("In snd_ali_enable_spdif_in\n");
+ /*
dwVal = inl(ALI_REG(codec, ALI_GLOBAL_CONTROL));
dwVal |= 1<<11;
@@ -848,6 +862,7 @@
outb(dwVal, ALI_REG(codec, ALI_SPDIF_CTRL));
snd_ali_enable_special_channel(codec, ALI_SPDIF_IN_CHANNEL);
+ */
}
static void snd_ali_disable_spdif_in(ali_t *codec)
@@ -866,7 +881,8 @@
{
unsigned char bVal;
unsigned int dwRate = 0;
-
+ printk("In snd_ali_set_spdif_out_rate\n");
+ /*
if (rate == 32000) dwRate = 0x300;
if (rate == 44100) dwRate = 0;
if (rate == 48000) dwRate = 0x200;
@@ -881,6 +897,7 @@
bVal &= (~0x80); //select left
outb(bVal, ALI_REG(codec, ALI_SPDIF_CTRL));
outw(rate | 0x10, ALI_REG(codec, ALI_SPDIF_CS + 2));
+ */
}
static void snd_ali_enable_spdif_out(ali_t *codec)
@@ -1756,6 +1773,10 @@
unsigned long flags;
ali_t *codec = snd_magic_cast(ali_t, kcontrol->private_data, -ENXIO);
unsigned int enable;
+ printk("In snd_ali5451_spdif_get\n");
+
+ /*
+
enable = ucontrol->value.integer.value[0] ? 1 : 0;
@@ -1775,12 +1796,18 @@
}
ucontrol->value.integer.value[0] = enable;
spin_unlock_irqrestore(&codec->reg_lock, flags);
+ */
return 0;
}
static int snd_ali5451_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
{
unsigned long flags;
+ printk("In snd_ali5451_spdif_put\n");
+ return 0;
+ /*
+
+
ali_t *codec = snd_magic_cast(ali_t, kcontrol->private_data, -ENXIO);
unsigned int change = 0, enable = 0;
@@ -1834,6 +1861,7 @@
spin_unlock_irqrestore(&codec->reg_lock, flags);
return change;
+ */
}
static snd_kcontrol_new_t snd_ali5451_mixer_spdif[] __devinitdata = {
@@ -1867,12 +1895,14 @@
snd_printk("ali mixer creating error.\n");
return err;
}
+ /* JPL SPDIF
if (codec->revision == ALI_5451_V02) {
for(idx = 0; idx < ARRAY_SIZE(snd_ali5451_mixer_spdif); idx++) {
err=snd_ctl_add(codec->card, snd_ctl_new1(&snd_ali5451_mixer_spdif[idx], codec));
if (err < 0) return err;
}
}
+ */
return 0;
}
@@ -2039,11 +2069,12 @@
codec->ac97_ext_id = snd_ali_codec_peek(codec, 0, AC97_EXTENDED_ID);
codec->ac97_ext_status = snd_ali_codec_peek(codec, 0, AC97_EXTENDED_STATUS);
+ /* JPL SPDIF
if (codec->revision == ALI_5451_V02) {
snd_ali_enable_spdif_out(codec);
codec->spdif_mask = 0x00000002;
}
-
+ */
snd_ali_printk("chip initialize succeed.\n");
return 0;
next reply other threads:[~2003-05-18 10:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-18 10:53 John Paul Lorenti [this message]
2003-05-19 11:28 ` Patch to get ali5451 to work on the Sharp MM10 Takashi Iwai
2003-05-20 2:41 ` John Paul Lorenti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3EC76645.2010303@columbia.edu \
--to=jpl31@columbia.edu \
--cc=alsa-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.