linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Sebastian Reichel <sre@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Emil Velikov <emil.velikov@collabora.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Daniel Mack <daniel@zonque.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Russell King <linux@armlinux.org.uk>,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@collabora.com,
	linux-arm-kernel@lists.infradead.org,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: [PATCHv2 4/6] ARM: pxa: Use GPIO descriptor for gpio-charger
Date: Sat,  6 Jun 2020 00:44:01 +0200	[thread overview]
Message-ID: <20200605224403.181015-5-sebastian.reichel@collabora.com> (raw)
In-Reply-To: <20200605224403.181015-1-sebastian.reichel@collabora.com>

Provide AC detect GPIO via gpiod table instead of
legacy platform data so that legacy GPIO support
can be removed from the driver.

Also remove useless IRQ resource, which is not
used by the driver.

Due to lack of hardware this has only been compile
tested.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 arch/arm/mach-pxa/tosa.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 3d2c108e911e..e4da2b4c5055 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -369,6 +369,14 @@ static struct pxaficp_platform_data tosa_ficp_platform_data = {
 /*
  * Tosa AC IN
  */
+static struct gpiod_lookup_table tosa_charger_gpiod_table = {
+	.dev_id = "gpio-charger",
+	.table = {
+		GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_AC_IN, NULL, GPIO_ACTIVE_LOW),
+		{},
+	},
+};
+
 static char *tosa_ac_supplied_to[] = {
 	"main-battery",
 	"backup-battery",
@@ -378,29 +386,14 @@ static char *tosa_ac_supplied_to[] = {
 static struct gpio_charger_platform_data tosa_power_data = {
 	.name			= "charger",
 	.type			= POWER_SUPPLY_TYPE_MAINS,
-	.gpio			= TOSA_GPIO_AC_IN,
-	.gpio_active_low	= 1,
 	.supplied_to		= tosa_ac_supplied_to,
 	.num_supplicants	= ARRAY_SIZE(tosa_ac_supplied_to),
 };
 
-static struct resource tosa_power_resource[] = {
-	{
-		.name		= "ac",
-		.start		= PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
-		.end		= PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
-		.flags		= IORESOURCE_IRQ |
-				  IORESOURCE_IRQ_HIGHEDGE |
-				  IORESOURCE_IRQ_LOWEDGE,
-	},
-};
-
 static struct platform_device tosa_power_device = {
 	.name			= "gpio-charger",
 	.id			= -1,
 	.dev.platform_data	= &tosa_power_data,
-	.resource		= tosa_power_resource,
-	.num_resources		= ARRAY_SIZE(tosa_power_resource),
 };
 
 /*
@@ -950,6 +943,7 @@ static void __init tosa_init(void)
 
 	clk_add_alias("CLK_CK3P6MI", tc6393xb_device.name, "GPIO11_CLK", NULL);
 
+	gpiod_add_lookup_table(&tosa_charger_gpiod_table);
 	gpiod_add_lookup_table(&tosa_udc_gpiod_table);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 }
-- 
2.26.2


  parent reply	other threads:[~2020-06-05 22:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 22:43 [PATCHv2 0/6] misc. gpio-charger patches Sebastian Reichel
2020-06-05 22:43 ` [PATCHv2 1/6] dt-bindings: power: supply: gpio-charger: convert to yaml Sebastian Reichel
2020-06-10  9:41   ` Linus Walleij
2020-06-15 17:49   ` Rob Herring
2020-06-19 16:29   ` Sebastian Reichel
2020-06-05 22:43 ` [PATCHv2 2/6] power: supply: gpio-charger: Make gpios optional Sebastian Reichel
2020-06-10  9:44   ` Linus Walleij
2020-06-15 17:50   ` Rob Herring
2020-06-19 16:29   ` Sebastian Reichel
2020-06-05 22:44 ` [PATCHv2 3/6] power: supply: gpio-charger: add charge-current-limit feature Sebastian Reichel
2020-06-10  9:46   ` Linus Walleij
2020-06-15 17:58   ` Rob Herring
2020-06-19 16:28     ` Sebastian Reichel
2020-06-05 22:44 ` Sebastian Reichel [this message]
2020-06-10  9:52   ` [PATCHv2 4/6] ARM: pxa: Use GPIO descriptor for gpio-charger Linus Walleij
2020-06-05 22:44 ` [PATCHv2 5/6] ARM: sa1100: " Sebastian Reichel
2020-06-10  9:54   ` Linus Walleij
2020-06-05 22:44 ` [PATCHv2 6/6] power: supply: gpio-charger: drop legacy GPIO support Sebastian Reichel
2020-06-10  9:55   ` Linus Walleij

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=20200605224403.181015-5-sebastian.reichel@collabora.com \
    --to=sebastian.reichel@collabora.com \
    --cc=daniel@zonque.org \
    --cc=devicetree@vger.kernel.org \
    --cc=emil.velikov@collabora.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=kernel@collabora.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=robert.jarzmik@free.fr \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.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).