mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Trevor Wu (吳文良)" <Trevor.Wu@mediatek.com>
To: "robh+dt@kernel.org" <robh+dt@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"angelogioacchino.delregno@collabora.com" 
	<angelogioacchino.delregno@collabora.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"tiwai@suse.com" <tiwai@suse.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Project_Global_Chrome_Upstream_Group 
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v2 03/12] ASoC: mediatek: mt8188: support audsys clock
Date: Fri, 21 Oct 2022 09:58:09 +0000	[thread overview]
Message-ID: <776557c0fda5a538549ee0d4f4b7f482b0d69934.camel@mediatek.com> (raw)
In-Reply-To: <de66f0e3-7694-7315-c896-9211259a1a17@collabora.com>

On Fri, 2022-10-21 at 10:41 +0200, AngeloGioacchino Del Regno wrote:
> Il 21/10/22 10:27, Trevor Wu ha scritto:
> > Add mt8188 audio cg clock control. Audio clock gates are registered
> > to CCF
> > for reference count and clock parent management.
> > 
> > Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
> > ---
> >   sound/soc/mediatek/mt8188/mt8188-audsys-clk.c | 206
> > ++++++++++++++++++
> >   sound/soc/mediatek/mt8188/mt8188-audsys-clk.h |  15 ++
> >   .../soc/mediatek/mt8188/mt8188-audsys-clkid.h |  83 +++++++
> >   3 files changed, 304 insertions(+)
> >   create mode 100644 sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
> >   create mode 100644 sound/soc/mediatek/mt8188/mt8188-audsys-clk.h
> >   create mode 100644 sound/soc/mediatek/mt8188/mt8188-audsys-
> > clkid.h
> > 
> > diff --git a/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
> > b/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
> > new file mode 100644
> > index 000000000000..1f294231d4c2
> > --- /dev/null
> > +++ b/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
> > @@ -0,0 +1,206 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * mt8188-audsys-clk.c  --  MediaTek 8188 audsys clock control
> > + *
> > + * Copyright (c) 2022 MediaTek Inc.
> > + * Author: Chun-Chia Chiu <chun-chia.chiu@mediatek.com>
> > + */
> > +
> > +#include <linux/clk.h>
> > +#include <linux/clk-provider.h>
> > +#include <linux/clkdev.h>
> > +#include "mt8188-afe-common.h"
> > +#include "mt8188-audsys-clk.h"
> > +#include "mt8188-audsys-clkid.h"
> > +#include "mt8188-reg.h"
> > +
> > +struct afe_gate {
> > +	int id;
> > +	const char *name;
> > +	const char *parent_name;
> > +	int reg;
> > +	u8 bit;
> > +	const struct clk_ops *ops;
> > +	unsigned long flags;
> > +	u8 cg_flags;
> > +};
> > +
> > +#define GATE_AFE_FLAGS(_id, _name, _parent, _reg, _bit, _flags,
> > _cgflags) {\
> > +		.id = _id,					\
> > +		.name = _name,					\
> > +		.parent_name = _parent,				\
> > +		.reg = _reg,					\
> > +		.bit = _bit,					\
> > +		.flags = _flags,				\
> > +		.cg_flags = _cgflags,				\
> > +	}
> > +
> > +#define GATE_AFE(_id, _name, _parent, _reg, _bit)		\
> > +	GATE_AFE_FLAGS(_id, _name, _parent, _reg, _bit,		\
> > +		       CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
> > CLK_GATE_SET_TO_DISABLE)
> 
> Can you please explain what's the reason for CLK_IGNORE_UNUSED here?
> Maybe we can solve some issue that you're facing in a cleaner way.
> 
> Regards,
> Angelo

Hi Angelo,

Because clk_disable_unused() calls clk_core_is_enabled(), register
access happens in is_enabled() ops.
At the moment, the power for register access is not enabled, so the
register read results in CPU hang.

That's why I added CLK_IGNORE_UNUSED here, but it can't resolve all
issues. Actually, we met same problem when "cat
/sys/kernel/debug/clk/clk_summary" is used. We are still suffering the
problem.

I'm not sure if I can implement clk ops by myself, and exclude the
registration of is_enabled() ops.

Thanks,
Trevor
> 

  reply	other threads:[~2022-10-21  9:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21  8:27 [PATCH v2 00/12] ASoC: mediatek: Add support for MT8188 SoC Trevor Wu
2022-10-21  8:27 ` [PATCH v2 01/12] ASoC: mediatek: common: add SMC ops and SMC CMD Trevor Wu
2022-10-21  8:27 ` [PATCH v2 02/12] ASoC: mediatek: mt8188: add common header Trevor Wu
2022-10-21  8:27 ` [PATCH v2 03/12] ASoC: mediatek: mt8188: support audsys clock Trevor Wu
2022-10-21  8:41   ` AngeloGioacchino Del Regno
2022-10-21  9:58     ` Trevor Wu (吳文良) [this message]
2022-10-25 10:18       ` AngeloGioacchino Del Regno
2022-10-26  4:10         ` Trevor Wu (吳文良)
2022-10-26  8:18           ` AngeloGioacchino Del Regno
2022-12-01  8:43             ` Trevor Wu (吳文良)
2022-12-01  9:42               ` AngeloGioacchino Del Regno
2022-10-21  8:27 ` [PATCH v2 04/12] ASoC: mediatek: mt8188: support adda in platform driver Trevor Wu
2022-10-21  8:41   ` AngeloGioacchino Del Regno
2022-10-21  8:27 ` [PATCH v2 05/12] ASoC: mediatek: mt8188: support etdm " Trevor Wu
2022-10-21  8:41   ` AngeloGioacchino Del Regno
2022-10-21  8:27 ` [PATCH v2 06/12] ASoC: mediatek: mt8188: support pcmif " Trevor Wu
2022-10-21  8:27 ` [PATCH v2 07/12] ASoC: mediatek: mt8188: support audio clock control Trevor Wu
2022-10-21  8:27 ` [PATCH v2 08/12] ASoC: mediatek: mt8188: add platform driver Trevor Wu
2022-10-21 11:55   ` kernel test robot
2022-10-21  8:27 ` [PATCH v2 09/12] ASoC: mediatek: mt8188: add control for timing select Trevor Wu
2022-10-21  8:27 ` [PATCH v2 10/12] dt-bindings: mediatek: mt8188: add audio afe document Trevor Wu
2022-10-24 18:33   ` Rob Herring
2022-10-31  7:11     ` Trevor Wu (吳文良)
2022-10-29  0:06   ` Krzysztof Kozlowski
2022-10-31  6:50     ` Trevor Wu (吳文良)
2022-10-21  8:27 ` [PATCH v2 11/12] ASoC: mediatek: mt8188: add machine driver with mt6359 Trevor Wu
2022-10-21  8:27 ` [PATCH v2 12/12] dt-bindings: mediatek: mt8188: add mt8188-mt6359 document Trevor Wu
2022-10-24 18:38   ` Rob Herring
2022-10-31  6:53     ` Trevor Wu (吳文良)

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=776557c0fda5a538549ee0d4f4b7f482b0d69934.camel@mediatek.com \
    --to=trevor.wu@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --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

all inboxes | Powered by JetHome®