git: ecd8cc84dcee - main - scmi: Implement scmi_clknode_recalc_freq method
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Apr 2024 09:59:20 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ecd8cc84dcee7d08be8663f721f0502dc5b65808 commit ecd8cc84dcee7d08be8663f721f0502dc5b65808 Author: Cristian Marussi <cristian.marussi@arm.com> AuthorDate: 2023-12-10 22:14:21 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-04-11 09:58:56 +0000 scmi: Implement scmi_clknode_recalc_freq method Allow the SCMI clock frequency to be queried back, useful for testing the IRQ path via sysctl access. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43038 --- sys/dev/firmware/arm/scmi_clk.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/dev/firmware/arm/scmi_clk.c b/sys/dev/firmware/arm/scmi_clk.c index da7a8d37b465..b9ab2145ed76 100644 --- a/sys/dev/firmware/arm/scmi_clk.c +++ b/sys/dev/firmware/arm/scmi_clk.c @@ -55,7 +55,7 @@ struct scmi_clknode_softc { int clock_id; }; -static int __unused +static int scmi_clk_get_rate(struct scmi_clk_softc *sc, int clk_id, uint64_t *rate) { struct scmi_clk_rate_get_out out; @@ -154,8 +154,18 @@ scmi_clknode_init(struct clknode *clk, device_t dev) static int scmi_clknode_recalc_freq(struct clknode *clk, uint64_t *freq) { + struct scmi_clknode_softc *clk_sc; + struct scmi_clk_softc *sc; + uint64_t rate; + int ret; - return (0); + clk_sc = clknode_get_softc(clk); + sc = device_get_softc(clk_sc->dev); + ret = scmi_clk_get_rate(sc, clk_sc->clock_id, &rate); + if (ret == 0) + *freq = rate; + + return (ret); } static int