From patchwork Mon Jul 27 08:33:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1336743 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=dqeHzRbs; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BFY676hk1z9sRR for ; Mon, 27 Jul 2020 18:35:27 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726845AbgG0If1 (ORCPT ); Mon, 27 Jul 2020 04:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbgG0If1 (ORCPT ); Mon, 27 Jul 2020 04:35:27 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD3C6C061794 for ; Mon, 27 Jul 2020 01:35:25 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id 140so8545658lfi.5 for ; Mon, 27 Jul 2020 01:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DcqMHLBx80emp1kcwjVp53X1uXPogEjD0s/igUbPvts=; b=dqeHzRbs2WQDrOUN2QUum50GDjhzkUK/aR1AIQ6oWHBQ+iJIacd4AcLBq7TvYjkNw8 y1cDoGnHLasDTZ4dtKIk/odDjTFdRUCczeEGkBLmFvVV+WAzMJ3ZQO/6NZBuGVLbkXyJ 2egr4g2ctEUCyeM7LOMpa97Dw0128lrtzE/L612TnKriJCA8yPfPZDs8hpxduvrMXcb1 UeyxBQ15E57hNWY8rbioTmkUt9Pt6/WRYKuCixnf377ToqffuLC1V7ofbwjKReE9omKR VqWyxHk2lFzeakVTO7C4amWxIVq73NBPvjfzwcDNPJvJpGmuEUbFq3HZWH1VDmzf735Z zPQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DcqMHLBx80emp1kcwjVp53X1uXPogEjD0s/igUbPvts=; b=qDf/x5hgdFNQvJpgmMDP3z0Y9DRaW8sfXgJ/9eadS0KA4A3tDbOS/avfgKYkfLi489 fwiNompwkcDHwMfASDQvklqAhm2DJskFOzhGzJOiEtiDz9lqcwEn0GQnac0Hu6ZnDEzt jR2vrNR7TZBcAJJh/zLTcFSotSV9U0HJ+6+lNVFxuYGE5TQN9hFU70TE8pG8hjXEqmPM ygKQBhH8+2WDzXHaMs2PDmeaPQHTAClAj4PFuOkrBHozSvUHHlvtHMbOswYyJBiRzpaG zAscn2hdsNwjwMyaTqlluXt4ZF9GvMTQD/FS6CbnmRIXWvjgt5y7263Rv/2vfDYUfTwE YGFw== X-Gm-Message-State: AOAM531k/NU3pAuXtX5OZc7ArFnjPZDaUInQQfMBM41C3S6rXuFYWfG5 SkBApYq8Yw8qtYlz/iRQp5gwIw== X-Google-Smtp-Source: ABdhPJxxFS7QsvuniCyV8tW3GnQLsw7xy2zEmDJAnS12LmmbcqKRUqAUWXmubpNBD1E7HTFl1DjgMg== X-Received: by 2002:a19:d14:: with SMTP id 20mr11298107lfn.27.1595838924212; Mon, 27 Jul 2020 01:35:24 -0700 (PDT) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id d14sm2865741lfj.30.2020.07.27.01.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 01:35:23 -0700 (PDT) From: Linus Walleij To: Guan Xuetao Cc: linux-gpio@vger.kernel.org, Linus Walleij , Stephan Linz Subject: [PATCH 1/2] unicore32: Convert GPIO LEDs to use machine descriptor table Date: Mon, 27 Jul 2020 10:33:18 +0200 Message-Id: <20200727083319.304658-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This converts the Unicore32 LEDs to use the GPIO machine descriptor table to provide the GPIO lines. Cc: Stephan Linz Cc: Guan Xuetao Signed-off-by: Linus Walleij --- arch/unicore32/kernel/gpio.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/unicore32/kernel/gpio.c b/arch/unicore32/kernel/gpio.c index 36d395b54b7c..887ea29c380a 100644 --- a/arch/unicore32/kernel/gpio.c +++ b/arch/unicore32/kernel/gpio.c @@ -12,6 +12,7 @@ #include #include #include +#include /* FIXME: needed for gpio_set_value() - convert to use descriptors or hogs */ #include #include @@ -21,10 +22,8 @@ #include static const struct gpio_led puv3_gpio_leds[] = { - { .name = "cpuhealth", .gpio = GPO_CPU_HEALTH, .active_low = 0, - .default_trigger = "heartbeat", }, - { .name = "hdd_led", .gpio = GPO_HDD_LED, .active_low = 1, - .default_trigger = "disk-activity", }, + { .name = "cpuhealth", .default_trigger = "heartbeat", }, + { .name = "hdd_led", .default_trigger = "disk-activity", }, }; static const struct gpio_led_platform_data puv3_gpio_led_data = { @@ -32,6 +31,17 @@ static const struct gpio_led_platform_data puv3_gpio_led_data = { .leds = (void *) puv3_gpio_leds, }; +static struct gpiod_lookup_table puv3_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("gpio", GPO_CPU_HEALTH, NULL, + 0, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("gpio", GPO_HDD_LED, NULL, + 1, GPIO_ACTIVE_LOW), + { }, + }, +}; + static struct platform_device puv3_gpio_gpio_leds = { .name = "leds-gpio", .id = -1, @@ -42,6 +52,7 @@ static struct platform_device puv3_gpio_gpio_leds = { static int __init puv3_gpio_leds_init(void) { + gpiod_add_lookup_table(&puv3_leds_gpio_table); platform_device_register(&puv3_gpio_gpio_leds); return 0; } From patchwork Mon Jul 27 08:33:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1336744 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=UNydazH+; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BFY6k57jwz9sRN for ; Mon, 27 Jul 2020 18:35:58 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726283AbgG0If5 (ORCPT ); Mon, 27 Jul 2020 04:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbgG0If5 (ORCPT ); Mon, 27 Jul 2020 04:35:57 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B0F3C061794 for ; Mon, 27 Jul 2020 01:35:57 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id 140so8546459lfi.5 for ; Mon, 27 Jul 2020 01:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MNrZrbX/zWOXvZdcywPntPx7fwHt/d5If59xF2eCZlY=; b=UNydazH+h5paUsWR20yLKHx6NChUdxd7sfhV3mi7wqHH1T27VowY7imJYVgdmbQPTw FVGMWwqgZtb1rwHPc0d2AVuHE/JJ1zMaEy234q986NUM7tKr034NL+78fY2pfEUO3LOs ozf0Ky5oFjsDiliy4Emvc7a9kwBlWXbGhU6v8fnGN3pkbm/+qNylN5bhfDg++Mx+mXpf BIpAXtPuwu7nZVPVmed+mENxe9eFAe4KBjmLz48VWk82GxmYJbROkVxdGpJZMhBFar36 3tKrq0to/BBXmQgQh8vZV3h+/8U0HfCM1ukmqA5IsAQIYhFmsoWuObDOHRXvnzunXLeo Sd7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MNrZrbX/zWOXvZdcywPntPx7fwHt/d5If59xF2eCZlY=; b=jGNQ9in2CmvQGrUYleBgctAQ+23E6FoddIGdBIAEct8LW7CWqsusmYVvEez62iASri 8+Xy++9i60p6iXNeCj7mlTv2owhN6BkE+MWE3OEG1pxJgWYs8gwQqXzNrS/Q+rQK+imK QWYZSsqbrHBIUTaubnBE8Wc1MlDoYO6kbVJImAIN8HiIXQt1Zk8IpDCQSMXDjmRjb5QP uVarXO+mc7WibgOoPfmJPIDCjFdTX2psDwlgk9uUobWJob5YRiYAnsKDK1RK/iAEL+xx OQ0MHvkDWaAzeGZ0RMCvm/1aPSzY9twi6Kghcr2lVv+OG1O8mc7mqlKWdoG+xbVh21K9 f0Xw== X-Gm-Message-State: AOAM530TiDhGMIw6KENQjV72JvmopWC16fJYLdPh2sw/ZnZj/v4Yra3I 8zGJ4i5azpz6BUgjQRXgqZ8Psw== X-Google-Smtp-Source: ABdhPJzz5H/BlTgfUUZmd7Or3pK4iUQOrratjL+D8qU2xzqWMg0l6AYYfuJjGp9jLmWoWYvfcI0udg== X-Received: by 2002:ac2:58d5:: with SMTP id u21mr11086919lfo.31.1595838955657; Mon, 27 Jul 2020 01:35:55 -0700 (PDT) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id d14sm2865741lfj.30.2020.07.27.01.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 01:35:55 -0700 (PDT) From: Linus Walleij To: Guan Xuetao Cc: linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH 2/2] unicore32: Get rid of dependency Date: Mon, 27 Jul 2020 10:33:19 +0200 Message-Id: <20200727083319.304658-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200727083319.304658-1-linus.walleij@linaro.org> References: <20200727083319.304658-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Instead of writing to the GPIO lines through the gpiolib API, call the appropriate function directly in the driver. Cc: Guan Xuetao Signed-off-by: Linus Walleij --- 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 #include #include -/* FIXME: needed for gpio_set_value() - convert to use descriptors or hogs */ -#include #include #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);