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; }