From: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
To: sre@kernel.org, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
wens@csie.org
Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v1 6/7] power: supply: axp20x_usb_power: Add support for AXP192
Date: Wed, 10 May 2023 12:50:45 +0100 [thread overview]
Message-ID: <20230510115046.963432-7-aidanmacdonald.0x0@gmail.com> (raw)
In-Reply-To: <20230510115046.963432-1-aidanmacdonald.0x0@gmail.com>
Add support for the AXP192. It is most similar to the AXP202 but
the current limits are different and the USB OTG status register
has a different address (0x04 instead of 0x02).
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
---
drivers/power/supply/axp20x_usb_power.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 089fe837a4b2..51c3f9b6458d 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -26,6 +26,8 @@
#define DRVNAME "axp20x-usb-power-supply"
+#define AXP192_USB_OTG_STATUS 0x04
+
#define AXP20X_PWR_STATUS_VBUS_PRESENT BIT(5)
#define AXP20X_PWR_STATUS_VBUS_USED BIT(4)
@@ -365,6 +367,13 @@ static const char * const axp22x_irq_names[] = {
"VBUS_REMOVAL",
};
+static int axp192_usb_curr_lim_table[] = {
+ -1,
+ -1,
+ 500000,
+ 100000,
+};
+
static int axp20x_usb_curr_lim_table[] = {
900000,
500000,
@@ -386,6 +395,16 @@ static int axp813_usb_curr_lim_table[] = {
2500000,
};
+static const struct axp_data axp192_data = {
+ .power_desc = &axp20x_usb_power_desc,
+ .irq_names = axp20x_irq_names,
+ .num_irq_names = ARRAY_SIZE(axp20x_irq_names),
+ .curr_lim_table = axp192_usb_curr_lim_table,
+ .curr_lim_fld = REG_FIELD(AXP20X_VBUS_IPSOUT_MGMT, 0, 1),
+ .vbus_valid_bit = REG_FIELD(AXP192_USB_OTG_STATUS, 2, 2),
+ .vbus_mon_bit = REG_FIELD(AXP20X_VBUS_MON, 3, 3),
+};
+
static const struct axp_data axp202_data = {
.power_desc = &axp20x_usb_power_desc,
.irq_names = axp20x_irq_names,
@@ -634,6 +653,9 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
static const struct of_device_id axp20x_usb_power_match[] = {
{
+ .compatible = "x-powers,axp192-usb-power-supply",
+ .data = &axp192_data,
+ }, {
.compatible = "x-powers,axp202-usb-power-supply",
.data = &axp202_data,
}, {
--
2.39.2
next prev parent reply other threads:[~2023-05-10 11:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 11:50 [PATCH v1 0/7] axp20x_usb_power: Add support for AXP192 Aidan MacDonald
2023-05-10 11:50 ` [PATCH v1 1/7] power: supply: axp20x_usb_power: Simplify USB current limit handling Aidan MacDonald
2023-05-10 11:50 ` [PATCH v1 2/7] power: supply: axp20x_usb_power: Use regmap fields for VBUS monitor feature Aidan MacDonald
2023-05-10 11:50 ` [PATCH v1 3/7] power: supply: axp20x_usb_power: Use regmap fields for USB BC feature Aidan MacDonald
2023-05-10 11:50 ` [PATCH v1 4/7] power: supply: axp20x_usb_power: Use regmap field for VBUS disabling Aidan MacDonald
2023-05-10 11:50 ` [PATCH v1 5/7] power: supply: axp20x_usb_power: Remove variant IDs from VBUS polling check Aidan MacDonald
2023-05-10 11:50 ` Aidan MacDonald [this message]
2023-05-10 11:50 ` [PATCH v1 7/7] dt-bindings: power: supply: axp20x: Add AXP192 compatible Aidan MacDonald
2023-05-10 14:22 ` Krzysztof Kozlowski
2023-05-15 21:26 ` [PATCH v1 0/7] axp20x_usb_power: Add support for AXP192 Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230510115046.963432-7-aidanmacdonald.0x0@gmail.com \
--to=aidanmacdonald.0x0@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox