From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D01DEC433E3 for ; Mon, 27 Jul 2020 08:35:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AAAD020719 for ; Mon, 27 Jul 2020 08:35:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dqeHzRbs" 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 Content-Transfer-Encoding: 8bit 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; } -- 2.26.2