From patchwork Tue Jan 2 21:07:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4684523dyb; Tue, 2 Jan 2024 13:09:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEICHz9b4LxY5rkXynNL5q8L262lKf3XBsJVXPA/YZxAw5Tl93xybmHRamciEF58lrq2s6h X-Received: by 2002:a05:600c:3153:b0:40d:70c4:fd6a with SMTP id h19-20020a05600c315300b0040d70c4fd6amr2888167wmo.60.1704229790508; Tue, 02 Jan 2024 13:09:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229790; cv=none; d=google.com; s=arc-20160816; b=gDkvrohdQi/XvrvUb26XmubvwLR1kyy58p7lb/qLDq8z9lzpISjhLd1XOcKtxaqIDk 6XZXRlWENzMRT+zgkCPAqW81IN4VDdc4Ut350ojNy6VjZ5ua+/V9rngFXlqcXKB9RkdU TalA2VjhxqzJPNk+/eGdhtdAi2XrHFcbTgg9EKdp0786+onNPc2Jag5rzpKuOsX1Y1K9 INaTWWVMa/MT9njiBsGz+zKDCphPJVsmUoKj34KTjIqWZlkdHKIFYjzBU0HJ2MfklReW 5xg5L9BuYwtAPovG6VKWqQaabTYZolbqn3r9RtM2jRpWhkqORZRI4MSh6kQ19iouWlBF XHCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AULYiml6H3I+b2G8tlhMxcx/1ZvVdi4KizI4u111pxQ=; fh=8Mqhbukr6LRjig1GXBDFEaCoN2oEXwmEEUR2oC9Y8v8=; b=gMKmXOKzb7st++LiaaTyYruJDHCa2+8vSBN3UR8Fh26ynePe/iNJEVhMEiNNgJG/IJ T/4nkPaqPC7ZvoyLWUMviv5Lyj524zzjS6xbZXUPIJ4B6N6BLMJD0OO5MrvW+f50sEyN rp+k5ugibsolMyxDQg81tEfj+xGWyAfvy+EdX6JceIw4/K4WE5r4mNo0wDD1kTUX/IlA st+oV5tNkuVmpGd/hC2S4DUjPo5D/FDh7ZrcbUXwBLEpqBVnB7y+t92b5Xvjj/I5Ptl+ qcLG9m8OfFoO/9l/8cLq9aT3ylk462Ju/yOGXextG/zc+SZj/ELa3FdN3t2AqXmM8dDS UrUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Joo2LHIv; spf=pass (google.com: domain of linux-kernel+bounces-14825-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14825-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e17-20020a1709062d5100b00a0fe0ed680esi10385603eji.178.2024.01.02.13.09.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14825-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Joo2LHIv; spf=pass (google.com: domain of linux-kernel+bounces-14825-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14825-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 205241F23529 for ; Tue, 2 Jan 2024 21:09:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A376117727; Tue, 2 Jan 2024 21:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Joo2LHIv" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59FBF1643A for ; Tue, 2 Jan 2024 21:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-7baa8da5692so421987239f.0 for ; Tue, 02 Jan 2024 13:08:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229724; x=1704834524; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AULYiml6H3I+b2G8tlhMxcx/1ZvVdi4KizI4u111pxQ=; b=Joo2LHIvGCuK3aFERRxNSEtajHNauRc0yJaLHBjfMAMzRY8w7hVez0nRhsg3zc2dlN 5Up3Ht5heS20vtfDdGVUfDzWfCgfhs8QzZkJe6f9GOz2RddQH99u8O+exxZW46folbED T4xTPIQDzWuehQ0jdIS/SkAHnIMxQeG/QB46Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229724; x=1704834524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AULYiml6H3I+b2G8tlhMxcx/1ZvVdi4KizI4u111pxQ=; b=hPV0JlNixzp9tr7jsaCqkErLnKWM2GBwIs4JbgdaT/4RFsIU+y6S2vYTC4qssRr78W Y+eVM6QQIGjYwdssLn04Ad+Onejxd3zGwc6HQehBRmvcQ1OJp/JLI5WhRqk/xshoinPW ErJ8jBMTp2Y3eJtDORIvH/WOYG8333FnBkCIYy7HgvZ/VHn7KRPBWTwFeS8nhfS2Wgxr k4SqxW4EKcfWOYNHpOIyvccuQ7h5j6ru5b5Ntw3IgHB0i2QcLsWLmNn6SiFV2nzi33Fp 2eWgTGnHKw+xNqcKhIqFkvlJ58zcPgGGvjtvSNKJhKsNFI+80iWPadHZVLd+/R7lJ7if N5dA== X-Gm-Message-State: AOJu0YzcB+yrMpt6hkZsX9ikkRzTG/BkixGnWUNe5GZH8nlQJbVS9x01 9NWxpaY+rqnVqNIZuqRDavC9W7J1IOszs4CyVQ+SXIOe7weM X-Received: by 2002:a5e:a70b:0:b0:7b7:3d:6452 with SMTP id b11-20020a5ea70b000000b007b7003d6452mr18789276iod.5.1704229724386; Tue, 02 Jan 2024 13:08:44 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:44 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Andy Shevchenko , AKASHI Takahiro , Andrew Morton , Baoquan He , Greg Kroah-Hartman Subject: [PATCH v4 01/24] resource: Add DEFINE_RES_*_NAMED_FLAGS macro Date: Tue, 2 Jan 2024 14:07:25 -0700 Message-ID: <20240102140734.v4.1.I59b56ebd2f303784031c27bbb1529cf6ef71ba16@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014456667414872 X-GMAIL-MSGID: 1787014456667414872 In some cases, it would be nice to instantiate a struct resource with custom flags. For example, creating an IRQ resource with a flag that marks the interrupt as wake capable. Add a set of macros to provide custom flag arguments. Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Signed-off-by: Mark Hasemeyer --- Changes in v4: -Update Andy's email to @linux.intel.com -Add Reviewed-by tag Changes in v3: -New patch include/linux/ioport.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index db7fe25f33700..a44e73ca058a8 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -163,28 +163,38 @@ enum { .desc = IORES_DESC_NONE, \ } +#define DEFINE_RES_IO_NAMED_FLAGS(_start, _size, _name, _flags) \ + DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_IO) #define DEFINE_RES_IO_NAMED(_start, _size, _name) \ - DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO) + DEFINE_RES_IO_NAMED_FLAGS((_start), (_size), (_name), 0) #define DEFINE_RES_IO(_start, _size) \ DEFINE_RES_IO_NAMED((_start), (_size), NULL) +#define DEFINE_RES_MEM_NAMED_FLAGS(_start, _size, _name, _flags) \ + DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_MEM) #define DEFINE_RES_MEM_NAMED(_start, _size, _name) \ - DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM) + DEFINE_RES_MEM_NAMED_FLAGS((_start), (_size), (_name), 0) #define DEFINE_RES_MEM(_start, _size) \ DEFINE_RES_MEM_NAMED((_start), (_size), NULL) +#define DEFINE_RES_REG_NAMED_FLAGS(_start, _size, _name, _flags) \ + DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_REG) #define DEFINE_RES_REG_NAMED(_start, _size, _name) \ - DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_REG) + DEFINE_RES_REG_NAMED_FLAGS((_start), (_size), (_name), 0) #define DEFINE_RES_REG(_start, _size) \ DEFINE_RES_REG_NAMED((_start), (_size), NULL) +#define DEFINE_RES_IRQ_NAMED_FLAGS(_irq, _name, _flags) \ + DEFINE_RES_NAMED((_irq), 1, (_name), (_flags) | IORESOURCE_IRQ) #define DEFINE_RES_IRQ_NAMED(_irq, _name) \ - DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ) + DEFINE_RES_IRQ_NAMED_FLAGS((_irq), (_name), 0) #define DEFINE_RES_IRQ(_irq) \ DEFINE_RES_IRQ_NAMED((_irq), NULL) +#define DEFINE_RES_DMA_NAMED_FLAGS(_dma, _name, _flags) \ + DEFINE_RES_NAMED((_dma), 1, (_name), (_flags) | IORESOURCE_DMA) #define DEFINE_RES_DMA_NAMED(_dma, _name) \ - DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA) + DEFINE_RES_DMA_NAMED_FLAGS((_dma), (_name), 0) #define DEFINE_RES_DMA(_dma) \ DEFINE_RES_DMA_NAMED((_dma), NULL) From patchwork Tue Jan 2 21:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4684767dyb; Tue, 2 Jan 2024 13:10:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGwgQBwiESHWqYTeO3WG98LcUlcwEpWjzCOONnBXU11gMhps/9ePciVah1tk6v198/75QL8 X-Received: by 2002:a50:8d10:0:b0:554:8c1c:963e with SMTP id s16-20020a508d10000000b005548c1c963emr6016851eds.57.1704229816966; Tue, 02 Jan 2024 13:10:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229816; cv=none; d=google.com; s=arc-20160816; b=TBXqKHFpZ9KcdMeeojnblHtw09XN6dVB8CVVmnBbH78aAhYfiVvL7Ysbn7wWLNyo6C DODQEw+aHobSIT6l4GW7y2fi1HeizkkfSMa0vDyA8bGteLrW6s7UphX/n/VRvbCmpJjO f3gH4Bl8zd9/MUWCAL6olsDkxsIHS7KG89C3EGQLrSMK6g92ARF2IIC+nJpsoDtI+8sU oQhhGiTrIuQA/pgjd1yyvyT5x9SvxgNTtrnZQqDCm4iCns+JSSnrEuCPxFALKJGPxiT6 zSs0sWgZh+neoQ/v0+Q4rFu5LXWBuM5aNcSVu37fqaMzPZ8cK8NWffVpXt/4JF6zhGSp waYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wDUs5YQEZsX9VnndGDbbu1yg628Gh+zaw5NO27kLhoY=; fh=pKsgGDFFdLQc3YFh9NLm5tTv2Ma770e9UVEE4TzRUAM=; b=wcXTXsWjJd4aIc+Io4Zwxicjm8Ni+OKYX9EMyuYsa1CriVgYTSxfHaV5ePIyWZJ5I/ 7Tu/DQYIpBA8ExHy0Z9kEPjF74rwME8Rf/dL7AUnTM0StLqX+dduayXTdS9KAcxo0+wb SePmFTgk90Px+e8evrwEKRsgf4Plua/yGs4Fb5Z4dG8iLiw6TU1+PANzMksFDPPbX7Kv GKSvQOcMfV0rJfF/ZkSoY3VXtQDq/zC9YakZwMjk5u1+YEaZMCS7RF2XzXkltvnTfT4f 8B11MTEjHPM85pz9ziwHhGjPViYWVT7W/wMkLFQ/TJh6fykYSHN/a0Ea2dKrH5FPc2h3 xryQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Pq2/3heP"; spf=pass (google.com: domain of linux-kernel+bounces-14826-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14826-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n22-20020a509356000000b00553bc1bfbb9si11137808eda.381.2024.01.02.13.10.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:10:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14826-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Pq2/3heP"; spf=pass (google.com: domain of linux-kernel+bounces-14826-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14826-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 692B01F2352E for ; Tue, 2 Jan 2024 21:10:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D61231775E; Tue, 2 Jan 2024 21:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Pq2/3heP" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B7B6168A9 for ; Tue, 2 Jan 2024 21:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-7ba737ee9b5so735121539f.0 for ; Tue, 02 Jan 2024 13:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229725; x=1704834525; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wDUs5YQEZsX9VnndGDbbu1yg628Gh+zaw5NO27kLhoY=; b=Pq2/3heP8p60zYEI/ughl50VZ2wrYs3fb63RiSNzKebkEBpr8uMQojlnVPuvRUgD3O ORV26BAfKYkHUHTPQRr1NoqTVKBpDarNE67YUGJfSqohVcH1gb32Pud25o4goHprmGSR zlhC+k6oZ4BbC2UXZNOQhwRVSgqlBn3wU1Cr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229725; x=1704834525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wDUs5YQEZsX9VnndGDbbu1yg628Gh+zaw5NO27kLhoY=; b=S0eVzTJngRJ2hCCDeDZ3N7CW0hLs0/NujD56Q6iKxqs0acDivu4KnnMQyA8vP24l+v wloQ1QVO/cAJtkmY3qNwkO3dtdWLEfZP6iklVaP2UY9gnNNErhlkR8pmmC25HJjy6mBX sh9Nm/lVWXYZ3RBVv5Ql9S0TC+BvqvOAW42lDSfMOeX2VIvSTrlRXq/N9KeO4OFscqZw 0Kk2F1xkl3OlvyP9TGUhXiBPb+0GZrURZ25iwXxnjuUqu67Wv8hSyAWgdTV3buznO4rk j9A3AhIr1c35LTbInCGCPOmXLjeNYc0JiNZiMXQP71KjJRUPgFbauSvy9lXlh9VOcWLJ 5ARg== X-Gm-Message-State: AOJu0YxAruv1AAgvH8Bv2fdyP5IUyBBk17whHMiMUxHScOF17Yeox9s1 qjQ7SlbVvvqbT+KmWTHvAXGxBsJ5hQnxRf2Rut/+2onwblVn X-Received: by 2002:a6b:7e0d:0:b0:7bb:d0a3:47b4 with SMTP id i13-20020a6b7e0d000000b007bbd0a347b4mr192538iom.19.1704229725292; Tue, 02 Jan 2024 13:08:45 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:45 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Andy Shevchenko , Bartosz Golaszewski , Len Brown , Linus Walleij , Mika Westerberg , "Rafael J. Wysocki" , Wolfram Sang , linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org Subject: [PATCH v4 02/24] gpiolib: acpi: Modify acpi_dev_irq_wake_get_by() to use resource Date: Tue, 2 Jan 2024 14:07:26 -0700 Message-ID: <20240102140734.v4.2.Ifd0903f1c351e84376d71dbdadbd43931197f5ea@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014484588916828 X-GMAIL-MSGID: 1787014484588916828 Other information besides wake capability can be provided about GPIO IRQs such as triggering, polarity, and sharability. Use resource flags to provide this information to the caller if they want it. This should keep the API more robust over time as flags are added, modified, or removed. It also more closely matches acpi_irq_get() which take a resource as an argument. Rename the function to acpi_dev_get_gpio_irq_resource() to better describe the function's new behavior. Signed-off-by: Mark Hasemeyer --- Changes in v4: -DEFINES_RES_NAMED->DEFINE_RES_IRQ_NAMED_FLAGS -Indent fix -Initialize struct resource on stack -Remove ioport.h dependency in acpi.h Changes in v3: -Use DEFINE_RES_NAMED macro -Add acpi_gpio_info.shareable doc Changes in v2: -Remove explicit cast to struct resource -irq -> IRQ drivers/gpio/gpiolib-acpi.c | 28 +++++++++++++++++++--------- drivers/i2c/i2c-core-acpi.c | 10 ++++++++-- include/linux/acpi.h | 25 +++++++++++-------------- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 88066826d8e5b..d14426c831187 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -99,6 +100,7 @@ struct acpi_gpio_chip { * @pin_config: pin bias as provided by ACPI * @polarity: interrupt polarity as provided by ACPI * @triggering: triggering type as provided by ACPI + * @shareable: share type as provided by ACPI (shared vs exclusive). * @wake_capable: wake capability as provided by ACPI * @debounce: debounce timeout as provided by ACPI * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping @@ -111,6 +113,7 @@ struct acpi_gpio_info { int polarity; int triggering; bool wake_capable; + bool shareable; unsigned int debounce; unsigned int quirks; }; @@ -760,6 +763,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) lookup->info.debounce = agpio->debounce_timeout; lookup->info.gpioint = gpioint; lookup->info.wake_capable = acpi_gpio_irq_is_wake(&lookup->info.adev->dev, agpio); + lookup->info.shareable = agpio->shareable == ACPI_SHARED; /* * Polarity and triggering are only specified for GpioInt @@ -1004,11 +1008,11 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, } /** - * acpi_dev_gpio_irq_wake_get_by() - Find GpioInt and translate it to Linux IRQ number + * acpi_dev_get_gpio_irq_resource() - Find GpioInt and populate resource struct * @adev: pointer to a ACPI device to get IRQ from * @name: optional name of GpioInt resource * @index: index of GpioInt resource (starting from %0) - * @wake_capable: Set to true if the IRQ is wake capable + * @r: pointer to resource to populate with IRQ information. * * If the device has one or more GpioInt resources, this function can be * used to translate from the GPIO offset in the resource to the Linux IRQ @@ -1023,10 +1027,12 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode, * The GPIO is considered wake capable if the GpioInt resource specifies * SharedAndWake or ExclusiveAndWake. * - * Return: Linux IRQ number (> %0) on success, negative errno on failure. + * IRQ number will be available in the resource structure. + * + * Return: 0 on success, negative errno on failure. */ -int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, int index, - bool *wake_capable) +int acpi_dev_get_gpio_irq_resource(struct acpi_device *adev, const char *name, int index, + struct resource *r) { int idx, i; unsigned int irq_flags; @@ -1045,6 +1051,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in if (info.gpioint && idx++ == index) { unsigned long lflags = GPIO_LOOKUP_FLAGS_DEFAULT; enum gpiod_flags dflags = GPIOD_ASIS; + unsigned long res_flags; char label[32]; int irq; @@ -1084,16 +1091,19 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in } /* avoid suspend issues with GPIOs when systems are using S3 */ - if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) - *wake_capable = info.wake_capable; + if (info.wake_capable && !(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) + info.wake_capable = false; - return irq; + res_flags = acpi_dev_irq_flags(info.triggering, info.polarity, + info.shareable, info.wake_capable); + *r = DEFINE_RES_IRQ_NAMED_FLAGS(irq, NULL, res_flags); + return 0; } } return -ENOENT; } -EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_wake_get_by); +EXPORT_SYMBOL_GPL(acpi_dev_get_gpio_irq_resource); static acpi_status acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index d6037a3286690..8126a87baf3d4 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -203,6 +203,7 @@ int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable) { struct acpi_device *adev = ACPI_COMPANION(&client->dev); struct list_head resource_list; + struct resource irqres; struct i2c_acpi_irq_context irq_ctx = { .irq = -ENOENT, }; @@ -217,8 +218,13 @@ int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable) acpi_dev_free_resource_list(&resource_list); - if (irq_ctx.irq == -ENOENT) - irq_ctx.irq = acpi_dev_gpio_irq_wake_get(adev, 0, &irq_ctx.wake_capable); + if (irq_ctx.irq == -ENOENT) { + ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, &irqres); + if (ret) + return ret; + irq_ctx.irq = irqres.start; + irq_ctx.wake_capable = irqres.flags & IORESOURCE_IRQ_WAKECAPABLE; + } if (irq_ctx.irq < 0) return irq_ctx.irq; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index b7165e52b3c68..a0cd733febe34 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -9,7 +9,6 @@ #define _LINUX_ACPI_H #include -#include /* for struct resource */ #include #include #include @@ -17,6 +16,7 @@ #include #include +struct resource; struct irq_domain; struct irq_domain_ops; @@ -1232,8 +1232,8 @@ bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, struct acpi_resource_gpio **agpio); bool acpi_gpio_get_io_resource(struct acpi_resource *ares, struct acpi_resource_gpio **agpio); -int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, int index, - bool *wake_capable); +int acpi_dev_get_gpio_irq_resource(struct acpi_device *adev, const char *name, int index, + struct resource *r); #else static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, struct acpi_resource_gpio **agpio) @@ -1245,28 +1245,25 @@ static inline bool acpi_gpio_get_io_resource(struct acpi_resource *ares, { return false; } -static inline int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, - int index, bool *wake_capable) +static inline int acpi_dev_get_gpio_irq_resource(struct acpi_device *adev, const char *name, + int index, struct resource *r) { return -ENXIO; } #endif -static inline int acpi_dev_gpio_irq_wake_get(struct acpi_device *adev, int index, - bool *wake_capable) +static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index) { - return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, wake_capable); -} + struct resource r = {}; + int ret; -static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, - int index) -{ - return acpi_dev_gpio_irq_wake_get_by(adev, name, index, NULL); + ret = acpi_dev_get_gpio_irq_resource(adev, name, index, &r); + return ret ?: r.start; } static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) { - return acpi_dev_gpio_irq_wake_get_by(adev, NULL, index, NULL); + return acpi_dev_gpio_irq_get_by(adev, NULL, index); } /* Device properties */ From patchwork Tue Jan 2 21:07:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685217dyb; Tue, 2 Jan 2024 13:11:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDHRVmIrtEjEYRuUSfmwB87BEDEjO5WGhcIxrlbtCTlXg6Y1ozKwt6GupxOcasZ3Wwy2pJ X-Received: by 2002:a05:6358:7250:b0:172:d2ac:1e with SMTP id i16-20020a056358725000b00172d2ac001emr13944036rwa.5.1704229877328; Tue, 02 Jan 2024 13:11:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229877; cv=none; d=google.com; s=arc-20160816; b=CvnymfJOw1aaVedAdnUHDXOGMvHFUa7OkGBkHGBItl26V+EtKGngmQljeg7ch7r6IG Tid16JcUJ4QE8h9XRsmz5SZaUChF4gEa576O7nKl1DEFb7ga3eyngMRgK/OUfb5UUY5c Q6FDjh4sHJHLkeOw+ljZrnlHdJdauyqTlA5E4aX97Lf0mbBjn4p+W3UZ2p82rkLrLrye RcNfQQVeK8XXCndrClTsAzvXrgGoC5VZUnjU/DzHjRzjq5/3JCT3DdwhX02sKzPKdCk7 b8MArYC3Y3rsHYABNOyjpeGHAffq8PHIM9DeEyqY53JOHb2Eb72XiuTGzq94UWTcS0SR FgRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hoCMzkIH2SpwplBXEvrmILCCJUolIXwuArK291Rg4jU=; fh=0mjHwQzkNMTYbAMbhlnUC+ITaPTpJZEVZt302w9VlUg=; b=Lh9q7HWgR8149X/kcUM7+oY449nHD1096/AXQx2dOAwuznBTMlaRDt77Mx3e9Y6vD9 /GeTZZZpEHv8Oshh89TLpjbNub3q2yVbIH5MRQwciIvvAiSsZXS9dR0g22l6k5jmsUtd l59chwxNdxXhArO5W3ePkqqOixJNGnq7X+irS0afsVleexQEYVXd8pKFhRj29iarUtJK lr8OHPcMBnp2s+FW1JKXch62eg9J1kyGlDlBbTqhGn6TMv/VNrSPgK3ZUZSmYBymTxOz 17IdcFZBN5PMWJ/N29C7/7HRFmStYgkwBfakFj3GC+pmGx0PMUcSbocMWXK1fSN4cv0m V/bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YKh0zhED; spf=pass (google.com: domain of linux-kernel+bounces-14827-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14827-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b8-20020a63d808000000b005c660acad7asi20774403pgh.4.2024.01.02.13.11.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:11:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14827-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YKh0zhED; spf=pass (google.com: domain of linux-kernel+bounces-14827-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14827-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 86FEEB22AFC for ; Tue, 2 Jan 2024 21:10:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5873D17997; Tue, 2 Jan 2024 21:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="YKh0zhED" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01EB2168BD for ; Tue, 2 Jan 2024 21:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-7ba8f139522so493850539f.1 for ; Tue, 02 Jan 2024 13:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229726; x=1704834526; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hoCMzkIH2SpwplBXEvrmILCCJUolIXwuArK291Rg4jU=; b=YKh0zhEDmK54BHzoeo1B7L58bAiJbmnxlRLuDKlcG9MRRE9FrY0D6FPo5K7HnTp5ng lLAo7p5C7ZiDzRdyaMPC5jhfxvKXlrkcaeBZfKLFWXx6kcr+0/XelLpNJHEXjV3eiyjo slLK0pw0Je9fwJqgWh/23sJhKeXyso91DprWI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229726; x=1704834526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hoCMzkIH2SpwplBXEvrmILCCJUolIXwuArK291Rg4jU=; b=wbVWangZEsEgnmbIFYmvUD/WqUblJyjR2uvYWN2qnOPq6vJDsRmEuBIFzxTR+jsyQV 209ah6fjcTIi+Ti5L+lZEGBcutzCD/uUR2lzYDsYPLeKUd8yyczWoSTb+GiKGV6iBBnU 3X88VNb8FSVt1Go2p9XTEXz1VzsyWhrHAdX5aoNSFOX8MCYcFbVkxRPoUmGOGpQAQTjx wy9XbKD8TIqXzK3srQ0QGJUvgU5Kof7tpdpOWwfwC+9ftQEH57m+ttvkNQ9HsxYmQy4O dOG4lAWr+kJU46H6zrvKBKrtv2MPhNgHfoKkpILzjm0D3BSpfG4sMAhbYZxhSy2tXFzN BCqQ== X-Gm-Message-State: AOJu0YysbLxFlq74w93+xB9QnbuTWT0fHiQB1vkPOlrKLip527zsCHLa Nf9iOyqNvbEBAUEpoKDL/bjDUQsLsjZkZm63E9+C9ocRzNne X-Received: by 2002:a05:6602:683:b0:7bb:aa7e:6d1d with SMTP id dp3-20020a056602068300b007bbaa7e6d1dmr3857804iob.10.1704229726099; Tue, 02 Jan 2024 13:08:46 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:45 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Andy Shevchenko , Mika Westerberg , Wolfram Sang , linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org Subject: [PATCH v4 03/24] i2c: acpi: Modify i2c_acpi_get_irq() to use resource Date: Tue, 2 Jan 2024 14:07:27 -0700 Message-ID: <20240102140734.v4.3.Ib65096357993ff602e7dd0000dd59a36571c48d8@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014547933779686 X-GMAIL-MSGID: 1787014547933779686 The i2c_acpi_irq_context structure provides redundant information that can be provided with struct resource. Refactor i2c_acpi_get_irq() to use struct resource instead of struct i2c_acpi_irq_context. Suggested-by: Andy Shevchenko Signed-off-by: Mark Hasemeyer --- Changes in v4: -Use Andy's @linux.intel.com email -Remove blank line in commit message -More error handling refactoring in i2c_acpi_get_irq() -Remove struct i2c_acpi_irq_context as it's unused Changes in v3: -Add Suggested-by -Check resource flags for valid irq -Drop error pointer check -Invert error checking logic in i2c_acpi_get_irq() -Drop redundant 0 in struct resource init -Drop unnecessary check for irq > 0 when setting I2C_CLIENT_WAKE Changes in v2: -New patch drivers/i2c/i2c-core-acpi.c | 49 +++++++++++++------------------------ drivers/i2c/i2c-core-base.c | 6 ++--- drivers/i2c/i2c-core.h | 4 +-- 3 files changed, 22 insertions(+), 37 deletions(-) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 8126a87baf3d4..4c3df540c2f4b 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -137,11 +137,6 @@ static const struct acpi_device_id i2c_acpi_ignored_device_ids[] = { {} }; -struct i2c_acpi_irq_context { - int irq; - bool wake_capable; -}; - static int i2c_acpi_do_lookup(struct acpi_device *adev, struct i2c_acpi_lookup *lookup) { @@ -175,64 +170,54 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev, static int i2c_acpi_add_irq_resource(struct acpi_resource *ares, void *data) { - struct i2c_acpi_irq_context *irq_ctx = data; - struct resource r; + struct resource *r = data; - if (irq_ctx->irq > 0) + if (r->flags) return 1; - if (!acpi_dev_resource_interrupt(ares, 0, &r)) + if (!acpi_dev_resource_interrupt(ares, 0, r)) return 1; - irq_ctx->irq = i2c_dev_irq_from_resources(&r, 1); - irq_ctx->wake_capable = r.flags & IORESOURCE_IRQ_WAKECAPABLE; + i2c_dev_irq_from_resources(r, 1); return 1; /* No need to add resource to the list */ } /** - * i2c_acpi_get_irq - get device IRQ number from ACPI + * i2c_acpi_get_irq - get device IRQ number from ACPI and populate resource * @client: Pointer to the I2C client device - * @wake_capable: Set to true if the IRQ is wake capable + * @r: resource with populated IRQ information * * Find the IRQ number used by a specific client device. * * Return: The IRQ number or an error code. */ -int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable) +int i2c_acpi_get_irq(struct i2c_client *client, struct resource *r) { struct acpi_device *adev = ACPI_COMPANION(&client->dev); struct list_head resource_list; - struct resource irqres; - struct i2c_acpi_irq_context irq_ctx = { - .irq = -ENOENT, - }; int ret; + if (!r) + return -EINVAL; + INIT_LIST_HEAD(&resource_list); ret = acpi_dev_get_resources(adev, &resource_list, - i2c_acpi_add_irq_resource, &irq_ctx); + i2c_acpi_add_irq_resource, r); if (ret < 0) return ret; acpi_dev_free_resource_list(&resource_list); - if (irq_ctx.irq == -ENOENT) { - ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, &irqres); - if (ret) - return ret; - irq_ctx.irq = irqres.start; - irq_ctx.wake_capable = irqres.flags & IORESOURCE_IRQ_WAKECAPABLE; - } + if (r->flags) + return r->start; - if (irq_ctx.irq < 0) - return irq_ctx.irq; + ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, r); + if (ret) + return ret; - if (wake_capable) - *wake_capable = irq_ctx.wake_capable; - - return irq_ctx.irq; + return r->start; } static int i2c_acpi_get_info(struct acpi_device *adev, diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 3bd48d4b6318f..0339c298ba50b 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -513,10 +513,10 @@ static int i2c_device_probe(struct device *dev) if (irq == -EINVAL || irq == -ENODATA) irq = of_irq_get(dev->of_node, 0); } else if (ACPI_COMPANION(dev)) { - bool wake_capable; + struct resource r = {}; - irq = i2c_acpi_get_irq(client, &wake_capable); - if (irq > 0 && wake_capable) + irq = i2c_acpi_get_irq(client, &r); + if (r.flags & IORESOURCE_IRQ_WAKECAPABLE) client->flags |= I2C_CLIENT_WAKE; } if (irq == -EPROBE_DEFER) { diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h index 05b8b8dfa9bdd..b5dc559c49d11 100644 --- a/drivers/i2c/i2c-core.h +++ b/drivers/i2c/i2c-core.h @@ -61,11 +61,11 @@ static inline int __i2c_check_suspended(struct i2c_adapter *adap) #ifdef CONFIG_ACPI void i2c_acpi_register_devices(struct i2c_adapter *adap); -int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable); +int i2c_acpi_get_irq(struct i2c_client *client, struct resource *r); #else /* CONFIG_ACPI */ static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { } -static inline int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable) +static inline int i2c_acpi_get_irq(struct i2c_client *client, struct resource *r) { return 0; } From patchwork Tue Jan 2 21:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685282dyb; Tue, 2 Jan 2024 13:11:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzfrMvMxvVhHv295PrPhJ1zEem49qHrEkIo0WjNxJDkLgtpVLikFrb9UY2+2x81vcIGwlF X-Received: by 2002:a17:902:d509:b0:1d4:3e87:d446 with SMTP id b9-20020a170902d50900b001d43e87d446mr19740968plg.127.1704229884488; Tue, 02 Jan 2024 13:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229884; cv=none; d=google.com; s=arc-20160816; b=u4/I6fXxS9ZHmdlVqmjeBEeosrzQgmC5eTWuOT6uOKaczIEJkpXZNr2CSX4AOQPRZI P54YnDpbhGWSLGf8iIJRHP+CTZB8nY12wDoKNeccjCPYbijIxAhRU1GHTBtsr2B7UmCj cN3rY0zs23lBxBZ49icuICYXMd8pNj7wiFwD3tpZNBa0JMunOLO3SuKfexY52NE6PS4A rQ4C0wQAGBkKydVziYzMOUf1uBDyiakoTFTABAxJvD+H3h8aoopkMx2ALR2Tb7e5MxQA pKxVJJoFLVFKiwb0WvIBaw0RHDiyWjZhytSHIJKqX2m4eywrlsbBpZb4Xtsvtax0xioH L+/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=WvEk8+CF0e0obxZ9GfqxQDlPWDurZBaCRVB9kdh79UY=; fh=GAsViczNV0CLIbwrmzrqBDNfMJhrczWjUhReqvUI/FQ=; b=odgRkOhJ8OrRf+RnYJ2h32D2338QqXCE3P8EVfhCdbDeDWtpWVlUL9feMigjWIz7oM PNGYYmxJNZIRwJxJwKrLw5zSlTI5H8Eu2xu317pK+IDcqTzNrhoVPUunqf169kxVjhIw 4D3FyhiwifdjDxVe2wbeimMdbpDj1K21DrdI/IorqZCybdDS3JYWEQGk16fVFELdH56z 12wj7KmRemXi7Iw9GSbnPgnV8k/ufTeGilSFv70HjEUuOIwlTy/d70VQrEnAmRqim8PN pNKa5sz/XnUfRPuirTglJ9xn+xhj3ibTrrnbM6mS9S1t+Y5GYlxnJc0A2BI/AKe5ESng Zxew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="mxlR/JRm"; spf=pass (google.com: domain of linux-kernel+bounces-14828-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14828-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id w5-20020a170902e88500b001d408d60138si17128355plg.115.2024.01.02.13.11.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:11:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14828-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="mxlR/JRm"; spf=pass (google.com: domain of linux-kernel+bounces-14828-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14828-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EF4CCB20BE7 for ; Tue, 2 Jan 2024 21:10:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B608D179A8; Tue, 2 Jan 2024 21:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mxlR/JRm" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD699168CE for ; Tue, 2 Jan 2024 21:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-7ba8c218fe1so522823739f.3 for ; Tue, 02 Jan 2024 13:08:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229727; x=1704834527; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WvEk8+CF0e0obxZ9GfqxQDlPWDurZBaCRVB9kdh79UY=; b=mxlR/JRmwEzQ24gQbrDuASfLAvbvVtviILTojV9tH+legi9uf4b7ADzWQF5EqQddIX xT6pNgZodzRXQHKsKbDQwzJoHjqoQgx2e8tm8tSVI049sJzPbI2KiAidhangrsB5MK5I 4w9xwxX7r/qLSQrGz9oBndIzZwjj3vIDlt9Ls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229727; x=1704834527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WvEk8+CF0e0obxZ9GfqxQDlPWDurZBaCRVB9kdh79UY=; b=LRJfQIkwSrxdwEU6EwcDCOIapDE3q0xotBFrNGejOWRJwUwJYSdTtTT2MdgbXH9L16 BT0t7gRFMokCI22gOnYr7HORiseIt/MgAI/hm7oJ2nic9l6uzWYO0MgVEdpvsDcnOs/e B/jKcLd2oEGmZesz+/q/u4YWX5sfeBK/37GzWUr45OrQPCOhhmdl2CWnwC6TaZ8yXQKN ntby6M0cTIa//M5GNcRtfOrBIe5WYzhPAqP1j41Q5RWgvdSDvg/Cgcx2v5YImEspj8cz Wm650xQ8cox4fyzTRAp7O8xgW6tcl55Ch3IftVp0w7ReDBAGks0m+XGAcxujc8xQYnoQ aelQ== X-Gm-Message-State: AOJu0YzAHu7NBfQJgfmIBeRxWSdEQKF9vWbsMzJpljqLdsxY75u194G1 yXipm9+k/H4FNgM3IIOlzZHBnWl2sEkQ8QKTZ8zU7r3lC7wx X-Received: by 2002:a6b:500e:0:b0:7ba:af56:55b4 with SMTP id e14-20020a6b500e000000b007baaf5655b4mr12329868iob.3.1704229726966; Tue, 02 Jan 2024 13:08:46 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:46 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Conor Dooley , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v4 04/24] dt-bindings: power: Clarify wording for wakeup-source property Date: Tue, 2 Jan 2024 14:07:28 -0700 Message-ID: <20240102140734.v4.4.I1016a45ac9e8daf8a9ebc9854ab90ec3542e7c30@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014555757722464 X-GMAIL-MSGID: 1787014555757722464 The wording in the current documentation is a little strong. The intention was not to fix any particular interrupt as wakeup capable but leave those details to the device. It wasn't intended to enforce any rules as what can be or can't be a wakeup interrupt. Soften the wording to not mandate that the 'wakeup-source' property be used, and clarify what it means when an interrupt is marked (or not marked) for wakeup. Link: https://lore.kernel.org/all/ZYAjxxHcCOgDVMTQ@bogus/ Link: https://lore.kernel.org/all/CAL_Jsq+MYwOG40X26cYmO9EkZ9xqWrXDi03MaRfxnV-+VGkXWQ@mail.gmail.com/ Signed-off-by: Mark Hasemeyer --- (no changes since v3) Changes in v3: -Update commit title prefixes Changes in v2: -New patch .../bindings/power/wakeup-source.txt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/power/wakeup-source.txt b/Documentation/devicetree/bindings/power/wakeup-source.txt index 697333a56d5e2..75bc20b95688f 100644 --- a/Documentation/devicetree/bindings/power/wakeup-source.txt +++ b/Documentation/devicetree/bindings/power/wakeup-source.txt @@ -3,16 +3,20 @@ Specifying wakeup capability for devices Any device nodes ---------------- -Nodes that describe devices which has wakeup capability must contain an +Nodes that describe devices which have wakeup capability may contain a "wakeup-source" boolean property. -Also, if device is marked as a wakeup source, then all the primary -interrupt(s) can be used as wakeup interrupt(s). +If the device is marked as a wakeup-source, interrupt wake capability depends +on the device specific "interrupt-names" property. If no interrupts are labeled +as wake capable, then it is up to the device to determine which interrupts can +wake the system. -However if the devices have dedicated interrupt as the wakeup source -then they need to specify/identify the same using device specific -interrupt name. In such cases only that interrupt can be used as wakeup -interrupt. +However if a device has a dedicated interrupt as the wakeup source, then it +needs to specify/identify it using a device specific interrupt name. In such +cases only that interrupt can be used as a wakeup interrupt. + +While various legacy interrupt names exist, new devices should use "wakeup" as +the canonical interrupt name. List of legacy properties and respective binding document --------------------------------------------------------- From patchwork Tue Jan 2 21:07:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685039dyb; Tue, 2 Jan 2024 13:10:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFa+6DwL9Xfqus00UZy+wjfs+vzZw+8blouJuOJ/8VWru1KViBZc5wrxDh9c+diviVIzKmr X-Received: by 2002:a17:902:e88b:b0:1d4:40f3:7ab9 with SMTP id w11-20020a170902e88b00b001d440f37ab9mr76776plg.40.1704229857712; Tue, 02 Jan 2024 13:10:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229857; cv=none; d=google.com; s=arc-20160816; b=EyXwhHtZHH0blD3rJU1WRhTedmz+1wmrBfvd4WwqbhiEhKnqqdJ3jmPWRkg3mypdKI PB7yh1G1EvqEy1vsG1gG4RBgqPasZFDf5Utsjx1SemG4udkUaZsFBmHvufi0Ag5ERbkh 67CHAaqYVeEthcB/lOUJzJOuEbTqHip5iu78vLvKgO1IGsZ6szLRQGbRujZm0zSQrcD/ RKrrw/HNoVb2KBAYKaqGzV4h6LkaJMcBddxQsL1N2d0UpXgLEp8c7LNMVqQyLfxYMMDc 99oZQkOalDgYRGtXRPouynJLOL80AcNvd/yltdAWqpVAJ2jQ0fFUGfcwVwOiHqTVrElB g6zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZjO95JnMkaDwwshxg++NkSMHj1Inq11nKJ2Uva51g+s=; fh=LVtsc25IE6q50pmooCNXgsUBzrr0HFF18UNosnJde/A=; b=BL1Ssnjmhm3MOOfKJEZPvUX2KyF7/0CJ6Der5pYALW/gXp6ud6NJJV97/eTT1N+qE+ iJ7RSvsHozSWg2Qig+GYYojt8LV/VtyCKMgmAf9Pq9JACt2wdBwZ6O7g92HyTQe6YPy0 0/2dvWc6eYmHGcJxG4OeqHpTd9484wD8rtmBuyE0BUVJzoAHz05rsb7pjXNJCjIOG2fL b4Q32ytEth3wOHNG0/1IrwA8E6r13cQRBqc6aXOe3Md40gY9WPUlO6svTqlMADO5KzQu BBo0X8tcodODCGj2b6LIiLtKhx+rVRDNnR8wunpIZqumk5iZOmzwgnUxrZjkg5pigmu9 bYSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TzvupCHx; spf=pass (google.com: domain of linux-kernel+bounces-14829-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14829-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id im22-20020a170902bb1600b001d2f6d7f080si20312630plb.12.2024.01.02.13.10.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:10:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14829-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TzvupCHx; spf=pass (google.com: domain of linux-kernel+bounces-14829-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14829-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7D6822844F4 for ; Tue, 2 Jan 2024 21:10:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9D9E18039; Tue, 2 Jan 2024 21:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TzvupCHx" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0AE7171BA for ; Tue, 2 Jan 2024 21:08:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-35fe47edd2eso20695415ab.0 for ; Tue, 02 Jan 2024 13:08:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229728; x=1704834528; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZjO95JnMkaDwwshxg++NkSMHj1Inq11nKJ2Uva51g+s=; b=TzvupCHxAkkrsakCQUzqs0yVAGMgiH7X+OVX1f6xgCQZhuzy8vI+jmgglIB58+S9A8 KKgaCT7i8KW2AG098C8PjBrgHatDj9qcDiI1C38wY/xg2Wc+6TKcqQT0FrkM6Obe5veF Is2QuhFPtC644eyxFHEh5OClumx/XWyBD638k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229728; x=1704834528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZjO95JnMkaDwwshxg++NkSMHj1Inq11nKJ2Uva51g+s=; b=iIS1BmbUOy4Idy6bQPBIQZgl9VlZH4rheqKma8oBC8L9SxeEYy6PbhEsRtlWZ+xvAl VZcEfpW31z/+tUXkDZxOFTArTfyH+zUttilYzwM+rUx1mLOPid9L+RXSRjzSAbiEMog/ 23oPpNMbZvOwCnbwYnMsA+YRyZDr+cYxKetrHfNWzo/Y5NXdYbxfyitLpIikjLRNJCDI AAk+KCJAh85ATviUZCB62XoLhdUfJXXnd4K8Ij3bVVxMmWmXH+j1VkO++ti70Y0Bg6F5 +i9WOWpC17zmFiIukZ15Udyt5OB3MXI91GQ7/zkHpYCwOvmURkKDyVHFC70ceFtBZPXZ 4eHQ== X-Gm-Message-State: AOJu0Yzu63+46MEVkTAm1wf15HMDCKze3lOuLtyjCOM+qv2S0FrCAUm8 qtWyDjx+1A0ujUtS6uAC9wt7HkGipezI+n6kne5aJ/0pmGfh X-Received: by 2002:a05:6e02:20ea:b0:360:142:3fec with SMTP id q10-20020a056e0220ea00b0036001423fecmr44297ilv.6.1704229727943; Tue, 02 Jan 2024 13:08:47 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:47 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Alexandre TORGUE , Andre Przywara , Conor Dooley , Jonathan Hunter , Krzysztof Kozlowski , Nick Hawkins , Paul Barker , Rob Herring , Romain Perier , Thierry Reding , Wei Xu , devicetree@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v4 05/24] ARM: dts: tegra: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:29 -0700 Message-ID: <20240102140734.v4.5.Ia598792a1386cca61844068be03c3ccec9e81753@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014527198335958 X-GMAIL-MSGID: 1787014527198335958 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm/boot/dts/nvidia/tegra124-nyan.dtsi | 1 + arch/arm/boot/dts/nvidia/tegra124-venice2.dts | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/nvidia/tegra124-nyan.dtsi b/arch/arm/boot/dts/nvidia/tegra124-nyan.dtsi index a2ee371802004..8125c1b3e8d79 100644 --- a/arch/arm/boot/dts/nvidia/tegra124-nyan.dtsi +++ b/arch/arm/boot/dts/nvidia/tegra124-nyan.dtsi @@ -338,6 +338,7 @@ cros_ec: cros-ec@0 { interrupt-parent = <&gpio>; interrupts = ; reg = <0>; + wakeup-source; google,cros-ec-spi-msg-delay = <2000>; diff --git a/arch/arm/boot/dts/nvidia/tegra124-venice2.dts b/arch/arm/boot/dts/nvidia/tegra124-venice2.dts index 3924ee385dee0..df98dc2a67b85 100644 --- a/arch/arm/boot/dts/nvidia/tegra124-venice2.dts +++ b/arch/arm/boot/dts/nvidia/tegra124-venice2.dts @@ -857,6 +857,7 @@ cros_ec: cros-ec@0 { interrupt-parent = <&gpio>; interrupts = ; reg = <0>; + wakeup-source; google,cros-ec-spi-msg-delay = <2000>; From patchwork Tue Jan 2 21:07:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685170dyb; Tue, 2 Jan 2024 13:11:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFYSJ9O230eoBa+eZlXQt+Nfo85Zz1Eel9/Ey+y9bTatY7vZhm2+wJhn3eg1t1H2KZvsoy X-Received: by 2002:a17:907:745:b0:a27:6c49:1fa6 with SMTP id xc5-20020a170907074500b00a276c491fa6mr5305969ejb.41.1704229871408; Tue, 02 Jan 2024 13:11:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229871; cv=none; d=google.com; s=arc-20160816; b=s3IXrF2CIq78i+2ilS7egk1iMhr4Y36F3MOBd8TO+O/PsCSacpZiCRMNcWkMtgGQ5Y CDct1rfn3rvGyDyIi2R5J2FGj0fd3CVrvGetdHKbywATmYzfKRK2jRHDxrUhujy3dNAP ICgWUuqnSAFGgka9dRWO+wtyoajgfVn95J4mffsFNvqXvFtGzjLaK9TU/ZcskSwgrYyl fjtP7mhL7XErN1/0d4E0I2sQmPnLjVjbf7eGb4ylITSH7W677CnJBm8zQTz2uU9urErv ucyjAt7uvS0uKRRXdb/sASNB8iZXtAvQbShRjK9EECRPOmy7mbTp2Yw29EJUdVm4p46j hXKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Y5uC/dqzQmYcBPDfBK6LehJHA1Nu9NUaC8OommBsuso=; fh=TUZa3FygMEW1+y6ZGtVIyO5RCjg2I7CyzZHAcFdV/rA=; b=PiMTOoUdiMHx3upIL/To5NFAunpetCJDWXejlSHA4cT3Iavfr+Lj2Ge6dB0klNxinh yb0TmNE1yJYz1CiXXiPORRpSzaRKiky0opM3ULd5pCvpq2gZcMNsnmeiLF4puX1GOOg7 zdBD7rabm8nn9qRIYZl8wIM37/XKhF+pntxBU4LnBtA2ibpWordcEUaZc98bBkkCROhr HZzDeA/Hu6dLzdNr3N56mL2R0SyUs0u00LPUtyhB/UQ+ztEBhhTuOdPls1K87yP0bAIO XG5OTvDyxfMEr22zn/lbGzYbcjsVm0ku9q3NIknDVFBX6iKUvZXIU/kxNVKGbCr0RTQp f46A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fXTEKLe7; spf=pass (google.com: domain of linux-kernel+bounces-14830-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14830-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id le19-20020a170906ae1300b00a27aed39fcesi3164725ejb.575.2024.01.02.13.11.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:11:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14830-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fXTEKLe7; spf=pass (google.com: domain of linux-kernel+bounces-14830-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14830-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 052AC1F22213 for ; Tue, 2 Jan 2024 21:11:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3D5C1805C; Tue, 2 Jan 2024 21:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="fXTEKLe7" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E12317726 for ; Tue, 2 Jan 2024 21:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-7baa8da5692so421989739f.0 for ; Tue, 02 Jan 2024 13:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229728; x=1704834528; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y5uC/dqzQmYcBPDfBK6LehJHA1Nu9NUaC8OommBsuso=; b=fXTEKLe7q71mJsF+Dq10I3kngM4DFvGhqoxx//hTAim9J3VvhgQd4W/CiK4EUo7+Af uK8PO27JvkAxve0otUSqSKXT1YNZKQzNw8P788roY0qn05/S1OcWuW6AAHJPIVeiIUHb N4T8zQhbcNYrU/mfKq2Kf4JTp1/S8JwdyzYLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229728; x=1704834528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y5uC/dqzQmYcBPDfBK6LehJHA1Nu9NUaC8OommBsuso=; b=kDhqxO2D6CfAc+/5cT+8kZTFb/5qc/eKZNy7Ns35l8uOEtzVmeenmNh+mEFT+8bAGc Qwj+bMv4MJhu19sd9Cfepnv4H0g48wE7MCOvuT9z1PAkTUek9zf97F/1oVo0rI197P5f HqSAqq4P1KaTMNrstzMnapLikurlENFphCEy5QXuY8bC2ZcJF9Iqy+tOIw+Ws7pSx9bG U6hugddZ+VReMGuWcx+6UFiHhbrHNeiaQNv71uET6pdV3bkPR4s/R8a8JEB+Ce+bLaze cPZkjK/2ub9RfmGtWqIEXlDOmGda5BBDnJw7pL5LWj12XD4MsMVcsElu4ub9qcAv0b2f 1SvQ== X-Gm-Message-State: AOJu0Yw6X0Bmh/jtf88798lIAdQARK4bRrcB493cToUjogbnuVIO8i9G TvpwF7z6hlnOBthmx6orhC9YzqVSWIY409bjFw8PIrxpGJLz X-Received: by 2002:a5d:8d84:0:b0:7bb:40db:9a47 with SMTP id b4-20020a5d8d84000000b007bb40db9a47mr8538555ioj.34.1704229728788; Tue, 02 Jan 2024 13:08:48 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:48 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Conor Dooley , Heiko Stuebner , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH v4 06/24] ARM: dts: rockchip: rk3288: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:30 -0700 Message-ID: <20240102140734.v4.6.I8249df4df0b7d12fb68ea1e69f84ca589c574bb1@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014541626674941 X-GMAIL-MSGID: 1787014541626674941 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm/boot/dts/rockchip/rk3288-veyron-chromebook.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/rockchip/rk3288-veyron-chromebook.dtsi b/arch/arm/boot/dts/rockchip/rk3288-veyron-chromebook.dtsi index 092316be67f74..1554fe36e60fe 100644 --- a/arch/arm/boot/dts/rockchip/rk3288-veyron-chromebook.dtsi +++ b/arch/arm/boot/dts/rockchip/rk3288-veyron-chromebook.dtsi @@ -112,6 +112,7 @@ cros_ec: ec@0 { pinctrl-names = "default"; pinctrl-0 = <&ec_int>; spi-max-frequency = <3000000>; + wakeup-source; i2c_tunnel: i2c-tunnel { compatible = "google,cros-ec-i2c-tunnel"; From patchwork Tue Jan 2 21:07:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685284dyb; Tue, 2 Jan 2024 13:11:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1DmP1yuJJHoQhIJ7nGBQCjoFYr5XfH/e+2Qc92G0xkrrNiG9F3zey8/IhVvBqj5KjWKek X-Received: by 2002:ac8:7d92:0:b0:428:1f19:5a4b with SMTP id c18-20020ac87d92000000b004281f195a4bmr4591438qtd.15.1704229884683; Tue, 02 Jan 2024 13:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229884; cv=none; d=google.com; s=arc-20160816; b=nnjiMCXVsnic3BGFn0xZLG9D5+ctfvcdXGByJzQHzYB8ZXjfM/Goe9HkEaPQA23GiK SupxOclERzrLiBy7DvU5vyYrOutG4yY/sw2o2SZuf1QLOy2M8XmkqaPFGjcRQtCKD0Db oLKc4QOmZGVziBXKMPHpWtQhLjRAGHamDZv23ObVuYopPjvqAOZOSb3JtgVGOIzGmsMq Z/4Y8lA0oqVPA+FIBUwp9Yd7otGNpWZ3YrUtoqraPUCtWMV07ADPPp8eYBGlgLgm96+N vmpDH8ARSKckxhcsReFDSZI/Oe4Sh+zlsFPWb+SzcV6RP+JEMebbJceQxSTUg5OaDTbg 5dXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=kFylEVwz6/jxQq1ZweDsmHVwptzQPuyXfUnhxAJ710k=; fh=8uK+O3dmXFXwuw+YdqmYBWrpgbsbP+F5u0lzNXYrRuM=; b=JS7ovDmCYhstD8K4Tnv7pgPrTSUE69/0Y5k/SXr60muKsYFJjMeGd1+eqlck2uK3Nz Q4m7CJvWxM8gBUSs82fJ1vLHblfXgcVG8Z7DXtEfFEERZNyRK4HsPBNEiubR5SvbcySY GEEhAvy54nEAmIlq1dSphIr0kp3EAgjeEhJ3aFmXHMi/ZWq6bc2RZ3w1aCDECPeymrtp XBJu7uQ8N/j0k5sVkt323ImKeC7BFwP0Jvj3rtmAJLggtHn1LGc4fmQ0s0Bi28ipu6cz nPeN3v9W6pAe00aWhU3Q1e1N7T09HDEBWtTuQHlHzrOhELJ9BjmYkaqtql+d0SeZoP1G Xc3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=grYAbEpE; spf=pass (google.com: domain of linux-kernel+bounces-14831-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14831-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q18-20020a05622a04d200b00425ef4a05d2si26897517qtx.7.2024.01.02.13.11.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:11:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14831-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=grYAbEpE; spf=pass (google.com: domain of linux-kernel+bounces-14831-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14831-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7A5D41C217FB for ; Tue, 2 Jan 2024 21:11:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 76834182BE; Tue, 2 Jan 2024 21:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="grYAbEpE" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 836991774F for ; Tue, 2 Jan 2024 21:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-7b7f9fdc14dso535431039f.0 for ; Tue, 02 Jan 2024 13:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229729; x=1704834529; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kFylEVwz6/jxQq1ZweDsmHVwptzQPuyXfUnhxAJ710k=; b=grYAbEpEGE+CY/lcVPOfo1nBGvsxD8gVu/PNJDxGLdxkl9JO2ttuV88LTUkBL6Nvu+ NDF4w4L2ULGkrLijFRY+PJ9FqOQwcOwgH7o1SnrTzXrh2gfX/nI8eyCeHlWwXbJ2WXe1 yzIBQweyAEsgllUrhRDkcgnbHpf4Er2TQLN0g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229729; x=1704834529; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kFylEVwz6/jxQq1ZweDsmHVwptzQPuyXfUnhxAJ710k=; b=GjqF5BupH6gBTnDJuTTlOIcdUOAUYGDRiwaEhakST/FX+oPvQTXcwhFFrNhKqzanfU 5PNjWJEIDGmlJfxyxZ3xwUVuhHf0zHqqqQ+M8NTFj8HJq0NVThJa9VSZM/akUIW1nOm0 7WP56ZbWF/RKJRl6gawVPLJTuPOCRLQcFJ6LOzq0/+LTIalGipBmHQDICMPUUU8j5YO0 zKPBGMaJhlHkiJ0i/CQPMCkAqeaCvxtDwKMruUTCjXAe6NyFh3qZ8fTOG0hvlqOZtsDe 6dCBj24KjjksdhRa3ebU+7Q+OCVr4ndqrVd+WAqCxyzBR5nFKxT1n5WWiORrqlwXafxF QRZw== X-Gm-Message-State: AOJu0YwfKOw5Rhp22qdzxBwdFaJQ8VF4RhfIuCezx2f5lQQEU5vOdOYn SQFhVxWdbs5toqnMsUH67LvWmxicJTjiWWYSAoW2EONZrNal X-Received: by 2002:a6b:c342:0:b0:7bb:cc1:a3b3 with SMTP id t63-20020a6bc342000000b007bb0cc1a3b3mr7901421iof.21.1704229729647; Tue, 02 Jan 2024 13:08:49 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:49 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Alim Akhtar , Conor Dooley , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v4 07/24] ARM: dts: samsung: exynos5420: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:31 -0700 Message-ID: <20240102140734.v4.7.I06b059021de1bf6103e60a73211f078f2af75d17@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014555446028406 X-GMAIL-MSGID: 1787014555446028406 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm/boot/dts/samsung/exynos5420-peach-pit.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/samsung/exynos5420-peach-pit.dts b/arch/arm/boot/dts/samsung/exynos5420-peach-pit.dts index 4e757b6e28e1c..3759742d38cac 100644 --- a/arch/arm/boot/dts/samsung/exynos5420-peach-pit.dts +++ b/arch/arm/boot/dts/samsung/exynos5420-peach-pit.dts @@ -967,6 +967,7 @@ cros_ec: cros-ec@0 { reg = <0>; spi-max-frequency = <3125000>; google,has-vbc-nvram; + wakeup-source; controller-data { samsung,spi-feedback-delay = <1>; From patchwork Tue Jan 2 21:07:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685436dyb; Tue, 2 Jan 2024 13:11:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtik3WaUuW2L+jVKHk1KcRp69pqfowW8wnxSBFOGAvGX9ciHWcUdSW5UO5FWtbzKxZ/Bw7 X-Received: by 2002:a37:ac0b:0:b0:781:8b48:f2b3 with SMTP id e11-20020a37ac0b000000b007818b48f2b3mr7622192qkm.101.1704229907799; Tue, 02 Jan 2024 13:11:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229907; cv=none; d=google.com; s=arc-20160816; b=oNrehkksQOTcmTj8zGiefnVmByojRDxDfs7CIHpY6EjP9OzuNKfKHJu5YIvlVpmmU9 kdKUfINUlcURCqcfEjtb9RfX61+MRmwedfegvinoSqG87TMTlL//sH77xRb/oFTnUddZ I0kUr5GY1vV32sKxUnclqNTj2yF0RRwmLjrTrvvjI67/0OfMrA7OzFAAu5EpN90pRbhy NlHo5RlUG0G7xInQ0jpQcXj4S6i6+5z6M+p44wyXBz69ZJ8PLmQK6eNS0D/o1wGtyUJp A4/kcDwV9qx5HPrasnPTEJ348w7ldyq208O22os/90PUqBvODXvnQklsQc0jlZLLLmch yT2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Iih8S9CbSKYXK6Eu1V5z5fk9f7rCImQ6DnJQzgwRsXQ=; fh=8uK+O3dmXFXwuw+YdqmYBWrpgbsbP+F5u0lzNXYrRuM=; b=ybBONFBy2XLJMAWSlRRcHk15fymA3kxzcplONcyrjRoOhRCxivIuF/BDiGd930Vgq/ dgtJ/Q2tp9UlIcf11SvoFefJK0L9hL6u/jXRGw4oe27f1d6uq6GQQufV+Vnd4+lB2Dew Q/SKx/8vvCkc08wDAGTxb5oSPqCA7haRcTojQfHgJTfkchFsVVyODpJEjDYsmdQ/KyZ2 vm2aUE478TFeYql+LklnFXatVAIoo82NA565QMioy3+MN6jWc8ImqLWcN3oR4E2oGM0E TlW4KGNSAXHMTx+YenrVOQZzr66UI7cO8yyQvYbA+FKVJYjBDumX1tNabbtjozCkG5k5 6aAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NxKC8Bg1; spf=pass (google.com: domain of linux-kernel+bounces-14832-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14832-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s18-20020a05620a255200b007817232fbf1si12532252qko.161.2024.01.02.13.11.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:11:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14832-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NxKC8Bg1; spf=pass (google.com: domain of linux-kernel+bounces-14832-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14832-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9607E1C229AB for ; Tue, 2 Jan 2024 21:11:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A234518640; Tue, 2 Jan 2024 21:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NxKC8Bg1" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 926811799E for ; Tue, 2 Jan 2024 21:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-7ba7c845e1aso589483239f.2 for ; Tue, 02 Jan 2024 13:08:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229730; x=1704834530; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Iih8S9CbSKYXK6Eu1V5z5fk9f7rCImQ6DnJQzgwRsXQ=; b=NxKC8Bg1E9loB28npLQy86G1Uk0jberzz0pipqr7NQKvJ55wAfFyIo/RUlTOuhxG8u jQOtXZm8zekL6yMFVXzNdqAqdEDBIxF65VbIf9DGIXLYs5Dz0n1Qr4cPnF3jb3NqdZ55 Sb4E+K1G9ILQM6kDWcB0LKl5Ru1vymvI/M29o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229730; x=1704834530; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iih8S9CbSKYXK6Eu1V5z5fk9f7rCImQ6DnJQzgwRsXQ=; b=TQsTheEMRdgQA1yoHkLsDD91tr/ac9ieESB8vEd2zhjINGvzw8CnrOsd/Oshplcw6T 7MbtJuEXLbGTCJbvAVUwFOw033x8MMawZpRRy8JjbYdFQp1T5i5Zw0LaaYnGInPWLiUF JBTjmpHRIlqLj85RZfFzu2Yj7uKl4G3ZptVUfqB9mJ99JoTnP3223L7M7yV6TBGRwFe2 ujS7aHeWeCLY68DXV/X+ladL6RHuQXYmDss5UZGsaaxN6GsDgDtFACsuNhrtv1BiEK12 MTrkFAdfHRxEy/AqOu+mUMrwVCXM+h5dl2zBVo6urzEk6qetXHRHQLxx4DsfDpFN1ojQ DDdA== X-Gm-Message-State: AOJu0YyHjN36aGh0QztxAu+eKtfEGpye17jDLzMJdeMV5I5PyDHXUtzx xwyf1j3nbuKrc5tNCXhcEby4080Ey1UbdNgbnAQhkDQr8M4J X-Received: by 2002:a5e:a50b:0:b0:7b7:55fc:7d4 with SMTP id 11-20020a5ea50b000000b007b755fc07d4mr24457360iog.18.1704229730619; Tue, 02 Jan 2024 13:08:50 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:50 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Alim Akhtar , Conor Dooley , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v4 08/24] ARM: dts: samsung: exynos5800: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:32 -0700 Message-ID: <20240102140734.v4.8.Idc995ce08a52ba4c5fde0685118ddf2873fc8acd@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014579493601882 X-GMAIL-MSGID: 1787014579493601882 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm/boot/dts/samsung/exynos5800-peach-pi.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/samsung/exynos5800-peach-pi.dts b/arch/arm/boot/dts/samsung/exynos5800-peach-pi.dts index f91bc4ae008e4..9bbbdce9103a6 100644 --- a/arch/arm/boot/dts/samsung/exynos5800-peach-pi.dts +++ b/arch/arm/boot/dts/samsung/exynos5800-peach-pi.dts @@ -949,6 +949,7 @@ cros_ec: cros-ec@0 { reg = <0>; spi-max-frequency = <3125000>; google,has-vbc-nvram; + wakeup-source; controller-data { samsung,spi-feedback-delay = <1>; From patchwork Tue Jan 2 21:07:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685903dyb; Tue, 2 Jan 2024 13:12:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGbnezp8YxVZLAAB9Y75Knvl2Z2fLLxBPXbFwXNBeGis0LxO8R2KQQwapet9qf8yDdjkOo X-Received: by 2002:a17:90a:b38f:b0:280:cd7b:1fa5 with SMTP id e15-20020a17090ab38f00b00280cd7b1fa5mr6065648pjr.4.1704229972519; Tue, 02 Jan 2024 13:12:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229972; cv=none; d=google.com; s=arc-20160816; b=BsyxnVtQe6gg20n5QmqQwvC+PqeUWGMOlQ6givKd1oPRFK12bh5VTGdfF/rJ8eawqI TxdEVnJJlD53vV1xVYXmUxXdudx6tY/mz7Zll7N86Y9JBiGmR/cMyDq3/ZYThtlZOCzI zDyi/EFFTNY9a7tlqpEl24iJBsVzVY8rs/Ax84wYGb0TKFmCjKTC+AmF6sxHzx+orBHQ I7KnGDrygG1D2v4L/T4zwm4uv5J26mg03Fg2szZe+AMQ0UNyYJOwnfOyHBit/LTL8WcS AjMaBRsWFgQhCyEJxw2248jZB3zbNGdF4UDR9o5isFFCx/FKffgZnciz8iRk2oNvydf1 DuUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LeATnxPiO37XaEtB4eQZXrEcgW0prfgDBCAc6VotlMc=; fh=1lZWIWcOZVFTUi4X75WIpUZJOALL5V9UacQsFr0aq2w=; b=aJ7M7TJwSK0PLnXOTkdWIz8Zn4sGlhQ04yGMLUMjqKc2JpgenJN2GeC4deShf7KoWx 4AnsIxDRBtYiwfAupNvBG9QidktnDqDjjKRzn3FD1Prm6OOh2EkeOs4m73GezNQsVmKL as5m7JEac9e2RZzBZ4fiSahrQ+1nDeCHNadM650F08miZ5p0XsjwtJgEug0t2TcSOhOA q5ViLlFmZZnAOqafQ6VjE3SA5bViCLraEt69oFlQdxqFLEiDebsT9D61W0PCHgrkb8Uq rHBs3GT8FBoenMXbIiRzZJky4G6dOz3P0HlI//+Q6IC7nw98BIm4TuFhTFdPFoVYEP6T OBAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PyeXmrBb; spf=pass (google.com: domain of linux-kernel+bounces-14833-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14833-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a14-20020a17090a740e00b0028672a7b3casi78759pjg.29.2024.01.02.13.12.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:12:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14833-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PyeXmrBb; spf=pass (google.com: domain of linux-kernel+bounces-14833-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14833-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7CD63B224DB for ; Tue, 2 Jan 2024 21:11:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4517418AE4; Tue, 2 Jan 2024 21:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PyeXmrBb" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F5F918023 for ; Tue, 2 Jan 2024 21:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-7bb97d5ee3aso99555739f.2 for ; Tue, 02 Jan 2024 13:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229731; x=1704834531; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LeATnxPiO37XaEtB4eQZXrEcgW0prfgDBCAc6VotlMc=; b=PyeXmrBbvHD0JEpLy/toV24mUPQXkcKEsrP2CPsbMBEuvug9xWLv23V0nsM8kdoo+w WiNM0e8Bz8Vhbweqg+l3plE1Jsa2Bm2ria9NHeYlnAevYO58QE8mLuVCm0bs77KA8ZOq W+IkdzfVuDsf48UFKrOG1IaC5HM+92ztPIzww= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229731; x=1704834531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LeATnxPiO37XaEtB4eQZXrEcgW0prfgDBCAc6VotlMc=; b=mplvHwXNZuKG2lbWlcpskO3OLAatvlJ216qtmpV4w8labGd6akny+pL2lrjsfCz7gE 3rl4EWB+IHOM8/mzaCjZjlit2DD1DmuikDpSyp3N688yrYl53F3TjV13W+ZJLnq/C1gs AUMg1zLqeWeGLKsjog/vx1IDON+qWRuJEMad82yo1Xsr8mi+wK361tkvS1Ecye/izvgW t5ILpJOsgIEjdcLvTyTjzpzIXfm65TIsLKQzj7EHM0n6C6ac3kGKd5peBvapYpA/l3tF 2lzkQdGOnQpoy6lMk/+a0ACTfVJvn0dQ6PSbpxjvQiD4xGM1YNMjZat7TNgxVHMsqmn3 3gkQ== X-Gm-Message-State: AOJu0YznOc5wKeRyZaZbgzxLOVpEqpskrdJqxxprUle/KRmGjvMS2vog 0EytO5erh50nlAkOa3KEqqLAw945euj4FBoJa3JT4MEZD728 X-Received: by 2002:a6b:f008:0:b0:7b7:4c36:f295 with SMTP id w8-20020a6bf008000000b007b74c36f295mr20729710ioc.40.1704229731497; Tue, 02 Jan 2024 13:08:51 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:51 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Conor Dooley , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 09/24] arm64: dts: mediatek: mt8173: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:33 -0700 Message-ID: <20240102140734.v4.9.Ic09ebe116c18e83cc1161f4bb073fea8043f03f3@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014648082053245 X-GMAIL-MSGID: 1787014648082053245 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer Reviewed-by: AngeloGioacchino Del Regno --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi b/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi index 8d614ac2c58ed..335aed42dc9e3 100644 --- a/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi @@ -1155,6 +1155,7 @@ cros_ec: ec@0 { spi-max-frequency = <12000000>; interrupts-extended = <&pio 0 IRQ_TYPE_LEVEL_LOW>; google,cros-ec-spi-msg-delay = <500>; + wakeup-source; i2c_tunnel: i2c-tunnel0 { compatible = "google,cros-ec-i2c-tunnel"; From patchwork Tue Jan 2 21:07:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685583dyb; Tue, 2 Jan 2024 13:12:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeL9U3W+u2Ux23Hh33fNqevxiqMBGhXCm2sMwDWaWyUMghnbp+MSy5s0y8f4KTiEQeRcbL X-Received: by 2002:ae9:ea0b:0:b0:781:72ff:7d6c with SMTP id f11-20020ae9ea0b000000b0078172ff7d6cmr10866939qkg.82.1704229928507; Tue, 02 Jan 2024 13:12:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229928; cv=none; d=google.com; s=arc-20160816; b=YfEoBHGT7INw1E0/cT9KJLFOF9vnYzwMo9HrYTso1ruHQQJS21dqVCywyyQ/tNDufe tifbgGCtbHsWJzEsolMtPxa/3o4FpaXYNdblFIIZwQWkuLU3bJTdEvVh9HfgyI5CsBe+ 215OVYX1dBgPkfJcAX7dfqkVAt7hz69Pwtg8N/69l9vjdJMmkaE43u/g6A6wUC0QWteU 9Tf+EUw+d5y1FFhnXP1kAW5ykU6bkbAwMh2rujFTJFNth9vVrB/Rw0wjM8ZBNOI4XF2F /xXP721cqT9R/c92SZrpIr2LZwxe2+XIi3s5lweCZksu/3Kkm6fYvqXKjvevcykyX3U0 0ZjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5bEDuGxV/dPJIqZg1w0wl3qVgLyOuLBrt1YTH4lJcK4=; fh=1lZWIWcOZVFTUi4X75WIpUZJOALL5V9UacQsFr0aq2w=; b=EJF47KwiFdROiCkxDUQ77D+BOseMLfU3dZ6CULGPNK2bLXq+1WjhqIcUPwGzvKISBF O6olPEEKtRQwgta/H/Qs+0BNY+/WGAjZkUUeP34sJkxna5kDfLlYAIX8js+TtMUsb0bs Y+Ag+7iIMr1mu18ttZWkmOh04oCiEb8m4iESa6Um+uXBoKicQ5OxzB+4tmiVUo7MTXwz AOjk07gFz8AS1zrG2XkwmxCYfnQnjHjb5TqaRqZumtwieglaAGyVlgEk0J7J2YuNlqkk fxlP0eD3GGMJ8hDa8G3ctfyThTj9SzvjAe5eWEv6HM4TaL4nYiWdfShommETgqWhyMp8 PCIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OUJsj7U4; spf=pass (google.com: domain of linux-kernel+bounces-14834-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14834-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s18-20020a05620a255200b007817232fbf1si12532252qko.161.2024.01.02.13.12.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:12:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14834-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OUJsj7U4; spf=pass (google.com: domain of linux-kernel+bounces-14834-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14834-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 512221C229D1 for ; Tue, 2 Jan 2024 21:12:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14F0B18AFB; Tue, 2 Jan 2024 21:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="OUJsj7U4" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 261B718041 for ; Tue, 2 Jan 2024 21:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7b7fdde8b98so496499039f.1 for ; Tue, 02 Jan 2024 13:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229732; x=1704834532; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5bEDuGxV/dPJIqZg1w0wl3qVgLyOuLBrt1YTH4lJcK4=; b=OUJsj7U4B/Wkgmd/AEzsPthDKbgyGX+3iugDar/5gA7ccoYTJ6wxikYoAtPZTOREmK UJ2mnqV+1gAUnr0GnKfLOhhpqJ/7zGJiUupAXFKyjhdkm8b3y1gJCpMPYQiqaPPvfz6H patHhOOm4j4GiWVlxD8AODicg2PmeldUrdKfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229732; x=1704834532; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5bEDuGxV/dPJIqZg1w0wl3qVgLyOuLBrt1YTH4lJcK4=; b=qG56ww6gYtnYpyj0sYOoFsyGK0UPHdp0s1MeMToCl3ASB5m8xRY1t6yH1ifeAfte64 UZmnmEtmRwGJq0VvnKLIX+T4+c0YuXCRA3g3nqcYY41HEs7xKCdFcYqbLzq++k27OkCJ /9HEX8fcGNS+OLS2J00gQ1XEey4rAMXXWZ5clRoOuvHUQ0W5P1tWWTaNYmaSo+mcnDJu GfdWRzA2Fd8z+hIhqhHYeOSkeX7KxRT6XJHFWWFF90qUjFIKj6UR08XbuUn7/yfVXviU 5XVW2gul4diDgi/26VDWnb/Oq/rmLrtsT4FD49jsTDmDx+QTJK1pyyEvR5MczU2AahWt mesA== X-Gm-Message-State: AOJu0Yz1e9i+d4PAgECuTkzCeAuwGA3yfJmYx7yVHvVha+nh0wVJZhsd b8MsRtDM75q6M8nkanPS2ESm6OuTfvYTnFnTa5x3cUwy/nl3 X-Received: by 2002:a05:6602:147:b0:7bb:cd42:ed8e with SMTP id v7-20020a056602014700b007bbcd42ed8emr301320iot.28.1704229732361; Tue, 02 Jan 2024 13:08:52 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:52 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Conor Dooley , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 10/24] arm64: dts: mediatek: mt8183: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:34 -0700 Message-ID: <20240102140734.v4.10.Iba4a8b7e908989e57f7838a80013a4062be5e614@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014601890118155 X-GMAIL-MSGID: 1787014601890118155 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer Reviewed-by: AngeloGioacchino Del Regno --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi index 5506de83f61d4..08261164ab18d 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -924,6 +924,7 @@ cros_ec: cros-ec@0 { interrupts-extended = <&pio 151 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&ec_ap_int_odl>; + wakeup-source; i2c_tunnel: i2c-tunnel { compatible = "google,cros-ec-i2c-tunnel"; From patchwork Tue Jan 2 21:07:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685665dyb; Tue, 2 Jan 2024 13:12:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrPkL/BXHcXGZe4PsuaacAWf9lkgtbZdIC1aHAmYwgjkB6vn32x/1UqFeN1OgiD04rUdMC X-Received: by 2002:a05:620a:15b0:b0:781:7848:1b93 with SMTP id f16-20020a05620a15b000b0078178481b93mr9419979qkk.90.1704229940435; Tue, 02 Jan 2024 13:12:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229940; cv=none; d=google.com; s=arc-20160816; b=n47n/bX2MdLH285PaL3Ne/8wr6J+L3uKoYh7ENgKJcY+cLc7vzdzQjdKl913FjcJYN QdCzb+3IjHQP+xK6CYhGJsp+YIK8iDOYViAZRcHWcKlENkWVsp6TcjinmbL0mQJKPr6W znIrrNsn8DF0lzBKEQAr3D+huiMPITnBJYx26+2VK1/NEcHSW3wm+fzCl0J4Ael2ofgU OXHECnN4u8/2qJtY97l7xxtzXWx5z9I5vRGEOQwvVdk5x2Ih08EB4ggoGOw+sE56+sQf zxBpXXviNzBvDA8whDM3EuIeSvopPRL6RN6z7anvS5S0F2lM5NfnxGV/KP4+fGG8e8lF jiZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Kv/aa+b9yoEdKvBahkqrw433Fqiy1xO+ioSsYaTJvb4=; fh=1lZWIWcOZVFTUi4X75WIpUZJOALL5V9UacQsFr0aq2w=; b=qMPT9GGRRbRryJNAW1Xw2nLYlNhwka4r5eKcEGkKHlMlT8lUq+Tq8+o6cKNcbzT3/g 1Tb65qlwYGI0v7TIG3MS5Ow6pzBp2plHmKN5kQW+wU1EuWHLwGtmyvwInctN19QDPCS2 nip9UA6zPwI2z8HIdUyNzNk0jOVORwdQNt/nHXsdfzI4vCL9D8TxOwKvR7oQrHv/ln/g xxRFTDAcffYc5q7ixmZ/tE9WV1clKNBIPo9F4n30kFv7T/NrZHPeyEV97cau5BUgx9ok 4DXdYmCGEndLfuNY+WBwV0kp7hJxVTgaOzmCfeRtBVWLLBsgWgR61zOa7fzPp40n8q2/ UlmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KkhdR48g; spf=pass (google.com: domain of linux-kernel+bounces-14835-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14835-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b26-20020a05620a089a00b0078154cbc43dsi16406788qka.652.2024.01.02.13.12.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:12:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14835-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KkhdR48g; spf=pass (google.com: domain of linux-kernel+bounces-14835-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14835-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1D2E01C22964 for ; Tue, 2 Jan 2024 21:12:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E243518B1E; Tue, 2 Jan 2024 21:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KkhdR48g" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16037182A7 for ; Tue, 2 Jan 2024 21:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-35fe9a6609eso73631245ab.2 for ; Tue, 02 Jan 2024 13:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229733; x=1704834533; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kv/aa+b9yoEdKvBahkqrw433Fqiy1xO+ioSsYaTJvb4=; b=KkhdR48gDfOnK0JzFjr9dKqzquQEnAWkct5MJKxXTVUYMsVdlUwo5iSD+vN7NzaVQa jetjvii6Fno+XkzfzFS/H1THp689jd0nzmp9/pCLWh616Sa0EGBDt+JmupEyUi/76F/2 Re4a0iKMXdCcCSwVDy1s5HI2HojH4odrxmZGs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229733; x=1704834533; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kv/aa+b9yoEdKvBahkqrw433Fqiy1xO+ioSsYaTJvb4=; b=QhLoPEaXPldUuxyJGLLzWlJ+HR42T0g4v/4Mi7jRBsBR/1NGTITUPMhuimaeXJVxRf ZxrUoF8VkcEd/BGEK2kACmCAkqGgjWg74KhUIMv6kUacDsp4TsFMqv02Kzxdp74EU2Me oGJeh8JRP1hLzC2BXveKwveIH1iQffHzGuPLanGbKu2HokWylAs8vnlRD4ogvLeTqbRR q74HwTMVe7hCD4Nhsgm5cQm89PN7gm1Kq4PWtWnjKbZaXKtiSnK01LNJkAdSVAXBKQUu s6hFqBt8jGFfiIpc7uxHzreBWE/ZMhnT8iHrRIFULN48r+f0juqyRDohemsv1y271Zd7 xGdw== X-Gm-Message-State: AOJu0YwcphmTuviG0GuQoCArfTXCdlpW7AqjMknqu2g1EBNcA/YeQZM2 Bp+bIM/iDaWzKj0vbL61Cy7QONSBlnmjWmGRJwwlFFwoDQLr X-Received: by 2002:a05:6e02:1a88:b0:35f:a4b2:7018 with SMTP id k8-20020a056e021a8800b0035fa4b27018mr27509779ilv.29.1704229733266; Tue, 02 Jan 2024 13:08:53 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:53 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Conor Dooley , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 11/24] arm64: dts: mediatek: mt8192: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:35 -0700 Message-ID: <20240102140734.v4.11.Ibd330d26a00f5e219a7e448452769124833a9762@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014614023560736 X-GMAIL-MSGID: 1787014614023560736 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer Reviewed-by: AngeloGioacchino Del Regno --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi index f2281250ac35d..ab44d382f757e 100644 --- a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi @@ -1332,6 +1332,7 @@ cros_ec: ec@0 { spi-max-frequency = <3000000>; pinctrl-names = "default"; pinctrl-0 = <&cros_ec_int>; + wakeup-source; #address-cells = <1>; #size-cells = <0>; From patchwork Tue Jan 2 21:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685979dyb; Tue, 2 Jan 2024 13:13:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpEgAU4VUbjRjIyP/PiI/doGA52YKUBfj5+4uos9EQvYwwtBFm8D8lM/M2FSTmwCaheGVF X-Received: by 2002:a05:6358:282:b0:175:32a7:705 with SMTP id w2-20020a056358028200b0017532a70705mr2884311rwj.64.1704229984904; Tue, 02 Jan 2024 13:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229984; cv=none; d=google.com; s=arc-20160816; b=iWLki27ThY3eAjWNKmexHn7QVEC14D8cMshL6ZDCgoxbSszYWz4M8PgbxSd4rVxGWw tLTXZxpH4hHeJH7m32csiSJiS3cIcB8xV/kniOYkN3wkC6xtHx/3amsWhYn+2Zm3Haow Or/8DGrXAXppoBnxpu1UuhVNho5fn3wUOE9JgMbA8UB8MEFD+AlNELO7McmpZ6Q2K+8y p6hECTW3w5od3ivcfsbZD2wp7PDQizizFWrKYM1y7a/86pg0ZJA3GHZpgNaIFHAyV3H7 +ZVbnpSYUXO0WsbriQSD4JfspUf1550A2mKFHpTMiDTlFn/MP5ucK5WF/AnPYBc8M+bb w01w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=n3q5bAzQikGEaFLCjfRt4Z8nKD+aA0c3SnrfHNcWXEY=; fh=1lZWIWcOZVFTUi4X75WIpUZJOALL5V9UacQsFr0aq2w=; b=K3x+KHjUYEUK4Sd1S07mYtcS9F6dsm6vvxob4EUrwXEWfNmqE0qmmJ0to9n7zT5LDK jrWzttxkTRmSqMzzvZiSO4wEcrUjI7Od19LeeJFI+pmUY/AEfZcjLG5fCtUfrY0uQ8Js EIPcPI7PwN/C0pcDrBmdpgfTnGybYl43Vno1F0aTE8mCzxIkrXUL22z2T7lwZqJbJHgK 003HzgLTWEv93blNJZZfYJZVmFNixOReobjwzcZ4ncmnAgQLM+TmhibcL33bLV43AkUw ebSB2Ugn/RZLir+JE06hvstb2s/z3Nq7AVG1lym2JVvqnyE7fUDkykHD8Hx3c1MJ/9MF WL3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JXIgDXon; spf=pass (google.com: domain of linux-kernel+bounces-14837-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14837-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k15-20020a05622a03cf00b00427b2719319si23923201qtx.546.2024.01.02.13.13.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:13:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14837-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JXIgDXon; spf=pass (google.com: domain of linux-kernel+bounces-14837-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14837-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AE54F1C22B2B for ; Tue, 2 Jan 2024 21:13:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5058618E3A; Tue, 2 Jan 2024 21:09:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JXIgDXon" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5441818632 for ; Tue, 2 Jan 2024 21:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7bb5fda069bso168111439f.0 for ; Tue, 02 Jan 2024 13:08:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229734; x=1704834534; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n3q5bAzQikGEaFLCjfRt4Z8nKD+aA0c3SnrfHNcWXEY=; b=JXIgDXonyYNTm//xOUZbqvGEUrcO/uNkN4iZlt5SKgdAoy2vIhCqJ8k3ilv1Qyju9n sqEoOwLdDWLnZ5BHEI3SEUOUyYRBKWtMGCPbadhqosOiYy2D0oupIDf7vv0ygYDSO2F6 Z92VWWV+mmFZk/gLa7p6FtRIY8D2fo6aJ2Mm8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229734; x=1704834534; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n3q5bAzQikGEaFLCjfRt4Z8nKD+aA0c3SnrfHNcWXEY=; b=AwCIba5QWgWYIF8Tga2Krr4zgfP7rJbM3Cx/IkvYT5kobZO1lmnin1WXWVlx1FvhiA e8T7zHK04Zs5D1mUDynQv4+MY6n/L6G5iafNH/JgKSolrtCCyYWnP+UpxvdDTeRnVslH bvLFIgMQbUphlhFGocgnnu93hnsX4sBBsxCWy3SaMiYV0YDOtD74qvgdXC7Tp8PkI3wV 37kbSFeW9R6h8hbSB/GaXd/ECsmnoaOJaEzuVPbmDfH4zC694BRRtP2GQOeaZrYPwGah mGPL7YY5BZyZrcikUgS7Mw8a/wfN/fSlKvdyET8l1Tpv4Ao4JGK+FSqUYbPuCN74Mudj pClA== X-Gm-Message-State: AOJu0YxtMrdJVMFjdPDUzHDs0GSRJny2jOZrpT+xmM8kLTNYlk9t5Vfe Fn7E9jDC8AI+i5p2PVoPHMtccWorIsbaC4kwUdRUZer8oHkK X-Received: by 2002:a6b:5905:0:b0:7bb:bca0:7670 with SMTP id n5-20020a6b5905000000b007bbbca07670mr1472284iob.23.1704229734077; Tue, 02 Jan 2024 13:08:54 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:53 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Conor Dooley , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 12/24] arm64: dts: mediatek: mt8195: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:36 -0700 Message-ID: <20240102140734.v4.12.Iee33a7f1f991408cef372744199026f936bf54e2@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014660685450105 X-GMAIL-MSGID: 1787014660685450105 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer Reviewed-by: AngeloGioacchino Del Regno --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi index bbdcd441c049d..2edb270d0bc2f 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi @@ -1149,6 +1149,7 @@ cros_ec: ec@0 { pinctrl-names = "default"; pinctrl-0 = <&cros_ec_int>; spi-max-frequency = <3000000>; + wakeup-source; keyboard-backlight { compatible = "google,cros-kbd-led-backlight"; From patchwork Tue Jan 2 21:07:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4685917dyb; Tue, 2 Jan 2024 13:12:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/bIFQJ1D9zpkNL/1OFSLGmnXbl5w6cXsBAAqfDhcsziahs9fZ9sbb3yWJBM2SYTbjXPCQ X-Received: by 2002:a50:d558:0:b0:555:b301:2ca7 with SMTP id f24-20020a50d558000000b00555b3012ca7mr4907757edj.41.1704229975772; Tue, 02 Jan 2024 13:12:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229975; cv=none; d=google.com; s=arc-20160816; b=fcVQjgwIHXAM1dWyPjacWJvbgA+mM97+vqn4ptdUBvGn2JAbABKDPGvsF5Sd2icdbo n+djJsIijfyTOfRFmA5zJ5YBh5r92iS0U18A39VHzNm3sBjGiFpcwHsIWFGAGXZBS5bD Dj0CnmoIGTXnDx2Xmf3s3p5qh3lL9tuzpOQuKiiI4g4TlKdW8g2Jyc1ly7GtBAgFMida 6wkBKi7dgxF6q2K1KMPOvELQH3583LFW1nt4k9WH+fWLaSmWM1Kq2h8uNvaQKxnN5Pt0 xLjn1p3c+BPeesb0GrD7umUloJX1M67l78Zw5rrbx47LegM5dU2YL3OLTGJ13kWSk28H /WKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6xWplU6V/74zhrE0fU+phMJuFQc01H2ditVc3hsW/nY=; fh=+Tr1Br32MKGmbHH9fsgJ+LjwTUzcRzSCYkCUiuUlFTA=; b=cWmXmORo5U2tf7rt69zQ5HfPh3fzYOpYhQ9TZtlul9cw0xywftDQU1yEqSBHnTu7e7 14fVMH62FeSIue3HcJ1bpgsOSrCfVTHPKdMWWXDydTyxvSwHqpwU4SysqOaWP/NfrMC5 ACEoyKgYs82g2oqjDxBbzdbuJ8zXrPNzgOKFeBkevymrW0RddhNs9kA8COdtK7qbwE3E KphHEmY3VLNelQg/CuWz9U9E3rJUt1ntHcJ2nQcOIg2QaZq+OfQezajcpKk/3rbiAzGC nm1q3PlDy1Um3yAiukfKVs9lU02UzuNSkSz74bnSp9hgYzq+HntiWmMxCVgmjyhAAYwt vGXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="J/iviGxT"; spf=pass (google.com: domain of linux-kernel+bounces-14836-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14836-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f17-20020a0564021e9100b00553ae988ef6si11804359edf.615.2024.01.02.13.12.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:12:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14836-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="J/iviGxT"; spf=pass (google.com: domain of linux-kernel+bounces-14836-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14836-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 646BB1F2141D for ; Tue, 2 Jan 2024 21:12:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0E6A18E25; Tue, 2 Jan 2024 21:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="J/iviGxT" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E26A118651 for ; Tue, 2 Jan 2024 21:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3600dc78bc0so29926405ab.2 for ; Tue, 02 Jan 2024 13:08:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229735; x=1704834535; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6xWplU6V/74zhrE0fU+phMJuFQc01H2ditVc3hsW/nY=; b=J/iviGxTnseTosGYD18/rbF8CRnnRPLnuoyhM+uMxt2rHo8zsjpoIu858je2rx9fSw nNFtxc1LOzjg1Bb5JrY3peV4KD6mCmd/qEqnogrUal+3AjklC1X68C2uWM0UK6ZPDF1m MCEH3hKAIXs4HL84mb8+Hlm2oT8Lv2Jt3Vbtk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229735; x=1704834535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6xWplU6V/74zhrE0fU+phMJuFQc01H2ditVc3hsW/nY=; b=RMOfL8q8TmjRvnzKJqTJksislE48NExfeTLEYqZuduZYRAsD5Ib3vwG5uS2Ox3tJKM A5PQ4R5rQMvfIgEgmtqL/PiWPxVqLoNLS4BNQOhLSQ8ITa7x8v3p67QBFjBf4QxfhpaM dGuZ26AqKb+zH469zwHpLObj5zyz/bNmpjc5vyQV5g+aPI5KQHshrOVPign2YXVmDN3R JrQ4/NsyR1wU9LRFjYFWYVKL/a/ddjxBWqX7oHjHoA/lA69VtIlNc9gWfogGeEgqmCBJ UpjS2TaMxQf/9k8b0AjHxjA/6EhWowLphLMOKlnHJMC0kTIP4N3rFsx0/dNRWiLK5iGW Ubjg== X-Gm-Message-State: AOJu0YxNEjgRNdPiE3E/nE9sWB2qq0lpksUp8GYOygWlJfFwO5o7Py2h OL/VKwEt3E45mCO+TLusi6QzWL1MfWdm7c/sEQJNfbl5HviB X-Received: by 2002:a05:6e02:1be1:b0:360:2197:4bbe with SMTP id y1-20020a056e021be100b0036021974bbemr15914894ilv.59.1704229735102; Tue, 02 Jan 2024 13:08:55 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:54 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Conor Dooley , Jonathan Hunter , Krzysztof Kozlowski , Rob Herring , Thierry Reding , devicetree@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v4 13/24] arm64: dts: tegra: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:37 -0700 Message-ID: <20240102140734.v4.13.Ic12bf13efe60f9ffaa444126c55a35fbf6c521cc@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014651316549661 X-GMAIL-MSGID: 1787014651316549661 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/nvidia/tegra132-norrin.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts b/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts index bbc2e9bef08da..14d58859bb55c 100644 --- a/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts +++ b/arch/arm64/boot/dts/nvidia/tegra132-norrin.dts @@ -762,6 +762,7 @@ ec: cros-ec@0 { interrupt-parent = <&gpio>; interrupts = ; reg = <0>; + wakeup-source; google,cros-ec-spi-msg-delay = <2000>; From patchwork Tue Jan 2 21:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184461 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4686082dyb; Tue, 2 Jan 2024 13:13:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQoeAKxE3N1NR9VMwoSNtA7nOqZ5OAiLUdAHA3nZiefDHHLWytbg15h7Q7ErJkYTdqIDRF X-Received: by 2002:a7b:cb4d:0:b0:40d:80f5:7767 with SMTP id v13-20020a7bcb4d000000b0040d80f57767mr1735579wmj.75.1704229997621; Tue, 02 Jan 2024 13:13:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229997; cv=none; d=google.com; s=arc-20160816; b=ZtTw8b/a+zy0V9e/pWpPyg91F3XaTbPA9unZgG25HY81+pXWZdc629dLON6fMjWRkq LdKTW5wTGfBuMLVRmdegWqly5ZIU0XKyZzk4FcnQvlPF9u/KEsKkge1KlOylmfS7nr8T jBCbcfz9QCruSIUTWgQ/RqH/rDvSiPuv4WDsGWfOKPzTHN25iCzrX1oWRdsEpUNQBeIg lOtYEm7QpIbil/ohFBTmkCdaqFkCj0RyfN2MhV7OdHCbwexFKmhSfeSFsV5pHJCmxsZc NNYXdX6nDPuVB6+2/QP4LMeuhXwQbCrxJ1yT4CqFj5Ke6KcIlPSTRz6QG/XA6Lgf0L2z yD6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ASVoJVcd+TT62Fgbp6rK6yB+IeWHJc5zYIDcydTnCh8=; fh=i9qMm7eTyXuYgN0CaK5GL2gmQ8m9aJzrDZ8hqikZ3oc=; b=GbCgMHjMS9wfJ2/6dFOXOU1bKNSZEJGPZd+AIpxjJbyKv/dMJpUSa1tWBs/7AvqSvN NbfL+4m+BeJUBC0bWJI5SdDygzPFnB566oD2KuvsxhtqQJ5RkLM/XdHa0Y9QvoZEH1+i bE545YeUGp6hsJ6ue25rn85z5OROOps/aiA/ZEgoZ4IXBE8iZd26TrXydYp/bPOkqLlo 2tfIhSAImPabKmzvE6I6CV7VBy5wRrG4ycw/XmCvg7c9gVr2RivdaXhxxGeq4foalubr U0EhUb6Zl6dCy3v1w9GXC73z7ixWt0lADbTMnn/SHbxtQAWoZYyKlnZKktnVF6/b6vH5 pcvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DqgZYr4s; spf=pass (google.com: domain of linux-kernel+bounces-14838-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14838-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ew1-20020a170907950100b00a26aad24bcasi10174646ejc.214.2024.01.02.13.13.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:13:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14838-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DqgZYr4s; spf=pass (google.com: domain of linux-kernel+bounces-14838-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14838-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3F4B01F23697 for ; Tue, 2 Jan 2024 21:13:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E72F218EB7; Tue, 2 Jan 2024 21:09:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DqgZYr4s" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13BDD18AFA for ; Tue, 2 Jan 2024 21:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7b7fbe3db16so507816539f.3 for ; Tue, 02 Jan 2024 13:08:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229736; x=1704834536; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ASVoJVcd+TT62Fgbp6rK6yB+IeWHJc5zYIDcydTnCh8=; b=DqgZYr4s3hSliN6FFFZaaGj74rg0u+PKQ1gTCVl99wqo4J+y870TQTIqaDrLDd/TzA IybtfT638ChuMEOSvh8m1OL/HOeSwCZUVK0vYTxkluiEZDWtcCcavssrYXdS7znuMpop e48pWg80Kd4vg6POS7V8Vk2nIpVzTckgE1a+c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229736; x=1704834536; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ASVoJVcd+TT62Fgbp6rK6yB+IeWHJc5zYIDcydTnCh8=; b=owjQYf/5SiSu89gMNXDhYiIWxG5KFIK+gKVkoui/ioMytACv3RxhHaGrtgLejtayou 8v2gp6+XQhelw78YZwIltuUqrRUIDvkI6IS//Re7x46b5XsWS896jalXjPkcOuP8+eWo 83/acjAPGCANc1ae31/ew8ozJKZcvZHr5qBcU49pxdyPlVEgjrngrd0eXejkO3YD9G45 K3dxaIZqy9ihdNjNyJxUba4T3p2dxMMHVsTf8WqPkDi0bzWGvWXl+Q+K/99N38vAG6aI QgoBp2/Re3RplY0WZjRDGwKNJBbuePz5ucwPmRD8pdRCo6aQRBhFdShKoeP5FwlKZ+Up UjIg== X-Gm-Message-State: AOJu0YwcBrmu2h5rsvL20qeXHTa2mOMndR2RoTqTpuF7gYs10pnutzL8 Vpqd2mNaJHDuZ3Ujemgpmhngq+fLh9OSI1vHUns7VicAR63v X-Received: by 2002:a5d:9358:0:b0:7ba:e1c5:7b47 with SMTP id i24-20020a5d9358000000b007bae1c57b47mr15402309ioo.33.1704229736202; Tue, 02 Jan 2024 13:08:56 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:55 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Douglas Anderson , Bjorn Andersson , Conor Dooley , Krzysztof Kozlowski , Rob Herring , cros-qcom-dts-watchers@chromium.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v4 14/24] arm64: dts: qcom: sc7180: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:38 -0700 Message-ID: <20240102140734.v4.14.I2ee94aede9e25932f656c2bdb832be3199fa1291@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014673945738371 X-GMAIL-MSGID: 1787014673945738371 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Reviewed-by: Douglas Anderson Signed-off-by: Mark Hasemeyer --- Changes in v4: -Add Douglas's Reviewed-by tag from v2 review Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi index 46aaeba286047..f3a6da8b28901 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi @@ -649,6 +649,7 @@ cros_ec: ec@0 { pinctrl-names = "default"; pinctrl-0 = <&ap_ec_int_l>; spi-max-frequency = <3000000>; + wakeup-source; cros_ec_pwm: pwm { compatible = "google,cros-ec-pwm"; From patchwork Tue Jan 2 21:07:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184462 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4686215dyb; Tue, 2 Jan 2024 13:13:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxV53T1aK+Cxx3a2jQ4O2I4l2c+6bfId7eyrOFP4StCFaT4oibUuWAOzWVnwkC4H38escK X-Received: by 2002:a17:903:645:b0:1d3:68ee:d958 with SMTP id kh5-20020a170903064500b001d368eed958mr7660393plb.107.1704230014378; Tue, 02 Jan 2024 13:13:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230014; cv=none; d=google.com; s=arc-20160816; b=Be1H0OhAHc39S12Tgw5upDrPGC0CuaG3Rr/locNIMW0nKQyth4OTlGhSt6+d5BEwjg TI83ny3lj2/fYhJQVF+TyUQCRzsemRkzDuuEpq2LmHU2kfZK+9Qx5GkgscMPbuhPPUrg W8GM4FxHitkv0wmgppAkarRS1lhXG0tIB7gaB2Yf95ivne2lkPrFae8n5yu94XvKANTi RHC8oHETZgrEEJZ7r0V4NQM/LKGdub/+EoLAeBGoFV+8DYi3/IWQJhyd2P0tnQ6+ww/b JmKbDz6H31TK2zkkwWzP70Vh1rom3fgamS9Yy89IBrwIehn3/Ph/eY0jinlejiq5aTYd N2Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=17sTLQMT2wthv6A1NoR1+c8v3q9aB7n6ZqwH4HJJEV0=; fh=i9qMm7eTyXuYgN0CaK5GL2gmQ8m9aJzrDZ8hqikZ3oc=; b=QFhEtrjCaQpjbC0P/HTCDSnKvrpj4AJuH9RjnUQutuIfVOrro3HeHxvDmTpAAwVPm5 t9tGjtktn1wblrBDPQWpIQqX3Lo0FJi61nknWaAZYkq3dhuCaxgHnAepwGuffuBMw3ug 3KBCukhQQq5tfLP6r7oXvEtIg4eEjTJq4OBCp3UxsZEWx5euqKkxwyXPtnFwIY4wpUx3 LtFr1kHrguTCY0mdhGrLi62g1QHQXtYoEmq7mxBrHiKuNzbMjBKymldfDiaoSlCvPtis vBXDb1yWpLEUwDhu08t7DcOAg8/s7Ulksdyl9cdaYgiPkeJla2VkgNmFevF7RhWM/S1Q Gpbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="G/dP0i3f"; spf=pass (google.com: domain of linux-kernel+bounces-14839-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14839-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y11-20020a170902b48b00b001d015cec684si20521656plr.238.2024.01.02.13.13.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:13:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14839-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="G/dP0i3f"; spf=pass (google.com: domain of linux-kernel+bounces-14839-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14839-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2B9482847D4 for ; Tue, 2 Jan 2024 21:13:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06DC718EDE; Tue, 2 Jan 2024 21:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="G/dP0i3f" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0857E18C07 for ; Tue, 2 Jan 2024 21:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7ba8f139522so493859439f.1 for ; Tue, 02 Jan 2024 13:08:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229737; x=1704834537; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=17sTLQMT2wthv6A1NoR1+c8v3q9aB7n6ZqwH4HJJEV0=; b=G/dP0i3fJD0GauZiZhHTIMDLCqWdj0PmuwNf+pRtfpGVkOOxze1QGiQHgR8CJXkzQ0 M1eOOs20S4ff2isiJd9MsA1GwnWU0ZaMmDK6mVPekj7tWiRLCYxMiGDsFQg1tacsJCqK 7IJ10o14ZlZJ7KSVfc6p/qi8iz7hntt+wkNKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229737; x=1704834537; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=17sTLQMT2wthv6A1NoR1+c8v3q9aB7n6ZqwH4HJJEV0=; b=aLIqPqdsgdrJJ0YU0oKY7Gdou0Fjuwdf+OYFjZC6CSZ7kNxXLHd75KQbFCBLfyky2W RVJjaqGtlLgpRpgVcgeGBU9iC29tImMpa6RI7LKtXjVM3afH4RprdsnQkgCMJcmbpHkQ qw9VM1aZybyA7YmPZI4JHeahdXsQomIao34WtizGKcc7dyyh+XJRWIXCr3yzXaZ03eBl zWApVXSF9RkK6iinKGroLb8G3hVEtZgtVNZWfqukyyJoKzO/r4XoCsIKWHwITH2z8/ic xB9y7DqyqhtpI21oDL+oycmne8Rz1uf191oIpdi8lQ+aAC9itJnY8uBpqk8xLqkxctpO 2hzw== X-Gm-Message-State: AOJu0YyyYOCDvH0JC0SVxCu/fqnXwT65mcHuHQwuIt/WmtsDTeKhSbcg nJy+rDYVP7UezXnA3Tv0I4kTRdaoQ1dwy1jfnwnr/pXL+feI X-Received: by 2002:a05:6602:19cf:b0:7ba:8706:3413 with SMTP id ba15-20020a05660219cf00b007ba87063413mr23570133iob.41.1704229737084; Tue, 02 Jan 2024 13:08:57 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:56 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Douglas Anderson , Bjorn Andersson , Conor Dooley , Krzysztof Kozlowski , Rob Herring , cros-qcom-dts-watchers@chromium.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v4 15/24] arm64: dts: qcom: sc7280: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:39 -0700 Message-ID: <20240102140734.v4.15.I7ea3f53272c9b7cd77633adfd18058ba443eed96@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014691239548966 X-GMAIL-MSGID: 1787014691239548966 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Reviewed-by: Douglas Anderson Signed-off-by: Mark Hasemeyer --- Changes in v4: -Add Douglas's Reviewed-by tag from v2 review Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi | 1 + arch/arm64/boot/dts/qcom/sc7280-idp-ec-h1.dtsi | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi b/arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi index 9ea6636125ad9..2ba4ea60cb147 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-herobrine.dtsi @@ -548,6 +548,7 @@ cros_ec: ec@0 { pinctrl-names = "default"; pinctrl-0 = <&ap_ec_int_l>; spi-max-frequency = <3000000>; + wakeup-source; cros_ec_pwm: pwm { compatible = "google,cros-ec-pwm"; diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp-ec-h1.dtsi b/arch/arm64/boot/dts/qcom/sc7280-idp-ec-h1.dtsi index ebae545c587c4..fbfac7534d3c6 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-idp-ec-h1.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-idp-ec-h1.dtsi @@ -19,6 +19,7 @@ cros_ec: ec@0 { pinctrl-names = "default"; pinctrl-0 = <&ap_ec_int_l>; spi-max-frequency = <3000000>; + wakeup-source; cros_ec_pwm: pwm { compatible = "google,cros-ec-pwm"; From patchwork Tue Jan 2 21:07:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4686329dyb; Tue, 2 Jan 2024 13:13:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNe0ihN/8UyS/e1VDlE2qHdVWx7q4uMtBdOL4xC6ijvYwwiZ9FjRevIXgjERnf6k9uBEFa X-Received: by 2002:a05:6808:4447:b0:3bb:c8ed:57ce with SMTP id ep7-20020a056808444700b003bbc8ed57cemr15406887oib.79.1704230032935; Tue, 02 Jan 2024 13:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230032; cv=none; d=google.com; s=arc-20160816; b=zvNgzxQTN+vIa7LYIdprJoN8cOkGcSSeBO8QhHdWA63pLX75P9O/6uFuqKaSW5/zYp W+tvj7S2LcDZd8rji/PaJqkm+JMy6YUMtMYQbkhUao0wPGrhG98K8g9ZifEIfg5O+yGl a8RFeITAhtOgBO3p4flQkKFMF91lMxsmK+msIjwZ4qBezF2ZaTIlcSY7zZcS3q+3FNy5 fr7liiF9G630qWOqSspiT5Zl5gU+6W2xb70wNqz1mrCn1rnHuSW6S2oJryUbXWzVIXCh 8HXpTdd9/Mm6bo9Gjf8ospfT2vjliEE24L8TSPgt2Hl8tdCL70J2jL0u1AJArNGTxamB VTJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YBXG8fkqI4E9TDywbJQDVQlGARTRe1Vl9dne1ILm/18=; fh=i9qMm7eTyXuYgN0CaK5GL2gmQ8m9aJzrDZ8hqikZ3oc=; b=eZB9cqs6ej6Lo4W5NLe5t7W8HKspJKxbO2cSDMP9jkMxJnTy2gabNZA5Lv6ox3/yhO AB29zOgMEBXHYy4b+POH9ernwzoBz9RFuW0ogrZ/ZAmjQP03CBFHIeJUxzktLPZhzkHZ BlIQHpxELVxpeCfnJU52EteE5TBbEFe+ABjNRrgo4RphIasT3v9HKAyHDLh9E8dy5HUQ S5BGF4IJ2dU+3s4JeqM2sY/EU+wP9+muOtTh2JOALPE7VqKGmWA8jzziwQju9FYvp0ap NF/C/JgduP7tbL8rMirALhOUeiTo9mtcsMAQXM/AlQTd9eJ28ydaj+QB7WriuSWvYrds 5KXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gPGOZCPV; spf=pass (google.com: domain of linux-kernel+bounces-14840-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14840-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z15-20020a056214040f00b006805f4f3d15si15689007qvx.486.2024.01.02.13.13.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:13:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14840-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gPGOZCPV; spf=pass (google.com: domain of linux-kernel+bounces-14840-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14840-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B489B1C22928 for ; Tue, 2 Jan 2024 21:13:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EFA1E19461; Tue, 2 Jan 2024 21:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="gPGOZCPV" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04052168B4 for ; Tue, 2 Jan 2024 21:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-7ba834684abso506386539f.2 for ; Tue, 02 Jan 2024 13:08:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229738; x=1704834538; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YBXG8fkqI4E9TDywbJQDVQlGARTRe1Vl9dne1ILm/18=; b=gPGOZCPVl2IIrjDodIynds27pMs1g9tjyI6RUW8c4K5irQ1QWFY02ZdmSp9dw1xXuD lVXArgUDrQ1w0wwrIRF2JSKyrb2MoJmnK0jQdeXA9XfriG2gO5eaIKLgFI/l0UfGKoUS ImvMVxBWqgtbgpsE3ief97V6bU0JucG9PvaZY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229738; x=1704834538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YBXG8fkqI4E9TDywbJQDVQlGARTRe1Vl9dne1ILm/18=; b=wlRizZOXCADgVzTxXqZEzSDm7Z9PcSEN39XiRl/37+ctImEKlX5IVBqJVWmMan8YvY QRuTl1VALfQRgqDMMse3nGoHcC44LmaLTpEbfEBjdpcedVpN8uaqbA436mQNpvl6BQkJ 5uhAbahYQEFmyOl4jquZsMQ05RNw63x4rEM9gKgLylDxcX47ih7LiNFON7R0AqqLa1Qh tn24Teeosw5rwpS3CVanuY+FwVSvEBLS/tJcCEkB7X3FAu5Muo3ActKoVPFeSKr/lvl1 aGlzuedqh8E+g+gORTPveIEi2jfR6kalQfGukwRLiAYK7FetYgmKD3NP7TG5GN8uZzDv OqEg== X-Gm-Message-State: AOJu0YxCBMj/eBuIiC07OwodZoLD4fUlvtIKfIET8YRjw/2uxlMyL8+x nNZiAB30uNlBYMREOW6PTYGA59B6hI4AL2ZMTXhst1hKngwZ X-Received: by 2002:a5d:974b:0:b0:7b7:4b32:7986 with SMTP id c11-20020a5d974b000000b007b74b327986mr22772171ioo.27.1704229738043; Tue, 02 Jan 2024 13:08:58 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:57 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Douglas Anderson , Bjorn Andersson , Conor Dooley , Krzysztof Kozlowski , Rob Herring , cros-qcom-dts-watchers@chromium.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v4 16/24] arm64: dts: qcom: sdm845: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:40 -0700 Message-ID: <20240102140734.v4.16.I870e2c3490e7fc27a8f6bc41dba23b3dfacd2d13@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014711115819269 X-GMAIL-MSGID: 1787014711115819269 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Reviewed-by: Douglas Anderson Signed-off-by: Mark Hasemeyer --- Changes in v4: -Add Douglas's Reviewed-by tag from v2 review Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi index 0ab5e8f53ac9f..e8276db9eabb2 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi @@ -852,6 +852,7 @@ cros_ec: ec@0 { pinctrl-names = "default"; pinctrl-0 = <&ec_ap_int_l>; spi-max-frequency = <3000000>; + wakeup-source; cros_ec_pwm: pwm { compatible = "google,cros-ec-pwm"; From patchwork Tue Jan 2 21:07:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184464 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4686390dyb; Tue, 2 Jan 2024 13:14:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdABO/0yVyNeyRZ26Q3G2U2U+ralHI3fSC/9/EOtH0AD4pc0iCwRgJfSti+Z98pG9QBWFq X-Received: by 2002:ae9:e113:0:b0:781:5a40:3f42 with SMTP id g19-20020ae9e113000000b007815a403f42mr101567qkm.51.1704230043432; Tue, 02 Jan 2024 13:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230043; cv=none; d=google.com; s=arc-20160816; b=YjOLnkHABEVsHy1u/FFNZ4ZBS3taqFPdl7nXYdl+HoJPu343fM53Ntihpp56lE3o5P hkX9mupPiNMzskdeqGvNK30A7BRUbqunJEZqPGH0yuJh5yhsbWyIqbEm7vUAix//l41i bKPDpuagswY03HdfBGOSFQdL6QENRFsNSWoEx80afjhryJLWCWayph+RJDzdn0TGi8HZ Po9H5OjV2p60Qx2SrYuqZnMorOMNO/AVGZpK1MlrtyDtXVZEzhWv7wcnScuHd2Xtbp+f SYNw7VkVJkgfRMjzFVOyy9E5JbuU6m3wxg+k3SL+WoXJhtYs7THKQQocPbrAJJfdqWwo 2FtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HRoMMnuwwy1ybNYQkYoJT5CIAhjtnaw7FKUhRhlzX2I=; fh=TUZa3FygMEW1+y6ZGtVIyO5RCjg2I7CyzZHAcFdV/rA=; b=r7QVCEFqKxbIpSmIObrgTzQ9nm3BVFynqXPbJ6pmU+5Ao9qqIQH92Mkf90kjC3J/nm ICG9u5pbmlP1O5A3jTrwuKgbMJIUigBKBOluxo2DUJxb/xmas5TNVI8DqWmMbirGm6IL t5qWVrnGM4eQLiTeWiN9F3/Gjx5iLKqP0S0jSJYsO1wuRm/b1VQSmGZVMu+faOvA39vX H3/B4j2COYOTHn5ZvkuAUcEZkO9q3iYoZdiq40AgklJ8JNpGM5+SmN/VUeTlY/az+R6z y2ji/pl0GcT+6x+4GL/yvUFDgKOchj7BXA3cQ1EkG4InGv0ZI9C9/PEm55MSdcUR2fSg dITQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FRVfJom6; spf=pass (google.com: domain of linux-kernel+bounces-14841-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14841-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s18-20020a05620a255200b007817232fbf1si12532252qko.161.2024.01.02.13.14.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:14:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14841-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FRVfJom6; spf=pass (google.com: domain of linux-kernel+bounces-14841-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14841-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3D3811C22B76 for ; Tue, 2 Jan 2024 21:14:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E4371947E; Tue, 2 Jan 2024 21:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FRVfJom6" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99DE318E1C for ; Tue, 2 Jan 2024 21:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7bb99f77f97so50074439f.1 for ; Tue, 02 Jan 2024 13:08:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229739; x=1704834539; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HRoMMnuwwy1ybNYQkYoJT5CIAhjtnaw7FKUhRhlzX2I=; b=FRVfJom6hMAFayRvvyslNUklQnuLd0ysUghLiqfhR6iLGS1kGoXbYm6H9qGTU8wu6P XfpobjuNTGE9PZlaiRo72OJoWH8vPqtqoTDC69Ld3yX3qpIlH2h/CZ2SfvcrfIrrQ08E L/fRdPj+tw6Xlqa4PVQvC5kDXGmfh66BqgmGk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229739; x=1704834539; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HRoMMnuwwy1ybNYQkYoJT5CIAhjtnaw7FKUhRhlzX2I=; b=PPT5/yY765F/XGzEbF1q5LfLd2RQh84/MxJ+gIIOMJHdRNIg1EQb9ow8/hj2GZFMV1 zVJwIhhncTG2dGNsP9PAmVG+ElBWAhuXZ4ID+QDi7A1+kKnAvRwae+XvqRjzK1j1ivBV gm9dZtRD0VNhOViMC3Kp5MbS6mnA52Ec3bPGP0AADcnOgHdKCTDRWCUx1waRe+LbC08d v2h6CAzAkmW9ONtIVU7CtRPY+CCm5OeDBZ0w/6jfpEZm3H60tszJBdAy305yGpFRiSw3 K0ouUhmQ5JUBkqTBvNOXwoyY96F0wavnYb18PlYGzJ07ra+pxliQNwngIg9gPs05KHzL Rfag== X-Gm-Message-State: AOJu0YwC2AopcYKD3/AAQ2Hy9jwRARdP860S1q06MFV3lLpfi6zs26gs MYs5ytxcGRY4NfGuP/1GlBQ4jwokv4/iboErZbCXmOROZ3iu X-Received: by 2002:a5d:83c2:0:b0:7bb:b722:63c1 with SMTP id u2-20020a5d83c2000000b007bbb72263c1mr34165ior.16.1704229738882; Tue, 02 Jan 2024 13:08:58 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:58 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Conor Dooley , Heiko Stuebner , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH v4 17/24] arm64: dts: rockchip: rk3399: Enable cros-ec-spi as wake source Date: Tue, 2 Jan 2024 14:07:41 -0700 Message-ID: <20240102140734.v4.17.Ice617703aded22ad4c806459129e1ae693eb57af@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014721840279805 X-GMAIL-MSGID: 1787014721840279805 The cros_ec driver currently assumes that cros-ec-spi compatible device nodes are a wakeup-source even though the wakeup-source property is not defined. Some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. With the current assumption, spurious wakes can occur on systems that use a separate wake pin. It is planned to update the driver to no longer assume that the EC interrupt pin should be enabled for wake. Add the wakeup-source property to all cros-ec-spi compatible device nodes to signify to the driver that they should still be a valid wakeup source. Signed-off-by: Mark Hasemeyer --- (no changes since v3) Changes in v3: -Update commit message to provide details of the motivation behind the change Changes in v2: -Split by arch/soc arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi index 789fd0dcc88ba..b5734e056aef1 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi @@ -603,6 +603,7 @@ cros_ec: ec@0 { pinctrl-names = "default"; pinctrl-0 = <&ec_ap_int_l>; spi-max-frequency = <3000000>; + wakeup-source; i2c_tunnel: i2c-tunnel { compatible = "google,cros-ec-i2c-tunnel"; From patchwork Tue Jan 2 21:07:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184465 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4686551dyb; Tue, 2 Jan 2024 13:14:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGanSmJLNNkgi5hZ90/s/VbIOEhCvvbrCQ9UW7zeUaWcBv0460xi7vESlxlEUen4VXc1NGF X-Received: by 2002:a05:622a:1489:b0:428:a6b:128f with SMTP id t9-20020a05622a148900b004280a6b128fmr10752101qtx.18.1704230066268; Tue, 02 Jan 2024 13:14:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230066; cv=none; d=google.com; s=arc-20160816; b=UBq1Y+v5PkaT1yOPZZPpswhOWH8B2YhdNEU80oMJDomJh8iU+THI+2GAyEdSHxiRH4 ja88E+yeChSu1l2ZUOWy163Wr0ytxJooQcX4GL3Th40rpezBWnksSHpuK3g4+12HfSU/ dPOaVY5iHdlxz6h3e5d++HR6iA5k6t899z6NWsJIWjPSqz5lmqu0PfvpOEofI+JNlRsS X1J3MfiGEypOThVsP1O1rR+J+rQ9FqQCl7w71Hh8rwCMIhQ4Do4DuYTASpPCdIgnsGkz 4U4jHLY4nwV5KEJ5xXEFV2lFRrVuE54sKiGBBY9VosPuCirZE7uSZbsyDF3BVEHSE9Eq jQhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ukfFPOjxIuuxKMITUORsVWUdW86ng+CgXwCq16suFWg=; fh=GIXp3Un6gCk2tdqRQywS+QjQ3DWCya/DIYXQDtsL7bI=; b=Wr82aCKgyXU6D3cfKROsw+dg0N99LdDRdqzDWOZ1/+HzCE7gj/kl/HrWjNeHpvAy1J 1OylVuIMvSkWQrCFHuVUGfpRetMfZ8YRQmC82x4aweyV5GIgldkDXBL2+bo9N4TYt+1V aD0ty5Uy6DtDoctgIgp8jXQfBp5CE6avOE3YXMMh/+E7CXWQtocuKkt34rndK11XVrGe fA/c1P2nso478SusTwqFD5B6kOwHC9ffnJPJn9Rds60TBBpdt3ek3iZtPdM33u1g6CT8 qCA5DxR6bM48xZoxcA6os8wcfaY1fhdCVQ3Ak47k6yY3cQDImYaD3/zUyLC0eW7QaAKw feYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BuKTDh26; spf=pass (google.com: domain of linux-kernel+bounces-14842-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14842-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o7-20020a05622a044700b0042783779803si28485227qtx.441.2024.01.02.13.14.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:14:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14842-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BuKTDh26; spf=pass (google.com: domain of linux-kernel+bounces-14842-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14842-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 06A641C22B3C for ; Tue, 2 Jan 2024 21:14:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB00D199D5; Tue, 2 Jan 2024 21:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BuKTDh26" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCAE018EB4 for ; Tue, 2 Jan 2024 21:09:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f43.google.com with SMTP id ca18e2360f4ac-7bade847536so342478539f.0 for ; Tue, 02 Jan 2024 13:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229740; x=1704834540; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ukfFPOjxIuuxKMITUORsVWUdW86ng+CgXwCq16suFWg=; b=BuKTDh26A6XoTsL9jU4OHGP74zfboMwfa682+h1xxyYoT9Wy7X034wmDLOa2XtgGHj JNnJTueHayzv1E/RFzT1boN8Y1067xCddRoyDnwSi86lGooWovPJ5qzmDFOKvWp7DZNC KTbZD5Zoa8/3Fc58AX59iHYNm4dEDn288uGp0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229740; x=1704834540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ukfFPOjxIuuxKMITUORsVWUdW86ng+CgXwCq16suFWg=; b=K52+dZkqcwUdL33k4c+ykNU8wUHeT5xaWGV5wZr90RMEwtUK5C+lS6ddG2qBcTVoLc JnLbkKCGkC4HMDLXSoBpTdF4EzRAxf3hYnQp5njVc0qO/4q4Co+NbrHaW6HKJEotwQb3 Lf/E32cMk6D29mRWojNQhYZ0lytJ3aERZS3HM3sTTyxtfQ4ED+eyOVSLlumvPXoVGLrt Aa5ZFXB5qZKJ+4gtvm65AUFm06ZIoFJ49ZbO1viq/gWHS5tjc+tX/SkZmKowBjaXa2o3 tML1v8HexstfoMTPIb5EFERjFoGljyudhNmLzxBFd8UwTWVr3hdMBtMLiWmCUgA1Fnsk 8j6Q== X-Gm-Message-State: AOJu0YyrsPQfNixsVE/3fKMIV3UOHfGgo038iL7ASkudUQW6aSh4A1sQ 1zEQ88GMgKCNa9y3fe/ZzINBgUIbMYtK+KQVj/cM4ZK8A1+O X-Received: by 2002:a5d:9a17:0:b0:7bb:41bd:715f with SMTP id s23-20020a5d9a17000000b007bb41bd715fmr12202311iol.39.1704229739844; Tue, 02 Jan 2024 13:08:59 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:59 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Frank Rowand , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v4 18/24] of: irq: add wake capable bit to of_irq_resource() Date: Tue, 2 Jan 2024 14:07:42 -0700 Message-ID: <20240102140734.v4.18.I29b26a7f3b80fac0a618707446a10b6cc974fdaf@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014745978577063 X-GMAIL-MSGID: 1787014745978577063 Add wake capability information to the IRQ resource. Wake capability is assumed based on conventions provided in the devicetree wakeup-source binding documentation. An interrupt is considered wake capable if the following are true: 1. A wakeup-source property exits in the same device node as the interrupt. 2. The IRQ is marked as dedicated by setting its interrupt-name to "wakeup". The wakeup-source documentation states that dedicated interrupts can use device specific interrupt names and device drivers are still welcome to use their own naming schemes. This API is provided as a helper if one is willing to conform to the above conventions. The ACPI subsystems already provides similar APIs that allow one to query the wake capability of an IRQ. This brings closer feature parity to the devicetree. Reviewed-by: Rob Herring Signed-off-by: Mark Hasemeyer --- Changes in v4: -Add Rob's Reviewed-by tag from v2 -Ignored Andy's Reviewed-by tag per his request: https://lore.kernel.org/all/ZYxgQn8L7ENkc0AJ@smile.fi.intel.com/ Changes in v3: -Use DEFINE_RES_IRQ_NAMED_FLAGS macro Changes in v2: -Update logic to return true only if wakeup-source property and "wakeup" interrupt-name are defined -irq->IRQ, api->API drivers/of/irq.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 174900072c18c..cdecdc3515f88 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -383,11 +383,39 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar } EXPORT_SYMBOL_GPL(of_irq_parse_one); +/** + * __of_irq_wake_capable - Determine whether a given IRQ index is wake capable + * + * The IRQ is considered wake capable if the following are true: + * 1. wakeup-source property exists + * 2. provided IRQ index is labelled as a dedicated wakeirq + * + * This logic assumes the provided IRQ index is valid. + * + * @dev: pointer to device tree node + * @index: zero-based index of the IRQ + * Return: True if provided IRQ index for #dev is wake capable. False otherwise. + */ +static bool __of_irq_wake_capable(const struct device_node *dev, int index) +{ + int wakeindex; + + if (!of_property_read_bool(dev, "wakeup-source")) + return false; + + wakeindex = of_property_match_string(dev, "interrupt-names", "wakeup"); + return wakeindex >= 0 && wakeindex == index; +} + /** * of_irq_to_resource - Decode a node's IRQ and return it as a resource * @dev: pointer to device tree node - * @index: zero-based index of the irq + * @index: zero-based index of the IRQ * @r: pointer to resource structure to return result into. + * + * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or + * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case + * of any other failure. */ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) { @@ -399,6 +427,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) /* Only dereference the resource if both the * resource and the irq are valid. */ if (r && irq) { + u32 irq_flags; const char *name = NULL; memset(r, 0, sizeof(*r)); @@ -409,9 +438,11 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) of_property_read_string_index(dev, "interrupt-names", index, &name); - r->start = r->end = irq; - r->flags = IORESOURCE_IRQ | irqd_get_trigger_type(irq_get_irq_data(irq)); - r->name = name ? name : of_node_full_name(dev); + irq_flags = irqd_get_trigger_type(irq_get_irq_data(irq)); + if (__of_irq_wake_capable(dev, index)) + irq_flags |= IORESOURCE_IRQ_WAKECAPABLE; + + *r = DEFINE_RES_IRQ_NAMED_FLAGS(irq, name ?: of_node_full_name(dev), irq_flags); } return irq; From patchwork Tue Jan 2 21:07:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4686642dyb; Tue, 2 Jan 2024 13:14:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8ZnGqAGbtOuegmxCkggx3yu88e9BTuE+PV16zOskMlCOGZQsre9XJmX//xBPnW9BFb/q8 X-Received: by 2002:ad4:4eed:0:b0:67f:7804:9511 with SMTP id dv13-20020ad44eed000000b0067f78049511mr122305qvb.24.1704230078945; Tue, 02 Jan 2024 13:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230078; cv=none; d=google.com; s=arc-20160816; b=rJPshuIKHILLahXcjjrqTiy2Q/zOTK5/t1FvkdhAwXXysBfYizsi0cMPdj3ktcxhW7 nLHUtrWztnGMNB7ov8aTyo4QWjve5MSn5H+U5lUXbkmhzRkX5xMws3V9EUTnaimdUNYn CvY262Y/0VGdA2MuOvTutebyPtpExamPXyt6E1tNAXNzys2LHUCwmnSv0rRjJvXkbJ4A I0nP0SxN8Kr7A3+H/xaoym64QrgMKxbF7BDTXbBmfW4LZt/Ty5gNJ5C05iujb/WAimTW TfUNmxjOx6qb7q74XxPGveldKwS7oLoMQQCmiRza0gx5iCazTG7YWMWjTmJNlBJhmfVv rhTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=mrqyCRQGWqtYZon/B8x6Cl4Beyi5N2srdFtijVb67bM=; fh=GIXp3Un6gCk2tdqRQywS+QjQ3DWCya/DIYXQDtsL7bI=; b=Q0tvFXiNigugd3t5qNi5WAZn4BfMh6OK1O8hwoVYi69gUblKYNNb0DGFqtbM6pHEMt 4FzyReVPj22wFL6j0lfsWho7sWT9b4vRmuA7JBb+WQGj+VdbpHu5nSN2qaVJj7h8emdq 9QAkMbfuhbawXjVdOic7fRg500CqyZs73hzyu6JG4OeOp2RqxY5qqX1oXHYWwqG66qo9 N5qL6iyzG+gOvW7zAy+Oxv3T4n2JjVg4v0bwKjKpEVbVRn9GodTGe9lQIZLsSa70sZzR KR5x/qFRPwjAH6VDliQWHg0TJuF+5PAHbyclOVAKW3HCvl2Bbhii9XSD91yTX8Ndo1eI NuUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Jd+OrY9Y; spf=pass (google.com: domain of linux-kernel+bounces-14843-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14843-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pj15-20020a05620a1d8f00b0077dba4b9e95si27016653qkn.742.2024.01.02.13.14.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:14:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14843-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Jd+OrY9Y; spf=pass (google.com: domain of linux-kernel+bounces-14843-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14843-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B8D7A1C22B0F for ; Tue, 2 Jan 2024 21:14:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8715219478; Tue, 2 Jan 2024 21:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Jd+OrY9Y" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8350218ECB for ; Tue, 2 Jan 2024 21:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-35fe47edd2eso20695865ab.0 for ; Tue, 02 Jan 2024 13:09:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229740; x=1704834540; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mrqyCRQGWqtYZon/B8x6Cl4Beyi5N2srdFtijVb67bM=; b=Jd+OrY9YWz3i/Dgd40CfK61o+Ojf3v5aYpvPs2XixprcNnM76DiksrFsbbvnYCw1F/ NsxXHGO/4IdweWWLAfvIFHf3LCILdaCKVxlgufoMIRO5YwRMy8+w1Zs+GD/2UzJNi/6Q 4C4KqXzv4tj0m1mlNjS+7c7LM29ibY27GoC8Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229740; x=1704834540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mrqyCRQGWqtYZon/B8x6Cl4Beyi5N2srdFtijVb67bM=; b=g99TlKcnX2a86hOv18ZUq9wlLTmnot74zH2AdQJ4aL/2MTgEyF8k6ibq6n7BWpsgFq HB3PazDILxhqh8o2rhVNNKXWJeB3cqO4iw71chEnGSAI9UmdAKzDbeZsNgGeAlLX/Vjo XBisXZV7DvUWbL/gDmmWKPfgWcgYcCptlhDY7OTMb2Jq4cC80XmDzDQpjkWTBAC9GwIl Ip7DfbcTWu6poRw0pI37vkmu9Fir6vnlB3fZhAIQ29YfMBzwg6i1ImPuLW/mU8zYYeK2 EPmEmkZY+/SyubtfDpwnOGLWNx17dpMWL1RETthERuM2g48k4ytHRvHAPo1U+hXW+mNm S/Kg== X-Gm-Message-State: AOJu0YywHGWtmbFru5tYoH3HFXKCU2rmaYNrC6nlF9JtrLoOAT6vTtxa VFnx/RhGR6HzYnyVOVlm5tx9OlcnfESFZ0U3jK1rjGzFQNBL X-Received: by 2002:a05:6e02:1a0e:b0:35d:59b3:2f7d with SMTP id s14-20020a056e021a0e00b0035d59b32f7dmr40919ild.18.1704229740602; Tue, 02 Jan 2024 13:09:00 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:00 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Frank Rowand , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v4 19/24] of: irq: Add default implementation for of_irq_to_resource() Date: Tue, 2 Jan 2024 14:07:43 -0700 Message-ID: <20240102140734.v4.19.I31d4dd6a7e5a3e5eee05c87b358e63cd1aa0e467@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014759102006821 X-GMAIL-MSGID: 1787014759102006821 Similar to of_irq_to_resource_table(), add a default implementation of of_irq_to_resource() for systems that don't have CONFIG_OF_IRQ defined. Acked-by: Rob Herring Signed-off-by: Mark Hasemeyer --- Changes in v4: -Add Rob's Ack tag from v2 include/linux/of_irq.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index d6d3eae2f1452..0d73b2ca92d31 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -34,8 +34,6 @@ static inline int of_irq_parse_oldworld(const struct device_node *device, int in extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq); extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data); -extern int of_irq_to_resource(struct device_node *dev, int index, - struct resource *r); #ifdef CONFIG_OF_IRQ extern void of_irq_init(const struct of_device_id *matches); @@ -44,6 +42,7 @@ extern int of_irq_parse_one(struct device_node *device, int index, extern int of_irq_count(struct device_node *dev); extern int of_irq_get(struct device_node *dev, int index); extern int of_irq_get_byname(struct device_node *dev, const char *name); +extern int of_irq_to_resource(struct device_node *dev, int index, struct resource *r); extern int of_irq_to_resource_table(struct device_node *dev, struct resource *res, int nr_irqs); extern struct device_node *of_irq_find_parent(struct device_node *child); @@ -76,6 +75,11 @@ static inline int of_irq_get_byname(struct device_node *dev, const char *name) { return 0; } +static inline int of_irq_to_resource(struct device_node *dev, int index, + struct resource *r) +{ + return 0; +} static inline int of_irq_to_resource_table(struct device_node *dev, struct resource *res, int nr_irqs) { From patchwork Tue Jan 2 21:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4686761dyb; Tue, 2 Jan 2024 13:14:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvhXlpawCxJ2JaacTQgk6rpFU5Hy8C7WlQRyrDG24MjyPbbqDU/GM4Yi8xQYrqFZj9UioN X-Received: by 2002:a05:6122:d07:b0:4b6:c9fa:d8e4 with SMTP id az7-20020a0561220d0700b004b6c9fad8e4mr7420867vkb.31.1704230095737; Tue, 02 Jan 2024 13:14:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230095; cv=none; d=google.com; s=arc-20160816; b=vcgWBYCkuSxxr3Fu3E65pfxrKKo8uiBv/55hbHEXy7Fk/xWb+lKISdEOuppbTdtweg bstbv28XuXV1hPIr+0cvbCSpplfygyx9EfiIn3amOCgzSGU0Ow8n8msGsDquj9dXBNVs CQorqGwT/ZUPahLU7FGHjjGssgMNxL44jtqp3mPvHeze3m/w0oRCEKPTSP7+nybcyLf0 0Jd9Ib/rG9AgLwNJUur/cAp1NFHkHJWFIUlnBiDC1LAy2fc4e9dNZzuiDWKmDaRMI//n qpbP4jhH7Vsyk66ZJSYBKGq3Xzu/SWisTNvF7cbb9oF5AVfEYE0vsN/mX13QsTJYlwEL vFdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yuhkCzL2l+Es2a6yZtXMYTtf834z1coLX69xx0eVIxw=; fh=GIXp3Un6gCk2tdqRQywS+QjQ3DWCya/DIYXQDtsL7bI=; b=0ZAaIWziwtAZoaKktG0hMnOIUQKx6/AP6m59hQWAEkxNeMMrl3CT5j2XWKShEY+3ye uaIFJXy11tCVEpdl0HsdI76R8wUHrxpBLgoisq3Vdg0dUUkhG6LBRMEVzHxLzYa1J/dP dv1oHhizdcCORaummfEl0tShmIpZOZmqJIVzpM/qRBoKuKMdYsevBGQqjDZcW5tKzFZM hjO2BKzbmsxUEKOu6fWE2PrQg1pJCkM+1N04ZhYac7Il2WckstqHJw43jsYr94Er0LP5 GbUUP8udjB2FCSiZQZFWg/OWl8nzSjGgFRZ3uldvlKzYvcdpNigOLKYlgOR+sAAwRp5D GDJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PcMWXXwG; spf=pass (google.com: domain of linux-kernel+bounces-14844-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14844-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pj15-20020a05620a1d8f00b0077dba4b9e95si27016653qkn.742.2024.01.02.13.14.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:14:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14844-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PcMWXXwG; spf=pass (google.com: domain of linux-kernel+bounces-14844-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14844-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 398BE1C22B4D for ; Tue, 2 Jan 2024 21:14:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E8901A282; Tue, 2 Jan 2024 21:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PcMWXXwG" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45E2818ED5 for ; Tue, 2 Jan 2024 21:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7b7fb34265fso491742739f.3 for ; Tue, 02 Jan 2024 13:09:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229741; x=1704834541; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yuhkCzL2l+Es2a6yZtXMYTtf834z1coLX69xx0eVIxw=; b=PcMWXXwGKxi3lOnc4PVx41Mbqm//fWa3Q8P5FK/aWfOfM4ABtshA+gXmY6cY5tkNqe A8sIKKRrVMk2Wgz+YPZcl7R+2GAF0KdMU6rHV5xr1AJt55NCYK65MqZ7LBZzmpSh0iC2 qwsim/jG2f+82HVKObdmWlOw9oG0hMp41Y5Cg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229741; x=1704834541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yuhkCzL2l+Es2a6yZtXMYTtf834z1coLX69xx0eVIxw=; b=KnLDm2vCvl/Dffv31Fzhgn3E3Ebwy5BFAsVPRgvRjLgx9YQLn9wygLexpPtVpOTHmv fInLxsbP9NPEBz3uaJNUgPAQuqOtLXNwJD7dccFMII7R7hvYa244haA0TFR6ViKXk8R6 dYKQco9l9tEl4fvQzhnXC1cmxeRx4XX58iD2MCsUextUWxp27N+vhBjvLHoi0N0r3sZ9 o0np4GRQaJGxKk1NSM7IAjJMQFOKr5Bha1/yyxbFWuvdDcWAHlzjhaWdI3x5mJrAyTrT wuRjRvZA5EP8MDLggyTBiR+wYzb/TMWYouSsngtFAqdV0wBd0g/8Yuge/J+PpC6DNTN8 +xLg== X-Gm-Message-State: AOJu0YwH0eHZPn4HmfdGE7wRDcNKOLK/up3uX8QNg0h8eTjgoqZRbNZr axCY05uiQfuGod8we9ms/xqY3dstBMIAkStE+48Au/u7qjOZ X-Received: by 2002:a05:6602:1492:b0:7b7:be85:23c with SMTP id a18-20020a056602149200b007b7be85023cmr25585003iow.30.1704229741350; Tue, 02 Jan 2024 13:09:01 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:01 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Frank Rowand , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v4 20/24] of: irq: Remove extern from function declarations Date: Tue, 2 Jan 2024 14:07:44 -0700 Message-ID: <20240102140734.v4.20.I319e781c11e6352eb5b6c408dc20bd54a720edbf@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014776672725389 X-GMAIL-MSGID: 1787014776672725389 The extern keyword is implicit for function declarations. Remove it where possible and adjust the line wrapping accordingly. Acked-by: Rob Herring Signed-off-by: Mark Hasemeyer --- Changes in v4: -Add Rob's Ack tag from v2 Changes in v2: -New patch include/linux/of_irq.h | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index 0d73b2ca92d31..a130dcbc4bb45 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -32,27 +32,26 @@ static inline int of_irq_parse_oldworld(const struct device_node *device, int in } #endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ -extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq); -extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data); +int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq); +unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data); #ifdef CONFIG_OF_IRQ -extern void of_irq_init(const struct of_device_id *matches); -extern int of_irq_parse_one(struct device_node *device, int index, - struct of_phandle_args *out_irq); -extern int of_irq_count(struct device_node *dev); -extern int of_irq_get(struct device_node *dev, int index); -extern int of_irq_get_byname(struct device_node *dev, const char *name); -extern int of_irq_to_resource(struct device_node *dev, int index, struct resource *r); -extern int of_irq_to_resource_table(struct device_node *dev, - struct resource *res, int nr_irqs); -extern struct device_node *of_irq_find_parent(struct device_node *child); -extern struct irq_domain *of_msi_get_domain(struct device *dev, +void of_irq_init(const struct of_device_id *matches); +int of_irq_parse_one(struct device_node *device, int index, + struct of_phandle_args *out_irq); +int of_irq_count(struct device_node *dev); +int of_irq_get(struct device_node *dev, int index); +int of_irq_get_byname(struct device_node *dev, const char *name); +int of_irq_to_resource(struct device_node *dev, int index, struct resource *r); +int of_irq_to_resource_table(struct device_node *dev, struct resource *res, + int nr_irqs); +struct device_node *of_irq_find_parent(struct device_node *child); +struct irq_domain *of_msi_get_domain(struct device *dev, struct device_node *np, enum irq_domain_bus_token token); -extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev, - u32 id, - u32 bus_token); -extern void of_msi_configure(struct device *dev, struct device_node *np); +struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 id, + u32 bus_token); +void of_msi_configure(struct device *dev, struct device_node *np); u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in); #else static inline void of_irq_init(const struct of_device_id *matches) @@ -117,7 +116,7 @@ static inline u32 of_msi_map_id(struct device *dev, * implements it differently. However, the prototype is the same for all, * so declare it here regardless of the CONFIG_OF_IRQ setting. */ -extern unsigned int irq_of_parse_and_map(struct device_node *node, int index); +unsigned int irq_of_parse_and_map(struct device_node *node, int index); #else /* !CONFIG_OF && !CONFIG_SPARC */ static inline unsigned int irq_of_parse_and_map(struct device_node *dev, From patchwork Tue Jan 2 21:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4687620dyb; Tue, 2 Jan 2024 13:16:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/aATXT1JS441VcjIfYWk7LtktXJ7MgjL8Gyjh8g+n1uLT2sb3IzFBlWRs78CkVVYnO+Uz X-Received: by 2002:a05:6870:494f:b0:203:3636:247 with SMTP id fl15-20020a056870494f00b0020336360247mr22177149oab.66.1704230212900; Tue, 02 Jan 2024 13:16:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230212; cv=none; d=google.com; s=arc-20160816; b=N3Iiu0y9VWEO7ZjIfZk4bu5qZfa8zn+dysc3VeGmxG4+uUcIz6vqzSZpYzDrL5Wd8Q Eae253+tiBKdEezmlK8K2Dk865VEhpDJZ8NN5NNSV9tyCK2vGV8iEy8VHH/lw8sjtDlQ d8bgHt5X6l1kdK2Sy2A+otU2pLOXwlrb8MEcTTWAGWYdA/nTsRafEEAVF41UMc6y98Zb vt+mJxxMA0ApD+r1p3i+0frPBw6826Lp8p9+EnEPSMt9q0jAvaobgqideeiZEaA/EtuL b6NKBZoMl/GjPzl3MqafD+irFB+j/+fgKWtPseTdsJH0AS1BmjQkiUnOi6XFHezHj6qr dmJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/6j1jotrF6PIPGIyj1YNZnkSmwkK1WAFrbZbjbyI7go=; fh=3HWw2L7b6T1mgu8C4E/gLCi1rse7/TCshhW8RcyjIB0=; b=pNRTzlW9anOIf4BZM6FrPM2nk8QnvGtPcRFncHaXNjevpHrulw+nBZzDIwxlON2MGt 6WNIJgxXrZKXLhcqRk1MZq5ohLITOTcU/u1BpUlM9EsEi9OnlWFksQiP11gg7zF7ex3G PfXhrZGheUqkPS8jzYtAWC0rKY/r7OGRxQn639dfhKaRHVPMfdHV3VaqywQFMdWM8ZwJ HYAoUlAx4XLepYhM6lw6QHxIwLmdYBt3i02o69MNyfM6s7wG2oAflNcES617jeFXGCr5 kR4P2IYEcsVZvPEQ45ERVNc2Ef4fWYW6ywm3d6eC7SInL9pRV0kvdu1Oe20tN3zQrme0 yx+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VTa2leDx; spf=pass (google.com: domain of linux-kernel+bounces-14845-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14845-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k68-20020a632447000000b005ce16d1f0d1si14770862pgk.459.2024.01.02.13.16.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14845-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VTa2leDx; spf=pass (google.com: domain of linux-kernel+bounces-14845-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14845-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A4D5FB22874 for ; Tue, 2 Jan 2024 21:15:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 679821A59D; Tue, 2 Jan 2024 21:09:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VTa2leDx" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5986319472 for ; Tue, 2 Jan 2024 21:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7ba8f139522so493862939f.1 for ; Tue, 02 Jan 2024 13:09:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229742; x=1704834542; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/6j1jotrF6PIPGIyj1YNZnkSmwkK1WAFrbZbjbyI7go=; b=VTa2leDxBK9KlSyJAN+wQVXeA1P9mITLlz8byiLbkbleOsU2gLTU7X0nQz3gcCCSE0 wj/aQkuDG9REKxEHVAzkvWZ/OldAVYC4tkeCsOvgyWxv2QPLLgy8aelwkID87NWiFtzW +YHSpuj+3e2XnAHEZjOe4kTixkYZQnfUHEn40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229742; x=1704834542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/6j1jotrF6PIPGIyj1YNZnkSmwkK1WAFrbZbjbyI7go=; b=GCQOgvu1hEQN9mW/7awOK3p72pCMmfqXmid60xFui1Z45wXu9Kz51JC3RMIrNsi2Pa N4UtMQ2URyfhXtHm5G0J6BA+s2sgu6dI4Ai7qNFgHexlvZjd/b55DN4oAAe0pLO4Ox7O HRoioUtOavQ+AtCwQIkhl0RFLOOjjUydF8A+EUNlLtlJV98UEEyHscf4Br4csVTd677t l/C9ikSlZevterovI1y/GgI4TWIOveC/IYPqkLF2DCFsp2iYnixhDWf77ZmzQI6FHkp2 +l0ufpqiUyGI3LMJaRUDwo9F+wGqCWTu3V1svq9XnZJ2+xVcbJRnl+7gWZXRTurfce68 XHXQ== X-Gm-Message-State: AOJu0YwzmjKQXqqx0E3cGQsJe09dhUOU3LY02LOUsOvwhvzXotGxaeB/ 6+f3RRQgdXau/ep1h95fswlge0YHQVN524HBL6WQvJ30wdYe X-Received: by 2002:a05:6602:19cf:b0:7ba:8706:3413 with SMTP id ba15-20020a05660219cf00b007ba87063413mr23570270iob.41.1704229742417; Tue, 02 Jan 2024 13:09:02 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:02 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Andy Shevchenko , Sakari Ailus , Daniel Scally , Frank Rowand , Greg Kroah-Hartman , Heikki Krogerus , Len Brown , "Rafael J. Wysocki" , Rob Herring , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH v4 21/24] device property: Modify fwnode irq_get() to use resource Date: Tue, 2 Jan 2024 14:07:45 -0700 Message-ID: <20240102140734.v4.21.I38ac58ab04985a404ed6551eb5813fa7841ef410@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014899738481350 X-GMAIL-MSGID: 1787014899738481350 The underlying ACPI and OF subsystems provide their own APIs which provide IRQ information as a struct resource. This allows callers to get more information about the IRQ by looking at the resource flags. For example, whether or not an IRQ is wake capable. Suggested-by: Andy Shevchenko Reviewed-by: Sakari Ailus Signed-off-by: Mark Hasemeyer Reviewed-by: Andy Shevchenko Reviewed-by: Rob Herring --- Changes in v4: -Add Sakari's Reviewed-by tag from v2 -Remove ioport.h dependency in fwnode.h -Use Andy's @linux.intel.com email Changes in v3: -Add Suggested-by tag -Initialize struct resource to 0 on stack -EXPORT_SYMBOL()->EXPORT_SYMBOL_GPL() -Remove extra space in commit message -Reformat fwnode_irq_get_resource() declaration Changes in v2: -New patch drivers/acpi/property.c | 11 +++++------ drivers/base/property.c | 32 +++++++++++++++++++++++++------- drivers/of/property.c | 8 ++++---- include/linux/fwnode.h | 8 +++++--- include/linux/property.h | 2 ++ 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index a6ead5204046b..891fff5a16797 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -1627,17 +1627,16 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, return 0; } -static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode, - unsigned int index) +static int acpi_fwnode_irq_get_resource(const struct fwnode_handle *fwnode, unsigned int index, + struct resource *r) { - struct resource res; int ret; - ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res); + ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, r); if (ret) return ret; - return res.start; + return r->start; } #define DECLARE_ACPI_FWNODE_OPS(ops) \ @@ -1664,7 +1663,7 @@ static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode, acpi_graph_get_remote_endpoint, \ .graph_get_port_parent = acpi_fwnode_get_parent, \ .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \ - .irq_get = acpi_fwnode_irq_get, \ + .irq_get_resource = acpi_fwnode_irq_get_resource, \ }; \ EXPORT_SYMBOL_GPL(ops) diff --git a/drivers/base/property.c b/drivers/base/property.c index a1b01ab420528..441899171d19d 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1046,6 +1046,29 @@ void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index) } EXPORT_SYMBOL(fwnode_iomap); +/** + * fwnode_irq_get_resource - Get IRQ directly from a fwnode and populate + * the resource struct + * @fwnode: Pointer to the firmware node + * @index: Zero-based index of the IRQ + * @r: Pointer to resource to populate with IRQ information. + * + * Return: Linux IRQ number on success. Negative errno on failure. + */ +int fwnode_irq_get_resource(const struct fwnode_handle *fwnode, unsigned int index, + struct resource *r) +{ + int ret; + + ret = fwnode_call_int_op(fwnode, irq_get_resource, index, r); + /* We treat mapping errors as invalid case */ + if (ret == 0) + return -EINVAL; + + return ret; +} +EXPORT_SYMBOL_GPL(fwnode_irq_get_resource); + /** * fwnode_irq_get - Get IRQ directly from a fwnode * @fwnode: Pointer to the firmware node @@ -1055,14 +1078,9 @@ EXPORT_SYMBOL(fwnode_iomap); */ int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index) { - int ret; + struct resource r = {}; - ret = fwnode_call_int_op(fwnode, irq_get, index); - /* We treat mapping errors as invalid case */ - if (ret == 0) - return -EINVAL; - - return ret; + return fwnode_irq_get_resource(fwnode, index, &r); } EXPORT_SYMBOL(fwnode_irq_get); diff --git a/drivers/of/property.c b/drivers/of/property.c index afdaefbd03f61..864ea5fa5702b 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1425,10 +1425,10 @@ static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index) #endif } -static int of_fwnode_irq_get(const struct fwnode_handle *fwnode, - unsigned int index) +static int of_fwnode_irq_get_resource(const struct fwnode_handle *fwnode, + unsigned int index, struct resource *r) { - return of_irq_get(to_of_node(fwnode), index); + return of_irq_to_resource(to_of_node(fwnode), index, r); } static int of_fwnode_add_links(struct fwnode_handle *fwnode) @@ -1469,7 +1469,7 @@ const struct fwnode_operations of_fwnode_ops = { .graph_get_port_parent = of_fwnode_graph_get_port_parent, .graph_parse_endpoint = of_fwnode_graph_parse_endpoint, .iomap = of_fwnode_iomap, - .irq_get = of_fwnode_irq_get, + .irq_get_resource = of_fwnode_irq_get_resource, .add_links = of_fwnode_add_links, }; EXPORT_SYMBOL_GPL(of_fwnode_ops); diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 2a72f55d26eb8..b82c9c072bcc9 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -9,12 +9,13 @@ #ifndef _LINUX_FWNODE_H_ #define _LINUX_FWNODE_H_ -#include -#include #include #include +#include +#include struct fwnode_operations; +struct resource; struct device; /* @@ -164,7 +165,8 @@ struct fwnode_operations { int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode, struct fwnode_endpoint *endpoint); void __iomem *(*iomap)(struct fwnode_handle *fwnode, int index); - int (*irq_get)(const struct fwnode_handle *fwnode, unsigned int index); + int (*irq_get_resource)(const struct fwnode_handle *fwnode, + unsigned int index, struct resource *r); int (*add_links)(struct fwnode_handle *fwnode); }; diff --git a/include/linux/property.h b/include/linux/property.h index e6516d0b7d52a..685ba72a8ce9e 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -190,6 +190,8 @@ struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode); void fwnode_handle_put(struct fwnode_handle *fwnode); int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index); +int fwnode_irq_get_resource(const struct fwnode_handle *fwnode, + unsigned int index, struct resource *r); int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name); unsigned int device_get_child_node_count(const struct device *dev); From patchwork Tue Jan 2 21:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4686923dyb; Tue, 2 Jan 2024 13:15:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVuTGFDGVH1KvOHxb+VaRWO6+T0KMsa6Rd4VQWSaLOHTqG/mDac886pUOyH7idVZ6/ZVrX X-Received: by 2002:ac8:5787:0:b0:428:3133:71a7 with SMTP id v7-20020ac85787000000b00428313371a7mr1478580qta.49.1704230120735; Tue, 02 Jan 2024 13:15:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230120; cv=none; d=google.com; s=arc-20160816; b=0xl8EW3n1UkHbNDd+hlj1Nu3wJAH9YTSnMuTPfEJ+j9iwroF/69WLws1ok1DMuC+ET mX6dOEjjJXFoeoq8w716xD1QEaLBXNBQt+CZZb8rpI9hi8d9rooxh3yytNeBI9/NjMFY By6ciLolX/FgVEy24yrRL4zJ6kF24R75wMj30zOtC36IRddO96dM/kqVV2q54cNM5osW HVes91MMRZTfDty+x0GZmO3EhARI80f5bdvj3GkQ6txOendBf25ODOCx4xi8gURWn9rH 1JVU92bkFOb3NuM7v+PTB4h39/KUpezeDU9oQIh3l8/VX0sglOJUASVnPXRTvgPRYmMJ n/mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sCG4rEgr/FQR7hxUStyYKIoU69lpCt3KIAVsm7R5chw=; fh=7ED9cFxIzMb121hW6YnNsY862rb3fkYAGjskaOF/DEI=; b=lc9aY0QpEFqsGOG93eWbtG1sghqNrs08W0wj2UTgGz8NK8ObH5v2NqM5mvlTdkipIF jftOEEdWEllriYC1lKTuGE3V/Ho70Rn1jCtdYEixxvdQJiLics4rzajKQnp7NbOvP0UF 6N58iYkO84/JX9zddp443gcX+XxtfH6jH3vIBcg1KQLjvBft0ukWKQMQUi82h4Yo/LZ/ NNQx6/Z/prCGoN+1jndjcSoC5K+QqDdbpXF3YL1C13LxSAKZNwJ+OYhylMKBSYKXbQJ1 hhbxUMCMrV84ysKT3LTsJ27wea5dbMOyH2LcpV8nCB4iFINbXQFbqH2lhd74nhCPfVJb Pxtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HH7tFOjr; spf=pass (google.com: domain of linux-kernel+bounces-14846-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14846-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a8-20020ac85b88000000b00428138cfcffsi7367216qta.801.2024.01.02.13.15.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:15:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14846-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HH7tFOjr; spf=pass (google.com: domain of linux-kernel+bounces-14846-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14846-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 87A1D1C21600 for ; Tue, 2 Jan 2024 21:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CEB41A5B9; Tue, 2 Jan 2024 21:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HH7tFOjr" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A636199BE for ; Tue, 2 Jan 2024 21:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-7b7f2c72846so491266539f.2 for ; Tue, 02 Jan 2024 13:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229743; x=1704834543; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sCG4rEgr/FQR7hxUStyYKIoU69lpCt3KIAVsm7R5chw=; b=HH7tFOjrAQTrdWIDJwg39s5pkcy+elPqqdPyYMArPhsxRixM6h/JAHq2NBec+JYJFq FTxNbr7+7HxnH6nIBXll3KHOSWFKmb+e2ZSYN6iUv/i8s3ZhVyaO0l1Oxxt6C/22osve gvQJlJC5UXoxyrkSr6+QTVvy+fITN4RdMHCdw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229743; x=1704834543; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sCG4rEgr/FQR7hxUStyYKIoU69lpCt3KIAVsm7R5chw=; b=e7+OFnxzdL9O6o4Re7IFq0OAJPfvlL9RixD1edDMhkPiknVepAQ2D050CDxKPKnSDp iTR0I0ui67T2QdBJJ2mAUhnKBkRWwMJgk9+DMZaxvJZbk9utjTyxCA4c9Jg0BvmbQw1Z NIV6fjeKm7OaSnjuE5nAflC6bNrkMhV435uPyA+vhnyaOwrdK+6gWttGU0r/9pb3Vjpf oLLPysy8GiKZc5BvFDqWqEKJxaObfL5T0WuEdTqRJwjgvVx7Ue0rgz2Uw6Uy+2tHM9mP ww+dioow60aMviCYBqkJg8JxVxQBy3PdlIVjIF1nF1W8gn6uXlz5NIymi9chksWqLCEp zZJg== X-Gm-Message-State: AOJu0Yw8FkTaNdajUiIVtiXDJHtniX2snjho0GpW5xZxVFw/4Km++csW pNR2SAU38NnRwNqJn8CY/pz4yHgnor/cSld21k9PY0ulM+rd X-Received: by 2002:a6b:c996:0:b0:7b7:fe2f:dddd with SMTP id z144-20020a6bc996000000b007b7fe2fddddmr18896089iof.22.1704229743320; Tue, 02 Jan 2024 13:09:03 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:03 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Sakari Ailus , Andy Shevchenko , Daniel Scally , Greg Kroah-Hartman , Heikki Krogerus , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org Subject: [PATCH v4 22/24] device property: Update functions to use EXPORT_SYMBOL_GPL() Date: Tue, 2 Jan 2024 14:07:46 -0700 Message-ID: <20240102140734.v4.22.I186bc5737c5ac4c3a5a7a91e9ec75645e723ca7b@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014803173965849 X-GMAIL-MSGID: 1787014803173965849 Some of the exported functions use EXPORT_SYMBOL() instead of EXPORT_SYMBOL_GPL() and are inconsistent with the other exported functions in the module. The underlying APCI/OF struct fwnode_operations implementations are also exported via EXPORT_SYMBOL_GPL(). Update them to use the EXPORT_SYMBOL_GPL() macro. Suggested-by: Sakari Ailus Reviewed-by: Andy Shevchenko Signed-off-by: Mark Hasemeyer Reviewed-by: Sakari Ailus --- Changes in v4: -EXPORT_SYMBOL->EXPORT_SYMBOL() -Add Andy's Reviewed-by tag Changes in v3: -New patch drivers/base/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index 441899171d19d..4f686516cac82 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1044,7 +1044,7 @@ void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index) { return fwnode_call_ptr_op(fwnode, iomap, index); } -EXPORT_SYMBOL(fwnode_iomap); +EXPORT_SYMBOL_GPL(fwnode_iomap); /** * fwnode_irq_get_resource - Get IRQ directly from a fwnode and populate @@ -1082,7 +1082,7 @@ int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index) return fwnode_irq_get_resource(fwnode, index, &r); } -EXPORT_SYMBOL(fwnode_irq_get); +EXPORT_SYMBOL_GPL(fwnode_irq_get); /** * fwnode_irq_get_byname - Get IRQ from a fwnode using its name @@ -1110,7 +1110,7 @@ int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name) return fwnode_irq_get(fwnode, index); } -EXPORT_SYMBOL(fwnode_irq_get_byname); +EXPORT_SYMBOL_GPL(fwnode_irq_get_byname); /** * fwnode_graph_get_next_endpoint - Get next endpoint firmware node @@ -1355,7 +1355,7 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint); } -EXPORT_SYMBOL(fwnode_graph_parse_endpoint); +EXPORT_SYMBOL_GPL(fwnode_graph_parse_endpoint); const void *device_get_match_data(const struct device *dev) { From patchwork Tue Jan 2 21:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4687044dyb; Tue, 2 Jan 2024 13:15:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8CtI3B+KSzu1V8Y0e7A2/2W0s+qIRbw8AItOhhX7ZjxxU9VZWr7uvGAXJVP1W0di1sEv2 X-Received: by 2002:a17:907:1b24:b0:a26:ef06:361e with SMTP id mp36-20020a1709071b2400b00a26ef06361emr7760280ejc.134.1704230136354; Tue, 02 Jan 2024 13:15:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230136; cv=none; d=google.com; s=arc-20160816; b=rxaWxXBb+WQBfv3CnaDsjofxxoTfQ0vIppDTcVNTfD6rOW0WU08PH2a45vXMIXJIAb 5SHYoiE/h1vmANz1maluEuzp3/YIkGJEDFQoAC94MXcqka3jw90ArdEX9HRTQwRvzZdG 0D0Zx18mzAi+czv0bQouTofK8jQ//kNfGD42OumonDnGIlgM86YG/ANeKRFM3mlHwbgW ZyW4NuqyQs2HXlnGo3YSims4+S1lYyilEW44QYbvGQ0VlnftK2axgcen3nPM5pVgVyHj x1RTi4nv/uYNm+dbrFs/QPGxyJ6leb6KnG1wdfTvIpDF8zth/uUedFfziCjrnTPz8O2O YmIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/Hw1xlFNdgkxULgKG3GwEV3Tvyifb1Pre98NYX4zJtY=; fh=HWG3Tv4UVMULqE6QtIrB0gzRWQzhpLvkujXzcxpQDBk=; b=QLqzS0qc5r+WQ5DjPnB1cxipwJcV5kNsah2zCoh36FJWIcbeDQNnO7vGibjV5D6W0+ 0CAA/4VEYBsBSkITvDFxwPV214+5sjJYp7layYVuEQGoaw79zCU4jNtsRCw7SvjDmkxf T1CMnzeXFbZchUSb+4rzHOkjxvfjTp0PJbWt10OW+o+Y1FMM8LhxEuEshtAb1NaP44bd Bm3FyN5ki/I8w1lCK6no5Ioep+WM82G0XuouwlL/QnJwqjMIkmlIXxWO6axI1FNF6vxT dISLuqqiRuh+Yr0xoioRsIIIbIEygX1Yn7q8Jsdq2ClU8t1rsWmoD7qcE3wG0U80ZjMJ aHXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UfHrPRyq; spf=pass (google.com: domain of linux-kernel+bounces-14847-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14847-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h22-20020a17090619d600b00a27ef327adesi2042218ejd.434.2024.01.02.13.15.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:15:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14847-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UfHrPRyq; spf=pass (google.com: domain of linux-kernel+bounces-14847-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14847-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C65481F23704 for ; Tue, 2 Jan 2024 21:15:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BF271A716; Tue, 2 Jan 2024 21:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UfHrPRyq" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B1E119BAF for ; Tue, 2 Jan 2024 21:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-7b7a9f90f34so534023839f.2 for ; Tue, 02 Jan 2024 13:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229744; x=1704834544; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/Hw1xlFNdgkxULgKG3GwEV3Tvyifb1Pre98NYX4zJtY=; b=UfHrPRyq1K9c0fjROBFDROpkjVV6Z50HJqMAJpG8fOpr/uhXpbzrD1pKOfcXkEQa+s mm2PgWG4g6H+26K96NqcZttpagvkW34EJW8+cbLAZQEo6MA35vUcGEwSUvQ/cWX/+oJ7 Sl3uYn4dTikDMei4/omb3FJyPq5XSGvZRlgZQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229744; x=1704834544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Hw1xlFNdgkxULgKG3GwEV3Tvyifb1Pre98NYX4zJtY=; b=qSwaUCEJrqk34CarG6D4Oa9tRxvHE5+ujsjzR5rpIH9PrkoZaa+J70gviA3eINNykg nlA67Oj4TAp3qySeX0TlZwgSDWgzHaElA2qt0q9NPXyoORtlBnmrP76b6yMEcJsRtz/7 JMx7PVzu2rHH16UtLYmN5HvPkJQxPxs7+NF4mjurIEnXdez6YsaK9er2PrsKwX6maQ6r e5bm6tk55aMQsVaSmwGPqNy4A1cLOTE/WQnrgFgzGbUdH5f6R371g9qqEJmTVjKznOhm Fdyj2LOTTVWSix+jATnY89o9Cx/JpV8ciM75fSAPY7WAUEc3Xz/U+s+mYVha082gpPCk NLtA== X-Gm-Message-State: AOJu0YyRax78fdLRSFPSEo/wn3lpF1fIQeJ3QoGgvgHPLizGVUMZzUDO 1yLgP1hwO0CRsvuLm0CqDQHNzYIgM5JneTUMwQ/WKNj0uuJ1 X-Received: by 2002:a05:6602:e03:b0:7ba:a232:30fe with SMTP id gp3-20020a0566020e0300b007baa23230femr13087873iob.20.1704229744185; Tue, 02 Jan 2024 13:09:04 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:03 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , David Gow , Greg Kroah-Hartman , Mark Brown , "Rafael J. Wysocki" , Takashi Iwai , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Subject: [PATCH v4 23/24] platform: Modify platform_get_irq_optional() to use resource Date: Tue, 2 Jan 2024 14:07:47 -0700 Message-ID: <20240102140734.v4.23.Ife9ebad2bbfbab3a05e90040f344d750aa0aac7e@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014819532094524 X-GMAIL-MSGID: 1787014819532094524 Unify handling of ACPI, GPIO, devictree, and platform resource interrupts in platform_get_irq_optional(). Each of these subsystems provide their own APIs which provide IRQ information as a struct resource. This simplifies the logic of the function and allows callers to get more information about the IRQ by looking at the resource flags. For example, whether or not an IRQ is wake capable. Signed-off-by: Mark Hasemeyer --- Changes in v4: -platform_get_irq_optional() returns 0 on success Changes in v3: -Remove PTR_ERR check -Move platform_res assignment -Check for irq == 0 to trigger WARN msg -Refactor error handling of acpi_dev_get_gpio_irq_resource() to be consistent with fwnode_irq_get_resource() -Remove extra blank lines -Initialize struct resource on stack Changes in v2: -irq->IRQ -Remove cast to struct resource -Conform to get_optional() function naming -Revert move of irq_get_irq_data() -Add NULL check on struct resource* -Use fwnode to retrieve IRQ for DT/ACPI drivers/base/platform.c | 90 +++++++++++++++++++++------------ include/linux/platform_device.h | 3 ++ 2 files changed, 61 insertions(+), 32 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 10c5779634182..8a42b48922e68 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -151,50 +151,45 @@ EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource_byname); #endif /* CONFIG_HAS_IOMEM */ /** - * platform_get_irq_optional - get an optional IRQ for a device + * platform_get_irq_resource_optional - get an optional IRQ for a device and + * populate the resource struct * @dev: platform device * @num: IRQ number index + * @r: pointer to resource to populate with IRQ information. * * Gets an IRQ for a platform device. Device drivers should check the return - * value for errors so as to not pass a negative integer value to the - * request_irq() APIs. This is the same as platform_get_irq(), except that it - * does not print an error message if an IRQ can not be obtained. + * value for errors. If no error is returned, the IRQ can be found in r->start. * * For example:: * - * int irq = platform_get_irq_optional(pdev, 0); - * if (irq < 0) - * return irq; + * int res = platform_get_irq_resource_optional(pdev, 0, &res); + * if (!res) + * return res.start; * - * Return: non-zero IRQ number on success, negative error number on failure. + * Return: 0 on success, negative error number on failure. */ -int platform_get_irq_optional(struct platform_device *dev, unsigned int num) +int platform_get_irq_resource_optional(struct platform_device *dev, + unsigned int num, struct resource *r) { int ret; + + if (!r) + return -EINVAL; + #ifdef CONFIG_SPARC /* sparc does not have irqs represented as IORESOURCE_IRQ resources */ if (!dev || num >= dev->archdata.num_irqs) goto out_not_found; - ret = dev->archdata.irqs[num]; + *r = DEFINE_RES_IRQ(dev->archdata.irqs[num]); + ret = 0; goto out; #else struct fwnode_handle *fwnode = dev_fwnode(&dev->dev); - struct resource *r; - if (is_of_node(fwnode)) { - ret = of_irq_get(to_of_node(fwnode), num); - if (ret > 0 || ret == -EPROBE_DEFER) - goto out; - } - - r = platform_get_resource(dev, IORESOURCE_IRQ, num); - if (is_acpi_device_node(fwnode)) { - if (r && r->flags & IORESOURCE_DISABLED) { - ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), num, r); - if (ret) - goto out; - } - } + ret = fwnode_irq_get_resource(fwnode, num, r); + ret = ret < 0 ? ret : 0; + if (!ret || ret == -EPROBE_DEFER) + goto out; /* * The resources may pass trigger flags to the irqs that need @@ -202,7 +197,9 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num) * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER* * settings. */ - if (r && r->flags & IORESOURCE_BITS) { + struct resource *platform_res = platform_get_resource(dev, IORESOURCE_IRQ, num); + + if (platform_res && platform_res->flags & IORESOURCE_BITS) { struct irq_data *irqd; irqd = irq_get_irq_data(r->start); @@ -211,8 +208,9 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num) irqd_set_trigger_type(irqd, r->flags & IORESOURCE_BITS); } - if (r) { - ret = r->start; + if (platform_res) { + *r = *platform_res; + ret = 0; goto out; } @@ -224,9 +222,9 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num) * allows a common code path across either kind of resource. */ if (num == 0 && is_acpi_device_node(fwnode)) { - ret = acpi_dev_gpio_irq_get(to_acpi_device_node(fwnode), num); + ret = acpi_dev_get_gpio_irq_resource(to_acpi_device_node(fwnode), NULL, num, r); /* Our callers expect -ENXIO for missing IRQs. */ - if (ret >= 0 || ret == -EPROBE_DEFER) + if (!ret || ret == -EPROBE_DEFER) goto out; } @@ -234,11 +232,11 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num) out_not_found: ret = -ENXIO; out: - if (WARN(!ret, "0 is an invalid IRQ number\n")) + if (WARN(!ret && !r->start, "0 is an invalid IRQ number\n")) return -EINVAL; return ret; } -EXPORT_SYMBOL_GPL(platform_get_irq_optional); +EXPORT_SYMBOL_GPL(platform_get_irq_resource_optional); /** * platform_get_irq - get an IRQ for a device @@ -270,6 +268,34 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) } EXPORT_SYMBOL_GPL(platform_get_irq); +/** + * platform_get_irq_optional - get an optional IRQ for a device + * @dev: platform device + * @num: IRQ number index + * + * Gets an IRQ for a platform device. Device drivers should check the return + * value for errors so as to not pass a negative integer value to the + * request_irq() APIs. This is the same as platform_get_irq(), except that it + * does not print an error message if an IRQ can not be obtained. + * + * For example:: + * + * int irq = platform_get_irq_optional(pdev, 0); + * if (irq < 0) + * return irq; + * + * Return: non-zero IRQ number on success, negative error number on failure. + */ +int platform_get_irq_optional(struct platform_device *dev, unsigned int num) +{ + int ret; + struct resource r = {}; + + ret = platform_get_irq_resource_optional(dev, num, &r); + return ret ?: r.start; +} +EXPORT_SYMBOL_GPL(platform_get_irq_optional); + /** * platform_irq_count - Count the number of IRQs a platform device uses * @dev: platform device diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 7a41c72c19591..2117f817d9c9c 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -102,6 +102,9 @@ devm_platform_ioremap_resource_byname(struct platform_device *pdev, extern int platform_get_irq(struct platform_device *, unsigned int); extern int platform_get_irq_optional(struct platform_device *, unsigned int); +extern int platform_get_irq_resource_optional(struct platform_device *dev, + unsigned int num, + struct resource *r); extern int platform_irq_count(struct platform_device *); extern int devm_platform_get_irqs_affinity(struct platform_device *dev, struct irq_affinity *affd, From patchwork Tue Jan 2 21:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 184472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4687843dyb; Tue, 2 Jan 2024 13:17:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBQfFYAUY0EdFfhwgA1W8NWD2FnFfAeeHp/3R0fqdluXPz8StnnpYnM2gUolOBQwRI9sFR X-Received: by 2002:a05:6e02:178a:b0:35d:6caf:78c4 with SMTP id y10-20020a056e02178a00b0035d6caf78c4mr30594249ilu.80.1704230246543; Tue, 02 Jan 2024 13:17:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704230246; cv=none; d=google.com; s=arc-20160816; b=YZ0O7wXPzAlUoDgciBuPe7SszDpwpI0e1Sx9Vx1lrMZk3YnmIIZzYltYj8ha210cqT nu7VcbsbWIFAqfw+hI9BPtbgpEd9mtgFA20D5cFEg3PCIwLVyizd/V4/twN7vw3Wmxix togLxvMnztUU/3eUenNly1iq0xvm0aG8WNboVsB5j4rLnBOjIOOl6KqIu35zvppOQALQ 9ohNkwMNuVaRMbzohnYdKbLyHcNRZQlKD6QpxG52XLjaB6HByqc2OaLhsy4NZSM1lMEy cW/osvd+AJuIXy7DErl2KaprvPkUMcKJWx0t9doJVxWVI8FvzL1eqzKUEI1T/ca30DcU I+Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+gYVKYJQzeswl0d2/E7tMkWp3ZqYQjIB7uAjyZVlcw4=; fh=wq30pV3JiC797JrDzOnTFxiKStC9HemY6QcONKodwWk=; b=yIpnvz8GxjTY4Rs/NXAk6+TgT7QIpR/eRDl1SwOf7NT3gl+Fh9JG1Laz2O2VY979YE 7RGmoCv0ds9WXGQDILeUSViR5Rb7JBCRo9n3oZUT86BEVOcOSK2AHCl6wargETfhWO5d ATEJGZ2GMD0UWFxqFgY4dIFFFteoIwpxMrvwodt/3nkl4ZdWeh1G1fuW0CxxTycj8T+7 ABivxbIJjVJ/0OouBup8c6K6LF8X/tERxOeaW08fhviS2SMip2minggcScYvSBt9aMel nSY4ygUHR3CvFhgcjl/esa7coyBjVcM60UfCe2WhC5VZDPRmkZ/DtyarQQHyLD2rclJ0 nY7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PAfFIwoc; spf=pass (google.com: domain of linux-kernel+bounces-14848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14848-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o23-20020a637317000000b005cdff83cbe6si17666251pgc.700.2024.01.02.13.17.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:17:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PAfFIwoc; spf=pass (google.com: domain of linux-kernel+bounces-14848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14848-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 59FEEB22E44 for ; Tue, 2 Jan 2024 21:15:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 485641A72A; Tue, 2 Jan 2024 21:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PAfFIwoc" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21B2E1A27D for ; Tue, 2 Jan 2024 21:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-7ba903342c2so711978739f.3 for ; Tue, 02 Jan 2024 13:09:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229745; x=1704834545; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+gYVKYJQzeswl0d2/E7tMkWp3ZqYQjIB7uAjyZVlcw4=; b=PAfFIwocWHybLVBVF3+pQWecm7obgM9gBARpFcuydHBhTwMegiEn/TSeOryKURawSN pOo6iyAsT+RsEpJ+nvuQ1JoMuNfsH5ny7QrkENStE3bVViI0pCcZUCftQFNfDx/9/rWn lx7k6pgCzbZ078uPHvFt3AJlScXJgOQ5xJn+o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229745; x=1704834545; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+gYVKYJQzeswl0d2/E7tMkWp3ZqYQjIB7uAjyZVlcw4=; b=Sw8pQfu0C16PW1GlKdjU/IY3YvlBfEc/UDjER77dk2QxTPn9+z3hccuhcmYNmX+xuL AhpQEfPc9zozLIrioWyCxsfgqaF2p5ADKLoJl5f6rLzW7EFDyr+7Ky8L+N/u0PtFr1cg XkdZrpc9LZ7b7j93t8V6LhawKqOdR+YjhaC9k3PEuKCPNGigMowxHONxwE9PSoQazYCO P+frsrtp7p5IJ7yoDlGvijKp6E5nEa69blhYiAC7fIAGpuMeE7kBEU7PQpvI0bGtuIH1 HpWN2W4Ga7ScQdfKJI8pPT6YPBy0N/8I6X+l/SlM28i//D2ICVY46P/192wLbC4nJY8T QCqA== X-Gm-Message-State: AOJu0YwZJjC314jb1hh5WIkWJ/OVq9NrAFbjkTTOMeUZy6wFLyRLbSaX YhRGv4NajC9KcNZPI9IoJLb6e9Bof0FN5Gy2kSgLPgLAYJIH X-Received: by 2002:a05:6602:2985:b0:7ba:ccbb:750d with SMTP id o5-20020a056602298500b007baccbb750dmr18015759ior.12.1704229745012; Tue, 02 Jan 2024 13:09:05 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:04 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , Benson Leung , Bhanu Prakash Maiya , Chen-Yu Tsai , Guenter Roeck , Prashant Malani , Rob Barnes , Stephen Boyd , chrome-platform@lists.linux.dev Subject: [PATCH v4 24/24] platform/chrome: cros_ec: Use PM subsystem to manage wakeirq Date: Tue, 2 Jan 2024 14:07:48 -0700 Message-ID: <20240102140734.v4.24.Ieee574a0e94fbaae01fd6883ffe2ceeb98d7df28@changeid> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20240102210820.2604667-1-markhas@chromium.org> References: <20240102210820.2604667-1-markhas@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014935298087171 X-GMAIL-MSGID: 1787014935298087171 The cros ec driver is manually managing the wake IRQ by calling enable_irq_wake()/disable_irq_wake() during suspend/resume. Modify the driver to use the power management subsystem to manage the wakeirq. Rather than assuming that the IRQ is wake capable, use the underlying firmware/device tree to determine whether or not to enable it as a wake source. Some Chromebooks rely solely on the ec_sync pin to wake the AP but do not specify the interrupt as wake capable in the ACPI _CRS. For LPC/ACPI based systems a DMI quirk is introduced listing boards whose firmware should not be trusted to provide correct wake capable values. For device tree base systems, it is not an issue as the relevant device tree entries have been updated and DTS is built from source for each ChromeOS update. Acked-by: Tzung-Bi Shih Signed-off-by: Mark Hasemeyer --- Changes in v4: -Rebase on linux-next -See each patch for patch specific changes -Add Tzung-Bi's Ack tag -Drop dev_err() during cros_ec_uart_probe() -Initalize struct resource on stack -Update error handling for platform_get_irq_resource_optional() Changes in v3: -Rebase on linux-next -See each patch for patch specific changes -Remove MODULE_DEVICE_TABLE -Drop "cros_ec _" prefix from should_force_irq_wake_capable() -Drop use of dev_err_probe() to be consistent with existing conventions in the driver -Drop *spi argument from cros_ec_spi_dt_probe() -Drop null device_node check from cros_ec_spi_dt_probe() -Add trailing commas to DMI table -Drop redundant "!= NULL" in should_force_irq_wake_capable() -Use str_yes_no() to print irq wake capability -Move irqwake handling from the interface specific modules to cros_ec.c Changes in v2: -Rebase on linux-next -Add cover letter -See each patch for patch specific changes -Look for 'wakeup-source' property in cros_ec_spi.c drivers/platform/chrome/cros_ec.c | 48 +++++++++++++++++---- drivers/platform/chrome/cros_ec_lpc.c | 40 ++++++++++++++--- drivers/platform/chrome/cros_ec_spi.c | 15 ++++--- drivers/platform/chrome/cros_ec_uart.c | 14 ++++-- include/linux/platform_data/cros_ec_proto.h | 4 +- 5 files changed, 94 insertions(+), 27 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index badc68bbae8cc..080b479f39a94 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -168,6 +169,35 @@ static int cros_ec_ready_event(struct notifier_block *nb, return NOTIFY_DONE; } +static int enable_irq_for_wake(struct cros_ec_device *ec_dev) +{ + struct device *dev = ec_dev->dev; + int ret = device_init_wakeup(dev, true); + + if (ret) { + dev_err(dev, "Failed to enable device for wakeup"); + return ret; + } + ret = dev_pm_set_wake_irq(dev, ec_dev->irq); + if (ret) + device_init_wakeup(dev, false); + + return ret; +} + +static int disable_irq_for_wake(struct cros_ec_device *ec_dev) +{ + int ret; + struct device *dev = ec_dev->dev; + + dev_pm_clear_wake_irq(dev); + ret = device_init_wakeup(dev, false); + if (ret) + dev_err(dev, "Failed to disable device for wakeup"); + + return ret; +} + /** * cros_ec_register() - Register a new ChromeOS EC, using the provided info. * @ec_dev: Device to register. @@ -221,6 +251,13 @@ int cros_ec_register(struct cros_ec_device *ec_dev) ec_dev->irq, err); goto exit; } + dev_dbg(dev, "IRQ: %i, wake_capable: %s\n", ec_dev->irq, + str_yes_no(ec_dev->irq_wake)); + if (ec_dev->irq_wake) { + err = enable_irq_for_wake(ec_dev); + if (err) + goto exit; + } } /* Register a platform device for the main EC instance */ @@ -313,6 +350,8 @@ EXPORT_SYMBOL(cros_ec_register); */ void cros_ec_unregister(struct cros_ec_device *ec_dev) { + if (ec_dev->irq_wake) + disable_irq_for_wake(ec_dev); platform_device_unregister(ec_dev->pd); platform_device_unregister(ec_dev->ec); mutex_destroy(&ec_dev->lock); @@ -353,12 +392,6 @@ EXPORT_SYMBOL(cros_ec_suspend_prepare); static void cros_ec_disable_irq(struct cros_ec_device *ec_dev) { - struct device *dev = ec_dev->dev; - if (device_may_wakeup(dev)) - ec_dev->wake_enabled = !enable_irq_wake(ec_dev->irq); - else - ec_dev->wake_enabled = false; - disable_irq(ec_dev->irq); ec_dev->suspended = true; } @@ -440,9 +473,6 @@ static void cros_ec_enable_irq(struct cros_ec_device *ec_dev) ec_dev->suspended = false; enable_irq(ec_dev->irq); - if (ec_dev->wake_enabled) - disable_irq_wake(ec_dev->irq); - /* * Let the mfd devices know about events that occur during * suspend. This way the clients know what to do with them. diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index f0f3d3d561572..0204593d7b1c9 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -48,6 +48,27 @@ struct lpc_driver_ops { static struct lpc_driver_ops cros_ec_lpc_ops = { }; +static const struct dmi_system_id untrusted_fw_irq_wake_capable[] = { + { + .ident = "Brya", + .matches = { + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"), + }, + }, + { + .ident = "Brask", + .matches = { + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brask"), + }, + }, + { } +}; + +static bool should_force_irq_wake_capable(void) +{ + return dmi_first_match(untrusted_fw_irq_wake_capable); +} + /* * A generic instance of the read function of struct lpc_driver_ops, used for * the LPC EC. @@ -353,8 +374,9 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) struct acpi_device *adev; acpi_status status; struct cros_ec_device *ec_dev; + struct resource r = {}; u8 buf[2] = {}; - int irq, ret; + int ret; /* * The Framework Laptop (and possibly other non-ChromeOS devices) @@ -428,12 +450,16 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) * Some boards do not have an IRQ allotted for cros_ec_lpc, * which makes ENXIO an expected (and safe) scenario. */ - irq = platform_get_irq_optional(pdev, 0); - if (irq > 0) - ec_dev->irq = irq; - else if (irq != -ENXIO) { - dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq); - return irq; + ret = platform_get_irq_resource_optional(pdev, 0, &r); + if (!ret) { + ec_dev->irq = r.start; + if (should_force_irq_wake_capable()) + ec_dev->irq_wake = true; + else + ec_dev->irq_wake = r.flags & IORESOURCE_IRQ_WAKECAPABLE; + } else if (ret != -ENXIO) { + dev_err(dev, "couldn't retrieve IRQ number (%d)\n", ret); + return ret; } ret = cros_ec_register(ec_dev); diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c index 3e88cc92e8192..102cdc3d1956d 100644 --- a/drivers/platform/chrome/cros_ec_spi.c +++ b/drivers/platform/chrome/cros_ec_spi.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,7 @@ * @end_of_msg_delay: used to set the delay_usecs on the spi_transfer that * is sent when we want to turn off CS at the end of a transaction. * @high_pri_worker: Used to schedule high priority work. + * @irq_wake: Whether or not irq assertion should wake the system. */ struct cros_ec_spi { struct spi_device *spi; @@ -77,6 +79,7 @@ struct cros_ec_spi { unsigned int start_of_msg_delay; unsigned int end_of_msg_delay; struct kthread_worker *high_pri_worker; + bool irq_wake; }; typedef int (*cros_ec_xfer_fn_t) (struct cros_ec_device *ec_dev, @@ -689,9 +692,10 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, return cros_ec_xfer_high_pri(ec_dev, ec_msg, do_cros_ec_cmd_xfer_spi); } -static void cros_ec_spi_dt_probe(struct cros_ec_spi *ec_spi, struct device *dev) +static void cros_ec_spi_dt_probe(struct cros_ec_spi *ec_spi) { - struct device_node *np = dev->of_node; + struct spi_device *spi = ec_spi->spi; + struct device_node *np = spi->dev.of_node; u32 val; int ret; @@ -702,6 +706,8 @@ static void cros_ec_spi_dt_probe(struct cros_ec_spi *ec_spi, struct device *dev) ret = of_property_read_u32(np, "google,cros-ec-spi-msg-delay", &val); if (!ret) ec_spi->end_of_msg_delay = val; + + ec_spi->irq_wake = spi->irq > 0 && of_property_present(np, "wakeup-source"); } static void cros_ec_spi_high_pri_release(void *worker) @@ -754,12 +760,13 @@ static int cros_ec_spi_probe(struct spi_device *spi) return -ENOMEM; /* Check for any DT properties */ - cros_ec_spi_dt_probe(ec_spi, dev); + cros_ec_spi_dt_probe(ec_spi); spi_set_drvdata(spi, ec_dev); ec_dev->dev = dev; ec_dev->priv = ec_spi; ec_dev->irq = spi->irq; + ec_dev->irq_wake = ec_spi->irq_wake; ec_dev->cmd_xfer = cros_ec_cmd_xfer_spi; ec_dev->pkt_xfer = cros_ec_pkt_xfer_spi; ec_dev->phys_name = dev_name(&ec_spi->spi->dev); @@ -780,8 +787,6 @@ static int cros_ec_spi_probe(struct spi_device *spi) return err; } - device_init_wakeup(&spi->dev, true); - return 0; } diff --git a/drivers/platform/chrome/cros_ec_uart.c b/drivers/platform/chrome/cros_ec_uart.c index 68d80559fddc2..5de346a078745 100644 --- a/drivers/platform/chrome/cros_ec_uart.c +++ b/drivers/platform/chrome/cros_ec_uart.c @@ -69,6 +69,7 @@ struct response_info { * @serdev: serdev uart device we are connected to. * @baudrate: UART baudrate of attached EC device. * @flowcontrol: UART flowcontrol of attached device. + * @irq_wake: Whether or not irq assertion should wake the system. * @irq: Linux IRQ number of associated serial device. * @response: Response info passing between cros_ec_uart_pkt_xfer() * and cros_ec_uart_rx_bytes() @@ -77,6 +78,7 @@ struct cros_ec_uart { struct serdev_device *serdev; u32 baudrate; u8 flowcontrol; + bool irq_wake; u32 irq; struct response_info response; }; @@ -224,8 +226,10 @@ static int cros_ec_uart_resource(struct acpi_resource *ares, void *data) static int cros_ec_uart_acpi_probe(struct cros_ec_uart *ec_uart) { int ret; + struct resource irqres; LIST_HEAD(resources); - struct acpi_device *adev = ACPI_COMPANION(&ec_uart->serdev->dev); + struct device *dev = &ec_uart->serdev->dev; + struct acpi_device *adev = ACPI_COMPANION(dev); ret = acpi_dev_get_resources(adev, &resources, cros_ec_uart_resource, ec_uart); if (ret < 0) @@ -234,12 +238,12 @@ static int cros_ec_uart_acpi_probe(struct cros_ec_uart *ec_uart) acpi_dev_free_resource_list(&resources); /* Retrieve GpioInt and translate it to Linux IRQ number */ - ret = acpi_dev_gpio_irq_get(adev, 0); + ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, &irqres); if (ret < 0) return ret; - ec_uart->irq = ret; - dev_dbg(&ec_uart->serdev->dev, "IRQ number %d\n", ec_uart->irq); + ec_uart->irq = irqres.start; + ec_uart->irq_wake = irqres.flags & IORESOURCE_IRQ_WAKECAPABLE; return 0; } @@ -293,6 +297,7 @@ static int cros_ec_uart_probe(struct serdev_device *serdev) ec_dev->dev = dev; ec_dev->priv = ec_uart; ec_dev->irq = ec_uart->irq; + ec_dev->irq_wake = ec_uart->irq_wake; ec_dev->cmd_xfer = NULL; ec_dev->pkt_xfer = cros_ec_uart_pkt_xfer; ec_dev->din_size = sizeof(struct ec_host_response) + @@ -301,6 +306,7 @@ static int cros_ec_uart_probe(struct serdev_device *serdev) serdev_device_set_client_ops(serdev, &cros_ec_uart_client_ops); + /* Register a new cros_ec device */ return cros_ec_register(ec_dev); } diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h index 8865e350c12a5..0fb2781b602d6 100644 --- a/include/linux/platform_data/cros_ec_proto.h +++ b/include/linux/platform_data/cros_ec_proto.h @@ -100,6 +100,7 @@ struct cros_ec_command { * @proto_version: The protocol version used for this device. * @priv: Private data. * @irq: Interrupt to use. + * @irq_wake: Whether or not irq assertion should wake the system. * @id: Device id. * @din: Input buffer (for data from EC). This buffer will always be * dword-aligned and include enough space for up to 7 word-alignment @@ -115,7 +116,6 @@ struct cros_ec_command { * performance advantage to using dword. * @din_size: Size of din buffer to allocate (zero to use static din). * @dout_size: Size of dout buffer to allocate (zero to use static dout). - * @wake_enabled: True if this device can wake the system from sleep. * @suspended: True if this device had been suspended. * @cmd_xfer: Send command to EC and get response. * Returns the number of bytes received if the communication @@ -169,11 +169,11 @@ struct cros_ec_device { u16 proto_version; void *priv; int irq; + bool irq_wake; u8 *din; u8 *dout; int din_size; int dout_size; - bool wake_enabled; bool suspended; int (*cmd_xfer)(struct cros_ec_device *ec, struct cros_ec_command *msg);