Lines Matching refs:rpi
70 struct raspberrypi_clk *rpi; member
117 struct raspberrypi_clk *rpi = data->rpi; in raspberrypi_fw_is_prepared() local
121 ret = raspberrypi_clock_property(rpi->firmware, data, in raspberrypi_fw_is_prepared()
135 struct raspberrypi_clk *rpi = data->rpi; in raspberrypi_fw_get_rate() local
139 ret = raspberrypi_clock_property(rpi->firmware, data, in raspberrypi_fw_get_rate()
152 struct raspberrypi_clk *rpi = data->rpi; in raspberrypi_fw_set_rate() local
156 ret = raspberrypi_clock_property(rpi->firmware, data, in raspberrypi_fw_set_rate()
159 dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d", in raspberrypi_fw_set_rate()
184 static struct clk_hw *raspberrypi_clk_register(struct raspberrypi_clk *rpi, in raspberrypi_clk_register() argument
193 data = devm_kzalloc(rpi->dev, sizeof(*data), GFP_KERNEL); in raspberrypi_clk_register()
196 data->rpi = rpi; in raspberrypi_clk_register()
199 init.name = devm_kasprintf(rpi->dev, GFP_KERNEL, in raspberrypi_clk_register()
207 ret = raspberrypi_clock_property(rpi->firmware, data, in raspberrypi_clk_register()
211 dev_err(rpi->dev, "Failed to get clock %d min freq: %d", in raspberrypi_clk_register()
216 ret = raspberrypi_clock_property(rpi->firmware, data, in raspberrypi_clk_register()
220 dev_err(rpi->dev, "Failed to get clock %d max freq: %d\n", in raspberrypi_clk_register()
225 ret = devm_clk_hw_register(rpi->dev, &data->hw); in raspberrypi_clk_register()
232 ret = devm_clk_hw_register_clkdev(rpi->dev, &data->hw, in raspberrypi_clk_register()
235 dev_err(rpi->dev, "Failed to initialize clkdev\n"); in raspberrypi_clk_register()
248 static int raspberrypi_discover_clocks(struct raspberrypi_clk *rpi, in raspberrypi_discover_clocks() argument
254 clks = devm_kcalloc(rpi->dev, in raspberrypi_discover_clocks()
260 ret = rpi_firmware_property(rpi->firmware, RPI_FIRMWARE_GET_CLOCKS, in raspberrypi_discover_clocks()
275 hw = raspberrypi_clk_register(rpi, clks->parent, in raspberrypi_discover_clocks()
299 struct raspberrypi_clk *rpi; in raspberrypi_clk_probe() local
322 rpi = devm_kzalloc(dev, sizeof(*rpi), GFP_KERNEL); in raspberrypi_clk_probe()
323 if (!rpi) in raspberrypi_clk_probe()
326 rpi->dev = dev; in raspberrypi_clk_probe()
327 rpi->firmware = firmware; in raspberrypi_clk_probe()
328 platform_set_drvdata(pdev, rpi); in raspberrypi_clk_probe()
336 ret = raspberrypi_discover_clocks(rpi, clk_data); in raspberrypi_clk_probe()
345 rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq", in raspberrypi_clk_probe()
353 struct raspberrypi_clk *rpi = platform_get_drvdata(pdev); in raspberrypi_clk_remove() local
355 platform_device_unregister(rpi->cpufreq); in raspberrypi_clk_remove()