Lines Matching +full:bcm2835 +full:- +full:hdmi

1 // SPDX-License-Identifier: GPL-2.0+
5 * Even though clk-bcm2835 provides an interface to the hardware registers for
8 * over-temperature and under-voltage protections provided by the firmware.
14 #include <linux/clk-provider.h>
19 #include <soc/bcm2835/raspberrypi-firmware.h>
35 [RPI_FIRMWARE_PIXEL_BVB_CLK_ID] = "pixel-bvb",
99 * HDMI connector, the firmware will skip the HSM
110 * The clock is shared between the two HDMI controllers
161 * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
174 .id = cpu_to_le32(data->id),
191 struct raspberrypi_clk *rpi = data->rpi;
195 ret = raspberrypi_clock_property(rpi->firmware, data,
208 struct raspberrypi_clk *rpi = data->rpi;
212 ret = raspberrypi_clock_property(rpi->firmware, data,
224 struct raspberrypi_clk *rpi = data->rpi;
228 ret = raspberrypi_clock_property(rpi->firmware, data,
231 dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d\n",
241 struct raspberrypi_clk_variant *variant = data->variant;
249 req->rate = clamp(req->rate, req->min_rate, req->max_rate);
256 if (variant->minimize && req->min_rate > 0)
257 req->rate = req->min_rate;
279 data = devm_kzalloc(rpi->dev, sizeof(*data), GFP_KERNEL);
281 return ERR_PTR(-ENOMEM);
282 data->rpi = rpi;
283 data->id = id;
284 data->variant = variant;
286 init.name = devm_kasprintf(rpi->dev, GFP_KERNEL,
287 "fw-clk-%s",
292 data->hw.init = &init;
294 ret = raspberrypi_clock_property(rpi->firmware, data,
298 dev_err(rpi->dev, "Failed to get clock %d min freq: %d\n",
303 ret = raspberrypi_clock_property(rpi->firmware, data,
307 dev_err(rpi->dev, "Failed to get clock %d max freq: %d\n",
312 ret = devm_clk_hw_register(rpi->dev, &data->hw);
316 clk_hw_set_rate_range(&data->hw, min_rate, max_rate);
318 if (variant->clkdev) {
319 ret = devm_clk_hw_register_clkdev(rpi->dev, &data->hw,
320 NULL, variant->clkdev);
322 dev_err(rpi->dev, "Failed to initialize clkdev\n");
327 if (variant->min_rate) {
330 clk_hw_set_rate_range(&data->hw, variant->min_rate, max_rate);
332 rate = raspberrypi_fw_get_rate(&data->hw, 0);
333 if (rate < variant->min_rate) {
334 ret = raspberrypi_fw_set_rate(&data->hw, variant->min_rate, 0);
340 return &data->hw;
359 clks = devm_kcalloc(rpi->dev,
363 return -ENOMEM;
365 ret = rpi_firmware_property(rpi->firmware, RPI_FIRMWARE_GET_CLOCKS,
371 while (clks->id) {
374 if (clks->id >= RPI_FIRMWARE_NUM_CLK_ID) {
375 dev_err(rpi->dev, "Unknown clock id: %u (max: %u)\n",
376 clks->id, RPI_FIRMWARE_NUM_CLK_ID - 1);
377 return -EINVAL;
380 variant = &raspberrypi_clk_variants[clks->id];
381 if (variant->export) {
384 hw = raspberrypi_clk_register(rpi, clks->parent,
385 clks->id, variant);
389 data->num = clks->id + 1;
390 data->hws[clks->id] = hw;
403 struct device *dev = &pdev->dev;
409 * We can be probed either through the an old-fashioned
413 if (dev->of_node)
414 firmware_node = of_get_parent(dev->of_node);
417 "raspberrypi,bcm2835-firmware");
420 return -ENOENT;
423 firmware = devm_rpi_firmware_get(&pdev->dev, firmware_node);
426 return -EPROBE_DEFER;
430 return -ENOMEM;
432 rpi->dev = dev;
433 rpi->firmware = firmware;
440 return -ENOMEM;
451 rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
452 -1, NULL, 0);
461 platform_device_unregister(rpi->cpufreq);
465 { .compatible = "raspberrypi,firmware-clocks" },
472 .name = "raspberrypi-clk",
483 MODULE_ALIAS("platform:raspberrypi-clk");