-
-#ifdef VIA_PROC_FS
-
-/****************************************************************
- *
- * /proc/driver/via/info
- *
- *
- */
-
-static int via_info_read_proc (char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
-#define YN(val,bit) (((val) & (bit)) ? "yes" : "no")
-#define ED(val,bit) (((val) & (bit)) ? "enable" : "disable")
-
- int len = 0;
- u8 r40, r41, r42, r44;
- struct via_info *card = data;
-
- DPRINTK ("ENTER\n");
-
- assert (card != NULL);
-
- len += sprintf (page+len, VIA_CARD_NAME "\n\n");
-
- pci_read_config_byte (card->pdev, 0x40, &r40);
- pci_read_config_byte (card->pdev, 0x41, &r41);
- pci_read_config_byte (card->pdev, 0x42, &r42);
- pci_read_config_byte (card->pdev, 0x44, &r44);
-
- len += sprintf (page+len,
- "Via 82Cxxx PCI registers:\n"
- "\n"
- "40 Codec Ready: %s\n"
- " Codec Low-power: %s\n"
- " Secondary Codec Ready: %s\n"
- "\n"
- "41 Interface Enable: %s\n"
- " De-Assert Reset: %s\n"
- " Force SYNC high: %s\n"
- " Force SDO high: %s\n"
- " Variable Sample Rate On-Demand Mode: %s\n"
- " SGD Read Channel PCM Data Out: %s\n"
- " FM Channel PCM Data Out: %s\n"
- " SB PCM Data Out: %s\n"
- "\n"
- "42 Game port enabled: %s\n"
- " SoundBlaster enabled: %s\n"
- " FM enabled: %s\n"
- " MIDI enabled: %s\n"
- "\n"
- "44 AC-Link Interface Access: %s\n"
- " Secondary Codec Support: %s\n"
-
- "\n",
-
- YN (r40, VIA_CR40_AC97_READY),
- YN (r40, VIA_CR40_AC97_LOW_POWER),
- YN (r40, VIA_CR40_SECONDARY_READY),
-
- ED (r41, VIA_CR41_AC97_ENABLE),
- YN (r41, (1 << 6)),
- YN (r41, (1 << 5)),
- YN (r41, (1 << 4)),
- ED (r41, (1 << 3)),
- ED (r41, (1 << 2)),
- ED (r41, (1 << 1)),
- ED (r41, (1 << 0)),
-
- YN (r42, VIA_CR42_GAME_ENABLE),
- YN (r42, VIA_CR42_SB_ENABLE),
- YN (r42, VIA_CR42_FM_ENABLE),
- YN (r42, VIA_CR42_MIDI_ENABLE),
-
- YN (r44, VIA_CR44_AC_LINK_ACCESS),
- YN (r44, VIA_CR44_SECOND_CODEC_SUPPORT)
-
- );
-
- DPRINTK ("EXIT, returning %d\n", len);
- return len;
-
-#undef YN
-#undef ED
-}
-
-
-/****************************************************************
- *
- * /proc/driver/via/... setup and cleanup
- *
- *
- */
-
-static int __init via_init_proc (void)
-{
- DPRINTK ("ENTER\n");
-
- if (!proc_mkdir ("driver/via", 0))
- return -EIO;
-
- DPRINTK ("EXIT, returning 0\n");
- return 0;
-}
-
-
-static void via_cleanup_proc (void)
-{
- DPRINTK ("ENTER\n");
-
- remove_proc_entry ("driver/via", NULL);
-
- DPRINTK ("EXIT\n");
-}
-
-
-static int __devinit via_card_init_proc (struct via_info *card)
-{
- char s[32];
- int rc;
-
- DPRINTK ("ENTER\n");
-
- sprintf (s, "driver/via/%d", card->card_num);
- if (!proc_mkdir (s, 0)) {
- rc = -EIO;
- goto err_out_none;
- }
-
- sprintf (s, "driver/via/%d/info", card->card_num);
- if (!create_proc_read_entry (s, 0, 0, via_info_read_proc, card)) {
- rc = -EIO;
- goto err_out_dir;
- }
-
- sprintf (s, "driver/via/%d/ac97", card->card_num);
- if (!create_proc_read_entry (s, 0, 0, ac97_read_proc, card->ac97)) {
- rc = -EIO;
- goto err_out_info;
- }
-
- DPRINTK ("EXIT, returning 0\n");
- return 0;
-
-err_out_info:
- sprintf (s, "driver/via/%d/info", card->card_num);
- remove_proc_entry (s, NULL);
-
-err_out_dir:
- sprintf (s, "driver/via/%d", card->card_num);
- remove_proc_entry (s, NULL);
-
-err_out_none:
- DPRINTK ("EXIT, returning %d\n", rc);
- return rc;
-}
-
-
-static void via_card_cleanup_proc (struct via_info *card)
-{
- char s[32];
-
- DPRINTK ("ENTER\n");
-
- sprintf (s, "driver/via/%d/ac97", card->card_num);
- remove_proc_entry (s, NULL);
-
- sprintf (s, "driver/via/%d/info", card->card_num);
- remove_proc_entry (s, NULL);
-
- sprintf (s, "driver/via/%d", card->card_num);
- remove_proc_entry (s, NULL);
-
- DPRINTK ("EXIT\n");
-}
-
-#endif /* VIA_PROC_FS */