Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp96934ybl; Tue, 7 Jan 2020 14:57:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxM4AfrcQKHbTU3hA/sTZSmB5zYBYsH4MXcUrid0MI/jXvPdalKkkZ80bQ4rFhIl/fQxHb0 X-Received: by 2002:a05:6830:18e3:: with SMTP id d3mr2027775otf.190.1578437855841; Tue, 07 Jan 2020 14:57:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578437855; cv=none; d=google.com; s=arc-20160816; b=ppB8HoYM4a1F126PcRbrXJ4M8GDyqpRQiMsftuf5wCDEUajWYJwr03LSugiTVEYGH+ 0Dta0W6+6TtnodCtpwNf1yNy6NryuwG8PxVuWpACe40+/6TPgk64/Dv7zZslBfe8yFds vc/6//7PMQ8V6BSkQ9EVifXe+IESIWikthQ7gBMJxIJZ2/sZR+m/bx/XYOHKr+wTFW64 JSHAu/YZuCJZIQ+lZCRQJvf2VJe4xmDmeNiZMIRRTE5YuXKqZgRl6tCrd6EexPARNbqt 3HcUY2dB+5Fp/Evh9oy22ZCK8nQJO/QI9ydm5bxFyIkWxE0YA4CtMCgFUv3RZ8QjhZ3t lRxA== 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:dkim-signature; bh=SmAaNlqX7wktMzlx+PndgXg6P7/OceJAZF8e2T4rFsk=; b=UjSxn7/SSAFlLfb7lWP1ASjluL6PAEKIcuhdLIIBLmkzrb6y0Ym0m3dqtnJ5IaZtBZ 97XB750wE1z7tt/a8sIaXYGzkMrq4vTgpp3EBBfnGaC+u/EkP8+YMlEHdlZwOO0Xaeel vj+lwnCjWuziXppoFPxhBa9TyIa9QGiZWjxtyAry1cra9901HLN27ytifEWLzUWpwwPs IGe822WwmZhhOpaS/wIKrtq3SkuyKzMTPdjFoOZDehEJjjMRWmqHpSeLz+jHTWi6FQQM AO8IMJmSVwr4ZaIwQDDky9wC+VjL8Y/QCBDDE9QsqKr8SjAQCh/WpJwiS4iyRPaDYyaE BKOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pISxBC+C; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 10si733783ois.76.2020.01.07.14.57.23; Tue, 07 Jan 2020 14:57:35 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pISxBC+C; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727487AbgAGW4h (ORCPT + 99 others); Tue, 7 Jan 2020 17:56:37 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:47044 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727046AbgAGW4g (ORCPT ); Tue, 7 Jan 2020 17:56:36 -0500 Received: by mail-lj1-f193.google.com with SMTP id m26so1258713ljc.13; Tue, 07 Jan 2020 14:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SmAaNlqX7wktMzlx+PndgXg6P7/OceJAZF8e2T4rFsk=; b=pISxBC+CwrFnifLFtbUDSEPoXWhewuFGjcbF7HnhNniuA5FtthlSYCpVkmpIB79m96 mOJA0eNkHLmAoYUo+a9ve5sncjZUjCGdJmOUwv68tNg23UR/7m4NPlnUpVDEKf6zcOBG 4h9zQZ7jij4MdXSOlqyoeaqurv9REuRMuBMP9vqGDmZ+1vmaBtp9Mht3S01M0rJkG+8p /kje1cuZflBVR1/uiOumJYQtnhPv/gtQlv4vVboT4W2ZFKpshTwQtDsOCMMszj3p/PL1 ftt4CdV7Ds7XQ6EpS/xJ9gQhIwEXwdhOALi2CsUSeltofBQ9BOr2bbZz/cPWy62MmDSp Kubw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SmAaNlqX7wktMzlx+PndgXg6P7/OceJAZF8e2T4rFsk=; b=TJTTEoIeniTmZqP322kuD8d52IqWHzYPvZUKesrK+QLgvesuUvhRQSsAMhkyIsXtAW iSWOokj0qI0axFATvnR/LFLnMHl6gOtpJRh+ujn0FRaOiIjxJY1h8oJpu9YMW3M90byZ eSbvn8rYE5b6J/wjpKeslHXxcekeZh2HdYWOmsxNbEL3uK2spH3fyUMAyhPgaj0IM5GK t1dWzXLLRPywzcIzcGYvJoMj6oeB7Mfp0T4eY+cT8rTOAluyIlDS8Rffkr6BFxfenMzS TxybU2TBW1tqMXy2YqBurVBjANlE8JQgmtwflZUOJn8Supht20mez2auXKoTlxTzUoMh 2GOw== X-Gm-Message-State: APjAAAV+bbazqiwAwyB5AUch3lYU5KE67NNx6nVzEaunw0gPNC4P+cJe pwpmWJUi6NSxMbylJ64S4eXdjUfr X-Received: by 2002:a2e:461a:: with SMTP id t26mr1069905lja.204.1578437793579; Tue, 07 Jan 2020 14:56:33 -0800 (PST) Received: from [192.168.2.145] (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.googlemail.com with ESMTPSA id 2sm390279ljq.38.2020.01.07.14.56.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jan 2020 14:56:32 -0800 (PST) Subject: Re: [PATCH v6 12/19] ASoC: tegra: Add audio mclk configuration To: Sowjanya Komatineni , Sameer Pujar , thierry.reding@gmail.com, jonathanh@nvidia.com, broonie@kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, mperttunen@nvidia.com, gregkh@linuxfoundation.org, sboyd@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: pdeschrijver@nvidia.com, pgaikwad@nvidia.com, josephl@nvidia.com, daniel.lezcano@linaro.org, mmaddireddy@nvidia.com, markz@nvidia.com, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <1578370458-3686-1-git-send-email-skomatineni@nvidia.com> <1578370458-3686-13-git-send-email-skomatineni@nvidia.com> From: Dmitry Osipenko Message-ID: Date: Wed, 8 Jan 2020 01:56:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 07.01.2020 19:56, Sowjanya Komatineni пишет: > > On 1/7/20 3:14 AM, Sameer Pujar wrote: >> >> On 1/7/2020 9:44 AM, Sowjanya Komatineni wrote: >>> Tegra PMC clock clk_out_1 is dedicated for audio mclk from Tegra30 >>> through Tegra210 and currently Tegra clock driver does the initial >>> parent >>> configuration for audio mclk and keeps it enabled by default. >>> >>> With the move of PMC clocks from clock driver into pmc driver, >>> audio clocks parent configuration can be specified through the device >>> tree >>> using assigned-clock-parents property and audio mclk control should be >>> taken care by the audio driver. >>> >>> This patch has implementation for parent configuration when default >>> parent >>> configuration is not specified in the device tree and controls audio >>> mclk >>> enable and disable during machine startup and shutdown. >>> >>> Signed-off-by: Sowjanya Komatineni >> >> Minor comments, otherwise LGTM. >> > Thanks Sameer. Will fix. >>> --- >>>   sound/soc/tegra/tegra_alc5632.c    | 21 ++++++++++ >>>   sound/soc/tegra/tegra_asoc_utils.c | 84 >>> ++++++++++++++++++++++++-------------- >>>   sound/soc/tegra/tegra_asoc_utils.h |  2 + >>>   sound/soc/tegra/tegra_max98090.c   | 21 ++++++++++ >>>   sound/soc/tegra/tegra_rt5640.c     | 21 ++++++++++ >>>   sound/soc/tegra/tegra_rt5677.c     | 21 ++++++++++ >>>   sound/soc/tegra/tegra_sgtl5000.c   | 21 ++++++++++ >>>   sound/soc/tegra/tegra_wm8753.c     | 21 ++++++++++ >>>   sound/soc/tegra/tegra_wm8903.c     | 21 ++++++++++ >>>   sound/soc/tegra/trimslice.c        | 21 ++++++++++ >>>   10 files changed, 224 insertions(+), 30 deletions(-) >>> >>> diff --git a/sound/soc/tegra/tegra_alc5632.c >>> b/sound/soc/tegra/tegra_alc5632.c >>> index 50a6d2ff4442..0fd10023f7a6 100644 >>> --- a/sound/soc/tegra/tegra_alc5632.c >>> +++ b/sound/soc/tegra/tegra_alc5632.c >>> @@ -62,8 +62,29 @@ static int tegra_alc5632_asoc_hw_params(struct >>> snd_pcm_substream *substream, >>>       return 0; >>>   } >>>   +static int tegra_alc5632_asoc_startup(struct snd_pcm_substream >>> *substream) >>> +{ >>> +    struct snd_soc_pcm_runtime *rtd = substream->private_data; >>> +    struct tegra_alc5632 *machine = >>> snd_soc_card_get_drvdata(rtd->card); >>> +    int ret; >>> + >>> +    ret = tegra_asoc_utils_clk_enable(&machine->util_data); >>> + >>> +    return ret; >>> +} >>> + >>> +static void tegra_alc5632_asoc_shutdown(struct snd_pcm_substream >>> *substream) >>> +{ >>> +    struct snd_soc_pcm_runtime *rtd = substream->private_data; >>> +    struct tegra_alc5632 *machine = >>> snd_soc_card_get_drvdata(rtd->card); >>> + >>> +    tegra_asoc_utils_clk_disable(&machine->util_data); >>> +} >>> + >>>   static const struct snd_soc_ops tegra_alc5632_asoc_ops = { >>> +    .startup = tegra_alc5632_asoc_startup, >>>       .hw_params = tegra_alc5632_asoc_hw_params, >>> +    .shutdown = tegra_alc5632_asoc_shutdown, >>>   }; >>>     static struct snd_soc_jack tegra_alc5632_hs_jack; >>> diff --git a/sound/soc/tegra/tegra_asoc_utils.c >>> b/sound/soc/tegra/tegra_asoc_utils.c >>> index 0d2271952555..2886ae9f5a16 100644 >>> --- a/sound/soc/tegra/tegra_asoc_utils.c >>> +++ b/sound/soc/tegra/tegra_asoc_utils.c >>> @@ -60,8 +60,6 @@ int tegra_asoc_utils_set_rate(struct >>> tegra_asoc_utils_data *data, int srate, >>>       data->set_mclk = 0; >>>         clk_disable_unprepare(data->clk_cdev1); >>> -    clk_disable_unprepare(data->clk_pll_a_out0); >>> -    clk_disable_unprepare(data->clk_pll_a); >>>         err = clk_set_rate(data->clk_pll_a, new_baseclock); >>>       if (err) { >>> @@ -77,18 +75,6 @@ int tegra_asoc_utils_set_rate(struct >>> tegra_asoc_utils_data *data, int srate, >>>         /* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */ >>>   -    err = clk_prepare_enable(data->clk_pll_a); >>> -    if (err) { >>> -        dev_err(data->dev, "Can't enable pll_a: %d\n", err); >>> -        return err; >>> -    } >>> - >>> -    err = clk_prepare_enable(data->clk_pll_a_out0); >>> -    if (err) { >>> -        dev_err(data->dev, "Can't enable pll_a_out0: %d\n", err); >>> -        return err; >>> -    } >>> - >>>       err = clk_prepare_enable(data->clk_cdev1); >>>       if (err) { >>>           dev_err(data->dev, "Can't enable cdev1: %d\n", err); >>> @@ -109,8 +95,6 @@ int tegra_asoc_utils_set_ac97_rate(struct >>> tegra_asoc_utils_data *data) >>>       int err; >>>         clk_disable_unprepare(data->clk_cdev1); >>> -    clk_disable_unprepare(data->clk_pll_a_out0); >>> -    clk_disable_unprepare(data->clk_pll_a); >>>         /* >>>        * AC97 rate is fixed at 24.576MHz and is used for both the host >>> @@ -130,17 +114,27 @@ int tegra_asoc_utils_set_ac97_rate(struct >>> tegra_asoc_utils_data *data) >>>         /* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */ >>>   -    err = clk_prepare_enable(data->clk_pll_a); >>> +    err = clk_prepare_enable(data->clk_cdev1); >>>       if (err) { >>> -        dev_err(data->dev, "Can't enable pll_a: %d\n", err); >>> +        dev_err(data->dev, "Can't enable cdev1: %d\n", err); >>>           return err; >>>       } >>>   -    err = clk_prepare_enable(data->clk_pll_a_out0); >>> -    if (err) { >>> -        dev_err(data->dev, "Can't enable pll_a_out0: %d\n", err); >>> -        return err; >>> -    } >>> +    data->set_baseclock = pll_rate; >>> +    data->set_mclk = ac97_rate; >>> + >>> +    return 0; >>> +} >>> +EXPORT_SYMBOL_GPL(tegra_asoc_utils_set_ac97_rate); >>> + >>> +void tegra_asoc_utils_clk_disable(struct tegra_asoc_utils_data *data) >>> +{ >>> +    clk_disable_unprepare(data->clk_cdev1); >>> +} >>> + >>> +int tegra_asoc_utils_clk_enable(struct tegra_asoc_utils_data *data) >>> +{ >>> +    int err; >>>         err = clk_prepare_enable(data->clk_cdev1); >>>       if (err) { >>> @@ -148,16 +142,13 @@ int tegra_asoc_utils_set_ac97_rate(struct >>> tegra_asoc_utils_data *data) >>>           return err; >>>       } >>>   -    data->set_baseclock = pll_rate; >>> -    data->set_mclk = ac97_rate; >>> - >>>       return 0; >>>   } >>> -EXPORT_SYMBOL_GPL(tegra_asoc_utils_set_ac97_rate); >>>     int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, >>>                 struct device *dev) >>>   { >>> +    struct clk *clk_out_1, *clk_extern1; >>>       int ret; >>>         data->dev = dev; >>> @@ -193,9 +184,42 @@ int tegra_asoc_utils_init(struct >>> tegra_asoc_utils_data *data, >>>           return PTR_ERR(data->clk_cdev1); >>>       } >>>   -    ret = tegra_asoc_utils_set_rate(data, 44100, 256 * 44100); >>> -    if (ret) >>> -        return ret; >>> +    /* >>> +     * If clock parents are not set in DT, configure here to use >>> clk_out_1 >>> +     * as mclk and extern1 as parent for Tegra30 and higher. >>> +     */ >>> +    if (!of_find_property(dev->of_node, "assigned-clock-parents", >>> NULL) && >>> +        data->soc > TEGRA_ASOC_UTILS_SOC_TEGRA20) { >>> +        dev_err(data->dev, >> >> As this is a fallback mechanism, use dev_info or dev_dbg instead? dev_warn >>> +            "Configuring clocks for a legacy device-tree\n"); I'd also add another message here saying "Please update your DT", for clarity.