Linux-GPIO Archive on lore.kernel.org
 help / color / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Guan Xuetao <gxt@pku.edu.cn>
Cc: linux-gpio@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 2/2] unicore32: Get rid of <linux/gpio.h> dependency
Date: Mon, 27 Jul 2020 10:33:19 +0200
Message-ID: <20200727083319.304658-2-linus.walleij@linaro.org> (raw)
In-Reply-To: <20200727083319.304658-1-linus.walleij@linaro.org>

Instead of writing to the GPIO lines through the gpiolib
API, call the appropriate function directly in the driver.

Cc: Guan Xuetao <gxt@pku.edu.cn>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/unicore32/kernel/gpio.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/arch/unicore32/kernel/gpio.c b/arch/unicore32/kernel/gpio.c
index 887ea29c380a..3f6b5747b094 100644
--- a/arch/unicore32/kernel/gpio.c
+++ b/arch/unicore32/kernel/gpio.c
@@ -13,8 +13,6 @@
 #include <linux/module.h>
 #include <linux/gpio/driver.h>
 #include <linux/gpio/machine.h>
-/* FIXME: needed for gpio_set_value() - convert to use descriptors or hogs */
-#include <linux/gpio.h>
 #include <mach/hardware.h>
 
 #ifdef CONFIG_LEDS
@@ -110,22 +108,22 @@ void __init puv3_init_gpio(void)
 	writel(GPIO_DIR, GPIO_GPDR);
 #if	defined(CONFIG_PUV3_NB0916) || defined(CONFIG_PUV3_SMW0919)	\
 	|| defined(CONFIG_PUV3_DB0913)
-	gpio_set_value(GPO_WIFI_EN, 1);
-	gpio_set_value(GPO_HDD_LED, 1);
-	gpio_set_value(GPO_VGA_EN, 1);
-	gpio_set_value(GPO_LCD_EN, 1);
-	gpio_set_value(GPO_CAM_PWR_EN, 0);
-	gpio_set_value(GPO_LCD_VCC_EN, 1);
-	gpio_set_value(GPO_SOFT_OFF, 1);
-	gpio_set_value(GPO_BT_EN, 1);
-	gpio_set_value(GPO_FAN_ON, 0);
-	gpio_set_value(GPO_SPKR, 0);
-	gpio_set_value(GPO_CPU_HEALTH, 1);
-	gpio_set_value(GPO_LAN_SEL, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_WIFI_EN, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_HDD_LED, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_VGA_EN, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_LCD_EN, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_CAM_PWR_EN, 0);
+	puv3_direction_output(&puv3_gpio_chip, GPO_LCD_VCC_EN, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_SOFT_OFF, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_BT_EN, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_FAN_ON, 0);
+	puv3_direction_output(&puv3_gpio_chip, GPO_SPKR, 0);
+	puv3_direction_output(&puv3_gpio_chip, GPO_CPU_HEALTH, 1);
+	puv3_direction_output(&puv3_gpio_chip, GPO_LAN_SEL, 1);
 /*
  * DO NOT modify the GPO_SET_V1 and GPO_SET_V2 in kernel
- *	gpio_set_value(GPO_SET_V1, 1);
- *	gpio_set_value(GPO_SET_V2, 1);
+ *	puv3_direction_output(&puv3_gpio_chip, GPO_SET_V1, 1);
+ *	puv3_direction_output(&puv3_gpio_chip, GPO_SET_V2, 1);
  */
 #endif
 	gpiochip_add_data(&puv3_gpio_chip, NULL);
-- 
2.26.2


      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27  8:33 [PATCH 1/2] unicore32: Convert GPIO LEDs to use machine descriptor table Linus Walleij
2020-07-27  8:33 ` Linus Walleij [this message]

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=20200727083319.304658-2-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=gxt@pku.edu.cn \
    --cc=linux-gpio@vger.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

Linux-GPIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-gpio/0 linux-gpio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-gpio linux-gpio/ https://lore.kernel.org/linux-gpio \
		linux-gpio@vger.kernel.org
	public-inbox-index linux-gpio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-gpio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git