示例:bsp\kernel\kernel5.4\drivers\power\supply\bq2560x-charger.c
1.定义 device_node platform_device结构体指针
struct bq2560x_charger_info *info;
struct device_node *regmap_np;
struct platform_device *regmap_pdev;
2. 获取dts中的"sprd,sc27xx-syscon" node
syscon@1800 {
compatible = "sprd,sc2731-syscon", "sprd,sc27xx-syscon";
reg = <0x1800>, <0x1ba0>, <0x1b98>;
};
regmap_np = of_find_compatible_node(NULL, NULL, "sprd,sc27xx-syscon");
if (!regmap_np)
regmap_np = of_find_compatible_node(NULL, NULL, "sprd,ump962x-syscon");
if (regmap_np) {
if (of_device_