aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cpufreq
Commit message (Collapse)AuthorAgeFilesLines
* ofw: Fix 64-bit arithmetic in cpufreq_dt.c.Michal Meloun2025-12-031-1/+1
| | | | MFC after: 3 weeks
* newbus: replace leftover device unit wildcardsAhmad Khalifa2025-06-212-4/+6
| | | | | | Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
* riscv: enable cpufreq_dt driverMitchell Horne2025-01-101-1/+1
| | | | | | | | | | | Implement the small amount of MD code required; copied from arm/arm64. One tweak is made to cpufreq_dt itself: if the opp-shared property is missing, but there is only one CPU, then we can still attach. This is relevant for the single-core Allwinner D1. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48124
* regulator: Move regulator code in dev/regulatorEmmanuel Vadot2024-01-101-1/+1
| | | | | | | | | | | We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: emaste, imp Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43194
* clk: Move clock code in dev/clkEmmanuel Vadot2024-01-101-1/+1
| | | | | | | | | | | We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: mhorne Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43191
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-272-2/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* cpufreq_dt: Find the closest frequencyEmmanuel Vadot2023-09-081-6/+15
| | | | | | | | | | | | | When building the frequencies table we convert the value in the DTS to megahertz and loose precision. While it's not a problem for most of the DTS it is when the expected frequency value is strict down to the hertz. So it's either we don't truncate the value and have some ugly and long values in the sysctls or we just find the closest frequency. Do the latter. Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D41762 Sponsored by: Beckhoff Automation GmbH & Co. KG
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-162-4/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* cpufreq: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-062-5/+4
|
* cpufreq: dt: Plug set but not used variableEmmanuel Vadot2022-02-211-3/+0
| | | | Sponsored by: Beckhoff Automation GmbH & Co. KG
* cpufreq: Support operating-mode-v2 tables with no voltagesAdrian Chadd2021-12-141-62/+116
| | | | | | | | | | | | | | | | | | | | | | Summary: The linux device tree documentation for this states that for v1 voltages are required, but for v2 voltages are optional. So, handle that here - if there's no regulator/supply provided for a v1 opmode then error out; but keep it optional for v2. Then just don't both doing any regulator calls if it's not configured. This isn't the best/final solution - mmel@ has suggested that this should be flipped around a bit and print warnings if we get an opp-microvolt property but we don't have a regulator. Subscribers: imp Reviewed by: mmel, jrtc27, manu Test Plan: * IPQ4018, with no voltage tables; the freq set is called appropriately. Differential Revision: https://reviews.freebsd.org/D33140
* Make CPU children explicitly share parent unit numbers.Alexander Motin2021-09-251-1/+2
| | | | | | Before this device unit number match was coincidental and broke if I disabled some CPU device(s). Aside of cosmetics, for some drivers (may be considered broken) it caused talking to wrong CPUs.
* cpufreq: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-2/+0
| | | | Notes: svn path=/head/; revision=365221
* coufreq_dt: Rename DEBUG to DPRINTFEmmanuel Vadot2020-06-091-22/+23
| | | | | | | | | | | | | DEBUG is a kernel configuration flag and if used cpufreq_dt.c will fail the build of kernel. PR: 246867 Submitted by: Oskar Holmund (oskar.holmlund@ohdata.se) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25080 Notes: svn path=/head/; revision=361964
* cpufreq: Unbreak build.Emmanuel Vadot2020-03-091-1/+2
| | | | Notes: svn path=/head/; revision=358800
* cpufreq_dt: Fix r358555Emmanuel Vadot2020-03-091-1/+1
| | | | | | | | | | | | Before skipping the current cpu when trying to find the ones that have the same opp, record that this one have this opp. Reported by: mmel MFC after: 2 weeks X-MFC-With: r358555 Notes: svn path=/head/; revision=358799
* cpufreq_dt: Improve multiple opp supportEmmanuel Vadot2020-03-021-5/+28
| | | | | | | | | | | | | | When looking for cpu with the same OPP starts from the root /cpus node so each instance of cpufreq_dt will now each cpu with the same operating point. Also test that the node we are testing have the property "device_type" set to be equal to "cpu". While here add more debug printfs (off by defaults). MFC after: 2 weeks Notes: svn path=/head/; revision=358555
* cpufreq_dt: Do not fetch again hw.ncpuEmmanuel Vadot2019-12-031-6/+4
| | | | | | | | | | MD code already set the global variable mp_ncpus according to the tunable hw.ncpu so use the global variable directly. Reported by: ian Notes: svn path=/head/; revision=355361
* cpufreq_dt: Do not attach the device if the cpu isn't presentEmmanuel Vadot2019-12-031-2/+9
| | | | | | | | | | | | | If we boot with hw.ncpu=X (available on arm and arm64 at least) we shouldn't attach the cpufreq driver as cf_set_method will try to get the cpuid and it doesn't exists. This solves cpufreq panicing on RockChip RK3399 when booting with hw.ncpu=4 MFC after: 1 week Notes: svn path=/head/; revision=355360
* Remove "all rights reserved" from copyright for the file I own.Emmanuel Vadot2019-12-031-1/+0
| | | | | | | | Some of the files have both me and Jared McNeill and he gave me permission to remove it from his files too. Notes: svn path=/head/; revision=355357
* Improve cpufreq_dt.Michal Meloun2019-03-191-18/+40
| | | | | | | | | | | | | - older DT can use 'cpu0-supply' property for power supply binding. - don't expect that actual CPU frequency is contained in CPU operational point table, but read current CPU voltage directly from reguator. Typically, u-boot can set starting CPU frequency to any value. MFC after: 2 weeks Notes: svn path=/head/; revision=345297
* cpufreq_dt: Add operating-points-v2 supportEmmanuel Vadot2018-07-191-63/+227
| | | | | | | | | | | | | Oppv2 add more flexibility on regulator value for the core voltage amongst other new thing. For now only shared opp table is supported as I don't have hardware with non-shared opp table. Tested-On: OrangePi One (with oppv1 and oppv2) Tested-On: Pine64-LTS Notes: svn path=/head/; revision=336478
* Align OF_getencprop_alloc API with OF_getencprop and OF_getprop_allocOleksandr Tymoshenko2018-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Change OF_getencprop_alloc semantics to be combination of malloc and OF_getencprop and return size of the property, not number of elements allocated. For the use cases where number of elements is preferred introduce OF_getencprop_alloc_multi helper function that copies semantics of OF_getencprop_alloc prior to this change. This is to make OF_getencprop_alloc and OF_getencprop_alloc_multi function signatures consistent with OF_getencprop_alloc and OF_getencprop_alloc_multi. Functionality-wise this patch is mostly rename of OF_getencprop_alloc to OF_getencprop_alloc_multi except two calls in ofw_bus_setup_iinfo where 1 was used as a block size. Notes: svn path=/head/; revision=332341
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Add generic device-tree cpufreq driver.Jared McNeill2016-09-061-0/+360
| | | | | | | | | | | | | | This driver supports two bindings: - cpufreq-dt: systems which share clock and voltage across all CPUs - arm_big_little_dt: systems which share clock and voltage across all CPUs in a single cluster Reviewed by: andrew, imp Relnotes: yes Differential Revision: https://reviews.freebsd.org/D7741 Notes: svn path=/head/; revision=305498
* Add a quirk to disable this driver for certain older laptops with an ICH2John Baldwin2013-02-261-4/+17
| | | | | | | | | | | southbridge and an Intel 82815_MC host bridge where the host bridge's revision is less than 5. Tested by: mi MFC after: 1 week Notes: svn path=/head/; revision=247332
* Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on ↵Sofian Brabez2013-01-301-1/+1
| | | | | | | | | | device_method_t arrays Reviewed by: cognet Approved by: cognet Notes: svn path=/head/; revision=246128
* Attach the cpufreq child devices with specific orders to enforce relativeJohn Baldwin2008-08-131-1/+1
| | | | | | | | | | | | | | | | | priority of some of the drivers that manage the same state (e.g. ichss0 vs est0). Specifically, powernow, est, and p4tcc are added at order 10, ichss at order 20, and smist at order 30. Previously, some laptops were seeing both ichss0 and est0 attaching and stomping on each other. XXX: This isn't quite ideal, but works with the existing hacks, I think what we really want instead is a single "speedstep0" device for CPUs that the ichss, est, and smist drivers probe (but with differing priorities). MFC after: 1 week Notes: svn path=/head/; revision=181691
* Probe CPUs after the PCI hierarchy on i386, amd64, and ia64. This allowsJohn Baldwin2008-03-101-61/+50
| | | | | | | | | | | | | | | | | | | | the cpufreq drivers to reliably use properties of PCI devices for quirks, etc. - For the legacy drivers, add CPU devices via an identify routine in the CPU driver itself rather than in the legacy driver's attach routine. - Add CPU devices after Host-PCI bridges in the acpi bus driver. - Change the ichss(4) driver to use pci_find_bsf() to locate the ICH and check its device ID rather than having a bogus PCI attachment that only checked for the ID in probe and always failed. As a side effect, you can now kldload ichss after boot. - Fix the ichss(4) driver to use the correct device_t for the ICH (and not for ichss0) when doing PCI config space operations to enable SpeedStep. MFC after: 2 weeks Reviewed by: njl, Andriy Gapon avg of icyb.net.ua Notes: svn path=/head/; revision=177041
* Since DELAY() was moved, most <machine/clock.h> #includes have beenPoul-Henning Kamp2006-05-161-1/+0
| | | | | | | unnecessary. Notes: svn path=/head/; revision=158651
* Only activate ICH speedstep if we're going to use it. No bugs were observedNate Lawson2005-03-201-9/+9
| | | | | | | due to this but it's cleaner this way. Notes: svn path=/head/; revision=143859
* Make a pass through all drivers checking specs for desired behavior onNate Lawson2005-02-271-1/+5
| | | | | | | | | | SMP systems. It appears all drivers except ichss should attach to each CPU and that settings should be performed on each CPU. Add comments about this. Also, add a guard for p4tcc's identify method being called more than once. Notes: svn path=/head/; revision=142625
* Support disabling individual cpufreq drivers with hints, e.g.,Nate Lawson2005-02-221-0/+3
| | | | | | | hint.ichss.0.disabled="1" Notes: svn path=/head/; revision=142203
* Don't attach ichss if est is present. On systems that seem to support both,Nate Lawson2005-02-201-2/+6
| | | | | | | the multi-setting EST is preferable. Notes: svn path=/head/; revision=142156
* Introduce a new method, cpufreq_drv_type(), that returns the type of theNate Lawson2005-02-181-9/+18
| | | | | | | | | | | | | | driver. This used to be handled by cpufreq_drv_settings() but it's useful to get the type/flags separately from getting the settings. (For example, you don't have to pass an array of cf_setting just to find the driver type.) Use this new method in our in-tree drivers to detect reliably if acpi_perf is present and owns the hardware. This simplifies logic in drivers as well as fixing a bug introduced in my last commit where too many drivers attached. Notes: svn path=/head/; revision=142032
* Fix the check for acpi_perf(4) so that we verify if it is fully attachedNate Lawson2005-02-171-4/+14
| | | | | | | | | | | | or just offering info. In the former case, we don't probe/attach to allow the ACPI driver precedence. A refinement of this would be to actually use the info provided by acpi_perf(4) to get the real CPU clock rates instead of estimating them but since all systems that support both acpi_perf(4) and ichss(4) export the control registers to acpi_perf(4), it can just handle the registers on its own. Notes: svn path=/head/; revision=142002
* Use intr_disable/restore() instead of disable_intr() since the latter isNate Lawson2005-02-051-2/+3
| | | | | | | not MI. This should fix build on non i386 platforms. Notes: svn path=/head/; revision=141363
* Don't rely on indirect inclusion of machine/bus.h to useWarner Losh2005-02-041-0/+1
| | | | | | | | | bus_space_{read,write}_* routines. This doesn't matter in the current tree, but will matter soon (the rest of the tree appears to already be clean). Notes: svn path=/head/; revision=141293
* Add a cpufreq driver for the SpeedStep capability in the ICH chipset. ThisNate Lawson2005-02-041-0/+372
driver offers two settings. Information for this driver was obtained from the Intel datasheets and by reviewing the Linux driver. Notes: svn path=/head/; revision=141241