From: salvador <salvador@inti.gov.ar>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Marcelo Tosatti <marcelo@conectiva.com.br>,
Linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH][RFCA] Sound: adding /proc/driver/{vendor}/{dev_pci}/ac97 entry for trident driver
Date: Wed, 09 Jan 2002 12:51:44 -0300 [thread overview]
Message-ID: <3C3C6710.94FFF61A@inti.gov.ar> (raw)
Kernel: 2.4.17
Hardware: ALiM5451+ALC100P
Module: sound/trident.c
The following patch adds a proc entry to fetch information about the codec
attached to the audio "accelerator".
Note: Most of the code is already in ac97_codec.c module.
Doubts:
1) This adds something like: /proc/driver/ali5451/00:03.00/ac97 I took the
idea from emu10k1.c module. My doubt is about the `:' it looks wrong in a
file name, specially when that's usually used to separate file names/paths.
Should we pass it by a small routine that converts : into something like _?
2) I used a buffer of fixed length as in other modules, but I don't feel
really good doing it. What solutions are recommended? (if any)
--- linux-2.4.17.ori/drivers/sound/trident.c Tue Nov 13 14:19:41 2001
+++ linux-2.4.17/drivers/sound/trident.c Tue Jan 8 21:41:05 2002
@@ -36,6 +36,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* History
+ * v0.14.9e
+ * January 8 2002 Salvador E. Tropea (SET) <salvador@inti.gov.ar>
+ * added a /proc/driver/{vendor}/{card}/ac97 entry
* v0.14.9d
* October 8 2001 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* use set_current_state, properly release resources on failure in
@@ -3829,8 +3832,8 @@
unsigned long ready_2nd = 0;
struct ac97_codec *codec;
int i = 0;
+ char proc_str[80], *name="unknown";
-
/* initialize controller side of AC link, and find out if secondary
codes
really exist */
switch (card->pci_id)
@@ -3853,6 +3856,7 @@
ready_2nd &= SI_AC97_SECONDARY_READY;
if (card->revision < ALI_5451_V02)
ready_2nd = 0;
+ name = "ali5451";
break;
case PCI_DEVICE_ID_SI_7018:
/* disable AC97 GPIO interrupt */
@@ -3865,16 +3869,19 @@
udelay(2000);
ready_2nd = inl(TRID_REG(card, SI_SERIAL_INTF_CTRL));
ready_2nd &= SI_AC97_SECONDARY_READY;
+ name = "sis7018";
break;
case PCI_DEVICE_ID_TRIDENT_4DWAVE_DX:
/* playback on */
outl(DX_AC97_PLAYBACK, TRID_REG(card,
DX_ACR2_AC97_COM_STAT));
+ name = "trident4D_DX";
break;
case PCI_DEVICE_ID_TRIDENT_4DWAVE_NX:
/* enable AC97 Output Slot 3,4 (PCM Left/Right Playback) */
outl(NX_AC97_PCM_OUTPUT, TRID_REG(card,
NX_ACR0_AC97_COM_STAT));
ready_2nd = inl(TRID_REG(card, NX_ACR0_AC97_COM_STAT));
ready_2nd &= NX_AC97_SECONDARY_READY;
+ name = "trident4D_NX";
break;
case PCI_DEVICE_ID_INTERG_5050:
/* disable AC97 GPIO interrupt */
@@ -3887,6 +3894,7 @@
udelay(2000);
ready_2nd = inl(TRID_REG(card, SI_SERIAL_INTF_CTRL));
ready_2nd &= SI_AC97_SECONDARY_READY;
+ name = "cyber5050";
break;
}
@@ -3919,6 +3927,16 @@
}
card->ac97_codec[num_ac97] = codec;
+
+ /* Create a proc entry to inform about the codec facilities
*/
+ sprintf(proc_str, "driver/%s", name);
+ if (proc_mkdir (proc_str, 0)) {
+ sprintf(proc_str, "driver/%s/%s", name,
card->pci_dev->slot_name);
+ if (proc_mkdir (proc_str, 0)) {
+ sprintf(proc_str, "driver/%s/%s/ac97", name,
card->pci_dev->slot_name);
+ create_proc_read_entry (proc_str, 0, 0,
ac97_read_proc, codec);
+ }
+ }
/* if there is no secondary codec at all, don't probe any
more */
if (!ready_2nd)
<---------End of patch
--
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Visit my home page: http://welcome.to/SetSoft or
http://www.geocities.com/SiliconValley/Vista/6552/
Alternative e-mail: set@computer.org set@ieee.org
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013
next reply other threads:[~2002-01-09 15:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-09 15:51 salvador [this message]
2002-01-09 16:19 ` [PATCH][RFCA] Sound: adding /proc/driver/{vendor}/{dev_pci}/ac97 entry Alan Cox
2002-01-09 17:40 ` salvador
2002-01-10 2:23 ` [PATCH][RFCA] Sound: adding /proc/driver/{vendor}/{dev_pci}/ac97 Alan Cox
2002-01-11 15:25 ` salvador
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=3C3C6710.94FFF61A@inti.gov.ar \
--to=salvador@inti.gov.ar \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox