From patchwork Mon Aug 11 00:04:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Smirl X-Patchwork-Id: 4705191 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 78C15C0338 for ; Mon, 11 Aug 2014 00:05:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4C2220166 for ; Mon, 11 Aug 2014 00:05:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 75D502015D for ; Mon, 11 Aug 2014 00:05:11 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 15703265065; Mon, 11 Aug 2014 02:05:05 +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 D0E85264FE3; Mon, 11 Aug 2014 02:04:54 +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 D1CC5264FF9; Mon, 11 Aug 2014 02:04:52 +0200 (CEST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by alsa0.perex.cz (Postfix) with ESMTP id 8BC30264F8D for ; Mon, 11 Aug 2014 02:04:44 +0200 (CEST) Received: by mail-lb0-f174.google.com with SMTP id c11so5307711lbj.19 for ; Sun, 10 Aug 2014 17:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yRYDfYxqPdhbJF12oxrDLATAkj/EJYeRpcxOfj2H04E=; b=oImNRC5+Ll81Whw0i1v8lxiuMO7mt/WBDJBpYWTbr2znfk4gUoXO5YLrtWyJoMiznW eWqm28xzbaMflZ4YtNlpRh1e95Mmqao5ossc6F5dQB0mgFyGy0IB1OTzCJcXOjnZEyKQ 7jrdyNuVRCZWJ3dwf2B0PuhuIMpxyog3JBzVHcyOPGyqrhTkTnXeZonh630c6vtJZccx jX2vF4yFebhGTAMoWDznBp5nlosq7kb39BkUOf9EgvjUrZ4egknf+B+K8bvF6u/vsU/q B2mYTRIl8IQZAf8giu/eODItQHNeYsxHuLvP7o+Cfas5VNGSFEB9+klsyeGIyUxGusZm chTA== MIME-Version: 1.0 X-Received: by 10.152.25.170 with SMTP id d10mr34559738lag.37.1407715483788; Sun, 10 Aug 2014 17:04:43 -0700 (PDT) Received: by 10.112.40.167 with HTTP; Sun, 10 Aug 2014 17:04:43 -0700 (PDT) In-Reply-To: References: <20140810105405.GW17528@sirena.org.uk> Date: Sun, 10 Aug 2014 20:04:43 -0400 Message-ID: From: "jonsmirl@gmail.com" To: Mark Brown Cc: alsa-devel mailing list , Lars-Peter Clausen , Liam Girdwood , zengzm.kernel@gmail.com, Kuninori Morimoto Subject: Re: [alsa-devel] Choosing the sysclk in simple-card looks broken to me. 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 After much messing around and learning the internals of OF clocks, it looks like this is what I need. diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 03a7fdc..05d074b 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -116,6 +117,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np, { struct device_node *node; struct clk *clk; + struct of_phandle_args clkspec; int ret; /* @@ -156,11 +158,14 @@ asoc_simple_card_sub_parse_of(struct device_node *np, "system-clock-frequency", &dai->sysclk); } else { - clk = of_clk_get(node, 0); - if (!IS_ERR(clk)) + clkspec.np = node; + clk = of_clk_get_from_provider(&clkspec); + + if (!IS_ERR(clk)) { dai->sysclk = clk_get_rate(clk); + clk_put(clk); + } } - return 0; }