linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>, Sebastian Reichel <sre@kernel.org>,
	Chen-Yu Tsai <wens@csie.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org
Subject: [PATCH 4/4] power: supply: axp288_charger: Unregister duplicate ACPI ac supply
Date: Thu, 16 Mar 2017 17:16:01 +0100	[thread overview]
Message-ID: <20170316161601.32267-5-hdegoede@redhat.com> (raw)
In-Reply-To: <20170316161601.32267-1-hdegoede@redhat.com>

On some systems with an axp288 PMIC the dsdt exports a non functional (*)
ACPI AC device (ACPI0003 device), which results in a Mains power_supply
which reports itself as being always online.

This commit calls acpi_ac_unregister() after successfully registering the
axp288_charger power_supply to remove the broken Mains power_supply.

*) It depends on a vendor specific BMOP ACPI opregion we do not implement

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/power/supply/Kconfig          | 2 ++
 drivers/power/supply/axp288_charger.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index e504644..8ee03d7 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -235,6 +235,8 @@ config CHARGER_AXP20X
 config AXP288_CHARGER
 	tristate "X-Powers AXP288 Charger"
 	depends on MFD_AXP20X && EXTCON_AXP288
+	# if ACPI_AC=m, this can't be 'y'
+	depends on ACPI_AC || !ACPI_AC
 	help
 	  Say yes here to have support X-Power AXP288 power management IC (PMIC)
 	  integrated charger.
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index 6be2fe2..d3bf4b2 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -23,6 +23,7 @@
 #include <linux/usb/otg.h>
 #include <linux/notifier.h>
 #include <linux/power_supply.h>
+#include <linux/power/acpi.h>
 #include <linux/property.h>
 #include <linux/mfd/axp20x.h>
 #include <linux/extcon.h>
@@ -876,6 +877,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
 		}
 	}
 
+	acpi_ac_unregister();
 	return 0;
 }
 
-- 
2.9.3


  parent reply	other threads:[~2017-03-16 16:16 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 16:15 [PATCH 0/4] Avoid duplicate registering of ACPI and native power-supplies Hans de Goede
2017-03-16 16:15 ` [PATCH 1/4] acpi: battery: Add acpi_battery_unregister() function Hans de Goede
2017-03-16 16:29   ` Andy Shevchenko
2017-03-20 13:03     ` Hans de Goede
2017-03-20 13:10       ` Andy Shevchenko
2017-03-20 13:11         ` Hans de Goede
2017-03-27  1:16   ` Zheng, Lv
2017-03-31  8:53     ` Hans de Goede
2017-03-31  9:00       ` Hans de Goede
2017-03-16 16:15 ` [PATCH 2/4] acpi: ac: Add acpi_ac_unregister() function Hans de Goede
2017-03-16 16:31   ` Andy Shevchenko
2017-03-16 16:16 ` [PATCH 3/4] power: supply: axp288_fuel_gauge: Unregister duplicate ACPI battery supply Hans de Goede
2017-03-16 16:33   ` Andy Shevchenko
2017-03-20 13:07     ` Hans de Goede
2017-03-29 20:31   ` Rafael J. Wysocki
2017-03-31  9:01     ` Hans de Goede
2017-03-31  9:05       ` Rafael J. Wysocki
2017-03-31  9:08         ` Hans de Goede
2017-03-31  9:11           ` Rafael J. Wysocki
2017-03-31  9:57             ` Hans de Goede
2017-03-31 22:30               ` Rafael J. Wysocki
2017-04-01 13:22                 ` Hans de Goede
2017-04-07  7:18               ` Hans de Goede
2017-04-10  7:31                 ` Hans de Goede
2017-04-10 18:13                   ` Hans de Goede
2017-04-10 20:01                     ` Rafael J. Wysocki
2017-04-11  9:18                       ` Hans de Goede
2017-04-11 13:51                         ` Rafael J. Wysocki
2017-03-16 16:16 ` Hans de Goede [this message]
2017-03-16 16:34   ` [PATCH 4/4] power: supply: axp288_charger: Unregister duplicate ACPI ac supply Andy Shevchenko
2017-03-20  1:33 ` [PATCH 0/4] Avoid duplicate registering of ACPI and native power-supplies Sebastian Reichel
2017-03-20 13:11   ` Hans de Goede
2017-03-20 13:18     ` Andy Shevchenko
2017-03-20 13:19       ` Hans de Goede
2017-03-20 21:55   ` Rafael J. Wysocki

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=20170316161601.32267-5-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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;
as well as URLs for NNTP newsgroup(s).