Module Name: src Committed By: jmcneill Date: Sat Nov 5 17:30:07 UTC 2022
Modified Files: src/sys/arch/arm/fdt: a9ptmr_fdt.c Log Message: Handle speed change events To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/fdt/a9ptmr_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/fdt/a9ptmr_fdt.c diff -u src/sys/arch/arm/fdt/a9ptmr_fdt.c:1.6 src/sys/arch/arm/fdt/a9ptmr_fdt.c:1.7 --- src/sys/arch/arm/fdt/a9ptmr_fdt.c:1.6 Tue Nov 1 11:05:18 2022 +++ src/sys/arch/arm/fdt/a9ptmr_fdt.c Sat Nov 5 17:30:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: a9ptmr_fdt.c,v 1.6 2022/11/01 11:05:18 jmcneill Exp $ */ +/* $NetBSD: a9ptmr_fdt.c,v 1.7 2022/11/05 17:30:06 jmcneill Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: a9ptmr_fdt.c,v 1.6 2022/11/01 11:05:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: a9ptmr_fdt.c,v 1.7 2022/11/05 17:30:06 jmcneill Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -50,6 +50,7 @@ static int a9ptmr_fdt_match(device_t, cf static void a9ptmr_fdt_attach(device_t, device_t, void *); static void a9ptmr_fdt_cpu_hatch(void *, struct cpu_info *); +static void a9ptmr_fdt_speed_changed(device_t); struct a9ptmr_fdt_softc { device_t sc_dev; @@ -144,6 +145,8 @@ a9ptmr_fdt_attach(device_t parent, devic arm_fdt_cpu_hatch_register(self, a9ptmr_fdt_cpu_hatch); arm_fdt_timer_register(a9ptmr_cpu_initclocks); } + + pmf_event_register(self, PMFE_SPEED_CHANGED, a9ptmr_fdt_speed_changed, true); } static void @@ -151,3 +154,16 @@ a9ptmr_fdt_cpu_hatch(void *priv, struct { a9ptmr_init_cpu_clock(ci); } + +static void +a9ptmr_fdt_speed_changed(device_t dev) +{ + struct a9ptmr_fdt_softc * const sc = device_private(dev); + prop_dictionary_t dict = device_properties(dev); + uint32_t rate; + + rate = clk_get_rate(sc->sc_clk); + prop_dictionary_set_uint32(dict, "frequency", rate); + + a9ptmr_update_freq(rate); +}