From patchwork Thu Jul 31 06:52:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4654101 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 930699F2B8 for ; Thu, 31 Jul 2014 06:52:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C09E9201BC for ; Thu, 31 Jul 2014 06:52:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5D3CF20149 for ; Thu, 31 Jul 2014 06:52:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CBAF4261B31; Thu, 31 Jul 2014 08:52:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A36D3261AF6; Thu, 31 Jul 2014 08:52:17 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 37C26261AF6; Thu, 31 Jul 2014 08:52:16 +0200 (CEST) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by alsa0.perex.cz (Postfix) with ESMTP id 6144B261AF7 for ; Thu, 31 Jul 2014 08:52:07 +0200 (CEST) Received: by mail-pd0-f172.google.com with SMTP id ft15so2911561pdb.17 for ; Wed, 30 Jul 2014 23:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:subject:user-agent:to:cc:mime-version :content-type; bh=5HjkE3EDMmYhiwGwKV2rsWDMOgka2t4kBNtyLWShrDE=; b=iKyYHJ4GgRepLhSuCQa53+vgDoWPwRIIWsQ6LH0m5KbFVxFX1MKC1w9jh9CNRnJ813 6Eij2AJviXig9lriLK52XMkVfojDpC44FlTp03jYbemzmQVy61pvXlj+S9hiNJ32++G2 ekoApWt2GVmLc4Iuok3gjLSfwNeMNLTm7z2T4r/arkD4ft8NqReTQyMDFWARwb9wflzy ZUmtE/RZUcmHZWDVa2HfY7tRk5rJNzEwBQCd8j/rRyI5e3LHdRftErD/KexrcdqHwQXJ gGVTgAi7MkMI38z7o1RRjjv8uE0RoqScvZFtH3Oh3osPO8qheyltyL1RQjk/oGh4apZ0 xXjQ== X-Received: by 10.68.179.66 with SMTP id de2mr2105123pbc.31.1406789525420; Wed, 30 Jul 2014 23:52:05 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id kt2sm4393737pbc.83.2014.07.30.23.52.03 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Jul 2014 23:52:04 -0700 (PDT) Date: Wed, 30 Jul 2014 23:52:04 -0700 (PDT) Message-ID: <87fvhiuijw.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Mark Brown MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto Subject: [alsa-devel] [PATCH] ASoC: rsnd: care detail of SRC_BSDSR X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Driver should care more detail of SRC_BSDSR settings. The sound includes noise without this patch if it used SRC. Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/src.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 4d39505..1ef811a 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -483,15 +483,45 @@ static struct rsnd_mod_ops rsnd_src_gen1_ops = { static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod, struct rsnd_dai *rdai) { + struct rsnd_priv *priv = rsnd_mod_to_priv(mod); + struct device *dev = rsnd_priv_to_dev(priv); + struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); + struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); + struct rsnd_src *src = rsnd_mod_to_src(mod); + uint ratio; int ret; + /* 6 - 1/6 are very enough ratio for SRC_BSDSR */ + if (!rsnd_src_convert_rate(src)) + ratio = 0; + else if (rsnd_src_convert_rate(src) > runtime->rate) + ratio = 100 * rsnd_src_convert_rate(src) / runtime->rate; + else + ratio = 100 * runtime->rate / rsnd_src_convert_rate(src); + + if (ratio > 600) { + dev_err(dev, "FSO/FSI ratio error\n"); + return -EINVAL; + } + ret = rsnd_src_set_convert_rate(mod, rdai); if (ret < 0) return ret; rsnd_mod_write(mod, SRC_SRCCR, 0x00011110); - rsnd_mod_write(mod, SRC_BSDSR, 0x01800000); + switch (rsnd_mod_id(mod)) { + case 5: + case 6: + case 7: + case 8: + rsnd_mod_write(mod, SRC_BSDSR, 0x02400000); + break; + default: + rsnd_mod_write(mod, SRC_BSDSR, 0x01800000); + break; + } + rsnd_mod_write(mod, SRC_BSISR, 0x00100060); return 0;