Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@aknet.ru>
To: Takashi Iwai <tiwai@suse.de>
Cc: Theodore Tso <tytso@mit.edu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Roberto Oppedisano <roberto.oppedisano@infracom.it>,
	alsa-devel@alsa-project.org
Subject: [patch] snd-pcsp: put back the compatibility code
Date: Fri, 16 May 2008 22:11:31 +0400	[thread overview]
Message-ID: <482DCE53.1000406@aknet.ru> (raw)
In-Reply-To: <s5h8wybr0c2.wl%tiwai@suse.de>

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

Hello.

The attached patch adds back the
compatibility code, allowing the
driver to work with older alsa-libs.
The removal was premature, it breaks
the real-life configs, I am sorry
about that.

Takashi, could you please apply?
It is a straight-forward revert of:
http://hg-mirror.alsa-project.org/alsa-kernel/diff/26b0243ab4fa/drivers/pcsp/pcsp_lib.c

[-- Attachment #2: pcsp_s16_back.diff --]
[-- Type: text/x-patch, Size: 2344 bytes --]

# HG changeset patch
# User Stas Sergeev <stsp@users.sourceforge.net>
# Date 1210960913 -14400
# Node ID 3887126bbd9ca422208e651d46f9f5385d409efe
# Parent  1ffcb28969441147a0480f0ad7bdc52093d1e4ee
snd-pcsp: put back the compatibility code for the older alsa-libs.

Signed-off-by: Stas Sergeev <stsp@aknet.ru>

diff -r 1ffcb2896944 -r 3887126bbd9c drivers/pcsp/pcsp_lib.c
--- a/drivers/pcsp/pcsp_lib.c	Fri May 16 12:34:47 2008 +0200
+++ b/drivers/pcsp/pcsp_lib.c	Fri May 16 22:01:53 2008 +0400
@@ -17,6 +17,8 @@ module_param(nforce_wa, bool, 0444);
 module_param(nforce_wa, bool, 0444);
 MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround "
 		"(expect bad sound)");
+
+#define DMIX_WANTS_S16	1
 
 static void pcsp_start_timer(unsigned long dummy)
 {
@@ -47,7 +49,7 @@ enum hrtimer_restart pcsp_do_timer(struc
 {
 	unsigned long flags;
 	unsigned char timer_cnt, val;
-	int periods_elapsed;
+	int fmt_size, periods_elapsed;
 	u64 ns;
 	size_t period_bytes, buffer_bytes;
 	struct snd_pcm_substream *substream;
@@ -92,8 +94,11 @@ enum hrtimer_restart pcsp_do_timer(struc
 		goto exit_nr_unlock2;
 
 	runtime = substream->runtime;
-	/* assume it is u8 mono */
-	val = runtime->dma_area[chip->playback_ptr];
+	fmt_size = snd_pcm_format_physical_width(runtime->format) >> 3;
+	/* assume it is mono! */
+	val = runtime->dma_area[chip->playback_ptr + fmt_size - 1];
+	if (snd_pcm_format_signed(runtime->format))
+		val ^= 0x80;
 	timer_cnt = val * CUR_DIV() / 256;
 
 	if (timer_cnt && chip->enable) {
@@ -111,7 +116,7 @@ enum hrtimer_restart pcsp_do_timer(struc
 
 	period_bytes = snd_pcm_lib_period_bytes(substream);
 	buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
-	chip->playback_ptr += PCSP_INDEX_INC();
+	chip->playback_ptr += PCSP_INDEX_INC() * fmt_size;
 	periods_elapsed = chip->playback_ptr - chip->period_ptr;
 	if (periods_elapsed < 0) {
 		printk(KERN_WARNING "PCSP: playback_ptr inconsistent "
@@ -270,7 +275,11 @@ static struct snd_pcm_hardware snd_pcsp_
 	.info = (SNDRV_PCM_INFO_INTERLEAVED |
 		 SNDRV_PCM_INFO_HALF_DUPLEX |
 		 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
-	.formats = SNDRV_PCM_FMTBIT_U8,
+	.formats = (SNDRV_PCM_FMTBIT_U8
+#if DMIX_WANTS_S16
+		    | SNDRV_PCM_FMTBIT_S16_LE
+#endif
+	    ),
 	.rates = SNDRV_PCM_RATE_KNOT,
 	.rate_min = PCSP_DEFAULT_SRATE,
 	.rate_max = PCSP_DEFAULT_SRATE,

       reply	other threads:[~2008-05-16 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <hPXlJLjt4XG.A._lF.Jv1JIB@chimera>
     [not found] ` <88YBFoyd1CN.A._sF.Ov1JIB@chimera>
     [not found]   ` <s5hskwmeb1h.wl%tiwai@suse.de>
     [not found]     ` <20080514212011.GH7054@mit.edu>
     [not found]       ` <s5hhcd0azv1.wl%tiwai@suse.de>
     [not found]         ` <20080515130654.GC18825@mit.edu>
     [not found]           ` <s5h8wybr0c2.wl%tiwai@suse.de>
2008-05-16 18:11             ` Stas Sergeev [this message]
2008-05-16 18:20               ` [patch] snd-pcsp: put back the compatibility code Rene Herman
     [not found]             ` <20080517204725.GA11460@codemonkey.org.uk>
     [not found]               ` <482F47DC.60505@aknet.ru>
     [not found]                 ` <20080517213231.GA31440@codemonkey.org.uk>
2008-05-17 22:05                   ` [Bug #10679] 2.6.26-rc1 regression: e5e1d3cb20034a3cbcfff1f0bae12201aa2ce17e breaks artsd Stas Sergeev
2008-05-17 22:09                     ` Stas Sergeev
2008-05-18  3:13               ` Stas Sergeev
2008-05-18  7:49                 ` Takashi Iwai
2008-05-22  4:38                   ` Stas Sergeev
2008-05-22  8:18                     ` Takashi Iwai

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=482DCE53.1000406@aknet.ru \
    --to=stsp@aknet.ru \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roberto.oppedisano@infracom.it \
    --cc=tiwai@suse.de \
    --cc=tytso@mit.edu \
    /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