From patchwork Tue Apr 14 18:48:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?T2xkw4XihKJpY2ggSmVkbGnDhMKNa2E=?= X-Patchwork-Id: 18206 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3EImNac027802 for ; Tue, 14 Apr 2009 18:48:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758050AbZDNSsU (ORCPT ); Tue, 14 Apr 2009 14:48:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757479AbZDNSsT (ORCPT ); Tue, 14 Apr 2009 14:48:19 -0400 Received: from smtp.seznam.cz ([77.75.72.43]:57751 "EHLO smtp.seznam.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757727AbZDNSsS convert rfc822-to-8bit (ORCPT ); Tue, 14 Apr 2009 14:48:18 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=seznam.cz; h=Received:To:Subject:Content-Disposition:From:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:X-Smtpd:X-Seznam-User:X-QM-Mark; b=DAjxqRDn+cdrDLQ8H1Cfvi4azgjR4bBhq2xGpUGBEZ087Qy1KCSI85y6nav9IPkPS kKY2p5QAFGy4ghCnRWQLWdxTYfjW86vHttHHnAahe66306Jz06dVOrzrX+MB2AePklz vwd+D0ekxZXaoO+5OzffrYOW5YyT1OWw92qLm1M= Received: from oldium (ip-89-102-129-2.karneval.cz [89.102.129.2]) by email-relay1.go.seznam.cz (Seznam SMTPD 1.1.7@13984) with ESMTP; Tue, 14 Apr 2009 20:48:16 +0200 (CEST) To: LMML Subject: [PATCH][RESEND] Use correct sampling rate for TV/FM radio Content-Disposition: inline From: Oldrich Jedlicka Date: Tue, 14 Apr 2009 20:48:14 +0200 MIME-Version: 1.0 Message-Id: <200904142048.14713.oldium.pro@seznam.cz> X-Smtpd: 1.1.7@13984 X-Seznam-User: oldium.pro@seznam.cz X-QM-Mark: email-qm2<408864629> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Here is the fix for using the 32kHz sampling rate for TV and FM radio (ALSA). The TV uses 32kHz anyway (mode 0; 32kHz demdec on), radio works only with 32kHz (mode 1; 32kHz baseband). The ALSA wrongly reported 32kHz and 48kHz for everything (TV, radio, LINE1/2). Now it should be possible to just use the card without the need to change the capture rate from 48kHz to 32kHz. Enjoy :-) Now without word-wrapping. Signed-off-by: Oldřich Jedlička --- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -r dba0b6fae413 linux/drivers/media/video/saa7134/saa7134-alsa.c --- a/linux/drivers/media/video/saa7134/saa7134-alsa.c Thu Apr 09 08:21:42 2009 -0300 +++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c Mon Apr 13 23:07:22 2009 +0200 @@ -465,6 +465,29 @@ .periods_max = 1024, }; +static struct snd_pcm_hardware snd_card_saa7134_capture_32kHz_only = +{ + .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID), + .formats = SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_S16_BE | \ + SNDRV_PCM_FMTBIT_S8 | \ + SNDRV_PCM_FMTBIT_U8 | \ + SNDRV_PCM_FMTBIT_U16_LE | \ + SNDRV_PCM_FMTBIT_U16_BE, + .rates = SNDRV_PCM_RATE_32000, + .rate_min = 32000, + .rate_max = 32000, + .channels_min = 1, + .channels_max = 2, + .buffer_bytes_max = (256*1024), + .period_bytes_min = 64, + .period_bytes_max = (256*1024), + .periods_min = 4, + .periods_max = 1024, +}; + static void snd_card_saa7134_runtime_free(struct snd_pcm_runtime *runtime) { snd_card_saa7134_pcm_t *pcm = runtime->private_data; @@ -651,7 +674,13 @@ pcm->substream = substream; runtime->private_data = pcm; runtime->private_free = snd_card_saa7134_runtime_free; - runtime->hw = snd_card_saa7134_capture; + + if (amux == TV || &card(dev).radio == dev->input) { + /* TV uses 32kHz sampling, AM/FM radio is locked to 32kHz */ + runtime->hw = snd_card_saa7134_capture_32kHz_only; + } else { + runtime->hw = snd_card_saa7134_capture; + } if (dev->ctl_mute != 0) { saa7134->mute_was_on = 1;