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: 247161 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp4605068ilg; Mon, 27 Jul 2020 01:35:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLFKn0AKycFcfx9OMsMmG5ZsLoBCvyhFJf3xYW3gpQ9p/H89MhaMgPOCXobkffPwcunUoe X-Received: by 2002:a17:906:b2d2:: with SMTP id cf18mr8284013ejb.551.1595838928031; Mon, 27 Jul 2020 01:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595838928; cv=none; d=google.com; s=arc-20160816; b=d5M2QKIJOYjw6lKCeg8GdQR0BL731BhZHw/5OA+nBuvc6e/5hvJ/UaxJ065KvWi+vE zVnY2HfXGOExSuoLD7RhAeswk4LGCbt8KIrQSo9a4fsSE93ibiPUoWl+a/fxp1trmFPX +0Mf8FrgOcBHruOnX/hfnDLF00avXNnNbCbk3c4B/t5HKaIO+5hxWcyApwa/giIkWYTK hnIVxHmGorC8SIWUybFY1yb8LYA5CaZMgc0+okOdZp+k5TEORBlqKBQSDwRWpcjJeTrY Sq9lkPxdjydkFhBCAZVdEtsBj6FEjg1DfQ7mU2J7RO0yoES/oeazo3Zn5vyKKnhkXyRa 2WeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=DcqMHLBx80emp1kcwjVp53X1uXPogEjD0s/igUbPvts=; b=UfaIN9deMkc5aJ3geUSnP6YmNGIBgeGi5OJ/7o0F0Kw33tWItOoj32RoIVr7c95yfy 3hxzn6wCkdnaBNCvmthD2KWuCSLM3BpmEA0JLNPaRxTvW47ZAmfLn3TuqMahj4Ng5gA3 G/xbE8jc7DYJz2ltoA1upd1NFN6oMwWpOMKfbR751/GxO9plvJvGNGrCvCNzJ+yB9Sno gglUKeYo+jjUS+9HeRh5Yy6Jr1DvtMlhzlh8F/eycjtgtSozt2iFJTJWrZlXaMalUJ6H ddg5B1m4Nqcud2vSmmj38WcTiSJodGhmHU/qIKlDM74BRsgMcdTxosmBGT1G6ybz0+/I 4Nsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dqeHzRbs; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc11si5162478edb.259.2020.07.27.01.35.27; Mon, 27 Jul 2020 01:35:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dqeHzRbs; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726845AbgG0If1 (ORCPT + 6 others); 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-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(-) -- 2.26.2 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: 247162 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp4605364ilg; Mon, 27 Jul 2020 01:35:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzosBivHtYsEo5tvYO/HthjALgF3zw5/jMlQAvnDEHbD/5XthwpkqqGERZx6NY2Tsy4eHpB X-Received: by 2002:a17:906:c04f:: with SMTP id bm15mr10503108ejb.207.1595838958387; Mon, 27 Jul 2020 01:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595838958; cv=none; d=google.com; s=arc-20160816; b=mtlUZnVpVsaqEW+63Rxe5olsqt5uAUhJCSx3r9WI9csAd6octdMTez7/lU+HWOLG73 KvhxK8PZVIy4drK449p1WGqc+pshnZ8zU3u7iRWvK/FuMU26JaRPUh066vE4vY/4YIN1 JD7hv3uKSXa5yh9KN6ck0WqCFkQmEdI+xzM5ziU5SnQQVY5tmAS2c32i3iojjFAbes1o DBtFdHiKaeYToNBZWKFrlFDt3ysYjEJyYcWG7qfYYI19Fk5m/iqfQm1lCvDSdv5nDuKd cmKlHoTlpICI+lSQT3/gYglKeWVtQ93PedTBvZr86saagrECWBNVPHrFg+JIz6LkE4de JwQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MNrZrbX/zWOXvZdcywPntPx7fwHt/d5If59xF2eCZlY=; b=d4JzUlTQ0EIHXQSkFDjwo0VbbKhKR5pyxlFgYgV6dI76wGLM/cKF6q2/9b++gMb3hc LfTa5bnlkDJkYH0ojnJkdPpsbWhYdWrRzJo+co0LiUpchX0ldBV0JTp56g15JcAlz8dV 5Px9Q/zN19w/oiwXscVlVKFynxRZU/E+z6Yyj5Zaz5u9jx3v496/ioWYpAjAmKweAlg2 lO7BCgGiqLsrtIJWCjUL7TCJfkiU4h7QvxrHSFf7D9T/fW22r22pMRnt337RlCJKCq3F 6elobRfZpztjtadYZnIpscP/uN+42X1eBYj2qHNRRLs4xmfo4OCT2fSEMEFpmG0Ynkz8 PAPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UNydazH+; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si5144330eje.121.2020.07.27.01.35.58; Mon, 27 Jul 2020 01:35:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UNydazH+; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726283AbgG0If5 (ORCPT + 6 others); 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-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(-) -- 2.26.2 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);