From patchwork Mon Feb 19 20:23:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 13563082 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 49F33535DE for ; Mon, 19 Feb 2024 20:23:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374214; cv=none; b=SA5BrH/he53kl74Wa08nCdEvjdNWsCYiVsOJdxA3Xdh+ipNG67arzBTku88OEMl0Pw3a+6kEiYZkozgGD9SLa1L/5L1YQWnfok2ivhi7UigvNG9B6fIE7iWVDADxs9r8xED34PW9J7aaZZg64/YnCspTOhRwpBpzW24ng3Ww9Es= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374214; c=relaxed/simple; bh=GCN4a3XwyVGjN4FSoVSL7WZNZKmZBWlauyy+D84PGEY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hAAT1JwDdcmrDNHso+olqSIPfJw3aDY4uPhl/FoF6/O7ymNO3hbd5EpDewgoo7BqrtSXe04XxEoXTyxBXrSvoPbVlyDc09KV6TbPk8x/lwHTuEWxg3DLyhJ9aPxYhVJyIwLR/06CrVsr6pB8T2ro3U5fyiSeVBXTbF17Ep+hLYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=mxqaoEqh; arc=none smtp.client-ip=209.85.214.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mxqaoEqh" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1dbae7b8ff2so14904605ad.3 for ; Mon, 19 Feb 2024 12:23:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708374210; x=1708979010; darn=lists.linux.dev; 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=kUa3JH16Oe5UJV9UEwjr6pY+WpID6lK8xSe+O5n7a8M=; b=mxqaoEqhUck79Z7mWhqu8ZeIeZVubplEohsUhC2/48JldFPuAkTNyUZK567kT0e6bj 25RhVtqrAh5jeIZdoklyuQIyqj+oev67vzK+iXOhzYoLG3AB/fD5u6FIm4O45ZxL1Wdk vQtflXcS8EvelF+FWCI7NxjLeJPAGbqVBkE9w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708374210; x=1708979010; 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=kUa3JH16Oe5UJV9UEwjr6pY+WpID6lK8xSe+O5n7a8M=; b=GmiXcaMJVv87rcGrHjGLspsuLHcX7hqn1+jUlhNQBWsAhL0avhlwjApz3rCkr1Clmv ZGzSGreSuFSMDWrS1fzS788ALpxHCtSNnsaGn6nl0HfYfxqfAekgQt3tKgoEOFVzI8Sg skxFreNLEFBe8G/61H7kwJSH54RImtj0I4UdiKiNcDsh0hu+4VqjPh1kEiGAcPrXUkD3 SZSoHNBNrWO+qv2VFgQ/0ASVR6lQvfAZYa0bk6N+fhITq5Psvc3DbnPP+4/lRPYhxUBe 48rmByUItdyf0I50JvYjS+tJdVYIqKLl/TpMFnQbm0MCL1RMdh4y53J9vfpYspnJ94y1 Gkdw== X-Forwarded-Encrypted: i=1; AJvYcCWhLmaUpFF6aT8+2SrMnbLMCWOCqCHyja2h+TucqD1VavJ45jG4Lo/2+k/PBkL9nnklCjgVXubiVbRIyrFEl3FREY/yik99DbkCqKzp51Lz X-Gm-Message-State: AOJu0YzFjnNYTyAi00G/jS8O5HHwPO9nPANPHK9Vo5rNrB35b9tpmMGC TBskkJ/I6gBBx9oHuopBuEwMBRyJqXH9Jy44yJnEtpm/J8p53hlynJbmWOIYpw== X-Google-Smtp-Source: AGHT+IG8LtaETDPpup4Qyvx26INSaCWovgahZdaA0zbKl+GL/t4KUJJLp2AnURqkSJ5Jxmv9EMKmoQ== X-Received: by 2002:a17:902:da87:b0:1d9:2158:1308 with SMTP id j7-20020a170902da8700b001d921581308mr16281281plx.28.1708374210688; Mon, 19 Feb 2024 12:23:30 -0800 (PST) Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id mf8-20020a170902fc8800b001d9fc6cb5f2sm4818207plb.203.2024.02.19.12.23.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Feb 2024 12:23:30 -0800 (PST) From: Stephen Boyd To: Lee Jones Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, Douglas Anderson , Pin-yen Lin , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Benson Leung , Guenter Roeck Subject: [PATCH 1/2] dt-bindings: cros-ec: Add properties for GPIO controller Date: Mon, 19 Feb 2024 12:23:23 -0800 Message-ID: <20240219202325.4095816-2-swboyd@chromium.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240219202325.4095816-1-swboyd@chromium.org> References: <20240219202325.4095816-1-swboyd@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. The GPIOs are on the EC itself, so the EC acts similar to a GPIO expander. Add the #gpio-cells and gpio-controller properties to the cros-ec binding so that other devices described in DT can get the GPIOs on the EC. Cc: Linus Walleij Cc: Bartosz Golaszewski Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Lee Jones Cc: Benson Leung Cc: Guenter Roeck Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/mfd/google,cros-ec.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml index e1ca4f297c6d..aac8819bd00b 100644 --- a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml +++ b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml @@ -93,6 +93,11 @@ properties: '#size-cells': const: 0 + '#gpio-cells': + const: 2 + + gpio-controller: true + typec: $ref: /schemas/chrome/google,cros-ec-typec.yaml# @@ -275,6 +280,8 @@ examples: interrupts = <99 0>; interrupt-parent = <&gpio7>; spi-max-frequency = <5000000>; + #gpio-cells = <2>; + gpio-controller; proximity { compatible = "google,cros-ec-mkbp-proximity"; From patchwork Mon Feb 19 20:23:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 13563083 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 06BEA53E16 for ; Mon, 19 Feb 2024 20:23:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374214; cv=none; b=rmP0ix0grK8YreZ6ljE8hrkHyueHneBHe0Q+ifyhBkWi8F+nh2Rpo6kqrWO8V4BqdH3soy3Y1pj+6Abf9xNx49AEfWJiCOQseBalbbaU1sd+N5dpOyXeyFuDHbLbxoTNAXa3V14mVhkT2aXY/X4KaONWjkyIaII5eHwSFpG+2pI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374214; c=relaxed/simple; bh=1LpOcOPE8NF67KY2Om+0rc+yLxqoD9d+aNt1OJgcsWY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VO4oBSAD0cePSSAcqfRE8RVltapFDOVBdk3izsRSz+GaxYlPqeuDgheHgD7PCi10ApocdX+Y6UwP3AjryYZPeIjGchASxS8d+iLUlRx0FwmfbsqYJlDMUJMG3NCDzXSfPJob4DW0pvTR5omszD68BObczgkIrAoMDbvQTeED1Bs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Z7+pLTf0; arc=none smtp.client-ip=209.85.216.50 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Z7+pLTf0" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-299846d6ccfso797296a91.0 for ; Mon, 19 Feb 2024 12:23:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708374212; x=1708979012; darn=lists.linux.dev; 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=GaHCMRLTHpVjbQpn0nm8Soa0CT5I0pTuDvK1Y4TvoOs=; b=Z7+pLTf0rKydqKbUEnAvXuz41DgwS+JxpWkB+VnATJnKQn85JCLMmYE5CgvVwDipBu 0S2oKXJHwmG8n+pv65t0IbEHLJwjnFxVgAbmGZEh2YDu6n5qloswH+C5piN4PkDpTFlA ua3URxhCdtUqotDrnP6NbHUuN9mkEjNAepcoY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708374212; x=1708979012; 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=GaHCMRLTHpVjbQpn0nm8Soa0CT5I0pTuDvK1Y4TvoOs=; b=VxH5kawTaR2EU1Tt/rrPtWHwccoGfxyer7UD2ph0qv4L9mP+xkpq7kyOJK7jKCLtbB oMijexhqH6QeDpT9YLbmrg9FWw2UmGIpQwT9PdEmJqgf1CnT6q3tvEuaJMXyAlEf8yhU MQKQlwiRbRUQXeeEBenUxVtIpSEBClPFzTg0rLE0alP9co7A/ZSA8QYcDSHcQFp/CpBd I8If3q3UtXOsJ5jcP8b6WO63Cu/pYDKC/K+ogMTE4UgzqhAbQgWP/FLn/ZMHreJB5Nrt wNrgn3Nd5MckkJA6SWJa8VsLdCGl3bfKwcLKgX2d/E4s/2SFcu0jvVpnkHklnaMYTh7o UujQ== X-Forwarded-Encrypted: i=1; AJvYcCUDS7aVFLHl8ZwAYqesgH/RrB1v1QL+G52dUp4yfCIkKlc/oKidO5MXN9Yzgb2bptp9sQ4GnILXpcNUYr8+GFxS1wJni4kEfC7qmrIRd8ua X-Gm-Message-State: AOJu0Yy0UmEY8mA2XIl/K1YdhPwZgnpH2bb9/RKClI/xQG4hSSmkZh2b b8gax/JGNEaJRVaOfY+Tq8I0EWqtedC2kIah6uCkMmpGM1LpItrWA2wzz1pfTg== X-Google-Smtp-Source: AGHT+IEAUG2tvGVJGd+hj3U8ybO/DpLRVg66FdpMvbg2eIV6gnVcioXBOcc/U9zxzq4OgB0t7uZbUg== X-Received: by 2002:a17:90a:b382:b0:299:3e54:83f3 with SMTP id e2-20020a17090ab38200b002993e5483f3mr6532900pjr.38.1708374212270; Mon, 19 Feb 2024 12:23:32 -0800 (PST) Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id e21-20020a17090ac21500b00298dd684b8csm5810598pjt.32.2024.02.19.12.23.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Feb 2024 12:23:31 -0800 (PST) From: Stephen Boyd To: Lee Jones Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, Douglas Anderson , Pin-yen Lin , Linus Walleij , Bartosz Golaszewski , Benson Leung , Guenter Roeck Subject: [PATCH 2/2] mfd: cros_ec_dev: Add gpio device if feature present on EC Date: Mon, 19 Feb 2024 12:23:24 -0800 Message-ID: <20240219202325.4095816-3-swboyd@chromium.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240219202325.4095816-1-swboyd@chromium.org> References: <20240219202325.4095816-1-swboyd@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. Check for the feature support by checking for the GPIO feature and then populate a sub-device for the gpio hardware on the EC. Cc: Lee Jones Cc: Linus Walleij Cc: Bartosz Golaszewski Cc: Benson Leung Cc: Guenter Roeck Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/mfd/cros_ec_dev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index 603b1cd52785..9c3f8488b416 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -74,6 +74,10 @@ static const struct mfd_cell cros_ec_cec_cells[] = { { .name = "cros-ec-cec", }, }; +static const struct mfd_cell cros_ec_gpio_cells[] = { + { .name = "cros-ec-gpio", }, +}; + static const struct mfd_cell cros_ec_rtc_cells[] = { { .name = "cros-ec-rtc", }, }; @@ -97,6 +101,11 @@ static const struct cros_feature_to_cells cros_subdevices[] = { .mfd_cells = cros_ec_cec_cells, .num_cells = ARRAY_SIZE(cros_ec_cec_cells), }, + { + .id = EC_FEATURE_GPIO, + .mfd_cells = cros_ec_gpio_cells, + .num_cells = ARRAY_SIZE(cros_ec_gpio_cells), + }, { .id = EC_FEATURE_RTC, .mfd_cells = cros_ec_rtc_cells,