From patchwork Fri Apr 3 01:37:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6152921 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5BE939F1BE for ; Fri, 3 Apr 2015 01:37:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45AA4203AA for ; Fri, 3 Apr 2015 01:37:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0B77203A9 for ; Fri, 3 Apr 2015 01:37:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753007AbbDCBhj (ORCPT ); Thu, 2 Apr 2015 21:37:39 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:61400 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752507AbbDCBhi (ORCPT ); Thu, 2 Apr 2015 21:37:38 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie1.idc.renesas.com with ESMTP; 03 Apr 2015 10:37:37 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 2E28C46F36 for ; Fri, 3 Apr 2015 10:37:37 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 1BB488002D; Fri, 3 Apr 2015 10:37:37 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 118028002F for ; Fri, 3 Apr 2015 10:37:37 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id LAD24391; Fri, 3 Apr 2015 10:37:37 +0900 X-IronPort-AV: E=Sophos;i="5.11,514,1422889200"; d="scan'208";a="183300735" Received: from mail-sg1lp0085.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.85]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 03 Apr 2015 10:37:36 +0900 Received: from morimoto-PC.renesas.com (211.11.155.132) by HKNPR06MB305.apcprd06.prod.outlook.com (10.141.37.16) with Microsoft SMTP Server (TLS) id 15.1.125.19; Fri, 3 Apr 2015 01:37:35 +0000 Message-ID: <877ftuxaa6.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Linux-SH CC: shiiba , komatsu Subject: [LOCAL PATCH] test: ARM: shmobile: SRC sampling rate convert User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 3 Apr 2015 01:37:35 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: OS1PR01CA0014.jpnprd01.prod.outlook.com (25.161.225.152) To HKNPR06MB305.apcprd06.prod.outlook.com (10.141.37.16) Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKNPR06MB305; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(53754006)(50466002)(47776003)(229853001)(42186005)(53416004)(23726002)(36756003)(122386002)(110136001)(40100003)(54356999)(50986999)(46102003)(87976001)(46406003)(77156002)(450100001)(66066001)(19580395003)(77096005)(83506001)(86362001)(92566002)(33646002)(19580405001)(62966003)(21314002); DIR:OUT; SFP:1102; SCL:1; SRVR:HKNPR06MB305; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:HKNPR06MB305; BCL:0; PCL:0; RULEID:; SRVR:HKNPR06MB305; X-Forefront-PRVS: 05352A48BE X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2015 01:37:35.3891 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKNPR06MB305 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all Latest ALSA SoC branch is including Synchronous SRC mode on 43cb6954f8c8a68fdc354226fa045ff43c7e4d39 (ASoC: rsnd: add Synchronous SRC mode) ALSA SoC git repository git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git :: topic/rcar You can try Synchronous/Asynchronous sampling rate convert. - git checkout Geert's renesas-drivers-2015-03-30-v4.0-rc6 or similar - git merge ASoC branch asoc/topic/rcar - apply this patch Asynchronous SRC mode: Use normal playback. it will exchange sampling rate convert to 48kHz. The image is... 48kHz -> 44.1kHz -> [SRC] -> 48kHz -> [SSI] -> ak4642 22050Hz -> ... But unfortunately, Lager board only has 1 system clock which is needed for sampling rate convert. Because of this reason, this patch try to exchange to 48kHz from 12288000 Hz. So, 44.1kHz base sound will be strange sound. Because 44.1kHz base needs 11289600 Hz, but Lager doesn't have it. It needs both 11289600/12288000 system clock if you want to use all sampling rate. But, don't worry about this. Asynchronous SRC mode is not needed on Lager anyway. this is just for test/debug. Synchronous SRC mode: You can try this command. amixer set "SRC Out Rate" on aplay xxx.wav & amixer set "SRC Out Rate" 96000 // convert rate to 96000Hz amixer set "SRC Out Rate" 22050 // convert rate to 22050Hz You can exchange sampling rate on runtime. But ak4642 is keeping 48kHz on this patch. So, the sound will be fast/slow. Sampling rate will be reset when you stop aplay. I don't know detail of use case of this feature... I'm happy if I could have feedback from you. >> Simon This is just test/debug patch. don't apply it to your branch :P Signed-off-by: Kuninori Morimoto --- arch/arm/boot/dts/r8a7790-lager.dts | 40 +++++++++++++++++++++++++++++++++---- arch/arm/configs/shmobile_defconfig | 1 + 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts index aaa4f25..5360067 100644 --- a/arch/arm/boot/dts/r8a7790-lager.dts +++ b/arch/arm/boot/dts/r8a7790-lager.dts @@ -18,7 +18,7 @@ * * This command is required when Playback/Capture * - * amixer set "LINEOUT Mixer DACL" on + * amixer set "ak4642 LINEOUT Mixer DACL" on * amixer set "DVC Out" 100% * amixer set "DVC In" 100% * @@ -35,6 +35,13 @@ * aplay xxx.wav & * amixer set "DVC Out" 80% // Volume Down * amixer set "DVC Out" 100% // Volume Up + * + * You can use Synchronous Sampling Rate Convert (if no DVC) + * + * amixer set "SRC Out Rate" on + * aplay xxx.wav & + * amixer set "SRC Out Rate" 96000 // convert rate to 96000Hz + * amixer set "SRC Out Rate" 22050 // convert rate to 22050Hz */ /dts-v1/; @@ -174,8 +181,9 @@ 1800000 0>; }; - sound { + sound@1 { compatible = "simple-audio-card"; + status = "disabled"; simple-audio-card,format = "left_j"; simple-audio-card,bitclock-master = <&sndcodec>; @@ -191,6 +199,26 @@ }; }; + sound@2 { + compatible = "renesas,rsrc-card,lager"; + + card-name = "rsnd-ak4643"; + format = "left_j"; + bitclock-master = <&dpcmcpu>; + frame-master = <&dpcmcpu>; + + convert-rate = <48000>; /* see audio_clk_a */ + + dpcmcpu: cpu { + sound-dai = <&rcar_sound>; + }; + + dpcmcodec: codec { + sound-dai = <&ak4643>; + system-clock-frequency = <11289600>; + }; + }; + vga-encoder { compatible = "adi,adv7123"; @@ -675,8 +703,8 @@ rcar_sound,dai { dai0 { - playback = <&ssi0 &src2 &dvc0>; - capture = <&ssi1 &src3 &dvc1>; + playback = <&ssi0 &src2>; + capture = <&ssi1 &src3>; }; }; }; @@ -684,3 +712,7 @@ &ssi1 { shared-pin; }; + +&audio_clk_a { + clock-frequency = <12288000>; /* 48000 base clock */ +}; diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig index b58618e..d2f807d 100644 --- a/arch/arm/configs/shmobile_defconfig +++ b/arch/arm/configs/shmobile_defconfig @@ -152,6 +152,7 @@ CONFIG_SND=y CONFIG_SND_SOC=y CONFIG_SND_SOC_SH4_FSI=y CONFIG_SND_SOC_RCAR=y +CONFIG_SND_SOC_RSRC_CARD=y CONFIG_SND_SOC_AK4642=y CONFIG_SND_SOC_WM8978=y CONFIG_USB=y