linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Sowjanya Komatineni <skomatineni@nvidia.com>,
	Sameer Pujar <spujar@nvidia.com>,
	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
Subject: Re: [PATCH v6 12/19] ASoC: tegra: Add audio mclk configuration
Date: Wed, 8 Jan 2020 01:56:31 +0300	[thread overview]
Message-ID: <adb4c9dd-043a-ffca-7a1d-c6b30055b7a0@gmail.com> (raw)
In-Reply-To: <d85c8529-9970-c79c-9430-ed80c47eaf36@nvidia.com>

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 <skomatineni@nvidia.com>
>>
>> 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.

  reply	other threads:[~2020-01-07 22:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07  4:13 [PATCH v6 00/19] Move PMC clocks into Tegra PMC driver Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 01/19] dt-bindings: clock: tegra: Change CLK_M_DIV to OSC_DIV clocks Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 02/19] clk: tegra: Change CLK_M_DIV clocks " Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 03/19] clk: tegra: Fix Tegra PMC clock out parents Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 04/19] dt-bindings: tegra: Convert Tegra PMC bindings to YAML Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 05/19] dt-bindings: soc: tegra-pmc: Add Tegra PMC clock bindings Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 06/19] soc: tegra: Add Tegra PMC clocks registration into PMC driver Sowjanya Komatineni
2020-01-08  1:00   ` Dmitry Osipenko
2020-01-08  1:13     ` Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 07/19] dt-bindings: soc: tegra-pmc: Add id for Tegra PMC 32KHz blink clock Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 08/19] soc: tegra: Add support for " Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 09/19] clk: tegra: Remove tegra_pmc_clk_init along with clk ids Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 10/19] dt-bindings: clock: tegra: Remove pmc clock ids from clock dt-bindings Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 11/19] ASoC: tegra: Use device managed resource APIs to get the clock Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 12/19] ASoC: tegra: Add audio mclk configuration Sowjanya Komatineni
2020-01-07 11:14   ` Sameer Pujar
2020-01-07 16:56     ` Sowjanya Komatineni
2020-01-07 22:56       ` Dmitry Osipenko [this message]
2020-01-07 23:23         ` Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 13/19] ASoC: tegra: Add fallback implementation for audio mclk Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 14/19] clk: tegra: Remove audio related clock enables from init_table Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 15/19] ARM: dts: tegra: Add clock-cells property to pmc Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 16/19] arm64: tegra: Add clock-cells property to Tegra PMC node Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 17/19] ARM: tegra: Update sound node clocks in device tree Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 18/19] arm64: tegra: smaug: Change clk_out_2 provider to pmc Sowjanya Komatineni
2020-01-07  4:14 ` [PATCH v6 19/19] ASoC: nau8825: change Tegra clk_out_2 provider to tegra_pmc Sowjanya Komatineni
2020-01-07 12:21 ` [PATCH v6 00/19] Move PMC clocks into Tegra PMC driver Thierry Reding
2020-01-07 16:50   ` Sowjanya Komatineni
2020-01-08  0:40     ` Dmitry Osipenko
2020-01-07 23:01 ` Dmitry Osipenko
2020-01-07 23:24   ` Sowjanya Komatineni
2020-01-07 23:28     ` Dmitry Osipenko
2020-01-08  0:02       ` Sowjanya Komatineni
2020-01-08  1:01         ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adb4c9dd-043a-ffca-7a1d-c6b30055b7a0@gmail.com \
    --to=digetx@gmail.com \
    --cc=broonie@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=josephl@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=markz@nvidia.com \
    --cc=mmaddireddy@nvidia.com \
    --cc=mperttunen@nvidia.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=perex@perex.cz \
    --cc=pgaikwad@nvidia.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=skomatineni@nvidia.com \
    --cc=spujar@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).