[PATCH v1 3/7] power: reset: qcom-pon: Migrate to devm_spmi_subdevice_alloc_and_add()

Andy Shevchenko andriy.shevchenko at intel.com
Mon Jul 21 04:36:57 PDT 2025


On Mon, Jul 21, 2025 at 09:55:21AM +0200, AngeloGioacchino Del Regno wrote:
> Some Qualcomm PMICs integrates a Power On device supporting pwrkey
> and resin along with the Android reboot reason action identifier.
> 
> Instead of using the parent SPMI device (the main PMIC) as a kind
> of syscon in this driver, register a new SPMI sub-device for PON
> and initialize its own regmap with this sub-device's specific base
> address, retrieved from the devicetree.
> 
> This allows to stop manually adding the register base address to
> every R/W call in this driver, as this can be, and is now, handled
> by the regmap API instead.

...

> +	struct regmap_config qcom_pon_regmap_config = {
> +		.reg_bits = 16,
> +		.val_bits = 16,
> +		.max_register = 0x100,
> +		.fast_io = true

Please, leave trailing comma in this and other similar cases.

> +	};


>  	struct qcom_pon *pon;
>  	long reason_shift;
>  	int error;

> +	if (!pdev->dev.parent)
> +		return -ENODEV;

You can start using

	struct device *dev = &pdev->dev;

here and perhaps one may convert the rest to it...

...

>  	error = of_property_read_u32(pdev->dev.of_node, "reg",

...including, but not limited to, use of device_property_read_u32(dev, ...) here.

> -				     &pon->baseaddr);
> +				     &qcom_pon_regmap_config.reg_base);

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-phy mailing list