From patchwork Fri Oct 24 13:31:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 5147461 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 02FCCC11AC for ; Fri, 24 Oct 2014 13:32:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0AFF220268 for ; Fri, 24 Oct 2014 13:32:11 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D086C201C8 for ; Fri, 24 Oct 2014 13:32:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5A90B26057D; Fri, 24 Oct 2014 15:32:06 +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=-0.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_FROM, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE, 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 6100F260560; Fri, 24 Oct 2014 15:31:55 +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 A802B26056C; Fri, 24 Oct 2014 15:31:53 +0200 (CEST) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by alsa0.perex.cz (Postfix) with ESMTP id 5552226055A for ; Fri, 24 Oct 2014 15:31:45 +0200 (CEST) Received: by mail-ob0-f178.google.com with SMTP id wn1so311534obc.37 for ; Fri, 24 Oct 2014 06:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=2rfcd4qU68rG9BsW+o1QMW302DyvXyyaiG5u4xcMiMw=; b=SBE4w6JyqtLaD9kXhz8hsT0kT7UHsHgUBvRliz7GfHXcEwHT8kr/S55mUB/cxIWIMA +aKvystFoaofYZ+W+42UPGRAQrfyutin23ulh9ri6O7CTT3dYETaPl0C4cBqw6ZpzJVj yLTyYWiahwFJT5PNUlkEtKALSfXq9q7dLTz1wHbZ8kZxBtltOBj62J6/PSzvesRpuxSJ QZa+9f3GaTVEcoZJ9a9yxF2ASTQMyRvzkjhHwxXHWioQF83tW5duqBr26ccLxi2gIhoJ soIdOxEn3/KFWPO8eJUN58NE974674/izldCr1PqQBA4AUuxqnDNfR+bpVleXf/xxU0h HwLQ== MIME-Version: 1.0 X-Received: by 10.202.108.151 with SMTP id h145mr214126oic.111.1414157503876; Fri, 24 Oct 2014 06:31:43 -0700 (PDT) Received: by 10.76.104.231 with HTTP; Fri, 24 Oct 2014 06:31:43 -0700 (PDT) Date: Fri, 24 Oct 2014 17:31:43 +0400 Message-ID: From: Max Filippov To: alsa-devel@alsa-project.org, Kuninori Morimoto Subject: [alsa-devel] Customizing simple audio card? 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 Hello, I'm developing ALSA driver for sound hardware on Xtensa FPGA boards. The hardware is very simple, we have AIC23 codec connected to I2S bus and I2S bus master that pumps data pushed by CPU into its FIFO. Both are connected to the same clock synthesizer output. There are no other devices that need to be supported now. Due to its simplicity the setup could happily use the simple sound card driver. But to support both 44100 and 48000 frequency ranges I need to change master clock, setting it either to 11289600 or to 12288000 Hz. I can do it in the I2S driver, but I see no way to inform audio codec of that change. I used the following hack to debug everything with the simple audio card: but that's of course not a solution. So my question is is there any way I can subclass or inherit from the simple audio card driver to add such functionality to it? diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index cef7776..abef5ed 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -43,6 +44,22 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, SND_SOC_CLOCK_IN); } + switch (params_rate(params)) { + case 48000: + case 32000: + case 16000: + case 8000: + ret = snd_soc_dai_set_sysclk(codec_dai, 0, 12288000, + SND_SOC_CLOCK_IN); + break; + case 44100: + case 22050: + case 11025: + ret = snd_soc_dai_set_sysclk(codec_dai, 0, 11289600, + SND_SOC_CLOCK_IN); + break; + + } return ret; }