drivers/clk/bcm/clk-raspberrypi.c
Source file repositories/reference/linux-study-clean/drivers/clk/bcm/clk-raspberrypi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/bcm/clk-raspberrypi.c- Extension
.c- Size
- 15625 bytes
- Lines
- 586
- Domain
- Driver Families
- Bucket
- drivers/clk
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clkdev.hlinux/clk-provider.hlinux/io.hlinux/module.hlinux/platform_device.hsoc/bcm2835/raspberrypi-firmware.h
Detected Declarations
struct raspberrypi_clk_variantstruct raspberrypi_clkstruct raspberrypi_clk_datastruct raspberrypi_clk_variantstruct raspberrypi_firmware_propstruct rpi_firmware_get_clocks_responsefunction raspberrypi_clock_propertyfunction raspberrypi_fw_is_preparedfunction raspberrypi_fw_get_ratefunction raspberrypi_fw_set_ratefunction raspberrypi_fw_dumb_determine_ratefunction raspberrypi_fw_preparefunction unpreparefunction raspberrypi_fw_unpreparefunction raspberrypi_discover_clocksfunction raspberrypi_clk_probefunction raspberrypi_clk_remove
Annotated Snippet
struct raspberrypi_clk {
struct device *dev;
struct rpi_firmware *firmware;
struct platform_device *cpufreq;
};
struct raspberrypi_clk_data {
struct clk_hw hw;
unsigned int id;
struct raspberrypi_clk_variant *variant;
struct raspberrypi_clk *rpi;
};
static inline
const struct raspberrypi_clk_data *clk_hw_to_data(const struct clk_hw *hw)
{
return container_of(hw, struct raspberrypi_clk_data, hw);
}
struct raspberrypi_clk_variant {
bool export;
char *clkdev;
unsigned long min_rate;
bool minimize;
bool maximize;
u32 flags;
};
static struct raspberrypi_clk_variant
raspberrypi_clk_variants[RPI_FIRMWARE_NUM_CLK_ID] = {
[RPI_FIRMWARE_ARM_CLK_ID] = {
.export = true,
.clkdev = "cpu0",
.flags = CLK_IS_CRITICAL,
},
[RPI_FIRMWARE_CORE_CLK_ID] = {
.export = true,
/*
* The clock is shared between the HVS and the CSI
* controllers, on the BCM2711 and will change depending
* on the pixels composited on the HVS and the capture
* resolution on Unicam.
*
* Since the rate can get quite large, and we need to
* coordinate between both driver instances, let's
* always use the minimum the drivers will let us.
*/
.minimize = true,
/*
* It should never be disabled as it drives the bus for
* everything else.
*/
.flags = CLK_IS_CRITICAL,
},
[RPI_FIRMWARE_M2MC_CLK_ID] = {
.export = true,
/*
* If we boot without any cable connected to any of the
* HDMI connector, the firmware will skip the HSM
* initialization and leave it with a rate of 0,
* resulting in a bus lockup when we're accessing the
* registers even if it's enabled.
*
* Let's put a sensible default so that we don't end up
* in this situation.
*/
.min_rate = 120000000,
/*
* The clock is shared between the two HDMI controllers
* on the BCM2711 and will change depending on the
* resolution output on each. Since the rate can get
* quite large, and we need to coordinate between both
* driver instances, let's always use the minimum the
* drivers will let us.
*/
.minimize = true,
/*
* As mentioned above, this clock is disabled during boot,
* the firmware will skip the HSM initialization, resulting
* in a bus lockup. Therefore, make sure it's enabled
* during boot, but after it, it can be enabled/disabled
* by the driver.
*/
Annotation
- Immediate include surface: `linux/clkdev.h`, `linux/clk-provider.h`, `linux/io.h`, `linux/module.h`, `linux/platform_device.h`, `soc/bcm2835/raspberrypi-firmware.h`.
- Detected declarations: `struct raspberrypi_clk_variant`, `struct raspberrypi_clk`, `struct raspberrypi_clk_data`, `struct raspberrypi_clk_variant`, `struct raspberrypi_firmware_prop`, `struct rpi_firmware_get_clocks_response`, `function raspberrypi_clock_property`, `function raspberrypi_fw_is_prepared`, `function raspberrypi_fw_get_rate`, `function raspberrypi_fw_set_rate`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.