···5206 You need to pass the <function>snd_dma_pci_data(pci)</function>,5207 where pci is the struct <structname>pci_dev</structname> pointer5208 of the chip as well.5209- The <type>snd_sg_buf_t</type> instance is created as5210 substream->dma_private. You can cast5211 the pointer like: 52125213 <informalexample>5214 <programlisting>5215<![CDATA[5216- struct snd_sg_buf *sgbuf = (struct snd_sg_buf_t*)substream->dma_private;5217]]>5218 </programlisting>5219 </informalexample>
···5206 You need to pass the <function>snd_dma_pci_data(pci)</function>,5207 where pci is the struct <structname>pci_dev</structname> pointer5208 of the chip as well.5209+ The <type>struct snd_sg_buf</type> instance is created as5210 substream->dma_private. You can cast5211 the pointer like: 52125213 <informalexample>5214 <programlisting>5215<![CDATA[5216+ struct snd_sg_buf *sgbuf = (struct snd_sg_buf *)substream->dma_private;5217]]>5218 </programlisting>5219 </informalexample>
···69MODULE_PARM_DESC(dma, "DMA # for SoundScape driver.");7071static struct platform_device *platform_devices[SNDRV_CARDS];72-static int pnp_registered;7374#ifdef CONFIG_PNP075static struct pnp_card_device_id sscape_pnpids[] = {76 { .id = "ENS3081", .devs = { { "ENS0000" } } },77 { .id = "" } /* end */···1391{1392 int i;139301394 if (pnp_registered)1395 pnp_unregister_card_driver(&sscape_pnpc_driver);01396 for (i = 0; i < ARRAY_SIZE(platform_devices); ++i)1397 platform_device_unregister(platform_devices[i]);1398 platform_driver_unregister(&snd_sscape_driver);···1468 ret = sscape_manual_probe();1469 if (ret < 0)1470 return ret;01471 if (pnp_register_card_driver(&sscape_pnpc_driver) >= 0)1472 pnp_registered = 1;01473 return 0;1474}1475
···69MODULE_PARM_DESC(dma, "DMA # for SoundScape driver.");7071static struct platform_device *platform_devices[SNDRV_CARDS];07273#ifdef CONFIG_PNP74+static int pnp_registered;75static struct pnp_card_device_id sscape_pnpids[] = {76 { .id = "ENS3081", .devs = { { "ENS0000" } } },77 { .id = "" } /* end */···1391{1392 int i;13931394+#ifdef CONFIG_PNP1395 if (pnp_registered)1396 pnp_unregister_card_driver(&sscape_pnpc_driver);1397+#endif1398 for (i = 0; i < ARRAY_SIZE(platform_devices); ++i)1399 platform_device_unregister(platform_devices[i]);1400 platform_driver_unregister(&snd_sscape_driver);···1466 ret = sscape_manual_probe();1467 if (ret < 0)1468 return ret;1469+#ifdef CONFIG_PNP1470 if (pnp_register_card_driver(&sscape_pnpc_driver) >= 0)1471 pnp_registered = 1;1472+#endif1473 return 0;1474}1475
+5-2
sound/isa/wavefront/wavefront.c
···84MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");8586static struct platform_device *platform_devices[SNDRV_CARDS];87-static int pnp_registered;88-8990#ifdef CONFIG_PNP09192static struct pnp_card_device_id snd_wavefront_pnpids[] = {93 /* Tropez */···694{695 int i;6960697 if (pnp_registered)698 pnp_unregister_card_driver(&wavefront_pnpc_driver);0699 for (i = 0; i < ARRAY_SIZE(platform_devices); ++i)700 platform_device_unregister(platform_devices[i]);701 platform_driver_unregister(&snd_wavefront_driver);···726 cards++;727 }7280729 i = pnp_register_card_driver(&wavefront_pnpc_driver);730 if (i >= 0) {731 pnp_registered = 1;732 cards += i;733 }0734735 if (!cards) {736#ifdef MODULE
···84MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");8586static struct platform_device *platform_devices[SNDRV_CARDS];008788#ifdef CONFIG_PNP89+static int pnp_registered;9091static struct pnp_card_device_id snd_wavefront_pnpids[] = {92 /* Tropez */···695{696 int i;697698+#ifdef CONFIG_PNP699 if (pnp_registered)700 pnp_unregister_card_driver(&wavefront_pnpc_driver);701+#endif702 for (i = 0; i < ARRAY_SIZE(platform_devices); ++i)703 platform_device_unregister(platform_devices[i]);704 platform_driver_unregister(&snd_wavefront_driver);···725 cards++;726 }727728+#ifdef CONFIG_PNP729 i = pnp_register_card_driver(&wavefront_pnpc_driver);730 if (i >= 0) {731 pnp_registered = 1;732 cards += i;733 }734+#endif735736 if (!cards) {737#ifdef MODULE
+1-1
sound/isa/wavefront/wavefront_synth.c
···866 divided by 2.867 */868869- u16 sample_short;870 u32 length;871 u16 __user *data_end = NULL;872 unsigned int i;
···866 divided by 2.867 */868869+ u16 sample_short = 0;870 u32 length;871 u16 __user *data_end = NULL;872 unsigned int i;
+39-14
sound/pci/ac97/ac97_patch.c
···1621 AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0),1622};1623000000000000000001624static int patch_ad1981a_specific(struct snd_ac97 * ac97)1625{001626 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,1627 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));1628}···1654#endif1655};16560000000000000001657static void check_ad1981_hp_jack_sense(struct snd_ac97 *ac97)1658{1659- u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device;1660- switch (subid) {1661- case 0x0e11005a: /* HP nc4000/4010 */1662- case 0x103c0890: /* HP nc6000 */1663- case 0x103c0938: /* HP nc4220 */1664- case 0x103c099c: /* HP nx6110 */1665- case 0x103c0944: /* HP nc6220 */1666- case 0x103c0934: /* HP nc8220 */1667- case 0x103c006d: /* HP nx9105 */1668- case 0x17340088: /* FSC Scenic-W */1669 /* enable headphone jack sense */1670 snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11);1671- break;1672- }1673}16741675int patch_ad1981a(struct snd_ac97 *ac97)···16951696 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)1697 return err;001698 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,1699 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));1700}···2235 /* Vref disable (bit12), 1kOhm (bit13) */2236 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13),2237 shared ? (1<<12) : (1<<13));2238- /* MIC-IN = 1, CENTER-LFE = 2 */2239 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4,2240- shared ? (2<<4) : (1<<4));2241}22422243static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = {
···1621 AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0),1622};16231624+/* black list to avoid HP/Line jack-sense controls1625+ * (SS vendor << 16 | device)1626+ */1627+static unsigned int ad1981_jacks_blacklist[] = {1628+ 0x10140554, /* Thinkpad T42p/R50p */1629+ 0 /* end */1630+};1631+1632+static int check_list(struct snd_ac97 *ac97, const unsigned int *list)1633+{1634+ u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device;1635+ for (; *list; list++)1636+ if (*list == subid)1637+ return 1;1638+ return 0;1639+}1640+1641static int patch_ad1981a_specific(struct snd_ac97 * ac97)1642{1643+ if (check_list(ac97, ad1981_jacks_blacklist))1644+ return 0;1645 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,1646 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));1647}···1635#endif1636};16371638+/* white list to enable HP jack-sense bits1639+ * (SS vendor << 16 | device)1640+ */1641+static unsigned int ad1981_jacks_whitelist[] = {1642+ 0x0e11005a, /* HP nc4000/4010 */1643+ 0x103c0890, /* HP nc6000 */1644+ 0x103c0938, /* HP nc4220 */1645+ 0x103c099c, /* HP nx6110 */1646+ 0x103c0944, /* HP nc6220 */1647+ 0x103c0934, /* HP nc8220 */1648+ 0x103c006d, /* HP nx9105 */1649+ 0x17340088, /* FSC Scenic-W */1650+ 0 /* end */1651+};1652+1653static void check_ad1981_hp_jack_sense(struct snd_ac97 *ac97)1654{1655+ if (check_list(ac97, ad1981_jacks_whitelist))0000000001656 /* enable headphone jack sense */1657 snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11);001658}16591660int patch_ad1981a(struct snd_ac97 *ac97)···16721673 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)1674 return err;1675+ if (check_list(ac97, ad1981_jacks_blacklist))1676+ return 0;1677 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,1678 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));1679}···2210 /* Vref disable (bit12), 1kOhm (bit13) */2211 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13),2212 shared ? (1<<12) : (1<<13));2213+ /* MIC-IN = 1, CENTER-LFE = 5 */2214 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4,2215+ shared ? (5<<4) : (1<<4));2216}22172218static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = {
···675 if (pass_through) {676 /* wont work with any other rate than677 the native DSP rate */678- snd_assert (rate = 48000);679680 scb = cs46xx_dsp_create_generic_scb(chip,scb_name,(u32 *)&src_task_scb,681 dest,"DMAREADER",parent_scb,
···675 if (pass_through) {676 /* wont work with any other rate than677 the native DSP rate */678+ snd_assert (rate == 48000);679680 scb = cs46xx_dsp_create_generic_scb(chip,scb_name,(u32 *)&src_task_scb,681 dest,"DMAREADER",parent_scb,
···454 is_capture = (subs->stream == SNDRV_PCM_STREAM_CAPTURE);455 stream_num = is_capture ? 0 : subs->number;456457- snd_printdd("pcxhr_update_r_buffer(pcm%c%d) : addr(%p) bytes(%x) subs(%d)\n",458 is_capture ? 'c' : 'p',459 chip->chip_idx, (void*)subs->runtime->dma_addr,460 subs->runtime->dma_bytes, subs->number);···744 /* only the first stream can choose the sample rate */745 /* the further opened streams will be limited to its frequency (see open) */746 /* set the clock only once (first stream) */747- if (mgr->sample_rate == 0) {748 err = pcxhr_set_clock(mgr, subs->runtime->rate);749 if (err)750 break;000751 mgr->sample_rate = subs->runtime->rate;752-753- err = pcxhr_hardware_timer(mgr, 1); /* start the DSP-timer */754 }755 } while(0); /* do only once (so we can use break instead of goto) */756
···454 is_capture = (subs->stream == SNDRV_PCM_STREAM_CAPTURE);455 stream_num = is_capture ? 0 : subs->number;456457+ snd_printdd("pcxhr_update_r_buffer(pcm%c%d) : addr(%p) bytes(%zx) subs(%d)\n",458 is_capture ? 'c' : 'p',459 chip->chip_idx, (void*)subs->runtime->dma_addr,460 subs->runtime->dma_bytes, subs->number);···744 /* only the first stream can choose the sample rate */745 /* the further opened streams will be limited to its frequency (see open) */746 /* set the clock only once (first stream) */747+ if (mgr->sample_rate != subs->runtime->rate) {748 err = pcxhr_set_clock(mgr, subs->runtime->rate);749 if (err)750 break;751+ if (mgr->sample_rate == 0)752+ /* start the DSP-timer */753+ err = pcxhr_hardware_timer(mgr, 1);754 mgr->sample_rate = subs->runtime->rate;00755 }756 } while(0); /* do only once (so we can use break instead of goto) */757
···478/*479 * Prepare urb for streaming before playback starts.480 *481- * We don't care about (or have) any data, so we just send a transfer delimiter.482 */483static int prepare_startup_playback_urb(struct snd_usb_substream *subs,484 struct snd_pcm_runtime *runtime,485 struct urb *urb)486{487- unsigned int i;488 struct snd_urb_ctx *ctx = urb->context;04890490 urb->dev = ctx->subs->dev;491 urb->number_of_packets = subs->packs_per_ms;492 for (i = 0; i < subs->packs_per_ms; ++i) {493- urb->iso_frame_desc[i].offset = 0;494- urb->iso_frame_desc[i].length = 0;00000000000495 }496- urb->transfer_buffer_length = 0;000497 return 0;498}499···2493 if (err < 0)2494 return err;2495#if 12496- /* FIXME: temporary hack for extigy/audigy 2 nx */2497 /* extigy apparently supports sample rates other than 48k2498 * but not in ordinary way. so we enable only 48k atm.2499 */2500 if (chip->usb_id == USB_ID(0x041e, 0x3000) ||2501- chip->usb_id == USB_ID(0x041e, 0x3020)) {02502 if (fmt[3] == USB_FORMAT_TYPE_I &&2503 fp->rates != SNDRV_PCM_RATE_48000 &&2504 fp->rates != SNDRV_PCM_RATE_96000)
···478/*479 * Prepare urb for streaming before playback starts.480 *481+ * We don't yet have data, so we send a frame of silence.482 */483static int prepare_startup_playback_urb(struct snd_usb_substream *subs,484 struct snd_pcm_runtime *runtime,485 struct urb *urb)486{487+ unsigned int i, offs, counts;488 struct snd_urb_ctx *ctx = urb->context;489+ int stride = runtime->frame_bits >> 3;490491+ offs = 0;492 urb->dev = ctx->subs->dev;493 urb->number_of_packets = subs->packs_per_ms;494 for (i = 0; i < subs->packs_per_ms; ++i) {495+ /* calculate the size of a packet */496+ if (subs->fill_max)497+ counts = subs->maxframesize; /* fixed */498+ else {499+ subs->phase = (subs->phase & 0xffff)500+ + (subs->freqm << subs->datainterval);501+ counts = subs->phase >> 16;502+ if (counts > subs->maxframesize)503+ counts = subs->maxframesize;504+ }505+ urb->iso_frame_desc[i].offset = offs * stride;506+ urb->iso_frame_desc[i].length = counts * stride;507+ offs += counts;508 }509+ urb->transfer_buffer_length = offs * stride;510+ memset(urb->transfer_buffer,511+ subs->cur_audiofmt->format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0,512+ offs * stride);513 return 0;514}515···2477 if (err < 0)2478 return err;2479#if 12480+ /* FIXME: temporary hack for extigy/audigy 2 nx/zs */2481 /* extigy apparently supports sample rates other than 48k2482 * but not in ordinary way. so we enable only 48k atm.2483 */2484 if (chip->usb_id == USB_ID(0x041e, 0x3000) ||2485+ chip->usb_id == USB_ID(0x041e, 0x3020) ||2486+ chip->usb_id == USB_ID(0x041e, 0x3061)) {2487 if (fmt[3] == USB_FORMAT_TYPE_I &&2488 fp->rates != SNDRV_PCM_RATE_48000 &&2489 fp->rates != SNDRV_PCM_RATE_96000)