Re: [PATCH v7 07/15] clk: ambarella: add CV75 RCT clock controller
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2026-09-15 13:27:47
Also in:
linux-clk, linux-devicetree, linux-gpio, linux-serial, lkml
On Tue, Sep 15, 2026 at 07:15:37PM +0800, Long Zhao via B4 Relay wrote:
Add a table-driven CCF driver for the CV75 root clock tree. Register the core PLL, AHB/APB fixed factors and UART0 composite clock, with osc supplied via clk_parent_data.
...
+#include <linux/array_size.h> +#include <linux/bitfield.h> +#include <linux/bits.h> +#include <linux/clk-provider.h> +#include <linux/container_of.h> +#include <linux/device.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/math64.h>
+#include <linux/mod_devicetable.h>
No new driver should use this, ID tables are provided by...
+#include <linux/module.h> +#include <linux/overflow.h> +#include <linux/platform_device.h>
^^^...this one.
+#include <linux/slab.h> +#include <linux/spinlock.h> +#include <linux/types.h>
...
+struct cv75_fixed_factor {
+ const char *name;
+ u32 id;+ u16 mult; + u16 div;
There is struct u16_fract in math.h. Can you use it instead of these two?
+};
...
+static int cv75_rct_probe(struct platform_device *pdev)
+{
+ struct clk_hw_onecell_data *data;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ spin_lock_init(&cv75_ccu.lock);
+
+ cv75_ccu.base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(cv75_ccu.base))
+ return PTR_ERR(cv75_ccu.base);+ data = devm_kzalloc(dev, struct_size(data, hws, CV75_NUM_CLKS), + GFP_KERNEL);
I think it's okay to have this on a single line.
+ if (!data) + return -ENOMEM; + data->num = CV75_NUM_CLKS; + + ret = cv75_register_plls(dev, data); + if (ret) + return dev_err_probe(dev, ret, "failed to register plls\n"); + + ret = cv75_register_fixed_factors(dev, data); + if (ret) + return dev_err_probe(dev, ret, "failed to register fixed factors\n"); + + ret = cv75_register_composites(dev, data); + if (ret) + return dev_err_probe(dev, ret, "failed to register composites\n"); + + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, data); + if (ret) + return dev_err_probe(dev, ret, "failed to add clock provider\n"); + + return 0; +}
-- With Best Regards, Andy Shevchenko