Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp633377imm; Wed, 29 Aug 2018 08:22:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbX6Jq9onKhsT12njZDKjqMI/sz+lWdPihOuI9SfnhfxGHRNNC0MKnhjXYG9ZEtxeo31guT X-Received: by 2002:a17:902:bf0b:: with SMTP id bi11-v6mr6478020plb.76.1535556142363; Wed, 29 Aug 2018 08:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535556142; cv=none; d=google.com; s=arc-20160816; b=QWq6BHJG9WTpdORwEpNNRvcnQzxinQG1tHlBkdT9vqU2IFsNqdywswlILdeItzjwU/ VsjuiGa+r+YOvHStc6moOB3mr9iGnWXIEfBJFbuV7N/wnKaNiL7FoboBRsK4qNK+I4JD wS9cUMRbNzgWrfjNURzk+vM05BG5MCnDMe18VFSWO+v47UaAUI0I0iJhPqKoF1s2zLiT XJxw+niEu0iwNWwLHaXwNp9VutTWbuttXkE/wr0H7if4KTg6mZ+RjXYIEb8wDM/EFnCq fRirXqjwLwBQ7R9W6fd0YKv9e+s2DYzuO9z3SO50AXMcZK9TrPuScg3iV/mt+QDjI4JD Dg0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=3DBjdpX21AwUyIkhLFReKT0PZANjQGrDucYX5r3d+wg=; b=GjJTJpbyjiadKopsIDRXIXsp8DJFZQhyFhj+OhV/PZXCRJ09nPuD8W3/A1omASCUTb +kMXKbP3Y6+4A6jwvXFC+WJaIExAbg5m+gXEw1kBXFl67s2aLLZGJfmcF0e8VOM8iWBJ WWoB/jNtHZa285ZraW9PSKSCUG8DNsfbwwhC0SJbrOAHeEdMCd24kozs0FbVkQ3BHnW5 IE++UTZKPyKUy3QJI8cN1TalfOFHvoE6LrTvtESMUXKibK2HPpjpdtELM5r0Bl4GHdRb E0Q/MlHaNXjbFwdIM8qKkmdDV7Gk2MZKkrpPXxULbnW3SYy2piIH8gFiZMPOB9CA9WUw na9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4-v6si3889633pgg.537.2018.08.29.08.22.07; Wed, 29 Aug 2018 08:22:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729089AbeH2TS1 (ORCPT + 99 others); Wed, 29 Aug 2018 15:18:27 -0400 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:59309 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728701AbeH2TS0 (ORCPT ); Wed, 29 Aug 2018 15:18:26 -0400 X-IronPort-AV: E=Sophos;i="5.53,303,1531810800"; d="scan'208";a="19723295" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Aug 2018 08:21:00 -0700 Received: from [10.145.4.68] (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Wed, 29 Aug 2018 08:20:59 -0700 Subject: Re: [PATCH 1/2] ASoC: Add driver for PROTO Audio CODEC (with a WM8731) To: Mark Brown CC: , , , , , , , , References: <20180829144727.13757-1-codrin.ciubotariu@microchip.com> <20180829144727.13757-2-codrin.ciubotariu@microchip.com> <20180829145355.GD27808@sirena.org.uk> From: Codrin Ciubotariu Message-ID: <8f1ecff2-aab7-2a1d-a8d3-8d0062a8a9e0@microchip.com> Date: Wed, 29 Aug 2018 18:20:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180829145355.GD27808@sirena.org.uk> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29.08.2018 17:53, Mark Brown wrote: > On Wed, Aug 29, 2018 at 05:47:26PM +0300, Codrin Ciubotariu wrote: > >> +static const unsigned int wm8731_rates_12288000[] = { >> + 8000, 32000, 48000, 96000, >> +}; >> + >> +static struct snd_pcm_hw_constraint_list wm8731_constraints_12288000 = { >> + .list = wm8731_rates_12288000, >> + .count = ARRAY_SIZE(wm8731_rates_12288000), >> +}; >> + >> +static int snd_proto_startup(struct snd_pcm_substream *substream) >> +{ >> + /* Setup constraints, because there is a 12.288 MHz XTAL on the board */ >> + snd_pcm_hw_constraint_list(substream->runtime, 0, >> + SNDRV_PCM_HW_PARAM_RATE, >> + &wm8731_constraints_12288000); >> + return 0; >> +} > > This bit is better added to the CODEC driver since it'll apply to any > system where there's this clock rate (someone else could come in and add > other rates, no need to do that yourself though it'd be nice of course). I could do it. > > That also has the nice bonus that with that I think you'd be able to use > the graph card rather than a custom driver? The main reason for adding a custom driver and not using graph/simple card is the snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, XTAL_RATE, SND_SOC_CLOCK_IN) call. This enables the oscillator found in the wm8731 codec. Since WM8731_SYSCLK_XTAL is not 0, we can't use system-clock-frequency DT property to set it. Best regards, Codrin