From patchwork Thu May 22 09:17:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 30577 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1BA0220369 for ; Thu, 22 May 2014 09:19:40 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id uo5sf10013874pbc.0 for ; Thu, 22 May 2014 02:19:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=sFpCSMO0OVwCWYE4/S3Mfuz4zA0cdezXQ3Lli7jp5qo=; b=FzOx7HcPYWUDRL8VRlI2gGN8XkJE65WMqtSBYmLMDZuWZsHJ0xeNynet3Umt6RBwPR 0lzm8evtxqw6r4CkUWvBwSYfKANafozzjyxKs8S7gxUZHnLtCBRFKs4tLpAbhpm3ZhJC nhIU+rX4uOMtF8ERPYZC3izvh6hJKAbATClnknRTHwJEzIg6WN9Pol/e+P0KH1baM1Nx bJGgXASC01PAs6FarEZAkLHqjDz72bgaq1syAEZ7sKLXO50efps8POEAf8fdK+zTCACf h/+VbIH13nLGMkZI5R/OSAVEZDEmh/jqjNO4ZcZ+SxSJXS9YcaEoZZlMv7ZMyeObAb2V NAeg== X-Gm-Message-State: ALoCoQnl+D2+jYXwWjuul6k24YChI2jm4XWlfupLHvJfmJqX4UIOFQ6o7pyJ+uFfR9RKD0LLjIAL X-Received: by 10.66.141.135 with SMTP id ro7mr24511277pab.28.1400750379317; Thu, 22 May 2014 02:19:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.85 with SMTP id 79ls1183736qgk.41.gmail; Thu, 22 May 2014 02:19:39 -0700 (PDT) X-Received: by 10.220.92.193 with SMTP id s1mr14749503vcm.34.1400750379205; Thu, 22 May 2014 02:19:39 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id qc5si4502763vcb.53.2014.05.22.02.19.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 02:19:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.169 as permitted sender) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id jx11so4028928veb.14 for ; Thu, 22 May 2014 02:19:39 -0700 (PDT) X-Received: by 10.220.53.72 with SMTP id l8mr14879176vcg.16.1400750379069; Thu, 22 May 2014 02:19:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp181937vcb; Thu, 22 May 2014 02:19:38 -0700 (PDT) X-Received: by 10.66.148.70 with SMTP id tq6mr65699666pab.56.1400750378267; Thu, 22 May 2014 02:19:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ga2si32746948pac.126.2014.05.22.02.19.37; Thu, 22 May 2014 02:19:37 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754242AbaEVJT2 (ORCPT + 27 others); Thu, 22 May 2014 05:19:28 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:58345 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754225AbaEVJT0 (ORCPT ); Thu, 22 May 2014 05:19:26 -0400 Received: by mail-pb0-f54.google.com with SMTP id jt11so2340823pbb.13 for ; Thu, 22 May 2014 02:19:25 -0700 (PDT) X-Received: by 10.66.250.166 with SMTP id zd6mr402095pac.7.1400750365606; Thu, 22 May 2014 02:19:25 -0700 (PDT) Received: from linaro.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id im2sm12039249pbb.32.2014.05.22.02.19.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 02:19:22 -0700 (PDT) From: Tushar Behera To: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: tiwai@suse.de, perex@perex.cz, broonie@kernel.org, dianders@chromium.org, jerry.wong@maximintegrated.com Subject: [PATCH 1/2] ASoC: max98090: Add master clock handling Date: Thu, 22 May 2014 14:47:07 +0530 Message-Id: <1400750228-13750-2-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400750228-13750-1-git-send-email-tushar.behera@linaro.org> References: <1400750228-13750-1-git-send-email-tushar.behera@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: tushar.behera@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If master clock is provided through device tree, then update the master clock frequency during set_sysclk. Documentation has been updated to reflect the change. Signed-off-by: Tushar Behera --- .../devicetree/bindings/sound/max98090.txt | 6 ++++++ sound/soc/codecs/max98090.c | 13 +++++++++++++ sound/soc/codecs/max98090.h | 1 + 3 files changed, 20 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/max98090.txt b/Documentation/devicetree/bindings/sound/max98090.txt index e4c8b36..a5e63fa 100644 --- a/Documentation/devicetree/bindings/sound/max98090.txt +++ b/Documentation/devicetree/bindings/sound/max98090.txt @@ -10,6 +10,12 @@ Required properties: - interrupts : The CODEC's interrupt output. +Optional properties: + +- clocks: The phandle of the master clock to the CODEC + +- clock-names: Should be "mclk" + Pins on the device (for linking into audio routes): * MIC1 diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 9b76f5a..41c61eb 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1929,6 +1930,11 @@ static int max98090_dai_set_sysclk(struct snd_soc_dai *dai, if (freq == max98090->sysclk) return 0; + if (!IS_ERR(max98090->mclk)) { + freq = clk_round_rate(max98090->mclk, freq); + clk_set_rate(max98090->mclk, freq); + } + /* Setup clocks for slave mode, and using the PLL * PSCLK = 0x01 (when master clk is 10MHz to 20MHz) * 0x02 (when master clk is 20MHz to 40MHz).. @@ -2213,6 +2219,10 @@ static int max98090_probe(struct snd_soc_codec *codec) dev_dbg(codec->dev, "max98090_probe\n"); + max98090->mclk = devm_clk_get(codec->dev, "mclk"); + if (!IS_ERR(max98090->mclk)) + clk_prepare_enable(max98090->mclk); + max98090->codec = codec; /* Reset the codec, the DSP core, and disable all interrupts */ @@ -2308,6 +2318,9 @@ static int max98090_remove(struct snd_soc_codec *codec) cancel_delayed_work_sync(&max98090->jack_work); + if (!IS_ERR(max98090->mclk)) + clk_disable_unprepare(max98090->mclk); + return 0; } diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h index 5a3c8d0..cf1b606 100644 --- a/sound/soc/codecs/max98090.h +++ b/sound/soc/codecs/max98090.h @@ -1524,6 +1524,7 @@ struct max98090_priv { struct snd_soc_codec *codec; enum max98090_type devtype; struct max98090_pdata *pdata; + struct clk *mclk; unsigned int sysclk; unsigned int bclk; unsigned int lrclk;