Hi, Attached are several patches:
1) sven_hdaudio - add support for intel SCH. Posted earlier by Sven to the list - I just changed this to unified diff format. 2) oss_hdaudio - add some ids. 3) oss_audiopci - fix build. 4) oss_install - change copy make stage on Linux - 'cp -R' errors out if destination has dir symlinks on copied path. 5) osscore - document max_intrate=0 6) ossplay/ossrecord - allow fractional time in args for -S, -t options. Yours, Yair K.
diff -r a9a237ddd426 kernel/drv/oss_audiopci/oss_audiopci.c --- a/kernel/drv/oss_audiopci/oss_audiopci.c Tue Apr 19 09:31:02 2011 +0300 +++ b/kernel/drv/oss_audiopci/oss_audiopci.c Fri May 27 20:56:11 2011 +0300 @@ -37,7 +37,7 @@ /* Mixer parameters */ int *levels; - unsigned char ak_regs[0x19]; /* Current mixer register values */ + unsigned char ak_regs[0x20]; /* Current mixer register values */ int recdevs; int micbias, micboost; unsigned char outsw1, outsw2;
diff -r a9a237ddd426 kernel/drv/oss_hdaudio/hdaudio_codecids.h --- a/kernel/drv/oss_hdaudio/hdaudio_codecids.h Tue Apr 19 09:31:02 2011 +0300 +++ b/kernel/drv/oss_hdaudio/hdaudio_codecids.h Fri May 27 21:00:42 2011 +0300 @@ -825,12 +825,14 @@ {0x10ec0262, "ALC262", VF_NONE, (char **) &alc262remap}, {0x10ec0268, "ALC268", VF_NONE, (char **) &alc262remap}, {0x10ec0662, "ALC662", VF_NONE, (char **) &alc662remap}, + {0x10ec0663, "ALC663", VF_NONE, (char **) &alc662remap}, {0x10ec0861, "ALC861", VF_NONE, (char **) &alc861remap}, {0x10ec0862, "ALC862", VF_NONE, (char **) &alc861remap}, {0x10ec0880, "ALC880", VF_ALC88X_HACK, (char **) &alc880remap}, {0x10ec0882, "ALC882", VF_ALC88X_HACK, (char **) &alc880remap}, {0x10ec0883, "ALC883", VF_ALC88X_HACK, (char **) &alc883remap}, {0x10ec0885, "ALC885", VF_ALC88X_HACK, (char **) &alc883remap}, + {0x10ec0887, "ALC887", VF_ALC88X_HACK, (char **) &alc883remap}, {0x10ec0888, "ALC888", VF_ALC88X_HACK, (char **) &alc883remap}, {0x10ec0889, "ALC889", VF_ALC88X_HACK, (char **) &alc883remap}, {0x10ec0892, "ALC892", VF_ALC88X_HACK, (char **) &alc883remap},
diff -r 09a210f84f55 cmd/savemixer/savemixer.c --- a/cmd/savemixer/savemixer.c Thu Jan 06 07:55:36 2011 +0200 +++ b/cmd/savemixer/savemixer.c Fri May 27 20:45:17 2011 +0300 @@ -7,7 +7,11 @@ #include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#ifndef LOCAL_BUILD #include <oss_config.h> +#else +#include <soundcard.h> +#endif #include <sys/ioctl.h> static void change_mixer (const char *, char *); @@ -429,7 +433,9 @@ load_applist (); #endif - if ((f = fopen (name, "r")) == NULL) + if ((name[0] == '-') && (name[1] == '\0')) f = fdopen (0, "r"); + else f = fopen (name, "r"); + if (f == NULL) { /* Nothing to do */ exit (0); @@ -475,90 +481,22 @@ } static void -open_device (const char * dev_name, int mode) +save_config (const char *name) { - if ((fd = open (dev_name, mode, 0)) == -1) + FILE *f; + int i, dev; + + if ((name[0] == '-') && (name[1] == '\0')) f = fdopen (1, "w"); + else f = fopen (name, "w"); + + if (f == NULL) { - if (errno != ENODEV) - perror (dev_name); - exit (-1); - } - - if (ioctl (fd, SNDCTL_MIX_NRMIX, &nummixers) == -1) - { - perror ("SNDCTL_MIX_NRMIX"); - fprintf (stderr, "Possibly incompatible OSS version\n"); - exit (-1); - } - - if (nummixers < 1) - { - fprintf (stderr, "No mixers in the system\n"); - exit (-1); - } - -} - -int -main (int argc, char *argv[]) -{ - int dev, i; - char * mapname = NULL; - extern char * optarg; - - FILE *f; - - while ((i = getopt (argc, argv, "LVf:v")) != EOF) - { - switch (i) - { - case 'v': - verbose++; - break; - - case 'L': - load_settings = 1; - break; - - case 'V': - fprintf (stdout, "OSS " OSS_VERSION_STRING " savemixer utility\n"); - exit (0); - break; - - case 'f': - mapname = optarg; - break; - - default: - fprintf (stdout, "Usage: %s [option(s)]\n", argv[0]); - fprintf (stdout, " Options: -L Restore mixer settings\n"); - fprintf (stdout, " -V Display version\n"); - fprintf (stdout, " -f<fname> Use fname as settings " - "file\n"); - fprintf (stdout, " -v Verbose output\n"); - exit (-1); - } - } - - if (mapname == NULL) mapname = get_mapname (); - - if (load_settings) - { - open_device ("/dev/mixer", O_WRONLY); - load_config (mapname); - exit (0); - } - - open_device ("/dev/mixer", O_RDONLY); - - if ((f = fopen (mapname, "w")) == NULL) - { - perror (mapname); + perror (name); exit (-1); } fprintf (f, "# Automatically generated by OSS savemixer - do not edit\n"); - if (verbose) fprintf (stdout, "Saving mixer settings to %s\n", mapname); + if (verbose) fprintf (stdout, "Saving mixer settings to %s\n", name); for (dev = 0; dev < nummixers; dev++) { @@ -613,6 +551,85 @@ fprintf (f, "$endmix\n"); } fclose (f); +} + +static void +open_device (const char * dev_name, int mode) +{ + if ((fd = open (dev_name, mode, 0)) == -1) + { + if (errno != ENODEV) + perror (dev_name); + exit (-1); + } + + if (ioctl (fd, SNDCTL_MIX_NRMIX, &nummixers) == -1) + { + perror ("SNDCTL_MIX_NRMIX"); + fprintf (stderr, "Possibly incompatible OSS version\n"); + exit (-1); + } + + if (nummixers < 1) + { + fprintf (stderr, "No mixers in the system\n"); + exit (-1); + } + +} + +int +main (int argc, char *argv[]) +{ + int i; + char * mapname = NULL; + extern char * optarg; + + while ((i = getopt (argc, argv, "LVf:v")) != EOF) + { + switch (i) + { + case 'v': + verbose++; + break; + + case 'L': + load_settings = 1; + break; + + case 'V': +#ifndef LOCAL_BUILD + fprintf (stdout, "OSS " OSS_VERSION_STRING " savemixer utility\n"); +#endif + exit (0); + break; + + case 'f': + mapname = optarg; + break; + + default: + fprintf (stdout, "Usage: %s [option(s)]\n", argv[0]); + fprintf (stdout, " Options: -L Restore mixer settings\n"); + fprintf (stdout, " -V Display version\n"); + fprintf (stdout, " -f<fname> Use fname as settings " + "file\n"); + fprintf (stdout, " -v Verbose output\n"); + exit (-1); + } + } + + if (mapname == NULL) mapname = get_mapname (); + + if (load_settings) + { + open_device ("/dev/mixer", O_WRONLY); + load_config (mapname); + exit (0); + } + + open_device ("/dev/mixer", O_RDONLY); + save_config (mapname); return 0; }
diff -r 09a210f84f55 setup/Linux/make.local --- a/setup/Linux/make.local Thu Jan 06 07:55:36 2011 +0200 +++ b/setup/Linux/make.local Fri May 27 20:45:17 2011 +0300 @@ -2,8 +2,9 @@ sh build.sh copy: build - rm -f ${OSSLIBDIR}/modules/*.o - cp -R prototype/* / + #rm -f ${OSSLIBDIR}/modules/*.o + (cd prototype; find -L . -type d | xargs -i{} mkdir -p ${DESTDIR}/{}) + (cd prototype; find -L . -type f | xargs -i{} cp {} ${DESTDIR}/{}) package: build sh setup/Linux/mkpkg.sh diff -r 09a210f84f55 utils/ossmkdep.c --- a/utils/ossmkdep.c Thu Jan 06 07:55:36 2011 +0200 +++ b/utils/ossmkdep.c Fri May 27 20:45:17 2011 +0300 @@ -207,6 +207,7 @@ int i; add_includedir ("/usr/include"); + add_includedir ("/usr/local/include"); for (i = 1; i < argc; i++) if (argv[i][0] == '-')
diff -r 09a210f84f55 kernel/drv/osscore/.params --- a/kernel/drv/osscore/.params Thu Jan 06 07:55:36 2011 +0200 +++ b/kernel/drv/osscore/.params Fri May 27 20:45:17 2011 +0300 @@ -13,7 +13,8 @@ * may require lower latencies. In such cases a higher value such as 500 or 1000 * may be needed. The minimum latency will be roughly 2/max_intrate * seconds. However the exactl latency depends on what the application has - * requested using ioctl(SNDCTL_DSP_SETFRAGMENT). + * requested using ioctl(SNDCTL_DSP_SETFRAGMENT). A value of zero means + * OSS doesn't try to limit interrupt rate. * * Lower latencies require higher interrupt rates which in turn causes higher * system overhead. In addition using max_intrate values higher than system's diff -r 09a210f84f55 kernel/drv/osscore/osscore.man --- a/kernel/drv/osscore/osscore.man Thu Jan 06 07:55:36 2011 +0200 +++ b/kernel/drv/osscore/osscore.man Fri May 27 20:45:17 2011 +0300 @@ -43,6 +43,7 @@ Default: 0 - system dependent buffsize. This option mustn't be changed unless it's absolutely necessary. o max_intrate Set the maximum number of interrupts per second. + A value of 0 means the number is unlimited. Default: 100 interrupts per second which equals to about 10 msec minimum latencies. o vmix_disabled The virtual mixer subsystem can be disabled by setting
diff -r 09a210f84f55 cmd/ossplay/ossplay.c --- a/cmd/ossplay/ossplay.c Thu Jan 06 07:55:36 2011 +0200 +++ b/cmd/ossplay/ossplay.c Fri May 27 20:45:17 2011 +0300 @@ -35,7 +35,7 @@ char script[512] = ""; unsigned int nfiles = 1; -big_t datalimit = 0; +double datalimit = 0; fctypes_t type = WAVE_FILE; const format_t format_a[] = { @@ -660,7 +663,7 @@ if (eflag == signum + 128) { signal (signum, SIG_DFL); - kill (getpid(), signum); + raise (signum); } #endif eflag = signum + 128; @@ -772,6 +781,7 @@ int ossrecord_parse_opts (int argc, char ** argv, dspdev_t * dsp) { + char * p; int c; extern char * optarg; extern int optind; @@ -882,7 +892,9 @@ break; case 't': - sscanf (optarg, _PRIbig_t, &datalimit); + errno = 0; + datalimit = strtod (optarg, &p); + if ((*p != '\0') || (errno) || (datalimit <= 0)) ossrecord_usage (argv[0]); break; case 'O': @@ -1137,7 +1157,7 @@ int record (dspdev_t * dsp, FILE * wave_fp, const char * filename, double constant, - big_t datalimit, big_t * data_size, decoders_queue_t * dec) + double datatime, big_t * data_size, decoders_queue_t * dec) { #define EXITREC(code) \ do { \ @@ -1150,14 +1170,15 @@ return (code); \ } while(0) + unsigned char * buf, * obuf; ssize_t l, outl; + big_t data_size_limit = *data_size; decoders_queue_t * d; - unsigned char * buf, * obuf; verbose_values_t * verbose_meta = NULL; if (verbose) { - verbose_meta = setup_verbose (dsp->format, constant, datalimit/constant); + verbose_meta = setup_verbose (dsp->format, constant, datatime); strncpy (verbose_meta->tstring, filename, 20)[19] = 0; } @@ -1199,7 +1220,7 @@ *data_size += outl; if (verbose) print_record_verbose_info (obuf, outl, verbose_meta); - if ((datalimit != 0) && (*data_size >= datalimit)) break; + if ((datalimit != 0) && (*data_size >= data_size_limit)) break; } ossplay_free (buf); diff -r 09a210f84f55 cmd/ossplay/ossplay.h --- a/cmd/ossplay/ossplay.h Thu Jan 06 07:55:36 2011 +0200 +++ b/cmd/ossplay/ossplay.h Fri May 27 20:45:17 2011 +0300 @@ -269,7 +269,7 @@ int ossrecord_parse_opts (int, char **, dspdev_t *); int play (dspdev_t *, int, big_t *, big_t, double, double, readfunc_t *, decoders_queue_t *, seekfunc_t *); -int record (dspdev_t *, FILE *, const char *, double, big_t, +int record (dspdev_t *, FILE *, const char *, double, double, big_t *, decoders_queue_t * dec); const char * sample_format_name (int); errors_t setup_device (dspdev_t *, int, int, int); diff -r 09a210f84f55 cmd/ossplay/ossplay_console.c --- a/cmd/ossplay/ossplay_console.c Thu Jan 06 07:55:36 2011 +0200 +++ b/cmd/ossplay/ossplay_console.c Fri May 27 20:45:17 2011 +0300 @@ -316,7 +316,7 @@ errors_t err; extern int force_fmt, force_channels, force_speed, nfiles; - extern big_t datalimit; + extern double datalimit; extern fctypes_t type; extern char script[512]; diff -r 09a210f84f55 cmd/ossplay/ossplay_decode.c --- a/cmd/ossplay/ossplay_decode.c Thu Jan 06 07:55:36 2011 +0200 +++ b/cmd/ossplay/ossplay_decode.c Fri May 27 20:45:17 2011 +0300 @@ -440,9 +440,9 @@ errors_t encode_sound (dspdev_t * dsp, fctypes_t type, const char * fname, int format, - int channels, int speed, big_t datalimit) + int channels, int speed, double data_time) { - big_t datasize = 0; + big_t data_size = 0; double constant; int fd = -1; decoders_queue_t * dec, * decoders = NULL; @@ -452,7 +452,7 @@ if ((ret = setup_device (dsp, format, channels, speed))) return ret; constant = format2bits (format) * speed * channels / 8.0; - if (datalimit != 0) datalimit *= constant; + if (data_time != 0) data_size = data_time * constant; if (strcmp (fname, "-") == 0) { wave_fp = fdopen (1, "wb"); @@ -485,7 +485,7 @@ /* * Write the initial header */ - if (write_head (wave_fp, type, datalimit, format, channels, speed)) + if (write_head (wave_fp, type, data_size, format, channels, speed)) return E_ENCODE; decoders = dec = @@ -506,9 +506,9 @@ decoders->flag = 0; } - ret = record (dsp, wave_fp, fname, constant, datalimit, &datasize, dec); + ret = record (dsp, wave_fp, fname, constant, data_time, &data_size, dec); - finalize_head (wave_fp, type, datasize, format, channels, speed); + finalize_head (wave_fp, type, data_size, format, channels, speed); fflush (wave_fp); /* * EINVAL and EROFS are returned for "special files which don't support diff -r 09a210f84f55 cmd/ossplay/ossplay_decode.h --- a/cmd/ossplay/ossplay_decode.h Thu Jan 06 07:55:36 2011 +0200 +++ b/cmd/ossplay/ossplay_decode.h Fri May 27 20:45:17 2011 +0300 @@ -23,7 +23,7 @@ errors_t decode_sound (dspdev_t *, int, big_t, int, int, int, void *); errors_t encode_sound (dspdev_t *, fctypes_t, const char *, int, int, int, - big_t); + double); int get_db_level (const unsigned char *, ssize_t, int); verbose_values_t * setup_verbose (int, double, double); diff -r 09a210f84f55 cmd/ossplay/ossplay_parser.c --- a/cmd/ossplay/ossplay_parser.c Thu Jan 06 07:55:36 2011 +0200 +++ b/cmd/ossplay/ossplay_parser.c Fri May 27 20:45:17 2011 +0300 @@ -683,7 +683,7 @@ case 24: case 25: case 26: - print_msg (ERRORM, "%s: G.72x ADPCM encoded .au files are not supported", + print_msg (ERRORM, "%s: G.72x ADPCM encoded .au files are not supported\n", filename); return E_FORMAT_UNSUPPORTED;
diff -r a9a237ddd426 kernel/drv/oss_hdaudio/hdaudio.h --- a/kernel/drv/oss_hdaudio/hdaudio.h Tue Apr 19 09:31:02 2011 +0300 +++ b/kernel/drv/oss_hdaudio/hdaudio.h Fri May 27 21:03:27 2011 +0300 @@ -1,7 +1,17 @@ /* * Purpose: Common definitions for the hdaudio driver files */ -#define COPYING102 Copyright (C) Hannu Savolainen and Dev Mazumdar 1996-2005. All rights reserved. +/* + * + * 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. + * + */ #define HDA_GCAP 0x00 /* Global Capabilities */ #define HDA_VMIN 0x02 /* Minor Version */ #define HDA_VMAJ 0x03 /* Major Version */ @@ -56,7 +66,7 @@ #define HDA_SDI0FORMAT 0x92 /* Format */ #define HDA_SDI0BDLPL 0x98 /* List Pointer - Lower */ #define HDA_SDI0BDLPU 0x9C /* List Pointer - Upper */ -#define HDA_SDI0LPIBA 0x2084 /* Link Posiiton in Buffer n Alias */ +#define HDA_SDI0LPIBA 0x2084 /* Link Position in Buffer n Alias */ #define HDA_SDI1CTL 0xA0 /* Stream Descriptor Control */ #define HDA_SDI1STS 0xA3 /* Stream Descriptor Status */ @@ -67,7 +77,7 @@ #define HDA_SDI1FORMAT 0xB2 /* Format */ #define HDA_SDI1BDLPL 0xB8 /* List Pointer - Lower */ #define HDA_SDI1BDLPU 0xBC /* List Pointer - Upper */ -#define HDA_SDI1LPIBA 0x20A4 /* Link Posiiton in Buffer n Alias */ +#define HDA_SDI1LPIBA 0x20A4 /* Link Position in Buffer n Alias */ #define HDA_SDI2CTL 0xC0 /* Stream Descriptor Control */ #define HDA_SDI2STS 0xC3 /* Stream Descriptor Status */ @@ -78,7 +88,7 @@ #define HDA_SDI2FORMAT 0xD2 /* Format */ #define HDA_SDI2BDLPL 0xD8 /* List Pointer - Lower */ #define HDA_SDI2BDLPU 0xDC /* List Pointer - Upper */ -#define HDA_SDI2LPIBA 0x20D4 /* Link Posiiton in Buffer n Alias */ +#define HDA_SDI2LPIBA 0x20D4 /* Link Position in Buffer n Alias */ #define HDA_SDI3CTL 0xE0 /* Stream Descriptor Control */ #define HDA_SDI3STS 0xE3 /* Stream Descriptor Status */ @@ -89,7 +99,7 @@ #define HDA_SDI3FORMAT 0xF2 /* Format */ #define HDA_SDI3BDLPL 0xF8 /* List Pointer - Lower */ #define HDA_SDI3BDLPU 0xFC /* List Pointer - Upper */ -#define HDA_SDI3LPIBA 0x20E4 /* Link Posiiton in Buffer n Alias */ +#define HDA_SDI3LPIBA 0x20E4 /* Link Position in Buffer n Alias */ #define HDA_SDO0CTL 0x100 /* Stream Descriptor Control */ #define HDA_SDO0STS 0x103 /* Stream Descriptor Status */ @@ -100,7 +110,7 @@ #define HDA_SDO0FORMAT 0x112 /* Format */ #define HDA_SDO0BDLPL 0x118 /* List Pointer - Lower */ #define HDA_SDO0BDLPU 0x11C /* List Pointer - Upper */ -#define HDA_SDO0LPIBA 0x2104 /* Link Posiiton in Buffer n Alias */ +#define HDA_SDO0LPIBA 0x2104 /* Link Position in Buffer n Alias */ #define HDA_SDO1CTL 0x120 /* Stream Descriptor Control */ #define HDA_SDO1STS 0x123 /* Stream Descriptor Status */ @@ -111,7 +121,7 @@ #define HDA_SDO1FORMAT 0x132 /* Format */ #define HDA_SDO1BDLPL 0x138 /* List Pointer - Lower */ #define HDA_SDO1BDLPU 0x13C /* List Pointer - Upper */ -#define HDA_SDO1LPIBA 0x2124 /* Link Posiiton in Buffer n Alias */ +#define HDA_SDO1LPIBA 0x2124 /* Link Position in Buffer n Alias */ #define HDA_SDO2CTL 0x140 /* Stream Descriptor Control */ #define HDA_SDO2STS 0x143 /* Stream Descriptor Status */ @@ -122,7 +132,7 @@ #define HDA_SDO2FORMAT 0x152 /* Format */ #define HDA_SDO2BDLPL 0x158 /* List Pointer - Lower */ #define HDA_SDO2BDLPU 0x15C /* List Pointer - Upper */ -#define HDA_SDO2LPIBA 0x2144 /* Link Posiiton in Buffer n Alias */ +#define HDA_SDO2LPIBA 0x2144 /* Link Position in Buffer n Alias */ #define HDA_SDO3CTL 0x160 /* Stream Descriptor Control */ #define HDA_SDO3STS 0x163 /* Stream Descriptor Status */ diff -r a9a237ddd426 kernel/drv/oss_hdaudio/hdaudio_generic.c --- a/kernel/drv/oss_hdaudio/hdaudio_generic.c Tue Apr 19 09:31:02 2011 +0300 +++ b/kernel/drv/oss_hdaudio/hdaudio_generic.c Fri May 27 21:03:27 2011 +0300 @@ -4,20 +4,30 @@ * This generic driver is used to create mixer/control panels for HDaudio * codec chips that don't have any dedicated driver available. * - * This drivere will obtain the widget definitions from the codec and then + * This driver will obtain the widget definitions from the codec and then * try to guess a mixer layout that makes some sense. However this approach * works properly only with a small set of codecs. * * Most codecs are unbearably complex and provide loads of redundant * functionality. The generic driver approach will not properly work with them * because the mixer (GUI) layout will become too large to fit on any screen. - * In addtion such automatically generated mixer controls will not make any + * In addition such automatically generated mixer controls will not make any * sense to the users. So in the future the only possible approach will be * creating dedicated mixer drivers for all possible codecs in the market. * Unfortunately in some cases the driver may even need to be motherboard * specific. Apparently this is going to be enormous task. */ -#define COPYING Copyright (C) Hannu Savolainen and Dev Mazumdar 2005-2007. All rights reserved. +/* + * + * 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_hdaudio_cfg.h" #include "hdaudio.h" @@ -826,7 +836,7 @@ } /* - * Finally handle all the widgets that heve not been attached yet + * Finally handle all the widgets that have not been attached yet */ n = 0; diff -r a9a237ddd426 kernel/drv/oss_hdaudio/oss_hdaudio.c --- a/kernel/drv/oss_hdaudio/oss_hdaudio.c Tue Apr 19 09:31:02 2011 +0300 +++ b/kernel/drv/oss_hdaudio/oss_hdaudio.c Fri May 27 21:03:27 2011 +0300 @@ -1,7 +1,17 @@ /* * Purpose: The High Definition Audio (HDA/Azalia) driver. */ -#define COPYING Copyright (C) Hannu Savolainen and Dev Mazumdar 2005. All rights reserved. +/* + * + * 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_hdaudio_cfg.h" #include "oss_pci.h" @@ -18,11 +28,12 @@ #define INTEL_DEVICE_ESB2 0x269a #define INTEL_DEVICE_ICH8 0x284b #define INTEL_DEVICE_ICH9 0x293f -#define INTEL_DEVICE_ICH10 0x3a3e +#define INTEL_DEVICE_ICH10 0x3a3e #define INTEL_DEVICE_ICH10_B 0x3a6e -#define INTEL_DEVICE_PCH 0x3b56 +#define INTEL_DEVICE_PCH 0x3b56 +#define INTEL_DEVICE_PCH2 0x3b57 +#define INTEL_DEVICE_SCH 0x811b #define INTEL_DEVICE_P35 0x293e -#define INTEL_DEVICE_CPT 0x1c20 #define NVIDIA_VENDOR_ID 0x10de #define NVIDIA_DEVICE_MCP51 0x026c @@ -1054,26 +1065,31 @@ { unsigned int tmp, tmout; + /*reset the controller by writing a 0*/ tmp = PCI_READL (devc->osdev, devc->azbar + HDA_GCTL); tmp &= ~CRST; PCI_WRITEL (devc->osdev, devc->azbar + HDA_GCTL, tmp); + /*wait until the controller writes a 0 to indicate reset is done or until 50ms have passed*/ tmout = 50; while ((PCI_READL (devc->osdev, devc->azbar + HDA_GCTL) & CRST) && --tmout) oss_udelay (1000); oss_udelay (1000); + /*bring the controller out of reset by writing a 1*/ tmp = PCI_READL (devc->osdev, devc->azbar + HDA_GCTL); tmp |= CRST; PCI_WRITEL (devc->osdev, devc->azbar + HDA_GCTL, tmp); + /*wait until the controller writes a 1 to indicate it is ready is or until 50ms have passed*/ tmout = 50; while (!(PCI_READL (devc->osdev, devc->azbar + HDA_GCTL) & CRST) && --tmout) oss_udelay (1000); oss_udelay (1000); + /*if the controller is not ready now, abort*/ if (!(PCI_READL (devc->osdev, devc->azbar + HDA_GCTL))) { cmn_err (CE_WARN, "Controller not ready\n"); @@ -1714,6 +1730,7 @@ devc->mixer_dev = hdaudio_mixer_get_mixdev (devc->mixer); gcap = PCI_READW (devc->osdev, devc->azbar + HDA_GCAP); + DDB (cmn_err (CE_CONT, " GCAP register content 0x%x\n", gcap)); if (((gcap >> 3) & 0x0f) > 0) cmn_err (CE_WARN, "Bidirectional engines not supported\n"); @@ -1731,13 +1748,14 @@ int oss_hdaudio_attach (oss_device_t * osdev) { - unsigned char pci_irq_line, pci_revision, btmp; + unsigned char pci_irq_line, pci_revision, btmp; unsigned short pci_command, vendor, device, wtmp; unsigned short subvendor, subdevice; hda_devc_t *devc; static int already_attached = 0; int err; - + unsigned short devctl; + DDB (cmn_err (CE_CONT, "oss_hdaudio_attach entered\n")); if (already_attached) @@ -1803,6 +1821,13 @@ switch (device) { + case INTEL_DEVICE_SCH: + pci_read_config_word (osdev, 0x78, &devctl); + DDB (cmn_err (CE_CONT, " DEVC register content 0x%04x\n", devctl);) + pci_write_config_word (osdev, 0x78, (devctl & (~0x0800)) ); + DDB (pci_read_config_word (osdev, 0x78, &devctl);) + DDB (cmn_err (CE_CONT, " DEVC register content (after clearing DEVC.NSNPEN) 0x%04x\n", devctl);) + /* continue is intentional */ case INTEL_DEVICE_ICH6: case INTEL_DEVICE_ICH7: case INTEL_DEVICE_ESB2: @@ -1812,7 +1837,7 @@ case INTEL_DEVICE_ICH10: case INTEL_DEVICE_ICH10_B: case INTEL_DEVICE_PCH: - case INTEL_DEVICE_CPT: + case INTEL_DEVICE_PCH2: devc->chip_name = "Intel HD Audio"; break; @@ -1869,10 +1894,7 @@ devc->azbar = (void *) MAP_PCI_MEM (devc->osdev, 0, devc->membar_addr, 16 * 1024); - /* activate the device */ - pci_command |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - pci_write_config_word (osdev, PCI_COMMAND, pci_command); - + /*verify interrupt*/ if (pci_irq_line == 0) { cmn_err (CE_WARN, "IRQ not assigned by BIOS.\n"); @@ -1880,6 +1902,11 @@ } devc->irq = pci_irq_line; + + /* activate the device */ + pci_command |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; + pci_write_config_word (osdev, PCI_COMMAND, pci_command); + MUTEX_INIT (devc->osdev, devc->mutex, MH_DRV); MUTEX_INIT (devc->osdev, devc->low_mutex, MH_DRV + 1); @@ -1899,7 +1926,7 @@ { pci_read_config_byte (osdev, 0x44, &btmp); pci_write_config_byte (osdev, 0x44, btmp & 0xf8); - } + } err = init_HDA (devc); return err; diff -r a9a237ddd426 kernel/drv/oss_hdaudio/.devices --- a/kernel/drv/oss_hdaudio/.devices Tue Apr 19 09:31:02 2011 +0300 +++ b/kernel/drv/oss_hdaudio/.devices Fri May 27 21:27:26 2011 +0300 @@ -7,7 +7,9 @@ oss_hdaudio pci8086,3a3e Intel High Definition Audio (ICH10) oss_hdaudio pci8086,3a6e Intel High Definition Audio (ICH10) oss_hdaudio pci8086,3b56 Intel High Definition Audio (PCH) +oss_hdaudio pci8086,3b57 Intel High Definition Audio (PCH) oss_hdaudio pci8086,1c20 Intel High Definition Audio (CPT) +oss_hdaudio pci8086,811b Intel High Definition Audio (SCH) oss_hdaudio pci10de,26c Nvidia High Definition Audio (MCP51) oss_hdaudio pci10de,371 Nvidia High Definition Audio (MCP55) oss_hdaudio pci10de,3e4 Nvidia High Definition Audio (MCP61)
_______________________________________________ oss-devel mailing list oss-devel@mailman.opensound.com http://mailman.opensound.com/mailman/listinfo/oss-devel