From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C55846A5F2 for ; Mon, 14 Sep 2026 21:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420281; cv=none; b=OEL4M3yoVOGP8kj8gx0FUFm39ku6ZgWiAm64EpClbovRwt4byUvfjJAuKHKZEzw0On9S72rnlkCuw5Qzi2SUeSOktl60x20cvmSxrOy/SWbQ4ff8p2vRkSpWh+BOsFsBI3lECZr61uuvXfEm+NPZeiItY2SfSAfDJf25sBkXX/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420281; c=relaxed/simple; bh=zwEor6K8yGoFURlxDvbOjCkK1oLF41ASBn1v919rW7k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o37KFNDfv846KS74aXbF6ASGxvlVqpIar8MEYTVDgW+9uN0U8TKoHUKMcvIEVFXApIe27XhN7Gh2Tbe0cPUTm108Kawv3H1HgrNKcwDOmw3QS7ZpWrcZyMTT8ImdGjZAPex0oo7kXF2ho4AlB6/EO2dYx9x9sRzpaX/2nk/o6jQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lp2gqsoA; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lp2gqsoA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE9511F00893; Mon, 14 Sep 2026 21:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420280; bh=S6FY7ZetqMty4OJBLyaiR50VfGzmS5JdgvQQAtmW5og=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=lp2gqsoAekT9AER+Ra3HmDDAHtx3rK9F7YiixZaWEgpRL/IH+ilZ5xeofYb8OGHbo a2XYrRxI0gLDG3vQ8yWTQHdYMQOIUi6NxP9gGCq3hM/ViwyI1dEm1jxwKBrKtLvH6w DIj56zVCjPqj9sCSkUqndFcRs/4j21tceveiTAV8e6jWF8pTAiAE1wMZo7NZoeUofW 05E3DxHSs5cCJWaLENRYXAAd3LjBObePgYOqVSP2a05H9Q7+eylPvFGgqgCEko7hzL y8KWjZFNl7eAwz+e9dKgMSa3zWnJlTVLuLbrDf1OyI4neAsw9RG7PycwxK2Qsh19WR jqwf1xaEkcL5A== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:14 +0200 Subject: [PATCH v4 01/10] regulator: ab8500: Fix AB8505 VANA voltage selectors Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-1-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 The AB8505 VANA voltage table assumes selector 0 represents 1.05 V and all eight selectors increase linearly. Selector 0 actually represents 1.2 V. Selectors 1 through 6 cover 1.05 V through 1.175 V, and selector 7 represents 1.225 V. Correct the table so each selector reports and programs the documented voltage. Reference: AB8505 User Manual, DM00046744 Rev 3, p. 257 Fixes: 8a3b1b8703fe ("regulator: ab8500: Add voltage selection for AUDIO an= d ANA on AB8505") Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 3705c98b0713..ca59406d42a8 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -264,13 +264,13 @@ static const unsigned int fixed_2050000_voltage[] =3D= { }; =20 static const unsigned int ldo_vana_voltages[] =3D { + 1200000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, - 1200000, 1225000, }; =20 --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FF094A2068 for ; Mon, 14 Sep 2026 21:11:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420283; cv=none; b=adSNGeufg49N3uin1Cf1mhvvom8FmD5oD/v9ho0mk+m0ntxewEWL3f6W0uHWdIfadx1tR8fboET3IRoZT42EwWOXC49vILR4iYhRykGAZjWikIpK5JwHq9woG5cSGun5F1iDV7Iem5pV2z81mjntUtGPY6i7HUKmYja2EtLHvaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420283; c=relaxed/simple; bh=ef+oXwxcVa8FKk7hEmWZPLiJFVo/qq/f25Yz8mXsKCA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R8tVxeWsvVmlk81U7JP1Cu4+PpPx3Y2XwPODsKLDYFrEFvzK1jpBfBcd/DRBF5Kk1nW9CUpvQDbMpS+F4IGSSzsTATmK14DE/iYIgJ11OtJnBMHsNt3BllcAZwKNq7V82JTeBcV8WluGqYqQqXhAbA6ciYWNG4IlowIAHenxpUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZsSkzecW; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZsSkzecW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A04311F000FF; Mon, 14 Sep 2026 21:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420281; bh=Fr64MGYLyhfXI/VcMfbC/lq4kwHH2zRzUBhtquow60k=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ZsSkzecWhpbA1tgtgjLfTCESzbxghymNk0Sx7BBBP369bxakghmJhIg9SpFL1HCCa DUJda/aj7riZ7qZ2TEPqbtqe+SZC0j7l++XcqNn2vunOV+5uO/IDVNT/0S90nKssLE LhruIA7XfRui/i9u6SlcUbJzDMgKqHSsRa+UCiiMZBZSbJO12ACKqXAjcg1Uc5LnDv 9Nlsl7gRs+gQZ+Ha1VrWo9+LixdSxMcxTjT9vQa1TfTvFv+qdymuo+PI9ZwUTT9u57 YwykMs4aWhXL0wC1eqVNNaW+EndSGi3g4ue2JuY/1AeLZMTPaF97OkPTlQ0dWuWjvS Yfe2fQYK/OhQA== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:15 +0200 Subject: [PATCH v4 02/10] regulator: ab8500: Add AB8505 VAUX3 3.05 V setting Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-2-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 AB8505 has an additional VAUX3 voltage setting which is not encoded in the normal three-bit selector. ArmRegu2.Vaux3Sel3 overrides that selector and selects 3.05 V. Add the missing voltage and use the override bit as an extended selector. Program the ordinary selector before clearing the override so VAUX3 does not briefly switch to a stale voltage. Reference: AB8505 User Manual, DM00046744 Rev 3, pp. 229 and 254 Fixes: 547f384f33db ("regulator: ab8500: add support for ab8505") Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 101 +++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 98 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index ca59406d42a8..07d96f8ff944 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -173,6 +173,7 @@ struct ab8500_shared_mode { * @voltage_bank: bank to control regulator voltage * @voltage_reg: register to control regulator voltage * @voltage_mask: mask to control regulator voltage + * @expand_register: additional register used to select an extra voltage */ struct ab8500_regulator_info { struct device *dev; @@ -193,6 +194,12 @@ struct ab8500_regulator_info { u8 voltage_bank; u8 voltage_reg; u8 voltage_mask; + struct { + u8 voltage_limit; + u8 voltage_bank; + u8 voltage_reg; + u8 voltage_mask; + } expand_register; }; =20 /* voltage tables for the vauxn/vintcore supplies */ @@ -226,6 +233,18 @@ static const unsigned int ldo_vaux3_voltages[] =3D { 2910000, }; =20 +static const unsigned int ldo_vaux3_ab8505_voltages[] =3D { + 1200000, + 1500000, + 1800000, + 2100000, + 2500000, + 2750000, + 2790000, + 2910000, + 3050000, +}; + static const unsigned int ldo_vaux56_voltages[] =3D { 1800000, 1050000, @@ -593,6 +612,64 @@ static int ab8500_regulator_set_voltage_sel(struct reg= ulator_dev *rdev, return ret; } =20 +static int ab8500_regulator_get_voltage_sel_expand(struct regulator_dev *r= dev) +{ + struct ab8500_regulator_info *info =3D rdev_get_drvdata(rdev); + u8 regval; + int ret; + + if (!info) + return -EINVAL; + + ret =3D abx500_get_register_interruptible(info->dev, + info->expand_register.voltage_bank, + info->expand_register.voltage_reg, ®val); + if (ret < 0) { + dev_err(rdev_get_dev(rdev), + "couldn't read voltage expand reg for regulator\n"); + return ret; + } + + if (regval & info->expand_register.voltage_mask) + return info->expand_register.voltage_limit; + + return ab8500_regulator_get_voltage_sel(rdev); +} + +static int ab8500_regulator_set_voltage_sel_expand(struct regulator_dev *r= dev, + unsigned int selector) +{ + struct ab8500_regulator_info *info =3D rdev_get_drvdata(rdev); + u8 regval; + int ret; + + if (!info) + return -EINVAL; + + if (selector > info->expand_register.voltage_limit) + return -EINVAL; + + if (selector < info->expand_register.voltage_limit) { + ret =3D ab8500_regulator_set_voltage_sel(rdev, selector); + if (ret < 0) + return ret; + + regval =3D 0; + } else { + regval =3D info->expand_register.voltage_mask; + } + + ret =3D abx500_mask_and_set_register_interruptible(info->dev, + info->expand_register.voltage_bank, + info->expand_register.voltage_reg, + info->expand_register.voltage_mask, regval); + if (ret < 0) + dev_err(rdev_get_dev(rdev), + "couldn't set voltage expand reg for regulator\n"); + + return ret; +} + static const struct regulator_ops ab8500_regulator_volt_mode_ops =3D { .enable =3D ab8500_regulator_enable, .disable =3D ab8500_regulator_disable, @@ -605,6 +682,18 @@ static const struct regulator_ops ab8500_regulator_vol= t_mode_ops =3D { .list_voltage =3D regulator_list_voltage_table, }; =20 +static const struct regulator_ops ab8500_regulator_volt_mode_expand_ops = =3D { + .enable =3D ab8500_regulator_enable, + .disable =3D ab8500_regulator_disable, + .is_enabled =3D ab8500_regulator_is_enabled, + .get_optimum_mode =3D ab8500_regulator_get_optimum_mode, + .set_mode =3D ab8500_regulator_set_mode, + .get_mode =3D ab8500_regulator_get_mode, + .get_voltage_sel =3D ab8500_regulator_get_voltage_sel_expand, + .set_voltage_sel =3D ab8500_regulator_set_voltage_sel_expand, + .list_voltage =3D regulator_list_voltage_table, +}; + static const struct regulator_ops ab8500_regulator_volt_ops =3D { .enable =3D ab8500_regulator_enable, .disable =3D ab8500_regulator_disable, @@ -908,12 +997,12 @@ static struct ab8500_regulator_info [AB8505_LDO_AUX3] =3D { .desc =3D { .name =3D "LDO-AUX3", - .ops =3D &ab8500_regulator_volt_mode_ops, + .ops =3D &ab8500_regulator_volt_mode_expand_ops, .type =3D REGULATOR_VOLTAGE, .id =3D AB8505_LDO_AUX3, .owner =3D THIS_MODULE, - .n_voltages =3D ARRAY_SIZE(ldo_vaux3_voltages), - .volt_table =3D ldo_vaux3_voltages, + .n_voltages =3D ARRAY_SIZE(ldo_vaux3_ab8505_voltages), + .volt_table =3D ldo_vaux3_ab8505_voltages, }, .load_lp_uA =3D 5000, .update_bank =3D 0x04, @@ -925,6 +1014,12 @@ static struct ab8500_regulator_info .voltage_bank =3D 0x04, .voltage_reg =3D 0x21, .voltage_mask =3D 0x07, + .expand_register =3D { + .voltage_limit =3D 8, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x01, + .voltage_mask =3D 0x10, + }, }, [AB8505_LDO_AUX4] =3D { .desc =3D { --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D149F4A2608 for ; Mon, 14 Sep 2026 21:11:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420284; cv=none; b=ZWxpNyhjRdNZ78tcTsvR6BK0TjAnWl5DQJ0Q3aKtLES7bho9IM+B1G04adL9OfTtlkIYpeSrjRH0ESGtIqWnhrjcXHou4ihjplsBsOQB8im9ySboPXUDNLkfakgm69eAx9T3EiJdVJomyPm8vAhiOhzmMEN0a0dngBqK3OHYMkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420284; c=relaxed/simple; bh=cB+fFscuIXMfLe/OVF0fbusXR/2htOwHCywwC00gyro=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mALPRPB+Dtm0mF1GJtuTeah8tKoIqr2sYxek1sXSq+odb3YRpwjvxn8vlJraqARnOwiL9LXYeL6FHFmskGrnSrYAgwMWm6zeY9yCN3cwZjWxhU5rqApG/qr1my872axsGKxIXIgxHaPj31zM6Rd4YlhabU48u7GOrmVY3SyE7uo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gHcXAgeV; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gHcXAgeV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51DAF1F00893; Mon, 14 Sep 2026 21:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420283; bh=uadjvHfGlhBu4sVq6tllQ+UPTpmDztODzyfXrEERPV8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=gHcXAgeVw3h+m0UQmNIJLn4CO7SCrIcLyL+RS6TFya1C6mxRK8iHIupCxzru7P/dm bA1vR0SyfFcQoaxws/8zgZapcxcdQ/huxM4BFYAI66bmLy8arZqeER1sUQ5BzCOz1M WwwfOsgcwsVWelNor0eB45VPR+3Dii2s6EM+G7HFI01mWSnvt1bsJB2vZCk02/51lE b0C1R0EVuPQ231xy3xSTS60yBehY7rU4T19rdmhkUpJCtiSYH021NRLQpcRbKQBKo5 Pd1N+F4cFcIbypzUNeKa42NQnUsEXoHOEUnRYX3QWwVbAvC+5iJ91dpdyFie1zx5Jk 5PSLoCDF/yOkw== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:16 +0200 Subject: [PATCH v4 03/10] regulator: ab8500: Handle AB8505 VINTCORE selector 7 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-3-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 The AB8505 VINTCORE table exposes only selectors 0 through 6. The hardware also accepts selector 7 and maps it to 1.35 V, just like selector 6. Omitting it can make an OTP-programmed selector 7 appear invalid to the regulator core. Give AB8505 its own eight-entry selector table while leaving the AB8500 table unchanged. Reference: AB8505 User Manual, DM00046744 Rev 3, p. 223 Fixes: 547f384f33db ("regulator: ab8500: add support for ab8505") Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 07d96f8ff944..5e24e6cdc773 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -266,6 +266,17 @@ static const unsigned int ldo_vintcore_voltages[] =3D { 1350000, }; =20 +static const unsigned int ldo_vintcore_ab8505_voltages[] =3D { + 1200000, + 1225000, + 1250000, + 1275000, + 1300000, + 1325000, + 1350000, + 1350000, +}; + static const unsigned int fixed_1200000_voltage[] =3D { 1200000, }; @@ -1095,8 +1106,8 @@ static struct ab8500_regulator_info .type =3D REGULATOR_VOLTAGE, .id =3D AB8505_LDO_INTCORE, .owner =3D THIS_MODULE, - .n_voltages =3D ARRAY_SIZE(ldo_vintcore_voltages), - .volt_table =3D ldo_vintcore_voltages, + .n_voltages =3D ARRAY_SIZE(ldo_vintcore_ab8505_voltages), + .volt_table =3D ldo_vintcore_ab8505_voltages, }, .load_lp_uA =3D 5000, .update_bank =3D 0x03, --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CCE14A2636 for ; Mon, 14 Sep 2026 21:11:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420287; cv=none; b=GXinYl9WgIRareiw8zwGeKSl0eAgxK/fiTFAOdEdlsycowsLczpOyqg99r8jDLA8CQ0zJijmq75a4LlXVuQRr1QUcrweRyAyjXSaoCpDEyO70MGREU8JRp4f5DrDe/riJM+VynpWQrmBiVnLh5iblFOFcg9XPEVLDOfd5hIsvVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420287; c=relaxed/simple; bh=5L7BeYhXO/6uJ84EQV5MJCSYczZ7+SYHAwWJcZPwu9U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YcgziFnxzUHpX7uo2Te+SCU6hVe4PkvFqXIb+qTcIEb0S0v9vUUlrY0swqHoexssBQ13Ms0NnWL+7U45z6FLKOvlZl3JRa4KQJVgsNRaOYTTPGYujZyP0sunWZs8Odiql1CXLfmpXmzzCLTQhGDXP2cBko+CIWV3C7nPJI8AkE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lrSb/4BS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lrSb/4BS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02F301F000FF; Mon, 14 Sep 2026 21:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420285; bh=W7I499jooT1wgVBKh3MKxZ2T8LqsKbR+3xzF5b+GSow=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=lrSb/4BSoZ4dNUp3utygWXXefgXhY3fNnf2E20hmriN9cQ/C1do4RF8JxkP7UpfUG ES9iDzSXnllNr0dcn8+LZnLT7iFMA+D4hz66kyzLux4InLjqfTKoMbOmdfAwo7SULr 5BMzthv5EKZafK0Cps4FcD8P7oxo0KRs1aDQtKvsfMDJQueO4cPt33M1j9On0c95uR Fa5tdkZLWY5IzxmOG4ySTQO66aORzpUQsnv0eFYv8v1kULFjOx2YlHGOmN8iQeIdTf ifUlV3Ktl7tHYKqO+SBR+Hhf8iHQT4ps0Bc5L4LQ5YVV2COU4KbKmo5igdnFaDnIRO 1L0q++O7O1heQ== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:17 +0200 Subject: [PATCH v4 04/10] regulator: ab8500: Treat cut 1.0 VAUX3 as fixed Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-4-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 The early-cut workaround currently gives AB8500 cut 1.0 the 16 programmable VAUX3 settings introduced with cut 1.1. On cut 1.0 the selector is not programmable and VAUX3 is fixed at 1.2 V. Register VAUX3 as a fixed-voltage regulator on cut 1.0 and retain the 16-value workaround only for cut 1.1. Reference: AB8500 User Manual, UM0836 Rev 3, p. 240 Fixes: 2b75151a1041 ("regulators: Added ab8500 v2 support") Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 5e24e6cdc773..42cb8dfdc7c9 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -1783,9 +1783,14 @@ static int ab8500_regulator_register(struct platform= _device *pdev, config.driver_data =3D info; config.of_node =3D np; =20 - /* fix for hardware before ab8500v2.0 */ - if (is_ab8500_1p1_or_earlier(ab8500)) { - if (info->desc.id =3D=3D AB8500_LDO_AUX3) { + /* Handle the different VAUX3 implementations in early AB8500 cuts. */ + if (info->desc.id =3D=3D AB8500_LDO_AUX3) { + if (is_ab8500_1p0_or_earlier(ab8500)) { + info->desc.ops =3D &ab8500_regulator_mode_ops; + info->desc.n_voltages =3D 1; + info->desc.volt_table =3D fixed_1200000_voltage; + info->voltage_mask =3D 0; + } else if (is_ab8500_1p1_or_earlier(ab8500)) { info->desc.n_voltages =3D ARRAY_SIZE(ldo_vauxn_voltages); info->desc.volt_table =3D ldo_vauxn_voltages; --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 400144A2A69 for ; Mon, 14 Sep 2026 21:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420288; cv=none; b=V06IJklqccVyXHp7hef0dDEMwS4zF+51awIVFZvcJ5ySaFZF00+l+Pzd7vWS5oKcqs995nqOnhVP/YwJSDTyKHJVbhlq6NbwwxKZpZWHgBdVyR3T1LjJ+K8YKq26xjKj51GTZTiY7vYKjUQwj5ToCJntYYJX90tCMso9K4DTAJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420288; c=relaxed/simple; bh=sm7o6cCzp8flppDMwW5Z+rofLj0ey1Q6EInHqIwTGW8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hkOwQgM+q1lXoV8Rpq2HeKCToOnX/4SaLBCbDm/cdbHcai1ivhDkn+izD5GOpEmNs3R4SHtaS20H2smL8XtJrgqH/zcoGXiExfSjRjECBHAsEec21IYA1IBroYzzdEbJyA7XFQFaKP/Ez+E0JrsPSe+9p0aQph/nM9ParTI2FAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fruSOOU5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fruSOOU5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8FE91F00893; Mon, 14 Sep 2026 21:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420286; bh=cYxLvSFl/YWS+JRovkLaSv4pMP7UxSGmiLqc9zYTVx0=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=fruSOOU5y50wTvkWq9Q+iLKfDDZaZMRyyoHMwft+bUygyz2OBly5SIY9tslwOtxXw iAjRLHvleImwCNRC/OIjlTHmbuPoq59dtAYhvh1AzNCpW6wHnR928s4Y5U1mywoxr0 wyBiorEIiRX9k++gbm25wWv2uTGSH/y8BmTk8LwLJc0Qz2NvGw32P78Z1IuKFh/3Wt ma3NRwmfOMv6JxixjsLf+cZ1uqiGUi3lNT9+YgWhhSygkZZ/QcEUywhAky4RbN9je0 aMpaavCNApYJQoZ8C7ML5HdcoXtz602DYQL5XUiKreMLod35sjIlDRhZwVLv6qmh+T mlq9GNEyMlXbg== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:18 +0200 Subject: [PATCH v4 05/10] regulator: ab8500: Test dedicated enable bits only Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-5-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 Some regulator control registers have independent enable and low-power bits. is_enabled() currently tests their combined update mask, so an off regulator with its low-power bit set is incorrectly reported as enabled. Add an optional enable mask and use it for VINTCORE, AB8500 TVOUT, AB8505 ADC, and AB8505 VAUX5/6. Regulators whose two-bit field encodes the complete operating state continue to test the full update mask. References: AB8500 User Manual, UM0836 Rev 3, p. 214; AB8505 User Manual, DM00046744 Rev 3, pp. 171-172 and 223 Fixes: 65e03ed2d0cd ("regulators: Fixed errors in ab8500 register mapping") Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 42cb8dfdc7c9..05c6b9c7af0c 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -162,6 +162,7 @@ struct ab8500_shared_mode { * @update_bank: bank to control on/off * @update_reg: register to control on/off * @update_mask: mask to enable/disable and set mode of regulator + * @enable_mask: optional mask for an enable bit separate from the mode bit * @update_val: bits holding the regulator current mode * @update_val_idle: bits to enable the regulator in idle (low power) mode * @update_val_normal: bits to enable the regulator in normal (high power)= mode @@ -183,6 +184,7 @@ struct ab8500_regulator_info { u8 update_bank; u8 update_reg; u8 update_mask; + u8 enable_mask; u8 update_val; u8 update_val_idle; u8 update_val_normal; @@ -377,6 +379,7 @@ static int ab8500_regulator_is_enabled(struct regulator= _dev *rdev) { int ret; struct ab8500_regulator_info *info =3D rdev_get_drvdata(rdev); + u8 enable_mask; u8 regval; =20 if (info =3D=3D NULL) { @@ -392,13 +395,15 @@ static int ab8500_regulator_is_enabled(struct regulat= or_dev *rdev) return ret; } =20 + enable_mask =3D info->enable_mask ? info->enable_mask : info->update_mask; + dev_vdbg(rdev_get_dev(rdev), "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," " 0x%x\n", info->desc.name, info->update_bank, info->update_reg, - info->update_mask, regval); + enable_mask, regval); =20 - if (regval & info->update_mask) + if (regval & enable_mask) return 1; else return 0; @@ -833,6 +838,7 @@ static struct ab8500_regulator_info .update_bank =3D 0x03, .update_reg =3D 0x80, .update_mask =3D 0x44, + .enable_mask =3D 0x04, .update_val =3D 0x44, .update_val_idle =3D 0x44, .update_val_normal =3D 0x04, @@ -861,6 +867,7 @@ static struct ab8500_regulator_info .update_bank =3D 0x03, .update_reg =3D 0x80, .update_mask =3D 0x82, + .enable_mask =3D 0x02, .update_val =3D 0x02, .update_val_idle =3D 0x82, .update_val_normal =3D 0x02, @@ -1070,6 +1077,7 @@ static struct ab8500_regulator_info .update_bank =3D 0x01, .update_reg =3D 0x55, .update_mask =3D 0x18, + .enable_mask =3D 0x10, .update_val =3D 0x10, .update_val_idle =3D 0x18, .update_val_normal =3D 0x10, @@ -1092,6 +1100,7 @@ static struct ab8500_regulator_info .update_bank =3D 0x01, .update_reg =3D 0x56, .update_mask =3D 0x18, + .enable_mask =3D 0x10, .update_val =3D 0x10, .update_val_idle =3D 0x18, .update_val_normal =3D 0x10, @@ -1113,6 +1122,7 @@ static struct ab8500_regulator_info .update_bank =3D 0x03, .update_reg =3D 0x80, .update_mask =3D 0x44, + .enable_mask =3D 0x04, .update_val =3D 0x04, .update_val_idle =3D 0x44, .update_val_normal =3D 0x04, @@ -1141,6 +1151,7 @@ static struct ab8500_regulator_info .update_bank =3D 0x03, .update_reg =3D 0x80, .update_mask =3D 0x82, + .enable_mask =3D 0x02, .update_val =3D 0x02, .update_val_idle =3D 0x82, .update_val_normal =3D 0x02, --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01BD54A2E2E for ; Mon, 14 Sep 2026 21:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420290; cv=none; b=GONmF8jamvVGluwoIqoMMgphl5v44mQFD6SQtIV/9rJy/6n0TAk44MaDztLugwWQWMCqGgi0Kz4jSZjPcqKVSCoMLw+X/3o7KHrZ6scQZW+OtzFTxDz+uP1ozlkiNtTxkTuJh1MDbBMdxQMcm2AjD5TMJn1O2l1gVXpy49bSci8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420290; c=relaxed/simple; bh=Dv/QiirNXaEGGNxNMEdOvs71nxTnxu7bZFGiiKUplfk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FskymA917JOEUA0Df1gytdQWlHJjBoe69YUy7jw00TTdhBpJva/9nalvd/k8qY1en23NJ7WDy0pPDkS4IWB+Lwf7upSnGvHrpvzR5mWb08B+s1pz6euUkTTh094/eRUPsh4YB7XIeMpLc6GSGMZNMTrNc/67mUTYvBHGSl8suEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IG7Yg2Xz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IG7Yg2Xz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AA9D1F00898; Mon, 14 Sep 2026 21:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420288; bh=bMZt0GB7fomwJcSjpqK2GXhF/LZOwUajUGEkniPFZLE=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=IG7Yg2XzjKo3y/u+JLvX2KMK87d9mct2h9R0zOEdI97TvUliD4MupSWyYGowgDOJW i5mlKKNC1lf+WA9t4xSJa53DotPGmXND99PvL+JvQsyI44eFAET24hSxdQDAYI/lgK FgPq5fOS4ZJ9b3ASdEeBAj2xJzsWY4gGugYuy8AXHeL4qqVMsa36fJdS/UKZa0ZdVm b0G0+NRq8CUIWpM3qr5nlbxitWpv6izryZTNm2E0+5zN4uVc50IqyFTVC/48M3P3fC LafBHQhoJfZNgtu+SOVpyrG0uKzrNNskbJD3o6yycBPDB3xA9yvdAkiA7DCvGdj9nm l4eHgMYPEaS1A== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:19 +0200 Subject: [PATCH v4 06/10] regulator: ab8500: Propagate mode enable read errors Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-6-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 For regulators whose enable and mode share a state field, set_mode() first reads that field so changing the requested mode does not enable a disabled rail. A register read error is currently treated as true and the driver proceeds to write the new mode, potentially enabling a rail whose state is unknown. Return the read error without changing the register or cached mode. References: AB8500 User Manual, UM0836 Rev 3, p. 227; AB8505 User Manual, DM00046744 Rev 3, p. 237 Fixes: 438e695b87e0 ("regulator: ab8500: Get rid of is_enabled from struct = ab8500_regulator_info") Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 05c6b9c7af0c..e4c3502c8dbc 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -433,7 +433,7 @@ static unsigned int ab8500_regulator_get_optimum_mode( static int ab8500_regulator_set_mode(struct regulator_dev *rdev, unsigned int mode) { - int ret =3D 0; + int enabled, ret =3D 0; u8 bank, reg, mask, val; bool lp_mode_req =3D false; struct ab8500_regulator_info *info =3D rdev_get_drvdata(rdev); @@ -490,7 +490,17 @@ static int ab8500_regulator_set_mode(struct regulator_= dev *rdev, goto out_unlock; } =20 - if (info->mode_mask || ab8500_regulator_is_enabled(rdev)) { + if (info->mode_mask) { + enabled =3D 1; + } else { + enabled =3D ab8500_regulator_is_enabled(rdev); + if (enabled < 0) { + ret =3D enabled; + goto out_unlock; + } + } + + if (enabled) { ret =3D abx500_mask_and_set_register_interruptible(info->dev, bank, reg, mask, val); if (ret < 0) { --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A02954A2E24 for ; Mon, 14 Sep 2026 21:11:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420291; cv=none; b=t50C2fzpSIYZBAnAHvF2tU/AKNTitZP/xTarZtM2TWihsCZBLSo8Qd9+1bvxK+7bRXGDgA4Zr0Xb+SmYnZ0A94CJzkNg8uiggVvc81uFVhQsdtgu0HPVY6xa9HEEUtRBiutVdCe6+RvIB9Q2qX8a7vXXbPB9fBVZZSmCheOCAKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420291; c=relaxed/simple; bh=o2g5BJsdLmgKohvdPEwdQASKwo6XZOlBHx9JkteNmOM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DO/Vt/s7ySnbW5OfDAjacK3SH47WDJlnhU1MtGtL0a9wPiUYz9lu8LKfoMR2CH8RmEECo8nObWYIVvXDvEFCkPF3BoeyoCI/Z8y76YlCK8vsg0Nq6r41mfCIApcxWw8xeiCKyQ1hgiWvZg1XK6PvDuGFTlcH7aD19tDbkZlmk1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=APjM8eiO; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="APjM8eiO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C2801F000FF; Mon, 14 Sep 2026 21:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420290; bh=XgsPq9RhCd3/kciawcNEGIUOwsxaXN47MCNNBD2JLps=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=APjM8eiORGA0ljz6metPveFihPdTXG+B6b8g8CLNLC1jKvH6icLp99OcNrwe3B7ww +L+/qqSdbvvv43e7K4jiLxQikoJEjsNdP6+CBph5YVmOj1C3ViAFETVZ10OmEK4R0J Rmo0clrepw2eh0RqTVvf/3+r2mzqObSVNtppCzQH+wwEM6L4LLxv6/eRXcGxy4dT5q ZCZfBYC39ukfo+KfYjPXhoxfSZOk2ixGLuMrTTyNmbTzmE49HNGne3z8mXQ7jebCTJ e/Im8iVc48w3nCeAo1hqdt6fBuucf+GpbYs46qixYHnXjbNGi4Z2yGe5DF22liuzpr SGICuZBHv7eAQ== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:20 +0200 Subject: [PATCH v4 07/10] regulator: ab8500: Use linear ranges for LDO voltages Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-7-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 VINTCORE uses consecutive selectors with uniform 25 mV steps, with AB8505 duplicating the highest voltage at selector 7. AB8505 VAUDIO likewise has uniform 100 mV steps followed by a duplicate selector for its highest voltage. Describe these selector encodings with linear ranges and the matching regulator helpers instead of enumerated voltage tables. Keep tables for the irregular and non-monotonic VAUX and VANA selectors. Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 74 +++++++++++++++++++++++-------------------= ---- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index e4c3502c8dbc..d1540099104c 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -258,25 +258,13 @@ static const unsigned int ldo_vaux56_voltages[] =3D { 2790000, }; =20 -static const unsigned int ldo_vintcore_voltages[] =3D { - 1200000, - 1225000, - 1250000, - 1275000, - 1300000, - 1325000, - 1350000, +static const struct linear_range ldo_vintcore_ranges[] =3D { + REGULATOR_LINEAR_RANGE(1200000, 0, 6, 25000), }; =20 -static const unsigned int ldo_vintcore_ab8505_voltages[] =3D { - 1200000, - 1225000, - 1250000, - 1275000, - 1300000, - 1325000, - 1350000, - 1350000, +static const struct linear_range ldo_vintcore_ab8505_ranges[] =3D { + REGULATOR_LINEAR_RANGE(1200000, 0, 6, 25000), + REGULATOR_LINEAR_RANGE(1350000, 7, 7, 0), }; =20 static const unsigned int fixed_1200000_voltage[] =3D { @@ -306,15 +294,10 @@ static const unsigned int ldo_vana_voltages[] =3D { 1225000, }; =20 -static const unsigned int ldo_vaudio_voltages[] =3D { - 2000000, - 2100000, - 2200000, - 2300000, - 2400000, - 2500000, - 2600000, - 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */ +static const struct linear_range ldo_vaudio_ranges[] =3D { + REGULATOR_LINEAR_RANGE(2000000, 0, 6, 100000), + /* Duplicated in Vaudio and IsoUicc Control register. */ + REGULATOR_LINEAR_RANGE(2600000, 7, 7, 0), }; =20 static DEFINE_MUTEX(shared_mode_mutex); @@ -720,13 +703,27 @@ static const struct regulator_ops ab8500_regulator_vo= lt_mode_expand_ops =3D { .list_voltage =3D regulator_list_voltage_table, }; =20 -static const struct regulator_ops ab8500_regulator_volt_ops =3D { +static const struct regulator_ops ab8500_regulator_linear_range_volt_mode_= ops =3D { + .enable =3D ab8500_regulator_enable, + .disable =3D ab8500_regulator_disable, + .is_enabled =3D ab8500_regulator_is_enabled, + .get_optimum_mode =3D ab8500_regulator_get_optimum_mode, + .set_mode =3D ab8500_regulator_set_mode, + .get_mode =3D ab8500_regulator_get_mode, + .get_voltage_sel =3D ab8500_regulator_get_voltage_sel, + .set_voltage_sel =3D ab8500_regulator_set_voltage_sel, + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, +}; + +static const struct regulator_ops ab8500_regulator_linear_range_volt_ops = =3D { .enable =3D ab8500_regulator_enable, .disable =3D ab8500_regulator_disable, .is_enabled =3D ab8500_regulator_is_enabled, .get_voltage_sel =3D ab8500_regulator_get_voltage_sel, .set_voltage_sel =3D ab8500_regulator_set_voltage_sel, - .list_voltage =3D regulator_list_voltage_table, + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, }; =20 static const struct regulator_ops ab8500_regulator_mode_ops =3D { @@ -836,12 +833,13 @@ static struct ab8500_regulator_info [AB8500_LDO_INTCORE] =3D { .desc =3D { .name =3D "LDO-INTCORE", - .ops =3D &ab8500_regulator_volt_mode_ops, + .ops =3D &ab8500_regulator_linear_range_volt_mode_ops, .type =3D REGULATOR_VOLTAGE, .id =3D AB8500_LDO_INTCORE, .owner =3D THIS_MODULE, - .n_voltages =3D ARRAY_SIZE(ldo_vintcore_voltages), - .volt_table =3D ldo_vintcore_voltages, + .n_voltages =3D 7, + .linear_ranges =3D ldo_vintcore_ranges, + .n_linear_ranges =3D ARRAY_SIZE(ldo_vintcore_ranges), .enable_time =3D 750, }, .load_lp_uA =3D 5000, @@ -1121,12 +1119,13 @@ static struct ab8500_regulator_info [AB8505_LDO_INTCORE] =3D { .desc =3D { .name =3D "LDO-INTCORE", - .ops =3D &ab8500_regulator_volt_mode_ops, + .ops =3D &ab8500_regulator_linear_range_volt_mode_ops, .type =3D REGULATOR_VOLTAGE, .id =3D AB8505_LDO_INTCORE, .owner =3D THIS_MODULE, - .n_voltages =3D ARRAY_SIZE(ldo_vintcore_ab8505_voltages), - .volt_table =3D ldo_vintcore_ab8505_voltages, + .n_voltages =3D 8, + .linear_ranges =3D ldo_vintcore_ab8505_ranges, + .n_linear_ranges =3D ARRAY_SIZE(ldo_vintcore_ab8505_ranges), }, .load_lp_uA =3D 5000, .update_bank =3D 0x03, @@ -1169,12 +1168,13 @@ static struct ab8500_regulator_info [AB8505_LDO_AUDIO] =3D { .desc =3D { .name =3D "LDO-AUDIO", - .ops =3D &ab8500_regulator_volt_ops, + .ops =3D &ab8500_regulator_linear_range_volt_ops, .type =3D REGULATOR_VOLTAGE, .id =3D AB8505_LDO_AUDIO, .owner =3D THIS_MODULE, - .n_voltages =3D ARRAY_SIZE(ldo_vaudio_voltages), - .volt_table =3D ldo_vaudio_voltages, + .n_voltages =3D 8, + .linear_ranges =3D ldo_vaudio_ranges, + .n_linear_ranges =3D ARRAY_SIZE(ldo_vaudio_ranges), }, .update_bank =3D 0x03, .update_reg =3D 0x83, --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C9904A3D33 for ; Mon, 14 Sep 2026 21:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420294; cv=none; b=fpo4Wfl3h+EBN1PnpAqhlRwHzpH3xOOnHu1EM0J88pyVKOH73OcvDK740eMToQDHATsDDQp0BPp6mfFRqNCGbT7K7tIBfmV+9ED0eU8rWSCXkXNkNHjwax+8pENPvlM08pGx0cWjGiFDzaBlciRZQ6QdhRz/7JIzF2AVm/C4KMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420294; c=relaxed/simple; bh=MT8sDGgmi+VnXl2CGP2Enoev1en9znyBtD06gddifuw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BF45+ZbujaxCpp/aytSxhJHqwgtqJ2Gx1RtwSc3/12sLSK6zf2SIc0nRG1wNpcP/hktO4HhF42rqUryrZcFI2oL33/98NEXLIzX9LisRmz+HKW1cS0e1APF1DsLulEhjBeJWXjNJsj36/I2x3WMA6hcNq5w4YqwxA0BhQ/hRIt4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Xq55Kofl; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Xq55Kofl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1ACA1F00893; Mon, 14 Sep 2026 21:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420292; bh=JllXSUHy+b3zdtDBvkgrDgyujMMYgJPstjjx5MbnyKk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Xq55KoflHzkIH9n+kai8ahZwNeA5gJkRu9PxA4hK5GhxkxxWbxWDNhYtzSkOzkFyL uXTp0q9eG1AtbBCXOJxQulrAmE6Dxn/vT668Cj365fWHjTET7bg8oxHqyzZTgxk9Rr jdYnt2bd0lq5WKlOeJ1LRuD72DR90MM5XbuJBSJryKxdVTx4zlAri4ZXHj4ODCvOFB tCDLfrF3hTZQvTsKakMGpN47Z2pC2/Ha8qWU2REngYVPWIeswk4mU1qvPywHEGQBW+ qWoe8W0Utq/XGASjhRzyTp7pB3KRUW/SEMzjCALPVUIFHDhOTNBUNeC2p8GMo3xd99 Ft/oyCsS+aZSA== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:21 +0200 Subject: [PATCH v4 08/10] regulator: ab8500: Add buck converter support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-8-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 Register the SMPS1, SMPS2, SMPS3, ARM, APE and MOD buck converters on AB8500 and the VSMPSA, VSMPSB, VSAFE, VARM, VSMPSC and VSMPSM buck converters on AB8505 so that the new device tree nodes can supply consumers. Match each variant through its own device tree node names. AB8500 SMPS3 supplies Vsafe and AB8505 VSAFE occupies the corresponding control and selector registers at 0x0405 and 0x041b through 0x041d. AB8500 VAPE and AB8505 VSMPSC instead use 0x0402 and the 0x040e through 0x0410 selector registers. Keep separate AB8505 regulator descriptors and identifiers so these variant-specific rails are not conflated. Describe the hardware selector ranges and follow the selector-control registers when reading or changing voltage. This accounts for AB8505 using Sel2 after reset, its additional selector registers and its separate 7-bit VARM range. Use the AB8500-compatible and low-range OTP profiles found on the supported platforms for the other rails. SMPS1 through SMPS3 and VSMPSA, VSMPSB and VSAFE also expose enable and low-power mode control. Keep the ARM, APE, MOD, VARM, VSMPSC and VSMPSM rails voltage-only since their on/off state is managed with the SoC. Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 461 +++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 452 insertions(+), 9 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index d1540099104c..130febf2680a 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -9,10 +9,12 @@ * AB8500 peripheral regulators * * AB8500 supports the following regulators: - * VAUX1/2/3, VINTCORE, VTVOUT, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA + * VSMPS1/2/3, VARM, VAPE, VMOD, VAUX1/2/3, VINTCORE, VTVOUT, + * VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA * * AB8505 supports the following regulators: - * VAUX1/2/3/4/5/6, VINTCORE, VADC, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA + * VSMPSA/B/C/M, VSAFE, VARM, VAUX1/2/3/4/5/6, VINTCORE, + * VADC, VUSB, VAUDIO, VAMIC1/2, VDMIC, VANA */ #include #include @@ -39,6 +41,12 @@ enum ab8500_regulator_id { AB8500_LDO_ANAMIC2, AB8500_LDO_DMIC, AB8500_LDO_ANA, + AB8500_BUCK_SMPS1, + AB8500_BUCK_SMPS2, + AB8500_BUCK_SMPS3, + AB8500_BUCK_ARM, + AB8500_BUCK_APE, + AB8500_BUCK_MOD, AB8500_NUM_REGULATORS, }; =20 @@ -57,6 +65,12 @@ enum ab8505_regulator_id { AB8505_LDO_ANAMIC2, AB8505_LDO_AUX8, AB8505_LDO_ANA, + AB8505_BUCK_SMPSA, + AB8505_BUCK_SMPSB, + AB8505_BUCK_SAFE, + AB8505_BUCK_ARM, + AB8505_BUCK_SMPSC, + AB8505_BUCK_SMPSM, AB8505_NUM_REGULATORS, }; =20 @@ -172,9 +186,17 @@ struct ab8500_shared_mode { * @mode_val_idle: mode setting for low power * @mode_val_normal: mode setting for normal power * @voltage_bank: bank to control regulator voltage - * @voltage_reg: register to control regulator voltage + * @voltage_reg: first register containing a selectable regulator voltage * @voltage_mask: mask to control regulator voltage * @expand_register: additional register used to select an extra voltage + * @voltage_ctrl_bank: bank containing the voltage selector control + * @voltage_ctrl_reg: register containing the voltage selector control + * @voltage_ctrl_mask: mask selecting one of the first voltage registers + * @voltage_ext_ctrl_bank: bank containing the extended selector control + * @voltage_ext_ctrl_reg: register containing the extended selector control + * @voltage_ext_ctrl_mask: mask selecting one of the extended voltage regi= sters + * @voltage_ext_reg: first extended voltage register + * @voltage_ext_regs: number of extended voltage registers */ struct ab8500_regulator_info { struct device *dev; @@ -202,6 +224,14 @@ struct ab8500_regulator_info { u8 voltage_reg; u8 voltage_mask; } expand_register; + u8 voltage_ctrl_bank; + u8 voltage_ctrl_reg; + u8 voltage_ctrl_mask; + u8 voltage_ext_ctrl_bank; + u8 voltage_ext_ctrl_reg; + u8 voltage_ext_ctrl_mask; + u8 voltage_ext_reg; + u8 voltage_ext_regs; }; =20 /* voltage tables for the vauxn/vintcore supplies */ @@ -300,6 +330,40 @@ static const struct linear_range ldo_vaudio_ranges[] = =3D { REGULATOR_LINEAR_RANGE(2600000, 7, 7, 0), }; =20 +/* + * AB8505 buck ranges except VARM are selected by OTP. The supported + * platforms use the AB8500-compatible profiles for VSMPSA/B and the low + * profiles for VSAFE, VSMPSC and VSMPSM. + */ +static const struct linear_range buck_low_voltages[] =3D { + REGULATOR_LINEAR_RANGE(700000, 0, 53, 12500), + REGULATOR_LINEAR_RANGE(1362500, 54, 63, 0), +}; + +/* VSMPS3 and VSAFE have a 7-bit selector, but the same low range. */ +static const struct linear_range buck_low_7bit_voltages[] =3D { + REGULATOR_LINEAR_RANGE(700000, 0, 53, 12500), + REGULATOR_LINEAR_RANGE(1362500, 54, 127, 0), +}; + +/* AB8505 VARM uses a separate 0.6 V to 1.39375 V selector range. */ +static const struct linear_range ab8505_buck_arm_voltages[] =3D { + REGULATOR_LINEAR_RANGE(600000, 0, 127, 6250), +}; + +/* VSMPS1 and the VSMPSA AB8500-compatible profile clamp to this range. */ +static const struct linear_range buck_smps1_voltages[] =3D { + REGULATOR_LINEAR_RANGE(1100000, 0, 32, 0), + REGULATOR_LINEAR_RANGE(1112500, 33, 48, 12500), + REGULATOR_LINEAR_RANGE(1300000, 49, 63, 0), +}; + +/* VSMPS2 and the VSMPSB AB8500-compatible profile clamp to this range. */ +static const struct linear_range buck_smps2_voltages[] =3D { + REGULATOR_LINEAR_RANGE(1800000, 0, 57, 0), + REGULATOR_LINEAR_RANGE(1812500, 58, 63, 12500), +}; + static DEFINE_MUTEX(shared_mode_mutex); static struct ab8500_shared_mode ldo_anamic1_shared; static struct ab8500_shared_mode ldo_anamic2_shared; @@ -558,11 +622,67 @@ static unsigned int ab8500_regulator_get_mode(struct = regulator_dev *rdev) return ret; } =20 +static int ab8500_regulator_get_voltage_reg(struct regulator_dev *rdev, + u8 *voltage_reg) +{ + struct ab8500_regulator_info *info =3D rdev_get_drvdata(rdev); + u8 regval; + unsigned int selector; + int ret; + + if (info->voltage_ext_ctrl_mask) { + ret =3D abx500_get_register_interruptible(info->dev, + info->voltage_ext_ctrl_bank, + info->voltage_ext_ctrl_reg, ®val); + if (ret < 0) + return ret; + + selector =3D (regval & info->voltage_ext_ctrl_mask) >> + (ffs(info->voltage_ext_ctrl_mask) - 1); + if (selector) { + selector =3D min_t(unsigned int, selector, + info->voltage_ext_regs); + *voltage_reg =3D info->voltage_ext_reg + selector - 1; + return 0; + } + } + + if (!info->voltage_ctrl_mask) { + *voltage_reg =3D info->voltage_reg; + return 0; + } + + ret =3D abx500_get_register_interruptible(info->dev, + info->voltage_ctrl_bank, + info->voltage_ctrl_reg, ®val); + if (ret < 0) + return ret; + + /* The three hardware selector layouts all use consecutive registers. */ + switch (info->voltage_ctrl_mask) { + case 0x0c: + selector =3D min((unsigned int)((regval & 0x0c) >> 2), 2U); + break; + case 0x24: + selector =3D regval & BIT(5) ? 2 : !!(regval & BIT(2)); + break; + case 0x04: + selector =3D !!(regval & BIT(2)); + break; + default: + return -EINVAL; + } + + *voltage_reg =3D info->voltage_reg + selector; + + return 0; +} + static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev) { int ret, voltage_shift; struct ab8500_regulator_info *info =3D rdev_get_drvdata(rdev); - u8 regval; + u8 regval, voltage_reg; =20 if (info =3D=3D NULL) { dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); @@ -571,8 +691,15 @@ static int ab8500_regulator_get_voltage_sel(struct reg= ulator_dev *rdev) =20 voltage_shift =3D ffs(info->voltage_mask) - 1; =20 + ret =3D ab8500_regulator_get_voltage_reg(rdev, &voltage_reg); + if (ret < 0) { + dev_err(rdev_get_dev(rdev), + "couldn't read voltage selector control\n"); + return ret; + } + ret =3D abx500_get_register_interruptible(info->dev, - info->voltage_bank, info->voltage_reg, ®val); + info->voltage_bank, voltage_reg, ®val); if (ret < 0) { dev_err(rdev_get_dev(rdev), "couldn't read voltage reg for regulator\n"); @@ -583,7 +710,7 @@ static int ab8500_regulator_get_voltage_sel(struct regu= lator_dev *rdev) "%s-get_voltage (bank, reg, mask, shift, value): " "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", info->desc.name, info->voltage_bank, - info->voltage_reg, info->voltage_mask, + voltage_reg, info->voltage_mask, voltage_shift, regval); =20 return (regval & info->voltage_mask) >> voltage_shift; @@ -594,7 +721,7 @@ static int ab8500_regulator_set_voltage_sel(struct regu= lator_dev *rdev, { int ret, voltage_shift; struct ab8500_regulator_info *info =3D rdev_get_drvdata(rdev); - u8 regval; + u8 regval, voltage_reg; =20 if (info =3D=3D NULL) { dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); @@ -603,10 +730,17 @@ static int ab8500_regulator_set_voltage_sel(struct re= gulator_dev *rdev, =20 voltage_shift =3D ffs(info->voltage_mask) - 1; =20 + ret =3D ab8500_regulator_get_voltage_reg(rdev, &voltage_reg); + if (ret < 0) { + dev_err(rdev_get_dev(rdev), + "couldn't read voltage selector control\n"); + return ret; + } + /* set the registers for the request */ regval =3D (u8)selector << voltage_shift; ret =3D abx500_mask_and_set_register_interruptible(info->dev, - info->voltage_bank, info->voltage_reg, + info->voltage_bank, voltage_reg, info->voltage_mask, regval); if (ret < 0) dev_err(rdev_get_dev(rdev), @@ -615,7 +749,7 @@ static int ab8500_regulator_set_voltage_sel(struct regu= lator_dev *rdev, dev_vdbg(rdev_get_dev(rdev), "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," " 0x%x\n", - info->desc.name, info->voltage_bank, info->voltage_reg, + info->desc.name, info->voltage_bank, voltage_reg, info->voltage_mask, regval); =20 return ret; @@ -726,6 +860,26 @@ static const struct regulator_ops ab8500_regulator_lin= ear_range_volt_ops =3D { .map_voltage =3D regulator_map_voltage_linear_range, }; =20 +static const struct regulator_ops ab8500_buck_ops =3D { + .enable =3D ab8500_regulator_enable, + .disable =3D ab8500_regulator_disable, + .is_enabled =3D ab8500_regulator_is_enabled, + .get_optimum_mode =3D ab8500_regulator_get_optimum_mode, + .set_mode =3D ab8500_regulator_set_mode, + .get_mode =3D ab8500_regulator_get_mode, + .get_voltage_sel =3D ab8500_regulator_get_voltage_sel, + .set_voltage_sel =3D ab8500_regulator_set_voltage_sel, + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, +}; + +static const struct regulator_ops ab8500_buck_voltage_ops =3D { + .get_voltage_sel =3D ab8500_regulator_get_voltage_sel, + .set_voltage_sel =3D ab8500_regulator_set_voltage_sel, + .list_voltage =3D regulator_list_voltage_linear_range, + .map_voltage =3D regulator_map_voltage_linear_range, +}; + static const struct regulator_ops ab8500_regulator_mode_ops =3D { .enable =3D ab8500_regulator_enable, .disable =3D ab8500_regulator_disable, @@ -967,6 +1121,137 @@ static struct ab8500_regulator_info .update_val_idle =3D 0x0c, .update_val_normal =3D 0x04, }, + + /* Buck converters */ + [AB8500_BUCK_SMPS1] =3D { + .desc =3D { + .name =3D "BUCK-SMPS1", + .ops =3D &ab8500_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8500_BUCK_SMPS1, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_smps1_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_smps1_voltages), + }, + .load_lp_uA =3D 20000, + .update_bank =3D 0x04, + .update_reg =3D 0x03, + .update_mask =3D 0x03, + .update_val =3D 0x01, + .update_val_idle =3D 0x03, + .update_val_normal =3D 0x01, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x13, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x03, + .voltage_ctrl_mask =3D 0x0c, + }, + [AB8500_BUCK_SMPS2] =3D { + .desc =3D { + .name =3D "BUCK-SMPS2", + .ops =3D &ab8500_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8500_BUCK_SMPS2, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_smps2_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_smps2_voltages), + }, + .load_lp_uA =3D 20000, + .update_bank =3D 0x04, + .update_reg =3D 0x04, + .update_mask =3D 0x03, + .update_val =3D 0x01, + .update_val_idle =3D 0x03, + .update_val_normal =3D 0x01, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x17, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x04, + .voltage_ctrl_mask =3D 0x0c, + }, + [AB8500_BUCK_SMPS3] =3D { + .desc =3D { + .name =3D "BUCK-SMPS3", + .ops =3D &ab8500_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8500_BUCK_SMPS3, + .owner =3D THIS_MODULE, + .n_voltages =3D 128, + .linear_ranges =3D buck_low_7bit_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_low_7bit_voltages), + }, + .load_lp_uA =3D 50000, + .update_bank =3D 0x04, + .update_reg =3D 0x05, + .update_mask =3D 0x03, + .update_val =3D 0x01, + .update_val_idle =3D 0x03, + .update_val_normal =3D 0x01, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x1b, + .voltage_mask =3D 0x7f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x05, + .voltage_ctrl_mask =3D 0x0c, + }, + [AB8500_BUCK_ARM] =3D { + .desc =3D { + .name =3D "BUCK-ARM", + .ops =3D &ab8500_buck_voltage_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8500_BUCK_ARM, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_low_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_low_voltages), + }, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x0b, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x00, + .voltage_ctrl_mask =3D 0x0c, + }, + [AB8500_BUCK_APE] =3D { + .desc =3D { + .name =3D "BUCK-APE", + .ops =3D &ab8500_buck_voltage_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8500_BUCK_APE, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_low_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_low_voltages), + }, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x0e, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x02, + .voltage_ctrl_mask =3D 0x24, + }, + [AB8500_BUCK_MOD] =3D { + .desc =3D { + .name =3D "BUCK-MOD", + .ops =3D &ab8500_buck_voltage_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8500_BUCK_MOD, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_low_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_low_voltages), + }, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x41, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x40, + .voltage_ctrl_mask =3D 0x04, + }, }; =20 /* AB8505 regulator information */ @@ -1265,6 +1550,152 @@ static struct ab8500_regulator_info .voltage_reg =3D 0x29, .voltage_mask =3D 0x7, }, + + /* Buck converters */ + [AB8505_BUCK_SMPSA] =3D { + .desc =3D { + .name =3D "BUCK-SMPSA", + .ops =3D &ab8500_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8505_BUCK_SMPSA, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_smps1_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_smps1_voltages), + }, + .load_lp_uA =3D 20000, + .update_bank =3D 0x04, + .update_reg =3D 0x03, + .update_mask =3D 0x03, + .update_val =3D 0x01, + .update_val_idle =3D 0x03, + .update_val_normal =3D 0x01, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x13, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x03, + .voltage_ctrl_mask =3D 0x0c, + }, + [AB8505_BUCK_SMPSB] =3D { + .desc =3D { + .name =3D "BUCK-SMPSB", + .ops =3D &ab8500_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8505_BUCK_SMPSB, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_smps2_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_smps2_voltages), + }, + .load_lp_uA =3D 20000, + .update_bank =3D 0x04, + .update_reg =3D 0x04, + .update_mask =3D 0x03, + .update_val =3D 0x01, + .update_val_idle =3D 0x03, + .update_val_normal =3D 0x01, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x17, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x04, + .voltage_ctrl_mask =3D 0x0c, + }, + [AB8505_BUCK_SAFE] =3D { + .desc =3D { + .name =3D "BUCK-SAFE", + .ops =3D &ab8500_buck_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8505_BUCK_SAFE, + .owner =3D THIS_MODULE, + .n_voltages =3D 128, + .linear_ranges =3D buck_low_7bit_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_low_7bit_voltages), + }, + .load_lp_uA =3D 50000, + .update_bank =3D 0x04, + .update_reg =3D 0x05, + .update_mask =3D 0x03, + .update_val =3D 0x01, + .update_val_idle =3D 0x03, + .update_val_normal =3D 0x01, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x1b, + .voltage_mask =3D 0x7f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x05, + .voltage_ctrl_mask =3D 0x0c, + }, + [AB8505_BUCK_ARM] =3D { + .desc =3D { + .name =3D "BUCK-ARM", + .ops =3D &ab8500_buck_voltage_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8505_BUCK_ARM, + .owner =3D THIS_MODULE, + .n_voltages =3D 128, + .linear_ranges =3D ab8505_buck_arm_voltages, + .n_linear_ranges =3D ARRAY_SIZE(ab8505_buck_arm_voltages), + }, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x0b, + .voltage_mask =3D 0x7f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x00, + .voltage_ctrl_mask =3D 0x0c, + .voltage_ext_ctrl_bank =3D 0x04, + .voltage_ext_ctrl_reg =3D 0x28, + .voltage_ext_ctrl_mask =3D 0x07, + .voltage_ext_reg =3D 0x24, + .voltage_ext_regs =3D 4, + }, + [AB8505_BUCK_SMPSC] =3D { + .desc =3D { + .name =3D "BUCK-SMPSC", + .ops =3D &ab8500_buck_voltage_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8505_BUCK_SMPSC, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_low_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_low_voltages), + }, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x0e, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x02, + .voltage_ctrl_mask =3D 0x24, + .voltage_ext_ctrl_bank =3D 0x04, + .voltage_ext_ctrl_reg =3D 0x2a, + .voltage_ext_ctrl_mask =3D 0x03, + .voltage_ext_reg =3D 0x2b, + .voltage_ext_regs =3D 2, + }, + [AB8505_BUCK_SMPSM] =3D { + .desc =3D { + .name =3D "BUCK-SMPSM", + .ops =3D &ab8500_buck_voltage_ops, + .type =3D REGULATOR_VOLTAGE, + .id =3D AB8505_BUCK_SMPSM, + .owner =3D THIS_MODULE, + .n_voltages =3D 64, + .linear_ranges =3D buck_low_voltages, + .n_linear_ranges =3D ARRAY_SIZE(buck_low_voltages), + }, + .voltage_bank =3D 0x04, + .voltage_reg =3D 0x41, + .voltage_mask =3D 0x3f, + .voltage_ctrl_bank =3D 0x04, + .voltage_ctrl_reg =3D 0x40, + .voltage_ctrl_mask =3D 0x04, + .voltage_ext_ctrl_bank =3D 0x04, + .voltage_ext_ctrl_reg =3D 0x47, + .voltage_ext_ctrl_mask =3D 0x03, + .voltage_ext_reg =3D 0x45, + .voltage_ext_regs =3D 2, + }, }; =20 static struct ab8500_shared_mode ldo_anamic1_shared =3D { @@ -1740,6 +2171,12 @@ static struct of_regulator_match ab8500_regulator_ma= tch[] =3D { { .name =3D "ab8500_ldo_anamic2", .driver_data =3D (void *) AB8500_LDO_AN= AMIC2, }, { .name =3D "ab8500_ldo_dmic", .driver_data =3D (void *) AB8500_LDO_DM= IC, }, { .name =3D "ab8500_ldo_ana", .driver_data =3D (void *) AB8500_LDO_AN= A, }, + { .name =3D "ab8500_buck_smps1", .driver_data =3D (void *)AB8500_BUCK_SM= PS1, }, + { .name =3D "ab8500_buck_smps2", .driver_data =3D (void *)AB8500_BUCK_SM= PS2, }, + { .name =3D "ab8500_buck_smps3", .driver_data =3D (void *)AB8500_BUCK_SM= PS3, }, + { .name =3D "ab8500_buck_arm", .driver_data =3D (void *)AB8500_BUCK_AR= M, }, + { .name =3D "ab8500_buck_ape", .driver_data =3D (void *)AB8500_BUCK_AP= E, }, + { .name =3D "ab8500_buck_mod", .driver_data =3D (void *)AB8500_BUCK_MO= D, }, }; =20 static struct of_regulator_match ab8505_regulator_match[] =3D { @@ -1756,6 +2193,12 @@ static struct of_regulator_match ab8505_regulator_ma= tch[] =3D { { .name =3D "ab8500_ldo_anamic2", .driver_data =3D (void *) AB8505_LDO_AN= AMIC2, }, { .name =3D "ab8500_ldo_aux8", .driver_data =3D (void *) AB8505_LDO_AU= X8, }, { .name =3D "ab8500_ldo_ana", .driver_data =3D (void *) AB8505_LDO_AN= A, }, + { .name =3D "ab8505_buck_smpsa", .driver_data =3D (void *)AB8505_BUCK_SM= PSA, }, + { .name =3D "ab8505_buck_smpsb", .driver_data =3D (void *)AB8505_BUCK_SM= PSB, }, + { .name =3D "ab8505_buck_safe", .driver_data =3D (void *)AB8505_BUCK_SA= FE, }, + { .name =3D "ab8505_buck_arm", .driver_data =3D (void *)AB8505_BUCK_AR= M, }, + { .name =3D "ab8505_buck_smpsc", .driver_data =3D (void *)AB8505_BUCK_SM= PSC, }, + { .name =3D "ab8505_buck_smpsm", .driver_data =3D (void *)AB8505_BUCK_SM= PSM, }, }; =20 static struct { --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE6044A3F0F for ; Mon, 14 Sep 2026 21:11:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420295; cv=none; b=q97SGCmR2sff0U+Tc68XMbUXF7336us0C34mWDvEfCA9UO5hqqu9s5rOBiCiTjo+Lf1zsijX/3MkuGKEh9hGhyki2E6DJIMB8TB0sfJAFxt2LIEERyX6yPQ3ZckjIE8aJoT2TJebuB4qPms74bizUyQWU+3/qLwgbaApzRdvSeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420295; c=relaxed/simple; bh=LX0llP1A1K4iHrbaACvouwpeVCE2A7XMNxPAFptGvLE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HxKkzsORezeOmYHHDZDbdu6VK5GeyeBylhHyv/+RxfPuAugWjU4QM4akYOfmdXsOF2wysbgcYTSj2Z/u51jyt9+uXU4Z8peMoCudRrwEm3S5XMc2OInBCMtx4dhWuvelUi8J6o/kbNdE0wC5y22/gvR5uI7DMGfbF9PQYYJkTWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VYw5LosG; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VYw5LosG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F3061F000FF; Mon, 14 Sep 2026 21:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420293; bh=CVvTaQDL0TSG4NiP8jhQlXn2CGJG/xY1HLs49Tsli4M=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=VYw5LosGAX1bcecLAUVBDsDd+ivacXg0N+hVq3X7ZuSRwll3PpAOiq3Kzwnqo4Ti1 g1d+nb3wdn2hGm574EhKlMCoX9R9rFWhIkUbR5ysX7SEhywC+3FbBJMmqJTYmooR2a IHyVszjWvh8THdSXb871geWn/3qfBaAqbq0hB9xzdNnEp/9CH1QR8w13EVJUyHdqEf 4trOrlauB4K9Ko7EjMSzScJByzJkiOW4sv1rszauncEBsW4LgB/+wAHAIUoS7BETh+ oJ9Mg5YYRPe1qy7NOyGkAcOLGQjfSVe0hGbUjgqlp44hl1ls6OXtoHM2MJfKwDxOPy hcnsPWokWOSMQ== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:22 +0200 Subject: [PATCH v4 09/10] regulator: ab8500: Report buck OTP and DT state mismatches Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-9-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 The switchable buck enable fields are initialized from OTP and may not match the boot-on and always-on constraints in the device tree. Read the enable field during regulator initialization, before the core applies the constraints. Compare it with the enabled state requested by regulator-boot-on or regulator-always-on and report any mismatch with dev_info(), including the regulator name, hardware state and both DT flags. Leave the constraints and normal enable handling unchanged, and skip the comparison when no DT node is present. This samples the OTP-initialized register rather than OTP storage; firmware may have changed the state before Linux probes the device. Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 130febf2680a..f9487395e290 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -456,6 +456,34 @@ static int ab8500_regulator_is_enabled(struct regulato= r_dev *rdev) return 0; } =20 +static int ab8500_buck_init(struct regulator_dev *rdev, + struct regulator_config *config) +{ + const struct regulation_constraints *constraints =3D rdev->constraints; + struct ab8500_regulator_info *info =3D config->driver_data; + bool enabled_in_dt =3D constraints->boot_on || constraints->always_on; + int enabled; + + if (!config->of_node) + return 0; + + /* + * The enable field is initialized from OTP, but firmware may have + * changed it before probe. Compare before applying DT constraints. + */ + enabled =3D ab8500_regulator_is_enabled(rdev); + if (enabled < 0) + return enabled; + + if (enabled !=3D enabled_in_dt) + dev_info(config->dev, + "%s: OTP-initialized state is %s, DT boot-on=3D%u, always-on=3D%u\n", + info->desc.name, enabled ? "enabled" : "disabled", + constraints->boot_on, constraints->always_on); + + return 0; +} + static unsigned int ab8500_regulator_get_optimum_mode( struct regulator_dev *rdev, int input_uV, int output_uV, int load_uA) @@ -1127,6 +1155,7 @@ static struct ab8500_regulator_info .desc =3D { .name =3D "BUCK-SMPS1", .ops =3D &ab8500_buck_ops, + .init_cb =3D ab8500_buck_init, .type =3D REGULATOR_VOLTAGE, .id =3D AB8500_BUCK_SMPS1, .owner =3D THIS_MODULE, @@ -1152,6 +1181,7 @@ static struct ab8500_regulator_info .desc =3D { .name =3D "BUCK-SMPS2", .ops =3D &ab8500_buck_ops, + .init_cb =3D ab8500_buck_init, .type =3D REGULATOR_VOLTAGE, .id =3D AB8500_BUCK_SMPS2, .owner =3D THIS_MODULE, @@ -1177,6 +1207,7 @@ static struct ab8500_regulator_info .desc =3D { .name =3D "BUCK-SMPS3", .ops =3D &ab8500_buck_ops, + .init_cb =3D ab8500_buck_init, .type =3D REGULATOR_VOLTAGE, .id =3D AB8500_BUCK_SMPS3, .owner =3D THIS_MODULE, @@ -1556,6 +1587,7 @@ static struct ab8500_regulator_info .desc =3D { .name =3D "BUCK-SMPSA", .ops =3D &ab8500_buck_ops, + .init_cb =3D ab8500_buck_init, .type =3D REGULATOR_VOLTAGE, .id =3D AB8505_BUCK_SMPSA, .owner =3D THIS_MODULE, @@ -1581,6 +1613,7 @@ static struct ab8500_regulator_info .desc =3D { .name =3D "BUCK-SMPSB", .ops =3D &ab8500_buck_ops, + .init_cb =3D ab8500_buck_init, .type =3D REGULATOR_VOLTAGE, .id =3D AB8505_BUCK_SMPSB, .owner =3D THIS_MODULE, @@ -1606,6 +1639,7 @@ static struct ab8500_regulator_info .desc =3D { .name =3D "BUCK-SAFE", .ops =3D &ab8500_buck_ops, + .init_cb =3D ab8500_buck_init, .type =3D REGULATOR_VOLTAGE, .id =3D AB8505_BUCK_SAFE, .owner =3D THIS_MODULE, --=20 2.55.0 From nobody Fri Sep 25 09:22:27 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF2284A3D5B for ; Mon, 14 Sep 2026 21:11:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420297; cv=none; b=uffvkItJ5c0l6d65mP1vv000P/M6zRZRHcbekCaAHRMTrNUstM7pe+PPaIlPf1s6lhQ1QpKmsyBYhBJaxYmWIlrSlw89oPYY5JZPiB/o4CghhBGPQVBCcx5gpGcA2ZUu1lc9efT4XMnUDQ68U5gP2Ju8Egv2Pgptl9e4Rh2pPEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789420297; c=relaxed/simple; bh=Nr35i1iVvmyxQQM1m36ZNQ0OJQRiTZJLyRxlridfurU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qqc21rLq+ZY4MN37uU8CGns5kBq3hFpyluyxxvjdimREWdp2gc99Rq/wlIfGwnAk+jDwkJORT9WXdhPfmXdGGJSX45grj3N/hg8kcgT22r0MdIDfvrH/5CmoAjdn4lLcHMr314P91IK4a5c7nqQNLqAiHIUbp0dTqmKQzLQPz4w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hR3TeRWX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hR3TeRWX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40F571F00898; Mon, 14 Sep 2026 21:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789420295; bh=A0QFITDkPY+ZSHHWURCIX3S2QtkeZuMcOu6OCqkVsHM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=hR3TeRWXVKZEq/ZQT+hj6BWLWoVB5wZbNtjRiJc1K/aC2Ae7Aqeb4PD8REqK/+SrH cjHJwa3+mpkCXkYZuusPxbmkIut8DCuv0K+mjsbXkl9jIXRvfT4/kU4FHaY8WmB1kF pGzN+MUwfsJHEz+i70BXLXMhf7y9+56b8U9e2suiyctNDcSgz2jqW8fYKq0laQtiNI aHwdFO0OrWzprqGpgPYdNpUGSS9ry8u2kltKHK9u0HRM7JoMNqJanXw+Sou/lIOZ0b EHD7FW7s05C35H4nZLnAlbiyM89O/APfFhDz176Yz/Cc+IzRueGWqESFUeH8d0Rv2d 3PCwD/8ssm6lQ== From: Linus Walleij Date: Mon, 14 Sep 2026 23:11:23 +0200 Subject: [PATCH v4 10/10] regulator: ab8500: Use scoped guard for shared mode mutex Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-ux500-dts-snowball-regulator-v4-10-dfc453a3031f@kernel.org> References: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> In-Reply-To: <20260914-ux500-dts-snowball-regulator-v4-0-dfc453a3031f@kernel.org> To: Stephan Gerhold , Liam Girdwood , Mark Brown , Axel Lin Cc: linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 Use a scoped mutex guard in ab8500_regulator_set_mode(). Assisted-by: LLM Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index f9487395e290..0ad2be98a049 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -518,6 +519,8 @@ static int ab8500_regulator_set_mode(struct regulator_d= ev *rdev, return -EINVAL; } =20 + guard(mutex)(&shared_mode_mutex); + if (info->mode_mask) { bank =3D info->mode_bank; reg =3D info->mode_reg; @@ -528,9 +531,6 @@ static int ab8500_regulator_set_mode(struct regulator_d= ev *rdev, mask =3D info->update_mask; } =20 - if (info->shared_mode) - mutex_lock(&shared_mode_mutex); - switch (mode) { case REGULATOR_MODE_NORMAL: if (info->shared_mode) @@ -549,7 +549,7 @@ static int ab8500_regulator_set_mode(struct regulator_d= ev *rdev, if (!shared_regulator->shared_mode->lp_mode_req) { /* Other regulator prevent LP mode */ info->shared_mode->lp_mode_req =3D true; - goto out_unlock; + return 0; } =20 lp_mode_req =3D true; @@ -561,18 +561,15 @@ static int ab8500_regulator_set_mode(struct regulator= _dev *rdev, val =3D info->update_val_idle; break; default: - ret =3D -EINVAL; - goto out_unlock; + return -EINVAL; } =20 if (info->mode_mask) { enabled =3D 1; } else { enabled =3D ab8500_regulator_is_enabled(rdev); - if (enabled < 0) { - ret =3D enabled; - goto out_unlock; - } + if (enabled < 0) + return enabled; } =20 if (enabled) { @@ -581,7 +578,7 @@ static int ab8500_regulator_set_mode(struct regulator_d= ev *rdev, if (ret < 0) { dev_err(rdev_get_dev(rdev), "couldn't set regulator mode\n"); - goto out_unlock; + return ret; } =20 dev_vdbg(rdev_get_dev(rdev), @@ -597,10 +594,6 @@ static int ab8500_regulator_set_mode(struct regulator_= dev *rdev, if (info->shared_mode) info->shared_mode->lp_mode_req =3D lp_mode_req; =20 -out_unlock: - if (info->shared_mode) - mutex_unlock(&shared_mode_mutex); - return ret; } =20 --=20 2.55.0