Re: [PATCH 1/2] regulator: pca9450: Correct default t_off_deb for PCA9451A/PCA9452

From: Frank Li

Date: Wed Jun 17 2026 - 23:08:14 EST


On Thu, Jun 18, 2026 at 10:03:05AM +0800, joy.zou@xxxxxxxxxxx wrote:
> From: Joy Zou <joy.zou@xxxxxxx>
>
> The PMIC PCA9451A and PCA9452 have a default power-off debounce time of
> 2ms according to their datasheet, while PCA9450A and PCA9450BC use 120us.
>
> Add default_t_off_deb field to struct pca9450 to support per-variant
> default configuration when the device tree property is not specified.
>
> Datasheet reference links:
> - PCA9451A Rev.2.1: https://www.nxp.com/docs/en/data-sheet/PCA9451A.pdf
> - PCA9452 Rev.1.0: https://www.nxp.com/docs/en/data-sheet/PCA9452.pdf
>
> Signed-off-by: Joy Zou <joy.zou@xxxxxxx>
> ---

If you have time, suggest change to use drvdata replace switch case.

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> Changes in v2:
> 1. remove original switch case changes, and add default_t_off_deb field to
> struct pca9450 to support per-variant default configuration.
> 2. modify commit message.
> ---
> drivers/regulator/pca9450-regulator.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
> index 45d7dc44c2cd..c41db70fa052 100644
> --- a/drivers/regulator/pca9450-regulator.c
> +++ b/drivers/regulator/pca9450-regulator.c
> @@ -44,6 +44,7 @@ struct pca9450 {
> unsigned int rcnt;
> int irq;
> bool sd_vsel_fixed_low;
> + int default_t_off_deb;
> };
>
> static const struct regmap_range pca9450_status_range = {
> @@ -1209,7 +1210,7 @@ static int pca9450_of_init(struct pca9450 *pca9450)
>
> ret = of_property_read_u32(i2c->dev.of_node, "nxp,pmic-on-req-off-debounce-us", &val);
> if (ret == -EINVAL)
> - t_off_deb = T_OFF_DEB_120US;
> + t_off_deb = pca9450->default_t_off_deb;
> else if (ret)
> return ret;
> else {
> @@ -1304,21 +1305,25 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
> case PCA9450_TYPE_PCA9450A:
> regulator_desc = pca9450a_regulators;
> pca9450->rcnt = ARRAY_SIZE(pca9450a_regulators);
> + pca9450->default_t_off_deb = T_OFF_DEB_120US;
> type_name = "pca9450a";
> break;
> case PCA9450_TYPE_PCA9450BC:
> regulator_desc = pca9450bc_regulators;
> pca9450->rcnt = ARRAY_SIZE(pca9450bc_regulators);
> + pca9450->default_t_off_deb = T_OFF_DEB_120US;
> type_name = "pca9450bc";
> break;
> case PCA9450_TYPE_PCA9451A:
> regulator_desc = pca9451a_regulators;
> pca9450->rcnt = ARRAY_SIZE(pca9451a_regulators);
> + pca9450->default_t_off_deb = T_OFF_DEB_2MS;
> type_name = "pca9451a";
> break;
> case PCA9450_TYPE_PCA9452:
> regulator_desc = pca9451a_regulators;
> pca9450->rcnt = ARRAY_SIZE(pca9451a_regulators);
> + pca9450->default_t_off_deb = T_OFF_DEB_2MS;
> type_name = "pca9452";
> break;
> default:
>
> --
> 2.34.1
>
>