All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2022-11-04 13:17 ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi,

This is a follow-up to a previous series that was printing a warning
when a mux has a set_parent implementation but is missing
determine_rate().

The rationale is that set_parent() is very likely to be useful when
changing the rate, but it's determine_rate() that takes the parenting
decision. If we're missing it, then the current parent is always going
to be used, and thus set_parent() will not be used. The only exception
being a direct call to clk_set_parent(), but those are fairly rare
compared to clk_set_rate().

Stephen then asked to promote the warning to an error, and to fix up all
the muxes that are in that situation first. So here it is :)

Let me know what you think,
Maxime

To: Michael Turquette <mturquette@baylibre.com>
To: Stephen Boyd <sboyd@kernel.org>
To: Andreas Färber <afaerber@suse.de>
To: Manivannan Sadhasivam <mani@kernel.org>
To: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Claudiu Beznea <claudiu.beznea@microchip.com>
To: Max Filippov <jcmvbkbc@gmail.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Richard Fitzgerald <rf@opensource.cirrus.com>
To: Maxime Coquelin <mcoquelin.stm32@gmail.com>
To: Alexandre Torgue <alexandre.torgue@foss.st.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: David Lechner <david@lechnology.com>
To: Sekhar Nori <nsekhar@ti.com>
To: Abel Vesa <abelvesa@kernel.org>
To: Shawn Guo <shawnguo@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
To: Pengutronix Kernel Team <kernel@pengutronix.de>
To: Fabio Estevam <festevam@gmail.com>
To: NXP Linux Team <linux-imx@nxp.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
To: Dinh Nguyen <dinguyen@kernel.org>
To: Peter De Schrijver <pdeschrijver@nvidia.com>
To: Prashant Gaikwad <pgaikwad@nvidia.com>
To: Thierry Reding <thierry.reding@gmail.com>
To: Jonathan Hunter <jonathanh@nvidia.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>
To: David Airlie <airlied@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
To: Vinod Koul <vkoul@kernel.org>
To: Kishon Vijay Abraham I <kishon@kernel.org>
To: Alessandro Zummo <a.zummo@towertech.it>
To: Chen-Yu Tsai <wens@csie.org>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
To: Samuel Holland <samuel@sholland.org>
To: Liam Girdwood <lgirdwood@gmail.com>
To: Mark Brown <broonie@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>
To: Takashi Iwai <tiwai@suse.com>
To: Paul Cercueil <paul@crapouillou.net>
To: Orson Zhai <orsonzhai@gmail.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: linux-clk@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-actions@lists.infradead.org
Cc: patches@opensource.cirrus.com
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-mediatek@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-phy@lists.infradead.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-sunxi@lists.linux.dev
Cc: alsa-devel@alsa-project.org
Cc: linux-mips@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
Changes in v2:
- Drop all the patches already applied
- Promote the clk registration warning to an error
- Make all muxes use determine_rate
- Link to v1: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v1-0-f3ef80518140@cerno.tech

---
Maxime Ripard (65):
      clk: Export clk_hw_forward_rate_request()
      clk: lan966x: Remove unused round_rate hook
      clk: nodrv: Add a determine_rate hook
      clk: test: Add a determine_rate hook
      clk: actions: composite: Add a determine_rate hook for pass clk
      clk: at91: main: Add a determine_rate hook
      clk: at91: sckc: Add a determine_rate hook
      clk: berlin: div: Add a determine_rate hook
      clk: cdce706: Add a determine_rate hook
      clk: k210: pll: Add a determine_rate hook
      clk: k210: aclk: Add a determine_rate hook
      clk: k210: mux: Add a determine_rate hook
      clk: lmk04832: clkout: Add a determine_rate hook
      clk: lochnagar: Add a determine_rate hook
      clk: qoriq: Add a determine_rate hook
      clk: si5341: Add a determine_rate hook
      clk: stm32f4: mux: Add a determine_rate hook
      clk: vc5: mux: Add a determine_rate hook
      clk: vc5: clkout: Add a determine_rate hook
      clk: wm831x: clkout: Add a determine_rate hook
      clk: davinci: da8xx-cfgchip: Add a determine_rate hook
      clk: davinci: da8xx-cfgchip: Add a determine_rate hook
      clk: imx: busy: Add a determine_rate hook
      clk: imx: fixup-mux: Add a determine_rate hook
      clk: imx: scu: Add a determine_rate hook
      clk: mediatek: cpumux: Add a determine_rate hook
      clk: pxa: Add a determine_rate hook
      clk: renesas: r9a06g032: Add a determine_rate hook
      clk: socfpga: gate: Add a determine_rate hook
      clk: stm32: core: Add a determine_rate hook
      clk: tegra: bpmp: Add a determine_rate hook
      clk: tegra: super: Add a determine_rate hook
      clk: tegra: periph: Add a determine_rate hook
      clk: ux500: prcmu: Add a determine_rate hook
      clk: ux500: sysctrl: Add a determine_rate hook
      clk: versatile: sp810: Add a determine_rate hook
      drm/tegra: sor: Add a determine_rate hook
      phy: cadence: sierra: Add a determine_rate hook
      phy: cadence: torrent: Add a determine_rate hook
      phy: ti: am654-serdes: Add a determine_rate hook
      phy: ti: j721e-wiz: Add a determine_rate hook
      rtc: sun6i: Add a determine_rate hook
      ASoC: tlv320aic32x4: Add a determine_rate hook
      clk: actions: composite: div: Switch to determine_rate
      clk: actions: composite: fact: Switch to determine_rate
      clk: at91: smd: Switch to determine_rate
      clk: axi-clkgen: Switch to determine_rate
      clk: cdce706: divider: Switch to determine_rate
      clk: cdce706: clkout: Switch to determine_rate
      clk: si5341: Switch to determine_rate
      clk: si5351: pll: Switch to determine_rate
      clk: si5351: msynth: Switch to determine_rate
      clk: si5351: clkout: Switch to determine_rate
      clk: da8xx: clk48: Switch to determine_rate
      clk: imx: scu: Switch to determine_rate
      clk: ingenic: cgu: Switch to determine_rate
      clk: ingenic: tcu: Switch to determine_rate
      clk: sprd: composite: Switch to determine_rate
      clk: st: flexgen: Switch to determine_rate
      clk: stm32: composite: Switch to determine_rate
      clk: tegra: periph: Switch to determine_rate
      clk: tegra: super: Switch to determine_rate
      ASoC: tlv320aic32x4: pll: Switch to determine_rate
      ASoC: tlv320aic32x4: div: Switch to determine_rate
      clk: Warn if we register a mux without determine_rate

 drivers/clk/actions/owl-composite.c       | 35 +++++++++++-----
 drivers/clk/actions/owl-composite.h       |  2 +-
 drivers/clk/at91/clk-main.c               |  3 +-
 drivers/clk/at91/clk-smd.c                | 29 +++++++------
 drivers/clk/at91/sckc.c                   |  3 +-
 drivers/clk/berlin/berlin2-div.c          |  3 +-
 drivers/clk/clk-axi-clkgen.c              | 14 ++++---
 drivers/clk/clk-cdce706.c                 | 31 ++++++++------
 drivers/clk/clk-k210.c                    | 17 +++++---
 drivers/clk/clk-lan966x.c                 | 17 --------
 drivers/clk/clk-lmk04832.c                |  1 +
 drivers/clk/clk-lochnagar.c               |  2 +
 drivers/clk/clk-qoriq.c                   | 10 +++--
 drivers/clk/clk-si5341.c                  | 21 +++++-----
 drivers/clk/clk-si5351.c                  | 67 +++++++++++++++++--------------
 drivers/clk/clk-stm32f4.c                 |  3 +-
 drivers/clk/clk-versaclock5.c             |  8 ++--
 drivers/clk/clk-wm831x.c                  |  3 +-
 drivers/clk/clk.c                         | 15 +++++++
 drivers/clk/clk_test.c                    |  1 +
 drivers/clk/davinci/da8xx-cfgchip.c       | 15 ++++---
 drivers/clk/imx/clk-busy.c                |  3 +-
 drivers/clk/imx/clk-fixup-mux.c           |  3 +-
 drivers/clk/imx/clk-scu.c                 | 27 +++++++++++--
 drivers/clk/ingenic/cgu.c                 | 15 +++----
 drivers/clk/ingenic/tcu.c                 | 19 +++++----
 drivers/clk/mediatek/clk-cpumux.c         |  3 +-
 drivers/clk/pxa/clk-pxa.c                 |  3 +-
 drivers/clk/renesas/r9a06g032-clocks.c    |  3 +-
 drivers/clk/socfpga/clk-gate.c            |  3 +-
 drivers/clk/sprd/composite.c              | 16 +++++---
 drivers/clk/st/clk-flexgen.c              | 15 +++----
 drivers/clk/stm32/clk-stm32-core.c        | 32 ++++++++++-----
 drivers/clk/tegra/clk-bpmp.c              |  7 +++-
 drivers/clk/tegra/clk-periph.c            | 19 ++++++---
 drivers/clk/tegra/clk-super.c             | 18 ++++++---
 drivers/clk/ux500/clk-prcmu.c             |  3 +-
 drivers/clk/ux500/clk-sysctrl.c           |  4 +-
 drivers/clk/versatile/clk-sp810.c         |  3 +-
 drivers/gpu/drm/tegra/sor.c               |  3 +-
 drivers/phy/cadence/phy-cadence-sierra.c  |  1 +
 drivers/phy/cadence/phy-cadence-torrent.c |  1 +
 drivers/phy/ti/phy-am654-serdes.c         |  1 +
 drivers/phy/ti/phy-j721e-wiz.c            |  1 +
 drivers/rtc/rtc-sun6i.c                   |  2 +
 sound/soc/codecs/tlv320aic32x4-clk.c      | 37 ++++++++++-------
 46 files changed, 343 insertions(+), 199 deletions(-)
---
base-commit: 61c3426aca2c71052ddcd06c32e29d92304990fd
change-id: 20221018-clk-range-checks-fixes-2039f3523240

Best regards,
-- 
Maxime Ripard <maxime@cerno.tech>

^ permalink raw reply	[flat|nested] 388+ messages in thread

* [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2022-11-04 13:17 ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

Hi,

This is a follow-up to a previous series that was printing a warning
when a mux has a set_parent implementation but is missing
determine_rate().

The rationale is that set_parent() is very likely to be useful when
changing the rate, but it's determine_rate() that takes the parenting
decision. If we're missing it, then the current parent is always going
to be used, and thus set_parent() will not be used. The only exception
being a direct call to clk_set_parent(), but those are fairly rare
compared to clk_set_rate().

Stephen then asked to promote the warning to an error, and to fix up all
the muxes that are in that situation first. So here it is :)

Let me know what you think,
Maxime

To: Michael Turquette <mturquette@baylibre.com>
To: Stephen Boyd <sboyd@kernel.org>
To: Andreas Färber <afaerber@suse.de>
To: Manivannan Sadhasivam <mani@kernel.org>
To: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Claudiu Beznea <claudiu.beznea@microchip.com>
To: Max Filippov <jcmvbkbc@gmail.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Richard Fitzgerald <rf@opensource.cirrus.com>
To: Maxime Coquelin <mcoquelin.stm32@gmail.com>
To: Alexandre Torgue <alexandre.torgue@foss.st.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: David Lechner <david@lechnology.com>
To: Sekhar Nori <nsekhar@ti.com>
To: Abel Vesa <abelvesa@kernel.org>
To: Shawn Guo <shawnguo@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
To: Pengutronix Kernel Team <kernel@pengutronix.de>
To: Fabio Estevam <festevam@gmail.com>
To: NXP Linux Team <linux-imx@nxp.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
To: Dinh Nguyen <dinguyen@kernel.org>
To: Peter De Schrijver <pdeschrijver@nvidia.com>
To: Prashant Gaikwad <pgaikwad@nvidia.com>
To: Thierry Reding <thierry.reding@gmail.com>
To: Jonathan Hunter <jonathanh@nvidia.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>
To: David Airlie <airlied@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
To: Vinod Koul <vkoul@kernel.org>
To: Kishon Vijay Abraham I <kishon@kernel.org>
To: Alessandro Zummo <a.zummo@towertech.it>
To: Chen-Yu Tsai <wens@csie.org>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
To: Samuel Holland <samuel@sholland.org>
To: Liam Girdwood <lgirdwood@gmail.com>
To: Mark Brown <broonie@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>
To: Takashi Iwai <tiwai@suse.com>
To: Paul Cercueil <paul@crapouillou.net>
To: Orson Zhai <orsonzhai@gmail.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: linux-clk@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-actions@lists.infradead.org
Cc: patches@opensource.cirrus.com
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-mediatek@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-phy@lists.infradead.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-sunxi@lists.linux.dev
Cc: alsa-devel@alsa-project.org
Cc: linux-mips@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
Changes in v2:
- Drop all the patches already applied
- Promote the clk registration warning to an error
- Make all muxes use determine_rate
- Link to v1: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v1-0-f3ef80518140@cerno.tech

---
Maxime Ripard (65):
      clk: Export clk_hw_forward_rate_request()
      clk: lan966x: Remove unused round_rate hook
      clk: nodrv: Add a determine_rate hook
      clk: test: Add a determine_rate hook
      clk: actions: composite: Add a determine_rate hook for pass clk
      clk: at91: main: Add a determine_rate hook
      clk: at91: sckc: Add a determine_rate hook
      clk: berlin: div: Add a determine_rate hook
      clk: cdce706: Add a determine_rate hook
      clk: k210: pll: Add a determine_rate hook
      clk: k210: aclk: Add a determine_rate hook
      clk: k210: mux: Add a determine_rate hook
      clk: lmk04832: clkout: Add a determine_rate hook
      clk: lochnagar: Add a determine_rate hook
      clk: qoriq: Add a determine_rate hook
      clk: si5341: Add a determine_rate hook
      clk: stm32f4: mux: Add a determine_rate hook
      clk: vc5: mux: Add a determine_rate hook
      clk: vc5: clkout: Add a determine_rate hook
      clk: wm831x: clkout: Add a determine_rate hook
      clk: davinci: da8xx-cfgchip: Add a determine_rate hook
      clk: davinci: da8xx-cfgchip: Add a determine_rate hook
      clk: imx: busy: Add a determine_rate hook
      clk: imx: fixup-mux: Add a determine_rate hook
      clk: imx: scu: Add a determine_rate hook
      clk: mediatek: cpumux: Add a determine_rate hook
      clk: pxa: Add a determine_rate hook
      clk: renesas: r9a06g032: Add a determine_rate hook
      clk: socfpga: gate: Add a determine_rate hook
      clk: stm32: core: Add a determine_rate hook
      clk: tegra: bpmp: Add a determine_rate hook
      clk: tegra: super: Add a determine_rate hook
      clk: tegra: periph: Add a determine_rate hook
      clk: ux500: prcmu: Add a determine_rate hook
      clk: ux500: sysctrl: Add a determine_rate hook
      clk: versatile: sp810: Add a determine_rate hook
      drm/tegra: sor: Add a determine_rate hook
      phy: cadence: sierra: Add a determine_rate hook
      phy: cadence: torrent: Add a determine_rate hook
      phy: ti: am654-serdes: Add a determine_rate hook
      phy: ti: j721e-wiz: Add a determine_rate hook
      rtc: sun6i: Add a determine_rate hook
      ASoC: tlv320aic32x4: Add a determine_rate hook
      clk: actions: composite: div: Switch to determine_rate
      clk: actions: composite: fact: Switch to determine_rate
      clk: at91: smd: Switch to determine_rate
      clk: axi-clkgen: Switch to determine_rate
      clk: cdce706: divider: Switch to determine_rate
      clk: cdce706: clkout: Switch to determine_rate
      clk: si5341: Switch to determine_rate
      clk: si5351: pll: Switch to determine_rate
      clk: si5351: msynth: Switch to determine_rate
      clk: si5351: clkout: Switch to determine_rate
      clk: da8xx: clk48: Switch to determine_rate
      clk: imx: scu: Switch to determine_rate
      clk: ingenic: cgu: Switch to determine_rate
      clk: ingenic: tcu: Switch to determine_rate
      clk: sprd: composite: Switch to determine_rate
      clk: st: flexgen: Switch to determine_rate
      clk: stm32: composite: Switch to determine_rate
      clk: tegra: periph: Switch to determine_rate
      clk: tegra: super: Switch to determine_rate
      ASoC: tlv320aic32x4: pll: Switch to determine_rate
      ASoC: tlv320aic32x4: div: Switch to determine_rate
      clk: Warn if we register a mux without determine_rate

 drivers/clk/actions/owl-composite.c       | 35 +++++++++++-----
 drivers/clk/actions/owl-composite.h       |  2 +-
 drivers/clk/at91/clk-main.c               |  3 +-
 drivers/clk/at91/clk-smd.c                | 29 +++++++------
 drivers/clk/at91/sckc.c                   |  3 +-
 drivers/clk/berlin/berlin2-div.c          |  3 +-
 drivers/clk/clk-axi-clkgen.c              | 14 ++++---
 drivers/clk/clk-cdce706.c                 | 31 ++++++++------
 drivers/clk/clk-k210.c                    | 17 +++++---
 drivers/clk/clk-lan966x.c                 | 17 --------
 drivers/clk/clk-lmk04832.c                |  1 +
 drivers/clk/clk-lochnagar.c               |  2 +
 drivers/clk/clk-qoriq.c                   | 10 +++--
 drivers/clk/clk-si5341.c                  | 21 +++++-----
 drivers/clk/clk-si5351.c                  | 67 +++++++++++++++++--------------
 drivers/clk/clk-stm32f4.c                 |  3 +-
 drivers/clk/clk-versaclock5.c             |  8 ++--
 drivers/clk/clk-wm831x.c                  |  3 +-
 drivers/clk/clk.c                         | 15 +++++++
 drivers/clk/clk_test.c                    |  1 +
 drivers/clk/davinci/da8xx-cfgchip.c       | 15 ++++---
 drivers/clk/imx/clk-busy.c                |  3 +-
 drivers/clk/imx/clk-fixup-mux.c           |  3 +-
 drivers/clk/imx/clk-scu.c                 | 27 +++++++++++--
 drivers/clk/ingenic/cgu.c                 | 15 +++----
 drivers/clk/ingenic/tcu.c                 | 19 +++++----
 drivers/clk/mediatek/clk-cpumux.c         |  3 +-
 drivers/clk/pxa/clk-pxa.c                 |  3 +-
 drivers/clk/renesas/r9a06g032-clocks.c    |  3 +-
 drivers/clk/socfpga/clk-gate.c            |  3 +-
 drivers/clk/sprd/composite.c              | 16 +++++---
 drivers/clk/st/clk-flexgen.c              | 15 +++----
 drivers/clk/stm32/clk-stm32-core.c        | 32 ++++++++++-----
 drivers/clk/tegra/clk-bpmp.c              |  7 +++-
 drivers/clk/tegra/clk-periph.c            | 19 ++++++---
 drivers/clk/tegra/clk-super.c             | 18 ++++++---
 drivers/clk/ux500/clk-prcmu.c             |  3 +-
 drivers/clk/ux500/clk-sysctrl.c           |  4 +-
 drivers/clk/versatile/clk-sp810.c         |  3 +-
 drivers/gpu/drm/tegra/sor.c               |  3 +-
 drivers/phy/cadence/phy-cadence-sierra.c  |  1 +
 drivers/phy/cadence/phy-cadence-torrent.c |  1 +
 drivers/phy/ti/phy-am654-serdes.c         |  1 +
 drivers/phy/ti/phy-j721e-wiz.c            |  1 +
 drivers/rtc/rtc-sun6i.c                   |  2 +
 sound/soc/codecs/tlv320aic32x4-clk.c      | 37 ++++++++++-------
 46 files changed, 343 insertions(+), 199 deletions(-)
---
base-commit: 61c3426aca2c71052ddcd06c32e29d92304990fd
change-id: 20221018-clk-range-checks-fixes-2039f3523240

Best regards,
-- 
Maxime Ripard <maxime@cerno.tech>

^ permalink raw reply	[flat|nested] 388+ messages in thread

* [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2022-11-04 13:17 ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi,

This is a follow-up to a previous series that was printing a warning
when a mux has a set_parent implementation but is missing
determine_rate().

The rationale is that set_parent() is very likely to be useful when
changing the rate, but it's determine_rate() that takes the parenting
decision. If we're missing it, then the current parent is always going
to be used, and thus set_parent() will not be used. The only exception
being a direct call to clk_set_parent(), but those are fairly rare
compared to clk_set_rate().

Stephen then asked to promote the warning to an error, and to fix up all
the muxes that are in that situation first. So here it is :)

Let me know what you think,
Maxime

To: Michael Turquette <mturquette@baylibre.com>
To: Stephen Boyd <sboyd@kernel.org>
To: Andreas Färber <afaerber@suse.de>
To: Manivannan Sadhasivam <mani@kernel.org>
To: Nicolas Ferre <nicolas.ferre@microchip.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Claudiu Beznea <claudiu.beznea@microchip.com>
To: Max Filippov <jcmvbkbc@gmail.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Richard Fitzgerald <rf@opensource.cirrus.com>
To: Maxime Coquelin <mcoquelin.stm32@gmail.com>
To: Alexandre Torgue <alexandre.torgue@foss.st.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: David Lechner <david@lechnology.com>
To: Sekhar Nori <nsekhar@ti.com>
To: Abel Vesa <abelvesa@kernel.org>
To: Shawn Guo <shawnguo@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
To: Pengutronix Kernel Team <kernel@pengutronix.de>
To: Fabio Estevam <festevam@gmail.com>
To: NXP Linux Team <linux-imx@nxp.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
To: Dinh Nguyen <dinguyen@kernel.org>
To: Peter De Schrijver <pdeschrijver@nvidia.com>
To: Prashant Gaikwad <pgaikwad@nvidia.com>
To: Thierry Reding <thierry.reding@gmail.com>
To: Jonathan Hunter <jonathanh@nvidia.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>
To: David Airlie <airlied@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
To: Vinod Koul <vkoul@kernel.org>
To: Kishon Vijay Abraham I <kishon@kernel.org>
To: Alessandro Zummo <a.zummo@towertech.it>
To: Chen-Yu Tsai <wens@csie.org>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
To: Samuel Holland <samuel@sholland.org>
To: Liam Girdwood <lgirdwood@gmail.com>
To: Mark Brown <broonie@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>
To: Takashi Iwai <tiwai@suse.com>
To: Paul Cercueil <paul@crapouillou.net>
To: Orson Zhai <orsonzhai@gmail.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: linux-clk@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-actions@lists.infradead.org
Cc: patches@opensource.cirrus.com
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-mediatek@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-phy@lists.infradead.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-sunxi@lists.linux.dev
Cc: alsa-devel@alsa-project.org
Cc: linux-mips@vger.kernel.org
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
Changes in v2:
- Drop all the patches already applied
- Promote the clk registration warning to an error
- Make all muxes use determine_rate
- Link to v1: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v1-0-f3ef80518140@cerno.tech

---
Maxime Ripard (65):
      clk: Export clk_hw_forward_rate_request()
      clk: lan966x: Remove unused round_rate hook
      clk: nodrv: Add a determine_rate hook
      clk: test: Add a determine_rate hook
      clk: actions: composite: Add a determine_rate hook for pass clk
      clk: at91: main: Add a determine_rate hook
      clk: at91: sckc: Add a determine_rate hook
      clk: berlin: div: Add a determine_rate hook
      clk: cdce706: Add a determine_rate hook
      clk: k210: pll: Add a determine_rate hook
      clk: k210: aclk: Add a determine_rate hook
      clk: k210: mux: Add a determine_rate hook
      clk: lmk04832: clkout: Add a determine_rate hook
      clk: lochnagar: Add a determine_rate hook
      clk: qoriq: Add a determine_rate hook
      clk: si5341: Add a determine_rate hook
      clk: stm32f4: mux: Add a determine_rate hook
      clk: vc5: mux: Add a determine_rate hook
      clk: vc5: clkout: Add a determine_rate hook
      clk: wm831x: clkout: Add a determine_rate hook
      clk: davinci: da8xx-cfgchip: Add a determine_rate hook
      clk: davinci: da8xx-cfgchip: Add a determine_rate hook
      clk: imx: busy: Add a determine_rate hook
      clk: imx: fixup-mux: Add a determine_rate hook
      clk: imx: scu: Add a determine_rate hook
      clk: mediatek: cpumux: Add a determine_rate hook
      clk: pxa: Add a determine_rate hook
      clk: renesas: r9a06g032: Add a determine_rate hook
      clk: socfpga: gate: Add a determine_rate hook
      clk: stm32: core: Add a determine_rate hook
      clk: tegra: bpmp: Add a determine_rate hook
      clk: tegra: super: Add a determine_rate hook
      clk: tegra: periph: Add a determine_rate hook
      clk: ux500: prcmu: Add a determine_rate hook
      clk: ux500: sysctrl: Add a determine_rate hook
      clk: versatile: sp810: Add a determine_rate hook
      drm/tegra: sor: Add a determine_rate hook
      phy: cadence: sierra: Add a determine_rate hook
      phy: cadence: torrent: Add a determine_rate hook
      phy: ti: am654-serdes: Add a determine_rate hook
      phy: ti: j721e-wiz: Add a determine_rate hook
      rtc: sun6i: Add a determine_rate hook
      ASoC: tlv320aic32x4: Add a determine_rate hook
      clk: actions: composite: div: Switch to determine_rate
      clk: actions: composite: fact: Switch to determine_rate
      clk: at91: smd: Switch to determine_rate
      clk: axi-clkgen: Switch to determine_rate
      clk: cdce706: divider: Switch to determine_rate
      clk: cdce706: clkout: Switch to determine_rate
      clk: si5341: Switch to determine_rate
      clk: si5351: pll: Switch to determine_rate
      clk: si5351: msynth: Switch to determine_rate
      clk: si5351: clkout: Switch to determine_rate
      clk: da8xx: clk48: Switch to determine_rate
      clk: imx: scu: Switch to determine_rate
      clk: ingenic: cgu: Switch to determine_rate
      clk: ingenic: tcu: Switch to determine_rate
      clk: sprd: composite: Switch to determine_rate
      clk: st: flexgen: Switch to determine_rate
      clk: stm32: composite: Switch to determine_rate
      clk: tegra: periph: Switch to determine_rate
      clk: tegra: super: Switch to determine_rate
      ASoC: tlv320aic32x4: pll: Switch to determine_rate
      ASoC: tlv320aic32x4: div: Switch to determine_rate
      clk: Warn if we register a mux without determine_rate

 drivers/clk/actions/owl-composite.c       | 35 +++++++++++-----
 drivers/clk/actions/owl-composite.h       |  2 +-
 drivers/clk/at91/clk-main.c               |  3 +-
 drivers/clk/at91/clk-smd.c                | 29 +++++++------
 drivers/clk/at91/sckc.c                   |  3 +-
 drivers/clk/berlin/berlin2-div.c          |  3 +-
 drivers/clk/clk-axi-clkgen.c              | 14 ++++---
 drivers/clk/clk-cdce706.c                 | 31 ++++++++------
 drivers/clk/clk-k210.c                    | 17 +++++---
 drivers/clk/clk-lan966x.c                 | 17 --------
 drivers/clk/clk-lmk04832.c                |  1 +
 drivers/clk/clk-lochnagar.c               |  2 +
 drivers/clk/clk-qoriq.c                   | 10 +++--
 drivers/clk/clk-si5341.c                  | 21 +++++-----
 drivers/clk/clk-si5351.c                  | 67 +++++++++++++++++--------------
 drivers/clk/clk-stm32f4.c                 |  3 +-
 drivers/clk/clk-versaclock5.c             |  8 ++--
 drivers/clk/clk-wm831x.c                  |  3 +-
 drivers/clk/clk.c                         | 15 +++++++
 drivers/clk/clk_test.c                    |  1 +
 drivers/clk/davinci/da8xx-cfgchip.c       | 15 ++++---
 drivers/clk/imx/clk-busy.c                |  3 +-
 drivers/clk/imx/clk-fixup-mux.c           |  3 +-
 drivers/clk/imx/clk-scu.c                 | 27 +++++++++++--
 drivers/clk/ingenic/cgu.c                 | 15 +++----
 drivers/clk/ingenic/tcu.c                 | 19 +++++----
 drivers/clk/mediatek/clk-cpumux.c         |  3 +-
 drivers/clk/pxa/clk-pxa.c                 |  3 +-
 drivers/clk/renesas/r9a06g032-clocks.c    |  3 +-
 drivers/clk/socfpga/clk-gate.c            |  3 +-
 drivers/clk/sprd/composite.c              | 16 +++++---
 drivers/clk/st/clk-flexgen.c              | 15 +++----
 drivers/clk/stm32/clk-stm32-core.c        | 32 ++++++++++-----
 drivers/clk/tegra/clk-bpmp.c              |  7 +++-
 drivers/clk/tegra/clk-periph.c            | 19 ++++++---
 drivers/clk/tegra/clk-super.c             | 18 ++++++---
 drivers/clk/ux500/clk-prcmu.c             |  3 +-
 drivers/clk/ux500/clk-sysctrl.c           |  4 +-
 drivers/clk/versatile/clk-sp810.c         |  3 +-
 drivers/gpu/drm/tegra/sor.c               |  3 +-
 drivers/phy/cadence/phy-cadence-sierra.c  |  1 +
 drivers/phy/cadence/phy-cadence-torrent.c |  1 +
 drivers/phy/ti/phy-am654-serdes.c         |  1 +
 drivers/phy/ti/phy-j721e-wiz.c            |  1 +
 drivers/rtc/rtc-sun6i.c                   |  2 +
 sound/soc/codecs/tlv320aic32x4-clk.c      | 37 ++++++++++-------
 46 files changed, 343 insertions(+), 199 deletions(-)
---
base-commit: 61c3426aca2c71052ddcd06c32e29d92304990fd
change-id: 20221018-clk-range-checks-fixes-2039f3523240

Best regards,
-- 
Maxime Ripard <maxime@cerno.tech>

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* [PATCH v2 01/65] clk: Export clk_hw_forward_rate_request()
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Commit 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the
parent") introduced the public clk_hw_forward_rate_request() function,
but didn't export the symbol. Make sure it's the case.

Fixes: 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the parent")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 57b83665e5c3..d4a74759fe29 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1525,6 +1525,7 @@ void clk_hw_forward_rate_request(const struct clk_hw *hw,
 				  parent->core, req,
 				  parent_rate);
 }
+EXPORT_SYMBOL_GPL(clk_hw_forward_rate_request);
 
 static bool clk_core_can_round(struct clk_core * const core)
 {

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 01/65] clk: Export clk_hw_forward_rate_request()
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

Commit 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the
parent") introduced the public clk_hw_forward_rate_request() function,
but didn't export the symbol. Make sure it's the case.

Fixes: 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the parent")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 57b83665e5c3..d4a74759fe29 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1525,6 +1525,7 @@ void clk_hw_forward_rate_request(const struct clk_hw *hw,
 				  parent->core, req,
 				  parent_rate);
 }
+EXPORT_SYMBOL_GPL(clk_hw_forward_rate_request);
 
 static bool clk_core_can_round(struct clk_core * const core)
 {

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 01/65] clk: Export clk_hw_forward_rate_request()
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Commit 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the
parent") introduced the public clk_hw_forward_rate_request() function,
but didn't export the symbol. Make sure it's the case.

Fixes: 262ca38f4b6e ("clk: Stop forwarding clk_rate_requests to the parent")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 57b83665e5c3..d4a74759fe29 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1525,6 +1525,7 @@ void clk_hw_forward_rate_request(const struct clk_hw *hw,
 				  parent->core, req,
 				  parent_rate);
 }
+EXPORT_SYMBOL_GPL(clk_hw_forward_rate_request);
 
 static bool clk_core_can_round(struct clk_core * const core)
 {

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 02/65] clk: lan966x: Remove unused round_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The lan966x driver registers a gck clock with both a determine_rate and
a round_rate implementation. Both are equivalent, and are only called by
clk_core_determine_round_nolock() which favors determine_rate.

Thus, lan966x_gck_round_rate() is never called, so we can just remove
it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lan966x.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/drivers/clk/clk-lan966x.c b/drivers/clk/clk-lan966x.c
index 460e7216bfa1..870fd7df50c1 100644
--- a/drivers/clk/clk-lan966x.c
+++ b/drivers/clk/clk-lan966x.c
@@ -103,22 +103,6 @@ static int lan966x_gck_set_rate(struct clk_hw *hw,
 	return 0;
 }
 
-static long lan966x_gck_round_rate(struct clk_hw *hw, unsigned long rate,
-				   unsigned long *parent_rate)
-{
-	unsigned int div;
-
-	if (rate == 0 || *parent_rate == 0)
-		return -EINVAL;
-
-	if (rate >= *parent_rate)
-		return *parent_rate;
-
-	div = DIV_ROUND_CLOSEST(*parent_rate, rate);
-
-	return *parent_rate / div;
-}
-
 static unsigned long lan966x_gck_recalc_rate(struct clk_hw *hw,
 					     unsigned long parent_rate)
 {
@@ -177,7 +161,6 @@ static const struct clk_ops lan966x_gck_ops = {
 	.enable         = lan966x_gck_enable,
 	.disable        = lan966x_gck_disable,
 	.set_rate       = lan966x_gck_set_rate,
-	.round_rate     = lan966x_gck_round_rate,
 	.recalc_rate    = lan966x_gck_recalc_rate,
 	.determine_rate = lan966x_gck_determine_rate,
 	.set_parent     = lan966x_gck_set_parent,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 02/65] clk: lan966x: Remove unused round_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The lan966x driver registers a gck clock with both a determine_rate and
a round_rate implementation. Both are equivalent, and are only called by
clk_core_determine_round_nolock() which favors determine_rate.

Thus, lan966x_gck_round_rate() is never called, so we can just remove
it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lan966x.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/drivers/clk/clk-lan966x.c b/drivers/clk/clk-lan966x.c
index 460e7216bfa1..870fd7df50c1 100644
--- a/drivers/clk/clk-lan966x.c
+++ b/drivers/clk/clk-lan966x.c
@@ -103,22 +103,6 @@ static int lan966x_gck_set_rate(struct clk_hw *hw,
 	return 0;
 }
 
-static long lan966x_gck_round_rate(struct clk_hw *hw, unsigned long rate,
-				   unsigned long *parent_rate)
-{
-	unsigned int div;
-
-	if (rate == 0 || *parent_rate == 0)
-		return -EINVAL;
-
-	if (rate >= *parent_rate)
-		return *parent_rate;
-
-	div = DIV_ROUND_CLOSEST(*parent_rate, rate);
-
-	return *parent_rate / div;
-}
-
 static unsigned long lan966x_gck_recalc_rate(struct clk_hw *hw,
 					     unsigned long parent_rate)
 {
@@ -177,7 +161,6 @@ static const struct clk_ops lan966x_gck_ops = {
 	.enable         = lan966x_gck_enable,
 	.disable        = lan966x_gck_disable,
 	.set_rate       = lan966x_gck_set_rate,
-	.round_rate     = lan966x_gck_round_rate,
 	.recalc_rate    = lan966x_gck_recalc_rate,
 	.determine_rate = lan966x_gck_determine_rate,
 	.set_parent     = lan966x_gck_set_parent,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 02/65] clk: lan966x: Remove unused round_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The lan966x driver registers a gck clock with both a determine_rate and
a round_rate implementation. Both are equivalent, and are only called by
clk_core_determine_round_nolock() which favors determine_rate.

Thus, lan966x_gck_round_rate() is never called, so we can just remove
it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lan966x.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/drivers/clk/clk-lan966x.c b/drivers/clk/clk-lan966x.c
index 460e7216bfa1..870fd7df50c1 100644
--- a/drivers/clk/clk-lan966x.c
+++ b/drivers/clk/clk-lan966x.c
@@ -103,22 +103,6 @@ static int lan966x_gck_set_rate(struct clk_hw *hw,
 	return 0;
 }
 
-static long lan966x_gck_round_rate(struct clk_hw *hw, unsigned long rate,
-				   unsigned long *parent_rate)
-{
-	unsigned int div;
-
-	if (rate == 0 || *parent_rate == 0)
-		return -EINVAL;
-
-	if (rate >= *parent_rate)
-		return *parent_rate;
-
-	div = DIV_ROUND_CLOSEST(*parent_rate, rate);
-
-	return *parent_rate / div;
-}
-
 static unsigned long lan966x_gck_recalc_rate(struct clk_hw *hw,
 					     unsigned long parent_rate)
 {
@@ -177,7 +161,6 @@ static const struct clk_ops lan966x_gck_ops = {
 	.enable         = lan966x_gck_enable,
 	.disable        = lan966x_gck_disable,
 	.set_rate       = lan966x_gck_set_rate,
-	.round_rate     = lan966x_gck_round_rate,
 	.recalc_rate    = lan966x_gck_recalc_rate,
 	.determine_rate = lan966x_gck_determine_rate,
 	.set_parent     = lan966x_gck_set_parent,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 03/65] clk: nodrv: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The nodrv clock implements a mux with a set_parent hook, but doesn't
provide a determine_rate implementation.

Even though it's a mock clock and the missing function is harmless,
we'll start to require a determine_rate implementation when set_parent
is set, so let's fill it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index d4a74759fe29..495d7497cc43 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4257,11 +4257,18 @@ static int clk_nodrv_set_parent(struct clk_hw *hw, u8 index)
 	return -ENXIO;
 }
 
+static int clk_nodrv_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
+{
+	return -ENXIO;
+}
+
 static const struct clk_ops clk_nodrv_ops = {
 	.enable		= clk_nodrv_prepare_enable,
 	.disable	= clk_nodrv_disable_unprepare,
 	.prepare	= clk_nodrv_prepare_enable,
 	.unprepare	= clk_nodrv_disable_unprepare,
+	.determine_rate	= clk_nodrv_determine_rate,
 	.set_rate	= clk_nodrv_set_rate,
 	.set_parent	= clk_nodrv_set_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 03/65] clk: nodrv: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The nodrv clock implements a mux with a set_parent hook, but doesn't
provide a determine_rate implementation.

Even though it's a mock clock and the missing function is harmless,
we'll start to require a determine_rate implementation when set_parent
is set, so let's fill it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index d4a74759fe29..495d7497cc43 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4257,11 +4257,18 @@ static int clk_nodrv_set_parent(struct clk_hw *hw, u8 index)
 	return -ENXIO;
 }
 
+static int clk_nodrv_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
+{
+	return -ENXIO;
+}
+
 static const struct clk_ops clk_nodrv_ops = {
 	.enable		= clk_nodrv_prepare_enable,
 	.disable	= clk_nodrv_disable_unprepare,
 	.prepare	= clk_nodrv_prepare_enable,
 	.unprepare	= clk_nodrv_disable_unprepare,
+	.determine_rate	= clk_nodrv_determine_rate,
 	.set_rate	= clk_nodrv_set_rate,
 	.set_parent	= clk_nodrv_set_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 03/65] clk: nodrv: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The nodrv clock implements a mux with a set_parent hook, but doesn't
provide a determine_rate implementation.

Even though it's a mock clock and the missing function is harmless,
we'll start to require a determine_rate implementation when set_parent
is set, so let's fill it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index d4a74759fe29..495d7497cc43 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4257,11 +4257,18 @@ static int clk_nodrv_set_parent(struct clk_hw *hw, u8 index)
 	return -ENXIO;
 }
 
+static int clk_nodrv_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
+{
+	return -ENXIO;
+}
+
 static const struct clk_ops clk_nodrv_ops = {
 	.enable		= clk_nodrv_prepare_enable,
 	.disable	= clk_nodrv_disable_unprepare,
 	.prepare	= clk_nodrv_prepare_enable,
 	.unprepare	= clk_nodrv_disable_unprepare,
+	.determine_rate	= clk_nodrv_determine_rate,
 	.set_rate	= clk_nodrv_set_rate,
 	.set_parent	= clk_nodrv_set_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 04/65] clk: test: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The single parent clock in our kunit tests implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is not entirely unexpected, since its whole purpose it to have a
single parent. When determine_rate is missing, and since
CLK_SET_RATE_PARENT is set for all its instances, the default behaviour
of the framework will be to forward it to the current parent.

This is totally fine as far as the tests are concerned, but we'll start
to mandate a determine_rate implementation when set_parent is set, so
let's fill it with __clk_mux_determine_rate() which will have the same
behavior.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c
index f9a5c2964c65..b4f37fbd180b 100644
--- a/drivers/clk/clk_test.c
+++ b/drivers/clk/clk_test.c
@@ -104,6 +104,7 @@ static const struct clk_ops clk_dummy_minimize_rate_ops = {
 };
 
 static const struct clk_ops clk_dummy_single_parent_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_dummy_single_set_parent,
 	.get_parent = clk_dummy_single_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 04/65] clk: test: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The single parent clock in our kunit tests implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is not entirely unexpected, since its whole purpose it to have a
single parent. When determine_rate is missing, and since
CLK_SET_RATE_PARENT is set for all its instances, the default behaviour
of the framework will be to forward it to the current parent.

This is totally fine as far as the tests are concerned, but we'll start
to mandate a determine_rate implementation when set_parent is set, so
let's fill it with __clk_mux_determine_rate() which will have the same
behavior.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c
index f9a5c2964c65..b4f37fbd180b 100644
--- a/drivers/clk/clk_test.c
+++ b/drivers/clk/clk_test.c
@@ -104,6 +104,7 @@ static const struct clk_ops clk_dummy_minimize_rate_ops = {
 };
 
 static const struct clk_ops clk_dummy_single_parent_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_dummy_single_set_parent,
 	.get_parent = clk_dummy_single_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 04/65] clk: test: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The single parent clock in our kunit tests implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is not entirely unexpected, since its whole purpose it to have a
single parent. When determine_rate is missing, and since
CLK_SET_RATE_PARENT is set for all its instances, the default behaviour
of the framework will be to forward it to the current parent.

This is totally fine as far as the tests are concerned, but we'll start
to mandate a determine_rate implementation when set_parent is set, so
let's fill it with __clk_mux_determine_rate() which will have the same
behavior.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c
index f9a5c2964c65..b4f37fbd180b 100644
--- a/drivers/clk/clk_test.c
+++ b/drivers/clk/clk_test.c
@@ -104,6 +104,7 @@ static const struct clk_ops clk_dummy_minimize_rate_ops = {
 };
 
 static const struct clk_ops clk_dummy_single_parent_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_dummy_single_set_parent,
 	.get_parent = clk_dummy_single_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 05/65] clk: actions: composite: Add a determine_rate hook for pass clk
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Actions "Pass" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 1 +
 drivers/clk/actions/owl-composite.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index 101706e0c66f..4c844a5613e4 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -189,6 +189,7 @@ const struct clk_ops owl_comp_fix_fact_ops = {
 
 const struct clk_ops owl_comp_pass_ops = {
 	/* mux_ops */
+	.determine_rate	= __clk_mux_determine_rate,
 	.get_parent	= owl_comp_get_parent,
 	.set_parent	= owl_comp_set_parent,
 
diff --git a/drivers/clk/actions/owl-composite.h b/drivers/clk/actions/owl-composite.h
index bca38bf8f218..0a0eecc78344 100644
--- a/drivers/clk/actions/owl-composite.h
+++ b/drivers/clk/actions/owl-composite.h
@@ -104,7 +104,7 @@ struct owl_composite {
 			.hw.init	= CLK_HW_INIT_PARENTS(_name,	\
 						     _parent,		\
 						     &owl_comp_pass_ops,\
-						     _flags),		\
+						     _flags | CLK_SET_RATE_NO_REPARENT), \
 		},							\
 	}
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 05/65] clk: actions: composite: Add a determine_rate hook for pass clk
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Actions "Pass" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 1 +
 drivers/clk/actions/owl-composite.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index 101706e0c66f..4c844a5613e4 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -189,6 +189,7 @@ const struct clk_ops owl_comp_fix_fact_ops = {
 
 const struct clk_ops owl_comp_pass_ops = {
 	/* mux_ops */
+	.determine_rate	= __clk_mux_determine_rate,
 	.get_parent	= owl_comp_get_parent,
 	.set_parent	= owl_comp_set_parent,
 
diff --git a/drivers/clk/actions/owl-composite.h b/drivers/clk/actions/owl-composite.h
index bca38bf8f218..0a0eecc78344 100644
--- a/drivers/clk/actions/owl-composite.h
+++ b/drivers/clk/actions/owl-composite.h
@@ -104,7 +104,7 @@ struct owl_composite {
 			.hw.init	= CLK_HW_INIT_PARENTS(_name,	\
 						     _parent,		\
 						     &owl_comp_pass_ops,\
-						     _flags),		\
+						     _flags | CLK_SET_RATE_NO_REPARENT), \
 		},							\
 	}
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 05/65] clk: actions: composite: Add a determine_rate hook for pass clk
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Actions "Pass" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 1 +
 drivers/clk/actions/owl-composite.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index 101706e0c66f..4c844a5613e4 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -189,6 +189,7 @@ const struct clk_ops owl_comp_fix_fact_ops = {
 
 const struct clk_ops owl_comp_pass_ops = {
 	/* mux_ops */
+	.determine_rate	= __clk_mux_determine_rate,
 	.get_parent	= owl_comp_get_parent,
 	.set_parent	= owl_comp_set_parent,
 
diff --git a/drivers/clk/actions/owl-composite.h b/drivers/clk/actions/owl-composite.h
index bca38bf8f218..0a0eecc78344 100644
--- a/drivers/clk/actions/owl-composite.h
+++ b/drivers/clk/actions/owl-composite.h
@@ -104,7 +104,7 @@ struct owl_composite {
 			.hw.init	= CLK_HW_INIT_PARENTS(_name,	\
 						     _parent,		\
 						     &owl_comp_pass_ops,\
-						     _flags),		\
+						     _flags | CLK_SET_RATE_NO_REPARENT), \
 		},							\
 	}
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 06/65] clk: at91: main: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SAM9x5 main clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/clk-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 8601b27c1ae0..e04e72394632 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -533,6 +533,7 @@ static const struct clk_ops sam9x5_main_ops = {
 	.prepare = clk_sam9x5_main_prepare,
 	.is_prepared = clk_sam9x5_main_is_prepared,
 	.recalc_rate = clk_sam9x5_main_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sam9x5_main_set_parent,
 	.get_parent = clk_sam9x5_main_get_parent,
 	.save_context = clk_sam9x5_main_save_context,
@@ -565,7 +566,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap,
 	init.ops = &sam9x5_main_ops;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
-	init.flags = CLK_SET_PARENT_GATE;
+	init.flags = CLK_SET_PARENT_GATE | CLK_SET_RATE_NO_REPARENT;
 
 	clkmain->hw.init = &init;
 	clkmain->regmap = regmap;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 06/65] clk: at91: main: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The SAM9x5 main clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/clk-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 8601b27c1ae0..e04e72394632 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -533,6 +533,7 @@ static const struct clk_ops sam9x5_main_ops = {
 	.prepare = clk_sam9x5_main_prepare,
 	.is_prepared = clk_sam9x5_main_is_prepared,
 	.recalc_rate = clk_sam9x5_main_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sam9x5_main_set_parent,
 	.get_parent = clk_sam9x5_main_get_parent,
 	.save_context = clk_sam9x5_main_save_context,
@@ -565,7 +566,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap,
 	init.ops = &sam9x5_main_ops;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
-	init.flags = CLK_SET_PARENT_GATE;
+	init.flags = CLK_SET_PARENT_GATE | CLK_SET_RATE_NO_REPARENT;
 
 	clkmain->hw.init = &init;
 	clkmain->regmap = regmap;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 06/65] clk: at91: main: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SAM9x5 main clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/clk-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 8601b27c1ae0..e04e72394632 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -533,6 +533,7 @@ static const struct clk_ops sam9x5_main_ops = {
 	.prepare = clk_sam9x5_main_prepare,
 	.is_prepared = clk_sam9x5_main_is_prepared,
 	.recalc_rate = clk_sam9x5_main_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sam9x5_main_set_parent,
 	.get_parent = clk_sam9x5_main_get_parent,
 	.save_context = clk_sam9x5_main_save_context,
@@ -565,7 +566,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap,
 	init.ops = &sam9x5_main_ops;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
-	init.flags = CLK_SET_PARENT_GATE;
+	init.flags = CLK_SET_PARENT_GATE | CLK_SET_RATE_NO_REPARENT;
 
 	clkmain->hw.init = &init;
 	clkmain->regmap = regmap;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 07/65] clk: at91: sckc: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SAM9x5 slow clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/sckc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c
index fdc9b669f8a7..9c42961a8a2f 100644
--- a/drivers/clk/at91/sckc.c
+++ b/drivers/clk/at91/sckc.c
@@ -310,6 +310,7 @@ static u8 clk_sam9x5_slow_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops sam9x5_slow_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sam9x5_slow_set_parent,
 	.get_parent = clk_sam9x5_slow_get_parent,
 };
@@ -337,7 +338,7 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr,
 	init.ops = &sam9x5_slow_ops;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	slowck->hw.init = &init;
 	slowck->sckcr = sckcr;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 07/65] clk: at91: sckc: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The SAM9x5 slow clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/sckc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c
index fdc9b669f8a7..9c42961a8a2f 100644
--- a/drivers/clk/at91/sckc.c
+++ b/drivers/clk/at91/sckc.c
@@ -310,6 +310,7 @@ static u8 clk_sam9x5_slow_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops sam9x5_slow_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sam9x5_slow_set_parent,
 	.get_parent = clk_sam9x5_slow_get_parent,
 };
@@ -337,7 +338,7 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr,
 	init.ops = &sam9x5_slow_ops;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	slowck->hw.init = &init;
 	slowck->sckcr = sckcr;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 07/65] clk: at91: sckc: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SAM9x5 slow clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/sckc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c
index fdc9b669f8a7..9c42961a8a2f 100644
--- a/drivers/clk/at91/sckc.c
+++ b/drivers/clk/at91/sckc.c
@@ -310,6 +310,7 @@ static u8 clk_sam9x5_slow_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops sam9x5_slow_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sam9x5_slow_set_parent,
 	.get_parent = clk_sam9x5_slow_get_parent,
 };
@@ -337,7 +338,7 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr,
 	init.ops = &sam9x5_slow_ops;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	slowck->hw.init = &init;
 	slowck->sckcr = sckcr;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 08/65] clk: berlin: div: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Berlin2 divider clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/berlin/berlin2-div.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/berlin/berlin2-div.c b/drivers/clk/berlin/berlin2-div.c
index eb14a5bc0507..d3856ec93c12 100644
--- a/drivers/clk/berlin/berlin2-div.c
+++ b/drivers/clk/berlin/berlin2-div.c
@@ -210,6 +210,7 @@ static unsigned long berlin2_div_recalc_rate(struct clk_hw *hw,
 }
 
 static const struct clk_ops berlin2_div_rate_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.recalc_rate	= berlin2_div_recalc_rate,
 };
 
@@ -251,5 +252,5 @@ berlin2_div_register(const struct berlin2_div_map *map,
 
 	return clk_hw_register_composite(NULL, name, parent_names, num_parents,
 				      &div->hw, mux_ops, &div->hw, rate_ops,
-				      &div->hw, gate_ops, flags);
+				      &div->hw, gate_ops, flags | CLK_SET_RATE_NO_REPARENT);
 }

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 08/65] clk: berlin: div: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Berlin2 divider clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/berlin/berlin2-div.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/berlin/berlin2-div.c b/drivers/clk/berlin/berlin2-div.c
index eb14a5bc0507..d3856ec93c12 100644
--- a/drivers/clk/berlin/berlin2-div.c
+++ b/drivers/clk/berlin/berlin2-div.c
@@ -210,6 +210,7 @@ static unsigned long berlin2_div_recalc_rate(struct clk_hw *hw,
 }
 
 static const struct clk_ops berlin2_div_rate_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.recalc_rate	= berlin2_div_recalc_rate,
 };
 
@@ -251,5 +252,5 @@ berlin2_div_register(const struct berlin2_div_map *map,
 
 	return clk_hw_register_composite(NULL, name, parent_names, num_parents,
 				      &div->hw, mux_ops, &div->hw, rate_ops,
-				      &div->hw, gate_ops, flags);
+				      &div->hw, gate_ops, flags | CLK_SET_RATE_NO_REPARENT);
 }

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 08/65] clk: berlin: div: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Berlin2 divider clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/berlin/berlin2-div.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/berlin/berlin2-div.c b/drivers/clk/berlin/berlin2-div.c
index eb14a5bc0507..d3856ec93c12 100644
--- a/drivers/clk/berlin/berlin2-div.c
+++ b/drivers/clk/berlin/berlin2-div.c
@@ -210,6 +210,7 @@ static unsigned long berlin2_div_recalc_rate(struct clk_hw *hw,
 }
 
 static const struct clk_ops berlin2_div_rate_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.recalc_rate	= berlin2_div_recalc_rate,
 };
 
@@ -251,5 +252,5 @@ berlin2_div_register(const struct berlin2_div_map *map,
 
 	return clk_hw_register_composite(NULL, name, parent_names, num_parents,
 				      &div->hw, mux_ops, &div->hw, rate_ops,
-				      &div->hw, gate_ops, flags);
+				      &div->hw, gate_ops, flags | CLK_SET_RATE_NO_REPARENT);
 }

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 09/65] clk: cdce706: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The cdce706 "clkin" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index 1449d0537674..dc046bbf83a1 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -155,6 +155,7 @@ static u8 cdce706_clkin_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cdce706_clkin_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdce706_clkin_set_parent,
 	.get_parent = cdce706_clkin_get_parent,
 };
@@ -471,6 +472,7 @@ static int cdce706_register_clkin(struct cdce706_dev_data *cdce)
 {
 	struct clk_init_data init = {
 		.ops = &cdce706_clkin_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 		.parent_names = cdce->clkin_name,
 		.num_parents = ARRAY_SIZE(cdce->clkin_name),
 	};

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 09/65] clk: cdce706: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The cdce706 "clkin" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index 1449d0537674..dc046bbf83a1 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -155,6 +155,7 @@ static u8 cdce706_clkin_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cdce706_clkin_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdce706_clkin_set_parent,
 	.get_parent = cdce706_clkin_get_parent,
 };
@@ -471,6 +472,7 @@ static int cdce706_register_clkin(struct cdce706_dev_data *cdce)
 {
 	struct clk_init_data init = {
 		.ops = &cdce706_clkin_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 		.parent_names = cdce->clkin_name,
 		.num_parents = ARRAY_SIZE(cdce->clkin_name),
 	};

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 09/65] clk: cdce706: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The cdce706 "clkin" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index 1449d0537674..dc046bbf83a1 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -155,6 +155,7 @@ static u8 cdce706_clkin_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cdce706_clkin_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdce706_clkin_set_parent,
 	.get_parent = cdce706_clkin_get_parent,
 };
@@ -471,6 +472,7 @@ static int cdce706_register_clkin(struct cdce706_dev_data *cdce)
 {
 	struct clk_init_data init = {
 		.ops = &cdce706_clkin_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 		.parent_names = cdce->clkin_name,
 		.num_parents = ARRAY_SIZE(cdce->clkin_name),
 	};

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 10/65] clk: k210: pll: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The K210 PLL clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 67a7cb3503c3..279931a38127 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -537,6 +537,7 @@ static const struct clk_ops k210_pll2_ops = {
 	.disable	= k210_pll_disable,
 	.is_enabled	= k210_pll_is_enabled,
 	.recalc_rate	= k210_pll_get_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_pll2_set_parent,
 	.get_parent	= k210_pll2_get_parent,
 };
@@ -544,7 +545,8 @@ static const struct clk_ops k210_pll2_ops = {
 static int __init k210_register_pll(struct device_node *np,
 				    struct k210_sysclk *ksc,
 				    enum k210_pll_id pllid, const char *name,
-				    int num_parents, const struct clk_ops *ops)
+				    int num_parents, const struct clk_ops *ops,
+				    unsigned long flags)
 {
 	struct k210_pll *pll = &ksc->plls[pllid];
 	struct clk_init_data init = {};
@@ -558,6 +560,7 @@ static int __init k210_register_pll(struct device_node *np,
 	init.parent_data = parent_data;
 	init.num_parents = num_parents;
 	init.ops = ops;
+	init.flags = flags;
 
 	pll->hw.init = &init;
 	pll->ksc = ksc;
@@ -574,19 +577,20 @@ static int __init k210_register_plls(struct device_node *np,
 		k210_init_pll(ksc->regs, i, &ksc->plls[i]);
 
 	/* PLL0 and PLL1 only have IN0 as parent */
-	ret = k210_register_pll(np, ksc, K210_PLL0, "pll0", 1, &k210_pll_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL0, "pll0", 1, &k210_pll_ops, 0);
 	if (ret) {
 		pr_err("%pOFP: register PLL0 failed\n", np);
 		return ret;
 	}
-	ret = k210_register_pll(np, ksc, K210_PLL1, "pll1", 1, &k210_pll_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL1, "pll1", 1, &k210_pll_ops, 0);
 	if (ret) {
 		pr_err("%pOFP: register PLL1 failed\n", np);
 		return ret;
 	}
 
 	/* PLL2 has IN0, PLL0 and PLL1 as parents */
-	ret = k210_register_pll(np, ksc, K210_PLL2, "pll2", 3, &k210_pll2_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL2, "pll2", 3, &k210_pll2_ops,
+				CLK_SET_RATE_NO_REPARENT);
 	if (ret) {
 		pr_err("%pOFP: register PLL2 failed\n", np);
 		return ret;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 10/65] clk: k210: pll: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The K210 PLL clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 67a7cb3503c3..279931a38127 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -537,6 +537,7 @@ static const struct clk_ops k210_pll2_ops = {
 	.disable	= k210_pll_disable,
 	.is_enabled	= k210_pll_is_enabled,
 	.recalc_rate	= k210_pll_get_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_pll2_set_parent,
 	.get_parent	= k210_pll2_get_parent,
 };
@@ -544,7 +545,8 @@ static const struct clk_ops k210_pll2_ops = {
 static int __init k210_register_pll(struct device_node *np,
 				    struct k210_sysclk *ksc,
 				    enum k210_pll_id pllid, const char *name,
-				    int num_parents, const struct clk_ops *ops)
+				    int num_parents, const struct clk_ops *ops,
+				    unsigned long flags)
 {
 	struct k210_pll *pll = &ksc->plls[pllid];
 	struct clk_init_data init = {};
@@ -558,6 +560,7 @@ static int __init k210_register_pll(struct device_node *np,
 	init.parent_data = parent_data;
 	init.num_parents = num_parents;
 	init.ops = ops;
+	init.flags = flags;
 
 	pll->hw.init = &init;
 	pll->ksc = ksc;
@@ -574,19 +577,20 @@ static int __init k210_register_plls(struct device_node *np,
 		k210_init_pll(ksc->regs, i, &ksc->plls[i]);
 
 	/* PLL0 and PLL1 only have IN0 as parent */
-	ret = k210_register_pll(np, ksc, K210_PLL0, "pll0", 1, &k210_pll_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL0, "pll0", 1, &k210_pll_ops, 0);
 	if (ret) {
 		pr_err("%pOFP: register PLL0 failed\n", np);
 		return ret;
 	}
-	ret = k210_register_pll(np, ksc, K210_PLL1, "pll1", 1, &k210_pll_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL1, "pll1", 1, &k210_pll_ops, 0);
 	if (ret) {
 		pr_err("%pOFP: register PLL1 failed\n", np);
 		return ret;
 	}
 
 	/* PLL2 has IN0, PLL0 and PLL1 as parents */
-	ret = k210_register_pll(np, ksc, K210_PLL2, "pll2", 3, &k210_pll2_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL2, "pll2", 3, &k210_pll2_ops,
+				CLK_SET_RATE_NO_REPARENT);
 	if (ret) {
 		pr_err("%pOFP: register PLL2 failed\n", np);
 		return ret;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 10/65] clk: k210: pll: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The K210 PLL clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 67a7cb3503c3..279931a38127 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -537,6 +537,7 @@ static const struct clk_ops k210_pll2_ops = {
 	.disable	= k210_pll_disable,
 	.is_enabled	= k210_pll_is_enabled,
 	.recalc_rate	= k210_pll_get_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_pll2_set_parent,
 	.get_parent	= k210_pll2_get_parent,
 };
@@ -544,7 +545,8 @@ static const struct clk_ops k210_pll2_ops = {
 static int __init k210_register_pll(struct device_node *np,
 				    struct k210_sysclk *ksc,
 				    enum k210_pll_id pllid, const char *name,
-				    int num_parents, const struct clk_ops *ops)
+				    int num_parents, const struct clk_ops *ops,
+				    unsigned long flags)
 {
 	struct k210_pll *pll = &ksc->plls[pllid];
 	struct clk_init_data init = {};
@@ -558,6 +560,7 @@ static int __init k210_register_pll(struct device_node *np,
 	init.parent_data = parent_data;
 	init.num_parents = num_parents;
 	init.ops = ops;
+	init.flags = flags;
 
 	pll->hw.init = &init;
 	pll->ksc = ksc;
@@ -574,19 +577,20 @@ static int __init k210_register_plls(struct device_node *np,
 		k210_init_pll(ksc->regs, i, &ksc->plls[i]);
 
 	/* PLL0 and PLL1 only have IN0 as parent */
-	ret = k210_register_pll(np, ksc, K210_PLL0, "pll0", 1, &k210_pll_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL0, "pll0", 1, &k210_pll_ops, 0);
 	if (ret) {
 		pr_err("%pOFP: register PLL0 failed\n", np);
 		return ret;
 	}
-	ret = k210_register_pll(np, ksc, K210_PLL1, "pll1", 1, &k210_pll_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL1, "pll1", 1, &k210_pll_ops, 0);
 	if (ret) {
 		pr_err("%pOFP: register PLL1 failed\n", np);
 		return ret;
 	}
 
 	/* PLL2 has IN0, PLL0 and PLL1 as parents */
-	ret = k210_register_pll(np, ksc, K210_PLL2, "pll2", 3, &k210_pll2_ops);
+	ret = k210_register_pll(np, ksc, K210_PLL2, "pll2", 3, &k210_pll2_ops,
+				CLK_SET_RATE_NO_REPARENT);
 	if (ret) {
 		pr_err("%pOFP: register PLL2 failed\n", np);
 		return ret;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 11/65] clk: k210: aclk: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The K210 ACLK clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 279931a38127..5b9fd00d14e1 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -639,6 +639,7 @@ static unsigned long k210_aclk_get_rate(struct clk_hw *hw,
 }
 
 static const struct clk_ops k210_aclk_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_aclk_set_parent,
 	.get_parent	= k210_aclk_get_parent,
 	.recalc_rate	= k210_aclk_get_rate,
@@ -661,6 +662,7 @@ static int __init k210_register_aclk(struct device_node *np,
 	init.parent_data = parent_data;
 	init.num_parents = 2;
 	init.ops = &k210_aclk_ops;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	ksc->aclk.init = &init;
 
 	ret = of_clk_hw_register(np, &ksc->aclk);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 11/65] clk: k210: aclk: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The K210 ACLK clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 279931a38127..5b9fd00d14e1 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -639,6 +639,7 @@ static unsigned long k210_aclk_get_rate(struct clk_hw *hw,
 }
 
 static const struct clk_ops k210_aclk_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_aclk_set_parent,
 	.get_parent	= k210_aclk_get_parent,
 	.recalc_rate	= k210_aclk_get_rate,
@@ -661,6 +662,7 @@ static int __init k210_register_aclk(struct device_node *np,
 	init.parent_data = parent_data;
 	init.num_parents = 2;
 	init.ops = &k210_aclk_ops;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	ksc->aclk.init = &init;
 
 	ret = of_clk_hw_register(np, &ksc->aclk);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 11/65] clk: k210: aclk: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The K210 ACLK clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 279931a38127..5b9fd00d14e1 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -639,6 +639,7 @@ static unsigned long k210_aclk_get_rate(struct clk_hw *hw,
 }
 
 static const struct clk_ops k210_aclk_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_aclk_set_parent,
 	.get_parent	= k210_aclk_get_parent,
 	.recalc_rate	= k210_aclk_get_rate,
@@ -661,6 +662,7 @@ static int __init k210_register_aclk(struct device_node *np,
 	init.parent_data = parent_data;
 	init.num_parents = 2;
 	init.ops = &k210_aclk_ops;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	ksc->aclk.init = &init;
 
 	ret = of_clk_hw_register(np, &ksc->aclk);

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 12/65] clk: k210: mux: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The K210 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 5b9fd00d14e1..cdd7230f8f66 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -780,6 +780,7 @@ static unsigned long k210_clk_get_rate(struct clk_hw *hw,
 static const struct clk_ops k210_clk_mux_ops = {
 	.enable		= k210_clk_enable,
 	.disable	= k210_clk_disable,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_clk_set_parent,
 	.get_parent	= k210_clk_get_parent,
 	.recalc_rate	= k210_clk_get_rate,
@@ -832,7 +833,7 @@ static inline void __init k210_register_mux_clk(struct device_node *np,
 		{ .hw = &ksc->plls[K210_PLL0].hw }
 	};
 
-	k210_register_clk(np, ksc, id, parent_data, 2, 0);
+	k210_register_clk(np, ksc, id, parent_data, 2, CLK_SET_RATE_NO_REPARENT);
 }
 
 static inline void __init k210_register_in0_child(struct device_node *np,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 12/65] clk: k210: mux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The K210 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 5b9fd00d14e1..cdd7230f8f66 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -780,6 +780,7 @@ static unsigned long k210_clk_get_rate(struct clk_hw *hw,
 static const struct clk_ops k210_clk_mux_ops = {
 	.enable		= k210_clk_enable,
 	.disable	= k210_clk_disable,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_clk_set_parent,
 	.get_parent	= k210_clk_get_parent,
 	.recalc_rate	= k210_clk_get_rate,
@@ -832,7 +833,7 @@ static inline void __init k210_register_mux_clk(struct device_node *np,
 		{ .hw = &ksc->plls[K210_PLL0].hw }
 	};
 
-	k210_register_clk(np, ksc, id, parent_data, 2, 0);
+	k210_register_clk(np, ksc, id, parent_data, 2, CLK_SET_RATE_NO_REPARENT);
 }
 
 static inline void __init k210_register_in0_child(struct device_node *np,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 12/65] clk: k210: mux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The K210 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-k210.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 5b9fd00d14e1..cdd7230f8f66 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -780,6 +780,7 @@ static unsigned long k210_clk_get_rate(struct clk_hw *hw,
 static const struct clk_ops k210_clk_mux_ops = {
 	.enable		= k210_clk_enable,
 	.disable	= k210_clk_disable,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent	= k210_clk_set_parent,
 	.get_parent	= k210_clk_get_parent,
 	.recalc_rate	= k210_clk_get_rate,
@@ -832,7 +833,7 @@ static inline void __init k210_register_mux_clk(struct device_node *np,
 		{ .hw = &ksc->plls[K210_PLL0].hw }
 	};
 
-	k210_register_clk(np, ksc, id, parent_data, 2, 0);
+	k210_register_clk(np, ksc, id, parent_data, 2, CLK_SET_RATE_NO_REPARENT);
 }
 
 static inline void __init k210_register_in0_child(struct device_node *np,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 13/65] clk: lmk04832: clkout: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The LKM04832 "CLKOUT" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lmk04832.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
index f416f8bc2898..f68bb0affdad 100644
--- a/drivers/clk/clk-lmk04832.c
+++ b/drivers/clk/clk-lmk04832.c
@@ -1281,6 +1281,7 @@ static const struct clk_ops lmk04832_clkout_ops = {
 	.is_enabled = lmk04832_clkout_is_enabled,
 	.prepare = lmk04832_clkout_prepare,
 	.unprepare = lmk04832_clkout_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = lmk04832_clkout_set_parent,
 	.get_parent = lmk04832_clkout_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 13/65] clk: lmk04832: clkout: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The LKM04832 "CLKOUT" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lmk04832.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
index f416f8bc2898..f68bb0affdad 100644
--- a/drivers/clk/clk-lmk04832.c
+++ b/drivers/clk/clk-lmk04832.c
@@ -1281,6 +1281,7 @@ static const struct clk_ops lmk04832_clkout_ops = {
 	.is_enabled = lmk04832_clkout_is_enabled,
 	.prepare = lmk04832_clkout_prepare,
 	.unprepare = lmk04832_clkout_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = lmk04832_clkout_set_parent,
 	.get_parent = lmk04832_clkout_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 13/65] clk: lmk04832: clkout: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The LKM04832 "CLKOUT" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lmk04832.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
index f416f8bc2898..f68bb0affdad 100644
--- a/drivers/clk/clk-lmk04832.c
+++ b/drivers/clk/clk-lmk04832.c
@@ -1281,6 +1281,7 @@ static const struct clk_ops lmk04832_clkout_ops = {
 	.is_enabled = lmk04832_clkout_is_enabled,
 	.prepare = lmk04832_clkout_prepare,
 	.unprepare = lmk04832_clkout_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = lmk04832_clkout_set_parent,
 	.get_parent = lmk04832_clkout_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 14/65] clk: lochnagar: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The lochnagar clocks implement a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lochnagar.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-lochnagar.c b/drivers/clk/clk-lochnagar.c
index 80944bf482e9..820c05732ac7 100644
--- a/drivers/clk/clk-lochnagar.c
+++ b/drivers/clk/clk-lochnagar.c
@@ -209,6 +209,7 @@ static u8 lochnagar_clk_get_parent(struct clk_hw *hw)
 static const struct clk_ops lochnagar_clk_ops = {
 	.prepare = lochnagar_clk_prepare,
 	.unprepare = lochnagar_clk_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = lochnagar_clk_set_parent,
 	.get_parent = lochnagar_clk_get_parent,
 };
@@ -238,6 +239,7 @@ static int lochnagar_clk_probe(struct platform_device *pdev)
 {
 	struct clk_init_data clk_init = {
 		.ops = &lochnagar_clk_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 	};
 	struct device *dev = &pdev->dev;
 	struct lochnagar_clk_priv *priv;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 14/65] clk: lochnagar: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The lochnagar clocks implement a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lochnagar.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-lochnagar.c b/drivers/clk/clk-lochnagar.c
index 80944bf482e9..820c05732ac7 100644
--- a/drivers/clk/clk-lochnagar.c
+++ b/drivers/clk/clk-lochnagar.c
@@ -209,6 +209,7 @@ static u8 lochnagar_clk_get_parent(struct clk_hw *hw)
 static const struct clk_ops lochnagar_clk_ops = {
 	.prepare = lochnagar_clk_prepare,
 	.unprepare = lochnagar_clk_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = lochnagar_clk_set_parent,
 	.get_parent = lochnagar_clk_get_parent,
 };
@@ -238,6 +239,7 @@ static int lochnagar_clk_probe(struct platform_device *pdev)
 {
 	struct clk_init_data clk_init = {
 		.ops = &lochnagar_clk_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 	};
 	struct device *dev = &pdev->dev;
 	struct lochnagar_clk_priv *priv;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 14/65] clk: lochnagar: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The lochnagar clocks implement a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-lochnagar.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-lochnagar.c b/drivers/clk/clk-lochnagar.c
index 80944bf482e9..820c05732ac7 100644
--- a/drivers/clk/clk-lochnagar.c
+++ b/drivers/clk/clk-lochnagar.c
@@ -209,6 +209,7 @@ static u8 lochnagar_clk_get_parent(struct clk_hw *hw)
 static const struct clk_ops lochnagar_clk_ops = {
 	.prepare = lochnagar_clk_prepare,
 	.unprepare = lochnagar_clk_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = lochnagar_clk_set_parent,
 	.get_parent = lochnagar_clk_get_parent,
 };
@@ -238,6 +239,7 @@ static int lochnagar_clk_probe(struct platform_device *pdev)
 {
 	struct clk_init_data clk_init = {
 		.ops = &lochnagar_clk_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 	};
 	struct device *dev = &pdev->dev;
 	struct lochnagar_clk_priv *priv;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 15/65] clk: qoriq: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Qoriq mux clocks implement a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-qoriq.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 5eddb9f0d6bd..6f51a2cfaace 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -878,6 +878,7 @@ static u8 mux_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cmux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = mux_get_parent,
 	.set_parent = mux_set_parent,
 };
@@ -908,6 +909,7 @@ static const struct clockgen_pll_div *get_pll_div(struct clockgen *cg,
 static struct clk * __init create_mux_common(struct clockgen *cg,
 					     struct mux_hwclock *hwc,
 					     const struct clk_ops *ops,
+					     unsigned long flags,
 					     unsigned long min_rate,
 					     unsigned long max_rate,
 					     unsigned long pct80_rate,
@@ -951,7 +953,7 @@ static struct clk * __init create_mux_common(struct clockgen *cg,
 	init.ops = ops;
 	init.parent_names = parent_names;
 	init.num_parents = hwc->num_parents = j;
-	init.flags = 0;
+	init.flags = flags;
 	hwc->hw.init = &init;
 	hwc->cg = cg;
 
@@ -1010,8 +1012,8 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
 	else
 		min_rate = plat_rate / 2;
 
-	return create_mux_common(cg, hwc, &cmux_ops, min_rate, max_rate,
-				 pct80_rate, "cg-cmux%d", idx);
+	return create_mux_common(cg, hwc, &cmux_ops, CLK_SET_RATE_NO_REPARENT,
+				 min_rate, max_rate, pct80_rate, "cg-cmux%d", idx);
 }
 
 static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
@@ -1025,7 +1027,7 @@ static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
 	hwc->reg = cg->regs + 0x20 * idx + 0x10;
 	hwc->info = cg->info.hwaccel[idx];
 
-	return create_mux_common(cg, hwc, &hwaccel_ops, 0, ULONG_MAX, 0,
+	return create_mux_common(cg, hwc, &hwaccel_ops, 0, 0, ULONG_MAX, 0,
 				 "cg-hwaccel%d", idx);
 }
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 15/65] clk: qoriq: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Qoriq mux clocks implement a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-qoriq.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 5eddb9f0d6bd..6f51a2cfaace 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -878,6 +878,7 @@ static u8 mux_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cmux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = mux_get_parent,
 	.set_parent = mux_set_parent,
 };
@@ -908,6 +909,7 @@ static const struct clockgen_pll_div *get_pll_div(struct clockgen *cg,
 static struct clk * __init create_mux_common(struct clockgen *cg,
 					     struct mux_hwclock *hwc,
 					     const struct clk_ops *ops,
+					     unsigned long flags,
 					     unsigned long min_rate,
 					     unsigned long max_rate,
 					     unsigned long pct80_rate,
@@ -951,7 +953,7 @@ static struct clk * __init create_mux_common(struct clockgen *cg,
 	init.ops = ops;
 	init.parent_names = parent_names;
 	init.num_parents = hwc->num_parents = j;
-	init.flags = 0;
+	init.flags = flags;
 	hwc->hw.init = &init;
 	hwc->cg = cg;
 
@@ -1010,8 +1012,8 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
 	else
 		min_rate = plat_rate / 2;
 
-	return create_mux_common(cg, hwc, &cmux_ops, min_rate, max_rate,
-				 pct80_rate, "cg-cmux%d", idx);
+	return create_mux_common(cg, hwc, &cmux_ops, CLK_SET_RATE_NO_REPARENT,
+				 min_rate, max_rate, pct80_rate, "cg-cmux%d", idx);
 }
 
 static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
@@ -1025,7 +1027,7 @@ static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
 	hwc->reg = cg->regs + 0x20 * idx + 0x10;
 	hwc->info = cg->info.hwaccel[idx];
 
-	return create_mux_common(cg, hwc, &hwaccel_ops, 0, ULONG_MAX, 0,
+	return create_mux_common(cg, hwc, &hwaccel_ops, 0, 0, ULONG_MAX, 0,
 				 "cg-hwaccel%d", idx);
 }
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 15/65] clk: qoriq: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Qoriq mux clocks implement a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-qoriq.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 5eddb9f0d6bd..6f51a2cfaace 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -878,6 +878,7 @@ static u8 mux_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cmux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = mux_get_parent,
 	.set_parent = mux_set_parent,
 };
@@ -908,6 +909,7 @@ static const struct clockgen_pll_div *get_pll_div(struct clockgen *cg,
 static struct clk * __init create_mux_common(struct clockgen *cg,
 					     struct mux_hwclock *hwc,
 					     const struct clk_ops *ops,
+					     unsigned long flags,
 					     unsigned long min_rate,
 					     unsigned long max_rate,
 					     unsigned long pct80_rate,
@@ -951,7 +953,7 @@ static struct clk * __init create_mux_common(struct clockgen *cg,
 	init.ops = ops;
 	init.parent_names = parent_names;
 	init.num_parents = hwc->num_parents = j;
-	init.flags = 0;
+	init.flags = flags;
 	hwc->hw.init = &init;
 	hwc->cg = cg;
 
@@ -1010,8 +1012,8 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
 	else
 		min_rate = plat_rate / 2;
 
-	return create_mux_common(cg, hwc, &cmux_ops, min_rate, max_rate,
-				 pct80_rate, "cg-cmux%d", idx);
+	return create_mux_common(cg, hwc, &cmux_ops, CLK_SET_RATE_NO_REPARENT,
+				 min_rate, max_rate, pct80_rate, "cg-cmux%d", idx);
 }
 
 static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
@@ -1025,7 +1027,7 @@ static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
 	hwc->reg = cg->regs + 0x20 * idx + 0x10;
 	hwc->info = cg->info.hwaccel[idx];
 
-	return create_mux_common(cg, hwc, &hwaccel_ops, 0, ULONG_MAX, 0,
+	return create_mux_common(cg, hwc, &hwaccel_ops, 0, 0, ULONG_MAX, 0,
 				 "cg-hwaccel%d", idx);
 }
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 16/65] clk: si5341: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The SI5341 clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5341.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 0e528d7ba656..259861aa2e2f 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -551,6 +551,7 @@ static int si5341_clk_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops si5341_clk_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = si5341_clk_set_parent,
 	.get_parent = si5341_clk_get_parent,
 	.recalc_rate = si5341_clk_recalc_rate,
@@ -1682,7 +1683,7 @@ static int si5341_probe(struct i2c_client *client)
 	init.parent_names = data->input_clk_name;
 	init.num_parents = SI5341_NUM_INPUTS;
 	init.ops = &si5341_clk_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	data->hw.init = &init;
 
 	err = devm_clk_hw_register(&client->dev, &data->hw);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 16/65] clk: si5341: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5341 clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5341.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 0e528d7ba656..259861aa2e2f 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -551,6 +551,7 @@ static int si5341_clk_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops si5341_clk_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = si5341_clk_set_parent,
 	.get_parent = si5341_clk_get_parent,
 	.recalc_rate = si5341_clk_recalc_rate,
@@ -1682,7 +1683,7 @@ static int si5341_probe(struct i2c_client *client)
 	init.parent_names = data->input_clk_name;
 	init.num_parents = SI5341_NUM_INPUTS;
 	init.ops = &si5341_clk_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	data->hw.init = &init;
 
 	err = devm_clk_hw_register(&client->dev, &data->hw);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 16/65] clk: si5341: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5341 clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5341.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 0e528d7ba656..259861aa2e2f 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -551,6 +551,7 @@ static int si5341_clk_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops si5341_clk_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = si5341_clk_set_parent,
 	.get_parent = si5341_clk_get_parent,
 	.recalc_rate = si5341_clk_recalc_rate,
@@ -1682,7 +1683,7 @@ static int si5341_probe(struct i2c_client *client)
 	init.parent_names = data->input_clk_name;
 	init.num_parents = SI5341_NUM_INPUTS;
 	init.ops = &si5341_clk_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	data->hw.init = &init;
 
 	err = devm_clk_hw_register(&client->dev, &data->hw);

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 17/65] clk: stm32f4: mux: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The STM32F4 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-stm32f4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c
index 473dfe632cc5..01046437a48c 100644
--- a/drivers/clk/clk-stm32f4.c
+++ b/drivers/clk/clk-stm32f4.c
@@ -1045,6 +1045,7 @@ static int cclk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops cclk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = cclk_mux_get_parent,
 	.set_parent = cclk_mux_set_parent,
 };
@@ -1085,7 +1086,7 @@ static struct clk_hw *stm32_register_cclk(struct device *dev, const char *name,
 			&mux->hw, &cclk_mux_ops,
 			NULL, NULL,
 			&gate->hw, &cclk_gate_ops,
-			flags);
+			flags | CLK_SET_RATE_NO_REPARENT);
 
 	if (IS_ERR(hw)) {
 		kfree(gate);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 17/65] clk: stm32f4: mux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The STM32F4 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-stm32f4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c
index 473dfe632cc5..01046437a48c 100644
--- a/drivers/clk/clk-stm32f4.c
+++ b/drivers/clk/clk-stm32f4.c
@@ -1045,6 +1045,7 @@ static int cclk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops cclk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = cclk_mux_get_parent,
 	.set_parent = cclk_mux_set_parent,
 };
@@ -1085,7 +1086,7 @@ static struct clk_hw *stm32_register_cclk(struct device *dev, const char *name,
 			&mux->hw, &cclk_mux_ops,
 			NULL, NULL,
 			&gate->hw, &cclk_gate_ops,
-			flags);
+			flags | CLK_SET_RATE_NO_REPARENT);
 
 	if (IS_ERR(hw)) {
 		kfree(gate);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 17/65] clk: stm32f4: mux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The STM32F4 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-stm32f4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c
index 473dfe632cc5..01046437a48c 100644
--- a/drivers/clk/clk-stm32f4.c
+++ b/drivers/clk/clk-stm32f4.c
@@ -1045,6 +1045,7 @@ static int cclk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops cclk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = cclk_mux_get_parent,
 	.set_parent = cclk_mux_set_parent,
 };
@@ -1085,7 +1086,7 @@ static struct clk_hw *stm32_register_cclk(struct device *dev, const char *name,
 			&mux->hw, &cclk_mux_ops,
 			NULL, NULL,
 			&gate->hw, &cclk_gate_ops,
-			flags);
+			flags | CLK_SET_RATE_NO_REPARENT);
 
 	if (IS_ERR(hw)) {
 		kfree(gate);

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 18/65] clk: vc5: mux: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Versaclock5 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-versaclock5.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index 88689415aff9..e858066c2c3f 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -281,6 +281,7 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops vc5_mux_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= vc5_mux_set_parent,
 	.get_parent	= vc5_mux_get_parent,
 };
@@ -1031,7 +1032,7 @@ static int vc5_probe(struct i2c_client *client)
 
 	init.name = kasprintf(GFP_KERNEL, "%pOFn.mux", client->dev.of_node);
 	init.ops = &vc5_mux_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	vc5->clk_mux.init = &init;
 	ret = devm_clk_hw_register(&client->dev, &vc5->clk_mux);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 18/65] clk: vc5: mux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Versaclock5 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-versaclock5.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index 88689415aff9..e858066c2c3f 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -281,6 +281,7 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops vc5_mux_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= vc5_mux_set_parent,
 	.get_parent	= vc5_mux_get_parent,
 };
@@ -1031,7 +1032,7 @@ static int vc5_probe(struct i2c_client *client)
 
 	init.name = kasprintf(GFP_KERNEL, "%pOFn.mux", client->dev.of_node);
 	init.ops = &vc5_mux_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	vc5->clk_mux.init = &init;
 	ret = devm_clk_hw_register(&client->dev, &vc5->clk_mux);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 18/65] clk: vc5: mux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Versaclock5 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-versaclock5.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index 88689415aff9..e858066c2c3f 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -281,6 +281,7 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops vc5_mux_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= vc5_mux_set_parent,
 	.get_parent	= vc5_mux_get_parent,
 };
@@ -1031,7 +1032,7 @@ static int vc5_probe(struct i2c_client *client)
 
 	init.name = kasprintf(GFP_KERNEL, "%pOFn.mux", client->dev.of_node);
 	init.ops = &vc5_mux_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	vc5->clk_mux.init = &init;
 	ret = devm_clk_hw_register(&client->dev, &vc5->clk_mux);

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 19/65] clk: vc5: clkout: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Versaclock5 "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-versaclock5.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index e858066c2c3f..661ab1ca3d83 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -728,6 +728,7 @@ static int vc5_clk_out_set_parent(struct clk_hw *hw, u8 index)
 static const struct clk_ops vc5_clk_out_ops = {
 	.prepare	= vc5_clk_out_prepare,
 	.unprepare	= vc5_clk_out_unprepare,
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= vc5_clk_out_set_parent,
 	.get_parent	= vc5_clk_out_get_parent,
 };
@@ -1115,7 +1116,7 @@ static int vc5_probe(struct i2c_client *client)
 	init.name = kasprintf(GFP_KERNEL, "%pOFn.out0_sel_i2cb",
 			      client->dev.of_node);
 	init.ops = &vc5_clk_out_ops;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	parent_names[0] = clk_hw_get_name(&vc5->clk_mux);
 	init.num_parents = 1;
@@ -1141,7 +1142,7 @@ static int vc5_probe(struct i2c_client *client)
 		init.name = kasprintf(GFP_KERNEL, "%pOFn.out%d",
 				      client->dev.of_node, idx + 1);
 		init.ops = &vc5_clk_out_ops;
-		init.flags = CLK_SET_RATE_PARENT;
+		init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 		init.parent_names = parent_names;
 		init.num_parents = 2;
 		vc5->clk_out[n].num = idx;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 19/65] clk: vc5: clkout: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Versaclock5 "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-versaclock5.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index e858066c2c3f..661ab1ca3d83 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -728,6 +728,7 @@ static int vc5_clk_out_set_parent(struct clk_hw *hw, u8 index)
 static const struct clk_ops vc5_clk_out_ops = {
 	.prepare	= vc5_clk_out_prepare,
 	.unprepare	= vc5_clk_out_unprepare,
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= vc5_clk_out_set_parent,
 	.get_parent	= vc5_clk_out_get_parent,
 };
@@ -1115,7 +1116,7 @@ static int vc5_probe(struct i2c_client *client)
 	init.name = kasprintf(GFP_KERNEL, "%pOFn.out0_sel_i2cb",
 			      client->dev.of_node);
 	init.ops = &vc5_clk_out_ops;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	parent_names[0] = clk_hw_get_name(&vc5->clk_mux);
 	init.num_parents = 1;
@@ -1141,7 +1142,7 @@ static int vc5_probe(struct i2c_client *client)
 		init.name = kasprintf(GFP_KERNEL, "%pOFn.out%d",
 				      client->dev.of_node, idx + 1);
 		init.ops = &vc5_clk_out_ops;
-		init.flags = CLK_SET_RATE_PARENT;
+		init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 		init.parent_names = parent_names;
 		init.num_parents = 2;
 		vc5->clk_out[n].num = idx;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 19/65] clk: vc5: clkout: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Versaclock5 "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-versaclock5.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index e858066c2c3f..661ab1ca3d83 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -728,6 +728,7 @@ static int vc5_clk_out_set_parent(struct clk_hw *hw, u8 index)
 static const struct clk_ops vc5_clk_out_ops = {
 	.prepare	= vc5_clk_out_prepare,
 	.unprepare	= vc5_clk_out_unprepare,
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= vc5_clk_out_set_parent,
 	.get_parent	= vc5_clk_out_get_parent,
 };
@@ -1115,7 +1116,7 @@ static int vc5_probe(struct i2c_client *client)
 	init.name = kasprintf(GFP_KERNEL, "%pOFn.out0_sel_i2cb",
 			      client->dev.of_node);
 	init.ops = &vc5_clk_out_ops;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	parent_names[0] = clk_hw_get_name(&vc5->clk_mux);
 	init.num_parents = 1;
@@ -1141,7 +1142,7 @@ static int vc5_probe(struct i2c_client *client)
 		init.name = kasprintf(GFP_KERNEL, "%pOFn.out%d",
 				      client->dev.of_node, idx + 1);
 		init.ops = &vc5_clk_out_ops;
-		init.flags = CLK_SET_RATE_PARENT;
+		init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 		init.parent_names = parent_names;
 		init.num_parents = 2;
 		vc5->clk_out[n].num = idx;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The WM381x "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-wm831x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-wm831x.c b/drivers/clk/clk-wm831x.c
index ae6dd38ec053..be3a9c1f3610 100644
--- a/drivers/clk/clk-wm831x.c
+++ b/drivers/clk/clk-wm831x.c
@@ -329,6 +329,7 @@ static const struct clk_ops wm831x_clkout_ops = {
 	.is_prepared = wm831x_clkout_is_prepared,
 	.prepare = wm831x_clkout_prepare,
 	.unprepare = wm831x_clkout_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = wm831x_clkout_get_parent,
 	.set_parent = wm831x_clkout_set_parent,
 };
@@ -338,7 +339,7 @@ static const struct clk_init_data wm831x_clkout_init = {
 	.ops = &wm831x_clkout_ops,
 	.parent_names = wm831x_clkout_parents,
 	.num_parents = ARRAY_SIZE(wm831x_clkout_parents),
-	.flags = CLK_SET_RATE_PARENT,
+	.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
 };
 
 static int wm831x_clk_probe(struct platform_device *pdev)

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The WM381x "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-wm831x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-wm831x.c b/drivers/clk/clk-wm831x.c
index ae6dd38ec053..be3a9c1f3610 100644
--- a/drivers/clk/clk-wm831x.c
+++ b/drivers/clk/clk-wm831x.c
@@ -329,6 +329,7 @@ static const struct clk_ops wm831x_clkout_ops = {
 	.is_prepared = wm831x_clkout_is_prepared,
 	.prepare = wm831x_clkout_prepare,
 	.unprepare = wm831x_clkout_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = wm831x_clkout_get_parent,
 	.set_parent = wm831x_clkout_set_parent,
 };
@@ -338,7 +339,7 @@ static const struct clk_init_data wm831x_clkout_init = {
 	.ops = &wm831x_clkout_ops,
 	.parent_names = wm831x_clkout_parents,
 	.num_parents = ARRAY_SIZE(wm831x_clkout_parents),
-	.flags = CLK_SET_RATE_PARENT,
+	.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
 };
 
 static int wm831x_clk_probe(struct platform_device *pdev)

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The WM381x "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-wm831x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-wm831x.c b/drivers/clk/clk-wm831x.c
index ae6dd38ec053..be3a9c1f3610 100644
--- a/drivers/clk/clk-wm831x.c
+++ b/drivers/clk/clk-wm831x.c
@@ -329,6 +329,7 @@ static const struct clk_ops wm831x_clkout_ops = {
 	.is_prepared = wm831x_clkout_is_prepared,
 	.prepare = wm831x_clkout_prepare,
 	.unprepare = wm831x_clkout_unprepare,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = wm831x_clkout_get_parent,
 	.set_parent = wm831x_clkout_set_parent,
 };
@@ -338,7 +339,7 @@ static const struct clk_init_data wm831x_clkout_init = {
 	.ops = &wm831x_clkout_ops,
 	.parent_names = wm831x_clkout_parents,
 	.num_parents = ARRAY_SIZE(wm831x_clkout_parents),
-	.flags = CLK_SET_RATE_PARENT,
+	.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
 };
 
 static int wm831x_clk_probe(struct platform_device *pdev)

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index 4103d605e804..c04276bc4051 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -229,6 +229,7 @@ static u8 da8xx_cfgchip_mux_clk_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops da8xx_cfgchip_mux_clk_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= da8xx_cfgchip_mux_clk_set_parent,
 	.get_parent	= da8xx_cfgchip_mux_clk_get_parent,
 };
@@ -251,7 +252,7 @@ da8xx_cfgchip_mux_clk_register(struct device *dev,
 	init.ops = &da8xx_cfgchip_mux_clk_ops;
 	init.parent_names = parent_names;
 	init.num_parents = 2;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	mux->hw.init = &init;
 	mux->regmap = regmap;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index 4103d605e804..c04276bc4051 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -229,6 +229,7 @@ static u8 da8xx_cfgchip_mux_clk_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops da8xx_cfgchip_mux_clk_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= da8xx_cfgchip_mux_clk_set_parent,
 	.get_parent	= da8xx_cfgchip_mux_clk_get_parent,
 };
@@ -251,7 +252,7 @@ da8xx_cfgchip_mux_clk_register(struct device *dev,
 	init.ops = &da8xx_cfgchip_mux_clk_ops;
 	init.parent_names = parent_names;
 	init.num_parents = 2;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	mux->hw.init = &init;
 	mux->regmap = regmap;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index 4103d605e804..c04276bc4051 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -229,6 +229,7 @@ static u8 da8xx_cfgchip_mux_clk_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops da8xx_cfgchip_mux_clk_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= da8xx_cfgchip_mux_clk_set_parent,
 	.get_parent	= da8xx_cfgchip_mux_clk_get_parent,
 };
@@ -251,7 +252,7 @@ da8xx_cfgchip_mux_clk_register(struct device *dev,
 	init.ops = &da8xx_cfgchip_mux_clk_ops;
 	init.parent_names = parent_names;
 	init.num_parents = 2;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	mux->hw.init = &init;
 	mux->regmap = regmap;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 22/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Davinci DA8xxx cfgchip "clk48" clock implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index c04276bc4051..4c1cc59bba53 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -565,6 +565,7 @@ static u8 da8xx_usb1_clk48_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops da8xx_usb1_clk48_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= da8xx_usb1_clk48_set_parent,
 	.get_parent	= da8xx_usb1_clk48_get_parent,
 };
@@ -589,6 +590,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev,
 
 	init.name = "usb1_clk48";
 	init.ops = &da8xx_usb1_clk48_ops;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = 2;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 22/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Davinci DA8xxx cfgchip "clk48" clock implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index c04276bc4051..4c1cc59bba53 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -565,6 +565,7 @@ static u8 da8xx_usb1_clk48_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops da8xx_usb1_clk48_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= da8xx_usb1_clk48_set_parent,
 	.get_parent	= da8xx_usb1_clk48_get_parent,
 };
@@ -589,6 +590,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev,
 
 	init.name = "usb1_clk48";
 	init.ops = &da8xx_usb1_clk48_ops;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = 2;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 22/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Davinci DA8xxx cfgchip "clk48" clock implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index c04276bc4051..4c1cc59bba53 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -565,6 +565,7 @@ static u8 da8xx_usb1_clk48_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops da8xx_usb1_clk48_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.set_parent	= da8xx_usb1_clk48_set_parent,
 	.get_parent	= da8xx_usb1_clk48_get_parent,
 };
@@ -589,6 +590,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev,
 
 	init.name = "usb1_clk48";
 	init.ops = &da8xx_usb1_clk48_ops;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = 2;
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 23/65] clk: imx: busy: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The iMX busy clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-busy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-busy.c b/drivers/clk/imx/clk-busy.c
index 6f17311647f3..2df81862782a 100644
--- a/drivers/clk/imx/clk-busy.c
+++ b/drivers/clk/imx/clk-busy.c
@@ -148,6 +148,7 @@ static int clk_busy_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_busy_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_busy_mux_get_parent,
 	.set_parent = clk_busy_mux_set_parent,
 };
@@ -176,7 +177,7 @@ struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift
 
 	init.name = name;
 	init.ops = &clk_busy_mux_ops;
-	init.flags = CLK_IS_CRITICAL;
+	init.flags = CLK_IS_CRITICAL | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 23/65] clk: imx: busy: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The iMX busy clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-busy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-busy.c b/drivers/clk/imx/clk-busy.c
index 6f17311647f3..2df81862782a 100644
--- a/drivers/clk/imx/clk-busy.c
+++ b/drivers/clk/imx/clk-busy.c
@@ -148,6 +148,7 @@ static int clk_busy_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_busy_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_busy_mux_get_parent,
 	.set_parent = clk_busy_mux_set_parent,
 };
@@ -176,7 +177,7 @@ struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift
 
 	init.name = name;
 	init.ops = &clk_busy_mux_ops;
-	init.flags = CLK_IS_CRITICAL;
+	init.flags = CLK_IS_CRITICAL | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 23/65] clk: imx: busy: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The iMX busy clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-busy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-busy.c b/drivers/clk/imx/clk-busy.c
index 6f17311647f3..2df81862782a 100644
--- a/drivers/clk/imx/clk-busy.c
+++ b/drivers/clk/imx/clk-busy.c
@@ -148,6 +148,7 @@ static int clk_busy_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_busy_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_busy_mux_get_parent,
 	.set_parent = clk_busy_mux_set_parent,
 };
@@ -176,7 +177,7 @@ struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift
 
 	init.name = name;
 	init.ops = &clk_busy_mux_ops;
-	init.flags = CLK_IS_CRITICAL;
+	init.flags = CLK_IS_CRITICAL | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 24/65] clk: imx: fixup-mux: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The iMX fixup mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-fixup-mux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-fixup-mux.c b/drivers/clk/imx/clk-fixup-mux.c
index c82401570c84..e32c3b22ff05 100644
--- a/drivers/clk/imx/clk-fixup-mux.c
+++ b/drivers/clk/imx/clk-fixup-mux.c
@@ -60,6 +60,7 @@ static int clk_fixup_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_fixup_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_fixup_mux_get_parent,
 	.set_parent = clk_fixup_mux_set_parent,
 };
@@ -84,7 +85,7 @@ struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg,
 	init.ops = &clk_fixup_mux_ops;
 	init.parent_names = parents;
 	init.num_parents = num_parents;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	fixup_mux->mux.reg = reg;
 	fixup_mux->mux.shift = shift;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 24/65] clk: imx: fixup-mux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The iMX fixup mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-fixup-mux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-fixup-mux.c b/drivers/clk/imx/clk-fixup-mux.c
index c82401570c84..e32c3b22ff05 100644
--- a/drivers/clk/imx/clk-fixup-mux.c
+++ b/drivers/clk/imx/clk-fixup-mux.c
@@ -60,6 +60,7 @@ static int clk_fixup_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_fixup_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_fixup_mux_get_parent,
 	.set_parent = clk_fixup_mux_set_parent,
 };
@@ -84,7 +85,7 @@ struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg,
 	init.ops = &clk_fixup_mux_ops;
 	init.parent_names = parents;
 	init.num_parents = num_parents;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	fixup_mux->mux.reg = reg;
 	fixup_mux->mux.shift = shift;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 24/65] clk: imx: fixup-mux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The iMX fixup mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-fixup-mux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-fixup-mux.c b/drivers/clk/imx/clk-fixup-mux.c
index c82401570c84..e32c3b22ff05 100644
--- a/drivers/clk/imx/clk-fixup-mux.c
+++ b/drivers/clk/imx/clk-fixup-mux.c
@@ -60,6 +60,7 @@ static int clk_fixup_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_fixup_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_fixup_mux_get_parent,
 	.set_parent = clk_fixup_mux_set_parent,
 };
@@ -84,7 +85,7 @@ struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg,
 	init.ops = &clk_fixup_mux_ops;
 	init.parent_names = parents;
 	init.num_parents = num_parents;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	fixup_mux->mux.reg = reg;
 	fixup_mux->mux.shift = shift;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 25/65] clk: imx: scu: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The iMX SCU mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-scu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 1e6870f3671f..66e49fea5f8a 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -785,6 +785,7 @@ static int clk_gpr_mux_scu_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_gpr_mux_scu_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_gpr_mux_scu_get_parent,
 	.set_parent = clk_gpr_mux_scu_set_parent,
 };
@@ -836,7 +837,7 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
 	struct imx_scu_clk_node *clk_node;
 	struct clk_gpr_scu *clk;
 	struct clk_hw *hw;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	int ret;
 
 	if (rsrc_id >= IMX_SC_R_LAST || gpr_id >= IMX_SC_C_LAST)
@@ -868,10 +869,11 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
 	if (flags & IMX_SCU_GPR_CLK_DIV)
 		init.ops = &clk_gpr_div_scu_ops;
 
-	if (flags & IMX_SCU_GPR_CLK_MUX)
+	if (flags & IMX_SCU_GPR_CLK_MUX) {
 		init.ops = &clk_gpr_mux_scu_ops;
+		init.flags |= CLK_SET_RATE_NO_REPARENT;
+	}
 
-	init.flags = 0;
 	init.name = name;
 	init.parent_names = parent_name;
 	init.num_parents = num_parents;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 25/65] clk: imx: scu: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The iMX SCU mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-scu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 1e6870f3671f..66e49fea5f8a 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -785,6 +785,7 @@ static int clk_gpr_mux_scu_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_gpr_mux_scu_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_gpr_mux_scu_get_parent,
 	.set_parent = clk_gpr_mux_scu_set_parent,
 };
@@ -836,7 +837,7 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
 	struct imx_scu_clk_node *clk_node;
 	struct clk_gpr_scu *clk;
 	struct clk_hw *hw;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	int ret;
 
 	if (rsrc_id >= IMX_SC_R_LAST || gpr_id >= IMX_SC_C_LAST)
@@ -868,10 +869,11 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
 	if (flags & IMX_SCU_GPR_CLK_DIV)
 		init.ops = &clk_gpr_div_scu_ops;
 
-	if (flags & IMX_SCU_GPR_CLK_MUX)
+	if (flags & IMX_SCU_GPR_CLK_MUX) {
 		init.ops = &clk_gpr_mux_scu_ops;
+		init.flags |= CLK_SET_RATE_NO_REPARENT;
+	}
 
-	init.flags = 0;
 	init.name = name;
 	init.parent_names = parent_name;
 	init.num_parents = num_parents;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 25/65] clk: imx: scu: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The iMX SCU mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-scu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 1e6870f3671f..66e49fea5f8a 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -785,6 +785,7 @@ static int clk_gpr_mux_scu_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_gpr_mux_scu_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_gpr_mux_scu_get_parent,
 	.set_parent = clk_gpr_mux_scu_set_parent,
 };
@@ -836,7 +837,7 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
 	struct imx_scu_clk_node *clk_node;
 	struct clk_gpr_scu *clk;
 	struct clk_hw *hw;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	int ret;
 
 	if (rsrc_id >= IMX_SC_R_LAST || gpr_id >= IMX_SC_C_LAST)
@@ -868,10 +869,11 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
 	if (flags & IMX_SCU_GPR_CLK_DIV)
 		init.ops = &clk_gpr_div_scu_ops;
 
-	if (flags & IMX_SCU_GPR_CLK_MUX)
+	if (flags & IMX_SCU_GPR_CLK_MUX) {
 		init.ops = &clk_gpr_mux_scu_ops;
+		init.flags |= CLK_SET_RATE_NO_REPARENT;
+	}
 
-	init.flags = 0;
 	init.name = name;
 	init.parent_names = parent_name;
 	init.num_parents = num_parents;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 26/65] clk: mediatek: cpumux: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Mediatek cpumux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/mediatek/clk-cpumux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-cpumux.c b/drivers/clk/mediatek/clk-cpumux.c
index 25618eff6f2a..514807ae4903 100644
--- a/drivers/clk/mediatek/clk-cpumux.c
+++ b/drivers/clk/mediatek/clk-cpumux.c
@@ -53,6 +53,7 @@ static int clk_cpumux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_cpumux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_cpumux_get_parent,
 	.set_parent = clk_cpumux_set_parent,
 };
@@ -73,7 +74,7 @@ mtk_clk_register_cpumux(const struct mtk_composite *mux,
 	init.ops = &clk_cpumux_ops;
 	init.parent_names = mux->parent_names;
 	init.num_parents = mux->num_parents;
-	init.flags = mux->flags;
+	init.flags = mux->flags | CLK_SET_RATE_NO_REPARENT;
 
 	cpumux->reg = mux->mux_reg;
 	cpumux->shift = mux->mux_shift;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 26/65] clk: mediatek: cpumux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Mediatek cpumux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/mediatek/clk-cpumux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-cpumux.c b/drivers/clk/mediatek/clk-cpumux.c
index 25618eff6f2a..514807ae4903 100644
--- a/drivers/clk/mediatek/clk-cpumux.c
+++ b/drivers/clk/mediatek/clk-cpumux.c
@@ -53,6 +53,7 @@ static int clk_cpumux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_cpumux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_cpumux_get_parent,
 	.set_parent = clk_cpumux_set_parent,
 };
@@ -73,7 +74,7 @@ mtk_clk_register_cpumux(const struct mtk_composite *mux,
 	init.ops = &clk_cpumux_ops;
 	init.parent_names = mux->parent_names;
 	init.num_parents = mux->num_parents;
-	init.flags = mux->flags;
+	init.flags = mux->flags | CLK_SET_RATE_NO_REPARENT;
 
 	cpumux->reg = mux->mux_reg;
 	cpumux->shift = mux->mux_shift;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 26/65] clk: mediatek: cpumux: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Mediatek cpumux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/mediatek/clk-cpumux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-cpumux.c b/drivers/clk/mediatek/clk-cpumux.c
index 25618eff6f2a..514807ae4903 100644
--- a/drivers/clk/mediatek/clk-cpumux.c
+++ b/drivers/clk/mediatek/clk-cpumux.c
@@ -53,6 +53,7 @@ static int clk_cpumux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_cpumux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_cpumux_get_parent,
 	.set_parent = clk_cpumux_set_parent,
 };
@@ -73,7 +74,7 @@ mtk_clk_register_cpumux(const struct mtk_composite *mux,
 	init.ops = &clk_cpumux_ops;
 	init.parent_names = mux->parent_names;
 	init.num_parents = mux->num_parents;
-	init.flags = mux->flags;
+	init.flags = mux->flags | CLK_SET_RATE_NO_REPARENT;
 
 	cpumux->reg = mux->mux_reg;
 	cpumux->shift = mux->mux_shift;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 27/65] clk: pxa: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The PXA "CKEN" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the set_parent implementation is a nop though, it seems unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/pxa/clk-pxa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/pxa/clk-pxa.c b/drivers/clk/pxa/clk-pxa.c
index 374098ebbf2b..47bc60c2854c 100644
--- a/drivers/clk/pxa/clk-pxa.c
+++ b/drivers/clk/pxa/clk-pxa.c
@@ -82,6 +82,7 @@ static u8 cken_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cken_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = cken_get_parent,
 	.set_parent = dummy_clk_set_parent,
 };
@@ -117,7 +118,7 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks,
 					     &pxa_clk->hw, &cken_mux_ops,
 					     &pxa_clk->hw, &cken_rate_ops,
 					     &pxa_clk->gate.hw, &clk_gate_ops,
-					     clks[i].flags);
+					     clks[i].flags | CLK_SET_RATE_NO_REPARENT);
 		clkdev_pxa_register(clks[i].ckid, clks[i].con_id,
 				    clks[i].dev_id, clk);
 	}

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 27/65] clk: pxa: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The PXA "CKEN" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the set_parent implementation is a nop though, it seems unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/pxa/clk-pxa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/pxa/clk-pxa.c b/drivers/clk/pxa/clk-pxa.c
index 374098ebbf2b..47bc60c2854c 100644
--- a/drivers/clk/pxa/clk-pxa.c
+++ b/drivers/clk/pxa/clk-pxa.c
@@ -82,6 +82,7 @@ static u8 cken_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cken_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = cken_get_parent,
 	.set_parent = dummy_clk_set_parent,
 };
@@ -117,7 +118,7 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks,
 					     &pxa_clk->hw, &cken_mux_ops,
 					     &pxa_clk->hw, &cken_rate_ops,
 					     &pxa_clk->gate.hw, &clk_gate_ops,
-					     clks[i].flags);
+					     clks[i].flags | CLK_SET_RATE_NO_REPARENT);
 		clkdev_pxa_register(clks[i].ckid, clks[i].con_id,
 				    clks[i].dev_id, clk);
 	}

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 27/65] clk: pxa: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The PXA "CKEN" clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the set_parent implementation is a nop though, it seems unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/pxa/clk-pxa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/pxa/clk-pxa.c b/drivers/clk/pxa/clk-pxa.c
index 374098ebbf2b..47bc60c2854c 100644
--- a/drivers/clk/pxa/clk-pxa.c
+++ b/drivers/clk/pxa/clk-pxa.c
@@ -82,6 +82,7 @@ static u8 cken_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops cken_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = cken_get_parent,
 	.set_parent = dummy_clk_set_parent,
 };
@@ -117,7 +118,7 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks,
 					     &pxa_clk->hw, &cken_mux_ops,
 					     &pxa_clk->hw, &cken_rate_ops,
 					     &pxa_clk->gate.hw, &clk_gate_ops,
-					     clks[i].flags);
+					     clks[i].flags | CLK_SET_RATE_NO_REPARENT);
 		clkdev_pxa_register(clks[i].ckid, clks[i].con_id,
 				    clks[i].dev_id, clk);
 	}

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 28/65] clk: renesas: r9a06g032: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Renesas r9a06g032 bitselect clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/renesas/r9a06g032-clocks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
index 983faa5707b9..70c37097ca6e 100644
--- a/drivers/clk/renesas/r9a06g032-clocks.c
+++ b/drivers/clk/renesas/r9a06g032-clocks.c
@@ -773,6 +773,7 @@ static int r9a06g032_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_bitselect_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = r9a06g032_clk_mux_get_parent,
 	.set_parent = r9a06g032_clk_mux_set_parent,
 };
@@ -797,7 +798,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
 
 	init.name = desc->name;
 	init.ops = &clk_bitselect_ops;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = names;
 	init.num_parents = 2;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 28/65] clk: renesas: r9a06g032: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Renesas r9a06g032 bitselect clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/renesas/r9a06g032-clocks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
index 983faa5707b9..70c37097ca6e 100644
--- a/drivers/clk/renesas/r9a06g032-clocks.c
+++ b/drivers/clk/renesas/r9a06g032-clocks.c
@@ -773,6 +773,7 @@ static int r9a06g032_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_bitselect_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = r9a06g032_clk_mux_get_parent,
 	.set_parent = r9a06g032_clk_mux_set_parent,
 };
@@ -797,7 +798,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
 
 	init.name = desc->name;
 	init.ops = &clk_bitselect_ops;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = names;
 	init.num_parents = 2;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 28/65] clk: renesas: r9a06g032: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Renesas r9a06g032 bitselect clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/renesas/r9a06g032-clocks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
index 983faa5707b9..70c37097ca6e 100644
--- a/drivers/clk/renesas/r9a06g032-clocks.c
+++ b/drivers/clk/renesas/r9a06g032-clocks.c
@@ -773,6 +773,7 @@ static int r9a06g032_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_bitselect_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = r9a06g032_clk_mux_get_parent,
 	.set_parent = r9a06g032_clk_mux_set_parent,
 };
@@ -797,7 +798,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
 
 	init.name = desc->name;
 	init.ops = &clk_bitselect_ops;
-	init.flags = CLK_SET_RATE_PARENT;
+	init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = names;
 	init.num_parents = 2;
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 29/65] clk: socfpga: gate: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SoCFGPA gate clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/socfpga/clk-gate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
index 53d6e3ec4309..261fe2fac982 100644
--- a/drivers/clk/socfpga/clk-gate.c
+++ b/drivers/clk/socfpga/clk-gate.c
@@ -164,6 +164,7 @@ static int socfpga_clk_prepare(struct clk_hw *hwclk)
 static struct clk_ops gateclk_ops = {
 	.prepare = socfpga_clk_prepare,
 	.recalc_rate = socfpga_clk_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = socfpga_clk_get_parent,
 	.set_parent = socfpga_clk_set_parent,
 };
@@ -228,7 +229,7 @@ void __init socfpga_gate_init(struct device_node *node)
 
 	init.name = clk_name;
 	init.ops = ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS);
 	if (init.num_parents < 2) {

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 29/65] clk: socfpga: gate: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The SoCFGPA gate clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/socfpga/clk-gate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
index 53d6e3ec4309..261fe2fac982 100644
--- a/drivers/clk/socfpga/clk-gate.c
+++ b/drivers/clk/socfpga/clk-gate.c
@@ -164,6 +164,7 @@ static int socfpga_clk_prepare(struct clk_hw *hwclk)
 static struct clk_ops gateclk_ops = {
 	.prepare = socfpga_clk_prepare,
 	.recalc_rate = socfpga_clk_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = socfpga_clk_get_parent,
 	.set_parent = socfpga_clk_set_parent,
 };
@@ -228,7 +229,7 @@ void __init socfpga_gate_init(struct device_node *node)
 
 	init.name = clk_name;
 	init.ops = ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS);
 	if (init.num_parents < 2) {

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 29/65] clk: socfpga: gate: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SoCFGPA gate clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/socfpga/clk-gate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
index 53d6e3ec4309..261fe2fac982 100644
--- a/drivers/clk/socfpga/clk-gate.c
+++ b/drivers/clk/socfpga/clk-gate.c
@@ -164,6 +164,7 @@ static int socfpga_clk_prepare(struct clk_hw *hwclk)
 static struct clk_ops gateclk_ops = {
 	.prepare = socfpga_clk_prepare,
 	.recalc_rate = socfpga_clk_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = socfpga_clk_get_parent,
 	.set_parent = socfpga_clk_set_parent,
 };
@@ -228,7 +229,7 @@ void __init socfpga_gate_init(struct device_node *node)
 
 	init.name = clk_name;
 	init.ops = ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 
 	init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS);
 	if (init.num_parents < 2) {

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 30/65] clk: stm32: core: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The STM32 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/stm32/clk-stm32-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index 45a279e73779..3247539683c9 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -275,6 +275,7 @@ static int clk_stm32_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 const struct clk_ops clk_stm32_mux_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.get_parent	= clk_stm32_mux_get_parent,
 	.set_parent	= clk_stm32_mux_set_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 30/65] clk: stm32: core: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The STM32 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/stm32/clk-stm32-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index 45a279e73779..3247539683c9 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -275,6 +275,7 @@ static int clk_stm32_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 const struct clk_ops clk_stm32_mux_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.get_parent	= clk_stm32_mux_get_parent,
 	.set_parent	= clk_stm32_mux_set_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 30/65] clk: stm32: core: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The STM32 mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/stm32/clk-stm32-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index 45a279e73779..3247539683c9 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -275,6 +275,7 @@ static int clk_stm32_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 const struct clk_ops clk_stm32_mux_ops = {
+	.determine_rate	= __clk_mux_determine_rate,
 	.get_parent	= clk_stm32_mux_get_parent,
 	.set_parent	= clk_stm32_mux_set_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 31/65] clk: tegra: bpmp: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra BPMP mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-bpmp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
index d82a71f10c2c..6aea1cefbb80 100644
--- a/drivers/clk/tegra/clk-bpmp.c
+++ b/drivers/clk/tegra/clk-bpmp.c
@@ -286,6 +286,7 @@ static const struct clk_ops tegra_bpmp_clk_mux_ops = {
 	.unprepare = tegra_bpmp_clk_unprepare,
 	.is_prepared = tegra_bpmp_clk_is_prepared,
 	.recalc_rate = tegra_bpmp_clk_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = tegra_bpmp_clk_set_parent,
 	.get_parent = tegra_bpmp_clk_get_parent,
 };
@@ -512,10 +513,12 @@ tegra_bpmp_clk_register(struct tegra_bpmp *bpmp,
 	clk->hw.init = &init;
 
 	if (info->flags & TEGRA_BPMP_CLK_HAS_MUX) {
-		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE)
+		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE) {
 			init.ops = &tegra_bpmp_clk_mux_rate_ops;
-		else
+		} else {
 			init.ops = &tegra_bpmp_clk_mux_ops;
+			init.flags |= CLK_SET_RATE_NO_REPARENT;
+		}
 	} else {
 		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE)
 			init.ops = &tegra_bpmp_clk_rate_ops;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 31/65] clk: tegra: bpmp: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Tegra BPMP mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-bpmp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
index d82a71f10c2c..6aea1cefbb80 100644
--- a/drivers/clk/tegra/clk-bpmp.c
+++ b/drivers/clk/tegra/clk-bpmp.c
@@ -286,6 +286,7 @@ static const struct clk_ops tegra_bpmp_clk_mux_ops = {
 	.unprepare = tegra_bpmp_clk_unprepare,
 	.is_prepared = tegra_bpmp_clk_is_prepared,
 	.recalc_rate = tegra_bpmp_clk_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = tegra_bpmp_clk_set_parent,
 	.get_parent = tegra_bpmp_clk_get_parent,
 };
@@ -512,10 +513,12 @@ tegra_bpmp_clk_register(struct tegra_bpmp *bpmp,
 	clk->hw.init = &init;
 
 	if (info->flags & TEGRA_BPMP_CLK_HAS_MUX) {
-		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE)
+		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE) {
 			init.ops = &tegra_bpmp_clk_mux_rate_ops;
-		else
+		} else {
 			init.ops = &tegra_bpmp_clk_mux_ops;
+			init.flags |= CLK_SET_RATE_NO_REPARENT;
+		}
 	} else {
 		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE)
 			init.ops = &tegra_bpmp_clk_rate_ops;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 31/65] clk: tegra: bpmp: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra BPMP mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-bpmp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
index d82a71f10c2c..6aea1cefbb80 100644
--- a/drivers/clk/tegra/clk-bpmp.c
+++ b/drivers/clk/tegra/clk-bpmp.c
@@ -286,6 +286,7 @@ static const struct clk_ops tegra_bpmp_clk_mux_ops = {
 	.unprepare = tegra_bpmp_clk_unprepare,
 	.is_prepared = tegra_bpmp_clk_is_prepared,
 	.recalc_rate = tegra_bpmp_clk_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = tegra_bpmp_clk_set_parent,
 	.get_parent = tegra_bpmp_clk_get_parent,
 };
@@ -512,10 +513,12 @@ tegra_bpmp_clk_register(struct tegra_bpmp *bpmp,
 	clk->hw.init = &init;
 
 	if (info->flags & TEGRA_BPMP_CLK_HAS_MUX) {
-		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE)
+		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE) {
 			init.ops = &tegra_bpmp_clk_mux_rate_ops;
-		else
+		} else {
 			init.ops = &tegra_bpmp_clk_mux_ops;
+			init.flags |= CLK_SET_RATE_NO_REPARENT;
+		}
 	} else {
 		if (info->flags & TEGRA_BPMP_CLK_HAS_SET_RATE)
 			init.ops = &tegra_bpmp_clk_rate_ops;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 32/65] clk: tegra: super: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra super mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
index a98a420398fa..8ad62e04fd8b 100644
--- a/drivers/clk/tegra/clk-super.c
+++ b/drivers/clk/tegra/clk-super.c
@@ -136,6 +136,7 @@ static void clk_super_mux_restore_context(struct clk_hw *hw)
 }
 
 static const struct clk_ops tegra_clk_super_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_super_get_parent,
 	.set_parent = clk_super_set_parent,
 	.restore_context = clk_super_mux_restore_context,
@@ -212,7 +213,7 @@ struct clk *tegra_clk_register_super_mux(const char *name,
 
 	init.name = name;
 	init.ops = &tegra_clk_super_mux_ops;
-	init.flags = flags;
+	init.flags = flags | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 32/65] clk: tegra: super: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Tegra super mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
index a98a420398fa..8ad62e04fd8b 100644
--- a/drivers/clk/tegra/clk-super.c
+++ b/drivers/clk/tegra/clk-super.c
@@ -136,6 +136,7 @@ static void clk_super_mux_restore_context(struct clk_hw *hw)
 }
 
 static const struct clk_ops tegra_clk_super_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_super_get_parent,
 	.set_parent = clk_super_set_parent,
 	.restore_context = clk_super_mux_restore_context,
@@ -212,7 +213,7 @@ struct clk *tegra_clk_register_super_mux(const char *name,
 
 	init.name = name;
 	init.ops = &tegra_clk_super_mux_ops;
-	init.flags = flags;
+	init.flags = flags | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 32/65] clk: tegra: super: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra super mux clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
index a98a420398fa..8ad62e04fd8b 100644
--- a/drivers/clk/tegra/clk-super.c
+++ b/drivers/clk/tegra/clk-super.c
@@ -136,6 +136,7 @@ static void clk_super_mux_restore_context(struct clk_hw *hw)
 }
 
 static const struct clk_ops tegra_clk_super_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_super_get_parent,
 	.set_parent = clk_super_set_parent,
 	.restore_context = clk_super_mux_restore_context,
@@ -212,7 +213,7 @@ struct clk *tegra_clk_register_super_mux(const char *name,
 
 	init.name = name;
 	init.ops = &tegra_clk_super_mux_ops;
-	init.flags = flags;
+	init.flags = flags | CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 33/65] clk: tegra: periph: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra periph nodiv clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-periph.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index 79ca3aa072b7..367396c62259 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -140,6 +140,7 @@ const struct clk_ops tegra_clk_periph_ops = {
 };
 
 static const struct clk_ops tegra_clk_periph_nodiv_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.is_enabled = clk_periph_is_enabled,
@@ -170,7 +171,7 @@ static struct clk *_tegra_clk_register_periph(const char *name,
 	bool div = !(periph->gate.flags & TEGRA_PERIPH_NO_DIV);
 
 	if (periph->gate.flags & TEGRA_PERIPH_NO_DIV) {
-		flags |= CLK_SET_RATE_PARENT;
+		flags |= CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 		init.ops = &tegra_clk_periph_nodiv_ops;
 	} else if (periph->gate.flags & TEGRA_PERIPH_NO_GATE)
 		init.ops = &tegra_clk_periph_no_gate_ops;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 33/65] clk: tegra: periph: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra periph nodiv clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-periph.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index 79ca3aa072b7..367396c62259 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -140,6 +140,7 @@ const struct clk_ops tegra_clk_periph_ops = {
 };
 
 static const struct clk_ops tegra_clk_periph_nodiv_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.is_enabled = clk_periph_is_enabled,
@@ -170,7 +171,7 @@ static struct clk *_tegra_clk_register_periph(const char *name,
 	bool div = !(periph->gate.flags & TEGRA_PERIPH_NO_DIV);
 
 	if (periph->gate.flags & TEGRA_PERIPH_NO_DIV) {
-		flags |= CLK_SET_RATE_PARENT;
+		flags |= CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 		init.ops = &tegra_clk_periph_nodiv_ops;
 	} else if (periph->gate.flags & TEGRA_PERIPH_NO_GATE)
 		init.ops = &tegra_clk_periph_no_gate_ops;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 33/65] clk: tegra: periph: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Tegra periph nodiv clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-periph.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index 79ca3aa072b7..367396c62259 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -140,6 +140,7 @@ const struct clk_ops tegra_clk_periph_ops = {
 };
 
 static const struct clk_ops tegra_clk_periph_nodiv_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.is_enabled = clk_periph_is_enabled,
@@ -170,7 +171,7 @@ static struct clk *_tegra_clk_register_periph(const char *name,
 	bool div = !(periph->gate.flags & TEGRA_PERIPH_NO_DIV);
 
 	if (periph->gate.flags & TEGRA_PERIPH_NO_DIV) {
-		flags |= CLK_SET_RATE_PARENT;
+		flags |= CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
 		init.ops = &tegra_clk_periph_nodiv_ops;
 	} else if (periph->gate.flags & TEGRA_PERIPH_NO_GATE)
 		init.ops = &tegra_clk_periph_no_gate_ops;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ux500/clk-prcmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c
index 4deb37f19a7c..7118991f3731 100644
--- a/drivers/clk/ux500/clk-prcmu.c
+++ b/drivers/clk/ux500/clk-prcmu.c
@@ -344,6 +344,7 @@ static const struct clk_ops clk_prcmu_clkout_ops = {
 	.prepare = clk_prcmu_clkout_prepare,
 	.unprepare = clk_prcmu_clkout_unprepare,
 	.recalc_rate = clk_prcmu_clkout_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_prcmu_clkout_get_parent,
 	.set_parent = clk_prcmu_clkout_set_parent,
 };
@@ -383,7 +384,7 @@ struct clk_hw *clk_reg_prcmu_clkout(const char *name,
 
 	clk_prcmu_clkout_init.name = name;
 	clk_prcmu_clkout_init.ops = &clk_prcmu_clkout_ops;
-	clk_prcmu_clkout_init.flags = CLK_GET_RATE_NOCACHE;
+	clk_prcmu_clkout_init.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT;
 	clk_prcmu_clkout_init.parent_names = parent_names;
 	clk_prcmu_clkout_init.num_parents = num_parents;
 	clk->hw.init = &clk_prcmu_clkout_init;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ux500/clk-prcmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c
index 4deb37f19a7c..7118991f3731 100644
--- a/drivers/clk/ux500/clk-prcmu.c
+++ b/drivers/clk/ux500/clk-prcmu.c
@@ -344,6 +344,7 @@ static const struct clk_ops clk_prcmu_clkout_ops = {
 	.prepare = clk_prcmu_clkout_prepare,
 	.unprepare = clk_prcmu_clkout_unprepare,
 	.recalc_rate = clk_prcmu_clkout_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_prcmu_clkout_get_parent,
 	.set_parent = clk_prcmu_clkout_set_parent,
 };
@@ -383,7 +384,7 @@ struct clk_hw *clk_reg_prcmu_clkout(const char *name,
 
 	clk_prcmu_clkout_init.name = name;
 	clk_prcmu_clkout_init.ops = &clk_prcmu_clkout_ops;
-	clk_prcmu_clkout_init.flags = CLK_GET_RATE_NOCACHE;
+	clk_prcmu_clkout_init.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT;
 	clk_prcmu_clkout_init.parent_names = parent_names;
 	clk_prcmu_clkout_init.num_parents = num_parents;
 	clk->hw.init = &clk_prcmu_clkout_init;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ux500/clk-prcmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c
index 4deb37f19a7c..7118991f3731 100644
--- a/drivers/clk/ux500/clk-prcmu.c
+++ b/drivers/clk/ux500/clk-prcmu.c
@@ -344,6 +344,7 @@ static const struct clk_ops clk_prcmu_clkout_ops = {
 	.prepare = clk_prcmu_clkout_prepare,
 	.unprepare = clk_prcmu_clkout_unprepare,
 	.recalc_rate = clk_prcmu_clkout_recalc_rate,
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_prcmu_clkout_get_parent,
 	.set_parent = clk_prcmu_clkout_set_parent,
 };
@@ -383,7 +384,7 @@ struct clk_hw *clk_reg_prcmu_clkout(const char *name,
 
 	clk_prcmu_clkout_init.name = name;
 	clk_prcmu_clkout_init.ops = &clk_prcmu_clkout_ops;
-	clk_prcmu_clkout_init.flags = CLK_GET_RATE_NOCACHE;
+	clk_prcmu_clkout_init.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT;
 	clk_prcmu_clkout_init.parent_names = parent_names;
 	clk_prcmu_clkout_init.num_parents = num_parents;
 	clk->hw.init = &clk_prcmu_clkout_init;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ux500/clk-sysctrl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
index 702f2f8b43fa..d36336665b6d 100644
--- a/drivers/clk/ux500/clk-sysctrl.c
+++ b/drivers/clk/ux500/clk-sysctrl.c
@@ -110,6 +110,7 @@ static const struct clk_ops clk_sysctrl_gate_fixed_rate_ops = {
 };
 
 static const struct clk_ops clk_sysctrl_set_parent_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sysctrl_set_parent,
 	.get_parent = clk_sysctrl_get_parent,
 };
@@ -220,6 +221,7 @@ struct clk *clk_reg_sysctrl_set_parent(struct device *dev,
 				unsigned long flags)
 {
 	return clk_reg_sysctrl(dev, name, parent_names, num_parents,
-			reg_sel, reg_mask, reg_bits, 0, 0, flags,
+			reg_sel, reg_mask, reg_bits, 0, 0,
+			flags | CLK_SET_RATE_NO_REPARENT,
 			&clk_sysctrl_set_parent_ops);
 }

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ux500/clk-sysctrl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
index 702f2f8b43fa..d36336665b6d 100644
--- a/drivers/clk/ux500/clk-sysctrl.c
+++ b/drivers/clk/ux500/clk-sysctrl.c
@@ -110,6 +110,7 @@ static const struct clk_ops clk_sysctrl_gate_fixed_rate_ops = {
 };
 
 static const struct clk_ops clk_sysctrl_set_parent_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sysctrl_set_parent,
 	.get_parent = clk_sysctrl_get_parent,
 };
@@ -220,6 +221,7 @@ struct clk *clk_reg_sysctrl_set_parent(struct device *dev,
 				unsigned long flags)
 {
 	return clk_reg_sysctrl(dev, name, parent_names, num_parents,
-			reg_sel, reg_mask, reg_bits, 0, 0, flags,
+			reg_sel, reg_mask, reg_bits, 0, 0,
+			flags | CLK_SET_RATE_NO_REPARENT,
 			&clk_sysctrl_set_parent_ops);
 }

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ux500/clk-sysctrl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
index 702f2f8b43fa..d36336665b6d 100644
--- a/drivers/clk/ux500/clk-sysctrl.c
+++ b/drivers/clk/ux500/clk-sysctrl.c
@@ -110,6 +110,7 @@ static const struct clk_ops clk_sysctrl_gate_fixed_rate_ops = {
 };
 
 static const struct clk_ops clk_sysctrl_set_parent_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_sysctrl_set_parent,
 	.get_parent = clk_sysctrl_get_parent,
 };
@@ -220,6 +221,7 @@ struct clk *clk_reg_sysctrl_set_parent(struct device *dev,
 				unsigned long flags)
 {
 	return clk_reg_sysctrl(dev, name, parent_names, num_parents,
-			reg_sel, reg_mask, reg_bits, 0, 0, flags,
+			reg_sel, reg_mask, reg_bits, 0, 0,
+			flags | CLK_SET_RATE_NO_REPARENT,
 			&clk_sysctrl_set_parent_ops);
 }

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 36/65] clk: versatile: sp810: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Versatile sp810 "timerclken" clock implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/versatile/clk-sp810.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index caf0cd2fb5b6..a45b1b7b7d49 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -63,6 +63,7 @@ static int clk_sp810_timerclken_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_sp810_timerclken_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_sp810_timerclken_get_parent,
 	.set_parent = clk_sp810_timerclken_set_parent,
 };
@@ -105,7 +106,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
 
 	init.name = name;
 	init.ops = &clk_sp810_timerclken_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 36/65] clk: versatile: sp810: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Versatile sp810 "timerclken" clock implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/versatile/clk-sp810.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index caf0cd2fb5b6..a45b1b7b7d49 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -63,6 +63,7 @@ static int clk_sp810_timerclken_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_sp810_timerclken_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_sp810_timerclken_get_parent,
 	.set_parent = clk_sp810_timerclken_set_parent,
 };
@@ -105,7 +106,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
 
 	init.name = name;
 	init.ops = &clk_sp810_timerclken_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num;
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 36/65] clk: versatile: sp810: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Versatile sp810 "timerclken" clock implements a mux with a
set_parent hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/versatile/clk-sp810.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index caf0cd2fb5b6..a45b1b7b7d49 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -63,6 +63,7 @@ static int clk_sp810_timerclken_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops clk_sp810_timerclken_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.get_parent = clk_sp810_timerclken_get_parent,
 	.set_parent = clk_sp810_timerclken_set_parent,
 };
@@ -105,7 +106,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
 
 	init.name = name;
 	init.ops = &clk_sp810_timerclken_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = parent_names;
 	init.num_parents = num;
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 37/65] drm/tegra: sor: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra sor pad clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/tegra/sor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 8af632740673..92084a9a67c5 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -586,6 +586,7 @@ static u8 tegra_clk_sor_pad_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops tegra_clk_sor_pad_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = tegra_clk_sor_pad_set_parent,
 	.get_parent = tegra_clk_sor_pad_get_parent,
 };
@@ -604,7 +605,7 @@ static struct clk *tegra_clk_sor_pad_register(struct tegra_sor *sor,
 	pad->sor = sor;
 
 	init.name = name;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = tegra_clk_sor_pad_parents[sor->index];
 	init.num_parents = ARRAY_SIZE(tegra_clk_sor_pad_parents[sor->index]);
 	init.ops = &tegra_clk_sor_pad_ops;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 37/65] drm/tegra: sor: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Tegra sor pad clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/tegra/sor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 8af632740673..92084a9a67c5 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -586,6 +586,7 @@ static u8 tegra_clk_sor_pad_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops tegra_clk_sor_pad_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = tegra_clk_sor_pad_set_parent,
 	.get_parent = tegra_clk_sor_pad_get_parent,
 };
@@ -604,7 +605,7 @@ static struct clk *tegra_clk_sor_pad_register(struct tegra_sor *sor,
 	pad->sor = sor;
 
 	init.name = name;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = tegra_clk_sor_pad_parents[sor->index];
 	init.num_parents = ARRAY_SIZE(tegra_clk_sor_pad_parents[sor->index]);
 	init.ops = &tegra_clk_sor_pad_ops;

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 37/65] drm/tegra: sor: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra sor pad clock implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/tegra/sor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 8af632740673..92084a9a67c5 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -586,6 +586,7 @@ static u8 tegra_clk_sor_pad_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops tegra_clk_sor_pad_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = tegra_clk_sor_pad_set_parent,
 	.get_parent = tegra_clk_sor_pad_get_parent,
 };
@@ -604,7 +605,7 @@ static struct clk *tegra_clk_sor_pad_register(struct tegra_sor *sor,
 	pad->sor = sor;
 
 	init.name = name;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_NO_REPARENT;
 	init.parent_names = tegra_clk_sor_pad_parents[sor->index];
 	init.num_parents = ARRAY_SIZE(tegra_clk_sor_pad_parents[sor->index]);
 	init.ops = &tegra_clk_sor_pad_ops;

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 38/65] phy: cadence: sierra: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Cadence Sierra PLL clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/cadence/phy-cadence-sierra.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c
index 6e86a6517f37..403f8eba9fe5 100644
--- a/drivers/phy/cadence/phy-cadence-sierra.c
+++ b/drivers/phy/cadence/phy-cadence-sierra.c
@@ -709,6 +709,7 @@ static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops cdns_sierra_pll_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdns_sierra_pll_mux_set_parent,
 	.get_parent = cdns_sierra_pll_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 38/65] phy: cadence: sierra: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Cadence Sierra PLL clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/cadence/phy-cadence-sierra.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c
index 6e86a6517f37..403f8eba9fe5 100644
--- a/drivers/phy/cadence/phy-cadence-sierra.c
+++ b/drivers/phy/cadence/phy-cadence-sierra.c
@@ -709,6 +709,7 @@ static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops cdns_sierra_pll_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdns_sierra_pll_mux_set_parent,
 	.get_parent = cdns_sierra_pll_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 38/65] phy: cadence: sierra: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Cadence Sierra PLL clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/cadence/phy-cadence-sierra.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c
index 6e86a6517f37..403f8eba9fe5 100644
--- a/drivers/phy/cadence/phy-cadence-sierra.c
+++ b/drivers/phy/cadence/phy-cadence-sierra.c
@@ -709,6 +709,7 @@ static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops cdns_sierra_pll_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdns_sierra_pll_mux_set_parent,
 	.get_parent = cdns_sierra_pll_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 39/65] phy: cadence: torrent: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Cadence Torrent refclk clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/cadence/phy-cadence-torrent.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index f099053c583c..be65b05ec41d 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -1861,6 +1861,7 @@ static const struct clk_ops cdns_torrent_refclk_driver_ops = {
 	.enable = cdns_torrent_refclk_driver_enable,
 	.disable = cdns_torrent_refclk_driver_disable,
 	.is_enabled = cdns_torrent_refclk_driver_is_enabled,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdns_torrent_refclk_driver_set_parent,
 	.get_parent = cdns_torrent_refclk_driver_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 39/65] phy: cadence: torrent: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Cadence Torrent refclk clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/cadence/phy-cadence-torrent.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index f099053c583c..be65b05ec41d 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -1861,6 +1861,7 @@ static const struct clk_ops cdns_torrent_refclk_driver_ops = {
 	.enable = cdns_torrent_refclk_driver_enable,
 	.disable = cdns_torrent_refclk_driver_disable,
 	.is_enabled = cdns_torrent_refclk_driver_is_enabled,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdns_torrent_refclk_driver_set_parent,
 	.get_parent = cdns_torrent_refclk_driver_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 39/65] phy: cadence: torrent: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Cadence Torrent refclk clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/cadence/phy-cadence-torrent.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index f099053c583c..be65b05ec41d 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -1861,6 +1861,7 @@ static const struct clk_ops cdns_torrent_refclk_driver_ops = {
 	.enable = cdns_torrent_refclk_driver_enable,
 	.disable = cdns_torrent_refclk_driver_disable,
 	.is_enabled = cdns_torrent_refclk_driver_is_enabled,
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = cdns_torrent_refclk_driver_set_parent,
 	.get_parent = cdns_torrent_refclk_driver_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 40/65] phy: ti: am654-serdes: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The TI AM654 SerDes clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/ti/phy-am654-serdes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c
index 0be727bb9f79..f2061ce4e62d 100644
--- a/drivers/phy/ti/phy-am654-serdes.c
+++ b/drivers/phy/ti/phy-am654-serdes.c
@@ -634,6 +634,7 @@ static int serdes_am654_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops serdes_am654_clk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = serdes_am654_clk_mux_set_parent,
 	.get_parent = serdes_am654_clk_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 40/65] phy: ti: am654-serdes: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The TI AM654 SerDes clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/ti/phy-am654-serdes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c
index 0be727bb9f79..f2061ce4e62d 100644
--- a/drivers/phy/ti/phy-am654-serdes.c
+++ b/drivers/phy/ti/phy-am654-serdes.c
@@ -634,6 +634,7 @@ static int serdes_am654_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops serdes_am654_clk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = serdes_am654_clk_mux_set_parent,
 	.get_parent = serdes_am654_clk_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 40/65] phy: ti: am654-serdes: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The TI AM654 SerDes clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/ti/phy-am654-serdes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c
index 0be727bb9f79..f2061ce4e62d 100644
--- a/drivers/phy/ti/phy-am654-serdes.c
+++ b/drivers/phy/ti/phy-am654-serdes.c
@@ -634,6 +634,7 @@ static int serdes_am654_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops serdes_am654_clk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = serdes_am654_clk_mux_set_parent,
 	.get_parent = serdes_am654_clk_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 41/65] phy: ti: j721e-wiz: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The TI J721e Wiz clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/ti/phy-j721e-wiz.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 141b51af4427..bd0691e5de47 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -781,6 +781,7 @@ static int wiz_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops wiz_clk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = wiz_clk_mux_set_parent,
 	.get_parent = wiz_clk_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 41/65] phy: ti: j721e-wiz: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The TI J721e Wiz clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/ti/phy-j721e-wiz.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 141b51af4427..bd0691e5de47 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -781,6 +781,7 @@ static int wiz_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops wiz_clk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = wiz_clk_mux_set_parent,
 	.get_parent = wiz_clk_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 41/65] phy: ti: j721e-wiz: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The TI J721e Wiz clock implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
unlikely.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/phy/ti/phy-j721e-wiz.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 141b51af4427..bd0691e5de47 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -781,6 +781,7 @@ static int wiz_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 }
 
 static const struct clk_ops wiz_clk_mux_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = wiz_clk_mux_set_parent,
 	.get_parent = wiz_clk_mux_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 42/65] rtc: sun6i: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:17   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Allwinner sun6i RTC clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/rtc/rtc-sun6i.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index ed5516089e9a..a2781502c244 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -215,6 +215,7 @@ static int sun6i_rtc_osc_set_parent(struct clk_hw *hw, u8 index)
 
 static const struct clk_ops sun6i_rtc_osc_ops = {
 	.recalc_rate	= sun6i_rtc_osc_recalc_rate,
+	.determine_rate	= __clk_mux_determine_rate,
 
 	.get_parent	= sun6i_rtc_osc_get_parent,
 	.set_parent	= sun6i_rtc_osc_set_parent,
@@ -228,6 +229,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node,
 	struct clk_init_data init = {
 		.ops		= &sun6i_rtc_osc_ops,
 		.name		= "losc",
+		.flags		= CLK_SET_RATE_NO_REPARENT,
 	};
 	const char *iosc_name = "rtc-int-osc";
 	const char *clkout_name = "osc32k-out";

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 42/65] rtc: sun6i: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Allwinner sun6i RTC clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/rtc/rtc-sun6i.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index ed5516089e9a..a2781502c244 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -215,6 +215,7 @@ static int sun6i_rtc_osc_set_parent(struct clk_hw *hw, u8 index)
 
 static const struct clk_ops sun6i_rtc_osc_ops = {
 	.recalc_rate	= sun6i_rtc_osc_recalc_rate,
+	.determine_rate	= __clk_mux_determine_rate,
 
 	.get_parent	= sun6i_rtc_osc_get_parent,
 	.set_parent	= sun6i_rtc_osc_set_parent,
@@ -228,6 +229,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node,
 	struct clk_init_data init = {
 		.ops		= &sun6i_rtc_osc_ops,
 		.name		= "losc",
+		.flags		= CLK_SET_RATE_NO_REPARENT,
 	};
 	const char *iosc_name = "rtc-int-osc";
 	const char *clkout_name = "osc32k-out";

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 42/65] rtc: sun6i: Add a determine_rate hook
@ 2022-11-04 13:17   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:17 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Allwinner sun6i RTC clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/rtc/rtc-sun6i.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index ed5516089e9a..a2781502c244 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -215,6 +215,7 @@ static int sun6i_rtc_osc_set_parent(struct clk_hw *hw, u8 index)
 
 static const struct clk_ops sun6i_rtc_osc_ops = {
 	.recalc_rate	= sun6i_rtc_osc_recalc_rate,
+	.determine_rate	= __clk_mux_determine_rate,
 
 	.get_parent	= sun6i_rtc_osc_get_parent,
 	.set_parent	= sun6i_rtc_osc_set_parent,
@@ -228,6 +229,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node,
 	struct clk_init_data init = {
 		.ops		= &sun6i_rtc_osc_ops,
 		.name		= "losc",
+		.flags		= CLK_SET_RATE_NO_REPARENT,
 	};
 	const char *iosc_name = "rtc-int-osc";
 	const char *clkout_name = "osc32k-out";

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The tlv320aic32x4 clkin clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index 2f78e6820c75..65b72373cb95 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -41,6 +41,7 @@ struct aic32x4_clkdesc {
 	const char * const *parent_names;
 	unsigned int num_parents;
 	const struct clk_ops *ops;
+	unsigned long flags;
 	unsigned int reg;
 };
 
@@ -292,6 +293,7 @@ static u8 clk_aic32x4_codec_clkin_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops aic32x4_codec_clkin_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_aic32x4_codec_clkin_set_parent,
 	.get_parent = clk_aic32x4_codec_clkin_get_parent,
 };
@@ -401,6 +403,7 @@ static struct aic32x4_clkdesc aic32x4_clkdesc_array[] = {
 			(const char *[]) { "mclk", "bclk", "gpio", "pll" },
 		.num_parents = 4,
 		.ops = &aic32x4_codec_clkin_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 		.reg = 0,
 	},
 	{
@@ -452,7 +455,7 @@ static struct clk *aic32x4_register_clk(struct device *dev,
 	init.name = desc->name;
 	init.parent_names = desc->parent_names;
 	init.num_parents = desc->num_parents;
-	init.flags = 0;
+	init.flags = desc->flags;
 
 	priv = devm_kzalloc(dev, sizeof(struct clk_aic32x4), GFP_KERNEL);
 	if (priv == NULL)

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The tlv320aic32x4 clkin clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index 2f78e6820c75..65b72373cb95 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -41,6 +41,7 @@ struct aic32x4_clkdesc {
 	const char * const *parent_names;
 	unsigned int num_parents;
 	const struct clk_ops *ops;
+	unsigned long flags;
 	unsigned int reg;
 };
 
@@ -292,6 +293,7 @@ static u8 clk_aic32x4_codec_clkin_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops aic32x4_codec_clkin_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_aic32x4_codec_clkin_set_parent,
 	.get_parent = clk_aic32x4_codec_clkin_get_parent,
 };
@@ -401,6 +403,7 @@ static struct aic32x4_clkdesc aic32x4_clkdesc_array[] = {
 			(const char *[]) { "mclk", "bclk", "gpio", "pll" },
 		.num_parents = 4,
 		.ops = &aic32x4_codec_clkin_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 		.reg = 0,
 	},
 	{
@@ -452,7 +455,7 @@ static struct clk *aic32x4_register_clk(struct device *dev,
 	init.name = desc->name;
 	init.parent_names = desc->parent_names;
 	init.num_parents = desc->num_parents;
-	init.flags = 0;
+	init.flags = desc->flags;
 
 	priv = devm_kzalloc(dev, sizeof(struct clk_aic32x4), GFP_KERNEL);
 	if (priv == NULL)

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The tlv320aic32x4 clkin clock implements a mux with a set_parent hook,
but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The latter case would be equivalent to setting the flag
CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
to __clk_mux_determine_rate(). Indeed, if no determine_rate
implementation is provided, clk_round_rate() (through
clk_core_round_rate_nolock()) will call itself on the parent if
CLK_SET_RATE_PARENT is set, and will not change the clock rate
otherwise. __clk_mux_determine_rate() has the exact same behavior when
CLK_SET_RATE_NO_REPARENT is set.

And if it was an oversight, then we are at least explicit about our
behavior now and it can be further refined down the line.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index 2f78e6820c75..65b72373cb95 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -41,6 +41,7 @@ struct aic32x4_clkdesc {
 	const char * const *parent_names;
 	unsigned int num_parents;
 	const struct clk_ops *ops;
+	unsigned long flags;
 	unsigned int reg;
 };
 
@@ -292,6 +293,7 @@ static u8 clk_aic32x4_codec_clkin_get_parent(struct clk_hw *hw)
 }
 
 static const struct clk_ops aic32x4_codec_clkin_ops = {
+	.determine_rate = __clk_mux_determine_rate,
 	.set_parent = clk_aic32x4_codec_clkin_set_parent,
 	.get_parent = clk_aic32x4_codec_clkin_get_parent,
 };
@@ -401,6 +403,7 @@ static struct aic32x4_clkdesc aic32x4_clkdesc_array[] = {
 			(const char *[]) { "mclk", "bclk", "gpio", "pll" },
 		.num_parents = 4,
 		.ops = &aic32x4_codec_clkin_ops,
+		.flags = CLK_SET_RATE_NO_REPARENT,
 		.reg = 0,
 	},
 	{
@@ -452,7 +455,7 @@ static struct clk *aic32x4_register_clk(struct device *dev,
 	init.name = desc->name;
 	init.parent_names = desc->parent_names;
 	init.num_parents = desc->num_parents;
-	init.flags = 0;
+	init.flags = desc->flags;
 
 	priv = devm_kzalloc(dev, sizeof(struct clk_aic32x4), GFP_KERNEL);
 	if (priv == NULL)

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 44/65] clk: actions: composite: div: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Actions composite divider clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index 4c844a5613e4..d66b268563d0 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -53,13 +53,19 @@ static int owl_comp_is_enabled(struct clk_hw *hw)
 	return owl_gate_clk_is_enabled(common, &comp->gate_hw);
 }
 
-static long owl_comp_div_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int owl_comp_div_determine_rate(struct clk_hw *hw,
+				       struct clk_rate_request *req)
 {
 	struct owl_composite *comp = hw_to_owl_comp(hw);
+	long rate;
 
-	return owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
-					rate, parent_rate);
+	rate = owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
+					     req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw,
@@ -152,7 +158,7 @@ const struct clk_ops owl_comp_div_ops = {
 	.is_enabled	= owl_comp_is_enabled,
 
 	/* div_ops */
-	.round_rate	= owl_comp_div_round_rate,
+	.determine_rate	= owl_comp_div_determine_rate,
 	.recalc_rate	= owl_comp_div_recalc_rate,
 	.set_rate	= owl_comp_div_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 44/65] clk: actions: composite: div: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Actions composite divider clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index 4c844a5613e4..d66b268563d0 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -53,13 +53,19 @@ static int owl_comp_is_enabled(struct clk_hw *hw)
 	return owl_gate_clk_is_enabled(common, &comp->gate_hw);
 }
 
-static long owl_comp_div_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int owl_comp_div_determine_rate(struct clk_hw *hw,
+				       struct clk_rate_request *req)
 {
 	struct owl_composite *comp = hw_to_owl_comp(hw);
+	long rate;
 
-	return owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
-					rate, parent_rate);
+	rate = owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
+					     req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw,
@@ -152,7 +158,7 @@ const struct clk_ops owl_comp_div_ops = {
 	.is_enabled	= owl_comp_is_enabled,
 
 	/* div_ops */
-	.round_rate	= owl_comp_div_round_rate,
+	.determine_rate	= owl_comp_div_determine_rate,
 	.recalc_rate	= owl_comp_div_recalc_rate,
 	.set_rate	= owl_comp_div_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 44/65] clk: actions: composite: div: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Actions composite divider clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index 4c844a5613e4..d66b268563d0 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -53,13 +53,19 @@ static int owl_comp_is_enabled(struct clk_hw *hw)
 	return owl_gate_clk_is_enabled(common, &comp->gate_hw);
 }
 
-static long owl_comp_div_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int owl_comp_div_determine_rate(struct clk_hw *hw,
+				       struct clk_rate_request *req)
 {
 	struct owl_composite *comp = hw_to_owl_comp(hw);
+	long rate;
 
-	return owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
-					rate, parent_rate);
+	rate = owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw,
+					     req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw,
@@ -152,7 +158,7 @@ const struct clk_ops owl_comp_div_ops = {
 	.is_enabled	= owl_comp_is_enabled,
 
 	/* div_ops */
-	.round_rate	= owl_comp_div_round_rate,
+	.determine_rate	= owl_comp_div_determine_rate,
 	.recalc_rate	= owl_comp_div_recalc_rate,
 	.set_rate	= owl_comp_div_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 45/65] clk: actions: composite: fact: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Actions composite factor clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index d66b268563d0..3cac8f0a80dc 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -86,14 +86,20 @@ static int owl_comp_div_set_rate(struct clk_hw *hw, unsigned long rate,
 					rate, parent_rate);
 }
 
-static long owl_comp_fact_round_rate(struct clk_hw *hw, unsigned long rate,
-			unsigned long *parent_rate)
+static int owl_comp_fact_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct owl_composite *comp = hw_to_owl_comp(hw);
+	long rate;
 
-	return owl_factor_helper_round_rate(&comp->common,
-					&comp->rate.factor_hw,
-					rate, parent_rate);
+	rate = owl_factor_helper_round_rate(&comp->common,
+					    &comp->rate.factor_hw,
+					    req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long owl_comp_fact_recalc_rate(struct clk_hw *hw,
@@ -175,7 +181,7 @@ const struct clk_ops owl_comp_fact_ops = {
 	.is_enabled	= owl_comp_is_enabled,
 
 	/* fact_ops */
-	.round_rate	= owl_comp_fact_round_rate,
+	.determine_rate	= owl_comp_fact_determine_rate,
 	.recalc_rate	= owl_comp_fact_recalc_rate,
 	.set_rate	= owl_comp_fact_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 45/65] clk: actions: composite: fact: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Actions composite factor clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index d66b268563d0..3cac8f0a80dc 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -86,14 +86,20 @@ static int owl_comp_div_set_rate(struct clk_hw *hw, unsigned long rate,
 					rate, parent_rate);
 }
 
-static long owl_comp_fact_round_rate(struct clk_hw *hw, unsigned long rate,
-			unsigned long *parent_rate)
+static int owl_comp_fact_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct owl_composite *comp = hw_to_owl_comp(hw);
+	long rate;
 
-	return owl_factor_helper_round_rate(&comp->common,
-					&comp->rate.factor_hw,
-					rate, parent_rate);
+	rate = owl_factor_helper_round_rate(&comp->common,
+					    &comp->rate.factor_hw,
+					    req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long owl_comp_fact_recalc_rate(struct clk_hw *hw,
@@ -175,7 +181,7 @@ const struct clk_ops owl_comp_fact_ops = {
 	.is_enabled	= owl_comp_is_enabled,
 
 	/* fact_ops */
-	.round_rate	= owl_comp_fact_round_rate,
+	.determine_rate	= owl_comp_fact_determine_rate,
 	.recalc_rate	= owl_comp_fact_recalc_rate,
 	.set_rate	= owl_comp_fact_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 45/65] clk: actions: composite: fact: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Actions composite factor clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/actions/owl-composite.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/actions/owl-composite.c b/drivers/clk/actions/owl-composite.c
index d66b268563d0..3cac8f0a80dc 100644
--- a/drivers/clk/actions/owl-composite.c
+++ b/drivers/clk/actions/owl-composite.c
@@ -86,14 +86,20 @@ static int owl_comp_div_set_rate(struct clk_hw *hw, unsigned long rate,
 					rate, parent_rate);
 }
 
-static long owl_comp_fact_round_rate(struct clk_hw *hw, unsigned long rate,
-			unsigned long *parent_rate)
+static int owl_comp_fact_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct owl_composite *comp = hw_to_owl_comp(hw);
+	long rate;
 
-	return owl_factor_helper_round_rate(&comp->common,
-					&comp->rate.factor_hw,
-					rate, parent_rate);
+	rate = owl_factor_helper_round_rate(&comp->common,
+					    &comp->rate.factor_hw,
+					    req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long owl_comp_fact_recalc_rate(struct clk_hw *hw,
@@ -175,7 +181,7 @@ const struct clk_ops owl_comp_fact_ops = {
 	.is_enabled	= owl_comp_is_enabled,
 
 	/* fact_ops */
-	.round_rate	= owl_comp_fact_round_rate,
+	.determine_rate	= owl_comp_fact_determine_rate,
 	.recalc_rate	= owl_comp_fact_recalc_rate,
 	.set_rate	= owl_comp_fact_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 46/65] clk: at91: smd: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Atmel SAM9x5 SMD clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/clk-smd.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
index 160378438f1b..09c649c8598e 100644
--- a/drivers/clk/at91/clk-smd.c
+++ b/drivers/clk/at91/clk-smd.c
@@ -36,26 +36,31 @@ static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw,
 	return parent_rate / (smddiv + 1);
 }
 
-static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate,
-					  unsigned long *parent_rate)
+static int at91sam9x5_clk_smd_determine_rate(struct clk_hw *hw,
+					     struct clk_rate_request *req)
 {
 	unsigned long div;
 	unsigned long bestrate;
 	unsigned long tmp;
 
-	if (rate >= *parent_rate)
-		return *parent_rate;
+	if (req->rate >= req->best_parent_rate) {
+		req->rate = req->best_parent_rate;
+		return 0;
+	}
 
-	div = *parent_rate / rate;
-	if (div > SMD_MAX_DIV)
-		return *parent_rate / (SMD_MAX_DIV + 1);
+	div = req->best_parent_rate / req->rate;
+	if (div > SMD_MAX_DIV) {
+		req->rate = req->best_parent_rate / (SMD_MAX_DIV + 1);
+		return 0;
+	}
 
-	bestrate = *parent_rate / div;
-	tmp = *parent_rate / (div + 1);
-	if (bestrate - rate > rate - tmp)
+	bestrate = req->best_parent_rate / div;
+	tmp = req->best_parent_rate / (div + 1);
+	if (bestrate - req->rate > req->rate - tmp)
 		bestrate = tmp;
 
-	return bestrate;
+	req->rate = bestrate;
+	return 0;
 }
 
 static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index)
@@ -98,7 +103,7 @@ static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops at91sam9x5_smd_ops = {
 	.recalc_rate = at91sam9x5_clk_smd_recalc_rate,
-	.round_rate = at91sam9x5_clk_smd_round_rate,
+	.determine_rate = at91sam9x5_clk_smd_determine_rate,
 	.get_parent = at91sam9x5_clk_smd_get_parent,
 	.set_parent = at91sam9x5_clk_smd_set_parent,
 	.set_rate = at91sam9x5_clk_smd_set_rate,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 46/65] clk: at91: smd: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Atmel SAM9x5 SMD clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/clk-smd.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
index 160378438f1b..09c649c8598e 100644
--- a/drivers/clk/at91/clk-smd.c
+++ b/drivers/clk/at91/clk-smd.c
@@ -36,26 +36,31 @@ static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw,
 	return parent_rate / (smddiv + 1);
 }
 
-static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate,
-					  unsigned long *parent_rate)
+static int at91sam9x5_clk_smd_determine_rate(struct clk_hw *hw,
+					     struct clk_rate_request *req)
 {
 	unsigned long div;
 	unsigned long bestrate;
 	unsigned long tmp;
 
-	if (rate >= *parent_rate)
-		return *parent_rate;
+	if (req->rate >= req->best_parent_rate) {
+		req->rate = req->best_parent_rate;
+		return 0;
+	}
 
-	div = *parent_rate / rate;
-	if (div > SMD_MAX_DIV)
-		return *parent_rate / (SMD_MAX_DIV + 1);
+	div = req->best_parent_rate / req->rate;
+	if (div > SMD_MAX_DIV) {
+		req->rate = req->best_parent_rate / (SMD_MAX_DIV + 1);
+		return 0;
+	}
 
-	bestrate = *parent_rate / div;
-	tmp = *parent_rate / (div + 1);
-	if (bestrate - rate > rate - tmp)
+	bestrate = req->best_parent_rate / div;
+	tmp = req->best_parent_rate / (div + 1);
+	if (bestrate - req->rate > req->rate - tmp)
 		bestrate = tmp;
 
-	return bestrate;
+	req->rate = bestrate;
+	return 0;
 }
 
 static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index)
@@ -98,7 +103,7 @@ static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops at91sam9x5_smd_ops = {
 	.recalc_rate = at91sam9x5_clk_smd_recalc_rate,
-	.round_rate = at91sam9x5_clk_smd_round_rate,
+	.determine_rate = at91sam9x5_clk_smd_determine_rate,
 	.get_parent = at91sam9x5_clk_smd_get_parent,
 	.set_parent = at91sam9x5_clk_smd_set_parent,
 	.set_rate = at91sam9x5_clk_smd_set_rate,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 46/65] clk: at91: smd: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Atmel SAM9x5 SMD clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/at91/clk-smd.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
index 160378438f1b..09c649c8598e 100644
--- a/drivers/clk/at91/clk-smd.c
+++ b/drivers/clk/at91/clk-smd.c
@@ -36,26 +36,31 @@ static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw,
 	return parent_rate / (smddiv + 1);
 }
 
-static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate,
-					  unsigned long *parent_rate)
+static int at91sam9x5_clk_smd_determine_rate(struct clk_hw *hw,
+					     struct clk_rate_request *req)
 {
 	unsigned long div;
 	unsigned long bestrate;
 	unsigned long tmp;
 
-	if (rate >= *parent_rate)
-		return *parent_rate;
+	if (req->rate >= req->best_parent_rate) {
+		req->rate = req->best_parent_rate;
+		return 0;
+	}
 
-	div = *parent_rate / rate;
-	if (div > SMD_MAX_DIV)
-		return *parent_rate / (SMD_MAX_DIV + 1);
+	div = req->best_parent_rate / req->rate;
+	if (div > SMD_MAX_DIV) {
+		req->rate = req->best_parent_rate / (SMD_MAX_DIV + 1);
+		return 0;
+	}
 
-	bestrate = *parent_rate / div;
-	tmp = *parent_rate / (div + 1);
-	if (bestrate - rate > rate - tmp)
+	bestrate = req->best_parent_rate / div;
+	tmp = req->best_parent_rate / (div + 1);
+	if (bestrate - req->rate > req->rate - tmp)
 		bestrate = tmp;
 
-	return bestrate;
+	req->rate = bestrate;
+	return 0;
 }
 
 static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index)
@@ -98,7 +103,7 @@ static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops at91sam9x5_smd_ops = {
 	.recalc_rate = at91sam9x5_clk_smd_recalc_rate,
-	.round_rate = at91sam9x5_clk_smd_round_rate,
+	.determine_rate = at91sam9x5_clk_smd_determine_rate,
 	.get_parent = at91sam9x5_clk_smd_get_parent,
 	.set_parent = at91sam9x5_clk_smd_set_parent,
 	.set_rate = at91sam9x5_clk_smd_set_rate,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 47/65] clk: axi-clkgen: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The AXI clkgen clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-axi-clkgen.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
index ac6ff736ac8f..6b2a44ef4d73 100644
--- a/drivers/clk/clk-axi-clkgen.c
+++ b/drivers/clk/clk-axi-clkgen.c
@@ -384,23 +384,25 @@ static int axi_clkgen_set_rate(struct clk_hw *clk_hw,
 	return 0;
 }
 
-static long axi_clkgen_round_rate(struct clk_hw *hw, unsigned long rate,
-	unsigned long *parent_rate)
+static int axi_clkgen_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(hw);
 	const struct axi_clkgen_limits *limits = &axi_clkgen->limits;
 	unsigned int d, m, dout;
 	unsigned long long tmp;
 
-	axi_clkgen_calc_params(limits, *parent_rate, rate, &d, &m, &dout);
+	axi_clkgen_calc_params(limits, req->best_parent_rate, req->rate,
+			       &d, &m, &dout);
 
 	if (d == 0 || dout == 0 || m == 0)
 		return -EINVAL;
 
-	tmp = (unsigned long long)*parent_rate * m;
+	tmp = (unsigned long long)req->best_parent_rate * m;
 	tmp = DIV_ROUND_CLOSEST_ULL(tmp, dout * d);
 
-	return min_t(unsigned long long, tmp, LONG_MAX);
+	req->rate = min_t(unsigned long long, tmp, LONG_MAX);
+	return 0;
 }
 
 static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen,
@@ -495,7 +497,7 @@ static u8 axi_clkgen_get_parent(struct clk_hw *clk_hw)
 
 static const struct clk_ops axi_clkgen_ops = {
 	.recalc_rate = axi_clkgen_recalc_rate,
-	.round_rate = axi_clkgen_round_rate,
+	.determine_rate = axi_clkgen_determine_rate,
 	.set_rate = axi_clkgen_set_rate,
 	.enable = axi_clkgen_enable,
 	.disable = axi_clkgen_disable,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 47/65] clk: axi-clkgen: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The AXI clkgen clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-axi-clkgen.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
index ac6ff736ac8f..6b2a44ef4d73 100644
--- a/drivers/clk/clk-axi-clkgen.c
+++ b/drivers/clk/clk-axi-clkgen.c
@@ -384,23 +384,25 @@ static int axi_clkgen_set_rate(struct clk_hw *clk_hw,
 	return 0;
 }
 
-static long axi_clkgen_round_rate(struct clk_hw *hw, unsigned long rate,
-	unsigned long *parent_rate)
+static int axi_clkgen_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(hw);
 	const struct axi_clkgen_limits *limits = &axi_clkgen->limits;
 	unsigned int d, m, dout;
 	unsigned long long tmp;
 
-	axi_clkgen_calc_params(limits, *parent_rate, rate, &d, &m, &dout);
+	axi_clkgen_calc_params(limits, req->best_parent_rate, req->rate,
+			       &d, &m, &dout);
 
 	if (d == 0 || dout == 0 || m == 0)
 		return -EINVAL;
 
-	tmp = (unsigned long long)*parent_rate * m;
+	tmp = (unsigned long long)req->best_parent_rate * m;
 	tmp = DIV_ROUND_CLOSEST_ULL(tmp, dout * d);
 
-	return min_t(unsigned long long, tmp, LONG_MAX);
+	req->rate = min_t(unsigned long long, tmp, LONG_MAX);
+	return 0;
 }
 
 static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen,
@@ -495,7 +497,7 @@ static u8 axi_clkgen_get_parent(struct clk_hw *clk_hw)
 
 static const struct clk_ops axi_clkgen_ops = {
 	.recalc_rate = axi_clkgen_recalc_rate,
-	.round_rate = axi_clkgen_round_rate,
+	.determine_rate = axi_clkgen_determine_rate,
 	.set_rate = axi_clkgen_set_rate,
 	.enable = axi_clkgen_enable,
 	.disable = axi_clkgen_disable,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 47/65] clk: axi-clkgen: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The AXI clkgen clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-axi-clkgen.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
index ac6ff736ac8f..6b2a44ef4d73 100644
--- a/drivers/clk/clk-axi-clkgen.c
+++ b/drivers/clk/clk-axi-clkgen.c
@@ -384,23 +384,25 @@ static int axi_clkgen_set_rate(struct clk_hw *clk_hw,
 	return 0;
 }
 
-static long axi_clkgen_round_rate(struct clk_hw *hw, unsigned long rate,
-	unsigned long *parent_rate)
+static int axi_clkgen_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(hw);
 	const struct axi_clkgen_limits *limits = &axi_clkgen->limits;
 	unsigned int d, m, dout;
 	unsigned long long tmp;
 
-	axi_clkgen_calc_params(limits, *parent_rate, rate, &d, &m, &dout);
+	axi_clkgen_calc_params(limits, req->best_parent_rate, req->rate,
+			       &d, &m, &dout);
 
 	if (d == 0 || dout == 0 || m == 0)
 		return -EINVAL;
 
-	tmp = (unsigned long long)*parent_rate * m;
+	tmp = (unsigned long long)req->best_parent_rate * m;
 	tmp = DIV_ROUND_CLOSEST_ULL(tmp, dout * d);
 
-	return min_t(unsigned long long, tmp, LONG_MAX);
+	req->rate = min_t(unsigned long long, tmp, LONG_MAX);
+	return 0;
 }
 
 static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen,
@@ -495,7 +497,7 @@ static u8 axi_clkgen_get_parent(struct clk_hw *clk_hw)
 
 static const struct clk_ops axi_clkgen_ops = {
 	.recalc_rate = axi_clkgen_recalc_rate,
-	.round_rate = axi_clkgen_round_rate,
+	.determine_rate = axi_clkgen_determine_rate,
 	.set_rate = axi_clkgen_set_rate,
 	.enable = axi_clkgen_enable,
 	.disable = axi_clkgen_disable,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 48/65] clk: cdce706: divider: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The cdce706 divider clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index dc046bbf83a1..a53769d239a9 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -288,18 +288,19 @@ static unsigned long cdce706_divider_recalc_rate(struct clk_hw *hw,
 	return 0;
 }
 
-static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
-				       unsigned long *parent_rate)
+static int cdce706_divider_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	struct cdce706_hw_data *hwd = to_hw_data(hw);
 	struct cdce706_dev_data *cdce = hwd->dev_data;
+	unsigned long rate = req->rate;
 	unsigned long mul, div;
 
 	dev_dbg(&hwd->dev_data->client->dev,
 		"%s, rate: %lu, parent_rate: %lu\n",
-		__func__, rate, *parent_rate);
+		__func__, rate, req->best_parent_rate);
 
-	rational_best_approximation(rate, *parent_rate,
+	rational_best_approximation(rate, req->best_parent_rate,
 				    1, CDCE706_DIVIDER_DIVIDER_MAX,
 				    &mul, &div);
 	if (!mul)
@@ -344,8 +345,8 @@ static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 
 		dev_dbg(&hwd->dev_data->client->dev,
 			"%s, altering parent rate: %lu -> %lu\n",
-			__func__, *parent_rate, rate * div);
-		*parent_rate = rate * div;
+			__func__, req->best_parent_rate, rate * div);
+		req->best_parent_rate = rate * div;
 	}
 	hwd->div = div;
 
@@ -353,7 +354,8 @@ static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 		"%s, divider: %d, div: %lu\n",
 		__func__, hwd->idx, div);
 
-	return *parent_rate / div;
+	req->rate = req->best_parent_rate / div;
+	return 0;
 }
 
 static int cdce706_divider_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -375,7 +377,7 @@ static const struct clk_ops cdce706_divider_ops = {
 	.set_parent = cdce706_divider_set_parent,
 	.get_parent = cdce706_divider_get_parent,
 	.recalc_rate = cdce706_divider_recalc_rate,
-	.round_rate = cdce706_divider_round_rate,
+	.determine_rate = cdce706_divider_determine_rate,
 	.set_rate = cdce706_divider_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 48/65] clk: cdce706: divider: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The cdce706 divider clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index dc046bbf83a1..a53769d239a9 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -288,18 +288,19 @@ static unsigned long cdce706_divider_recalc_rate(struct clk_hw *hw,
 	return 0;
 }
 
-static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
-				       unsigned long *parent_rate)
+static int cdce706_divider_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	struct cdce706_hw_data *hwd = to_hw_data(hw);
 	struct cdce706_dev_data *cdce = hwd->dev_data;
+	unsigned long rate = req->rate;
 	unsigned long mul, div;
 
 	dev_dbg(&hwd->dev_data->client->dev,
 		"%s, rate: %lu, parent_rate: %lu\n",
-		__func__, rate, *parent_rate);
+		__func__, rate, req->best_parent_rate);
 
-	rational_best_approximation(rate, *parent_rate,
+	rational_best_approximation(rate, req->best_parent_rate,
 				    1, CDCE706_DIVIDER_DIVIDER_MAX,
 				    &mul, &div);
 	if (!mul)
@@ -344,8 +345,8 @@ static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 
 		dev_dbg(&hwd->dev_data->client->dev,
 			"%s, altering parent rate: %lu -> %lu\n",
-			__func__, *parent_rate, rate * div);
-		*parent_rate = rate * div;
+			__func__, req->best_parent_rate, rate * div);
+		req->best_parent_rate = rate * div;
 	}
 	hwd->div = div;
 
@@ -353,7 +354,8 @@ static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 		"%s, divider: %d, div: %lu\n",
 		__func__, hwd->idx, div);
 
-	return *parent_rate / div;
+	req->rate = req->best_parent_rate / div;
+	return 0;
 }
 
 static int cdce706_divider_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -375,7 +377,7 @@ static const struct clk_ops cdce706_divider_ops = {
 	.set_parent = cdce706_divider_set_parent,
 	.get_parent = cdce706_divider_get_parent,
 	.recalc_rate = cdce706_divider_recalc_rate,
-	.round_rate = cdce706_divider_round_rate,
+	.determine_rate = cdce706_divider_determine_rate,
 	.set_rate = cdce706_divider_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 48/65] clk: cdce706: divider: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The cdce706 divider clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index dc046bbf83a1..a53769d239a9 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -288,18 +288,19 @@ static unsigned long cdce706_divider_recalc_rate(struct clk_hw *hw,
 	return 0;
 }
 
-static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
-				       unsigned long *parent_rate)
+static int cdce706_divider_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	struct cdce706_hw_data *hwd = to_hw_data(hw);
 	struct cdce706_dev_data *cdce = hwd->dev_data;
+	unsigned long rate = req->rate;
 	unsigned long mul, div;
 
 	dev_dbg(&hwd->dev_data->client->dev,
 		"%s, rate: %lu, parent_rate: %lu\n",
-		__func__, rate, *parent_rate);
+		__func__, rate, req->best_parent_rate);
 
-	rational_best_approximation(rate, *parent_rate,
+	rational_best_approximation(rate, req->best_parent_rate,
 				    1, CDCE706_DIVIDER_DIVIDER_MAX,
 				    &mul, &div);
 	if (!mul)
@@ -344,8 +345,8 @@ static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 
 		dev_dbg(&hwd->dev_data->client->dev,
 			"%s, altering parent rate: %lu -> %lu\n",
-			__func__, *parent_rate, rate * div);
-		*parent_rate = rate * div;
+			__func__, req->best_parent_rate, rate * div);
+		req->best_parent_rate = rate * div;
 	}
 	hwd->div = div;
 
@@ -353,7 +354,8 @@ static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 		"%s, divider: %d, div: %lu\n",
 		__func__, hwd->idx, div);
 
-	return *parent_rate / div;
+	req->rate = req->best_parent_rate / div;
+	return 0;
 }
 
 static int cdce706_divider_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -375,7 +377,7 @@ static const struct clk_ops cdce706_divider_ops = {
 	.set_parent = cdce706_divider_set_parent,
 	.get_parent = cdce706_divider_get_parent,
 	.recalc_rate = cdce706_divider_recalc_rate,
-	.round_rate = cdce706_divider_round_rate,
+	.determine_rate = cdce706_divider_determine_rate,
 	.set_rate = cdce706_divider_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 49/65] clk: cdce706: clkout: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The cdce706 clkout clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index a53769d239a9..0a560b4d295e 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -423,11 +423,12 @@ static unsigned long cdce706_clkout_recalc_rate(struct clk_hw *hw,
 	return parent_rate;
 }
 
-static long cdce706_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
-				      unsigned long *parent_rate)
+static int cdce706_clkout_determine_rate(struct clk_hw *hw,
+					 struct clk_rate_request *req)
 {
-	*parent_rate = rate;
-	return rate;
+	req->best_parent_rate = req->rate;
+
+	return 0;
 }
 
 static int cdce706_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -442,7 +443,7 @@ static const struct clk_ops cdce706_clkout_ops = {
 	.set_parent = cdce706_clkout_set_parent,
 	.get_parent = cdce706_clkout_get_parent,
 	.recalc_rate = cdce706_clkout_recalc_rate,
-	.round_rate = cdce706_clkout_round_rate,
+	.determine_rate = cdce706_clkout_determine_rate,
 	.set_rate = cdce706_clkout_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 49/65] clk: cdce706: clkout: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The cdce706 clkout clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index a53769d239a9..0a560b4d295e 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -423,11 +423,12 @@ static unsigned long cdce706_clkout_recalc_rate(struct clk_hw *hw,
 	return parent_rate;
 }
 
-static long cdce706_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
-				      unsigned long *parent_rate)
+static int cdce706_clkout_determine_rate(struct clk_hw *hw,
+					 struct clk_rate_request *req)
 {
-	*parent_rate = rate;
-	return rate;
+	req->best_parent_rate = req->rate;
+
+	return 0;
 }
 
 static int cdce706_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -442,7 +443,7 @@ static const struct clk_ops cdce706_clkout_ops = {
 	.set_parent = cdce706_clkout_set_parent,
 	.get_parent = cdce706_clkout_get_parent,
 	.recalc_rate = cdce706_clkout_recalc_rate,
-	.round_rate = cdce706_clkout_round_rate,
+	.determine_rate = cdce706_clkout_determine_rate,
 	.set_rate = cdce706_clkout_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 49/65] clk: cdce706: clkout: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The cdce706 clkout clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-cdce706.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index a53769d239a9..0a560b4d295e 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -423,11 +423,12 @@ static unsigned long cdce706_clkout_recalc_rate(struct clk_hw *hw,
 	return parent_rate;
 }
 
-static long cdce706_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
-				      unsigned long *parent_rate)
+static int cdce706_clkout_determine_rate(struct clk_hw *hw,
+					 struct clk_rate_request *req)
 {
-	*parent_rate = rate;
-	return rate;
+	req->best_parent_rate = req->rate;
+
+	return 0;
 }
 
 static int cdce706_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -442,7 +443,7 @@ static const struct clk_ops cdce706_clkout_ops = {
 	.set_parent = cdce706_clkout_set_parent,
 	.get_parent = cdce706_clkout_get_parent,
 	.recalc_rate = cdce706_clkout_recalc_rate,
-	.round_rate = cdce706_clkout_round_rate,
+	.determine_rate = cdce706_clkout_determine_rate,
 	.set_rate = cdce706_clkout_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 50/65] clk: si5341: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5341 output clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5341.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 259861aa2e2f..14792d5ffb4f 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -828,19 +828,20 @@ static unsigned long si5341_output_clk_recalc_rate(struct clk_hw *hw,
 	return parent_rate / r_divider;
 }
 
-static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate,
-		unsigned long *parent_rate)
+static int si5341_output_clk_determine_rate(struct clk_hw *hw,
+					    struct clk_rate_request *req)
 {
+	unsigned long rate = req->rate;
 	unsigned long r;
 
 	if (!rate)
 		return 0;
 
-	r = *parent_rate >> 1;
+	r = req->best_parent_rate >> 1;
 
 	/* If rate is an even divisor, no changes to parent required */
 	if (r && !(r % rate))
-		return (long)rate;
+		return 0;
 
 	if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
 		if (rate > 200000000) {
@@ -850,14 +851,15 @@ static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate,
 			/* Take a parent frequency near 400 MHz */
 			r = (400000000u / rate) & ~1;
 		}
-		*parent_rate = r * rate;
+		req->best_parent_rate = r * rate;
 	} else {
 		/* We cannot change our parent's rate, report what we can do */
 		r /= rate;
-		rate = *parent_rate / (r << 1);
+		rate = req->best_parent_rate / (r << 1);
 	}
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -930,7 +932,7 @@ static const struct clk_ops si5341_output_clk_ops = {
 	.prepare = si5341_output_clk_prepare,
 	.unprepare = si5341_output_clk_unprepare,
 	.recalc_rate = si5341_output_clk_recalc_rate,
-	.round_rate = si5341_output_clk_round_rate,
+	.determine_rate = si5341_output_clk_determine_rate,
 	.set_rate = si5341_output_clk_set_rate,
 	.set_parent = si5341_output_set_parent,
 	.get_parent = si5341_output_get_parent,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 50/65] clk: si5341: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The SI5341 output clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5341.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 259861aa2e2f..14792d5ffb4f 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -828,19 +828,20 @@ static unsigned long si5341_output_clk_recalc_rate(struct clk_hw *hw,
 	return parent_rate / r_divider;
 }
 
-static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate,
-		unsigned long *parent_rate)
+static int si5341_output_clk_determine_rate(struct clk_hw *hw,
+					    struct clk_rate_request *req)
 {
+	unsigned long rate = req->rate;
 	unsigned long r;
 
 	if (!rate)
 		return 0;
 
-	r = *parent_rate >> 1;
+	r = req->best_parent_rate >> 1;
 
 	/* If rate is an even divisor, no changes to parent required */
 	if (r && !(r % rate))
-		return (long)rate;
+		return 0;
 
 	if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
 		if (rate > 200000000) {
@@ -850,14 +851,15 @@ static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate,
 			/* Take a parent frequency near 400 MHz */
 			r = (400000000u / rate) & ~1;
 		}
-		*parent_rate = r * rate;
+		req->best_parent_rate = r * rate;
 	} else {
 		/* We cannot change our parent's rate, report what we can do */
 		r /= rate;
-		rate = *parent_rate / (r << 1);
+		rate = req->best_parent_rate / (r << 1);
 	}
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -930,7 +932,7 @@ static const struct clk_ops si5341_output_clk_ops = {
 	.prepare = si5341_output_clk_prepare,
 	.unprepare = si5341_output_clk_unprepare,
 	.recalc_rate = si5341_output_clk_recalc_rate,
-	.round_rate = si5341_output_clk_round_rate,
+	.determine_rate = si5341_output_clk_determine_rate,
 	.set_rate = si5341_output_clk_set_rate,
 	.set_parent = si5341_output_set_parent,
 	.get_parent = si5341_output_get_parent,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 50/65] clk: si5341: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5341 output clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5341.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 259861aa2e2f..14792d5ffb4f 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -828,19 +828,20 @@ static unsigned long si5341_output_clk_recalc_rate(struct clk_hw *hw,
 	return parent_rate / r_divider;
 }
 
-static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate,
-		unsigned long *parent_rate)
+static int si5341_output_clk_determine_rate(struct clk_hw *hw,
+					    struct clk_rate_request *req)
 {
+	unsigned long rate = req->rate;
 	unsigned long r;
 
 	if (!rate)
 		return 0;
 
-	r = *parent_rate >> 1;
+	r = req->best_parent_rate >> 1;
 
 	/* If rate is an even divisor, no changes to parent required */
 	if (r && !(r % rate))
-		return (long)rate;
+		return 0;
 
 	if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
 		if (rate > 200000000) {
@@ -850,14 +851,15 @@ static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate,
 			/* Take a parent frequency near 400 MHz */
 			r = (400000000u / rate) & ~1;
 		}
-		*parent_rate = r * rate;
+		req->best_parent_rate = r * rate;
 	} else {
 		/* We cannot change our parent's rate, report what we can do */
 		r /= rate;
-		rate = *parent_rate / (r << 1);
+		rate = req->best_parent_rate / (r << 1);
 	}
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -930,7 +932,7 @@ static const struct clk_ops si5341_output_clk_ops = {
 	.prepare = si5341_output_clk_prepare,
 	.unprepare = si5341_output_clk_unprepare,
 	.recalc_rate = si5341_output_clk_recalc_rate,
-	.round_rate = si5341_output_clk_round_rate,
+	.determine_rate = si5341_output_clk_determine_rate,
 	.set_rate = si5341_output_clk_set_rate,
 	.set_parent = si5341_output_set_parent,
 	.get_parent = si5341_output_get_parent,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 51/65] clk: si5351: pll: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5351 PLL clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 9e939c98a455..fcf5785ba4ce 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -442,11 +442,12 @@ static unsigned long si5351_pll_recalc_rate(struct clk_hw *hw,
 	return (unsigned long)rate;
 }
 
-static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-				  unsigned long *parent_rate)
+static int si5351_pll_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned long rfrac, denom, a, b, c;
 	unsigned long long lltmp;
 
@@ -456,18 +457,18 @@ static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 		rate = SI5351_PLL_VCO_MAX;
 
 	/* determine integer part of feedback equation */
-	a = rate / *parent_rate;
+	a = rate / req->best_parent_rate;
 
 	if (a < SI5351_PLL_A_MIN)
-		rate = *parent_rate * SI5351_PLL_A_MIN;
+		rate = req->best_parent_rate * SI5351_PLL_A_MIN;
 	if (a > SI5351_PLL_A_MAX)
-		rate = *parent_rate * SI5351_PLL_A_MAX;
+		rate = req->best_parent_rate * SI5351_PLL_A_MAX;
 
 	/* find best approximation for b/c = fVCO mod fIN */
 	denom = 1000 * 1000;
-	lltmp = rate % (*parent_rate);
+	lltmp = rate % (req->best_parent_rate);
 	lltmp *= denom;
-	do_div(lltmp, *parent_rate);
+	do_div(lltmp, req->best_parent_rate);
 	rfrac = (unsigned long)lltmp;
 
 	b = 0;
@@ -484,19 +485,20 @@ static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 	hwdata->params.p1 -= 512;
 
 	/* recalculate rate by fIN * (a + b/c) */
-	lltmp  = *parent_rate;
+	lltmp  = req->best_parent_rate;
 	lltmp *= b;
 	do_div(lltmp, c);
 
 	rate  = (unsigned long)lltmp;
-	rate += *parent_rate * a;
+	rate += req->best_parent_rate * a;
 
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: a = %lu, b = %lu, c = %lu, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), a, b, c,
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -533,7 +535,7 @@ static const struct clk_ops si5351_pll_ops = {
 	.set_parent = si5351_pll_set_parent,
 	.get_parent = si5351_pll_get_parent,
 	.recalc_rate = si5351_pll_recalc_rate,
-	.round_rate = si5351_pll_round_rate,
+	.determine_rate = si5351_pll_determine_rate,
 	.set_rate = si5351_pll_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 51/65] clk: si5351: pll: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The SI5351 PLL clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 9e939c98a455..fcf5785ba4ce 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -442,11 +442,12 @@ static unsigned long si5351_pll_recalc_rate(struct clk_hw *hw,
 	return (unsigned long)rate;
 }
 
-static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-				  unsigned long *parent_rate)
+static int si5351_pll_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned long rfrac, denom, a, b, c;
 	unsigned long long lltmp;
 
@@ -456,18 +457,18 @@ static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 		rate = SI5351_PLL_VCO_MAX;
 
 	/* determine integer part of feedback equation */
-	a = rate / *parent_rate;
+	a = rate / req->best_parent_rate;
 
 	if (a < SI5351_PLL_A_MIN)
-		rate = *parent_rate * SI5351_PLL_A_MIN;
+		rate = req->best_parent_rate * SI5351_PLL_A_MIN;
 	if (a > SI5351_PLL_A_MAX)
-		rate = *parent_rate * SI5351_PLL_A_MAX;
+		rate = req->best_parent_rate * SI5351_PLL_A_MAX;
 
 	/* find best approximation for b/c = fVCO mod fIN */
 	denom = 1000 * 1000;
-	lltmp = rate % (*parent_rate);
+	lltmp = rate % (req->best_parent_rate);
 	lltmp *= denom;
-	do_div(lltmp, *parent_rate);
+	do_div(lltmp, req->best_parent_rate);
 	rfrac = (unsigned long)lltmp;
 
 	b = 0;
@@ -484,19 +485,20 @@ static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 	hwdata->params.p1 -= 512;
 
 	/* recalculate rate by fIN * (a + b/c) */
-	lltmp  = *parent_rate;
+	lltmp  = req->best_parent_rate;
 	lltmp *= b;
 	do_div(lltmp, c);
 
 	rate  = (unsigned long)lltmp;
-	rate += *parent_rate * a;
+	rate += req->best_parent_rate * a;
 
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: a = %lu, b = %lu, c = %lu, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), a, b, c,
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -533,7 +535,7 @@ static const struct clk_ops si5351_pll_ops = {
 	.set_parent = si5351_pll_set_parent,
 	.get_parent = si5351_pll_get_parent,
 	.recalc_rate = si5351_pll_recalc_rate,
-	.round_rate = si5351_pll_round_rate,
+	.determine_rate = si5351_pll_determine_rate,
 	.set_rate = si5351_pll_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 51/65] clk: si5351: pll: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5351 PLL clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 9e939c98a455..fcf5785ba4ce 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -442,11 +442,12 @@ static unsigned long si5351_pll_recalc_rate(struct clk_hw *hw,
 	return (unsigned long)rate;
 }
 
-static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-				  unsigned long *parent_rate)
+static int si5351_pll_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned long rfrac, denom, a, b, c;
 	unsigned long long lltmp;
 
@@ -456,18 +457,18 @@ static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 		rate = SI5351_PLL_VCO_MAX;
 
 	/* determine integer part of feedback equation */
-	a = rate / *parent_rate;
+	a = rate / req->best_parent_rate;
 
 	if (a < SI5351_PLL_A_MIN)
-		rate = *parent_rate * SI5351_PLL_A_MIN;
+		rate = req->best_parent_rate * SI5351_PLL_A_MIN;
 	if (a > SI5351_PLL_A_MAX)
-		rate = *parent_rate * SI5351_PLL_A_MAX;
+		rate = req->best_parent_rate * SI5351_PLL_A_MAX;
 
 	/* find best approximation for b/c = fVCO mod fIN */
 	denom = 1000 * 1000;
-	lltmp = rate % (*parent_rate);
+	lltmp = rate % (req->best_parent_rate);
 	lltmp *= denom;
-	do_div(lltmp, *parent_rate);
+	do_div(lltmp, req->best_parent_rate);
 	rfrac = (unsigned long)lltmp;
 
 	b = 0;
@@ -484,19 +485,20 @@ static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 	hwdata->params.p1 -= 512;
 
 	/* recalculate rate by fIN * (a + b/c) */
-	lltmp  = *parent_rate;
+	lltmp  = req->best_parent_rate;
 	lltmp *= b;
 	do_div(lltmp, c);
 
 	rate  = (unsigned long)lltmp;
-	rate += *parent_rate * a;
+	rate += req->best_parent_rate * a;
 
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: a = %lu, b = %lu, c = %lu, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), a, b, c,
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -533,7 +535,7 @@ static const struct clk_ops si5351_pll_ops = {
 	.set_parent = si5351_pll_set_parent,
 	.get_parent = si5351_pll_get_parent,
 	.recalc_rate = si5351_pll_recalc_rate,
-	.round_rate = si5351_pll_round_rate,
+	.determine_rate = si5351_pll_determine_rate,
 	.set_rate = si5351_pll_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 52/65] clk: si5351: msynth: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The SI5351 msynth clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index fcf5785ba4ce..bfab05f4fe28 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -642,11 +642,12 @@ static unsigned long si5351_msynth_recalc_rate(struct clk_hw *hw,
 	return (unsigned long)rate;
 }
 
-static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
-				     unsigned long *parent_rate)
+static int si5351_msynth_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned long long lltmp;
 	unsigned long a, b, c;
 	int divby4;
@@ -681,10 +682,10 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 		b = 0;
 		c = 1;
 
-		*parent_rate = a * rate;
+		req->best_parent_rate = a * rate;
 	} else if (hwdata->num >= 6) {
 		/* determine the closest integer divider */
-		a = DIV_ROUND_CLOSEST(*parent_rate, rate);
+		a = DIV_ROUND_CLOSEST(req->best_parent_rate, rate);
 		if (a < SI5351_MULTISYNTH_A_MIN)
 			a = SI5351_MULTISYNTH_A_MIN;
 		if (a > SI5351_MULTISYNTH67_A_MAX)
@@ -702,7 +703,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 		}
 
 		/* determine integer part of divider equation */
-		a = *parent_rate / rate;
+		a = req->best_parent_rate / rate;
 		if (a < SI5351_MULTISYNTH_A_MIN)
 			a = SI5351_MULTISYNTH_A_MIN;
 		if (a > SI5351_MULTISYNTH_A_MAX)
@@ -710,7 +711,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 
 		/* find best approximation for b/c = fVCO mod fOUT */
 		denom = 1000 * 1000;
-		lltmp = (*parent_rate) % rate;
+		lltmp = req->best_parent_rate % rate;
 		lltmp *= denom;
 		do_div(lltmp, rate);
 		rfrac = (unsigned long)lltmp;
@@ -724,7 +725,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 	}
 
 	/* recalculate rate by fOUT = fIN / (a + b/c) */
-	lltmp  = *parent_rate;
+	lltmp  = req->best_parent_rate;
 	lltmp *= c;
 	do_div(lltmp, a * c + b);
 	rate  = (unsigned long)lltmp;
@@ -749,9 +750,11 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: a = %lu, b = %lu, c = %lu, divby4 = %d, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), a, b, c, divby4,
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+
+	return 0;
 }
 
 static int si5351_msynth_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -791,7 +794,7 @@ static const struct clk_ops si5351_msynth_ops = {
 	.set_parent = si5351_msynth_set_parent,
 	.get_parent = si5351_msynth_get_parent,
 	.recalc_rate = si5351_msynth_recalc_rate,
-	.round_rate = si5351_msynth_round_rate,
+	.determine_rate = si5351_msynth_determine_rate,
 	.set_rate = si5351_msynth_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 52/65] clk: si5351: msynth: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5351 msynth clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index fcf5785ba4ce..bfab05f4fe28 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -642,11 +642,12 @@ static unsigned long si5351_msynth_recalc_rate(struct clk_hw *hw,
 	return (unsigned long)rate;
 }
 
-static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
-				     unsigned long *parent_rate)
+static int si5351_msynth_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned long long lltmp;
 	unsigned long a, b, c;
 	int divby4;
@@ -681,10 +682,10 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 		b = 0;
 		c = 1;
 
-		*parent_rate = a * rate;
+		req->best_parent_rate = a * rate;
 	} else if (hwdata->num >= 6) {
 		/* determine the closest integer divider */
-		a = DIV_ROUND_CLOSEST(*parent_rate, rate);
+		a = DIV_ROUND_CLOSEST(req->best_parent_rate, rate);
 		if (a < SI5351_MULTISYNTH_A_MIN)
 			a = SI5351_MULTISYNTH_A_MIN;
 		if (a > SI5351_MULTISYNTH67_A_MAX)
@@ -702,7 +703,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 		}
 
 		/* determine integer part of divider equation */
-		a = *parent_rate / rate;
+		a = req->best_parent_rate / rate;
 		if (a < SI5351_MULTISYNTH_A_MIN)
 			a = SI5351_MULTISYNTH_A_MIN;
 		if (a > SI5351_MULTISYNTH_A_MAX)
@@ -710,7 +711,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 
 		/* find best approximation for b/c = fVCO mod fOUT */
 		denom = 1000 * 1000;
-		lltmp = (*parent_rate) % rate;
+		lltmp = req->best_parent_rate % rate;
 		lltmp *= denom;
 		do_div(lltmp, rate);
 		rfrac = (unsigned long)lltmp;
@@ -724,7 +725,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 	}
 
 	/* recalculate rate by fOUT = fIN / (a + b/c) */
-	lltmp  = *parent_rate;
+	lltmp  = req->best_parent_rate;
 	lltmp *= c;
 	do_div(lltmp, a * c + b);
 	rate  = (unsigned long)lltmp;
@@ -749,9 +750,11 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: a = %lu, b = %lu, c = %lu, divby4 = %d, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), a, b, c, divby4,
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+
+	return 0;
 }
 
 static int si5351_msynth_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -791,7 +794,7 @@ static const struct clk_ops si5351_msynth_ops = {
 	.set_parent = si5351_msynth_set_parent,
 	.get_parent = si5351_msynth_get_parent,
 	.recalc_rate = si5351_msynth_recalc_rate,
-	.round_rate = si5351_msynth_round_rate,
+	.determine_rate = si5351_msynth_determine_rate,
 	.set_rate = si5351_msynth_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 52/65] clk: si5351: msynth: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5351 msynth clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index fcf5785ba4ce..bfab05f4fe28 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -642,11 +642,12 @@ static unsigned long si5351_msynth_recalc_rate(struct clk_hw *hw,
 	return (unsigned long)rate;
 }
 
-static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
-				     unsigned long *parent_rate)
+static int si5351_msynth_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned long long lltmp;
 	unsigned long a, b, c;
 	int divby4;
@@ -681,10 +682,10 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 		b = 0;
 		c = 1;
 
-		*parent_rate = a * rate;
+		req->best_parent_rate = a * rate;
 	} else if (hwdata->num >= 6) {
 		/* determine the closest integer divider */
-		a = DIV_ROUND_CLOSEST(*parent_rate, rate);
+		a = DIV_ROUND_CLOSEST(req->best_parent_rate, rate);
 		if (a < SI5351_MULTISYNTH_A_MIN)
 			a = SI5351_MULTISYNTH_A_MIN;
 		if (a > SI5351_MULTISYNTH67_A_MAX)
@@ -702,7 +703,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 		}
 
 		/* determine integer part of divider equation */
-		a = *parent_rate / rate;
+		a = req->best_parent_rate / rate;
 		if (a < SI5351_MULTISYNTH_A_MIN)
 			a = SI5351_MULTISYNTH_A_MIN;
 		if (a > SI5351_MULTISYNTH_A_MAX)
@@ -710,7 +711,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 
 		/* find best approximation for b/c = fVCO mod fOUT */
 		denom = 1000 * 1000;
-		lltmp = (*parent_rate) % rate;
+		lltmp = req->best_parent_rate % rate;
 		lltmp *= denom;
 		do_div(lltmp, rate);
 		rfrac = (unsigned long)lltmp;
@@ -724,7 +725,7 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 	}
 
 	/* recalculate rate by fOUT = fIN / (a + b/c) */
-	lltmp  = *parent_rate;
+	lltmp  = req->best_parent_rate;
 	lltmp *= c;
 	do_div(lltmp, a * c + b);
 	rate  = (unsigned long)lltmp;
@@ -749,9 +750,11 @@ static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate,
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: a = %lu, b = %lu, c = %lu, divby4 = %d, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), a, b, c, divby4,
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+
+	return 0;
 }
 
 static int si5351_msynth_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -791,7 +794,7 @@ static const struct clk_ops si5351_msynth_ops = {
 	.set_parent = si5351_msynth_set_parent,
 	.get_parent = si5351_msynth_get_parent,
 	.recalc_rate = si5351_msynth_recalc_rate,
-	.round_rate = si5351_msynth_round_rate,
+	.determine_rate = si5351_msynth_determine_rate,
 	.set_rate = si5351_msynth_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 53/65] clk: si5351: clkout: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5351 clkout clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index bfab05f4fe28..11aaa934da29 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1037,11 +1037,12 @@ static unsigned long si5351_clkout_recalc_rate(struct clk_hw *hw,
 	return parent_rate >> rdiv;
 }
 
-static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
-				     unsigned long *parent_rate)
+static int si5351_clkout_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned char rdiv;
 
 	/* clkout6/7 can only handle output freqencies < 150MHz */
@@ -1063,13 +1064,13 @@ static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
 			rdiv += 1;
 			rate *= 2;
 		}
-		*parent_rate = rate;
+		req->best_parent_rate = rate;
 	} else {
 		unsigned long new_rate, new_err, err;
 
 		/* round to closed rdiv */
 		rdiv = SI5351_OUTPUT_CLK_DIV_1;
-		new_rate = *parent_rate;
+		new_rate = req->best_parent_rate;
 		err = abs(new_rate - rate);
 		do {
 			new_rate >>= 1;
@@ -1080,14 +1081,15 @@ static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
 			err = new_err;
 		} while (1);
 	}
-	rate = *parent_rate >> rdiv;
+	rate = req->best_parent_rate >> rdiv;
 
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: rdiv = %u, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), (1 << rdiv),
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5351_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -1147,7 +1149,7 @@ static const struct clk_ops si5351_clkout_ops = {
 	.set_parent = si5351_clkout_set_parent,
 	.get_parent = si5351_clkout_get_parent,
 	.recalc_rate = si5351_clkout_recalc_rate,
-	.round_rate = si5351_clkout_round_rate,
+	.determine_rate = si5351_clkout_determine_rate,
 	.set_rate = si5351_clkout_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 53/65] clk: si5351: clkout: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The SI5351 clkout clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index bfab05f4fe28..11aaa934da29 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1037,11 +1037,12 @@ static unsigned long si5351_clkout_recalc_rate(struct clk_hw *hw,
 	return parent_rate >> rdiv;
 }
 
-static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
-				     unsigned long *parent_rate)
+static int si5351_clkout_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned char rdiv;
 
 	/* clkout6/7 can only handle output freqencies < 150MHz */
@@ -1063,13 +1064,13 @@ static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
 			rdiv += 1;
 			rate *= 2;
 		}
-		*parent_rate = rate;
+		req->best_parent_rate = rate;
 	} else {
 		unsigned long new_rate, new_err, err;
 
 		/* round to closed rdiv */
 		rdiv = SI5351_OUTPUT_CLK_DIV_1;
-		new_rate = *parent_rate;
+		new_rate = req->best_parent_rate;
 		err = abs(new_rate - rate);
 		do {
 			new_rate >>= 1;
@@ -1080,14 +1081,15 @@ static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
 			err = new_err;
 		} while (1);
 	}
-	rate = *parent_rate >> rdiv;
+	rate = req->best_parent_rate >> rdiv;
 
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: rdiv = %u, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), (1 << rdiv),
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5351_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -1147,7 +1149,7 @@ static const struct clk_ops si5351_clkout_ops = {
 	.set_parent = si5351_clkout_set_parent,
 	.get_parent = si5351_clkout_get_parent,
 	.recalc_rate = si5351_clkout_recalc_rate,
-	.round_rate = si5351_clkout_round_rate,
+	.determine_rate = si5351_clkout_determine_rate,
 	.set_rate = si5351_clkout_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 53/65] clk: si5351: clkout: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The SI5351 clkout clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk-si5351.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index bfab05f4fe28..11aaa934da29 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1037,11 +1037,12 @@ static unsigned long si5351_clkout_recalc_rate(struct clk_hw *hw,
 	return parent_rate >> rdiv;
 }
 
-static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
-				     unsigned long *parent_rate)
+static int si5351_clkout_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct si5351_hw_data *hwdata =
 		container_of(hw, struct si5351_hw_data, hw);
+	unsigned long rate = req->rate;
 	unsigned char rdiv;
 
 	/* clkout6/7 can only handle output freqencies < 150MHz */
@@ -1063,13 +1064,13 @@ static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
 			rdiv += 1;
 			rate *= 2;
 		}
-		*parent_rate = rate;
+		req->best_parent_rate = rate;
 	} else {
 		unsigned long new_rate, new_err, err;
 
 		/* round to closed rdiv */
 		rdiv = SI5351_OUTPUT_CLK_DIV_1;
-		new_rate = *parent_rate;
+		new_rate = req->best_parent_rate;
 		err = abs(new_rate - rate);
 		do {
 			new_rate >>= 1;
@@ -1080,14 +1081,15 @@ static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
 			err = new_err;
 		} while (1);
 	}
-	rate = *parent_rate >> rdiv;
+	rate = req->best_parent_rate >> rdiv;
 
 	dev_dbg(&hwdata->drvdata->client->dev,
 		"%s - %s: rdiv = %u, parent_rate = %lu, rate = %lu\n",
 		__func__, clk_hw_get_name(hw), (1 << rdiv),
-		*parent_rate, rate);
+		req->best_parent_rate, rate);
 
-	return rate;
+	req->rate = rate;
+	return 0;
 }
 
 static int si5351_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -1147,7 +1149,7 @@ static const struct clk_ops si5351_clkout_ops = {
 	.set_parent = si5351_clkout_set_parent,
 	.get_parent = si5351_clkout_get_parent,
 	.recalc_rate = si5351_clkout_recalc_rate,
-	.round_rate = si5351_clkout_round_rate,
+	.determine_rate = si5351_clkout_determine_rate,
 	.set_rate = si5351_clkout_set_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index 4c1cc59bba53..f60c97091818 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -462,10 +462,12 @@ static unsigned long da8xx_usb0_clk48_recalc_rate(struct clk_hw *hw,
 	return 48000000;
 }
 
-static long da8xx_usb0_clk48_round_rate(struct clk_hw *hw, unsigned long rate,
-					unsigned long *parent_rate)
+static int da8xx_usb0_clk48_determine_rate(struct clk_hw *hw,
+					   struct clk_rate_request *req)
 {
-	return 48000000;
+	req->rate = 48000000;
+
+	return 0;
 }
 
 static int da8xx_usb0_clk48_set_parent(struct clk_hw *hw, u8 index)
@@ -494,7 +496,7 @@ static const struct clk_ops da8xx_usb0_clk48_ops = {
 	.disable	= da8xx_usb0_clk48_disable,
 	.is_enabled	= da8xx_usb0_clk48_is_enabled,
 	.recalc_rate	= da8xx_usb0_clk48_recalc_rate,
-	.round_rate	= da8xx_usb0_clk48_round_rate,
+	.determine_rate	= da8xx_usb0_clk48_determine_rate,
 	.set_parent	= da8xx_usb0_clk48_set_parent,
 	.get_parent	= da8xx_usb0_clk48_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index 4c1cc59bba53..f60c97091818 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -462,10 +462,12 @@ static unsigned long da8xx_usb0_clk48_recalc_rate(struct clk_hw *hw,
 	return 48000000;
 }
 
-static long da8xx_usb0_clk48_round_rate(struct clk_hw *hw, unsigned long rate,
-					unsigned long *parent_rate)
+static int da8xx_usb0_clk48_determine_rate(struct clk_hw *hw,
+					   struct clk_rate_request *req)
 {
-	return 48000000;
+	req->rate = 48000000;
+
+	return 0;
 }
 
 static int da8xx_usb0_clk48_set_parent(struct clk_hw *hw, u8 index)
@@ -494,7 +496,7 @@ static const struct clk_ops da8xx_usb0_clk48_ops = {
 	.disable	= da8xx_usb0_clk48_disable,
 	.is_enabled	= da8xx_usb0_clk48_is_enabled,
 	.recalc_rate	= da8xx_usb0_clk48_recalc_rate,
-	.round_rate	= da8xx_usb0_clk48_round_rate,
+	.determine_rate	= da8xx_usb0_clk48_determine_rate,
 	.set_parent	= da8xx_usb0_clk48_set_parent,
 	.get_parent	= da8xx_usb0_clk48_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index 4c1cc59bba53..f60c97091818 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -462,10 +462,12 @@ static unsigned long da8xx_usb0_clk48_recalc_rate(struct clk_hw *hw,
 	return 48000000;
 }
 
-static long da8xx_usb0_clk48_round_rate(struct clk_hw *hw, unsigned long rate,
-					unsigned long *parent_rate)
+static int da8xx_usb0_clk48_determine_rate(struct clk_hw *hw,
+					   struct clk_rate_request *req)
 {
-	return 48000000;
+	req->rate = 48000000;
+
+	return 0;
 }
 
 static int da8xx_usb0_clk48_set_parent(struct clk_hw *hw, u8 index)
@@ -494,7 +496,7 @@ static const struct clk_ops da8xx_usb0_clk48_ops = {
 	.disable	= da8xx_usb0_clk48_disable,
 	.is_enabled	= da8xx_usb0_clk48_is_enabled,
 	.recalc_rate	= da8xx_usb0_clk48_recalc_rate,
-	.round_rate	= da8xx_usb0_clk48_round_rate,
+	.determine_rate	= da8xx_usb0_clk48_determine_rate,
 	.set_parent	= da8xx_usb0_clk48_set_parent,
 	.get_parent	= da8xx_usb0_clk48_get_parent,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 55/65] clk: imx: scu: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The iMX SCU clocks implements a mux with a set_parent hook, but doesn't
provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. The round_rate()
implementation being shared with other clocks, it's not removed.

And if it was an oversight, the clock behaviour can be adjusted later
on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-scu.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 66e49fea5f8a..bbdc1b23f6f5 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -250,6 +250,23 @@ static unsigned long clk_scu_recalc_rate(struct clk_hw *hw,
 	return le32_to_cpu(msg.data.resp.rate);
 }
 
+/*
+ * clk_scu_determine_rate - Returns the closest rate for a SCU clock
+ * @hw: clock to round rate for
+ * @req: clock rate request
+ *
+ * Returns 0 on success, a negative error on failure
+ */
+static int clk_scu_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
+{
+	/*
+	 * Assume we support all the requested rate and let the SCU firmware
+	 * to handle the left work
+	 */
+	return 0;
+}
+
 /*
  * clk_scu_round_rate - Round clock rate for a SCU clock
  * @hw: clock to round rate for
@@ -425,7 +442,7 @@ static void clk_scu_unprepare(struct clk_hw *hw)
 
 static const struct clk_ops clk_scu_ops = {
 	.recalc_rate = clk_scu_recalc_rate,
-	.round_rate = clk_scu_round_rate,
+	.determine_rate = clk_scu_determine_rate,
 	.set_rate = clk_scu_set_rate,
 	.get_parent = clk_scu_get_parent,
 	.set_parent = clk_scu_set_parent,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 55/65] clk: imx: scu: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The iMX SCU clocks implements a mux with a set_parent hook, but doesn't
provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. The round_rate()
implementation being shared with other clocks, it's not removed.

And if it was an oversight, the clock behaviour can be adjusted later
on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-scu.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 66e49fea5f8a..bbdc1b23f6f5 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -250,6 +250,23 @@ static unsigned long clk_scu_recalc_rate(struct clk_hw *hw,
 	return le32_to_cpu(msg.data.resp.rate);
 }
 
+/*
+ * clk_scu_determine_rate - Returns the closest rate for a SCU clock
+ * @hw: clock to round rate for
+ * @req: clock rate request
+ *
+ * Returns 0 on success, a negative error on failure
+ */
+static int clk_scu_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
+{
+	/*
+	 * Assume we support all the requested rate and let the SCU firmware
+	 * to handle the left work
+	 */
+	return 0;
+}
+
 /*
  * clk_scu_round_rate - Round clock rate for a SCU clock
  * @hw: clock to round rate for
@@ -425,7 +442,7 @@ static void clk_scu_unprepare(struct clk_hw *hw)
 
 static const struct clk_ops clk_scu_ops = {
 	.recalc_rate = clk_scu_recalc_rate,
-	.round_rate = clk_scu_round_rate,
+	.determine_rate = clk_scu_determine_rate,
 	.set_rate = clk_scu_set_rate,
 	.get_parent = clk_scu_get_parent,
 	.set_parent = clk_scu_set_parent,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 55/65] clk: imx: scu: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The iMX SCU clocks implements a mux with a set_parent hook, but doesn't
provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. The round_rate()
implementation being shared with other clocks, it's not removed.

And if it was an oversight, the clock behaviour can be adjusted later
on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/imx/clk-scu.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 66e49fea5f8a..bbdc1b23f6f5 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -250,6 +250,23 @@ static unsigned long clk_scu_recalc_rate(struct clk_hw *hw,
 	return le32_to_cpu(msg.data.resp.rate);
 }
 
+/*
+ * clk_scu_determine_rate - Returns the closest rate for a SCU clock
+ * @hw: clock to round rate for
+ * @req: clock rate request
+ *
+ * Returns 0 on success, a negative error on failure
+ */
+static int clk_scu_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
+{
+	/*
+	 * Assume we support all the requested rate and let the SCU firmware
+	 * to handle the left work
+	 */
+	return 0;
+}
+
 /*
  * clk_scu_round_rate - Round clock rate for a SCU clock
  * @hw: clock to round rate for
@@ -425,7 +442,7 @@ static void clk_scu_unprepare(struct clk_hw *hw)
 
 static const struct clk_ops clk_scu_ops = {
 	.recalc_rate = clk_scu_recalc_rate,
-	.round_rate = clk_scu_round_rate,
+	.determine_rate = clk_scu_determine_rate,
 	.set_rate = clk_scu_set_rate,
 	.get_parent = clk_scu_get_parent,
 	.set_parent = clk_scu_set_parent,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Ingenic CGU clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ingenic/cgu.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
index 1f7ba30f5a1b..0c9c8344ad11 100644
--- a/drivers/clk/ingenic/cgu.c
+++ b/drivers/clk/ingenic/cgu.c
@@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
 	return div;
 }
 
-static long
-ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
-		       unsigned long *parent_rate)
+static int ingenic_clk_determine_rate(struct clk_hw *hw,
+				      struct clk_rate_request *req)
 {
 	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
 	const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk);
 	unsigned int div = 1;
 
 	if (clk_info->type & CGU_CLK_DIV)
-		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
+		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
+					   req->rate);
 	else if (clk_info->type & CGU_CLK_FIXDIV)
 		div = clk_info->fixdiv.div;
 	else if (clk_hw_can_set_rate_parent(hw))
-		*parent_rate = req_rate;
+		req->best_parent_rate = req->rate;
 
-	return DIV_ROUND_UP(*parent_rate, div);
+	req->rate = DIV_ROUND_UP(req->best_parent_rate, div);
+	return 0;
 }
 
 static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu,
@@ -626,7 +627,7 @@ static const struct clk_ops ingenic_clk_ops = {
 	.set_parent = ingenic_clk_set_parent,
 
 	.recalc_rate = ingenic_clk_recalc_rate,
-	.round_rate = ingenic_clk_round_rate,
+	.determine_rate = ingenic_clk_determine_rate,
 	.set_rate = ingenic_clk_set_rate,
 
 	.enable = ingenic_clk_enable,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Ingenic CGU clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ingenic/cgu.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
index 1f7ba30f5a1b..0c9c8344ad11 100644
--- a/drivers/clk/ingenic/cgu.c
+++ b/drivers/clk/ingenic/cgu.c
@@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
 	return div;
 }
 
-static long
-ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
-		       unsigned long *parent_rate)
+static int ingenic_clk_determine_rate(struct clk_hw *hw,
+				      struct clk_rate_request *req)
 {
 	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
 	const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk);
 	unsigned int div = 1;
 
 	if (clk_info->type & CGU_CLK_DIV)
-		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
+		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
+					   req->rate);
 	else if (clk_info->type & CGU_CLK_FIXDIV)
 		div = clk_info->fixdiv.div;
 	else if (clk_hw_can_set_rate_parent(hw))
-		*parent_rate = req_rate;
+		req->best_parent_rate = req->rate;
 
-	return DIV_ROUND_UP(*parent_rate, div);
+	req->rate = DIV_ROUND_UP(req->best_parent_rate, div);
+	return 0;
 }
 
 static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu,
@@ -626,7 +627,7 @@ static const struct clk_ops ingenic_clk_ops = {
 	.set_parent = ingenic_clk_set_parent,
 
 	.recalc_rate = ingenic_clk_recalc_rate,
-	.round_rate = ingenic_clk_round_rate,
+	.determine_rate = ingenic_clk_determine_rate,
 	.set_rate = ingenic_clk_set_rate,
 
 	.enable = ingenic_clk_enable,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Ingenic CGU clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ingenic/cgu.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
index 1f7ba30f5a1b..0c9c8344ad11 100644
--- a/drivers/clk/ingenic/cgu.c
+++ b/drivers/clk/ingenic/cgu.c
@@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
 	return div;
 }
 
-static long
-ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
-		       unsigned long *parent_rate)
+static int ingenic_clk_determine_rate(struct clk_hw *hw,
+				      struct clk_rate_request *req)
 {
 	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
 	const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk);
 	unsigned int div = 1;
 
 	if (clk_info->type & CGU_CLK_DIV)
-		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
+		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
+					   req->rate);
 	else if (clk_info->type & CGU_CLK_FIXDIV)
 		div = clk_info->fixdiv.div;
 	else if (clk_hw_can_set_rate_parent(hw))
-		*parent_rate = req_rate;
+		req->best_parent_rate = req->rate;
 
-	return DIV_ROUND_UP(*parent_rate, div);
+	req->rate = DIV_ROUND_UP(req->best_parent_rate, div);
+	return 0;
 }
 
 static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu,
@@ -626,7 +627,7 @@ static const struct clk_ops ingenic_clk_ops = {
 	.set_parent = ingenic_clk_set_parent,
 
 	.recalc_rate = ingenic_clk_recalc_rate,
-	.round_rate = ingenic_clk_round_rate,
+	.determine_rate = ingenic_clk_determine_rate,
 	.set_rate = ingenic_clk_set_rate,
 
 	.enable = ingenic_clk_enable,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 57/65] clk: ingenic: tcu: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Ingenic TCU clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ingenic/tcu.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c
index d5544cbc5c48..7d04ef40b7cf 100644
--- a/drivers/clk/ingenic/tcu.c
+++ b/drivers/clk/ingenic/tcu.c
@@ -178,18 +178,21 @@ static u8 ingenic_tcu_get_prescale(unsigned long rate, unsigned long req_rate)
 	return 5; /* /1024 divider */
 }
 
-static long ingenic_tcu_round_rate(struct clk_hw *hw, unsigned long req_rate,
-		unsigned long *parent_rate)
+static int ingenic_tcu_determine_rate(struct clk_hw *hw,
+				      struct clk_rate_request *req)
 {
-	unsigned long rate = *parent_rate;
+	unsigned long rate = req->best_parent_rate;
 	u8 prescale;
 
-	if (req_rate > rate)
-		return rate;
+	if (req->rate > rate) {
+		req->rate = rate;
+		return 0;
+	}
 
-	prescale = ingenic_tcu_get_prescale(rate, req_rate);
+	prescale = ingenic_tcu_get_prescale(rate, req->rate);
 
-	return rate >> (prescale * 2);
+	req->rate = rate >> (prescale * 2);
+	return 0;
 }
 
 static int ingenic_tcu_set_rate(struct clk_hw *hw, unsigned long req_rate,
@@ -219,7 +222,7 @@ static const struct clk_ops ingenic_tcu_clk_ops = {
 	.set_parent	= ingenic_tcu_set_parent,
 
 	.recalc_rate	= ingenic_tcu_recalc_rate,
-	.round_rate	= ingenic_tcu_round_rate,
+	.determine_rate	= ingenic_tcu_determine_rate,
 	.set_rate	= ingenic_tcu_set_rate,
 
 	.enable		= ingenic_tcu_enable,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 57/65] clk: ingenic: tcu: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Ingenic TCU clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ingenic/tcu.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c
index d5544cbc5c48..7d04ef40b7cf 100644
--- a/drivers/clk/ingenic/tcu.c
+++ b/drivers/clk/ingenic/tcu.c
@@ -178,18 +178,21 @@ static u8 ingenic_tcu_get_prescale(unsigned long rate, unsigned long req_rate)
 	return 5; /* /1024 divider */
 }
 
-static long ingenic_tcu_round_rate(struct clk_hw *hw, unsigned long req_rate,
-		unsigned long *parent_rate)
+static int ingenic_tcu_determine_rate(struct clk_hw *hw,
+				      struct clk_rate_request *req)
 {
-	unsigned long rate = *parent_rate;
+	unsigned long rate = req->best_parent_rate;
 	u8 prescale;
 
-	if (req_rate > rate)
-		return rate;
+	if (req->rate > rate) {
+		req->rate = rate;
+		return 0;
+	}
 
-	prescale = ingenic_tcu_get_prescale(rate, req_rate);
+	prescale = ingenic_tcu_get_prescale(rate, req->rate);
 
-	return rate >> (prescale * 2);
+	req->rate = rate >> (prescale * 2);
+	return 0;
 }
 
 static int ingenic_tcu_set_rate(struct clk_hw *hw, unsigned long req_rate,
@@ -219,7 +222,7 @@ static const struct clk_ops ingenic_tcu_clk_ops = {
 	.set_parent	= ingenic_tcu_set_parent,
 
 	.recalc_rate	= ingenic_tcu_recalc_rate,
-	.round_rate	= ingenic_tcu_round_rate,
+	.determine_rate	= ingenic_tcu_determine_rate,
 	.set_rate	= ingenic_tcu_set_rate,
 
 	.enable		= ingenic_tcu_enable,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 57/65] clk: ingenic: tcu: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Ingenic TCU clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/ingenic/tcu.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c
index d5544cbc5c48..7d04ef40b7cf 100644
--- a/drivers/clk/ingenic/tcu.c
+++ b/drivers/clk/ingenic/tcu.c
@@ -178,18 +178,21 @@ static u8 ingenic_tcu_get_prescale(unsigned long rate, unsigned long req_rate)
 	return 5; /* /1024 divider */
 }
 
-static long ingenic_tcu_round_rate(struct clk_hw *hw, unsigned long req_rate,
-		unsigned long *parent_rate)
+static int ingenic_tcu_determine_rate(struct clk_hw *hw,
+				      struct clk_rate_request *req)
 {
-	unsigned long rate = *parent_rate;
+	unsigned long rate = req->best_parent_rate;
 	u8 prescale;
 
-	if (req_rate > rate)
-		return rate;
+	if (req->rate > rate) {
+		req->rate = rate;
+		return 0;
+	}
 
-	prescale = ingenic_tcu_get_prescale(rate, req_rate);
+	prescale = ingenic_tcu_get_prescale(rate, req->rate);
 
-	return rate >> (prescale * 2);
+	req->rate = rate >> (prescale * 2);
+	return 0;
 }
 
 static int ingenic_tcu_set_rate(struct clk_hw *hw, unsigned long req_rate,
@@ -219,7 +222,7 @@ static const struct clk_ops ingenic_tcu_clk_ops = {
 	.set_parent	= ingenic_tcu_set_parent,
 
 	.recalc_rate	= ingenic_tcu_recalc_rate,
-	.round_rate	= ingenic_tcu_round_rate,
+	.determine_rate	= ingenic_tcu_determine_rate,
 	.set_rate	= ingenic_tcu_set_rate,
 
 	.enable		= ingenic_tcu_enable,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 58/65] clk: sprd: composite: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Spreadtrum composite clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/sprd/composite.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c
index ebb644820b1e..d3a852720c07 100644
--- a/drivers/clk/sprd/composite.c
+++ b/drivers/clk/sprd/composite.c
@@ -9,13 +9,19 @@
 
 #include "composite.h"
 
-static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int sprd_comp_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	struct sprd_comp *cc = hw_to_sprd_comp(hw);
+	unsigned long rate;
 
-	return sprd_div_helper_round_rate(&cc->common, &cc->div,
-					 rate, parent_rate);
+	rate = sprd_div_helper_round_rate(&cc->common, &cc->div,
+					  req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
@@ -53,7 +59,7 @@ const struct clk_ops sprd_comp_ops = {
 	.get_parent	= sprd_comp_get_parent,
 	.set_parent	= sprd_comp_set_parent,
 
-	.round_rate	= sprd_comp_round_rate,
+	.determine_rate	= sprd_comp_determine_rate,
 	.recalc_rate	= sprd_comp_recalc_rate,
 	.set_rate	= sprd_comp_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 58/65] clk: sprd: composite: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Spreadtrum composite clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/sprd/composite.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c
index ebb644820b1e..d3a852720c07 100644
--- a/drivers/clk/sprd/composite.c
+++ b/drivers/clk/sprd/composite.c
@@ -9,13 +9,19 @@
 
 #include "composite.h"
 
-static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int sprd_comp_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	struct sprd_comp *cc = hw_to_sprd_comp(hw);
+	unsigned long rate;
 
-	return sprd_div_helper_round_rate(&cc->common, &cc->div,
-					 rate, parent_rate);
+	rate = sprd_div_helper_round_rate(&cc->common, &cc->div,
+					  req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
@@ -53,7 +59,7 @@ const struct clk_ops sprd_comp_ops = {
 	.get_parent	= sprd_comp_get_parent,
 	.set_parent	= sprd_comp_set_parent,
 
-	.round_rate	= sprd_comp_round_rate,
+	.determine_rate	= sprd_comp_determine_rate,
 	.recalc_rate	= sprd_comp_recalc_rate,
 	.set_rate	= sprd_comp_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 58/65] clk: sprd: composite: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Spreadtrum composite clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/sprd/composite.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c
index ebb644820b1e..d3a852720c07 100644
--- a/drivers/clk/sprd/composite.c
+++ b/drivers/clk/sprd/composite.c
@@ -9,13 +9,19 @@
 
 #include "composite.h"
 
-static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int sprd_comp_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	struct sprd_comp *cc = hw_to_sprd_comp(hw);
+	unsigned long rate;
 
-	return sprd_div_helper_round_rate(&cc->common, &cc->div,
-					 rate, parent_rate);
+	rate = sprd_div_helper_round_rate(&cc->common, &cc->div,
+					  req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
@@ -53,7 +59,7 @@ const struct clk_ops sprd_comp_ops = {
 	.get_parent	= sprd_comp_get_parent,
 	.set_parent	= sprd_comp_set_parent,
 
-	.round_rate	= sprd_comp_round_rate,
+	.determine_rate	= sprd_comp_determine_rate,
 	.recalc_rate	= sprd_comp_recalc_rate,
 	.set_rate	= sprd_comp_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 59/65] clk: st: flexgen: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The ST Flexgen clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/st/clk-flexgen.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index 7ae4f656191e..5292208c4dd8 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -119,20 +119,21 @@ clk_best_div(unsigned long parent_rate, unsigned long rate)
 	return parent_rate / rate + ((rate > (2*(parent_rate % rate))) ? 0 : 1);
 }
 
-static long flexgen_round_rate(struct clk_hw *hw, unsigned long rate,
-				   unsigned long *prate)
+static int flexgen_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
 {
 	unsigned long div;
 
 	/* Round div according to exact prate and wished rate */
-	div = clk_best_div(*prate, rate);
+	div = clk_best_div(req->best_parent_rate, req->rate);
 
 	if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
-		*prate = rate * div;
-		return rate;
+		req->best_parent_rate = req->rate * div;
+		return 0;
 	}
 
-	return *prate / div;
+	req->rate = req->best_parent_rate / div;
+	return 0;
 }
 
 static unsigned long flexgen_recalc_rate(struct clk_hw *hw,
@@ -197,7 +198,7 @@ static const struct clk_ops flexgen_ops = {
 	.is_enabled = flexgen_is_enabled,
 	.get_parent = flexgen_get_parent,
 	.set_parent = flexgen_set_parent,
-	.round_rate = flexgen_round_rate,
+	.determine_rate = flexgen_determine_rate,
 	.recalc_rate = flexgen_recalc_rate,
 	.set_rate = flexgen_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 59/65] clk: st: flexgen: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The ST Flexgen clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/st/clk-flexgen.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index 7ae4f656191e..5292208c4dd8 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -119,20 +119,21 @@ clk_best_div(unsigned long parent_rate, unsigned long rate)
 	return parent_rate / rate + ((rate > (2*(parent_rate % rate))) ? 0 : 1);
 }
 
-static long flexgen_round_rate(struct clk_hw *hw, unsigned long rate,
-				   unsigned long *prate)
+static int flexgen_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
 {
 	unsigned long div;
 
 	/* Round div according to exact prate and wished rate */
-	div = clk_best_div(*prate, rate);
+	div = clk_best_div(req->best_parent_rate, req->rate);
 
 	if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
-		*prate = rate * div;
-		return rate;
+		req->best_parent_rate = req->rate * div;
+		return 0;
 	}
 
-	return *prate / div;
+	req->rate = req->best_parent_rate / div;
+	return 0;
 }
 
 static unsigned long flexgen_recalc_rate(struct clk_hw *hw,
@@ -197,7 +198,7 @@ static const struct clk_ops flexgen_ops = {
 	.is_enabled = flexgen_is_enabled,
 	.get_parent = flexgen_get_parent,
 	.set_parent = flexgen_set_parent,
-	.round_rate = flexgen_round_rate,
+	.determine_rate = flexgen_determine_rate,
 	.recalc_rate = flexgen_recalc_rate,
 	.set_rate = flexgen_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 59/65] clk: st: flexgen: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The ST Flexgen clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/st/clk-flexgen.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index 7ae4f656191e..5292208c4dd8 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -119,20 +119,21 @@ clk_best_div(unsigned long parent_rate, unsigned long rate)
 	return parent_rate / rate + ((rate > (2*(parent_rate % rate))) ? 0 : 1);
 }
 
-static long flexgen_round_rate(struct clk_hw *hw, unsigned long rate,
-				   unsigned long *prate)
+static int flexgen_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
 {
 	unsigned long div;
 
 	/* Round div according to exact prate and wished rate */
-	div = clk_best_div(*prate, rate);
+	div = clk_best_div(req->best_parent_rate, req->rate);
 
 	if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
-		*prate = rate * div;
-		return rate;
+		req->best_parent_rate = req->rate * div;
+		return 0;
 	}
 
-	return *prate / div;
+	req->rate = req->best_parent_rate / div;
+	return 0;
 }
 
 static unsigned long flexgen_recalc_rate(struct clk_hw *hw,
@@ -197,7 +198,7 @@ static const struct clk_ops flexgen_ops = {
 	.is_enabled = flexgen_is_enabled,
 	.get_parent = flexgen_get_parent,
 	.set_parent = flexgen_set_parent,
-	.round_rate = flexgen_round_rate,
+	.determine_rate = flexgen_determine_rate,
 	.recalc_rate = flexgen_recalc_rate,
 	.set_rate = flexgen_set_rate,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 60/65] clk: stm32: composite: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The STM32 composite clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/stm32/clk-stm32-core.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index 3247539683c9..4027ca7d9806 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -349,14 +349,15 @@ static int clk_stm32_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 	return ret;
 }
 
-static long clk_stm32_divider_round_rate(struct clk_hw *hw, unsigned long rate,
-					 unsigned long *prate)
+static int clk_stm32_divider_determine_rate(struct clk_hw *hw,
+					    struct clk_rate_request *req)
 {
 	struct clk_stm32_div *div = to_clk_stm32_divider(hw);
 	const struct stm32_div_cfg *divider;
+	unsigned long rate;
 
 	if (div->div_id == NO_STM32_DIV)
-		return rate;
+		return 0;
 
 	divider = &div->clock_data->dividers[div->div_id];
 
@@ -367,14 +368,24 @@ static long clk_stm32_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 		val =  readl(div->base + divider->offset) >> divider->shift;
 		val &= clk_div_mask(divider->width);
 
-		return divider_ro_round_rate(hw, rate, prate, divider->table,
-				divider->width, divider->flags,
-				val);
+		rate = divider_ro_round_rate(hw, req->rate, &req->best_parent_rate,
+					     divider->table, divider->width, divider->flags,
+					     val);
+		if (rate < 0)
+			return rate;
+
+		req->rate = rate;
+		return 0;
 	}
 
-	return divider_round_rate_parent(hw, clk_hw_get_parent(hw),
-					 rate, prate, divider->table,
-					 divider->width, divider->flags);
+	rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
+					 req->rate, &req->best_parent_rate,
+					 divider->table, divider->width, divider->flags);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long clk_stm32_divider_recalc_rate(struct clk_hw *hw,
@@ -602,7 +613,7 @@ static void clk_stm32_composite_disable_unused(struct clk_hw *hw)
 const struct clk_ops clk_stm32_composite_ops = {
 	.set_rate	= clk_stm32_composite_set_rate,
 	.recalc_rate	= clk_stm32_composite_recalc_rate,
-	.round_rate	= clk_stm32_composite_round_rate,
+	.determine_rate	= clk_stm32_composite_determine_rate,
 	.get_parent	= clk_stm32_composite_get_parent,
 	.set_parent	= clk_stm32_composite_set_parent,
 	.enable		= clk_stm32_composite_gate_enable,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 60/65] clk: stm32: composite: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The STM32 composite clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/stm32/clk-stm32-core.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index 3247539683c9..4027ca7d9806 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -349,14 +349,15 @@ static int clk_stm32_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 	return ret;
 }
 
-static long clk_stm32_divider_round_rate(struct clk_hw *hw, unsigned long rate,
-					 unsigned long *prate)
+static int clk_stm32_divider_determine_rate(struct clk_hw *hw,
+					    struct clk_rate_request *req)
 {
 	struct clk_stm32_div *div = to_clk_stm32_divider(hw);
 	const struct stm32_div_cfg *divider;
+	unsigned long rate;
 
 	if (div->div_id == NO_STM32_DIV)
-		return rate;
+		return 0;
 
 	divider = &div->clock_data->dividers[div->div_id];
 
@@ -367,14 +368,24 @@ static long clk_stm32_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 		val =  readl(div->base + divider->offset) >> divider->shift;
 		val &= clk_div_mask(divider->width);
 
-		return divider_ro_round_rate(hw, rate, prate, divider->table,
-				divider->width, divider->flags,
-				val);
+		rate = divider_ro_round_rate(hw, req->rate, &req->best_parent_rate,
+					     divider->table, divider->width, divider->flags,
+					     val);
+		if (rate < 0)
+			return rate;
+
+		req->rate = rate;
+		return 0;
 	}
 
-	return divider_round_rate_parent(hw, clk_hw_get_parent(hw),
-					 rate, prate, divider->table,
-					 divider->width, divider->flags);
+	rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
+					 req->rate, &req->best_parent_rate,
+					 divider->table, divider->width, divider->flags);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long clk_stm32_divider_recalc_rate(struct clk_hw *hw,
@@ -602,7 +613,7 @@ static void clk_stm32_composite_disable_unused(struct clk_hw *hw)
 const struct clk_ops clk_stm32_composite_ops = {
 	.set_rate	= clk_stm32_composite_set_rate,
 	.recalc_rate	= clk_stm32_composite_recalc_rate,
-	.round_rate	= clk_stm32_composite_round_rate,
+	.determine_rate	= clk_stm32_composite_determine_rate,
 	.get_parent	= clk_stm32_composite_get_parent,
 	.set_parent	= clk_stm32_composite_set_parent,
 	.enable		= clk_stm32_composite_gate_enable,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 60/65] clk: stm32: composite: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The STM32 composite clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/stm32/clk-stm32-core.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index 3247539683c9..4027ca7d9806 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -349,14 +349,15 @@ static int clk_stm32_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 	return ret;
 }
 
-static long clk_stm32_divider_round_rate(struct clk_hw *hw, unsigned long rate,
-					 unsigned long *prate)
+static int clk_stm32_divider_determine_rate(struct clk_hw *hw,
+					    struct clk_rate_request *req)
 {
 	struct clk_stm32_div *div = to_clk_stm32_divider(hw);
 	const struct stm32_div_cfg *divider;
+	unsigned long rate;
 
 	if (div->div_id == NO_STM32_DIV)
-		return rate;
+		return 0;
 
 	divider = &div->clock_data->dividers[div->div_id];
 
@@ -367,14 +368,24 @@ static long clk_stm32_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 		val =  readl(div->base + divider->offset) >> divider->shift;
 		val &= clk_div_mask(divider->width);
 
-		return divider_ro_round_rate(hw, rate, prate, divider->table,
-				divider->width, divider->flags,
-				val);
+		rate = divider_ro_round_rate(hw, req->rate, &req->best_parent_rate,
+					     divider->table, divider->width, divider->flags,
+					     val);
+		if (rate < 0)
+			return rate;
+
+		req->rate = rate;
+		return 0;
 	}
 
-	return divider_round_rate_parent(hw, clk_hw_get_parent(hw),
-					 rate, prate, divider->table,
-					 divider->width, divider->flags);
+	rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw),
+					 req->rate, &req->best_parent_rate,
+					 divider->table, divider->width, divider->flags);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long clk_stm32_divider_recalc_rate(struct clk_hw *hw,
@@ -602,7 +613,7 @@ static void clk_stm32_composite_disable_unused(struct clk_hw *hw)
 const struct clk_ops clk_stm32_composite_ops = {
 	.set_rate	= clk_stm32_composite_set_rate,
 	.recalc_rate	= clk_stm32_composite_recalc_rate,
-	.round_rate	= clk_stm32_composite_round_rate,
+	.determine_rate	= clk_stm32_composite_determine_rate,
 	.get_parent	= clk_stm32_composite_get_parent,
 	.set_parent	= clk_stm32_composite_set_parent,
 	.enable		= clk_stm32_composite_gate_enable,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 61/65] clk: tegra: periph: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra periph clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-periph.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index 367396c62259..ce8cab5f1978 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -45,16 +45,22 @@ static unsigned long clk_periph_recalc_rate(struct clk_hw *hw,
 	return div_ops->recalc_rate(div_hw, parent_rate);
 }
 
-static long clk_periph_round_rate(struct clk_hw *hw, unsigned long rate,
-				  unsigned long *prate)
+static int clk_periph_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct tegra_clk_periph *periph = to_clk_periph(hw);
 	const struct clk_ops *div_ops = periph->div_ops;
 	struct clk_hw *div_hw = &periph->divider.hw;
+	unsigned long rate;
 
 	__clk_hw_set_clk(div_hw, hw);
 
-	return div_ops->round_rate(div_hw, rate, prate);
+	rate = div_ops->round_rate(div_hw, req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static int clk_periph_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -130,7 +136,7 @@ const struct clk_ops tegra_clk_periph_ops = {
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.recalc_rate = clk_periph_recalc_rate,
-	.round_rate = clk_periph_round_rate,
+	.determine_rate = clk_periph_determine_rate,
 	.set_rate = clk_periph_set_rate,
 	.is_enabled = clk_periph_is_enabled,
 	.enable = clk_periph_enable,
@@ -154,7 +160,7 @@ static const struct clk_ops tegra_clk_periph_no_gate_ops = {
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.recalc_rate = clk_periph_recalc_rate,
-	.round_rate = clk_periph_round_rate,
+	.determine_rate = clk_periph_determine_rate,
 	.set_rate = clk_periph_set_rate,
 	.restore_context = clk_periph_restore_context,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 61/65] clk: tegra: periph: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Tegra periph clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-periph.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index 367396c62259..ce8cab5f1978 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -45,16 +45,22 @@ static unsigned long clk_periph_recalc_rate(struct clk_hw *hw,
 	return div_ops->recalc_rate(div_hw, parent_rate);
 }
 
-static long clk_periph_round_rate(struct clk_hw *hw, unsigned long rate,
-				  unsigned long *prate)
+static int clk_periph_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct tegra_clk_periph *periph = to_clk_periph(hw);
 	const struct clk_ops *div_ops = periph->div_ops;
 	struct clk_hw *div_hw = &periph->divider.hw;
+	unsigned long rate;
 
 	__clk_hw_set_clk(div_hw, hw);
 
-	return div_ops->round_rate(div_hw, rate, prate);
+	rate = div_ops->round_rate(div_hw, req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static int clk_periph_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -130,7 +136,7 @@ const struct clk_ops tegra_clk_periph_ops = {
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.recalc_rate = clk_periph_recalc_rate,
-	.round_rate = clk_periph_round_rate,
+	.determine_rate = clk_periph_determine_rate,
 	.set_rate = clk_periph_set_rate,
 	.is_enabled = clk_periph_is_enabled,
 	.enable = clk_periph_enable,
@@ -154,7 +160,7 @@ static const struct clk_ops tegra_clk_periph_no_gate_ops = {
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.recalc_rate = clk_periph_recalc_rate,
-	.round_rate = clk_periph_round_rate,
+	.determine_rate = clk_periph_determine_rate,
 	.set_rate = clk_periph_set_rate,
 	.restore_context = clk_periph_restore_context,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 61/65] clk: tegra: periph: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra periph clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-periph.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c
index 367396c62259..ce8cab5f1978 100644
--- a/drivers/clk/tegra/clk-periph.c
+++ b/drivers/clk/tegra/clk-periph.c
@@ -45,16 +45,22 @@ static unsigned long clk_periph_recalc_rate(struct clk_hw *hw,
 	return div_ops->recalc_rate(div_hw, parent_rate);
 }
 
-static long clk_periph_round_rate(struct clk_hw *hw, unsigned long rate,
-				  unsigned long *prate)
+static int clk_periph_determine_rate(struct clk_hw *hw,
+				     struct clk_rate_request *req)
 {
 	struct tegra_clk_periph *periph = to_clk_periph(hw);
 	const struct clk_ops *div_ops = periph->div_ops;
 	struct clk_hw *div_hw = &periph->divider.hw;
+	unsigned long rate;
 
 	__clk_hw_set_clk(div_hw, hw);
 
-	return div_ops->round_rate(div_hw, rate, prate);
+	rate = div_ops->round_rate(div_hw, req->rate, &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static int clk_periph_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -130,7 +136,7 @@ const struct clk_ops tegra_clk_periph_ops = {
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.recalc_rate = clk_periph_recalc_rate,
-	.round_rate = clk_periph_round_rate,
+	.determine_rate = clk_periph_determine_rate,
 	.set_rate = clk_periph_set_rate,
 	.is_enabled = clk_periph_is_enabled,
 	.enable = clk_periph_enable,
@@ -154,7 +160,7 @@ static const struct clk_ops tegra_clk_periph_no_gate_ops = {
 	.get_parent = clk_periph_get_parent,
 	.set_parent = clk_periph_set_parent,
 	.recalc_rate = clk_periph_recalc_rate,
-	.round_rate = clk_periph_round_rate,
+	.determine_rate = clk_periph_determine_rate,
 	.set_rate = clk_periph_set_rate,
 	.restore_context = clk_periph_restore_context,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 62/65] clk: tegra: super: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra super clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-super.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
index 8ad62e04fd8b..c035f0eb030d 100644
--- a/drivers/clk/tegra/clk-super.c
+++ b/drivers/clk/tegra/clk-super.c
@@ -142,15 +142,22 @@ static const struct clk_ops tegra_clk_super_mux_ops = {
 	.restore_context = clk_super_mux_restore_context,
 };
 
-static long clk_super_round_rate(struct clk_hw *hw, unsigned long rate,
-				 unsigned long *parent_rate)
+static int clk_super_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	struct tegra_clk_super_mux *super = to_clk_super_mux(hw);
 	struct clk_hw *div_hw = &super->frac_div.hw;
+	unsigned long rate;
 
 	__clk_hw_set_clk(div_hw, hw);
 
-	return super->div_ops->round_rate(div_hw, rate, parent_rate);
+	rate = super->div_ops->round_rate(div_hw, req->rate,
+					  &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long clk_super_recalc_rate(struct clk_hw *hw,
@@ -193,7 +200,7 @@ const struct clk_ops tegra_clk_super_ops = {
 	.get_parent = clk_super_get_parent,
 	.set_parent = clk_super_set_parent,
 	.set_rate = clk_super_set_rate,
-	.round_rate = clk_super_round_rate,
+	.determine_rate = clk_super_determine_rate,
 	.recalc_rate = clk_super_recalc_rate,
 	.restore_context = clk_super_restore_context,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 62/65] clk: tegra: super: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The Tegra super clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-super.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
index 8ad62e04fd8b..c035f0eb030d 100644
--- a/drivers/clk/tegra/clk-super.c
+++ b/drivers/clk/tegra/clk-super.c
@@ -142,15 +142,22 @@ static const struct clk_ops tegra_clk_super_mux_ops = {
 	.restore_context = clk_super_mux_restore_context,
 };
 
-static long clk_super_round_rate(struct clk_hw *hw, unsigned long rate,
-				 unsigned long *parent_rate)
+static int clk_super_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	struct tegra_clk_super_mux *super = to_clk_super_mux(hw);
 	struct clk_hw *div_hw = &super->frac_div.hw;
+	unsigned long rate;
 
 	__clk_hw_set_clk(div_hw, hw);
 
-	return super->div_ops->round_rate(div_hw, rate, parent_rate);
+	rate = super->div_ops->round_rate(div_hw, req->rate,
+					  &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long clk_super_recalc_rate(struct clk_hw *hw,
@@ -193,7 +200,7 @@ const struct clk_ops tegra_clk_super_ops = {
 	.get_parent = clk_super_get_parent,
 	.set_parent = clk_super_set_parent,
 	.set_rate = clk_super_set_rate,
-	.round_rate = clk_super_round_rate,
+	.determine_rate = clk_super_determine_rate,
 	.recalc_rate = clk_super_recalc_rate,
 	.restore_context = clk_super_restore_context,
 };

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 62/65] clk: tegra: super: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The Tegra super clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/tegra/clk-super.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
index 8ad62e04fd8b..c035f0eb030d 100644
--- a/drivers/clk/tegra/clk-super.c
+++ b/drivers/clk/tegra/clk-super.c
@@ -142,15 +142,22 @@ static const struct clk_ops tegra_clk_super_mux_ops = {
 	.restore_context = clk_super_mux_restore_context,
 };
 
-static long clk_super_round_rate(struct clk_hw *hw, unsigned long rate,
-				 unsigned long *parent_rate)
+static int clk_super_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	struct tegra_clk_super_mux *super = to_clk_super_mux(hw);
 	struct clk_hw *div_hw = &super->frac_div.hw;
+	unsigned long rate;
 
 	__clk_hw_set_clk(div_hw, hw);
 
-	return super->div_ops->round_rate(div_hw, rate, parent_rate);
+	rate = super->div_ops->round_rate(div_hw, req->rate,
+					  &req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static unsigned long clk_super_recalc_rate(struct clk_hw *hw,
@@ -193,7 +200,7 @@ const struct clk_ops tegra_clk_super_ops = {
 	.get_parent = clk_super_get_parent,
 	.set_parent = clk_super_set_parent,
 	.set_rate = clk_super_set_rate,
-	.round_rate = clk_super_round_rate,
+	.determine_rate = clk_super_determine_rate,
 	.recalc_rate = clk_super_recalc_rate,
 	.restore_context = clk_super_restore_context,
 };

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 63/65] ASoC: tlv320aic32x4: pll: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The tlv320aic32x4 PLL clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index 65b72373cb95..d8b8ea3eaa12 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -205,18 +205,23 @@ static unsigned long clk_aic32x4_pll_recalc_rate(struct clk_hw *hw,
 	return clk_aic32x4_pll_calc_rate(&settings, parent_rate);
 }
 
-static long clk_aic32x4_pll_round_rate(struct clk_hw *hw,
-			unsigned long rate,
-			unsigned long *parent_rate)
+static int clk_aic32x4_pll_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	struct clk_aic32x4_pll_muldiv settings;
+	unsigned long rate;
 	int ret;
 
-	ret = clk_aic32x4_pll_calc_muldiv(&settings, rate, *parent_rate);
+	ret = clk_aic32x4_pll_calc_muldiv(&settings, req->rate, req->best_parent_rate);
 	if (ret < 0)
-		return 0;
+		return -EINVAL;
 
-	return clk_aic32x4_pll_calc_rate(&settings, *parent_rate);
+	rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static int clk_aic32x4_pll_set_rate(struct clk_hw *hw,
@@ -267,7 +272,7 @@ static const struct clk_ops aic32x4_pll_ops = {
 	.unprepare = clk_aic32x4_pll_unprepare,
 	.is_prepared = clk_aic32x4_pll_is_prepared,
 	.recalc_rate = clk_aic32x4_pll_recalc_rate,
-	.round_rate = clk_aic32x4_pll_round_rate,
+	.determine_rate = clk_aic32x4_pll_determine_rate,
 	.set_rate = clk_aic32x4_pll_set_rate,
 	.set_parent = clk_aic32x4_pll_set_parent,
 	.get_parent = clk_aic32x4_pll_get_parent,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 63/65] ASoC: tlv320aic32x4: pll: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The tlv320aic32x4 PLL clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index 65b72373cb95..d8b8ea3eaa12 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -205,18 +205,23 @@ static unsigned long clk_aic32x4_pll_recalc_rate(struct clk_hw *hw,
 	return clk_aic32x4_pll_calc_rate(&settings, parent_rate);
 }
 
-static long clk_aic32x4_pll_round_rate(struct clk_hw *hw,
-			unsigned long rate,
-			unsigned long *parent_rate)
+static int clk_aic32x4_pll_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	struct clk_aic32x4_pll_muldiv settings;
+	unsigned long rate;
 	int ret;
 
-	ret = clk_aic32x4_pll_calc_muldiv(&settings, rate, *parent_rate);
+	ret = clk_aic32x4_pll_calc_muldiv(&settings, req->rate, req->best_parent_rate);
 	if (ret < 0)
-		return 0;
+		return -EINVAL;
 
-	return clk_aic32x4_pll_calc_rate(&settings, *parent_rate);
+	rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static int clk_aic32x4_pll_set_rate(struct clk_hw *hw,
@@ -267,7 +272,7 @@ static const struct clk_ops aic32x4_pll_ops = {
 	.unprepare = clk_aic32x4_pll_unprepare,
 	.is_prepared = clk_aic32x4_pll_is_prepared,
 	.recalc_rate = clk_aic32x4_pll_recalc_rate,
-	.round_rate = clk_aic32x4_pll_round_rate,
+	.determine_rate = clk_aic32x4_pll_determine_rate,
 	.set_rate = clk_aic32x4_pll_set_rate,
 	.set_parent = clk_aic32x4_pll_set_parent,
 	.get_parent = clk_aic32x4_pll_get_parent,

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 63/65] ASoC: tlv320aic32x4: pll: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The tlv320aic32x4 PLL clocks implements a mux with a set_parent hook, but
doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index 65b72373cb95..d8b8ea3eaa12 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -205,18 +205,23 @@ static unsigned long clk_aic32x4_pll_recalc_rate(struct clk_hw *hw,
 	return clk_aic32x4_pll_calc_rate(&settings, parent_rate);
 }
 
-static long clk_aic32x4_pll_round_rate(struct clk_hw *hw,
-			unsigned long rate,
-			unsigned long *parent_rate)
+static int clk_aic32x4_pll_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	struct clk_aic32x4_pll_muldiv settings;
+	unsigned long rate;
 	int ret;
 
-	ret = clk_aic32x4_pll_calc_muldiv(&settings, rate, *parent_rate);
+	ret = clk_aic32x4_pll_calc_muldiv(&settings, req->rate, req->best_parent_rate);
 	if (ret < 0)
-		return 0;
+		return -EINVAL;
 
-	return clk_aic32x4_pll_calc_rate(&settings, *parent_rate);
+	rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate);
+	if (rate < 0)
+		return rate;
+
+	req->rate = rate;
+	return 0;
 }
 
 static int clk_aic32x4_pll_set_rate(struct clk_hw *hw,
@@ -267,7 +272,7 @@ static const struct clk_ops aic32x4_pll_ops = {
 	.unprepare = clk_aic32x4_pll_unprepare,
 	.is_prepared = clk_aic32x4_pll_is_prepared,
 	.recalc_rate = clk_aic32x4_pll_recalc_rate,
-	.round_rate = clk_aic32x4_pll_round_rate,
+	.determine_rate = clk_aic32x4_pll_determine_rate,
 	.set_rate = clk_aic32x4_pll_set_rate,
 	.set_parent = clk_aic32x4_pll_set_parent,
 	.get_parent = clk_aic32x4_pll_get_parent,

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 64/65] ASoC: tlv320aic32x4: div: Switch to determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The tlv320aic32x4 divider clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index d8b8ea3eaa12..707c9951fac0 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -333,16 +333,17 @@ static int clk_aic32x4_div_set_rate(struct clk_hw *hw, unsigned long rate,
 				AIC32X4_DIV_MASK, divisor);
 }
 
-static long clk_aic32x4_div_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int clk_aic32x4_div_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	unsigned long divisor;
 
-	divisor = DIV_ROUND_UP(*parent_rate, rate);
+	divisor = DIV_ROUND_UP(req->best_parent_rate, req->rate);
 	if (divisor > 128)
 		return -EINVAL;
 
-	return DIV_ROUND_UP(*parent_rate, divisor);
+	req->rate = DIV_ROUND_UP(req->best_parent_rate, divisor);
+	return 0;
 }
 
 static unsigned long clk_aic32x4_div_recalc_rate(struct clk_hw *hw,
@@ -361,7 +362,7 @@ static const struct clk_ops aic32x4_div_ops = {
 	.prepare = clk_aic32x4_div_prepare,
 	.unprepare = clk_aic32x4_div_unprepare,
 	.set_rate = clk_aic32x4_div_set_rate,
-	.round_rate = clk_aic32x4_div_round_rate,
+	.determine_rate = clk_aic32x4_div_determine_rate,
 	.recalc_rate = clk_aic32x4_div_recalc_rate,
 };
 
@@ -389,7 +390,7 @@ static const struct clk_ops aic32x4_bdiv_ops = {
 	.set_parent = clk_aic32x4_bdiv_set_parent,
 	.get_parent = clk_aic32x4_bdiv_get_parent,
 	.set_rate = clk_aic32x4_div_set_rate,
-	.round_rate = clk_aic32x4_div_round_rate,
+	.determine_rate = clk_aic32x4_div_determine_rate,
 	.recalc_rate = clk_aic32x4_div_recalc_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 64/65] ASoC: tlv320aic32x4: div: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The tlv320aic32x4 divider clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index d8b8ea3eaa12..707c9951fac0 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -333,16 +333,17 @@ static int clk_aic32x4_div_set_rate(struct clk_hw *hw, unsigned long rate,
 				AIC32X4_DIV_MASK, divisor);
 }
 
-static long clk_aic32x4_div_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int clk_aic32x4_div_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	unsigned long divisor;
 
-	divisor = DIV_ROUND_UP(*parent_rate, rate);
+	divisor = DIV_ROUND_UP(req->best_parent_rate, req->rate);
 	if (divisor > 128)
 		return -EINVAL;
 
-	return DIV_ROUND_UP(*parent_rate, divisor);
+	req->rate = DIV_ROUND_UP(req->best_parent_rate, divisor);
+	return 0;
 }
 
 static unsigned long clk_aic32x4_div_recalc_rate(struct clk_hw *hw,
@@ -361,7 +362,7 @@ static const struct clk_ops aic32x4_div_ops = {
 	.prepare = clk_aic32x4_div_prepare,
 	.unprepare = clk_aic32x4_div_unprepare,
 	.set_rate = clk_aic32x4_div_set_rate,
-	.round_rate = clk_aic32x4_div_round_rate,
+	.determine_rate = clk_aic32x4_div_determine_rate,
 	.recalc_rate = clk_aic32x4_div_recalc_rate,
 };
 
@@ -389,7 +390,7 @@ static const struct clk_ops aic32x4_bdiv_ops = {
 	.set_parent = clk_aic32x4_bdiv_set_parent,
 	.get_parent = clk_aic32x4_bdiv_get_parent,
 	.set_rate = clk_aic32x4_div_set_rate,
-	.round_rate = clk_aic32x4_div_round_rate,
+	.determine_rate = clk_aic32x4_div_determine_rate,
 	.recalc_rate = clk_aic32x4_div_recalc_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 64/65] ASoC: tlv320aic32x4: div: Switch to determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The tlv320aic32x4 divider clocks implements a mux with a set_parent
hook, but doesn't provide a determine_rate implementation.

This is a bit odd, since set_parent() is there to, as its name implies,
change the parent of a clock. However, the most likely candidate to
trigger that parent change is a call to clk_set_rate(), with
determine_rate() figuring out which parent is the best suited for a
given rate.

The other trigger would be a call to clk_set_parent(), but it's far less
used, and it doesn't look like there's any obvious user for that clock.

So, the set_parent hook is effectively unused, possibly because of an
oversight. However, it could also be an explicit decision by the
original author to avoid any reparenting but through an explicit call to
clk_set_parent().

The driver does implement round_rate() though, which means that we can
change the rate of the clock, but we will never get to change the
parent.

However, It's hard to tell whether it's been done on purpose or not.

Since we'll start mandating a determine_rate() implementation, let's
convert the round_rate() implementation to a determine_rate(), which
will also make the current behavior explicit. And if it was an
oversight, the clock behaviour can be adjusted later on.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 sound/soc/codecs/tlv320aic32x4-clk.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index d8b8ea3eaa12..707c9951fac0 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -333,16 +333,17 @@ static int clk_aic32x4_div_set_rate(struct clk_hw *hw, unsigned long rate,
 				AIC32X4_DIV_MASK, divisor);
 }
 
-static long clk_aic32x4_div_round_rate(struct clk_hw *hw, unsigned long rate,
-				unsigned long *parent_rate)
+static int clk_aic32x4_div_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	unsigned long divisor;
 
-	divisor = DIV_ROUND_UP(*parent_rate, rate);
+	divisor = DIV_ROUND_UP(req->best_parent_rate, req->rate);
 	if (divisor > 128)
 		return -EINVAL;
 
-	return DIV_ROUND_UP(*parent_rate, divisor);
+	req->rate = DIV_ROUND_UP(req->best_parent_rate, divisor);
+	return 0;
 }
 
 static unsigned long clk_aic32x4_div_recalc_rate(struct clk_hw *hw,
@@ -361,7 +362,7 @@ static const struct clk_ops aic32x4_div_ops = {
 	.prepare = clk_aic32x4_div_prepare,
 	.unprepare = clk_aic32x4_div_unprepare,
 	.set_rate = clk_aic32x4_div_set_rate,
-	.round_rate = clk_aic32x4_div_round_rate,
+	.determine_rate = clk_aic32x4_div_determine_rate,
 	.recalc_rate = clk_aic32x4_div_recalc_rate,
 };
 
@@ -389,7 +390,7 @@ static const struct clk_ops aic32x4_bdiv_ops = {
 	.set_parent = clk_aic32x4_bdiv_set_parent,
 	.get_parent = clk_aic32x4_bdiv_get_parent,
 	.set_rate = clk_aic32x4_div_set_rate,
-	.round_rate = clk_aic32x4_div_round_rate,
+	.determine_rate = clk_aic32x4_div_determine_rate,
 	.recalc_rate = clk_aic32x4_div_recalc_rate,
 };
 

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate
  2022-11-04 13:17 ` Maxime Ripard
  (?)
@ 2022-11-04 13:18   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

The determine_rate hook allows to select the proper parent and its rate
for a given clock configuration. On another hand, set_parent is there to
change the parent of a mux.

Some clocks provide a set_parent hook but don't implement
determine_rate. In such a case, set_parent is pretty much useless since
the clock framework will always assume the current parent is to be used,
and we will thus never change it.

This situation can be solved in two ways:
  - either we don't need to change the parent, and we thus shouldn't
    implement set_parent;
  - or we don't want to change the parent, in this case we should set
    CLK_SET_RATE_NO_REPARENT;
  - or we're missing a determine_rate implementation.

The latter is probably just an oversight from the driver's author, and
we should thus raise their awareness about the fact that the current
state of the driver is confusing.

It's not clear at this point how many drivers are affected though, so
let's make it a warning instead of an error for now.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 495d7497cc43..9eb0343629cc 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3701,6 +3701,13 @@ static int __clk_core_init(struct clk_core *core)
 		goto out;
 	}
 
+	if (core->ops->set_parent && !core->ops->determine_rate) {
+		pr_err("%s: %s must implement .set_parent & .determine_rate\n",
+			__func__, core->name);
+		ret = -EINVAL;
+		goto out;
+	}
+
 	if (core->num_parents > 1 && !core->ops->get_parent) {
 		pr_err("%s: %s must implement .get_parent as it has multi parents\n",
 		       __func__, core->name);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The determine_rate hook allows to select the proper parent and its rate
for a given clock configuration. On another hand, set_parent is there to
change the parent of a mux.

Some clocks provide a set_parent hook but don't implement
determine_rate. In such a case, set_parent is pretty much useless since
the clock framework will always assume the current parent is to be used,
and we will thus never change it.

This situation can be solved in two ways:
  - either we don't need to change the parent, and we thus shouldn't
    implement set_parent;
  - or we don't want to change the parent, in this case we should set
    CLK_SET_RATE_NO_REPARENT;
  - or we're missing a determine_rate implementation.

The latter is probably just an oversight from the driver's author, and
we should thus raise their awareness about the fact that the current
state of the driver is confusing.

It's not clear at this point how many drivers are affected though, so
let's make it a warning instead of an error for now.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 495d7497cc43..9eb0343629cc 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3701,6 +3701,13 @@ static int __clk_core_init(struct clk_core *core)
 		goto out;
 	}
 
+	if (core->ops->set_parent && !core->ops->determine_rate) {
+		pr_err("%s: %s must implement .set_parent & .determine_rate\n",
+			__func__, core->name);
+		ret = -EINVAL;
+		goto out;
+	}
+
 	if (core->num_parents > 1 && !core->ops->get_parent) {
 		pr_err("%s: %s must implement .get_parent as it has multi parents\n",
 		       __func__, core->name);

-- 
b4 0.11.0-dev-99e3a

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate
@ 2022-11-04 13:18   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 13:18 UTC (permalink / raw)
  To: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

The determine_rate hook allows to select the proper parent and its rate
for a given clock configuration. On another hand, set_parent is there to
change the parent of a mux.

Some clocks provide a set_parent hook but don't implement
determine_rate. In such a case, set_parent is pretty much useless since
the clock framework will always assume the current parent is to be used,
and we will thus never change it.

This situation can be solved in two ways:
  - either we don't need to change the parent, and we thus shouldn't
    implement set_parent;
  - or we don't want to change the parent, in this case we should set
    CLK_SET_RATE_NO_REPARENT;
  - or we're missing a determine_rate implementation.

The latter is probably just an oversight from the driver's author, and
we should thus raise their awareness about the fact that the current
state of the driver is confusing.

It's not clear at this point how many drivers are affected though, so
let's make it a warning instead of an error for now.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/clk/clk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 495d7497cc43..9eb0343629cc 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3701,6 +3701,13 @@ static int __clk_core_init(struct clk_core *core)
 		goto out;
 	}
 
+	if (core->ops->set_parent && !core->ops->determine_rate) {
+		pr_err("%s: %s must implement .set_parent & .determine_rate\n",
+			__func__, core->name);
+		ret = -EINVAL;
+		goto out;
+	}
+
 	if (core->num_parents > 1 && !core->ops->get_parent) {
 		pr_err("%s: %s must implement .get_parent as it has multi parents\n",
 		       __func__, core->name);

-- 
b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-04 13:18   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-04 14:31     ` Paul Cercueil
  -1 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-04 14:31 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> The Ingenic CGU clocks implements a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name 
> implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far 
> less
> used, and it doesn't look like there's any obvious user for that 
> clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call 
> to
> clk_set_parent().
> 
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
> 
> However, It's hard to tell whether it's been done on purpose or not.
> 
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.

So it's partly on purpose, partly because I didn't know about 
.determine_rate.

There's nothing odd about having a lonely .set_parent callback; in my 
case the clocks are parented from the device tree.

Having the clocks driver trigger a parent change when requesting a rate 
change sounds very dangerous, IMHO. My MMC controller can be parented 
to the external 48 MHz oscillator, and if the card requests 50 MHz, it 
could switch to one of the PLLs. That works as long as the PLLs don't 
change rate, but if one is configured as driving the CPU clock, it 
becomes messy.
The thing is, the clocks driver has no way to know whether or not it is 
"safe" to use a designated parent.

For that reason, in practice, I never actually want to have a clock 
re-parented - it's almost always a bad idea vs. sticking to the parent 
clock configured in the DTS.


> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
> index 1f7ba30f5a1b..0c9c8344ad11 100644
> --- a/drivers/clk/ingenic/cgu.c
> +++ b/drivers/clk/ingenic/cgu.c
> @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>  	return div;
>  }
> 
> -static long
> -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
> -		       unsigned long *parent_rate)
> +static int ingenic_clk_determine_rate(struct clk_hw *hw,
> +				      struct clk_rate_request *req)
>  {
>  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>  	const struct ingenic_cgu_clk_info *clk_info = 
> to_clk_info(ingenic_clk);
>  	unsigned int div = 1;
> 
>  	if (clk_info->type & CGU_CLK_DIV)
> -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
> +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
> +					   req->rate);

Sorry but I'm not sure that this works.

You replace the "parent_rate" with the "best_parent_rate", and that 
means you only check the requested rate vs. the parent with the highest 
frequency, and not vs. the actual parent that will be used.

Cheers,
-Paul

>  	else if (clk_info->type & CGU_CLK_FIXDIV)
>  		div = clk_info->fixdiv.div;
>  	else if (clk_hw_can_set_rate_parent(hw))
> -		*parent_rate = req_rate;
> +		req->best_parent_rate = req->rate;
> 
> -	return DIV_ROUND_UP(*parent_rate, div);
> +	req->rate = DIV_ROUND_UP(req->best_parent_rate, div);
> +	return 0;
>  }
> 
>  static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu,
> @@ -626,7 +627,7 @@ static const struct clk_ops ingenic_clk_ops = {
>  	.set_parent = ingenic_clk_set_parent,
> 
>  	.recalc_rate = ingenic_clk_recalc_rate,
> -	.round_rate = ingenic_clk_round_rate,
> +	.determine_rate = ingenic_clk_determine_rate,
>  	.set_rate = ingenic_clk_set_rate,
> 
>  	.enable = ingenic_clk_enable,
> 
> --
> b4 0.11.0-dev-99e3a



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 14:31     ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-04 14:31 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> The Ingenic CGU clocks implements a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name 
> implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far 
> less
> used, and it doesn't look like there's any obvious user for that 
> clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call 
> to
> clk_set_parent().
> 
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
> 
> However, It's hard to tell whether it's been done on purpose or not.
> 
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.

So it's partly on purpose, partly because I didn't know about 
.determine_rate.

There's nothing odd about having a lonely .set_parent callback; in my 
case the clocks are parented from the device tree.

Having the clocks driver trigger a parent change when requesting a rate 
change sounds very dangerous, IMHO. My MMC controller can be parented 
to the external 48 MHz oscillator, and if the card requests 50 MHz, it 
could switch to one of the PLLs. That works as long as the PLLs don't 
change rate, but if one is configured as driving the CPU clock, it 
becomes messy.
The thing is, the clocks driver has no way to know whether or not it is 
"safe" to use a designated parent.

For that reason, in practice, I never actually want to have a clock 
re-parented - it's almost always a bad idea vs. sticking to the parent 
clock configured in the DTS.


> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
> index 1f7ba30f5a1b..0c9c8344ad11 100644
> --- a/drivers/clk/ingenic/cgu.c
> +++ b/drivers/clk/ingenic/cgu.c
> @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>  	return div;
>  }
> 
> -static long
> -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
> -		       unsigned long *parent_rate)
> +static int ingenic_clk_determine_rate(struct clk_hw *hw,
> +				      struct clk_rate_request *req)
>  {
>  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>  	const struct ingenic_cgu_clk_info *clk_info = 
> to_clk_info(ingenic_clk);
>  	unsigned int div = 1;
> 
>  	if (clk_info->type & CGU_CLK_DIV)
> -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
> +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
> +					   req->rate);

Sorry but I'm not sure that this works.

You replace the "parent_rate" with the "best_parent_rate", and that 
means you only check the requested rate vs. the parent with the highest 
frequency, and not vs. the actual parent that will be used.

Cheers,
-Paul

>  	else if (clk_info->type & CGU_CLK_FIXDIV)
>  		div = clk_info->fixdiv.div;
>  	else if (clk_hw_can_set_rate_parent(hw))
> -		*parent_rate = req_rate;
> +		req->best_parent_rate = req->rate;
> 
> -	return DIV_ROUND_UP(*parent_rate, div);
> +	req->rate = DIV_ROUND_UP(req->best_parent_rate, div);
> +	return 0;
>  }
> 
>  static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu,
> @@ -626,7 +627,7 @@ static const struct clk_ops ingenic_clk_ops = {
>  	.set_parent = ingenic_clk_set_parent,
> 
>  	.recalc_rate = ingenic_clk_recalc_rate,
> -	.round_rate = ingenic_clk_round_rate,
> +	.determine_rate = ingenic_clk_determine_rate,
>  	.set_rate = ingenic_clk_set_rate,
> 
>  	.enable = ingenic_clk_enable,
> 
> --
> b4 0.11.0-dev-99e3a



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 14:31     ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-04 14:31 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> The Ingenic CGU clocks implements a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name 
> implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far 
> less
> used, and it doesn't look like there's any obvious user for that 
> clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call 
> to
> clk_set_parent().
> 
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
> 
> However, It's hard to tell whether it's been done on purpose or not.
> 
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.

So it's partly on purpose, partly because I didn't know about 
.determine_rate.

There's nothing odd about having a lonely .set_parent callback; in my 
case the clocks are parented from the device tree.

Having the clocks driver trigger a parent change when requesting a rate 
change sounds very dangerous, IMHO. My MMC controller can be parented 
to the external 48 MHz oscillator, and if the card requests 50 MHz, it 
could switch to one of the PLLs. That works as long as the PLLs don't 
change rate, but if one is configured as driving the CPU clock, it 
becomes messy.
The thing is, the clocks driver has no way to know whether or not it is 
"safe" to use a designated parent.

For that reason, in practice, I never actually want to have a clock 
re-parented - it's almost always a bad idea vs. sticking to the parent 
clock configured in the DTS.


> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
> index 1f7ba30f5a1b..0c9c8344ad11 100644
> --- a/drivers/clk/ingenic/cgu.c
> +++ b/drivers/clk/ingenic/cgu.c
> @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>  	return div;
>  }
> 
> -static long
> -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
> -		       unsigned long *parent_rate)
> +static int ingenic_clk_determine_rate(struct clk_hw *hw,
> +				      struct clk_rate_request *req)
>  {
>  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>  	const struct ingenic_cgu_clk_info *clk_info = 
> to_clk_info(ingenic_clk);
>  	unsigned int div = 1;
> 
>  	if (clk_info->type & CGU_CLK_DIV)
> -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
> +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
> +					   req->rate);

Sorry but I'm not sure that this works.

You replace the "parent_rate" with the "best_parent_rate", and that 
means you only check the requested rate vs. the parent with the highest 
frequency, and not vs. the actual parent that will be used.

Cheers,
-Paul

>  	else if (clk_info->type & CGU_CLK_FIXDIV)
>  		div = clk_info->fixdiv.div;
>  	else if (clk_hw_can_set_rate_parent(hw))
> -		*parent_rate = req_rate;
> +		req->best_parent_rate = req->rate;
> 
> -	return DIV_ROUND_UP(*parent_rate, div);
> +	req->rate = DIV_ROUND_UP(req->best_parent_rate, div);
> +	return 0;
>  }
> 
>  static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu,
> @@ -626,7 +627,7 @@ static const struct clk_ops ingenic_clk_ops = {
>  	.set_parent = ingenic_clk_set_parent,
> 
>  	.recalc_rate = ingenic_clk_recalc_rate,
> -	.round_rate = ingenic_clk_round_rate,
> +	.determine_rate = ingenic_clk_determine_rate,
>  	.set_rate = ingenic_clk_set_rate,
> 
>  	.enable = ingenic_clk_enable,
> 
> --
> b4 0.11.0-dev-99e3a



-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 14:31     ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-04 14:31 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Max Filippov, Thierry Reding, linux-phy, David Airlie,
	Fabio Estevam, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	Linus Walleij, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> The Ingenic CGU clocks implements a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name 
> implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far 
> less
> used, and it doesn't look like there's any obvious user for that 
> clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call 
> to
> clk_set_parent().
> 
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
> 
> However, It's hard to tell whether it's been done on purpose or not.
> 
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.

So it's partly on purpose, partly because I didn't know about 
.determine_rate.

There's nothing odd about having a lonely .set_parent callback; in my 
case the clocks are parented from the device tree.

Having the clocks driver trigger a parent change when requesting a rate 
change sounds very dangerous, IMHO. My MMC controller can be parented 
to the external 48 MHz oscillator, and if the card requests 50 MHz, it 
could switch to one of the PLLs. That works as long as the PLLs don't 
change rate, but if one is configured as driving the CPU clock, it 
becomes messy.
The thing is, the clocks driver has no way to know whether or not it is 
"safe" to use a designated parent.

For that reason, in practice, I never actually want to have a clock 
re-parented - it's almost always a bad idea vs. sticking to the parent 
clock configured in the DTS.


> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
> index 1f7ba30f5a1b..0c9c8344ad11 100644
> --- a/drivers/clk/ingenic/cgu.c
> +++ b/drivers/clk/ingenic/cgu.c
> @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>  	return div;
>  }
> 
> -static long
> -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
> -		       unsigned long *parent_rate)
> +static int ingenic_clk_determine_rate(struct clk_hw *hw,
> +				      struct clk_rate_request *req)
>  {
>  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>  	const struct ingenic_cgu_clk_info *clk_info = 
> to_clk_info(ingenic_clk);
>  	unsigned int div = 1;
> 
>  	if (clk_info->type & CGU_CLK_DIV)
> -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
> +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
> +					   req->rate);

Sorry but I'm not sure that this works.

You replace the "parent_rate" with the "best_parent_rate", and that 
means you only check the requested rate vs. the parent with the highest 
frequency, and not vs. the actual parent that will be used.

Cheers,
-Paul

>  	else if (clk_info->type & CGU_CLK_FIXDIV)
>  		div = clk_info->fixdiv.div;
>  	else if (clk_hw_can_set_rate_parent(hw))
> -		*parent_rate = req_rate;
> +		req->best_parent_rate = req->rate;
> 
> -	return DIV_ROUND_UP(*parent_rate, div);
> +	req->rate = DIV_ROUND_UP(req->best_parent_rate, div);
> +	return 0;
>  }
> 
>  static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu,
> @@ -626,7 +627,7 @@ static const struct clk_ops ingenic_clk_ops = {
>  	.set_parent = ingenic_clk_set_parent,
> 
>  	.recalc_rate = ingenic_clk_recalc_rate,
> -	.round_rate = ingenic_clk_round_rate,
> +	.determine_rate = ingenic_clk_determine_rate,
>  	.set_rate = ingenic_clk_set_rate,
> 
>  	.enable = ingenic_clk_enable,
> 
> --
> b4 0.11.0-dev-99e3a



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-04 14:31     ` Paul Cercueil
  (?)
  (?)
@ 2022-11-04 14:59       ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 14:59 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 4344 bytes --]

Hi Paul,

On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> écrit :
> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> > doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> > 
> > The driver does implement round_rate() though, which means that we can
> > change the rate of the clock, but we will never get to change the
> > parent.
> > 
> > However, It's hard to tell whether it's been done on purpose or not.
> > 
> > Since we'll start mandating a determine_rate() implementation, let's
> > convert the round_rate() implementation to a determine_rate(), which
> > will also make the current behavior explicit. And if it was an
> > oversight, the clock behaviour can be adjusted later on.
> 
> So it's partly on purpose, partly because I didn't know about
> .determine_rate.
> 
> There's nothing odd about having a lonely .set_parent callback; in my case
> the clocks are parented from the device tree.
> 
> Having the clocks driver trigger a parent change when requesting a rate
> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> one is configured as driving the CPU clock, it becomes messy.
> The thing is, the clocks driver has no way to know whether or not it is
> "safe" to use a designated parent.
> 
> For that reason, in practice, I never actually want to have a clock
> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> configured in the DTS.

Yeah, and this is totally fine. But we need to be explicit about it. The
determine_rate implementation I did in all the patches is an exact
equivalent to the round_rate one if there was one. We will never ask to
change the parent.

Given what you just said, I would suggest to set the
CLK_SET_RATE_NO_REPARENT flag as well.

> 
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > ---
> >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
> > index 1f7ba30f5a1b..0c9c8344ad11 100644
> > --- a/drivers/clk/ingenic/cgu.c
> > +++ b/drivers/clk/ingenic/cgu.c
> > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
> >  	return div;
> >  }
> > 
> > -static long
> > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
> > -		       unsigned long *parent_rate)
> > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
> > +				      struct clk_rate_request *req)
> >  {
> >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
> >  	const struct ingenic_cgu_clk_info *clk_info =
> > to_clk_info(ingenic_clk);
> >  	unsigned int div = 1;
> > 
> >  	if (clk_info->type & CGU_CLK_DIV)
> > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
> > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
> > +					   req->rate);
> 
> Sorry but I'm not sure that this works.
> 
> You replace the "parent_rate" with the "best_parent_rate", and that means
> you only check the requested rate vs. the parent with the highest frequency,
> and not vs. the actual parent that will be used.

best_parent_rate is initialized to the current parent rate, not the
parent with the highest frequency:
https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 14:59       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 14:59 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 4344 bytes --]

Hi Paul,

On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> écrit :
> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> > doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> > 
> > The driver does implement round_rate() though, which means that we can
> > change the rate of the clock, but we will never get to change the
> > parent.
> > 
> > However, It's hard to tell whether it's been done on purpose or not.
> > 
> > Since we'll start mandating a determine_rate() implementation, let's
> > convert the round_rate() implementation to a determine_rate(), which
> > will also make the current behavior explicit. And if it was an
> > oversight, the clock behaviour can be adjusted later on.
> 
> So it's partly on purpose, partly because I didn't know about
> .determine_rate.
> 
> There's nothing odd about having a lonely .set_parent callback; in my case
> the clocks are parented from the device tree.
> 
> Having the clocks driver trigger a parent change when requesting a rate
> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> one is configured as driving the CPU clock, it becomes messy.
> The thing is, the clocks driver has no way to know whether or not it is
> "safe" to use a designated parent.
> 
> For that reason, in practice, I never actually want to have a clock
> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> configured in the DTS.

Yeah, and this is totally fine. But we need to be explicit about it. The
determine_rate implementation I did in all the patches is an exact
equivalent to the round_rate one if there was one. We will never ask to
change the parent.

Given what you just said, I would suggest to set the
CLK_SET_RATE_NO_REPARENT flag as well.

> 
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > ---
> >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
> > index 1f7ba30f5a1b..0c9c8344ad11 100644
> > --- a/drivers/clk/ingenic/cgu.c
> > +++ b/drivers/clk/ingenic/cgu.c
> > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
> >  	return div;
> >  }
> > 
> > -static long
> > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
> > -		       unsigned long *parent_rate)
> > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
> > +				      struct clk_rate_request *req)
> >  {
> >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
> >  	const struct ingenic_cgu_clk_info *clk_info =
> > to_clk_info(ingenic_clk);
> >  	unsigned int div = 1;
> > 
> >  	if (clk_info->type & CGU_CLK_DIV)
> > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
> > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
> > +					   req->rate);
> 
> Sorry but I'm not sure that this works.
> 
> You replace the "parent_rate" with the "best_parent_rate", and that means
> you only check the requested rate vs. the parent with the highest frequency,
> and not vs. the actual parent that will be used.

best_parent_rate is initialized to the current parent rate, not the
parent with the highest frequency:
https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 14:59       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 14:59 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 4344 bytes --]

Hi Paul,

On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> écrit :
> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> > doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> > 
> > The driver does implement round_rate() though, which means that we can
> > change the rate of the clock, but we will never get to change the
> > parent.
> > 
> > However, It's hard to tell whether it's been done on purpose or not.
> > 
> > Since we'll start mandating a determine_rate() implementation, let's
> > convert the round_rate() implementation to a determine_rate(), which
> > will also make the current behavior explicit. And if it was an
> > oversight, the clock behaviour can be adjusted later on.
> 
> So it's partly on purpose, partly because I didn't know about
> .determine_rate.
> 
> There's nothing odd about having a lonely .set_parent callback; in my case
> the clocks are parented from the device tree.
> 
> Having the clocks driver trigger a parent change when requesting a rate
> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> one is configured as driving the CPU clock, it becomes messy.
> The thing is, the clocks driver has no way to know whether or not it is
> "safe" to use a designated parent.
> 
> For that reason, in practice, I never actually want to have a clock
> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> configured in the DTS.

Yeah, and this is totally fine. But we need to be explicit about it. The
determine_rate implementation I did in all the patches is an exact
equivalent to the round_rate one if there was one. We will never ask to
change the parent.

Given what you just said, I would suggest to set the
CLK_SET_RATE_NO_REPARENT flag as well.

> 
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > ---
> >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
> > index 1f7ba30f5a1b..0c9c8344ad11 100644
> > --- a/drivers/clk/ingenic/cgu.c
> > +++ b/drivers/clk/ingenic/cgu.c
> > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
> >  	return div;
> >  }
> > 
> > -static long
> > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
> > -		       unsigned long *parent_rate)
> > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
> > +				      struct clk_rate_request *req)
> >  {
> >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
> >  	const struct ingenic_cgu_clk_info *clk_info =
> > to_clk_info(ingenic_clk);
> >  	unsigned int div = 1;
> > 
> >  	if (clk_info->type & CGU_CLK_DIV)
> > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
> > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
> > +					   req->rate);
> 
> Sorry but I'm not sure that this works.
> 
> You replace the "parent_rate" with the "best_parent_rate", and that means
> you only check the requested rate vs. the parent with the highest frequency,
> and not vs. the actual parent that will be used.

best_parent_rate is initialized to the current parent rate, not the
parent with the highest frequency:
https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 14:59       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 14:59 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Max Filippov, Thierry Reding, linux-phy, David Airlie,
	Fabio Estevam, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	Linus Walleij, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 4344 bytes --]

Hi Paul,

On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> écrit :
> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> > doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> > 
> > The driver does implement round_rate() though, which means that we can
> > change the rate of the clock, but we will never get to change the
> > parent.
> > 
> > However, It's hard to tell whether it's been done on purpose or not.
> > 
> > Since we'll start mandating a determine_rate() implementation, let's
> > convert the round_rate() implementation to a determine_rate(), which
> > will also make the current behavior explicit. And if it was an
> > oversight, the clock behaviour can be adjusted later on.
> 
> So it's partly on purpose, partly because I didn't know about
> .determine_rate.
> 
> There's nothing odd about having a lonely .set_parent callback; in my case
> the clocks are parented from the device tree.
> 
> Having the clocks driver trigger a parent change when requesting a rate
> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> one is configured as driving the CPU clock, it becomes messy.
> The thing is, the clocks driver has no way to know whether or not it is
> "safe" to use a designated parent.
> 
> For that reason, in practice, I never actually want to have a clock
> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> configured in the DTS.

Yeah, and this is totally fine. But we need to be explicit about it. The
determine_rate implementation I did in all the patches is an exact
equivalent to the round_rate one if there was one. We will never ask to
change the parent.

Given what you just said, I would suggest to set the
CLK_SET_RATE_NO_REPARENT flag as well.

> 
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > ---
> >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
> > index 1f7ba30f5a1b..0c9c8344ad11 100644
> > --- a/drivers/clk/ingenic/cgu.c
> > +++ b/drivers/clk/ingenic/cgu.c
> > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
> >  	return div;
> >  }
> > 
> > -static long
> > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
> > -		       unsigned long *parent_rate)
> > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
> > +				      struct clk_rate_request *req)
> >  {
> >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
> >  	const struct ingenic_cgu_clk_info *clk_info =
> > to_clk_info(ingenic_clk);
> >  	unsigned int div = 1;
> > 
> >  	if (clk_info->type & CGU_CLK_DIV)
> > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
> > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
> > +					   req->rate);
> 
> Sorry but I'm not sure that this works.
> 
> You replace the "parent_rate" with the "best_parent_rate", and that means
> you only check the requested rate vs. the parent with the highest frequency,
> and not vs. the actual parent that will be used.

best_parent_rate is initialized to the current parent rate, not the
parent with the highest frequency:
https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-04 13:18   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-04 15:44     ` Mark Brown
  -1 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-04 15:44 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

On Fri, Nov 04, 2022 at 02:18:00PM +0100, Maxime Ripard wrote:

> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.

> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.

Given that the current approach involves patching every single user to
set a default implementation it feels like it might be more
straightforward to just have the clock API use that implementation if
none is defined - as you say there's already a flag to indicate the
unusual case where there's a solid reason to prevent reparenting.  It
feels like the resulting API is more straightforward.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:44     ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-04 15:44 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

On Fri, Nov 04, 2022 at 02:18:00PM +0100, Maxime Ripard wrote:

> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.

> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.

Given that the current approach involves patching every single user to
set a default implementation it feels like it might be more
straightforward to just have the clock API use that implementation if
none is defined - as you say there's already a flag to indicate the
unusual case where there's a solid reason to prevent reparenting.  It
feels like the resulting API is more straightforward.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:44     ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-04 15:44 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1313 bytes --]

On Fri, Nov 04, 2022 at 02:18:00PM +0100, Maxime Ripard wrote:

> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.

> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.

Given that the current approach involves patching every single user to
set a default implementation it feels like it might be more
straightforward to just have the clock API use that implementation if
none is defined - as you say there's already a flag to indicate the
unusual case where there's a solid reason to prevent reparenting.  It
feels like the resulting API is more straightforward.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:44     ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-04 15:44 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

On Fri, Nov 04, 2022 at 02:18:00PM +0100, Maxime Ripard wrote:

> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.

> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.

Given that the current approach involves patching every single user to
set a default implementation it feels like it might be more
straightforward to just have the clock API use that implementation if
none is defined - as you say there's already a flag to indicate the
unusual case where there's a solid reason to prevent reparenting.  It
feels like the resulting API is more straightforward.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-04 15:44     ` Mark Brown
  (?)
  (?)
@ 2022-11-04 15:51       ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 15:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

Hi Mark,

On Fri, Nov 04, 2022 at 03:44:53PM +0000, Mark Brown wrote:
> On Fri, Nov 04, 2022 at 02:18:00PM +0100, Maxime Ripard wrote:
> 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> > The latter case would be equivalent to setting the flag
> > CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> > to __clk_mux_determine_rate(). Indeed, if no determine_rate
> > implementation is provided, clk_round_rate() (through
> > clk_core_round_rate_nolock()) will call itself on the parent if
> > CLK_SET_RATE_PARENT is set, and will not change the clock rate
> > otherwise. __clk_mux_determine_rate() has the exact same behavior when
> > CLK_SET_RATE_NO_REPARENT is set.
> 
> > And if it was an oversight, then we are at least explicit about our
> > behavior now and it can be further refined down the line.
> 
> Given that the current approach involves patching every single user to
> set a default implementation it feels like it might be more
> straightforward to just have the clock API use that implementation if
> none is defined - as you say there's already a flag to indicate the
> unusual case where there's a solid reason to prevent reparenting.  It
> feels like the resulting API is more straightforward.

That would be another solution indeed. The thing is, most places where
determine_rate is missing seems to be oversight, and the flag is missing
as well.

Just filling determine_rate if it's missing with
__clk_mux_determine_rate will possibly pick different parents, and I'm
fairly certain that this have never been tested on most platforms, and
will be completely broken. And I don't really want to play a game of
whack-a-mole adding that flag everywhere it turns out it's broken.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:51       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 15:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

Hi Mark,

On Fri, Nov 04, 2022 at 03:44:53PM +0000, Mark Brown wrote:
> On Fri, Nov 04, 2022 at 02:18:00PM +0100, Maxime Ripard wrote:
> 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> > The latter case would be equivalent to setting the flag
> > CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> > to __clk_mux_determine_rate(). Indeed, if no determine_rate
> > implementation is provided, clk_round_rate() (through
> > clk_core_round_rate_nolock()) will call itself on the parent if
> > CLK_SET_RATE_PARENT is set, and will not change the clock rate
> > otherwise. __clk_mux_determine_rate() has the exact same behavior when
> > CLK_SET_RATE_NO_REPARENT is set.
> 
> > And if it was an oversight, then we are at least explicit about our
> > behavior now and it can be further refined down the line.
> 
> Given that the current approach involves patching every single user to
> set a default implementation it feels like it might be more
> straightforward to just have the clock API use that implementation if
> none is defined - as you say there's already a flag to indicate the
> unusual case where there's a solid reason to prevent reparenting.  It
> feels like the resulting API is more straightforward.

That would be another solution indeed. The thing is, most places where
determine_rate is missing seems to be oversight, and the flag is missing
as well.

Just filling determine_rate if it's missing with
__clk_mux_determine_rate will possibly pick different parents, and I'm
fairly certain that this have never been tested on most platforms, and
will be completely broken. And I don't really want to play a game of
whack-a-mole adding that flag everywhere it turns out it's broken.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:51       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 15:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1963 bytes --]

Hi Mark,

On Fri, Nov 04, 2022 at 03:44:53PM +0000, Mark Brown wrote:
> On Fri, Nov 04, 2022 at 02:18:00PM +0100, Maxime Ripard wrote:
> 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> > The latter case would be equivalent to setting the flag
> > CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> > to __clk_mux_determine_rate(). Indeed, if no determine_rate
> > implementation is provided, clk_round_rate() (through
> > clk_core_round_rate_nolock()) will call itself on the parent if
> > CLK_SET_RATE_PARENT is set, and will not change the clock rate
> > otherwise. __clk_mux_determine_rate() has the exact same behavior when
> > CLK_SET_RATE_NO_REPARENT is set.
> 
> > And if it was an oversight, then we are at least explicit about our
> > behavior now and it can be further refined down the line.
> 
> Given that the current approach involves patching every single user to
> set a default implementation it feels like it might be more
> straightforward to just have the clock API use that implementation if
> none is defined - as you say there's already a flag to indicate the
> unusual case where there's a solid reason to prevent reparenting.  It
> feels like the resulting API is more straightforward.

That would be another solution indeed. The thing is, most places where
determine_rate is missing seems to be oversight, and the flag is missing
as well.

Just filling determine_rate if it's missing with
__clk_mux_determine_rate will possibly pick different parents, and I'm
fairly certain that this have never been tested on most platforms, and
will be completely broken. And I don't really want to play a game of
whack-a-mole adding that flag everywhere it turns out it's broken.

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:51       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-04 15:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

Hi Mark,

On Fri, Nov 04, 2022 at 03:44:53PM +0000, Mark Brown wrote:
> On Fri, Nov 04, 2022 at 02:18:00PM +0100, Maxime Ripard wrote:
> 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> > The latter case would be equivalent to setting the flag
> > CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> > to __clk_mux_determine_rate(). Indeed, if no determine_rate
> > implementation is provided, clk_round_rate() (through
> > clk_core_round_rate_nolock()) will call itself on the parent if
> > CLK_SET_RATE_PARENT is set, and will not change the clock rate
> > otherwise. __clk_mux_determine_rate() has the exact same behavior when
> > CLK_SET_RATE_NO_REPARENT is set.
> 
> > And if it was an oversight, then we are at least explicit about our
> > behavior now and it can be further refined down the line.
> 
> Given that the current approach involves patching every single user to
> set a default implementation it feels like it might be more
> straightforward to just have the clock API use that implementation if
> none is defined - as you say there's already a flag to indicate the
> unusual case where there's a solid reason to prevent reparenting.  It
> feels like the resulting API is more straightforward.

That would be another solution indeed. The thing is, most places where
determine_rate is missing seems to be oversight, and the flag is missing
as well.

Just filling determine_rate if it's missing with
__clk_mux_determine_rate will possibly pick different parents, and I'm
fairly certain that this have never been tested on most platforms, and
will be completely broken. And I don't really want to play a game of
whack-a-mole adding that flag everywhere it turns out it's broken.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-04 15:51       ` Maxime Ripard
  (?)
  (?)
@ 2022-11-04 15:59         ` Mark Brown
  -1 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-04 15:59 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

On Fri, Nov 04, 2022 at 04:51:23PM +0100, Maxime Ripard wrote:

> Just filling determine_rate if it's missing with
> __clk_mux_determine_rate will possibly pick different parents, and I'm
> fairly certain that this have never been tested on most platforms, and
> will be completely broken. And I don't really want to play a game of
> whack-a-mole adding that flag everywhere it turns out it's broken.

Well, hopefully everyone for whom it's an issue currently will be
objecting to this version of the change anyway so we'll either know
where to set the flag or we'll get the whack-a-mole with the series
being merged?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:59         ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-04 15:59 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

On Fri, Nov 04, 2022 at 04:51:23PM +0100, Maxime Ripard wrote:

> Just filling determine_rate if it's missing with
> __clk_mux_determine_rate will possibly pick different parents, and I'm
> fairly certain that this have never been tested on most platforms, and
> will be completely broken. And I don't really want to play a game of
> whack-a-mole adding that flag everywhere it turns out it's broken.

Well, hopefully everyone for whom it's an issue currently will be
objecting to this version of the change anyway so we'll either know
where to set the flag or we'll get the whack-a-mole with the series
being merged?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:59         ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-04 15:59 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 618 bytes --]

On Fri, Nov 04, 2022 at 04:51:23PM +0100, Maxime Ripard wrote:

> Just filling determine_rate if it's missing with
> __clk_mux_determine_rate will possibly pick different parents, and I'm
> fairly certain that this have never been tested on most platforms, and
> will be completely broken. And I don't really want to play a game of
> whack-a-mole adding that flag everywhere it turns out it's broken.

Well, hopefully everyone for whom it's an issue currently will be
objecting to this version of the change anyway so we'll either know
where to set the flag or we'll get the whack-a-mole with the series
being merged?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-04 15:59         ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-04 15:59 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

On Fri, Nov 04, 2022 at 04:51:23PM +0100, Maxime Ripard wrote:

> Just filling determine_rate if it's missing with
> __clk_mux_determine_rate will possibly pick different parents, and I'm
> fairly certain that this have never been tested on most platforms, and
> will be completely broken. And I don't really want to play a game of
> whack-a-mole adding that flag everywhere it turns out it's broken.

Well, hopefully everyone for whom it's an issue currently will be
objecting to this version of the change anyway so we'll either know
where to set the flag or we'll get the whack-a-mole with the series
being merged?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
  (?)
@ 2022-11-04 16:45     ` David Lechner
  -1 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:45 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On 11/4/22 8:17 AM, Maxime Ripard wrote:
> The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().


The parent is defined in the device tree and is not expected to change
at runtime, so if I am understanding the patch correctly, setting the
CLK_SET_RATE_NO_REPARENT flag seems correct.

> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index 4103d605e804..c04276bc4051 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -229,6 +229,7 @@ static u8 da8xx_cfgchip_mux_clk_get_parent(struct clk_hw *hw)
>   }
>   
>   static const struct clk_ops da8xx_cfgchip_mux_clk_ops = {
> +	.determine_rate	= __clk_mux_determine_rate,
>   	.set_parent	= da8xx_cfgchip_mux_clk_set_parent,
>   	.get_parent	= da8xx_cfgchip_mux_clk_get_parent,
>   };
> @@ -251,7 +252,7 @@ da8xx_cfgchip_mux_clk_register(struct device *dev,
>   	init.ops = &da8xx_cfgchip_mux_clk_ops;
>   	init.parent_names = parent_names;
>   	init.num_parents = 2;
> -	init.flags = 0;
> +	init.flags = CLK_SET_RATE_NO_REPARENT;
>   
>   	mux->hw.init = &init;
>   	mux->regmap = regmap;
> 


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-04 16:45     ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:45 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On 11/4/22 8:17 AM, Maxime Ripard wrote:
> The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().


The parent is defined in the device tree and is not expected to change
at runtime, so if I am understanding the patch correctly, setting the
CLK_SET_RATE_NO_REPARENT flag seems correct.

> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index 4103d605e804..c04276bc4051 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -229,6 +229,7 @@ static u8 da8xx_cfgchip_mux_clk_get_parent(struct clk_hw *hw)
>   }
>   
>   static const struct clk_ops da8xx_cfgchip_mux_clk_ops = {
> +	.determine_rate	= __clk_mux_determine_rate,
>   	.set_parent	= da8xx_cfgchip_mux_clk_set_parent,
>   	.get_parent	= da8xx_cfgchip_mux_clk_get_parent,
>   };
> @@ -251,7 +252,7 @@ da8xx_cfgchip_mux_clk_register(struct device *dev,
>   	init.ops = &da8xx_cfgchip_mux_clk_ops;
>   	init.parent_names = parent_names;
>   	init.num_parents = 2;
> -	init.flags = 0;
> +	init.flags = CLK_SET_RATE_NO_REPARENT;
>   
>   	mux->hw.init = &init;
>   	mux->regmap = regmap;
> 


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-04 16:45     ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:45 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, linux-phy, linux-sunxi, linux-stm32,
	linux-arm-kernel, AngeloGioacchino Del Regno

On 11/4/22 8:17 AM, Maxime Ripard wrote:
> The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().


The parent is defined in the device tree and is not expected to change
at runtime, so if I am understanding the patch correctly, setting the
CLK_SET_RATE_NO_REPARENT flag seems correct.

> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index 4103d605e804..c04276bc4051 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -229,6 +229,7 @@ static u8 da8xx_cfgchip_mux_clk_get_parent(struct clk_hw *hw)
>   }
>   
>   static const struct clk_ops da8xx_cfgchip_mux_clk_ops = {
> +	.determine_rate	= __clk_mux_determine_rate,
>   	.set_parent	= da8xx_cfgchip_mux_clk_set_parent,
>   	.get_parent	= da8xx_cfgchip_mux_clk_get_parent,
>   };
> @@ -251,7 +252,7 @@ da8xx_cfgchip_mux_clk_register(struct device *dev,
>   	init.ops = &da8xx_cfgchip_mux_clk_ops;
>   	init.parent_names = parent_names;
>   	init.num_parents = 2;
> -	init.flags = 0;
> +	init.flags = CLK_SET_RATE_NO_REPARENT;
>   
>   	mux->hw.init = &init;
>   	mux->regmap = regmap;
> 


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 22/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
  (?)
@ 2022-11-04 16:46     ` David Lechner
  -1 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:46 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On 11/4/22 8:17 AM, Maxime Ripard wrote:
> The Davinci DA8xxx cfgchip "clk48" clock implements a mux with a
> set_parent hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.

The parent is defined in the device tree and is not expected to change
at runtime, so if I am understanding the patch correctly, setting the
CLK_SET_RATE_NO_REPARENT flag seems correct.

> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index c04276bc4051..4c1cc59bba53 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -565,6 +565,7 @@ static u8 da8xx_usb1_clk48_get_parent(struct clk_hw *hw)
>   }
>   
>   static const struct clk_ops da8xx_usb1_clk48_ops = {
> +	.determine_rate	= __clk_mux_determine_rate,
>   	.set_parent	= da8xx_usb1_clk48_set_parent,
>   	.get_parent	= da8xx_usb1_clk48_get_parent,
>   };
> @@ -589,6 +590,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev,
>   
>   	init.name = "usb1_clk48";
>   	init.ops = &da8xx_usb1_clk48_ops;
> +	init.flags = CLK_SET_RATE_NO_REPARENT;
>   	init.parent_names = parent_names;
>   	init.num_parents = 2;
>   
> 


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 22/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-04 16:46     ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:46 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On 11/4/22 8:17 AM, Maxime Ripard wrote:
> The Davinci DA8xxx cfgchip "clk48" clock implements a mux with a
> set_parent hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.

The parent is defined in the device tree and is not expected to change
at runtime, so if I am understanding the patch correctly, setting the
CLK_SET_RATE_NO_REPARENT flag seems correct.

> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index c04276bc4051..4c1cc59bba53 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -565,6 +565,7 @@ static u8 da8xx_usb1_clk48_get_parent(struct clk_hw *hw)
>   }
>   
>   static const struct clk_ops da8xx_usb1_clk48_ops = {
> +	.determine_rate	= __clk_mux_determine_rate,
>   	.set_parent	= da8xx_usb1_clk48_set_parent,
>   	.get_parent	= da8xx_usb1_clk48_get_parent,
>   };
> @@ -589,6 +590,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev,
>   
>   	init.name = "usb1_clk48";
>   	init.ops = &da8xx_usb1_clk48_ops;
> +	init.flags = CLK_SET_RATE_NO_REPARENT;
>   	init.parent_names = parent_names;
>   	init.num_parents = 2;
>   
> 


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 22/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-04 16:46     ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:46 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, linux-phy, linux-sunxi, linux-stm32,
	linux-arm-kernel, AngeloGioacchino Del Regno

On 11/4/22 8:17 AM, Maxime Ripard wrote:
> The Davinci DA8xxx cfgchip "clk48" clock implements a mux with a
> set_parent hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.

The parent is defined in the device tree and is not expected to change
at runtime, so if I am understanding the patch correctly, setting the
CLK_SET_RATE_NO_REPARENT flag seems correct.

> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index c04276bc4051..4c1cc59bba53 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -565,6 +565,7 @@ static u8 da8xx_usb1_clk48_get_parent(struct clk_hw *hw)
>   }
>   
>   static const struct clk_ops da8xx_usb1_clk48_ops = {
> +	.determine_rate	= __clk_mux_determine_rate,
>   	.set_parent	= da8xx_usb1_clk48_set_parent,
>   	.get_parent	= da8xx_usb1_clk48_get_parent,
>   };
> @@ -589,6 +590,7 @@ da8xx_cfgchip_register_usb1_clk48(struct device *dev,
>   
>   	init.name = "usb1_clk48";
>   	init.ops = &da8xx_usb1_clk48_ops;
> +	init.flags = CLK_SET_RATE_NO_REPARENT;
>   	init.parent_names = parent_names;
>   	init.num_parents = 2;
>   
> 


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
  2022-11-04 13:18   ` Maxime Ripard
  (?)
@ 2022-11-04 16:49     ` David Lechner
  -1 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:49 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On 11/4/22 8:18 AM, Maxime Ripard wrote:
> The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
> 
> However, It's hard to tell whether it's been done on purpose or not.
> 
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.

I think this one should be the same as the clk:davinci changes and
not allow re-parenting. Since this is a USB 48MHz PHY clock, a rate
change will never be requested.

> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index 4c1cc59bba53..f60c97091818 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -462,10 +462,12 @@ static unsigned long da8xx_usb0_clk48_recalc_rate(struct clk_hw *hw,
>   	return 48000000;
>   }
>   
> -static long da8xx_usb0_clk48_round_rate(struct clk_hw *hw, unsigned long rate,
> -					unsigned long *parent_rate)
> +static int da8xx_usb0_clk48_determine_rate(struct clk_hw *hw,
> +					   struct clk_rate_request *req)
>   {
> -	return 48000000;
> +	req->rate = 48000000;
> +
> +	return 0;
>   }
>   
>   static int da8xx_usb0_clk48_set_parent(struct clk_hw *hw, u8 index)
> @@ -494,7 +496,7 @@ static const struct clk_ops da8xx_usb0_clk48_ops = {
>   	.disable	= da8xx_usb0_clk48_disable,
>   	.is_enabled	= da8xx_usb0_clk48_is_enabled,
>   	.recalc_rate	= da8xx_usb0_clk48_recalc_rate,
> -	.round_rate	= da8xx_usb0_clk48_round_rate,
> +	.determine_rate	= da8xx_usb0_clk48_determine_rate,
>   	.set_parent	= da8xx_usb0_clk48_set_parent,
>   	.get_parent	= da8xx_usb0_clk48_get_parent,
>   };
> 


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
@ 2022-11-04 16:49     ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:49 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On 11/4/22 8:18 AM, Maxime Ripard wrote:
> The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
> 
> However, It's hard to tell whether it's been done on purpose or not.
> 
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.

I think this one should be the same as the clk:davinci changes and
not allow re-parenting. Since this is a USB 48MHz PHY clock, a rate
change will never be requested.

> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index 4c1cc59bba53..f60c97091818 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -462,10 +462,12 @@ static unsigned long da8xx_usb0_clk48_recalc_rate(struct clk_hw *hw,
>   	return 48000000;
>   }
>   
> -static long da8xx_usb0_clk48_round_rate(struct clk_hw *hw, unsigned long rate,
> -					unsigned long *parent_rate)
> +static int da8xx_usb0_clk48_determine_rate(struct clk_hw *hw,
> +					   struct clk_rate_request *req)
>   {
> -	return 48000000;
> +	req->rate = 48000000;
> +
> +	return 0;
>   }
>   
>   static int da8xx_usb0_clk48_set_parent(struct clk_hw *hw, u8 index)
> @@ -494,7 +496,7 @@ static const struct clk_ops da8xx_usb0_clk48_ops = {
>   	.disable	= da8xx_usb0_clk48_disable,
>   	.is_enabled	= da8xx_usb0_clk48_is_enabled,
>   	.recalc_rate	= da8xx_usb0_clk48_recalc_rate,
> -	.round_rate	= da8xx_usb0_clk48_round_rate,
> +	.determine_rate	= da8xx_usb0_clk48_determine_rate,
>   	.set_parent	= da8xx_usb0_clk48_set_parent,
>   	.get_parent	= da8xx_usb0_clk48_get_parent,
>   };
> 


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
@ 2022-11-04 16:49     ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-04 16:49 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, linux-phy, linux-sunxi, linux-stm32,
	linux-arm-kernel, AngeloGioacchino Del Regno

On 11/4/22 8:18 AM, Maxime Ripard wrote:
> The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
> 
> However, It's hard to tell whether it's been done on purpose or not.
> 
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.

I think this one should be the same as the clk:davinci changes and
not allow re-parenting. Since this is a USB 48MHz PHY clock, a rate
change will never be requested.

> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/clk/davinci/da8xx-cfgchip.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
> index 4c1cc59bba53..f60c97091818 100644
> --- a/drivers/clk/davinci/da8xx-cfgchip.c
> +++ b/drivers/clk/davinci/da8xx-cfgchip.c
> @@ -462,10 +462,12 @@ static unsigned long da8xx_usb0_clk48_recalc_rate(struct clk_hw *hw,
>   	return 48000000;
>   }
>   
> -static long da8xx_usb0_clk48_round_rate(struct clk_hw *hw, unsigned long rate,
> -					unsigned long *parent_rate)
> +static int da8xx_usb0_clk48_determine_rate(struct clk_hw *hw,
> +					   struct clk_rate_request *req)
>   {
> -	return 48000000;
> +	req->rate = 48000000;
> +
> +	return 0;
>   }
>   
>   static int da8xx_usb0_clk48_set_parent(struct clk_hw *hw, u8 index)
> @@ -494,7 +496,7 @@ static const struct clk_ops da8xx_usb0_clk48_ops = {
>   	.disable	= da8xx_usb0_clk48_disable,
>   	.is_enabled	= da8xx_usb0_clk48_is_enabled,
>   	.recalc_rate	= da8xx_usb0_clk48_recalc_rate,
> -	.round_rate	= da8xx_usb0_clk48_round_rate,
> +	.determine_rate	= da8xx_usb0_clk48_determine_rate,
>   	.set_parent	= da8xx_usb0_clk48_set_parent,
>   	.get_parent	= da8xx_usb0_clk48_get_parent,
>   };
> 


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-04 14:59       ` Maxime Ripard
  (?)
  (?)
@ 2022-11-04 17:35         ` Aidan MacDonald
  -1 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2022-11-04 17:35 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Paul Cercueil, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Maxime Ripard <maxime@cerno.tech> writes:

> Hi Paul,
>
> On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
>> écrit :
>> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
>> > doesn't provide a determine_rate implementation.
>> >
>> > This is a bit odd, since set_parent() is there to, as its name implies,
>> > change the parent of a clock. However, the most likely candidate to
>> > trigger that parent change is a call to clk_set_rate(), with
>> > determine_rate() figuring out which parent is the best suited for a
>> > given rate.
>> >
>> > The other trigger would be a call to clk_set_parent(), but it's far less
>> > used, and it doesn't look like there's any obvious user for that clock.
>> >
>> > So, the set_parent hook is effectively unused, possibly because of an
>> > oversight. However, it could also be an explicit decision by the
>> > original author to avoid any reparenting but through an explicit call to
>> > clk_set_parent().
>> >
>> > The driver does implement round_rate() though, which means that we can
>> > change the rate of the clock, but we will never get to change the
>> > parent.
>> >
>> > However, It's hard to tell whether it's been done on purpose or not.
>> >
>> > Since we'll start mandating a determine_rate() implementation, let's
>> > convert the round_rate() implementation to a determine_rate(), which
>> > will also make the current behavior explicit. And if it was an
>> > oversight, the clock behaviour can be adjusted later on.
>>
>> So it's partly on purpose, partly because I didn't know about
>> .determine_rate.
>>
>> There's nothing odd about having a lonely .set_parent callback; in my case
>> the clocks are parented from the device tree.
>>
>> Having the clocks driver trigger a parent change when requesting a rate
>> change sounds very dangerous, IMHO. My MMC controller can be parented to the
>> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
>> to one of the PLLs. That works as long as the PLLs don't change rate, but if
>> one is configured as driving the CPU clock, it becomes messy.
>> The thing is, the clocks driver has no way to know whether or not it is
>> "safe" to use a designated parent.
>>
>> For that reason, in practice, I never actually want to have a clock
>> re-parented - it's almost always a bad idea vs. sticking to the parent clock
>> configured in the DTS.
>
> Yeah, and this is totally fine. But we need to be explicit about it. The
> determine_rate implementation I did in all the patches is an exact
> equivalent to the round_rate one if there was one. We will never ask to
> change the parent.
>
> Given what you just said, I would suggest to set the
> CLK_SET_RATE_NO_REPARENT flag as well.
>

Ideally there should be a way for drivers and the device tree to
say, "clock X must be driven by clock Y", but the clock framework
would be allowed to re-parent clocks freely as long as it doesn't
violate any DT or driver constraints.

That way allowing reparenting doesn't need to be an all-or-nothing
thing, and it doesn't need to be decided at the clock driver level
with special flags.

Regards,
Aidan

>> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>> > ---
>> >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>> >  1 file changed, 8 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
>> > index 1f7ba30f5a1b..0c9c8344ad11 100644
>> > --- a/drivers/clk/ingenic/cgu.c
>> > +++ b/drivers/clk/ingenic/cgu.c
>> > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>> >  	return div;
>> >  }
>> >
>> > -static long
>> > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
>> > -		       unsigned long *parent_rate)
>> > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
>> > +				      struct clk_rate_request *req)
>> >  {
>> >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>> >  	const struct ingenic_cgu_clk_info *clk_info =
>> > to_clk_info(ingenic_clk);
>> >  	unsigned int div = 1;
>> >
>> >  	if (clk_info->type & CGU_CLK_DIV)
>> > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
>> > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
>> > +					   req->rate);
>>
>> Sorry but I'm not sure that this works.
>>
>> You replace the "parent_rate" with the "best_parent_rate", and that means
>> you only check the requested rate vs. the parent with the highest frequency,
>> and not vs. the actual parent that will be used.
>
> best_parent_rate is initialized to the current parent rate, not the
> parent with the highest frequency:
> https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471
>
> Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 17:35         ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2022-11-04 17:35 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Paul Cercueil, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Maxime Ripard <maxime@cerno.tech> writes:

> Hi Paul,
>
> On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
>> écrit :
>> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
>> > doesn't provide a determine_rate implementation.
>> >
>> > This is a bit odd, since set_parent() is there to, as its name implies,
>> > change the parent of a clock. However, the most likely candidate to
>> > trigger that parent change is a call to clk_set_rate(), with
>> > determine_rate() figuring out which parent is the best suited for a
>> > given rate.
>> >
>> > The other trigger would be a call to clk_set_parent(), but it's far less
>> > used, and it doesn't look like there's any obvious user for that clock.
>> >
>> > So, the set_parent hook is effectively unused, possibly because of an
>> > oversight. However, it could also be an explicit decision by the
>> > original author to avoid any reparenting but through an explicit call to
>> > clk_set_parent().
>> >
>> > The driver does implement round_rate() though, which means that we can
>> > change the rate of the clock, but we will never get to change the
>> > parent.
>> >
>> > However, It's hard to tell whether it's been done on purpose or not.
>> >
>> > Since we'll start mandating a determine_rate() implementation, let's
>> > convert the round_rate() implementation to a determine_rate(), which
>> > will also make the current behavior explicit. And if it was an
>> > oversight, the clock behaviour can be adjusted later on.
>>
>> So it's partly on purpose, partly because I didn't know about
>> .determine_rate.
>>
>> There's nothing odd about having a lonely .set_parent callback; in my case
>> the clocks are parented from the device tree.
>>
>> Having the clocks driver trigger a parent change when requesting a rate
>> change sounds very dangerous, IMHO. My MMC controller can be parented to the
>> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
>> to one of the PLLs. That works as long as the PLLs don't change rate, but if
>> one is configured as driving the CPU clock, it becomes messy.
>> The thing is, the clocks driver has no way to know whether or not it is
>> "safe" to use a designated parent.
>>
>> For that reason, in practice, I never actually want to have a clock
>> re-parented - it's almost always a bad idea vs. sticking to the parent clock
>> configured in the DTS.
>
> Yeah, and this is totally fine. But we need to be explicit about it. The
> determine_rate implementation I did in all the patches is an exact
> equivalent to the round_rate one if there was one. We will never ask to
> change the parent.
>
> Given what you just said, I would suggest to set the
> CLK_SET_RATE_NO_REPARENT flag as well.
>

Ideally there should be a way for drivers and the device tree to
say, "clock X must be driven by clock Y", but the clock framework
would be allowed to re-parent clocks freely as long as it doesn't
violate any DT or driver constraints.

That way allowing reparenting doesn't need to be an all-or-nothing
thing, and it doesn't need to be decided at the clock driver level
with special flags.

Regards,
Aidan

>> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>> > ---
>> >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>> >  1 file changed, 8 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
>> > index 1f7ba30f5a1b..0c9c8344ad11 100644
>> > --- a/drivers/clk/ingenic/cgu.c
>> > +++ b/drivers/clk/ingenic/cgu.c
>> > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>> >  	return div;
>> >  }
>> >
>> > -static long
>> > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
>> > -		       unsigned long *parent_rate)
>> > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
>> > +				      struct clk_rate_request *req)
>> >  {
>> >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>> >  	const struct ingenic_cgu_clk_info *clk_info =
>> > to_clk_info(ingenic_clk);
>> >  	unsigned int div = 1;
>> >
>> >  	if (clk_info->type & CGU_CLK_DIV)
>> > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
>> > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
>> > +					   req->rate);
>>
>> Sorry but I'm not sure that this works.
>>
>> You replace the "parent_rate" with the "best_parent_rate", and that means
>> you only check the requested rate vs. the parent with the highest frequency,
>> and not vs. the actual parent that will be used.
>
> best_parent_rate is initialized to the current parent rate, not the
> parent with the highest frequency:
> https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471
>
> Maxime

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 17:35         ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2022-11-04 17:35 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea


Maxime Ripard <maxime@cerno.tech> writes:

> Hi Paul,
>
> On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
>> écrit :
>> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
>> > doesn't provide a determine_rate implementation.
>> >
>> > This is a bit odd, since set_parent() is there to, as its name implies,
>> > change the parent of a clock. However, the most likely candidate to
>> > trigger that parent change is a call to clk_set_rate(), with
>> > determine_rate() figuring out which parent is the best suited for a
>> > given rate.
>> >
>> > The other trigger would be a call to clk_set_parent(), but it's far less
>> > used, and it doesn't look like there's any obvious user for that clock.
>> >
>> > So, the set_parent hook is effectively unused, possibly because of an
>> > oversight. However, it could also be an explicit decision by the
>> > original author to avoid any reparenting but through an explicit call to
>> > clk_set_parent().
>> >
>> > The driver does implement round_rate() though, which means that we can
>> > change the rate of the clock, but we will never get to change the
>> > parent.
>> >
>> > However, It's hard to tell whether it's been done on purpose or not.
>> >
>> > Since we'll start mandating a determine_rate() implementation, let's
>> > convert the round_rate() implementation to a determine_rate(), which
>> > will also make the current behavior explicit. And if it was an
>> > oversight, the clock behaviour can be adjusted later on.
>>
>> So it's partly on purpose, partly because I didn't know about
>> .determine_rate.
>>
>> There's nothing odd about having a lonely .set_parent callback; in my case
>> the clocks are parented from the device tree.
>>
>> Having the clocks driver trigger a parent change when requesting a rate
>> change sounds very dangerous, IMHO. My MMC controller can be parented to the
>> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
>> to one of the PLLs. That works as long as the PLLs don't change rate, but if
>> one is configured as driving the CPU clock, it becomes messy.
>> The thing is, the clocks driver has no way to know whether or not it is
>> "safe" to use a designated parent.
>>
>> For that reason, in practice, I never actually want to have a clock
>> re-parented - it's almost always a bad idea vs. sticking to the parent clock
>> configured in the DTS.
>
> Yeah, and this is totally fine. But we need to be explicit about it. The
> determine_rate implementation I did in all the patches is an exact
> equivalent to the round_rate one if there was one. We will never ask to
> change the parent.
>
> Given what you just said, I would suggest to set the
> CLK_SET_RATE_NO_REPARENT flag as well.
>

Ideally there should be a way for drivers and the device tree to
say, "clock X must be driven by clock Y", but the clock framework
would be allowed to re-parent clocks freely as long as it doesn't
violate any DT or driver constraints.

That way allowing reparenting doesn't need to be an all-or-nothing
thing, and it doesn't need to be decided at the clock driver level
with special flags.

Regards,
Aidan

>> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>> > ---
>> >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>> >  1 file changed, 8 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
>> > index 1f7ba30f5a1b..0c9c8344ad11 100644
>> > --- a/drivers/clk/ingenic/cgu.c
>> > +++ b/drivers/clk/ingenic/cgu.c
>> > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>> >  	return div;
>> >  }
>> >
>> > -static long
>> > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
>> > -		       unsigned long *parent_rate)
>> > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
>> > +				      struct clk_rate_request *req)
>> >  {
>> >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>> >  	const struct ingenic_cgu_clk_info *clk_info =
>> > to_clk_info(ingenic_clk);
>> >  	unsigned int div = 1;
>> >
>> >  	if (clk_info->type & CGU_CLK_DIV)
>> > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
>> > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
>> > +					   req->rate);
>>
>> Sorry but I'm not sure that this works.
>>
>> You replace the "parent_rate" with the "best_parent_rate", and that means
>> you only check the requested rate vs. the parent with the highest frequency,
>> and not vs. the actual parent that will be used.
>
> best_parent_rate is initialized to the current parent rate, not the
> parent with the highest frequency:
> https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471
>
> Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-04 17:35         ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2022-11-04 17:35 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea


Maxime Ripard <maxime@cerno.tech> writes:

> Hi Paul,
>
> On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
>> écrit :
>> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
>> > doesn't provide a determine_rate implementation.
>> >
>> > This is a bit odd, since set_parent() is there to, as its name implies,
>> > change the parent of a clock. However, the most likely candidate to
>> > trigger that parent change is a call to clk_set_rate(), with
>> > determine_rate() figuring out which parent is the best suited for a
>> > given rate.
>> >
>> > The other trigger would be a call to clk_set_parent(), but it's far less
>> > used, and it doesn't look like there's any obvious user for that clock.
>> >
>> > So, the set_parent hook is effectively unused, possibly because of an
>> > oversight. However, it could also be an explicit decision by the
>> > original author to avoid any reparenting but through an explicit call to
>> > clk_set_parent().
>> >
>> > The driver does implement round_rate() though, which means that we can
>> > change the rate of the clock, but we will never get to change the
>> > parent.
>> >
>> > However, It's hard to tell whether it's been done on purpose or not.
>> >
>> > Since we'll start mandating a determine_rate() implementation, let's
>> > convert the round_rate() implementation to a determine_rate(), which
>> > will also make the current behavior explicit. And if it was an
>> > oversight, the clock behaviour can be adjusted later on.
>>
>> So it's partly on purpose, partly because I didn't know about
>> .determine_rate.
>>
>> There's nothing odd about having a lonely .set_parent callback; in my case
>> the clocks are parented from the device tree.
>>
>> Having the clocks driver trigger a parent change when requesting a rate
>> change sounds very dangerous, IMHO. My MMC controller can be parented to the
>> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
>> to one of the PLLs. That works as long as the PLLs don't change rate, but if
>> one is configured as driving the CPU clock, it becomes messy.
>> The thing is, the clocks driver has no way to know whether or not it is
>> "safe" to use a designated parent.
>>
>> For that reason, in practice, I never actually want to have a clock
>> re-parented - it's almost always a bad idea vs. sticking to the parent clock
>> configured in the DTS.
>
> Yeah, and this is totally fine. But we need to be explicit about it. The
> determine_rate implementation I did in all the patches is an exact
> equivalent to the round_rate one if there was one. We will never ask to
> change the parent.
>
> Given what you just said, I would suggest to set the
> CLK_SET_RATE_NO_REPARENT flag as well.
>

Ideally there should be a way for drivers and the device tree to
say, "clock X must be driven by clock Y", but the clock framework
would be allowed to re-parent clocks freely as long as it doesn't
violate any DT or driver constraints.

That way allowing reparenting doesn't need to be an all-or-nothing
thing, and it doesn't need to be decided at the clock driver level
with special flags.

Regards,
Aidan

>> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>> > ---
>> >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>> >  1 file changed, 8 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
>> > index 1f7ba30f5a1b..0c9c8344ad11 100644
>> > --- a/drivers/clk/ingenic/cgu.c
>> > +++ b/drivers/clk/ingenic/cgu.c
>> > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>> >  	return div;
>> >  }
>> >
>> > -static long
>> > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
>> > -		       unsigned long *parent_rate)
>> > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
>> > +				      struct clk_rate_request *req)
>> >  {
>> >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>> >  	const struct ingenic_cgu_clk_info *clk_info =
>> > to_clk_info(ingenic_clk);
>> >  	unsigned int div = 1;
>> >
>> >  	if (clk_info->type & CGU_CLK_DIV)
>> > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate);
>> > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
>> > +					   req->rate);
>>
>> Sorry but I'm not sure that this works.
>>
>> You replace the "parent_rate" with the "best_parent_rate", and that means
>> you only check the requested rate vs. the parent with the highest frequency,
>> and not vs. the actual parent that will be used.
>
> best_parent_rate is initialized to the current parent rate, not the
> parent with the highest frequency:
> https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471
>
> Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 42/65] rtc: sun6i: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
@ 2022-11-05  3:45     ` Samuel Holland
  -1 siblings, 0 replies; 388+ messages in thread
From: Samuel Holland @ 2022-11-05  3:45 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Chen-Yu Tsai, Michael Turquette,
	Alessandro Zummo, Alexandre Belloni, Jernej Skrabec
  Cc: linux-clk, linux-rtc, linux-arm-kernel, linux-sunxi, linux-kernel

Hi Maxime,

On 11/4/22 08:17, Maxime Ripard wrote:
> The Allwinner sun6i RTC clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

For this driver, we always want to use the more accurate parent if it is
available. The driver enforces this in the probe function already, so I
think it would be better to just remove the .set_parent implementation.

Regards,
Samuel


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 42/65] rtc: sun6i: Add a determine_rate hook
@ 2022-11-05  3:45     ` Samuel Holland
  0 siblings, 0 replies; 388+ messages in thread
From: Samuel Holland @ 2022-11-05  3:45 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Chen-Yu Tsai, Michael Turquette,
	Alessandro Zummo, Alexandre Belloni, Jernej Skrabec
  Cc: linux-clk, linux-rtc, linux-arm-kernel, linux-sunxi, linux-kernel

Hi Maxime,

On 11/4/22 08:17, Maxime Ripard wrote:
> The Allwinner sun6i RTC clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

For this driver, we always want to use the more accurate parent if it is
available. The driver enforces this in the probe function already, so I
think it would be better to just remove the .set_parent implementation.

Regards,
Samuel


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-04 14:59       ` Maxime Ripard
  (?)
  (?)
@ 2022-11-05 10:33         ` Paul Cercueil
  -1 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-05 10:33 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> Hi Paul,
> 
> On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>>  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard 
>> <maxime@cerno.tech> a
>>  écrit :
>>  > The Ingenic CGU clocks implements a mux with a set_parent hook, 
>> but
>>  > doesn't provide a determine_rate implementation.
>>  >
>>  > This is a bit odd, since set_parent() is there to, as its name 
>> implies,
>>  > change the parent of a clock. However, the most likely candidate 
>> to
>>  > trigger that parent change is a call to clk_set_rate(), with
>>  > determine_rate() figuring out which parent is the best suited for 
>> a
>>  > given rate.
>>  >
>>  > The other trigger would be a call to clk_set_parent(), but it's 
>> far less
>>  > used, and it doesn't look like there's any obvious user for that 
>> clock.
>>  >
>>  > So, the set_parent hook is effectively unused, possibly because 
>> of an
>>  > oversight. However, it could also be an explicit decision by the
>>  > original author to avoid any reparenting but through an explicit 
>> call to
>>  > clk_set_parent().
>>  >
>>  > The driver does implement round_rate() though, which means that 
>> we can
>>  > change the rate of the clock, but we will never get to change the
>>  > parent.
>>  >
>>  > However, It's hard to tell whether it's been done on purpose or 
>> not.
>>  >
>>  > Since we'll start mandating a determine_rate() implementation, 
>> let's
>>  > convert the round_rate() implementation to a determine_rate(), 
>> which
>>  > will also make the current behavior explicit. And if it was an
>>  > oversight, the clock behaviour can be adjusted later on.
>> 
>>  So it's partly on purpose, partly because I didn't know about
>>  .determine_rate.
>> 
>>  There's nothing odd about having a lonely .set_parent callback; in 
>> my case
>>  the clocks are parented from the device tree.
>> 
>>  Having the clocks driver trigger a parent change when requesting a 
>> rate
>>  change sounds very dangerous, IMHO. My MMC controller can be 
>> parented to the
>>  external 48 MHz oscillator, and if the card requests 50 MHz, it 
>> could switch
>>  to one of the PLLs. That works as long as the PLLs don't change 
>> rate, but if
>>  one is configured as driving the CPU clock, it becomes messy.
>>  The thing is, the clocks driver has no way to know whether or not 
>> it is
>>  "safe" to use a designated parent.
>> 
>>  For that reason, in practice, I never actually want to have a clock
>>  re-parented - it's almost always a bad idea vs. sticking to the 
>> parent clock
>>  configured in the DTS.
> 
> Yeah, and this is totally fine. But we need to be explicit about it. 
> The
> determine_rate implementation I did in all the patches is an exact
> equivalent to the round_rate one if there was one. We will never ask 
> to
> change the parent.
> 
> Given what you just said, I would suggest to set the
> CLK_SET_RATE_NO_REPARENT flag as well.

But that would introduce policy into the driver... The fact that I 
don't want the MMC parented to the PLLs, doesn't mean that it's an 
invalid configuration per se.

Cheers,
-Paul

>> 
>>  > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>>  > ---
>>  >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>>  >  1 file changed, 8 insertions(+), 7 deletions(-)
>>  >
>>  > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
>>  > index 1f7ba30f5a1b..0c9c8344ad11 100644
>>  > --- a/drivers/clk/ingenic/cgu.c
>>  > +++ b/drivers/clk/ingenic/cgu.c
>>  > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>>  >  	return div;
>>  >  }
>>  >
>>  > -static long
>>  > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
>>  > -		       unsigned long *parent_rate)
>>  > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
>>  > +				      struct clk_rate_request *req)
>>  >  {
>>  >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>>  >  	const struct ingenic_cgu_clk_info *clk_info =
>>  > to_clk_info(ingenic_clk);
>>  >  	unsigned int div = 1;
>>  >
>>  >  	if (clk_info->type & CGU_CLK_DIV)
>>  > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, 
>> req_rate);
>>  > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
>>  > +					   req->rate);
>> 
>>  Sorry but I'm not sure that this works.
>> 
>>  You replace the "parent_rate" with the "best_parent_rate", and that 
>> means
>>  you only check the requested rate vs. the parent with the highest 
>> frequency,
>>  and not vs. the actual parent that will be used.
> 
> best_parent_rate is initialized to the current parent rate, not the
> parent with the highest frequency:
> https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471
> 
> Maxime



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-05 10:33         ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-05 10:33 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> Hi Paul,
> 
> On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>>  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard 
>> <maxime@cerno.tech> a
>>  écrit :
>>  > The Ingenic CGU clocks implements a mux with a set_parent hook, 
>> but
>>  > doesn't provide a determine_rate implementation.
>>  >
>>  > This is a bit odd, since set_parent() is there to, as its name 
>> implies,
>>  > change the parent of a clock. However, the most likely candidate 
>> to
>>  > trigger that parent change is a call to clk_set_rate(), with
>>  > determine_rate() figuring out which parent is the best suited for 
>> a
>>  > given rate.
>>  >
>>  > The other trigger would be a call to clk_set_parent(), but it's 
>> far less
>>  > used, and it doesn't look like there's any obvious user for that 
>> clock.
>>  >
>>  > So, the set_parent hook is effectively unused, possibly because 
>> of an
>>  > oversight. However, it could also be an explicit decision by the
>>  > original author to avoid any reparenting but through an explicit 
>> call to
>>  > clk_set_parent().
>>  >
>>  > The driver does implement round_rate() though, which means that 
>> we can
>>  > change the rate of the clock, but we will never get to change the
>>  > parent.
>>  >
>>  > However, It's hard to tell whether it's been done on purpose or 
>> not.
>>  >
>>  > Since we'll start mandating a determine_rate() implementation, 
>> let's
>>  > convert the round_rate() implementation to a determine_rate(), 
>> which
>>  > will also make the current behavior explicit. And if it was an
>>  > oversight, the clock behaviour can be adjusted later on.
>> 
>>  So it's partly on purpose, partly because I didn't know about
>>  .determine_rate.
>> 
>>  There's nothing odd about having a lonely .set_parent callback; in 
>> my case
>>  the clocks are parented from the device tree.
>> 
>>  Having the clocks driver trigger a parent change when requesting a 
>> rate
>>  change sounds very dangerous, IMHO. My MMC controller can be 
>> parented to the
>>  external 48 MHz oscillator, and if the card requests 50 MHz, it 
>> could switch
>>  to one of the PLLs. That works as long as the PLLs don't change 
>> rate, but if
>>  one is configured as driving the CPU clock, it becomes messy.
>>  The thing is, the clocks driver has no way to know whether or not 
>> it is
>>  "safe" to use a designated parent.
>> 
>>  For that reason, in practice, I never actually want to have a clock
>>  re-parented - it's almost always a bad idea vs. sticking to the 
>> parent clock
>>  configured in the DTS.
> 
> Yeah, and this is totally fine. But we need to be explicit about it. 
> The
> determine_rate implementation I did in all the patches is an exact
> equivalent to the round_rate one if there was one. We will never ask 
> to
> change the parent.
> 
> Given what you just said, I would suggest to set the
> CLK_SET_RATE_NO_REPARENT flag as well.

But that would introduce policy into the driver... The fact that I 
don't want the MMC parented to the PLLs, doesn't mean that it's an 
invalid configuration per se.

Cheers,
-Paul

>> 
>>  > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>>  > ---
>>  >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>>  >  1 file changed, 8 insertions(+), 7 deletions(-)
>>  >
>>  > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
>>  > index 1f7ba30f5a1b..0c9c8344ad11 100644
>>  > --- a/drivers/clk/ingenic/cgu.c
>>  > +++ b/drivers/clk/ingenic/cgu.c
>>  > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>>  >  	return div;
>>  >  }
>>  >
>>  > -static long
>>  > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
>>  > -		       unsigned long *parent_rate)
>>  > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
>>  > +				      struct clk_rate_request *req)
>>  >  {
>>  >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>>  >  	const struct ingenic_cgu_clk_info *clk_info =
>>  > to_clk_info(ingenic_clk);
>>  >  	unsigned int div = 1;
>>  >
>>  >  	if (clk_info->type & CGU_CLK_DIV)
>>  > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, 
>> req_rate);
>>  > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
>>  > +					   req->rate);
>> 
>>  Sorry but I'm not sure that this works.
>> 
>>  You replace the "parent_rate" with the "best_parent_rate", and that 
>> means
>>  you only check the requested rate vs. the parent with the highest 
>> frequency,
>>  and not vs. the actual parent that will be used.
> 
> best_parent_rate is initialized to the current parent rate, not the
> parent with the highest frequency:
> https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471
> 
> Maxime



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-05 10:33         ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-05 10:33 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> Hi Paul,
> 
> On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>>  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard 
>> <maxime@cerno.tech> a
>>  écrit :
>>  > The Ingenic CGU clocks implements a mux with a set_parent hook, 
>> but
>>  > doesn't provide a determine_rate implementation.
>>  >
>>  > This is a bit odd, since set_parent() is there to, as its name 
>> implies,
>>  > change the parent of a clock. However, the most likely candidate 
>> to
>>  > trigger that parent change is a call to clk_set_rate(), with
>>  > determine_rate() figuring out which parent is the best suited for 
>> a
>>  > given rate.
>>  >
>>  > The other trigger would be a call to clk_set_parent(), but it's 
>> far less
>>  > used, and it doesn't look like there's any obvious user for that 
>> clock.
>>  >
>>  > So, the set_parent hook is effectively unused, possibly because 
>> of an
>>  > oversight. However, it could also be an explicit decision by the
>>  > original author to avoid any reparenting but through an explicit 
>> call to
>>  > clk_set_parent().
>>  >
>>  > The driver does implement round_rate() though, which means that 
>> we can
>>  > change the rate of the clock, but we will never get to change the
>>  > parent.
>>  >
>>  > However, It's hard to tell whether it's been done on purpose or 
>> not.
>>  >
>>  > Since we'll start mandating a determine_rate() implementation, 
>> let's
>>  > convert the round_rate() implementation to a determine_rate(), 
>> which
>>  > will also make the current behavior explicit. And if it was an
>>  > oversight, the clock behaviour can be adjusted later on.
>> 
>>  So it's partly on purpose, partly because I didn't know about
>>  .determine_rate.
>> 
>>  There's nothing odd about having a lonely .set_parent callback; in 
>> my case
>>  the clocks are parented from the device tree.
>> 
>>  Having the clocks driver trigger a parent change when requesting a 
>> rate
>>  change sounds very dangerous, IMHO. My MMC controller can be 
>> parented to the
>>  external 48 MHz oscillator, and if the card requests 50 MHz, it 
>> could switch
>>  to one of the PLLs. That works as long as the PLLs don't change 
>> rate, but if
>>  one is configured as driving the CPU clock, it becomes messy.
>>  The thing is, the clocks driver has no way to know whether or not 
>> it is
>>  "safe" to use a designated parent.
>> 
>>  For that reason, in practice, I never actually want to have a clock
>>  re-parented - it's almost always a bad idea vs. sticking to the 
>> parent clock
>>  configured in the DTS.
> 
> Yeah, and this is totally fine. But we need to be explicit about it. 
> The
> determine_rate implementation I did in all the patches is an exact
> equivalent to the round_rate one if there was one. We will never ask 
> to
> change the parent.
> 
> Given what you just said, I would suggest to set the
> CLK_SET_RATE_NO_REPARENT flag as well.

But that would introduce policy into the driver... The fact that I 
don't want the MMC parented to the PLLs, doesn't mean that it's an 
invalid configuration per se.

Cheers,
-Paul

>> 
>>  > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>>  > ---
>>  >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>>  >  1 file changed, 8 insertions(+), 7 deletions(-)
>>  >
>>  > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
>>  > index 1f7ba30f5a1b..0c9c8344ad11 100644
>>  > --- a/drivers/clk/ingenic/cgu.c
>>  > +++ b/drivers/clk/ingenic/cgu.c
>>  > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>>  >  	return div;
>>  >  }
>>  >
>>  > -static long
>>  > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
>>  > -		       unsigned long *parent_rate)
>>  > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
>>  > +				      struct clk_rate_request *req)
>>  >  {
>>  >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>>  >  	const struct ingenic_cgu_clk_info *clk_info =
>>  > to_clk_info(ingenic_clk);
>>  >  	unsigned int div = 1;
>>  >
>>  >  	if (clk_info->type & CGU_CLK_DIV)
>>  > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, 
>> req_rate);
>>  > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
>>  > +					   req->rate);
>> 
>>  Sorry but I'm not sure that this works.
>> 
>>  You replace the "parent_rate" with the "best_parent_rate", and that 
>> means
>>  you only check the requested rate vs. the parent with the highest 
>> frequency,
>>  and not vs. the actual parent that will be used.
> 
> best_parent_rate is initialized to the current parent rate, not the
> parent with the highest frequency:
> https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471
> 
> Maxime



-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-05 10:33         ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-05 10:33 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Max Filippov, Thierry Reding, linux-phy, David Airlie,
	Fabio Estevam, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	Linus Walleij, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> Hi Paul,
> 
> On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>>  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard 
>> <maxime@cerno.tech> a
>>  écrit :
>>  > The Ingenic CGU clocks implements a mux with a set_parent hook, 
>> but
>>  > doesn't provide a determine_rate implementation.
>>  >
>>  > This is a bit odd, since set_parent() is there to, as its name 
>> implies,
>>  > change the parent of a clock. However, the most likely candidate 
>> to
>>  > trigger that parent change is a call to clk_set_rate(), with
>>  > determine_rate() figuring out which parent is the best suited for 
>> a
>>  > given rate.
>>  >
>>  > The other trigger would be a call to clk_set_parent(), but it's 
>> far less
>>  > used, and it doesn't look like there's any obvious user for that 
>> clock.
>>  >
>>  > So, the set_parent hook is effectively unused, possibly because 
>> of an
>>  > oversight. However, it could also be an explicit decision by the
>>  > original author to avoid any reparenting but through an explicit 
>> call to
>>  > clk_set_parent().
>>  >
>>  > The driver does implement round_rate() though, which means that 
>> we can
>>  > change the rate of the clock, but we will never get to change the
>>  > parent.
>>  >
>>  > However, It's hard to tell whether it's been done on purpose or 
>> not.
>>  >
>>  > Since we'll start mandating a determine_rate() implementation, 
>> let's
>>  > convert the round_rate() implementation to a determine_rate(), 
>> which
>>  > will also make the current behavior explicit. And if it was an
>>  > oversight, the clock behaviour can be adjusted later on.
>> 
>>  So it's partly on purpose, partly because I didn't know about
>>  .determine_rate.
>> 
>>  There's nothing odd about having a lonely .set_parent callback; in 
>> my case
>>  the clocks are parented from the device tree.
>> 
>>  Having the clocks driver trigger a parent change when requesting a 
>> rate
>>  change sounds very dangerous, IMHO. My MMC controller can be 
>> parented to the
>>  external 48 MHz oscillator, and if the card requests 50 MHz, it 
>> could switch
>>  to one of the PLLs. That works as long as the PLLs don't change 
>> rate, but if
>>  one is configured as driving the CPU clock, it becomes messy.
>>  The thing is, the clocks driver has no way to know whether or not 
>> it is
>>  "safe" to use a designated parent.
>> 
>>  For that reason, in practice, I never actually want to have a clock
>>  re-parented - it's almost always a bad idea vs. sticking to the 
>> parent clock
>>  configured in the DTS.
> 
> Yeah, and this is totally fine. But we need to be explicit about it. 
> The
> determine_rate implementation I did in all the patches is an exact
> equivalent to the round_rate one if there was one. We will never ask 
> to
> change the parent.
> 
> Given what you just said, I would suggest to set the
> CLK_SET_RATE_NO_REPARENT flag as well.

But that would introduce policy into the driver... The fact that I 
don't want the MMC parented to the PLLs, doesn't mean that it's an 
invalid configuration per se.

Cheers,
-Paul

>> 
>>  > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>>  > ---
>>  >  drivers/clk/ingenic/cgu.c | 15 ++++++++-------
>>  >  1 file changed, 8 insertions(+), 7 deletions(-)
>>  >
>>  > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
>>  > index 1f7ba30f5a1b..0c9c8344ad11 100644
>>  > --- a/drivers/clk/ingenic/cgu.c
>>  > +++ b/drivers/clk/ingenic/cgu.c
>>  > @@ -491,22 +491,23 @@ ingenic_clk_calc_div(struct clk_hw *hw,
>>  >  	return div;
>>  >  }
>>  >
>>  > -static long
>>  > -ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
>>  > -		       unsigned long *parent_rate)
>>  > +static int ingenic_clk_determine_rate(struct clk_hw *hw,
>>  > +				      struct clk_rate_request *req)
>>  >  {
>>  >  	struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
>>  >  	const struct ingenic_cgu_clk_info *clk_info =
>>  > to_clk_info(ingenic_clk);
>>  >  	unsigned int div = 1;
>>  >
>>  >  	if (clk_info->type & CGU_CLK_DIV)
>>  > -		div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, 
>> req_rate);
>>  > +		div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate,
>>  > +					   req->rate);
>> 
>>  Sorry but I'm not sure that this works.
>> 
>>  You replace the "parent_rate" with the "best_parent_rate", and that 
>> means
>>  you only check the requested rate vs. the parent with the highest 
>> frequency,
>>  and not vs. the actual parent that will be used.
> 
> best_parent_rate is initialized to the current parent rate, not the
> parent with the highest frequency:
> https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/clk/clk.c#L1471
> 
> Maxime



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 60/65] clk: stm32: composite: Switch to determine_rate
  2022-11-04 13:18   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-05 14:51   ` kernel test robot
  -1 siblings, 0 replies; 388+ messages in thread
From: kernel test robot @ 2022-11-05 14:51 UTC (permalink / raw)
  To: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald
  Cc: oe-kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3357 bytes --]

Hi Maxime,

I love your patch! Yet something to improve:

[auto build test ERROR on 61c3426aca2c71052ddcd06c32e29d92304990fd]

url:    https://github.com/intel-lab-lkp/linux/commits/Maxime-Ripard/clk-Make-determine_rate-mandatory-for-muxes/20221104-222530
base:   61c3426aca2c71052ddcd06c32e29d92304990fd
patch link:    https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v2-60-f6736dec138e%40cerno.tech
patch subject: [PATCH v2 60/65] clk: stm32: composite: Switch to determine_rate
config: arm-defconfig
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/1ded0df5b0a35f148b1dd640ef1547a76d3ec33a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Maxime-Ripard/clk-Make-determine_rate-mandatory-for-muxes/20221104-222530
        git checkout 1ded0df5b0a35f148b1dd640ef1547a76d3ec33a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/clk/stm32/clk-stm32-core.c:404:27: error: 'clk_stm32_divider_round_rate' undeclared here (not in a function); did you mean 'clk_stm32_divider_recalc_rate'?
     404 |         .round_rate     = clk_stm32_divider_round_rate,
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                           clk_stm32_divider_recalc_rate
>> drivers/clk/stm32/clk-stm32-core.c:616:27: error: 'clk_stm32_composite_determine_rate' undeclared here (not in a function); did you mean 'clk_stm32_composite_round_rate'?
     616 |         .determine_rate = clk_stm32_composite_determine_rate,
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                           clk_stm32_composite_round_rate
   drivers/clk/stm32/clk-stm32-core.c:440:13: warning: 'clk_stm32_composite_round_rate' defined but not used [-Wunused-function]
     440 | static long clk_stm32_composite_round_rate(struct clk_hw *hw, unsigned long rate,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/stm32/clk-stm32-core.c:352:12: warning: 'clk_stm32_divider_determine_rate' defined but not used [-Wunused-function]
     352 | static int clk_stm32_divider_determine_rate(struct clk_hw *hw,
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +404 drivers/clk/stm32/clk-stm32-core.c

720e34ab3e57e1 Gabriel Fernandez 2022-05-16  401  
720e34ab3e57e1 Gabriel Fernandez 2022-05-16  402  const struct clk_ops clk_stm32_divider_ops = {
720e34ab3e57e1 Gabriel Fernandez 2022-05-16  403  	.recalc_rate	= clk_stm32_divider_recalc_rate,
720e34ab3e57e1 Gabriel Fernandez 2022-05-16 @404  	.round_rate	= clk_stm32_divider_round_rate,
720e34ab3e57e1 Gabriel Fernandez 2022-05-16  405  	.set_rate	= clk_stm32_divider_set_rate,
720e34ab3e57e1 Gabriel Fernandez 2022-05-16  406  };
720e34ab3e57e1 Gabriel Fernandez 2022-05-16  407  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

[-- Attachment #2: config --]
[-- Type: text/plain, Size: 262997 bytes --]

#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 6.1.0-rc3 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="arm-linux-gnueabi-gcc (GCC) 12.1.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=120100
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23800
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=23800
CONFIG_LLD_VERSION=0
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
CONFIG_PAHOLE_VERSION=123
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
# CONFIG_WERROR is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_INIT=""
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_WATCH_QUEUE is not set
CONFIG_CROSS_MEMORY_ATTACH=y
# CONFIG_USELIB is not set
# CONFIG_AUDIT is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS=y
CONFIG_GENERIC_IRQ_IPI=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
# CONFIG_GENERIC_IRQ_DEBUGFS is not set
# end of IRQ subsystem

CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_ARCH_HAS_TICK_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_CONTEXT_TRACKING=y
CONFIG_CONTEXT_TRACKING_IDLE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
# CONFIG_NO_HZ is not set
CONFIG_HIGH_RES_TIMERS=y
# end of Timers subsystem

CONFIG_BPF=y
CONFIG_HAVE_EBPF_JIT=y

#
# BPF subsystem
#
# CONFIG_BPF_SYSCALL is not set
# CONFIG_BPF_JIT is not set
# end of BPF subsystem

CONFIG_PREEMPT_NONE_BUILD=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
CONFIG_SCHED_THERMAL_PRESSURE=y
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set
# CONFIG_PSI is not set
# end of CPU/Task time and stats accounting

CONFIG_CPU_ISOLATION=y

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_RCU_EXPERT is not set
CONFIG_SRCU=y
CONFIG_TREE_SRCU=y
CONFIG_NEED_SRCU_NMI_SAFE=y
CONFIG_RCU_STALL_COMMON=y
CONFIG_RCU_NEED_SEGCBLIST=y
# end of RCU Subsystem

# CONFIG_IKCONFIG is not set
# CONFIG_IKHEADERS is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13
# CONFIG_PRINTK_INDEX is not set
CONFIG_GENERIC_SCHED_CLOCK=y

#
# Scheduler features
#
# CONFIG_UCLAMP_TASK is not set
# end of Scheduler features

CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
CONFIG_GCC12_NO_ARRAY_BOUNDS=y
CONFIG_CC_NO_ARRAY_BOUNDS=y
CONFIG_CGROUPS=y
# CONFIG_CGROUP_FAVOR_DYNMODS is not set
# CONFIG_MEMCG is not set
# CONFIG_BLK_CGROUP is not set
# CONFIG_CGROUP_SCHED is not set
# CONFIG_CGROUP_PIDS is not set
# CONFIG_CGROUP_RDMA is not set
# CONFIG_CGROUP_FREEZER is not set
# CONFIG_CPUSETS is not set
# CONFIG_CGROUP_DEVICE is not set
# CONFIG_CGROUP_CPUACCT is not set
# CONFIG_CGROUP_PERF is not set
# CONFIG_CGROUP_MISC is not set
# CONFIG_CGROUP_DEBUG is not set
# CONFIG_NAMESPACES is not set
# CONFIG_CHECKPOINT_RESTORE is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
# CONFIG_RELAY is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
CONFIG_RD_LZO=y
CONFIG_RD_LZ4=y
CONFIG_RD_ZSTD=y
# CONFIG_BOOT_CONFIG is not set
CONFIG_INITRAMFS_PRESERVE_MTIME=y
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_LD_ORPHAN_WARN=y
CONFIG_LD_ORPHAN_WARN_LEVEL="warn"
CONFIG_SYSCTL=y
CONFIG_HAVE_UID16=y
CONFIG_EXPERT=y
CONFIG_UID16=y
CONFIG_MULTIUSER=y
# CONFIG_SGETMASK_SYSCALL is not set
CONFIG_SYSFS_SYSCALL=y
CONFIG_FHANDLE=y
CONFIG_POSIX_TIMERS=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_FUTEX_PI=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_IO_URING=y
CONFIG_ADVISE_SYSCALLS=y
CONFIG_MEMBARRIER=y
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_ALL is not set
CONFIG_KALLSYMS_BASE_RELATIVE=y
CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
CONFIG_KCMP=y
CONFIG_RSEQ=y
# CONFIG_DEBUG_RSEQ is not set
CONFIG_EMBEDDED=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_USE_VMALLOC=y
# CONFIG_PC104 is not set

#
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
# end of Kernel Performance Events And Counters

CONFIG_SYSTEM_DATA_VERIFICATION=y
# CONFIG_PROFILING is not set
CONFIG_TRACEPOINTS=y
# end of General setup

CONFIG_ARM=y
CONFIG_ARM_HAS_GROUP_RELOCS=y
CONFIG_ARM_DMA_USE_IOMMU=y
CONFIG_ARM_DMA_IOMMU_ALIGNMENT=8
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_NO_IOPORT_MAP=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_ARCH_HAS_BANDGAP=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIQ=y
CONFIG_ARM_PATCH_PHYS_VIRT=y
CONFIG_GENERIC_BUG=y
CONFIG_PGTABLE_LEVELS=2

#
# System Type
#
CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=8
CONFIG_ARCH_MMAP_RND_BITS_MAX=16
CONFIG_ARCH_MULTIPLATFORM=y

#
# Platform selection
#

#
# CPU Core family selection
#
# CONFIG_ARCH_MULTI_V6 is not set
CONFIG_ARCH_MULTI_V7=y
CONFIG_ARCH_MULTI_V6_V7=y
# end of Platform selection

CONFIG_ARCH_VIRT=y
CONFIG_ARCH_AIROHA=y
CONFIG_ARCH_ACTIONS=y
CONFIG_ARCH_ALPINE=y
CONFIG_ARCH_ARTPEC=y
CONFIG_MACH_ARTPEC6=y
CONFIG_ARCH_ASPEED=y
CONFIG_MACH_ASPEED_G6=y
CONFIG_ARCH_AT91=y
CONFIG_SOC_SAMA5D2=y
CONFIG_SOC_SAMA5D3=y
CONFIG_SOC_SAMA5D4=y
CONFIG_SOC_SAMA7G5=y
CONFIG_SOC_LAN966=y

#
# Clocksource driver selection
#
CONFIG_ATMEL_CLOCKSOURCE_PIT=y
CONFIG_ATMEL_CLOCKSOURCE_TCB=y
CONFIG_MICROCHIP_CLOCKSOURCE_PIT64B=y
CONFIG_HAVE_AT91_UTMI=y
CONFIG_HAVE_AT91_USB_CLK=y
CONFIG_COMMON_CLK_AT91=y
CONFIG_HAVE_AT91_SMD=y
CONFIG_HAVE_AT91_H32MX=y
CONFIG_HAVE_AT91_GENERATED_CLK=y
CONFIG_HAVE_AT91_AUDIO_PLL=y
CONFIG_HAVE_AT91_I2S_MUX_CLK=y
CONFIG_HAVE_AT91_SAM9X60_PLL=y
CONFIG_SOC_SAM_V7=y
CONFIG_SOC_SAMA5=y
CONFIG_ATMEL_PM=y
# CONFIG_ATMEL_SECURE_PM is not set
CONFIG_SOC_SAMA7=y
CONFIG_ARCH_BCM=y

#
# IPROC architected SoCs
#
CONFIG_ARCH_BCM_IPROC=y
CONFIG_ARCH_BCM_CYGNUS=y
CONFIG_ARCH_BCM_HR2=y
CONFIG_ARCH_BCM_NSP=y
CONFIG_ARCH_BCM_5301X=y

#
# KONA architected SoCs
#
CONFIG_ARCH_BCM_MOBILE=y
CONFIG_ARCH_BCM_281XX=y
CONFIG_ARCH_BCM_21664=y
CONFIG_ARCH_BCM_23550=y
CONFIG_ARCH_BCM_MOBILE_L2_CACHE=y
CONFIG_ARCH_BCM_MOBILE_SMC=y
CONFIG_ARCH_BCM_MOBILE_SMP=y

#
# Other Architectures
#
CONFIG_ARCH_BCM2835=y
CONFIG_ARCH_BCM_53573=y
CONFIG_ARCH_BRCMSTB=y
CONFIG_ARCH_BCMBCA=y

#
# BCMBCA sub platforms
#
CONFIG_ARCH_BCMBCA_CORTEXA7=y
CONFIG_ARCH_BCMBCA_CORTEXA9=y
CONFIG_ARCH_BCMBCA_BRAHMAB15=y
CONFIG_ARCH_BERLIN=y
CONFIG_MACH_BERLIN_BG2=y
CONFIG_MACH_BERLIN_BG2CD=y
CONFIG_MACH_BERLIN_BG2Q=y
CONFIG_ARCH_DIGICOLOR=y
# CONFIG_ARCH_DOVE is not set
CONFIG_ARCH_EXYNOS=y
CONFIG_S5P_DEV_MFC=y
CONFIG_ARCH_EXYNOS3=y
CONFIG_ARCH_EXYNOS4=y
CONFIG_ARCH_EXYNOS5=y

#
# Exynos SoCs
#
CONFIG_SOC_EXYNOS3250=y
CONFIG_CPU_EXYNOS4210=y
CONFIG_SOC_EXYNOS4412=y
CONFIG_SOC_EXYNOS5250=y
CONFIG_SOC_EXYNOS5260=y
CONFIG_SOC_EXYNOS5410=y
CONFIG_SOC_EXYNOS5420=y
CONFIG_SOC_EXYNOS5800=y
CONFIG_EXYNOS_MCPM=y
CONFIG_EXYNOS_CPU_SUSPEND=y
CONFIG_ARCH_HIGHBANK=y
CONFIG_ARCH_HISI=y

#
# Hisilicon platform type
#
CONFIG_ARCH_HI3xxx=y
CONFIG_ARCH_HIP01=y
CONFIG_ARCH_HIP04=y
CONFIG_ARCH_HIX5HD2=y
# end of Hisilicon platform type

CONFIG_ARCH_HPE=y
CONFIG_ARCH_HPE_GXP=y
CONFIG_ARCH_MXC=y
CONFIG_MXC_TZIC=y
CONFIG_HAVE_IMX_ANATOP=y
CONFIG_HAVE_IMX_GPC=y
CONFIG_HAVE_IMX_MMDC=y
CONFIG_HAVE_IMX_SRC=y

#
# Cortex-A platforms
#
CONFIG_SOC_IMX5=y
CONFIG_SOC_IMX50=y
CONFIG_SOC_IMX51=y
CONFIG_SOC_IMX53=y
CONFIG_SOC_IMX6=y
CONFIG_SOC_IMX6Q=y
CONFIG_SOC_IMX6SL=y
CONFIG_SOC_IMX6SLL=y
CONFIG_SOC_IMX6SX=y
CONFIG_SOC_IMX6UL=y
CONFIG_SOC_LS1021A=y

#
# Cortex-A/Cortex-M asymmetric multiprocessing platforms
#
CONFIG_SOC_IMX7D_CA7=y
CONFIG_SOC_IMX7D=y
CONFIG_SOC_IMX7ULP=y
CONFIG_SOC_VF610=y
CONFIG_VF_USE_ARM_GLOBAL_TIMER=y
# CONFIG_VF_USE_PIT_TIMER is not set
CONFIG_ARCH_KEYSTONE=y
CONFIG_ARCH_MEDIATEK=y
CONFIG_MACH_MT2701=y
CONFIG_MACH_MT6589=y
CONFIG_MACH_MT6592=y
CONFIG_MACH_MT7623=y
CONFIG_MACH_MT7629=y
CONFIG_MACH_MT8127=y
CONFIG_MACH_MT8135=y
CONFIG_ARCH_MESON=y
CONFIG_MACH_MESON6=y
CONFIG_MACH_MESON8=y
CONFIG_ARCH_MILBEAUT=y
CONFIG_ARCH_MILBEAUT_M10V=y
CONFIG_ARCH_MMP=y

#
# Marvell PXA168/910/MMP2 Implementations
#
CONFIG_MACH_MMP2_DT=y
CONFIG_MACH_MMP3_DT=y
# end of Marvell PXA168/910/MMP2 Implementations

# CONFIG_USB_EHCI_MV_U2O is not set
# CONFIG_ARCH_MSTARV7 is not set
CONFIG_ARCH_MVEBU=y
CONFIG_MACH_MVEBU_ANY=y
CONFIG_MACH_MVEBU_V7=y
CONFIG_MACH_ARMADA_370=y
CONFIG_MACH_ARMADA_375=y
CONFIG_MACH_ARMADA_38X=y
CONFIG_MACH_ARMADA_39X=y
CONFIG_MACH_ARMADA_XP=y
CONFIG_MACH_DOVE=y
# CONFIG_ARCH_NPCM is not set
CONFIG_ARCH_OMAP=y
CONFIG_MACH_OMAP_GENERIC=y

#
# TI OMAP/AM/DM/DRA Family
#
CONFIG_OMAP_HWMOD=y
CONFIG_ARCH_OMAP3=y
CONFIG_ARCH_OMAP4=y
CONFIG_SOC_OMAP5=y
CONFIG_SOC_AM33XX=y
CONFIG_SOC_AM43XX=y
CONFIG_SOC_DRA7XX=y
CONFIG_ARCH_OMAP2PLUS=y
CONFIG_OMAP_INTERCONNECT_BARRIER=y

#
# TI OMAP2/3/4 Specific Features
#
CONFIG_ARCH_OMAP2PLUS_TYPICAL=y
CONFIG_SOC_HAS_OMAP2_SDRC=y
CONFIG_SOC_HAS_REALTIME_COUNTER=y
# CONFIG_POWER_AVS_OMAP is not set
# CONFIG_OMAP3_L2_AUX_SECURE_SAVE_RESTORE is not set
CONFIG_SOC_OMAP3430=y
CONFIG_SOC_TI81XX=y

#
# OMAP Legacy Platform Data Board Type
#
# CONFIG_OMAP3_SDRC_AC_TIMING is not set
# end of TI OMAP2/3/4 Specific Features

# CONFIG_OMAP5_ERRATA_801819 is not set
# end of TI OMAP/AM/DM/DRA Family

CONFIG_ARCH_QCOM=y
# CONFIG_ARCH_IPQ40XX is not set
CONFIG_ARCH_MSM8X60=y
# CONFIG_ARCH_MSM8909 is not set
CONFIG_ARCH_MSM8916=y
CONFIG_ARCH_MSM8960=y
CONFIG_ARCH_MSM8974=y
# CONFIG_ARCH_MDM9615 is not set
# CONFIG_ARCH_RDA is not set
# CONFIG_ARCH_REALTEK is not set
CONFIG_ARCH_ROCKCHIP=y
# CONFIG_ARCH_S5PV210 is not set
CONFIG_ARCH_RENESAS=y
CONFIG_ARCH_INTEL_SOCFPGA=y
# CONFIG_SOCFPGA_SUSPEND is not set
CONFIG_PLAT_SPEAR=y
CONFIG_ARCH_SPEAR13XX=y
CONFIG_MACH_SPEAR1310=y
CONFIG_MACH_SPEAR1340=y
CONFIG_ARCH_STI=y
CONFIG_SOC_STIH415=y
CONFIG_SOC_STIH416=y
CONFIG_SOC_STIH407=y
CONFIG_ARCH_STM32=y
CONFIG_MACH_STM32MP157=y
CONFIG_MACH_STM32MP13=y
CONFIG_ARCH_SUNPLUS=y
CONFIG_SOC_SP7021=y
CONFIG_ARCH_SUNXI=y
CONFIG_MACH_SUN4I=y
CONFIG_MACH_SUN5I=y
CONFIG_MACH_SUN6I=y
CONFIG_MACH_SUN7I=y
CONFIG_MACH_SUN8I=y
CONFIG_MACH_SUN9I=y
CONFIG_ARCH_SUNXI_MC_SMP=y
CONFIG_ARCH_TEGRA=y
CONFIG_ARCH_UNIPHIER=y
CONFIG_ARCH_U8500=y
CONFIG_UX500_SOC_DB8500=y
CONFIG_UX500_DEBUG_UART=2
# CONFIG_ARCH_REALVIEW is not set
CONFIG_ARCH_VEXPRESS=y
CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y
# CONFIG_ARCH_VEXPRESS_DCSCB is not set
CONFIG_ARCH_VEXPRESS_SPC=y
CONFIG_ARCH_VEXPRESS_TC2_PM=y
CONFIG_ARCH_VT8500=y
CONFIG_ARCH_WM8850=y
CONFIG_ARCH_ZYNQ=y
CONFIG_PLAT_ORION=y
CONFIG_PLAT_VERSATILE=y

#
# Processor Type
#
CONFIG_CPU_PJ4=y
CONFIG_CPU_PJ4B=y
CONFIG_CPU_V7=y
CONFIG_CPU_THUMB_CAPABLE=y
CONFIG_CPU_32v6K=y
CONFIG_CPU_32v7=y
CONFIG_CPU_ABRT_EV7=y
CONFIG_CPU_PABRT_V7=y
CONFIG_CPU_CACHE_V7=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_COPY_V6=y
CONFIG_CPU_TLB_V7=y
CONFIG_CPU_HAS_ASID=y
CONFIG_CPU_CP15=y
CONFIG_CPU_CP15_MMU=y

#
# Processor Features
#
# CONFIG_ARM_LPAE is not set
CONFIG_ARM_THUMB=y
CONFIG_ARM_THUMBEE=y
CONFIG_ARM_VIRT_EXT=y
CONFIG_SWP_EMULATE=y
CONFIG_CPU_LITTLE_ENDIAN=y
# CONFIG_CPU_BIG_ENDIAN is not set
# CONFIG_CPU_ICACHE_DISABLE is not set
# CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND is not set
# CONFIG_CPU_BPREDICT_DISABLE is not set
CONFIG_CPU_SPECTRE=y
CONFIG_HARDEN_BRANCH_PREDICTOR=y
CONFIG_HARDEN_BRANCH_HISTORY=y
CONFIG_KUSER_HELPERS=y
CONFIG_VDSO=y
CONFIG_OUTER_CACHE=y
CONFIG_OUTER_CACHE_SYNC=y
CONFIG_CACHE_B15_RAC=y
CONFIG_CACHE_FEROCEON_L2=y
# CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set
CONFIG_MIGHT_HAVE_CACHE_L2X0=y
CONFIG_CACHE_L2X0=y
# CONFIG_CACHE_L2X0_PMU is not set
CONFIG_PL310_ERRATA_588369=y
CONFIG_PL310_ERRATA_727915=y
CONFIG_PL310_ERRATA_753970=y
CONFIG_PL310_ERRATA_769419=y
CONFIG_CACHE_TAUROS2=y
# CONFIG_CACHE_UNIPHIER is not set
CONFIG_ARM_L1_CACHE_SHIFT_6=y
CONFIG_ARM_L1_CACHE_SHIFT=6
CONFIG_ARM_DMA_MEM_BUFFERABLE=y
CONFIG_ARM_HEAVY_MB=y
CONFIG_DEBUG_ALIGN_RODATA=y
CONFIG_IWMMXT=y
CONFIG_PJ4B_ERRATA_4742=y
CONFIG_ARM_ERRATA_430973=y
CONFIG_ARM_ERRATA_643719=y
CONFIG_ARM_ERRATA_720789=y
CONFIG_ARM_ERRATA_754322=y
CONFIG_ARM_ERRATA_754327=y
CONFIG_ARM_ERRATA_764369=y
# CONFIG_ARM_ERRATA_764319 is not set
CONFIG_ARM_ERRATA_775420=y
CONFIG_ARM_ERRATA_798181=y
# CONFIG_ARM_ERRATA_773022 is not set
# CONFIG_ARM_ERRATA_818325_852422 is not set
# CONFIG_ARM_ERRATA_821420 is not set
# CONFIG_ARM_ERRATA_825619 is not set
# CONFIG_ARM_ERRATA_857271 is not set
# CONFIG_ARM_ERRATA_852421 is not set
# CONFIG_ARM_ERRATA_852423 is not set
# CONFIG_ARM_ERRATA_857272 is not set
# end of System Type

#
# Bus support
#
CONFIG_ARM_ERRATA_814220=y
# end of Bus support

#
# Kernel Features
#
CONFIG_HAVE_SMP=y
CONFIG_SMP=y
CONFIG_SMP_ON_UP=y
CONFIG_CURRENT_POINTER_IN_TPIDRURO=y
CONFIG_IRQSTACKS=y
CONFIG_ARM_CPU_TOPOLOGY=y
# CONFIG_SCHED_MC is not set
# CONFIG_SCHED_SMT is not set
CONFIG_HAVE_ARM_SCU=y
CONFIG_HAVE_ARM_ARCH_TIMER=y
CONFIG_HAVE_ARM_TWD=y
CONFIG_MCPM=y
CONFIG_MCPM_QUAD_CLUSTER=y
# CONFIG_BIG_LITTLE is not set
CONFIG_VMSPLIT_3G=y
# CONFIG_VMSPLIT_3G_OPT is not set
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_1G is not set
CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_NR_CPUS=16
CONFIG_HOTPLUG_CPU=y
CONFIG_ARM_PSCI=y
CONFIG_HZ_FIXED=0
CONFIG_HZ_100=y
# CONFIG_HZ_200 is not set
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_500 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100
CONFIG_SCHED_HRTICK=y
# CONFIG_THUMB2_KERNEL is not set
CONFIG_ARM_PATCH_IDIV=y
CONFIG_AEABI=y
# CONFIG_OABI_COMPAT is not set
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_FLATMEM_ENABLE=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_HIGHMEM=y
CONFIG_HIGHPTE=y
CONFIG_CPU_SW_DOMAIN_PAN=y
CONFIG_HW_PERF_EVENTS=y
CONFIG_ARM_MODULE_PLTS=y
CONFIG_ARCH_FORCE_MAX_ORDER=12
CONFIG_ALIGNMENT_TRAP=y
# CONFIG_UACCESS_WITH_MEMCPY is not set
# CONFIG_PARAVIRT is not set
# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
# CONFIG_XEN is not set
CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y
CONFIG_STACKPROTECTOR_PER_TASK=y
# end of Kernel Features

#
# Boot options
#
CONFIG_USE_OF=y
CONFIG_ATAGS=y
# CONFIG_UNUSED_BOARD_FILES is not set
# CONFIG_DEPRECATED_PARAM_STRUCT is not set
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ATAG_DTB_COMPAT=y
CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set
CONFIG_CMDLINE=""
CONFIG_KEXEC=y
CONFIG_ATAGS_PROC=y
# CONFIG_CRASH_DUMP is not set
CONFIG_AUTO_ZRELADDR=y
CONFIG_EFI_STUB=y
CONFIG_EFI=y
CONFIG_DMI=y
# end of Boot options

#
# CPU Power Management
#

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
CONFIG_CPU_FREQ_GOV_COMMON=y
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y

#
# CPU frequency scaling drivers
#
CONFIG_CPUFREQ_DT=y
CONFIG_CPUFREQ_DT_PLATDEV=y
# CONFIG_ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM is not set
# CONFIG_ARM_ARMADA_37XX_CPUFREQ is not set
# CONFIG_ARM_ARMADA_8K_CPUFREQ is not set
# CONFIG_ARM_VEXPRESS_SPC_CPUFREQ is not set
CONFIG_ARM_BRCMSTB_AVS_CPUFREQ=y
CONFIG_ARM_HIGHBANK_CPUFREQ=m
CONFIG_ARM_IMX6Q_CPUFREQ=y
# CONFIG_ARM_IMX_CPUFREQ_DT is not set
# CONFIG_ARM_MEDIATEK_CPUFREQ is not set
CONFIG_ARM_MEDIATEK_CPUFREQ_HW=m
CONFIG_ARM_OMAP2PLUS_CPUFREQ=y
CONFIG_ARM_QCOM_CPUFREQ_NVMEM=y
# CONFIG_ARM_QCOM_CPUFREQ_HW is not set
CONFIG_ARM_RASPBERRYPI_CPUFREQ=y
CONFIG_ARM_SCMI_CPUFREQ=y
CONFIG_ARM_SPEAR_CPUFREQ=y
# CONFIG_ARM_STI_CPUFREQ is not set
CONFIG_ARM_TEGRA20_CPUFREQ=y
CONFIG_ARM_TEGRA124_CPUFREQ=y
CONFIG_ARM_TI_CPUFREQ=y
CONFIG_QORIQ_CPUFREQ=y
# end of CPU Frequency scaling

#
# CPU Idle
#
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y
# CONFIG_CPU_IDLE_GOV_LADDER is not set
CONFIG_CPU_IDLE_GOV_MENU=y
# CONFIG_CPU_IDLE_GOV_TEO is not set
CONFIG_DT_IDLE_STATES=y
CONFIG_DT_IDLE_GENPD=y

#
# ARM CPU Idle Drivers
#
CONFIG_ARM_CPUIDLE=y
CONFIG_ARM_PSCI_CPUIDLE=y
CONFIG_ARM_PSCI_CPUIDLE_DOMAIN=y
# CONFIG_ARM_BIG_LITTLE_CPUIDLE is not set
# CONFIG_ARM_HIGHBANK_CPUIDLE is not set
CONFIG_ARM_ZYNQ_CPUIDLE=y
# CONFIG_ARM_U8500_CPUIDLE is not set
CONFIG_ARM_AT91_CPUIDLE=y
CONFIG_ARM_EXYNOS_CPUIDLE=y
# CONFIG_ARM_MVEBU_V7_CPUIDLE is not set
CONFIG_ARM_TEGRA_CPUIDLE=y
CONFIG_ARM_QCOM_SPM_CPUIDLE=y
# end of ARM CPU Idle Drivers

CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED=y
# end of CPU Idle
# end of CPU Power Management

#
# Floating point emulation
#

#
# At least one emulation must be selected
#
CONFIG_VFP=y
CONFIG_VFPv3=y
CONFIG_NEON=y
CONFIG_KERNEL_MODE_NEON=y
# end of Floating point emulation

#
# Power management options
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_SUSPEND_SKIP_SYNC is not set
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
# CONFIG_PM_AUTOSLEEP is not set
# CONFIG_PM_USERSPACE_AUTOSLEEP is not set
# CONFIG_PM_WAKELOCKS is not set
CONFIG_PM=y
# CONFIG_PM_DEBUG is not set
# CONFIG_APM_EMULATION is not set
CONFIG_PM_CLK=y
CONFIG_PM_GENERIC_DOMAINS=y
# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
CONFIG_PM_GENERIC_DOMAINS_SLEEP=y
CONFIG_PM_GENERIC_DOMAINS_OF=y
CONFIG_CPU_PM=y
# CONFIG_ENERGY_MODEL is not set
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARM_CPU_SUSPEND=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
# end of Power management options

CONFIG_AS_VFP_VMRS_FPINST=y

#
# General architecture-dependent options
#
CONFIG_CRASH_CORE=y
CONFIG_KEXEC_CORE=y
# CONFIG_KPROBES is not set
# CONFIG_JUMP_LABEL is not set
CONFIG_UPROBES=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_ARCH_USE_BUILTIN_BSWAP=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_OPTPROBES=y
CONFIG_HAVE_NMI=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_CONTIGUOUS=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_GENERIC_IDLE_POLL_SETUP=y
CONFIG_ARCH_HAS_FORTIFY_SOURCE=y
CONFIG_ARCH_HAS_KEEPINITRD=y
CONFIG_ARCH_HAS_SET_MEMORY=y
CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y
CONFIG_ARCH_32BIT_OFF_T=y
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
CONFIG_HAVE_RSEQ=y
CONFIG_HAVE_HW_BREAKPOINT=y
CONFIG_HAVE_PERF_REGS=y
CONFIG_HAVE_PERF_USER_STACK_DUMP=y
CONFIG_HAVE_ARCH_JUMP_LABEL=y
CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_HAVE_ARCH_SECCOMP=y
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
CONFIG_SECCOMP=y
CONFIG_SECCOMP_FILTER=y
# CONFIG_SECCOMP_CACHE_DEBUG is not set
CONFIG_HAVE_STACKPROTECTOR=y
CONFIG_STACKPROTECTOR=y
CONFIG_STACKPROTECTOR_STRONG=y
CONFIG_LTO_NONE=y
CONFIG_HAVE_CONTEXT_TRACKING_USER=y
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
CONFIG_MODULES_USE_ELF_REL=y
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK=y
CONFIG_SOFTIRQ_ON_OWN_STACK=y
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
CONFIG_HAVE_ARCH_MMAP_RND_BITS=y
CONFIG_HAVE_EXIT_THREAD=y
CONFIG_ARCH_MMAP_RND_BITS=8
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y
CONFIG_CLONE_BACKWARDS=y
CONFIG_OLD_SIGSUSPEND3=y
CONFIG_OLD_SIGACTION=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_HAVE_ARCH_VMAP_STACK=y
CONFIG_VMAP_STACK=y
CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y
CONFIG_STRICT_KERNEL_RWX=y
CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
CONFIG_STRICT_MODULE_RWX=y
# CONFIG_LOCK_EVENT_COUNTS is not set
CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y
CONFIG_HAVE_ARCH_PFN_VALID=y

#
# GCOV-based kernel profiling
#
# CONFIG_GCOV_KERNEL is not set
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
# end of GCOV-based kernel profiling

CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_GCC_PLUGINS=y
# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set
CONFIG_FUNCTION_ALIGNMENT=0
# end of General architecture-dependent options

CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
# CONFIG_MODULE_UNLOAD_TAINT_TRACKING is not set
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
# CONFIG_MODULE_SIG is not set
CONFIG_MODULE_COMPRESS_NONE=y
# CONFIG_MODULE_COMPRESS_GZIP is not set
# CONFIG_MODULE_COMPRESS_XZ is not set
# CONFIG_MODULE_COMPRESS_ZSTD is not set
# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set
CONFIG_MODPROBE_PATH="/sbin/modprobe"
# CONFIG_TRIM_UNUSED_KSYMS is not set
CONFIG_MODULES_TREE_LOOKUP=y
CONFIG_BLOCK=y
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
CONFIG_BLK_DEV_BSG_COMMON=y
# CONFIG_BLK_DEV_BSGLIB is not set
# CONFIG_BLK_DEV_INTEGRITY is not set
# CONFIG_BLK_DEV_ZONED is not set
# CONFIG_BLK_WBT is not set
CONFIG_BLK_DEBUG_FS=y
# CONFIG_BLK_SED_OPAL is not set
# CONFIG_BLK_INLINE_ENCRYPTION is not set

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
# CONFIG_ACORN_PARTITION is not set
# CONFIG_AIX_PARTITION is not set
# CONFIG_OSF_PARTITION is not set
# CONFIG_AMIGA_PARTITION is not set
# CONFIG_ATARI_PARTITION is not set
# CONFIG_MAC_PARTITION is not set
CONFIG_MSDOS_PARTITION=y
# CONFIG_BSD_DISKLABEL is not set
# CONFIG_MINIX_SUBPARTITION is not set
# CONFIG_SOLARIS_X86_PARTITION is not set
# CONFIG_UNIXWARE_DISKLABEL is not set
# CONFIG_LDM_PARTITION is not set
# CONFIG_SGI_PARTITION is not set
# CONFIG_ULTRIX_PARTITION is not set
# CONFIG_SUN_PARTITION is not set
# CONFIG_KARMA_PARTITION is not set
CONFIG_EFI_PARTITION=y
# CONFIG_SYSV68_PARTITION is not set
CONFIG_CMDLINE_PARTITION=y
# end of Partition Types

CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_BLK_PM=y

#
# IO Schedulers
#
CONFIG_MQ_IOSCHED_DEADLINE=y
CONFIG_MQ_IOSCHED_KYBER=y
# CONFIG_IOSCHED_BFQ is not set
# end of IO Schedulers

CONFIG_ASN1=y
CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
CONFIG_INLINE_READ_UNLOCK=y
CONFIG_INLINE_READ_UNLOCK_IRQ=y
CONFIG_INLINE_WRITE_UNLOCK=y
CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_LOCK_SPIN_ON_OWNER=y
CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y
CONFIG_FREEZER=y

#
# Executable file formats
#
CONFIG_BINFMT_ELF=y
# CONFIG_BINFMT_ELF_FDPIC is not set
CONFIG_ELFCORE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_BINFMT_SCRIPT=y
CONFIG_ARCH_HAS_BINFMT_FLAT=y
# CONFIG_BINFMT_FLAT is not set
CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y
# CONFIG_BINFMT_MISC is not set
CONFIG_COREDUMP=y
# end of Executable file formats

#
# Memory Management options
#
CONFIG_SWAP=y
# CONFIG_ZSWAP is not set

#
# SLAB allocator options
#
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
CONFIG_SLAB_MERGE_DEFAULT=y
# CONFIG_SLAB_FREELIST_RANDOM is not set
# CONFIG_SLAB_FREELIST_HARDENED is not set
# CONFIG_SLUB_STATS is not set
CONFIG_SLUB_CPU_PARTIAL=y
# end of SLAB allocator options

# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set
CONFIG_COMPAT_BRK=y
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
# CONFIG_SPARSEMEM_MANUAL is not set
CONFIG_FLATMEM=y
CONFIG_ARCH_KEEP_MEMBLOCK=y
CONFIG_MEMORY_ISOLATION=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_COMPACTION=y
CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1
# CONFIG_PAGE_REPORTING is not set
CONFIG_MIGRATION=y
CONFIG_CONTIG_ALLOC=y
CONFIG_BOUNCE=y
# CONFIG_KSM is not set
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_CMA=y
# CONFIG_CMA_DEBUG is not set
# CONFIG_CMA_DEBUGFS is not set
# CONFIG_CMA_SYSFS is not set
CONFIG_CMA_AREAS=7
CONFIG_GENERIC_EARLY_IOREMAP=y
# CONFIG_IDLE_PAGE_TRACKING is not set
CONFIG_ARCH_HAS_CURRENT_STACK_POINTER=y
CONFIG_ZONE_DMA=y
CONFIG_VM_EVENT_COUNTERS=y
# CONFIG_PERCPU_STATS is not set
# CONFIG_GUP_TEST is not set
CONFIG_KMAP_LOCAL=y
CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y
# CONFIG_ANON_VMA_NAME is not set
# CONFIG_USERFAULTFD is not set
# CONFIG_LRU_GEN is not set

#
# Data Access Monitoring
#
# CONFIG_DAMON is not set
# end of Data Access Monitoring
# end of Memory Management options

CONFIG_NET=y
CONFIG_SKB_EXTENSIONS=y

#
# Networking options
#
CONFIG_PACKET=y
# CONFIG_PACKET_DIAG is not set
CONFIG_UNIX=y
CONFIG_UNIX_SCM=y
CONFIG_AF_UNIX_OOB=y
# CONFIG_UNIX_DIAG is not set
# CONFIG_TLS is not set
CONFIG_XFRM=y
CONFIG_XFRM_ALGO=m
# CONFIG_XFRM_USER is not set
# CONFIG_XFRM_INTERFACE is not set
# CONFIG_XFRM_SUB_POLICY is not set
# CONFIG_XFRM_MIGRATE is not set
# CONFIG_XFRM_STATISTICS is not set
CONFIG_XFRM_AH=m
CONFIG_XFRM_ESP=m
CONFIG_XFRM_IPCOMP=m
# CONFIG_NET_KEY is not set
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
# CONFIG_IP_ADVANCED_ROUTER is not set
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE_DEMUX is not set
CONFIG_NET_IP_TUNNEL=y
# CONFIG_SYN_COOKIES is not set
# CONFIG_NET_IPVTI is not set
# CONFIG_NET_FOU is not set
# CONFIG_NET_FOU_IP_TUNNELS is not set
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set
CONFIG_INET_TUNNEL=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_INET_UDP_DIAG is not set
# CONFIG_INET_RAW_DIAG is not set
# CONFIG_INET_DIAG_DESTROY is not set
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
CONFIG_IPV6=y
CONFIG_IPV6_ROUTER_PREF=y
# CONFIG_IPV6_ROUTE_INFO is not set
CONFIG_IPV6_OPTIMISTIC_DAD=y
CONFIG_INET6_AH=m
CONFIG_INET6_ESP=m
# CONFIG_INET6_ESP_OFFLOAD is not set
# CONFIG_INET6_ESPINTCP is not set
CONFIG_INET6_IPCOMP=m
CONFIG_IPV6_MIP6=m
CONFIG_INET6_XFRM_TUNNEL=m
CONFIG_INET6_TUNNEL=m
# CONFIG_IPV6_VTI is not set
CONFIG_IPV6_SIT=y
# CONFIG_IPV6_SIT_6RD is not set
CONFIG_IPV6_NDISC_NODETYPE=y
CONFIG_IPV6_TUNNEL=m
CONFIG_IPV6_MULTIPLE_TABLES=y
# CONFIG_IPV6_SUBTREES is not set
# CONFIG_IPV6_MROUTE is not set
# CONFIG_IPV6_SEG6_LWTUNNEL is not set
# CONFIG_IPV6_SEG6_HMAC is not set
# CONFIG_IPV6_RPL_LWTUNNEL is not set
# CONFIG_IPV6_IOAM6_LWTUNNEL is not set
# CONFIG_MPTCP is not set
# CONFIG_NETWORK_SECMARK is not set
CONFIG_NET_PTP_CLASSIFY=y
# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
# CONFIG_NETFILTER is not set
# CONFIG_BPFILTER is not set
# CONFIG_IP_DCCP is not set
# CONFIG_IP_SCTP is not set
# CONFIG_RDS is not set
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
# CONFIG_L2TP is not set
# CONFIG_BRIDGE is not set
CONFIG_NET_DSA=m
# CONFIG_NET_DSA_TAG_AR9331 is not set
CONFIG_NET_DSA_TAG_BRCM_COMMON=m
CONFIG_NET_DSA_TAG_BRCM=m
CONFIG_NET_DSA_TAG_BRCM_LEGACY=m
CONFIG_NET_DSA_TAG_BRCM_PREPEND=m
# CONFIG_NET_DSA_TAG_HELLCREEK is not set
# CONFIG_NET_DSA_TAG_GSWIP is not set
# CONFIG_NET_DSA_TAG_DSA is not set
# CONFIG_NET_DSA_TAG_EDSA is not set
# CONFIG_NET_DSA_TAG_MTK is not set
# CONFIG_NET_DSA_TAG_KSZ is not set
# CONFIG_NET_DSA_TAG_OCELOT is not set
# CONFIG_NET_DSA_TAG_OCELOT_8021Q is not set
# CONFIG_NET_DSA_TAG_QCA is not set
# CONFIG_NET_DSA_TAG_RTL4_A is not set
# CONFIG_NET_DSA_TAG_RTL8_4 is not set
# CONFIG_NET_DSA_TAG_RZN1_A5PSW is not set
# CONFIG_NET_DSA_TAG_LAN9303 is not set
# CONFIG_NET_DSA_TAG_SJA1105 is not set
# CONFIG_NET_DSA_TAG_TRAILER is not set
# CONFIG_NET_DSA_TAG_XRS700X is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_LLC2 is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_PHONET is not set
# CONFIG_6LOWPAN is not set
# CONFIG_IEEE802154 is not set
# CONFIG_NET_SCHED is not set
# CONFIG_DCB is not set
CONFIG_DNS_RESOLVER=y
# CONFIG_BATMAN_ADV is not set
# CONFIG_OPENVSWITCH is not set
# CONFIG_VSOCKETS is not set
# CONFIG_NETLINK_DIAG is not set
# CONFIG_MPLS is not set
# CONFIG_NET_NSH is not set
# CONFIG_HSR is not set
CONFIG_NET_SWITCHDEV=y
# CONFIG_NET_L3_MASTER_DEV is not set
CONFIG_QRTR=m
CONFIG_QRTR_SMD=m
# CONFIG_QRTR_TUN is not set
# CONFIG_NET_NCSI is not set
CONFIG_PCPU_DEV_REFCNT=y
CONFIG_RPS=y
CONFIG_RFS_ACCEL=y
CONFIG_SOCK_RX_QUEUE_MAPPING=y
CONFIG_XPS=y
# CONFIG_CGROUP_NET_PRIO is not set
# CONFIG_CGROUP_NET_CLASSID is not set
CONFIG_NET_RX_BUSY_POLL=y
CONFIG_BQL=y
CONFIG_NET_FLOW_LIMIT=y

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_NET_DROP_MONITOR is not set
# end of Network testing
# end of Networking options

# CONFIG_HAMRADIO is not set
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
CONFIG_CAN_GW=y
# CONFIG_CAN_J1939 is not set
# CONFIG_CAN_ISOTP is not set
CONFIG_BT=m
CONFIG_BT_BREDR=y
# CONFIG_BT_RFCOMM is not set
# CONFIG_BT_BNEP is not set
# CONFIG_BT_HIDP is not set
# CONFIG_BT_HS is not set
CONFIG_BT_LE=y
CONFIG_BT_LE_L2CAP_ECRED=y
# CONFIG_BT_LEDS is not set
# CONFIG_BT_MSFTEXT is not set
# CONFIG_BT_AOSPEXT is not set
CONFIG_BT_DEBUGFS=y
# CONFIG_BT_SELFTEST is not set
# CONFIG_BT_FEATURE_DEBUG is not set

#
# Bluetooth device drivers
#
CONFIG_BT_BCM=m
CONFIG_BT_QCA=m
# CONFIG_BT_HCIBTUSB is not set
# CONFIG_BT_HCIBTSDIO is not set
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_SERDEV=y
CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIUART_NOKIA is not set
# CONFIG_BT_HCIUART_BCSP is not set
# CONFIG_BT_HCIUART_ATH3K is not set
# CONFIG_BT_HCIUART_LL is not set
# CONFIG_BT_HCIUART_3WIRE is not set
# CONFIG_BT_HCIUART_INTEL is not set
CONFIG_BT_HCIUART_BCM=y
# CONFIG_BT_HCIUART_RTL is not set
# CONFIG_BT_HCIUART_QCA is not set
# CONFIG_BT_HCIUART_AG6XX is not set
# CONFIG_BT_HCIUART_MRVL is not set
# CONFIG_BT_HCIBCM203X is not set
# CONFIG_BT_HCIBPA10X is not set
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIVHCI is not set
CONFIG_BT_MRVL=m
CONFIG_BT_MRVL_SDIO=m
# CONFIG_BT_MTKSDIO is not set
# CONFIG_BT_MTKUART is not set
CONFIG_BT_QCOMSMD=m
# CONFIG_BT_VIRTIO is not set
# end of Bluetooth device drivers

# CONFIG_AF_RXRPC is not set
# CONFIG_AF_KCM is not set
# CONFIG_MCTP is not set
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_CFG80211=m
# CONFIG_NL80211_TESTMODE is not set
# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
# CONFIG_CFG80211_CERTIFICATION_ONUS is not set
CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y
CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y
CONFIG_CFG80211_DEFAULT_PS=y
# CONFIG_CFG80211_DEBUGFS is not set
CONFIG_CFG80211_CRDA_SUPPORT=y
# CONFIG_CFG80211_WEXT is not set
CONFIG_MAC80211=m
CONFIG_MAC80211_HAS_RC=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"
# CONFIG_MAC80211_MESH is not set
# CONFIG_MAC80211_LEDS is not set
# CONFIG_MAC80211_DEBUGFS is not set
# CONFIG_MAC80211_MESSAGE_TRACING is not set
# CONFIG_MAC80211_DEBUG_MENU is not set
CONFIG_MAC80211_STA_HASH_MAX_SIZE=0
CONFIG_RFKILL=y
CONFIG_RFKILL_LEDS=y
CONFIG_RFKILL_INPUT=y
CONFIG_RFKILL_GPIO=y
# CONFIG_NET_9P is not set
# CONFIG_CAIF is not set
# CONFIG_CEPH_LIB is not set
CONFIG_NFC=m
CONFIG_NFC_DIGITAL=m
CONFIG_NFC_NCI=m
CONFIG_NFC_NCI_SPI=m
CONFIG_NFC_NCI_UART=m
CONFIG_NFC_HCI=m
CONFIG_NFC_SHDLC=y

#
# Near Field Communication (NFC) devices
#
# CONFIG_NFC_TRF7970A is not set
# CONFIG_NFC_SIM is not set
# CONFIG_NFC_PORT100 is not set
# CONFIG_NFC_VIRTUAL_NCI is not set
# CONFIG_NFC_FDP is not set
# CONFIG_NFC_PN544_I2C is not set
# CONFIG_NFC_PN533_USB is not set
# CONFIG_NFC_PN533_I2C is not set
# CONFIG_NFC_PN532_UART is not set
# CONFIG_NFC_MICROREAD_I2C is not set
# CONFIG_NFC_MRVL_USB is not set
# CONFIG_NFC_MRVL_UART is not set
# CONFIG_NFC_ST21NFCA_I2C is not set
# CONFIG_NFC_ST_NCI_I2C is not set
# CONFIG_NFC_ST_NCI_SPI is not set
# CONFIG_NFC_NXP_NCI is not set
CONFIG_NFC_S3FWRN5=m
CONFIG_NFC_S3FWRN5_I2C=m
# CONFIG_NFC_S3FWRN82_UART is not set
# CONFIG_NFC_ST95HF is not set
# end of Near Field Communication (NFC) devices

# CONFIG_PSAMPLE is not set
# CONFIG_NET_IFE is not set
# CONFIG_LWTUNNEL is not set
CONFIG_DST_CACHE=y
CONFIG_GRO_CELLS=y
CONFIG_NET_SELFTESTS=y
CONFIG_NET_DEVLINK=y
CONFIG_PAGE_POOL=y
CONFIG_PAGE_POOL_STATS=y
CONFIG_FAILOVER=y
CONFIG_ETHTOOL_NETLINK=y

#
# Device Drivers
#
CONFIG_ARM_AMBA=y
CONFIG_TEGRA_AHB=y
CONFIG_HAVE_PCI=y
CONFIG_FORCE_PCI=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCI_DOMAINS_GENERIC=y
CONFIG_PCI_SYSCALL=y
CONFIG_PCIEPORTBUS=y
# CONFIG_PCIEAER is not set
CONFIG_PCIEASPM=y
CONFIG_PCIEASPM_DEFAULT=y
# CONFIG_PCIEASPM_POWERSAVE is not set
# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set
# CONFIG_PCIEASPM_PERFORMANCE is not set
CONFIG_PCIE_PME=y
# CONFIG_PCIE_PTM is not set
CONFIG_PCI_MSI=y
CONFIG_PCI_MSI_IRQ_DOMAIN=y
CONFIG_PCI_QUIRKS=y
# CONFIG_PCI_DEBUG is not set
# CONFIG_PCI_STUB is not set
CONFIG_PCI_ECAM=y
CONFIG_PCI_BRIDGE_EMUL=y
# CONFIG_PCI_IOV is not set
# CONFIG_PCI_PRI is not set
# CONFIG_PCI_PASID is not set
CONFIG_PCI_LABEL=y
# CONFIG_PCIE_BUS_TUNE_OFF is not set
CONFIG_PCIE_BUS_DEFAULT=y
# CONFIG_PCIE_BUS_SAFE is not set
# CONFIG_PCIE_BUS_PERFORMANCE is not set
# CONFIG_PCIE_BUS_PEER2PEER is not set
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=16
# CONFIG_HOTPLUG_PCI is not set

#
# PCI controller drivers
#
CONFIG_PCI_MVEBU=y
# CONFIG_PCI_FTPCI100 is not set
CONFIG_PCI_TEGRA=y
CONFIG_PCI_RCAR_GEN2=y
CONFIG_PCIE_RCAR_HOST=y
# CONFIG_PCIE_RCAR_EP is not set
CONFIG_PCI_HOST_COMMON=y
CONFIG_PCI_HOST_GENERIC=y
# CONFIG_PCIE_XILINX is not set
# CONFIG_PCI_V3_SEMI is not set
CONFIG_PCIE_IPROC=y
CONFIG_PCIE_IPROC_PLATFORM=y
CONFIG_PCIE_IPROC_BCMA=y
CONFIG_PCIE_IPROC_MSI=y
# CONFIG_PCIE_ALTERA is not set
# CONFIG_PCIE_ROCKCHIP_HOST is not set
# CONFIG_PCIE_ROCKCHIP_EP is not set
# CONFIG_PCIE_MEDIATEK is not set
# CONFIG_PCIE_MEDIATEK_GEN3 is not set
CONFIG_PCIE_BRCMSTB=y
# CONFIG_PCIE_MICROCHIP_HOST is not set

#
# DesignWare PCI Core Support
#
CONFIG_PCIE_DW=y
CONFIG_PCIE_DW_HOST=y
CONFIG_PCIE_DW_EP=y
CONFIG_PCI_DRA7XX=y
CONFIG_PCI_DRA7XX_HOST=y
CONFIG_PCI_DRA7XX_EP=y
# CONFIG_PCIE_DW_PLAT_HOST is not set
# CONFIG_PCIE_DW_PLAT_EP is not set
# CONFIG_PCI_EXYNOS is not set
# CONFIG_PCI_IMX6 is not set
# CONFIG_PCIE_SPEAR13XX is not set
# CONFIG_PCI_KEYSTONE_HOST is not set
# CONFIG_PCI_KEYSTONE_EP is not set
# CONFIG_PCI_LAYERSCAPE is not set
# CONFIG_PCI_LAYERSCAPE_EP is not set
# CONFIG_PCIE_QCOM is not set
# CONFIG_PCIE_QCOM_EP is not set
# CONFIG_PCIE_ARMADA_8K is not set
# CONFIG_PCIE_ARTPEC6_HOST is not set
# CONFIG_PCIE_ARTPEC6_EP is not set
# CONFIG_PCIE_ROCKCHIP_DW_HOST is not set
# CONFIG_PCIE_HISI_STB is not set
CONFIG_PCI_MESON=m
# CONFIG_PCIE_UNIPHIER is not set
# CONFIG_PCIE_UNIPHIER_EP is not set
# end of DesignWare PCI Core Support

#
# Mobiveil PCIe Core Support
#
# end of Mobiveil PCIe Core Support

#
# Cadence PCIe controllers support
#
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
# CONFIG_PCIE_CADENCE_PLAT_EP is not set
# CONFIG_PCI_J721E_HOST is not set
# CONFIG_PCI_J721E_EP is not set
# end of Cadence PCIe controllers support
# end of PCI controller drivers

#
# PCI Endpoint
#
CONFIG_PCI_ENDPOINT=y
CONFIG_PCI_ENDPOINT_CONFIGFS=y
CONFIG_PCI_EPF_TEST=m
# CONFIG_PCI_EPF_NTB is not set
# end of PCI Endpoint

#
# PCI switch controller drivers
#
# CONFIG_PCI_SW_SWITCHTEC is not set
# end of PCI switch controller drivers

# CONFIG_CXL_BUS is not set
# CONFIG_PCCARD is not set
# CONFIG_RAPIDIO is not set

#
# Generic Driver Options
#
# CONFIG_UEVENT_HELPER is not set
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_DEVTMPFS_SAFE is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y

#
# Firmware loader
#
CONFIG_FW_LOADER=y
CONFIG_EXTRA_FIRMWARE=""
# CONFIG_FW_LOADER_USER_HELPER is not set
# CONFIG_FW_LOADER_COMPRESS is not set
CONFIG_FW_CACHE=y
# CONFIG_FW_UPLOAD is not set
# end of Firmware loader

CONFIG_WANT_DEV_COREDUMP=y
CONFIG_ALLOW_DEV_COREDUMP=y
CONFIG_DEV_COREDUMP=y
# CONFIG_DEBUG_DRIVER is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set
# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set
CONFIG_GENERIC_CPU_AUTOPROBE=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_SOC_BUS=y
CONFIG_REGMAP=y
CONFIG_REGMAP_AC97=m
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_SPI=y
CONFIG_REGMAP_SPMI=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGMAP_IRQ=y
CONFIG_DMA_SHARED_BUFFER=y
# CONFIG_DMA_FENCE_TRACE is not set
CONFIG_GENERIC_ARCH_TOPOLOGY=y
# end of Generic Driver Options

#
# Bus devices
#
CONFIG_ARM_CCI=y
CONFIG_ARM_CCI400_COMMON=y
CONFIG_ARM_CCI400_PORT_CTRL=y
CONFIG_BRCMSTB_GISB_ARB=y
# CONFIG_MOXTET is not set
# CONFIG_IMX_WEIM is not set
CONFIG_MVEBU_MBUS=y
CONFIG_OMAP_INTERCONNECT=y
CONFIG_OMAP_OCP2SCP=y
CONFIG_QCOM_EBI2=y
# CONFIG_QCOM_SSC_BLOCK_BUS is not set
# CONFIG_SUN50I_DE2_BUS is not set
CONFIG_SUNXI_RSB=y
# CONFIG_TEGRA_GMI is not set
CONFIG_TI_SYSC=y
CONFIG_UNIPHIER_SYSTEM_BUS=y
CONFIG_VEXPRESS_CONFIG=y
# CONFIG_FSL_MC_BUS is not set
# CONFIG_MHI_BUS is not set
# CONFIG_MHI_BUS_EP is not set
# end of Bus devices

# CONFIG_CONNECTOR is not set

#
# Firmware Drivers
#

#
# ARM System Control and Management Interface Protocol
#
CONFIG_ARM_SCMI_PROTOCOL=y
CONFIG_ARM_SCMI_HAVE_TRANSPORT=y
CONFIG_ARM_SCMI_HAVE_SHMEM=y
CONFIG_ARM_SCMI_TRANSPORT_MAILBOX=y
CONFIG_ARM_SCMI_TRANSPORT_SMC=y
# CONFIG_ARM_SCMI_TRANSPORT_SMC_ATOMIC_ENABLE is not set
# CONFIG_ARM_SCMI_TRANSPORT_VIRTIO is not set
CONFIG_ARM_SCMI_POWER_DOMAIN=y
# CONFIG_ARM_SCMI_POWER_CONTROL is not set
# end of ARM System Control and Management Interface Protocol

# CONFIG_ARM_SCPI_PROTOCOL is not set
# CONFIG_FIRMWARE_MEMMAP is not set
CONFIG_DMIID=y
# CONFIG_DMI_SYSFS is not set
CONFIG_RASPBERRYPI_FIRMWARE=y
CONFIG_QCOM_SCM=y
# CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT is not set
CONFIG_SYSFB=y
# CONFIG_SYSFB_SIMPLEFB is not set
CONFIG_TRUSTED_FOUNDATIONS=y
# CONFIG_TURRIS_MOX_RWTM is not set
CONFIG_BCM47XX_NVRAM=y
CONFIG_BCM47XX_SPROM=y
# CONFIG_GOOGLE_FIRMWARE is not set

#
# EFI (Extensible Firmware Interface) Support
#
CONFIG_EFI_ESRT=y
CONFIG_EFI_VARS_PSTORE=y
# CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE is not set
CONFIG_EFI_PARAMS_FROM_FDT=y
CONFIG_EFI_RUNTIME_WRAPPERS=y
CONFIG_EFI_GENERIC_STUB=y
CONFIG_EFI_ARMSTUB_DTB_LOADER=y
# CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER is not set
# CONFIG_EFI_BOOTLOADER_CONTROL is not set
CONFIG_EFI_CAPSULE_LOADER=m
# CONFIG_EFI_TEST is not set
# CONFIG_RESET_ATTACK_MITIGATION is not set
# CONFIG_EFI_DISABLE_PCI_DMA is not set
# CONFIG_EFI_DISABLE_RUNTIME is not set
# CONFIG_EFI_COCO_SECRET is not set
# end of EFI (Extensible Firmware Interface) Support

CONFIG_ARM_PSCI_FW=y
# CONFIG_ARM_PSCI_CHECKER is not set
CONFIG_HAVE_ARM_SMCCC=y
CONFIG_HAVE_ARM_SMCCC_DISCOVERY=y
CONFIG_ARM_SMCCC_SOC_ID=y

#
# Tegra firmware driver
#
# CONFIG_TEGRA_IVC is not set
# end of Tegra firmware driver
# end of Firmware Drivers

# CONFIG_GNSS is not set
CONFIG_MTD=y
# CONFIG_MTD_TESTS is not set

#
# Partition parsers
#
# CONFIG_MTD_AR7_PARTS is not set
# CONFIG_MTD_BCM47XX_PARTS is not set
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_OF_PARTS=y
CONFIG_MTD_OF_PARTS_BCM4908=y
CONFIG_MTD_OF_PARTS_LINKSYS_NS=y
# CONFIG_MTD_AFS_PARTS is not set
# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set
# CONFIG_MTD_PARSER_TRX is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_QCOMSMEM_PARTS is not set
# end of Partition parsers

#
# User Modules And Translation Layers
#
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y

#
# Note that in some cases UBI block is preferred. See MTD_UBI_BLOCK.
#
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
# CONFIG_SSFDC is not set
# CONFIG_SM_FTL is not set
# CONFIG_MTD_OOPS is not set
# CONFIG_MTD_SWAP is not set
# CONFIG_MTD_PARTITIONED_MASTER is not set

#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_CFI=y
# CONFIG_MTD_JEDECPROBE is not set
CONFIG_MTD_GEN_PROBE=y
# CONFIG_MTD_CFI_ADV_OPTIONS is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
CONFIG_MTD_CFI_INTELEXT=y
# CONFIG_MTD_CFI_AMDSTD is not set
# CONFIG_MTD_CFI_STAA is not set
CONFIG_MTD_CFI_UTIL=y
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set
# end of RAM/ROM/Flash chip drivers

#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
CONFIG_MTD_PHYSMAP=y
# CONFIG_MTD_PHYSMAP_COMPAT is not set
CONFIG_MTD_PHYSMAP_OF=y
# CONFIG_MTD_PHYSMAP_VERSATILE is not set
# CONFIG_MTD_PHYSMAP_GEMINI is not set
# CONFIG_MTD_PHYSMAP_IXP4XX is not set
# CONFIG_MTD_INTEL_VR_NOR is not set
# CONFIG_MTD_PLATRAM is not set
# end of Mapping drivers for chip access

#
# Self-contained MTD device drivers
#
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_DATAFLASH is not set
# CONFIG_MTD_MCHP23K256 is not set
# CONFIG_MTD_MCHP48L640 is not set
CONFIG_MTD_SPEAR_SMI=y
# CONFIG_MTD_SST25L is not set
# CONFIG_MTD_BCM47XXSFLASH is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_MTDRAM is not set
# CONFIG_MTD_BLOCK2MTD is not set

#
# Disk-On-Chip Device Drivers
#
# CONFIG_MTD_DOCG3 is not set
# CONFIG_MTD_ST_SPI_FSM is not set
# end of Self-contained MTD device drivers

#
# NAND
#
CONFIG_MTD_NAND_CORE=y
# CONFIG_MTD_ONENAND is not set
CONFIG_MTD_RAW_NAND=y

#
# Raw/parallel NAND flash controllers
#
CONFIG_MTD_NAND_DENALI=y
# CONFIG_MTD_NAND_DENALI_PCI is not set
CONFIG_MTD_NAND_DENALI_DT=y
CONFIG_MTD_NAND_OMAP2=y
CONFIG_MTD_NAND_OMAP_BCH=y
CONFIG_MTD_NAND_OMAP_BCH_BUILD=y
# CONFIG_MTD_NAND_CAFE is not set
CONFIG_MTD_NAND_ATMEL=y
# CONFIG_MTD_NAND_ORION is not set
CONFIG_MTD_NAND_MARVELL=y
CONFIG_MTD_NAND_BRCMNAND=y
# CONFIG_MTD_NAND_BRCMNAND_BCM63XX is not set
CONFIG_MTD_NAND_BRCMNAND_BCMBCA=y
CONFIG_MTD_NAND_BRCMNAND_BRCMSTB=y
CONFIG_MTD_NAND_BRCMNAND_IPROC=y
CONFIG_MTD_NAND_GPMI_NAND=y
# CONFIG_MTD_NAND_FSL_IFC is not set
CONFIG_MTD_NAND_VF610_NFC=y
# CONFIG_MTD_NAND_MXC is not set
CONFIG_MTD_NAND_DAVINCI=y
# CONFIG_MTD_NAND_FSMC is not set
# CONFIG_MTD_NAND_SUNXI is not set
# CONFIG_MTD_NAND_HISI504 is not set
# CONFIG_MTD_NAND_QCOM is not set
# CONFIG_MTD_NAND_MXIC is not set
# CONFIG_MTD_NAND_TEGRA is not set
CONFIG_MTD_NAND_STM32_FMC2=y
# CONFIG_MTD_NAND_MESON is not set
# CONFIG_MTD_NAND_GPIO is not set
# CONFIG_MTD_NAND_PLATFORM is not set
# CONFIG_MTD_NAND_CADENCE is not set
# CONFIG_MTD_NAND_ARASAN is not set
# CONFIG_MTD_NAND_INTEL_LGM is not set
# CONFIG_MTD_NAND_ROCKCHIP is not set
CONFIG_MTD_NAND_PL35X=y
# CONFIG_MTD_NAND_RENESAS is not set

#
# Misc
#
# CONFIG_MTD_NAND_NANDSIM is not set
# CONFIG_MTD_NAND_RICOH is not set
# CONFIG_MTD_NAND_DISKONCHIP is not set
# CONFIG_MTD_SPI_NAND is not set

#
# ECC engine support
#
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_ECC_SW_HAMMING=y
# CONFIG_MTD_NAND_ECC_SW_HAMMING_SMC is not set
# CONFIG_MTD_NAND_ECC_SW_BCH is not set
# CONFIG_MTD_NAND_ECC_MXIC is not set
# CONFIG_MTD_NAND_ECC_MEDIATEK is not set
# end of ECC engine support
# end of NAND

#
# LPDDR & LPDDR2 PCM memory drivers
#
# CONFIG_MTD_LPDDR is not set
# CONFIG_MTD_LPDDR2_NVM is not set
# end of LPDDR & LPDDR2 PCM memory drivers

CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
# CONFIG_MTD_SPI_NOR_SWP_DISABLE is not set
CONFIG_MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE=y
# CONFIG_MTD_SPI_NOR_SWP_KEEP is not set
# CONFIG_SPI_HISI_SFC is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
# CONFIG_MTD_UBI_BLOCK is not set
# CONFIG_MTD_HYPERBUS is not set
CONFIG_DTC=y
CONFIG_OF=y
# CONFIG_OF_UNITTEST is not set
CONFIG_OF_FLATTREE=y
CONFIG_OF_EARLY_FLATTREE=y
CONFIG_OF_KOBJ=y
CONFIG_OF_DYNAMIC=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_IRQ=y
CONFIG_OF_RESERVED_MEM=y
CONFIG_OF_RESOLVE=y
CONFIG_OF_OVERLAY=y
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
# CONFIG_PARPORT is not set
CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_NULL_BLK is not set
CONFIG_CDROM=y
# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set
# CONFIG_ZRAM is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
# CONFIG_BLK_DEV_DRBD is not set
# CONFIG_BLK_DEV_NBD is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=65536
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
CONFIG_VIRTIO_BLK=y
# CONFIG_BLK_DEV_RBD is not set
# CONFIG_BLK_DEV_UBLK is not set

#
# NVME Support
#
# CONFIG_BLK_DEV_NVME is not set
# CONFIG_NVME_FC is not set
# CONFIG_NVME_TCP is not set
# CONFIG_NVME_TARGET is not set
# end of NVME Support

#
# Misc devices
#
CONFIG_AD525X_DPOT=y
CONFIG_AD525X_DPOT_I2C=y
# CONFIG_AD525X_DPOT_SPI is not set
# CONFIG_DUMMY_IRQ is not set
# CONFIG_PHANTOM is not set
# CONFIG_TIFM_CORE is not set
CONFIG_ICS932S401=y
CONFIG_ATMEL_SSC=m
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_GEHC_ACHC is not set
# CONFIG_HI6421V600_IRQ is not set
# CONFIG_HP_ILO is not set
CONFIG_QCOM_COINCELL=m
CONFIG_QCOM_FASTRPC=m
CONFIG_APDS9802ALS=y
CONFIG_ISL29003=y
# CONFIG_ISL29020 is not set
# CONFIG_SENSORS_TSL2550 is not set
# CONFIG_SENSORS_BH1770 is not set
# CONFIG_SENSORS_APDS990X is not set
# CONFIG_HMC6352 is not set
# CONFIG_DS1682 is not set
# CONFIG_LATTICE_ECP3_CONFIG is not set
CONFIG_SRAM=y
CONFIG_SRAM_EXEC=y
# CONFIG_DW_XDATA_PCIE is not set
CONFIG_PCI_ENDPOINT_TEST=m
# CONFIG_XILINX_SDFEC is not set
# CONFIG_HISI_HIKEY_USB is not set
# CONFIG_OPEN_DICE is not set
# CONFIG_VCPU_STALL_DETECTOR is not set
# CONFIG_C2PORT is not set

#
# EEPROM support
#
CONFIG_EEPROM_AT24=y
# CONFIG_EEPROM_AT25 is not set
# CONFIG_EEPROM_LEGACY is not set
# CONFIG_EEPROM_MAX6875 is not set
CONFIG_EEPROM_93CX6=y
# CONFIG_EEPROM_93XX46 is not set
# CONFIG_EEPROM_IDT_89HPESX is not set
# CONFIG_EEPROM_EE1004 is not set
# end of EEPROM support

# CONFIG_CB710_CORE is not set

#
# Texas Instruments shared transport line discipline
#
# CONFIG_TI_ST is not set
# end of Texas Instruments shared transport line discipline

# CONFIG_SENSORS_LIS3_SPI is not set
# CONFIG_SENSORS_LIS3_I2C is not set
# CONFIG_ALTERA_STAPL is not set
# CONFIG_ECHO is not set
# CONFIG_BCM_VK is not set
# CONFIG_MISC_ALCOR_PCI is not set
# CONFIG_MISC_RTSX_PCI is not set
# CONFIG_MISC_RTSX_USB is not set
# CONFIG_HABANA_AI is not set
# CONFIG_UACCE is not set
# CONFIG_PVPANIC is not set
# CONFIG_GP_PCI1XXXX is not set
# end of Misc devices

#
# SCSI device support
#
CONFIG_SCSI_MOD=y
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI_COMMON=y
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
# CONFIG_CHR_DEV_ST is not set
CONFIG_BLK_DEV_SR=y
# CONFIG_CHR_DEV_SG is not set
CONFIG_BLK_DEV_BSG=y
# CONFIG_CHR_DEV_SCH is not set
# CONFIG_SCSI_CONSTANTS is not set
# CONFIG_SCSI_LOGGING is not set
# CONFIG_SCSI_SCAN_ASYNC is not set

#
# SCSI Transports
#
# CONFIG_SCSI_SPI_ATTRS is not set
# CONFIG_SCSI_FC_ATTRS is not set
# CONFIG_SCSI_ISCSI_ATTRS is not set
# CONFIG_SCSI_SAS_ATTRS is not set
# CONFIG_SCSI_SAS_LIBSAS is not set
# CONFIG_SCSI_SRP_ATTRS is not set
# end of SCSI Transports

CONFIG_SCSI_LOWLEVEL=y
# CONFIG_ISCSI_TCP is not set
# CONFIG_ISCSI_BOOT_SYSFS is not set
# CONFIG_SCSI_CXGB3_ISCSI is not set
# CONFIG_SCSI_CXGB4_ISCSI is not set
# CONFIG_SCSI_BNX2_ISCSI is not set
# CONFIG_BE2ISCSI is not set
# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
# CONFIG_SCSI_HPSA is not set
# CONFIG_SCSI_3W_9XXX is not set
# CONFIG_SCSI_3W_SAS is not set
# CONFIG_SCSI_ACARD is not set
# CONFIG_SCSI_AACRAID is not set
# CONFIG_SCSI_AIC7XXX is not set
# CONFIG_SCSI_AIC79XX is not set
# CONFIG_SCSI_AIC94XX is not set
# CONFIG_SCSI_MVSAS is not set
# CONFIG_SCSI_MVUMI is not set
# CONFIG_SCSI_ADVANSYS is not set
# CONFIG_SCSI_ARCMSR is not set
# CONFIG_SCSI_ESAS2R is not set
# CONFIG_MEGARAID_NEWGEN is not set
# CONFIG_MEGARAID_LEGACY is not set
# CONFIG_MEGARAID_SAS is not set
# CONFIG_SCSI_MPT3SAS is not set
# CONFIG_SCSI_MPT2SAS is not set
# CONFIG_SCSI_MPI3MR is not set
# CONFIG_SCSI_SMARTPQI is not set
# CONFIG_SCSI_HPTIOP is not set
# CONFIG_SCSI_BUSLOGIC is not set
# CONFIG_SCSI_MYRB is not set
# CONFIG_SCSI_MYRS is not set
# CONFIG_SCSI_SNIC is not set
# CONFIG_SCSI_DMX3191D is not set
# CONFIG_SCSI_FDOMAIN_PCI is not set
# CONFIG_SCSI_IPS is not set
# CONFIG_SCSI_INITIO is not set
# CONFIG_SCSI_INIA100 is not set
# CONFIG_SCSI_STEX is not set
# CONFIG_SCSI_SYM53C8XX_2 is not set
# CONFIG_SCSI_IPR is not set
# CONFIG_SCSI_QLOGIC_1280 is not set
# CONFIG_SCSI_QLA_ISCSI is not set
# CONFIG_SCSI_DC395x is not set
# CONFIG_SCSI_AM53C974 is not set
# CONFIG_SCSI_NSP32 is not set
# CONFIG_SCSI_WD719X is not set
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_PMCRAID is not set
# CONFIG_SCSI_PM8001 is not set
# CONFIG_SCSI_VIRTIO is not set
# CONFIG_SCSI_DH is not set
# end of SCSI device support

CONFIG_ATA=y
CONFIG_SATA_HOST=y
CONFIG_ATA_VERBOSE_ERROR=y
CONFIG_ATA_FORCE=y
CONFIG_SATA_PMP=y

#
# Controllers with non-SFF native interface
#
CONFIG_SATA_AHCI=y
CONFIG_SATA_MOBILE_LPM_POLICY=0
CONFIG_SATA_AHCI_PLATFORM=y
CONFIG_AHCI_BRCM=y
CONFIG_AHCI_DM816=y
# CONFIG_AHCI_DWC is not set
CONFIG_AHCI_ST=y
CONFIG_AHCI_IMX=y
# CONFIG_AHCI_CEVA is not set
# CONFIG_AHCI_MTK is not set
# CONFIG_AHCI_MVEBU is not set
CONFIG_AHCI_SUNXI=y
CONFIG_AHCI_TEGRA=y
# CONFIG_AHCI_QORIQ is not set
# CONFIG_SATA_INIC162X is not set
# CONFIG_SATA_ACARD_AHCI is not set
# CONFIG_SATA_SIL24 is not set
CONFIG_ATA_SFF=y

#
# SFF controllers with custom DMA interface
#
# CONFIG_PDC_ADMA is not set
# CONFIG_SATA_QSTOR is not set
# CONFIG_SATA_SX4 is not set
CONFIG_ATA_BMDMA=y

#
# SATA SFF controllers with BMDMA
#
# CONFIG_ATA_PIIX is not set
# CONFIG_SATA_DWC is not set
CONFIG_SATA_HIGHBANK=y
CONFIG_SATA_MV=y
# CONFIG_SATA_NV is not set
# CONFIG_SATA_PROMISE is not set
CONFIG_SATA_RCAR=y
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIS is not set
# CONFIG_SATA_SVW is not set
# CONFIG_SATA_ULI is not set
# CONFIG_SATA_VIA is not set
# CONFIG_SATA_VITESSE is not set

#
# PATA SFF controllers with BMDMA
#
# CONFIG_PATA_ALI is not set
# CONFIG_PATA_AMD is not set
# CONFIG_PATA_ARASAN_CF is not set
# CONFIG_PATA_ARTOP is not set
# CONFIG_PATA_ATIIXP is not set
# CONFIG_PATA_ATP867X is not set
# CONFIG_PATA_CMD64X is not set
# CONFIG_PATA_CYPRESS is not set
# CONFIG_PATA_EFAR is not set
# CONFIG_PATA_HPT366 is not set
# CONFIG_PATA_HPT37X is not set
# CONFIG_PATA_HPT3X2N is not set
# CONFIG_PATA_HPT3X3 is not set
# CONFIG_PATA_IMX is not set
# CONFIG_PATA_IT8213 is not set
# CONFIG_PATA_IT821X is not set
# CONFIG_PATA_JMICRON is not set
# CONFIG_PATA_MARVELL is not set
# CONFIG_PATA_NETCELL is not set
# CONFIG_PATA_NINJA32 is not set
# CONFIG_PATA_NS87415 is not set
# CONFIG_PATA_OLDPIIX is not set
# CONFIG_PATA_OPTIDMA is not set
# CONFIG_PATA_PDC2027X is not set
# CONFIG_PATA_PDC_OLD is not set
# CONFIG_PATA_RADISYS is not set
# CONFIG_PATA_RDC is not set
# CONFIG_PATA_SCH is not set
# CONFIG_PATA_SERVERWORKS is not set
# CONFIG_PATA_SIL680 is not set
# CONFIG_PATA_SIS is not set
# CONFIG_PATA_TOSHIBA is not set
# CONFIG_PATA_TRIFLEX is not set
# CONFIG_PATA_VIA is not set
# CONFIG_PATA_WINBOND is not set

#
# PIO-only SFF controllers
#
# CONFIG_PATA_CMD640_PCI is not set
# CONFIG_PATA_MPIIX is not set
# CONFIG_PATA_NS87410 is not set
# CONFIG_PATA_OPTI is not set
# CONFIG_PATA_OF_PLATFORM is not set
# CONFIG_PATA_RZ1000 is not set

#
# Generic fallback / legacy drivers
#
# CONFIG_ATA_GENERIC is not set
# CONFIG_PATA_LEGACY is not set
# CONFIG_MD is not set
# CONFIG_TARGET_CORE is not set
# CONFIG_FUSION is not set

#
# IEEE 1394 (FireWire) support
#
# CONFIG_FIREWIRE is not set
# CONFIG_FIREWIRE_NOSY is not set
# end of IEEE 1394 (FireWire) support

CONFIG_NETDEVICES=y
CONFIG_MII=y
CONFIG_NET_CORE=y
# CONFIG_BONDING is not set
# CONFIG_DUMMY is not set
# CONFIG_WIREGUARD is not set
# CONFIG_EQUALIZER is not set
# CONFIG_NET_FC is not set
# CONFIG_NET_TEAM is not set
# CONFIG_MACVLAN is not set
# CONFIG_IPVLAN is not set
# CONFIG_VXLAN is not set
# CONFIG_GENEVE is not set
# CONFIG_BAREUDP is not set
# CONFIG_GTP is not set
# CONFIG_MACSEC is not set
# CONFIG_NETCONSOLE is not set
# CONFIG_TUN is not set
# CONFIG_TUN_VNET_CROSS_LE is not set
# CONFIG_VETH is not set
CONFIG_VIRTIO_NET=y
# CONFIG_NLMON is not set
# CONFIG_ARCNET is not set

#
# Distributed Switch Architecture drivers
#
CONFIG_B53=m
CONFIG_B53_SPI_DRIVER=m
CONFIG_B53_MDIO_DRIVER=m
CONFIG_B53_MMAP_DRIVER=m
CONFIG_B53_SRAB_DRIVER=m
CONFIG_B53_SERDES=m
CONFIG_NET_DSA_BCM_SF2=m
# CONFIG_NET_DSA_LOOP is not set
# CONFIG_NET_DSA_LANTIQ_GSWIP is not set
# CONFIG_NET_DSA_MT7530 is not set
# CONFIG_NET_DSA_MV88E6060 is not set
# CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON is not set
# CONFIG_NET_DSA_MV88E6XXX is not set
# CONFIG_NET_DSA_MSCC_FELIX is not set
# CONFIG_NET_DSA_MSCC_SEVILLE is not set
# CONFIG_NET_DSA_AR9331 is not set
# CONFIG_NET_DSA_QCA8K is not set
# CONFIG_NET_DSA_SJA1105 is not set
# CONFIG_NET_DSA_XRS700X_I2C is not set
# CONFIG_NET_DSA_XRS700X_MDIO is not set
# CONFIG_NET_DSA_REALTEK is not set
# CONFIG_NET_DSA_RZN1_A5PSW is not set
# CONFIG_NET_DSA_SMSC_LAN9303_I2C is not set
# CONFIG_NET_DSA_SMSC_LAN9303_MDIO is not set
# CONFIG_NET_DSA_VITESSE_VSC73XX_SPI is not set
# CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM is not set
# end of Distributed Switch Architecture drivers

CONFIG_ETHERNET=y
CONFIG_NET_VENDOR_3COM=y
# CONFIG_TYPHOON is not set
CONFIG_NET_VENDOR_ACTIONS=y
# CONFIG_OWL_EMAC is not set
CONFIG_NET_VENDOR_ADAPTEC=y
# CONFIG_ADAPTEC_STARFIRE is not set
CONFIG_NET_VENDOR_AGERE=y
# CONFIG_ET131X is not set
CONFIG_NET_VENDOR_ALACRITECH=y
# CONFIG_SLICOSS is not set
CONFIG_NET_VENDOR_ALLWINNER=y
CONFIG_SUN4I_EMAC=y
CONFIG_NET_VENDOR_ALTEON=y
# CONFIG_ACENIC is not set
# CONFIG_ALTERA_TSE is not set
CONFIG_NET_VENDOR_AMAZON=y
# CONFIG_ENA_ETHERNET is not set
CONFIG_NET_VENDOR_AMD=y
# CONFIG_AMD8111_ETH is not set
# CONFIG_PCNET32 is not set
CONFIG_NET_VENDOR_AQUANTIA=y
# CONFIG_AQTION is not set
CONFIG_NET_VENDOR_ARC=y
# CONFIG_EMAC_ROCKCHIP is not set
CONFIG_NET_VENDOR_ASIX=y
CONFIG_SPI_AX88796C=m
# CONFIG_SPI_AX88796C_COMPRESSION is not set
CONFIG_NET_VENDOR_ATHEROS=y
# CONFIG_ATL2 is not set
# CONFIG_ATL1 is not set
# CONFIG_ATL1E is not set
# CONFIG_ATL1C is not set
# CONFIG_ALX is not set
CONFIG_NET_VENDOR_BROADCOM=y
# CONFIG_B44 is not set
CONFIG_BCM4908_ENET=y
CONFIG_BCMGENET=m
# CONFIG_BNX2 is not set
# CONFIG_CNIC is not set
# CONFIG_TIGON3 is not set
# CONFIG_BNX2X is not set
CONFIG_BGMAC=y
CONFIG_BGMAC_BCMA=y
CONFIG_BGMAC_PLATFORM=y
CONFIG_SYSTEMPORT=m
# CONFIG_BNXT is not set
CONFIG_NET_VENDOR_CADENCE=y
CONFIG_MACB=y
CONFIG_MACB_USE_HWSTAMP=y
# CONFIG_MACB_PCI is not set
CONFIG_NET_CALXEDA_XGMAC=y
CONFIG_NET_VENDOR_CAVIUM=y
CONFIG_NET_VENDOR_CHELSIO=y
# CONFIG_CHELSIO_T1 is not set
# CONFIG_CHELSIO_T3 is not set
# CONFIG_CHELSIO_T4 is not set
# CONFIG_CHELSIO_T4VF is not set
CONFIG_NET_VENDOR_CIRRUS=y
# CONFIG_CS89x0_PLATFORM is not set
CONFIG_NET_VENDOR_CISCO=y
# CONFIG_ENIC is not set
CONFIG_NET_VENDOR_CORTINA=y
# CONFIG_GEMINI_ETHERNET is not set
CONFIG_NET_VENDOR_DAVICOM=y
# CONFIG_DM9000 is not set
# CONFIG_DM9051 is not set
# CONFIG_DNET is not set
CONFIG_NET_VENDOR_DEC=y
# CONFIG_NET_TULIP is not set
CONFIG_NET_VENDOR_DLINK=y
# CONFIG_DL2K is not set
# CONFIG_SUNDANCE is not set
CONFIG_NET_VENDOR_EMULEX=y
# CONFIG_BE2NET is not set
CONFIG_NET_VENDOR_ENGLEDER=y
# CONFIG_TSNEP is not set
CONFIG_NET_VENDOR_EZCHIP=y
# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set
CONFIG_NET_VENDOR_FARADAY=y
# CONFIG_FTMAC100 is not set
CONFIG_FTGMAC100=m
CONFIG_NET_VENDOR_FREESCALE=y
CONFIG_FEC=y
CONFIG_FSL_PQ_MDIO=y
# CONFIG_FSL_XGMAC_MDIO is not set
CONFIG_GIANFAR=y
# CONFIG_FSL_DPAA2_SWITCH is not set
# CONFIG_FSL_ENETC is not set
# CONFIG_FSL_ENETC_VF is not set
# CONFIG_FSL_ENETC_IERB is not set
# CONFIG_FSL_ENETC_MDIO is not set
CONFIG_NET_VENDOR_FUNGIBLE=y
# CONFIG_FUN_ETH is not set
CONFIG_NET_VENDOR_GOOGLE=y
# CONFIG_GVE is not set
CONFIG_NET_VENDOR_HISILICON=y
CONFIG_HIX5HD2_GMAC=y
# CONFIG_HISI_FEMAC is not set
# CONFIG_HIP04_ETH is not set
# CONFIG_HNS_DSAF is not set
# CONFIG_HNS_ENET is not set
# CONFIG_HNS3 is not set
CONFIG_NET_VENDOR_HUAWEI=y
CONFIG_NET_VENDOR_I825XX=y
CONFIG_NET_VENDOR_INTEL=y
# CONFIG_E100 is not set
# CONFIG_E1000 is not set
CONFIG_E1000E=y
CONFIG_IGB=y
CONFIG_IGB_HWMON=y
# CONFIG_IGBVF is not set
# CONFIG_IXGB is not set
# CONFIG_IXGBE is not set
# CONFIG_IXGBEVF is not set
# CONFIG_I40E is not set
# CONFIG_I40EVF is not set
# CONFIG_ICE is not set
# CONFIG_FM10K is not set
# CONFIG_IGC is not set
CONFIG_NET_VENDOR_WANGXUN=y
# CONFIG_NGBE is not set
# CONFIG_TXGBE is not set
# CONFIG_JME is not set
CONFIG_NET_VENDOR_ADI=y
# CONFIG_ADIN1110 is not set
CONFIG_NET_VENDOR_LITEX=y
# CONFIG_LITEX_LITEETH is not set
CONFIG_NET_VENDOR_MARVELL=y
CONFIG_MV643XX_ETH=y
CONFIG_MVMDIO=y
# CONFIG_MVNETA_BM_ENABLE is not set
CONFIG_MVNETA=y
# CONFIG_MVPP2 is not set
CONFIG_PXA168_ETH=m
# CONFIG_SKGE is not set
# CONFIG_SKY2 is not set
# CONFIG_NET_VENDOR_MEDIATEK is not set
CONFIG_NET_VENDOR_MELLANOX=y
# CONFIG_MLX4_EN is not set
# CONFIG_MLX5_CORE is not set
# CONFIG_MLXSW_CORE is not set
# CONFIG_MLXFW is not set
CONFIG_NET_VENDOR_MICREL=y
# CONFIG_KS8842 is not set
CONFIG_KS8851=y
# CONFIG_KS8851_MLL is not set
# CONFIG_KSZ884X_PCI is not set
CONFIG_NET_VENDOR_MICROCHIP=y
# CONFIG_ENC28J60 is not set
# CONFIG_ENCX24J600 is not set
# CONFIG_LAN743X is not set
CONFIG_LAN966X_SWITCH=m
# CONFIG_VCAP is not set
CONFIG_NET_VENDOR_MICROSEMI=y
# CONFIG_MSCC_OCELOT_SWITCH is not set
CONFIG_NET_VENDOR_MICROSOFT=y
CONFIG_NET_VENDOR_MYRI=y
# CONFIG_MYRI10GE is not set
CONFIG_NET_VENDOR_NI=y
# CONFIG_NI_XGE_MANAGEMENT_ENET is not set
CONFIG_NET_VENDOR_NATSEMI=y
# CONFIG_NATSEMI is not set
# CONFIG_NS83820 is not set
CONFIG_NET_VENDOR_NETERION=y
# CONFIG_S2IO is not set
CONFIG_NET_VENDOR_NETRONOME=y
# CONFIG_NFP is not set
CONFIG_NET_VENDOR_8390=y
# CONFIG_AX88796 is not set
# CONFIG_NE2K_PCI is not set
CONFIG_NET_VENDOR_NVIDIA=y
# CONFIG_FORCEDETH is not set
CONFIG_NET_VENDOR_OKI=y
# CONFIG_ETHOC is not set
CONFIG_NET_VENDOR_PACKET_ENGINES=y
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
CONFIG_NET_VENDOR_PENSANDO=y
CONFIG_NET_VENDOR_QLOGIC=y
# CONFIG_QLA3XXX is not set
# CONFIG_QLCNIC is not set
# CONFIG_NETXEN_NIC is not set
# CONFIG_QED is not set
CONFIG_NET_VENDOR_BROCADE=y
# CONFIG_BNA is not set
CONFIG_NET_VENDOR_QUALCOMM=y
# CONFIG_QCA7000_SPI is not set
# CONFIG_QCA7000_UART is not set
# CONFIG_QCOM_EMAC is not set
# CONFIG_RMNET is not set
CONFIG_NET_VENDOR_RDC=y
# CONFIG_R6040 is not set
CONFIG_NET_VENDOR_REALTEK=y
# CONFIG_8139CP is not set
# CONFIG_8139TOO is not set
CONFIG_R8169=y
CONFIG_NET_VENDOR_RENESAS=y
CONFIG_SH_ETH=y
# CONFIG_RAVB is not set
CONFIG_NET_VENDOR_ROCKER=y
CONFIG_NET_VENDOR_SAMSUNG=y
# CONFIG_SXGBE_ETH is not set
CONFIG_NET_VENDOR_SEEQ=y
CONFIG_NET_VENDOR_SILAN=y
# CONFIG_SC92031 is not set
CONFIG_NET_VENDOR_SIS=y
# CONFIG_SIS900 is not set
# CONFIG_SIS190 is not set
CONFIG_NET_VENDOR_SOLARFLARE=y
# CONFIG_SFC is not set
# CONFIG_SFC_FALCON is not set
# CONFIG_SFC_SIENA is not set
CONFIG_NET_VENDOR_SMSC=y
# CONFIG_SMC91X is not set
# CONFIG_EPIC100 is not set
CONFIG_SMSC911X=y
# CONFIG_SMSC9420 is not set
CONFIG_NET_VENDOR_SOCIONEXT=y
CONFIG_SNI_AVE=y
CONFIG_NET_VENDOR_STMICRO=y
CONFIG_STMMAC_ETH=y
# CONFIG_STMMAC_SELFTESTS is not set
CONFIG_STMMAC_PLATFORM=y
CONFIG_DWMAC_DWC_QOS_ETH=y
CONFIG_DWMAC_GENERIC=y
CONFIG_DWMAC_IPQ806X=y
# CONFIG_DWMAC_MEDIATEK is not set
CONFIG_DWMAC_MESON=y
CONFIG_DWMAC_QCOM_ETHQOS=y
CONFIG_DWMAC_ROCKCHIP=y
CONFIG_DWMAC_SOCFPGA=y
CONFIG_DWMAC_STI=y
CONFIG_DWMAC_STM32=y
CONFIG_DWMAC_SUNXI=y
CONFIG_DWMAC_SUN8I=y
CONFIG_DWMAC_IMX8=y
# CONFIG_DWMAC_INTEL_PLAT is not set
# CONFIG_DWMAC_LOONGSON is not set
# CONFIG_STMMAC_PCI is not set
CONFIG_NET_VENDOR_SUN=y
# CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set
# CONFIG_CASSINI is not set
# CONFIG_NIU is not set
CONFIG_NET_VENDOR_SUNPLUS=y
# CONFIG_SP7021_EMAC is not set
CONFIG_NET_VENDOR_SYNOPSYS=y
# CONFIG_DWC_XLGMAC is not set
CONFIG_NET_VENDOR_TEHUTI=y
# CONFIG_TEHUTI is not set
CONFIG_NET_VENDOR_TI=y
# CONFIG_TI_DAVINCI_EMAC is not set
CONFIG_TI_DAVINCI_MDIO=y
# CONFIG_TI_CPSW_PHY_SEL is not set
CONFIG_TI_CPSW=y
CONFIG_TI_CPSW_SWITCHDEV=y
CONFIG_TI_CPTS=y
# CONFIG_TLAN is not set
CONFIG_NET_VENDOR_VERTEXCOM=y
# CONFIG_MSE102X is not set
CONFIG_NET_VENDOR_VIA=y
# CONFIG_VIA_RHINE is not set
# CONFIG_VIA_VELOCITY is not set
CONFIG_NET_VENDOR_WIZNET=y
# CONFIG_WIZNET_W5100 is not set
# CONFIG_WIZNET_W5300 is not set
CONFIG_NET_VENDOR_XILINX=y
CONFIG_XILINX_EMACLITE=y
# CONFIG_XILINX_AXI_EMAC is not set
# CONFIG_XILINX_LL_TEMAC is not set
# CONFIG_FDDI is not set
# CONFIG_HIPPI is not set
# CONFIG_QCOM_IPA is not set
CONFIG_PHYLINK=y
CONFIG_PHYLIB=y
CONFIG_SWPHY=y
# CONFIG_LED_TRIGGER_PHY is not set
CONFIG_FIXED_PHY=y
CONFIG_SFP=m

#
# MII PHY device drivers
#
# CONFIG_AMD_PHY is not set
# CONFIG_MESON_GXL_PHY is not set
# CONFIG_ADIN_PHY is not set
# CONFIG_ADIN1100_PHY is not set
# CONFIG_AQUANTIA_PHY is not set
CONFIG_AX88796B_PHY=y
CONFIG_BROADCOM_PHY=y
# CONFIG_BCM54140_PHY is not set
CONFIG_BCM7XXX_PHY=m
# CONFIG_BCM84881_PHY is not set
# CONFIG_BCM87XX_PHY is not set
# CONFIG_BCM_CYGNUS_PHY is not set
CONFIG_BCM_NET_PHYLIB=y
# CONFIG_CICADA_PHY is not set
# CONFIG_CORTINA_PHY is not set
# CONFIG_DAVICOM_PHY is not set
CONFIG_ICPLUS_PHY=y
# CONFIG_LXT_PHY is not set
# CONFIG_INTEL_XWAY_PHY is not set
# CONFIG_LSI_ET1011C_PHY is not set
CONFIG_MARVELL_PHY=y
# CONFIG_MARVELL_10G_PHY is not set
# CONFIG_MARVELL_88X2222_PHY is not set
# CONFIG_MAXLINEAR_GPHY is not set
# CONFIG_MEDIATEK_GE_PHY is not set
CONFIG_MICREL_PHY=y
CONFIG_MICROCHIP_PHY=m
# CONFIG_MICROCHIP_T1_PHY is not set
# CONFIG_MICROSEMI_PHY is not set
# CONFIG_MOTORCOMM_PHY is not set
# CONFIG_NATIONAL_PHY is not set
# CONFIG_NXP_C45_TJA11XX_PHY is not set
# CONFIG_NXP_TJA11XX_PHY is not set
CONFIG_AT803X_PHY=y
# CONFIG_QSEMI_PHY is not set
CONFIG_REALTEK_PHY=y
# CONFIG_RENESAS_PHY is not set
CONFIG_ROCKCHIP_PHY=y
CONFIG_SMSC_PHY=y
# CONFIG_STE10XP is not set
# CONFIG_TERANETICS_PHY is not set
# CONFIG_DP83822_PHY is not set
# CONFIG_DP83TC811_PHY is not set
# CONFIG_DP83848_PHY is not set
CONFIG_DP83867_PHY=y
# CONFIG_DP83869_PHY is not set
# CONFIG_DP83TD510_PHY is not set
# CONFIG_VITESSE_PHY is not set
# CONFIG_XILINX_GMII2RGMII is not set
# CONFIG_MICREL_KS8995MA is not set
# CONFIG_PSE_CONTROLLER is not set
CONFIG_CAN_DEV=y
# CONFIG_CAN_VCAN is not set
# CONFIG_CAN_VXCAN is not set
CONFIG_CAN_NETLINK=y
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_RX_OFFLOAD=y
CONFIG_CAN_AT91=m
# CONFIG_CAN_CAN327 is not set
CONFIG_CAN_FLEXCAN=m
# CONFIG_CAN_GRCAN is not set
# CONFIG_CAN_KVASER_PCIEFD is not set
# CONFIG_CAN_SLCAN is not set
CONFIG_CAN_SUN4I=y
# CONFIG_CAN_TI_HECC is not set
CONFIG_CAN_XILINXCAN=y
# CONFIG_CAN_C_CAN is not set
# CONFIG_CAN_CC770 is not set
# CONFIG_CAN_CTUCANFD_PCI is not set
# CONFIG_CAN_CTUCANFD_PLATFORM is not set
# CONFIG_CAN_IFI_CANFD is not set
# CONFIG_CAN_M_CAN is not set
# CONFIG_CAN_PEAK_PCIEFD is not set
CONFIG_CAN_RCAR=m
# CONFIG_CAN_RCAR_CANFD is not set
# CONFIG_CAN_SJA1000 is not set
# CONFIG_CAN_SOFTING is not set

#
# CAN SPI interfaces
#
# CONFIG_CAN_HI311X is not set
CONFIG_CAN_MCP251X=y
# CONFIG_CAN_MCP251XFD is not set
# end of CAN SPI interfaces

#
# CAN USB interfaces
#
# CONFIG_CAN_8DEV_USB is not set
# CONFIG_CAN_EMS_USB is not set
# CONFIG_CAN_ESD_USB is not set
# CONFIG_CAN_ETAS_ES58X is not set
# CONFIG_CAN_GS_USB is not set
# CONFIG_CAN_KVASER_USB is not set
# CONFIG_CAN_MCBA_USB is not set
# CONFIG_CAN_PEAK_USB is not set
# CONFIG_CAN_UCAN is not set
# end of CAN USB interfaces

# CONFIG_CAN_DEBUG_DEVICES is not set
CONFIG_MDIO_DEVICE=y
CONFIG_MDIO_BUS=y
CONFIG_FWNODE_MDIO=y
CONFIG_OF_MDIO=y
CONFIG_MDIO_DEVRES=y
CONFIG_MDIO_SUN4I=y
CONFIG_MDIO_ASPEED=m
CONFIG_MDIO_BITBANG=y
CONFIG_MDIO_BCM_IPROC=y
CONFIG_MDIO_BCM_UNIMAC=m
# CONFIG_MDIO_GPIO is not set
# CONFIG_MDIO_HISI_FEMAC is not set
CONFIG_MDIO_I2C=m
# CONFIG_MDIO_MVUSB is not set
CONFIG_MDIO_MSCC_MIIM=m
# CONFIG_MDIO_IPQ4019 is not set
# CONFIG_MDIO_IPQ8064 is not set

#
# MDIO Multiplexers
#
CONFIG_MDIO_BUS_MUX=y
CONFIG_MDIO_BUS_MUX_MESON_G12A=m
CONFIG_MDIO_BUS_MUX_BCM_IPROC=y
# CONFIG_MDIO_BUS_MUX_GPIO is not set
# CONFIG_MDIO_BUS_MUX_MULTIPLEXER is not set
# CONFIG_MDIO_BUS_MUX_MMIOREG is not set

#
# PCS device drivers
#
CONFIG_PCS_XPCS=y
# CONFIG_PCS_RZN1_MIIC is not set
# end of PCS device drivers

# CONFIG_PPP is not set
# CONFIG_SLIP is not set
CONFIG_USB_NET_DRIVERS=y
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
CONFIG_USB_PEGASUS=y
# CONFIG_USB_RTL8150 is not set
CONFIG_USB_RTL8152=m
CONFIG_USB_LAN78XX=m
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_AX88179_178A=y
CONFIG_USB_NET_CDCETHER=y
# CONFIG_USB_NET_CDC_EEM is not set
CONFIG_USB_NET_CDC_NCM=y
# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set
# CONFIG_USB_NET_CDC_MBIM is not set
# CONFIG_USB_NET_DM9601 is not set
# CONFIG_USB_NET_SR9700 is not set
# CONFIG_USB_NET_SR9800 is not set
CONFIG_USB_NET_SMSC75XX=y
CONFIG_USB_NET_SMSC95XX=y
# CONFIG_USB_NET_GL620A is not set
CONFIG_USB_NET_NET1080=y
# CONFIG_USB_NET_PLUSB is not set
# CONFIG_USB_NET_MCS7830 is not set
# CONFIG_USB_NET_RNDIS_HOST is not set
CONFIG_USB_NET_CDC_SUBSET_ENABLE=y
CONFIG_USB_NET_CDC_SUBSET=y
# CONFIG_USB_ALI_M5632 is not set
# CONFIG_USB_AN2720 is not set
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
# CONFIG_USB_EPSON2888 is not set
# CONFIG_USB_KC2190 is not set
CONFIG_USB_NET_ZAURUS=y
# CONFIG_USB_NET_CX82310_ETH is not set
# CONFIG_USB_NET_KALMIA is not set
# CONFIG_USB_NET_QMI_WWAN is not set
# CONFIG_USB_HSO is not set
# CONFIG_USB_NET_INT51X1 is not set
# CONFIG_USB_IPHETH is not set
# CONFIG_USB_SIERRA_NET is not set
# CONFIG_USB_VL600 is not set
# CONFIG_USB_NET_CH9200 is not set
# CONFIG_USB_NET_AQC111 is not set
CONFIG_USB_RTL8153_ECM=m
CONFIG_WLAN=y
CONFIG_WLAN_VENDOR_ADMTEK=y
# CONFIG_ADM8211 is not set
CONFIG_WLAN_VENDOR_ATH=y
# CONFIG_ATH_DEBUG is not set
# CONFIG_ATH5K is not set
# CONFIG_ATH5K_PCI is not set
# CONFIG_ATH9K is not set
# CONFIG_ATH9K_HTC is not set
# CONFIG_CARL9170 is not set
# CONFIG_ATH6KL is not set
# CONFIG_AR5523 is not set
# CONFIG_WIL6210 is not set
# CONFIG_ATH10K is not set
CONFIG_WCN36XX=m
# CONFIG_WCN36XX_DEBUGFS is not set
CONFIG_WLAN_VENDOR_ATMEL=y
# CONFIG_ATMEL is not set
# CONFIG_AT76C50X_USB is not set
CONFIG_WLAN_VENDOR_BROADCOM=y
# CONFIG_B43 is not set
# CONFIG_B43LEGACY is not set
CONFIG_BRCMUTIL=m
# CONFIG_BRCMSMAC is not set
CONFIG_BRCMFMAC=m
CONFIG_BRCMFMAC_PROTO_BCDC=y
CONFIG_BRCMFMAC_SDIO=y
# CONFIG_BRCMFMAC_USB is not set
# CONFIG_BRCMFMAC_PCIE is not set
# CONFIG_BRCM_TRACING is not set
# CONFIG_BRCMDBG is not set
CONFIG_WLAN_VENDOR_CISCO=y
CONFIG_WLAN_VENDOR_INTEL=y
# CONFIG_IPW2100 is not set
# CONFIG_IPW2200 is not set
# CONFIG_IWL4965 is not set
# CONFIG_IWL3945 is not set
# CONFIG_IWLWIFI is not set
CONFIG_WLAN_VENDOR_INTERSIL=y
# CONFIG_HOSTAP is not set
# CONFIG_HERMES is not set
# CONFIG_P54_COMMON is not set
CONFIG_WLAN_VENDOR_MARVELL=y
# CONFIG_LIBERTAS is not set
# CONFIG_LIBERTAS_THINFIRM is not set
CONFIG_MWIFIEX=m
CONFIG_MWIFIEX_SDIO=m
# CONFIG_MWIFIEX_PCIE is not set
# CONFIG_MWIFIEX_USB is not set
# CONFIG_MWL8K is not set
CONFIG_WLAN_VENDOR_MEDIATEK=y
# CONFIG_MT7601U is not set
# CONFIG_MT76x0U is not set
# CONFIG_MT76x0E is not set
# CONFIG_MT76x2E is not set
# CONFIG_MT76x2U is not set
# CONFIG_MT7603E is not set
# CONFIG_MT7615E is not set
# CONFIG_MT7663U is not set
# CONFIG_MT7663S is not set
# CONFIG_MT7915E is not set
# CONFIG_MT7921E is not set
# CONFIG_MT7921S is not set
# CONFIG_MT7921U is not set
CONFIG_WLAN_VENDOR_MICROCHIP=y
# CONFIG_WILC1000_SDIO is not set
# CONFIG_WILC1000_SPI is not set
CONFIG_WLAN_VENDOR_PURELIFI=y
# CONFIG_PLFXLC is not set
CONFIG_WLAN_VENDOR_RALINK=y
CONFIG_RT2X00=m
# CONFIG_RT2400PCI is not set
# CONFIG_RT2500PCI is not set
# CONFIG_RT61PCI is not set
# CONFIG_RT2800PCI is not set
# CONFIG_RT2500USB is not set
# CONFIG_RT73USB is not set
CONFIG_RT2800USB=m
CONFIG_RT2800USB_RT33XX=y
CONFIG_RT2800USB_RT35XX=y
# CONFIG_RT2800USB_RT3573 is not set
# CONFIG_RT2800USB_RT53XX is not set
# CONFIG_RT2800USB_RT55XX is not set
# CONFIG_RT2800USB_UNKNOWN is not set
CONFIG_RT2800_LIB=m
CONFIG_RT2X00_LIB_USB=m
CONFIG_RT2X00_LIB=m
CONFIG_RT2X00_LIB_FIRMWARE=y
CONFIG_RT2X00_LIB_CRYPTO=y
CONFIG_RT2X00_LIB_LEDS=y
# CONFIG_RT2X00_DEBUG is not set
CONFIG_WLAN_VENDOR_REALTEK=y
# CONFIG_RTL8180 is not set
# CONFIG_RTL8187 is not set
CONFIG_RTL_CARDS=m
# CONFIG_RTL8192CE is not set
# CONFIG_RTL8192SE is not set
# CONFIG_RTL8192DE is not set
# CONFIG_RTL8723AE is not set
# CONFIG_RTL8723BE is not set
# CONFIG_RTL8188EE is not set
# CONFIG_RTL8192EE is not set
# CONFIG_RTL8821AE is not set
# CONFIG_RTL8192CU is not set
# CONFIG_RTL8XXXU is not set
# CONFIG_RTW88 is not set
# CONFIG_RTW89 is not set
CONFIG_WLAN_VENDOR_RSI=y
# CONFIG_RSI_91X is not set
CONFIG_WLAN_VENDOR_SILABS=y
# CONFIG_WFX is not set
CONFIG_WLAN_VENDOR_ST=y
# CONFIG_CW1200 is not set
CONFIG_WLAN_VENDOR_TI=y
# CONFIG_WL1251 is not set
# CONFIG_WL12XX is not set
# CONFIG_WL18XX is not set
# CONFIG_WLCORE is not set
CONFIG_WLAN_VENDOR_ZYDAS=y
# CONFIG_USB_ZD1201 is not set
# CONFIG_ZD1211RW is not set
CONFIG_WLAN_VENDOR_QUANTENNA=y
# CONFIG_QTNFMAC_PCIE is not set
# CONFIG_MAC80211_HWSIM is not set
# CONFIG_USB_NET_RNDIS_WLAN is not set
# CONFIG_VIRT_WIFI is not set
# CONFIG_WAN is not set

#
# Wireless WAN
#
# CONFIG_WWAN is not set
# end of Wireless WAN

# CONFIG_VMXNET3 is not set
# CONFIG_NETDEVSIM is not set
CONFIG_NET_FAILOVER=y
# CONFIG_ISDN is not set

#
# Input device support
#
CONFIG_INPUT=y
CONFIG_INPUT_LEDS=y
CONFIG_INPUT_FF_MEMLESS=m
# CONFIG_INPUT_SPARSEKMAP is not set
CONFIG_INPUT_MATRIXKMAP=y
CONFIG_INPUT_VIVALDIFMAP=y

#
# Userland interfaces
#
# CONFIG_INPUT_MOUSEDEV is not set
CONFIG_INPUT_JOYDEV=y
CONFIG_INPUT_EVDEV=y
# CONFIG_INPUT_EVBUG is not set

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_ADC is not set
# CONFIG_KEYBOARD_ADP5588 is not set
# CONFIG_KEYBOARD_ADP5589 is not set
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_QT1050 is not set
CONFIG_KEYBOARD_QT1070=m
# CONFIG_KEYBOARD_QT2160 is not set
# CONFIG_KEYBOARD_DLINK_DIR685 is not set
# CONFIG_KEYBOARD_LKKBD is not set
CONFIG_KEYBOARD_GPIO=y
# CONFIG_KEYBOARD_GPIO_POLLED is not set
# CONFIG_KEYBOARD_TCA6416 is not set
# CONFIG_KEYBOARD_TCA8418 is not set
# CONFIG_KEYBOARD_MATRIX is not set
# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_LM8333 is not set
# CONFIG_KEYBOARD_MAX7359 is not set
# CONFIG_KEYBOARD_MCS is not set
# CONFIG_KEYBOARD_MPR121 is not set
# CONFIG_KEYBOARD_SNVS_PWRKEY is not set
# CONFIG_KEYBOARD_IMX is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_NOMADIK is not set
CONFIG_KEYBOARD_TEGRA=y
# CONFIG_KEYBOARD_OPENCORES is not set
# CONFIG_KEYBOARD_PINEPHONE is not set
CONFIG_KEYBOARD_PXA27x=m
# CONFIG_KEYBOARD_PMIC8XXX is not set
CONFIG_KEYBOARD_SAMSUNG=m
# CONFIG_KEYBOARD_STOWAWAY is not set
CONFIG_KEYBOARD_ST_KEYSCAN=y
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_STMPE is not set
# CONFIG_KEYBOARD_SUN4I_LRADC is not set
# CONFIG_KEYBOARD_OMAP4 is not set
CONFIG_KEYBOARD_SPEAR=y
# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set
# CONFIG_KEYBOARD_TWL4030 is not set
# CONFIG_KEYBOARD_XTKBD is not set
CONFIG_KEYBOARD_CROS_EC=m
# CONFIG_KEYBOARD_CAP11XX is not set
CONFIG_KEYBOARD_BCM=y
# CONFIG_KEYBOARD_MT6779 is not set
# CONFIG_KEYBOARD_CYPRESS_SF is not set
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=y
CONFIG_MOUSE_PS2_ALPS=y
CONFIG_MOUSE_PS2_BYD=y
CONFIG_MOUSE_PS2_LOGIPS2PP=y
CONFIG_MOUSE_PS2_SYNAPTICS=y
CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y
CONFIG_MOUSE_PS2_CYPRESS=y
CONFIG_MOUSE_PS2_TRACKPOINT=y
CONFIG_MOUSE_PS2_ELANTECH=y
CONFIG_MOUSE_PS2_ELANTECH_SMBUS=y
# CONFIG_MOUSE_PS2_SENTELIC is not set
# CONFIG_MOUSE_PS2_TOUCHKIT is not set
CONFIG_MOUSE_PS2_FOCALTECH=y
CONFIG_MOUSE_PS2_SMBUS=y
# CONFIG_MOUSE_SERIAL is not set
# CONFIG_MOUSE_APPLETOUCH is not set
# CONFIG_MOUSE_BCM5974 is not set
CONFIG_MOUSE_CYAPA=m
CONFIG_MOUSE_ELAN_I2C=y
CONFIG_MOUSE_ELAN_I2C_I2C=y
# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set
# CONFIG_MOUSE_VSXXXAA is not set
# CONFIG_MOUSE_GPIO is not set
# CONFIG_MOUSE_SYNAPTICS_I2C is not set
# CONFIG_MOUSE_SYNAPTICS_USB is not set
# CONFIG_INPUT_JOYSTICK is not set
# CONFIG_INPUT_TABLET is not set
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_ADS7846 is not set
# CONFIG_TOUCHSCREEN_AD7877 is not set
# CONFIG_TOUCHSCREEN_AD7879 is not set
CONFIG_TOUCHSCREEN_ADC=m
# CONFIG_TOUCHSCREEN_AR1021_I2C is not set
CONFIG_TOUCHSCREEN_ATMEL_MXT=m
# CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 is not set
# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
# CONFIG_TOUCHSCREEN_BU21013 is not set
# CONFIG_TOUCHSCREEN_BU21029 is not set
# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set
# CONFIG_TOUCHSCREEN_CY8CTMA140 is not set
# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set
# CONFIG_TOUCHSCREEN_CYTTSP5 is not set
# CONFIG_TOUCHSCREEN_DYNAPRO is not set
# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
# CONFIG_TOUCHSCREEN_EETI is not set
# CONFIG_TOUCHSCREEN_EGALAX is not set
# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set
# CONFIG_TOUCHSCREEN_EXC3000 is not set
# CONFIG_TOUCHSCREEN_FUJITSU is not set
# CONFIG_TOUCHSCREEN_GOODIX is not set
# CONFIG_TOUCHSCREEN_HIDEEP is not set
# CONFIG_TOUCHSCREEN_HYCON_HY46XX is not set
# CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX is not set
# CONFIG_TOUCHSCREEN_ILI210X is not set
# CONFIG_TOUCHSCREEN_ILITEK is not set
# CONFIG_TOUCHSCREEN_IPROC is not set
# CONFIG_TOUCHSCREEN_S6SY761 is not set
# CONFIG_TOUCHSCREEN_GUNZE is not set
# CONFIG_TOUCHSCREEN_EKTF2127 is not set
CONFIG_TOUCHSCREEN_ELAN=m
# CONFIG_TOUCHSCREEN_ELO is not set
# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
# CONFIG_TOUCHSCREEN_WACOM_I2C is not set
# CONFIG_TOUCHSCREEN_MAX11801 is not set
# CONFIG_TOUCHSCREEN_MCS5000 is not set
CONFIG_TOUCHSCREEN_MMS114=m
# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set
# CONFIG_TOUCHSCREEN_MSG2638 is not set
# CONFIG_TOUCHSCREEN_MTOUCH is not set
# CONFIG_TOUCHSCREEN_IMAGIS is not set
# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set
# CONFIG_TOUCHSCREEN_INEXIO is not set
# CONFIG_TOUCHSCREEN_MK712 is not set
# CONFIG_TOUCHSCREEN_PENMOUNT is not set
# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set
# CONFIG_TOUCHSCREEN_RASPBERRYPI_FW is not set
# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
# CONFIG_TOUCHSCREEN_PIXCIR is not set
# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set
CONFIG_TOUCHSCREEN_WM97XX=m
CONFIG_TOUCHSCREEN_WM9705=y
CONFIG_TOUCHSCREEN_WM9712=y
CONFIG_TOUCHSCREEN_WM9713=y
# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
# CONFIG_TOUCHSCREEN_TS4800 is not set
# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
# CONFIG_TOUCHSCREEN_TSC2004 is not set
# CONFIG_TOUCHSCREEN_TSC2005 is not set
# CONFIG_TOUCHSCREEN_TSC2007 is not set
# CONFIG_TOUCHSCREEN_RM_TS is not set
# CONFIG_TOUCHSCREEN_SILEAD is not set
# CONFIG_TOUCHSCREEN_SIS_I2C is not set
CONFIG_TOUCHSCREEN_ST1232=m
# CONFIG_TOUCHSCREEN_STMFTS is not set
CONFIG_TOUCHSCREEN_STMPE=y
CONFIG_TOUCHSCREEN_SUN4I=y
# CONFIG_TOUCHSCREEN_SUR40 is not set
# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set
# CONFIG_TOUCHSCREEN_SX8654 is not set
# CONFIG_TOUCHSCREEN_TPS6507X is not set
# CONFIG_TOUCHSCREEN_ZET6223 is not set
# CONFIG_TOUCHSCREEN_ZFORCE is not set
# CONFIG_TOUCHSCREEN_COLIBRI_VF50 is not set
# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set
# CONFIG_TOUCHSCREEN_IQS5XX is not set
# CONFIG_TOUCHSCREEN_ZINITIX is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_AB8500_PONKEY is not set
# CONFIG_INPUT_AD714X is not set
# CONFIG_INPUT_ARIEL_PWRBUTTON is not set
# CONFIG_INPUT_ATMEL_CAPTOUCH is not set
# CONFIG_INPUT_BMA150 is not set
# CONFIG_INPUT_E3X0_BUTTON is not set
CONFIG_INPUT_PM8941_PWRKEY=y
# CONFIG_INPUT_PM8XXX_VIBRATOR is not set
# CONFIG_INPUT_PMIC8XXX_PWRKEY is not set
CONFIG_INPUT_MAX77693_HAPTIC=m
CONFIG_INPUT_MAX8997_HAPTIC=m
# CONFIG_INPUT_MMA8450 is not set
# CONFIG_INPUT_GPIO_BEEPER is not set
# CONFIG_INPUT_GPIO_DECODER is not set
# CONFIG_INPUT_GPIO_VIBRA is not set
CONFIG_INPUT_CPCAP_PWRBUTTON=m
# CONFIG_INPUT_ATI_REMOTE2 is not set
# CONFIG_INPUT_KEYSPAN_REMOTE is not set
# CONFIG_INPUT_KXTJ9 is not set
# CONFIG_INPUT_POWERMATE is not set
# CONFIG_INPUT_YEALINK is not set
# CONFIG_INPUT_CM109 is not set
# CONFIG_INPUT_REGULATOR_HAPTIC is not set
# CONFIG_INPUT_TPS65218_PWRBUTTON is not set
CONFIG_INPUT_AXP20X_PEK=m
# CONFIG_INPUT_TWL4030_PWRBUTTON is not set
# CONFIG_INPUT_TWL4030_VIBRA is not set
# CONFIG_INPUT_UINPUT is not set
# CONFIG_INPUT_PALMAS_PWRBUTTON is not set
# CONFIG_INPUT_PCF8574 is not set
# CONFIG_INPUT_PWM_BEEPER is not set
# CONFIG_INPUT_PWM_VIBRA is not set
# CONFIG_INPUT_RK805_PWRKEY is not set
# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
# CONFIG_INPUT_DA7280_HAPTICS is not set
CONFIG_INPUT_DA9063_ONKEY=m
CONFIG_INPUT_ADXL34X=m
CONFIG_INPUT_ADXL34X_I2C=m
CONFIG_INPUT_ADXL34X_SPI=m
# CONFIG_INPUT_IBM_PANEL is not set
# CONFIG_INPUT_IMS_PCU is not set
# CONFIG_INPUT_IQS269A is not set
# CONFIG_INPUT_IQS626A is not set
# CONFIG_INPUT_IQS7222 is not set
# CONFIG_INPUT_CMA3000 is not set
# CONFIG_INPUT_DRV260X_HAPTICS is not set
# CONFIG_INPUT_DRV2665_HAPTICS is not set
# CONFIG_INPUT_DRV2667_HAPTICS is not set
# CONFIG_INPUT_HISI_POWERKEY is not set
CONFIG_INPUT_STPMIC1_ONKEY=y
# CONFIG_RMI4_CORE is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO_AMBAKMI=y
# CONFIG_SERIO_PCIPS2 is not set
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
# CONFIG_SERIO_ALTERA_PS2 is not set
# CONFIG_SERIO_PS2MULT is not set
# CONFIG_SERIO_ARC_PS2 is not set
# CONFIG_SERIO_APBPS2 is not set
# CONFIG_SERIO_OLPC_APSP is not set
# CONFIG_SERIO_SUN4I_PS2 is not set
# CONFIG_SERIO_GPIO_PS2 is not set
# CONFIG_USERIO is not set
# CONFIG_GAMEPORT is not set
# end of Hardware I/O ports
# end of Input device support

#
# Character devices
#
CONFIG_TTY=y
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_VT_CONSOLE_SLEEP=y
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_LDISC_AUTOLOAD=y

#
# Serial drivers
#
CONFIG_SERIAL_EARLYCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y
CONFIG_SERIAL_8250_16550A_VARIANTS=y
# CONFIG_SERIAL_8250_FINTEK is not set
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_DMA=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_EXAR=y
CONFIG_SERIAL_8250_NR_UARTS=5
CONFIG_SERIAL_8250_RUNTIME_UARTS=5
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_ASPEED_VUART=m
CONFIG_SERIAL_8250_SHARE_IRQ=y
# CONFIG_SERIAL_8250_DETECT_IRQ is not set
# CONFIG_SERIAL_8250_RSA is not set
CONFIG_SERIAL_8250_DWLIB=y
CONFIG_SERIAL_8250_BCM2835AUX=y
CONFIG_SERIAL_8250_FSL=y
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_8250_EM=y
# CONFIG_SERIAL_8250_RT288X is not set
CONFIG_SERIAL_8250_OMAP=y
CONFIG_SERIAL_8250_OMAP_TTYO_FIXUP=y
CONFIG_SERIAL_8250_MT6577=y
CONFIG_SERIAL_8250_UNIPHIER=y
CONFIG_SERIAL_8250_PERICOM=y
# CONFIG_SERIAL_8250_PXA is not set
CONFIG_SERIAL_8250_TEGRA=y
CONFIG_SERIAL_8250_BCM7271=y
CONFIG_SERIAL_OF_PLATFORM=y

#
# Non-8250 serial port support
#
# CONFIG_SERIAL_AMBA_PL010 is not set
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set
CONFIG_SERIAL_ATMEL=y
CONFIG_SERIAL_ATMEL_CONSOLE=y
CONFIG_SERIAL_ATMEL_PDC=y
CONFIG_SERIAL_ATMEL_TTYAT=y
CONFIG_SERIAL_MESON=y
CONFIG_SERIAL_MESON_CONSOLE=y
CONFIG_SERIAL_SAMSUNG=y
CONFIG_SERIAL_SAMSUNG_UARTS_4=y
CONFIG_SERIAL_SAMSUNG_UARTS=4
CONFIG_SERIAL_SAMSUNG_CONSOLE=y
CONFIG_SERIAL_TEGRA=y
# CONFIG_SERIAL_MAX3100 is not set
# CONFIG_SERIAL_MAX310X is not set
# CONFIG_SERIAL_PXA is not set
CONFIG_SERIAL_IMX=y
CONFIG_SERIAL_IMX_CONSOLE=y
CONFIG_SERIAL_IMX_EARLYCON=y
# CONFIG_SERIAL_UARTLITE is not set
CONFIG_SERIAL_SH_SCI=y
CONFIG_SERIAL_SH_SCI_NR_UARTS=20
CONFIG_SERIAL_SH_SCI_CONSOLE=y
CONFIG_SERIAL_SH_SCI_EARLYCON=y
CONFIG_SERIAL_SH_SCI_DMA=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
CONFIG_SERIAL_MSM=y
CONFIG_SERIAL_MSM_CONSOLE=y
CONFIG_SERIAL_VT8500=y
CONFIG_SERIAL_VT8500_CONSOLE=y
# CONFIG_SERIAL_SIFIVE is not set
# CONFIG_SERIAL_SCCNXP is not set
# CONFIG_SERIAL_SC16IS7XX is not set
CONFIG_SERIAL_BCM63XX=y
CONFIG_SERIAL_BCM63XX_CONSOLE=y
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
CONFIG_SERIAL_XILINX_PS_UART=y
CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
# CONFIG_SERIAL_ARC is not set
# CONFIG_SERIAL_RP2 is not set
CONFIG_SERIAL_FSL_LPUART=y
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
# CONFIG_SERIAL_FSL_LINFLEXUART is not set
CONFIG_SERIAL_CONEXANT_DIGICOLOR=y
CONFIG_SERIAL_CONEXANT_DIGICOLOR_CONSOLE=y
CONFIG_SERIAL_ST_ASC=y
CONFIG_SERIAL_ST_ASC_CONSOLE=y
# CONFIG_SERIAL_SPRD is not set
CONFIG_SERIAL_STM32=y
CONFIG_SERIAL_STM32_CONSOLE=y
# CONFIG_SERIAL_MVEBU_UART is not set
CONFIG_SERIAL_OWL=y
CONFIG_SERIAL_OWL_CONSOLE=y
CONFIG_SERIAL_MILBEAUT_USIO=y
CONFIG_SERIAL_MILBEAUT_USIO_PORTS=4
CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE=y
CONFIG_SERIAL_SUNPLUS=y
CONFIG_SERIAL_SUNPLUS_CONSOLE=y
# end of Serial drivers

CONFIG_SERIAL_MCTRL_GPIO=y
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_N_GSM is not set
# CONFIG_NOZOMI is not set
# CONFIG_NULL_TTY is not set
CONFIG_HVC_DRIVER=y
# CONFIG_HVC_DCC is not set
# CONFIG_RPMSG_TTY is not set
CONFIG_SERIAL_DEV_BUS=y
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
# CONFIG_TTY_PRINTK is not set
CONFIG_VIRTIO_CONSOLE=y
# CONFIG_IPMI_HANDLER is not set
CONFIG_IPMI_KCS_BMC=m
CONFIG_ASPEED_KCS_IPMI_BMC=m
# CONFIG_IPMI_KCS_BMC_CDEV_IPMI is not set
# CONFIG_IPMI_KCS_BMC_SERIO is not set
CONFIG_ASPEED_BT_IPMI_BMC=m
# CONFIG_SSIF_IPMI_BMC is not set
# CONFIG_IPMB_DEVICE_INTERFACE is not set
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
CONFIG_HW_RANDOM_ATMEL=y
# CONFIG_HW_RANDOM_BA431 is not set
CONFIG_HW_RANDOM_BCM2835=y
CONFIG_HW_RANDOM_IPROC_RNG200=y
CONFIG_HW_RANDOM_OMAP=y
CONFIG_HW_RANDOM_OMAP3_ROM=y
# CONFIG_HW_RANDOM_VIRTIO is not set
CONFIG_HW_RANDOM_IMX_RNGC=y
CONFIG_HW_RANDOM_HISI=y
CONFIG_HW_RANDOM_ST=y
CONFIG_HW_RANDOM_STM32=y
CONFIG_HW_RANDOM_MESON=y
CONFIG_HW_RANDOM_MTK=y
CONFIG_HW_RANDOM_EXYNOS=y
CONFIG_HW_RANDOM_KEYSTONE=y
# CONFIG_HW_RANDOM_CCTRNG is not set
# CONFIG_HW_RANDOM_XIPHERA is not set
CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y
# CONFIG_APPLICOM is not set
CONFIG_DEVMEM=y
CONFIG_DEVPORT=y
CONFIG_TCG_TPM=m
CONFIG_HW_RANDOM_TPM=y
# CONFIG_TCG_TIS is not set
# CONFIG_TCG_TIS_SPI is not set
# CONFIG_TCG_TIS_I2C is not set
# CONFIG_TCG_TIS_I2C_CR50 is not set
# CONFIG_TCG_TIS_I2C_ATMEL is not set
CONFIG_TCG_TIS_I2C_INFINEON=m
# CONFIG_TCG_TIS_I2C_NUVOTON is not set
# CONFIG_TCG_VTPM_PROXY is not set
# CONFIG_TCG_TIS_ST33ZP24_I2C is not set
# CONFIG_TCG_TIS_ST33ZP24_SPI is not set
# CONFIG_XILLYBUS is not set
# CONFIG_XILLYUSB is not set
# end of Character devices

#
# I2C support
#
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y

#
# Multiplexer I2C Chip support
#
CONFIG_I2C_ARB_GPIO_CHALLENGE=m
CONFIG_I2C_MUX_GPIO=y
# CONFIG_I2C_MUX_GPMUX is not set
# CONFIG_I2C_MUX_LTC4306 is not set
# CONFIG_I2C_MUX_PCA9541 is not set
CONFIG_I2C_MUX_PCA954x=y
CONFIG_I2C_MUX_PINCTRL=y
# CONFIG_I2C_MUX_REG is not set
CONFIG_I2C_DEMUX_PINCTRL=y
# CONFIG_I2C_MUX_MLXCPLD is not set
# end of Multiplexer I2C Chip support

CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_SMBUS=y
CONFIG_I2C_ALGOBIT=y

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
# CONFIG_I2C_ALI1535 is not set
# CONFIG_I2C_ALI1563 is not set
# CONFIG_I2C_ALI15X3 is not set
# CONFIG_I2C_AMD756 is not set
# CONFIG_I2C_AMD8111 is not set
# CONFIG_I2C_HIX5HD2 is not set
# CONFIG_I2C_I801 is not set
# CONFIG_I2C_ISCH is not set
# CONFIG_I2C_PIIX4 is not set
# CONFIG_I2C_NFORCE2 is not set
# CONFIG_I2C_NVIDIA_GPU is not set
# CONFIG_I2C_SIS5595 is not set
# CONFIG_I2C_SIS630 is not set
# CONFIG_I2C_SIS96X is not set
# CONFIG_I2C_VIA is not set
# CONFIG_I2C_VIAPRO is not set

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
# CONFIG_I2C_ALTERA is not set
CONFIG_I2C_ASPEED=m
CONFIG_I2C_AT91=m
# CONFIG_I2C_AT91_SLAVE_EXPERIMENTAL is not set
CONFIG_I2C_BCM2835=y
CONFIG_I2C_BCM_IPROC=y
CONFIG_I2C_BCM_KONA=y
CONFIG_I2C_BRCMSTB=y
CONFIG_I2C_CADENCE=y
# CONFIG_I2C_CBUS_GPIO is not set
CONFIG_I2C_DAVINCI=y
CONFIG_I2C_DESIGNWARE_CORE=y
# CONFIG_I2C_DESIGNWARE_SLAVE is not set
CONFIG_I2C_DESIGNWARE_PLATFORM=y
# CONFIG_I2C_DESIGNWARE_PCI is not set
CONFIG_I2C_DIGICOLOR=m
CONFIG_I2C_EMEV2=m
CONFIG_I2C_EXYNOS5=y
CONFIG_I2C_GPIO=m
# CONFIG_I2C_GPIO_FAULT_INJECTOR is not set
CONFIG_I2C_IMX=y
# CONFIG_I2C_IMX_LPI2C is not set
CONFIG_I2C_MESON=y
# CONFIG_I2C_MT65XX is not set
CONFIG_I2C_MV64XXX=y
CONFIG_I2C_NOMADIK=y
# CONFIG_I2C_OCORES is not set
CONFIG_I2C_OMAP=y
CONFIG_I2C_OWL=y
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_I2C_PXA is not set
CONFIG_I2C_QCOM_CCI=m
CONFIG_I2C_QUP=y
CONFIG_I2C_RIIC=y
CONFIG_I2C_RK3X=y
# CONFIG_I2C_RZV2M is not set
CONFIG_I2C_S3C2410=y
CONFIG_I2C_SH_MOBILE=y
# CONFIG_I2C_SIMTEC is not set
CONFIG_I2C_ST=y
# CONFIG_I2C_STM32F4 is not set
CONFIG_I2C_STM32F7=y
CONFIG_I2C_SUN6I_P2WI=y
CONFIG_I2C_TEGRA=y
CONFIG_I2C_UNIPHIER=y
CONFIG_I2C_UNIPHIER_F=y
# CONFIG_I2C_VERSATILE is not set
# CONFIG_I2C_WMT is not set
CONFIG_I2C_XILINX=y
CONFIG_I2C_RCAR=y

#
# External I2C/SMBus adapter drivers
#
# CONFIG_I2C_DIOLAN_U2C is not set
# CONFIG_I2C_CP2615 is not set
# CONFIG_I2C_PCI1XXXX is not set
# CONFIG_I2C_ROBOTFUZZ_OSIF is not set
# CONFIG_I2C_TAOS_EVM is not set
# CONFIG_I2C_TINY_USB is not set

#
# Other I2C/SMBus bus drivers
#
CONFIG_I2C_CROS_EC_TUNNEL=m
# CONFIG_I2C_FSI is not set
# CONFIG_I2C_VIRTIO is not set
# end of I2C Hardware Bus support

# CONFIG_I2C_STUB is not set
CONFIG_I2C_SLAVE=y
CONFIG_I2C_SLAVE_EEPROM=y
# CONFIG_I2C_SLAVE_TESTUNIT is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
# end of I2C support

# CONFIG_I3C is not set
CONFIG_SPI=y
# CONFIG_SPI_DEBUG is not set
CONFIG_SPI_MASTER=y
CONFIG_SPI_MEM=y

#
# SPI Master Controller Drivers
#
# CONFIG_SPI_ALTERA is not set
# CONFIG_SPI_ARMADA_3700 is not set
CONFIG_SPI_ASPEED_SMC=m
CONFIG_SPI_ATMEL=m
# CONFIG_SPI_AT91_USART is not set
CONFIG_SPI_ATMEL_QUADSPI=m
# CONFIG_SPI_AXI_SPI_ENGINE is not set
CONFIG_SPI_BCM2835=y
CONFIG_SPI_BCM2835AUX=y
# CONFIG_SPI_BCM63XX_HSSPI is not set
CONFIG_SPI_BCM_QSPI=y
CONFIG_SPI_BITBANG=y
CONFIG_SPI_CADENCE=y
# CONFIG_SPI_CADENCE_QUADSPI is not set
# CONFIG_SPI_CADENCE_XSPI is not set
CONFIG_SPI_DAVINCI=y
# CONFIG_SPI_DESIGNWARE is not set
# CONFIG_SPI_FSI is not set
# CONFIG_SPI_FSL_LPSPI is not set
CONFIG_SPI_FSL_QUADSPI=m
# CONFIG_SPI_GXP is not set
# CONFIG_SPI_NXP_FLEXSPI is not set
CONFIG_SPI_GPIO=m
# CONFIG_SPI_IMX is not set
# CONFIG_SPI_FSL_SPI is not set
CONFIG_SPI_FSL_DSPI=m
# CONFIG_SPI_MESON_SPICC is not set
# CONFIG_SPI_MESON_SPIFC is not set
# CONFIG_SPI_MICROCHIP_CORE is not set
# CONFIG_SPI_MICROCHIP_CORE_QSPI is not set
# CONFIG_SPI_MT65XX is not set
# CONFIG_SPI_MTK_NOR is not set
# CONFIG_SPI_OC_TINY is not set
CONFIG_SPI_OMAP24XX=y
# CONFIG_SPI_TI_QSPI is not set
CONFIG_SPI_ORION=y
# CONFIG_SPI_PCI1XXXX is not set
CONFIG_SPI_PL022=y
# CONFIG_SPI_PXA2XX is not set
CONFIG_SPI_ROCKCHIP=m
# CONFIG_SPI_ROCKCHIP_SFC is not set
CONFIG_SPI_RSPI=y
# CONFIG_SPI_QCOM_QSPI is not set
CONFIG_SPI_QUP=m
CONFIG_SPI_S3C64XX=m
# CONFIG_SPI_SC18IS602 is not set
CONFIG_SPI_SH_MSIOF=m
CONFIG_SPI_SH_HSPI=y
# CONFIG_SPI_SIFIVE is not set
CONFIG_SPI_STM32=m
CONFIG_SPI_STM32_QSPI=y
# CONFIG_SPI_ST_SSC4 is not set
CONFIG_SPI_SUN4I=y
CONFIG_SPI_SUN6I=y
# CONFIG_SPI_SUNPLUS_SP7021 is not set
# CONFIG_SPI_MXIC is not set
# CONFIG_SPI_TEGRA210_QUAD is not set
CONFIG_SPI_TEGRA114=y
CONFIG_SPI_TEGRA20_SFLASH=y
CONFIG_SPI_TEGRA20_SLINK=y
# CONFIG_SPI_UNIPHIER is not set
# CONFIG_SPI_XCOMM is not set
CONFIG_SPI_XILINX=y
# CONFIG_SPI_ZYNQ_QSPI is not set
# CONFIG_SPI_ZYNQMP_GQSPI is not set
# CONFIG_SPI_AMD is not set

#
# SPI Multiplexer support
#
# CONFIG_SPI_MUX is not set

#
# SPI Protocol Masters
#
CONFIG_SPI_SPIDEV=y
# CONFIG_SPI_LOOPBACK_TEST is not set
# CONFIG_SPI_TLE62X0 is not set
# CONFIG_SPI_SLAVE is not set
CONFIG_SPI_DYNAMIC=y
CONFIG_SPMI=y
# CONFIG_SPMI_HISI3670 is not set
CONFIG_SPMI_MSM_PMIC_ARB=y
# CONFIG_SPMI_MTK_PMIF is not set
# CONFIG_HSI is not set
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set

#
# PPS clients support
#
# CONFIG_PPS_CLIENT_KTIMER is not set
# CONFIG_PPS_CLIENT_LDISC is not set
# CONFIG_PPS_CLIENT_GPIO is not set

#
# PPS generators support
#

#
# PTP clock support
#
CONFIG_PTP_1588_CLOCK=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_PTP_1588_CLOCK_DTE=y
CONFIG_PTP_1588_CLOCK_QORIQ=y

#
# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks.
#
CONFIG_PTP_1588_CLOCK_KVM=y
# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set
# CONFIG_PTP_1588_CLOCK_IDTCM is not set
# CONFIG_PTP_1588_CLOCK_OCP is not set
# end of PTP clock support

CONFIG_PINCTRL=y
CONFIG_GENERIC_PINCTRL_GROUPS=y
CONFIG_PINMUX=y
CONFIG_GENERIC_PINMUX_FUNCTIONS=y
CONFIG_PINCONF=y
CONFIG_GENERIC_PINCONF=y
# CONFIG_DEBUG_PINCTRL is not set
# CONFIG_PINCTRL_ARTPEC6 is not set
CONFIG_PINCTRL_AS3722=y
CONFIG_PINCTRL_AT91=y
CONFIG_PINCTRL_AT91PIO4=y
# CONFIG_PINCTRL_AXP209 is not set
# CONFIG_PINCTRL_CY8C95X0 is not set
CONFIG_PINCTRL_DIGICOLOR=y
# CONFIG_PINCTRL_MCP23S08 is not set
CONFIG_PINCTRL_MICROCHIP_SGPIO=y
CONFIG_PINCTRL_OCELOT=y
CONFIG_PINCTRL_PALMAS=y
# CONFIG_PINCTRL_RK805 is not set
CONFIG_PINCTRL_ROCKCHIP=y
CONFIG_PINCTRL_SINGLE=y
CONFIG_PINCTRL_ST=y
CONFIG_PINCTRL_STMFX=y
# CONFIG_PINCTRL_SX150X is not set
CONFIG_PINCTRL_ZYNQ=y
CONFIG_PINCTRL_OWL=y
CONFIG_PINCTRL_S500=y
CONFIG_PINCTRL_ASPEED=y
CONFIG_PINCTRL_ASPEED_G6=y
CONFIG_PINCTRL_BCM281XX=y
CONFIG_PINCTRL_BCM2835=y
CONFIG_PINCTRL_BCM4908=y
CONFIG_PINCTRL_IPROC_GPIO=y
CONFIG_PINCTRL_CYGNUS_MUX=y
CONFIG_PINCTRL_NS=y
CONFIG_PINCTRL_NSP_GPIO=y
# CONFIG_PINCTRL_NS2_MUX is not set
CONFIG_PINCTRL_NSP_MUX=y
CONFIG_PINCTRL_BERLIN=y
# CONFIG_PINCTRL_AS370 is not set
CONFIG_PINCTRL_BERLIN_BG2=y
CONFIG_PINCTRL_BERLIN_BG2CD=y
CONFIG_PINCTRL_BERLIN_BG2Q=y
# CONFIG_PINCTRL_BERLIN_BG4CT is not set
CONFIG_PINCTRL_IMX=y
CONFIG_PINCTRL_IMX50=y
CONFIG_PINCTRL_IMX51=y
CONFIG_PINCTRL_IMX53=y
CONFIG_PINCTRL_IMX6Q=y
CONFIG_PINCTRL_IMX6SL=y
CONFIG_PINCTRL_IMX6SLL=y
CONFIG_PINCTRL_IMX6SX=y
CONFIG_PINCTRL_IMX6UL=y
CONFIG_PINCTRL_IMX7D=y
CONFIG_PINCTRL_IMX7ULP=y
# CONFIG_PINCTRL_IMX8ULP is not set
# CONFIG_PINCTRL_IMXRT1050 is not set
# CONFIG_PINCTRL_IMX93 is not set
CONFIG_PINCTRL_VF610=y
# CONFIG_PINCTRL_IMXRT1170 is not set

#
# MediaTek pinctrl drivers
#
CONFIG_EINT_MTK=y
CONFIG_PINCTRL_MTK=y
CONFIG_PINCTRL_MTK_V2=y
CONFIG_PINCTRL_MTK_MOORE=y
CONFIG_PINCTRL_MT2701=y
CONFIG_PINCTRL_MT7623=y
CONFIG_PINCTRL_MT7629=y
CONFIG_PINCTRL_MT8135=y
CONFIG_PINCTRL_MT8127=y
# end of MediaTek pinctrl drivers

CONFIG_PINCTRL_MESON=y
CONFIG_PINCTRL_MESON8=y
CONFIG_PINCTRL_MESON8B=y
CONFIG_PINCTRL_MESON8_PMX=y
CONFIG_PINCTRL_MVEBU=y
CONFIG_PINCTRL_DOVE=y
CONFIG_PINCTRL_ARMADA_370=y
CONFIG_PINCTRL_ARMADA_375=y
CONFIG_PINCTRL_ARMADA_38X=y
CONFIG_PINCTRL_ARMADA_39X=y
CONFIG_PINCTRL_ARMADA_XP=y
CONFIG_PINCTRL_ABX500=y
CONFIG_PINCTRL_AB8500=y
CONFIG_PINCTRL_AB8505=y
CONFIG_PINCTRL_NOMADIK=y
CONFIG_PINCTRL_DB8500=y
CONFIG_PINCTRL_MSM=y
CONFIG_PINCTRL_APQ8064=y
CONFIG_PINCTRL_APQ8084=y
# CONFIG_PINCTRL_IPQ4019 is not set
CONFIG_PINCTRL_IPQ8064=y
# CONFIG_PINCTRL_MSM8226 is not set
CONFIG_PINCTRL_MSM8660=y
CONFIG_PINCTRL_MSM8960=y
# CONFIG_PINCTRL_MDM9607 is not set
# CONFIG_PINCTRL_MDM9615 is not set
CONFIG_PINCTRL_MSM8X74=y
# CONFIG_PINCTRL_MSM8909 is not set
CONFIG_PINCTRL_MSM8916=y
CONFIG_PINCTRL_QCOM_SPMI_PMIC=y
CONFIG_PINCTRL_QCOM_SSBI_PMIC=y
# CONFIG_PINCTRL_SDX55 is not set
# CONFIG_PINCTRL_SDX65 is not set
# CONFIG_PINCTRL_LPASS_LPI is not set

#
# Renesas pinctrl drivers
#
CONFIG_PINCTRL_RENESAS=y
CONFIG_PINCTRL_SH_PFC=y
CONFIG_PINCTRL_SH_PFC_GPIO=y
CONFIG_PINCTRL_PFC_EMEV2=y
CONFIG_PINCTRL_PFC_R8A7794=y
CONFIG_PINCTRL_PFC_R8A7779=y
CONFIG_PINCTRL_PFC_R8A7790=y
CONFIG_PINCTRL_PFC_R8A7778=y
CONFIG_PINCTRL_PFC_R8A7793=y
CONFIG_PINCTRL_PFC_R8A7791=y
CONFIG_PINCTRL_PFC_R8A7792=y
CONFIG_PINCTRL_PFC_R8A7740=y
CONFIG_PINCTRL_PFC_R8A73A4=y
# CONFIG_PINCTRL_RZA1 is not set
CONFIG_PINCTRL_RZA2=y
CONFIG_PINCTRL_PFC_R8A77470=y
CONFIG_PINCTRL_PFC_R8A7745=y
CONFIG_PINCTRL_PFC_R8A7742=y
CONFIG_PINCTRL_PFC_R8A7743=y
CONFIG_PINCTRL_PFC_R8A7744=y
# CONFIG_PINCTRL_RZN1 is not set
CONFIG_PINCTRL_PFC_SH73A0=y
# end of Renesas pinctrl drivers

CONFIG_PINCTRL_SAMSUNG=y
CONFIG_PINCTRL_EXYNOS=y
CONFIG_PINCTRL_EXYNOS_ARM=y
CONFIG_PINCTRL_SPEAR=y
CONFIG_PINCTRL_SPEAR1310=y
CONFIG_PINCTRL_SPEAR1340=y
CONFIG_PINCTRL_SPEAR_PLGPIO=y
CONFIG_PINCTRL_STM32=y
CONFIG_PINCTRL_STM32MP135=y
CONFIG_PINCTRL_STM32MP157=y
CONFIG_PINCTRL_SPPCTL=y
CONFIG_PINCTRL_SUNXI=y
CONFIG_PINCTRL_SUN4I_A10=y
CONFIG_PINCTRL_SUN5I=y
CONFIG_PINCTRL_SUN6I_A31=y
CONFIG_PINCTRL_SUN6I_A31_R=y
CONFIG_PINCTRL_SUN8I_A23=y
CONFIG_PINCTRL_SUN8I_A33=y
CONFIG_PINCTRL_SUN8I_A83T=y
CONFIG_PINCTRL_SUN8I_A83T_R=y
CONFIG_PINCTRL_SUN8I_A23_R=y
CONFIG_PINCTRL_SUN8I_H3=y
CONFIG_PINCTRL_SUN8I_H3_R=y
CONFIG_PINCTRL_SUN8I_V3S=y
CONFIG_PINCTRL_SUN9I_A80=y
CONFIG_PINCTRL_SUN9I_A80_R=y
CONFIG_PINCTRL_SUN20I_D1=y
# CONFIG_PINCTRL_SUN50I_A64 is not set
# CONFIG_PINCTRL_SUN50I_A64_R is not set
# CONFIG_PINCTRL_SUN50I_A100 is not set
# CONFIG_PINCTRL_SUN50I_A100_R is not set
# CONFIG_PINCTRL_SUN50I_H5 is not set
# CONFIG_PINCTRL_SUN50I_H6 is not set
# CONFIG_PINCTRL_SUN50I_H6_R is not set
# CONFIG_PINCTRL_SUN50I_H616 is not set
# CONFIG_PINCTRL_SUN50I_H616_R is not set
CONFIG_PINCTRL_TEGRA=y
CONFIG_PINCTRL_TEGRA20=y
CONFIG_PINCTRL_TEGRA30=y
CONFIG_PINCTRL_TEGRA114=y
CONFIG_PINCTRL_TEGRA124=y
CONFIG_PINCTRL_TEGRA_XUSB=y
CONFIG_PINCTRL_TI_IODELAY=y
CONFIG_PINCTRL_UNIPHIER=y
CONFIG_PINCTRL_UNIPHIER_LD4=y
CONFIG_PINCTRL_UNIPHIER_PRO4=y
CONFIG_PINCTRL_UNIPHIER_SLD8=y
CONFIG_PINCTRL_UNIPHIER_PRO5=y
CONFIG_PINCTRL_UNIPHIER_PXS2=y
CONFIG_PINCTRL_UNIPHIER_LD6B=y
# CONFIG_PINCTRL_UNIPHIER_LD11 is not set
# CONFIG_PINCTRL_UNIPHIER_LD20 is not set
# CONFIG_PINCTRL_UNIPHIER_PXS3 is not set
# CONFIG_PINCTRL_UNIPHIER_NX1 is not set
# CONFIG_PINCTRL_WM8850 is not set
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_FASTPATH_LIMIT=512
CONFIG_OF_GPIO=y
CONFIG_GPIOLIB_IRQCHIP=y
# CONFIG_DEBUG_GPIO is not set
# CONFIG_GPIO_SYSFS is not set
CONFIG_GPIO_CDEV=y
CONFIG_GPIO_CDEV_V1=y
CONFIG_GPIO_GENERIC=y

#
# Memory mapped GPIO drivers
#
# CONFIG_GPIO_74XX_MMIO is not set
# CONFIG_GPIO_ALTERA is not set
# CONFIG_GPIO_ASPEED is not set
CONFIG_GPIO_ASPEED_SGPIO=y
CONFIG_GPIO_RASPBERRYPI_EXP=y
CONFIG_GPIO_BCM_KONA=y
CONFIG_GPIO_BCM_XGS_IPROC=y
CONFIG_GPIO_BRCMSTB=y
# CONFIG_GPIO_CADENCE is not set
CONFIG_GPIO_DAVINCI=y
CONFIG_GPIO_DWAPB=y
CONFIG_GPIO_EM=y
CONFIG_GPIO_EN7523=y
# CONFIG_GPIO_EXAR is not set
# CONFIG_GPIO_FTGPIO010 is not set
CONFIG_GPIO_GENERIC_PLATFORM=y
# CONFIG_GPIO_GRGPIO is not set
# CONFIG_GPIO_HLWD is not set
# CONFIG_GPIO_LOGICVC is not set
# CONFIG_GPIO_MB86S7X is not set
# CONFIG_GPIO_MPC8XXX is not set
CONFIG_GPIO_MVEBU=y
CONFIG_GPIO_MXC=y
CONFIG_GPIO_OMAP=y
CONFIG_GPIO_PL061=y
CONFIG_GPIO_PXA=y
CONFIG_GPIO_RCAR=y
CONFIG_GPIO_ROCKCHIP=y
# CONFIG_GPIO_SAMA5D2_PIOBU is not set
# CONFIG_GPIO_SIFIVE is not set
CONFIG_GPIO_SPEAR_SPICS=y
CONFIG_GPIO_SYSCON=y
CONFIG_GPIO_TEGRA=y
# CONFIG_GPIO_TS4800 is not set
CONFIG_GPIO_UNIPHIER=y
CONFIG_GPIO_VF610=y
CONFIG_GPIO_XILINX=y
# CONFIG_GPIO_ZEVIO is not set
CONFIG_GPIO_ZYNQ=y
# CONFIG_GPIO_AMD_FCH is not set
# end of Memory mapped GPIO drivers

#
# I2C GPIO expanders
#
# CONFIG_GPIO_ADNP is not set
# CONFIG_GPIO_GW_PLD is not set
# CONFIG_GPIO_MAX7300 is not set
# CONFIG_GPIO_MAX732X is not set
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
# CONFIG_GPIO_PCA9570 is not set
CONFIG_GPIO_PCF857X=y
# CONFIG_GPIO_TPIC2810 is not set
# CONFIG_GPIO_TS4900 is not set
# end of I2C GPIO expanders

#
# MFD GPIO expanders
#
# CONFIG_HTC_EGPIO is not set
CONFIG_GPIO_PALMAS=y
# CONFIG_GPIO_STMPE is not set
# CONFIG_GPIO_TPS65218 is not set
CONFIG_GPIO_TPS6586X=y
CONFIG_GPIO_TPS65910=y
CONFIG_GPIO_TWL4030=y
# CONFIG_GPIO_WM8994 is not set
# end of MFD GPIO expanders

#
# PCI GPIO expanders
#
# CONFIG_GPIO_BT8XX is not set
# CONFIG_GPIO_PCI_IDIO_16 is not set
# CONFIG_GPIO_PCIE_IDIO_24 is not set
# CONFIG_GPIO_RDC321X is not set
# end of PCI GPIO expanders

#
# SPI GPIO expanders
#
# CONFIG_GPIO_74X164 is not set
# CONFIG_GPIO_MAX3191X is not set
# CONFIG_GPIO_MAX7301 is not set
# CONFIG_GPIO_MC33880 is not set
# CONFIG_GPIO_PISOSR is not set
# CONFIG_GPIO_XRA1403 is not set
# end of SPI GPIO expanders

#
# USB GPIO expanders
#
# end of USB GPIO expanders

#
# Virtual GPIO drivers
#
# CONFIG_GPIO_AGGREGATOR is not set
# CONFIG_GPIO_LATCH is not set
# CONFIG_GPIO_MOCKUP is not set
# CONFIG_GPIO_VIRTIO is not set
# CONFIG_GPIO_SIM is not set
# end of Virtual GPIO drivers

# CONFIG_W1 is not set
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_AS3722=y
CONFIG_POWER_RESET_AT91_POWEROFF=y
CONFIG_POWER_RESET_AT91_RESET=y
CONFIG_POWER_RESET_AT91_SAMA5D2_SHDWC=y
CONFIG_POWER_RESET_BRCMKONA=y
CONFIG_POWER_RESET_BRCMSTB=y
CONFIG_POWER_RESET_GPIO=y
CONFIG_POWER_RESET_GPIO_RESTART=y
CONFIG_POWER_RESET_HISI=y
# CONFIG_POWER_RESET_LINKSTATION is not set
CONFIG_POWER_RESET_MSM=y
CONFIG_POWER_RESET_QCOM_PON=y
# CONFIG_POWER_RESET_LTC2952 is not set
# CONFIG_POWER_RESET_QNAP is not set
# CONFIG_POWER_RESET_REGULATOR is not set
# CONFIG_POWER_RESET_RESTART is not set
CONFIG_POWER_RESET_ST=y
# CONFIG_POWER_RESET_VERSATILE is not set
CONFIG_POWER_RESET_VEXPRESS=y
CONFIG_POWER_RESET_KEYSTONE=y
CONFIG_POWER_RESET_SYSCON=y
CONFIG_POWER_RESET_SYSCON_POWEROFF=y
CONFIG_POWER_RESET_RMOBILE=y
CONFIG_REBOOT_MODE=y
# CONFIG_SYSCON_REBOOT_MODE is not set
# CONFIG_NVMEM_REBOOT_MODE is not set
CONFIG_POWER_SUPPLY=y
# CONFIG_POWER_SUPPLY_DEBUG is not set
CONFIG_POWER_SUPPLY_HWMON=y
# CONFIG_PDA_POWER is not set
# CONFIG_GENERIC_ADC_BATTERY is not set
# CONFIG_IP5XXX_POWER is not set
# CONFIG_TEST_POWER is not set
# CONFIG_CHARGER_ADP5061 is not set
CONFIG_BATTERY_ACT8945A=y
CONFIG_BATTERY_CPCAP=m
# CONFIG_BATTERY_CW2015 is not set
# CONFIG_BATTERY_DS2780 is not set
# CONFIG_BATTERY_DS2781 is not set
# CONFIG_BATTERY_DS2782 is not set
# CONFIG_BATTERY_SAMSUNG_SDI is not set
CONFIG_BATTERY_SBS=y
# CONFIG_CHARGER_SBS is not set
# CONFIG_MANAGER_SBS is not set
CONFIG_BATTERY_BQ27XXX=m
CONFIG_BATTERY_BQ27XXX_I2C=m
# CONFIG_BATTERY_BQ27XXX_DT_UPDATES_NVM is not set
CONFIG_AXP20X_POWER=m
CONFIG_BATTERY_MAX17040=m
CONFIG_BATTERY_MAX17042=m
CONFIG_CHARGER_CPCAP=m
# CONFIG_CHARGER_ISP1704 is not set
# CONFIG_CHARGER_MAX8903 is not set
# CONFIG_CHARGER_TWL4030 is not set
# CONFIG_CHARGER_LP8727 is not set
CONFIG_CHARGER_GPIO=m
# CONFIG_CHARGER_MANAGER is not set
# CONFIG_CHARGER_LT3651 is not set
# CONFIG_CHARGER_LTC4162L is not set
CONFIG_CHARGER_MAX14577=m
# CONFIG_CHARGER_DETECTOR_MAX14656 is not set
CONFIG_CHARGER_MAX77693=m
# CONFIG_CHARGER_MAX77976 is not set
CONFIG_CHARGER_MAX8997=m
CONFIG_CHARGER_MAX8998=m
# CONFIG_CHARGER_QCOM_SMBB is not set
# CONFIG_CHARGER_BQ2415X is not set
# CONFIG_CHARGER_BQ24190 is not set
# CONFIG_CHARGER_BQ24257 is not set
# CONFIG_CHARGER_BQ24735 is not set
# CONFIG_CHARGER_BQ2515X is not set
# CONFIG_CHARGER_BQ25890 is not set
# CONFIG_CHARGER_BQ25980 is not set
# CONFIG_CHARGER_BQ256XX is not set
# CONFIG_CHARGER_RK817 is not set
CONFIG_CHARGER_SMB347=m
CONFIG_CHARGER_TPS65090=y
# CONFIG_CHARGER_TPS65217 is not set
# CONFIG_BATTERY_GAUGE_LTC2941 is not set
# CONFIG_AB8500_BM is not set
# CONFIG_BATTERY_GOLDFISH is not set
# CONFIG_BATTERY_RT5033 is not set
# CONFIG_CHARGER_RT9455 is not set
# CONFIG_CHARGER_CROS_USBPD is not set
CONFIG_CHARGER_CROS_PCHG=m
# CONFIG_CHARGER_UCS1002 is not set
# CONFIG_CHARGER_BD99954 is not set
CONFIG_BATTERY_ACER_A500=m
# CONFIG_BATTERY_UG3105 is not set
CONFIG_HWMON=y
# CONFIG_HWMON_DEBUG_CHIP is not set

#
# Native drivers
#
# CONFIG_SENSORS_AD7314 is not set
# CONFIG_SENSORS_AD7414 is not set
# CONFIG_SENSORS_AD7418 is not set
# CONFIG_SENSORS_ADM1025 is not set
# CONFIG_SENSORS_ADM1026 is not set
# CONFIG_SENSORS_ADM1029 is not set
# CONFIG_SENSORS_ADM1031 is not set
# CONFIG_SENSORS_ADM1177 is not set
# CONFIG_SENSORS_ADM9240 is not set
# CONFIG_SENSORS_ADT7310 is not set
# CONFIG_SENSORS_ADT7410 is not set
# CONFIG_SENSORS_ADT7411 is not set
# CONFIG_SENSORS_ADT7462 is not set
# CONFIG_SENSORS_ADT7470 is not set
# CONFIG_SENSORS_ADT7475 is not set
# CONFIG_SENSORS_AHT10 is not set
# CONFIG_SENSORS_AQUACOMPUTER_D5NEXT is not set
# CONFIG_SENSORS_AS370 is not set
# CONFIG_SENSORS_ASC7621 is not set
# CONFIG_SENSORS_AXI_FAN_CONTROL is not set
CONFIG_SENSORS_ARM_SCMI=y
CONFIG_SENSORS_ASPEED=m
# CONFIG_SENSORS_ATXP1 is not set
# CONFIG_SENSORS_CORSAIR_CPRO is not set
# CONFIG_SENSORS_CORSAIR_PSU is not set
# CONFIG_SENSORS_DRIVETEMP is not set
# CONFIG_SENSORS_DS620 is not set
# CONFIG_SENSORS_DS1621 is not set
# CONFIG_SENSORS_I5K_AMB is not set
# CONFIG_SENSORS_F71805F is not set
# CONFIG_SENSORS_F71882FG is not set
# CONFIG_SENSORS_F75375S is not set
# CONFIG_SENSORS_FTSTEUTATES is not set
# CONFIG_SENSORS_GL518SM is not set
# CONFIG_SENSORS_GL520SM is not set
# CONFIG_SENSORS_G760A is not set
# CONFIG_SENSORS_G762 is not set
# CONFIG_SENSORS_GPIO_FAN is not set
# CONFIG_SENSORS_HIH6130 is not set
CONFIG_SENSORS_IIO_HWMON=y
# CONFIG_SENSORS_IT87 is not set
# CONFIG_SENSORS_JC42 is not set
# CONFIG_SENSORS_POWR1220 is not set
CONFIG_SENSORS_LAN966X=m
# CONFIG_SENSORS_LINEAGE is not set
# CONFIG_SENSORS_LTC2945 is not set
# CONFIG_SENSORS_LTC2947_I2C is not set
# CONFIG_SENSORS_LTC2947_SPI is not set
# CONFIG_SENSORS_LTC2990 is not set
# CONFIG_SENSORS_LTC2992 is not set
# CONFIG_SENSORS_LTC4151 is not set
# CONFIG_SENSORS_LTC4215 is not set
# CONFIG_SENSORS_LTC4222 is not set
# CONFIG_SENSORS_LTC4245 is not set
# CONFIG_SENSORS_LTC4260 is not set
# CONFIG_SENSORS_LTC4261 is not set
# CONFIG_SENSORS_MAX1111 is not set
# CONFIG_SENSORS_MAX127 is not set
# CONFIG_SENSORS_MAX16065 is not set
# CONFIG_SENSORS_MAX1619 is not set
# CONFIG_SENSORS_MAX1668 is not set
# CONFIG_SENSORS_MAX197 is not set
# CONFIG_SENSORS_MAX31722 is not set
# CONFIG_SENSORS_MAX31730 is not set
# CONFIG_SENSORS_MAX31760 is not set
# CONFIG_SENSORS_MAX6620 is not set
# CONFIG_SENSORS_MAX6621 is not set
# CONFIG_SENSORS_MAX6639 is not set
# CONFIG_SENSORS_MAX6650 is not set
# CONFIG_SENSORS_MAX6697 is not set
# CONFIG_SENSORS_MAX31790 is not set
# CONFIG_SENSORS_MCP3021 is not set
# CONFIG_SENSORS_TC654 is not set
# CONFIG_SENSORS_TPS23861 is not set
# CONFIG_SENSORS_MR75203 is not set
# CONFIG_SENSORS_ADCXX is not set
# CONFIG_SENSORS_LM63 is not set
# CONFIG_SENSORS_LM70 is not set
# CONFIG_SENSORS_LM73 is not set
# CONFIG_SENSORS_LM75 is not set
# CONFIG_SENSORS_LM77 is not set
# CONFIG_SENSORS_LM78 is not set
# CONFIG_SENSORS_LM80 is not set
# CONFIG_SENSORS_LM83 is not set
# CONFIG_SENSORS_LM85 is not set
# CONFIG_SENSORS_LM87 is not set
CONFIG_SENSORS_LM90=y
# CONFIG_SENSORS_LM92 is not set
# CONFIG_SENSORS_LM93 is not set
# CONFIG_SENSORS_LM95234 is not set
# CONFIG_SENSORS_LM95241 is not set
CONFIG_SENSORS_LM95245=y
# CONFIG_SENSORS_PC87360 is not set
# CONFIG_SENSORS_PC87427 is not set
CONFIG_SENSORS_NTC_THERMISTOR=m
# CONFIG_SENSORS_NCT6683 is not set
# CONFIG_SENSORS_NCT6775 is not set
# CONFIG_SENSORS_NCT6775_I2C is not set
# CONFIG_SENSORS_NCT7802 is not set
# CONFIG_SENSORS_NCT7904 is not set
# CONFIG_SENSORS_NPCM7XX is not set
# CONFIG_SENSORS_NZXT_KRAKEN2 is not set
# CONFIG_SENSORS_NZXT_SMART2 is not set
# CONFIG_SENSORS_OCC_P8_I2C is not set
# CONFIG_SENSORS_OCC_P9_SBE is not set
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_PMBUS is not set
CONFIG_SENSORS_PWM_FAN=m
CONFIG_SENSORS_RASPBERRYPI_HWMON=m
# CONFIG_SENSORS_SBTSI is not set
# CONFIG_SENSORS_SBRMI is not set
# CONFIG_SENSORS_SHT15 is not set
# CONFIG_SENSORS_SHT21 is not set
# CONFIG_SENSORS_SHT3x is not set
# CONFIG_SENSORS_SHT4x is not set
# CONFIG_SENSORS_SHTC1 is not set
# CONFIG_SENSORS_SIS5595 is not set
# CONFIG_SENSORS_DME1737 is not set
# CONFIG_SENSORS_EMC1403 is not set
# CONFIG_SENSORS_EMC2103 is not set
# CONFIG_SENSORS_EMC2305 is not set
# CONFIG_SENSORS_EMC6W201 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
# CONFIG_SENSORS_SMSC47M192 is not set
# CONFIG_SENSORS_SMSC47B397 is not set
# CONFIG_SENSORS_SCH5627 is not set
# CONFIG_SENSORS_SCH5636 is not set
# CONFIG_SENSORS_STTS751 is not set
# CONFIG_SENSORS_SMM665 is not set
# CONFIG_SENSORS_ADC128D818 is not set
# CONFIG_SENSORS_ADS7828 is not set
# CONFIG_SENSORS_ADS7871 is not set
# CONFIG_SENSORS_AMC6821 is not set
# CONFIG_SENSORS_INA209 is not set
CONFIG_SENSORS_INA2XX=m
# CONFIG_SENSORS_INA238 is not set
# CONFIG_SENSORS_INA3221 is not set
# CONFIG_SENSORS_TC74 is not set
# CONFIG_SENSORS_THMC50 is not set
# CONFIG_SENSORS_TMP102 is not set
# CONFIG_SENSORS_TMP103 is not set
# CONFIG_SENSORS_TMP108 is not set
# CONFIG_SENSORS_TMP401 is not set
# CONFIG_SENSORS_TMP421 is not set
# CONFIG_SENSORS_TMP464 is not set
# CONFIG_SENSORS_TMP513 is not set
# CONFIG_SENSORS_VEXPRESS is not set
# CONFIG_SENSORS_VIA686A is not set
# CONFIG_SENSORS_VT1211 is not set
# CONFIG_SENSORS_VT8231 is not set
# CONFIG_SENSORS_W83773G is not set
# CONFIG_SENSORS_W83781D is not set
# CONFIG_SENSORS_W83791D is not set
# CONFIG_SENSORS_W83792D is not set
# CONFIG_SENSORS_W83793 is not set
# CONFIG_SENSORS_W83795 is not set
# CONFIG_SENSORS_W83L785TS is not set
# CONFIG_SENSORS_W83L786NG is not set
# CONFIG_SENSORS_W83627HF is not set
# CONFIG_SENSORS_W83627EHF is not set
CONFIG_THERMAL=y
# CONFIG_THERMAL_NETLINK is not set
# CONFIG_THERMAL_STATISTICS is not set
CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
CONFIG_THERMAL_HWMON=y
CONFIG_THERMAL_OF=y
# CONFIG_THERMAL_WRITABLE_TRIPS is not set
CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set
# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set
# CONFIG_THERMAL_GOV_FAIR_SHARE is not set
CONFIG_THERMAL_GOV_STEP_WISE=y
# CONFIG_THERMAL_GOV_BANG_BANG is not set
# CONFIG_THERMAL_GOV_USER_SPACE is not set
CONFIG_CPU_THERMAL=y
CONFIG_CPU_FREQ_THERMAL=y
CONFIG_DEVFREQ_THERMAL=y
# CONFIG_THERMAL_EMULATION is not set
# CONFIG_THERMAL_MMIO is not set
CONFIG_HISI_THERMAL=y
CONFIG_IMX_THERMAL=y
# CONFIG_IMX8MM_THERMAL is not set
# CONFIG_QORIQ_THERMAL is not set
# CONFIG_SPEAR_THERMAL is not set
# CONFIG_SUN8I_THERMAL is not set
CONFIG_ROCKCHIP_THERMAL=y
CONFIG_RCAR_THERMAL=y
# CONFIG_RCAR_GEN3_THERMAL is not set
# CONFIG_RZG2L_THERMAL is not set
# CONFIG_DOVE_THERMAL is not set
CONFIG_DB8500_THERMAL=y
CONFIG_ARMADA_THERMAL=y
CONFIG_MTK_THERMAL=y
CONFIG_AMLOGIC_THERMAL=y

#
# Broadcom thermal drivers
#
CONFIG_BCM2711_THERMAL=m
CONFIG_BCM2835_THERMAL=m
CONFIG_BRCMSTB_THERMAL=m
CONFIG_BCM_NS_THERMAL=y
CONFIG_BCM_SR_THERMAL=y
# end of Broadcom thermal drivers

#
# Texas Instruments thermal drivers
#
CONFIG_TI_SOC_THERMAL=y
# CONFIG_TI_THERMAL is not set
# CONFIG_OMAP3_THERMAL is not set
# CONFIG_OMAP4_THERMAL is not set
# CONFIG_OMAP5_THERMAL is not set
# CONFIG_DRA752_THERMAL is not set
# end of Texas Instruments thermal drivers

#
# Samsung thermal drivers
#
CONFIG_EXYNOS_THERMAL=y
# end of Samsung thermal drivers

#
# STMicroelectronics thermal drivers
#
CONFIG_ST_THERMAL=y
# CONFIG_ST_THERMAL_SYSCFG is not set
CONFIG_ST_THERMAL_MEMMAP=y
CONFIG_STM32_THERMAL=y
# end of STMicroelectronics thermal drivers

#
# NVIDIA Tegra thermal drivers
#
CONFIG_TEGRA_SOCTHERM=m
CONFIG_TEGRA30_TSENSOR=m
# end of NVIDIA Tegra thermal drivers

CONFIG_GENERIC_ADC_THERMAL=m

#
# Qualcomm thermal drivers
#
CONFIG_QCOM_TSENS=y
# CONFIG_QCOM_SPMI_ADC_TM5 is not set
# CONFIG_QCOM_SPMI_TEMP_ALARM is not set
# CONFIG_QCOM_LMH is not set
# end of Qualcomm thermal drivers

CONFIG_UNIPHIER_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
# CONFIG_WATCHDOG_NOWAYOUT is not set
CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y
CONFIG_WATCHDOG_OPEN_TIMEOUT=0
# CONFIG_WATCHDOG_SYSFS is not set
# CONFIG_WATCHDOG_HRTIMER_PRETIMEOUT is not set

#
# Watchdog Pretimeout Governors
#
# CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set

#
# Watchdog Device Drivers
#
# CONFIG_SOFT_WATCHDOG is not set
CONFIG_DA9063_WATCHDOG=m
# CONFIG_GPIO_WATCHDOG is not set
CONFIG_XILINX_WATCHDOG=y
# CONFIG_ZIIRAVE_WATCHDOG is not set
CONFIG_ARM_SP805_WATCHDOG=y
# CONFIG_ARMADA_37XX_WATCHDOG is not set
CONFIG_AT91SAM9X_WATCHDOG=y
CONFIG_SAMA5D4_WATCHDOG=y
# CONFIG_CADENCE_WATCHDOG is not set
# CONFIG_FTWDT010_WATCHDOG is not set
CONFIG_S3C2410_WATCHDOG=m
CONFIG_DW_WATCHDOG=y
# CONFIG_OMAP_WATCHDOG is not set
CONFIG_DAVINCI_WATCHDOG=m
CONFIG_ORION_WATCHDOG=y
CONFIG_RN5T618_WATCHDOG=y
CONFIG_SUNXI_WATCHDOG=y
# CONFIG_TWL4030_WATCHDOG is not set
# CONFIG_TS4800_WATCHDOG is not set
# CONFIG_MAX63XX_WATCHDOG is not set
CONFIG_IMX2_WDT=y
# CONFIG_IMX7ULP_WDT is not set
CONFIG_DB500_WATCHDOG=y
CONFIG_ST_LPC_WATCHDOG=y
CONFIG_TEGRA_WATCHDOG=m
CONFIG_QCOM_WDT=m
# CONFIG_MESON_GXBB_WATCHDOG is not set
CONFIG_MESON_WATCHDOG=y
CONFIG_MEDIATEK_WATCHDOG=y
CONFIG_DIGICOLOR_WATCHDOG=y
# CONFIG_ARM_SMC_WATCHDOG is not set
CONFIG_RENESAS_WDT=m
CONFIG_RENESAS_RZAWDT=m
# CONFIG_RENESAS_RZN1WDT is not set
# CONFIG_RENESAS_RZG2LWDT is not set
CONFIG_ASPEED_WATCHDOG=y
CONFIG_STM32_WATCHDOG=y
CONFIG_STPMIC1_WATCHDOG=y
# CONFIG_UNIPHIER_WATCHDOG is not set
CONFIG_PM8916_WATCHDOG=m
# CONFIG_SUNPLUS_WATCHDOG is not set
# CONFIG_ALIM7101_WDT is not set
# CONFIG_I6300ESB_WDT is not set
CONFIG_BCM47XX_WDT=y
CONFIG_BCM2835_WDT=y
CONFIG_BCM_KONA_WDT=y
# CONFIG_BCM_KONA_WDT_DEBUG is not set
CONFIG_BCM7038_WDT=m
CONFIG_GXP_WATCHDOG=y
# CONFIG_MEN_A21_WDT is not set

#
# PCI-based Watchdog Cards
#
# CONFIG_PCIPCWATCHDOG is not set
# CONFIG_WDTPCI is not set

#
# USB-based Watchdog Cards
#
# CONFIG_USBPCWATCHDOG is not set
CONFIG_SSB_POSSIBLE=y
# CONFIG_SSB is not set
CONFIG_BCMA_POSSIBLE=y
CONFIG_BCMA=y
CONFIG_BCMA_HOST_PCI_POSSIBLE=y
CONFIG_BCMA_HOST_PCI=y
CONFIG_BCMA_HOST_SOC=y
CONFIG_BCMA_DRIVER_PCI=y
CONFIG_BCMA_SFLASH=y
CONFIG_BCMA_DRIVER_GMAC_CMN=y
CONFIG_BCMA_DRIVER_GPIO=y
# CONFIG_BCMA_DEBUG is not set

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
# CONFIG_MFD_ALTERA_A10SR is not set
# CONFIG_MFD_ALTERA_SYSMGR is not set
CONFIG_MFD_ACT8945A=y
CONFIG_MFD_AS3711=y
# CONFIG_MFD_SMPRO is not set
CONFIG_MFD_AS3722=y
# CONFIG_PMIC_ADP5520 is not set
# CONFIG_MFD_AAT2870_CORE is not set
CONFIG_MFD_AT91_USART=y
CONFIG_MFD_ATMEL_FLEXCOM=y
CONFIG_MFD_ATMEL_HLCDC=m
CONFIG_MFD_ATMEL_SMC=y
CONFIG_MFD_BCM590XX=y
# CONFIG_MFD_BD9571MWV is not set
CONFIG_MFD_AC100=y
CONFIG_MFD_AXP20X=y
CONFIG_MFD_AXP20X_I2C=y
CONFIG_MFD_AXP20X_RSB=y
CONFIG_MFD_CROS_EC_DEV=m
# CONFIG_MFD_MADERA is not set
# CONFIG_MFD_ASIC3 is not set
# CONFIG_PMIC_DA903X is not set
# CONFIG_MFD_DA9052_SPI is not set
# CONFIG_MFD_DA9052_I2C is not set
# CONFIG_MFD_DA9055 is not set
# CONFIG_MFD_DA9062 is not set
CONFIG_MFD_DA9063=m
# CONFIG_MFD_DA9150 is not set
# CONFIG_MFD_DLN2 is not set
# CONFIG_MFD_ENE_KB3930 is not set
# CONFIG_MFD_EXYNOS_LPASS is not set
# CONFIG_MFD_GATEWORKS_GSC is not set
# CONFIG_MFD_MC13XXX_SPI is not set
# CONFIG_MFD_MC13XXX_I2C is not set
# CONFIG_MFD_MP2629 is not set
# CONFIG_MFD_HI6421_PMIC is not set
# CONFIG_MFD_HI6421_SPMI is not set
# CONFIG_MFD_HI655X_PMIC is not set
# CONFIG_HTC_PASIC3 is not set
# CONFIG_HTC_I2CPLD is not set
# CONFIG_LPC_ICH is not set
# CONFIG_LPC_SCH is not set
# CONFIG_MFD_IQS62X is not set
# CONFIG_MFD_JANZ_CMODIO is not set
# CONFIG_MFD_KEMPLD is not set
# CONFIG_MFD_88PM800 is not set
# CONFIG_MFD_88PM805 is not set
# CONFIG_MFD_88PM860X is not set
CONFIG_MFD_MAX14577=y
# CONFIG_MFD_MAX77620 is not set
# CONFIG_MFD_MAX77650 is not set
CONFIG_MFD_MAX77686=y
CONFIG_MFD_MAX77693=m
# CONFIG_MFD_MAX77714 is not set
# CONFIG_MFD_MAX77843 is not set
CONFIG_MFD_MAX8907=y
# CONFIG_MFD_MAX8925 is not set
CONFIG_MFD_MAX8997=y
CONFIG_MFD_MAX8998=y
# CONFIG_MFD_MT6360 is not set
# CONFIG_MFD_MT6370 is not set
# CONFIG_MFD_MT6397 is not set
# CONFIG_MFD_MENF21BMC is not set
# CONFIG_MFD_OCELOT is not set
# CONFIG_EZX_PCAP is not set
CONFIG_MFD_CPCAP=y
# CONFIG_MFD_VIPERBOARD is not set
# CONFIG_MFD_NTXEC is not set
# CONFIG_MFD_RETU is not set
# CONFIG_MFD_PCF50633 is not set
# CONFIG_UCB1400_CORE is not set
CONFIG_MFD_PM8XXX=y
CONFIG_MFD_QCOM_RPM=y
CONFIG_MFD_SPMI_PMIC=y
# CONFIG_MFD_SY7636A is not set
# CONFIG_MFD_RDC321X is not set
# CONFIG_MFD_RT4831 is not set
# CONFIG_MFD_RT5033 is not set
# CONFIG_MFD_RT5120 is not set
# CONFIG_MFD_RC5T583 is not set
CONFIG_MFD_RK808=y
CONFIG_MFD_RN5T618=y
CONFIG_MFD_SEC_CORE=y
# CONFIG_MFD_SI476X_CORE is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_MFD_SKY81452 is not set
CONFIG_ABX500_CORE=y
CONFIG_AB8500_CORE=y
CONFIG_MFD_DB8500_PRCMU=y
CONFIG_MFD_STMPE=y

#
# STMicroelectronics STMPE Interface Drivers
#
CONFIG_STMPE_I2C=y
# CONFIG_STMPE_SPI is not set
# end of STMicroelectronics STMPE Interface Drivers

CONFIG_MFD_SUN6I_PRCM=y
CONFIG_MFD_SYSCON=y
# CONFIG_MFD_TI_AM335X_TSCADC is not set
# CONFIG_MFD_LP3943 is not set
# CONFIG_MFD_LP8788 is not set
# CONFIG_MFD_TI_LMU is not set
CONFIG_MFD_OMAP_USB_HOST=y
CONFIG_MFD_PALMAS=y
# CONFIG_TPS6105X is not set
# CONFIG_TPS65010 is not set
# CONFIG_TPS6507X is not set
# CONFIG_MFD_TPS65086 is not set
CONFIG_MFD_TPS65090=y
CONFIG_MFD_TPS65217=y
# CONFIG_MFD_TI_LP873X is not set
# CONFIG_MFD_TI_LP87565 is not set
CONFIG_MFD_TPS65218=y
CONFIG_MFD_TPS6586X=y
CONFIG_MFD_TPS65910=y
# CONFIG_MFD_TPS65912_I2C is not set
# CONFIG_MFD_TPS65912_SPI is not set
CONFIG_TWL4030_CORE=y
CONFIG_TWL4030_POWER=y
# CONFIG_MFD_TWL4030_AUDIO is not set
# CONFIG_TWL6040_CORE is not set
# CONFIG_MFD_WL1273_CORE is not set
# CONFIG_MFD_LM3533 is not set
# CONFIG_MFD_TC3589X is not set
# CONFIG_MFD_T7L66XB is not set
# CONFIG_MFD_TC6387XB is not set
# CONFIG_MFD_TC6393XB is not set
# CONFIG_MFD_TQMX86 is not set
# CONFIG_MFD_VX855 is not set
# CONFIG_MFD_LOCHNAGAR is not set
# CONFIG_MFD_ARIZONA_I2C is not set
# CONFIG_MFD_ARIZONA_SPI is not set
# CONFIG_MFD_WM8400 is not set
# CONFIG_MFD_WM831X_I2C is not set
# CONFIG_MFD_WM831X_SPI is not set
# CONFIG_MFD_WM8350_I2C is not set
CONFIG_MFD_WM8994=m
# CONFIG_MFD_ROHM_BD718XX is not set
# CONFIG_MFD_ROHM_BD71828 is not set
# CONFIG_MFD_ROHM_BD957XMUF is not set
CONFIG_MFD_STM32_LPTIMER=m
CONFIG_MFD_STM32_TIMERS=m
CONFIG_MFD_STPMIC1=y
CONFIG_MFD_STMFX=y
# CONFIG_MFD_ATC260X_I2C is not set
# CONFIG_MFD_KHADAS_MCU is not set
CONFIG_MFD_ACER_A500_EC=m
# CONFIG_MFD_QCOM_PM8008 is not set
CONFIG_MFD_VEXPRESS_SYSREG=y
# CONFIG_RAVE_SP_CORE is not set
# CONFIG_MFD_INTEL_M10_BMC is not set
# CONFIG_MFD_RSMU_I2C is not set
# CONFIG_MFD_RSMU_SPI is not set
# end of Multifunction device drivers

CONFIG_REGULATOR=y
# CONFIG_REGULATOR_DEBUG is not set
CONFIG_REGULATOR_FIXED_VOLTAGE=y
# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
# CONFIG_REGULATOR_88PG86X is not set
CONFIG_REGULATOR_ACT8865=y
CONFIG_REGULATOR_ACT8945A=y
# CONFIG_REGULATOR_AD5398 is not set
CONFIG_REGULATOR_ANATOP=y
CONFIG_REGULATOR_AB8500=y
# CONFIG_REGULATOR_ARM_SCMI is not set
CONFIG_REGULATOR_AS3711=y
CONFIG_REGULATOR_AS3722=y
CONFIG_REGULATOR_AXP20X=y
CONFIG_REGULATOR_BCM590XX=y
CONFIG_REGULATOR_CPCAP=y
# CONFIG_REGULATOR_CROS_EC is not set
# CONFIG_REGULATOR_DA9063 is not set
# CONFIG_REGULATOR_DA9121 is not set
CONFIG_REGULATOR_DA9210=y
# CONFIG_REGULATOR_DA9211 is not set
CONFIG_REGULATOR_DBX500_PRCMU=y
CONFIG_REGULATOR_DB8500_PRCMU=y
CONFIG_REGULATOR_FAN53555=y
# CONFIG_REGULATOR_FAN53880 is not set
CONFIG_REGULATOR_GPIO=y
# CONFIG_REGULATOR_ISL9305 is not set
# CONFIG_REGULATOR_ISL6271A is not set
# CONFIG_REGULATOR_LP3971 is not set
# CONFIG_REGULATOR_LP3972 is not set
CONFIG_REGULATOR_LP872X=y
# CONFIG_REGULATOR_LP8755 is not set
# CONFIG_REGULATOR_LTC3589 is not set
# CONFIG_REGULATOR_LTC3676 is not set
CONFIG_REGULATOR_MAX14577=m
# CONFIG_REGULATOR_MAX1586 is not set
# CONFIG_REGULATOR_MAX8649 is not set
# CONFIG_REGULATOR_MAX8660 is not set
# CONFIG_REGULATOR_MAX8893 is not set
CONFIG_REGULATOR_MAX8907=y
CONFIG_REGULATOR_MAX8952=m
CONFIG_REGULATOR_MAX8973=y
CONFIG_REGULATOR_MAX8997=m
CONFIG_REGULATOR_MAX8998=m
# CONFIG_REGULATOR_MAX20086 is not set
CONFIG_REGULATOR_MAX77686=y
CONFIG_REGULATOR_MAX77693=m
CONFIG_REGULATOR_MAX77802=y
# CONFIG_REGULATOR_MAX77826 is not set
# CONFIG_REGULATOR_MCP16502 is not set
# CONFIG_REGULATOR_MP5416 is not set
# CONFIG_REGULATOR_MP8859 is not set
# CONFIG_REGULATOR_MP886X is not set
# CONFIG_REGULATOR_MPQ7920 is not set
# CONFIG_REGULATOR_MT6311 is not set
# CONFIG_REGULATOR_MT6315 is not set
CONFIG_REGULATOR_PALMAS=y
CONFIG_REGULATOR_PBIAS=y
# CONFIG_REGULATOR_PCA9450 is not set
# CONFIG_REGULATOR_PF8X00 is not set
# CONFIG_REGULATOR_PFUZE100 is not set
# CONFIG_REGULATOR_PV88060 is not set
# CONFIG_REGULATOR_PV88080 is not set
# CONFIG_REGULATOR_PV88090 is not set
CONFIG_REGULATOR_PWM=y
CONFIG_REGULATOR_QCOM_RPM=y
# CONFIG_REGULATOR_QCOM_RPMH is not set
CONFIG_REGULATOR_QCOM_SMD_RPM=y
CONFIG_REGULATOR_QCOM_SPMI=y
# CONFIG_REGULATOR_QCOM_USB_VBUS is not set
# CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY is not set
CONFIG_REGULATOR_RK808=y
CONFIG_REGULATOR_RN5T618=y
# CONFIG_REGULATOR_RT4801 is not set
# CONFIG_REGULATOR_RT5190A is not set
# CONFIG_REGULATOR_RT5759 is not set
# CONFIG_REGULATOR_RT6160 is not set
# CONFIG_REGULATOR_RT6245 is not set
# CONFIG_REGULATOR_RTQ2134 is not set
# CONFIG_REGULATOR_RTMV20 is not set
# CONFIG_REGULATOR_RTQ6752 is not set
CONFIG_REGULATOR_S2MPA01=m
CONFIG_REGULATOR_S2MPS11=y
CONFIG_REGULATOR_S5M8767=y
# CONFIG_REGULATOR_SLG51000 is not set
CONFIG_REGULATOR_STM32_BOOSTER=m
CONFIG_REGULATOR_STM32_VREFBUF=m
CONFIG_REGULATOR_STM32_PWR=y
CONFIG_REGULATOR_STPMIC1=y
CONFIG_REGULATOR_TI_ABB=y
# CONFIG_REGULATOR_SY8106A is not set
# CONFIG_REGULATOR_SY8824X is not set
# CONFIG_REGULATOR_SY8827N is not set
CONFIG_REGULATOR_TPS51632=y
CONFIG_REGULATOR_TPS62360=y
# CONFIG_REGULATOR_TPS6286X is not set
# CONFIG_REGULATOR_TPS65023 is not set
# CONFIG_REGULATOR_TPS6507X is not set
CONFIG_REGULATOR_TPS65090=y
# CONFIG_REGULATOR_TPS65132 is not set
CONFIG_REGULATOR_TPS65217=y
CONFIG_REGULATOR_TPS65218=y
# CONFIG_REGULATOR_TPS6524X is not set
CONFIG_REGULATOR_TPS6586X=y
CONFIG_REGULATOR_TPS65910=y
CONFIG_REGULATOR_TWL4030=y
CONFIG_REGULATOR_UNIPHIER=y
# CONFIG_REGULATOR_VCTRL is not set
CONFIG_REGULATOR_VEXPRESS=y
# CONFIG_REGULATOR_VQMMC_IPQ4019 is not set
CONFIG_REGULATOR_WM8994=m
# CONFIG_REGULATOR_QCOM_LABIBB is not set
# CONFIG_RC_CORE is not set
CONFIG_CEC_CORE=y
CONFIG_CEC_NOTIFIER=y

#
# CEC support
#
CONFIG_MEDIA_CEC_SUPPORT=y
# CONFIG_CEC_CH7322 is not set
# CONFIG_CEC_CROS_EC is not set
# CONFIG_CEC_MESON_AO is not set
# CONFIG_CEC_MESON_G12A_AO is not set
CONFIG_CEC_SAMSUNG_S5P=m
# CONFIG_CEC_STI is not set
CONFIG_CEC_STM32=m
# CONFIG_CEC_TEGRA is not set
# CONFIG_USB_PULSE8_CEC is not set
# CONFIG_USB_RAINSHADOW_CEC is not set
# end of CEC support

CONFIG_MEDIA_SUPPORT=m
# CONFIG_MEDIA_SUPPORT_FILTER is not set
# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set

#
# Media device types
#
CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_MEDIA_ANALOG_TV_SUPPORT=y
CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
CONFIG_MEDIA_RADIO_SUPPORT=y
CONFIG_MEDIA_SDR_SUPPORT=y
CONFIG_MEDIA_PLATFORM_SUPPORT=y
CONFIG_MEDIA_TEST_SUPPORT=y
# end of Media device types

#
# Media core support
#
CONFIG_VIDEO_DEV=m
CONFIG_MEDIA_CONTROLLER=y
CONFIG_DVB_CORE=m
# end of Media core support

#
# Video4Linux options
#
CONFIG_VIDEO_V4L2_I2C=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
# CONFIG_VIDEO_ADV_DEBUG is not set
# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
CONFIG_V4L2_H264=m
CONFIG_V4L2_MEM2MEM_DEV=m
# CONFIG_V4L2_FLASH_LED_CLASS is not set
CONFIG_V4L2_FWNODE=m
CONFIG_V4L2_ASYNC=m
# end of Video4Linux options

#
# Media controller options
#
# CONFIG_MEDIA_CONTROLLER_DVB is not set
CONFIG_MEDIA_CONTROLLER_REQUEST_API=y
# end of Media controller options

#
# Digital TV options
#
# CONFIG_DVB_MMAP is not set
CONFIG_DVB_NET=y
CONFIG_DVB_MAX_ADAPTERS=16
CONFIG_DVB_DYNAMIC_MINORS=y
# CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set
# CONFIG_DVB_ULE_DEBUG is not set
# end of Digital TV options

#
# Media drivers
#

#
# Media drivers
#
CONFIG_MEDIA_USB_SUPPORT=y

#
# Webcam devices
#
# CONFIG_USB_GSPCA is not set
# CONFIG_USB_PWC is not set
# CONFIG_USB_S2255 is not set
# CONFIG_VIDEO_USBTV is not set
CONFIG_USB_VIDEO_CLASS=m
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y

#
# Analog TV USB devices
#
# CONFIG_VIDEO_GO7007 is not set
# CONFIG_VIDEO_HDPVR is not set
# CONFIG_VIDEO_PVRUSB2 is not set
# CONFIG_VIDEO_STK1160_COMMON is not set

#
# Analog/digital TV USB devices
#
# CONFIG_VIDEO_AU0828 is not set
# CONFIG_VIDEO_CX231XX is not set

#
# Digital TV USB devices
#
# CONFIG_DVB_AS102 is not set
# CONFIG_DVB_B2C2_FLEXCOP_USB is not set
# CONFIG_DVB_USB_V2 is not set
# CONFIG_SMS_USB_DRV is not set
# CONFIG_DVB_TTUSB_BUDGET is not set
# CONFIG_DVB_TTUSB_DEC is not set

#
# Webcam, TV (analog/digital) USB devices
#
# CONFIG_VIDEO_EM28XX is not set

#
# Software defined radio USB devices
#
# CONFIG_USB_AIRSPY is not set
# CONFIG_USB_HACKRF is not set
# CONFIG_USB_MSI2500 is not set
# CONFIG_MEDIA_PCI_SUPPORT is not set
CONFIG_RADIO_ADAPTERS=m
# CONFIG_RADIO_MAXIRADIO is not set
# CONFIG_RADIO_SAA7706H is not set
# CONFIG_RADIO_SHARK is not set
# CONFIG_RADIO_SHARK2 is not set
# CONFIG_RADIO_SI4713 is not set
# CONFIG_RADIO_TEA5764 is not set
# CONFIG_RADIO_TEF6862 is not set
# CONFIG_RADIO_WL1273 is not set
# CONFIG_USB_DSBR is not set
# CONFIG_USB_KEENE is not set
# CONFIG_USB_MA901 is not set
# CONFIG_USB_MR800 is not set
# CONFIG_USB_RAREMONO is not set
# CONFIG_RADIO_SI470X is not set
CONFIG_MEDIA_PLATFORM_DRIVERS=y
CONFIG_V4L_PLATFORM_DRIVERS=y
# CONFIG_SDR_PLATFORM_DRIVERS is not set
# CONFIG_DVB_PLATFORM_DRIVERS is not set
CONFIG_V4L_MEM2MEM_DRIVERS=y
# CONFIG_VIDEO_MEM2MEM_DEINTERLACE is not set
# CONFIG_VIDEO_MUX is not set

#
# Allegro DVT media platform drivers
#

#
# Amlogic media platform drivers
#
# CONFIG_VIDEO_MESON_GE2D is not set

#
# Amphion drivers
#
# CONFIG_VIDEO_AMPHION_VPU is not set

#
# Aspeed media platform drivers
#
CONFIG_VIDEO_ASPEED=m

#
# Atmel media platform drivers
#
CONFIG_VIDEO_ATMEL_ISC=m
CONFIG_VIDEO_ATMEL_XISC=m
CONFIG_VIDEO_ATMEL_ISC_BASE=m
CONFIG_VIDEO_ATMEL_ISI=m
CONFIG_VIDEO_MICROCHIP_CSI2DC=m

#
# Cadence media platform drivers
#
# CONFIG_VIDEO_CADENCE_CSI2RX is not set
# CONFIG_VIDEO_CADENCE_CSI2TX is not set

#
# Chips&Media media platform drivers
#
# CONFIG_VIDEO_CODA is not set

#
# Intel media platform drivers
#

#
# Marvell media platform drivers
#
# CONFIG_VIDEO_CAFE_CCIC is not set
CONFIG_VIDEO_MMP_CAMERA=m

#
# Mediatek media platform drivers
#
# CONFIG_VIDEO_MEDIATEK_VPU is not set

#
# NVidia media platform drivers
#
CONFIG_VIDEO_TEGRA_VDE=m

#
# NXP media platform drivers
#
# CONFIG_VIDEO_IMX_MIPI_CSIS is not set
# CONFIG_VIDEO_IMX_PXP is not set
# CONFIG_VIDEO_DW100 is not set
# CONFIG_VIDEO_IMX8_JPEG is not set

#
# Qualcomm media platform drivers
#

#
# Renesas media platform drivers
#
CONFIG_VIDEO_RENESAS_CEU=m
# CONFIG_VIDEO_RCAR_ISP is not set
# CONFIG_VIDEO_RCAR_CSI2 is not set
CONFIG_VIDEO_RCAR_VIN=m
# CONFIG_VIDEO_RENESAS_FCP is not set
CONFIG_VIDEO_RENESAS_FDP1=m
CONFIG_VIDEO_RENESAS_JPU=m
CONFIG_VIDEO_RENESAS_VSP1=m

#
# Rockchip media platform drivers
#
# CONFIG_VIDEO_ROCKCHIP_RGA is not set
# CONFIG_VIDEO_ROCKCHIP_ISP1 is not set

#
# Samsung media platform drivers
#
CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m
CONFIG_VIDEO_SAMSUNG_EXYNOS4_IS=m
CONFIG_VIDEO_EXYNOS4_IS_COMMON=m
CONFIG_VIDEO_S5P_FIMC=m
CONFIG_VIDEO_S5P_MIPI_CSIS=m
CONFIG_VIDEO_EXYNOS_FIMC_LITE=m
CONFIG_VIDEO_EXYNOS4_FIMC_IS=m
CONFIG_VIDEO_EXYNOS4_ISP_DMA_CAPTURE=y
# CONFIG_VIDEO_SAMSUNG_S5P_G2D is not set
CONFIG_VIDEO_SAMSUNG_S5P_JPEG=m
CONFIG_VIDEO_SAMSUNG_S5P_MFC=m

#
# STMicroelectronics media platform drivers
#
CONFIG_VIDEO_STI_BDISP=m
CONFIG_VIDEO_STI_DELTA=m
CONFIG_VIDEO_STI_DELTA_MJPEG=y
CONFIG_VIDEO_STI_DELTA_DRIVER=m
CONFIG_VIDEO_STI_HVA=m
# CONFIG_VIDEO_STI_HVA_DEBUGFS is not set
CONFIG_VIDEO_STM32_DCMI=m
# CONFIG_VIDEO_STM32_DMA2D is not set

#
# Sunxi media platform drivers
#
# CONFIG_VIDEO_SUN4I_CSI is not set
# CONFIG_VIDEO_SUN6I_CSI is not set
# CONFIG_VIDEO_SUN6I_MIPI_CSI2 is not set
# CONFIG_VIDEO_SUN8I_A83T_MIPI_CSI2 is not set
# CONFIG_VIDEO_SUN8I_DEINTERLACE is not set
# CONFIG_VIDEO_SUN8I_ROTATE is not set

#
# Texas Instruments drivers
#
# CONFIG_VIDEO_TI_CAL is not set
# CONFIG_VIDEO_TI_VPE is not set
# CONFIG_VIDEO_AM437X_VPFE is not set

#
# Verisilicon media platform drivers
#
# CONFIG_VIDEO_HANTRO is not set

#
# VIA media platform drivers
#

#
# Xilinx media platform drivers
#
# CONFIG_VIDEO_XILINX is not set

#
# MMC/SDIO DVB adapters
#
# CONFIG_SMS_SDIO_DRV is not set
CONFIG_V4L_TEST_DRIVERS=y
# CONFIG_VIDEO_VIM2M is not set
# CONFIG_VIDEO_VICODEC is not set
# CONFIG_VIDEO_VIMC is not set
CONFIG_VIDEO_VIVID=m
# CONFIG_VIDEO_VIVID_CEC is not set
CONFIG_VIDEO_VIVID_MAX_DEVS=64
# CONFIG_DVB_TEST_DRIVERS is not set
CONFIG_VIDEO_V4L2_TPG=m
CONFIG_VIDEOBUF2_CORE=m
CONFIG_VIDEOBUF2_V4L2=m
CONFIG_VIDEOBUF2_MEMOPS=m
CONFIG_VIDEOBUF2_DMA_CONTIG=m
CONFIG_VIDEOBUF2_VMALLOC=m
CONFIG_VIDEOBUF2_DMA_SG=m
# end of Media drivers

#
# Media ancillary drivers
#
CONFIG_MEDIA_ATTACH=y

#
# Camera sensor devices
#
# CONFIG_VIDEO_AR0521 is not set
# CONFIG_VIDEO_HI556 is not set
# CONFIG_VIDEO_HI846 is not set
# CONFIG_VIDEO_HI847 is not set
# CONFIG_VIDEO_IMX208 is not set
# CONFIG_VIDEO_IMX214 is not set
# CONFIG_VIDEO_IMX219 is not set
# CONFIG_VIDEO_IMX258 is not set
# CONFIG_VIDEO_IMX274 is not set
# CONFIG_VIDEO_IMX290 is not set
# CONFIG_VIDEO_IMX319 is not set
# CONFIG_VIDEO_IMX334 is not set
# CONFIG_VIDEO_IMX335 is not set
# CONFIG_VIDEO_IMX355 is not set
# CONFIG_VIDEO_IMX412 is not set
# CONFIG_VIDEO_MT9M001 is not set
# CONFIG_VIDEO_MT9M032 is not set
# CONFIG_VIDEO_MT9M111 is not set
# CONFIG_VIDEO_MT9P031 is not set
# CONFIG_VIDEO_MT9T001 is not set
# CONFIG_VIDEO_MT9T112 is not set
# CONFIG_VIDEO_MT9V011 is not set
# CONFIG_VIDEO_MT9V032 is not set
# CONFIG_VIDEO_MT9V111 is not set
# CONFIG_VIDEO_NOON010PC30 is not set
# CONFIG_VIDEO_OG01A1B is not set
# CONFIG_VIDEO_OV02A10 is not set
# CONFIG_VIDEO_OV08D10 is not set
# CONFIG_VIDEO_OV13858 is not set
# CONFIG_VIDEO_OV13B10 is not set
# CONFIG_VIDEO_OV2640 is not set
# CONFIG_VIDEO_OV2659 is not set
# CONFIG_VIDEO_OV2680 is not set
# CONFIG_VIDEO_OV2685 is not set
# CONFIG_VIDEO_OV5640 is not set
# CONFIG_VIDEO_OV5645 is not set
# CONFIG_VIDEO_OV5647 is not set
# CONFIG_VIDEO_OV5648 is not set
# CONFIG_VIDEO_OV5670 is not set
# CONFIG_VIDEO_OV5675 is not set
# CONFIG_VIDEO_OV5693 is not set
# CONFIG_VIDEO_OV5695 is not set
# CONFIG_VIDEO_OV6650 is not set
# CONFIG_VIDEO_OV7251 is not set
# CONFIG_VIDEO_OV7640 is not set
CONFIG_VIDEO_OV7670=m
# CONFIG_VIDEO_OV772X is not set
# CONFIG_VIDEO_OV7740 is not set
# CONFIG_VIDEO_OV8856 is not set
# CONFIG_VIDEO_OV8865 is not set
# CONFIG_VIDEO_OV9282 is not set
# CONFIG_VIDEO_OV9640 is not set
# CONFIG_VIDEO_OV9650 is not set
# CONFIG_VIDEO_RDACM20 is not set
# CONFIG_VIDEO_RDACM21 is not set
# CONFIG_VIDEO_RJ54N1 is not set
# CONFIG_VIDEO_S5C73M3 is not set
# CONFIG_VIDEO_S5K4ECGX is not set
# CONFIG_VIDEO_S5K5BAF is not set
# CONFIG_VIDEO_S5K6A3 is not set
# CONFIG_VIDEO_S5K6AA is not set
# CONFIG_VIDEO_SR030PC30 is not set
# CONFIG_VIDEO_VS6624 is not set
# CONFIG_VIDEO_CCS is not set
# CONFIG_VIDEO_ET8EK8 is not set
# CONFIG_VIDEO_M5MOLS is not set
# end of Camera sensor devices

#
# Lens drivers
#
# CONFIG_VIDEO_AD5820 is not set
# CONFIG_VIDEO_AK7375 is not set
# CONFIG_VIDEO_DW9714 is not set
# CONFIG_VIDEO_DW9768 is not set
# CONFIG_VIDEO_DW9807_VCM is not set
# end of Lens drivers

#
# Flash devices
#
# CONFIG_VIDEO_ADP1653 is not set
# CONFIG_VIDEO_LM3560 is not set
# CONFIG_VIDEO_LM3646 is not set
# end of Flash devices

#
# Audio decoders, processors and mixers
#
# CONFIG_VIDEO_CS3308 is not set
# CONFIG_VIDEO_CS5345 is not set
# CONFIG_VIDEO_CS53L32A is not set
# CONFIG_VIDEO_MSP3400 is not set
# CONFIG_VIDEO_SONY_BTF_MPX is not set
# CONFIG_VIDEO_TDA1997X is not set
# CONFIG_VIDEO_TDA7432 is not set
# CONFIG_VIDEO_TDA9840 is not set
# CONFIG_VIDEO_TEA6415C is not set
# CONFIG_VIDEO_TEA6420 is not set
# CONFIG_VIDEO_TLV320AIC23B is not set
# CONFIG_VIDEO_TVAUDIO is not set
# CONFIG_VIDEO_UDA1342 is not set
# CONFIG_VIDEO_VP27SMPX is not set
# CONFIG_VIDEO_WM8739 is not set
# CONFIG_VIDEO_WM8775 is not set
# end of Audio decoders, processors and mixers

#
# RDS decoders
#
# CONFIG_VIDEO_SAA6588 is not set
# end of RDS decoders

#
# Video decoders
#
CONFIG_VIDEO_ADV7180=m
# CONFIG_VIDEO_ADV7183 is not set
# CONFIG_VIDEO_ADV748X is not set
CONFIG_VIDEO_ADV7604=m
CONFIG_VIDEO_ADV7604_CEC=y
# CONFIG_VIDEO_ADV7842 is not set
# CONFIG_VIDEO_BT819 is not set
# CONFIG_VIDEO_BT856 is not set
# CONFIG_VIDEO_BT866 is not set
# CONFIG_VIDEO_ISL7998X is not set
# CONFIG_VIDEO_KS0127 is not set
# CONFIG_VIDEO_MAX9286 is not set
CONFIG_VIDEO_ML86V7667=m
# CONFIG_VIDEO_SAA7110 is not set
# CONFIG_VIDEO_SAA711X is not set
# CONFIG_VIDEO_TC358743 is not set
# CONFIG_VIDEO_TVP514X is not set
# CONFIG_VIDEO_TVP5150 is not set
# CONFIG_VIDEO_TVP7002 is not set
# CONFIG_VIDEO_TW2804 is not set
# CONFIG_VIDEO_TW9903 is not set
# CONFIG_VIDEO_TW9906 is not set
# CONFIG_VIDEO_TW9910 is not set
# CONFIG_VIDEO_VPX3220 is not set

#
# Video and audio decoders
#
# CONFIG_VIDEO_SAA717X is not set
# CONFIG_VIDEO_CX25840 is not set
# end of Video decoders

#
# Video encoders
#
# CONFIG_VIDEO_AD9389B is not set
# CONFIG_VIDEO_ADV7170 is not set
# CONFIG_VIDEO_ADV7175 is not set
# CONFIG_VIDEO_ADV7343 is not set
# CONFIG_VIDEO_ADV7393 is not set
# CONFIG_VIDEO_AK881X is not set
# CONFIG_VIDEO_SAA7127 is not set
# CONFIG_VIDEO_SAA7185 is not set
# CONFIG_VIDEO_THS8200 is not set
# end of Video encoders

#
# Video improvement chips
#
# CONFIG_VIDEO_UPD64031A is not set
# CONFIG_VIDEO_UPD64083 is not set
# end of Video improvement chips

#
# Audio/Video compression chips
#
# CONFIG_VIDEO_SAA6752HS is not set
# end of Audio/Video compression chips

#
# SDR tuner chips
#
# CONFIG_SDR_MAX2175 is not set
# end of SDR tuner chips

#
# Miscellaneous helper chips
#
# CONFIG_VIDEO_I2C is not set
# CONFIG_VIDEO_M52790 is not set
# CONFIG_VIDEO_ST_MIPID02 is not set
# CONFIG_VIDEO_THS7303 is not set
# end of Miscellaneous helper chips

#
# Media SPI Adapters
#
CONFIG_CXD2880_SPI_DRV=m
# CONFIG_VIDEO_GS1662 is not set
# end of Media SPI Adapters

CONFIG_MEDIA_TUNER=m

#
# Customize TV tuners
#
CONFIG_MEDIA_TUNER_E4000=m
CONFIG_MEDIA_TUNER_FC0011=m
CONFIG_MEDIA_TUNER_FC0012=m
CONFIG_MEDIA_TUNER_FC0013=m
CONFIG_MEDIA_TUNER_FC2580=m
CONFIG_MEDIA_TUNER_IT913X=m
CONFIG_MEDIA_TUNER_M88RS6000T=m
CONFIG_MEDIA_TUNER_MAX2165=m
CONFIG_MEDIA_TUNER_MC44S803=m
CONFIG_MEDIA_TUNER_MSI001=m
CONFIG_MEDIA_TUNER_MT2060=m
CONFIG_MEDIA_TUNER_MT2063=m
CONFIG_MEDIA_TUNER_MT20XX=m
CONFIG_MEDIA_TUNER_MT2131=m
CONFIG_MEDIA_TUNER_MT2266=m
CONFIG_MEDIA_TUNER_MXL301RF=m
CONFIG_MEDIA_TUNER_MXL5005S=m
CONFIG_MEDIA_TUNER_MXL5007T=m
CONFIG_MEDIA_TUNER_QM1D1B0004=m
CONFIG_MEDIA_TUNER_QM1D1C0042=m
CONFIG_MEDIA_TUNER_QT1010=m
CONFIG_MEDIA_TUNER_R820T=m
CONFIG_MEDIA_TUNER_SI2157=m
CONFIG_MEDIA_TUNER_SIMPLE=m
CONFIG_MEDIA_TUNER_TDA18212=m
CONFIG_MEDIA_TUNER_TDA18218=m
CONFIG_MEDIA_TUNER_TDA18250=m
CONFIG_MEDIA_TUNER_TDA18271=m
CONFIG_MEDIA_TUNER_TDA827X=m
CONFIG_MEDIA_TUNER_TDA8290=m
CONFIG_MEDIA_TUNER_TDA9887=m
CONFIG_MEDIA_TUNER_TEA5761=m
CONFIG_MEDIA_TUNER_TEA5767=m
CONFIG_MEDIA_TUNER_TUA9001=m
CONFIG_MEDIA_TUNER_XC2028=m
CONFIG_MEDIA_TUNER_XC4000=m
CONFIG_MEDIA_TUNER_XC5000=m
# end of Customize TV tuners

#
# Customise DVB Frontends
#

#
# Multistandard (satellite) frontends
#
CONFIG_DVB_M88DS3103=m
CONFIG_DVB_MXL5XX=m
CONFIG_DVB_STB0899=m
CONFIG_DVB_STB6100=m
CONFIG_DVB_STV090x=m
CONFIG_DVB_STV0910=m
CONFIG_DVB_STV6110x=m
CONFIG_DVB_STV6111=m

#
# Multistandard (cable + terrestrial) frontends
#
CONFIG_DVB_DRXK=m
CONFIG_DVB_MN88472=m
CONFIG_DVB_MN88473=m
CONFIG_DVB_SI2165=m
CONFIG_DVB_TDA18271C2DD=m

#
# DVB-S (satellite) frontends
#
CONFIG_DVB_CX24110=m
CONFIG_DVB_CX24116=m
CONFIG_DVB_CX24117=m
CONFIG_DVB_CX24120=m
CONFIG_DVB_CX24123=m
CONFIG_DVB_DS3000=m
CONFIG_DVB_MB86A16=m
CONFIG_DVB_MT312=m
CONFIG_DVB_S5H1420=m
CONFIG_DVB_SI21XX=m
CONFIG_DVB_STB6000=m
CONFIG_DVB_STV0288=m
CONFIG_DVB_STV0299=m
CONFIG_DVB_STV0900=m
CONFIG_DVB_STV6110=m
CONFIG_DVB_TDA10071=m
CONFIG_DVB_TDA10086=m
CONFIG_DVB_TDA8083=m
CONFIG_DVB_TDA8261=m
CONFIG_DVB_TDA826X=m
CONFIG_DVB_TS2020=m
CONFIG_DVB_TUA6100=m
CONFIG_DVB_TUNER_CX24113=m
CONFIG_DVB_TUNER_ITD1000=m
CONFIG_DVB_VES1X93=m
CONFIG_DVB_ZL10036=m
CONFIG_DVB_ZL10039=m

#
# DVB-T (terrestrial) frontends
#
CONFIG_DVB_AF9013=m
CONFIG_DVB_CX22700=m
CONFIG_DVB_CX22702=m
CONFIG_DVB_CXD2820R=m
CONFIG_DVB_CXD2841ER=m
CONFIG_DVB_DIB3000MB=m
CONFIG_DVB_DIB3000MC=m
CONFIG_DVB_DIB7000M=m
CONFIG_DVB_DIB7000P=m
CONFIG_DVB_DIB9000=m
CONFIG_DVB_DRXD=m
CONFIG_DVB_EC100=m
CONFIG_DVB_L64781=m
CONFIG_DVB_MT352=m
CONFIG_DVB_NXT6000=m
CONFIG_DVB_RTL2830=m
CONFIG_DVB_RTL2832=m
CONFIG_DVB_RTL2832_SDR=m
CONFIG_DVB_S5H1432=m
CONFIG_DVB_SI2168=m
CONFIG_DVB_SP887X=m
CONFIG_DVB_STV0367=m
CONFIG_DVB_TDA10048=m
CONFIG_DVB_TDA1004X=m
CONFIG_DVB_ZD1301_DEMOD=m
CONFIG_DVB_ZL10353=m
CONFIG_DVB_CXD2880=m

#
# DVB-C (cable) frontends
#
CONFIG_DVB_STV0297=m
CONFIG_DVB_TDA10021=m
CONFIG_DVB_TDA10023=m
CONFIG_DVB_VES1820=m

#
# ATSC (North American/Korean Terrestrial/Cable DTV) frontends
#
CONFIG_DVB_AU8522=m
CONFIG_DVB_AU8522_DTV=m
CONFIG_DVB_AU8522_V4L=m
CONFIG_DVB_BCM3510=m
CONFIG_DVB_LG2160=m
CONFIG_DVB_LGDT3305=m
CONFIG_DVB_LGDT3306A=m
CONFIG_DVB_LGDT330X=m
CONFIG_DVB_MXL692=m
CONFIG_DVB_NXT200X=m
CONFIG_DVB_OR51132=m
CONFIG_DVB_OR51211=m
CONFIG_DVB_S5H1409=m
CONFIG_DVB_S5H1411=m

#
# ISDB-T (terrestrial) frontends
#
CONFIG_DVB_DIB8000=m
CONFIG_DVB_MB86A20S=m
CONFIG_DVB_S921=m

#
# ISDB-S (satellite) & ISDB-T (terrestrial) frontends
#
CONFIG_DVB_MN88443X=m
CONFIG_DVB_TC90522=m

#
# Digital terrestrial only tuners/PLL
#
CONFIG_DVB_PLL=m
CONFIG_DVB_TUNER_DIB0070=m
CONFIG_DVB_TUNER_DIB0090=m

#
# SEC control devices for DVB-S
#
CONFIG_DVB_A8293=m
CONFIG_DVB_AF9033=m
CONFIG_DVB_ASCOT2E=m
CONFIG_DVB_ATBM8830=m
CONFIG_DVB_HELENE=m
CONFIG_DVB_HORUS3A=m
CONFIG_DVB_ISL6405=m
CONFIG_DVB_ISL6421=m
CONFIG_DVB_ISL6423=m
CONFIG_DVB_IX2505V=m
CONFIG_DVB_LGS8GL5=m
CONFIG_DVB_LGS8GXX=m
CONFIG_DVB_LNBH25=m
CONFIG_DVB_LNBH29=m
CONFIG_DVB_LNBP21=m
CONFIG_DVB_LNBP22=m
CONFIG_DVB_M88RS2000=m
CONFIG_DVB_TDA665x=m
CONFIG_DVB_DRX39XYJ=m

#
# Common Interface (EN50221) controller drivers
#
CONFIG_DVB_CXD2099=m
CONFIG_DVB_SP2=m
# end of Customise DVB Frontends

#
# Tools to develop new frontends
#
# CONFIG_DVB_DUMMY_FE is not set
# end of Media ancillary drivers

#
# Graphics support
#
CONFIG_APERTURE_HELPERS=y
CONFIG_TEGRA_HOST1X_CONTEXT_BUS=y
CONFIG_TEGRA_HOST1X=y
CONFIG_TEGRA_HOST1X_FIREWALL=y
CONFIG_IMX_IPUV3_CORE=m
CONFIG_DRM=y
CONFIG_DRM_MIPI_DSI=y
# CONFIG_DRM_DEBUG_MM is not set
CONFIG_DRM_KMS_HELPER=y
# CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS is not set
# CONFIG_DRM_DEBUG_MODESET_LOCK is not set
CONFIG_DRM_FBDEV_EMULATION=y
CONFIG_DRM_FBDEV_OVERALLOC=100
# CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
CONFIG_DRM_DP_AUX_BUS=y
CONFIG_DRM_DISPLAY_HELPER=y
CONFIG_DRM_DISPLAY_DP_HELPER=y
CONFIG_DRM_DISPLAY_HDMI_HELPER=y
# CONFIG_DRM_DP_AUX_CHARDEV is not set
# CONFIG_DRM_DP_CEC is not set
CONFIG_DRM_TTM=m
CONFIG_DRM_TTM_HELPER=m
CONFIG_DRM_GEM_DMA_HELPER=m
CONFIG_DRM_GEM_SHMEM_HELPER=m
CONFIG_DRM_SCHED=m

#
# I2C encoder or helper chips
#
# CONFIG_DRM_I2C_CH7006 is not set
# CONFIG_DRM_I2C_SIL164 is not set
CONFIG_DRM_I2C_NXP_TDA998X=m
# CONFIG_DRM_I2C_NXP_TDA9950 is not set
# end of I2C encoder or helper chips

#
# ARM devices
#
# CONFIG_DRM_HDLCD is not set
# CONFIG_DRM_MALI_DISPLAY is not set
# CONFIG_DRM_KOMEDA is not set
# end of ARM devices

# CONFIG_DRM_RADEON is not set
# CONFIG_DRM_AMDGPU is not set
CONFIG_DRM_NOUVEAU=m
CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT=y
CONFIG_NOUVEAU_PLATFORM_DRIVER=y
CONFIG_NOUVEAU_DEBUG=5
CONFIG_NOUVEAU_DEBUG_DEFAULT=3
# CONFIG_NOUVEAU_DEBUG_MMU is not set
# CONFIG_NOUVEAU_DEBUG_PUSH is not set
CONFIG_DRM_NOUVEAU_BACKLIGHT=y
# CONFIG_DRM_VGEM is not set
# CONFIG_DRM_VKMS is not set
CONFIG_DRM_EXYNOS=m

#
# CRTCs
#
CONFIG_DRM_EXYNOS_FIMD=y
# CONFIG_DRM_EXYNOS5433_DECON is not set
# CONFIG_DRM_EXYNOS7_DECON is not set
CONFIG_DRM_EXYNOS_MIXER=y
# CONFIG_DRM_EXYNOS_VIDI is not set

#
# Encoders and Bridges
#
CONFIG_DRM_EXYNOS_DPI=y
CONFIG_DRM_EXYNOS_DSI=y
CONFIG_DRM_EXYNOS_DP=y
CONFIG_DRM_EXYNOS_HDMI=y

#
# Sub-drivers
#
# CONFIG_DRM_EXYNOS_G2D is not set
# CONFIG_DRM_EXYNOS_FIMC is not set
# CONFIG_DRM_EXYNOS_ROTATOR is not set
# CONFIG_DRM_EXYNOS_SCALER is not set
CONFIG_DRM_ROCKCHIP=m
CONFIG_ROCKCHIP_VOP=y
# CONFIG_ROCKCHIP_VOP2 is not set
CONFIG_ROCKCHIP_ANALOGIX_DP=y
# CONFIG_ROCKCHIP_CDN_DP is not set
CONFIG_ROCKCHIP_DW_HDMI=y
CONFIG_ROCKCHIP_DW_MIPI_DSI=y
CONFIG_ROCKCHIP_INNO_HDMI=y
# CONFIG_ROCKCHIP_LVDS is not set
# CONFIG_ROCKCHIP_RGB is not set
# CONFIG_ROCKCHIP_RK3066_HDMI is not set
# CONFIG_DRM_UDL is not set
# CONFIG_DRM_AST is not set
# CONFIG_DRM_MGAG200 is not set
# CONFIG_DRM_ARMADA is not set
CONFIG_DRM_ATMEL_HLCDC=m
CONFIG_DRM_RCAR_DU=m
CONFIG_DRM_RCAR_USE_CMM=y
CONFIG_DRM_RCAR_CMM=m
# CONFIG_DRM_RCAR_DW_HDMI is not set
CONFIG_DRM_RCAR_USE_LVDS=y
CONFIG_DRM_RCAR_LVDS=m
# CONFIG_DRM_RCAR_MIPI_DSI is not set
# CONFIG_DRM_RCAR_VSP is not set
CONFIG_DRM_SUN4I=m
CONFIG_DRM_SUN4I_HDMI=m
# CONFIG_DRM_SUN4I_HDMI_CEC is not set
CONFIG_DRM_SUN4I_BACKEND=m
CONFIG_DRM_SUN6I_DSI=m
CONFIG_DRM_SUN8I_DW_HDMI=m
CONFIG_DRM_SUN8I_MIXER=m
CONFIG_DRM_SUN8I_TCON_TOP=m
# CONFIG_DRM_OMAP is not set
# CONFIG_DRM_TILCDC is not set
# CONFIG_DRM_QXL is not set
# CONFIG_DRM_VIRTIO_GPU is not set
CONFIG_DRM_MSM=m
CONFIG_DRM_MSM_GPU_STATE=y
# CONFIG_DRM_MSM_GPU_SUDO is not set
CONFIG_DRM_MSM_MDSS=y
CONFIG_DRM_MSM_MDP4=y
CONFIG_DRM_MSM_MDP5=y
CONFIG_DRM_MSM_DPU=y
CONFIG_DRM_MSM_DP=y
CONFIG_DRM_MSM_DSI=y
CONFIG_DRM_MSM_DSI_28NM_PHY=y
CONFIG_DRM_MSM_DSI_20NM_PHY=y
CONFIG_DRM_MSM_DSI_28NM_8960_PHY=y
CONFIG_DRM_MSM_DSI_14NM_PHY=y
CONFIG_DRM_MSM_DSI_10NM_PHY=y
CONFIG_DRM_MSM_DSI_7NM_PHY=y
CONFIG_DRM_MSM_HDMI=y
CONFIG_DRM_MSM_HDMI_HDCP=y
CONFIG_DRM_FSL_DCU=m
CONFIG_DRM_TEGRA=y
# CONFIG_DRM_TEGRA_DEBUG is not set
# CONFIG_DRM_TEGRA_STAGING is not set
CONFIG_DRM_STM=m
CONFIG_DRM_STM_DSI=m
CONFIG_DRM_PANEL=y

#
# Display Panels
#
# CONFIG_DRM_PANEL_ABT_Y030XX067A is not set
# CONFIG_DRM_PANEL_ARM_VERSATILE is not set
# CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596 is not set
# CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0 is not set
# CONFIG_DRM_PANEL_BOE_HIMAX8279D is not set
# CONFIG_DRM_PANEL_BOE_TV101WUM_NL6 is not set
# CONFIG_DRM_PANEL_DSI_CM is not set
CONFIG_DRM_PANEL_LVDS=m
CONFIG_DRM_PANEL_SIMPLE=y
CONFIG_DRM_PANEL_EDP=y
# CONFIG_DRM_PANEL_EBBG_FT8719 is not set
# CONFIG_DRM_PANEL_ELIDA_KD35T133 is not set
# CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02 is not set
# CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D is not set
# CONFIG_DRM_PANEL_ILITEK_IL9322 is not set
# CONFIG_DRM_PANEL_ILITEK_ILI9341 is not set
# CONFIG_DRM_PANEL_ILITEK_ILI9881C is not set
# CONFIG_DRM_PANEL_INNOLUX_EJ030NA is not set
# CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set
# CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set
# CONFIG_DRM_PANEL_JDI_R63452 is not set
# CONFIG_DRM_PANEL_KHADAS_TS050 is not set
# CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04 is not set
# CONFIG_DRM_PANEL_LEADTEK_LTK050H3146W is not set
# CONFIG_DRM_PANEL_LEADTEK_LTK500HD1829 is not set
CONFIG_DRM_PANEL_SAMSUNG_LD9040=m
# CONFIG_DRM_PANEL_LG_LB035Q02 is not set
# CONFIG_DRM_PANEL_LG_LG4573 is not set
# CONFIG_DRM_PANEL_NEC_NL8048HL11 is not set
# CONFIG_DRM_PANEL_NEWVISION_NV3052C is not set
# CONFIG_DRM_PANEL_NOVATEK_NT35510 is not set
# CONFIG_DRM_PANEL_NOVATEK_NT35560 is not set
# CONFIG_DRM_PANEL_NOVATEK_NT35950 is not set
# CONFIG_DRM_PANEL_NOVATEK_NT36672A is not set
# CONFIG_DRM_PANEL_NOVATEK_NT39016 is not set
# CONFIG_DRM_PANEL_MANTIX_MLAF057WE51 is not set
# CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO is not set
CONFIG_DRM_PANEL_ORISETECH_OTM8009A=m
# CONFIG_DRM_PANEL_OSD_OSD101T2587_53TS is not set
# CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set
# CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set
# CONFIG_DRM_PANEL_RAYDIUM_RM67191 is not set
CONFIG_DRM_PANEL_RAYDIUM_RM68200=m
# CONFIG_DRM_PANEL_RONBO_RB070D30 is not set
# CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20 is not set
# CONFIG_DRM_PANEL_SAMSUNG_DB7430 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6D16D0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6D27A1 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set
CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03=m
# CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 is not set
CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=m
# CONFIG_DRM_PANEL_SAMSUNG_SOFEF00 is not set
# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set
CONFIG_DRM_PANEL_SHARP_LQ101R1SX01=m
# CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set
# CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set
# CONFIG_DRM_PANEL_SHARP_LS060T1SX01 is not set
# CONFIG_DRM_PANEL_SITRONIX_ST7701 is not set
# CONFIG_DRM_PANEL_SITRONIX_ST7703 is not set
# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set
# CONFIG_DRM_PANEL_SONY_ACX565AKM is not set
# CONFIG_DRM_PANEL_SONY_TULIP_TRULY_NT35521 is not set
# CONFIG_DRM_PANEL_TDO_TL070WSH30 is not set
# CONFIG_DRM_PANEL_TPO_TD028TTEC1 is not set
# CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set
# CONFIG_DRM_PANEL_TPO_TPG110 is not set
# CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA is not set
# CONFIG_DRM_PANEL_VISIONOX_RM69299 is not set
# CONFIG_DRM_PANEL_WIDECHIPS_WS2401 is not set
# CONFIG_DRM_PANEL_XINPENG_XPP055C272 is not set
# end of Display Panels

CONFIG_DRM_BRIDGE=y
CONFIG_DRM_PANEL_BRIDGE=y

#
# Display Interface Bridges
#
# CONFIG_DRM_CDNS_DSI is not set
# CONFIG_DRM_CHIPONE_ICN6211 is not set
# CONFIG_DRM_CHRONTEL_CH7033 is not set
# CONFIG_DRM_CROS_EC_ANX7688 is not set
CONFIG_DRM_DISPLAY_CONNECTOR=m
# CONFIG_DRM_FSL_LDB is not set
# CONFIG_DRM_ITE_IT6505 is not set
# CONFIG_DRM_LONTIUM_LT8912B is not set
# CONFIG_DRM_LONTIUM_LT9211 is not set
# CONFIG_DRM_LONTIUM_LT9611 is not set
# CONFIG_DRM_LONTIUM_LT9611UXC is not set
# CONFIG_DRM_ITE_IT66121 is not set
CONFIG_DRM_LVDS_CODEC=m
# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set
# CONFIG_DRM_NWL_MIPI_DSI is not set
CONFIG_DRM_NXP_PTN3460=m
CONFIG_DRM_PARADE_PS8622=m
# CONFIG_DRM_PARADE_PS8640 is not set
# CONFIG_DRM_SIL_SII8620 is not set
CONFIG_DRM_SII902X=m
CONFIG_DRM_SII9234=m
CONFIG_DRM_SIMPLE_BRIDGE=m
# CONFIG_DRM_THINE_THC63LVD1024 is not set
# CONFIG_DRM_TOSHIBA_TC358762 is not set
CONFIG_DRM_TOSHIBA_TC358764=m
# CONFIG_DRM_TOSHIBA_TC358767 is not set
CONFIG_DRM_TOSHIBA_TC358768=m
# CONFIG_DRM_TOSHIBA_TC358775 is not set
# CONFIG_DRM_TI_DLPC3433 is not set
# CONFIG_DRM_TI_TFP410 is not set
# CONFIG_DRM_TI_SN65DSI83 is not set
# CONFIG_DRM_TI_SN65DSI86 is not set
# CONFIG_DRM_TI_TPD12S015 is not set
# CONFIG_DRM_ANALOGIX_ANX6345 is not set
# CONFIG_DRM_ANALOGIX_ANX78XX is not set
CONFIG_DRM_ANALOGIX_DP=m
# CONFIG_DRM_ANALOGIX_ANX7625 is not set
CONFIG_DRM_I2C_ADV7511=m
CONFIG_DRM_I2C_ADV7511_AUDIO=y
CONFIG_DRM_I2C_ADV7511_CEC=y
# CONFIG_DRM_CDNS_MHDP8546 is not set
# CONFIG_DRM_IMX8QM_LDB is not set
# CONFIG_DRM_IMX8QXP_LDB is not set
# CONFIG_DRM_IMX8QXP_PIXEL_COMBINER is not set
# CONFIG_DRM_IMX8QXP_PIXEL_LINK_TO_DPI is not set
CONFIG_DRM_DW_HDMI=m
# CONFIG_DRM_DW_HDMI_AHB_AUDIO is not set
# CONFIG_DRM_DW_HDMI_I2S_AUDIO is not set
# CONFIG_DRM_DW_HDMI_GP_AUDIO is not set
# CONFIG_DRM_DW_HDMI_CEC is not set
CONFIG_DRM_DW_MIPI_DSI=m
# end of Display Interface Bridges

CONFIG_DRM_STI=m
CONFIG_DRM_IMX=m
CONFIG_DRM_IMX_PARALLEL_DISPLAY=m
CONFIG_DRM_IMX_TVE=m
CONFIG_DRM_IMX_LDB=m
CONFIG_DRM_IMX_HDMI=m
CONFIG_DRM_V3D=m
CONFIG_DRM_VC4=m
# CONFIG_DRM_VC4_HDMI_CEC is not set
CONFIG_DRM_ETNAVIV=m
CONFIG_DRM_ETNAVIV_THERMAL=y
# CONFIG_DRM_LOGICVC is not set
# CONFIG_DRM_MEDIATEK is not set
CONFIG_DRM_MXS=y
CONFIG_DRM_MXSFB=m
# CONFIG_DRM_IMX_LCDIF is not set
# CONFIG_DRM_MESON is not set
# CONFIG_DRM_ARCPGU is not set
# CONFIG_DRM_BOCHS is not set
# CONFIG_DRM_CIRRUS_QEMU is not set
# CONFIG_DRM_GM12U320 is not set
# CONFIG_DRM_PANEL_MIPI_DBI is not set
# CONFIG_DRM_SIMPLEDRM is not set
# CONFIG_TINYDRM_HX8357D is not set
# CONFIG_TINYDRM_ILI9163 is not set
# CONFIG_TINYDRM_ILI9225 is not set
# CONFIG_TINYDRM_ILI9341 is not set
# CONFIG_TINYDRM_ILI9486 is not set
# CONFIG_TINYDRM_MI0283QT is not set
# CONFIG_TINYDRM_REPAPER is not set
# CONFIG_TINYDRM_ST7586 is not set
# CONFIG_TINYDRM_ST7735R is not set
CONFIG_DRM_PL111=m
# CONFIG_DRM_TVE200 is not set
CONFIG_DRM_LIMA=m
CONFIG_DRM_PANFROST=m
CONFIG_DRM_ASPEED_GFX=m
# CONFIG_DRM_MCDE is not set
# CONFIG_DRM_TIDSS is not set
# CONFIG_DRM_GUD is not set
# CONFIG_DRM_SSD130X is not set
CONFIG_DRM_LEGACY=y
# CONFIG_DRM_TDFX is not set
# CONFIG_DRM_R128 is not set
# CONFIG_DRM_MGA is not set
# CONFIG_DRM_VIA is not set
# CONFIG_DRM_SAVAGE is not set
CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
CONFIG_DRM_NOMODESET=y

#
# Frame buffer Devices
#
CONFIG_FB_CMDLINE=y
CONFIG_FB_NOTIFY=y
CONFIG_FB=y
# CONFIG_FIRMWARE_EDID is not set
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA=y
# CONFIG_FB_FOREIGN_ENDIAN is not set
CONFIG_FB_SYS_FOPS=y
CONFIG_FB_DEFERRED_IO=y
CONFIG_FB_BACKLIGHT=y
CONFIG_FB_MODE_HELPERS=y
# CONFIG_FB_TILEBLITTING is not set

#
# Frame buffer hardware drivers
#
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_ARMCLCD is not set
# CONFIG_FB_IMX is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ASILIANT is not set
# CONFIG_FB_IMSTT is not set
CONFIG_FB_EFI=y
# CONFIG_FB_OPENCORES is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_I740 is not set
# CONFIG_FB_MATROX is not set
# CONFIG_FB_RADEON is not set
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
# CONFIG_FB_S3 is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_VT8623 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_CARMINE is not set
# CONFIG_FB_VT8500 is not set
CONFIG_FB_WM8505=y
# CONFIG_FB_WMT_GE_ROPS is not set
CONFIG_FB_SH_MOBILE_LCDC=y
# CONFIG_FB_SMSCUFX is not set
# CONFIG_FB_UDL is not set
# CONFIG_FB_IBM_GXT4500 is not set
# CONFIG_FB_XILINX is not set
# CONFIG_FB_DA8XX is not set
# CONFIG_FB_VIRTUAL is not set
# CONFIG_FB_METRONOME is not set
# CONFIG_FB_MB862XX is not set
CONFIG_FB_MX3=y
CONFIG_FB_SIMPLE=y
# CONFIG_FB_SSD1307 is not set
# CONFIG_FB_SM712 is not set
# CONFIG_FB_OMAP2 is not set
# end of Frame buffer Devices

#
# Backlight & LCD device support
#
# CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_KTD253 is not set
CONFIG_BACKLIGHT_PWM=y
# CONFIG_BACKLIGHT_QCOM_WLED is not set
# CONFIG_BACKLIGHT_ADP8860 is not set
# CONFIG_BACKLIGHT_ADP8870 is not set
# CONFIG_BACKLIGHT_LM3630A is not set
# CONFIG_BACKLIGHT_LM3639 is not set
# CONFIG_BACKLIGHT_LP855X is not set
# CONFIG_BACKLIGHT_PANDORA is not set
# CONFIG_BACKLIGHT_TPS65217 is not set
CONFIG_BACKLIGHT_AS3711=y
CONFIG_BACKLIGHT_GPIO=y
# CONFIG_BACKLIGHT_LV5207LP is not set
# CONFIG_BACKLIGHT_BD6107 is not set
# CONFIG_BACKLIGHT_ARCXCNN is not set
# CONFIG_BACKLIGHT_LED is not set
# end of Backlight & LCD device support

CONFIG_VIDEOMODE_HELPERS=y
CONFIG_HDMI=y

#
# Console display driver support
#
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set
# end of Console display driver support

# CONFIG_LOGO is not set
# end of Graphics support

CONFIG_SOUND=m
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
CONFIG_SND_PCM_ELD=y
CONFIG_SND_PCM_IEC958=y
CONFIG_SND_DMAENGINE_PCM=m
CONFIG_SND_HWDEP=m
CONFIG_SND_RAWMIDI=m
CONFIG_SND_JACK=y
CONFIG_SND_JACK_INPUT_DEV=y
# CONFIG_SND_OSSEMUL is not set
CONFIG_SND_PCM_TIMER=y
# CONFIG_SND_HRTIMER is not set
CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_MAX_CARDS=32
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_PROC_FS=y
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_VERBOSE_PRINTK is not set
CONFIG_SND_CTL_FAST_LOOKUP=y
# CONFIG_SND_DEBUG is not set
# CONFIG_SND_CTL_INPUT_VALIDATION is not set
CONFIG_SND_VMASTER=y
CONFIG_SND_CTL_LED=m
# CONFIG_SND_SEQUENCER is not set
CONFIG_SND_AC97_CODEC=m
CONFIG_SND_DRIVERS=y
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_ALOOP is not set
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_SERIAL_GENERIC is not set
# CONFIG_SND_MPU401 is not set
# CONFIG_SND_AC97_POWER_SAVE is not set
CONFIG_SND_PCI=y
# CONFIG_SND_AD1889 is not set
# CONFIG_SND_ALS300 is not set
# CONFIG_SND_ALI5451 is not set
# CONFIG_SND_ATIIXP is not set
# CONFIG_SND_ATIIXP_MODEM is not set
# CONFIG_SND_AU8810 is not set
# CONFIG_SND_AU8820 is not set
# CONFIG_SND_AU8830 is not set
# CONFIG_SND_AW2 is not set
# CONFIG_SND_AZT3328 is not set
# CONFIG_SND_BT87X is not set
# CONFIG_SND_CA0106 is not set
# CONFIG_SND_CMIPCI is not set
# CONFIG_SND_OXYGEN is not set
# CONFIG_SND_CS4281 is not set
# CONFIG_SND_CS46XX is not set
# CONFIG_SND_CTXFI is not set
# CONFIG_SND_DARLA20 is not set
# CONFIG_SND_GINA20 is not set
# CONFIG_SND_LAYLA20 is not set
# CONFIG_SND_DARLA24 is not set
# CONFIG_SND_GINA24 is not set
# CONFIG_SND_LAYLA24 is not set
# CONFIG_SND_MONA is not set
# CONFIG_SND_MIA is not set
# CONFIG_SND_ECHO3G is not set
# CONFIG_SND_INDIGO is not set
# CONFIG_SND_INDIGOIO is not set
# CONFIG_SND_INDIGODJ is not set
# CONFIG_SND_INDIGOIOX is not set
# CONFIG_SND_INDIGODJX is not set
# CONFIG_SND_EMU10K1 is not set
# CONFIG_SND_EMU10K1X is not set
# CONFIG_SND_ENS1370 is not set
# CONFIG_SND_ENS1371 is not set
# CONFIG_SND_ES1938 is not set
# CONFIG_SND_ES1968 is not set
# CONFIG_SND_FM801 is not set
# CONFIG_SND_HDSP is not set
# CONFIG_SND_HDSPM is not set
# CONFIG_SND_ICE1712 is not set
# CONFIG_SND_ICE1724 is not set
# CONFIG_SND_INTEL8X0 is not set
# CONFIG_SND_INTEL8X0M is not set
# CONFIG_SND_KORG1212 is not set
# CONFIG_SND_LOLA is not set
# CONFIG_SND_MAESTRO3 is not set
# CONFIG_SND_MIXART is not set
# CONFIG_SND_NM256 is not set
# CONFIG_SND_PCXHR is not set
# CONFIG_SND_RIPTIDE is not set
# CONFIG_SND_RME32 is not set
# CONFIG_SND_RME96 is not set
# CONFIG_SND_RME9652 is not set
# CONFIG_SND_SE6X is not set
# CONFIG_SND_SONICVIBES is not set
# CONFIG_SND_TRIDENT is not set
# CONFIG_SND_VIA82XX is not set
# CONFIG_SND_VIA82XX_MODEM is not set
# CONFIG_SND_VIRTUOSO is not set
# CONFIG_SND_VX222 is not set
# CONFIG_SND_YMFPCI is not set

#
# HD-Audio
#
CONFIG_SND_HDA=m
CONFIG_SND_HDA_GENERIC_LEDS=y
# CONFIG_SND_HDA_INTEL is not set
CONFIG_SND_HDA_TEGRA=m
# CONFIG_SND_HDA_HWDEP is not set
CONFIG_SND_HDA_RECONFIG=y
CONFIG_SND_HDA_INPUT_BEEP=y
CONFIG_SND_HDA_INPUT_BEEP_MODE=1
CONFIG_SND_HDA_PATCH_LOADER=y
CONFIG_SND_HDA_CODEC_REALTEK=m
# CONFIG_SND_HDA_CODEC_ANALOG is not set
# CONFIG_SND_HDA_CODEC_SIGMATEL is not set
# CONFIG_SND_HDA_CODEC_VIA is not set
CONFIG_SND_HDA_CODEC_HDMI=m
# CONFIG_SND_HDA_CODEC_CIRRUS is not set
# CONFIG_SND_HDA_CODEC_CS8409 is not set
# CONFIG_SND_HDA_CODEC_CONEXANT is not set
# CONFIG_SND_HDA_CODEC_CA0110 is not set
# CONFIG_SND_HDA_CODEC_CA0132 is not set
# CONFIG_SND_HDA_CODEC_CMEDIA is not set
# CONFIG_SND_HDA_CODEC_SI3054 is not set
CONFIG_SND_HDA_GENERIC=m
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
# end of HD-Audio

CONFIG_SND_HDA_CORE=m
CONFIG_SND_HDA_ALIGNED_MMIO=y
CONFIG_SND_HDA_COMPONENT=y
CONFIG_SND_HDA_PREALLOC_SIZE=64
CONFIG_SND_ARM=y
# CONFIG_SND_ARMAACI is not set
CONFIG_SND_PXA2XX_LIB=m

#
# Atmel devices (AT91)
#
# CONFIG_SND_ATMEL_AC97C is not set
# end of Atmel devices (AT91)

CONFIG_SND_SPI=y
# CONFIG_SND_AT73C213 is not set
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=m
CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER=y
# CONFIG_SND_USB_UA101 is not set
# CONFIG_SND_USB_CAIAQ is not set
# CONFIG_SND_USB_6FIRE is not set
# CONFIG_SND_USB_HIFACE is not set
# CONFIG_SND_BCD2000 is not set
# CONFIG_SND_USB_POD is not set
# CONFIG_SND_USB_PODHD is not set
# CONFIG_SND_USB_TONEPORT is not set
# CONFIG_SND_USB_VARIAX is not set
CONFIG_SND_SOC=m
CONFIG_SND_SOC_AC97_BUS=y
CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
# CONFIG_SND_SOC_ADI is not set
# CONFIG_SND_SOC_AMD_ACP is not set
# CONFIG_SND_AMD_ACP_CONFIG is not set
CONFIG_SND_ATMEL_SOC=m
CONFIG_SND_ATMEL_SOC_PDC=y
CONFIG_SND_ATMEL_SOC_DMA=y
CONFIG_SND_ATMEL_SOC_SSC=m
# CONFIG_SND_ATMEL_SOC_SSC_PDC is not set
CONFIG_SND_ATMEL_SOC_SSC_DMA=m
# CONFIG_SND_AT91_SOC_SAM9G20_WM8731 is not set
CONFIG_SND_ATMEL_SOC_WM8904=m
# CONFIG_SND_AT91_SOC_SAM9X5_WM8731 is not set
# CONFIG_SND_ATMEL_SOC_CLASSD is not set
CONFIG_SND_ATMEL_SOC_PDMIC=m
# CONFIG_SND_ATMEL_SOC_TSE850_PCM5142 is not set
CONFIG_SND_ATMEL_SOC_I2S=m
# CONFIG_SND_SOC_MIKROE_PROTO is not set
# CONFIG_SND_MCHP_SOC_I2S_MCC is not set
# CONFIG_SND_MCHP_SOC_SPDIFTX is not set
# CONFIG_SND_MCHP_SOC_SPDIFRX is not set
# CONFIG_SND_MCHP_SOC_PDMC is not set
CONFIG_SND_BCM2835_SOC_I2S=m
# CONFIG_SND_SOC_CYGNUS is not set
# CONFIG_SND_BCM63XX_I2S_WHISTLER is not set
# CONFIG_SND_DESIGNWARE_I2S is not set

#
# SoC Audio for Freescale CPUs
#

#
# Common SoC Audio options for Freescale CPUs:
#
# CONFIG_SND_SOC_FSL_ASRC is not set
CONFIG_SND_SOC_FSL_SAI=m
# CONFIG_SND_SOC_FSL_MQS is not set
# CONFIG_SND_SOC_FSL_AUDMIX is not set
CONFIG_SND_SOC_FSL_SSI=m
# CONFIG_SND_SOC_FSL_SPDIF is not set
CONFIG_SND_SOC_FSL_ESAI=m
# CONFIG_SND_SOC_FSL_MICFIL is not set
# CONFIG_SND_SOC_FSL_XCVR is not set
# CONFIG_SND_SOC_FSL_AUD2HTX is not set
CONFIG_SND_SOC_FSL_UTILS=m
# CONFIG_SND_SOC_FSL_RPMSG is not set
CONFIG_SND_SOC_IMX_PCM_DMA=m
CONFIG_SND_SOC_IMX_AUDMUX=m
CONFIG_SND_IMX_SOC=m
CONFIG_SND_SOC_IMX_PCM_FIQ=m

#
# SoC Audio support for Freescale i.MX boards:
#
# CONFIG_SND_SOC_EUKREA_TLV320 is not set
# CONFIG_SND_SOC_IMX_ES8328 is not set
# CONFIG_SND_SOC_IMX_SGTL5000 is not set
# CONFIG_SND_SOC_IMX_SPDIF is not set
CONFIG_SND_SOC_FSL_ASOC_CARD=m
# CONFIG_SND_SOC_IMX_AUDMIX is not set
# CONFIG_SND_SOC_IMX_HDMI is not set
# CONFIG_SND_SOC_IMX_RPMSG is not set
# CONFIG_SND_SOC_IMX_CARD is not set
# end of SoC Audio for Freescale CPUs

# CONFIG_SND_I2S_HI6210_I2S is not set
# CONFIG_SND_KIRKWOOD_SOC is not set
# CONFIG_SND_SOC_IMG is not set
# CONFIG_SND_SOC_MT2701 is not set
# CONFIG_SND_SOC_MT6797 is not set
# CONFIG_SND_SOC_MT8173 is not set
# CONFIG_SND_SOC_MT8183 is not set
# CONFIG_SND_SOC_MT8186 is not set
# CONFIG_SND_SOC_MTK_BTCVSD is not set
# CONFIG_SND_SOC_MT8192 is not set
# CONFIG_SND_SOC_MT8195 is not set

#
# ASoC support for Amlogic platforms
#
# CONFIG_SND_MESON_AIU is not set
# CONFIG_SND_MESON_AXG_FRDDR is not set
# CONFIG_SND_MESON_AXG_TODDR is not set
# CONFIG_SND_MESON_AXG_TDMIN is not set
# CONFIG_SND_MESON_AXG_TDMOUT is not set
# CONFIG_SND_MESON_AXG_SOUND_CARD is not set
# CONFIG_SND_MESON_AXG_SPDIFOUT is not set
# CONFIG_SND_MESON_AXG_SPDIFIN is not set
# CONFIG_SND_MESON_AXG_PDM is not set
# CONFIG_SND_MESON_GX_SOUND_CARD is not set
# CONFIG_SND_MESON_G12A_TOACODEC is not set
# CONFIG_SND_MESON_G12A_TOHDMITX is not set
# CONFIG_SND_SOC_MESON_T9015 is not set
# end of ASoC support for Amlogic platforms

CONFIG_SND_PXA_SOC_SSP=m
CONFIG_SND_MMP_SOC_SSPA=m
CONFIG_SND_PXA910_SOC=m
CONFIG_SND_SOC_QCOM=m
CONFIG_SND_SOC_LPASS_CPU=m
CONFIG_SND_SOC_LPASS_PLATFORM=m
CONFIG_SND_SOC_LPASS_APQ8016=m
# CONFIG_SND_SOC_STORM is not set
CONFIG_SND_SOC_APQ8016_SBC=m
CONFIG_SND_SOC_QCOM_COMMON=m
# CONFIG_SND_SOC_SC7180 is not set
CONFIG_SND_SOC_ROCKCHIP=m
CONFIG_SND_SOC_ROCKCHIP_I2S=m
# CONFIG_SND_SOC_ROCKCHIP_I2S_TDM is not set
# CONFIG_SND_SOC_ROCKCHIP_PDM is not set
CONFIG_SND_SOC_ROCKCHIP_SPDIF=m
CONFIG_SND_SOC_ROCKCHIP_MAX98090=m
CONFIG_SND_SOC_ROCKCHIP_RT5645=m
# CONFIG_SND_SOC_RK3288_HDMI_ANALOG is not set
# CONFIG_SND_SOC_RK3399_GRU_SOUND is not set
CONFIG_SND_SOC_SAMSUNG=m
CONFIG_SND_SAMSUNG_PCM=m
# CONFIG_SND_SAMSUNG_SPDIF is not set
CONFIG_SND_SAMSUNG_I2S=m
CONFIG_SND_SOC_SAMSUNG_SMDK_WM8994=m
# CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF is not set
CONFIG_SND_SOC_SMDK_WM8994_PCM=m
CONFIG_SND_SOC_SNOW=m
CONFIG_SND_SOC_ODROID=m
CONFIG_SND_SOC_ARNDALE=m
# CONFIG_SND_SOC_SAMSUNG_ARIES_WM8994 is not set
CONFIG_SND_SOC_SAMSUNG_MIDAS_WM1811=m

#
# SoC Audio support for Renesas SoCs
#
CONFIG_SND_SOC_SH4_FSI=m
CONFIG_SND_SOC_RCAR=m
# end of SoC Audio support for Renesas SoCs

# CONFIG_SND_SOC_SOF_TOPLEVEL is not set
CONFIG_SND_SOC_STI=m

#
# STMicroelectronics STM32 SOC audio support
#
CONFIG_SND_SOC_STM32_SAI=m
CONFIG_SND_SOC_STM32_I2S=m
CONFIG_SND_SOC_STM32_SPDIFRX=m
CONFIG_SND_SOC_STM32_DFSDM=m
# end of STMicroelectronics STM32 SOC audio support

#
# Allwinner SoC Audio support
#
CONFIG_SND_SUN4I_CODEC=m
# CONFIG_SND_SUN8I_CODEC is not set
# CONFIG_SND_SUN8I_CODEC_ANALOG is not set
# CONFIG_SND_SUN4I_I2S is not set
# CONFIG_SND_SUN4I_SPDIF is not set
# CONFIG_SND_SUN50I_DMIC is not set
# end of Allwinner SoC Audio support

CONFIG_SND_SOC_TEGRA=m
CONFIG_SND_SOC_TEGRA20_AC97=m
CONFIG_SND_SOC_TEGRA20_DAS=m
CONFIG_SND_SOC_TEGRA20_I2S=m
CONFIG_SND_SOC_TEGRA20_SPDIF=m
CONFIG_SND_SOC_TEGRA30_AHUB=m
CONFIG_SND_SOC_TEGRA30_I2S=m
# CONFIG_SND_SOC_TEGRA210_AHUB is not set
# CONFIG_SND_SOC_TEGRA210_DMIC is not set
# CONFIG_SND_SOC_TEGRA210_I2S is not set
# CONFIG_SND_SOC_TEGRA210_OPE is not set
# CONFIG_SND_SOC_TEGRA186_ASRC is not set
# CONFIG_SND_SOC_TEGRA186_DSPK is not set
# CONFIG_SND_SOC_TEGRA210_ADMAIF is not set
# CONFIG_SND_SOC_TEGRA210_MVC is not set
# CONFIG_SND_SOC_TEGRA210_SFC is not set
# CONFIG_SND_SOC_TEGRA210_AMX is not set
# CONFIG_SND_SOC_TEGRA210_ADX is not set
# CONFIG_SND_SOC_TEGRA210_MIXER is not set
# CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD is not set
CONFIG_SND_SOC_TEGRA_MACHINE_DRV=m
CONFIG_SND_SOC_TEGRA_RT5640=m
CONFIG_SND_SOC_TEGRA_WM8753=m
CONFIG_SND_SOC_TEGRA_WM8903=m
CONFIG_SND_SOC_TEGRA_WM9712=m
CONFIG_SND_SOC_TEGRA_TRIMSLICE=m
CONFIG_SND_SOC_TEGRA_ALC5632=m
CONFIG_SND_SOC_TEGRA_MAX98090=m
# CONFIG_SND_SOC_TEGRA_RT5677 is not set
# CONFIG_SND_SOC_TEGRA_SGTL5000 is not set

#
# Audio support for Texas Instruments SoCs
#
CONFIG_SND_SOC_TI_EDMA_PCM=m
CONFIG_SND_SOC_TI_SDMA_PCM=m
CONFIG_SND_SOC_TI_UDMA_PCM=m

#
# Texas Instruments DAI support for:
#
CONFIG_SND_SOC_DAVINCI_MCASP=m
# CONFIG_SND_SOC_OMAP_DMIC is not set
# CONFIG_SND_SOC_OMAP_MCBSP is not set
# CONFIG_SND_SOC_OMAP_MCPDM is not set

#
# Audio support for boards with Texas Instruments SoCs
#
# CONFIG_SND_SOC_NOKIA_RX51 is not set
# CONFIG_SND_SOC_OMAP3_PANDORA is not set
# CONFIG_SND_SOC_OMAP3_TWL4030 is not set
# end of Audio support for Texas Instruments SoCs

# CONFIG_SND_SOC_UNIPHIER is not set
# CONFIG_SND_SOC_UX500 is not set
# CONFIG_SND_SOC_XILINX_I2S is not set
# CONFIG_SND_SOC_XILINX_AUDIO_FORMATTER is not set
# CONFIG_SND_SOC_XILINX_SPDIF is not set
# CONFIG_SND_SOC_XTFPGA_I2S is not set
CONFIG_SND_SOC_I2C_AND_SPI=m

#
# CODEC drivers
#
CONFIG_SND_SOC_WM_HUBS=m
CONFIG_SND_SOC_AC97_CODEC=m
# CONFIG_SND_SOC_ADAU1372_I2C is not set
# CONFIG_SND_SOC_ADAU1372_SPI is not set
# CONFIG_SND_SOC_ADAU1701 is not set
# CONFIG_SND_SOC_ADAU1761_I2C is not set
# CONFIG_SND_SOC_ADAU1761_SPI is not set
# CONFIG_SND_SOC_ADAU7002 is not set
# CONFIG_SND_SOC_ADAU7118_HW is not set
# CONFIG_SND_SOC_ADAU7118_I2C is not set
# CONFIG_SND_SOC_AK4104 is not set
# CONFIG_SND_SOC_AK4118 is not set
# CONFIG_SND_SOC_AK4375 is not set
# CONFIG_SND_SOC_AK4458 is not set
# CONFIG_SND_SOC_AK4554 is not set
# CONFIG_SND_SOC_AK4613 is not set
CONFIG_SND_SOC_AK4642=m
# CONFIG_SND_SOC_AK5386 is not set
# CONFIG_SND_SOC_AK5558 is not set
# CONFIG_SND_SOC_ALC5623 is not set
CONFIG_SND_SOC_ALC5632=m
# CONFIG_SND_SOC_AW8738 is not set
# CONFIG_SND_SOC_BD28623 is not set
# CONFIG_SND_SOC_BT_SCO is not set
CONFIG_SND_SOC_CPCAP=m
# CONFIG_SND_SOC_CROS_EC_CODEC is not set
# CONFIG_SND_SOC_CS35L32 is not set
# CONFIG_SND_SOC_CS35L33 is not set
# CONFIG_SND_SOC_CS35L34 is not set
# CONFIG_SND_SOC_CS35L35 is not set
# CONFIG_SND_SOC_CS35L36 is not set
# CONFIG_SND_SOC_CS35L41_SPI is not set
# CONFIG_SND_SOC_CS35L41_I2C is not set
# CONFIG_SND_SOC_CS35L45_SPI is not set
# CONFIG_SND_SOC_CS35L45_I2C is not set
# CONFIG_SND_SOC_CS42L42 is not set
CONFIG_SND_SOC_CS42L51=m
CONFIG_SND_SOC_CS42L51_I2C=m
# CONFIG_SND_SOC_CS42L52 is not set
# CONFIG_SND_SOC_CS42L56 is not set
# CONFIG_SND_SOC_CS42L73 is not set
# CONFIG_SND_SOC_CS42L83 is not set
# CONFIG_SND_SOC_CS4234 is not set
# CONFIG_SND_SOC_CS4265 is not set
# CONFIG_SND_SOC_CS4270 is not set
# CONFIG_SND_SOC_CS4271_I2C is not set
# CONFIG_SND_SOC_CS4271_SPI is not set
# CONFIG_SND_SOC_CS42XX8_I2C is not set
# CONFIG_SND_SOC_CS43130 is not set
# CONFIG_SND_SOC_CS4341 is not set
# CONFIG_SND_SOC_CS4349 is not set
# CONFIG_SND_SOC_CS53L30 is not set
# CONFIG_SND_SOC_CX2072X is not set
# CONFIG_SND_SOC_DA7213 is not set
CONFIG_SND_SOC_DMIC=m
CONFIG_SND_SOC_HDMI_CODEC=m
# CONFIG_SND_SOC_ES7134 is not set
# CONFIG_SND_SOC_ES7241 is not set
# CONFIG_SND_SOC_ES8316 is not set
# CONFIG_SND_SOC_ES8326 is not set
# CONFIG_SND_SOC_ES8328_I2C is not set
# CONFIG_SND_SOC_ES8328_SPI is not set
# CONFIG_SND_SOC_GTM601 is not set
# CONFIG_SND_SOC_HDA is not set
# CONFIG_SND_SOC_ICS43432 is not set
# CONFIG_SND_SOC_INNO_RK3036 is not set
# CONFIG_SND_SOC_MAX98088 is not set
CONFIG_SND_SOC_MAX98090=m
CONFIG_SND_SOC_MAX98095=m
# CONFIG_SND_SOC_MAX98357A is not set
# CONFIG_SND_SOC_MAX98504 is not set
# CONFIG_SND_SOC_MAX9867 is not set
# CONFIG_SND_SOC_MAX98927 is not set
# CONFIG_SND_SOC_MAX98520 is not set
# CONFIG_SND_SOC_MAX98373_I2C is not set
# CONFIG_SND_SOC_MAX98390 is not set
# CONFIG_SND_SOC_MAX98396 is not set
# CONFIG_SND_SOC_MAX9860 is not set
CONFIG_SND_SOC_MSM8916_WCD_ANALOG=m
CONFIG_SND_SOC_MSM8916_WCD_DIGITAL=m
# CONFIG_SND_SOC_PCM1681 is not set
# CONFIG_SND_SOC_PCM1789_I2C is not set
# CONFIG_SND_SOC_PCM179X_I2C is not set
# CONFIG_SND_SOC_PCM179X_SPI is not set
# CONFIG_SND_SOC_PCM186X_I2C is not set
# CONFIG_SND_SOC_PCM186X_SPI is not set
# CONFIG_SND_SOC_PCM3060_I2C is not set
# CONFIG_SND_SOC_PCM3060_SPI is not set
# CONFIG_SND_SOC_PCM3168A_I2C is not set
# CONFIG_SND_SOC_PCM3168A_SPI is not set
# CONFIG_SND_SOC_PCM5102A is not set
# CONFIG_SND_SOC_PCM512x_I2C is not set
# CONFIG_SND_SOC_PCM512x_SPI is not set
# CONFIG_SND_SOC_RK3328 is not set
# CONFIG_SND_SOC_RK817 is not set
CONFIG_SND_SOC_RL6231=m
# CONFIG_SND_SOC_RT5616 is not set
CONFIG_SND_SOC_RT5631=m
CONFIG_SND_SOC_RT5640=m
CONFIG_SND_SOC_RT5645=m
# CONFIG_SND_SOC_RT5659 is not set
# CONFIG_SND_SOC_RT9120 is not set
CONFIG_SND_SOC_SGTL5000=m
# CONFIG_SND_SOC_SIMPLE_AMPLIFIER is not set
# CONFIG_SND_SOC_SIMPLE_MUX is not set
CONFIG_SND_SOC_SPDIF=m
# CONFIG_SND_SOC_SRC4XXX_I2C is not set
# CONFIG_SND_SOC_SSM2305 is not set
# CONFIG_SND_SOC_SSM2518 is not set
# CONFIG_SND_SOC_SSM2602_SPI is not set
# CONFIG_SND_SOC_SSM2602_I2C is not set
# CONFIG_SND_SOC_SSM4567 is not set
# CONFIG_SND_SOC_STA32X is not set
# CONFIG_SND_SOC_STA350 is not set
CONFIG_SND_SOC_STI_SAS=m
# CONFIG_SND_SOC_TAS2552 is not set
# CONFIG_SND_SOC_TAS2562 is not set
# CONFIG_SND_SOC_TAS2764 is not set
# CONFIG_SND_SOC_TAS2770 is not set
# CONFIG_SND_SOC_TAS2780 is not set
# CONFIG_SND_SOC_TAS5086 is not set
# CONFIG_SND_SOC_TAS571X is not set
# CONFIG_SND_SOC_TAS5720 is not set
# CONFIG_SND_SOC_TAS5805M is not set
# CONFIG_SND_SOC_TAS6424 is not set
# CONFIG_SND_SOC_TDA7419 is not set
# CONFIG_SND_SOC_TFA9879 is not set
# CONFIG_SND_SOC_TFA989X is not set
# CONFIG_SND_SOC_TLV320ADC3XXX is not set
CONFIG_SND_SOC_TLV320AIC23=m
CONFIG_SND_SOC_TLV320AIC23_I2C=m
# CONFIG_SND_SOC_TLV320AIC23_SPI is not set
CONFIG_SND_SOC_TLV320AIC31XX=m
# CONFIG_SND_SOC_TLV320AIC32X4_I2C is not set
# CONFIG_SND_SOC_TLV320AIC32X4_SPI is not set
# CONFIG_SND_SOC_TLV320AIC3X_I2C is not set
# CONFIG_SND_SOC_TLV320AIC3X_SPI is not set
# CONFIG_SND_SOC_TLV320ADCX140 is not set
CONFIG_SND_SOC_TS3A227E=m
# CONFIG_SND_SOC_TSCS42XX is not set
# CONFIG_SND_SOC_TSCS454 is not set
# CONFIG_SND_SOC_UDA1334 is not set
# CONFIG_SND_SOC_WM8510 is not set
# CONFIG_SND_SOC_WM8523 is not set
# CONFIG_SND_SOC_WM8524 is not set
# CONFIG_SND_SOC_WM8580 is not set
# CONFIG_SND_SOC_WM8711 is not set
# CONFIG_SND_SOC_WM8728 is not set
# CONFIG_SND_SOC_WM8731_I2C is not set
# CONFIG_SND_SOC_WM8731_SPI is not set
# CONFIG_SND_SOC_WM8737 is not set
# CONFIG_SND_SOC_WM8741 is not set
# CONFIG_SND_SOC_WM8750 is not set
CONFIG_SND_SOC_WM8753=m
# CONFIG_SND_SOC_WM8770 is not set
# CONFIG_SND_SOC_WM8776 is not set
# CONFIG_SND_SOC_WM8782 is not set
# CONFIG_SND_SOC_WM8804_I2C is not set
# CONFIG_SND_SOC_WM8804_SPI is not set
CONFIG_SND_SOC_WM8903=m
CONFIG_SND_SOC_WM8904=m
# CONFIG_SND_SOC_WM8940 is not set
# CONFIG_SND_SOC_WM8960 is not set
# CONFIG_SND_SOC_WM8961 is not set
# CONFIG_SND_SOC_WM8962 is not set
# CONFIG_SND_SOC_WM8974 is not set
CONFIG_SND_SOC_WM8978=m
# CONFIG_SND_SOC_WM8985 is not set
CONFIG_SND_SOC_WM8994=m
CONFIG_SND_SOC_WM9712=m
# CONFIG_SND_SOC_ZL38060 is not set
# CONFIG_SND_SOC_MAX9759 is not set
# CONFIG_SND_SOC_MT6351 is not set
# CONFIG_SND_SOC_MT6358 is not set
# CONFIG_SND_SOC_MT6660 is not set
# CONFIG_SND_SOC_NAU8315 is not set
# CONFIG_SND_SOC_NAU8540 is not set
# CONFIG_SND_SOC_NAU8810 is not set
# CONFIG_SND_SOC_NAU8821 is not set
# CONFIG_SND_SOC_NAU8822 is not set
# CONFIG_SND_SOC_NAU8824 is not set
# CONFIG_SND_SOC_TPA6130A2 is not set
# CONFIG_SND_SOC_LPASS_WSA_MACRO is not set
# CONFIG_SND_SOC_LPASS_VA_MACRO is not set
# CONFIG_SND_SOC_LPASS_RX_MACRO is not set
# CONFIG_SND_SOC_LPASS_TX_MACRO is not set
# end of CODEC drivers

CONFIG_SND_SIMPLE_CARD_UTILS=m
CONFIG_SND_SIMPLE_CARD=m
CONFIG_SND_AUDIO_GRAPH_CARD=m
# CONFIG_SND_AUDIO_GRAPH_CARD2 is not set
# CONFIG_SND_TEST_COMPONENT is not set
# CONFIG_SND_VIRTIO is not set
CONFIG_AC97_BUS=m

#
# HID support
#
CONFIG_HID=y
# CONFIG_HID_BATTERY_STRENGTH is not set
# CONFIG_HIDRAW is not set
# CONFIG_UHID is not set
CONFIG_HID_GENERIC=y

#
# Special HID drivers
#
# CONFIG_HID_A4TECH is not set
# CONFIG_HID_ACCUTOUCH is not set
# CONFIG_HID_ACRUX is not set
# CONFIG_HID_APPLE is not set
# CONFIG_HID_APPLEIR is not set
# CONFIG_HID_ASUS is not set
# CONFIG_HID_AUREAL is not set
# CONFIG_HID_BELKIN is not set
# CONFIG_HID_BETOP_FF is not set
# CONFIG_HID_BIGBEN_FF is not set
# CONFIG_HID_CHERRY is not set
# CONFIG_HID_CHICONY is not set
# CONFIG_HID_CORSAIR is not set
# CONFIG_HID_COUGAR is not set
# CONFIG_HID_MACALLY is not set
# CONFIG_HID_PRODIKEYS is not set
# CONFIG_HID_CMEDIA is not set
# CONFIG_HID_CREATIVE_SB0540 is not set
# CONFIG_HID_CYPRESS is not set
# CONFIG_HID_DRAGONRISE is not set
# CONFIG_HID_EMS_FF is not set
# CONFIG_HID_ELAN is not set
# CONFIG_HID_ELECOM is not set
# CONFIG_HID_ELO is not set
# CONFIG_HID_EZKEY is not set
# CONFIG_HID_GEMBIRD is not set
# CONFIG_HID_GFRM is not set
# CONFIG_HID_GLORIOUS is not set
# CONFIG_HID_HOLTEK is not set
# CONFIG_HID_GOOGLE_HAMMER is not set
# CONFIG_HID_VIVALDI is not set
# CONFIG_HID_GT683R is not set
# CONFIG_HID_KEYTOUCH is not set
# CONFIG_HID_KYE is not set
# CONFIG_HID_UCLOGIC is not set
# CONFIG_HID_WALTOP is not set
# CONFIG_HID_VIEWSONIC is not set
# CONFIG_HID_VRC2 is not set
# CONFIG_HID_XIAOMI is not set
# CONFIG_HID_GYRATION is not set
# CONFIG_HID_ICADE is not set
# CONFIG_HID_ITE is not set
# CONFIG_HID_JABRA is not set
# CONFIG_HID_TWINHAN is not set
# CONFIG_HID_KENSINGTON is not set
# CONFIG_HID_LCPOWER is not set
# CONFIG_HID_LED is not set
# CONFIG_HID_LENOVO is not set
# CONFIG_HID_LETSKETCH is not set
# CONFIG_HID_LOGITECH is not set
# CONFIG_HID_MAGICMOUSE is not set
# CONFIG_HID_MALTRON is not set
# CONFIG_HID_MAYFLASH is not set
# CONFIG_HID_MEGAWORLD_FF is not set
# CONFIG_HID_REDRAGON is not set
# CONFIG_HID_MICROSOFT is not set
# CONFIG_HID_MONTEREY is not set
# CONFIG_HID_MULTITOUCH is not set
# CONFIG_HID_NINTENDO is not set
# CONFIG_HID_NTI is not set
# CONFIG_HID_NTRIG is not set
# CONFIG_HID_ORTEK is not set
# CONFIG_HID_PANTHERLORD is not set
# CONFIG_HID_PENMOUNT is not set
# CONFIG_HID_PETALYNX is not set
# CONFIG_HID_PICOLCD is not set
# CONFIG_HID_PLANTRONICS is not set
# CONFIG_HID_PXRC is not set
# CONFIG_HID_RAZER is not set
# CONFIG_HID_PRIMAX is not set
# CONFIG_HID_RETRODE is not set
# CONFIG_HID_ROCCAT is not set
# CONFIG_HID_SAITEK is not set
# CONFIG_HID_SAMSUNG is not set
# CONFIG_HID_SEMITEK is not set
# CONFIG_HID_SIGMAMICRO is not set
# CONFIG_HID_SONY is not set
# CONFIG_HID_SPEEDLINK is not set
# CONFIG_HID_STEAM is not set
# CONFIG_HID_STEELSERIES is not set
# CONFIG_HID_SUNPLUS is not set
# CONFIG_HID_RMI is not set
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set
# CONFIG_HID_TIVO is not set
# CONFIG_HID_TOPSEED is not set
# CONFIG_HID_TOPRE is not set
# CONFIG_HID_THINGM is not set
# CONFIG_HID_THRUSTMASTER is not set
# CONFIG_HID_UDRAW_PS3 is not set
# CONFIG_HID_U2FZERO is not set
# CONFIG_HID_WACOM is not set
# CONFIG_HID_WIIMOTE is not set
# CONFIG_HID_XINMO is not set
# CONFIG_HID_ZEROPLUS is not set
# CONFIG_HID_ZYDACRON is not set
# CONFIG_HID_SENSOR_HUB is not set
# CONFIG_HID_ALPS is not set
# CONFIG_HID_MCP2221 is not set
# end of Special HID drivers

#
# USB HID support
#
CONFIG_USB_HID=y
# CONFIG_HID_PID is not set
# CONFIG_USB_HIDDEV is not set
# end of USB HID support

#
# I2C HID support
#
# CONFIG_I2C_HID_OF is not set
# CONFIG_I2C_HID_OF_ELAN is not set
# CONFIG_I2C_HID_OF_GOODIX is not set
# end of I2C HID support
# end of HID support

CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_COMMON=y
# CONFIG_USB_LED_TRIG is not set
CONFIG_USB_ULPI_BUS=y
CONFIG_USB_CONN_GPIO=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB=y
CONFIG_USB_PCI=y
# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set

#
# Miscellaneous USB options
#
CONFIG_USB_DEFAULT_PERSIST=y
# CONFIG_USB_FEW_INIT_RETRIES is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
CONFIG_USB_OTG=y
# CONFIG_USB_OTG_PRODUCTLIST is not set
# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set
# CONFIG_USB_OTG_FSM is not set
# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set
CONFIG_USB_AUTOSUSPEND_DELAY=2
# CONFIG_USB_MON is not set

#
# USB Host Controller Drivers
#
# CONFIG_USB_C67X00_HCD is not set
CONFIG_USB_XHCI_HCD=y
# CONFIG_USB_XHCI_DBGCAP is not set
CONFIG_USB_XHCI_PCI=y
# CONFIG_USB_XHCI_PCI_RENESAS is not set
CONFIG_USB_XHCI_PLATFORM=y
# CONFIG_USB_XHCI_HISTB is not set
# CONFIG_USB_XHCI_MTK is not set
CONFIG_USB_XHCI_MVEBU=y
CONFIG_USB_XHCI_RCAR=y
CONFIG_USB_XHCI_TEGRA=m
CONFIG_USB_EHCI_BRCMSTB=m
CONFIG_USB_BRCMSTB=m
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_PCI=y
# CONFIG_USB_EHCI_FSL is not set
CONFIG_USB_EHCI_HCD_OMAP=y
CONFIG_USB_EHCI_HCD_ORION=y
CONFIG_USB_EHCI_HCD_SPEAR=y
CONFIG_USB_EHCI_HCD_STI=y
CONFIG_USB_EHCI_HCD_AT91=y
# CONFIG_USB_EHCI_TEGRA is not set
CONFIG_USB_EHCI_EXYNOS=m
CONFIG_USB_EHCI_MV=m
CONFIG_USB_EHCI_HCD_PLATFORM=y
# CONFIG_USB_OXU210HP_HCD is not set
# CONFIG_USB_ISP116X_HCD is not set
# CONFIG_USB_FOTG210_HCD is not set
# CONFIG_USB_MAX3421_HCD is not set
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_SPEAR=y
CONFIG_USB_OHCI_HCD_STI=y
CONFIG_USB_OHCI_HCD_AT91=y
CONFIG_USB_OHCI_HCD_OMAP3=y
CONFIG_USB_OHCI_HCD_PCI=y
CONFIG_USB_OHCI_EXYNOS=m
CONFIG_USB_OHCI_HCD_PLATFORM=y
# CONFIG_USB_UHCI_HCD is not set
CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC=y
CONFIG_USB_UHCI_PLATFORM=y
CONFIG_USB_UHCI_ASPEED=y
# CONFIG_USB_SL811_HCD is not set
CONFIG_USB_R8A66597_HCD=m
# CONFIG_USB_RENESAS_USBHS_HCD is not set
# CONFIG_USB_HCD_BCMA is not set
# CONFIG_USB_HCD_TEST_MODE is not set
CONFIG_USB_RENESAS_USBHS=m

#
# USB Device Class drivers
#
# CONFIG_USB_ACM is not set
# CONFIG_USB_PRINTER is not set
# CONFIG_USB_WDM is not set
# CONFIG_USB_TMC is not set

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#

#
# also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_REALTEK is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_STORAGE_USBAT is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
# CONFIG_USB_STORAGE_ENE_UB6250 is not set
CONFIG_USB_UAS=m

#
# USB Imaging devices
#
# CONFIG_USB_MDC800 is not set
# CONFIG_USB_MICROTEK is not set
# CONFIG_USBIP_CORE is not set
# CONFIG_USB_CDNS_SUPPORT is not set
# CONFIG_USB_MTU3 is not set
CONFIG_USB_MUSB_HDRC=m
# CONFIG_USB_MUSB_HOST is not set
# CONFIG_USB_MUSB_GADGET is not set
CONFIG_USB_MUSB_DUAL_ROLE=y

#
# Platform Glue Layer
#
CONFIG_USB_MUSB_SUNXI=m
CONFIG_USB_MUSB_TUSB6010=m
CONFIG_USB_MUSB_OMAP2PLUS=m
CONFIG_USB_MUSB_AM35X=m
CONFIG_USB_MUSB_DSPS=m
CONFIG_USB_MUSB_UX500=m
# CONFIG_USB_MUSB_MEDIATEK is not set

#
# MUSB DMA mode
#
# CONFIG_MUSB_PIO_ONLY is not set
CONFIG_USB_UX500_DMA=y
CONFIG_USB_INVENTRA_DMA=y
CONFIG_USB_TI_CPPI41_DMA=y
CONFIG_USB_TUSB_OMAP_DMA=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_ULPI is not set
# CONFIG_USB_DWC3_HOST is not set
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_DWC3_DUAL_ROLE=y

#
# Platform Glue Driver Support
#
CONFIG_USB_DWC3_OMAP=y
CONFIG_USB_DWC3_EXYNOS=y
CONFIG_USB_DWC3_HAPS=y
CONFIG_USB_DWC3_KEYSTONE=y
CONFIG_USB_DWC3_MESON_G12A=y
CONFIG_USB_DWC3_OF_SIMPLE=y
CONFIG_USB_DWC3_ST=y
CONFIG_USB_DWC3_QCOM=y
CONFIG_USB_DWC2=y
# CONFIG_USB_DWC2_HOST is not set

#
# Gadget/Dual-role mode requires USB Gadget support to be enabled
#
# CONFIG_USB_DWC2_PERIPHERAL is not set
CONFIG_USB_DWC2_DUAL_ROLE=y
# CONFIG_USB_DWC2_PCI is not set
# CONFIG_USB_DWC2_DEBUG is not set
# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_USB_CHIPIDEA_PCI=y
CONFIG_USB_CHIPIDEA_MSM=y
CONFIG_USB_CHIPIDEA_IMX=y
CONFIG_USB_CHIPIDEA_GENERIC=y
CONFIG_USB_CHIPIDEA_TEGRA=y
CONFIG_USB_ISP1760=y
CONFIG_USB_ISP1760_HCD=y
CONFIG_USB_ISP1761_UDC=y
# CONFIG_USB_ISP1760_HOST_ROLE is not set
# CONFIG_USB_ISP1760_GADGET_ROLE is not set
CONFIG_USB_ISP1760_DUAL_ROLE=y

#
# USB port drivers
#
# CONFIG_USB_SERIAL is not set

#
# USB Miscellaneous drivers
#
# CONFIG_USB_EMI62 is not set
# CONFIG_USB_EMI26 is not set
# CONFIG_USB_ADUTUX is not set
# CONFIG_USB_SEVSEG is not set
# CONFIG_USB_LEGOTOWER is not set
# CONFIG_USB_LCD is not set
# CONFIG_USB_CYPRESS_CY7C63 is not set
# CONFIG_USB_CYTHERM is not set
# CONFIG_USB_IDMOUSE is not set
# CONFIG_USB_FTDI_ELAN is not set
# CONFIG_USB_APPLEDISPLAY is not set
# CONFIG_USB_QCOM_EUD is not set
# CONFIG_APPLE_MFI_FASTCHARGE is not set
# CONFIG_USB_SISUSBVGA is not set
# CONFIG_USB_LD is not set
# CONFIG_USB_TRANCEVIBRATOR is not set
# CONFIG_USB_IOWARRIOR is not set
# CONFIG_USB_TEST is not set
# CONFIG_USB_EHSET_TEST_FIXTURE is not set
# CONFIG_USB_ISIGHTFW is not set
# CONFIG_USB_YUREX is not set
# CONFIG_USB_EZUSB_FX2 is not set
# CONFIG_USB_HUB_USB251XB is not set
CONFIG_USB_HSIC_USB3503=y
# CONFIG_USB_HSIC_USB4604 is not set
# CONFIG_USB_LINK_LAYER_TEST is not set
# CONFIG_USB_CHAOSKEY is not set
CONFIG_BRCM_USB_PINMAP=m
CONFIG_USB_ONBOARD_HUB=m

#
# USB Physical Layer drivers
#
CONFIG_USB_PHY=y
CONFIG_AB8500_USB=y
CONFIG_KEYSTONE_USB_PHY=m
CONFIG_NOP_USB_XCEIV=y
CONFIG_AM335X_CONTROL_USB=m
CONFIG_AM335X_PHY_USB=m
CONFIG_TWL6030_USB=m
CONFIG_USB_GPIO_VBUS=y
CONFIG_USB_ISP1301=y
CONFIG_USB_MXS_PHY=y
CONFIG_USB_TEGRA_PHY=y
CONFIG_USB_ULPI=y
CONFIG_USB_ULPI_VIEWPORT=y
# end of USB Physical Layer drivers

CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG is not set
# CONFIG_USB_GADGET_DEBUG_FILES is not set
# CONFIG_USB_GADGET_DEBUG_FS is not set
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
# CONFIG_U_SERIAL_CONSOLE is not set

#
# USB Peripheral Controller
#
# CONFIG_USB_AT91 is not set
# CONFIG_USB_ATMEL_USBA is not set
# CONFIG_USB_FUSB300 is not set
# CONFIG_USB_FOTG210_UDC is not set
# CONFIG_USB_GR_UDC is not set
# CONFIG_USB_R8A66597 is not set
CONFIG_USB_RENESAS_USBHS_UDC=m
# CONFIG_USB_RENESAS_USB3 is not set
# CONFIG_USB_PXA27X is not set
# CONFIG_USB_MV_UDC is not set
# CONFIG_USB_MV_U3D is not set
CONFIG_USB_SNP_CORE=y
CONFIG_USB_SNP_UDC_PLAT=y
# CONFIG_USB_M66592 is not set
CONFIG_USB_BDC_UDC=y
# CONFIG_USB_AMD5536UDC is not set
# CONFIG_USB_NET2272 is not set
# CONFIG_USB_NET2280 is not set
# CONFIG_USB_GOKU is not set
# CONFIG_USB_EG20T is not set
# CONFIG_USB_GADGET_XILINX is not set
# CONFIG_USB_MAX3420_UDC is not set
# CONFIG_USB_TEGRA_XUDC is not set
# CONFIG_USB_ASPEED_UDC is not set
CONFIG_USB_ASPEED_VHUB=m
# CONFIG_USB_DUMMY_HCD is not set
# end of USB Peripheral Controller

CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_F_ACM=m
CONFIG_USB_F_SS_LB=m
CONFIG_USB_U_SERIAL=m
CONFIG_USB_U_ETHER=m
CONFIG_USB_U_AUDIO=m
CONFIG_USB_F_SERIAL=m
CONFIG_USB_F_OBEX=m
CONFIG_USB_F_NCM=m
CONFIG_USB_F_ECM=m
CONFIG_USB_F_EEM=m
CONFIG_USB_F_SUBSET=m
CONFIG_USB_F_RNDIS=m
CONFIG_USB_F_MASS_STORAGE=m
CONFIG_USB_F_FS=m
CONFIG_USB_F_UAC1=m
CONFIG_USB_F_UAC1_LEGACY=m
CONFIG_USB_F_UAC2=m
CONFIG_USB_F_UVC=m
CONFIG_USB_F_MIDI=m
CONFIG_USB_F_HID=m
CONFIG_USB_F_PRINTER=m
CONFIG_USB_CONFIGFS=m
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_USB_CONFIGFS_F_PRINTER=y

#
# USB Gadget precomposed configurations
#
# CONFIG_USB_ZERO is not set
# CONFIG_USB_AUDIO is not set
CONFIG_USB_ETH=m
CONFIG_USB_ETH_RNDIS=y
# CONFIG_USB_ETH_EEM is not set
# CONFIG_USB_G_NCM is not set
# CONFIG_USB_GADGETFS is not set
# CONFIG_USB_FUNCTIONFS is not set
# CONFIG_USB_MASS_STORAGE is not set
# CONFIG_USB_G_SERIAL is not set
# CONFIG_USB_MIDI_GADGET is not set
# CONFIG_USB_G_PRINTER is not set
# CONFIG_USB_CDC_COMPOSITE is not set
# CONFIG_USB_G_ACM_MS is not set
# CONFIG_USB_G_MULTI is not set
# CONFIG_USB_G_HID is not set
# CONFIG_USB_G_DBGP is not set
# CONFIG_USB_G_WEBCAM is not set
# CONFIG_USB_RAW_GADGET is not set
# end of USB Gadget precomposed configurations

CONFIG_TYPEC=m
# CONFIG_TYPEC_TCPM is not set
CONFIG_TYPEC_UCSI=m
# CONFIG_UCSI_CCG is not set
CONFIG_UCSI_STM32G0=m
# CONFIG_TYPEC_TPS6598X is not set
# CONFIG_TYPEC_ANX7411 is not set
# CONFIG_TYPEC_RT1719 is not set
# CONFIG_TYPEC_HD3SS3220 is not set
CONFIG_TYPEC_STUSB160X=m
# CONFIG_TYPEC_QCOM_PMIC is not set
# CONFIG_TYPEC_WUSB3801 is not set

#
# USB Type-C Multiplexer/DeMultiplexer Switch support
#
# CONFIG_TYPEC_MUX_FSA4480 is not set
# CONFIG_TYPEC_MUX_PI3USB30532 is not set
# end of USB Type-C Multiplexer/DeMultiplexer Switch support

#
# USB Type-C Alternate Mode drivers
#
# CONFIG_TYPEC_DP_ALTMODE is not set
# end of USB Type-C Alternate Mode drivers

CONFIG_USB_ROLE_SWITCH=y
CONFIG_MMC=y
CONFIG_PWRSEQ_EMMC=y
# CONFIG_PWRSEQ_SD8787 is not set
CONFIG_PWRSEQ_SIMPLE=y
CONFIG_MMC_BLOCK=y
CONFIG_MMC_BLOCK_MINORS=16
# CONFIG_SDIO_UART is not set
# CONFIG_MMC_TEST is not set

#
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_DEBUG is not set
CONFIG_MMC_ARMMMCI=y
CONFIG_MMC_QCOM_DML=y
CONFIG_MMC_STM32_SDMMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_IO_ACCESSORS=y
# CONFIG_MMC_SDHCI_PCI is not set
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_OF_ARASAN=y
# CONFIG_MMC_SDHCI_OF_ASPEED is not set
CONFIG_MMC_SDHCI_OF_AT91=y
CONFIG_MMC_SDHCI_OF_ESDHC=y
# CONFIG_MMC_SDHCI_OF_DWCMSHC is not set
# CONFIG_MMC_SDHCI_CADENCE is not set
CONFIG_MMC_SDHCI_ESDHC_IMX=y
CONFIG_MMC_SDHCI_DOVE=y
CONFIG_MMC_SDHCI_TEGRA=y
CONFIG_MMC_SDHCI_S3C=y
CONFIG_MMC_SDHCI_PXAV3=y
CONFIG_MMC_SDHCI_PXAV2=m
CONFIG_MMC_SDHCI_SPEAR=y
CONFIG_MMC_SDHCI_S3C_DMA=y
CONFIG_MMC_SDHCI_BCM_KONA=y
# CONFIG_MMC_SDHCI_F_SDH30 is not set
# CONFIG_MMC_SDHCI_MILBEAUT is not set
CONFIG_MMC_SDHCI_IPROC=y
# CONFIG_MMC_MESON_GX is not set
CONFIG_MMC_MESON_MX_SDHC=y
CONFIG_MMC_MESON_MX_SDIO=y
CONFIG_MMC_SDHCI_ST=y
CONFIG_MMC_OMAP=y
CONFIG_MMC_OMAP_HS=y
CONFIG_MMC_ATMELMCI=y
CONFIG_MMC_SDHCI_MSM=y
# CONFIG_MMC_MXC is not set
# CONFIG_MMC_TIFM_SD is not set
CONFIG_MMC_MVSDIO=y
# CONFIG_MMC_SPI is not set
CONFIG_MMC_TMIO_CORE=y
CONFIG_MMC_SDHI=y
CONFIG_MMC_SDHI_SYS_DMAC=y
CONFIG_MMC_SDHI_INTERNAL_DMAC=y
CONFIG_MMC_UNIPHIER=y
# CONFIG_MMC_CB710 is not set
# CONFIG_MMC_VIA_SDMMC is not set
CONFIG_MMC_DW=y
CONFIG_MMC_DW_PLTFM=y
# CONFIG_MMC_DW_BLUEFIELD is not set
CONFIG_MMC_DW_EXYNOS=y
# CONFIG_MMC_DW_HI3798CV200 is not set
# CONFIG_MMC_DW_K3 is not set
# CONFIG_MMC_DW_PCI is not set
CONFIG_MMC_DW_ROCKCHIP=y
CONFIG_MMC_SH_MMCIF=y
# CONFIG_MMC_VUB300 is not set
# CONFIG_MMC_USHC is not set
CONFIG_MMC_WMT=y
# CONFIG_MMC_USDHI6ROL0 is not set
CONFIG_MMC_SUNXI=y
CONFIG_MMC_CQHCI=y
# CONFIG_MMC_HSQ is not set
# CONFIG_MMC_TOSHIBA_PCI is not set
CONFIG_MMC_BCM2835=y
# CONFIG_MMC_MTK is not set
CONFIG_MMC_SDHCI_BRCMSTB=y
# CONFIG_MMC_SDHCI_XENON is not set
CONFIG_MMC_SDHCI_OMAP=y
# CONFIG_MMC_SDHCI_AM654 is not set
CONFIG_MMC_OWL=y
CONFIG_MMC_SDHCI_EXTERNAL_DMA=y
# CONFIG_SCSI_UFSHCD is not set
# CONFIG_MEMSTICK is not set
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_CLASS_FLASH=m
# CONFIG_LEDS_CLASS_MULTICOLOR is not set
# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set

#
# LED drivers
#
# CONFIG_LEDS_AN30259A is not set
# CONFIG_LEDS_AW2013 is not set
# CONFIG_LEDS_BCM6328 is not set
# CONFIG_LEDS_BCM6358 is not set
CONFIG_LEDS_CPCAP=m
# CONFIG_LEDS_CR0014114 is not set
# CONFIG_LEDS_EL15203000 is not set
# CONFIG_LEDS_LM3530 is not set
# CONFIG_LEDS_LM3532 is not set
# CONFIG_LEDS_LM3642 is not set
# CONFIG_LEDS_LM3692X is not set
# CONFIG_LEDS_PCA9532 is not set
CONFIG_LEDS_GPIO=y
# CONFIG_LEDS_LP3944 is not set
# CONFIG_LEDS_LP3952 is not set
# CONFIG_LEDS_LP50XX is not set
# CONFIG_LEDS_LP55XX_COMMON is not set
# CONFIG_LEDS_LP8860 is not set
# CONFIG_LEDS_PCA955X is not set
# CONFIG_LEDS_PCA963X is not set
# CONFIG_LEDS_DAC124S085 is not set
CONFIG_LEDS_PWM=y
# CONFIG_LEDS_REGULATOR is not set
# CONFIG_LEDS_BD2802 is not set
# CONFIG_LEDS_LT3593 is not set
CONFIG_LEDS_NS2=y
# CONFIG_LEDS_TCA6507 is not set
# CONFIG_LEDS_TLC591XX is not set
CONFIG_LEDS_MAX8997=m
# CONFIG_LEDS_LM355x is not set
# CONFIG_LEDS_IS31FL319X is not set
# CONFIG_LEDS_IS31FL32XX is not set

#
# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)
#
# CONFIG_LEDS_BLINKM is not set
# CONFIG_LEDS_SYSCON is not set
# CONFIG_LEDS_PM8058 is not set
# CONFIG_LEDS_MLXREG is not set
# CONFIG_LEDS_USER is not set
# CONFIG_LEDS_SPI_BYTE is not set
# CONFIG_LEDS_TI_LMU_COMMON is not set
CONFIG_LEDS_ACER_A500=m
# CONFIG_LEDS_BCM63138 is not set

#
# Flash and Torch LED drivers
#
# CONFIG_LEDS_AAT1290 is not set
# CONFIG_LEDS_AS3645A is not set
# CONFIG_LEDS_KTD2692 is not set
# CONFIG_LEDS_LM3601X is not set
CONFIG_LEDS_MAX77693=m
# CONFIG_LEDS_RT4505 is not set
# CONFIG_LEDS_RT8515 is not set
# CONFIG_LEDS_SGM3140 is not set

#
# RGB LED drivers
#

#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_ONESHOT=y
# CONFIG_LEDS_TRIGGER_DISK is not set
# CONFIG_LEDS_TRIGGER_MTD is not set
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
CONFIG_LEDS_TRIGGER_CPU=y
# CONFIG_LEDS_TRIGGER_ACTIVITY is not set
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y

#
# iptables trigger is under Netfilter config (LED target)
#
CONFIG_LEDS_TRIGGER_TRANSIENT=y
CONFIG_LEDS_TRIGGER_CAMERA=y
# CONFIG_LEDS_TRIGGER_PANIC is not set
# CONFIG_LEDS_TRIGGER_NETDEV is not set
# CONFIG_LEDS_TRIGGER_PATTERN is not set
CONFIG_LEDS_TRIGGER_AUDIO=m
# CONFIG_LEDS_TRIGGER_TTY is not set

#
# Simple LED drivers
#
# CONFIG_ACCESSIBILITY is not set
# CONFIG_INFINIBAND is not set
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
CONFIG_EDAC=y
CONFIG_EDAC_LEGACY_SYSFS=y
# CONFIG_EDAC_DEBUG is not set
# CONFIG_EDAC_AL_MC is not set
# CONFIG_EDAC_LAYERSCAPE is not set
CONFIG_EDAC_HIGHBANK_MC=y
CONFIG_EDAC_HIGHBANK_L2=y
# CONFIG_EDAC_ALTERA is not set
# CONFIG_EDAC_ARMADA_XP is not set
# CONFIG_EDAC_SYNOPSYS is not set
# CONFIG_EDAC_TI is not set
# CONFIG_EDAC_ASPEED is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_SYSTOHC=y
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set
CONFIG_RTC_NVMEM=y

#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set

#
# I2C RTC drivers
#
# CONFIG_RTC_DRV_ABB5ZES3 is not set
# CONFIG_RTC_DRV_ABEOZ9 is not set
# CONFIG_RTC_DRV_ABX80X is not set
CONFIG_RTC_DRV_AC100=y
CONFIG_RTC_DRV_BRCMSTB=y
CONFIG_RTC_DRV_AS3722=y
CONFIG_RTC_DRV_DS1307=y
# CONFIG_RTC_DRV_DS1307_CENTURY is not set
# CONFIG_RTC_DRV_DS1374 is not set
# CONFIG_RTC_DRV_DS1672 is not set
CONFIG_RTC_DRV_HYM8563=m
# CONFIG_RTC_DRV_MAX6900 is not set
CONFIG_RTC_DRV_MAX8907=y
CONFIG_RTC_DRV_MAX8998=m
CONFIG_RTC_DRV_MAX8997=m
CONFIG_RTC_DRV_MAX77686=y
# CONFIG_RTC_DRV_NCT3018Y is not set
CONFIG_RTC_DRV_RK808=m
CONFIG_RTC_DRV_RS5C372=m
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_ISL12022 is not set
# CONFIG_RTC_DRV_ISL12026 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8523 is not set
# CONFIG_RTC_DRV_PCF85063 is not set
CONFIG_RTC_DRV_PCF85363=m
# CONFIG_RTC_DRV_PCF8563 is not set
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
CONFIG_RTC_DRV_BQ32K=m
CONFIG_RTC_DRV_TWL4030=y
CONFIG_RTC_DRV_PALMAS=y
CONFIG_RTC_DRV_TPS6586X=y
CONFIG_RTC_DRV_TPS65910=y
# CONFIG_RTC_DRV_RC5T619 is not set
CONFIG_RTC_DRV_S35390A=m
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8010 is not set
CONFIG_RTC_DRV_RX8581=m
# CONFIG_RTC_DRV_RX8025 is not set
CONFIG_RTC_DRV_EM3027=y
# CONFIG_RTC_DRV_RV3028 is not set
# CONFIG_RTC_DRV_RV3032 is not set
# CONFIG_RTC_DRV_RV8803 is not set
CONFIG_RTC_DRV_S5M=m
# CONFIG_RTC_DRV_SD3078 is not set

#
# SPI RTC drivers
#
# CONFIG_RTC_DRV_M41T93 is not set
# CONFIG_RTC_DRV_M41T94 is not set
# CONFIG_RTC_DRV_DS1302 is not set
# CONFIG_RTC_DRV_DS1305 is not set
# CONFIG_RTC_DRV_DS1343 is not set
# CONFIG_RTC_DRV_DS1347 is not set
# CONFIG_RTC_DRV_DS1390 is not set
# CONFIG_RTC_DRV_MAX6916 is not set
# CONFIG_RTC_DRV_R9701 is not set
# CONFIG_RTC_DRV_RX4581 is not set
# CONFIG_RTC_DRV_RS5C348 is not set
# CONFIG_RTC_DRV_MAX6902 is not set
# CONFIG_RTC_DRV_PCF2123 is not set
# CONFIG_RTC_DRV_MCP795 is not set
CONFIG_RTC_I2C_AND_SPI=y

#
# SPI and I2C RTC drivers
#
# CONFIG_RTC_DRV_DS3232 is not set
# CONFIG_RTC_DRV_PCF2127 is not set
# CONFIG_RTC_DRV_RV3029C2 is not set
# CONFIG_RTC_DRV_RX6110 is not set

#
# Platform RTC drivers
#
# CONFIG_RTC_DRV_CMOS is not set
# CONFIG_RTC_DRV_DS1286 is not set
# CONFIG_RTC_DRV_DS1511 is not set
# CONFIG_RTC_DRV_DS1553 is not set
# CONFIG_RTC_DRV_DS1685_FAMILY is not set
# CONFIG_RTC_DRV_DS1742 is not set
# CONFIG_RTC_DRV_DS2404 is not set
CONFIG_RTC_DRV_DA9063=m
CONFIG_RTC_DRV_EFI=m
# CONFIG_RTC_DRV_STK17TA8 is not set
# CONFIG_RTC_DRV_M48T86 is not set
# CONFIG_RTC_DRV_M48T35 is not set
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_MSM6242 is not set
# CONFIG_RTC_DRV_BQ4802 is not set
# CONFIG_RTC_DRV_RP5C01 is not set
# CONFIG_RTC_DRV_V3020 is not set
CONFIG_RTC_DRV_SPEAR=y
# CONFIG_RTC_DRV_AB8500 is not set
# CONFIG_RTC_DRV_ZYNQMP is not set
# CONFIG_RTC_DRV_CROS_EC is not set

#
# on-CPU RTC drivers
#
CONFIG_RTC_DRV_DIGICOLOR=m
# CONFIG_RTC_DRV_IMXDI is not set
# CONFIG_RTC_DRV_FSL_FTM_ALARM is not set
# CONFIG_RTC_DRV_MESON is not set
CONFIG_RTC_DRV_MESON_VRTC=m
# CONFIG_RTC_DRV_OMAP is not set
CONFIG_RTC_DRV_S3C=m
CONFIG_RTC_DRV_SA1100=m
CONFIG_RTC_DRV_SH=m
# CONFIG_RTC_DRV_SUNPLUS is not set
# CONFIG_RTC_DRV_PL030 is not set
CONFIG_RTC_DRV_PL031=y
CONFIG_RTC_DRV_AT91RM9200=m
CONFIG_RTC_DRV_AT91SAM9=m
# CONFIG_RTC_DRV_RZN1 is not set
CONFIG_RTC_DRV_VT8500=y
CONFIG_RTC_DRV_SUN6I=y
CONFIG_RTC_DRV_SUNXI=y
CONFIG_RTC_DRV_MV=y
# CONFIG_RTC_DRV_ARMADA38X is not set
# CONFIG_RTC_DRV_CADENCE is not set
# CONFIG_RTC_DRV_FTRTC010 is not set
CONFIG_RTC_DRV_PM8XXX=m
CONFIG_RTC_DRV_TEGRA=y
# CONFIG_RTC_DRV_MXC is not set
# CONFIG_RTC_DRV_MXC_V2 is not set
# CONFIG_RTC_DRV_SNVS is not set
CONFIG_RTC_DRV_ST_LPC=y
# CONFIG_RTC_DRV_MT2712 is not set
# CONFIG_RTC_DRV_MT7622 is not set
# CONFIG_RTC_DRV_R7301 is not set
CONFIG_RTC_DRV_STM32=y
CONFIG_RTC_DRV_CPCAP=m
CONFIG_RTC_DRV_ASPEED=m

#
# HID Sensor RTC drivers
#
# CONFIG_RTC_DRV_GOLDFISH is not set
CONFIG_DMADEVICES=y
# CONFIG_DMADEVICES_DEBUG is not set

#
# DMA Devices
#
CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
CONFIG_DMA_ENGINE=y
CONFIG_DMA_VIRTUAL_CHANNELS=y
CONFIG_DMA_OF=y
# CONFIG_ALTERA_MSGDMA is not set
# CONFIG_AMBA_PL08X is not set
CONFIG_AT_HDMAC=y
CONFIG_AT_XDMAC=y
# CONFIG_AXI_DMAC is not set
CONFIG_DMA_BCM2835=y
CONFIG_DMA_SUN4I=y
CONFIG_DMA_SUN6I=y
# CONFIG_DW_AXI_DMAC is not set
CONFIG_FSL_EDMA=y
# CONFIG_FSL_QDMA is not set
CONFIG_IMX_DMA=y
CONFIG_IMX_SDMA=y
# CONFIG_INTEL_IDMA64 is not set
# CONFIG_K3_DMA is not set
# CONFIG_MILBEAUT_HDMAC is not set
# CONFIG_MILBEAUT_XDMAC is not set
# CONFIG_MMP_PDMA is not set
# CONFIG_MMP_TDMA is not set
CONFIG_MV_XOR=y
CONFIG_MXS_DMA=y
CONFIG_MX3_IPU=y
CONFIG_MX3_IPU_IRQS=4
# CONFIG_NBPFAXI_DMA is not set
CONFIG_OWL_DMA=y
CONFIG_PL330_DMA=y
# CONFIG_PXA_DMA is not set
# CONFIG_PLX_DMA is not set
CONFIG_STE_DMA40=y
CONFIG_ST_FDMA=m
CONFIG_STM32_DMA=y
CONFIG_STM32_DMAMUX=y
CONFIG_STM32_MDMA=y
CONFIG_TEGRA20_APB_DMA=y
CONFIG_UNIPHIER_MDMAC=y
# CONFIG_UNIPHIER_XDMAC is not set
CONFIG_XILINX_DMA=y
# CONFIG_XILINX_ZYNQMP_DMA is not set
# CONFIG_XILINX_ZYNQMP_DPDMA is not set
# CONFIG_MTK_HSDMA is not set
# CONFIG_MTK_CQDMA is not set
# CONFIG_MTK_UART_APDMA is not set
# CONFIG_QCOM_ADM is not set
CONFIG_QCOM_BAM_DMA=y
# CONFIG_QCOM_GPI_DMA is not set
# CONFIG_QCOM_HIDMA_MGMT is not set
# CONFIG_QCOM_HIDMA is not set
CONFIG_DW_DMAC_CORE=y
CONFIG_DW_DMAC=y
# CONFIG_RZN1_DMAMUX is not set
# CONFIG_DW_DMAC_PCI is not set
# CONFIG_DW_EDMA is not set
# CONFIG_DW_EDMA_PCIE is not set
# CONFIG_SF_PDMA is not set
CONFIG_RENESAS_DMA=y
CONFIG_RCAR_DMAC=y
CONFIG_RENESAS_USB_DMAC=m
CONFIG_TI_CPPI41=m
CONFIG_TI_EDMA=y
CONFIG_DMA_OMAP=y
CONFIG_TI_DMA_CROSSBAR=y

#
# DMA Clients
#
# CONFIG_ASYNC_TX_DMA is not set
# CONFIG_DMATEST is not set
CONFIG_DMA_ENGINE_RAID=y

#
# DMABUF options
#
CONFIG_SYNC_FILE=y
# CONFIG_SW_SYNC is not set
# CONFIG_UDMABUF is not set
# CONFIG_DMABUF_MOVE_NOTIFY is not set
# CONFIG_DMABUF_DEBUG is not set
# CONFIG_DMABUF_SELFTESTS is not set
# CONFIG_DMABUF_HEAPS is not set
# CONFIG_DMABUF_SYSFS_STATS is not set
# end of DMABUF options

# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set
# CONFIG_VFIO is not set
# CONFIG_VIRT_DRIVERS is not set
CONFIG_VIRTIO_ANCHOR=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI_LIB=y
CONFIG_VIRTIO_PCI_LIB_LEGACY=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_PCI_LEGACY=y
# CONFIG_VIRTIO_BALLOON is not set
# CONFIG_VIRTIO_INPUT is not set
CONFIG_VIRTIO_MMIO=y
# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set
# CONFIG_VDPA is not set
CONFIG_VHOST_MENU=y
# CONFIG_VHOST_NET is not set
# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set

#
# Microsoft Hyper-V guest support
#
# end of Microsoft Hyper-V guest support

# CONFIG_GREYBUS is not set
# CONFIG_COMEDI is not set
CONFIG_STAGING=y
# CONFIG_PRISM2_USB is not set
# CONFIG_RTL8192U is not set
# CONFIG_RTLLIB is not set
# CONFIG_RTL8723BS is not set
# CONFIG_R8712U is not set
# CONFIG_R8188EU is not set
# CONFIG_RTS5208 is not set
# CONFIG_VT6655 is not set
# CONFIG_VT6656 is not set

#
# IIO staging drivers
#

#
# Accelerometers
#
# CONFIG_ADIS16203 is not set
# CONFIG_ADIS16240 is not set
# end of Accelerometers

#
# Analog to digital converters
#
# CONFIG_AD7816 is not set
# end of Analog to digital converters

#
# Analog digital bi-direction converters
#
# CONFIG_ADT7316 is not set
# end of Analog digital bi-direction converters

#
# Direct Digital Synthesis
#
# CONFIG_AD9832 is not set
# CONFIG_AD9834 is not set
# end of Direct Digital Synthesis

#
# Network Analyzer, Impedance Converters
#
# CONFIG_AD5933 is not set
# end of Network Analyzer, Impedance Converters

#
# Active energy metering IC
#
# CONFIG_ADE7854 is not set
# end of Active energy metering IC

#
# Resolver to digital converters
#
# CONFIG_AD2S1210 is not set
# end of Resolver to digital converters
# end of IIO staging drivers

# CONFIG_FB_SM750 is not set
# CONFIG_USB_EMXX is not set
CONFIG_MFD_NVEC=y
CONFIG_KEYBOARD_NVEC=y
CONFIG_SERIO_NVEC_PS2=y
CONFIG_NVEC_POWER=y
CONFIG_NVEC_PAZ00=y
# CONFIG_STAGING_MEDIA is not set
CONFIG_STAGING_BOARD=y
# CONFIG_LTE_GDM724X is not set
# CONFIG_FB_TFT is not set
# CONFIG_KS7010 is not set
CONFIG_BCM_VIDEOCORE=y
# CONFIG_BCM2835_VCHIQ is not set
# CONFIG_SND_BCM2835 is not set
# CONFIG_VIDEO_BCM2835 is not set
# CONFIG_PI433 is not set
# CONFIG_XIL_AXIS_FIFO is not set
# CONFIG_FIELDBUS_DEV is not set
# CONFIG_QLGE is not set
# CONFIG_VME_BUS is not set
# CONFIG_GOLDFISH is not set
CONFIG_CHROME_PLATFORMS=y
CONFIG_CROS_EC=m
CONFIG_CROS_EC_I2C=m
# CONFIG_CROS_EC_RPMSG is not set
CONFIG_CROS_EC_SPI=m
CONFIG_CROS_EC_PROTO=y
# CONFIG_CROS_KBD_LED_BACKLIGHT is not set
CONFIG_CROS_EC_CHARDEV=m
CONFIG_CROS_EC_LIGHTBAR=m
CONFIG_CROS_EC_VBC=m
CONFIG_CROS_EC_DEBUGFS=m
CONFIG_CROS_EC_SENSORHUB=m
CONFIG_CROS_EC_SYSFS=m
CONFIG_CROS_EC_TYPEC=m
# CONFIG_CROS_HPS_I2C is not set
CONFIG_CROS_USBPD_NOTIFY=m
# CONFIG_MELLANOX_PLATFORM is not set
# CONFIG_OLPC_XO175 is not set
CONFIG_HAVE_CLK=y
CONFIG_HAVE_CLK_PREPARE=y
CONFIG_COMMON_CLK=y

#
# Clock driver for ARM Reference designs
#
CONFIG_CLK_ICST=y
CONFIG_CLK_SP810=y
CONFIG_CLK_VEXPRESS_OSC=y
# end of Clock driver for ARM Reference designs

# CONFIG_LMK04832 is not set
CONFIG_COMMON_CLK_MAX77686=y
# CONFIG_COMMON_CLK_MAX9485 is not set
CONFIG_COMMON_CLK_RK808=m
CONFIG_COMMON_CLK_SCMI=y
# CONFIG_COMMON_CLK_SI5341 is not set
# CONFIG_COMMON_CLK_SI5351 is not set
# CONFIG_COMMON_CLK_SI514 is not set
# CONFIG_COMMON_CLK_SI544 is not set
# CONFIG_COMMON_CLK_SI570 is not set
# CONFIG_COMMON_CLK_CDCE706 is not set
# CONFIG_COMMON_CLK_CDCE925 is not set
# CONFIG_COMMON_CLK_CS2000_CP is not set
CONFIG_COMMON_CLK_EN7523=y
CONFIG_COMMON_CLK_LAN966X=y
CONFIG_COMMON_CLK_ASPEED=y
CONFIG_COMMON_CLK_S2MPS11=m
# CONFIG_COMMON_CLK_AXI_CLKGEN is not set
CONFIG_CLK_QORIQ=y
# CONFIG_COMMON_CLK_PALMAS is not set
# CONFIG_COMMON_CLK_PWM is not set
# CONFIG_COMMON_CLK_RS9_PCIE is not set
# CONFIG_COMMON_CLK_VC5 is not set
# CONFIG_COMMON_CLK_VC7 is not set
CONFIG_COMMON_CLK_STM32MP135=y
CONFIG_COMMON_CLK_STM32MP157=y
CONFIG_COMMON_CLK_MMP2=y
# CONFIG_COMMON_CLK_MMP2_AUDIO is not set
# CONFIG_COMMON_CLK_FIXED_MMIO is not set
CONFIG_CLK_ACTIONS=y
CONFIG_CLK_OWL_S500=y
CONFIG_CLK_BCM2711_DVP=y
CONFIG_CLK_BCM2835=y
CONFIG_CLK_BCM_63XX=y
CONFIG_CLK_BCM_KONA=y
CONFIG_COMMON_CLK_IPROC=y
CONFIG_CLK_BCM_CYGNUS=y
CONFIG_CLK_BCM_HR2=y
CONFIG_CLK_BCM_NSP=y
CONFIG_CLK_BCM_NS2=y
CONFIG_CLK_BCM_SR=y
CONFIG_CLK_RASPBERRYPI=y
CONFIG_COMMON_CLK_HI3516CV300=y
CONFIG_COMMON_CLK_HI3519=y
CONFIG_COMMON_CLK_HI3559A=y
CONFIG_COMMON_CLK_HI3660=y
CONFIG_COMMON_CLK_HI3670=y
CONFIG_COMMON_CLK_HI3798CV200=y
CONFIG_COMMON_CLK_HI6220=y
CONFIG_RESET_HISI=y
CONFIG_STUB_CLK_HI6220=y
CONFIG_STUB_CLK_HI3660=y
CONFIG_MXC_CLK=y
CONFIG_CLK_IMX5=y
CONFIG_CLK_IMX6Q=y
CONFIG_CLK_IMX6SL=y
CONFIG_CLK_IMX6SLL=y
CONFIG_CLK_IMX6SX=y
CONFIG_CLK_IMX6UL=y
CONFIG_CLK_IMX7D=y
CONFIG_CLK_IMX7ULP=y
CONFIG_CLK_VF610=y
# CONFIG_CLK_IMX8MM is not set
# CONFIG_CLK_IMX8MN is not set
# CONFIG_CLK_IMX8MP is not set
# CONFIG_CLK_IMX8MQ is not set
# CONFIG_CLK_IMX8ULP is not set
# CONFIG_CLK_IMX93 is not set
CONFIG_COMMON_CLK_KEYSTONE=y
CONFIG_TI_SYSCON_CLK=y

#
# Clock driver for MediaTek SoC
#
CONFIG_COMMON_CLK_MEDIATEK=y
CONFIG_COMMON_CLK_MT2701=y
# CONFIG_COMMON_CLK_MT2701_MMSYS is not set
# CONFIG_COMMON_CLK_MT2701_IMGSYS is not set
# CONFIG_COMMON_CLK_MT2701_VDECSYS is not set
# CONFIG_COMMON_CLK_MT2701_HIFSYS is not set
# CONFIG_COMMON_CLK_MT2701_ETHSYS is not set
# CONFIG_COMMON_CLK_MT2701_BDPSYS is not set
# CONFIG_COMMON_CLK_MT2701_AUDSYS is not set
# CONFIG_COMMON_CLK_MT2701_G3DSYS is not set
CONFIG_COMMON_CLK_MT6795=y
CONFIG_COMMON_CLK_MT6795_MFGCFG=y
CONFIG_COMMON_CLK_MT6795_MMSYS=y
CONFIG_COMMON_CLK_MT6795_VDECSYS=y
CONFIG_COMMON_CLK_MT6795_VENCSYS=y
CONFIG_COMMON_CLK_MT7622=y
# CONFIG_COMMON_CLK_MT7622_ETHSYS is not set
# CONFIG_COMMON_CLK_MT7622_HIFSYS is not set
# CONFIG_COMMON_CLK_MT7622_AUDSYS is not set
CONFIG_COMMON_CLK_MT7629=y
# CONFIG_COMMON_CLK_MT7629_ETHSYS is not set
# CONFIG_COMMON_CLK_MT7629_HIFSYS is not set
CONFIG_COMMON_CLK_MT7986=y
CONFIG_COMMON_CLK_MT7986_ETHSYS=y
CONFIG_COMMON_CLK_MT8135=y
CONFIG_COMMON_CLK_MT8173=y
CONFIG_COMMON_CLK_MT8173_MMSYS=y
# CONFIG_COMMON_CLK_MT8365 is not set
CONFIG_COMMON_CLK_MT8516=y
# CONFIG_COMMON_CLK_MT8516_AUDSYS is not set
# end of Clock driver for MediaTek SoC

#
# Clock support for Amlogic platforms
#
CONFIG_COMMON_CLK_MESON_REGMAP=y
CONFIG_COMMON_CLK_MESON_MPLL=y
CONFIG_COMMON_CLK_MESON_PLL=y
CONFIG_COMMON_CLK_MESON8B=y
# end of Clock support for Amlogic platforms

CONFIG_MVEBU_CLK_COMMON=y
CONFIG_MVEBU_CLK_CPU=y
CONFIG_MVEBU_CLK_COREDIV=y
CONFIG_ARMADA_370_CLK=y
CONFIG_ARMADA_375_CLK=y
CONFIG_ARMADA_38X_CLK=y
CONFIG_ARMADA_39X_CLK=y
CONFIG_ARMADA_XP_CLK=y
CONFIG_DOVE_CLK=y
CONFIG_QCOM_GDSC=y
CONFIG_QCOM_RPMCC=y
CONFIG_COMMON_CLK_QCOM=y
CONFIG_QCOM_A53PLL=y
# CONFIG_QCOM_A7PLL is not set
CONFIG_QCOM_CLK_APCS_MSM8916=y
# CONFIG_QCOM_CLK_APCS_SDX55 is not set
CONFIG_QCOM_CLK_RPM=y
CONFIG_QCOM_CLK_SMD_RPM=y
# CONFIG_QCOM_CLK_RPMH is not set
CONFIG_APQ_GCC_8084=y
CONFIG_APQ_MMCC_8084=y
# CONFIG_IPQ_APSS_PLL is not set
# CONFIG_IPQ_APSS_6018 is not set
# CONFIG_IPQ_GCC_4019 is not set
# CONFIG_IPQ_GCC_6018 is not set
# CONFIG_IPQ_GCC_806X is not set
# CONFIG_IPQ_LCC_806X is not set
# CONFIG_IPQ_GCC_8074 is not set
CONFIG_MSM_GCC_8660=y
# CONFIG_MSM_GCC_8909 is not set
CONFIG_MSM_GCC_8916=y
# CONFIG_MSM_GCC_8939 is not set
CONFIG_MSM_GCC_8960=y
# CONFIG_MSM_LCC_8960 is not set
# CONFIG_MDM_GCC_9607 is not set
# CONFIG_MDM_GCC_9615 is not set
# CONFIG_MDM_LCC_9615 is not set
CONFIG_MSM_MMCC_8960=y
# CONFIG_MSM_GCC_8953 is not set
CONFIG_MSM_GCC_8974=y
CONFIG_MSM_MMCC_8974=y
# CONFIG_MSM_GCC_8976 is not set
# CONFIG_MSM_MMCC_8994 is not set
# CONFIG_MSM_GCC_8994 is not set
# CONFIG_MSM_GCC_8996 is not set
# CONFIG_MSM_MMCC_8996 is not set
# CONFIG_MSM_GCC_8998 is not set
# CONFIG_MSM_GPUCC_8998 is not set
# CONFIG_MSM_MMCC_8998 is not set
# CONFIG_QCM_GCC_2290 is not set
# CONFIG_QCM_DISPCC_2290 is not set
# CONFIG_QCS_GCC_404 is not set
# CONFIG_SC_CAMCC_7180 is not set
# CONFIG_SC_CAMCC_7280 is not set
# CONFIG_SC_DISPCC_7180 is not set
# CONFIG_SC_DISPCC_7280 is not set
# CONFIG_SC_GCC_7180 is not set
# CONFIG_SC_GCC_7280 is not set
# CONFIG_SC_GCC_8180X is not set
# CONFIG_SC_GCC_8280XP is not set
# CONFIG_SC_GPUCC_7180 is not set
# CONFIG_SC_GPUCC_7280 is not set
# CONFIG_SC_GPUCC_8280XP is not set
# CONFIG_SC_LPASSCC_7280 is not set
# CONFIG_SC_LPASS_CORECC_7180 is not set
# CONFIG_SC_LPASS_CORECC_7280 is not set
# CONFIG_SC_MSS_7180 is not set
# CONFIG_SC_VIDEOCC_7180 is not set
# CONFIG_SC_VIDEOCC_7280 is not set
# CONFIG_SDM_CAMCC_845 is not set
# CONFIG_SDM_GCC_660 is not set
# CONFIG_SDM_MMCC_660 is not set
# CONFIG_SDM_GPUCC_660 is not set
# CONFIG_QCS_TURING_404 is not set
# CONFIG_QCS_Q6SSTOP_404 is not set
# CONFIG_SDM_GCC_845 is not set
# CONFIG_SDM_GPUCC_845 is not set
# CONFIG_SDM_VIDEOCC_845 is not set
# CONFIG_SDM_DISPCC_845 is not set
# CONFIG_SDM_LPASSCC_845 is not set
# CONFIG_SDX_GCC_55 is not set
# CONFIG_SDX_GCC_65 is not set
# CONFIG_SM_CAMCC_8250 is not set
# CONFIG_SM_CAMCC_8450 is not set
# CONFIG_SM_GCC_6115 is not set
# CONFIG_SM_GCC_6125 is not set
# CONFIG_SM_GCC_6350 is not set
# CONFIG_SM_GCC_6375 is not set
# CONFIG_SM_GCC_8150 is not set
# CONFIG_SM_GCC_8250 is not set
# CONFIG_SM_GCC_8350 is not set
# CONFIG_SM_GCC_8450 is not set
# CONFIG_SM_GPUCC_6350 is not set
# CONFIG_SM_GPUCC_8150 is not set
# CONFIG_SM_GPUCC_8250 is not set
# CONFIG_SM_GPUCC_8350 is not set
# CONFIG_SM_VIDEOCC_8150 is not set
# CONFIG_SM_VIDEOCC_8250 is not set
# CONFIG_SPMI_PMIC_CLKDIV is not set
# CONFIG_QCOM_HFPLL is not set
# CONFIG_KPSS_XCC is not set
# CONFIG_KRAITCC is not set
# CONFIG_CLK_GFM_LPASS_SM8250 is not set
CONFIG_CLK_RENESAS=y
CONFIG_CLK_EMEV2=y
CONFIG_CLK_RZA1=y
CONFIG_CLK_R7S9210=y
CONFIG_CLK_R8A73A4=y
CONFIG_CLK_R8A7740=y
CONFIG_CLK_R8A7742=y
CONFIG_CLK_R8A7743=y
CONFIG_CLK_R8A7745=y
CONFIG_CLK_R8A77470=y
CONFIG_CLK_R8A7778=y
CONFIG_CLK_R8A7779=y
CONFIG_CLK_R8A7790=y
CONFIG_CLK_R8A7791=y
CONFIG_CLK_R8A7792=y
CONFIG_CLK_R8A7794=y
CONFIG_CLK_R9A06G032=y
CONFIG_CLK_SH73A0=y
CONFIG_CLK_RCAR_GEN2_CPG=y
# CONFIG_CLK_RCAR_USB2_CLOCK_SEL is not set
CONFIG_CLK_RENESAS_CPG_MSSR=y
CONFIG_CLK_RENESAS_CPG_MSTP=y
CONFIG_CLK_RENESAS_DIV6=y
CONFIG_COMMON_CLK_ROCKCHIP=y
CONFIG_CLK_RV110X=y
CONFIG_CLK_RV1126=y
CONFIG_CLK_RK3036=y
CONFIG_CLK_RK312X=y
CONFIG_CLK_RK3188=y
CONFIG_CLK_RK322X=y
CONFIG_CLK_RK3288=y
CONFIG_COMMON_CLK_SAMSUNG=y
CONFIG_EXYNOS_3250_COMMON_CLK=y
CONFIG_EXYNOS_4_COMMON_CLK=y
CONFIG_EXYNOS_5250_COMMON_CLK=y
CONFIG_EXYNOS_5260_COMMON_CLK=y
CONFIG_EXYNOS_5410_COMMON_CLK=y
CONFIG_EXYNOS_5420_COMMON_CLK=y
CONFIG_EXYNOS_AUDSS_CLK_CON=y
CONFIG_EXYNOS_CLKOUT=y
CONFIG_CLK_INTEL_SOCFPGA=y
CONFIG_CLK_INTEL_SOCFPGA32=y
CONFIG_CLK_SUNXI=y
CONFIG_CLK_SUNXI_CLOCKS=y
CONFIG_CLK_SUNXI_PRCM_SUN6I=y
CONFIG_CLK_SUNXI_PRCM_SUN8I=y
CONFIG_CLK_SUNXI_PRCM_SUN9I=y
CONFIG_SUNXI_CCU=y
CONFIG_SUN4I_A10_CCU=y
CONFIG_SUN5I_CCU=y
CONFIG_SUN6I_A31_CCU=y
CONFIG_SUN6I_RTC_CCU=y
CONFIG_SUN8I_A23_CCU=y
CONFIG_SUN8I_A33_CCU=y
CONFIG_SUN8I_A83T_CCU=y
CONFIG_SUN8I_H3_CCU=y
CONFIG_SUN8I_V3S_CCU=y
CONFIG_SUN8I_DE2_CCU=y
CONFIG_SUN8I_R40_CCU=y
CONFIG_SUN9I_A80_CCU=y
CONFIG_SUN8I_R_CCU=y
CONFIG_TEGRA_CLK_DFLL=y
CONFIG_TEGRA124_CLK_EMC=y
CONFIG_COMMON_CLK_TI_ADPLL=y
CONFIG_CLK_UNIPHIER=y
# CONFIG_XILINX_VCU is not set
# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set
CONFIG_HWSPINLOCK=y
# CONFIG_HWSPINLOCK_OMAP is not set
CONFIG_HWSPINLOCK_QCOM=y
# CONFIG_HWSPINLOCK_STM32 is not set
# CONFIG_HWSPINLOCK_SUN6I is not set
# CONFIG_HSEM_U8500 is not set

#
# Clock Source drivers
#
CONFIG_TIMER_OF=y
CONFIG_TIMER_PROBE=y
CONFIG_OMAP_DM_SYSTIMER=y
CONFIG_CLKSRC_MMIO=y
CONFIG_BCM2835_TIMER=y
CONFIG_BCM_KONA_TIMER=y
CONFIG_DIGICOLOR_TIMER=y
CONFIG_OMAP_DM_TIMER=y
CONFIG_DW_APB_TIMER=y
CONFIG_DW_APB_TIMER_OF=y
CONFIG_ROCKCHIP_TIMER=y
CONFIG_ARMADA_370_XP_TIMER=y
CONFIG_MESON6_TIMER=y
CONFIG_ORION_TIMER=y
CONFIG_OWL_TIMER=y
CONFIG_SUN4I_TIMER=y
CONFIG_SUN5I_HSTIMER=y
CONFIG_TEGRA_TIMER=y
# CONFIG_TEGRA186_TIMER is not set
CONFIG_VT8500_TIMER=y
CONFIG_CADENCE_TTC_TIMER=y
CONFIG_CLKSRC_NOMADIK_MTU=y
CONFIG_CLKSRC_DBX500_PRCMU=y
CONFIG_KEYSTONE_TIMER=y
CONFIG_CLKSRC_TI_32K=y
CONFIG_CLKSRC_STM32=y
# CONFIG_CLKSRC_STM32_LP is not set
CONFIG_ARM_ARCH_TIMER=y
CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
CONFIG_ARM_GLOBAL_TIMER=y
CONFIG_ARM_GT_INITIAL_PRESCALER_VAL=2
CONFIG_ARM_TIMER_SP804=y
CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y
CONFIG_ATMEL_PIT=y
CONFIG_ATMEL_TCB_CLKSRC=y
CONFIG_CLKSRC_EXYNOS_MCT=y
CONFIG_CLKSRC_SAMSUNG_PWM=y
CONFIG_SYS_SUPPORTS_SH_CMT=y
CONFIG_MTK_TIMER=y
CONFIG_SYS_SUPPORTS_SH_MTU2=y
CONFIG_SYS_SUPPORTS_SH_TMU=y
CONFIG_SYS_SUPPORTS_EM_STI=y
CONFIG_SH_TIMER_CMT=y
CONFIG_SH_TIMER_MTU2=y
CONFIG_RENESAS_OSTM=y
CONFIG_SH_TIMER_TMU=y
CONFIG_EM_TIMER_STI=y
CONFIG_CLKSRC_QCOM=y
CONFIG_CLKSRC_VERSATILE=y
CONFIG_CLKSRC_IMX_GPT=y
CONFIG_CLKSRC_IMX_TPM=y
CONFIG_CLKSRC_ST_LPC=y
CONFIG_GXP_TIMER=y
CONFIG_MILBEAUT_TIMER=y
CONFIG_MICROCHIP_PIT64B=y
# end of Clock Source drivers

CONFIG_MAILBOX=y
# CONFIG_ARM_MHU is not set
# CONFIG_ARM_MHU_V2 is not set
# CONFIG_IMX_MBOX is not set
# CONFIG_PLATFORM_MHU is not set
CONFIG_PL320_MBOX=y
# CONFIG_ARMADA_37XX_RWTM_MBOX is not set
# CONFIG_OMAP2PLUS_MBOX is not set
# CONFIG_ROCKCHIP_MBOX is not set
# CONFIG_ALTERA_MBOX is not set
CONFIG_BCM2835_MBOX=y
CONFIG_STI_MBOX=m
# CONFIG_TI_MESSAGE_MANAGER is not set
CONFIG_HI3660_MBOX=y
CONFIG_HI6220_MBOX=y
# CONFIG_MAILBOX_TEST is not set
CONFIG_QCOM_APCS_IPC=y
# CONFIG_TEGRA_HSP_MBOX is not set
# CONFIG_BCM_PDC_MBOX is not set
# CONFIG_STM32_IPCC is not set
# CONFIG_MTK_ADSP_MBOX is not set
# CONFIG_MTK_CMDQ_MBOX is not set
CONFIG_SUN6I_MSGBOX=y
CONFIG_QCOM_IPCC=y
CONFIG_IOMMU_IOVA=y
CONFIG_IOMMU_API=y
CONFIG_IOMMU_SUPPORT=y

#
# Generic IOMMU Pagetable Support
#
CONFIG_IOMMU_IO_PGTABLE=y
CONFIG_IOMMU_IO_PGTABLE_LPAE=y
# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set
# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set
# end of Generic IOMMU Pagetable Support

# CONFIG_IOMMU_DEBUGFS is not set
CONFIG_IOMMU_DEFAULT_DMA_STRICT=y
# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set
# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set
CONFIG_OF_IOMMU=y
# CONFIG_MSM_IOMMU is not set
# CONFIG_IOMMUFD is not set
# CONFIG_OMAP_IOMMU is not set
CONFIG_ROCKCHIP_IOMMU=y
# CONFIG_SUN50I_IOMMU is not set
CONFIG_TEGRA_IOMMU_GART=y
CONFIG_TEGRA_IOMMU_SMMU=y
CONFIG_EXYNOS_IOMMU=y
# CONFIG_EXYNOS_IOMMU_DEBUG is not set
# CONFIG_IPMMU_VMSA is not set
# CONFIG_ARM_SMMU is not set
# CONFIG_MTK_IOMMU is not set
# CONFIG_MTK_IOMMU_V1 is not set
CONFIG_QCOM_IOMMU=y

#
# Remoteproc drivers
#
CONFIG_REMOTEPROC=y
# CONFIG_REMOTEPROC_CDEV is not set
# CONFIG_IMX_REMOTEPROC is not set
# CONFIG_IMX_DSP_REMOTEPROC is not set
# CONFIG_MTK_SCP is not set
# CONFIG_WKUP_M3_RPROC is not set
# CONFIG_KEYSTONE_REMOTEPROC is not set
# CONFIG_MESON_MX_AO_ARC_REMOTEPROC is not set
CONFIG_QCOM_PIL_INFO=m
CONFIG_QCOM_RPROC_COMMON=m
CONFIG_QCOM_Q6V5_COMMON=m
# CONFIG_QCOM_Q6V5_ADSP is not set
CONFIG_QCOM_Q6V5_MSS=m
# CONFIG_QCOM_Q6V5_PAS is not set
# CONFIG_QCOM_Q6V5_WCSS is not set
CONFIG_QCOM_SYSMON=m
CONFIG_QCOM_WCNSS_PIL=m
# CONFIG_RCAR_REMOTEPROC is not set
CONFIG_ST_REMOTEPROC=m
CONFIG_ST_SLIM_REMOTEPROC=m
# CONFIG_STM32_RPROC is not set
# end of Remoteproc drivers

#
# Rpmsg drivers
#
CONFIG_RPMSG=y
# CONFIG_RPMSG_CHAR is not set
# CONFIG_RPMSG_CTRL is not set
CONFIG_RPMSG_NS=m
# CONFIG_RPMSG_QCOM_GLINK_RPM is not set
# CONFIG_RPMSG_QCOM_GLINK_SMEM is not set
CONFIG_RPMSG_QCOM_SMD=y
CONFIG_RPMSG_VIRTIO=m
# end of Rpmsg drivers

# CONFIG_SOUNDWIRE is not set

#
# SOC (System On Chip) specific Drivers
#
CONFIG_OWL_PM_DOMAINS_HELPER=y
# CONFIG_OWL_PM_DOMAINS is not set

#
# Amlogic SoC drivers
#
# CONFIG_MESON_CANVAS is not set
CONFIG_MESON_CLK_MEASURE=y
CONFIG_MESON_GX_PM_DOMAINS=y
CONFIG_MESON_EE_PM_DOMAINS=y
CONFIG_MESON_MX_SOCINFO=y
# end of Amlogic SoC drivers

#
# ASPEED SoC drivers
#
CONFIG_ASPEED_LPC_CTRL=m
CONFIG_ASPEED_LPC_SNOOP=m
CONFIG_ASPEED_UART_ROUTING=y
CONFIG_ASPEED_P2A_CTRL=m
CONFIG_ASPEED_SOCINFO=y
# end of ASPEED SoC drivers

CONFIG_AT91_SOC_ID=y
# CONFIG_AT91_SOC_SFR is not set

#
# Broadcom SoC drivers
#
CONFIG_BCM2835_POWER=y
CONFIG_RASPBERRYPI_POWER=y
CONFIG_SOC_BRCMSTB=y
CONFIG_BCM_PMB=y
CONFIG_BRCMSTB_PM=y
# end of Broadcom SoC drivers

#
# NXP/Freescale QorIQ SoC drivers
#
# CONFIG_QUICC_ENGINE is not set
CONFIG_FSL_GUTS=y
# CONFIG_FSL_RCPM is not set
# end of NXP/Freescale QorIQ SoC drivers

#
# fujitsu SoC drivers
#
# end of fujitsu SoC drivers

#
# i.MX SoC drivers
#
CONFIG_IMX_GPCV2_PM_DOMAINS=y
# CONFIG_SOC_IMX8M is not set
# CONFIG_SOC_IMX9 is not set
# end of i.MX SoC drivers

#
# Enable LiteX SoC Builder specific drivers
#
# CONFIG_LITEX_SOC_CONTROLLER is not set
# end of Enable LiteX SoC Builder specific drivers

#
# MediaTek SoC drivers
#
# CONFIG_MTK_CMDQ is not set
# CONFIG_MTK_DEVAPC is not set
CONFIG_MTK_INFRACFG=y
# CONFIG_MTK_PMIC_WRAP is not set
CONFIG_MTK_SCPSYS=y
CONFIG_MTK_SCPSYS_PM_DOMAINS=y
CONFIG_MTK_MMSYS=y
# end of MediaTek SoC drivers

CONFIG_PLAT_PXA=y
CONFIG_PXA_SSP=m

#
# Qualcomm SoC drivers
#
# CONFIG_QCOM_AOSS_QMP is not set
CONFIG_QCOM_COMMAND_DB=m
CONFIG_QCOM_CPR=y
# CONFIG_QCOM_GENI_SE is not set
CONFIG_QCOM_GSBI=y
# CONFIG_QCOM_LLCC is not set
CONFIG_QCOM_MDT_LOADER=m
CONFIG_QCOM_OCMEM=m
CONFIG_QCOM_QMI_HELPERS=m
CONFIG_QCOM_RMTFS_MEM=m
CONFIG_QCOM_RPMH=m
CONFIG_QCOM_RPMHPD=m
CONFIG_QCOM_RPMPD=y
CONFIG_QCOM_SMEM=y
CONFIG_QCOM_SMD_RPM=y
CONFIG_QCOM_SMEM_STATE=y
CONFIG_QCOM_SMP2P=y
CONFIG_QCOM_SMSM=y
CONFIG_QCOM_SOCINFO=m
CONFIG_QCOM_SPM=y
CONFIG_QCOM_STATS=m
CONFIG_QCOM_WCNSS_CTRL=m
# CONFIG_QCOM_APR is not set
# CONFIG_QCOM_ICC_BWMON is not set
# end of Qualcomm SoC drivers

CONFIG_SOC_RENESAS=y
CONFIG_ARCH_RCAR_GEN1=y
CONFIG_ARCH_RCAR_GEN2=y
CONFIG_ARCH_RMOBILE=y
CONFIG_ARCH_RZN1=y
CONFIG_ARCH_EMEV2=y
CONFIG_ARCH_R8A7794=y
CONFIG_ARCH_R8A7779=y
CONFIG_ARCH_R8A7790=y
CONFIG_ARCH_R8A7778=y
CONFIG_ARCH_R8A7793=y
CONFIG_ARCH_R8A7791=y
CONFIG_ARCH_R8A7792=y
CONFIG_ARCH_R8A7740=y
CONFIG_ARCH_R8A73A4=y
CONFIG_ARCH_R7S72100=y
CONFIG_ARCH_R7S9210=y
CONFIG_ARCH_R8A77470=y
CONFIG_ARCH_R8A7745=y
CONFIG_ARCH_R8A7742=y
CONFIG_ARCH_R8A7743=y
CONFIG_ARCH_R8A7744=y
CONFIG_ARCH_R9A06G032=y
CONFIG_ARCH_SH73A0=y
CONFIG_RST_RCAR=y
CONFIG_SYSC_RCAR=y
CONFIG_SYSC_R8A7794=y
CONFIG_SYSC_R8A7779=y
CONFIG_SYSC_R8A7790=y
CONFIG_SYSC_R8A7791=y
CONFIG_SYSC_R8A7792=y
CONFIG_SYSC_RMOBILE=y
CONFIG_SYSC_R8A77470=y
CONFIG_SYSC_R8A7745=y
CONFIG_SYSC_R8A7742=y
CONFIG_SYSC_R8A7743=y
CONFIG_ROCKCHIP_GRF=y
CONFIG_ROCKCHIP_IODOMAIN=y
CONFIG_ROCKCHIP_PM_DOMAINS=y
CONFIG_SOC_SAMSUNG=y
CONFIG_EXYNOS_ASV_ARM=y
CONFIG_EXYNOS_CHIPID=y
# CONFIG_EXYNOS_USI is not set
CONFIG_EXYNOS_PMU=y
CONFIG_EXYNOS_PMU_ARM_DRIVERS=y
CONFIG_EXYNOS_PM_DOMAINS=y
CONFIG_EXYNOS_REGULATOR_COUPLER=y
CONFIG_SUNXI_MBUS=y
CONFIG_SUNXI_SRAM=y
CONFIG_ARCH_TEGRA_2x_SOC=y
CONFIG_ARCH_TEGRA_3x_SOC=y
CONFIG_ARCH_TEGRA_114_SOC=y
CONFIG_ARCH_TEGRA_124_SOC=y
CONFIG_SOC_TEGRA_FUSE=y
CONFIG_SOC_TEGRA_FLOWCTRL=y
CONFIG_SOC_TEGRA_PMC=y
CONFIG_SOC_TEGRA20_VOLTAGE_COUPLER=y
CONFIG_SOC_TEGRA30_VOLTAGE_COUPLER=y
# CONFIG_SOC_TI is not set
CONFIG_UX500_SOC_ID=y

#
# Xilinx SoC drivers
#
# end of Xilinx SoC drivers
# end of SOC (System On Chip) specific Drivers

CONFIG_PM_DEVFREQ=y

#
# DEVFREQ Governors
#
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set
# CONFIG_DEVFREQ_GOV_POWERSAVE is not set
# CONFIG_DEVFREQ_GOV_USERSPACE is not set
CONFIG_DEVFREQ_GOV_PASSIVE=m

#
# DEVFREQ Drivers
#
CONFIG_ARM_EXYNOS_BUS_DEVFREQ=m
# CONFIG_ARM_IMX_BUS_DEVFREQ is not set
# CONFIG_ARM_IMX8M_DDRC_DEVFREQ is not set
CONFIG_ARM_TEGRA_DEVFREQ=m
# CONFIG_ARM_RK3399_DMC_DEVFREQ is not set
# CONFIG_ARM_SUN8I_A33_MBUS_DEVFREQ is not set
CONFIG_PM_DEVFREQ_EVENT=y
CONFIG_DEVFREQ_EVENT_EXYNOS_NOCP=m
CONFIG_DEVFREQ_EVENT_EXYNOS_PPMU=m
# CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI is not set
CONFIG_EXTCON=y

#
# Extcon Device Drivers
#
# CONFIG_EXTCON_ADC_JACK is not set
# CONFIG_EXTCON_FSA9480 is not set
# CONFIG_EXTCON_GPIO is not set
CONFIG_EXTCON_MAX14577=m
# CONFIG_EXTCON_MAX3355 is not set
CONFIG_EXTCON_MAX77693=m
CONFIG_EXTCON_MAX8997=m
# CONFIG_EXTCON_PALMAS is not set
# CONFIG_EXTCON_PTN5150 is not set
# CONFIG_EXTCON_QCOM_SPMI_MISC is not set
# CONFIG_EXTCON_RT8973A is not set
# CONFIG_EXTCON_SM5502 is not set
CONFIG_EXTCON_USB_GPIO=y
# CONFIG_EXTCON_USBC_CROS_EC is not set
# CONFIG_EXTCON_USBC_TUSB320 is not set
CONFIG_MEMORY=y
CONFIG_DDR=y
# CONFIG_ARM_PL172_MPMC is not set
CONFIG_ATMEL_SDRAMC=y
CONFIG_ATMEL_EBI=y
CONFIG_BRCMSTB_DPFE=y
CONFIG_BRCMSTB_MEMC=y
CONFIG_TI_AEMIF=y
# CONFIG_TI_EMIF is not set
CONFIG_OMAP_GPMC=y
# CONFIG_OMAP_GPMC_DEBUG is not set
# CONFIG_TI_EMIF_SRAM is not set
CONFIG_MVEBU_DEVBUS=y
CONFIG_PL353_SMC=y
# CONFIG_RENESAS_RPCIF is not set
CONFIG_STM32_FMC2_EBI=y
CONFIG_SAMSUNG_MC=y
CONFIG_EXYNOS5422_DMC=m
CONFIG_EXYNOS_SROM=y
CONFIG_TEGRA_MC=y
CONFIG_TEGRA20_EMC=y
CONFIG_TEGRA30_EMC=y
CONFIG_TEGRA124_EMC=y
CONFIG_IIO=y
CONFIG_IIO_BUFFER=y
CONFIG_IIO_BUFFER_CB=m
# CONFIG_IIO_BUFFER_DMA is not set
# CONFIG_IIO_BUFFER_DMAENGINE is not set
CONFIG_IIO_BUFFER_HW_CONSUMER=m
CONFIG_IIO_KFIFO_BUF=y
CONFIG_IIO_TRIGGERED_BUFFER=y
CONFIG_IIO_CONFIGFS=y
CONFIG_IIO_TRIGGER=y
CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
# CONFIG_IIO_SW_DEVICE is not set
CONFIG_IIO_SW_TRIGGER=y
# CONFIG_IIO_TRIGGERED_EVENT is not set

#
# Accelerometers
#
# CONFIG_ADIS16201 is not set
# CONFIG_ADIS16209 is not set
# CONFIG_ADXL313_I2C is not set
# CONFIG_ADXL313_SPI is not set
# CONFIG_ADXL355_I2C is not set
# CONFIG_ADXL355_SPI is not set
# CONFIG_ADXL367_SPI is not set
# CONFIG_ADXL367_I2C is not set
# CONFIG_ADXL372_SPI is not set
# CONFIG_ADXL372_I2C is not set
# CONFIG_BMA180 is not set
# CONFIG_BMA220 is not set
# CONFIG_BMA400 is not set
# CONFIG_BMC150_ACCEL is not set
# CONFIG_BMI088_ACCEL is not set
# CONFIG_DA280 is not set
# CONFIG_DA311 is not set
# CONFIG_DMARD06 is not set
# CONFIG_DMARD09 is not set
# CONFIG_DMARD10 is not set
# CONFIG_FXLS8962AF_I2C is not set
# CONFIG_FXLS8962AF_SPI is not set
# CONFIG_IIO_CROS_EC_ACCEL_LEGACY is not set
# CONFIG_IIO_ST_ACCEL_3AXIS is not set
# CONFIG_KXSD9 is not set
# CONFIG_KXCJK1013 is not set
# CONFIG_MC3230 is not set
# CONFIG_MMA7455_I2C is not set
# CONFIG_MMA7455_SPI is not set
# CONFIG_MMA7660 is not set
# CONFIG_MMA8452 is not set
# CONFIG_MMA9551 is not set
# CONFIG_MMA9553 is not set
# CONFIG_MSA311 is not set
# CONFIG_MXC4005 is not set
# CONFIG_MXC6255 is not set
# CONFIG_SCA3000 is not set
# CONFIG_SCA3300 is not set
# CONFIG_STK8312 is not set
# CONFIG_STK8BA50 is not set
# end of Accelerometers

#
# Analog to digital converters
#
CONFIG_AB8500_GPADC=y
# CONFIG_AD7091R5 is not set
# CONFIG_AD7124 is not set
# CONFIG_AD7192 is not set
# CONFIG_AD7266 is not set
# CONFIG_AD7280 is not set
# CONFIG_AD7291 is not set
# CONFIG_AD7292 is not set
# CONFIG_AD7298 is not set
# CONFIG_AD7476 is not set
# CONFIG_AD7606_IFACE_PARALLEL is not set
# CONFIG_AD7606_IFACE_SPI is not set
# CONFIG_AD7766 is not set
# CONFIG_AD7768_1 is not set
# CONFIG_AD7780 is not set
# CONFIG_AD7791 is not set
# CONFIG_AD7793 is not set
# CONFIG_AD7887 is not set
# CONFIG_AD7923 is not set
# CONFIG_AD7949 is not set
# CONFIG_AD799X is not set
# CONFIG_ADI_AXI_ADC is not set
CONFIG_ASPEED_ADC=m
CONFIG_AT91_ADC=m
CONFIG_AT91_SAMA5D2_ADC=m
# CONFIG_AXP20X_ADC is not set
# CONFIG_AXP288_ADC is not set
CONFIG_BCM_IPROC_ADC=y
CONFIG_BERLIN2_ADC=m
# CONFIG_CC10001_ADC is not set
CONFIG_CPCAP_ADC=m
# CONFIG_ENVELOPE_DETECTOR is not set
CONFIG_EXYNOS_ADC=m
# CONFIG_HI8435 is not set
# CONFIG_HX711 is not set
# CONFIG_INA2XX_ADC is not set
# CONFIG_IMX7D_ADC is not set
# CONFIG_IMX8QXP_ADC is not set
# CONFIG_LTC2471 is not set
# CONFIG_LTC2485 is not set
# CONFIG_LTC2496 is not set
# CONFIG_LTC2497 is not set
# CONFIG_MAX1027 is not set
# CONFIG_MAX11100 is not set
# CONFIG_MAX1118 is not set
# CONFIG_MAX11205 is not set
# CONFIG_MAX1241 is not set
# CONFIG_MAX1363 is not set
# CONFIG_MAX9611 is not set
# CONFIG_MCP320X is not set
# CONFIG_MCP3422 is not set
# CONFIG_MCP3911 is not set
# CONFIG_MEDIATEK_MT6577_AUXADC is not set
CONFIG_MESON_SARADC=m
# CONFIG_NAU7802 is not set
# CONFIG_PALMAS_GPADC is not set
CONFIG_QCOM_VADC_COMMON=m
# CONFIG_QCOM_PM8XXX_XOADC is not set
# CONFIG_QCOM_SPMI_RRADC is not set
# CONFIG_QCOM_SPMI_IADC is not set
CONFIG_QCOM_SPMI_VADC=m
# CONFIG_QCOM_SPMI_ADC5 is not set
# CONFIG_RCAR_GYRO_ADC is not set
# CONFIG_RN5T618_ADC is not set
CONFIG_ROCKCHIP_SARADC=m
# CONFIG_RICHTEK_RTQ6056 is not set
# CONFIG_SPEAR_ADC is not set
# CONFIG_SD_ADC_MODULATOR is not set
CONFIG_STM32_ADC_CORE=m
CONFIG_STM32_ADC=m
CONFIG_STM32_DFSDM_CORE=m
CONFIG_STM32_DFSDM_ADC=m
CONFIG_STMPE_ADC=m
# CONFIG_SUN4I_GPADC is not set
# CONFIG_TI_ADC081C is not set
# CONFIG_TI_ADC0832 is not set
# CONFIG_TI_ADC084S021 is not set
# CONFIG_TI_ADC12138 is not set
# CONFIG_TI_ADC108S102 is not set
# CONFIG_TI_ADC128S052 is not set
# CONFIG_TI_ADC161S626 is not set
# CONFIG_TI_ADS1015 is not set
# CONFIG_TI_ADS7950 is not set
# CONFIG_TI_ADS8344 is not set
# CONFIG_TI_ADS8688 is not set
# CONFIG_TI_ADS124S08 is not set
# CONFIG_TI_ADS131E08 is not set
# CONFIG_TI_TLC4541 is not set
# CONFIG_TI_TSC2046 is not set
# CONFIG_TWL4030_MADC is not set
# CONFIG_TWL6030_GPADC is not set
CONFIG_VF610_ADC=m
CONFIG_XILINX_XADC=y
# end of Analog to digital converters

#
# Analog to digital and digital to analog converters
#
# CONFIG_AD74413R is not set
# end of Analog to digital and digital to analog converters

#
# Analog Front Ends
#
# CONFIG_IIO_RESCALE is not set
# end of Analog Front Ends

#
# Amplifiers
#
# CONFIG_AD8366 is not set
# CONFIG_ADA4250 is not set
# CONFIG_HMC425 is not set
# end of Amplifiers

#
# Capacitance to digital converters
#
# CONFIG_AD7150 is not set
# CONFIG_AD7746 is not set
# end of Capacitance to digital converters

#
# Chemical Sensors
#
# CONFIG_ATLAS_PH_SENSOR is not set
# CONFIG_ATLAS_EZO_SENSOR is not set
# CONFIG_BME680 is not set
# CONFIG_CCS811 is not set
# CONFIG_IAQCORE is not set
# CONFIG_PMS7003 is not set
# CONFIG_SCD30_CORE is not set
# CONFIG_SCD4X is not set
# CONFIG_SENSIRION_SGP30 is not set
# CONFIG_SENSIRION_SGP40 is not set
# CONFIG_SPS30_I2C is not set
# CONFIG_SPS30_SERIAL is not set
# CONFIG_SENSEAIR_SUNRISE_CO2 is not set
# CONFIG_VZ89X is not set
# end of Chemical Sensors

CONFIG_IIO_CROS_EC_SENSORS_CORE=m
CONFIG_IIO_CROS_EC_SENSORS=m
# CONFIG_IIO_CROS_EC_SENSORS_LID_ANGLE is not set

#
# Hid Sensor IIO Common
#
# end of Hid Sensor IIO Common

#
# IIO SCMI Sensors
#
# CONFIG_IIO_SCMI is not set
# end of IIO SCMI Sensors

#
# SSP Sensor Common
#
# CONFIG_IIO_SSP_SENSORHUB is not set
# end of SSP Sensor Common

#
# Digital to analog converters
#
# CONFIG_AD3552R is not set
# CONFIG_AD5064 is not set
# CONFIG_AD5360 is not set
# CONFIG_AD5380 is not set
# CONFIG_AD5421 is not set
# CONFIG_AD5446 is not set
# CONFIG_AD5449 is not set
# CONFIG_AD5592R is not set
# CONFIG_AD5593R is not set
# CONFIG_AD5504 is not set
# CONFIG_AD5624R_SPI is not set
# CONFIG_LTC2688 is not set
# CONFIG_AD5686_SPI is not set
# CONFIG_AD5696_I2C is not set
# CONFIG_AD5755 is not set
# CONFIG_AD5758 is not set
# CONFIG_AD5761 is not set
# CONFIG_AD5764 is not set
# CONFIG_AD5766 is not set
# CONFIG_AD5770R is not set
# CONFIG_AD5791 is not set
# CONFIG_AD7293 is not set
# CONFIG_AD7303 is not set
# CONFIG_AD8801 is not set
# CONFIG_DPOT_DAC is not set
# CONFIG_DS4424 is not set
# CONFIG_LTC1660 is not set
# CONFIG_LTC2632 is not set
# CONFIG_M62332 is not set
# CONFIG_MAX517 is not set
# CONFIG_MAX5821 is not set
# CONFIG_MCP4725 is not set
# CONFIG_MCP4922 is not set
CONFIG_STM32_DAC=m
CONFIG_STM32_DAC_CORE=m
# CONFIG_TI_DAC082S085 is not set
# CONFIG_TI_DAC5571 is not set
# CONFIG_TI_DAC7311 is not set
# CONFIG_TI_DAC7612 is not set
# CONFIG_VF610_DAC is not set
# end of Digital to analog converters

#
# IIO dummy driver
#
# end of IIO dummy driver

#
# Filters
#
# end of Filters

#
# Frequency Synthesizers DDS/PLL
#

#
# Clock Generator/Distribution
#
# CONFIG_AD9523 is not set
# end of Clock Generator/Distribution

#
# Phase-Locked Loop (PLL) frequency synthesizers
#
# CONFIG_ADF4350 is not set
# CONFIG_ADF4371 is not set
# CONFIG_ADMV1013 is not set
# CONFIG_ADMV4420 is not set
# CONFIG_ADRF6780 is not set
# end of Phase-Locked Loop (PLL) frequency synthesizers
# end of Frequency Synthesizers DDS/PLL

#
# Digital gyroscope sensors
#
# CONFIG_ADIS16080 is not set
# CONFIG_ADIS16130 is not set
# CONFIG_ADIS16136 is not set
# CONFIG_ADIS16260 is not set
# CONFIG_ADXRS290 is not set
# CONFIG_ADXRS450 is not set
# CONFIG_BMG160 is not set
# CONFIG_FXAS21002C is not set
CONFIG_MPU3050=y
CONFIG_MPU3050_I2C=y
# CONFIG_IIO_ST_GYRO_3AXIS is not set
# CONFIG_ITG3200 is not set
# end of Digital gyroscope sensors

#
# Health Sensors
#

#
# Heart Rate Monitors
#
# CONFIG_AFE4403 is not set
# CONFIG_AFE4404 is not set
# CONFIG_MAX30100 is not set
# CONFIG_MAX30102 is not set
# end of Heart Rate Monitors
# end of Health Sensors

#
# Humidity sensors
#
# CONFIG_AM2315 is not set
# CONFIG_DHT11 is not set
# CONFIG_HDC100X is not set
# CONFIG_HDC2010 is not set
# CONFIG_HTS221 is not set
# CONFIG_HTU21 is not set
# CONFIG_SI7005 is not set
# CONFIG_SI7020 is not set
# end of Humidity sensors

#
# Inertial measurement units
#
# CONFIG_ADIS16400 is not set
# CONFIG_ADIS16460 is not set
# CONFIG_ADIS16475 is not set
# CONFIG_ADIS16480 is not set
# CONFIG_BMI160_I2C is not set
# CONFIG_BMI160_SPI is not set
# CONFIG_BOSCH_BNO055_SERIAL is not set
# CONFIG_BOSCH_BNO055_I2C is not set
# CONFIG_FXOS8700_I2C is not set
# CONFIG_FXOS8700_SPI is not set
# CONFIG_KMX61 is not set
# CONFIG_INV_ICM42600_I2C is not set
# CONFIG_INV_ICM42600_SPI is not set
# CONFIG_INV_MPU6050_I2C is not set
# CONFIG_INV_MPU6050_SPI is not set
# CONFIG_IIO_ST_LSM6DSX is not set
# CONFIG_IIO_ST_LSM9DS0 is not set
# end of Inertial measurement units

#
# Light sensors
#
# CONFIG_ADJD_S311 is not set
# CONFIG_ADUX1020 is not set
# CONFIG_AL3010 is not set
# CONFIG_AL3320A is not set
# CONFIG_APDS9300 is not set
# CONFIG_APDS9960 is not set
# CONFIG_AS73211 is not set
# CONFIG_BH1750 is not set
# CONFIG_BH1780 is not set
# CONFIG_CM32181 is not set
# CONFIG_CM3232 is not set
# CONFIG_CM3323 is not set
# CONFIG_CM3605 is not set
CONFIG_CM36651=m
CONFIG_IIO_CROS_EC_LIGHT_PROX=m
# CONFIG_GP2AP002 is not set
# CONFIG_GP2AP020A00F is not set
CONFIG_SENSORS_ISL29018=y
CONFIG_SENSORS_ISL29028=y
# CONFIG_ISL29125 is not set
# CONFIG_JSA1212 is not set
# CONFIG_RPR0521 is not set
# CONFIG_LTR501 is not set
# CONFIG_LTRF216A is not set
# CONFIG_LV0104CS is not set
# CONFIG_MAX44000 is not set
# CONFIG_MAX44009 is not set
# CONFIG_NOA1305 is not set
# CONFIG_OPT3001 is not set
# CONFIG_PA12203001 is not set
# CONFIG_SI1133 is not set
# CONFIG_SI1145 is not set
# CONFIG_STK3310 is not set
# CONFIG_ST_UVIS25 is not set
# CONFIG_TCS3414 is not set
# CONFIG_TCS3472 is not set
# CONFIG_SENSORS_TSL2563 is not set
# CONFIG_TSL2583 is not set
# CONFIG_TSL2591 is not set
# CONFIG_TSL2772 is not set
# CONFIG_TSL4531 is not set
# CONFIG_US5182D is not set
# CONFIG_VCNL4000 is not set
# CONFIG_VCNL4035 is not set
# CONFIG_VEML6030 is not set
# CONFIG_VEML6070 is not set
# CONFIG_VL6180 is not set
# CONFIG_ZOPT2201 is not set
# end of Light sensors

#
# Magnetometer sensors
#
# CONFIG_AK8974 is not set
CONFIG_AK8975=y
# CONFIG_AK09911 is not set
# CONFIG_BMC150_MAGN_I2C is not set
# CONFIG_BMC150_MAGN_SPI is not set
# CONFIG_MAG3110 is not set
# CONFIG_MMC35240 is not set
# CONFIG_IIO_ST_MAGN_3AXIS is not set
# CONFIG_SENSORS_HMC5843_I2C is not set
# CONFIG_SENSORS_HMC5843_SPI is not set
# CONFIG_SENSORS_RM3100_I2C is not set
# CONFIG_SENSORS_RM3100_SPI is not set
# CONFIG_YAMAHA_YAS530 is not set
# end of Magnetometer sensors

#
# Multiplexers
#
# CONFIG_IIO_MUX is not set
# end of Multiplexers

#
# Inclinometer sensors
#
# end of Inclinometer sensors

#
# Triggers - standalone
#
CONFIG_IIO_HRTIMER_TRIGGER=y
# CONFIG_IIO_INTERRUPT_TRIGGER is not set
CONFIG_IIO_STM32_LPTIMER_TRIGGER=m
CONFIG_IIO_STM32_TIMER_TRIGGER=m
# CONFIG_IIO_TIGHTLOOP_TRIGGER is not set
# CONFIG_IIO_SYSFS_TRIGGER is not set
# end of Triggers - standalone

#
# Linear and angular position sensors
#
# end of Linear and angular position sensors

#
# Digital potentiometers
#
# CONFIG_AD5110 is not set
# CONFIG_AD5272 is not set
# CONFIG_DS1803 is not set
# CONFIG_MAX5432 is not set
# CONFIG_MAX5481 is not set
# CONFIG_MAX5487 is not set
# CONFIG_MCP4018 is not set
# CONFIG_MCP4131 is not set
# CONFIG_MCP4531 is not set
# CONFIG_MCP41010 is not set
# CONFIG_TPL0102 is not set
# end of Digital potentiometers

#
# Digital potentiostats
#
# CONFIG_LMP91000 is not set
# end of Digital potentiostats

#
# Pressure sensors
#
# CONFIG_ABP060MG is not set
# CONFIG_BMP280 is not set
# CONFIG_IIO_CROS_EC_BARO is not set
# CONFIG_DLHL60D is not set
# CONFIG_DPS310 is not set
# CONFIG_HP03 is not set
# CONFIG_ICP10100 is not set
# CONFIG_MPL115_I2C is not set
# CONFIG_MPL115_SPI is not set
# CONFIG_MPL3115 is not set
# CONFIG_MS5611 is not set
# CONFIG_MS5637 is not set
# CONFIG_IIO_ST_PRESS is not set
# CONFIG_T5403 is not set
# CONFIG_HP206C is not set
# CONFIG_ZPA2326 is not set
# end of Pressure sensors

#
# Lightning sensors
#
# CONFIG_AS3935 is not set
# end of Lightning sensors

#
# Proximity and distance sensors
#
# CONFIG_CROS_EC_MKBP_PROXIMITY is not set
# CONFIG_ISL29501 is not set
# CONFIG_LIDAR_LITE_V2 is not set
# CONFIG_MB1232 is not set
# CONFIG_PING is not set
# CONFIG_RFD77402 is not set
# CONFIG_SRF04 is not set
# CONFIG_SX9310 is not set
# CONFIG_SX9324 is not set
# CONFIG_SX9360 is not set
# CONFIG_SX9500 is not set
# CONFIG_SRF08 is not set
# CONFIG_VCNL3020 is not set
# CONFIG_VL53L0X_I2C is not set
# end of Proximity and distance sensors

#
# Resolver to digital converters
#
# CONFIG_AD2S90 is not set
# CONFIG_AD2S1200 is not set
# end of Resolver to digital converters

#
# Temperature sensors
#
# CONFIG_LTC2983 is not set
# CONFIG_MAXIM_THERMOCOUPLE is not set
# CONFIG_MLX90614 is not set
# CONFIG_MLX90632 is not set
# CONFIG_TMP006 is not set
# CONFIG_TMP007 is not set
# CONFIG_TMP117 is not set
# CONFIG_TSYS01 is not set
# CONFIG_TSYS02D is not set
# CONFIG_MAX31856 is not set
# CONFIG_MAX31865 is not set
# end of Temperature sensors

# CONFIG_NTB is not set
CONFIG_PWM=y
CONFIG_PWM_SYSFS=y
# CONFIG_PWM_DEBUG is not set
# CONFIG_PWM_AB8500 is not set
CONFIG_PWM_ATMEL=m
CONFIG_PWM_ATMEL_HLCDC_PWM=m
CONFIG_PWM_ATMEL_TCB=m
CONFIG_PWM_BCM_IPROC=y
CONFIG_PWM_BCM_KONA=y
CONFIG_PWM_BCM2835=y
# CONFIG_PWM_BERLIN is not set
CONFIG_PWM_BRCMSTB=m
# CONFIG_PWM_CLK is not set
# CONFIG_PWM_CROS_EC is not set
# CONFIG_PWM_DWC is not set
CONFIG_PWM_FSL_FTM=m
# CONFIG_PWM_HIBVT is not set
# CONFIG_PWM_IMX1 is not set
# CONFIG_PWM_IMX27 is not set
# CONFIG_PWM_IMX_TPM is not set
CONFIG_PWM_MESON=m
# CONFIG_PWM_MTK_DISP is not set
# CONFIG_PWM_MEDIATEK is not set
# CONFIG_PWM_OMAP_DMTIMER is not set
# CONFIG_PWM_PCA9685 is not set
# CONFIG_PWM_RASPBERRYPI_POE is not set
CONFIG_PWM_RCAR=m
CONFIG_PWM_RENESAS_TPU=y
CONFIG_PWM_ROCKCHIP=m
CONFIG_PWM_SAMSUNG=m
# CONFIG_PWM_SPEAR is not set
CONFIG_PWM_STI=y
CONFIG_PWM_STM32=m
CONFIG_PWM_STM32_LP=m
# CONFIG_PWM_STMPE is not set
CONFIG_PWM_SUN4I=y
# CONFIG_PWM_SUNPLUS is not set
CONFIG_PWM_TEGRA=y
# CONFIG_PWM_TIECAP is not set
# CONFIG_PWM_TIEHRPWM is not set
# CONFIG_PWM_TWL is not set
# CONFIG_PWM_TWL_LED is not set
CONFIG_PWM_VT8500=y
# CONFIG_PWM_XILINX is not set

#
# IRQ chip support
#
CONFIG_IRQCHIP=y
CONFIG_ARM_GIC=y
CONFIG_ARM_GIC_MAX_NR=1
CONFIG_ARM_GIC_V2M=y
CONFIG_GIC_NON_BANKED=y
CONFIG_ARM_GIC_V3=y
CONFIG_ARM_GIC_V3_ITS=y
CONFIG_ARM_GIC_V3_ITS_PCI=y
CONFIG_ARM_VIC=y
CONFIG_ARM_VIC_NR=2
CONFIG_ARMADA_370_XP_IRQ=y
CONFIG_ALPINE_MSI=y
# CONFIG_AL_FIC is not set
CONFIG_ATMEL_AIC5_IRQ=y
CONFIG_BCM7038_L1_IRQ=y
CONFIG_BCM7120_L2_IRQ=y
CONFIG_BRCMSTB_L2_IRQ=y
CONFIG_DW_APB_ICTL=y
CONFIG_OMAP_IRQCHIP=y
CONFIG_ORION_IRQCHIP=y
CONFIG_RENESAS_INTC_IRQPIN=y
CONFIG_RENESAS_IRQC=y
CONFIG_RENESAS_RZA1_IRQC=y
CONFIG_ST_IRQCHIP=y
CONFIG_SUN4I_INTC=y
CONFIG_SUN6I_R_INTC=y
CONFIG_SUNXI_NMI_INTC=y
# CONFIG_TS4800_IRQ is not set
# CONFIG_XILINX_INTC is not set
CONFIG_IRQ_CROSSBAR=y
CONFIG_KEYSTONE_IRQ=y
CONFIG_IMX_GPCV2=y
CONFIG_LS_EXTIRQ=y
CONFIG_LS_SCFG_MSI=y
CONFIG_PARTITION_PERCPU=y
CONFIG_STM32_EXTI=y
CONFIG_IRQ_UNIPHIER_AIDET=y
CONFIG_MESON_IRQ_GPIO=y
# CONFIG_QCOM_PDC is not set
# CONFIG_QCOM_MPM is not set
CONFIG_IMX_IRQSTEER=y
CONFIG_IMX_INTMUX=y
CONFIG_IMX_MU_MSI=m
CONFIG_EXYNOS_IRQ_COMBINER=y
CONFIG_MST_IRQ=y
# CONFIG_MCHP_EIC is not set
CONFIG_SUNPLUS_SP7021_INTC=y
# end of IRQ chip support

# CONFIG_IPACK_BUS is not set
CONFIG_ARCH_HAS_RESET_CONTROLLER=y
CONFIG_RESET_CONTROLLER=y
CONFIG_RESET_BERLIN=m
CONFIG_RESET_BRCMSTB=y
CONFIG_RESET_BRCMSTB_RESCAL=y
CONFIG_RESET_IMX7=y
CONFIG_RESET_MCHP_SPARX5=y
CONFIG_RESET_MESON=y
# CONFIG_RESET_MESON_AUDIO_ARB is not set
# CONFIG_RESET_QCOM_AOSS is not set
# CONFIG_RESET_QCOM_PDC is not set
CONFIG_RESET_RASPBERRYPI=y
CONFIG_RESET_SCMI=y
CONFIG_RESET_SIMPLE=y
CONFIG_RESET_SOCFPGA=y
CONFIG_RESET_SUNPLUS=y
CONFIG_RESET_SUNXI=y
# CONFIG_RESET_TI_SYSCON is not set
# CONFIG_RESET_TI_TPS380X is not set
CONFIG_RESET_UNIPHIER=y
CONFIG_RESET_UNIPHIER_GLUE=y
CONFIG_RESET_ZYNQ=y
CONFIG_STI_RESET_SYSCFG=y
CONFIG_STIH407_RESET=y
CONFIG_COMMON_RESET_HI3660=y
CONFIG_COMMON_RESET_HI6220=y

#
# PHY Subsystem
#
CONFIG_GENERIC_PHY=y
CONFIG_GENERIC_PHY_MIPI_DPHY=y
# CONFIG_PHY_CAN_TRANSCEIVER is not set
CONFIG_PHY_SUN4I_USB=y
CONFIG_PHY_SUN6I_MIPI_DPHY=m
CONFIG_PHY_SUN9I_USB=y
# CONFIG_PHY_SUN50I_USB3 is not set
# CONFIG_PHY_MESON8_HDMI_TX is not set
CONFIG_PHY_MESON8B_USB2=y
CONFIG_PHY_MESON_GXL_USB2=y
CONFIG_PHY_MESON_G12A_MIPI_DPHY_ANALOG=y
CONFIG_PHY_MESON_G12A_USB2=y
CONFIG_PHY_MESON_G12A_USB3_PCIE=y
CONFIG_PHY_MESON_AXG_PCIE=y
CONFIG_PHY_MESON_AXG_MIPI_PCIE_ANALOG=y
CONFIG_PHY_MESON_AXG_MIPI_DPHY=y

#
# PHY drivers for Broadcom platforms
#
CONFIG_PHY_CYGNUS_PCIE=y
CONFIG_PHY_BCM_SR_USB=y
# CONFIG_BCM_KONA_USB2_PHY is not set
# CONFIG_PHY_BCM_NS_USB2 is not set
# CONFIG_PHY_BCM_NS_USB3 is not set
CONFIG_PHY_NS2_PCIE=y
CONFIG_PHY_NS2_USB_DRD=y
CONFIG_PHY_BRCM_SATA=y
CONFIG_PHY_BRCM_USB=m
CONFIG_PHY_BCM_SR_PCIE=y
# end of PHY drivers for Broadcom platforms

# CONFIG_PHY_CADENCE_TORRENT is not set
# CONFIG_PHY_CADENCE_DPHY is not set
# CONFIG_PHY_CADENCE_DPHY_RX is not set
# CONFIG_PHY_CADENCE_SIERRA is not set
# CONFIG_PHY_CADENCE_SALVO is not set
CONFIG_PHY_HIX5HD2_SATA=y
CONFIG_ARMADA375_USBCLUSTER_PHY=y
CONFIG_PHY_BERLIN_SATA=y
CONFIG_PHY_BERLIN_USB=y
CONFIG_PHY_MVEBU_A3700_COMPHY=y
CONFIG_PHY_MVEBU_A3700_UTMI=y
# CONFIG_PHY_MVEBU_A38X_COMPHY is not set
# CONFIG_PHY_MVEBU_CP110_COMPHY is not set
# CONFIG_PHY_MVEBU_CP110_UTMI is not set
CONFIG_PHY_MVEBU_SATA=y
# CONFIG_PHY_PXA_28NM_HSIC is not set
# CONFIG_PHY_PXA_28NM_USB2 is not set
# CONFIG_PHY_PXA_USB is not set
CONFIG_PHY_MMP3_USB=m
# CONFIG_PHY_MMP3_HSIC is not set
# CONFIG_PHY_MTK_PCIE is not set
# CONFIG_PHY_MTK_TPHY is not set
# CONFIG_PHY_MTK_UFS is not set
# CONFIG_PHY_MTK_XSPHY is not set
# CONFIG_PHY_MTK_HDMI is not set
# CONFIG_PHY_MTK_MIPI_DSI is not set
# CONFIG_PHY_MTK_DP is not set
CONFIG_PHY_LAN966X_SERDES=m
CONFIG_PHY_CPCAP_USB=m
# CONFIG_PHY_MAPPHONE_MDM6600 is not set
# CONFIG_PHY_OCELOT_SERDES is not set
CONFIG_PHY_QCOM_APQ8064_SATA=m
# CONFIG_PHY_QCOM_EDP is not set
# CONFIG_PHY_QCOM_IPQ4019_USB is not set
# CONFIG_PHY_QCOM_IPQ806X_SATA is not set
# CONFIG_PHY_QCOM_PCIE2 is not set
# CONFIG_PHY_QCOM_QMP is not set
# CONFIG_PHY_QCOM_QUSB2 is not set
CONFIG_PHY_QCOM_USB_HS=y
# CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2 is not set
# CONFIG_PHY_QCOM_USB_HSIC is not set
# CONFIG_PHY_QCOM_USB_HS_28NM is not set
# CONFIG_PHY_QCOM_USB_SS is not set
# CONFIG_PHY_QCOM_IPQ806X_USB is not set
CONFIG_PHY_RCAR_GEN2=m
# CONFIG_PHY_RCAR_GEN3_PCIE is not set
# CONFIG_PHY_RCAR_GEN3_USB2 is not set
# CONFIG_PHY_RCAR_GEN3_USB3 is not set
CONFIG_PHY_ROCKCHIP_DP=m
# CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set
# CONFIG_PHY_ROCKCHIP_EMMC is not set
# CONFIG_PHY_ROCKCHIP_INNO_HDMI is not set
# CONFIG_PHY_ROCKCHIP_INNO_USB2 is not set
# CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY is not set
# CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY is not set
# CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY is not set
# CONFIG_PHY_ROCKCHIP_PCIE is not set
# CONFIG_PHY_ROCKCHIP_SNPS_PCIE3 is not set
# CONFIG_PHY_ROCKCHIP_TYPEC is not set
CONFIG_PHY_ROCKCHIP_USB=y
CONFIG_PHY_EXYNOS_DP_VIDEO=y
CONFIG_PHY_EXYNOS_MIPI_VIDEO=y
# CONFIG_PHY_EXYNOS_PCIE is not set
# CONFIG_PHY_SAMSUNG_UFS is not set
CONFIG_PHY_SAMSUNG_USB2=m
CONFIG_PHY_EXYNOS4210_USB2=y
CONFIG_PHY_EXYNOS4X12_USB2=y
CONFIG_PHY_EXYNOS5250_USB2=y
CONFIG_PHY_EXYNOS5_USBDRD=y
CONFIG_PHY_EXYNOS5250_SATA=m
CONFIG_PHY_UNIPHIER_USB2=y
CONFIG_PHY_UNIPHIER_USB3=y
# CONFIG_PHY_UNIPHIER_PCIE is not set
CONFIG_PHY_UNIPHIER_AHCI=y
CONFIG_PHY_MIPHY28LP=y
CONFIG_PHY_ST_SPEAR1310_MIPHY=y
CONFIG_PHY_ST_SPEAR1340_MIPHY=y
CONFIG_PHY_STIH407_USB=y
CONFIG_PHY_STM32_USBPHYC=y
# CONFIG_PHY_SUNPLUS_USB is not set
CONFIG_PHY_TEGRA_XUSB=y
CONFIG_PHY_DM816X_USB=m
CONFIG_OMAP_CONTROL_PHY=y
CONFIG_OMAP_USB2=y
CONFIG_TI_PIPE3=y
# CONFIG_PHY_TUSB1210 is not set
CONFIG_TWL4030_USB=m
CONFIG_PHY_TI_GMII_SEL=y
# end of PHY Subsystem

# CONFIG_POWERCAP is not set
# CONFIG_MCB is not set

#
# Performance monitor support
#
# CONFIG_ARM_CCI_PMU is not set
# CONFIG_ARM_CCN is not set
CONFIG_ARM_PMU=y
# CONFIG_FSL_IMX8_DDR_PMU is not set
# end of Performance monitor support

CONFIG_RAS=y
# CONFIG_USB4 is not set

#
# Android
#
# CONFIG_ANDROID_BINDER_IPC is not set
# end of Android

# CONFIG_DAX is not set
CONFIG_NVMEM=y
CONFIG_NVMEM_SYSFS=y
CONFIG_NVMEM_BCM_OCOTP=y
# CONFIG_NVMEM_BRCM_NVRAM is not set
# CONFIG_NVMEM_IMX_IIM is not set
CONFIG_NVMEM_IMX_OCOTP=y
# CONFIG_NVMEM_LAN9662_OTPC is not set
CONFIG_NVMEM_MESON_MX_EFUSE=m
# CONFIG_NVMEM_MICROCHIP_OTPC is not set
# CONFIG_NVMEM_MTK_EFUSE is not set
CONFIG_NVMEM_QCOM_QFPROM=y
CONFIG_NVMEM_RMEM=m
CONFIG_NVMEM_ROCKCHIP_EFUSE=m
# CONFIG_NVMEM_ROCKCHIP_OTP is not set
# CONFIG_NVMEM_SNVS_LPGPR is not set
# CONFIG_NVMEM_SPMI_SDAM is not set
# CONFIG_NVMEM_STM32_ROMEM is not set
# CONFIG_NVMEM_SUNPLUS_OCOTP is not set
CONFIG_NVMEM_SUNXI_SID=y
# CONFIG_NVMEM_U_BOOT_ENV is not set
# CONFIG_NVMEM_UNIPHIER_EFUSE is not set
CONFIG_NVMEM_VF610_OCOTP=y

#
# HW tracing support
#
# CONFIG_STM is not set
# CONFIG_INTEL_TH is not set
# end of HW tracing support

# CONFIG_FPGA is not set
CONFIG_FSI=m
# CONFIG_FSI_NEW_DEV_NODE is not set
CONFIG_FSI_MASTER_GPIO=m
CONFIG_FSI_MASTER_HUB=m
CONFIG_FSI_MASTER_ASPEED=m
CONFIG_FSI_SCOM=m
CONFIG_FSI_SBEFIFO=m
CONFIG_FSI_OCC=m
# CONFIG_TEE is not set
CONFIG_PM_OPP=y
# CONFIG_SIOX is not set
# CONFIG_SLIMBUS is not set
CONFIG_INTERCONNECT=y
# CONFIG_INTERCONNECT_IMX is not set
CONFIG_INTERCONNECT_QCOM=y
CONFIG_INTERCONNECT_QCOM_MSM8916=y
# CONFIG_INTERCONNECT_QCOM_MSM8939 is not set
# CONFIG_INTERCONNECT_QCOM_MSM8974 is not set
# CONFIG_INTERCONNECT_QCOM_MSM8996 is not set
# CONFIG_INTERCONNECT_QCOM_OSM_L3 is not set
# CONFIG_INTERCONNECT_QCOM_QCM2290 is not set
# CONFIG_INTERCONNECT_QCOM_QCS404 is not set
CONFIG_INTERCONNECT_QCOM_RPMH_POSSIBLE=m
# CONFIG_INTERCONNECT_QCOM_SC7180 is not set
# CONFIG_INTERCONNECT_QCOM_SC7280 is not set
# CONFIG_INTERCONNECT_QCOM_SC8180X is not set
# CONFIG_INTERCONNECT_QCOM_SC8280XP is not set
# CONFIG_INTERCONNECT_QCOM_SDM660 is not set
# CONFIG_INTERCONNECT_QCOM_SDM845 is not set
# CONFIG_INTERCONNECT_QCOM_SDX55 is not set
# CONFIG_INTERCONNECT_QCOM_SDX65 is not set
# CONFIG_INTERCONNECT_QCOM_SM6350 is not set
# CONFIG_INTERCONNECT_QCOM_SM8150 is not set
# CONFIG_INTERCONNECT_QCOM_SM8250 is not set
# CONFIG_INTERCONNECT_QCOM_SM8350 is not set
# CONFIG_INTERCONNECT_QCOM_SM8450 is not set
CONFIG_INTERCONNECT_QCOM_SMD_RPM=y
# CONFIG_INTERCONNECT_SAMSUNG is not set
CONFIG_COUNTER=m
# CONFIG_INTERRUPT_CNT is not set
CONFIG_STM32_TIMER_CNT=m
CONFIG_STM32_LPTIMER_CNT=m
# CONFIG_TI_EQEP is not set
# CONFIG_FTM_QUADDEC is not set
# CONFIG_MICROCHIP_TCB_CAPTURE is not set
# CONFIG_INTEL_QEP is not set
# CONFIG_TI_ECAP_CAPTURE is not set
# CONFIG_MOST is not set
# CONFIG_PECI is not set
# CONFIG_HTE is not set
# end of Device Drivers

#
# File systems
#
CONFIG_DCACHE_WORD_ACCESS=y
# CONFIG_VALIDATE_FS_PARSER is not set
CONFIG_FS_IOMAP=y
# CONFIG_EXT2_FS is not set
# CONFIG_EXT3_FS is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
# CONFIG_EXT4_FS_POSIX_ACL is not set
# CONFIG_EXT4_FS_SECURITY is not set
# CONFIG_EXT4_DEBUG is not set
CONFIG_JBD2=y
# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_OCFS2_FS is not set
# CONFIG_BTRFS_FS is not set
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not set
CONFIG_FS_POSIX_ACL=y
CONFIG_EXPORTFS=y
# CONFIG_EXPORTFS_BLOCK_OPS is not set
CONFIG_FILE_LOCKING=y
# CONFIG_FS_ENCRYPTION is not set
# CONFIG_FS_VERITY is not set
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_FANOTIFY is not set
# CONFIG_QUOTA is not set
CONFIG_AUTOFS4_FS=y
CONFIG_AUTOFS_FS=y
# CONFIG_FUSE_FS is not set
# CONFIG_OVERLAY_FS is not set

#
# Caches
#
# CONFIG_FSCACHE is not set
# end of Caches

#
# CD-ROM/DVD Filesystems
#
# CONFIG_ISO9660_FS is not set
# CONFIG_UDF_FS is not set
# end of CD-ROM/DVD Filesystems

#
# DOS/FAT/EXFAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
# CONFIG_FAT_DEFAULT_UTF8 is not set
# CONFIG_EXFAT_FS is not set
CONFIG_NTFS_FS=y
# CONFIG_NTFS_DEBUG is not set
# CONFIG_NTFS_RW is not set
# CONFIG_NTFS3_FS is not set
# end of DOS/FAT/EXFAT/NT Filesystems

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
# CONFIG_PROC_CHILDREN is not set
CONFIG_KERNFS=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TMPFS_XATTR=y
CONFIG_MEMFD_CREATE=y
CONFIG_CONFIGFS_FS=y
CONFIG_EFIVAR_FS=m
# end of Pseudo filesystems

CONFIG_MISC_FILESYSTEMS=y
# CONFIG_ORANGEFS_FS is not set
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
# CONFIG_ECRYPT_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
# CONFIG_JFFS2_FS is not set
CONFIG_UBIFS_FS=y
# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UBIFS_FS_ZSTD=y
# CONFIG_UBIFS_ATIME_SUPPORT is not set
CONFIG_UBIFS_FS_XATTR=y
CONFIG_UBIFS_FS_SECURITY=y
# CONFIG_UBIFS_FS_AUTHENTICATION is not set
# CONFIG_CRAMFS is not set
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_FILE_CACHE=y
# CONFIG_SQUASHFS_FILE_DIRECT is not set
CONFIG_SQUASHFS_DECOMP_SINGLE=y
# CONFIG_SQUASHFS_CHOICE_DECOMP_BY_MOUNT is not set
CONFIG_SQUASHFS_COMPILE_DECOMP_SINGLE=y
# CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI is not set
# CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU is not set
# CONFIG_SQUASHFS_XATTR is not set
CONFIG_SQUASHFS_ZLIB=y
# CONFIG_SQUASHFS_LZ4 is not set
CONFIG_SQUASHFS_LZO=y
CONFIG_SQUASHFS_XZ=y
# CONFIG_SQUASHFS_ZSTD is not set
# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set
# CONFIG_SQUASHFS_EMBEDDED is not set
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
# CONFIG_VXFS_FS is not set
# CONFIG_MINIX_FS is not set
# CONFIG_OMFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
# CONFIG_QNX6FS_FS is not set
# CONFIG_ROMFS_FS is not set
CONFIG_PSTORE=y
CONFIG_PSTORE_DEFAULT_KMSG_BYTES=10240
CONFIG_PSTORE_DEFLATE_COMPRESS=y
# CONFIG_PSTORE_LZO_COMPRESS is not set
# CONFIG_PSTORE_LZ4_COMPRESS is not set
# CONFIG_PSTORE_LZ4HC_COMPRESS is not set
# CONFIG_PSTORE_842_COMPRESS is not set
# CONFIG_PSTORE_ZSTD_COMPRESS is not set
CONFIG_PSTORE_COMPRESS=y
CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y
CONFIG_PSTORE_COMPRESS_DEFAULT="deflate"
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_PMSG=y
CONFIG_PSTORE_RAM=y
# CONFIG_PSTORE_BLK is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
# CONFIG_EROFS_FS is not set
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V2=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
# CONFIG_NFS_SWAP is not set
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_PNFS_FILE_LAYOUT=y
CONFIG_PNFS_FLEXFILE_LAYOUT=y
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"
# CONFIG_NFS_V4_1_MIGRATION is not set
CONFIG_ROOT_NFS=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
CONFIG_NFS_DISABLE_UDP_SUPPORT=y
# CONFIG_NFS_V4_2_READ_PLUS is not set
# CONFIG_NFSD is not set
CONFIG_GRACE_PERIOD=y
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
CONFIG_NFS_V4_2_SSC_HELPER=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_SUNRPC_BACKCHANNEL=y
# CONFIG_SUNRPC_DEBUG is not set
# CONFIG_CEPH_FS is not set
# CONFIG_CIFS is not set
# CONFIG_SMB_SERVER is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=y
# CONFIG_NLS_CODEPAGE_737 is not set
# CONFIG_NLS_CODEPAGE_775 is not set
# CONFIG_NLS_CODEPAGE_850 is not set
# CONFIG_NLS_CODEPAGE_852 is not set
# CONFIG_NLS_CODEPAGE_855 is not set
# CONFIG_NLS_CODEPAGE_857 is not set
# CONFIG_NLS_CODEPAGE_860 is not set
# CONFIG_NLS_CODEPAGE_861 is not set
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
# CONFIG_NLS_CODEPAGE_869 is not set
# CONFIG_NLS_CODEPAGE_936 is not set
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
# CONFIG_NLS_ISO8859_8 is not set
# CONFIG_NLS_CODEPAGE_1250 is not set
# CONFIG_NLS_CODEPAGE_1251 is not set
# CONFIG_NLS_ASCII is not set
CONFIG_NLS_ISO8859_1=y
# CONFIG_NLS_ISO8859_2 is not set
# CONFIG_NLS_ISO8859_3 is not set
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
# CONFIG_NLS_ISO8859_6 is not set
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
# CONFIG_NLS_ISO8859_13 is not set
# CONFIG_NLS_ISO8859_14 is not set
# CONFIG_NLS_ISO8859_15 is not set
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
# CONFIG_NLS_MAC_ROMAN is not set
# CONFIG_NLS_MAC_CELTIC is not set
# CONFIG_NLS_MAC_CENTEURO is not set
# CONFIG_NLS_MAC_CROATIAN is not set
# CONFIG_NLS_MAC_CYRILLIC is not set
# CONFIG_NLS_MAC_GAELIC is not set
# CONFIG_NLS_MAC_GREEK is not set
# CONFIG_NLS_MAC_ICELAND is not set
# CONFIG_NLS_MAC_INUIT is not set
# CONFIG_NLS_MAC_ROMANIAN is not set
# CONFIG_NLS_MAC_TURKISH is not set
CONFIG_NLS_UTF8=y
# CONFIG_DLM is not set
# CONFIG_UNICODE is not set
CONFIG_IO_WQ=y
# end of File systems

#
# Security options
#
CONFIG_KEYS=y
# CONFIG_KEYS_REQUEST_CACHE is not set
# CONFIG_PERSISTENT_KEYRINGS is not set
# CONFIG_TRUSTED_KEYS is not set
# CONFIG_ENCRYPTED_KEYS is not set
# CONFIG_KEY_DH_OPERATIONS is not set
# CONFIG_SECURITY_DMESG_RESTRICT is not set
# CONFIG_SECURITY is not set
CONFIG_SECURITYFS=y
CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
# CONFIG_HARDENED_USERCOPY is not set
# CONFIG_FORTIFY_SOURCE is not set
# CONFIG_STATIC_USERMODEHELPER is not set
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,integrity,bpf"

#
# Kernel hardening options
#

#
# Memory initialization
#
CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
# CONFIG_INIT_STACK_NONE is not set
# CONFIG_INIT_STACK_ALL_PATTERN is not set
CONFIG_INIT_STACK_ALL_ZERO=y
# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set
# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set
CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
# CONFIG_ZERO_CALL_USED_REGS is not set
# end of Memory initialization

CONFIG_RANDSTRUCT_NONE=y
# CONFIG_RANDSTRUCT_FULL is not set
# CONFIG_RANDSTRUCT_PERFORMANCE is not set
# end of Kernel hardening options
# end of Security options

CONFIG_CRYPTO=y

#
# Crypto core or helper
#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=m
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_SKCIPHER=m
CONFIG_CRYPTO_SKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG=m
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_RNG_DEFAULT=m
CONFIG_CRYPTO_AKCIPHER2=y
CONFIG_CRYPTO_AKCIPHER=y
CONFIG_CRYPTO_KPP2=y
CONFIG_CRYPTO_KPP=m
CONFIG_CRYPTO_ACOMP2=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_USER=m
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
CONFIG_CRYPTO_GF128MUL=m
CONFIG_CRYPTO_NULL=m
CONFIG_CRYPTO_NULL2=y
# CONFIG_CRYPTO_PCRYPT is not set
CONFIG_CRYPTO_CRYPTD=m
CONFIG_CRYPTO_AUTHENC=m
# CONFIG_CRYPTO_TEST is not set
CONFIG_CRYPTO_SIMD=m
CONFIG_CRYPTO_ENGINE=m
# end of Crypto core or helper

#
# Public-key cryptography
#
CONFIG_CRYPTO_RSA=y
# CONFIG_CRYPTO_DH is not set
CONFIG_CRYPTO_ECC=m
CONFIG_CRYPTO_ECDH=m
# CONFIG_CRYPTO_ECDSA is not set
# CONFIG_CRYPTO_ECRDSA is not set
# CONFIG_CRYPTO_SM2 is not set
# CONFIG_CRYPTO_CURVE25519 is not set
# end of Public-key cryptography

#
# Block ciphers
#
CONFIG_CRYPTO_AES=m
# CONFIG_CRYPTO_AES_TI is not set
# CONFIG_CRYPTO_ANUBIS is not set
# CONFIG_CRYPTO_ARIA is not set
# CONFIG_CRYPTO_BLOWFISH is not set
# CONFIG_CRYPTO_CAMELLIA is not set
# CONFIG_CRYPTO_CAST5 is not set
# CONFIG_CRYPTO_CAST6 is not set
CONFIG_CRYPTO_DES=m
# CONFIG_CRYPTO_FCRYPT is not set
# CONFIG_CRYPTO_KHAZAD is not set
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
# CONFIG_CRYPTO_SM4_GENERIC is not set
# CONFIG_CRYPTO_TEA is not set
# CONFIG_CRYPTO_TWOFISH is not set
# end of Block ciphers

#
# Length-preserving ciphers and modes
#
# CONFIG_CRYPTO_ADIANTUM is not set
# CONFIG_CRYPTO_ARC4 is not set
# CONFIG_CRYPTO_CHACHA20 is not set
CONFIG_CRYPTO_CBC=m
# CONFIG_CRYPTO_CFB is not set
CONFIG_CRYPTO_CTR=m
# CONFIG_CRYPTO_CTS is not set
CONFIG_CRYPTO_ECB=m
# CONFIG_CRYPTO_HCTR2 is not set
# CONFIG_CRYPTO_KEYWRAP is not set
# CONFIG_CRYPTO_LRW is not set
# CONFIG_CRYPTO_OFB is not set
# CONFIG_CRYPTO_PCBC is not set
CONFIG_CRYPTO_XTS=m
# end of Length-preserving ciphers and modes

#
# AEAD (authenticated encryption with associated data) ciphers
#
# CONFIG_CRYPTO_AEGIS128 is not set
# CONFIG_CRYPTO_CHACHA20POLY1305 is not set
CONFIG_CRYPTO_CCM=m
CONFIG_CRYPTO_GCM=m
CONFIG_CRYPTO_SEQIV=m
CONFIG_CRYPTO_ECHAINIV=m
# CONFIG_CRYPTO_ESSIV is not set
# end of AEAD (authenticated encryption with associated data) ciphers

#
# Hashes, digests, and MACs
#
# CONFIG_CRYPTO_BLAKE2B is not set
CONFIG_CRYPTO_CMAC=m
CONFIG_CRYPTO_GHASH=m
CONFIG_CRYPTO_HMAC=m
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=m
# CONFIG_CRYPTO_MICHAEL_MIC is not set
# CONFIG_CRYPTO_POLY1305 is not set
# CONFIG_CRYPTO_RMD160 is not set
CONFIG_CRYPTO_SHA1=m
CONFIG_CRYPTO_SHA256=m
CONFIG_CRYPTO_SHA512=m
# CONFIG_CRYPTO_SHA3 is not set
# CONFIG_CRYPTO_SM3_GENERIC is not set
# CONFIG_CRYPTO_STREEBOG is not set
# CONFIG_CRYPTO_VMAC is not set
# CONFIG_CRYPTO_WP512 is not set
# CONFIG_CRYPTO_XCBC is not set
# CONFIG_CRYPTO_XXHASH is not set
# end of Hashes, digests, and MACs

#
# CRCs (cyclic redundancy checks)
#
CONFIG_CRYPTO_CRC32C=y
# CONFIG_CRYPTO_CRC32 is not set
# CONFIG_CRYPTO_CRCT10DIF is not set
# end of CRCs (cyclic redundancy checks)

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_LZO=y
# CONFIG_CRYPTO_842 is not set
# CONFIG_CRYPTO_LZ4 is not set
# CONFIG_CRYPTO_LZ4HC is not set
CONFIG_CRYPTO_ZSTD=y
# end of Compression

#
# Random number generation
#
# CONFIG_CRYPTO_ANSI_CPRNG is not set
CONFIG_CRYPTO_DRBG_MENU=m
CONFIG_CRYPTO_DRBG_HMAC=y
# CONFIG_CRYPTO_DRBG_HASH is not set
# CONFIG_CRYPTO_DRBG_CTR is not set
CONFIG_CRYPTO_DRBG=m
CONFIG_CRYPTO_JITTERENTROPY=m
# end of Random number generation

#
# Userspace interface
#
CONFIG_CRYPTO_USER_API=m
CONFIG_CRYPTO_USER_API_HASH=m
CONFIG_CRYPTO_USER_API_SKCIPHER=m
CONFIG_CRYPTO_USER_API_RNG=m
# CONFIG_CRYPTO_USER_API_RNG_CAVP is not set
CONFIG_CRYPTO_USER_API_AEAD=m
CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE=y
# CONFIG_CRYPTO_STATS is not set
# end of Userspace interface

CONFIG_CRYPTO_HASH_INFO=y

#
# Accelerated Cryptographic Algorithms for CPU (arm)
#
# CONFIG_CRYPTO_CURVE25519_NEON is not set
CONFIG_CRYPTO_GHASH_ARM_CE=m
# CONFIG_CRYPTO_NHPOLY1305_NEON is not set
# CONFIG_CRYPTO_POLY1305_ARM is not set
# CONFIG_CRYPTO_BLAKE2S_ARM is not set
# CONFIG_CRYPTO_BLAKE2B_NEON is not set
CONFIG_CRYPTO_SHA1_ARM=m
CONFIG_CRYPTO_SHA1_ARM_NEON=m
CONFIG_CRYPTO_SHA1_ARM_CE=m
CONFIG_CRYPTO_SHA2_ARM_CE=m
CONFIG_CRYPTO_SHA256_ARM=m
CONFIG_CRYPTO_SHA512_ARM=m
CONFIG_CRYPTO_AES_ARM=m
CONFIG_CRYPTO_AES_ARM_BS=m
CONFIG_CRYPTO_AES_ARM_CE=m
CONFIG_CRYPTO_CHACHA20_NEON=m
CONFIG_CRYPTO_CRC32_ARM_CE=m
# end of Accelerated Cryptographic Algorithms for CPU (arm)

CONFIG_CRYPTO_HW=y
CONFIG_CRYPTO_DEV_ALLWINNER=y
CONFIG_CRYPTO_DEV_SUN4I_SS=m
# CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG is not set
# CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG is not set
# CONFIG_CRYPTO_DEV_SUN8I_CE is not set
# CONFIG_CRYPTO_DEV_SUN8I_SS is not set
# CONFIG_CRYPTO_DEV_HIFN_795X is not set
CONFIG_CRYPTO_DEV_FSL_CAAM_COMMON=m
CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC=m
CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC=m
CONFIG_CRYPTO_DEV_FSL_CAAM=m
# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set
CONFIG_CRYPTO_DEV_FSL_CAAM_JR=m
CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9
# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set
CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y
CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y
CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y
CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y
CONFIG_CRYPTO_DEV_FSL_CAAM_PRNG_API=y
# CONFIG_CRYPTO_DEV_OMAP is not set
# CONFIG_CRYPTO_DEV_SAHARA is not set
CONFIG_CRYPTO_DEV_EXYNOS_RNG=m
CONFIG_CRYPTO_DEV_S5P=m
# CONFIG_CRYPTO_DEV_UX500 is not set
# CONFIG_CRYPTO_DEV_ATMEL_AUTHENC is not set
CONFIG_CRYPTO_DEV_ATMEL_AES=m
CONFIG_CRYPTO_DEV_ATMEL_TDES=m
CONFIG_CRYPTO_DEV_ATMEL_SHA=m
# CONFIG_CRYPTO_DEV_ATMEL_ECC is not set
# CONFIG_CRYPTO_DEV_ATMEL_SHA204A is not set
# CONFIG_CRYPTO_DEV_MXS_DCP is not set
# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set
# CONFIG_CRYPTO_DEV_QAT_C3XXX is not set
# CONFIG_CRYPTO_DEV_QAT_C62X is not set
# CONFIG_CRYPTO_DEV_QAT_4XXX is not set
# CONFIG_CRYPTO_DEV_QAT_DH895xCCVF is not set
# CONFIG_CRYPTO_DEV_QAT_C3XXXVF is not set
# CONFIG_CRYPTO_DEV_QAT_C62XVF is not set
CONFIG_CRYPTO_DEV_MARVELL=m
CONFIG_CRYPTO_DEV_MARVELL_CESA=m
CONFIG_CRYPTO_DEV_QCE=m
CONFIG_CRYPTO_DEV_QCE_SKCIPHER=y
CONFIG_CRYPTO_DEV_QCE_SHA=y
CONFIG_CRYPTO_DEV_QCE_AEAD=y
CONFIG_CRYPTO_DEV_QCE_ENABLE_ALL=y
# CONFIG_CRYPTO_DEV_QCE_ENABLE_SKCIPHER is not set
# CONFIG_CRYPTO_DEV_QCE_ENABLE_SHA is not set
# CONFIG_CRYPTO_DEV_QCE_ENABLE_AEAD is not set
CONFIG_CRYPTO_DEV_QCE_SW_MAX_LEN=512
CONFIG_CRYPTO_DEV_QCOM_RNG=m
CONFIG_CRYPTO_DEV_ROCKCHIP=m
# CONFIG_CRYPTO_DEV_ROCKCHIP_DEBUG is not set
# CONFIG_CRYPTO_DEV_VIRTIO is not set
CONFIG_CRYPTO_DEV_BCM_SPU=m
CONFIG_CRYPTO_DEV_STM32_CRC=m
CONFIG_CRYPTO_DEV_STM32_HASH=m
CONFIG_CRYPTO_DEV_STM32_CRYP=m
# CONFIG_CRYPTO_DEV_SAFEXCEL is not set
# CONFIG_CRYPTO_DEV_ARTPEC6 is not set
# CONFIG_CRYPTO_DEV_CCREE is not set
CONFIG_CRYPTO_DEV_AMLOGIC_GXL=m
# CONFIG_CRYPTO_DEV_AMLOGIC_GXL_DEBUG is not set
# CONFIG_CRYPTO_DEV_ASPEED is not set
CONFIG_ASYMMETRIC_KEY_TYPE=y
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
CONFIG_X509_CERTIFICATE_PARSER=y
# CONFIG_PKCS8_PRIVATE_KEY_PARSER is not set
CONFIG_PKCS7_MESSAGE_PARSER=y
# CONFIG_PKCS7_TEST_KEY is not set
# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set
# CONFIG_FIPS_SIGNATURE_SELFTEST is not set

#
# Certificates for signature checking
#
CONFIG_SYSTEM_TRUSTED_KEYRING=y
CONFIG_SYSTEM_TRUSTED_KEYS=""
# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set
# CONFIG_SECONDARY_TRUSTED_KEYRING is not set
# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set
# end of Certificates for signature checking

CONFIG_BINARY_PRINTF=y

#
# Library routines
#
CONFIG_LINEAR_RANGES=y
CONFIG_PACKING=y
CONFIG_BITREVERSE=y
CONFIG_HAVE_ARCH_BITREVERSE=y
CONFIG_GENERIC_STRNCPY_FROM_USER=y
CONFIG_GENERIC_STRNLEN_USER=y
CONFIG_GENERIC_NET_UTILS=y
# CONFIG_CORDIC is not set
# CONFIG_PRIME_NUMBERS is not set
CONFIG_RATIONAL=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_STMP_DEVICE=y
CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y

#
# Crypto library routines
#
CONFIG_CRYPTO_LIB_UTILS=y
CONFIG_CRYPTO_LIB_AES=m
CONFIG_CRYPTO_LIB_ARC4=m
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=m
# CONFIG_CRYPTO_LIB_CHACHA is not set
# CONFIG_CRYPTO_LIB_CURVE25519 is not set
CONFIG_CRYPTO_LIB_DES=m
CONFIG_CRYPTO_LIB_POLY1305_RSIZE=9
# CONFIG_CRYPTO_LIB_POLY1305 is not set
# CONFIG_CRYPTO_LIB_CHACHA20POLY1305 is not set
CONFIG_CRYPTO_LIB_SHA1=y
CONFIG_CRYPTO_LIB_SHA256=m
# end of Crypto library routines

CONFIG_CRC_CCITT=m
CONFIG_CRC16=y
# CONFIG_CRC_T10DIF is not set
# CONFIG_CRC64_ROCKSOFT is not set
CONFIG_CRC_ITU_T=m
CONFIG_CRC32=y
# CONFIG_CRC32_SELFTEST is not set
CONFIG_CRC32_SLICEBY8=y
# CONFIG_CRC32_SLICEBY4 is not set
# CONFIG_CRC32_SARWATE is not set
# CONFIG_CRC32_BIT is not set
# CONFIG_CRC64 is not set
CONFIG_CRC4=m
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
# CONFIG_CRC8 is not set
CONFIG_XXHASH=y
# CONFIG_RANDOM32_SELFTEST is not set
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_LZ4_DECOMPRESS=y
CONFIG_ZSTD_COMMON=y
CONFIG_ZSTD_COMPRESS=y
CONFIG_ZSTD_DECOMPRESS=y
CONFIG_XZ_DEC=y
CONFIG_XZ_DEC_X86=y
CONFIG_XZ_DEC_POWERPC=y
CONFIG_XZ_DEC_IA64=y
CONFIG_XZ_DEC_ARM=y
CONFIG_XZ_DEC_ARMTHUMB=y
CONFIG_XZ_DEC_SPARC=y
# CONFIG_XZ_DEC_MICROLZMA is not set
CONFIG_XZ_DEC_BCJ=y
# CONFIG_XZ_DEC_TEST is not set
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DECOMPRESS_XZ=y
CONFIG_DECOMPRESS_LZO=y
CONFIG_DECOMPRESS_LZ4=y
CONFIG_DECOMPRESS_ZSTD=y
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_REED_SOLOMON=y
CONFIG_REED_SOLOMON_ENC8=y
CONFIG_REED_SOLOMON_DEC8=y
CONFIG_BCH=y
CONFIG_XARRAY_MULTI=y
CONFIG_ASSOCIATIVE_ARRAY=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_DMA=y
CONFIG_DMA_OPS=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_DMA_DECLARE_COHERENT=y
CONFIG_ARCH_HAS_SETUP_DMA_OPS=y
CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS=y
CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y
CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y
CONFIG_DMA_NONCOHERENT_MMAP=y
CONFIG_DMA_CMA=y
# CONFIG_DMA_PERNUMA_CMA is not set

#
# Default contiguous memory area size:
#
CONFIG_CMA_SIZE_MBYTES=64
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_MAX is not set
CONFIG_CMA_ALIGNMENT=8
# CONFIG_DMA_API_DEBUG is not set
# CONFIG_DMA_MAP_BENCHMARK is not set
CONFIG_SGL_ALLOC=y
CONFIG_UNFORCE_NR_CPUS=y
# CONFIG_FORCE_NR_CPUS is not set
CONFIG_CPU_RMAP=y
CONFIG_DQL=y
CONFIG_GLOB=y
# CONFIG_GLOB_SELFTEST is not set
CONFIG_NLATTR=y
CONFIG_CLZ_TAB=y
# CONFIG_IRQ_POLL is not set
CONFIG_MPILIB=y
CONFIG_DIMLIB=y
CONFIG_LIBFDT=y
CONFIG_OID_REGISTRY=y
CONFIG_UCS2_STRING=y
CONFIG_HAVE_GENERIC_VDSO=y
CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_VDSO_32=y
CONFIG_FONT_SUPPORT=y
# CONFIG_FONTS is not set
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_SG_SPLIT=y
CONFIG_SG_POOL=y
CONFIG_STACKDEPOT=y
CONFIG_SBITMAP=y
# end of Library routines

CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y
CONFIG_POLYNOMIAL=m

#
# Kernel hacking
#

#
# printk and dmesg options
#
CONFIG_PRINTK_TIME=y
# CONFIG_PRINTK_CALLER is not set
# CONFIG_STACKTRACE_BUILD_ID is not set
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_QUIET=4
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# CONFIG_BOOT_PRINTK_DELAY is not set
# CONFIG_DYNAMIC_DEBUG is not set
# CONFIG_DYNAMIC_DEBUG_CORE is not set
CONFIG_SYMBOLIC_ERRNAME=y
CONFIG_DEBUG_BUGVERBOSE=y
# end of printk and dmesg options

CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_MISC=y

#
# Compile-time checks and compiler options
#
CONFIG_AS_HAS_NON_CONST_LEB128=y
CONFIG_DEBUG_INFO_NONE=y
# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
# CONFIG_DEBUG_INFO_DWARF4 is not set
# CONFIG_DEBUG_INFO_DWARF5 is not set
CONFIG_FRAME_WARN=1024
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_READABLE_ASM is not set
# CONFIG_HEADERS_INSTALL is not set
CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
# CONFIG_VMLINUX_MAP is not set
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# end of Compile-time checks and compiler options

#
# Generic Kernel Debugging Instruments
#
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
CONFIG_MAGIC_SYSRQ_SERIAL=y
CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE=""
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_FS_ALLOW_ALL=y
# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set
# CONFIG_DEBUG_FS_ALLOW_NONE is not set
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set
# CONFIG_UBSAN is not set
CONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments

#
# Networking Debugging
#
# CONFIG_NET_DEV_REFCNT_TRACKER is not set
# CONFIG_NET_NS_REFCNT_TRACKER is not set
# CONFIG_DEBUG_NET is not set
# end of Networking Debugging

#
# Memory Debugging
#
# CONFIG_PAGE_EXTENSION is not set
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_SLUB_DEBUG=y
# CONFIG_SLUB_DEBUG_ON is not set
# CONFIG_PAGE_OWNER is not set
# CONFIG_PAGE_POISONING is not set
# CONFIG_DEBUG_PAGE_REF is not set
# CONFIG_DEBUG_RODATA_TEST is not set
# CONFIG_DEBUG_WX is not set
# CONFIG_DEBUG_OBJECTS is not set
# CONFIG_SHRINKER_DEBUG is not set
CONFIG_HAVE_DEBUG_KMEMLEAK=y
# CONFIG_DEBUG_KMEMLEAK is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_SCHED_STACK_END_CHECK is not set
# CONFIG_DEBUG_VM is not set
CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_MEMORY_INIT is not set
# CONFIG_DEBUG_PER_CPU_MAPS is not set
# CONFIG_DEBUG_KMAP_LOCAL is not set
# CONFIG_DEBUG_HIGHMEM is not set
CONFIG_HAVE_ARCH_KASAN=y
CONFIG_HAVE_ARCH_KASAN_VMALLOC=y
CONFIG_CC_HAS_KASAN_GENERIC=y
CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y
# CONFIG_KASAN is not set
CONFIG_HAVE_ARCH_KFENCE=y
# CONFIG_KFENCE is not set
# end of Memory Debugging

# CONFIG_DEBUG_SHIRQ is not set

#
# Debug Oops, Lockups and Hangs
#
# CONFIG_PANIC_ON_OOPS is not set
CONFIG_PANIC_ON_OOPS_VALUE=0
CONFIG_PANIC_TIMEOUT=0
# CONFIG_SOFTLOCKUP_DETECTOR is not set
# CONFIG_DETECT_HUNG_TASK is not set
# CONFIG_WQ_WATCHDOG is not set
# CONFIG_TEST_LOCKUP is not set
# end of Debug Oops, Lockups and Hangs

#
# Scheduler Debugging
#
CONFIG_SCHED_DEBUG=y
# CONFIG_SCHEDSTATS is not set
# end of Scheduler Debugging

# CONFIG_DEBUG_TIMEKEEPING is not set

#
# Lock Debugging (spinlocks, mutexes, etc...)
#
CONFIG_LOCK_DEBUGGING_SUPPORT=y
# CONFIG_PROVE_LOCKING is not set
# CONFIG_LOCK_STAT is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_DEBUG_SPINLOCK is not set
# CONFIG_DEBUG_MUTEXES is not set
# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set
# CONFIG_DEBUG_RWSEMS is not set
# CONFIG_DEBUG_LOCK_ALLOC is not set
# CONFIG_DEBUG_ATOMIC_SLEEP is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_LOCK_TORTURE_TEST is not set
# CONFIG_WW_MUTEX_SELFTEST is not set
# CONFIG_SCF_TORTURE_TEST is not set
# end of Lock Debugging (spinlocks, mutexes, etc...)

# CONFIG_DEBUG_IRQFLAGS is not set
CONFIG_STACKTRACE=y
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
# CONFIG_DEBUG_KOBJECT is not set

#
# Debug kernel data structures
#
# CONFIG_DEBUG_LIST is not set
# CONFIG_DEBUG_PLIST is not set
# CONFIG_DEBUG_SG is not set
# CONFIG_DEBUG_NOTIFIERS is not set
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
# CONFIG_DEBUG_MAPLE_TREE is not set
# end of Debug kernel data structures

# CONFIG_DEBUG_CREDENTIALS is not set

#
# RCU Debugging
#
# CONFIG_RCU_SCALE_TEST is not set
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_RCU_REF_SCALE_TEST is not set
CONFIG_RCU_CPU_STALL_TIMEOUT=21
CONFIG_RCU_EXP_CPU_STALL_TIMEOUT=0
CONFIG_RCU_TRACE=y
# CONFIG_RCU_EQS_DEBUG is not set
# end of RCU Debugging

# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set
# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set
# CONFIG_LATENCYTOP is not set
CONFIG_NOP_TRACER=y
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_HAVE_BUILDTIME_MCOUNT_SORT=y
CONFIG_TRACE_CLOCK=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_TRACING=y
CONFIG_TRACING_SUPPORT=y
CONFIG_FTRACE=y
# CONFIG_BOOTTIME_TRACING is not set
# CONFIG_FUNCTION_TRACER is not set
# CONFIG_STACK_TRACER is not set
# CONFIG_IRQSOFF_TRACER is not set
# CONFIG_SCHED_TRACER is not set
# CONFIG_HWLAT_TRACER is not set
# CONFIG_OSNOISE_TRACER is not set
# CONFIG_TIMERLAT_TRACER is not set
# CONFIG_ENABLE_DEFAULT_TRACERS is not set
# CONFIG_FTRACE_SYSCALLS is not set
# CONFIG_TRACER_SNAPSHOT is not set
CONFIG_BRANCH_PROFILE_NONE=y
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
# CONFIG_PROFILE_ALL_BRANCHES is not set
# CONFIG_BLK_DEV_IO_TRACE is not set
CONFIG_UPROBE_EVENTS=y
CONFIG_DYNAMIC_EVENTS=y
CONFIG_PROBE_EVENTS=y
# CONFIG_SYNTH_EVENTS is not set
# CONFIG_HIST_TRIGGERS is not set
# CONFIG_TRACE_EVENT_INJECT is not set
# CONFIG_TRACEPOINT_BENCHMARK is not set
# CONFIG_RING_BUFFER_BENCHMARK is not set
# CONFIG_TRACE_EVAL_MAP_FILE is not set
# CONFIG_RING_BUFFER_STARTUP_TEST is not set
# CONFIG_RING_BUFFER_VALIDATE_TIME_DELTAS is not set
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set
# CONFIG_RV is not set
# CONFIG_SAMPLES is not set
# CONFIG_STRICT_DEVMEM is not set

#
# arm Debugging
#
# CONFIG_ARM_PTDUMP_DEBUGFS is not set
# CONFIG_UNWINDER_FRAME_POINTER is not set
CONFIG_UNWINDER_ARM=y
CONFIG_ARM_UNWIND=y
# CONFIG_BACKTRACE_VERBOSE is not set
# CONFIG_DEBUG_USER is not set
# CONFIG_DEBUG_LL is not set
CONFIG_DEBUG_VF_UART_PORT=1
CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
# CONFIG_PID_IN_CONTEXTIDR is not set
# CONFIG_CORESIGHT is not set
# end of arm Debugging

#
# Kernel Testing and Coverage
#
# CONFIG_KUNIT is not set
# CONFIG_NOTIFIER_ERROR_INJECTION is not set
# CONFIG_FAULT_INJECTION is not set
CONFIG_ARCH_HAS_KCOV=y
CONFIG_CC_HAS_SANCOV_TRACE_PC=y
# CONFIG_KCOV is not set
CONFIG_RUNTIME_TESTING_MENU=y
# CONFIG_LKDTM is not set
# CONFIG_TEST_MIN_HEAP is not set
# CONFIG_TEST_DIV64 is not set
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_TEST_REF_TRACKER is not set
# CONFIG_RBTREE_TEST is not set
# CONFIG_REED_SOLOMON_TEST is not set
# CONFIG_INTERVAL_TREE_TEST is not set
# CONFIG_PERCPU_TEST is not set
# CONFIG_ATOMIC64_SELFTEST is not set
# CONFIG_TEST_HEXDUMP is not set
# CONFIG_STRING_SELFTEST is not set
# CONFIG_TEST_STRING_HELPERS is not set
# CONFIG_TEST_KSTRTOX is not set
# CONFIG_TEST_PRINTF is not set
# CONFIG_TEST_SCANF is not set
# CONFIG_TEST_BITMAP is not set
# CONFIG_TEST_UUID is not set
# CONFIG_TEST_XARRAY is not set
# CONFIG_TEST_MAPLE_TREE is not set
# CONFIG_TEST_RHASHTABLE is not set
# CONFIG_TEST_IDA is not set
# CONFIG_TEST_LKM is not set
# CONFIG_TEST_BITOPS is not set
# CONFIG_TEST_VMALLOC is not set
# CONFIG_TEST_USER_COPY is not set
# CONFIG_TEST_BPF is not set
# CONFIG_TEST_BLACKHOLE_DEV is not set
# CONFIG_FIND_BIT_BENCHMARK is not set
# CONFIG_TEST_FIRMWARE is not set
# CONFIG_TEST_SYSCTL is not set
# CONFIG_TEST_UDELAY is not set
# CONFIG_TEST_STATIC_KEYS is not set
# CONFIG_TEST_KMOD is not set
# CONFIG_TEST_MEMCAT_P is not set
# CONFIG_TEST_MEMINIT is not set
# CONFIG_TEST_FREE_PAGES is not set
CONFIG_ARCH_USE_MEMTEST=y
# CONFIG_MEMTEST is not set
# end of Kernel Testing and Coverage

#
# Rust hacking
#
# end of Rust hacking
# end of Kernel hacking

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 28/65] clk: renesas: r9a06g032: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-07  7:51     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 388+ messages in thread
From: Geert Uytterhoeven @ 2022-11-07  7:51 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel,
	Gareth Williams

CC Gareth

On Fri, Nov 4, 2022 at 2:18 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
> The Renesas r9a06g032 bitselect clock implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/clk/renesas/r9a06g032-clocks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
> index 983faa5707b9..70c37097ca6e 100644
> --- a/drivers/clk/renesas/r9a06g032-clocks.c
> +++ b/drivers/clk/renesas/r9a06g032-clocks.c
> @@ -773,6 +773,7 @@ static int r9a06g032_clk_mux_set_parent(struct clk_hw *hw, u8 index)
>  }
>
>  static const struct clk_ops clk_bitselect_ops = {
> +       .determine_rate = __clk_mux_determine_rate,
>         .get_parent = r9a06g032_clk_mux_get_parent,
>         .set_parent = r9a06g032_clk_mux_set_parent,
>  };
> @@ -797,7 +798,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
>
>         init.name = desc->name;
>         init.ops = &clk_bitselect_ops;
> -       init.flags = CLK_SET_RATE_PARENT;
> +       init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
>         init.parent_names = names;
>         init.num_parents = 2;
>
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 28/65] clk: renesas: r9a06g032: Add a determine_rate hook
@ 2022-11-07  7:51     ` Geert Uytterhoeven
  0 siblings, 0 replies; 388+ messages in thread
From: Geert Uytterhoeven @ 2022-11-07  7:51 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Gareth Williams,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

CC Gareth

On Fri, Nov 4, 2022 at 2:18 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
> The Renesas r9a06g032 bitselect clock implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/clk/renesas/r9a06g032-clocks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
> index 983faa5707b9..70c37097ca6e 100644
> --- a/drivers/clk/renesas/r9a06g032-clocks.c
> +++ b/drivers/clk/renesas/r9a06g032-clocks.c
> @@ -773,6 +773,7 @@ static int r9a06g032_clk_mux_set_parent(struct clk_hw *hw, u8 index)
>  }
>
>  static const struct clk_ops clk_bitselect_ops = {
> +       .determine_rate = __clk_mux_determine_rate,
>         .get_parent = r9a06g032_clk_mux_get_parent,
>         .set_parent = r9a06g032_clk_mux_set_parent,
>  };
> @@ -797,7 +798,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
>
>         init.name = desc->name;
>         init.ops = &clk_bitselect_ops;
> -       init.flags = CLK_SET_RATE_PARENT;
> +       init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
>         init.parent_names = names;
>         init.num_parents = 2;
>
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 28/65] clk: renesas: r9a06g032: Add a determine_rate hook
@ 2022-11-07  7:51     ` Geert Uytterhoeven
  0 siblings, 0 replies; 388+ messages in thread
From: Geert Uytterhoeven @ 2022-11-07  7:51 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel,
	Gareth Williams

CC Gareth

On Fri, Nov 4, 2022 at 2:18 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
> The Renesas r9a06g032 bitselect clock implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/clk/renesas/r9a06g032-clocks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
> index 983faa5707b9..70c37097ca6e 100644
> --- a/drivers/clk/renesas/r9a06g032-clocks.c
> +++ b/drivers/clk/renesas/r9a06g032-clocks.c
> @@ -773,6 +773,7 @@ static int r9a06g032_clk_mux_set_parent(struct clk_hw *hw, u8 index)
>  }
>
>  static const struct clk_ops clk_bitselect_ops = {
> +       .determine_rate = __clk_mux_determine_rate,
>         .get_parent = r9a06g032_clk_mux_get_parent,
>         .set_parent = r9a06g032_clk_mux_set_parent,
>  };
> @@ -797,7 +798,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
>
>         init.name = desc->name;
>         init.ops = &clk_bitselect_ops;
> -       init.flags = CLK_SET_RATE_PARENT;
> +       init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
>         init.parent_names = names;
>         init.num_parents = 2;
>
>
> --
> b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 28/65] clk: renesas: r9a06g032: Add a determine_rate hook
@ 2022-11-07  7:51     ` Geert Uytterhoeven
  0 siblings, 0 replies; 388+ messages in thread
From: Geert Uytterhoeven @ 2022-11-07  7:51 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Gareth Williams,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

CC Gareth

On Fri, Nov 4, 2022 at 2:18 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
> The Renesas r9a06g032 bitselect clock implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/clk/renesas/r9a06g032-clocks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c
> index 983faa5707b9..70c37097ca6e 100644
> --- a/drivers/clk/renesas/r9a06g032-clocks.c
> +++ b/drivers/clk/renesas/r9a06g032-clocks.c
> @@ -773,6 +773,7 @@ static int r9a06g032_clk_mux_set_parent(struct clk_hw *hw, u8 index)
>  }
>
>  static const struct clk_ops clk_bitselect_ops = {
> +       .determine_rate = __clk_mux_determine_rate,
>         .get_parent = r9a06g032_clk_mux_get_parent,
>         .set_parent = r9a06g032_clk_mux_set_parent,
>  };
> @@ -797,7 +798,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
>
>         init.name = desc->name;
>         init.ops = &clk_bitselect_ops;
> -       init.flags = CLK_SET_RATE_PARENT;
> +       init.flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT;
>         init.parent_names = names;
>         init.num_parents = 2;
>
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-04 15:59         ` Mark Brown
  (?)
  (?)
@ 2022-11-07  8:43           ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07  8:43 UTC (permalink / raw)
  To: Mark Brown
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Mark,

On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> On Fri, Nov 04, 2022 at 04:51:23PM +0100, Maxime Ripard wrote:
> 
> > Just filling determine_rate if it's missing with
> > __clk_mux_determine_rate will possibly pick different parents, and I'm
> > fairly certain that this have never been tested on most platforms, and
> > will be completely broken. And I don't really want to play a game of
> > whack-a-mole adding that flag everywhere it turns out it's broken.
> 
> Well, hopefully everyone for whom it's an issue currently will be
> objecting to this version of the change anyway so we'll either know
> where to set the flag or we'll get the whack-a-mole with the series
> being merged?

I'm sorry, I'm not sure what you mean here. The only issue to fix at the
moment is that determine_rate and set_parent aren't coupled, and it led
to issues due to oversight.

I initially added a warning but Stephen wanted to fix all users in that
case and make that an error instead.

If I filled __clk_mux_determine_rate into clocks that weren't using it
before, I would change their behavior. With that flag set, on all users
I add __clk_mux_determine_rate to, the behavior is the same than what we
previously had, so the risk of regressions is minimal, and everything
should keep going like it was?

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07  8:43           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07  8:43 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Mark,

On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> On Fri, Nov 04, 2022 at 04:51:23PM +0100, Maxime Ripard wrote:
> 
> > Just filling determine_rate if it's missing with
> > __clk_mux_determine_rate will possibly pick different parents, and I'm
> > fairly certain that this have never been tested on most platforms, and
> > will be completely broken. And I don't really want to play a game of
> > whack-a-mole adding that flag everywhere it turns out it's broken.
> 
> Well, hopefully everyone for whom it's an issue currently will be
> objecting to this version of the change anyway so we'll either know
> where to set the flag or we'll get the whack-a-mole with the series
> being merged?

I'm sorry, I'm not sure what you mean here. The only issue to fix at the
moment is that determine_rate and set_parent aren't coupled, and it led
to issues due to oversight.

I initially added a warning but Stephen wanted to fix all users in that
case and make that an error instead.

If I filled __clk_mux_determine_rate into clocks that weren't using it
before, I would change their behavior. With that flag set, on all users
I add __clk_mux_determine_rate to, the behavior is the same than what we
previously had, so the risk of regressions is minimal, and everything
should keep going like it was?

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07  8:43           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07  8:43 UTC (permalink / raw)
  To: Mark Brown
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Mark,

On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> On Fri, Nov 04, 2022 at 04:51:23PM +0100, Maxime Ripard wrote:
> 
> > Just filling determine_rate if it's missing with
> > __clk_mux_determine_rate will possibly pick different parents, and I'm
> > fairly certain that this have never been tested on most platforms, and
> > will be completely broken. And I don't really want to play a game of
> > whack-a-mole adding that flag everywhere it turns out it's broken.
> 
> Well, hopefully everyone for whom it's an issue currently will be
> objecting to this version of the change anyway so we'll either know
> where to set the flag or we'll get the whack-a-mole with the series
> being merged?

I'm sorry, I'm not sure what you mean here. The only issue to fix at the
moment is that determine_rate and set_parent aren't coupled, and it led
to issues due to oversight.

I initially added a warning but Stephen wanted to fix all users in that
case and make that an error instead.

If I filled __clk_mux_determine_rate into clocks that weren't using it
before, I would change their behavior. With that flag set, on all users
I add __clk_mux_determine_rate to, the behavior is the same than what we
previously had, so the risk of regressions is minimal, and everything
should keep going like it was?

Maxime

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07  8:43           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07  8:43 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Mark,

On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> On Fri, Nov 04, 2022 at 04:51:23PM +0100, Maxime Ripard wrote:
> 
> > Just filling determine_rate if it's missing with
> > __clk_mux_determine_rate will possibly pick different parents, and I'm
> > fairly certain that this have never been tested on most platforms, and
> > will be completely broken. And I don't really want to play a game of
> > whack-a-mole adding that flag everywhere it turns out it's broken.
> 
> Well, hopefully everyone for whom it's an issue currently will be
> objecting to this version of the change anyway so we'll either know
> where to set the flag or we'll get the whack-a-mole with the series
> being merged?

I'm sorry, I'm not sure what you mean here. The only issue to fix at the
moment is that determine_rate and set_parent aren't coupled, and it led
to issues due to oversight.

I initially added a warning but Stephen wanted to fix all users in that
case and make that an error instead.

If I filled __clk_mux_determine_rate into clocks that weren't using it
before, I would change their behavior. With that flag set, on all users
I add __clk_mux_determine_rate to, the behavior is the same than what we
previously had, so the risk of regressions is minimal, and everything
should keep going like it was?

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-04 17:35         ` Aidan MacDonald
  (?)
  (?)
@ 2022-11-07  8:54           ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07  8:54 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Paul Cercueil, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi,

On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> 
> Maxime Ripard <maxime@cerno.tech> writes:
> 
> > Hi Paul,
> >
> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> >> écrit :
> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> >> > doesn't provide a determine_rate implementation.
> >> >
> >> > This is a bit odd, since set_parent() is there to, as its name implies,
> >> > change the parent of a clock. However, the most likely candidate to
> >> > trigger that parent change is a call to clk_set_rate(), with
> >> > determine_rate() figuring out which parent is the best suited for a
> >> > given rate.
> >> >
> >> > The other trigger would be a call to clk_set_parent(), but it's far less
> >> > used, and it doesn't look like there's any obvious user for that clock.
> >> >
> >> > So, the set_parent hook is effectively unused, possibly because of an
> >> > oversight. However, it could also be an explicit decision by the
> >> > original author to avoid any reparenting but through an explicit call to
> >> > clk_set_parent().
> >> >
> >> > The driver does implement round_rate() though, which means that we can
> >> > change the rate of the clock, but we will never get to change the
> >> > parent.
> >> >
> >> > However, It's hard to tell whether it's been done on purpose or not.
> >> >
> >> > Since we'll start mandating a determine_rate() implementation, let's
> >> > convert the round_rate() implementation to a determine_rate(), which
> >> > will also make the current behavior explicit. And if it was an
> >> > oversight, the clock behaviour can be adjusted later on.
> >>
> >> So it's partly on purpose, partly because I didn't know about
> >> .determine_rate.
> >>
> >> There's nothing odd about having a lonely .set_parent callback; in my case
> >> the clocks are parented from the device tree.
> >>
> >> Having the clocks driver trigger a parent change when requesting a rate
> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> >> one is configured as driving the CPU clock, it becomes messy.
> >> The thing is, the clocks driver has no way to know whether or not it is
> >> "safe" to use a designated parent.
> >>
> >> For that reason, in practice, I never actually want to have a clock
> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> >> configured in the DTS.
> >
> > Yeah, and this is totally fine. But we need to be explicit about it. The
> > determine_rate implementation I did in all the patches is an exact
> > equivalent to the round_rate one if there was one. We will never ask to
> > change the parent.
> >
> > Given what you just said, I would suggest to set the
> > CLK_SET_RATE_NO_REPARENT flag as well.
>
> Ideally there should be a way for drivers and the device tree to
> say, "clock X must be driven by clock Y", but the clock framework
> would be allowed to re-parent clocks freely as long as it doesn't
> violate any DT or driver constraints.

I'm not really sure what you mean there, sorry. Isn't it what
assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
implementation that would affect best_parent_hw would already provide?

> That way allowing reparenting doesn't need to be an all-or-nothing
> thing, and it doesn't need to be decided at the clock driver level
> with special flags.

Like I said, the default implementation is already working to what you
suggested if I understood properly. However, this has never been tested
for any of the drivers in that series so I don't want to introduce (and
debug ;)) regressions in all those drivers that were not setting any
constraint but never actually tested their reparenting code.

So that series is strictly equivalent to what you had before, it's just
explicit now.

If you find that some other decision make sense for your driver in
particular cases, feel free to change it. I barely know most of these
platforms, so I won't be able to make that decision (and test it)
unfortunately.

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-07  8:54           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07  8:54 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi,

On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> 
> Maxime Ripard <maxime@cerno.tech> writes:
> 
> > Hi Paul,
> >
> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> >> écrit :
> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> >> > doesn't provide a determine_rate implementation.
> >> >
> >> > This is a bit odd, since set_parent() is there to, as its name implies,
> >> > change the parent of a clock. However, the most likely candidate to
> >> > trigger that parent change is a call to clk_set_rate(), with
> >> > determine_rate() figuring out which parent is the best suited for a
> >> > given rate.
> >> >
> >> > The other trigger would be a call to clk_set_parent(), but it's far less
> >> > used, and it doesn't look like there's any obvious user for that clock.
> >> >
> >> > So, the set_parent hook is effectively unused, possibly because of an
> >> > oversight. However, it could also be an explicit decision by the
> >> > original author to avoid any reparenting but through an explicit call to
> >> > clk_set_parent().
> >> >
> >> > The driver does implement round_rate() though, which means that we can
> >> > change the rate of the clock, but we will never get to change the
> >> > parent.
> >> >
> >> > However, It's hard to tell whether it's been done on purpose or not.
> >> >
> >> > Since we'll start mandating a determine_rate() implementation, let's
> >> > convert the round_rate() implementation to a determine_rate(), which
> >> > will also make the current behavior explicit. And if it was an
> >> > oversight, the clock behaviour can be adjusted later on.
> >>
> >> So it's partly on purpose, partly because I didn't know about
> >> .determine_rate.
> >>
> >> There's nothing odd about having a lonely .set_parent callback; in my case
> >> the clocks are parented from the device tree.
> >>
> >> Having the clocks driver trigger a parent change when requesting a rate
> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> >> one is configured as driving the CPU clock, it becomes messy.
> >> The thing is, the clocks driver has no way to know whether or not it is
> >> "safe" to use a designated parent.
> >>
> >> For that reason, in practice, I never actually want to have a clock
> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> >> configured in the DTS.
> >
> > Yeah, and this is totally fine. But we need to be explicit about it. The
> > determine_rate implementation I did in all the patches is an exact
> > equivalent to the round_rate one if there was one. We will never ask to
> > change the parent.
> >
> > Given what you just said, I would suggest to set the
> > CLK_SET_RATE_NO_REPARENT flag as well.
>
> Ideally there should be a way for drivers and the device tree to
> say, "clock X must be driven by clock Y", but the clock framework
> would be allowed to re-parent clocks freely as long as it doesn't
> violate any DT or driver constraints.

I'm not really sure what you mean there, sorry. Isn't it what
assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
implementation that would affect best_parent_hw would already provide?

> That way allowing reparenting doesn't need to be an all-or-nothing
> thing, and it doesn't need to be decided at the clock driver level
> with special flags.

Like I said, the default implementation is already working to what you
suggested if I understood properly. However, this has never been tested
for any of the drivers in that series so I don't want to introduce (and
debug ;)) regressions in all those drivers that were not setting any
constraint but never actually tested their reparenting code.

So that series is strictly equivalent to what you had before, it's just
explicit now.

If you find that some other decision make sense for your driver in
particular cases, feel free to change it. I barely know most of these
platforms, so I won't be able to make that decision (and test it)
unfortunately.

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-07  8:54           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07  8:54 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Paul Cercueil, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi,

On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> 
> Maxime Ripard <maxime@cerno.tech> writes:
> 
> > Hi Paul,
> >
> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> >> écrit :
> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> >> > doesn't provide a determine_rate implementation.
> >> >
> >> > This is a bit odd, since set_parent() is there to, as its name implies,
> >> > change the parent of a clock. However, the most likely candidate to
> >> > trigger that parent change is a call to clk_set_rate(), with
> >> > determine_rate() figuring out which parent is the best suited for a
> >> > given rate.
> >> >
> >> > The other trigger would be a call to clk_set_parent(), but it's far less
> >> > used, and it doesn't look like there's any obvious user for that clock.
> >> >
> >> > So, the set_parent hook is effectively unused, possibly because of an
> >> > oversight. However, it could also be an explicit decision by the
> >> > original author to avoid any reparenting but through an explicit call to
> >> > clk_set_parent().
> >> >
> >> > The driver does implement round_rate() though, which means that we can
> >> > change the rate of the clock, but we will never get to change the
> >> > parent.
> >> >
> >> > However, It's hard to tell whether it's been done on purpose or not.
> >> >
> >> > Since we'll start mandating a determine_rate() implementation, let's
> >> > convert the round_rate() implementation to a determine_rate(), which
> >> > will also make the current behavior explicit. And if it was an
> >> > oversight, the clock behaviour can be adjusted later on.
> >>
> >> So it's partly on purpose, partly because I didn't know about
> >> .determine_rate.
> >>
> >> There's nothing odd about having a lonely .set_parent callback; in my case
> >> the clocks are parented from the device tree.
> >>
> >> Having the clocks driver trigger a parent change when requesting a rate
> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> >> one is configured as driving the CPU clock, it becomes messy.
> >> The thing is, the clocks driver has no way to know whether or not it is
> >> "safe" to use a designated parent.
> >>
> >> For that reason, in practice, I never actually want to have a clock
> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> >> configured in the DTS.
> >
> > Yeah, and this is totally fine. But we need to be explicit about it. The
> > determine_rate implementation I did in all the patches is an exact
> > equivalent to the round_rate one if there was one. We will never ask to
> > change the parent.
> >
> > Given what you just said, I would suggest to set the
> > CLK_SET_RATE_NO_REPARENT flag as well.
>
> Ideally there should be a way for drivers and the device tree to
> say, "clock X must be driven by clock Y", but the clock framework
> would be allowed to re-parent clocks freely as long as it doesn't
> violate any DT or driver constraints.

I'm not really sure what you mean there, sorry. Isn't it what
assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
implementation that would affect best_parent_hw would already provide?

> That way allowing reparenting doesn't need to be an all-or-nothing
> thing, and it doesn't need to be decided at the clock driver level
> with special flags.

Like I said, the default implementation is already working to what you
suggested if I understood properly. However, this has never been tested
for any of the drivers in that series so I don't want to introduce (and
debug ;)) regressions in all those drivers that were not setting any
constraint but never actually tested their reparenting code.

So that series is strictly equivalent to what you had before, it's just
explicit now.

If you find that some other decision make sense for your driver in
particular cases, feel free to change it. I barely know most of these
platforms, so I won't be able to make that decision (and test it)
unfortunately.

Maxime

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-07  8:54           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07  8:54 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi,

On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> 
> Maxime Ripard <maxime@cerno.tech> writes:
> 
> > Hi Paul,
> >
> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> >> écrit :
> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> >> > doesn't provide a determine_rate implementation.
> >> >
> >> > This is a bit odd, since set_parent() is there to, as its name implies,
> >> > change the parent of a clock. However, the most likely candidate to
> >> > trigger that parent change is a call to clk_set_rate(), with
> >> > determine_rate() figuring out which parent is the best suited for a
> >> > given rate.
> >> >
> >> > The other trigger would be a call to clk_set_parent(), but it's far less
> >> > used, and it doesn't look like there's any obvious user for that clock.
> >> >
> >> > So, the set_parent hook is effectively unused, possibly because of an
> >> > oversight. However, it could also be an explicit decision by the
> >> > original author to avoid any reparenting but through an explicit call to
> >> > clk_set_parent().
> >> >
> >> > The driver does implement round_rate() though, which means that we can
> >> > change the rate of the clock, but we will never get to change the
> >> > parent.
> >> >
> >> > However, It's hard to tell whether it's been done on purpose or not.
> >> >
> >> > Since we'll start mandating a determine_rate() implementation, let's
> >> > convert the round_rate() implementation to a determine_rate(), which
> >> > will also make the current behavior explicit. And if it was an
> >> > oversight, the clock behaviour can be adjusted later on.
> >>
> >> So it's partly on purpose, partly because I didn't know about
> >> .determine_rate.
> >>
> >> There's nothing odd about having a lonely .set_parent callback; in my case
> >> the clocks are parented from the device tree.
> >>
> >> Having the clocks driver trigger a parent change when requesting a rate
> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> >> one is configured as driving the CPU clock, it becomes messy.
> >> The thing is, the clocks driver has no way to know whether or not it is
> >> "safe" to use a designated parent.
> >>
> >> For that reason, in practice, I never actually want to have a clock
> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> >> configured in the DTS.
> >
> > Yeah, and this is totally fine. But we need to be explicit about it. The
> > determine_rate implementation I did in all the patches is an exact
> > equivalent to the round_rate one if there was one. We will never ask to
> > change the parent.
> >
> > Given what you just said, I would suggest to set the
> > CLK_SET_RATE_NO_REPARENT flag as well.
>
> Ideally there should be a way for drivers and the device tree to
> say, "clock X must be driven by clock Y", but the clock framework
> would be allowed to re-parent clocks freely as long as it doesn't
> violate any DT or driver constraints.

I'm not really sure what you mean there, sorry. Isn't it what
assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
implementation that would affect best_parent_hw would already provide?

> That way allowing reparenting doesn't need to be an all-or-nothing
> thing, and it doesn't need to be decided at the clock driver level
> with special flags.

Like I said, the default implementation is already working to what you
suggested if I understood properly. However, this has never been tested
for any of the drivers in that series so I don't want to introduce (and
debug ;)) regressions in all those drivers that were not setting any
constraint but never actually tested their reparenting code.

So that series is strictly equivalent to what you had before, it's just
explicit now.

If you find that some other decision make sense for your driver in
particular cases, feel free to change it. I barely know most of these
platforms, so I won't be able to make that decision (and test it)
unfortunately.

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate
  2022-11-04 13:18   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-07 10:56     ` Charles Keepax
  -1 siblings, 0 replies; 388+ messages in thread
From: Charles Keepax @ 2022-11-07 10:56 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, Nov 04, 2022 at 02:18:22PM +0100, Maxime Ripard wrote:
> The determine_rate hook allows to select the proper parent and its rate
> for a given clock configuration. On another hand, set_parent is there to
> change the parent of a mux.
> 
> Some clocks provide a set_parent hook but don't implement
> determine_rate. In such a case, set_parent is pretty much useless since
> the clock framework will always assume the current parent is to be used,
> and we will thus never change it.
> 
> This situation can be solved in two ways:
>   - either we don't need to change the parent, and we thus shouldn't
>     implement set_parent;
>   - or we don't want to change the parent, in this case we should set
>     CLK_SET_RATE_NO_REPARENT;
>   - or we're missing a determine_rate implementation.
> 
> The latter is probably just an oversight from the driver's author, and
> we should thus raise their awareness about the fact that the current
> state of the driver is confusing.
> 
> It's not clear at this point how many drivers are affected though, so
> let's make it a warning instead of an error for now.
> 

Commit message could probably use updated to make the new state
of the chain.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate
@ 2022-11-07 10:56     ` Charles Keepax
  0 siblings, 0 replies; 388+ messages in thread
From: Charles Keepax @ 2022-11-07 10:56 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, Nov 04, 2022 at 02:18:22PM +0100, Maxime Ripard wrote:
> The determine_rate hook allows to select the proper parent and its rate
> for a given clock configuration. On another hand, set_parent is there to
> change the parent of a mux.
> 
> Some clocks provide a set_parent hook but don't implement
> determine_rate. In such a case, set_parent is pretty much useless since
> the clock framework will always assume the current parent is to be used,
> and we will thus never change it.
> 
> This situation can be solved in two ways:
>   - either we don't need to change the parent, and we thus shouldn't
>     implement set_parent;
>   - or we don't want to change the parent, in this case we should set
>     CLK_SET_RATE_NO_REPARENT;
>   - or we're missing a determine_rate implementation.
> 
> The latter is probably just an oversight from the driver's author, and
> we should thus raise their awareness about the fact that the current
> state of the driver is confusing.
> 
> It's not clear at this point how many drivers are affected though, so
> let's make it a warning instead of an error for now.
> 

Commit message could probably use updated to make the new state
of the chain.

Thanks,
Charles

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate
@ 2022-11-07 10:56     ` Charles Keepax
  0 siblings, 0 replies; 388+ messages in thread
From: Charles Keepax @ 2022-11-07 10:56 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team,
	Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc, linux-clk,
	linux-tegra, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Nov 04, 2022 at 02:18:22PM +0100, Maxime Ripard wrote:
> The determine_rate hook allows to select the proper parent and its rate
> for a given clock configuration. On another hand, set_parent is there to
> change the parent of a mux.
> 
> Some clocks provide a set_parent hook but don't implement
> determine_rate. In such a case, set_parent is pretty much useless since
> the clock framework will always assume the current parent is to be used,
> and we will thus never change it.
> 
> This situation can be solved in two ways:
>   - either we don't need to change the parent, and we thus shouldn't
>     implement set_parent;
>   - or we don't want to change the parent, in this case we should set
>     CLK_SET_RATE_NO_REPARENT;
>   - or we're missing a determine_rate implementation.
> 
> The latter is probably just an oversight from the driver's author, and
> we should thus raise their awareness about the fact that the current
> state of the driver is confusing.
> 
> It's not clear at this point how many drivers are affected though, so
> let's make it a warning instead of an error for now.
> 

Commit message could probably use updated to make the new state
of the chain.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate
@ 2022-11-07 10:56     ` Charles Keepax
  0 siblings, 0 replies; 388+ messages in thread
From: Charles Keepax @ 2022-11-07 10:56 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk, linux-tegra,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Nov 04, 2022 at 02:18:22PM +0100, Maxime Ripard wrote:
> The determine_rate hook allows to select the proper parent and its rate
> for a given clock configuration. On another hand, set_parent is there to
> change the parent of a mux.
> 
> Some clocks provide a set_parent hook but don't implement
> determine_rate. In such a case, set_parent is pretty much useless since
> the clock framework will always assume the current parent is to be used,
> and we will thus never change it.
> 
> This situation can be solved in two ways:
>   - either we don't need to change the parent, and we thus shouldn't
>     implement set_parent;
>   - or we don't want to change the parent, in this case we should set
>     CLK_SET_RATE_NO_REPARENT;
>   - or we're missing a determine_rate implementation.
> 
> The latter is probably just an oversight from the driver's author, and
> we should thus raise their awareness about the fact that the current
> state of the driver is confusing.
> 
> It's not clear at this point how many drivers are affected though, so
> let's make it a warning instead of an error for now.
> 

Commit message could probably use updated to make the new state
of the chain.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-07 10:58     ` Charles Keepax
  -1 siblings, 0 replies; 388+ messages in thread
From: Charles Keepax @ 2022-11-07 10:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, Nov 04, 2022 at 02:17:37PM +0100, Maxime Ripard wrote:
> The WM381x "clkout" clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 

Yeah I don't think there would be anything wrong with this clock
changing parents on a rate change, but as you say this can be
refined down the line if someone needs the behaviour. It's an
older part so probably better to stick roughly to the current
behaviour for now.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook
@ 2022-11-07 10:58     ` Charles Keepax
  0 siblings, 0 replies; 388+ messages in thread
From: Charles Keepax @ 2022-11-07 10:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, Nov 04, 2022 at 02:17:37PM +0100, Maxime Ripard wrote:
> The WM381x "clkout" clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 

Yeah I don't think there would be anything wrong with this clock
changing parents on a rate change, but as you say this can be
refined down the line if someone needs the behaviour. It's an
older part so probably better to stick roughly to the current
behaviour for now.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook
@ 2022-11-07 10:58     ` Charles Keepax
  0 siblings, 0 replies; 388+ messages in thread
From: Charles Keepax @ 2022-11-07 10:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team,
	Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc, linux-clk,
	linux-tegra, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Nov 04, 2022 at 02:17:37PM +0100, Maxime Ripard wrote:
> The WM381x "clkout" clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 

Yeah I don't think there would be anything wrong with this clock
changing parents on a rate change, but as you say this can be
refined down the line if someone needs the behaviour. It's an
older part so probably better to stick roughly to the current
behaviour for now.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 20/65] clk: wm831x: clkout: Add a determine_rate hook
@ 2022-11-07 10:58     ` Charles Keepax
  0 siblings, 0 replies; 388+ messages in thread
From: Charles Keepax @ 2022-11-07 10:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk, linux-tegra,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Nov 04, 2022 at 02:17:37PM +0100, Maxime Ripard wrote:
> The WM381x "clkout" clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
> 
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 

Yeah I don't think there would be anything wrong with this clock
changing parents on a rate change, but as you say this can be
refined down the line if someone needs the behaviour. It's an
older part so probably better to stick roughly to the current
behaviour for now.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-07  8:43           ` Maxime Ripard
  (?)
  (?)
@ 2022-11-07 12:06             ` Mark Brown
  -1 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-07 12:06 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:

> > Well, hopefully everyone for whom it's an issue currently will be
> > objecting to this version of the change anyway so we'll either know
> > where to set the flag or we'll get the whack-a-mole with the series
> > being merged?

> I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> moment is that determine_rate and set_parent aren't coupled, and it led
> to issues due to oversight.

> I initially added a warning but Stephen wanted to fix all users in that
> case and make that an error instead.

My suggestion is that instead of doing either of these things it'd be
quicker and less error prone to just fix the core to provide the default
implementation if nothing more specific is provided.  Any issues that
causes would already be present with your current series.

> If I filled __clk_mux_determine_rate into clocks that weren't using it
> before, I would change their behavior. With that flag set, on all users
> I add __clk_mux_determine_rate to, the behavior is the same than what we
> previously had, so the risk of regressions is minimal, and everything
> should keep going like it was?

The series does fill in __clk_mux_determine_rate for everything though -
if it was just assumed by default the only thing that'd be needed would
be adding the flag.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 12:06             ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-07 12:06 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:

> > Well, hopefully everyone for whom it's an issue currently will be
> > objecting to this version of the change anyway so we'll either know
> > where to set the flag or we'll get the whack-a-mole with the series
> > being merged?

> I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> moment is that determine_rate and set_parent aren't coupled, and it led
> to issues due to oversight.

> I initially added a warning but Stephen wanted to fix all users in that
> case and make that an error instead.

My suggestion is that instead of doing either of these things it'd be
quicker and less error prone to just fix the core to provide the default
implementation if nothing more specific is provided.  Any issues that
causes would already be present with your current series.

> If I filled __clk_mux_determine_rate into clocks that weren't using it
> before, I would change their behavior. With that flag set, on all users
> I add __clk_mux_determine_rate to, the behavior is the same than what we
> previously had, so the risk of regressions is minimal, and everything
> should keep going like it was?

The series does fill in __clk_mux_determine_rate for everything though -
if it was just assumed by default the only thing that'd be needed would
be adding the flag.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 12:06             ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-07 12:06 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1418 bytes --]

On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:

> > Well, hopefully everyone for whom it's an issue currently will be
> > objecting to this version of the change anyway so we'll either know
> > where to set the flag or we'll get the whack-a-mole with the series
> > being merged?

> I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> moment is that determine_rate and set_parent aren't coupled, and it led
> to issues due to oversight.

> I initially added a warning but Stephen wanted to fix all users in that
> case and make that an error instead.

My suggestion is that instead of doing either of these things it'd be
quicker and less error prone to just fix the core to provide the default
implementation if nothing more specific is provided.  Any issues that
causes would already be present with your current series.

> If I filled __clk_mux_determine_rate into clocks that weren't using it
> before, I would change their behavior. With that flag set, on all users
> I add __clk_mux_determine_rate to, the behavior is the same than what we
> previously had, so the risk of regressions is minimal, and everything
> should keep going like it was?

The series does fill in __clk_mux_determine_rate for everything though -
if it was just assumed by default the only thing that'd be needed would
be adding the flag.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 12:06             ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-07 12:06 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:

> > Well, hopefully everyone for whom it's an issue currently will be
> > objecting to this version of the change anyway so we'll either know
> > where to set the flag or we'll get the whack-a-mole with the series
> > being merged?

> I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> moment is that determine_rate and set_parent aren't coupled, and it led
> to issues due to oversight.

> I initially added a warning but Stephen wanted to fix all users in that
> case and make that an error instead.

My suggestion is that instead of doing either of these things it'd be
quicker and less error prone to just fix the core to provide the default
implementation if nothing more specific is provided.  Any issues that
causes would already be present with your current series.

> If I filled __clk_mux_determine_rate into clocks that weren't using it
> before, I would change their behavior. With that flag set, on all users
> I add __clk_mux_determine_rate to, the behavior is the same than what we
> previously had, so the risk of regressions is minimal, and everything
> should keep going like it was?

The series does fill in __clk_mux_determine_rate for everything though -
if it was just assumed by default the only thing that'd be needed would
be adding the flag.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
  2022-11-04 16:45     ` David Lechner
  (?)
  (?)
@ 2022-11-07 12:06       ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 12:06 UTC (permalink / raw)
  To: David Lechner
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

Hi David,

On Fri, Nov 04, 2022 at 11:45:17AM -0500, David Lechner wrote:
> On 11/4/22 8:17 AM, Maxime Ripard wrote:
> > The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> 
> The parent is defined in the device tree and is not expected to change
> at runtime, so if I am understanding the patch correctly, setting the
> CLK_SET_RATE_NO_REPARENT flag seems correct.

Is that an acked-by/reviewed-by?

Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-07 12:06       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 12:06 UTC (permalink / raw)
  To: David Lechner
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

Hi David,

On Fri, Nov 04, 2022 at 11:45:17AM -0500, David Lechner wrote:
> On 11/4/22 8:17 AM, Maxime Ripard wrote:
> > The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> 
> The parent is defined in the device tree and is not expected to change
> at runtime, so if I am understanding the patch correctly, setting the
> CLK_SET_RATE_NO_REPARENT flag seems correct.

Is that an acked-by/reviewed-by?

Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-07 12:06       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 12:06 UTC (permalink / raw)
  To: David Lechner
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1245 bytes --]

Hi David,

On Fri, Nov 04, 2022 at 11:45:17AM -0500, David Lechner wrote:
> On 11/4/22 8:17 AM, Maxime Ripard wrote:
> > The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> 
> The parent is defined in the device tree and is not expected to change
> at runtime, so if I am understanding the patch correctly, setting the
> CLK_SET_RATE_NO_REPARENT flag seems correct.

Is that an acked-by/reviewed-by?

Thanks!
Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-07 12:06       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 12:06 UTC (permalink / raw)
  To: David Lechner
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

Hi David,

On Fri, Nov 04, 2022 at 11:45:17AM -0500, David Lechner wrote:
> On 11/4/22 8:17 AM, Maxime Ripard wrote:
> > The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> 
> The parent is defined in the device tree and is not expected to change
> at runtime, so if I am understanding the patch correctly, setting the
> CLK_SET_RATE_NO_REPARENT flag seems correct.

Is that an acked-by/reviewed-by?

Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
  2022-11-04 16:49     ` David Lechner
  (?)
  (?)
@ 2022-11-07 14:52       ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 14:52 UTC (permalink / raw)
  To: David Lechner
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1972 bytes --]

Hi David,

On Fri, Nov 04, 2022 at 11:49:34AM -0500, David Lechner wrote:
> On 11/4/22 8:18 AM, Maxime Ripard wrote:
> > The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> > 
> > The driver does implement round_rate() though, which means that we can
> > change the rate of the clock, but we will never get to change the
> > parent.
> > 
> > However, It's hard to tell whether it's been done on purpose or not.
> > 
> > Since we'll start mandating a determine_rate() implementation, let's
> > convert the round_rate() implementation to a determine_rate(), which
> > will also make the current behavior explicit. And if it was an
> > oversight, the clock behaviour can be adjusted later on.
> 
> I think this one should be the same as the clk:davinci changes and
> not allow re-parenting. Since this is a USB 48MHz PHY clock, a rate
> change will never be requested.

I'm not sure, it doesn't seem to be the same clock, it's not doing the
same thing (this one will always force the same rate, the others let the
rate change), and we're not doing the same refactoring (this one had a
round_rate implementation, the other one doesn't)

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
@ 2022-11-07 14:52       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 14:52 UTC (permalink / raw)
  To: David Lechner
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1972 bytes --]

Hi David,

On Fri, Nov 04, 2022 at 11:49:34AM -0500, David Lechner wrote:
> On 11/4/22 8:18 AM, Maxime Ripard wrote:
> > The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> > 
> > The driver does implement round_rate() though, which means that we can
> > change the rate of the clock, but we will never get to change the
> > parent.
> > 
> > However, It's hard to tell whether it's been done on purpose or not.
> > 
> > Since we'll start mandating a determine_rate() implementation, let's
> > convert the round_rate() implementation to a determine_rate(), which
> > will also make the current behavior explicit. And if it was an
> > oversight, the clock behaviour can be adjusted later on.
> 
> I think this one should be the same as the clk:davinci changes and
> not allow re-parenting. Since this is a USB 48MHz PHY clock, a rate
> change will never be requested.

I'm not sure, it doesn't seem to be the same clock, it's not doing the
same thing (this one will always force the same rate, the others let the
rate change), and we're not doing the same refactoring (this one had a
round_rate implementation, the other one doesn't)

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
@ 2022-11-07 14:52       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 14:52 UTC (permalink / raw)
  To: David Lechner
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1972 bytes --]

Hi David,

On Fri, Nov 04, 2022 at 11:49:34AM -0500, David Lechner wrote:
> On 11/4/22 8:18 AM, Maxime Ripard wrote:
> > The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> > 
> > The driver does implement round_rate() though, which means that we can
> > change the rate of the clock, but we will never get to change the
> > parent.
> > 
> > However, It's hard to tell whether it's been done on purpose or not.
> > 
> > Since we'll start mandating a determine_rate() implementation, let's
> > convert the round_rate() implementation to a determine_rate(), which
> > will also make the current behavior explicit. And if it was an
> > oversight, the clock behaviour can be adjusted later on.
> 
> I think this one should be the same as the clk:davinci changes and
> not allow re-parenting. Since this is a USB 48MHz PHY clock, a rate
> change will never be requested.

I'm not sure, it doesn't seem to be the same clock, it's not doing the
same thing (this one will always force the same rate, the others let the
rate change), and we're not doing the same refactoring (this one had a
round_rate implementation, the other one doesn't)

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 54/65] clk: da8xx: clk48: Switch to determine_rate
@ 2022-11-07 14:52       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 14:52 UTC (permalink / raw)
  To: David Lechner
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1972 bytes --]

Hi David,

On Fri, Nov 04, 2022 at 11:49:34AM -0500, David Lechner wrote:
> On 11/4/22 8:18 AM, Maxime Ripard wrote:
> > The TI DA8xx USB0 clk48 clocks implements a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> > 
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> > 
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> > 
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> > 
> > The driver does implement round_rate() though, which means that we can
> > change the rate of the clock, but we will never get to change the
> > parent.
> > 
> > However, It's hard to tell whether it's been done on purpose or not.
> > 
> > Since we'll start mandating a determine_rate() implementation, let's
> > convert the round_rate() implementation to a determine_rate(), which
> > will also make the current behavior explicit. And if it was an
> > oversight, the clock behaviour can be adjusted later on.
> 
> I think this one should be the same as the clk:davinci changes and
> not allow re-parenting. Since this is a USB 48MHz PHY clock, a rate
> change will never be requested.

I'm not sure, it doesn't seem to be the same clock, it's not doing the
same thing (this one will always force the same rate, the others let the
rate change), and we're not doing the same refactoring (this one had a
round_rate implementation, the other one doesn't)

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
  2022-11-07 12:06       ` Maxime Ripard
  (?)
  (?)
@ 2022-11-07 14:52         ` David Lechner
  -1 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-07 14:52 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On 11/7/22 6:06 AM, Maxime Ripard wrote:
> Hi David,
> 
> On Fri, Nov 04, 2022 at 11:45:17AM -0500, David Lechner wrote:
>> On 11/4/22 8:17 AM, Maxime Ripard wrote:
>>> The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
>>> hook, but doesn't provide a determine_rate implementation.
>>>
>>> This is a bit odd, since set_parent() is there to, as its name implies,
>>> change the parent of a clock. However, the most likely candidate to
>>> trigger that parent change is a call to clk_set_rate(), with
>>> determine_rate() figuring out which parent is the best suited for a
>>> given rate.
>>>
>>> The other trigger would be a call to clk_set_parent(), but it's far less
>>> used, and it doesn't look like there's any obvious user for that clock.
>>>
>>> So, the set_parent hook is effectively unused, possibly because of an
>>> oversight. However, it could also be an explicit decision by the
>>> original author to avoid any reparenting but through an explicit call to
>>> clk_set_parent().
>>
>>
>> The parent is defined in the device tree and is not expected to change
>> at runtime, so if I am understanding the patch correctly, setting the
>> CLK_SET_RATE_NO_REPARENT flag seems correct.
> 
> Is that an acked-by/reviewed-by?
> 
> Thanks!
> Maxime

The commit message could be updated to be more certain now, but sure...

Acked-by: David Lechner <david@lechnology.com>

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-07 14:52         ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-07 14:52 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, Shawn Guo, Claudiu Beznea

On 11/7/22 6:06 AM, Maxime Ripard wrote:
> Hi David,
> 
> On Fri, Nov 04, 2022 at 11:45:17AM -0500, David Lechner wrote:
>> On 11/4/22 8:17 AM, Maxime Ripard wrote:
>>> The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
>>> hook, but doesn't provide a determine_rate implementation.
>>>
>>> This is a bit odd, since set_parent() is there to, as its name implies,
>>> change the parent of a clock. However, the most likely candidate to
>>> trigger that parent change is a call to clk_set_rate(), with
>>> determine_rate() figuring out which parent is the best suited for a
>>> given rate.
>>>
>>> The other trigger would be a call to clk_set_parent(), but it's far less
>>> used, and it doesn't look like there's any obvious user for that clock.
>>>
>>> So, the set_parent hook is effectively unused, possibly because of an
>>> oversight. However, it could also be an explicit decision by the
>>> original author to avoid any reparenting but through an explicit call to
>>> clk_set_parent().
>>
>>
>> The parent is defined in the device tree and is not expected to change
>> at runtime, so if I am understanding the patch correctly, setting the
>> CLK_SET_RATE_NO_REPARENT flag seems correct.
> 
> Is that an acked-by/reviewed-by?
> 
> Thanks!
> Maxime

The commit message could be updated to be more certain now, but sure...

Acked-by: David Lechner <david@lechnology.com>

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-07 14:52         ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-07 14:52 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On 11/7/22 6:06 AM, Maxime Ripard wrote:
> Hi David,
> 
> On Fri, Nov 04, 2022 at 11:45:17AM -0500, David Lechner wrote:
>> On 11/4/22 8:17 AM, Maxime Ripard wrote:
>>> The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
>>> hook, but doesn't provide a determine_rate implementation.
>>>
>>> This is a bit odd, since set_parent() is there to, as its name implies,
>>> change the parent of a clock. However, the most likely candidate to
>>> trigger that parent change is a call to clk_set_rate(), with
>>> determine_rate() figuring out which parent is the best suited for a
>>> given rate.
>>>
>>> The other trigger would be a call to clk_set_parent(), but it's far less
>>> used, and it doesn't look like there's any obvious user for that clock.
>>>
>>> So, the set_parent hook is effectively unused, possibly because of an
>>> oversight. However, it could also be an explicit decision by the
>>> original author to avoid any reparenting but through an explicit call to
>>> clk_set_parent().
>>
>>
>> The parent is defined in the device tree and is not expected to change
>> at runtime, so if I am understanding the patch correctly, setting the
>> CLK_SET_RATE_NO_REPARENT flag seems correct.
> 
> Is that an acked-by/reviewed-by?
> 
> Thanks!
> Maxime

The commit message could be updated to be more certain now, but sure...

Acked-by: David Lechner <david@lechnology.com>

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: Add a determine_rate hook
@ 2022-11-07 14:52         ` David Lechner
  0 siblings, 0 replies; 388+ messages in thread
From: David Lechner @ 2022-11-07 14:52 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, Shawn Guo, Claudiu Beznea

On 11/7/22 6:06 AM, Maxime Ripard wrote:
> Hi David,
> 
> On Fri, Nov 04, 2022 at 11:45:17AM -0500, David Lechner wrote:
>> On 11/4/22 8:17 AM, Maxime Ripard wrote:
>>> The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
>>> hook, but doesn't provide a determine_rate implementation.
>>>
>>> This is a bit odd, since set_parent() is there to, as its name implies,
>>> change the parent of a clock. However, the most likely candidate to
>>> trigger that parent change is a call to clk_set_rate(), with
>>> determine_rate() figuring out which parent is the best suited for a
>>> given rate.
>>>
>>> The other trigger would be a call to clk_set_parent(), but it's far less
>>> used, and it doesn't look like there's any obvious user for that clock.
>>>
>>> So, the set_parent hook is effectively unused, possibly because of an
>>> oversight. However, it could also be an explicit decision by the
>>> original author to avoid any reparenting but through an explicit call to
>>> clk_set_parent().
>>
>>
>> The parent is defined in the device tree and is not expected to change
>> at runtime, so if I am understanding the patch correctly, setting the
>> CLK_SET_RATE_NO_REPARENT flag seems correct.
> 
> Is that an acked-by/reviewed-by?
> 
> Thanks!
> Maxime

The commit message could be updated to be more certain now, but sure...

Acked-by: David Lechner <david@lechnology.com>

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-07 12:06             ` Mark Brown
  (?)
  (?)
@ 2022-11-07 15:26               ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 15:26 UTC (permalink / raw)
  To: Mark Brown
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 2064 bytes --]

On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> > On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> 
> > > Well, hopefully everyone for whom it's an issue currently will be
> > > objecting to this version of the change anyway so we'll either know
> > > where to set the flag or we'll get the whack-a-mole with the series
> > > being merged?
> 
> > I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> > moment is that determine_rate and set_parent aren't coupled, and it led
> > to issues due to oversight.
> 
> > I initially added a warning but Stephen wanted to fix all users in that
> > case and make that an error instead.
> 
> My suggestion is that instead of doing either of these things it'd be
> quicker and less error prone to just fix the core to provide the default
> implementation if nothing more specific is provided.  Any issues that
> causes would already be present with your current series.
> 
> > If I filled __clk_mux_determine_rate into clocks that weren't using it
> > before, I would change their behavior. With that flag set, on all users
> > I add __clk_mux_determine_rate to, the behavior is the same than what we
> > previously had, so the risk of regressions is minimal, and everything
> > should keep going like it was?
> 
> The series does fill in __clk_mux_determine_rate for everything though -
> if it was just assumed by default the only thing that'd be needed would
> be adding the flag.

The behavior assumed by default was equivalent to
__clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
both if determine_rate is missing in the core, but that's unprecedented
in the clock framework so I think we'll want Stephen to comment here :)

It's also replacing one implicit behavior by another. The point of this
series was to raise awareness on that particular point, so I'm not sure
it actually fixes things. We'll see what Stephen thinks about it.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 15:26               ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 15:26 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 2064 bytes --]

On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> > On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> 
> > > Well, hopefully everyone for whom it's an issue currently will be
> > > objecting to this version of the change anyway so we'll either know
> > > where to set the flag or we'll get the whack-a-mole with the series
> > > being merged?
> 
> > I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> > moment is that determine_rate and set_parent aren't coupled, and it led
> > to issues due to oversight.
> 
> > I initially added a warning but Stephen wanted to fix all users in that
> > case and make that an error instead.
> 
> My suggestion is that instead of doing either of these things it'd be
> quicker and less error prone to just fix the core to provide the default
> implementation if nothing more specific is provided.  Any issues that
> causes would already be present with your current series.
> 
> > If I filled __clk_mux_determine_rate into clocks that weren't using it
> > before, I would change their behavior. With that flag set, on all users
> > I add __clk_mux_determine_rate to, the behavior is the same than what we
> > previously had, so the risk of regressions is minimal, and everything
> > should keep going like it was?
> 
> The series does fill in __clk_mux_determine_rate for everything though -
> if it was just assumed by default the only thing that'd be needed would
> be adding the flag.

The behavior assumed by default was equivalent to
__clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
both if determine_rate is missing in the core, but that's unprecedented
in the clock framework so I think we'll want Stephen to comment here :)

It's also replacing one implicit behavior by another. The point of this
series was to raise awareness on that particular point, so I'm not sure
it actually fixes things. We'll see what Stephen thinks about it.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 15:26               ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 15:26 UTC (permalink / raw)
  To: Mark Brown
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 2064 bytes --]

On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> > On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> 
> > > Well, hopefully everyone for whom it's an issue currently will be
> > > objecting to this version of the change anyway so we'll either know
> > > where to set the flag or we'll get the whack-a-mole with the series
> > > being merged?
> 
> > I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> > moment is that determine_rate and set_parent aren't coupled, and it led
> > to issues due to oversight.
> 
> > I initially added a warning but Stephen wanted to fix all users in that
> > case and make that an error instead.
> 
> My suggestion is that instead of doing either of these things it'd be
> quicker and less error prone to just fix the core to provide the default
> implementation if nothing more specific is provided.  Any issues that
> causes would already be present with your current series.
> 
> > If I filled __clk_mux_determine_rate into clocks that weren't using it
> > before, I would change their behavior. With that flag set, on all users
> > I add __clk_mux_determine_rate to, the behavior is the same than what we
> > previously had, so the risk of regressions is minimal, and everything
> > should keep going like it was?
> 
> The series does fill in __clk_mux_determine_rate for everything though -
> if it was just assumed by default the only thing that'd be needed would
> be adding the flag.

The behavior assumed by default was equivalent to
__clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
both if determine_rate is missing in the core, but that's unprecedented
in the clock framework so I think we'll want Stephen to comment here :)

It's also replacing one implicit behavior by another. The point of this
series was to raise awareness on that particular point, so I'm not sure
it actually fixes things. We'll see what Stephen thinks about it.

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 15:26               ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-07 15:26 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 2064 bytes --]

On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> > On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> 
> > > Well, hopefully everyone for whom it's an issue currently will be
> > > objecting to this version of the change anyway so we'll either know
> > > where to set the flag or we'll get the whack-a-mole with the series
> > > being merged?
> 
> > I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> > moment is that determine_rate and set_parent aren't coupled, and it led
> > to issues due to oversight.
> 
> > I initially added a warning but Stephen wanted to fix all users in that
> > case and make that an error instead.
> 
> My suggestion is that instead of doing either of these things it'd be
> quicker and less error prone to just fix the core to provide the default
> implementation if nothing more specific is provided.  Any issues that
> causes would already be present with your current series.
> 
> > If I filled __clk_mux_determine_rate into clocks that weren't using it
> > before, I would change their behavior. With that flag set, on all users
> > I add __clk_mux_determine_rate to, the behavior is the same than what we
> > previously had, so the risk of regressions is minimal, and everything
> > should keep going like it was?
> 
> The series does fill in __clk_mux_determine_rate for everything though -
> if it was just assumed by default the only thing that'd be needed would
> be adding the flag.

The behavior assumed by default was equivalent to
__clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
both if determine_rate is missing in the core, but that's unprecedented
in the clock framework so I think we'll want Stephen to comment here :)

It's also replacing one implicit behavior by another. The point of this
series was to raise awareness on that particular point, so I'm not sure
it actually fixes things. We'll see what Stephen thinks about it.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-07 15:26               ` Maxime Ripard
  (?)
  (?)
@ 2022-11-07 16:02                 ` Mark Brown
  -1 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-07 16:02 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

On Mon, Nov 07, 2022 at 04:26:03PM +0100, Maxime Ripard wrote:
> On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> > On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:

> > The series does fill in __clk_mux_determine_rate for everything though -
> > if it was just assumed by default the only thing that'd be needed would
> > be adding the flag.

> The behavior assumed by default was equivalent to
> __clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
> both if determine_rate is missing in the core, but that's unprecedented
> in the clock framework so I think we'll want Stephen to comment here :)

> It's also replacing one implicit behavior by another. The point of this
> series was to raise awareness on that particular point, so I'm not sure
> it actually fixes things. We'll see what Stephen thinks about it.

We could also just set the operation and still require the flag to be
specified.  I'm a little surprised to learn that it's something you
might want to override, never mind that the API didn't have a default -
it feels like a bit of a landmine that this is the case and is probably
why there's so many cases to fix up.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 16:02                 ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-07 16:02 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

On Mon, Nov 07, 2022 at 04:26:03PM +0100, Maxime Ripard wrote:
> On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> > On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:

> > The series does fill in __clk_mux_determine_rate for everything though -
> > if it was just assumed by default the only thing that'd be needed would
> > be adding the flag.

> The behavior assumed by default was equivalent to
> __clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
> both if determine_rate is missing in the core, but that's unprecedented
> in the clock framework so I think we'll want Stephen to comment here :)

> It's also replacing one implicit behavior by another. The point of this
> series was to raise awareness on that particular point, so I'm not sure
> it actually fixes things. We'll see what Stephen thinks about it.

We could also just set the operation and still require the flag to be
specified.  I'm a little surprised to learn that it's something you
might want to override, never mind that the API didn't have a default -
it feels like a bit of a landmine that this is the case and is probably
why there's so many cases to fix up.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 16:02                 ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-07 16:02 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1183 bytes --]

On Mon, Nov 07, 2022 at 04:26:03PM +0100, Maxime Ripard wrote:
> On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> > On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:

> > The series does fill in __clk_mux_determine_rate for everything though -
> > if it was just assumed by default the only thing that'd be needed would
> > be adding the flag.

> The behavior assumed by default was equivalent to
> __clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
> both if determine_rate is missing in the core, but that's unprecedented
> in the clock framework so I think we'll want Stephen to comment here :)

> It's also replacing one implicit behavior by another. The point of this
> series was to raise awareness on that particular point, so I'm not sure
> it actually fixes things. We'll see what Stephen thinks about it.

We could also just set the operation and still require the flag to be
specified.  I'm a little surprised to learn that it's something you
might want to override, never mind that the API didn't have a default -
it feels like a bit of a landmine that this is the case and is probably
why there's so many cases to fix up.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2022-11-07 16:02                 ` Mark Brown
  0 siblings, 0 replies; 388+ messages in thread
From: Mark Brown @ 2022-11-07 16:02 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

On Mon, Nov 07, 2022 at 04:26:03PM +0100, Maxime Ripard wrote:
> On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> > On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:

> > The series does fill in __clk_mux_determine_rate for everything though -
> > if it was just assumed by default the only thing that'd be needed would
> > be adding the flag.

> The behavior assumed by default was equivalent to
> __clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
> both if determine_rate is missing in the core, but that's unprecedented
> in the clock framework so I think we'll want Stephen to comment here :)

> It's also replacing one implicit behavior by another. The point of this
> series was to raise awareness on that particular point, so I'm not sure
> it actually fixes things. We'll see what Stephen thinks about it.

We could also just set the operation and still require the flag to be
specified.  I'm a little surprised to learn that it's something you
might want to override, never mind that the API didn't have a default -
it feels like a bit of a landmine that this is the case and is probably
why there's so many cases to fix up.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-07  8:54           ` Maxime Ripard
  (?)
  (?)
@ 2022-11-07 20:57             ` Aidan MacDonald
  -1 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2022-11-07 20:57 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Paul Cercueil, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Maxime Ripard <maxime@cerno.tech> writes:

> Hi,
>
> On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>>
>> Maxime Ripard <maxime@cerno.tech> writes:
>>
>> > Hi Paul,
>> >
>> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
>> >> écrit :
>> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
>> >> > doesn't provide a determine_rate implementation.
>> >> >
>> >> > This is a bit odd, since set_parent() is there to, as its name implies,
>> >> > change the parent of a clock. However, the most likely candidate to
>> >> > trigger that parent change is a call to clk_set_rate(), with
>> >> > determine_rate() figuring out which parent is the best suited for a
>> >> > given rate.
>> >> >
>> >> > The other trigger would be a call to clk_set_parent(), but it's far less
>> >> > used, and it doesn't look like there's any obvious user for that clock.
>> >> >
>> >> > So, the set_parent hook is effectively unused, possibly because of an
>> >> > oversight. However, it could also be an explicit decision by the
>> >> > original author to avoid any reparenting but through an explicit call to
>> >> > clk_set_parent().
>> >> >
>> >> > The driver does implement round_rate() though, which means that we can
>> >> > change the rate of the clock, but we will never get to change the
>> >> > parent.
>> >> >
>> >> > However, It's hard to tell whether it's been done on purpose or not.
>> >> >
>> >> > Since we'll start mandating a determine_rate() implementation, let's
>> >> > convert the round_rate() implementation to a determine_rate(), which
>> >> > will also make the current behavior explicit. And if it was an
>> >> > oversight, the clock behaviour can be adjusted later on.
>> >>
>> >> So it's partly on purpose, partly because I didn't know about
>> >> .determine_rate.
>> >>
>> >> There's nothing odd about having a lonely .set_parent callback; in my case
>> >> the clocks are parented from the device tree.
>> >>
>> >> Having the clocks driver trigger a parent change when requesting a rate
>> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
>> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
>> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
>> >> one is configured as driving the CPU clock, it becomes messy.
>> >> The thing is, the clocks driver has no way to know whether or not it is
>> >> "safe" to use a designated parent.
>> >>
>> >> For that reason, in practice, I never actually want to have a clock
>> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
>> >> configured in the DTS.
>> >
>> > Yeah, and this is totally fine. But we need to be explicit about it. The
>> > determine_rate implementation I did in all the patches is an exact
>> > equivalent to the round_rate one if there was one. We will never ask to
>> > change the parent.
>> >
>> > Given what you just said, I would suggest to set the
>> > CLK_SET_RATE_NO_REPARENT flag as well.
>>
>> Ideally there should be a way for drivers and the device tree to
>> say, "clock X must be driven by clock Y", but the clock framework
>> would be allowed to re-parent clocks freely as long as it doesn't
>> violate any DT or driver constraints.
>
> I'm not really sure what you mean there, sorry. Isn't it what
> assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
> implementation that would affect best_parent_hw would already provide?

Assigning the parent clock in the DT works once, at boot, but going off
what you wrote in the commit message, if the clock driver has a
.determine_rate() implementation that *can* reparent clocks then it
probably *will* reparent them, and the DT assignment will be lost.

What I'm suggesting is a runtime constraint that the clock subsystem
would enforce, and actively prevent drivers from changing the parent.
Either explicitly with clk_set_parent() or due to .determine_rate().

That way you could write a .determine_rate() implementation that *can*
select a better parent, but if the DT applies a constraint to fix the
clock to a particular parent, the clock subsystem will force that parent
to be used so you can be sure the clock is never reparented by accident.

>> That way allowing reparenting doesn't need to be an all-or-nothing
>> thing, and it doesn't need to be decided at the clock driver level
>> with special flags.
>
> Like I said, the default implementation is already working to what you
> suggested if I understood properly. However, this has never been tested
> for any of the drivers in that series so I don't want to introduce (and
> debug ;)) regressions in all those drivers that were not setting any
> constraint but never actually tested their reparenting code.
>
> So that series is strictly equivalent to what you had before, it's just
> explicit now.
>
> If you find that some other decision make sense for your driver in
> particular cases, feel free to change it. I barely know most of these
> platforms, so I won't be able to make that decision (and test it)
> unfortunately.
>
> Maxime

That's OK, I didn't review the patch, I'm just making a general
suggestion. :)

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-07 20:57             ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2022-11-07 20:57 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea


Maxime Ripard <maxime@cerno.tech> writes:

> Hi,
>
> On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>>
>> Maxime Ripard <maxime@cerno.tech> writes:
>>
>> > Hi Paul,
>> >
>> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
>> >> écrit :
>> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
>> >> > doesn't provide a determine_rate implementation.
>> >> >
>> >> > This is a bit odd, since set_parent() is there to, as its name implies,
>> >> > change the parent of a clock. However, the most likely candidate to
>> >> > trigger that parent change is a call to clk_set_rate(), with
>> >> > determine_rate() figuring out which parent is the best suited for a
>> >> > given rate.
>> >> >
>> >> > The other trigger would be a call to clk_set_parent(), but it's far less
>> >> > used, and it doesn't look like there's any obvious user for that clock.
>> >> >
>> >> > So, the set_parent hook is effectively unused, possibly because of an
>> >> > oversight. However, it could also be an explicit decision by the
>> >> > original author to avoid any reparenting but through an explicit call to
>> >> > clk_set_parent().
>> >> >
>> >> > The driver does implement round_rate() though, which means that we can
>> >> > change the rate of the clock, but we will never get to change the
>> >> > parent.
>> >> >
>> >> > However, It's hard to tell whether it's been done on purpose or not.
>> >> >
>> >> > Since we'll start mandating a determine_rate() implementation, let's
>> >> > convert the round_rate() implementation to a determine_rate(), which
>> >> > will also make the current behavior explicit. And if it was an
>> >> > oversight, the clock behaviour can be adjusted later on.
>> >>
>> >> So it's partly on purpose, partly because I didn't know about
>> >> .determine_rate.
>> >>
>> >> There's nothing odd about having a lonely .set_parent callback; in my case
>> >> the clocks are parented from the device tree.
>> >>
>> >> Having the clocks driver trigger a parent change when requesting a rate
>> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
>> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
>> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
>> >> one is configured as driving the CPU clock, it becomes messy.
>> >> The thing is, the clocks driver has no way to know whether or not it is
>> >> "safe" to use a designated parent.
>> >>
>> >> For that reason, in practice, I never actually want to have a clock
>> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
>> >> configured in the DTS.
>> >
>> > Yeah, and this is totally fine. But we need to be explicit about it. The
>> > determine_rate implementation I did in all the patches is an exact
>> > equivalent to the round_rate one if there was one. We will never ask to
>> > change the parent.
>> >
>> > Given what you just said, I would suggest to set the
>> > CLK_SET_RATE_NO_REPARENT flag as well.
>>
>> Ideally there should be a way for drivers and the device tree to
>> say, "clock X must be driven by clock Y", but the clock framework
>> would be allowed to re-parent clocks freely as long as it doesn't
>> violate any DT or driver constraints.
>
> I'm not really sure what you mean there, sorry. Isn't it what
> assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
> implementation that would affect best_parent_hw would already provide?

Assigning the parent clock in the DT works once, at boot, but going off
what you wrote in the commit message, if the clock driver has a
.determine_rate() implementation that *can* reparent clocks then it
probably *will* reparent them, and the DT assignment will be lost.

What I'm suggesting is a runtime constraint that the clock subsystem
would enforce, and actively prevent drivers from changing the parent.
Either explicitly with clk_set_parent() or due to .determine_rate().

That way you could write a .determine_rate() implementation that *can*
select a better parent, but if the DT applies a constraint to fix the
clock to a particular parent, the clock subsystem will force that parent
to be used so you can be sure the clock is never reparented by accident.

>> That way allowing reparenting doesn't need to be an all-or-nothing
>> thing, and it doesn't need to be decided at the clock driver level
>> with special flags.
>
> Like I said, the default implementation is already working to what you
> suggested if I understood properly. However, this has never been tested
> for any of the drivers in that series so I don't want to introduce (and
> debug ;)) regressions in all those drivers that were not setting any
> constraint but never actually tested their reparenting code.
>
> So that series is strictly equivalent to what you had before, it's just
> explicit now.
>
> If you find that some other decision make sense for your driver in
> particular cases, feel free to change it. I barely know most of these
> platforms, so I won't be able to make that decision (and test it)
> unfortunately.
>
> Maxime

That's OK, I didn't review the patch, I'm just making a general
suggestion. :)

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-07 20:57             ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2022-11-07 20:57 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Paul Cercueil, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Maxime Ripard <maxime@cerno.tech> writes:

> Hi,
>
> On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>>
>> Maxime Ripard <maxime@cerno.tech> writes:
>>
>> > Hi Paul,
>> >
>> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
>> >> écrit :
>> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
>> >> > doesn't provide a determine_rate implementation.
>> >> >
>> >> > This is a bit odd, since set_parent() is there to, as its name implies,
>> >> > change the parent of a clock. However, the most likely candidate to
>> >> > trigger that parent change is a call to clk_set_rate(), with
>> >> > determine_rate() figuring out which parent is the best suited for a
>> >> > given rate.
>> >> >
>> >> > The other trigger would be a call to clk_set_parent(), but it's far less
>> >> > used, and it doesn't look like there's any obvious user for that clock.
>> >> >
>> >> > So, the set_parent hook is effectively unused, possibly because of an
>> >> > oversight. However, it could also be an explicit decision by the
>> >> > original author to avoid any reparenting but through an explicit call to
>> >> > clk_set_parent().
>> >> >
>> >> > The driver does implement round_rate() though, which means that we can
>> >> > change the rate of the clock, but we will never get to change the
>> >> > parent.
>> >> >
>> >> > However, It's hard to tell whether it's been done on purpose or not.
>> >> >
>> >> > Since we'll start mandating a determine_rate() implementation, let's
>> >> > convert the round_rate() implementation to a determine_rate(), which
>> >> > will also make the current behavior explicit. And if it was an
>> >> > oversight, the clock behaviour can be adjusted later on.
>> >>
>> >> So it's partly on purpose, partly because I didn't know about
>> >> .determine_rate.
>> >>
>> >> There's nothing odd about having a lonely .set_parent callback; in my case
>> >> the clocks are parented from the device tree.
>> >>
>> >> Having the clocks driver trigger a parent change when requesting a rate
>> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
>> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
>> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
>> >> one is configured as driving the CPU clock, it becomes messy.
>> >> The thing is, the clocks driver has no way to know whether or not it is
>> >> "safe" to use a designated parent.
>> >>
>> >> For that reason, in practice, I never actually want to have a clock
>> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
>> >> configured in the DTS.
>> >
>> > Yeah, and this is totally fine. But we need to be explicit about it. The
>> > determine_rate implementation I did in all the patches is an exact
>> > equivalent to the round_rate one if there was one. We will never ask to
>> > change the parent.
>> >
>> > Given what you just said, I would suggest to set the
>> > CLK_SET_RATE_NO_REPARENT flag as well.
>>
>> Ideally there should be a way for drivers and the device tree to
>> say, "clock X must be driven by clock Y", but the clock framework
>> would be allowed to re-parent clocks freely as long as it doesn't
>> violate any DT or driver constraints.
>
> I'm not really sure what you mean there, sorry. Isn't it what
> assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
> implementation that would affect best_parent_hw would already provide?

Assigning the parent clock in the DT works once, at boot, but going off
what you wrote in the commit message, if the clock driver has a
.determine_rate() implementation that *can* reparent clocks then it
probably *will* reparent them, and the DT assignment will be lost.

What I'm suggesting is a runtime constraint that the clock subsystem
would enforce, and actively prevent drivers from changing the parent.
Either explicitly with clk_set_parent() or due to .determine_rate().

That way you could write a .determine_rate() implementation that *can*
select a better parent, but if the DT applies a constraint to fix the
clock to a particular parent, the clock subsystem will force that parent
to be used so you can be sure the clock is never reparented by accident.

>> That way allowing reparenting doesn't need to be an all-or-nothing
>> thing, and it doesn't need to be decided at the clock driver level
>> with special flags.
>
> Like I said, the default implementation is already working to what you
> suggested if I understood properly. However, this has never been tested
> for any of the drivers in that series so I don't want to introduce (and
> debug ;)) regressions in all those drivers that were not setting any
> constraint but never actually tested their reparenting code.
>
> So that series is strictly equivalent to what you had before, it's just
> explicit now.
>
> If you find that some other decision make sense for your driver in
> particular cases, feel free to change it. I barely know most of these
> platforms, so I won't be able to make that decision (and test it)
> unfortunately.
>
> Maxime

That's OK, I didn't review the patch, I'm just making a general
suggestion. :)

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-07 20:57             ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2022-11-07 20:57 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea


Maxime Ripard <maxime@cerno.tech> writes:

> Hi,
>
> On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>>
>> Maxime Ripard <maxime@cerno.tech> writes:
>>
>> > Hi Paul,
>> >
>> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
>> >> écrit :
>> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
>> >> > doesn't provide a determine_rate implementation.
>> >> >
>> >> > This is a bit odd, since set_parent() is there to, as its name implies,
>> >> > change the parent of a clock. However, the most likely candidate to
>> >> > trigger that parent change is a call to clk_set_rate(), with
>> >> > determine_rate() figuring out which parent is the best suited for a
>> >> > given rate.
>> >> >
>> >> > The other trigger would be a call to clk_set_parent(), but it's far less
>> >> > used, and it doesn't look like there's any obvious user for that clock.
>> >> >
>> >> > So, the set_parent hook is effectively unused, possibly because of an
>> >> > oversight. However, it could also be an explicit decision by the
>> >> > original author to avoid any reparenting but through an explicit call to
>> >> > clk_set_parent().
>> >> >
>> >> > The driver does implement round_rate() though, which means that we can
>> >> > change the rate of the clock, but we will never get to change the
>> >> > parent.
>> >> >
>> >> > However, It's hard to tell whether it's been done on purpose or not.
>> >> >
>> >> > Since we'll start mandating a determine_rate() implementation, let's
>> >> > convert the round_rate() implementation to a determine_rate(), which
>> >> > will also make the current behavior explicit. And if it was an
>> >> > oversight, the clock behaviour can be adjusted later on.
>> >>
>> >> So it's partly on purpose, partly because I didn't know about
>> >> .determine_rate.
>> >>
>> >> There's nothing odd about having a lonely .set_parent callback; in my case
>> >> the clocks are parented from the device tree.
>> >>
>> >> Having the clocks driver trigger a parent change when requesting a rate
>> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
>> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
>> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
>> >> one is configured as driving the CPU clock, it becomes messy.
>> >> The thing is, the clocks driver has no way to know whether or not it is
>> >> "safe" to use a designated parent.
>> >>
>> >> For that reason, in practice, I never actually want to have a clock
>> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
>> >> configured in the DTS.
>> >
>> > Yeah, and this is totally fine. But we need to be explicit about it. The
>> > determine_rate implementation I did in all the patches is an exact
>> > equivalent to the round_rate one if there was one. We will never ask to
>> > change the parent.
>> >
>> > Given what you just said, I would suggest to set the
>> > CLK_SET_RATE_NO_REPARENT flag as well.
>>
>> Ideally there should be a way for drivers and the device tree to
>> say, "clock X must be driven by clock Y", but the clock framework
>> would be allowed to re-parent clocks freely as long as it doesn't
>> violate any DT or driver constraints.
>
> I'm not really sure what you mean there, sorry. Isn't it what
> assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
> implementation that would affect best_parent_hw would already provide?

Assigning the parent clock in the DT works once, at boot, but going off
what you wrote in the commit message, if the clock driver has a
.determine_rate() implementation that *can* reparent clocks then it
probably *will* reparent them, and the DT assignment will be lost.

What I'm suggesting is a runtime constraint that the clock subsystem
would enforce, and actively prevent drivers from changing the parent.
Either explicitly with clk_set_parent() or due to .determine_rate().

That way you could write a .determine_rate() implementation that *can*
select a better parent, but if the DT applies a constraint to fix the
clock to a particular parent, the clock subsystem will force that parent
to be used so you can be sure the clock is never reparented by accident.

>> That way allowing reparenting doesn't need to be an all-or-nothing
>> thing, and it doesn't need to be decided at the clock driver level
>> with special flags.
>
> Like I said, the default implementation is already working to what you
> suggested if I understood properly. However, this has never been tested
> for any of the drivers in that series so I don't want to introduce (and
> debug ;)) regressions in all those drivers that were not setting any
> constraint but never actually tested their reparenting code.
>
> So that series is strictly equivalent to what you had before, it's just
> explicit now.
>
> If you find that some other decision make sense for your driver in
> particular cases, feel free to change it. I barely know most of these
> platforms, so I won't be able to make that decision (and test it)
> unfortunately.
>
> Maxime

That's OK, I didn't review the patch, I'm just making a general
suggestion. :)

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-08 13:25     ` Linus Walleij
  -1 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-08 13:25 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:

> The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

It is actually set up from the device tree, typically like this:

/* clkout1 from ACLK divided by 8 */
clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;

So the parent (source) and divisor comes in there.

clk->source and clk->divider is already set up when clk_hw_register() is
called.

So set/get_parent() is never used on clkout.

I think I just added the callbacks for completeness, should we delete them
altogether? The patch is probably fine as-is as well so
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
@ 2022-11-08 13:25     ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-08 13:25 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	linux-sunxi, linux-rtc, linux-clk, Charles Keepax, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-actions,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:

> The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

It is actually set up from the device tree, typically like this:

/* clkout1 from ACLK divided by 8 */
clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;

So the parent (source) and divisor comes in there.

clk->source and clk->divider is already set up when clk_hw_register() is
called.

So set/get_parent() is never used on clkout.

I think I just added the callbacks for completeness, should we delete them
altogether? The patch is probably fine as-is as well so
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
@ 2022-11-08 13:25     ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-08 13:25 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:

> The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

It is actually set up from the device tree, typically like this:

/* clkout1 from ACLK divided by 8 */
clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;

So the parent (source) and divisor comes in there.

clk->source and clk->divider is already set up when clk_hw_register() is
called.

So set/get_parent() is never used on clkout.

I think I just added the callbacks for completeness, should we delete them
altogether? The patch is probably fine as-is as well so
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
@ 2022-11-08 13:25     ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-08 13:25 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:

> The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
> but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

It is actually set up from the device tree, typically like this:

/* clkout1 from ACLK divided by 8 */
clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;

So the parent (source) and divisor comes in there.

clk->source and clk->divider is already set up when clk_hw_register() is
called.

So set/get_parent() is never used on clkout.

I think I just added the callbacks for completeness, should we delete them
altogether? The patch is probably fine as-is as well so
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-08 13:27     ` Linus Walleij
  -1 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-08 13:27 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:

> The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-08 13:27     ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-08 13:27 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	linux-sunxi, linux-rtc, linux-clk, Charles Keepax, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-actions,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:

> The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-08 13:27     ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-08 13:27 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:

> The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-08 13:27     ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-08 13:27 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:

> The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 58/65] clk: sprd: composite: Switch to determine_rate
  2022-11-04 13:18   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-09  2:43     ` Chunyan Zhang
  -1 siblings, 0 replies; 388+ messages in thread
From: Chunyan Zhang @ 2022-11-09  2:43 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Takashi Iwai, linux-tegra,
	Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team,
	Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc, linux-clk,
	Charles Keepax, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Claudiu Beznea, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Andreas Färber

On Fri, 4 Nov 2022 at 21:33, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The Spreadtrum composite clocks implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
>
> However, It's hard to tell whether it's been done on purpose or not.
>
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>

Thanks,
Chunyan

> ---
>  drivers/clk/sprd/composite.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c
> index ebb644820b1e..d3a852720c07 100644
> --- a/drivers/clk/sprd/composite.c
> +++ b/drivers/clk/sprd/composite.c
> @@ -9,13 +9,19 @@
>
>  #include "composite.h"
>
> -static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
> -                               unsigned long *parent_rate)
> +static int sprd_comp_determine_rate(struct clk_hw *hw,
> +                                   struct clk_rate_request *req)
>  {
>         struct sprd_comp *cc = hw_to_sprd_comp(hw);
> +       unsigned long rate;
>
> -       return sprd_div_helper_round_rate(&cc->common, &cc->div,
> -                                        rate, parent_rate);
> +       rate = sprd_div_helper_round_rate(&cc->common, &cc->div,
> +                                         req->rate, &req->best_parent_rate);
> +       if (rate < 0)
> +               return rate;
> +
> +       req->rate = rate;
> +       return 0;
>  }
>
>  static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
> @@ -53,7 +59,7 @@ const struct clk_ops sprd_comp_ops = {
>         .get_parent     = sprd_comp_get_parent,
>         .set_parent     = sprd_comp_set_parent,
>
> -       .round_rate     = sprd_comp_round_rate,
> +       .determine_rate = sprd_comp_determine_rate,
>         .recalc_rate    = sprd_comp_recalc_rate,
>         .set_rate       = sprd_comp_set_rate,
>  };
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 58/65] clk: sprd: composite: Switch to determine_rate
@ 2022-11-09  2:43     ` Chunyan Zhang
  0 siblings, 0 replies; 388+ messages in thread
From: Chunyan Zhang @ 2022-11-09  2:43 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, 4 Nov 2022 at 21:33, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The Spreadtrum composite clocks implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
>
> However, It's hard to tell whether it's been done on purpose or not.
>
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>

Thanks,
Chunyan

> ---
>  drivers/clk/sprd/composite.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c
> index ebb644820b1e..d3a852720c07 100644
> --- a/drivers/clk/sprd/composite.c
> +++ b/drivers/clk/sprd/composite.c
> @@ -9,13 +9,19 @@
>
>  #include "composite.h"
>
> -static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
> -                               unsigned long *parent_rate)
> +static int sprd_comp_determine_rate(struct clk_hw *hw,
> +                                   struct clk_rate_request *req)
>  {
>         struct sprd_comp *cc = hw_to_sprd_comp(hw);
> +       unsigned long rate;
>
> -       return sprd_div_helper_round_rate(&cc->common, &cc->div,
> -                                        rate, parent_rate);
> +       rate = sprd_div_helper_round_rate(&cc->common, &cc->div,
> +                                         req->rate, &req->best_parent_rate);
> +       if (rate < 0)
> +               return rate;
> +
> +       req->rate = rate;
> +       return 0;
>  }
>
>  static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
> @@ -53,7 +59,7 @@ const struct clk_ops sprd_comp_ops = {
>         .get_parent     = sprd_comp_get_parent,
>         .set_parent     = sprd_comp_set_parent,
>
> -       .round_rate     = sprd_comp_round_rate,
> +       .determine_rate = sprd_comp_determine_rate,
>         .recalc_rate    = sprd_comp_recalc_rate,
>         .set_rate       = sprd_comp_set_rate,
>  };
>
> --
> b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 58/65] clk: sprd: composite: Switch to determine_rate
@ 2022-11-09  2:43     ` Chunyan Zhang
  0 siblings, 0 replies; 388+ messages in thread
From: Chunyan Zhang @ 2022-11-09  2:43 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, 4 Nov 2022 at 21:33, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The Spreadtrum composite clocks implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
>
> However, It's hard to tell whether it's been done on purpose or not.
>
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>

Thanks,
Chunyan

> ---
>  drivers/clk/sprd/composite.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c
> index ebb644820b1e..d3a852720c07 100644
> --- a/drivers/clk/sprd/composite.c
> +++ b/drivers/clk/sprd/composite.c
> @@ -9,13 +9,19 @@
>
>  #include "composite.h"
>
> -static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
> -                               unsigned long *parent_rate)
> +static int sprd_comp_determine_rate(struct clk_hw *hw,
> +                                   struct clk_rate_request *req)
>  {
>         struct sprd_comp *cc = hw_to_sprd_comp(hw);
> +       unsigned long rate;
>
> -       return sprd_div_helper_round_rate(&cc->common, &cc->div,
> -                                        rate, parent_rate);
> +       rate = sprd_div_helper_round_rate(&cc->common, &cc->div,
> +                                         req->rate, &req->best_parent_rate);
> +       if (rate < 0)
> +               return rate;
> +
> +       req->rate = rate;
> +       return 0;
>  }
>
>  static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
> @@ -53,7 +59,7 @@ const struct clk_ops sprd_comp_ops = {
>         .get_parent     = sprd_comp_get_parent,
>         .set_parent     = sprd_comp_set_parent,
>
> -       .round_rate     = sprd_comp_round_rate,
> +       .determine_rate = sprd_comp_determine_rate,
>         .recalc_rate    = sprd_comp_recalc_rate,
>         .set_rate       = sprd_comp_set_rate,
>  };
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 58/65] clk: sprd: composite: Switch to determine_rate
@ 2022-11-09  2:43     ` Chunyan Zhang
  0 siblings, 0 replies; 388+ messages in thread
From: Chunyan Zhang @ 2022-11-09  2:43 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	Fabio Estevam, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, David Airlie, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	Linus Walleij, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Claudiu Beznea, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Andreas Färber

On Fri, 4 Nov 2022 at 21:33, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The Spreadtrum composite clocks implements a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().
>
> The driver does implement round_rate() though, which means that we can
> change the rate of the clock, but we will never get to change the
> parent.
>
> However, It's hard to tell whether it's been done on purpose or not.
>
> Since we'll start mandating a determine_rate() implementation, let's
> convert the round_rate() implementation to a determine_rate(), which
> will also make the current behavior explicit. And if it was an
> oversight, the clock behaviour can be adjusted later on.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>

Thanks,
Chunyan

> ---
>  drivers/clk/sprd/composite.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/sprd/composite.c b/drivers/clk/sprd/composite.c
> index ebb644820b1e..d3a852720c07 100644
> --- a/drivers/clk/sprd/composite.c
> +++ b/drivers/clk/sprd/composite.c
> @@ -9,13 +9,19 @@
>
>  #include "composite.h"
>
> -static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate,
> -                               unsigned long *parent_rate)
> +static int sprd_comp_determine_rate(struct clk_hw *hw,
> +                                   struct clk_rate_request *req)
>  {
>         struct sprd_comp *cc = hw_to_sprd_comp(hw);
> +       unsigned long rate;
>
> -       return sprd_div_helper_round_rate(&cc->common, &cc->div,
> -                                        rate, parent_rate);
> +       rate = sprd_div_helper_round_rate(&cc->common, &cc->div,
> +                                         req->rate, &req->best_parent_rate);
> +       if (rate < 0)
> +               return rate;
> +
> +       req->rate = rate;
> +       return 0;
>  }
>
>  static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw,
> @@ -53,7 +59,7 @@ const struct clk_ops sprd_comp_ops = {
>         .get_parent     = sprd_comp_get_parent,
>         .set_parent     = sprd_comp_set_parent,
>
> -       .round_rate     = sprd_comp_round_rate,
> +       .determine_rate = sprd_comp_determine_rate,
>         .recalc_rate    = sprd_comp_recalc_rate,
>         .set_rate       = sprd_comp_set_rate,
>  };
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-05 10:33         ` Paul Cercueil
  (?)
  (?)
@ 2022-11-09 10:53           ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 10:53 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Paul,

On Sat, Nov 05, 2022 at 10:33:54AM +0000, Paul Cercueil wrote:
> Hi Maxime,
> 
> Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard <maxime@cerno.tech> a
> écrit :
> > Hi Paul,
> > 
> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> > >  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard
> > > <maxime@cerno.tech> a
> > >  écrit :
> > >  > The Ingenic CGU clocks implements a mux with a set_parent hook,
> > > but
> > >  > doesn't provide a determine_rate implementation.
> > >  >
> > >  > This is a bit odd, since set_parent() is there to, as its name
> > > implies,
> > >  > change the parent of a clock. However, the most likely candidate
> > > to
> > >  > trigger that parent change is a call to clk_set_rate(), with
> > >  > determine_rate() figuring out which parent is the best suited for
> > > a
> > >  > given rate.
> > >  >
> > >  > The other trigger would be a call to clk_set_parent(), but it's
> > > far less
> > >  > used, and it doesn't look like there's any obvious user for that
> > > clock.
> > >  >
> > >  > So, the set_parent hook is effectively unused, possibly because
> > > of an
> > >  > oversight. However, it could also be an explicit decision by the
> > >  > original author to avoid any reparenting but through an explicit
> > > call to
> > >  > clk_set_parent().
> > >  >
> > >  > The driver does implement round_rate() though, which means that
> > > we can
> > >  > change the rate of the clock, but we will never get to change the
> > >  > parent.
> > >  >
> > >  > However, It's hard to tell whether it's been done on purpose or
> > > not.
> > >  >
> > >  > Since we'll start mandating a determine_rate() implementation,
> > > let's
> > >  > convert the round_rate() implementation to a determine_rate(),
> > > which
> > >  > will also make the current behavior explicit. And if it was an
> > >  > oversight, the clock behaviour can be adjusted later on.
> > > 
> > >  So it's partly on purpose, partly because I didn't know about
> > >  .determine_rate.
> > > 
> > >  There's nothing odd about having a lonely .set_parent callback; in
> > > my case
> > >  the clocks are parented from the device tree.
> > > 
> > >  Having the clocks driver trigger a parent change when requesting a
> > > rate
> > >  change sounds very dangerous, IMHO. My MMC controller can be
> > > parented to the
> > >  external 48 MHz oscillator, and if the card requests 50 MHz, it
> > > could switch
> > >  to one of the PLLs. That works as long as the PLLs don't change
> > > rate, but if
> > >  one is configured as driving the CPU clock, it becomes messy.
> > >  The thing is, the clocks driver has no way to know whether or not
> > > it is
> > >  "safe" to use a designated parent.
> > > 
> > >  For that reason, in practice, I never actually want to have a clock
> > >  re-parented - it's almost always a bad idea vs. sticking to the
> > > parent clock
> > >  configured in the DTS.
> > 
> > Yeah, and this is totally fine. But we need to be explicit about it. The
> > determine_rate implementation I did in all the patches is an exact
> > equivalent to the round_rate one if there was one. We will never ask to
> > change the parent.
> > 
> > Given what you just said, I would suggest to set the
> > CLK_SET_RATE_NO_REPARENT flag as well.
> 
> But that would introduce policy into the driver...

I'm not sure why you're bringing policies into that discussion. There's
plenty of policy in the driver already, and the current code doesn't do
something that the old wasn't doing (implicitly).

And there's plenty of policies in drivers in general. Whether you limit
the rate or not, whether you allow reparenting or not, even the
CLK_SET_RATE_NO_REPARENT flag mentioned above is a policy decision set
by drivers.

> The fact that I don't want the MMC parented to the PLLs, doesn't mean
> that it's an invalid configuration per se.

Sure, and that's another policy :)

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 10:53           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 10:53 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Paul,

On Sat, Nov 05, 2022 at 10:33:54AM +0000, Paul Cercueil wrote:
> Hi Maxime,
> 
> Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard <maxime@cerno.tech> a
> écrit :
> > Hi Paul,
> > 
> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> > >  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard
> > > <maxime@cerno.tech> a
> > >  écrit :
> > >  > The Ingenic CGU clocks implements a mux with a set_parent hook,
> > > but
> > >  > doesn't provide a determine_rate implementation.
> > >  >
> > >  > This is a bit odd, since set_parent() is there to, as its name
> > > implies,
> > >  > change the parent of a clock. However, the most likely candidate
> > > to
> > >  > trigger that parent change is a call to clk_set_rate(), with
> > >  > determine_rate() figuring out which parent is the best suited for
> > > a
> > >  > given rate.
> > >  >
> > >  > The other trigger would be a call to clk_set_parent(), but it's
> > > far less
> > >  > used, and it doesn't look like there's any obvious user for that
> > > clock.
> > >  >
> > >  > So, the set_parent hook is effectively unused, possibly because
> > > of an
> > >  > oversight. However, it could also be an explicit decision by the
> > >  > original author to avoid any reparenting but through an explicit
> > > call to
> > >  > clk_set_parent().
> > >  >
> > >  > The driver does implement round_rate() though, which means that
> > > we can
> > >  > change the rate of the clock, but we will never get to change the
> > >  > parent.
> > >  >
> > >  > However, It's hard to tell whether it's been done on purpose or
> > > not.
> > >  >
> > >  > Since we'll start mandating a determine_rate() implementation,
> > > let's
> > >  > convert the round_rate() implementation to a determine_rate(),
> > > which
> > >  > will also make the current behavior explicit. And if it was an
> > >  > oversight, the clock behaviour can be adjusted later on.
> > > 
> > >  So it's partly on purpose, partly because I didn't know about
> > >  .determine_rate.
> > > 
> > >  There's nothing odd about having a lonely .set_parent callback; in
> > > my case
> > >  the clocks are parented from the device tree.
> > > 
> > >  Having the clocks driver trigger a parent change when requesting a
> > > rate
> > >  change sounds very dangerous, IMHO. My MMC controller can be
> > > parented to the
> > >  external 48 MHz oscillator, and if the card requests 50 MHz, it
> > > could switch
> > >  to one of the PLLs. That works as long as the PLLs don't change
> > > rate, but if
> > >  one is configured as driving the CPU clock, it becomes messy.
> > >  The thing is, the clocks driver has no way to know whether or not
> > > it is
> > >  "safe" to use a designated parent.
> > > 
> > >  For that reason, in practice, I never actually want to have a clock
> > >  re-parented - it's almost always a bad idea vs. sticking to the
> > > parent clock
> > >  configured in the DTS.
> > 
> > Yeah, and this is totally fine. But we need to be explicit about it. The
> > determine_rate implementation I did in all the patches is an exact
> > equivalent to the round_rate one if there was one. We will never ask to
> > change the parent.
> > 
> > Given what you just said, I would suggest to set the
> > CLK_SET_RATE_NO_REPARENT flag as well.
> 
> But that would introduce policy into the driver...

I'm not sure why you're bringing policies into that discussion. There's
plenty of policy in the driver already, and the current code doesn't do
something that the old wasn't doing (implicitly).

And there's plenty of policies in drivers in general. Whether you limit
the rate or not, whether you allow reparenting or not, even the
CLK_SET_RATE_NO_REPARENT flag mentioned above is a policy decision set
by drivers.

> The fact that I don't want the MMC parented to the PLLs, doesn't mean
> that it's an invalid configuration per se.

Sure, and that's another policy :)

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 10:53           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 10:53 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Paul,

On Sat, Nov 05, 2022 at 10:33:54AM +0000, Paul Cercueil wrote:
> Hi Maxime,
> 
> Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard <maxime@cerno.tech> a
> écrit :
> > Hi Paul,
> > 
> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> > >  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard
> > > <maxime@cerno.tech> a
> > >  écrit :
> > >  > The Ingenic CGU clocks implements a mux with a set_parent hook,
> > > but
> > >  > doesn't provide a determine_rate implementation.
> > >  >
> > >  > This is a bit odd, since set_parent() is there to, as its name
> > > implies,
> > >  > change the parent of a clock. However, the most likely candidate
> > > to
> > >  > trigger that parent change is a call to clk_set_rate(), with
> > >  > determine_rate() figuring out which parent is the best suited for
> > > a
> > >  > given rate.
> > >  >
> > >  > The other trigger would be a call to clk_set_parent(), but it's
> > > far less
> > >  > used, and it doesn't look like there's any obvious user for that
> > > clock.
> > >  >
> > >  > So, the set_parent hook is effectively unused, possibly because
> > > of an
> > >  > oversight. However, it could also be an explicit decision by the
> > >  > original author to avoid any reparenting but through an explicit
> > > call to
> > >  > clk_set_parent().
> > >  >
> > >  > The driver does implement round_rate() though, which means that
> > > we can
> > >  > change the rate of the clock, but we will never get to change the
> > >  > parent.
> > >  >
> > >  > However, It's hard to tell whether it's been done on purpose or
> > > not.
> > >  >
> > >  > Since we'll start mandating a determine_rate() implementation,
> > > let's
> > >  > convert the round_rate() implementation to a determine_rate(),
> > > which
> > >  > will also make the current behavior explicit. And if it was an
> > >  > oversight, the clock behaviour can be adjusted later on.
> > > 
> > >  So it's partly on purpose, partly because I didn't know about
> > >  .determine_rate.
> > > 
> > >  There's nothing odd about having a lonely .set_parent callback; in
> > > my case
> > >  the clocks are parented from the device tree.
> > > 
> > >  Having the clocks driver trigger a parent change when requesting a
> > > rate
> > >  change sounds very dangerous, IMHO. My MMC controller can be
> > > parented to the
> > >  external 48 MHz oscillator, and if the card requests 50 MHz, it
> > > could switch
> > >  to one of the PLLs. That works as long as the PLLs don't change
> > > rate, but if
> > >  one is configured as driving the CPU clock, it becomes messy.
> > >  The thing is, the clocks driver has no way to know whether or not
> > > it is
> > >  "safe" to use a designated parent.
> > > 
> > >  For that reason, in practice, I never actually want to have a clock
> > >  re-parented - it's almost always a bad idea vs. sticking to the
> > > parent clock
> > >  configured in the DTS.
> > 
> > Yeah, and this is totally fine. But we need to be explicit about it. The
> > determine_rate implementation I did in all the patches is an exact
> > equivalent to the round_rate one if there was one. We will never ask to
> > change the parent.
> > 
> > Given what you just said, I would suggest to set the
> > CLK_SET_RATE_NO_REPARENT flag as well.
> 
> But that would introduce policy into the driver...

I'm not sure why you're bringing policies into that discussion. There's
plenty of policy in the driver already, and the current code doesn't do
something that the old wasn't doing (implicitly).

And there's plenty of policies in drivers in general. Whether you limit
the rate or not, whether you allow reparenting or not, even the
CLK_SET_RATE_NO_REPARENT flag mentioned above is a policy decision set
by drivers.

> The fact that I don't want the MMC parented to the PLLs, doesn't mean
> that it's an invalid configuration per se.

Sure, and that's another policy :)

Maxime

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 10:53           ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 10:53 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Max Filippov, Thierry Reding, linux-phy, David Airlie,
	Fabio Estevam, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	Linus Walleij, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Paul,

On Sat, Nov 05, 2022 at 10:33:54AM +0000, Paul Cercueil wrote:
> Hi Maxime,
> 
> Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard <maxime@cerno.tech> a
> écrit :
> > Hi Paul,
> > 
> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> > >  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard
> > > <maxime@cerno.tech> a
> > >  écrit :
> > >  > The Ingenic CGU clocks implements a mux with a set_parent hook,
> > > but
> > >  > doesn't provide a determine_rate implementation.
> > >  >
> > >  > This is a bit odd, since set_parent() is there to, as its name
> > > implies,
> > >  > change the parent of a clock. However, the most likely candidate
> > > to
> > >  > trigger that parent change is a call to clk_set_rate(), with
> > >  > determine_rate() figuring out which parent is the best suited for
> > > a
> > >  > given rate.
> > >  >
> > >  > The other trigger would be a call to clk_set_parent(), but it's
> > > far less
> > >  > used, and it doesn't look like there's any obvious user for that
> > > clock.
> > >  >
> > >  > So, the set_parent hook is effectively unused, possibly because
> > > of an
> > >  > oversight. However, it could also be an explicit decision by the
> > >  > original author to avoid any reparenting but through an explicit
> > > call to
> > >  > clk_set_parent().
> > >  >
> > >  > The driver does implement round_rate() though, which means that
> > > we can
> > >  > change the rate of the clock, but we will never get to change the
> > >  > parent.
> > >  >
> > >  > However, It's hard to tell whether it's been done on purpose or
> > > not.
> > >  >
> > >  > Since we'll start mandating a determine_rate() implementation,
> > > let's
> > >  > convert the round_rate() implementation to a determine_rate(),
> > > which
> > >  > will also make the current behavior explicit. And if it was an
> > >  > oversight, the clock behaviour can be adjusted later on.
> > > 
> > >  So it's partly on purpose, partly because I didn't know about
> > >  .determine_rate.
> > > 
> > >  There's nothing odd about having a lonely .set_parent callback; in
> > > my case
> > >  the clocks are parented from the device tree.
> > > 
> > >  Having the clocks driver trigger a parent change when requesting a
> > > rate
> > >  change sounds very dangerous, IMHO. My MMC controller can be
> > > parented to the
> > >  external 48 MHz oscillator, and if the card requests 50 MHz, it
> > > could switch
> > >  to one of the PLLs. That works as long as the PLLs don't change
> > > rate, but if
> > >  one is configured as driving the CPU clock, it becomes messy.
> > >  The thing is, the clocks driver has no way to know whether or not
> > > it is
> > >  "safe" to use a designated parent.
> > > 
> > >  For that reason, in practice, I never actually want to have a clock
> > >  re-parented - it's almost always a bad idea vs. sticking to the
> > > parent clock
> > >  configured in the DTS.
> > 
> > Yeah, and this is totally fine. But we need to be explicit about it. The
> > determine_rate implementation I did in all the patches is an exact
> > equivalent to the round_rate one if there was one. We will never ask to
> > change the parent.
> > 
> > Given what you just said, I would suggest to set the
> > CLK_SET_RATE_NO_REPARENT flag as well.
> 
> But that would introduce policy into the driver...

I'm not sure why you're bringing policies into that discussion. There's
plenty of policy in the driver already, and the current code doesn't do
something that the old wasn't doing (implicitly).

And there's plenty of policies in drivers in general. Whether you limit
the rate or not, whether you allow reparenting or not, even the
CLK_SET_RATE_NO_REPARENT flag mentioned above is a policy decision set
by drivers.

> The fact that I don't want the MMC parented to the PLLs, doesn't mean
> that it's an invalid configuration per se.

Sure, and that's another policy :)

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-07 20:57             ` Aidan MacDonald
  (?)
  (?)
@ 2022-11-09 11:00               ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 11:00 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Paul Cercueil, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> 
> Maxime Ripard <maxime@cerno.tech> writes:
> 
> > Hi,
> >
> > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> >>
> >> Maxime Ripard <maxime@cerno.tech> writes:
> >>
> >> > Hi Paul,
> >> >
> >> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> >> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> >> >> écrit :
> >> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> >> >> > doesn't provide a determine_rate implementation.
> >> >> >
> >> >> > This is a bit odd, since set_parent() is there to, as its name implies,
> >> >> > change the parent of a clock. However, the most likely candidate to
> >> >> > trigger that parent change is a call to clk_set_rate(), with
> >> >> > determine_rate() figuring out which parent is the best suited for a
> >> >> > given rate.
> >> >> >
> >> >> > The other trigger would be a call to clk_set_parent(), but it's far less
> >> >> > used, and it doesn't look like there's any obvious user for that clock.
> >> >> >
> >> >> > So, the set_parent hook is effectively unused, possibly because of an
> >> >> > oversight. However, it could also be an explicit decision by the
> >> >> > original author to avoid any reparenting but through an explicit call to
> >> >> > clk_set_parent().
> >> >> >
> >> >> > The driver does implement round_rate() though, which means that we can
> >> >> > change the rate of the clock, but we will never get to change the
> >> >> > parent.
> >> >> >
> >> >> > However, It's hard to tell whether it's been done on purpose or not.
> >> >> >
> >> >> > Since we'll start mandating a determine_rate() implementation, let's
> >> >> > convert the round_rate() implementation to a determine_rate(), which
> >> >> > will also make the current behavior explicit. And if it was an
> >> >> > oversight, the clock behaviour can be adjusted later on.
> >> >>
> >> >> So it's partly on purpose, partly because I didn't know about
> >> >> .determine_rate.
> >> >>
> >> >> There's nothing odd about having a lonely .set_parent callback; in my case
> >> >> the clocks are parented from the device tree.
> >> >>
> >> >> Having the clocks driver trigger a parent change when requesting a rate
> >> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> >> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> >> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> >> >> one is configured as driving the CPU clock, it becomes messy.
> >> >> The thing is, the clocks driver has no way to know whether or not it is
> >> >> "safe" to use a designated parent.
> >> >>
> >> >> For that reason, in practice, I never actually want to have a clock
> >> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> >> >> configured in the DTS.
> >> >
> >> > Yeah, and this is totally fine. But we need to be explicit about it. The
> >> > determine_rate implementation I did in all the patches is an exact
> >> > equivalent to the round_rate one if there was one. We will never ask to
> >> > change the parent.
> >> >
> >> > Given what you just said, I would suggest to set the
> >> > CLK_SET_RATE_NO_REPARENT flag as well.
> >>
> >> Ideally there should be a way for drivers and the device tree to
> >> say, "clock X must be driven by clock Y", but the clock framework
> >> would be allowed to re-parent clocks freely as long as it doesn't
> >> violate any DT or driver constraints.
> >
> > I'm not really sure what you mean there, sorry. Isn't it what
> > assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
> > implementation that would affect best_parent_hw would already provide?
> 
> Assigning the parent clock in the DT works once, at boot, but going off
> what you wrote in the commit message, if the clock driver has a
> .determine_rate() implementation that *can* reparent clocks then it
> probably *will* reparent them, and the DT assignment will be lost.

Yes, indeed, but assigned-clock-parents never provided any sort of
guarantee on whether or not the clock was allowed to reparent or not.
It's just a one-off thing, right before probe, and a clk_set_parent()
call at probe will override that just fine.

Just like assigned-clock-rates isn't permanent.

> What I'm suggesting is a runtime constraint that the clock subsystem
> would enforce, and actively prevent drivers from changing the parent.
> Either explicitly with clk_set_parent() or due to .determine_rate().
> 
> That way you could write a .determine_rate() implementation that *can*
> select a better parent, but if the DT applies a constraint to fix the
> clock to a particular parent, the clock subsystem will force that parent
> to be used so you can be sure the clock is never reparented by accident.

Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
too far off from this, it's just ignored by clk_set_parent() for now. I
guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
clk_set_parent handle it, and set that flag whenever
assigned-clock-parents is set on a clock.

It's out of scope for this series though, and I certainly don't want to
deal with all the regressions it might create :)

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 11:00               ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 11:00 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> 
> Maxime Ripard <maxime@cerno.tech> writes:
> 
> > Hi,
> >
> > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> >>
> >> Maxime Ripard <maxime@cerno.tech> writes:
> >>
> >> > Hi Paul,
> >> >
> >> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> >> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> >> >> écrit :
> >> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> >> >> > doesn't provide a determine_rate implementation.
> >> >> >
> >> >> > This is a bit odd, since set_parent() is there to, as its name implies,
> >> >> > change the parent of a clock. However, the most likely candidate to
> >> >> > trigger that parent change is a call to clk_set_rate(), with
> >> >> > determine_rate() figuring out which parent is the best suited for a
> >> >> > given rate.
> >> >> >
> >> >> > The other trigger would be a call to clk_set_parent(), but it's far less
> >> >> > used, and it doesn't look like there's any obvious user for that clock.
> >> >> >
> >> >> > So, the set_parent hook is effectively unused, possibly because of an
> >> >> > oversight. However, it could also be an explicit decision by the
> >> >> > original author to avoid any reparenting but through an explicit call to
> >> >> > clk_set_parent().
> >> >> >
> >> >> > The driver does implement round_rate() though, which means that we can
> >> >> > change the rate of the clock, but we will never get to change the
> >> >> > parent.
> >> >> >
> >> >> > However, It's hard to tell whether it's been done on purpose or not.
> >> >> >
> >> >> > Since we'll start mandating a determine_rate() implementation, let's
> >> >> > convert the round_rate() implementation to a determine_rate(), which
> >> >> > will also make the current behavior explicit. And if it was an
> >> >> > oversight, the clock behaviour can be adjusted later on.
> >> >>
> >> >> So it's partly on purpose, partly because I didn't know about
> >> >> .determine_rate.
> >> >>
> >> >> There's nothing odd about having a lonely .set_parent callback; in my case
> >> >> the clocks are parented from the device tree.
> >> >>
> >> >> Having the clocks driver trigger a parent change when requesting a rate
> >> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> >> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> >> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> >> >> one is configured as driving the CPU clock, it becomes messy.
> >> >> The thing is, the clocks driver has no way to know whether or not it is
> >> >> "safe" to use a designated parent.
> >> >>
> >> >> For that reason, in practice, I never actually want to have a clock
> >> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> >> >> configured in the DTS.
> >> >
> >> > Yeah, and this is totally fine. But we need to be explicit about it. The
> >> > determine_rate implementation I did in all the patches is an exact
> >> > equivalent to the round_rate one if there was one. We will never ask to
> >> > change the parent.
> >> >
> >> > Given what you just said, I would suggest to set the
> >> > CLK_SET_RATE_NO_REPARENT flag as well.
> >>
> >> Ideally there should be a way for drivers and the device tree to
> >> say, "clock X must be driven by clock Y", but the clock framework
> >> would be allowed to re-parent clocks freely as long as it doesn't
> >> violate any DT or driver constraints.
> >
> > I'm not really sure what you mean there, sorry. Isn't it what
> > assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
> > implementation that would affect best_parent_hw would already provide?
> 
> Assigning the parent clock in the DT works once, at boot, but going off
> what you wrote in the commit message, if the clock driver has a
> .determine_rate() implementation that *can* reparent clocks then it
> probably *will* reparent them, and the DT assignment will be lost.

Yes, indeed, but assigned-clock-parents never provided any sort of
guarantee on whether or not the clock was allowed to reparent or not.
It's just a one-off thing, right before probe, and a clk_set_parent()
call at probe will override that just fine.

Just like assigned-clock-rates isn't permanent.

> What I'm suggesting is a runtime constraint that the clock subsystem
> would enforce, and actively prevent drivers from changing the parent.
> Either explicitly with clk_set_parent() or due to .determine_rate().
> 
> That way you could write a .determine_rate() implementation that *can*
> select a better parent, but if the DT applies a constraint to fix the
> clock to a particular parent, the clock subsystem will force that parent
> to be used so you can be sure the clock is never reparented by accident.

Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
too far off from this, it's just ignored by clk_set_parent() for now. I
guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
clk_set_parent handle it, and set that flag whenever
assigned-clock-parents is set on a clock.

It's out of scope for this series though, and I certainly don't want to
deal with all the regressions it might create :)

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 11:00               ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 11:00 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Paul Cercueil, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> 
> Maxime Ripard <maxime@cerno.tech> writes:
> 
> > Hi,
> >
> > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> >>
> >> Maxime Ripard <maxime@cerno.tech> writes:
> >>
> >> > Hi Paul,
> >> >
> >> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> >> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> >> >> écrit :
> >> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> >> >> > doesn't provide a determine_rate implementation.
> >> >> >
> >> >> > This is a bit odd, since set_parent() is there to, as its name implies,
> >> >> > change the parent of a clock. However, the most likely candidate to
> >> >> > trigger that parent change is a call to clk_set_rate(), with
> >> >> > determine_rate() figuring out which parent is the best suited for a
> >> >> > given rate.
> >> >> >
> >> >> > The other trigger would be a call to clk_set_parent(), but it's far less
> >> >> > used, and it doesn't look like there's any obvious user for that clock.
> >> >> >
> >> >> > So, the set_parent hook is effectively unused, possibly because of an
> >> >> > oversight. However, it could also be an explicit decision by the
> >> >> > original author to avoid any reparenting but through an explicit call to
> >> >> > clk_set_parent().
> >> >> >
> >> >> > The driver does implement round_rate() though, which means that we can
> >> >> > change the rate of the clock, but we will never get to change the
> >> >> > parent.
> >> >> >
> >> >> > However, It's hard to tell whether it's been done on purpose or not.
> >> >> >
> >> >> > Since we'll start mandating a determine_rate() implementation, let's
> >> >> > convert the round_rate() implementation to a determine_rate(), which
> >> >> > will also make the current behavior explicit. And if it was an
> >> >> > oversight, the clock behaviour can be adjusted later on.
> >> >>
> >> >> So it's partly on purpose, partly because I didn't know about
> >> >> .determine_rate.
> >> >>
> >> >> There's nothing odd about having a lonely .set_parent callback; in my case
> >> >> the clocks are parented from the device tree.
> >> >>
> >> >> Having the clocks driver trigger a parent change when requesting a rate
> >> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> >> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> >> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> >> >> one is configured as driving the CPU clock, it becomes messy.
> >> >> The thing is, the clocks driver has no way to know whether or not it is
> >> >> "safe" to use a designated parent.
> >> >>
> >> >> For that reason, in practice, I never actually want to have a clock
> >> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> >> >> configured in the DTS.
> >> >
> >> > Yeah, and this is totally fine. But we need to be explicit about it. The
> >> > determine_rate implementation I did in all the patches is an exact
> >> > equivalent to the round_rate one if there was one. We will never ask to
> >> > change the parent.
> >> >
> >> > Given what you just said, I would suggest to set the
> >> > CLK_SET_RATE_NO_REPARENT flag as well.
> >>
> >> Ideally there should be a way for drivers and the device tree to
> >> say, "clock X must be driven by clock Y", but the clock framework
> >> would be allowed to re-parent clocks freely as long as it doesn't
> >> violate any DT or driver constraints.
> >
> > I'm not really sure what you mean there, sorry. Isn't it what
> > assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
> > implementation that would affect best_parent_hw would already provide?
> 
> Assigning the parent clock in the DT works once, at boot, but going off
> what you wrote in the commit message, if the clock driver has a
> .determine_rate() implementation that *can* reparent clocks then it
> probably *will* reparent them, and the DT assignment will be lost.

Yes, indeed, but assigned-clock-parents never provided any sort of
guarantee on whether or not the clock was allowed to reparent or not.
It's just a one-off thing, right before probe, and a clk_set_parent()
call at probe will override that just fine.

Just like assigned-clock-rates isn't permanent.

> What I'm suggesting is a runtime constraint that the clock subsystem
> would enforce, and actively prevent drivers from changing the parent.
> Either explicitly with clk_set_parent() or due to .determine_rate().
> 
> That way you could write a .determine_rate() implementation that *can*
> select a better parent, but if the DT applies a constraint to fix the
> clock to a particular parent, the clock subsystem will force that parent
> to be used so you can be sure the clock is never reparented by accident.

Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
too far off from this, it's just ignored by clk_set_parent() for now. I
guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
clk_set_parent handle it, and set that flag whenever
assigned-clock-parents is set on a clock.

It's out of scope for this series though, and I certainly don't want to
deal with all the regressions it might create :)

Maxime

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 11:00               ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 11:00 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> 
> Maxime Ripard <maxime@cerno.tech> writes:
> 
> > Hi,
> >
> > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> >>
> >> Maxime Ripard <maxime@cerno.tech> writes:
> >>
> >> > Hi Paul,
> >> >
> >> > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
> >> >> Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard <maxime@cerno.tech> a
> >> >> écrit :
> >> >> > The Ingenic CGU clocks implements a mux with a set_parent hook, but
> >> >> > doesn't provide a determine_rate implementation.
> >> >> >
> >> >> > This is a bit odd, since set_parent() is there to, as its name implies,
> >> >> > change the parent of a clock. However, the most likely candidate to
> >> >> > trigger that parent change is a call to clk_set_rate(), with
> >> >> > determine_rate() figuring out which parent is the best suited for a
> >> >> > given rate.
> >> >> >
> >> >> > The other trigger would be a call to clk_set_parent(), but it's far less
> >> >> > used, and it doesn't look like there's any obvious user for that clock.
> >> >> >
> >> >> > So, the set_parent hook is effectively unused, possibly because of an
> >> >> > oversight. However, it could also be an explicit decision by the
> >> >> > original author to avoid any reparenting but through an explicit call to
> >> >> > clk_set_parent().
> >> >> >
> >> >> > The driver does implement round_rate() though, which means that we can
> >> >> > change the rate of the clock, but we will never get to change the
> >> >> > parent.
> >> >> >
> >> >> > However, It's hard to tell whether it's been done on purpose or not.
> >> >> >
> >> >> > Since we'll start mandating a determine_rate() implementation, let's
> >> >> > convert the round_rate() implementation to a determine_rate(), which
> >> >> > will also make the current behavior explicit. And if it was an
> >> >> > oversight, the clock behaviour can be adjusted later on.
> >> >>
> >> >> So it's partly on purpose, partly because I didn't know about
> >> >> .determine_rate.
> >> >>
> >> >> There's nothing odd about having a lonely .set_parent callback; in my case
> >> >> the clocks are parented from the device tree.
> >> >>
> >> >> Having the clocks driver trigger a parent change when requesting a rate
> >> >> change sounds very dangerous, IMHO. My MMC controller can be parented to the
> >> >> external 48 MHz oscillator, and if the card requests 50 MHz, it could switch
> >> >> to one of the PLLs. That works as long as the PLLs don't change rate, but if
> >> >> one is configured as driving the CPU clock, it becomes messy.
> >> >> The thing is, the clocks driver has no way to know whether or not it is
> >> >> "safe" to use a designated parent.
> >> >>
> >> >> For that reason, in practice, I never actually want to have a clock
> >> >> re-parented - it's almost always a bad idea vs. sticking to the parent clock
> >> >> configured in the DTS.
> >> >
> >> > Yeah, and this is totally fine. But we need to be explicit about it. The
> >> > determine_rate implementation I did in all the patches is an exact
> >> > equivalent to the round_rate one if there was one. We will never ask to
> >> > change the parent.
> >> >
> >> > Given what you just said, I would suggest to set the
> >> > CLK_SET_RATE_NO_REPARENT flag as well.
> >>
> >> Ideally there should be a way for drivers and the device tree to
> >> say, "clock X must be driven by clock Y", but the clock framework
> >> would be allowed to re-parent clocks freely as long as it doesn't
> >> violate any DT or driver constraints.
> >
> > I'm not really sure what you mean there, sorry. Isn't it what
> > assigned-clock-parents/clk_set_parent() at probe, plus a determine_rate
> > implementation that would affect best_parent_hw would already provide?
> 
> Assigning the parent clock in the DT works once, at boot, but going off
> what you wrote in the commit message, if the clock driver has a
> .determine_rate() implementation that *can* reparent clocks then it
> probably *will* reparent them, and the DT assignment will be lost.

Yes, indeed, but assigned-clock-parents never provided any sort of
guarantee on whether or not the clock was allowed to reparent or not.
It's just a one-off thing, right before probe, and a clk_set_parent()
call at probe will override that just fine.

Just like assigned-clock-rates isn't permanent.

> What I'm suggesting is a runtime constraint that the clock subsystem
> would enforce, and actively prevent drivers from changing the parent.
> Either explicitly with clk_set_parent() or due to .determine_rate().
> 
> That way you could write a .determine_rate() implementation that *can*
> select a better parent, but if the DT applies a constraint to fix the
> clock to a particular parent, the clock subsystem will force that parent
> to be used so you can be sure the clock is never reparented by accident.

Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
too far off from this, it's just ignored by clk_set_parent() for now. I
guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
clk_set_parent handle it, and set that flag whenever
assigned-clock-parents is set on a clock.

It's out of scope for this series though, and I certainly don't want to
deal with all the regressions it might create :)

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
  2022-11-08 13:25     ` Linus Walleij
  (?)
  (?)
@ 2022-11-09 11:05       ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 11:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

Hi Linus,

On Tue, Nov 08, 2022 at 02:25:04PM +0100, Linus Walleij wrote:
> On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:
> 
> > The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
> > but doesn't provide a determine_rate implementation.
> >
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> >
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> >
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> It is actually set up from the device tree, typically like this:
> 
> /* clkout1 from ACLK divided by 8 */
> clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;
> 
> So the parent (source) and divisor comes in there.
> 
> clk->source and clk->divider is already set up when clk_hw_register() is
> called.

I wasn't aware that we had such bindings. AFAIUI, it looks redundant
with assigned-clock-rates and assigned-clock-parents, could we deprecate
it?

> So set/get_parent() is never used on clkout.
> 
> I think I just added the callbacks for completeness, should we delete them
> altogether?

I can't really test any of these platforms, so I'm a bit wary of making
such changes myself. Feel free to send a follow-up if you think it's
needed :)

> The patch is probably fine as-is as well so
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Thanks!
Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
@ 2022-11-09 11:05       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 11:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	linux-sunxi, linux-rtc, linux-clk, Charles Keepax, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-actions,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

Hi Linus,

On Tue, Nov 08, 2022 at 02:25:04PM +0100, Linus Walleij wrote:
> On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:
> 
> > The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
> > but doesn't provide a determine_rate implementation.
> >
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> >
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> >
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> It is actually set up from the device tree, typically like this:
> 
> /* clkout1 from ACLK divided by 8 */
> clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;
> 
> So the parent (source) and divisor comes in there.
> 
> clk->source and clk->divider is already set up when clk_hw_register() is
> called.

I wasn't aware that we had such bindings. AFAIUI, it looks redundant
with assigned-clock-rates and assigned-clock-parents, could we deprecate
it?

> So set/get_parent() is never used on clkout.
> 
> I think I just added the callbacks for completeness, should we delete them
> altogether?

I can't really test any of these platforms, so I'm a bit wary of making
such changes myself. Feel free to send a follow-up if you think it's
needed :)

> The patch is probably fine as-is as well so
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Thanks!
Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
@ 2022-11-09 11:05       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 11:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

Hi Linus,

On Tue, Nov 08, 2022 at 02:25:04PM +0100, Linus Walleij wrote:
> On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:
> 
> > The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
> > but doesn't provide a determine_rate implementation.
> >
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> >
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> >
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> It is actually set up from the device tree, typically like this:
> 
> /* clkout1 from ACLK divided by 8 */
> clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;
> 
> So the parent (source) and divisor comes in there.
> 
> clk->source and clk->divider is already set up when clk_hw_register() is
> called.

I wasn't aware that we had such bindings. AFAIUI, it looks redundant
with assigned-clock-rates and assigned-clock-parents, could we deprecate
it?

> So set/get_parent() is never used on clkout.
> 
> I think I just added the callbacks for completeness, should we delete them
> altogether?

I can't really test any of these platforms, so I'm a bit wary of making
such changes myself. Feel free to send a follow-up if you think it's
needed :)

> The patch is probably fine as-is as well so
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Thanks!
Maxime

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 34/65] clk: ux500: prcmu: Add a determine_rate hook
@ 2022-11-09 11:05       ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2022-11-09 11:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

Hi Linus,

On Tue, Nov 08, 2022 at 02:25:04PM +0100, Linus Walleij wrote:
> On Fri, Nov 4, 2022 at 2:32 PM Maxime Ripard <maxime@cerno.tech> wrote:
> 
> > The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
> > but doesn't provide a determine_rate implementation.
> >
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> >
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
> >
> > So, the set_parent hook is effectively unused, possibly because of an
> > oversight. However, it could also be an explicit decision by the
> > original author to avoid any reparenting but through an explicit call to
> > clk_set_parent().
> 
> It is actually set up from the device tree, typically like this:
> 
> /* clkout1 from ACLK divided by 8 */
> clocks = <&clkout_clk DB8500_CLKOUT_1 DB8500_CLKOUT_SRC_ACLK 8>;
> 
> So the parent (source) and divisor comes in there.
> 
> clk->source and clk->divider is already set up when clk_hw_register() is
> called.

I wasn't aware that we had such bindings. AFAIUI, it looks redundant
with assigned-clock-rates and assigned-clock-parents, could we deprecate
it?

> So set/get_parent() is never used on clkout.
> 
> I think I just added the callbacks for completeness, should we delete them
> altogether?

I can't really test any of these platforms, so I'm a bit wary of making
such changes myself. Feel free to send a follow-up if you think it's
needed :)

> The patch is probably fine as-is as well so
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Thanks!
Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-09 10:53           ` Maxime Ripard
  (?)
  (?)
@ 2022-11-09 11:36             ` Paul Cercueil
  -1 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-09 11:36 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

Le mer. 9 nov. 2022 à 11:53:01 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> Hi Paul,
> 
> On Sat, Nov 05, 2022 at 10:33:54AM +0000, Paul Cercueil wrote:
>>  Hi Maxime,
>> 
>>  Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard 
>> <maxime@cerno.tech> a
>>  écrit :
>>  > Hi Paul,
>>  >
>>  > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>>  > >  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard
>>  > > <maxime@cerno.tech> a
>>  > >  écrit :
>>  > >  > The Ingenic CGU clocks implements a mux with a set_parent 
>> hook,
>>  > > but
>>  > >  > doesn't provide a determine_rate implementation.
>>  > >  >
>>  > >  > This is a bit odd, since set_parent() is there to, as its 
>> name
>>  > > implies,
>>  > >  > change the parent of a clock. However, the most likely 
>> candidate
>>  > > to
>>  > >  > trigger that parent change is a call to clk_set_rate(), with
>>  > >  > determine_rate() figuring out which parent is the best 
>> suited for
>>  > > a
>>  > >  > given rate.
>>  > >  >
>>  > >  > The other trigger would be a call to clk_set_parent(), but 
>> it's
>>  > > far less
>>  > >  > used, and it doesn't look like there's any obvious user for 
>> that
>>  > > clock.
>>  > >  >
>>  > >  > So, the set_parent hook is effectively unused, possibly 
>> because
>>  > > of an
>>  > >  > oversight. However, it could also be an explicit decision by 
>> the
>>  > >  > original author to avoid any reparenting but through an 
>> explicit
>>  > > call to
>>  > >  > clk_set_parent().
>>  > >  >
>>  > >  > The driver does implement round_rate() though, which means 
>> that
>>  > > we can
>>  > >  > change the rate of the clock, but we will never get to 
>> change the
>>  > >  > parent.
>>  > >  >
>>  > >  > However, It's hard to tell whether it's been done on purpose 
>> or
>>  > > not.
>>  > >  >
>>  > >  > Since we'll start mandating a determine_rate() 
>> implementation,
>>  > > let's
>>  > >  > convert the round_rate() implementation to a 
>> determine_rate(),
>>  > > which
>>  > >  > will also make the current behavior explicit. And if it was 
>> an
>>  > >  > oversight, the clock behaviour can be adjusted later on.
>>  > >
>>  > >  So it's partly on purpose, partly because I didn't know about
>>  > >  .determine_rate.
>>  > >
>>  > >  There's nothing odd about having a lonely .set_parent 
>> callback; in
>>  > > my case
>>  > >  the clocks are parented from the device tree.
>>  > >
>>  > >  Having the clocks driver trigger a parent change when 
>> requesting a
>>  > > rate
>>  > >  change sounds very dangerous, IMHO. My MMC controller can be
>>  > > parented to the
>>  > >  external 48 MHz oscillator, and if the card requests 50 MHz, it
>>  > > could switch
>>  > >  to one of the PLLs. That works as long as the PLLs don't change
>>  > > rate, but if
>>  > >  one is configured as driving the CPU clock, it becomes messy.
>>  > >  The thing is, the clocks driver has no way to know whether or 
>> not
>>  > > it is
>>  > >  "safe" to use a designated parent.
>>  > >
>>  > >  For that reason, in practice, I never actually want to have a 
>> clock
>>  > >  re-parented - it's almost always a bad idea vs. sticking to the
>>  > > parent clock
>>  > >  configured in the DTS.
>>  >
>>  > Yeah, and this is totally fine. But we need to be explicit about 
>> it. The
>>  > determine_rate implementation I did in all the patches is an exact
>>  > equivalent to the round_rate one if there was one. We will never 
>> ask to
>>  > change the parent.
>>  >
>>  > Given what you just said, I would suggest to set the
>>  > CLK_SET_RATE_NO_REPARENT flag as well.
>> 
>>  But that would introduce policy into the driver...
> 
> I'm not sure why you're bringing policies into that discussion. 
> There's
> plenty of policy in the driver already, and the current code doesn't 
> do
> something that the old wasn't doing (implicitly).

Yes, I was just talking about the CLK_SET_RATE_NO_REPARENT flag adding 
policy. The fact that there's plenty of policy in the driver already is 
not an argument for adding some more.

> And there's plenty of policies in drivers in general. Whether you 
> limit
> the rate or not, whether you allow reparenting or not, even the
> CLK_SET_RATE_NO_REPARENT flag mentioned above is a policy decision set
> by drivers.

Allowing reparenting and not limiting the rates is not a policy, it's 
just following what the hardware allows you to do. The absence of 
policy means that the driver allows you to configure the hardware in 
any way you might want to.

Limiting rates, forbidding reparenting, that's policy, and it doesn't 
belong in a driver.

You can argue that choosing not to reparent on rate change is a policy, 
and it is. That's why we need a way to enforce these policies outside 
the driver.

>>  The fact that I don't want the MMC parented to the PLLs, doesn't 
>> mean
>>  that it's an invalid configuration per se.
> 
> Sure, and that's another policy :)

A policy that is not enforced by the driver.

Going back to the patch itself... I am fine with the change, although 
the patch description should probably be updated. We have .set_parent 
callbacks to configure clocks from DT, there's nothing more to it.

Cheers,
-Paul



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 11:36             ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-09 11:36 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

Le mer. 9 nov. 2022 à 11:53:01 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> Hi Paul,
> 
> On Sat, Nov 05, 2022 at 10:33:54AM +0000, Paul Cercueil wrote:
>>  Hi Maxime,
>> 
>>  Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard 
>> <maxime@cerno.tech> a
>>  écrit :
>>  > Hi Paul,
>>  >
>>  > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>>  > >  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard
>>  > > <maxime@cerno.tech> a
>>  > >  écrit :
>>  > >  > The Ingenic CGU clocks implements a mux with a set_parent 
>> hook,
>>  > > but
>>  > >  > doesn't provide a determine_rate implementation.
>>  > >  >
>>  > >  > This is a bit odd, since set_parent() is there to, as its 
>> name
>>  > > implies,
>>  > >  > change the parent of a clock. However, the most likely 
>> candidate
>>  > > to
>>  > >  > trigger that parent change is a call to clk_set_rate(), with
>>  > >  > determine_rate() figuring out which parent is the best 
>> suited for
>>  > > a
>>  > >  > given rate.
>>  > >  >
>>  > >  > The other trigger would be a call to clk_set_parent(), but 
>> it's
>>  > > far less
>>  > >  > used, and it doesn't look like there's any obvious user for 
>> that
>>  > > clock.
>>  > >  >
>>  > >  > So, the set_parent hook is effectively unused, possibly 
>> because
>>  > > of an
>>  > >  > oversight. However, it could also be an explicit decision by 
>> the
>>  > >  > original author to avoid any reparenting but through an 
>> explicit
>>  > > call to
>>  > >  > clk_set_parent().
>>  > >  >
>>  > >  > The driver does implement round_rate() though, which means 
>> that
>>  > > we can
>>  > >  > change the rate of the clock, but we will never get to 
>> change the
>>  > >  > parent.
>>  > >  >
>>  > >  > However, It's hard to tell whether it's been done on purpose 
>> or
>>  > > not.
>>  > >  >
>>  > >  > Since we'll start mandating a determine_rate() 
>> implementation,
>>  > > let's
>>  > >  > convert the round_rate() implementation to a 
>> determine_rate(),
>>  > > which
>>  > >  > will also make the current behavior explicit. And if it was 
>> an
>>  > >  > oversight, the clock behaviour can be adjusted later on.
>>  > >
>>  > >  So it's partly on purpose, partly because I didn't know about
>>  > >  .determine_rate.
>>  > >
>>  > >  There's nothing odd about having a lonely .set_parent 
>> callback; in
>>  > > my case
>>  > >  the clocks are parented from the device tree.
>>  > >
>>  > >  Having the clocks driver trigger a parent change when 
>> requesting a
>>  > > rate
>>  > >  change sounds very dangerous, IMHO. My MMC controller can be
>>  > > parented to the
>>  > >  external 48 MHz oscillator, and if the card requests 50 MHz, it
>>  > > could switch
>>  > >  to one of the PLLs. That works as long as the PLLs don't change
>>  > > rate, but if
>>  > >  one is configured as driving the CPU clock, it becomes messy.
>>  > >  The thing is, the clocks driver has no way to know whether or 
>> not
>>  > > it is
>>  > >  "safe" to use a designated parent.
>>  > >
>>  > >  For that reason, in practice, I never actually want to have a 
>> clock
>>  > >  re-parented - it's almost always a bad idea vs. sticking to the
>>  > > parent clock
>>  > >  configured in the DTS.
>>  >
>>  > Yeah, and this is totally fine. But we need to be explicit about 
>> it. The
>>  > determine_rate implementation I did in all the patches is an exact
>>  > equivalent to the round_rate one if there was one. We will never 
>> ask to
>>  > change the parent.
>>  >
>>  > Given what you just said, I would suggest to set the
>>  > CLK_SET_RATE_NO_REPARENT flag as well.
>> 
>>  But that would introduce policy into the driver...
> 
> I'm not sure why you're bringing policies into that discussion. 
> There's
> plenty of policy in the driver already, and the current code doesn't 
> do
> something that the old wasn't doing (implicitly).

Yes, I was just talking about the CLK_SET_RATE_NO_REPARENT flag adding 
policy. The fact that there's plenty of policy in the driver already is 
not an argument for adding some more.

> And there's plenty of policies in drivers in general. Whether you 
> limit
> the rate or not, whether you allow reparenting or not, even the
> CLK_SET_RATE_NO_REPARENT flag mentioned above is a policy decision set
> by drivers.

Allowing reparenting and not limiting the rates is not a policy, it's 
just following what the hardware allows you to do. The absence of 
policy means that the driver allows you to configure the hardware in 
any way you might want to.

Limiting rates, forbidding reparenting, that's policy, and it doesn't 
belong in a driver.

You can argue that choosing not to reparent on rate change is a policy, 
and it is. That's why we need a way to enforce these policies outside 
the driver.

>>  The fact that I don't want the MMC parented to the PLLs, doesn't 
>> mean
>>  that it's an invalid configuration per se.
> 
> Sure, and that's another policy :)

A policy that is not enforced by the driver.

Going back to the patch itself... I am fine with the change, although 
the patch description should probably be updated. We have .set_parent 
callbacks to configure clocks from DT, there's nothing more to it.

Cheers,
-Paul



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 11:36             ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-09 11:36 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

Le mer. 9 nov. 2022 à 11:53:01 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> Hi Paul,
> 
> On Sat, Nov 05, 2022 at 10:33:54AM +0000, Paul Cercueil wrote:
>>  Hi Maxime,
>> 
>>  Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard 
>> <maxime@cerno.tech> a
>>  écrit :
>>  > Hi Paul,
>>  >
>>  > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>>  > >  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard
>>  > > <maxime@cerno.tech> a
>>  > >  écrit :
>>  > >  > The Ingenic CGU clocks implements a mux with a set_parent 
>> hook,
>>  > > but
>>  > >  > doesn't provide a determine_rate implementation.
>>  > >  >
>>  > >  > This is a bit odd, since set_parent() is there to, as its 
>> name
>>  > > implies,
>>  > >  > change the parent of a clock. However, the most likely 
>> candidate
>>  > > to
>>  > >  > trigger that parent change is a call to clk_set_rate(), with
>>  > >  > determine_rate() figuring out which parent is the best 
>> suited for
>>  > > a
>>  > >  > given rate.
>>  > >  >
>>  > >  > The other trigger would be a call to clk_set_parent(), but 
>> it's
>>  > > far less
>>  > >  > used, and it doesn't look like there's any obvious user for 
>> that
>>  > > clock.
>>  > >  >
>>  > >  > So, the set_parent hook is effectively unused, possibly 
>> because
>>  > > of an
>>  > >  > oversight. However, it could also be an explicit decision by 
>> the
>>  > >  > original author to avoid any reparenting but through an 
>> explicit
>>  > > call to
>>  > >  > clk_set_parent().
>>  > >  >
>>  > >  > The driver does implement round_rate() though, which means 
>> that
>>  > > we can
>>  > >  > change the rate of the clock, but we will never get to 
>> change the
>>  > >  > parent.
>>  > >  >
>>  > >  > However, It's hard to tell whether it's been done on purpose 
>> or
>>  > > not.
>>  > >  >
>>  > >  > Since we'll start mandating a determine_rate() 
>> implementation,
>>  > > let's
>>  > >  > convert the round_rate() implementation to a 
>> determine_rate(),
>>  > > which
>>  > >  > will also make the current behavior explicit. And if it was 
>> an
>>  > >  > oversight, the clock behaviour can be adjusted later on.
>>  > >
>>  > >  So it's partly on purpose, partly because I didn't know about
>>  > >  .determine_rate.
>>  > >
>>  > >  There's nothing odd about having a lonely .set_parent 
>> callback; in
>>  > > my case
>>  > >  the clocks are parented from the device tree.
>>  > >
>>  > >  Having the clocks driver trigger a parent change when 
>> requesting a
>>  > > rate
>>  > >  change sounds very dangerous, IMHO. My MMC controller can be
>>  > > parented to the
>>  > >  external 48 MHz oscillator, and if the card requests 50 MHz, it
>>  > > could switch
>>  > >  to one of the PLLs. That works as long as the PLLs don't change
>>  > > rate, but if
>>  > >  one is configured as driving the CPU clock, it becomes messy.
>>  > >  The thing is, the clocks driver has no way to know whether or 
>> not
>>  > > it is
>>  > >  "safe" to use a designated parent.
>>  > >
>>  > >  For that reason, in practice, I never actually want to have a 
>> clock
>>  > >  re-parented - it's almost always a bad idea vs. sticking to the
>>  > > parent clock
>>  > >  configured in the DTS.
>>  >
>>  > Yeah, and this is totally fine. But we need to be explicit about 
>> it. The
>>  > determine_rate implementation I did in all the patches is an exact
>>  > equivalent to the round_rate one if there was one. We will never 
>> ask to
>>  > change the parent.
>>  >
>>  > Given what you just said, I would suggest to set the
>>  > CLK_SET_RATE_NO_REPARENT flag as well.
>> 
>>  But that would introduce policy into the driver...
> 
> I'm not sure why you're bringing policies into that discussion. 
> There's
> plenty of policy in the driver already, and the current code doesn't 
> do
> something that the old wasn't doing (implicitly).

Yes, I was just talking about the CLK_SET_RATE_NO_REPARENT flag adding 
policy. The fact that there's plenty of policy in the driver already is 
not an argument for adding some more.

> And there's plenty of policies in drivers in general. Whether you 
> limit
> the rate or not, whether you allow reparenting or not, even the
> CLK_SET_RATE_NO_REPARENT flag mentioned above is a policy decision set
> by drivers.

Allowing reparenting and not limiting the rates is not a policy, it's 
just following what the hardware allows you to do. The absence of 
policy means that the driver allows you to configure the hardware in 
any way you might want to.

Limiting rates, forbidding reparenting, that's policy, and it doesn't 
belong in a driver.

You can argue that choosing not to reparent on rate change is a policy, 
and it is. That's why we need a way to enforce these policies outside 
the driver.

>>  The fact that I don't want the MMC parented to the PLLs, doesn't 
>> mean
>>  that it's an invalid configuration per se.
> 
> Sure, and that's another policy :)

A policy that is not enforced by the driver.

Going back to the patch itself... I am fine with the change, although 
the patch description should probably be updated. We have .set_parent 
callbacks to configure clocks from DT, there's nothing more to it.

Cheers,
-Paul



-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2022-11-09 11:36             ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2022-11-09 11:36 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Max Filippov, Thierry Reding, linux-phy, David Airlie,
	Fabio Estevam, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	Linus Walleij, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

Le mer. 9 nov. 2022 à 11:53:01 +0100, Maxime Ripard 
<maxime@cerno.tech> a écrit :
> Hi Paul,
> 
> On Sat, Nov 05, 2022 at 10:33:54AM +0000, Paul Cercueil wrote:
>>  Hi Maxime,
>> 
>>  Le ven. 4 nov. 2022 à 15:59:46 +0100, Maxime Ripard 
>> <maxime@cerno.tech> a
>>  écrit :
>>  > Hi Paul,
>>  >
>>  > On Fri, Nov 04, 2022 at 02:31:20PM +0000, Paul Cercueil wrote:
>>  > >  Le ven. 4 nov. 2022 à 14:18:13 +0100, Maxime Ripard
>>  > > <maxime@cerno.tech> a
>>  > >  écrit :
>>  > >  > The Ingenic CGU clocks implements a mux with a set_parent 
>> hook,
>>  > > but
>>  > >  > doesn't provide a determine_rate implementation.
>>  > >  >
>>  > >  > This is a bit odd, since set_parent() is there to, as its 
>> name
>>  > > implies,
>>  > >  > change the parent of a clock. However, the most likely 
>> candidate
>>  > > to
>>  > >  > trigger that parent change is a call to clk_set_rate(), with
>>  > >  > determine_rate() figuring out which parent is the best 
>> suited for
>>  > > a
>>  > >  > given rate.
>>  > >  >
>>  > >  > The other trigger would be a call to clk_set_parent(), but 
>> it's
>>  > > far less
>>  > >  > used, and it doesn't look like there's any obvious user for 
>> that
>>  > > clock.
>>  > >  >
>>  > >  > So, the set_parent hook is effectively unused, possibly 
>> because
>>  > > of an
>>  > >  > oversight. However, it could also be an explicit decision by 
>> the
>>  > >  > original author to avoid any reparenting but through an 
>> explicit
>>  > > call to
>>  > >  > clk_set_parent().
>>  > >  >
>>  > >  > The driver does implement round_rate() though, which means 
>> that
>>  > > we can
>>  > >  > change the rate of the clock, but we will never get to 
>> change the
>>  > >  > parent.
>>  > >  >
>>  > >  > However, It's hard to tell whether it's been done on purpose 
>> or
>>  > > not.
>>  > >  >
>>  > >  > Since we'll start mandating a determine_rate() 
>> implementation,
>>  > > let's
>>  > >  > convert the round_rate() implementation to a 
>> determine_rate(),
>>  > > which
>>  > >  > will also make the current behavior explicit. And if it was 
>> an
>>  > >  > oversight, the clock behaviour can be adjusted later on.
>>  > >
>>  > >  So it's partly on purpose, partly because I didn't know about
>>  > >  .determine_rate.
>>  > >
>>  > >  There's nothing odd about having a lonely .set_parent 
>> callback; in
>>  > > my case
>>  > >  the clocks are parented from the device tree.
>>  > >
>>  > >  Having the clocks driver trigger a parent change when 
>> requesting a
>>  > > rate
>>  > >  change sounds very dangerous, IMHO. My MMC controller can be
>>  > > parented to the
>>  > >  external 48 MHz oscillator, and if the card requests 50 MHz, it
>>  > > could switch
>>  > >  to one of the PLLs. That works as long as the PLLs don't change
>>  > > rate, but if
>>  > >  one is configured as driving the CPU clock, it becomes messy.
>>  > >  The thing is, the clocks driver has no way to know whether or 
>> not
>>  > > it is
>>  > >  "safe" to use a designated parent.
>>  > >
>>  > >  For that reason, in practice, I never actually want to have a 
>> clock
>>  > >  re-parented - it's almost always a bad idea vs. sticking to the
>>  > > parent clock
>>  > >  configured in the DTS.
>>  >
>>  > Yeah, and this is totally fine. But we need to be explicit about 
>> it. The
>>  > determine_rate implementation I did in all the patches is an exact
>>  > equivalent to the round_rate one if there was one. We will never 
>> ask to
>>  > change the parent.
>>  >
>>  > Given what you just said, I would suggest to set the
>>  > CLK_SET_RATE_NO_REPARENT flag as well.
>> 
>>  But that would introduce policy into the driver...
> 
> I'm not sure why you're bringing policies into that discussion. 
> There's
> plenty of policy in the driver already, and the current code doesn't 
> do
> something that the old wasn't doing (implicitly).

Yes, I was just talking about the CLK_SET_RATE_NO_REPARENT flag adding 
policy. The fact that there's plenty of policy in the driver already is 
not an argument for adding some more.

> And there's plenty of policies in drivers in general. Whether you 
> limit
> the rate or not, whether you allow reparenting or not, even the
> CLK_SET_RATE_NO_REPARENT flag mentioned above is a policy decision set
> by drivers.

Allowing reparenting and not limiting the rates is not a policy, it's 
just following what the hardware allows you to do. The absence of 
policy means that the driver allows you to configure the hardware in 
any way you might want to.

Limiting rates, forbidding reparenting, that's policy, and it doesn't 
belong in a driver.

You can argue that choosing not to reparent on rate change is a policy, 
and it is. That's why we need a way to enforce these policies outside 
the driver.

>>  The fact that I don't want the MMC parented to the PLLs, doesn't 
>> mean
>>  that it's an invalid configuration per se.
> 
> Sure, and that's another policy :)

A policy that is not enforced by the driver.

Going back to the patch itself... I am fine with the change, although 
the patch description should probably be updated. We have .set_parent 
callbacks to configure clocks from DT, there's nothing more to it.

Cheers,
-Paul



^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-10 11:28     ` Ulf Hansson
  -1 siblings, 0 replies; 388+ messages in thread
From: Ulf Hansson @ 2022-11-10 11:28 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Claudiu Beznea, Michael Turquette, Dinh Nguyen,
	Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.

If I recall correctly, that is the use case we did target for these
types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.

Maybe there are some additional pieces missing from the old down
stream kernel, I don't have full picture, sorry.

Anyway, if I am not wrong, this was about supporting a low-power audio
use case, which requires us to switch the parent clock (to avoid
wasting energy).

>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

Yes, this was the reason.

As a matter of fact, I don't even recall that re-parenting was
possible through clk_set_rate() when this clock driver was introduced.
But, I might be wrong, it's quite a while ago.

>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Seems reasonable to me!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/clk/ux500/clk-sysctrl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
> index 702f2f8b43fa..d36336665b6d 100644
> --- a/drivers/clk/ux500/clk-sysctrl.c
> +++ b/drivers/clk/ux500/clk-sysctrl.c
> @@ -110,6 +110,7 @@ static const struct clk_ops clk_sysctrl_gate_fixed_rate_ops = {
>  };
>
>  static const struct clk_ops clk_sysctrl_set_parent_ops = {
> +       .determine_rate = __clk_mux_determine_rate,
>         .set_parent = clk_sysctrl_set_parent,
>         .get_parent = clk_sysctrl_get_parent,
>  };
> @@ -220,6 +221,7 @@ struct clk *clk_reg_sysctrl_set_parent(struct device *dev,
>                                 unsigned long flags)
>  {
>         return clk_reg_sysctrl(dev, name, parent_names, num_parents,
> -                       reg_sel, reg_mask, reg_bits, 0, 0, flags,
> +                       reg_sel, reg_mask, reg_bits, 0, 0,
> +                       flags | CLK_SET_RATE_NO_REPARENT,
>                         &clk_sysctrl_set_parent_ops);
>  }
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 11:28     ` Ulf Hansson
  0 siblings, 0 replies; 388+ messages in thread
From: Ulf Hansson @ 2022-11-10 11:28 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Liam Girdwood, Michael Turquette, Sekhar Nori, Alexandre Torgue,
	dri-devel, Jaroslav Kysela, Paul Cercueil, Max Filippov,
	Thierry Reding, linux-phy, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Samuel Holland, Chunyan Zhang,
	Takashi Iwai, linux-tegra, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, linux-rtc, linux-clk, Charles Keepax, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-actions,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.

If I recall correctly, that is the use case we did target for these
types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.

Maybe there are some additional pieces missing from the old down
stream kernel, I don't have full picture, sorry.

Anyway, if I am not wrong, this was about supporting a low-power audio
use case, which requires us to switch the parent clock (to avoid
wasting energy).

>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

Yes, this was the reason.

As a matter of fact, I don't even recall that re-parenting was
possible through clk_set_rate() when this clock driver was introduced.
But, I might be wrong, it's quite a while ago.

>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Seems reasonable to me!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/clk/ux500/clk-sysctrl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
> index 702f2f8b43fa..d36336665b6d 100644
> --- a/drivers/clk/ux500/clk-sysctrl.c
> +++ b/drivers/clk/ux500/clk-sysctrl.c
> @@ -110,6 +110,7 @@ static const struct clk_ops clk_sysctrl_gate_fixed_rate_ops = {
>  };
>
>  static const struct clk_ops clk_sysctrl_set_parent_ops = {
> +       .determine_rate = __clk_mux_determine_rate,
>         .set_parent = clk_sysctrl_set_parent,
>         .get_parent = clk_sysctrl_get_parent,
>  };
> @@ -220,6 +221,7 @@ struct clk *clk_reg_sysctrl_set_parent(struct device *dev,
>                                 unsigned long flags)
>  {
>         return clk_reg_sysctrl(dev, name, parent_names, num_parents,
> -                       reg_sel, reg_mask, reg_bits, 0, 0, flags,
> +                       reg_sel, reg_mask, reg_bits, 0, 0,
> +                       flags | CLK_SET_RATE_NO_REPARENT,
>                         &clk_sysctrl_set_parent_ops);
>  }
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 11:28     ` Ulf Hansson
  0 siblings, 0 replies; 388+ messages in thread
From: Ulf Hansson @ 2022-11-10 11:28 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Claudiu Beznea, Michael Turquette, Dinh Nguyen,
	Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.

If I recall correctly, that is the use case we did target for these
types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.

Maybe there are some additional pieces missing from the old down
stream kernel, I don't have full picture, sorry.

Anyway, if I am not wrong, this was about supporting a low-power audio
use case, which requires us to switch the parent clock (to avoid
wasting energy).

>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

Yes, this was the reason.

As a matter of fact, I don't even recall that re-parenting was
possible through clk_set_rate() when this clock driver was introduced.
But, I might be wrong, it's quite a while ago.

>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Seems reasonable to me!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/clk/ux500/clk-sysctrl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
> index 702f2f8b43fa..d36336665b6d 100644
> --- a/drivers/clk/ux500/clk-sysctrl.c
> +++ b/drivers/clk/ux500/clk-sysctrl.c
> @@ -110,6 +110,7 @@ static const struct clk_ops clk_sysctrl_gate_fixed_rate_ops = {
>  };
>
>  static const struct clk_ops clk_sysctrl_set_parent_ops = {
> +       .determine_rate = __clk_mux_determine_rate,
>         .set_parent = clk_sysctrl_set_parent,
>         .get_parent = clk_sysctrl_get_parent,
>  };
> @@ -220,6 +221,7 @@ struct clk *clk_reg_sysctrl_set_parent(struct device *dev,
>                                 unsigned long flags)
>  {
>         return clk_reg_sysctrl(dev, name, parent_names, num_parents,
> -                       reg_sel, reg_mask, reg_bits, 0, 0, flags,
> +                       reg_sel, reg_mask, reg_bits, 0, 0,
> +                       flags | CLK_SET_RATE_NO_REPARENT,
>                         &clk_sysctrl_set_parent_ops);
>  }
>
> --
> b4 0.11.0-dev-99e3a

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 11:28     ` Ulf Hansson
  0 siblings, 0 replies; 388+ messages in thread
From: Ulf Hansson @ 2022-11-10 11:28 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Liam Girdwood, Michael Turquette, Sekhar Nori, Alexandre Torgue,
	dri-devel, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Samuel Holland, Chunyan Zhang,
	Takashi Iwai, linux-tegra, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
>
> The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> hook, but doesn't provide a determine_rate implementation.
>
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
>
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.

If I recall correctly, that is the use case we did target for these
types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.

Maybe there are some additional pieces missing from the old down
stream kernel, I don't have full picture, sorry.

Anyway, if I am not wrong, this was about supporting a low-power audio
use case, which requires us to switch the parent clock (to avoid
wasting energy).

>
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

Yes, this was the reason.

As a matter of fact, I don't even recall that re-parenting was
possible through clk_set_rate() when this clock driver was introduced.
But, I might be wrong, it's quite a while ago.

>
> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
>
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Seems reasonable to me!

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/clk/ux500/clk-sysctrl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
> index 702f2f8b43fa..d36336665b6d 100644
> --- a/drivers/clk/ux500/clk-sysctrl.c
> +++ b/drivers/clk/ux500/clk-sysctrl.c
> @@ -110,6 +110,7 @@ static const struct clk_ops clk_sysctrl_gate_fixed_rate_ops = {
>  };
>
>  static const struct clk_ops clk_sysctrl_set_parent_ops = {
> +       .determine_rate = __clk_mux_determine_rate,
>         .set_parent = clk_sysctrl_set_parent,
>         .get_parent = clk_sysctrl_get_parent,
>  };
> @@ -220,6 +221,7 @@ struct clk *clk_reg_sysctrl_set_parent(struct device *dev,
>                                 unsigned long flags)
>  {
>         return clk_reg_sysctrl(dev, name, parent_names, num_parents,
> -                       reg_sel, reg_mask, reg_bits, 0, 0, flags,
> +                       reg_sel, reg_mask, reg_bits, 0, 0,
> +                       flags | CLK_SET_RATE_NO_REPARENT,
>                         &clk_sysctrl_set_parent_ops);
>  }
>
> --
> b4 0.11.0-dev-99e3a

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
  2022-11-10 11:28     ` Ulf Hansson
  (?)
  (?)
@ 2022-11-10 11:39       ` Linus Walleij
  -1 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-10 11:39 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> >
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> >
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
>
> If I recall correctly, that is the use case we did target for these
> types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.

Hm I am trying to get that driver to work ... from time to time.
It's just that ALSA SoC DT has changed to much that it turns out
into a complete rewrite :/

So in sound/soc/ux500/mop500_ab8500.c
I see this:

        status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
        if (status)
(...)

and there is elaborate code to switch between "SYSCLK" and
"ULPCLK" (ulta-low power clock). Just like you say... however
a clock named SYSCLK or ULPCLK does not appear in the
code in drivers/clk/ux500 or any DT bindings so... it seems to
be non-working for the time being.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 11:39       ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-10 11:39 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Liam Girdwood, Michael Turquette, Sekhar Nori, Alexandre Torgue,
	dri-devel, Jaroslav Kysela, Paul Cercueil, Max Filippov,
	Thierry Reding, linux-phy, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Samuel Holland, Chunyan Zhang,
	Takashi Iwai, linux-tegra, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk, Charles Keepax,
	alsa-devel, Manivannan Sadhasivam, linux-kernel, Sascha Hauer,
	linux-actions, Richard Fitzgerald, Mark Brown, linux-mediatek,
	Maxime Ripard, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> >
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> >
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
>
> If I recall correctly, that is the use case we did target for these
> types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.

Hm I am trying to get that driver to work ... from time to time.
It's just that ALSA SoC DT has changed to much that it turns out
into a complete rewrite :/

So in sound/soc/ux500/mop500_ab8500.c
I see this:

        status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
        if (status)
(...)

and there is elaborate code to switch between "SYSCLK" and
"ULPCLK" (ulta-low power clock). Just like you say... however
a clock named SYSCLK or ULPCLK does not appear in the
code in drivers/clk/ux500 or any DT bindings so... it seems to
be non-working for the time being.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 11:39       ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-10 11:39 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> >
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> >
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
>
> If I recall correctly, that is the use case we did target for these
> types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.

Hm I am trying to get that driver to work ... from time to time.
It's just that ALSA SoC DT has changed to much that it turns out
into a complete rewrite :/

So in sound/soc/ux500/mop500_ab8500.c
I see this:

        status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
        if (status)
(...)

and there is elaborate code to switch between "SYSCLK" and
"ULPCLK" (ulta-low power clock). Just like you say... however
a clock named SYSCLK or ULPCLK does not appear in the
code in drivers/clk/ux500 or any DT bindings so... it seems to
be non-working for the time being.

Yours,
Linus Walleij

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 11:39       ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-10 11:39 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Liam Girdwood, Michael Turquette, Sekhar Nori, Alexandre Torgue,
	dri-devel, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Samuel Holland, Chunyan Zhang,
	Takashi Iwai, linux-tegra, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Maxime Ripard, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > hook, but doesn't provide a determine_rate implementation.
> >
> > This is a bit odd, since set_parent() is there to, as its name implies,
> > change the parent of a clock. However, the most likely candidate to
> > trigger that parent change is a call to clk_set_rate(), with
> > determine_rate() figuring out which parent is the best suited for a
> > given rate.
> >
> > The other trigger would be a call to clk_set_parent(), but it's far less
> > used, and it doesn't look like there's any obvious user for that clock.
>
> If I recall correctly, that is the use case we did target for these
> types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.

Hm I am trying to get that driver to work ... from time to time.
It's just that ALSA SoC DT has changed to much that it turns out
into a complete rewrite :/

So in sound/soc/ux500/mop500_ab8500.c
I see this:

        status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
        if (status)
(...)

and there is elaborate code to switch between "SYSCLK" and
"ULPCLK" (ulta-low power clock). Just like you say... however
a clock named SYSCLK or ULPCLK does not appear in the
code in drivers/clk/ux500 or any DT bindings so... it seems to
be non-working for the time being.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
  2022-11-10 11:39       ` Linus Walleij
  (?)
  (?)
@ 2022-11-10 13:05         ` Ulf Hansson
  -1 siblings, 0 replies; 388+ messages in thread
From: Ulf Hansson @ 2022-11-10 13:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > >
> > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > hook, but doesn't provide a determine_rate implementation.
> > >
> > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > change the parent of a clock. However, the most likely candidate to
> > > trigger that parent change is a call to clk_set_rate(), with
> > > determine_rate() figuring out which parent is the best suited for a
> > > given rate.
> > >
> > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > used, and it doesn't look like there's any obvious user for that clock.
> >
> > If I recall correctly, that is the use case we did target for these
> > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
>
> Hm I am trying to get that driver to work ... from time to time.
> It's just that ALSA SoC DT has changed to much that it turns out
> into a complete rewrite :/
>
> So in sound/soc/ux500/mop500_ab8500.c
> I see this:
>
>         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
>         if (status)
> (...)
>
> and there is elaborate code to switch between "SYSCLK" and
> "ULPCLK" (ulta-low power clock). Just like you say... however
> a clock named SYSCLK or ULPCLK does not appear in the
> code in drivers/clk/ux500 or any DT bindings so... it seems to
> be non-working for the time being.

It's definitely not working, but the corresponding clocks ("ulpclk",
"intclk", "audioclk", etc) are being registered in ab8500_reg_clks().

What seems to be missing is a DT conversion for these clocks, so they
can be consumed properly. Right?

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 13:05         ` Ulf Hansson
  0 siblings, 0 replies; 388+ messages in thread
From: Ulf Hansson @ 2022-11-10 13:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Liam Girdwood, Michael Turquette, Sekhar Nori, Alexandre Torgue,
	dri-devel, Jaroslav Kysela, Paul Cercueil, Max Filippov,
	Thierry Reding, linux-phy, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Samuel Holland, Chunyan Zhang,
	Takashi Iwai, linux-tegra, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk, Charles Keepax,
	alsa-devel, Manivannan Sadhasivam, linux-kernel, Sascha Hauer,
	linux-actions, Richard Fitzgerald, Mark Brown, linux-mediatek,
	Maxime Ripard, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > >
> > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > hook, but doesn't provide a determine_rate implementation.
> > >
> > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > change the parent of a clock. However, the most likely candidate to
> > > trigger that parent change is a call to clk_set_rate(), with
> > > determine_rate() figuring out which parent is the best suited for a
> > > given rate.
> > >
> > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > used, and it doesn't look like there's any obvious user for that clock.
> >
> > If I recall correctly, that is the use case we did target for these
> > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
>
> Hm I am trying to get that driver to work ... from time to time.
> It's just that ALSA SoC DT has changed to much that it turns out
> into a complete rewrite :/
>
> So in sound/soc/ux500/mop500_ab8500.c
> I see this:
>
>         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
>         if (status)
> (...)
>
> and there is elaborate code to switch between "SYSCLK" and
> "ULPCLK" (ulta-low power clock). Just like you say... however
> a clock named SYSCLK or ULPCLK does not appear in the
> code in drivers/clk/ux500 or any DT bindings so... it seems to
> be non-working for the time being.

It's definitely not working, but the corresponding clocks ("ulpclk",
"intclk", "audioclk", etc) are being registered in ab8500_reg_clks().

What seems to be missing is a DT conversion for these clocks, so they
can be consumed properly. Right?

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 13:05         ` Ulf Hansson
  0 siblings, 0 replies; 388+ messages in thread
From: Ulf Hansson @ 2022-11-10 13:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > >
> > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > hook, but doesn't provide a determine_rate implementation.
> > >
> > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > change the parent of a clock. However, the most likely candidate to
> > > trigger that parent change is a call to clk_set_rate(), with
> > > determine_rate() figuring out which parent is the best suited for a
> > > given rate.
> > >
> > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > used, and it doesn't look like there's any obvious user for that clock.
> >
> > If I recall correctly, that is the use case we did target for these
> > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
>
> Hm I am trying to get that driver to work ... from time to time.
> It's just that ALSA SoC DT has changed to much that it turns out
> into a complete rewrite :/
>
> So in sound/soc/ux500/mop500_ab8500.c
> I see this:
>
>         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
>         if (status)
> (...)
>
> and there is elaborate code to switch between "SYSCLK" and
> "ULPCLK" (ulta-low power clock). Just like you say... however
> a clock named SYSCLK or ULPCLK does not appear in the
> code in drivers/clk/ux500 or any DT bindings so... it seems to
> be non-working for the time being.

It's definitely not working, but the corresponding clocks ("ulpclk",
"intclk", "audioclk", etc) are being registered in ab8500_reg_clks().

What seems to be missing is a DT conversion for these clocks, so they
can be consumed properly. Right?

Kind regards
Uffe

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-10 13:05         ` Ulf Hansson
  0 siblings, 0 replies; 388+ messages in thread
From: Ulf Hansson @ 2022-11-10 13:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Liam Girdwood, Michael Turquette, Sekhar Nori, Alexandre Torgue,
	dri-devel, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Samuel Holland, Chunyan Zhang,
	Takashi Iwai, linux-tegra, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Maxime Ripard, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > >
> > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > hook, but doesn't provide a determine_rate implementation.
> > >
> > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > change the parent of a clock. However, the most likely candidate to
> > > trigger that parent change is a call to clk_set_rate(), with
> > > determine_rate() figuring out which parent is the best suited for a
> > > given rate.
> > >
> > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > used, and it doesn't look like there's any obvious user for that clock.
> >
> > If I recall correctly, that is the use case we did target for these
> > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
>
> Hm I am trying to get that driver to work ... from time to time.
> It's just that ALSA SoC DT has changed to much that it turns out
> into a complete rewrite :/
>
> So in sound/soc/ux500/mop500_ab8500.c
> I see this:
>
>         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
>         if (status)
> (...)
>
> and there is elaborate code to switch between "SYSCLK" and
> "ULPCLK" (ulta-low power clock). Just like you say... however
> a clock named SYSCLK or ULPCLK does not appear in the
> code in drivers/clk/ux500 or any DT bindings so... it seems to
> be non-working for the time being.

It's definitely not working, but the corresponding clocks ("ulpclk",
"intclk", "audioclk", etc) are being registered in ab8500_reg_clks().

What seems to be missing is a DT conversion for these clocks, so they
can be consumed properly. Right?

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
  2022-11-10 13:05         ` Ulf Hansson
  (?)
  (?)
@ 2022-11-11  9:20           ` Linus Walleij
  -1 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-11  9:20 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel, Lee Jones

On Thu, Nov 10, 2022 at 2:05 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > > >
> > > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > > hook, but doesn't provide a determine_rate implementation.
> > > >
> > > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > > change the parent of a clock. However, the most likely candidate to
> > > > trigger that parent change is a call to clk_set_rate(), with
> > > > determine_rate() figuring out which parent is the best suited for a
> > > > given rate.
> > > >
> > > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > > used, and it doesn't look like there's any obvious user for that clock.
> > >
> > > If I recall correctly, that is the use case we did target for these
> > > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
> >
> > Hm I am trying to get that driver to work ... from time to time.
> > It's just that ALSA SoC DT has changed to much that it turns out
> > into a complete rewrite :/
> >
> > So in sound/soc/ux500/mop500_ab8500.c
> > I see this:
> >
> >         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
> >         if (status)
> > (...)
> >
> > and there is elaborate code to switch between "SYSCLK" and
> > "ULPCLK" (ulta-low power clock). Just like you say... however
> > a clock named SYSCLK or ULPCLK does not appear in the
> > code in drivers/clk/ux500 or any DT bindings so... it seems to
> > be non-working for the time being.
>
> It's definitely not working, but the corresponding clocks ("ulpclk",
> "intclk", "audioclk", etc) are being registered in ab8500_reg_clks().
>
> What seems to be missing is a DT conversion for these clocks, so they
> can be consumed properly. Right?

Yeps that and a few more things, I have a scratch rewrite here:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git/log/?h=ux500-audio-rewrite

I remember Lee said he had audio working with the mainline kernel
on Snowball at one point, unfortunately I think that was before we
started with the DT conversions and then we probably broke it.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-11  9:20           ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-11  9:20 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Liam Girdwood, Michael Turquette, Sekhar Nori, Alexandre Torgue,
	dri-devel, Jaroslav Kysela, Paul Cercueil, Max Filippov,
	Thierry Reding, Lee Jones, linux-phy, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Samuel Holland, Chunyan Zhang,
	Takashi Iwai, linux-tegra, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk, Charles Keepax,
	alsa-devel, Manivannan Sadhasivam, linux-kernel, Sascha Hauer,
	linux-actions, Richard Fitzgerald, Mark Brown, linux-mediatek,
	Maxime Ripard, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Thu, Nov 10, 2022 at 2:05 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > > >
> > > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > > hook, but doesn't provide a determine_rate implementation.
> > > >
> > > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > > change the parent of a clock. However, the most likely candidate to
> > > > trigger that parent change is a call to clk_set_rate(), with
> > > > determine_rate() figuring out which parent is the best suited for a
> > > > given rate.
> > > >
> > > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > > used, and it doesn't look like there's any obvious user for that clock.
> > >
> > > If I recall correctly, that is the use case we did target for these
> > > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
> >
> > Hm I am trying to get that driver to work ... from time to time.
> > It's just that ALSA SoC DT has changed to much that it turns out
> > into a complete rewrite :/
> >
> > So in sound/soc/ux500/mop500_ab8500.c
> > I see this:
> >
> >         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
> >         if (status)
> > (...)
> >
> > and there is elaborate code to switch between "SYSCLK" and
> > "ULPCLK" (ulta-low power clock). Just like you say... however
> > a clock named SYSCLK or ULPCLK does not appear in the
> > code in drivers/clk/ux500 or any DT bindings so... it seems to
> > be non-working for the time being.
>
> It's definitely not working, but the corresponding clocks ("ulpclk",
> "intclk", "audioclk", etc) are being registered in ab8500_reg_clks().
>
> What seems to be missing is a DT conversion for these clocks, so they
> can be consumed properly. Right?

Yeps that and a few more things, I have a scratch rewrite here:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git/log/?h=ux500-audio-rewrite

I remember Lee said he had audio working with the mainline kernel
on Snowball at one point, unfortunately I think that was before we
started with the DT conversions and then we probably broke it.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-11  9:20           ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-11  9:20 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Maxime Ripard, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel, Lee Jones

On Thu, Nov 10, 2022 at 2:05 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > > >
> > > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > > hook, but doesn't provide a determine_rate implementation.
> > > >
> > > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > > change the parent of a clock. However, the most likely candidate to
> > > > trigger that parent change is a call to clk_set_rate(), with
> > > > determine_rate() figuring out which parent is the best suited for a
> > > > given rate.
> > > >
> > > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > > used, and it doesn't look like there's any obvious user for that clock.
> > >
> > > If I recall correctly, that is the use case we did target for these
> > > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
> >
> > Hm I am trying to get that driver to work ... from time to time.
> > It's just that ALSA SoC DT has changed to much that it turns out
> > into a complete rewrite :/
> >
> > So in sound/soc/ux500/mop500_ab8500.c
> > I see this:
> >
> >         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
> >         if (status)
> > (...)
> >
> > and there is elaborate code to switch between "SYSCLK" and
> > "ULPCLK" (ulta-low power clock). Just like you say... however
> > a clock named SYSCLK or ULPCLK does not appear in the
> > code in drivers/clk/ux500 or any DT bindings so... it seems to
> > be non-working for the time being.
>
> It's definitely not working, but the corresponding clocks ("ulpclk",
> "intclk", "audioclk", etc) are being registered in ab8500_reg_clks().
>
> What seems to be missing is a DT conversion for these clocks, so they
> can be consumed properly. Right?

Yeps that and a few more things, I have a scratch rewrite here:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git/log/?h=ux500-audio-rewrite

I remember Lee said he had audio working with the mainline kernel
on Snowball at one point, unfortunately I think that was before we
started with the DT conversions and then we probably broke it.

Yours,
Linus Walleij

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-11  9:20           ` Linus Walleij
  0 siblings, 0 replies; 388+ messages in thread
From: Linus Walleij @ 2022-11-11  9:20 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Liam Girdwood, Michael Turquette, Sekhar Nori, Alexandre Torgue,
	dri-devel, Paul Cercueil, Max Filippov, Thierry Reding,
	Lee Jones, linux-phy, David Airlie, Fabio Estevam, linux-stm32,
	Abel Vesa, Kishon Vijay Abraham I, Samuel Holland, Chunyan Zhang,
	Takashi Iwai, linux-tegra, Jernej Skrabec, Jonathan Hunter,
	Chen-Yu Tsai, NXP Linux Team, Orson Zhai, linux-mips,
	Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk, Charles Keepax,
	Daniel Vetter, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, linux-actions, Richard Fitzgerald, Mark Brown,
	linux-mediatek, Maxime Ripard, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Thu, Nov 10, 2022 at 2:05 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > > >
> > > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > > hook, but doesn't provide a determine_rate implementation.
> > > >
> > > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > > change the parent of a clock. However, the most likely candidate to
> > > > trigger that parent change is a call to clk_set_rate(), with
> > > > determine_rate() figuring out which parent is the best suited for a
> > > > given rate.
> > > >
> > > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > > used, and it doesn't look like there's any obvious user for that clock.
> > >
> > > If I recall correctly, that is the use case we did target for these
> > > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
> >
> > Hm I am trying to get that driver to work ... from time to time.
> > It's just that ALSA SoC DT has changed to much that it turns out
> > into a complete rewrite :/
> >
> > So in sound/soc/ux500/mop500_ab8500.c
> > I see this:
> >
> >         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
> >         if (status)
> > (...)
> >
> > and there is elaborate code to switch between "SYSCLK" and
> > "ULPCLK" (ulta-low power clock). Just like you say... however
> > a clock named SYSCLK or ULPCLK does not appear in the
> > code in drivers/clk/ux500 or any DT bindings so... it seems to
> > be non-working for the time being.
>
> It's definitely not working, but the corresponding clocks ("ulpclk",
> "intclk", "audioclk", etc) are being registered in ab8500_reg_clks().
>
> What seems to be missing is a DT conversion for these clocks, so they
> can be consumed properly. Right?

Yeps that and a few more things, I have a scratch rewrite here:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git/log/?h=ux500-audio-rewrite

I remember Lee said he had audio working with the mainline kernel
on Snowball at one point, unfortunately I think that was before we
started with the DT conversions and then we probably broke it.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 13/65] clk: lmk04832: clkout: Add a determine_rate hook
  2022-11-04 13:17   ` Maxime Ripard
  (?)
  (?)
@ 2022-11-13 22:35     ` Liam Beguin
  -1 siblings, 0 replies; 388+ messages in thread
From: Liam Beguin @ 2022-11-13 22:35 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

On Fri, Nov 04, 2022 at 02:17:30PM +0100, Maxime Ripard wrote:
> The LKM04832 "CLKOUT" clock implements a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

This is correct, the set_parent hook is effectively unused at the
moment. It was implemented as a way for consumers to select the parent
themselves.

The LMK04832 is used in JESD204 applications where devices need a device
clock as well as a sysref clock. Since this is determined by the
hardware layout, a devicetree option is used to select the inital state
of the clkout mux. This is set at the end of lmk04832_register_clkout().

> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 
> Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
> unlikely.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Liam Beguin <liambeguin@gmail.com>

Cheers,
Liam

> ---
>  drivers/clk/clk-lmk04832.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
> index f416f8bc2898..f68bb0affdad 100644
> --- a/drivers/clk/clk-lmk04832.c
> +++ b/drivers/clk/clk-lmk04832.c
> @@ -1281,6 +1281,7 @@ static const struct clk_ops lmk04832_clkout_ops = {
>  	.is_enabled = lmk04832_clkout_is_enabled,
>  	.prepare = lmk04832_clkout_prepare,
>  	.unprepare = lmk04832_clkout_unprepare,
> +	.determine_rate = __clk_mux_determine_rate,
>  	.set_parent = lmk04832_clkout_set_parent,
>  	.get_parent = lmk04832_clkout_get_parent,
>  };
> 
> -- 
> b4 0.11.0-dev-99e3a
> 

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 13/65] clk: lmk04832: clkout: Add a determine_rate hook
@ 2022-11-13 22:35     ` Liam Beguin
  0 siblings, 0 replies; 388+ messages in thread
From: Liam Beguin @ 2022-11-13 22:35 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

On Fri, Nov 04, 2022 at 02:17:30PM +0100, Maxime Ripard wrote:
> The LKM04832 "CLKOUT" clock implements a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

This is correct, the set_parent hook is effectively unused at the
moment. It was implemented as a way for consumers to select the parent
themselves.

The LMK04832 is used in JESD204 applications where devices need a device
clock as well as a sysref clock. Since this is determined by the
hardware layout, a devicetree option is used to select the inital state
of the clkout mux. This is set at the end of lmk04832_register_clkout().

> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 
> Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
> unlikely.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Liam Beguin <liambeguin@gmail.com>

Cheers,
Liam

> ---
>  drivers/clk/clk-lmk04832.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
> index f416f8bc2898..f68bb0affdad 100644
> --- a/drivers/clk/clk-lmk04832.c
> +++ b/drivers/clk/clk-lmk04832.c
> @@ -1281,6 +1281,7 @@ static const struct clk_ops lmk04832_clkout_ops = {
>  	.is_enabled = lmk04832_clkout_is_enabled,
>  	.prepare = lmk04832_clkout_prepare,
>  	.unprepare = lmk04832_clkout_unprepare,
> +	.determine_rate = __clk_mux_determine_rate,
>  	.set_parent = lmk04832_clkout_set_parent,
>  	.get_parent = lmk04832_clkout_get_parent,
>  };
> 
> -- 
> b4 0.11.0-dev-99e3a
> 

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 13/65] clk: lmk04832: clkout: Add a determine_rate hook
@ 2022-11-13 22:35     ` Liam Beguin
  0 siblings, 0 replies; 388+ messages in thread
From: Liam Beguin @ 2022-11-13 22:35 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

On Fri, Nov 04, 2022 at 02:17:30PM +0100, Maxime Ripard wrote:
> The LKM04832 "CLKOUT" clock implements a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

This is correct, the set_parent hook is effectively unused at the
moment. It was implemented as a way for consumers to select the parent
themselves.

The LMK04832 is used in JESD204 applications where devices need a device
clock as well as a sysref clock. Since this is determined by the
hardware layout, a devicetree option is used to select the inital state
of the clkout mux. This is set at the end of lmk04832_register_clkout().

> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 
> Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
> unlikely.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Liam Beguin <liambeguin@gmail.com>

Cheers,
Liam

> ---
>  drivers/clk/clk-lmk04832.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
> index f416f8bc2898..f68bb0affdad 100644
> --- a/drivers/clk/clk-lmk04832.c
> +++ b/drivers/clk/clk-lmk04832.c
> @@ -1281,6 +1281,7 @@ static const struct clk_ops lmk04832_clkout_ops = {
>  	.is_enabled = lmk04832_clkout_is_enabled,
>  	.prepare = lmk04832_clkout_prepare,
>  	.unprepare = lmk04832_clkout_unprepare,
> +	.determine_rate = __clk_mux_determine_rate,
>  	.set_parent = lmk04832_clkout_set_parent,
>  	.get_parent = lmk04832_clkout_get_parent,
>  };
> 
> -- 
> b4 0.11.0-dev-99e3a
> 

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 13/65] clk: lmk04832: clkout: Add a determine_rate hook
@ 2022-11-13 22:35     ` Liam Beguin
  0 siblings, 0 replies; 388+ messages in thread
From: Liam Beguin @ 2022-11-13 22:35 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, Linus Walleij, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

On Fri, Nov 04, 2022 at 02:17:30PM +0100, Maxime Ripard wrote:
> The LKM04832 "CLKOUT" clock implements a mux with a set_parent hook, but
> doesn't provide a determine_rate implementation.
> 
> This is a bit odd, since set_parent() is there to, as its name implies,
> change the parent of a clock. However, the most likely candidate to
> trigger that parent change is a call to clk_set_rate(), with
> determine_rate() figuring out which parent is the best suited for a
> given rate.
> 
> The other trigger would be a call to clk_set_parent(), but it's far less
> used, and it doesn't look like there's any obvious user for that clock.
> 
> So, the set_parent hook is effectively unused, possibly because of an
> oversight. However, it could also be an explicit decision by the
> original author to avoid any reparenting but through an explicit call to
> clk_set_parent().

This is correct, the set_parent hook is effectively unused at the
moment. It was implemented as a way for consumers to select the parent
themselves.

The LMK04832 is used in JESD204 applications where devices need a device
clock as well as a sysref clock. Since this is determined by the
hardware layout, a devicetree option is used to select the inital state
of the clkout mux. This is set at the end of lmk04832_register_clkout().

> The latter case would be equivalent to setting the flag
> CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
> to __clk_mux_determine_rate(). Indeed, if no determine_rate
> implementation is provided, clk_round_rate() (through
> clk_core_round_rate_nolock()) will call itself on the parent if
> CLK_SET_RATE_PARENT is set, and will not change the clock rate
> otherwise. __clk_mux_determine_rate() has the exact same behavior when
> CLK_SET_RATE_NO_REPARENT is set.
> 
> And if it was an oversight, then we are at least explicit about our
> behavior now and it can be further refined down the line.
> 
> Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
> unlikely.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Liam Beguin <liambeguin@gmail.com>

Cheers,
Liam

> ---
>  drivers/clk/clk-lmk04832.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
> index f416f8bc2898..f68bb0affdad 100644
> --- a/drivers/clk/clk-lmk04832.c
> +++ b/drivers/clk/clk-lmk04832.c
> @@ -1281,6 +1281,7 @@ static const struct clk_ops lmk04832_clkout_ops = {
>  	.is_enabled = lmk04832_clkout_is_enabled,
>  	.prepare = lmk04832_clkout_prepare,
>  	.unprepare = lmk04832_clkout_unprepare,
> +	.determine_rate = __clk_mux_determine_rate,
>  	.set_parent = lmk04832_clkout_set_parent,
>  	.get_parent = lmk04832_clkout_get_parent,
>  };
> 
> -- 
> b4 0.11.0-dev-99e3a
> 

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
  2022-11-11  9:20           ` Linus Walleij
  (?)
  (?)
@ 2022-11-14  9:05             ` Lee Jones
  -1 siblings, 0 replies; 388+ messages in thread
From: Lee Jones @ 2022-11-14  9:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	linux-sunxi, linux-rtc, linux-clk, Charles Keepax, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-actions,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Maxime Ripard,
	Baolin Wang, Matthias Brugger, Pengutronix Kernel Team,
	linux-arm-kernel, AngeloGioacchino Del Regno, Alessandro Zummo,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Fri, 11 Nov 2022, Linus Walleij wrote:

> On Thu, Nov 10, 2022 at 2:05 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> > >
> > > On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > >
> > > > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > > > hook, but doesn't provide a determine_rate implementation.
> > > > >
> > > > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > > > change the parent of a clock. However, the most likely candidate to
> > > > > trigger that parent change is a call to clk_set_rate(), with
> > > > > determine_rate() figuring out which parent is the best suited for a
> > > > > given rate.
> > > > >
> > > > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > > > used, and it doesn't look like there's any obvious user for that clock.
> > > >
> > > > If I recall correctly, that is the use case we did target for these
> > > > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
> > >
> > > Hm I am trying to get that driver to work ... from time to time.
> > > It's just that ALSA SoC DT has changed to much that it turns out
> > > into a complete rewrite :/
> > >
> > > So in sound/soc/ux500/mop500_ab8500.c
> > > I see this:
> > >
> > >         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
> > >         if (status)
> > > (...)
> > >
> > > and there is elaborate code to switch between "SYSCLK" and
> > > "ULPCLK" (ulta-low power clock). Just like you say... however
> > > a clock named SYSCLK or ULPCLK does not appear in the
> > > code in drivers/clk/ux500 or any DT bindings so... it seems to
> > > be non-working for the time being.
> >
> > It's definitely not working, but the corresponding clocks ("ulpclk",
> > "intclk", "audioclk", etc) are being registered in ab8500_reg_clks().
> >
> > What seems to be missing is a DT conversion for these clocks, so they
> > can be consumed properly. Right?
> 
> Yeps that and a few more things, I have a scratch rewrite here:
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git/log/?h=ux500-audio-rewrite
> 
> I remember Lee said he had audio working with the mainline kernel
> on Snowball at one point, unfortunately I think that was before we
> started with the DT conversions and then we probably broke it.

That was also 100 years ago. :)

But yes, it used to work at one point.

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-14  9:05             ` Lee Jones
  0 siblings, 0 replies; 388+ messages in thread
From: Lee Jones @ 2022-11-14  9:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ulf Hansson, Maxime Ripard, Stephen Boyd, Maxime Coquelin,
	Chen-Yu Tsai, Daniel Vetter, Nicolas Ferre, Thierry Reding,
	Jaroslav Kysela, Shawn Guo, Fabio Estevam, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Fri, 11 Nov 2022, Linus Walleij wrote:

> On Thu, Nov 10, 2022 at 2:05 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> > >
> > > On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > >
> > > > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > > > hook, but doesn't provide a determine_rate implementation.
> > > > >
> > > > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > > > change the parent of a clock. However, the most likely candidate to
> > > > > trigger that parent change is a call to clk_set_rate(), with
> > > > > determine_rate() figuring out which parent is the best suited for a
> > > > > given rate.
> > > > >
> > > > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > > > used, and it doesn't look like there's any obvious user for that clock.
> > > >
> > > > If I recall correctly, that is the use case we did target for these
> > > > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
> > >
> > > Hm I am trying to get that driver to work ... from time to time.
> > > It's just that ALSA SoC DT has changed to much that it turns out
> > > into a complete rewrite :/
> > >
> > > So in sound/soc/ux500/mop500_ab8500.c
> > > I see this:
> > >
> > >         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
> > >         if (status)
> > > (...)
> > >
> > > and there is elaborate code to switch between "SYSCLK" and
> > > "ULPCLK" (ulta-low power clock). Just like you say... however
> > > a clock named SYSCLK or ULPCLK does not appear in the
> > > code in drivers/clk/ux500 or any DT bindings so... it seems to
> > > be non-working for the time being.
> >
> > It's definitely not working, but the corresponding clocks ("ulpclk",
> > "intclk", "audioclk", etc) are being registered in ab8500_reg_clks().
> >
> > What seems to be missing is a DT conversion for these clocks, so they
> > can be consumed properly. Right?
> 
> Yeps that and a few more things, I have a scratch rewrite here:
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git/log/?h=ux500-audio-rewrite
> 
> I remember Lee said he had audio working with the mainline kernel
> on Snowball at one point, unfortunately I think that was before we
> started with the DT conversions and then we probably broke it.

That was also 100 years ago. :)

But yes, it used to work at one point.

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-14  9:05             ` Lee Jones
  0 siblings, 0 replies; 388+ messages in thread
From: Lee Jones @ 2022-11-14  9:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ulf Hansson, Maxime Ripard, Stephen Boyd, Maxime Coquelin,
	Chen-Yu Tsai, Daniel Vetter, Nicolas Ferre, Thierry Reding,
	Jaroslav Kysela, Shawn Guo, Fabio Estevam, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Paul Cercueil, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Takashi Iwai, David Airlie,
	Luca Ceresoli, Jernej Skrabec, Pengutronix Kernel Team,
	Baolin Wang, David Lechner, Sascha Hauer, Mark Brown,
	Max Filippov, Geert Uytterhoeven, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

On Fri, 11 Nov 2022, Linus Walleij wrote:

> On Thu, Nov 10, 2022 at 2:05 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> > >
> > > On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > >
> > > > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > > > hook, but doesn't provide a determine_rate implementation.
> > > > >
> > > > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > > > change the parent of a clock. However, the most likely candidate to
> > > > > trigger that parent change is a call to clk_set_rate(), with
> > > > > determine_rate() figuring out which parent is the best suited for a
> > > > > given rate.
> > > > >
> > > > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > > > used, and it doesn't look like there's any obvious user for that clock.
> > > >
> > > > If I recall correctly, that is the use case we did target for these
> > > > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
> > >
> > > Hm I am trying to get that driver to work ... from time to time.
> > > It's just that ALSA SoC DT has changed to much that it turns out
> > > into a complete rewrite :/
> > >
> > > So in sound/soc/ux500/mop500_ab8500.c
> > > I see this:
> > >
> > >         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
> > >         if (status)
> > > (...)
> > >
> > > and there is elaborate code to switch between "SYSCLK" and
> > > "ULPCLK" (ulta-low power clock). Just like you say... however
> > > a clock named SYSCLK or ULPCLK does not appear in the
> > > code in drivers/clk/ux500 or any DT bindings so... it seems to
> > > be non-working for the time being.
> >
> > It's definitely not working, but the corresponding clocks ("ulpclk",
> > "intclk", "audioclk", etc) are being registered in ab8500_reg_clks().
> >
> > What seems to be missing is a DT conversion for these clocks, so they
> > can be consumed properly. Right?
> 
> Yeps that and a few more things, I have a scratch rewrite here:
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git/log/?h=ux500-audio-rewrite
> 
> I remember Lee said he had audio working with the mainline kernel
> on Snowball at one point, unfortunately I think that was before we
> started with the DT conversions and then we probably broke it.

That was also 100 years ago. :)

But yes, it used to work at one point.

-- 
Lee Jones [李琼斯]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 35/65] clk: ux500: sysctrl: Add a determine_rate hook
@ 2022-11-14  9:05             ` Lee Jones
  0 siblings, 0 replies; 388+ messages in thread
From: Lee Jones @ 2022-11-14  9:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	David Airlie, Fabio Estevam, linux-stm32, Abel Vesa,
	Kishon Vijay Abraham I, Geert Uytterhoeven, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	linux-mips, Luca Ceresoli, linux-sunxi, linux-rtc, linux-clk,
	Charles Keepax, Daniel Vetter, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Maxime Ripard, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, Stephen Boyd,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

On Fri, 11 Nov 2022, Linus Walleij wrote:

> On Thu, Nov 10, 2022 at 2:05 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On Thu, 10 Nov 2022 at 12:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> > >
> > > On Thu, Nov 10, 2022 at 12:29 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > > > On Fri, 4 Nov 2022 at 14:32, Maxime Ripard <maxime@cerno.tech> wrote:
> > > > >
> > > > > The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
> > > > > hook, but doesn't provide a determine_rate implementation.
> > > > >
> > > > > This is a bit odd, since set_parent() is there to, as its name implies,
> > > > > change the parent of a clock. However, the most likely candidate to
> > > > > trigger that parent change is a call to clk_set_rate(), with
> > > > > determine_rate() figuring out which parent is the best suited for a
> > > > > given rate.
> > > > >
> > > > > The other trigger would be a call to clk_set_parent(), but it's far less
> > > > > used, and it doesn't look like there's any obvious user for that clock.
> > > >
> > > > If I recall correctly, that is the use case we did target for these
> > > > types of clocks. See sound/soc/ux500/ux500_ab85xx.c, for example.
> > >
> > > Hm I am trying to get that driver to work ... from time to time.
> > > It's just that ALSA SoC DT has changed to much that it turns out
> > > into a complete rewrite :/
> > >
> > > So in sound/soc/ux500/mop500_ab8500.c
> > > I see this:
> > >
> > >         status = clk_set_parent(drvdata->clk_ptr_intclk, clk_ptr);
> > >         if (status)
> > > (...)
> > >
> > > and there is elaborate code to switch between "SYSCLK" and
> > > "ULPCLK" (ulta-low power clock). Just like you say... however
> > > a clock named SYSCLK or ULPCLK does not appear in the
> > > code in drivers/clk/ux500 or any DT bindings so... it seems to
> > > be non-working for the time being.
> >
> > It's definitely not working, but the corresponding clocks ("ulpclk",
> > "intclk", "audioclk", etc) are being registered in ab8500_reg_clks().
> >
> > What seems to be missing is a DT conversion for these clocks, so they
> > can be consumed properly. Right?
> 
> Yeps that and a few more things, I have a scratch rewrite here:
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git/log/?h=ux500-audio-rewrite
> 
> I remember Lee said he had audio working with the mainline kernel
> on Snowball at one point, unfortunately I think that was before we
> started with the DT conversions and then we probably broke it.

That was also 100 years ago. :)

But yes, it used to work at one point.

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
  2022-11-04 13:17 ` Maxime Ripard
@ 2023-03-21 23:55   ` Stephen Boyd
  -1 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-21 23:55 UTC (permalink / raw)
  To: Abel Vesa, Alessandro Zummo, Alexandre Belloni, Alexandre Torgue,
	Andreas Färber, Baolin Wang, Charles Keepax, Chen-Yu Tsai,
	Chunyan Zhang, Claudiu Beznea, Daniel Vetter, David Airlie,
	David Lechner, Dinh Nguyen, Fabio Estevam, Geert Uytterhoeven,
	Jaroslav Kysela, Jernej Skrabec, Jonathan Hunter,
	Kishon Vijay Abraham I, Liam Girdwood, Linus Walleij,
	Luca Ceresoli, Manivannan Sadhasivam
  Cc: linux-rtc, alsa-devel, linux-kernel, patches, linux-actions,
	linux-mips, dri-devel, linux-clk, linux-renesas-soc, linux-tegra,
	linux-mediatek, Maxime Ripard, linux-phy, linux-sunxi,
	linux-stm32, linux-arm-kernel, AngeloGioacchino Del Regno

Quoting Maxime Ripard (2022-11-04 06:17:17)
> Hi,
> 
> This is a follow-up to a previous series that was printing a warning
> when a mux has a set_parent implementation but is missing
> determine_rate().
> 
> The rationale is that set_parent() is very likely to be useful when
> changing the rate, but it's determine_rate() that takes the parenting
> decision. If we're missing it, then the current parent is always going
> to be used, and thus set_parent() will not be used. The only exception
> being a direct call to clk_set_parent(), but those are fairly rare
> compared to clk_set_rate().
> 
> Stephen then asked to promote the warning to an error, and to fix up all
> the muxes that are in that situation first. So here it is :)
> 
> Let me know what you think,

What's the plan here? Are you going to resend?

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2023-03-21 23:55   ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-21 23:55 UTC (permalink / raw)
  To: Abel Vesa, Alessandro Zummo, Alexandre Belloni, Alexandre Torgue,
	Andreas Färber, Baolin Wang, Charles Keepax, Chen-Yu Tsai,
	Chunyan Zhang, Claudiu Beznea, Daniel Vetter, David Airlie,
	David Lechner, Dinh Nguyen, Fabio Estevam, Geert Uytterhoeven,
	Jaroslav Kysela, Jernej Skrabec, Jonathan Hunter,
	Kishon Vijay Abraham I, Liam Girdwood, Linus Walleij,
	Luca Ceresoli, Manivannan Sadhasivam
  Cc: linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	Maxime Ripard, linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Quoting Maxime Ripard (2022-11-04 06:17:17)
> Hi,
> 
> This is a follow-up to a previous series that was printing a warning
> when a mux has a set_parent implementation but is missing
> determine_rate().
> 
> The rationale is that set_parent() is very likely to be useful when
> changing the rate, but it's determine_rate() that takes the parenting
> decision. If we're missing it, then the current parent is always going
> to be used, and thus set_parent() will not be used. The only exception
> being a direct call to clk_set_parent(), but those are fairly rare
> compared to clk_set_rate().
> 
> Stephen then asked to promote the warning to an error, and to fix up all
> the muxes that are in that situation first. So here it is :)
> 
> Let me know what you think,

What's the plan here? Are you going to resend?

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
  2023-03-21 23:55   ` Stephen Boyd
  (?)
  (?)
@ 2023-03-22 10:01     ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-22 10:01 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Abel Vesa, Alessandro Zummo, Alexandre Belloni, Alexandre Torgue,
	Andreas Färber, Baolin Wang, Charles Keepax, Chen-Yu Tsai,
	Chunyan Zhang, Claudiu Beznea, Daniel Vetter, David Airlie,
	David Lechner, Dinh Nguyen, Fabio Estevam, Geert Uytterhoeven,
	Jaroslav Kysela, Jernej Skrabec, Jonathan Hunter,
	Kishon Vijay Abraham I, Liam Girdwood, Linus Walleij,
	Luca Ceresoli, Manivannan Sadhasivam, Mark Brown,
	Matthias Brugger, Max Filippov, Maxime Coquelin,
	Michael Turquette, NXP Linux Team, Nicolas Ferre, Orson Zhai,
	Paul Cercueil, Pengutronix Kernel Team, Peter De Schrijver,
	Prashant Gaikwad, Richard Fitzgerald, Samuel Holland,
	Sascha Hauer, Sekhar Nori, Shawn Guo, Takashi Iwai,
	Thierry Reding, Ulf Hansson, Vinod Koul, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]

Hi Stephen,

On Tue, Mar 21, 2023 at 04:55:03PM -0700, Stephen Boyd wrote:
> Quoting Maxime Ripard (2022-11-04 06:17:17)
> > Hi,
> > 
> > This is a follow-up to a previous series that was printing a warning
> > when a mux has a set_parent implementation but is missing
> > determine_rate().
> > 
> > The rationale is that set_parent() is very likely to be useful when
> > changing the rate, but it's determine_rate() that takes the parenting
> > decision. If we're missing it, then the current parent is always going
> > to be used, and thus set_parent() will not be used. The only exception
> > being a direct call to clk_set_parent(), but those are fairly rare
> > compared to clk_set_rate().
> > 
> > Stephen then asked to promote the warning to an error, and to fix up all
> > the muxes that are in that situation first. So here it is :)
> > 
> > Let me know what you think,
> 
> What's the plan here? Are you going to resend?

It wasn't clear to me whether or not this was something that you wanted,
and I got some pushback on the drivers so I kind of forgot about it.

If you do want it (and it looks like you do), I'll resend it.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2023-03-22 10:01     ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-22 10:01 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Sekhar Nori, Alexandre Torgue, dri-devel, Jaroslav Kysela,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	Ulf Hansson, linux-mips, Luca Ceresoli, Michael Turquette,
	Maxime Coquelin, linux-rtc, linux-clk, Charles Keepax,
	David Lechner, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, Nicolas Ferre, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	patches, Peter De Schrijver, Liam Girdwood, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Shawn Guo,
	Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]

Hi Stephen,

On Tue, Mar 21, 2023 at 04:55:03PM -0700, Stephen Boyd wrote:
> Quoting Maxime Ripard (2022-11-04 06:17:17)
> > Hi,
> > 
> > This is a follow-up to a previous series that was printing a warning
> > when a mux has a set_parent implementation but is missing
> > determine_rate().
> > 
> > The rationale is that set_parent() is very likely to be useful when
> > changing the rate, but it's determine_rate() that takes the parenting
> > decision. If we're missing it, then the current parent is always going
> > to be used, and thus set_parent() will not be used. The only exception
> > being a direct call to clk_set_parent(), but those are fairly rare
> > compared to clk_set_rate().
> > 
> > Stephen then asked to promote the warning to an error, and to fix up all
> > the muxes that are in that situation first. So here it is :)
> > 
> > Let me know what you think,
> 
> What's the plan here? Are you going to resend?

It wasn't clear to me whether or not this was something that you wanted,
and I got some pushback on the drivers so I kind of forgot about it.

If you do want it (and it looks like you do), I'll resend it.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2023-03-22 10:01     ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-22 10:01 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Abel Vesa, Alessandro Zummo, Alexandre Belloni, Alexandre Torgue,
	Andreas Färber, Baolin Wang, Charles Keepax, Chen-Yu Tsai,
	Chunyan Zhang, Claudiu Beznea, Daniel Vetter, David Airlie,
	David Lechner, Dinh Nguyen, Fabio Estevam, Geert Uytterhoeven,
	Jaroslav Kysela, Jernej Skrabec, Jonathan Hunter,
	Kishon Vijay Abraham I, Liam Girdwood, Linus Walleij,
	Luca Ceresoli, Manivannan Sadhasivam, Mark Brown,
	Matthias Brugger, Max Filippov, Maxime Coquelin,
	Michael Turquette, NXP Linux Team, Nicolas Ferre, Orson Zhai,
	Paul Cercueil, Pengutronix Kernel Team, Peter De Schrijver,
	Prashant Gaikwad, Richard Fitzgerald, Samuel Holland,
	Sascha Hauer, Sekhar Nori, Shawn Guo, Takashi Iwai,
	Thierry Reding, Ulf Hansson, Vinod Koul, linux-stm32, alsa-devel,
	linux-mediatek, linux-phy, linux-mips, linux-renesas-soc,
	linux-actions, linux-clk, AngeloGioacchino Del Regno, patches,
	linux-tegra, linux-rtc, linux-arm-kernel, linux-sunxi,
	linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1175 bytes --]

Hi Stephen,

On Tue, Mar 21, 2023 at 04:55:03PM -0700, Stephen Boyd wrote:
> Quoting Maxime Ripard (2022-11-04 06:17:17)
> > Hi,
> > 
> > This is a follow-up to a previous series that was printing a warning
> > when a mux has a set_parent implementation but is missing
> > determine_rate().
> > 
> > The rationale is that set_parent() is very likely to be useful when
> > changing the rate, but it's determine_rate() that takes the parenting
> > decision. If we're missing it, then the current parent is always going
> > to be used, and thus set_parent() will not be used. The only exception
> > being a direct call to clk_set_parent(), but those are fairly rare
> > compared to clk_set_rate().
> > 
> > Stephen then asked to promote the warning to an error, and to fix up all
> > the muxes that are in that situation first. So here it is :)
> > 
> > Let me know what you think,
> 
> What's the plan here? Are you going to resend?

It wasn't clear to me whether or not this was something that you wanted,
and I got some pushback on the drivers so I kind of forgot about it.

If you do want it (and it looks like you do), I'll resend it.

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2023-03-22 10:01     ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-22 10:01 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Abel Vesa, Alessandro Zummo, Alexandre Belloni, Alexandre Torgue,
	Andreas Färber, Baolin Wang, Charles Keepax, Chen-Yu Tsai,
	Chunyan Zhang, Claudiu Beznea, Daniel Vetter, David Airlie,
	David Lechner, Dinh Nguyen, Fabio Estevam, Geert Uytterhoeven,
	Jernej Skrabec, Jonathan Hunter, Kishon Vijay Abraham I,
	Liam Girdwood, Linus Walleij, Luca Ceresoli,
	Manivannan Sadhasivam, Mark Brown, Matthias Brugger,
	Max Filippov, Maxime Coquelin, Michael Turquette, NXP Linux Team,
	Nicolas Ferre, Orson Zhai, Paul Cercueil,
	Pengutronix Kernel Team, Peter De Schrijver, Prashant Gaikwad,
	Richard Fitzgerald, Samuel Holland, Sascha Hauer, Sekhar Nori,
	Shawn Guo, Takashi Iwai, Thierry Reding, Ulf Hansson, Vinod Koul,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]

Hi Stephen,

On Tue, Mar 21, 2023 at 04:55:03PM -0700, Stephen Boyd wrote:
> Quoting Maxime Ripard (2022-11-04 06:17:17)
> > Hi,
> > 
> > This is a follow-up to a previous series that was printing a warning
> > when a mux has a set_parent implementation but is missing
> > determine_rate().
> > 
> > The rationale is that set_parent() is very likely to be useful when
> > changing the rate, but it's determine_rate() that takes the parenting
> > decision. If we're missing it, then the current parent is always going
> > to be used, and thus set_parent() will not be used. The only exception
> > being a direct call to clk_set_parent(), but those are fairly rare
> > compared to clk_set_rate().
> > 
> > Stephen then asked to promote the warning to an error, and to fix up all
> > the muxes that are in that situation first. So here it is :)
> > 
> > Let me know what you think,
> 
> What's the plan here? Are you going to resend?

It wasn't clear to me whether or not this was something that you wanted,
and I got some pushback on the drivers so I kind of forgot about it.

If you do want it (and it looks like you do), I'll resend it.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
  2023-03-22 10:01     ` Maxime Ripard
  (?)
@ 2023-03-22 15:19       ` Stephen Boyd
  -1 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 15:19 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Belloni, Prashant Gaikwad, Geert Uytterhoeven,
	Sekhar Nori, Alexandre Torgue, dri-devel, Jaroslav Kysela,
	Paul Cercueil, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I, Samuel Holland,
	Chunyan Zhang, Takashi Iwai, linux-tegra, Jernej Skrabec,
	Jonathan Hunter, Chen-Yu Tsai, NXP Linux Team, Orson Zhai,
	Ulf Hansson, linux-mips, Luca Ceresoli, Michael Turquette,
	Maxime Coquelin, linux-rtc, linux-clk, Charles Keepax,
	David Lechner, alsa-devel, Manivannan Sadhasivam, linux-kernel,
	Sascha Hauer, Nicolas Ferre, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, nel.org, AngeloGioacchino Del Regno,
	linux-arm-kernel, Alessandro Zummo, linux-sunxi, patches,
	Peter De Schrijver, Liam Girdwood, Andreas Färber,
	Dinh Nguyen, Vinod Koul, linux-renesas-soc, Shawn Guo,
	Claudiu Beznea

Quoting Maxime Ripard (2023-03-22 03:01:53)
> Hi Stephen,
> 
> On Tue, Mar 21, 2023 at 04:55:03PM -0700, Stephen Boyd wrote:
> > Quoting Maxime Ripard (2022-11-04 06:17:17)
> > > Hi,
> > > 
> > > This is a follow-up to a previous series that was printing a warning
> > > when a mux has a set_parent implementation but is missing
> > > determine_rate().
> > > 
> > > The rationale is that set_parent() is very likely to be useful when
> > > changing the rate, but it's determine_rate() that takes the parenting
> > > decision. If we're missing it, then the current parent is always going
> > > to be used, and thus set_parent() will not be used. The only exception
> > > being a direct call to clk_set_parent(), but those are fairly rare
> > > compared to clk_set_rate().
> > > 
> > > Stephen then asked to promote the warning to an error, and to fix up all
> > > the muxes that are in that situation first. So here it is :)
> > > 
> > > Let me know what you think,
> > 
> > What's the plan here? Are you going to resend?
> 
> It wasn't clear to me whether or not this was something that you wanted,
> and I got some pushback on the drivers so I kind of forgot about it.
> 
> If you do want it (and it looks like you do), I'll resend it.

Let me read the whole series first. I was ignoring it because I was
assuming it was going to be resent.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2023-03-22 15:19       ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 15:19 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Abel Vesa, Alessandro Zummo, Alexandre Belloni, Alexandre Torgue,
	Andreas Färber, Baolin Wang, Charles Keepax, Chen-Yu Tsai,
	Chunyan Zhang, Claudiu Beznea, Daniel Vetter, David Airlie,
	David Lechner, Dinh Nguyen, Fabio Estevam, Geert Uytterhoeven,
	Jaroslav Kysela, Jernej Skrabec, Jonathan Hunter,
	Kishon Vijay Abraham I, Liam Girdwood, Linus Walleij,
	Luca Ceresoli, Manivannan Sadhasivam

Quoting Maxime Ripard (2023-03-22 03:01:53)
> Hi Stephen,
> 
> On Tue, Mar 21, 2023 at 04:55:03PM -0700, Stephen Boyd wrote:
> > Quoting Maxime Ripard (2022-11-04 06:17:17)
> > > Hi,
> > > 
> > > This is a follow-up to a previous series that was printing a warning
> > > when a mux has a set_parent implementation but is missing
> > > determine_rate().
> > > 
> > > The rationale is that set_parent() is very likely to be useful when
> > > changing the rate, but it's determine_rate() that takes the parenting
> > > decision. If we're missing it, then the current parent is always going
> > > to be used, and thus set_parent() will not be used. The only exception
> > > being a direct call to clk_set_parent(), but those are fairly rare
> > > compared to clk_set_rate().
> > > 
> > > Stephen then asked to promote the warning to an error, and to fix up all
> > > the muxes that are in that situation first. So here it is :)
> > > 
> > > Let me know what you think,
> > 
> > What's the plan here? Are you going to resend?
> 
> It wasn't clear to me whether or not this was something that you wanted,
> and I got some pushback on the drivers so I kind of forgot about it.
> 
> If you do want it (and it looks like you do), I'll resend it.

Let me read the whole series first. I was ignoring it because I was
assuming it was going to be resent.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes
@ 2023-03-22 15:19       ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 15:19 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Abel Vesa, Alessandro Zummo, Alexandre Belloni, Alexandre Torgue,
	Andreas Färber, Baolin Wang, Charles Keepax, Chen-Yu Tsai,
	Chunyan Zhang, Claudiu Beznea, Daniel Vetter, David Airlie,
	David Lechner, Dinh Nguyen, Fabio Estevam, Geert Uytterhoeven,
	Jernej Skrabec, Jonathan Hunter, Kishon Vijay Abraham I,
	Liam Girdwood, Linus Walleij, Luca Ceresoli,
	Manivannan Sadhasivam, Mark Brown, Matthias Brugger,
	Max Filippov, Maxime Coquelin, Michael Turquette, NXP Linux Team,
	Nicolas Ferre, Orson Zhai, Paul Cercueil,
	Pengutronix Kernel Team, Peter De Schrijver, Prashant Gaikwad,
	Richard Fitzgerald, Samuel Holland, Sascha Hauer, Sekhar Nori,
	Shawn Guo, Takashi Iwai, Thierry Reding, Ulf Hansson, Vinod Koul,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, nel.org, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Quoting Maxime Ripard (2023-03-22 03:01:53)
> Hi Stephen,
> 
> On Tue, Mar 21, 2023 at 04:55:03PM -0700, Stephen Boyd wrote:
> > Quoting Maxime Ripard (2022-11-04 06:17:17)
> > > Hi,
> > > 
> > > This is a follow-up to a previous series that was printing a warning
> > > when a mux has a set_parent implementation but is missing
> > > determine_rate().
> > > 
> > > The rationale is that set_parent() is very likely to be useful when
> > > changing the rate, but it's determine_rate() that takes the parenting
> > > decision. If we're missing it, then the current parent is always going
> > > to be used, and thus set_parent() will not be used. The only exception
> > > being a direct call to clk_set_parent(), but those are fairly rare
> > > compared to clk_set_rate().
> > > 
> > > Stephen then asked to promote the warning to an error, and to fix up all
> > > the muxes that are in that situation first. So here it is :)
> > > 
> > > Let me know what you think,
> > 
> > What's the plan here? Are you going to resend?
> 
> It wasn't clear to me whether or not this was something that you wanted,
> and I got some pushback on the drivers so I kind of forgot about it.
> 
> If you do want it (and it looks like you do), I'll resend it.

Let me read the whole series first. I was ignoring it because I was
assuming it was going to be resent.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2022-11-07 15:26               ` Maxime Ripard
  (?)
@ 2023-03-22 23:31                 ` Stephen Boyd
  -1 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 23:31 UTC (permalink / raw)
  To: Mark Brown, Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Liam Girdwood,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	Kishon Vijay Abraham I, Charles Keepax, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-clk,
	Richard Fitzgerald, linux-mediatek, .com, Baolin Wang,
	Matthias Brugger, linux-actions, Pengutronix Kernel Team,
	linux-arm-kernel, AngeloGioacchino Del Regno, Alessandro Zummo,
	linux-sunxi, adead.org, patches, Peter De Schrijver,
	Nicolas Ferre, Andreas Färber, linux-renesas-soc,
	Dinh Nguyen, Vinod Koul, Maxime Coquelin, David Lechner,
	Shawn Guo, Claudiu Beznea, linux-rtc

Quoting Maxime Ripard (2022-11-07 07:26:03)
> On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> > On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> > > On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> > 
> > > > Well, hopefully everyone for whom it's an issue currently will be
> > > > objecting to this version of the change anyway so we'll either know
> > > > where to set the flag or we'll get the whack-a-mole with the series
> > > > being merged?
> > 
> > > I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> > > moment is that determine_rate and set_parent aren't coupled, and it led
> > > to issues due to oversight.
> > 
> > > I initially added a warning but Stephen wanted to fix all users in that
> > > case and make that an error instead.
> > 
> > My suggestion is that instead of doing either of these things it'd be
> > quicker and less error prone to just fix the core to provide the default
> > implementation if nothing more specific is provided.  Any issues that
> > causes would already be present with your current series.
> > 
> > > If I filled __clk_mux_determine_rate into clocks that weren't using it
> > > before, I would change their behavior. With that flag set, on all users
> > > I add __clk_mux_determine_rate to, the behavior is the same than what we
> > > previously had, so the risk of regressions is minimal, and everything
> > > should keep going like it was?
> > 
> > The series does fill in __clk_mux_determine_rate for everything though -
> > if it was just assumed by default the only thing that'd be needed would
> > be adding the flag.
> 
> The behavior assumed by default was equivalent to
> __clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
> both if determine_rate is missing in the core, but that's unprecedented
> in the clock framework so I think we'll want Stephen to comment here :)

The clk_ops pointer is const (no writeable jump tables) so we'd have to
copy the clk_ops struct on registration to set the
__clk_mux_determine_rate() op. We could set the flag though and then
check for the absence of a determine_rate op. Things like
clk_core_can_round() would need to check for the flag. I'd actually
forgotten about this flag. In hindsight I think we should delete it.
I'd expect it to be used when walking the clk tree during rate rounding,
but it's only used in the determine rate clk op.

> 
> It's also replacing one implicit behavior by another. The point of this
> series was to raise awareness on that particular point, so I'm not sure
> it actually fixes things. We'll see what Stephen thinks about it.
> 

Right. A decade ago (!) when determine_rate() was introduced we
introduced CLK_SET_RATE_NO_REPARENT and set it on each mux user (see
commit  819c1de344c5 ("clk: add CLK_SET_RATE_NO_REPARENT flag")). This
way driver behavior wouldn't change and the status quo would be
maintained, i.e. that clk_set_rate() on a mux wouldn't change parents.
We didn't enforce that determine_rate exists if the set_parent() op
existed at the same time though. Probably an oversight.

Most of the replies to this series have been "DT is setting the parent",
which makes me believe that there are 'assigned-clock-parents' being
used. The clk_set_parent() path is valid for those cases. Probably
nobody cares about determine_rate because they don't set rates on these
clks. Some drivers even explicitly left out
determine_rate()/round_rate() because they didn't want to have some
other clk round up to the mux and change the parent.

Eventually we want drivers to migrate to determine_rate op so we can get
rid of the round_rate op and save a pointer (we're so greedy). It's been
10 years though, and that hasn't been done. Sigh! I can see value in
this series from the angle of migrating, but adding a determine_rate op
when there isn't a round_rate op makes it hard to reason about. What if
something copies the clk_ops or sets a different flag? Now we've just
added parent changing support to clk_set_rate(). What if the clk has
CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
change rate. Fun bugs.

TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
then the clk is a mux that doesn't want to support clk_set_rate(). Make
a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
branch in clk_mux_determine_rate_flags() and call that directly from the
clk_ops so it is clear what's happening,
clk_hw_mux_same_parent_determine_rate() or something with a better name.
Otherwise migrate the explicit determine_rate op to this new function
and don't set the flag.

It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
with this design, if the determine_rate clk_op can call the inner
wrapper function instead of __clk_mux_determine_rate*() (those
underscores are awful, we should just prefix them with clk_hw_mux_*()
and live happier). That should be another patch series.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2023-03-22 23:31                 ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 23:31 UTC (permalink / raw)
  To: Mark Brown, Maxime Ripard
  Cc: Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter, Nicolas Ferre,
	Thierry Reding, Jaroslav Kysela, Shawn Guo, Fabio Estevam,
	Ulf Hansson, Claudiu Beznea, Michael Turquette, Dinh Nguyen,
	Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions

Quoting Maxime Ripard (2022-11-07 07:26:03)
> On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> > On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> > > On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> > 
> > > > Well, hopefully everyone for whom it's an issue currently will be
> > > > objecting to this version of the change anyway so we'll either know
> > > > where to set the flag or we'll get the whack-a-mole with the series
> > > > being merged?
> > 
> > > I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> > > moment is that determine_rate and set_parent aren't coupled, and it led
> > > to issues due to oversight.
> > 
> > > I initially added a warning but Stephen wanted to fix all users in that
> > > case and make that an error instead.
> > 
> > My suggestion is that instead of doing either of these things it'd be
> > quicker and less error prone to just fix the core to provide the default
> > implementation if nothing more specific is provided.  Any issues that
> > causes would already be present with your current series.
> > 
> > > If I filled __clk_mux_determine_rate into clocks that weren't using it
> > > before, I would change their behavior. With that flag set, on all users
> > > I add __clk_mux_determine_rate to, the behavior is the same than what we
> > > previously had, so the risk of regressions is minimal, and everything
> > > should keep going like it was?
> > 
> > The series does fill in __clk_mux_determine_rate for everything though -
> > if it was just assumed by default the only thing that'd be needed would
> > be adding the flag.
> 
> The behavior assumed by default was equivalent to
> __clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
> both if determine_rate is missing in the core, but that's unprecedented
> in the clock framework so I think we'll want Stephen to comment here :)

The clk_ops pointer is const (no writeable jump tables) so we'd have to
copy the clk_ops struct on registration to set the
__clk_mux_determine_rate() op. We could set the flag though and then
check for the absence of a determine_rate op. Things like
clk_core_can_round() would need to check for the flag. I'd actually
forgotten about this flag. In hindsight I think we should delete it.
I'd expect it to be used when walking the clk tree during rate rounding,
but it's only used in the determine rate clk op.

> 
> It's also replacing one implicit behavior by another. The point of this
> series was to raise awareness on that particular point, so I'm not sure
> it actually fixes things. We'll see what Stephen thinks about it.
> 

Right. A decade ago (!) when determine_rate() was introduced we
introduced CLK_SET_RATE_NO_REPARENT and set it on each mux user (see
commit  819c1de344c5 ("clk: add CLK_SET_RATE_NO_REPARENT flag")). This
way driver behavior wouldn't change and the status quo would be
maintained, i.e. that clk_set_rate() on a mux wouldn't change parents.
We didn't enforce that determine_rate exists if the set_parent() op
existed at the same time though. Probably an oversight.

Most of the replies to this series have been "DT is setting the parent",
which makes me believe that there are 'assigned-clock-parents' being
used. The clk_set_parent() path is valid for those cases. Probably
nobody cares about determine_rate because they don't set rates on these
clks. Some drivers even explicitly left out
determine_rate()/round_rate() because they didn't want to have some
other clk round up to the mux and change the parent.

Eventually we want drivers to migrate to determine_rate op so we can get
rid of the round_rate op and save a pointer (we're so greedy). It's been
10 years though, and that hasn't been done. Sigh! I can see value in
this series from the angle of migrating, but adding a determine_rate op
when there isn't a round_rate op makes it hard to reason about. What if
something copies the clk_ops or sets a different flag? Now we've just
added parent changing support to clk_set_rate(). What if the clk has
CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
change rate. Fun bugs.

TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
then the clk is a mux that doesn't want to support clk_set_rate(). Make
a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
branch in clk_mux_determine_rate_flags() and call that directly from the
clk_ops so it is clear what's happening,
clk_hw_mux_same_parent_determine_rate() or something with a better name.
Otherwise migrate the explicit determine_rate op to this new function
and don't set the flag.

It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
with this design, if the determine_rate clk_op can call the inner
wrapper function instead of __clk_mux_determine_rate*() (those
underscores are awful, we should just prefix them with clk_hw_mux_*()
and live happier). That should be another patch series.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2023-03-22 23:31                 ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 23:31 UTC (permalink / raw)
  To: Mark Brown, Maxime Ripard
  Cc: Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter, Nicolas Ferre,
	Thierry Reding, Shawn Guo, Fabio Estevam, Ulf Hansson,
	Claudiu Beznea, Michael Turquette, Dinh Nguyen, Paul Cercueil,
	Chunyan Zhang, Manivannan Sadhasivam, Andreas Färber,
	Jonathan Hunter, Abel Vesa, Charles Keepax, Alessandro Zummo,
	Peter De Schrijver, Orson Zhai, Alexandre Torgue,
	Prashant Gaikwad, Liam Girdwood, Alexandre Belloni,
	Samuel Holland, Matthias Brugger, Richard Fitzgerald, Vinod Koul,
	NXP Linux Team, Sekhar Nori, Kishon Vijay Abraham I,
	Linus Walleij, Takashi Iwai, David Airlie, Luca Ceresoli,
	Jernej Skrabec, Pengutronix Kernel Team, Baolin Wang,
	David Lechner, Sascha Hauer, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, adead.org, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Quoting Maxime Ripard (2022-11-07 07:26:03)
> On Mon, Nov 07, 2022 at 12:06:07PM +0000, Mark Brown wrote:
> > On Mon, Nov 07, 2022 at 09:43:22AM +0100, Maxime Ripard wrote:
> > > On Fri, Nov 04, 2022 at 03:59:53PM +0000, Mark Brown wrote:
> > 
> > > > Well, hopefully everyone for whom it's an issue currently will be
> > > > objecting to this version of the change anyway so we'll either know
> > > > where to set the flag or we'll get the whack-a-mole with the series
> > > > being merged?
> > 
> > > I'm sorry, I'm not sure what you mean here. The only issue to fix at the
> > > moment is that determine_rate and set_parent aren't coupled, and it led
> > > to issues due to oversight.
> > 
> > > I initially added a warning but Stephen wanted to fix all users in that
> > > case and make that an error instead.
> > 
> > My suggestion is that instead of doing either of these things it'd be
> > quicker and less error prone to just fix the core to provide the default
> > implementation if nothing more specific is provided.  Any issues that
> > causes would already be present with your current series.
> > 
> > > If I filled __clk_mux_determine_rate into clocks that weren't using it
> > > before, I would change their behavior. With that flag set, on all users
> > > I add __clk_mux_determine_rate to, the behavior is the same than what we
> > > previously had, so the risk of regressions is minimal, and everything
> > > should keep going like it was?
> > 
> > The series does fill in __clk_mux_determine_rate for everything though -
> > if it was just assumed by default the only thing that'd be needed would
> > be adding the flag.
> 
> The behavior assumed by default was equivalent to
> __clk_mux_determine_rate + CLK_SET_RATE_NO_REPARENT. We could indeed set
> both if determine_rate is missing in the core, but that's unprecedented
> in the clock framework so I think we'll want Stephen to comment here :)

The clk_ops pointer is const (no writeable jump tables) so we'd have to
copy the clk_ops struct on registration to set the
__clk_mux_determine_rate() op. We could set the flag though and then
check for the absence of a determine_rate op. Things like
clk_core_can_round() would need to check for the flag. I'd actually
forgotten about this flag. In hindsight I think we should delete it.
I'd expect it to be used when walking the clk tree during rate rounding,
but it's only used in the determine rate clk op.

> 
> It's also replacing one implicit behavior by another. The point of this
> series was to raise awareness on that particular point, so I'm not sure
> it actually fixes things. We'll see what Stephen thinks about it.
> 

Right. A decade ago (!) when determine_rate() was introduced we
introduced CLK_SET_RATE_NO_REPARENT and set it on each mux user (see
commit  819c1de344c5 ("clk: add CLK_SET_RATE_NO_REPARENT flag")). This
way driver behavior wouldn't change and the status quo would be
maintained, i.e. that clk_set_rate() on a mux wouldn't change parents.
We didn't enforce that determine_rate exists if the set_parent() op
existed at the same time though. Probably an oversight.

Most of the replies to this series have been "DT is setting the parent",
which makes me believe that there are 'assigned-clock-parents' being
used. The clk_set_parent() path is valid for those cases. Probably
nobody cares about determine_rate because they don't set rates on these
clks. Some drivers even explicitly left out
determine_rate()/round_rate() because they didn't want to have some
other clk round up to the mux and change the parent.

Eventually we want drivers to migrate to determine_rate op so we can get
rid of the round_rate op and save a pointer (we're so greedy). It's been
10 years though, and that hasn't been done. Sigh! I can see value in
this series from the angle of migrating, but adding a determine_rate op
when there isn't a round_rate op makes it hard to reason about. What if
something copies the clk_ops or sets a different flag? Now we've just
added parent changing support to clk_set_rate(). What if the clk has
CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
change rate. Fun bugs.

TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
then the clk is a mux that doesn't want to support clk_set_rate(). Make
a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
branch in clk_mux_determine_rate_flags() and call that directly from the
clk_ops so it is clear what's happening,
clk_hw_mux_same_parent_determine_rate() or something with a better name.
Otherwise migrate the explicit determine_rate op to this new function
and don't set the flag.

It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
with this design, if the determine_rate clk_op can call the inner
wrapper function instead of __clk_mux_determine_rate*() (those
underscores are awful, we should just prefix them with clk_hw_mux_*()
and live happier). That should be another patch series.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2022-11-09 11:00               ` Maxime Ripard
  (?)
@ 2023-03-22 23:41                 ` Stephen Boyd
  -1 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 23:41 UTC (permalink / raw)
  To: Aidan MacDonald, Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Liam Girdwood,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli,
	Kishon Vijay Abraham I, linux-clk, Charles Keepax, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-actions,
	Richard Fitzgerald, Mark Brown, linux-mediatek, .com,
	Baolin Wang, Matthias Brugger, Pengutronix Kernel Team, nel.org,
	AngeloGioacchino Del Regno, linux-arm-kernel, Alessandro Zummo,
	linux-sunxi, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	linux-renesas-soc, David Lechner, Shawn Guo, Claudiu Beznea,
	linux-rtc

Quoting Maxime Ripard (2022-11-09 03:00:45)
> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> > 
> > Maxime Ripard <maxime@cerno.tech> writes:
> > 
> > > Hi,
> > >
> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> > 
> > Assigning the parent clock in the DT works once, at boot, but going off
> > what you wrote in the commit message, if the clock driver has a
> > .determine_rate() implementation that *can* reparent clocks then it
> > probably *will* reparent them, and the DT assignment will be lost.
> 
> Yes, indeed, but assigned-clock-parents never provided any sort of
> guarantee on whether or not the clock was allowed to reparent or not.
> It's just a one-off thing, right before probe, and a clk_set_parent()
> call at probe will override that just fine.
> 
> Just like assigned-clock-rates isn't permanent.
> 
> > What I'm suggesting is a runtime constraint that the clock subsystem
> > would enforce, and actively prevent drivers from changing the parent.
> > Either explicitly with clk_set_parent() or due to .determine_rate().
> > 
> > That way you could write a .determine_rate() implementation that *can*
> > select a better parent, but if the DT applies a constraint to fix the
> > clock to a particular parent, the clock subsystem will force that parent
> > to be used so you can be sure the clock is never reparented by accident.
> 
> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
> too far off from this, it's just ignored by clk_set_parent() for now. I
> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
> clk_set_parent handle it, and set that flag whenever
> assigned-clock-parents is set on a clock.
> 
> It's out of scope for this series though, and I certainly don't want to
> deal with all the regressions it might create :)
> 

This sounds like a new dt binding that says the assigned parent should
never change. It sounds sort of like gpio hogs. A clock-hogs binding?

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-22 23:41                 ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 23:41 UTC (permalink / raw)
  To: Aidan MacDonald, Maxime Ripard
  Cc: Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc

Quoting Maxime Ripard (2022-11-09 03:00:45)
> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> > 
> > Maxime Ripard <maxime@cerno.tech> writes:
> > 
> > > Hi,
> > >
> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> > 
> > Assigning the parent clock in the DT works once, at boot, but going off
> > what you wrote in the commit message, if the clock driver has a
> > .determine_rate() implementation that *can* reparent clocks then it
> > probably *will* reparent them, and the DT assignment will be lost.
> 
> Yes, indeed, but assigned-clock-parents never provided any sort of
> guarantee on whether or not the clock was allowed to reparent or not.
> It's just a one-off thing, right before probe, and a clk_set_parent()
> call at probe will override that just fine.
> 
> Just like assigned-clock-rates isn't permanent.
> 
> > What I'm suggesting is a runtime constraint that the clock subsystem
> > would enforce, and actively prevent drivers from changing the parent.
> > Either explicitly with clk_set_parent() or due to .determine_rate().
> > 
> > That way you could write a .determine_rate() implementation that *can*
> > select a better parent, but if the DT applies a constraint to fix the
> > clock to a particular parent, the clock subsystem will force that parent
> > to be used so you can be sure the clock is never reparented by accident.
> 
> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
> too far off from this, it's just ignored by clk_set_parent() for now. I
> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
> clk_set_parent handle it, and set that flag whenever
> assigned-clock-parents is set on a clock.
> 
> It's out of scope for this series though, and I certainly don't want to
> deal with all the regressions it might create :)
> 

This sounds like a new dt binding that says the assigned parent should
never change. It sounds sort of like gpio hogs. A clock-hogs binding?

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-22 23:41                 ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-22 23:41 UTC (permalink / raw)
  To: Aidan MacDonald, Maxime Ripard
  Cc: Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Shawn Guo, Fabio Estevam,
	Ulf Hansson, Claudiu Beznea, Michael Turquette, Dinh Nguyen,
	Chunyan Zhang, Manivannan Sadhasivam, Andreas Färber,
	Jonathan Hunter, Abel Vesa, Charles Keepax, Alessandro Zummo,
	Peter De Schrijver, Orson Zhai, Alexandre Torgue,
	Prashant Gaikwad, Liam Girdwood, Alexandre Belloni,
	Samuel Holland, Matthias Brugger, Richard Fitzgerald, Vinod Koul,
	NXP Linux Team, Sekhar Nori, Kishon Vijay Abraham I,
	Linus Walleij, Takashi Iwai, David Airlie, Luca Ceresoli,
	Jernej Skrabec, Pengutronix Kernel Team, Baolin Wang,
	David Lechner, Sascha Hauer, Mark Brown, Max Filippov,
	Geert Uytterhoeven, linux-stm32, alsa-devel, linux-mediatek,
	linux-phy, linux-mips, linux-renesas-soc, nel.org, linux-actions,
	linux-clk, AngeloGioacchino Del Regno, patches, linux-tegra,
	linux-rtc, linux-arm-kernel, linux-sunxi, linux-kernel,
	dri-devel

Quoting Maxime Ripard (2022-11-09 03:00:45)
> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> > 
> > Maxime Ripard <maxime@cerno.tech> writes:
> > 
> > > Hi,
> > >
> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> > 
> > Assigning the parent clock in the DT works once, at boot, but going off
> > what you wrote in the commit message, if the clock driver has a
> > .determine_rate() implementation that *can* reparent clocks then it
> > probably *will* reparent them, and the DT assignment will be lost.
> 
> Yes, indeed, but assigned-clock-parents never provided any sort of
> guarantee on whether or not the clock was allowed to reparent or not.
> It's just a one-off thing, right before probe, and a clk_set_parent()
> call at probe will override that just fine.
> 
> Just like assigned-clock-rates isn't permanent.
> 
> > What I'm suggesting is a runtime constraint that the clock subsystem
> > would enforce, and actively prevent drivers from changing the parent.
> > Either explicitly with clk_set_parent() or due to .determine_rate().
> > 
> > That way you could write a .determine_rate() implementation that *can*
> > select a better parent, but if the DT applies a constraint to fix the
> > clock to a particular parent, the clock subsystem will force that parent
> > to be used so you can be sure the clock is never reparented by accident.
> 
> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
> too far off from this, it's just ignored by clk_set_parent() for now. I
> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
> clk_set_parent handle it, and set that flag whenever
> assigned-clock-parents is set on a clock.
> 
> It's out of scope for this series though, and I certainly don't want to
> deal with all the regressions it might create :)
> 

This sounds like a new dt binding that says the assigned parent should
never change. It sounds sort of like gpio hogs. A clock-hogs binding?

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2023-03-22 23:41                 ` Stephen Boyd
  (?)
  (?)
@ 2023-03-23 15:35                   ` Aidan MacDonald
  -1 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2023-03-23 15:35 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Maxime Ripard, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Stephen Boyd <sboyd@kernel.org> writes:

> Quoting Maxime Ripard (2022-11-09 03:00:45)
>> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
>> >
>> > Maxime Ripard <maxime@cerno.tech> writes:
>> >
>> > > Hi,
>> > >
>> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>> >
>> > Assigning the parent clock in the DT works once, at boot, but going off
>> > what you wrote in the commit message, if the clock driver has a
>> > .determine_rate() implementation that *can* reparent clocks then it
>> > probably *will* reparent them, and the DT assignment will be lost.
>>
>> Yes, indeed, but assigned-clock-parents never provided any sort of
>> guarantee on whether or not the clock was allowed to reparent or not.
>> It's just a one-off thing, right before probe, and a clk_set_parent()
>> call at probe will override that just fine.
>>
>> Just like assigned-clock-rates isn't permanent.
>>
>> > What I'm suggesting is a runtime constraint that the clock subsystem
>> > would enforce, and actively prevent drivers from changing the parent.
>> > Either explicitly with clk_set_parent() or due to .determine_rate().
>> >
>> > That way you could write a .determine_rate() implementation that *can*
>> > select a better parent, but if the DT applies a constraint to fix the
>> > clock to a particular parent, the clock subsystem will force that parent
>> > to be used so you can be sure the clock is never reparented by accident.
>>
>> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
>> too far off from this, it's just ignored by clk_set_parent() for now. I
>> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
>> clk_set_parent handle it, and set that flag whenever
>> assigned-clock-parents is set on a clock.
>>
>> It's out of scope for this series though, and I certainly don't want to
>> deal with all the regressions it might create :)
>>
>
> This sounds like a new dt binding that says the assigned parent should
> never change. It sounds sort of like gpio hogs. A clock-hogs binding?

Ideally we want the clock driver to be able to reparent clocks freely
to get the best rate. But we also need some control over that to stop
consumers from being reparented in undesired ways. Eg. you might want
to make sure the GPU gets its own PLL so it can be reclocked easily,
and putting another device on the GPU's PLL could prevent that.

The only way to achieve this today is (1) never do any reparenting in
the clock driver; and (2) use assigned-clock-parents in the DT to set
up the entire clock tree manually.

Maxime said that (2) is basically wrong -- if assigned-clock-parents
provides no guarantee on what the OS does "after boot" then the OS is
pretty much free to ignore it.

My suggestion: add a per-clock bitmap to keep track of which parents
are allowed. Any operation that would select a parent clock not on the
whitelist should fail. Automatic reparenting should only select from
clocks on the whitelist. And we need new DT bindings for controlling
the whitelist, for example:

    clock-parents-0 = <&clk1>, <&pll_c>;
    clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;

This means that clk1 can only have pll_c as a parent, while clk2 can
have pll_a or pll_b as parents. By default every clock will be able
to use any parent, so a list is only needed if the machine needs a
more restrictive policy.

assigned-clock-parents should disable automatic reparenting, but allow
explicit clk_set_parent(). This will allow clock drivers to start doing
reparenting without breaking old DTs.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-23 15:35                   ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2023-03-23 15:35 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Maxime Ripard, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea


Stephen Boyd <sboyd@kernel.org> writes:

> Quoting Maxime Ripard (2022-11-09 03:00:45)
>> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
>> >
>> > Maxime Ripard <maxime@cerno.tech> writes:
>> >
>> > > Hi,
>> > >
>> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>> >
>> > Assigning the parent clock in the DT works once, at boot, but going off
>> > what you wrote in the commit message, if the clock driver has a
>> > .determine_rate() implementation that *can* reparent clocks then it
>> > probably *will* reparent them, and the DT assignment will be lost.
>>
>> Yes, indeed, but assigned-clock-parents never provided any sort of
>> guarantee on whether or not the clock was allowed to reparent or not.
>> It's just a one-off thing, right before probe, and a clk_set_parent()
>> call at probe will override that just fine.
>>
>> Just like assigned-clock-rates isn't permanent.
>>
>> > What I'm suggesting is a runtime constraint that the clock subsystem
>> > would enforce, and actively prevent drivers from changing the parent.
>> > Either explicitly with clk_set_parent() or due to .determine_rate().
>> >
>> > That way you could write a .determine_rate() implementation that *can*
>> > select a better parent, but if the DT applies a constraint to fix the
>> > clock to a particular parent, the clock subsystem will force that parent
>> > to be used so you can be sure the clock is never reparented by accident.
>>
>> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
>> too far off from this, it's just ignored by clk_set_parent() for now. I
>> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
>> clk_set_parent handle it, and set that flag whenever
>> assigned-clock-parents is set on a clock.
>>
>> It's out of scope for this series though, and I certainly don't want to
>> deal with all the regressions it might create :)
>>
>
> This sounds like a new dt binding that says the assigned parent should
> never change. It sounds sort of like gpio hogs. A clock-hogs binding?

Ideally we want the clock driver to be able to reparent clocks freely
to get the best rate. But we also need some control over that to stop
consumers from being reparented in undesired ways. Eg. you might want
to make sure the GPU gets its own PLL so it can be reclocked easily,
and putting another device on the GPU's PLL could prevent that.

The only way to achieve this today is (1) never do any reparenting in
the clock driver; and (2) use assigned-clock-parents in the DT to set
up the entire clock tree manually.

Maxime said that (2) is basically wrong -- if assigned-clock-parents
provides no guarantee on what the OS does "after boot" then the OS is
pretty much free to ignore it.

My suggestion: add a per-clock bitmap to keep track of which parents
are allowed. Any operation that would select a parent clock not on the
whitelist should fail. Automatic reparenting should only select from
clocks on the whitelist. And we need new DT bindings for controlling
the whitelist, for example:

    clock-parents-0 = <&clk1>, <&pll_c>;
    clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;

This means that clk1 can only have pll_c as a parent, while clk2 can
have pll_a or pll_b as parents. By default every clock will be able
to use any parent, so a list is only needed if the machine needs a
more restrictive policy.

assigned-clock-parents should disable automatic reparenting, but allow
explicit clk_set_parent(). This will allow clock drivers to start doing
reparenting without breaking old DTs.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-23 15:35                   ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2023-03-23 15:35 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Maxime Ripard, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Stephen Boyd <sboyd@kernel.org> writes:

> Quoting Maxime Ripard (2022-11-09 03:00:45)
>> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
>> >
>> > Maxime Ripard <maxime@cerno.tech> writes:
>> >
>> > > Hi,
>> > >
>> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>> >
>> > Assigning the parent clock in the DT works once, at boot, but going off
>> > what you wrote in the commit message, if the clock driver has a
>> > .determine_rate() implementation that *can* reparent clocks then it
>> > probably *will* reparent them, and the DT assignment will be lost.
>>
>> Yes, indeed, but assigned-clock-parents never provided any sort of
>> guarantee on whether or not the clock was allowed to reparent or not.
>> It's just a one-off thing, right before probe, and a clk_set_parent()
>> call at probe will override that just fine.
>>
>> Just like assigned-clock-rates isn't permanent.
>>
>> > What I'm suggesting is a runtime constraint that the clock subsystem
>> > would enforce, and actively prevent drivers from changing the parent.
>> > Either explicitly with clk_set_parent() or due to .determine_rate().
>> >
>> > That way you could write a .determine_rate() implementation that *can*
>> > select a better parent, but if the DT applies a constraint to fix the
>> > clock to a particular parent, the clock subsystem will force that parent
>> > to be used so you can be sure the clock is never reparented by accident.
>>
>> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
>> too far off from this, it's just ignored by clk_set_parent() for now. I
>> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
>> clk_set_parent handle it, and set that flag whenever
>> assigned-clock-parents is set on a clock.
>>
>> It's out of scope for this series though, and I certainly don't want to
>> deal with all the regressions it might create :)
>>
>
> This sounds like a new dt binding that says the assigned parent should
> never change. It sounds sort of like gpio hogs. A clock-hogs binding?

Ideally we want the clock driver to be able to reparent clocks freely
to get the best rate. But we also need some control over that to stop
consumers from being reparented in undesired ways. Eg. you might want
to make sure the GPU gets its own PLL so it can be reclocked easily,
and putting another device on the GPU's PLL could prevent that.

The only way to achieve this today is (1) never do any reparenting in
the clock driver; and (2) use assigned-clock-parents in the DT to set
up the entire clock tree manually.

Maxime said that (2) is basically wrong -- if assigned-clock-parents
provides no guarantee on what the OS does "after boot" then the OS is
pretty much free to ignore it.

My suggestion: add a per-clock bitmap to keep track of which parents
are allowed. Any operation that would select a parent clock not on the
whitelist should fail. Automatic reparenting should only select from
clocks on the whitelist. And we need new DT bindings for controlling
the whitelist, for example:

    clock-parents-0 = <&clk1>, <&pll_c>;
    clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;

This means that clk1 can only have pll_c as a parent, while clk2 can
have pll_a or pll_b as parents. By default every clock will be able
to use any parent, so a list is only needed if the machine needs a
more restrictive policy.

assigned-clock-parents should disable automatic reparenting, but allow
explicit clk_set_parent(). This will allow clock drivers to start doing
reparenting without breaking old DTs.

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-23 15:35                   ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2023-03-23 15:35 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Maxime Ripard, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Stephen Boyd <sboyd@kernel.org> writes:

> Quoting Maxime Ripard (2022-11-09 03:00:45)
>> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
>> >
>> > Maxime Ripard <maxime@cerno.tech> writes:
>> >
>> > > Hi,
>> > >
>> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>> >
>> > Assigning the parent clock in the DT works once, at boot, but going off
>> > what you wrote in the commit message, if the clock driver has a
>> > .determine_rate() implementation that *can* reparent clocks then it
>> > probably *will* reparent them, and the DT assignment will be lost.
>>
>> Yes, indeed, but assigned-clock-parents never provided any sort of
>> guarantee on whether or not the clock was allowed to reparent or not.
>> It's just a one-off thing, right before probe, and a clk_set_parent()
>> call at probe will override that just fine.
>>
>> Just like assigned-clock-rates isn't permanent.
>>
>> > What I'm suggesting is a runtime constraint that the clock subsystem
>> > would enforce, and actively prevent drivers from changing the parent.
>> > Either explicitly with clk_set_parent() or due to .determine_rate().
>> >
>> > That way you could write a .determine_rate() implementation that *can*
>> > select a better parent, but if the DT applies a constraint to fix the
>> > clock to a particular parent, the clock subsystem will force that parent
>> > to be used so you can be sure the clock is never reparented by accident.
>>
>> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
>> too far off from this, it's just ignored by clk_set_parent() for now. I
>> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
>> clk_set_parent handle it, and set that flag whenever
>> assigned-clock-parents is set on a clock.
>>
>> It's out of scope for this series though, and I certainly don't want to
>> deal with all the regressions it might create :)
>>
>
> This sounds like a new dt binding that says the assigned parent should
> never change. It sounds sort of like gpio hogs. A clock-hogs binding?

Ideally we want the clock driver to be able to reparent clocks freely
to get the best rate. But we also need some control over that to stop
consumers from being reparented in undesired ways. Eg. you might want
to make sure the GPU gets its own PLL so it can be reclocked easily,
and putting another device on the GPU's PLL could prevent that.

The only way to achieve this today is (1) never do any reparenting in
the clock driver; and (2) use assigned-clock-parents in the DT to set
up the entire clock tree manually.

Maxime said that (2) is basically wrong -- if assigned-clock-parents
provides no guarantee on what the OS does "after boot" then the OS is
pretty much free to ignore it.

My suggestion: add a per-clock bitmap to keep track of which parents
are allowed. Any operation that would select a parent clock not on the
whitelist should fail. Automatic reparenting should only select from
clocks on the whitelist. And we need new DT bindings for controlling
the whitelist, for example:

    clock-parents-0 = <&clk1>, <&pll_c>;
    clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;

This means that clk1 can only have pll_c as a parent, while clk2 can
have pll_a or pll_b as parents. By default every clock will be able
to use any parent, so a list is only needed if the machine needs a
more restrictive policy.

assigned-clock-parents should disable automatic reparenting, but allow
explicit clk_set_parent(). This will allow clock drivers to start doing
reparenting without breaking old DTs.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2023-03-23 15:35                   ` Aidan MacDonald
  (?)
  (?)
@ 2023-03-24 11:19                     ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-24 11:19 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 4343 bytes --]

Hi,

On Thu, Mar 23, 2023 at 03:35:30PM +0000, Aidan MacDonald wrote:
> 
> Stephen Boyd <sboyd@kernel.org> writes:
> 
> > Quoting Maxime Ripard (2022-11-09 03:00:45)
> >> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> >> >
> >> > Maxime Ripard <maxime@cerno.tech> writes:
> >> >
> >> > > Hi,
> >> > >
> >> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> >> >
> >> > Assigning the parent clock in the DT works once, at boot, but going off
> >> > what you wrote in the commit message, if the clock driver has a
> >> > .determine_rate() implementation that *can* reparent clocks then it
> >> > probably *will* reparent them, and the DT assignment will be lost.
> >>
> >> Yes, indeed, but assigned-clock-parents never provided any sort of
> >> guarantee on whether or not the clock was allowed to reparent or not.
> >> It's just a one-off thing, right before probe, and a clk_set_parent()
> >> call at probe will override that just fine.
> >>
> >> Just like assigned-clock-rates isn't permanent.
> >>
> >> > What I'm suggesting is a runtime constraint that the clock subsystem
> >> > would enforce, and actively prevent drivers from changing the parent.
> >> > Either explicitly with clk_set_parent() or due to .determine_rate().
> >> >
> >> > That way you could write a .determine_rate() implementation that *can*
> >> > select a better parent, but if the DT applies a constraint to fix the
> >> > clock to a particular parent, the clock subsystem will force that parent
> >> > to be used so you can be sure the clock is never reparented by accident.
> >>
> >> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
> >> too far off from this, it's just ignored by clk_set_parent() for now. I
> >> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
> >> clk_set_parent handle it, and set that flag whenever
> >> assigned-clock-parents is set on a clock.
> >>
> >> It's out of scope for this series though, and I certainly don't want to
> >> deal with all the regressions it might create :)
> >>
> >
> > This sounds like a new dt binding that says the assigned parent should
> > never change. It sounds sort of like gpio hogs. A clock-hogs binding?
> 
> Ideally we want the clock driver to be able to reparent clocks freely
> to get the best rate. But we also need some control over that to stop
> consumers from being reparented in undesired ways. Eg. you might want
> to make sure the GPU gets its own PLL so it can be reclocked easily,
> and putting another device on the GPU's PLL could prevent that.
> 
> The only way to achieve this today is (1) never do any reparenting in
> the clock driver; and (2) use assigned-clock-parents in the DT to set
> up the entire clock tree manually.
> 
> Maxime said that (2) is basically wrong -- if assigned-clock-parents
> provides no guarantee on what the OS does "after boot" then the OS is
> pretty much free to ignore it.

I didn't really say it's wrong, just that it never provided the
guarantee you expect it to provide. I can't really say whether it's an
issue or not on your platform.

It's mostly unrelated to this series though, none of these patches
affect that behavior in one way or the other.

> My suggestion: add a per-clock bitmap to keep track of which parents
> are allowed. Any operation that would select a parent clock not on the
> whitelist should fail. Automatic reparenting should only select from
> clocks on the whitelist. And we need new DT bindings for controlling
> the whitelist, for example:
> 
>     clock-parents-0 = <&clk1>, <&pll_c>;
>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> 
> This means that clk1 can only have pll_c as a parent, while clk2 can
> have pll_a or pll_b as parents. By default every clock will be able
> to use any parent, so a list is only needed if the machine needs a
> more restrictive policy.
> 
> assigned-clock-parents should disable automatic reparenting, but allow
> explicit clk_set_parent(). This will allow clock drivers to start doing
> reparenting without breaking old DTs.

I'm generally not a fan of putting all these policies in the device
tree. Do you have an example where it wouldn't be possible to do exactly
this from the driver itself?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-24 11:19                     ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-24 11:19 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 4343 bytes --]

Hi,

On Thu, Mar 23, 2023 at 03:35:30PM +0000, Aidan MacDonald wrote:
> 
> Stephen Boyd <sboyd@kernel.org> writes:
> 
> > Quoting Maxime Ripard (2022-11-09 03:00:45)
> >> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> >> >
> >> > Maxime Ripard <maxime@cerno.tech> writes:
> >> >
> >> > > Hi,
> >> > >
> >> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> >> >
> >> > Assigning the parent clock in the DT works once, at boot, but going off
> >> > what you wrote in the commit message, if the clock driver has a
> >> > .determine_rate() implementation that *can* reparent clocks then it
> >> > probably *will* reparent them, and the DT assignment will be lost.
> >>
> >> Yes, indeed, but assigned-clock-parents never provided any sort of
> >> guarantee on whether or not the clock was allowed to reparent or not.
> >> It's just a one-off thing, right before probe, and a clk_set_parent()
> >> call at probe will override that just fine.
> >>
> >> Just like assigned-clock-rates isn't permanent.
> >>
> >> > What I'm suggesting is a runtime constraint that the clock subsystem
> >> > would enforce, and actively prevent drivers from changing the parent.
> >> > Either explicitly with clk_set_parent() or due to .determine_rate().
> >> >
> >> > That way you could write a .determine_rate() implementation that *can*
> >> > select a better parent, but if the DT applies a constraint to fix the
> >> > clock to a particular parent, the clock subsystem will force that parent
> >> > to be used so you can be sure the clock is never reparented by accident.
> >>
> >> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
> >> too far off from this, it's just ignored by clk_set_parent() for now. I
> >> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
> >> clk_set_parent handle it, and set that flag whenever
> >> assigned-clock-parents is set on a clock.
> >>
> >> It's out of scope for this series though, and I certainly don't want to
> >> deal with all the regressions it might create :)
> >>
> >
> > This sounds like a new dt binding that says the assigned parent should
> > never change. It sounds sort of like gpio hogs. A clock-hogs binding?
> 
> Ideally we want the clock driver to be able to reparent clocks freely
> to get the best rate. But we also need some control over that to stop
> consumers from being reparented in undesired ways. Eg. you might want
> to make sure the GPU gets its own PLL so it can be reclocked easily,
> and putting another device on the GPU's PLL could prevent that.
> 
> The only way to achieve this today is (1) never do any reparenting in
> the clock driver; and (2) use assigned-clock-parents in the DT to set
> up the entire clock tree manually.
> 
> Maxime said that (2) is basically wrong -- if assigned-clock-parents
> provides no guarantee on what the OS does "after boot" then the OS is
> pretty much free to ignore it.

I didn't really say it's wrong, just that it never provided the
guarantee you expect it to provide. I can't really say whether it's an
issue or not on your platform.

It's mostly unrelated to this series though, none of these patches
affect that behavior in one way or the other.

> My suggestion: add a per-clock bitmap to keep track of which parents
> are allowed. Any operation that would select a parent clock not on the
> whitelist should fail. Automatic reparenting should only select from
> clocks on the whitelist. And we need new DT bindings for controlling
> the whitelist, for example:
> 
>     clock-parents-0 = <&clk1>, <&pll_c>;
>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> 
> This means that clk1 can only have pll_c as a parent, while clk2 can
> have pll_a or pll_b as parents. By default every clock will be able
> to use any parent, so a list is only needed if the machine needs a
> more restrictive policy.
> 
> assigned-clock-parents should disable automatic reparenting, but allow
> explicit clk_set_parent(). This will allow clock drivers to start doing
> reparenting without breaking old DTs.

I'm generally not a fan of putting all these policies in the device
tree. Do you have an example where it wouldn't be possible to do exactly
this from the driver itself?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-24 11:19                     ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-24 11:19 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 4343 bytes --]

Hi,

On Thu, Mar 23, 2023 at 03:35:30PM +0000, Aidan MacDonald wrote:
> 
> Stephen Boyd <sboyd@kernel.org> writes:
> 
> > Quoting Maxime Ripard (2022-11-09 03:00:45)
> >> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> >> >
> >> > Maxime Ripard <maxime@cerno.tech> writes:
> >> >
> >> > > Hi,
> >> > >
> >> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> >> >
> >> > Assigning the parent clock in the DT works once, at boot, but going off
> >> > what you wrote in the commit message, if the clock driver has a
> >> > .determine_rate() implementation that *can* reparent clocks then it
> >> > probably *will* reparent them, and the DT assignment will be lost.
> >>
> >> Yes, indeed, but assigned-clock-parents never provided any sort of
> >> guarantee on whether or not the clock was allowed to reparent or not.
> >> It's just a one-off thing, right before probe, and a clk_set_parent()
> >> call at probe will override that just fine.
> >>
> >> Just like assigned-clock-rates isn't permanent.
> >>
> >> > What I'm suggesting is a runtime constraint that the clock subsystem
> >> > would enforce, and actively prevent drivers from changing the parent.
> >> > Either explicitly with clk_set_parent() or due to .determine_rate().
> >> >
> >> > That way you could write a .determine_rate() implementation that *can*
> >> > select a better parent, but if the DT applies a constraint to fix the
> >> > clock to a particular parent, the clock subsystem will force that parent
> >> > to be used so you can be sure the clock is never reparented by accident.
> >>
> >> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
> >> too far off from this, it's just ignored by clk_set_parent() for now. I
> >> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
> >> clk_set_parent handle it, and set that flag whenever
> >> assigned-clock-parents is set on a clock.
> >>
> >> It's out of scope for this series though, and I certainly don't want to
> >> deal with all the regressions it might create :)
> >>
> >
> > This sounds like a new dt binding that says the assigned parent should
> > never change. It sounds sort of like gpio hogs. A clock-hogs binding?
> 
> Ideally we want the clock driver to be able to reparent clocks freely
> to get the best rate. But we also need some control over that to stop
> consumers from being reparented in undesired ways. Eg. you might want
> to make sure the GPU gets its own PLL so it can be reclocked easily,
> and putting another device on the GPU's PLL could prevent that.
> 
> The only way to achieve this today is (1) never do any reparenting in
> the clock driver; and (2) use assigned-clock-parents in the DT to set
> up the entire clock tree manually.
> 
> Maxime said that (2) is basically wrong -- if assigned-clock-parents
> provides no guarantee on what the OS does "after boot" then the OS is
> pretty much free to ignore it.

I didn't really say it's wrong, just that it never provided the
guarantee you expect it to provide. I can't really say whether it's an
issue or not on your platform.

It's mostly unrelated to this series though, none of these patches
affect that behavior in one way or the other.

> My suggestion: add a per-clock bitmap to keep track of which parents
> are allowed. Any operation that would select a parent clock not on the
> whitelist should fail. Automatic reparenting should only select from
> clocks on the whitelist. And we need new DT bindings for controlling
> the whitelist, for example:
> 
>     clock-parents-0 = <&clk1>, <&pll_c>;
>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> 
> This means that clk1 can only have pll_c as a parent, while clk2 can
> have pll_a or pll_b as parents. By default every clock will be able
> to use any parent, so a list is only needed if the machine needs a
> more restrictive policy.
> 
> assigned-clock-parents should disable automatic reparenting, but allow
> explicit clk_set_parent(). This will allow clock drivers to start doing
> reparenting without breaking old DTs.

I'm generally not a fan of putting all these policies in the device
tree. Do you have an example where it wouldn't be possible to do exactly
this from the driver itself?

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-24 11:19                     ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-24 11:19 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 4343 bytes --]

Hi,

On Thu, Mar 23, 2023 at 03:35:30PM +0000, Aidan MacDonald wrote:
> 
> Stephen Boyd <sboyd@kernel.org> writes:
> 
> > Quoting Maxime Ripard (2022-11-09 03:00:45)
> >> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
> >> >
> >> > Maxime Ripard <maxime@cerno.tech> writes:
> >> >
> >> > > Hi,
> >> > >
> >> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
> >> >
> >> > Assigning the parent clock in the DT works once, at boot, but going off
> >> > what you wrote in the commit message, if the clock driver has a
> >> > .determine_rate() implementation that *can* reparent clocks then it
> >> > probably *will* reparent them, and the DT assignment will be lost.
> >>
> >> Yes, indeed, but assigned-clock-parents never provided any sort of
> >> guarantee on whether or not the clock was allowed to reparent or not.
> >> It's just a one-off thing, right before probe, and a clk_set_parent()
> >> call at probe will override that just fine.
> >>
> >> Just like assigned-clock-rates isn't permanent.
> >>
> >> > What I'm suggesting is a runtime constraint that the clock subsystem
> >> > would enforce, and actively prevent drivers from changing the parent.
> >> > Either explicitly with clk_set_parent() or due to .determine_rate().
> >> >
> >> > That way you could write a .determine_rate() implementation that *can*
> >> > select a better parent, but if the DT applies a constraint to fix the
> >> > clock to a particular parent, the clock subsystem will force that parent
> >> > to be used so you can be sure the clock is never reparented by accident.
> >>
> >> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
> >> too far off from this, it's just ignored by clk_set_parent() for now. I
> >> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
> >> clk_set_parent handle it, and set that flag whenever
> >> assigned-clock-parents is set on a clock.
> >>
> >> It's out of scope for this series though, and I certainly don't want to
> >> deal with all the regressions it might create :)
> >>
> >
> > This sounds like a new dt binding that says the assigned parent should
> > never change. It sounds sort of like gpio hogs. A clock-hogs binding?
> 
> Ideally we want the clock driver to be able to reparent clocks freely
> to get the best rate. But we also need some control over that to stop
> consumers from being reparented in undesired ways. Eg. you might want
> to make sure the GPU gets its own PLL so it can be reclocked easily,
> and putting another device on the GPU's PLL could prevent that.
> 
> The only way to achieve this today is (1) never do any reparenting in
> the clock driver; and (2) use assigned-clock-parents in the DT to set
> up the entire clock tree manually.
> 
> Maxime said that (2) is basically wrong -- if assigned-clock-parents
> provides no guarantee on what the OS does "after boot" then the OS is
> pretty much free to ignore it.

I didn't really say it's wrong, just that it never provided the
guarantee you expect it to provide. I can't really say whether it's an
issue or not on your platform.

It's mostly unrelated to this series though, none of these patches
affect that behavior in one way or the other.

> My suggestion: add a per-clock bitmap to keep track of which parents
> are allowed. Any operation that would select a parent clock not on the
> whitelist should fail. Automatic reparenting should only select from
> clocks on the whitelist. And we need new DT bindings for controlling
> the whitelist, for example:
> 
>     clock-parents-0 = <&clk1>, <&pll_c>;
>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> 
> This means that clk1 can only have pll_c as a parent, while clk2 can
> have pll_a or pll_b as parents. By default every clock will be able
> to use any parent, so a list is only needed if the machine needs a
> more restrictive policy.
> 
> assigned-clock-parents should disable automatic reparenting, but allow
> explicit clk_set_parent(). This will allow clock drivers to start doing
> reparenting without breaking old DTs.

I'm generally not a fan of putting all these policies in the device
tree. Do you have an example where it wouldn't be possible to do exactly
this from the driver itself?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2023-03-24 11:19                     ` Maxime Ripard
  (?)
  (?)
@ 2023-03-24 20:58                       ` Aidan MacDonald
  -1 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2023-03-24 20:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea


Maxime Ripard <maxime@cerno.tech> writes:

> On Thu, Mar 23, 2023 at 03:35:30PM +0000, Aidan MacDonald wrote:
>>
>> Stephen Boyd <sboyd@kernel.org> writes:
>>
>> > Quoting Maxime Ripard (2022-11-09 03:00:45)
>> >> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
>> >> >
>> >> > Maxime Ripard <maxime@cerno.tech> writes:
>> >> >
>> >> > > Hi,
>> >> > >
>> >> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>> >> >
>> >> > Assigning the parent clock in the DT works once, at boot, but going off
>> >> > what you wrote in the commit message, if the clock driver has a
>> >> > .determine_rate() implementation that *can* reparent clocks then it
>> >> > probably *will* reparent them, and the DT assignment will be lost.
>> >>
>> >> Yes, indeed, but assigned-clock-parents never provided any sort of
>> >> guarantee on whether or not the clock was allowed to reparent or not.
>> >> It's just a one-off thing, right before probe, and a clk_set_parent()
>> >> call at probe will override that just fine.
>> >>
>> >> Just like assigned-clock-rates isn't permanent.
>> >>
>> >> > What I'm suggesting is a runtime constraint that the clock subsystem
>> >> > would enforce, and actively prevent drivers from changing the parent.
>> >> > Either explicitly with clk_set_parent() or due to .determine_rate().
>> >> >
>> >> > That way you could write a .determine_rate() implementation that *can*
>> >> > select a better parent, but if the DT applies a constraint to fix the
>> >> > clock to a particular parent, the clock subsystem will force that parent
>> >> > to be used so you can be sure the clock is never reparented by accident.
>> >>
>> >> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
>> >> too far off from this, it's just ignored by clk_set_parent() for now. I
>> >> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
>> >> clk_set_parent handle it, and set that flag whenever
>> >> assigned-clock-parents is set on a clock.
>> >>
>> >> It's out of scope for this series though, and I certainly don't want to
>> >> deal with all the regressions it might create :)
>> >>
>> >
>> > This sounds like a new dt binding that says the assigned parent should
>> > never change. It sounds sort of like gpio hogs. A clock-hogs binding?
>>
>> Ideally we want the clock driver to be able to reparent clocks freely
>> to get the best rate. But we also need some control over that to stop
>> consumers from being reparented in undesired ways. Eg. you might want
>> to make sure the GPU gets its own PLL so it can be reclocked easily,
>> and putting another device on the GPU's PLL could prevent that.
>>
>> The only way to achieve this today is (1) never do any reparenting in
>> the clock driver; and (2) use assigned-clock-parents in the DT to set
>> up the entire clock tree manually.
>>
>> Maxime said that (2) is basically wrong -- if assigned-clock-parents
>> provides no guarantee on what the OS does "after boot" then the OS is
>> pretty much free to ignore it.
>
> I didn't really say it's wrong, just that it never provided the
> guarantee you expect it to provide. I can't really say whether it's an
> issue or not on your platform.
>
> It's mostly unrelated to this series though, none of these patches
> affect that behavior in one way or the other.

I know. Sorry for derailing your patch :(

>> My suggestion: add a per-clock bitmap to keep track of which parents
>> are allowed. Any operation that would select a parent clock not on the
>> whitelist should fail. Automatic reparenting should only select from
>> clocks on the whitelist. And we need new DT bindings for controlling
>> the whitelist, for example:
>>
>>     clock-parents-0 = <&clk1>, <&pll_c>;
>>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
>>
>> This means that clk1 can only have pll_c as a parent, while clk2 can
>> have pll_a or pll_b as parents. By default every clock will be able
>> to use any parent, so a list is only needed if the machine needs a
>> more restrictive policy.
>>
>> assigned-clock-parents should disable automatic reparenting, but allow
>> explicit clk_set_parent(). This will allow clock drivers to start doing
>> reparenting without breaking old DTs.
>
> I'm generally not a fan of putting all these policies in the device
> tree. Do you have an example where it wouldn't be possible to do exactly
> this from the driver itself?
>
> Maxime

I'm confused. What's implicit in the example is clk1 and clk2 might
have *other* possible choices of parent clock and the device tree is
limiting what the OS is allowed to choose.

Why would you put such arbitrary limitations into the driver? They
would be different from machine to machine, unless the clock tree is
so simple there is only *one* meaningful way to configure it. Most
SoCs are complicated enough that there will be tradeoffs depending
on what peripherals you are using (typically a single machine will
not use *every* peripheral device provided by the SoC).

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-24 20:58                       ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2023-03-24 20:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Maxime Ripard <maxime@cerno.tech> writes:

> On Thu, Mar 23, 2023 at 03:35:30PM +0000, Aidan MacDonald wrote:
>>
>> Stephen Boyd <sboyd@kernel.org> writes:
>>
>> > Quoting Maxime Ripard (2022-11-09 03:00:45)
>> >> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
>> >> >
>> >> > Maxime Ripard <maxime@cerno.tech> writes:
>> >> >
>> >> > > Hi,
>> >> > >
>> >> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>> >> >
>> >> > Assigning the parent clock in the DT works once, at boot, but going off
>> >> > what you wrote in the commit message, if the clock driver has a
>> >> > .determine_rate() implementation that *can* reparent clocks then it
>> >> > probably *will* reparent them, and the DT assignment will be lost.
>> >>
>> >> Yes, indeed, but assigned-clock-parents never provided any sort of
>> >> guarantee on whether or not the clock was allowed to reparent or not.
>> >> It's just a one-off thing, right before probe, and a clk_set_parent()
>> >> call at probe will override that just fine.
>> >>
>> >> Just like assigned-clock-rates isn't permanent.
>> >>
>> >> > What I'm suggesting is a runtime constraint that the clock subsystem
>> >> > would enforce, and actively prevent drivers from changing the parent.
>> >> > Either explicitly with clk_set_parent() or due to .determine_rate().
>> >> >
>> >> > That way you could write a .determine_rate() implementation that *can*
>> >> > select a better parent, but if the DT applies a constraint to fix the
>> >> > clock to a particular parent, the clock subsystem will force that parent
>> >> > to be used so you can be sure the clock is never reparented by accident.
>> >>
>> >> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
>> >> too far off from this, it's just ignored by clk_set_parent() for now. I
>> >> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
>> >> clk_set_parent handle it, and set that flag whenever
>> >> assigned-clock-parents is set on a clock.
>> >>
>> >> It's out of scope for this series though, and I certainly don't want to
>> >> deal with all the regressions it might create :)
>> >>
>> >
>> > This sounds like a new dt binding that says the assigned parent should
>> > never change. It sounds sort of like gpio hogs. A clock-hogs binding?
>>
>> Ideally we want the clock driver to be able to reparent clocks freely
>> to get the best rate. But we also need some control over that to stop
>> consumers from being reparented in undesired ways. Eg. you might want
>> to make sure the GPU gets its own PLL so it can be reclocked easily,
>> and putting another device on the GPU's PLL could prevent that.
>>
>> The only way to achieve this today is (1) never do any reparenting in
>> the clock driver; and (2) use assigned-clock-parents in the DT to set
>> up the entire clock tree manually.
>>
>> Maxime said that (2) is basically wrong -- if assigned-clock-parents
>> provides no guarantee on what the OS does "after boot" then the OS is
>> pretty much free to ignore it.
>
> I didn't really say it's wrong, just that it never provided the
> guarantee you expect it to provide. I can't really say whether it's an
> issue or not on your platform.
>
> It's mostly unrelated to this series though, none of these patches
> affect that behavior in one way or the other.

I know. Sorry for derailing your patch :(

>> My suggestion: add a per-clock bitmap to keep track of which parents
>> are allowed. Any operation that would select a parent clock not on the
>> whitelist should fail. Automatic reparenting should only select from
>> clocks on the whitelist. And we need new DT bindings for controlling
>> the whitelist, for example:
>>
>>     clock-parents-0 = <&clk1>, <&pll_c>;
>>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
>>
>> This means that clk1 can only have pll_c as a parent, while clk2 can
>> have pll_a or pll_b as parents. By default every clock will be able
>> to use any parent, so a list is only needed if the machine needs a
>> more restrictive policy.
>>
>> assigned-clock-parents should disable automatic reparenting, but allow
>> explicit clk_set_parent(). This will allow clock drivers to start doing
>> reparenting without breaking old DTs.
>
> I'm generally not a fan of putting all these policies in the device
> tree. Do you have an example where it wouldn't be possible to do exactly
> this from the driver itself?
>
> Maxime

I'm confused. What's implicit in the example is clk1 and clk2 might
have *other* possible choices of parent clock and the device tree is
limiting what the OS is allowed to choose.

Why would you put such arbitrary limitations into the driver? They
would be different from machine to machine, unless the clock tree is
so simple there is only *one* meaningful way to configure it. Most
SoCs are complicated enough that there will be tradeoffs depending
on what peripherals you are using (typically a single machine will
not use *every* peripheral device provided by the SoC).

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-24 20:58                       ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2023-03-24 20:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Maxime Ripard <maxime@cerno.tech> writes:

> On Thu, Mar 23, 2023 at 03:35:30PM +0000, Aidan MacDonald wrote:
>>
>> Stephen Boyd <sboyd@kernel.org> writes:
>>
>> > Quoting Maxime Ripard (2022-11-09 03:00:45)
>> >> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
>> >> >
>> >> > Maxime Ripard <maxime@cerno.tech> writes:
>> >> >
>> >> > > Hi,
>> >> > >
>> >> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>> >> >
>> >> > Assigning the parent clock in the DT works once, at boot, but going off
>> >> > what you wrote in the commit message, if the clock driver has a
>> >> > .determine_rate() implementation that *can* reparent clocks then it
>> >> > probably *will* reparent them, and the DT assignment will be lost.
>> >>
>> >> Yes, indeed, but assigned-clock-parents never provided any sort of
>> >> guarantee on whether or not the clock was allowed to reparent or not.
>> >> It's just a one-off thing, right before probe, and a clk_set_parent()
>> >> call at probe will override that just fine.
>> >>
>> >> Just like assigned-clock-rates isn't permanent.
>> >>
>> >> > What I'm suggesting is a runtime constraint that the clock subsystem
>> >> > would enforce, and actively prevent drivers from changing the parent.
>> >> > Either explicitly with clk_set_parent() or due to .determine_rate().
>> >> >
>> >> > That way you could write a .determine_rate() implementation that *can*
>> >> > select a better parent, but if the DT applies a constraint to fix the
>> >> > clock to a particular parent, the clock subsystem will force that parent
>> >> > to be used so you can be sure the clock is never reparented by accident.
>> >>
>> >> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
>> >> too far off from this, it's just ignored by clk_set_parent() for now. I
>> >> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
>> >> clk_set_parent handle it, and set that flag whenever
>> >> assigned-clock-parents is set on a clock.
>> >>
>> >> It's out of scope for this series though, and I certainly don't want to
>> >> deal with all the regressions it might create :)
>> >>
>> >
>> > This sounds like a new dt binding that says the assigned parent should
>> > never change. It sounds sort of like gpio hogs. A clock-hogs binding?
>>
>> Ideally we want the clock driver to be able to reparent clocks freely
>> to get the best rate. But we also need some control over that to stop
>> consumers from being reparented in undesired ways. Eg. you might want
>> to make sure the GPU gets its own PLL so it can be reclocked easily,
>> and putting another device on the GPU's PLL could prevent that.
>>
>> The only way to achieve this today is (1) never do any reparenting in
>> the clock driver; and (2) use assigned-clock-parents in the DT to set
>> up the entire clock tree manually.
>>
>> Maxime said that (2) is basically wrong -- if assigned-clock-parents
>> provides no guarantee on what the OS does "after boot" then the OS is
>> pretty much free to ignore it.
>
> I didn't really say it's wrong, just that it never provided the
> guarantee you expect it to provide. I can't really say whether it's an
> issue or not on your platform.
>
> It's mostly unrelated to this series though, none of these patches
> affect that behavior in one way or the other.

I know. Sorry for derailing your patch :(

>> My suggestion: add a per-clock bitmap to keep track of which parents
>> are allowed. Any operation that would select a parent clock not on the
>> whitelist should fail. Automatic reparenting should only select from
>> clocks on the whitelist. And we need new DT bindings for controlling
>> the whitelist, for example:
>>
>>     clock-parents-0 = <&clk1>, <&pll_c>;
>>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
>>
>> This means that clk1 can only have pll_c as a parent, while clk2 can
>> have pll_a or pll_b as parents. By default every clock will be able
>> to use any parent, so a list is only needed if the machine needs a
>> more restrictive policy.
>>
>> assigned-clock-parents should disable automatic reparenting, but allow
>> explicit clk_set_parent(). This will allow clock drivers to start doing
>> reparenting without breaking old DTs.
>
> I'm generally not a fan of putting all these policies in the device
> tree. Do you have an example where it wouldn't be possible to do exactly
> this from the driver itself?
>
> Maxime

I'm confused. What's implicit in the example is clk1 and clk2 might
have *other* possible choices of parent clock and the device tree is
limiting what the OS is allowed to choose.

Why would you put such arbitrary limitations into the driver? They
would be different from machine to machine, unless the clock tree is
so simple there is only *one* meaningful way to configure it. Most
SoCs are complicated enough that there will be tradeoffs depending
on what peripherals you are using (typically a single machine will
not use *every* peripheral device provided by the SoC).

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-24 20:58                       ` Aidan MacDonald
  0 siblings, 0 replies; 388+ messages in thread
From: Aidan MacDonald @ 2023-03-24 20:58 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


Maxime Ripard <maxime@cerno.tech> writes:

> On Thu, Mar 23, 2023 at 03:35:30PM +0000, Aidan MacDonald wrote:
>>
>> Stephen Boyd <sboyd@kernel.org> writes:
>>
>> > Quoting Maxime Ripard (2022-11-09 03:00:45)
>> >> On Mon, Nov 07, 2022 at 08:57:22PM +0000, Aidan MacDonald wrote:
>> >> >
>> >> > Maxime Ripard <maxime@cerno.tech> writes:
>> >> >
>> >> > > Hi,
>> >> > >
>> >> > > On Fri, Nov 04, 2022 at 05:35:29PM +0000, Aidan MacDonald wrote:
>> >> >
>> >> > Assigning the parent clock in the DT works once, at boot, but going off
>> >> > what you wrote in the commit message, if the clock driver has a
>> >> > .determine_rate() implementation that *can* reparent clocks then it
>> >> > probably *will* reparent them, and the DT assignment will be lost.
>> >>
>> >> Yes, indeed, but assigned-clock-parents never provided any sort of
>> >> guarantee on whether or not the clock was allowed to reparent or not.
>> >> It's just a one-off thing, right before probe, and a clk_set_parent()
>> >> call at probe will override that just fine.
>> >>
>> >> Just like assigned-clock-rates isn't permanent.
>> >>
>> >> > What I'm suggesting is a runtime constraint that the clock subsystem
>> >> > would enforce, and actively prevent drivers from changing the parent.
>> >> > Either explicitly with clk_set_parent() or due to .determine_rate().
>> >> >
>> >> > That way you could write a .determine_rate() implementation that *can*
>> >> > select a better parent, but if the DT applies a constraint to fix the
>> >> > clock to a particular parent, the clock subsystem will force that parent
>> >> > to be used so you can be sure the clock is never reparented by accident.
>> >>
>> >> Yeah, that sounds like a good idea, and CLK_SET_RATE_NO_REPARENT isn't
>> >> too far off from this, it's just ignored by clk_set_parent() for now. I
>> >> guess we could rename CLK_SET_RATE_NO_REPARENT to CLK_NO_REPARENT, make
>> >> clk_set_parent handle it, and set that flag whenever
>> >> assigned-clock-parents is set on a clock.
>> >>
>> >> It's out of scope for this series though, and I certainly don't want to
>> >> deal with all the regressions it might create :)
>> >>
>> >
>> > This sounds like a new dt binding that says the assigned parent should
>> > never change. It sounds sort of like gpio hogs. A clock-hogs binding?
>>
>> Ideally we want the clock driver to be able to reparent clocks freely
>> to get the best rate. But we also need some control over that to stop
>> consumers from being reparented in undesired ways. Eg. you might want
>> to make sure the GPU gets its own PLL so it can be reclocked easily,
>> and putting another device on the GPU's PLL could prevent that.
>>
>> The only way to achieve this today is (1) never do any reparenting in
>> the clock driver; and (2) use assigned-clock-parents in the DT to set
>> up the entire clock tree manually.
>>
>> Maxime said that (2) is basically wrong -- if assigned-clock-parents
>> provides no guarantee on what the OS does "after boot" then the OS is
>> pretty much free to ignore it.
>
> I didn't really say it's wrong, just that it never provided the
> guarantee you expect it to provide. I can't really say whether it's an
> issue or not on your platform.
>
> It's mostly unrelated to this series though, none of these patches
> affect that behavior in one way or the other.

I know. Sorry for derailing your patch :(

>> My suggestion: add a per-clock bitmap to keep track of which parents
>> are allowed. Any operation that would select a parent clock not on the
>> whitelist should fail. Automatic reparenting should only select from
>> clocks on the whitelist. And we need new DT bindings for controlling
>> the whitelist, for example:
>>
>>     clock-parents-0 = <&clk1>, <&pll_c>;
>>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
>>
>> This means that clk1 can only have pll_c as a parent, while clk2 can
>> have pll_a or pll_b as parents. By default every clock will be able
>> to use any parent, so a list is only needed if the machine needs a
>> more restrictive policy.
>>
>> assigned-clock-parents should disable automatic reparenting, but allow
>> explicit clk_set_parent(). This will allow clock drivers to start doing
>> reparenting without breaking old DTs.
>
> I'm generally not a fan of putting all these policies in the device
> tree. Do you have an example where it wouldn't be possible to do exactly
> this from the driver itself?
>
> Maxime

I'm confused. What's implicit in the example is clk1 and clk2 might
have *other* possible choices of parent clock and the device tree is
limiting what the OS is allowed to choose.

Why would you put such arbitrary limitations into the driver? They
would be different from machine to machine, unless the clock tree is
so simple there is only *one* meaningful way to configure it. Most
SoCs are complicated enough that there will be tradeoffs depending
on what peripherals you are using (typically a single machine will
not use *every* peripheral device provided by the SoC).

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2023-03-24 20:58                       ` Aidan MacDonald
  (?)
  (?)
@ 2023-03-27 19:24                         ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-27 19:24 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> >> My suggestion: add a per-clock bitmap to keep track of which parents
> >> are allowed. Any operation that would select a parent clock not on the
> >> whitelist should fail. Automatic reparenting should only select from
> >> clocks on the whitelist. And we need new DT bindings for controlling
> >> the whitelist, for example:
> >>
> >>     clock-parents-0 = <&clk1>, <&pll_c>;
> >>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> >>
> >> This means that clk1 can only have pll_c as a parent, while clk2 can
> >> have pll_a or pll_b as parents. By default every clock will be able
> >> to use any parent, so a list is only needed if the machine needs a
> >> more restrictive policy.
> >>
> >> assigned-clock-parents should disable automatic reparenting, but allow
> >> explicit clk_set_parent(). This will allow clock drivers to start doing
> >> reparenting without breaking old DTs.
> >
> > I'm generally not a fan of putting all these policies in the device
> > tree. Do you have an example where it wouldn't be possible to do exactly
> > this from the driver itself?
> 
> I'm confused. What's implicit in the example is clk1 and clk2 might
> have *other* possible choices of parent clock and the device tree is
> limiting what the OS is allowed to choose.
>
> Why would you put such arbitrary limitations into the driver?

Why would we put such arbitrary limitations in the firmware? As this
entire thread can attest, people are already using the device tree to
work around the limitations of the Linux driver, or reduce the
features of Linux because they can rely on the device tree. Either
way, it's linked to the state of the Linux driver, and any other OS or
Linux version could very well implement something more dynamic.

> They would be different from machine to machine, unless the clock
> tree is so simple there is only *one* meaningful way to configure
> it.

If we look at the device trees we have in-tree, most of the users of
assigned-clocks are the same from one board to another.

> Most SoCs are complicated enough that there will be tradeoffs
> depending on what peripherals you are using (typically a single
> machine will not use *every* peripheral device provided by the SoC).

We already have APIs to lock parents or rates on a given clock from
the consumer. It's far superior (feature-wise) than what the device
tree will ever offer because it's code, and it depends on the usage
already since an unused driver won't probe.

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-27 19:24                         ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-27 19:24 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> >> My suggestion: add a per-clock bitmap to keep track of which parents
> >> are allowed. Any operation that would select a parent clock not on the
> >> whitelist should fail. Automatic reparenting should only select from
> >> clocks on the whitelist. And we need new DT bindings for controlling
> >> the whitelist, for example:
> >>
> >>     clock-parents-0 = <&clk1>, <&pll_c>;
> >>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> >>
> >> This means that clk1 can only have pll_c as a parent, while clk2 can
> >> have pll_a or pll_b as parents. By default every clock will be able
> >> to use any parent, so a list is only needed if the machine needs a
> >> more restrictive policy.
> >>
> >> assigned-clock-parents should disable automatic reparenting, but allow
> >> explicit clk_set_parent(). This will allow clock drivers to start doing
> >> reparenting without breaking old DTs.
> >
> > I'm generally not a fan of putting all these policies in the device
> > tree. Do you have an example where it wouldn't be possible to do exactly
> > this from the driver itself?
> 
> I'm confused. What's implicit in the example is clk1 and clk2 might
> have *other* possible choices of parent clock and the device tree is
> limiting what the OS is allowed to choose.
>
> Why would you put such arbitrary limitations into the driver?

Why would we put such arbitrary limitations in the firmware? As this
entire thread can attest, people are already using the device tree to
work around the limitations of the Linux driver, or reduce the
features of Linux because they can rely on the device tree. Either
way, it's linked to the state of the Linux driver, and any other OS or
Linux version could very well implement something more dynamic.

> They would be different from machine to machine, unless the clock
> tree is so simple there is only *one* meaningful way to configure
> it.

If we look at the device trees we have in-tree, most of the users of
assigned-clocks are the same from one board to another.

> Most SoCs are complicated enough that there will be tradeoffs
> depending on what peripherals you are using (typically a single
> machine will not use *every* peripheral device provided by the SoC).

We already have APIs to lock parents or rates on a given clock from
the consumer. It's far superior (feature-wise) than what the device
tree will ever offer because it's code, and it depends on the usage
already since an unused driver won't probe.

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-27 19:24                         ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-27 19:24 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> >> My suggestion: add a per-clock bitmap to keep track of which parents
> >> are allowed. Any operation that would select a parent clock not on the
> >> whitelist should fail. Automatic reparenting should only select from
> >> clocks on the whitelist. And we need new DT bindings for controlling
> >> the whitelist, for example:
> >>
> >>     clock-parents-0 = <&clk1>, <&pll_c>;
> >>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> >>
> >> This means that clk1 can only have pll_c as a parent, while clk2 can
> >> have pll_a or pll_b as parents. By default every clock will be able
> >> to use any parent, so a list is only needed if the machine needs a
> >> more restrictive policy.
> >>
> >> assigned-clock-parents should disable automatic reparenting, but allow
> >> explicit clk_set_parent(). This will allow clock drivers to start doing
> >> reparenting without breaking old DTs.
> >
> > I'm generally not a fan of putting all these policies in the device
> > tree. Do you have an example where it wouldn't be possible to do exactly
> > this from the driver itself?
> 
> I'm confused. What's implicit in the example is clk1 and clk2 might
> have *other* possible choices of parent clock and the device tree is
> limiting what the OS is allowed to choose.
>
> Why would you put such arbitrary limitations into the driver?

Why would we put such arbitrary limitations in the firmware? As this
entire thread can attest, people are already using the device tree to
work around the limitations of the Linux driver, or reduce the
features of Linux because they can rely on the device tree. Either
way, it's linked to the state of the Linux driver, and any other OS or
Linux version could very well implement something more dynamic.

> They would be different from machine to machine, unless the clock
> tree is so simple there is only *one* meaningful way to configure
> it.

If we look at the device trees we have in-tree, most of the users of
assigned-clocks are the same from one board to another.

> Most SoCs are complicated enough that there will be tradeoffs
> depending on what peripherals you are using (typically a single
> machine will not use *every* peripheral device provided by the SoC).

We already have APIs to lock parents or rates on a given clock from
the consumer. It's far superior (feature-wise) than what the device
tree will ever offer because it's code, and it depends on the usage
already since an unused driver won't probe.

Maxime

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-03-27 19:24                         ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-27 19:24 UTC (permalink / raw)
  To: Aidan MacDonald
  Cc: Stephen Boyd, Paul Cercueil, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> >> My suggestion: add a per-clock bitmap to keep track of which parents
> >> are allowed. Any operation that would select a parent clock not on the
> >> whitelist should fail. Automatic reparenting should only select from
> >> clocks on the whitelist. And we need new DT bindings for controlling
> >> the whitelist, for example:
> >>
> >>     clock-parents-0 = <&clk1>, <&pll_c>;
> >>     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> >>
> >> This means that clk1 can only have pll_c as a parent, while clk2 can
> >> have pll_a or pll_b as parents. By default every clock will be able
> >> to use any parent, so a list is only needed if the machine needs a
> >> more restrictive policy.
> >>
> >> assigned-clock-parents should disable automatic reparenting, but allow
> >> explicit clk_set_parent(). This will allow clock drivers to start doing
> >> reparenting without breaking old DTs.
> >
> > I'm generally not a fan of putting all these policies in the device
> > tree. Do you have an example where it wouldn't be possible to do exactly
> > this from the driver itself?
> 
> I'm confused. What's implicit in the example is clk1 and clk2 might
> have *other* possible choices of parent clock and the device tree is
> limiting what the OS is allowed to choose.
>
> Why would you put such arbitrary limitations into the driver?

Why would we put such arbitrary limitations in the firmware? As this
entire thread can attest, people are already using the device tree to
work around the limitations of the Linux driver, or reduce the
features of Linux because they can rely on the device tree. Either
way, it's linked to the state of the Linux driver, and any other OS or
Linux version could very well implement something more dynamic.

> They would be different from machine to machine, unless the clock
> tree is so simple there is only *one* meaningful way to configure
> it.

If we look at the device trees we have in-tree, most of the users of
assigned-clocks are the same from one board to another.

> Most SoCs are complicated enough that there will be tradeoffs
> depending on what peripherals you are using (typically a single
> machine will not use *every* peripheral device provided by the SoC).

We already have APIs to lock parents or rates on a given clock from
the consumer. It's far superior (feature-wise) than what the device
tree will ever offer because it's code, and it depends on the usage
already since an unused driver won't probe.

Maxime

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2023-03-22 23:31                 ` Stephen Boyd
  (?)
  (?)
@ 2023-03-29 19:50                   ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-29 19:50 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	patches, Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	linux-renesas-soc, Dinh Nguyen, Vinod Koul, Maxime Coquelin,
	David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 3071 bytes --]

Hi Stephen,

On Wed, Mar 22, 2023 at 04:31:04PM -0700, Stephen Boyd wrote:
> > It's also replacing one implicit behavior by another. The point of this
> > series was to raise awareness on that particular point, so I'm not sure
> > it actually fixes things. We'll see what Stephen thinks about it.
> > 
> 
> Right. A decade ago (!) when determine_rate() was introduced we
> introduced CLK_SET_RATE_NO_REPARENT and set it on each mux user (see
> commit  819c1de344c5 ("clk: add CLK_SET_RATE_NO_REPARENT flag")). This
> way driver behavior wouldn't change and the status quo would be
> maintained, i.e. that clk_set_rate() on a mux wouldn't change parents.
> We didn't enforce that determine_rate exists if the set_parent() op
> existed at the same time though. Probably an oversight.
> 
> Most of the replies to this series have been "DT is setting the parent",
> which makes me believe that there are 'assigned-clock-parents' being
> used.

Yes, that's my understanding as well.

> The clk_set_parent() path is valid for those cases. Probably nobody
> cares about determine_rate because they don't set rates on these clks.
> Some drivers even explicitly left out determine_rate()/round_rate()
> because they didn't want to have some other clk round up to the mux
> and change the parent.
> 
> Eventually we want drivers to migrate to determine_rate op so we can get
> rid of the round_rate op and save a pointer (we're so greedy). It's been
> 10 years though, and that hasn't been done. Sigh! I can see value in
> this series from the angle of migrating, but adding a determine_rate op
> when there isn't a round_rate op makes it hard to reason about. What if
> something copies the clk_ops or sets a different flag? Now we've just
> added parent changing support to clk_set_rate(). What if the clk has
> CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
> change rate. Fun bugs.
> 
> TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
> then the clk is a mux that doesn't want to support clk_set_rate(). Make
> a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
> branch in clk_mux_determine_rate_flags() and call that directly from the
> clk_ops so it is clear what's happening,
> clk_hw_mux_same_parent_determine_rate() or something with a better name.
> Otherwise migrate the explicit determine_rate op to this new function
> and don't set the flag.
> 
> It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
> with this design, if the determine_rate clk_op can call the inner
> wrapper function instead of __clk_mux_determine_rate*() (those
> underscores are awful, we should just prefix them with clk_hw_mux_*()
> and live happier). That should be another patch series.

Sorry but it's not really clear to me what you expect in the v2 of this
series (if you even expect one). It looks that you don't like the
assignment-if-missing idea Mark suggested, but should I just
rebase/resend or did you expect something else?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2023-03-29 19:50                   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-29 19:50 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 3071 bytes --]

Hi Stephen,

On Wed, Mar 22, 2023 at 04:31:04PM -0700, Stephen Boyd wrote:
> > It's also replacing one implicit behavior by another. The point of this
> > series was to raise awareness on that particular point, so I'm not sure
> > it actually fixes things. We'll see what Stephen thinks about it.
> > 
> 
> Right. A decade ago (!) when determine_rate() was introduced we
> introduced CLK_SET_RATE_NO_REPARENT and set it on each mux user (see
> commit  819c1de344c5 ("clk: add CLK_SET_RATE_NO_REPARENT flag")). This
> way driver behavior wouldn't change and the status quo would be
> maintained, i.e. that clk_set_rate() on a mux wouldn't change parents.
> We didn't enforce that determine_rate exists if the set_parent() op
> existed at the same time though. Probably an oversight.
> 
> Most of the replies to this series have been "DT is setting the parent",
> which makes me believe that there are 'assigned-clock-parents' being
> used.

Yes, that's my understanding as well.

> The clk_set_parent() path is valid for those cases. Probably nobody
> cares about determine_rate because they don't set rates on these clks.
> Some drivers even explicitly left out determine_rate()/round_rate()
> because they didn't want to have some other clk round up to the mux
> and change the parent.
> 
> Eventually we want drivers to migrate to determine_rate op so we can get
> rid of the round_rate op and save a pointer (we're so greedy). It's been
> 10 years though, and that hasn't been done. Sigh! I can see value in
> this series from the angle of migrating, but adding a determine_rate op
> when there isn't a round_rate op makes it hard to reason about. What if
> something copies the clk_ops or sets a different flag? Now we've just
> added parent changing support to clk_set_rate(). What if the clk has
> CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
> change rate. Fun bugs.
> 
> TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
> then the clk is a mux that doesn't want to support clk_set_rate(). Make
> a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
> branch in clk_mux_determine_rate_flags() and call that directly from the
> clk_ops so it is clear what's happening,
> clk_hw_mux_same_parent_determine_rate() or something with a better name.
> Otherwise migrate the explicit determine_rate op to this new function
> and don't set the flag.
> 
> It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
> with this design, if the determine_rate clk_op can call the inner
> wrapper function instead of __clk_mux_determine_rate*() (those
> underscores are awful, we should just prefix them with clk_hw_mux_*()
> and live happier). That should be another patch series.

Sorry but it's not really clear to me what you expect in the v2 of this
series (if you even expect one). It looks that you don't like the
assignment-if-missing idea Mark suggested, but should I just
rebase/resend or did you expect something else?

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2023-03-29 19:50                   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-29 19:50 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 3071 bytes --]

Hi Stephen,

On Wed, Mar 22, 2023 at 04:31:04PM -0700, Stephen Boyd wrote:
> > It's also replacing one implicit behavior by another. The point of this
> > series was to raise awareness on that particular point, so I'm not sure
> > it actually fixes things. We'll see what Stephen thinks about it.
> > 
> 
> Right. A decade ago (!) when determine_rate() was introduced we
> introduced CLK_SET_RATE_NO_REPARENT and set it on each mux user (see
> commit  819c1de344c5 ("clk: add CLK_SET_RATE_NO_REPARENT flag")). This
> way driver behavior wouldn't change and the status quo would be
> maintained, i.e. that clk_set_rate() on a mux wouldn't change parents.
> We didn't enforce that determine_rate exists if the set_parent() op
> existed at the same time though. Probably an oversight.
> 
> Most of the replies to this series have been "DT is setting the parent",
> which makes me believe that there are 'assigned-clock-parents' being
> used.

Yes, that's my understanding as well.

> The clk_set_parent() path is valid for those cases. Probably nobody
> cares about determine_rate because they don't set rates on these clks.
> Some drivers even explicitly left out determine_rate()/round_rate()
> because they didn't want to have some other clk round up to the mux
> and change the parent.
> 
> Eventually we want drivers to migrate to determine_rate op so we can get
> rid of the round_rate op and save a pointer (we're so greedy). It's been
> 10 years though, and that hasn't been done. Sigh! I can see value in
> this series from the angle of migrating, but adding a determine_rate op
> when there isn't a round_rate op makes it hard to reason about. What if
> something copies the clk_ops or sets a different flag? Now we've just
> added parent changing support to clk_set_rate(). What if the clk has
> CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
> change rate. Fun bugs.
> 
> TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
> then the clk is a mux that doesn't want to support clk_set_rate(). Make
> a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
> branch in clk_mux_determine_rate_flags() and call that directly from the
> clk_ops so it is clear what's happening,
> clk_hw_mux_same_parent_determine_rate() or something with a better name.
> Otherwise migrate the explicit determine_rate op to this new function
> and don't set the flag.
> 
> It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
> with this design, if the determine_rate clk_op can call the inner
> wrapper function instead of __clk_mux_determine_rate*() (those
> underscores are awful, we should just prefix them with clk_hw_mux_*()
> and live happier). That should be another patch series.

Sorry but it's not really clear to me what you expect in the v2 of this
series (if you even expect one). It looks that you don't like the
assignment-if-missing idea Mark suggested, but should I just
rebase/resend or did you expect something else?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2023-03-29 19:50                   ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-03-29 19:50 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Shawn Guo, Fabio Estevam,
	Ulf Hansson, Claudiu Beznea, Michael Turquette, Dinh Nguyen,
	Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 3071 bytes --]

Hi Stephen,

On Wed, Mar 22, 2023 at 04:31:04PM -0700, Stephen Boyd wrote:
> > It's also replacing one implicit behavior by another. The point of this
> > series was to raise awareness on that particular point, so I'm not sure
> > it actually fixes things. We'll see what Stephen thinks about it.
> > 
> 
> Right. A decade ago (!) when determine_rate() was introduced we
> introduced CLK_SET_RATE_NO_REPARENT and set it on each mux user (see
> commit  819c1de344c5 ("clk: add CLK_SET_RATE_NO_REPARENT flag")). This
> way driver behavior wouldn't change and the status quo would be
> maintained, i.e. that clk_set_rate() on a mux wouldn't change parents.
> We didn't enforce that determine_rate exists if the set_parent() op
> existed at the same time though. Probably an oversight.
> 
> Most of the replies to this series have been "DT is setting the parent",
> which makes me believe that there are 'assigned-clock-parents' being
> used.

Yes, that's my understanding as well.

> The clk_set_parent() path is valid for those cases. Probably nobody
> cares about determine_rate because they don't set rates on these clks.
> Some drivers even explicitly left out determine_rate()/round_rate()
> because they didn't want to have some other clk round up to the mux
> and change the parent.
> 
> Eventually we want drivers to migrate to determine_rate op so we can get
> rid of the round_rate op and save a pointer (we're so greedy). It's been
> 10 years though, and that hasn't been done. Sigh! I can see value in
> this series from the angle of migrating, but adding a determine_rate op
> when there isn't a round_rate op makes it hard to reason about. What if
> something copies the clk_ops or sets a different flag? Now we've just
> added parent changing support to clk_set_rate(). What if the clk has
> CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
> change rate. Fun bugs.
> 
> TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
> then the clk is a mux that doesn't want to support clk_set_rate(). Make
> a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
> branch in clk_mux_determine_rate_flags() and call that directly from the
> clk_ops so it is clear what's happening,
> clk_hw_mux_same_parent_determine_rate() or something with a better name.
> Otherwise migrate the explicit determine_rate op to this new function
> and don't set the flag.
> 
> It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
> with this design, if the determine_rate clk_op can call the inner
> wrapper function instead of __clk_mux_determine_rate*() (those
> underscores are awful, we should just prefix them with clk_hw_mux_*()
> and live happier). That should be another patch series.

Sorry but it's not really clear to me what you expect in the v2 of this
series (if you even expect one). It looks that you don't like the
assignment-if-missing idea Mark suggested, but should I just
rebase/resend or did you expect something else?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
  2023-03-29 19:50                   ` Maxime Ripard
  (?)
@ 2023-03-29 20:04                     ` Stephen Boyd
  -1 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-29 20:04 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Mark Brown, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc

Quoting Maxime Ripard (2023-03-29 12:50:49)
> On Wed, Mar 22, 2023 at 04:31:04PM -0700, Stephen Boyd wrote:
> 
> > The clk_set_parent() path is valid for those cases. Probably nobody
> > cares about determine_rate because they don't set rates on these clks.
> > Some drivers even explicitly left out determine_rate()/round_rate()
> > because they didn't want to have some other clk round up to the mux
> > and change the parent.
> > 
> > Eventually we want drivers to migrate to determine_rate op so we can get
> > rid of the round_rate op and save a pointer (we're so greedy). It's been
> > 10 years though, and that hasn't been done. Sigh! I can see value in
> > this series from the angle of migrating, but adding a determine_rate op
> > when there isn't a round_rate op makes it hard to reason about. What if
> > something copies the clk_ops or sets a different flag? Now we've just
> > added parent changing support to clk_set_rate(). What if the clk has
> > CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
> > change rate. Fun bugs.
> > 
> > TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
> > then the clk is a mux that doesn't want to support clk_set_rate(). Make
> > a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
> > branch in clk_mux_determine_rate_flags() and call that directly from the
> > clk_ops so it is clear what's happening,
> > clk_hw_mux_same_parent_determine_rate() or something with a better name.
> > Otherwise migrate the explicit determine_rate op to this new function
> > and don't set the flag.
> > 
> > It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
> > with this design, if the determine_rate clk_op can call the inner
> > wrapper function instead of __clk_mux_determine_rate*() (those
> > underscores are awful, we should just prefix them with clk_hw_mux_*()
> > and live happier). That should be another patch series.
> 
> Sorry but it's not really clear to me what you expect in the v2 of this
> series (if you even expect one). It looks that you don't like the
> assignment-if-missing idea Mark suggested, but should I just
> rebase/resend or did you expect something else?
> 

Yes, we want explicit code. Just rebase & resend. Don't add a
determine_rate if there isn't a round_rate. Don't add more users of
CLK_SET_RATE_NO_REPARENT. Instead, make an explicit determine_rate
function for that. If you want to work on the removal of
CLK_SET_RATE_NO_REPARENT go for it. Otherwise I'll take care of it after
this series.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2023-03-29 20:04                     ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-29 20:04 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Paul Cercueil, Max Filippov, Thierry Reding,
	linux-phy, linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, nel.org, AngeloGioacchino Del Regno,
	linux-arm-kernel, Alessandro Zummo, linux-sunxi, patches,
	Peter De Schrijver, Nicolas Ferre, Andreas Färber,
	Dinh Nguyen, Vinod Koul, Maxime Coquelin, linux-renesas-soc,
	David Lechner, Shawn Guo, Claudiu Beznea

Quoting Maxime Ripard (2023-03-29 12:50:49)
> On Wed, Mar 22, 2023 at 04:31:04PM -0700, Stephen Boyd wrote:
> 
> > The clk_set_parent() path is valid for those cases. Probably nobody
> > cares about determine_rate because they don't set rates on these clks.
> > Some drivers even explicitly left out determine_rate()/round_rate()
> > because they didn't want to have some other clk round up to the mux
> > and change the parent.
> > 
> > Eventually we want drivers to migrate to determine_rate op so we can get
> > rid of the round_rate op and save a pointer (we're so greedy). It's been
> > 10 years though, and that hasn't been done. Sigh! I can see value in
> > this series from the angle of migrating, but adding a determine_rate op
> > when there isn't a round_rate op makes it hard to reason about. What if
> > something copies the clk_ops or sets a different flag? Now we've just
> > added parent changing support to clk_set_rate(). What if the clk has
> > CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
> > change rate. Fun bugs.
> > 
> > TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
> > then the clk is a mux that doesn't want to support clk_set_rate(). Make
> > a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
> > branch in clk_mux_determine_rate_flags() and call that directly from the
> > clk_ops so it is clear what's happening,
> > clk_hw_mux_same_parent_determine_rate() or something with a better name.
> > Otherwise migrate the explicit determine_rate op to this new function
> > and don't set the flag.
> > 
> > It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
> > with this design, if the determine_rate clk_op can call the inner
> > wrapper function instead of __clk_mux_determine_rate*() (those
> > underscores are awful, we should just prefix them with clk_hw_mux_*()
> > and live happier). That should be another patch series.
> 
> Sorry but it's not really clear to me what you expect in the v2 of this
> series (if you even expect one). It looks that you don't like the
> assignment-if-missing idea Mark suggested, but should I just
> rebase/resend or did you expect something else?
> 

Yes, we want explicit code. Just rebase & resend. Don't add a
determine_rate if there isn't a round_rate. Don't add more users of
CLK_SET_RATE_NO_REPARENT. Instead, make an explicit determine_rate
function for that. If you want to work on the removal of
CLK_SET_RATE_NO_REPARENT go for it. Otherwise I'll take care of it after
this series.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 43/65] ASoC: tlv320aic32x4: Add a determine_rate hook
@ 2023-03-29 20:04                     ` Stephen Boyd
  0 siblings, 0 replies; 388+ messages in thread
From: Stephen Boyd @ 2023-03-29 20:04 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Mark Brown, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Shawn Guo, Fabio Estevam,
	Ulf Hansson, Claudiu Beznea, Michael Turquette, Dinh Nguyen,
	Paul Cercueil, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Max Filippov, Geert Uytterhoeven, linux-stm32,
	alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, nel.org, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Quoting Maxime Ripard (2023-03-29 12:50:49)
> On Wed, Mar 22, 2023 at 04:31:04PM -0700, Stephen Boyd wrote:
> 
> > The clk_set_parent() path is valid for those cases. Probably nobody
> > cares about determine_rate because they don't set rates on these clks.
> > Some drivers even explicitly left out determine_rate()/round_rate()
> > because they didn't want to have some other clk round up to the mux
> > and change the parent.
> > 
> > Eventually we want drivers to migrate to determine_rate op so we can get
> > rid of the round_rate op and save a pointer (we're so greedy). It's been
> > 10 years though, and that hasn't been done. Sigh! I can see value in
> > this series from the angle of migrating, but adding a determine_rate op
> > when there isn't a round_rate op makes it hard to reason about. What if
> > something copies the clk_ops or sets a different flag? Now we've just
> > added parent changing support to clk_set_rate(). What if the clk has
> > CLK_SET_RATE_PARENT flag set? Now we're going to ask the parent clk to
> > change rate. Fun bugs.
> > 
> > TL;DR: If the set_parent op exists but determine_rate/round_rate doesn't
> > then the clk is a mux that doesn't want to support clk_set_rate(). Make
> > a new mux function that's the contents of the CLK_SET_RATE_NO_REPARENT
> > branch in clk_mux_determine_rate_flags() and call that directly from the
> > clk_ops so it is clear what's happening,
> > clk_hw_mux_same_parent_determine_rate() or something with a better name.
> > Otherwise migrate the explicit determine_rate op to this new function
> > and don't set the flag.
> > 
> > It may be possible to entirely remove the CLK_SET_RATE_NO_REPARENT flag
> > with this design, if the determine_rate clk_op can call the inner
> > wrapper function instead of __clk_mux_determine_rate*() (those
> > underscores are awful, we should just prefix them with clk_hw_mux_*()
> > and live happier). That should be another patch series.
> 
> Sorry but it's not really clear to me what you expect in the v2 of this
> series (if you even expect one). It looks that you don't like the
> assignment-if-missing idea Mark suggested, but should I just
> rebase/resend or did you expect something else?
> 

Yes, we want explicit code. Just rebase & resend. Don't add a
determine_rate if there isn't a round_rate. Don't add more users of
CLK_SET_RATE_NO_REPARENT. Instead, make an explicit determine_rate
function for that. If you want to work on the removal of
CLK_SET_RATE_NO_REPARENT go for it. Otherwise I'll take care of it after
this series.

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2023-03-27 19:24                         ` Maxime Ripard
  (?)
  (?)
@ 2023-04-05 12:57                           ` Paul Cercueil
  -1 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2023-04-05 12:57 UTC (permalink / raw)
  To: Maxime Ripard, Aidan MacDonald
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > My suggestion: add a per-clock bitmap to keep track of which
> > > > parents
> > > > are allowed. Any operation that would select a parent clock not
> > > > on the
> > > > whitelist should fail. Automatic reparenting should only select
> > > > from
> > > > clocks on the whitelist. And we need new DT bindings for
> > > > controlling
> > > > the whitelist, for example:
> > > > 
> > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > 
> > > > This means that clk1 can only have pll_c as a parent, while
> > > > clk2 can
> > > > have pll_a or pll_b as parents. By default every clock will be
> > > > able
> > > > to use any parent, so a list is only needed if the machine
> > > > needs a
> > > > more restrictive policy.
> > > > 
> > > > assigned-clock-parents should disable automatic reparenting,
> > > > but allow
> > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > start doing
> > > > reparenting without breaking old DTs.
> > > 
> > > I'm generally not a fan of putting all these policies in the
> > > device
> > > tree. Do you have an example where it wouldn't be possible to do
> > > exactly
> > > this from the driver itself?
> > 
> > I'm confused. What's implicit in the example is clk1 and clk2 might
> > have *other* possible choices of parent clock and the device tree
> > is
> > limiting what the OS is allowed to choose.
> > 
> > Why would you put such arbitrary limitations into the driver?
> 
> Why would we put such arbitrary limitations in the firmware? As this
> entire thread can attest, people are already using the device tree to
> work around the limitations of the Linux driver, or reduce the
> features of Linux because they can rely on the device tree. Either
> way, it's linked to the state of the Linux driver, and any other OS
> or
> Linux version could very well implement something more dynamic.

Probably because if we have to choose between setting policy in the
kernel or in the firmware, it is arguably better to set it in the
firmware.

Especially when talking about clocks, as the firmware is already the
one programming the boot clocks.

Cheers,
-Paul

> > They would be different from machine to machine, unless the clock
> > tree is so simple there is only *one* meaningful way to configure
> > it.
> 
> If we look at the device trees we have in-tree, most of the users of
> assigned-clocks are the same from one board to another.
> 
> > Most SoCs are complicated enough that there will be tradeoffs
> > depending on what peripherals you are using (typically a single
> > machine will not use *every* peripheral device provided by the
> > SoC).
> 
> We already have APIs to lock parents or rates on a given clock from
> the consumer. It's far superior (feature-wise) than what the device
> tree will ever offer because it's code, and it depends on the usage
> already since an unused driver won't probe.
> 
> Maxime


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 12:57                           ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2023-04-05 12:57 UTC (permalink / raw)
  To: Maxime Ripard, Aidan MacDonald
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, alsa-devel, Manivannan Sadhasivam,
	linux-kernel, Sascha Hauer, linux-actions, Richard Fitzgerald,
	Mark Brown, linux-mediatek, Baolin Wang, Matthias Brugger,
	Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Hi Maxime,

Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > My suggestion: add a per-clock bitmap to keep track of which
> > > > parents
> > > > are allowed. Any operation that would select a parent clock not
> > > > on the
> > > > whitelist should fail. Automatic reparenting should only select
> > > > from
> > > > clocks on the whitelist. And we need new DT bindings for
> > > > controlling
> > > > the whitelist, for example:
> > > > 
> > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > 
> > > > This means that clk1 can only have pll_c as a parent, while
> > > > clk2 can
> > > > have pll_a or pll_b as parents. By default every clock will be
> > > > able
> > > > to use any parent, so a list is only needed if the machine
> > > > needs a
> > > > more restrictive policy.
> > > > 
> > > > assigned-clock-parents should disable automatic reparenting,
> > > > but allow
> > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > start doing
> > > > reparenting without breaking old DTs.
> > > 
> > > I'm generally not a fan of putting all these policies in the
> > > device
> > > tree. Do you have an example where it wouldn't be possible to do
> > > exactly
> > > this from the driver itself?
> > 
> > I'm confused. What's implicit in the example is clk1 and clk2 might
> > have *other* possible choices of parent clock and the device tree
> > is
> > limiting what the OS is allowed to choose.
> > 
> > Why would you put such arbitrary limitations into the driver?
> 
> Why would we put such arbitrary limitations in the firmware? As this
> entire thread can attest, people are already using the device tree to
> work around the limitations of the Linux driver, or reduce the
> features of Linux because they can rely on the device tree. Either
> way, it's linked to the state of the Linux driver, and any other OS
> or
> Linux version could very well implement something more dynamic.

Probably because if we have to choose between setting policy in the
kernel or in the firmware, it is arguably better to set it in the
firmware.

Especially when talking about clocks, as the firmware is already the
one programming the boot clocks.

Cheers,
-Paul

> > They would be different from machine to machine, unless the clock
> > tree is so simple there is only *one* meaningful way to configure
> > it.
> 
> If we look at the device trees we have in-tree, most of the users of
> assigned-clocks are the same from one board to another.
> 
> > Most SoCs are complicated enough that there will be tradeoffs
> > depending on what peripherals you are using (typically a single
> > machine will not use *every* peripheral device provided by the
> > SoC).
> 
> We already have APIs to lock parents or rates on a given clock from
> the consumer. It's far superior (feature-wise) than what the device
> tree will ever offer because it's code, and it depends on the usage
> already since an unused driver won't probe.
> 
> Maxime


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 12:57                           ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2023-04-05 12:57 UTC (permalink / raw)
  To: Maxime Ripard, Aidan MacDonald
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Jaroslav Kysela, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Hi Maxime,

Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > My suggestion: add a per-clock bitmap to keep track of which
> > > > parents
> > > > are allowed. Any operation that would select a parent clock not
> > > > on the
> > > > whitelist should fail. Automatic reparenting should only select
> > > > from
> > > > clocks on the whitelist. And we need new DT bindings for
> > > > controlling
> > > > the whitelist, for example:
> > > > 
> > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > 
> > > > This means that clk1 can only have pll_c as a parent, while
> > > > clk2 can
> > > > have pll_a or pll_b as parents. By default every clock will be
> > > > able
> > > > to use any parent, so a list is only needed if the machine
> > > > needs a
> > > > more restrictive policy.
> > > > 
> > > > assigned-clock-parents should disable automatic reparenting,
> > > > but allow
> > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > start doing
> > > > reparenting without breaking old DTs.
> > > 
> > > I'm generally not a fan of putting all these policies in the
> > > device
> > > tree. Do you have an example where it wouldn't be possible to do
> > > exactly
> > > this from the driver itself?
> > 
> > I'm confused. What's implicit in the example is clk1 and clk2 might
> > have *other* possible choices of parent clock and the device tree
> > is
> > limiting what the OS is allowed to choose.
> > 
> > Why would you put such arbitrary limitations into the driver?
> 
> Why would we put such arbitrary limitations in the firmware? As this
> entire thread can attest, people are already using the device tree to
> work around the limitations of the Linux driver, or reduce the
> features of Linux because they can rely on the device tree. Either
> way, it's linked to the state of the Linux driver, and any other OS
> or
> Linux version could very well implement something more dynamic.

Probably because if we have to choose between setting policy in the
kernel or in the firmware, it is arguably better to set it in the
firmware.

Especially when talking about clocks, as the firmware is already the
one programming the boot clocks.

Cheers,
-Paul

> > They would be different from machine to machine, unless the clock
> > tree is so simple there is only *one* meaningful way to configure
> > it.
> 
> If we look at the device trees we have in-tree, most of the users of
> assigned-clocks are the same from one board to another.
> 
> > Most SoCs are complicated enough that there will be tradeoffs
> > depending on what peripherals you are using (typically a single
> > machine will not use *every* peripheral device provided by the
> > SoC).
> 
> We already have APIs to lock parents or rates on a given clock from
> the consumer. It's far superior (feature-wise) than what the device
> tree will ever offer because it's code, and it depends on the usage
> already since an unused driver won't probe.
> 
> Maxime


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 12:57                           ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2023-04-05 12:57 UTC (permalink / raw)
  To: Maxime Ripard, Aidan MacDonald
  Cc: Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai, Daniel Vetter,
	Nicolas Ferre, Thierry Reding, Shawn Guo, Fabio Estevam,
	Ulf Hansson, Claudiu Beznea, Michael Turquette, Dinh Nguyen,
	Chunyan Zhang, Manivannan Sadhasivam, Andreas Färber,
	Jonathan Hunter, Abel Vesa, Charles Keepax, Alessandro Zummo,
	Peter De Schrijver, Orson Zhai, Alexandre Torgue,
	Prashant Gaikwad, Liam Girdwood, Alexandre Belloni,
	Samuel Holland, Matthias Brugger, Richard Fitzgerald, Vinod Koul,
	NXP Linux Team, Sekhar Nori, Kishon Vijay Abraham I,
	Linus Walleij, Takashi Iwai, David Airlie, Luca Ceresoli,
	Jernej Skrabec, Pengutronix Kernel Team, Baolin Wang,
	David Lechner, Sascha Hauer, Mark Brown, Max Filippov,
	Geert Uytterhoeven, linux-stm32, alsa-devel, linux-mediatek,
	linux-phy, linux-mips, linux-renesas-soc, linux-actions,
	linux-clk, AngeloGioacchino Del Regno, patches, linux-tegra,
	linux-rtc, linux-arm-kernel, linux-sunxi, linux-kernel,
	dri-devel

Hi Maxime,

Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > My suggestion: add a per-clock bitmap to keep track of which
> > > > parents
> > > > are allowed. Any operation that would select a parent clock not
> > > > on the
> > > > whitelist should fail. Automatic reparenting should only select
> > > > from
> > > > clocks on the whitelist. And we need new DT bindings for
> > > > controlling
> > > > the whitelist, for example:
> > > > 
> > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > 
> > > > This means that clk1 can only have pll_c as a parent, while
> > > > clk2 can
> > > > have pll_a or pll_b as parents. By default every clock will be
> > > > able
> > > > to use any parent, so a list is only needed if the machine
> > > > needs a
> > > > more restrictive policy.
> > > > 
> > > > assigned-clock-parents should disable automatic reparenting,
> > > > but allow
> > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > start doing
> > > > reparenting without breaking old DTs.
> > > 
> > > I'm generally not a fan of putting all these policies in the
> > > device
> > > tree. Do you have an example where it wouldn't be possible to do
> > > exactly
> > > this from the driver itself?
> > 
> > I'm confused. What's implicit in the example is clk1 and clk2 might
> > have *other* possible choices of parent clock and the device tree
> > is
> > limiting what the OS is allowed to choose.
> > 
> > Why would you put such arbitrary limitations into the driver?
> 
> Why would we put such arbitrary limitations in the firmware? As this
> entire thread can attest, people are already using the device tree to
> work around the limitations of the Linux driver, or reduce the
> features of Linux because they can rely on the device tree. Either
> way, it's linked to the state of the Linux driver, and any other OS
> or
> Linux version could very well implement something more dynamic.

Probably because if we have to choose between setting policy in the
kernel or in the firmware, it is arguably better to set it in the
firmware.

Especially when talking about clocks, as the firmware is already the
one programming the boot clocks.

Cheers,
-Paul

> > They would be different from machine to machine, unless the clock
> > tree is so simple there is only *one* meaningful way to configure
> > it.
> 
> If we look at the device trees we have in-tree, most of the users of
> assigned-clocks are the same from one board to another.
> 
> > Most SoCs are complicated enough that there will be tradeoffs
> > depending on what peripherals you are using (typically a single
> > machine will not use *every* peripheral device provided by the
> > SoC).
> 
> We already have APIs to lock parents or rates on a given clock from
> the consumer. It's far superior (feature-wise) than what the device
> tree will ever offer because it's code, and it depends on the usage
> already since an unused driver won't probe.
> 
> Maxime


^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2023-04-05 12:57                           ` Paul Cercueil
  (?)
  (?)
@ 2023-04-05 14:50                             ` Maxime Ripard
  -1 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-04-05 14:50 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Aidan MacDonald, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 3038 bytes --]

On Wed, Apr 05, 2023 at 02:57:26PM +0200, Paul Cercueil wrote:
> Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> > On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > > My suggestion: add a per-clock bitmap to keep track of which
> > > > > parents
> > > > > are allowed. Any operation that would select a parent clock not
> > > > > on the
> > > > > whitelist should fail. Automatic reparenting should only select
> > > > > from
> > > > > clocks on the whitelist. And we need new DT bindings for
> > > > > controlling
> > > > > the whitelist, for example:
> > > > > 
> > > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > > 
> > > > > This means that clk1 can only have pll_c as a parent, while
> > > > > clk2 can
> > > > > have pll_a or pll_b as parents. By default every clock will be
> > > > > able
> > > > > to use any parent, so a list is only needed if the machine
> > > > > needs a
> > > > > more restrictive policy.
> > > > > 
> > > > > assigned-clock-parents should disable automatic reparenting,
> > > > > but allow
> > > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > > start doing
> > > > > reparenting without breaking old DTs.
> > > > 
> > > > I'm generally not a fan of putting all these policies in the
> > > > device
> > > > tree. Do you have an example where it wouldn't be possible to do
> > > > exactly
> > > > this from the driver itself?
> > > 
> > > I'm confused. What's implicit in the example is clk1 and clk2 might
> > > have *other* possible choices of parent clock and the device tree
> > > is
> > > limiting what the OS is allowed to choose.
> > > 
> > > Why would you put such arbitrary limitations into the driver?
> > 
> > Why would we put such arbitrary limitations in the firmware? As this
> > entire thread can attest, people are already using the device tree to
> > work around the limitations of the Linux driver, or reduce the
> > features of Linux because they can rely on the device tree. Either
> > way, it's linked to the state of the Linux driver, and any other OS
> > or
> > Linux version could very well implement something more dynamic.
> 
> Probably because if we have to choose between setting policy in the
> kernel or in the firmware, it is arguably better to set it in the
> firmware.

I have a very different view on this I guess. Firmware is (most of the
time) hard to update, and the policy depend on the state of support of a
given OS so it's likely to evolve. The kernel is the best place to me to
put that kind of policy. Why do you think differently?

> Especially when talking about clocks, as the firmware is already the
> one programming the boot clocks.

I'm not sure what your point is there. I don't think I ever saw a
firmware getting the clocks right for every possible scenario on a given
platform. And if it was indeed the case, then we wouldn't even a kernel
driver.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 14:50                             ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-04-05 14:50 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, Aidan MacDonald, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-actions,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 3038 bytes --]

On Wed, Apr 05, 2023 at 02:57:26PM +0200, Paul Cercueil wrote:
> Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> > On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > > My suggestion: add a per-clock bitmap to keep track of which
> > > > > parents
> > > > > are allowed. Any operation that would select a parent clock not
> > > > > on the
> > > > > whitelist should fail. Automatic reparenting should only select
> > > > > from
> > > > > clocks on the whitelist. And we need new DT bindings for
> > > > > controlling
> > > > > the whitelist, for example:
> > > > > 
> > > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > > 
> > > > > This means that clk1 can only have pll_c as a parent, while
> > > > > clk2 can
> > > > > have pll_a or pll_b as parents. By default every clock will be
> > > > > able
> > > > > to use any parent, so a list is only needed if the machine
> > > > > needs a
> > > > > more restrictive policy.
> > > > > 
> > > > > assigned-clock-parents should disable automatic reparenting,
> > > > > but allow
> > > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > > start doing
> > > > > reparenting without breaking old DTs.
> > > > 
> > > > I'm generally not a fan of putting all these policies in the
> > > > device
> > > > tree. Do you have an example where it wouldn't be possible to do
> > > > exactly
> > > > this from the driver itself?
> > > 
> > > I'm confused. What's implicit in the example is clk1 and clk2 might
> > > have *other* possible choices of parent clock and the device tree
> > > is
> > > limiting what the OS is allowed to choose.
> > > 
> > > Why would you put such arbitrary limitations into the driver?
> > 
> > Why would we put such arbitrary limitations in the firmware? As this
> > entire thread can attest, people are already using the device tree to
> > work around the limitations of the Linux driver, or reduce the
> > features of Linux because they can rely on the device tree. Either
> > way, it's linked to the state of the Linux driver, and any other OS
> > or
> > Linux version could very well implement something more dynamic.
> 
> Probably because if we have to choose between setting policy in the
> kernel or in the firmware, it is arguably better to set it in the
> firmware.

I have a very different view on this I guess. Firmware is (most of the
time) hard to update, and the policy depend on the state of support of a
given OS so it's likely to evolve. The kernel is the best place to me to
put that kind of policy. Why do you think differently?

> Especially when talking about clocks, as the firmware is already the
> one programming the boot clocks.

I'm not sure what your point is there. I don't think I ever saw a
firmware getting the clocks right for every possible scenario on a given
platform. And if it was indeed the case, then we wouldn't even a kernel
driver.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 14:50                             ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-04-05 14:50 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Aidan MacDonald, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 3038 bytes --]

On Wed, Apr 05, 2023 at 02:57:26PM +0200, Paul Cercueil wrote:
> Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> > On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > > My suggestion: add a per-clock bitmap to keep track of which
> > > > > parents
> > > > > are allowed. Any operation that would select a parent clock not
> > > > > on the
> > > > > whitelist should fail. Automatic reparenting should only select
> > > > > from
> > > > > clocks on the whitelist. And we need new DT bindings for
> > > > > controlling
> > > > > the whitelist, for example:
> > > > > 
> > > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > > 
> > > > > This means that clk1 can only have pll_c as a parent, while
> > > > > clk2 can
> > > > > have pll_a or pll_b as parents. By default every clock will be
> > > > > able
> > > > > to use any parent, so a list is only needed if the machine
> > > > > needs a
> > > > > more restrictive policy.
> > > > > 
> > > > > assigned-clock-parents should disable automatic reparenting,
> > > > > but allow
> > > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > > start doing
> > > > > reparenting without breaking old DTs.
> > > > 
> > > > I'm generally not a fan of putting all these policies in the
> > > > device
> > > > tree. Do you have an example where it wouldn't be possible to do
> > > > exactly
> > > > this from the driver itself?
> > > 
> > > I'm confused. What's implicit in the example is clk1 and clk2 might
> > > have *other* possible choices of parent clock and the device tree
> > > is
> > > limiting what the OS is allowed to choose.
> > > 
> > > Why would you put such arbitrary limitations into the driver?
> > 
> > Why would we put such arbitrary limitations in the firmware? As this
> > entire thread can attest, people are already using the device tree to
> > work around the limitations of the Linux driver, or reduce the
> > features of Linux because they can rely on the device tree. Either
> > way, it's linked to the state of the Linux driver, and any other OS
> > or
> > Linux version could very well implement something more dynamic.
> 
> Probably because if we have to choose between setting policy in the
> kernel or in the firmware, it is arguably better to set it in the
> firmware.

I have a very different view on this I guess. Firmware is (most of the
time) hard to update, and the policy depend on the state of support of a
given OS so it's likely to evolve. The kernel is the best place to me to
put that kind of policy. Why do you think differently?

> Especially when talking about clocks, as the firmware is already the
> one programming the boot clocks.

I'm not sure what your point is there. I don't think I ever saw a
firmware getting the clocks right for every possible scenario on a given
platform. And if it was indeed the case, then we wouldn't even a kernel
driver.

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 14:50                             ` Maxime Ripard
  0 siblings, 0 replies; 388+ messages in thread
From: Maxime Ripard @ 2023-04-05 14:50 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Aidan MacDonald, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

[-- Attachment #1: Type: text/plain, Size: 3038 bytes --]

On Wed, Apr 05, 2023 at 02:57:26PM +0200, Paul Cercueil wrote:
> Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> > On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > > My suggestion: add a per-clock bitmap to keep track of which
> > > > > parents
> > > > > are allowed. Any operation that would select a parent clock not
> > > > > on the
> > > > > whitelist should fail. Automatic reparenting should only select
> > > > > from
> > > > > clocks on the whitelist. And we need new DT bindings for
> > > > > controlling
> > > > > the whitelist, for example:
> > > > > 
> > > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > > 
> > > > > This means that clk1 can only have pll_c as a parent, while
> > > > > clk2 can
> > > > > have pll_a or pll_b as parents. By default every clock will be
> > > > > able
> > > > > to use any parent, so a list is only needed if the machine
> > > > > needs a
> > > > > more restrictive policy.
> > > > > 
> > > > > assigned-clock-parents should disable automatic reparenting,
> > > > > but allow
> > > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > > start doing
> > > > > reparenting without breaking old DTs.
> > > > 
> > > > I'm generally not a fan of putting all these policies in the
> > > > device
> > > > tree. Do you have an example where it wouldn't be possible to do
> > > > exactly
> > > > this from the driver itself?
> > > 
> > > I'm confused. What's implicit in the example is clk1 and clk2 might
> > > have *other* possible choices of parent clock and the device tree
> > > is
> > > limiting what the OS is allowed to choose.
> > > 
> > > Why would you put such arbitrary limitations into the driver?
> > 
> > Why would we put such arbitrary limitations in the firmware? As this
> > entire thread can attest, people are already using the device tree to
> > work around the limitations of the Linux driver, or reduce the
> > features of Linux because they can rely on the device tree. Either
> > way, it's linked to the state of the Linux driver, and any other OS
> > or
> > Linux version could very well implement something more dynamic.
> 
> Probably because if we have to choose between setting policy in the
> kernel or in the firmware, it is arguably better to set it in the
> firmware.

I have a very different view on this I guess. Firmware is (most of the
time) hard to update, and the policy depend on the state of support of a
given OS so it's likely to evolve. The kernel is the best place to me to
put that kind of policy. Why do you think differently?

> Especially when talking about clocks, as the firmware is already the
> one programming the boot clocks.

I'm not sure what your point is there. I don't think I ever saw a
firmware getting the clocks right for every possible scenario on a given
platform. And if it was indeed the case, then we wouldn't even a kernel
driver.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
  2023-04-05 14:50                             ` Maxime Ripard
  (?)
  (?)
@ 2023-04-05 15:29                               ` Paul Cercueil
  -1 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2023-04-05 15:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Aidan MacDonald, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Le mercredi 05 avril 2023 à 16:50 +0200, Maxime Ripard a écrit :
> On Wed, Apr 05, 2023 at 02:57:26PM +0200, Paul Cercueil wrote:
> > Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> > > On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > > > My suggestion: add a per-clock bitmap to keep track of
> > > > > > which
> > > > > > parents
> > > > > > are allowed. Any operation that would select a parent clock
> > > > > > not
> > > > > > on the
> > > > > > whitelist should fail. Automatic reparenting should only
> > > > > > select
> > > > > > from
> > > > > > clocks on the whitelist. And we need new DT bindings for
> > > > > > controlling
> > > > > > the whitelist, for example:
> > > > > > 
> > > > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > > > 
> > > > > > This means that clk1 can only have pll_c as a parent, while
> > > > > > clk2 can
> > > > > > have pll_a or pll_b as parents. By default every clock will
> > > > > > be
> > > > > > able
> > > > > > to use any parent, so a list is only needed if the machine
> > > > > > needs a
> > > > > > more restrictive policy.
> > > > > > 
> > > > > > assigned-clock-parents should disable automatic
> > > > > > reparenting,
> > > > > > but allow
> > > > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > > > start doing
> > > > > > reparenting without breaking old DTs.
> > > > > 
> > > > > I'm generally not a fan of putting all these policies in the
> > > > > device
> > > > > tree. Do you have an example where it wouldn't be possible to
> > > > > do
> > > > > exactly
> > > > > this from the driver itself?
> > > > 
> > > > I'm confused. What's implicit in the example is clk1 and clk2
> > > > might
> > > > have *other* possible choices of parent clock and the device
> > > > tree
> > > > is
> > > > limiting what the OS is allowed to choose.
> > > > 
> > > > Why would you put such arbitrary limitations into the driver?
> > > 
> > > Why would we put such arbitrary limitations in the firmware? As
> > > this
> > > entire thread can attest, people are already using the device
> > > tree to
> > > work around the limitations of the Linux driver, or reduce the
> > > features of Linux because they can rely on the device tree.
> > > Either
> > > way, it's linked to the state of the Linux driver, and any other
> > > OS
> > > or
> > > Linux version could very well implement something more dynamic.
> > 
> > Probably because if we have to choose between setting policy in the
> > kernel or in the firmware, it is arguably better to set it in the
> > firmware.
> 
> I have a very different view on this I guess. Firmware is (most of
> the
> time) hard to update, and the policy depend on the state of support
> of a
> given OS so it's likely to evolve. The kernel is the best place to me
> to
> put that kind of policy. Why do you think differently?

Because the clocks configuration can be board-specific. And you don't
really want board-specific stuff in the driver.

If we take the Ingenic JZ4770 SoC as example, on one board we parent
everything we can to the PLL1 clock and set it to 432 MHz (the least
common multiple). Then the PLL0 (which drives the DDR and CPU clocks)
can be updated to overclock/underclock the CPU and RAM.

So should that be hardcoded in the driver? Well, for a different board,
for which overclock is not really needed, it's better to parent
everything to PLL0 so that PLL1 can be shut down to save power. So what
policy should be hardcoded in the driver?

> 
> > Especially when talking about clocks, as the firmware is already
> > the
> > one programming the boot clocks.
> 
> I'm not sure what your point is there. I don't think I ever saw a
> firmware getting the clocks right for every possible scenario on a
> given
> platform. And if it was indeed the case, then we wouldn't even a
> kernel
> driver.

My point is that there is already policy in how the firmware sets up
the hardware; and most often than not, the kernel driver won't change
that (e.g. you're probably not going to touch the DDR clock). It's
better to have all policy in the firmware then, instead of having some
in the firmware, and some in the kernel driver.

Cheers,
-Paul

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 15:29                               ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2023-04-05 15:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Ulf Hansson, Prashant Gaikwad, Alexandre Belloni, Liam Girdwood,
	Michael Turquette, Sekhar Nori, Alexandre Torgue, dri-devel,
	Jaroslav Kysela, Max Filippov, Thierry Reding, linux-phy,
	linux-stm32, Abel Vesa, Kishon Vijay Abraham I,
	Geert Uytterhoeven, Samuel Holland, Chunyan Zhang, Takashi Iwai,
	linux-tegra, Jernej Skrabec, Jonathan Hunter, Chen-Yu Tsai,
	NXP Linux Team, Orson Zhai, linux-mips, Luca Ceresoli, linux-rtc,
	linux-clk, Charles Keepax, Aidan MacDonald, alsa-devel,
	Manivannan Sadhasivam, linux-kernel, Sascha Hauer, linux-actions,
	Richard Fitzgerald, Mark Brown, linux-mediatek, Baolin Wang,
	Matthias Brugger, Pengutronix Kernel Team, linux-arm-kernel,
	AngeloGioacchino Del Regno, Alessandro Zummo, linux-sunxi,
	Stephen Boyd, patches, Peter De Schrijver, Nicolas Ferre,
	Andreas Färber, linux-renesas-soc, Dinh Nguyen, Vinod Koul,
	Maxime Coquelin, David Lechner, Shawn Guo, Claudiu Beznea

Le mercredi 05 avril 2023 à 16:50 +0200, Maxime Ripard a écrit :
> On Wed, Apr 05, 2023 at 02:57:26PM +0200, Paul Cercueil wrote:
> > Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> > > On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > > > My suggestion: add a per-clock bitmap to keep track of
> > > > > > which
> > > > > > parents
> > > > > > are allowed. Any operation that would select a parent clock
> > > > > > not
> > > > > > on the
> > > > > > whitelist should fail. Automatic reparenting should only
> > > > > > select
> > > > > > from
> > > > > > clocks on the whitelist. And we need new DT bindings for
> > > > > > controlling
> > > > > > the whitelist, for example:
> > > > > > 
> > > > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > > > 
> > > > > > This means that clk1 can only have pll_c as a parent, while
> > > > > > clk2 can
> > > > > > have pll_a or pll_b as parents. By default every clock will
> > > > > > be
> > > > > > able
> > > > > > to use any parent, so a list is only needed if the machine
> > > > > > needs a
> > > > > > more restrictive policy.
> > > > > > 
> > > > > > assigned-clock-parents should disable automatic
> > > > > > reparenting,
> > > > > > but allow
> > > > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > > > start doing
> > > > > > reparenting without breaking old DTs.
> > > > > 
> > > > > I'm generally not a fan of putting all these policies in the
> > > > > device
> > > > > tree. Do you have an example where it wouldn't be possible to
> > > > > do
> > > > > exactly
> > > > > this from the driver itself?
> > > > 
> > > > I'm confused. What's implicit in the example is clk1 and clk2
> > > > might
> > > > have *other* possible choices of parent clock and the device
> > > > tree
> > > > is
> > > > limiting what the OS is allowed to choose.
> > > > 
> > > > Why would you put such arbitrary limitations into the driver?
> > > 
> > > Why would we put such arbitrary limitations in the firmware? As
> > > this
> > > entire thread can attest, people are already using the device
> > > tree to
> > > work around the limitations of the Linux driver, or reduce the
> > > features of Linux because they can rely on the device tree.
> > > Either
> > > way, it's linked to the state of the Linux driver, and any other
> > > OS
> > > or
> > > Linux version could very well implement something more dynamic.
> > 
> > Probably because if we have to choose between setting policy in the
> > kernel or in the firmware, it is arguably better to set it in the
> > firmware.
> 
> I have a very different view on this I guess. Firmware is (most of
> the
> time) hard to update, and the policy depend on the state of support
> of a
> given OS so it's likely to evolve. The kernel is the best place to me
> to
> put that kind of policy. Why do you think differently?

Because the clocks configuration can be board-specific. And you don't
really want board-specific stuff in the driver.

If we take the Ingenic JZ4770 SoC as example, on one board we parent
everything we can to the PLL1 clock and set it to 432 MHz (the least
common multiple). Then the PLL0 (which drives the DDR and CPU clocks)
can be updated to overclock/underclock the CPU and RAM.

So should that be hardcoded in the driver? Well, for a different board,
for which overclock is not really needed, it's better to parent
everything to PLL0 so that PLL1 can be shut down to save power. So what
policy should be hardcoded in the driver?

> 
> > Especially when talking about clocks, as the firmware is already
> > the
> > one programming the boot clocks.
> 
> I'm not sure what your point is there. I don't think I ever saw a
> firmware getting the clocks right for every possible scenario on a
> given
> platform. And if it was indeed the case, then we wouldn't even a
> kernel
> driver.

My point is that there is already policy in how the firmware sets up
the hardware; and most often than not, the kernel driver won't change
that (e.g. you're probably not going to touch the DDR clock). It's
better to have all policy in the firmware then, instead of having some
in the firmware, and some in the kernel driver.

Cheers,
-Paul

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 15:29                               ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2023-04-05 15:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Aidan MacDonald, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Jaroslav Kysela,
	Shawn Guo, Fabio Estevam, Ulf Hansson, Claudiu Beznea,
	Michael Turquette, Dinh Nguyen, Chunyan Zhang,
	Manivannan Sadhasivam, Andreas Färber, Jonathan Hunter,
	Abel Vesa, Charles Keepax, Alessandro Zummo, Peter De Schrijver,
	Orson Zhai, Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Le mercredi 05 avril 2023 à 16:50 +0200, Maxime Ripard a écrit :
> On Wed, Apr 05, 2023 at 02:57:26PM +0200, Paul Cercueil wrote:
> > Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> > > On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > > > My suggestion: add a per-clock bitmap to keep track of
> > > > > > which
> > > > > > parents
> > > > > > are allowed. Any operation that would select a parent clock
> > > > > > not
> > > > > > on the
> > > > > > whitelist should fail. Automatic reparenting should only
> > > > > > select
> > > > > > from
> > > > > > clocks on the whitelist. And we need new DT bindings for
> > > > > > controlling
> > > > > > the whitelist, for example:
> > > > > > 
> > > > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > > > 
> > > > > > This means that clk1 can only have pll_c as a parent, while
> > > > > > clk2 can
> > > > > > have pll_a or pll_b as parents. By default every clock will
> > > > > > be
> > > > > > able
> > > > > > to use any parent, so a list is only needed if the machine
> > > > > > needs a
> > > > > > more restrictive policy.
> > > > > > 
> > > > > > assigned-clock-parents should disable automatic
> > > > > > reparenting,
> > > > > > but allow
> > > > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > > > start doing
> > > > > > reparenting without breaking old DTs.
> > > > > 
> > > > > I'm generally not a fan of putting all these policies in the
> > > > > device
> > > > > tree. Do you have an example where it wouldn't be possible to
> > > > > do
> > > > > exactly
> > > > > this from the driver itself?
> > > > 
> > > > I'm confused. What's implicit in the example is clk1 and clk2
> > > > might
> > > > have *other* possible choices of parent clock and the device
> > > > tree
> > > > is
> > > > limiting what the OS is allowed to choose.
> > > > 
> > > > Why would you put such arbitrary limitations into the driver?
> > > 
> > > Why would we put such arbitrary limitations in the firmware? As
> > > this
> > > entire thread can attest, people are already using the device
> > > tree to
> > > work around the limitations of the Linux driver, or reduce the
> > > features of Linux because they can rely on the device tree.
> > > Either
> > > way, it's linked to the state of the Linux driver, and any other
> > > OS
> > > or
> > > Linux version could very well implement something more dynamic.
> > 
> > Probably because if we have to choose between setting policy in the
> > kernel or in the firmware, it is arguably better to set it in the
> > firmware.
> 
> I have a very different view on this I guess. Firmware is (most of
> the
> time) hard to update, and the policy depend on the state of support
> of a
> given OS so it's likely to evolve. The kernel is the best place to me
> to
> put that kind of policy. Why do you think differently?

Because the clocks configuration can be board-specific. And you don't
really want board-specific stuff in the driver.

If we take the Ingenic JZ4770 SoC as example, on one board we parent
everything we can to the PLL1 clock and set it to 432 MHz (the least
common multiple). Then the PLL0 (which drives the DDR and CPU clocks)
can be updated to overclock/underclock the CPU and RAM.

So should that be hardcoded in the driver? Well, for a different board,
for which overclock is not really needed, it's better to parent
everything to PLL0 so that PLL1 can be shut down to save power. So what
policy should be hardcoded in the driver?

> 
> > Especially when talking about clocks, as the firmware is already
> > the
> > one programming the boot clocks.
> 
> I'm not sure what your point is there. I don't think I ever saw a
> firmware getting the clocks right for every possible scenario on a
> given
> platform. And if it was indeed the case, then we wouldn't even a
> kernel
> driver.

My point is that there is already policy in how the firmware sets up
the hardware; and most often than not, the kernel driver won't change
that (e.g. you're probably not going to touch the DDR clock). It's
better to have all policy in the firmware then, instead of having some
in the firmware, and some in the kernel driver.

Cheers,
-Paul

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply	[flat|nested] 388+ messages in thread

* Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate
@ 2023-04-05 15:29                               ` Paul Cercueil
  0 siblings, 0 replies; 388+ messages in thread
From: Paul Cercueil @ 2023-04-05 15:29 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Aidan MacDonald, Stephen Boyd, Maxime Coquelin, Chen-Yu Tsai,
	Daniel Vetter, Nicolas Ferre, Thierry Reding, Shawn Guo,
	Fabio Estevam, Ulf Hansson, Claudiu Beznea, Michael Turquette,
	Dinh Nguyen, Chunyan Zhang, Manivannan Sadhasivam,
	Andreas Färber, Jonathan Hunter, Abel Vesa, Charles Keepax,
	Alessandro Zummo, Peter De Schrijver, Orson Zhai,
	Alexandre Torgue, Prashant Gaikwad, Liam Girdwood,
	Alexandre Belloni, Samuel Holland, Matthias Brugger,
	Richard Fitzgerald, Vinod Koul, NXP Linux Team, Sekhar Nori,
	Kishon Vijay Abraham I, Linus Walleij, Takashi Iwai,
	David Airlie, Luca Ceresoli, Jernej Skrabec,
	Pengutronix Kernel Team, Baolin Wang, David Lechner,
	Sascha Hauer, Mark Brown, Max Filippov, Geert Uytterhoeven,
	linux-stm32, alsa-devel, linux-mediatek, linux-phy, linux-mips,
	linux-renesas-soc, linux-actions, linux-clk,
	AngeloGioacchino Del Regno, patches, linux-tegra, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel, dri-devel

Le mercredi 05 avril 2023 à 16:50 +0200, Maxime Ripard a écrit :
> On Wed, Apr 05, 2023 at 02:57:26PM +0200, Paul Cercueil wrote:
> > Le lundi 27 mars 2023 à 21:24 +0200, Maxime Ripard a écrit :
> > > On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote:
> > > > > > My suggestion: add a per-clock bitmap to keep track of
> > > > > > which
> > > > > > parents
> > > > > > are allowed. Any operation that would select a parent clock
> > > > > > not
> > > > > > on the
> > > > > > whitelist should fail. Automatic reparenting should only
> > > > > > select
> > > > > > from
> > > > > > clocks on the whitelist. And we need new DT bindings for
> > > > > > controlling
> > > > > > the whitelist, for example:
> > > > > > 
> > > > > >     clock-parents-0 = <&clk1>, <&pll_c>;
> > > > > >     clock-parents-1 = <&clk2>, <&pll_a>, <&pll_b>;
> > > > > > 
> > > > > > This means that clk1 can only have pll_c as a parent, while
> > > > > > clk2 can
> > > > > > have pll_a or pll_b as parents. By default every clock will
> > > > > > be
> > > > > > able
> > > > > > to use any parent, so a list is only needed if the machine
> > > > > > needs a
> > > > > > more restrictive policy.
> > > > > > 
> > > > > > assigned-clock-parents should disable automatic
> > > > > > reparenting,
> > > > > > but allow
> > > > > > explicit clk_set_parent(). This will allow clock drivers to
> > > > > > start doing
> > > > > > reparenting without breaking old DTs.
> > > > > 
> > > > > I'm generally not a fan of putting all these policies in the
> > > > > device
> > > > > tree. Do you have an example where it wouldn't be possible to
> > > > > do
> > > > > exactly
> > > > > this from the driver itself?
> > > > 
> > > > I'm confused. What's implicit in the example is clk1 and clk2
> > > > might
> > > > have *other* possible choices of parent clock and the device
> > > > tree
> > > > is
> > > > limiting what the OS is allowed to choose.
> > > > 
> > > > Why would you put such arbitrary limitations into the driver?
> > > 
> > > Why would we put such arbitrary limitations in the firmware? As
> > > this
> > > entire thread can attest, people are already using the device
> > > tree to
> > > work around the limitations of the Linux driver, or reduce the
> > > features of Linux because they can rely on the device tree.
> > > Either
> > > way, it's linked to the state of the Linux driver, and any other
> > > OS
> > > or
> > > Linux version could very well implement something more dynamic.
> > 
> > Probably because if we have to choose between setting policy in the
> > kernel or in the firmware, it is arguably better to set it in the
> > firmware.
> 
> I have a very different view on this I guess. Firmware is (most of
> the
> time) hard to update, and the policy depend on the state of support
> of a
> given OS so it's likely to evolve. The kernel is the best place to me
> to
> put that kind of policy. Why do you think differently?

Because the clocks configuration can be board-specific. And you don't
really want board-specific stuff in the driver.

If we take the Ingenic JZ4770 SoC as example, on one board we parent
everything we can to the PLL1 clock and set it to 432 MHz (the least
common multiple). Then the PLL0 (which drives the DDR and CPU clocks)
can be updated to overclock/underclock the CPU and RAM.

So should that be hardcoded in the driver? Well, for a different board,
for which overclock is not really needed, it's better to parent
everything to PLL0 so that PLL1 can be shut down to save power. So what
policy should be hardcoded in the driver?

> 
> > Especially when talking about clocks, as the firmware is already
> > the
> > one programming the boot clocks.
> 
> I'm not sure what your point is there. I don't think I ever saw a
> firmware getting the clocks right for every possible scenario on a
> given
> platform. And if it was indeed the case, then we wouldn't even a
> kernel
> driver.

My point is that there is already policy in how the firmware sets up
the hardware; and most often than not, the kernel driver won't change
that (e.g. you're probably not going to touch the DDR clock). It's
better to have all policy in the firmware then, instead of having some
in the firmware, and some in the kernel driver.

Cheers,
-Paul

^ permalink raw reply	[flat|nested] 388+ messages in thread

end of thread, other threads:[~2023-04-06 14:29 UTC | newest]

Thread overview: 388+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 13:17 [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes Maxime Ripard
2022-11-04 13:17 ` Maxime Ripard
2022-11-04 13:17 ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 01/65] clk: Export clk_hw_forward_rate_request() Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 02/65] clk: lan966x: Remove unused round_rate hook Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 03/65] clk: nodrv: Add a determine_rate hook Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 04/65] clk: test: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 05/65] clk: actions: composite: Add a determine_rate hook for pass clk Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 06/65] clk: at91: main: Add a determine_rate hook Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 07/65] clk: at91: sckc: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 08/65] clk: berlin: div: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 09/65] clk: cdce706: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 10/65] clk: k210: pll: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 11/65] clk: k210: aclk: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 12/65] clk: k210: mux: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 13/65] clk: lmk04832: clkout: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-13 22:35   ` Liam Beguin
2022-11-13 22:35     ` Liam Beguin
2022-11-13 22:35     ` Liam Beguin
2022-11-13 22:35     ` Liam Beguin
2022-11-04 13:17 ` [PATCH v2 14/65] clk: lochnagar: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 15/65] clk: qoriq: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 16/65] clk: si5341: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 17/65] clk: stm32f4: mux: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 18/65] clk: vc5: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 19/65] clk: vc5: clkout: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 20/65] clk: wm831x: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-07 10:58   ` Charles Keepax
2022-11-07 10:58     ` Charles Keepax
2022-11-07 10:58     ` Charles Keepax
2022-11-07 10:58     ` Charles Keepax
2022-11-04 13:17 ` [PATCH v2 21/65] clk: davinci: da8xx-cfgchip: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 16:45   ` David Lechner
2022-11-04 16:45     ` David Lechner
2022-11-04 16:45     ` David Lechner
2022-11-07 12:06     ` Maxime Ripard
2022-11-07 12:06       ` Maxime Ripard
2022-11-07 12:06       ` Maxime Ripard
2022-11-07 12:06       ` Maxime Ripard
2022-11-07 14:52       ` David Lechner
2022-11-07 14:52         ` David Lechner
2022-11-07 14:52         ` David Lechner
2022-11-07 14:52         ` David Lechner
2022-11-04 13:17 ` [PATCH v2 22/65] " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 16:46   ` David Lechner
2022-11-04 16:46     ` David Lechner
2022-11-04 16:46     ` David Lechner
2022-11-04 13:17 ` [PATCH v2 23/65] clk: imx: busy: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 24/65] clk: imx: fixup-mux: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 25/65] clk: imx: scu: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 26/65] clk: mediatek: cpumux: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 27/65] clk: pxa: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 28/65] clk: renesas: r9a06g032: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-07  7:51   ` Geert Uytterhoeven
2022-11-07  7:51     ` Geert Uytterhoeven
2022-11-07  7:51     ` Geert Uytterhoeven
2022-11-07  7:51     ` Geert Uytterhoeven
2022-11-04 13:17 ` [PATCH v2 29/65] clk: socfpga: gate: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 30/65] clk: stm32: core: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 31/65] clk: tegra: bpmp: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 32/65] clk: tegra: super: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 33/65] clk: tegra: periph: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 34/65] clk: ux500: prcmu: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-08 13:25   ` Linus Walleij
2022-11-08 13:25     ` Linus Walleij
2022-11-08 13:25     ` Linus Walleij
2022-11-08 13:25     ` Linus Walleij
2022-11-09 11:05     ` Maxime Ripard
2022-11-09 11:05       ` Maxime Ripard
2022-11-09 11:05       ` Maxime Ripard
2022-11-09 11:05       ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 35/65] clk: ux500: sysctrl: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-08 13:27   ` Linus Walleij
2022-11-08 13:27     ` Linus Walleij
2022-11-08 13:27     ` Linus Walleij
2022-11-08 13:27     ` Linus Walleij
2022-11-10 11:28   ` Ulf Hansson
2022-11-10 11:28     ` Ulf Hansson
2022-11-10 11:28     ` Ulf Hansson
2022-11-10 11:28     ` Ulf Hansson
2022-11-10 11:39     ` Linus Walleij
2022-11-10 11:39       ` Linus Walleij
2022-11-10 11:39       ` Linus Walleij
2022-11-10 11:39       ` Linus Walleij
2022-11-10 13:05       ` Ulf Hansson
2022-11-10 13:05         ` Ulf Hansson
2022-11-10 13:05         ` Ulf Hansson
2022-11-10 13:05         ` Ulf Hansson
2022-11-11  9:20         ` Linus Walleij
2022-11-11  9:20           ` Linus Walleij
2022-11-11  9:20           ` Linus Walleij
2022-11-11  9:20           ` Linus Walleij
2022-11-14  9:05           ` Lee Jones
2022-11-14  9:05             ` Lee Jones
2022-11-14  9:05             ` Lee Jones
2022-11-14  9:05             ` Lee Jones
2022-11-04 13:17 ` [PATCH v2 36/65] clk: versatile: sp810: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 37/65] drm/tegra: sor: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 38/65] phy: cadence: sierra: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 39/65] phy: cadence: torrent: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 40/65] phy: ti: am654-serdes: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 41/65] phy: ti: j721e-wiz: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17 ` [PATCH v2 42/65] rtc: sun6i: " Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-04 13:17   ` Maxime Ripard
2022-11-05  3:45   ` Samuel Holland
2022-11-05  3:45     ` Samuel Holland
2022-11-04 13:18 ` [PATCH v2 43/65] ASoC: tlv320aic32x4: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 15:44   ` Mark Brown
2022-11-04 15:44     ` Mark Brown
2022-11-04 15:44     ` Mark Brown
2022-11-04 15:44     ` Mark Brown
2022-11-04 15:51     ` Maxime Ripard
2022-11-04 15:51       ` Maxime Ripard
2022-11-04 15:51       ` Maxime Ripard
2022-11-04 15:51       ` Maxime Ripard
2022-11-04 15:59       ` Mark Brown
2022-11-04 15:59         ` Mark Brown
2022-11-04 15:59         ` Mark Brown
2022-11-04 15:59         ` Mark Brown
2022-11-07  8:43         ` Maxime Ripard
2022-11-07  8:43           ` Maxime Ripard
2022-11-07  8:43           ` Maxime Ripard
2022-11-07  8:43           ` Maxime Ripard
2022-11-07 12:06           ` Mark Brown
2022-11-07 12:06             ` Mark Brown
2022-11-07 12:06             ` Mark Brown
2022-11-07 12:06             ` Mark Brown
2022-11-07 15:26             ` Maxime Ripard
2022-11-07 15:26               ` Maxime Ripard
2022-11-07 15:26               ` Maxime Ripard
2022-11-07 15:26               ` Maxime Ripard
2022-11-07 16:02               ` Mark Brown
2022-11-07 16:02                 ` Mark Brown
2022-11-07 16:02                 ` Mark Brown
2022-11-07 16:02                 ` Mark Brown
2023-03-22 23:31               ` Stephen Boyd
2023-03-22 23:31                 ` Stephen Boyd
2023-03-22 23:31                 ` Stephen Boyd
2023-03-29 19:50                 ` Maxime Ripard
2023-03-29 19:50                   ` Maxime Ripard
2023-03-29 19:50                   ` Maxime Ripard
2023-03-29 19:50                   ` Maxime Ripard
2023-03-29 20:04                   ` Stephen Boyd
2023-03-29 20:04                     ` Stephen Boyd
2023-03-29 20:04                     ` Stephen Boyd
2022-11-04 13:18 ` [PATCH v2 44/65] clk: actions: composite: div: Switch to determine_rate Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 45/65] clk: actions: composite: fact: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 46/65] clk: at91: smd: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 47/65] clk: axi-clkgen: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 48/65] clk: cdce706: divider: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 49/65] clk: cdce706: clkout: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 50/65] clk: si5341: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 51/65] clk: si5351: pll: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 52/65] clk: si5351: msynth: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 53/65] clk: si5351: clkout: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 54/65] clk: da8xx: clk48: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 16:49   ` David Lechner
2022-11-04 16:49     ` David Lechner
2022-11-04 16:49     ` David Lechner
2022-11-07 14:52     ` Maxime Ripard
2022-11-07 14:52       ` Maxime Ripard
2022-11-07 14:52       ` Maxime Ripard
2022-11-07 14:52       ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 55/65] clk: imx: scu: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 56/65] clk: ingenic: cgu: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 14:31   ` Paul Cercueil
2022-11-04 14:31     ` Paul Cercueil
2022-11-04 14:31     ` Paul Cercueil
2022-11-04 14:31     ` Paul Cercueil
2022-11-04 14:59     ` Maxime Ripard
2022-11-04 14:59       ` Maxime Ripard
2022-11-04 14:59       ` Maxime Ripard
2022-11-04 14:59       ` Maxime Ripard
2022-11-04 17:35       ` Aidan MacDonald
2022-11-04 17:35         ` Aidan MacDonald
2022-11-04 17:35         ` Aidan MacDonald
2022-11-04 17:35         ` Aidan MacDonald
2022-11-07  8:54         ` Maxime Ripard
2022-11-07  8:54           ` Maxime Ripard
2022-11-07  8:54           ` Maxime Ripard
2022-11-07  8:54           ` Maxime Ripard
2022-11-07 20:57           ` Aidan MacDonald
2022-11-07 20:57             ` Aidan MacDonald
2022-11-07 20:57             ` Aidan MacDonald
2022-11-07 20:57             ` Aidan MacDonald
2022-11-09 11:00             ` Maxime Ripard
2022-11-09 11:00               ` Maxime Ripard
2022-11-09 11:00               ` Maxime Ripard
2022-11-09 11:00               ` Maxime Ripard
2023-03-22 23:41               ` Stephen Boyd
2023-03-22 23:41                 ` Stephen Boyd
2023-03-22 23:41                 ` Stephen Boyd
2023-03-23 15:35                 ` Aidan MacDonald
2023-03-23 15:35                   ` Aidan MacDonald
2023-03-23 15:35                   ` Aidan MacDonald
2023-03-23 15:35                   ` Aidan MacDonald
2023-03-24 11:19                   ` Maxime Ripard
2023-03-24 11:19                     ` Maxime Ripard
2023-03-24 11:19                     ` Maxime Ripard
2023-03-24 11:19                     ` Maxime Ripard
2023-03-24 20:58                     ` Aidan MacDonald
2023-03-24 20:58                       ` Aidan MacDonald
2023-03-24 20:58                       ` Aidan MacDonald
2023-03-24 20:58                       ` Aidan MacDonald
2023-03-27 19:24                       ` Maxime Ripard
2023-03-27 19:24                         ` Maxime Ripard
2023-03-27 19:24                         ` Maxime Ripard
2023-03-27 19:24                         ` Maxime Ripard
2023-04-05 12:57                         ` Paul Cercueil
2023-04-05 12:57                           ` Paul Cercueil
2023-04-05 12:57                           ` Paul Cercueil
2023-04-05 12:57                           ` Paul Cercueil
2023-04-05 14:50                           ` Maxime Ripard
2023-04-05 14:50                             ` Maxime Ripard
2023-04-05 14:50                             ` Maxime Ripard
2023-04-05 14:50                             ` Maxime Ripard
2023-04-05 15:29                             ` Paul Cercueil
2023-04-05 15:29                               ` Paul Cercueil
2023-04-05 15:29                               ` Paul Cercueil
2023-04-05 15:29                               ` Paul Cercueil
2022-11-05 10:33       ` Paul Cercueil
2022-11-05 10:33         ` Paul Cercueil
2022-11-05 10:33         ` Paul Cercueil
2022-11-05 10:33         ` Paul Cercueil
2022-11-09 10:53         ` Maxime Ripard
2022-11-09 10:53           ` Maxime Ripard
2022-11-09 10:53           ` Maxime Ripard
2022-11-09 10:53           ` Maxime Ripard
2022-11-09 11:36           ` Paul Cercueil
2022-11-09 11:36             ` Paul Cercueil
2022-11-09 11:36             ` Paul Cercueil
2022-11-09 11:36             ` Paul Cercueil
2022-11-04 13:18 ` [PATCH v2 57/65] clk: ingenic: tcu: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 58/65] clk: sprd: composite: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-09  2:43   ` Chunyan Zhang
2022-11-09  2:43     ` Chunyan Zhang
2022-11-09  2:43     ` Chunyan Zhang
2022-11-09  2:43     ` Chunyan Zhang
2022-11-04 13:18 ` [PATCH v2 59/65] clk: st: flexgen: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 60/65] clk: stm32: composite: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-05 14:51   ` kernel test robot
2022-11-04 13:18 ` [PATCH v2 61/65] clk: tegra: periph: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 62/65] clk: tegra: super: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 63/65] ASoC: tlv320aic32x4: pll: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 64/65] ASoC: tlv320aic32x4: div: " Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18 ` [PATCH v2 65/65] clk: Warn if we register a mux without determine_rate Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-04 13:18   ` Maxime Ripard
2022-11-07 10:56   ` Charles Keepax
2022-11-07 10:56     ` Charles Keepax
2022-11-07 10:56     ` Charles Keepax
2022-11-07 10:56     ` Charles Keepax
2023-03-21 23:55 ` [PATCH v2 00/65] clk: Make determine_rate mandatory for muxes Stephen Boyd
2023-03-21 23:55   ` Stephen Boyd
2023-03-22 10:01   ` Maxime Ripard
2023-03-22 10:01     ` Maxime Ripard
2023-03-22 10:01     ` Maxime Ripard
2023-03-22 10:01     ` Maxime Ripard
2023-03-22 15:19     ` Stephen Boyd
2023-03-22 15:19       ` Stephen Boyd
2023-03-22 15:19       ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.