[PATCH v7 06/10] clk: Add Sunplus SP7021 clock driver

qinjian[覃健] qinjian at cqplus1.com
Thu Jan 6 23:55:18 PST 2022


> > +
> > +CLK_OF_DECLARE_DRIVER(sp_clkc, "sunplus,sp7021-clkc", sp_clk_setup);
> 
> Why CLK_OF_DECLARE_DRIVER? There should be a comment but better would be
> to make a platform driver instead. If the platform driver can't be used,
> we need to know what other device driver is probing based on this clkc
> compatible string.

Dear Stephen,

Sorry, I don't understand your comment.
Did you mean, like below:

static int sp7021_clk_probe(struct platform_device *pdev)
{
	......
	sp_clk_data->num = CLK_MAX;
	return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, sp_clk_data);
}

static const struct of_device_id sp7021_clk_dt_ids[] = {
	{ .compatible = "sunplus,sp7021-clkc", },
	{ }
};
MODULE_DEVICE_TABLE(of, sp7021_clk_dt_ids);

static struct platform_driver sp7021_clk_driver = {
	.probe  = sp7021_clk_probe,
	.driver = {
		.name = "sp7021-clk",
		.of_match_table = sp7021_clk_dt_ids,
	},
};
builtin_platform_driver(sp7021_clk_driver);


But, It's doesn't work. 
Most other clk drivers used CLK_OF_DECLARE_DRIVER or CLK_OF_DECLARE.
I just take these as the reference and it's working.


More information about the linux-arm-kernel mailing list