* [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes
@ 2021-10-18 13:50 Hans de Goede
2021-10-18 13:50 ` [PATCH 1/3] power: supply: axp288-charger: Add depends on IOSF_MBIO to Kconfig Hans de Goede
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Hans de Goede @ 2021-10-18 13:50 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: Hans de Goede, Kate Hsuan, linux-pm
Hi All,
Here are 3 patches for the axp288-charger driver which apply on top of
commit ed229454856e ("power: supply: axp288-charger: Optimize register
reading method") in linux-power-supply/for-next .
The first patch is a build fix and the other 2 are 2 small cleanups.
Regards,
Hans
Hans de Goede (3):
power: supply: axp288-charger: Add depends on IOSF_MBIO to Kconfig
power: supply: axp288-charger: Remove unnecessary is_present and
is_online helpers
power: supply: axp288-charger: Simplify axp288_get_charger_health()
drivers/power/supply/Kconfig | 2 +-
drivers/power/supply/axp288_charger.c | 37 +++++----------------------
2 files changed, 8 insertions(+), 31 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] power: supply: axp288-charger: Add depends on IOSF_MBIO to Kconfig
2021-10-18 13:50 [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes Hans de Goede
@ 2021-10-18 13:50 ` Hans de Goede
2021-10-18 13:50 ` [PATCH 2/3] power: supply: axp288-charger: Remove unnecessary is_present and is_online helpers Hans de Goede
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2021-10-18 13:50 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: Hans de Goede, Kate Hsuan, linux-pm, kernel test robot
Add "depends on IOSF_MBI" to CONFIG_AXP288_CHARGER as the changes from
commit ed229454856e ("power: supply: axp288-charger: Optimize register
reading method") use symbols which are only defined when IOSF_MBI support
is enabled.
Depending on this is ok since IOSF_MBI support should always be enabled
on devices which use the AXP288 PMIC.
Fixes: ed229454856e ("power: supply: axp288-charger: Optimize register reading method")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/power/supply/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index fcc7534edcb2..2366b785abd9 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -351,7 +351,7 @@ config AXP20X_POWER
config AXP288_CHARGER
tristate "X-Powers AXP288 Charger"
- depends on MFD_AXP20X && EXTCON_AXP288
+ depends on MFD_AXP20X && EXTCON_AXP288 && IOSF_MBI
help
Say yes here to have support X-Power AXP288 power management IC (PMIC)
integrated charger.
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] power: supply: axp288-charger: Remove unnecessary is_present and is_online helpers
2021-10-18 13:50 [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes Hans de Goede
2021-10-18 13:50 ` [PATCH 1/3] power: supply: axp288-charger: Add depends on IOSF_MBIO to Kconfig Hans de Goede
@ 2021-10-18 13:50 ` Hans de Goede
2021-10-18 13:50 ` [PATCH 3/3] power: supply: axp288-charger: Simplify axp288_get_charger_health() Hans de Goede
2021-10-18 16:25 ` [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes Sebastian Reichel
3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2021-10-18 13:50 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: Hans de Goede, Kate Hsuan, linux-pm
Now that axp288_charger_usb_update_property() reads and caches all
relevant registers, the axp288_charger_is_present() and
axp288_charger_is_online() helpers are not necessary anymore.
Directly check the cached input_status instead, allowing the removal
of these 2 helpers.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/power/supply/axp288_charger.c | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index 058e2cd4b4aa..d09c8f36b73a 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -302,24 +302,6 @@ static int axp288_charger_enable_charger(struct axp288_chrg_info *info,
return ret;
}
-static int axp288_charger_is_present(struct axp288_chrg_info *info)
-{
- int present = 0;
-
- if (info->input_status & PS_STAT_VBUS_PRESENT)
- present = 1;
- return present;
-}
-
-static int axp288_charger_is_online(struct axp288_chrg_info *info)
-{
- int online = 0;
-
- if (info->input_status & PS_STAT_VBUS_VALID)
- online = 1;
- return online;
-}
-
static int axp288_get_charger_health(struct axp288_chrg_info *info)
{
int health = POWER_SUPPLY_HEALTH_UNKNOWN;
@@ -447,7 +429,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
val->intval = 0;
break;
}
- val->intval = axp288_charger_is_present(info);
+ val->intval = (info->input_status & PS_STAT_VBUS_PRESENT) ? 1 : 0;
break;
case POWER_SUPPLY_PROP_ONLINE:
/* Check for OTG case first */
@@ -455,7 +437,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
val->intval = 0;
break;
}
- val->intval = axp288_charger_is_online(info);
+ val->intval = (info->input_status & PS_STAT_VBUS_VALID) ? 1 : 0;
break;
case POWER_SUPPLY_PROP_HEALTH:
val->intval = axp288_get_charger_health(info);
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] power: supply: axp288-charger: Simplify axp288_get_charger_health()
2021-10-18 13:50 [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes Hans de Goede
2021-10-18 13:50 ` [PATCH 1/3] power: supply: axp288-charger: Add depends on IOSF_MBIO to Kconfig Hans de Goede
2021-10-18 13:50 ` [PATCH 2/3] power: supply: axp288-charger: Remove unnecessary is_present and is_online helpers Hans de Goede
@ 2021-10-18 13:50 ` Hans de Goede
2021-10-18 16:25 ` [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes Sebastian Reichel
3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2021-10-18 13:50 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: Hans de Goede, Kate Hsuan, linux-pm
Now that axp288_charger_usb_update_property() reads and caches all
relevant registers, axp288_get_charger_health() can be simplified
by directly returning the health.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/power/supply/axp288_charger.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index d09c8f36b73a..ed058b598223 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -304,22 +304,17 @@ static int axp288_charger_enable_charger(struct axp288_chrg_info *info,
static int axp288_get_charger_health(struct axp288_chrg_info *info)
{
- int health = POWER_SUPPLY_HEALTH_UNKNOWN;
-
if (!(info->input_status & PS_STAT_VBUS_PRESENT))
- goto health_read_fail;
+ return POWER_SUPPLY_HEALTH_UNKNOWN;
if (!(info->input_status & PS_STAT_VBUS_VALID))
- health = POWER_SUPPLY_HEALTH_DEAD;
+ return POWER_SUPPLY_HEALTH_DEAD;
else if (info->op_mode & CHRG_STAT_PMIC_OTP)
- health = POWER_SUPPLY_HEALTH_OVERHEAT;
+ return POWER_SUPPLY_HEALTH_OVERHEAT;
else if (info->op_mode & CHRG_STAT_BAT_SAFE_MODE)
- health = POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE;
+ return POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE;
else
- health = POWER_SUPPLY_HEALTH_GOOD;
-
-health_read_fail:
- return health;
+ return POWER_SUPPLY_HEALTH_GOOD;
}
static int axp288_charger_usb_set_property(struct power_supply *psy,
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes
2021-10-18 13:50 [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes Hans de Goede
` (2 preceding siblings ...)
2021-10-18 13:50 ` [PATCH 3/3] power: supply: axp288-charger: Simplify axp288_get_charger_health() Hans de Goede
@ 2021-10-18 16:25 ` Sebastian Reichel
3 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2021-10-18 16:25 UTC (permalink / raw)
To: Hans de Goede; +Cc: Kate Hsuan, linux-pm
[-- Attachment #1: Type: text/plain, Size: 864 bytes --]
Hi,
On Mon, Oct 18, 2021 at 03:50:50PM +0200, Hans de Goede wrote:
> Here are 3 patches for the axp288-charger driver which apply on top of
> commit ed229454856e ("power: supply: axp288-charger: Optimize register
> reading method") in linux-power-supply/for-next .
>
> The first patch is a build fix and the other 2 are 2 small cleanups.
>
> Regards,
>
> Hans
>
>
> Hans de Goede (3):
> power: supply: axp288-charger: Add depends on IOSF_MBIO to Kconfig
> power: supply: axp288-charger: Remove unnecessary is_present and
> is_online helpers
> power: supply: axp288-charger: Simplify axp288_get_charger_health()
>
> drivers/power/supply/Kconfig | 2 +-
> drivers/power/supply/axp288_charger.c | 37 +++++----------------------
> 2 files changed, 8 insertions(+), 31 deletions(-)
Thanks, queued.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-18 16:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 13:50 [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes Hans de Goede
2021-10-18 13:50 ` [PATCH 1/3] power: supply: axp288-charger: Add depends on IOSF_MBIO to Kconfig Hans de Goede
2021-10-18 13:50 ` [PATCH 2/3] power: supply: axp288-charger: Remove unnecessary is_present and is_online helpers Hans de Goede
2021-10-18 13:50 ` [PATCH 3/3] power: supply: axp288-charger: Simplify axp288_get_charger_health() Hans de Goede
2021-10-18 16:25 ` [PATCH 0/3] power: supply: axp288-charger: cleanups + fixes Sebastian Reichel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.