All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phuong Nguyen <ndp2809@gmail.com>
To: Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Chen Wang <chen.wang@linux.dev>,
	Inochi Amaoto <inochiama@gmail.com>,
	linux-clk@vger.kernel.org, sophgo@lists.linux.dev
Cc: Inochi Amaoto <inochiama@outlook.com>
Subject: [PATCH] clk: sophgo: cv1800: set mux parent in bypass_mux_set_parent()
Date: Fri, 20 Nov 2026 17:57:33 +0700	[thread overview]
Message-ID: <20261120105737.7461-1-ndp2809@gmail.com> (raw)

In bypass_mux_set_parent(), when index > 0, clearing the bypass bit
switches the clock to the mux path without updating the mux selector.
As a result, the hardware mux remains at parent 0 instead of selecting
the requested parent.

Call mux_set_parent(hw, index - 1) before clearing the bypass bit to
configure the mux selector before switching to the mux path.

Fixes: 80fd61ec4612 ("clk: sophgo: Add clock support for CV1800 SoC")
Signed-off-by: Phuong Nguyen <ndp2809@gmail.com>
---
 drivers/clk/sophgo/clk-cv18xx-ip.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/sophgo/clk-cv18xx-ip.c b/drivers/clk/sophgo/clk-cv18xx-ip.c
index e936e3154003..34062ad7f2aa 100644
--- a/drivers/clk/sophgo/clk-cv18xx-ip.c
+++ b/drivers/clk/sophgo/clk-cv18xx-ip.c
@@ -588,10 +588,15 @@ static u8 bypass_mux_get_parent(struct clk_hw *hw)
 static int bypass_mux_set_parent(struct clk_hw *hw, u8 index)
 {
 	struct cv1800_clk_bypass_mux *mux = hw_to_cv1800_clk_bypass_mux(hw);
+	int ret;
 
 	if (index == 0)
 		return cv1800_clk_setbit(&mux->mux.common, &mux->bypass);
 
+	ret = mux_set_parent(hw, index - 1);
+	if (ret)
+		return ret;
+
 	return cv1800_clk_clearbit(&mux->mux.common, &mux->bypass);
 }
 
-- 
2.43.0


             reply	other threads:[~2026-11-20 10:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 10:57 Phuong Nguyen [this message]
2026-11-20 18:44 ` [PATCH] clk: sophgo: cv1800: set mux parent in bypass_mux_set_parent() Jerome Brunet

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20261120105737.7461-1-ndp2809@gmail.com \
    --to=ndp2809@gmail.com \
    --cc=bmasney+clk@redhat.com \
    --cc=chen.wang@linux.dev \
    --cc=inochiama@gmail.com \
    --cc=inochiama@outlook.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sophgo@lists.linux.dev \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.