From patchwork Thu Jun 27 04:46:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13713817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 34094C30658 for ; Thu, 27 Jun 2024 04:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=EJYxRBEnCR0c7heDIYrlzOpEfIjphMvhUvoRah75BKg=; b=DIvNQSJl5O8klpSoAaxoGVH1dl 19O55BJqep1lMBac+gemLL6/rVgCGW5QXMYCrvqdwVJy0Yo/kWmRxFIPGPtqmeXH6ef/EEs2NoVkA DtGYfeA1ZBedOS1l6vSN625DdTJBy+80DS1sVUm9/RYK8AXTiViYya2by2Fyfd6nzSKmiL7+NX3gQ cyIP62gAerKJ8QfjudNd+QXQaLyjaAhR8QAaTerGxxn7at3GP9oBzQ1CUZSmBgL0nJDKY0qFBvLaA JHEKJIGgePgESO6bpK59jfXPtxdLwqczh8i05hfj+M2mLdW5BArL+fv+/gXPSbbj6YcSbI1Pntty8 eboDASrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMh1e-00000009CWj-0AwT; Thu, 27 Jun 2024 04:46:26 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMh1W-00000009CVi-06Pu for linux-arm-kernel@lists.infradead.org; Thu, 27 Jun 2024 04:46:19 +0000 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-70b2421471aso5323826a12.0 for ; Wed, 26 Jun 2024 21:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719463577; x=1720068377; darn=lists.infradead.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=EJYxRBEnCR0c7heDIYrlzOpEfIjphMvhUvoRah75BKg=; b=koRm5vBYBmzjkcCI4SvQCDWkbR7OBdbU3xhJS9pgBZzth+JgilWuygDkugFFYcse7a gOkG2YuWsTtt1KJpRsPlG/9dcRUFIcJoHQU3IhpDRZVzbCGKv5jsJC5/BhmMiKnG61QI guE4OffuVsSxulhpAaTO9z1sdaVQ1qXfiMElKjf41V84uX9dwf/KwaVTSv1MBKxt4Sbt fUqRhYOL2KstrnrjbSeVFkHDROSZw9jxG+K24kmVx0pdamTSuevO5ONb8j++KOoqK+/Z 11170yOfFgrYzmZhlPPcZypkxc0Aedo18ucYYV6ZC8uUK850+Nt+G4QhQEIwc8d78ZsK mOkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719463577; x=1720068377; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EJYxRBEnCR0c7heDIYrlzOpEfIjphMvhUvoRah75BKg=; b=uMnsldIsssuLo06QigcA90VyrCkuzRM/PkxgdCBxGTClJNt9RkHHvDKB5Y/+sl+7/X YNbJYH8LzNq/vt4m7ZiBFwgAO6v6wOxX3k6YtXlW1Fgqxs6EhESCqsnjq9LV8y5uKMX9 GvJlrXbpi3i2fkM5F92574BBCr9Mfj1G73NfYrteS/ofc+QQnIl3L4783eNQY32KiS76 VpS5S1pfKEYLdS1UNowldTaQMuQSu0pjGS4S9K1CW8hXwMlnAKuO3hGUUNkabr5ZdKEK 8Au3Pyz+L/jxB/lIp1cw8/cf5xML31GRDNdhvU0JFrVEW9fxsrLIDwYvqU0yN8TEdWIF df9A== X-Forwarded-Encrypted: i=1; AJvYcCXvRayV+MpzBmBrib8iocdJ4g40eH1dYk9h/3OlcZ/RWLf29IwnDX2a9TdK9d0QitTeOEcSS+fqheRrrUyMzRTQUYKRcFJYVQOQ1UOg/C+UYlY8k3U= X-Gm-Message-State: AOJu0YxPRBAZInpPga4xNpvB2SFXsfAlQ0vX9BtFqa2W5v7wqMs4Y5Tv INuhw+MEr5A2amtNdASLhA0vSZUNw0ut+1mAjZk8q52SX/w2/5OEKDGyBw== X-Google-Smtp-Source: AGHT+IFp29qp9vdgmc0J9c1HxM/cGT4fSjmGUFZR4eKfFGh80tpXolcvxJJZBzvoJxjV+1Xfwv7/mA== X-Received: by 2002:a05:6a20:748c:b0:1bd:2413:a963 with SMTP id adf61e73a8af0-1becda2b052mr1205055637.41.1719463576445; Wed, 26 Jun 2024 21:46:16 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:c4ea:7ce4:91ae:d360]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1faac9c33e1sm3332565ad.279.2024.06.26.21.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 21:46:16 -0700 (PDT) Date: Wed, 26 Jun 2024 21:46:13 -0700 From: Dmitry Torokhov To: Thierry Reding Cc: Russell King , Jonathan Hunter , linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: tegra: paz00: use software nodes to describe GPIOs for WiFi rfkill Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240626_214618_113471_C9E2C5EC X-CRM114-Status: GOOD ( 14.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Complete conversion of the WiFi rfkill device to use device properties/software nodes by utilizing PROPERTY_ENTRY_GPIO() instead of a lookup table. Signed-off-by: Dmitry Torokhov --- Compiled only, no real hardware to test. arch/arm/mach-tegra/board-paz00.c | 50 ++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c index 18d37f90cdfe..3ec810b6f1a7 100644 --- a/arch/arm/mach-tegra/board-paz00.c +++ b/arch/arm/mach-tegra/board-paz00.c @@ -8,35 +8,49 @@ * Copyright (C) 2010 Google, Inc. */ -#include +#include #include +#include #include +#include +#include #include "board.h" -static struct property_entry wifi_rfkill_prop[] __initdata = { - PROPERTY_ENTRY_STRING("name", "wifi_rfkill"), - PROPERTY_ENTRY_STRING("type", "wlan"), - { }, +static const struct software_node tegra_gpiochip_node = { + .name = "tegra-gpio", }; -static struct platform_device wifi_rfkill_device = { - .name = "rfkill_gpio", - .id = -1, +static const struct property_entry wifi_rfkill_prop[] __initconst = { + PROPERTY_ENTRY_STRING("name", "wifi_rfkill"), + PROPERTY_ENTRY_STRING("type", "wlan"), + PROPERTY_ENTRY_GPIO("reset-gpios", + &tegra_gpiochip_node, 25, GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("shutdown-gpios", + &tegra_gpiochip_node, 85, GPIO_ACTIVE_HIGH), + { } }; -static struct gpiod_lookup_table wifi_gpio_lookup = { - .dev_id = "rfkill_gpio", - .table = { - GPIO_LOOKUP("tegra-gpio", 25, "reset", 0), - GPIO_LOOKUP("tegra-gpio", 85, "shutdown", 0), - { }, - }, +static const struct platform_device_info wifi_rfkill_info __initconst = { + .name = "rfkill_gpio", + .id = PLATFORM_DEVID_NONE, + .properties = wifi_rfkill_prop, }; void __init tegra_paz00_wifikill_init(void) { - device_create_managed_software_node(&wifi_rfkill_device.dev, wifi_rfkill_prop, NULL); - gpiod_add_lookup_table(&wifi_gpio_lookup); - platform_device_register(&wifi_rfkill_device); + struct platform_device *pd; + int err; + + err = software_node_register(&tegra_gpiochip_node); + if (err) { + pr_err("failed to register %s node: %d\n", + tegra_gpiochip_node.name, err); + return; + } + + pd = platform_device_register_full(&wifi_rfkill_info); + err = PTR_ERR_OR_ZERO(pd); + if (err) + pr_err("failed to register WiFi rfkill device: %d\n", err); }