Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp82858rdh; Tue, 13 Feb 2024 10:02:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW9wjg5KzuwF8j552NKk8FaFlj3PZiaqfQQ0PjihnAF+eCd6I4leTfVmlzg2M86vqwVSZktCARHYz/9r+913HmoSxStC5LEsWdaXds8Aw== X-Google-Smtp-Source: AGHT+IFqv//dhLzR3f5UNoBu2c6vvXBQ9zNasVlbdgBuC9/zXTY82BlyNsd69dNDuNswVP2tlZIm X-Received: by 2002:a17:90a:6881:b0:297:4f1:8a19 with SMTP id a1-20020a17090a688100b0029704f18a19mr241989pjd.23.1707847352775; Tue, 13 Feb 2024 10:02:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707847352; cv=pass; d=google.com; s=arc-20160816; b=bfcF/9X2j1NVminzGL3Ygh4Pm6AzRQWS6ICDTLFXt+NhsKGYKHhP7ItgCW7YVI9hHo AXIi1fzD1OkxN6qmLpPTn2iukI3ouQH2urkQ4nHDZ/xZ/pABfCXvL/oVz3zmLRmbYIZx wAcDfHjkoly9lOGYDaudOYKakIsHPGjZOegNEkRbUCdz/hNEZvMpMQaKy+Y/yTOHCupu LsurIJPvGPvREB+mp/ypQ5X2USZDxJv6FN9/9qBRTAKkI/yXONW7IqgUfEUEoz3YYQww u1B8gbt9kN3kJO0Tjl7n70RbhsBKyiAvf479qmXBUDFw2boHJtv41PLAYjFIo2edf+Np oK5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ThFEwmSsic89kjVyr0919FUZo6LtjSuhDb8efYOkiGI=; fh=n4maSfO9Nn8tsUktjyu/OUtBSoajBALn3PGpbpHKyTY=; b=jvDT1dL3on8KiNMP/VylaOuD+ItfRL8E6zB63SfJfbX7DPnxxKdnESahEAd+/rYx09 CupCQJTj7pkbzBrpZivU6pTgJpmsOHQK2ogBR6Rqygb0qIRA+gb9Z/cibeHTzONJGh5V dix6ERw5Kt/DBkGObwb2q/TRwy1waPFmLBllMz6E1Na0nVmdi57Tta/AEOqbf9ZZbSXZ b7hlSrTfoJHGql2OYL4G+bBLj9xRJPMjr9298BoH1v6xOPxbfUWO5iefvegHBfPtOznw 3o/RUI4YzJhmnFF9vjyALzzDVCSoLw/V/64LjjMf7hm/XkSdOt6eyWan+ZhTVM2Sm5Ni XptQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BFpUcjw9; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-64040-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64040-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCWhig8kj7QEIxjMRFHzHJP692FkIDXW7tclGOpraUX3WhkKF5t8sdRoHMOSrC2bI6gVGouscPtiNWUZ8MhhWKL5GYznxI5X3kXLG36skw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cs23-20020a17090af51700b0029712e1ba1dsi2412936pjb.72.2024.02.13.10.02.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 10:02:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64040-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BFpUcjw9; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-64040-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64040-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 2692E2867EF for ; Tue, 13 Feb 2024 18:00:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32F5A60DC4; Tue, 13 Feb 2024 17:57:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BFpUcjw9" Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (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 701E35FF03 for ; Tue, 13 Feb 2024 17:57:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707847058; cv=none; b=qVjubuuxvPhLaSd3UzCk0dCZ+v2AI9yMZbgAyXYqxV+NhIB94GEYLqDKnbWIpeq+90TT+MiLbYLl1q8fsMbfgr285C8Bq9Th41ROlTAhjGqSdKXroR+T/G3Ro7tZ3DJIiZLK1pwEoI8SSRV1yphZ5gLNXme+cg5eR6wFXASas28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707847058; c=relaxed/simple; bh=vGsPH/6NepigkHWNcE1Gp/jZaGblgkAQJ/VePx7mqOY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=svTQLwez9Yq9si8ZAqWv/OxGTEozKwpwPJHWTKO5fdEv6HuXCTKehAw4zvvC30o0DTb1xL64iz/SFX0AR7xutvZy1UyRJMYXPA9N0H7IXHuyFj23pZcywz0IDSUkD4SP6bId8j8CBzB+3zUn8iWfvKLdQzCx4EOzbgv3cbNkStQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=BFpUcjw9; arc=none smtp.client-ip=209.85.219.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-dcc73148611so1110240276.3 for ; Tue, 13 Feb 2024 09:57:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707847054; x=1708451854; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ThFEwmSsic89kjVyr0919FUZo6LtjSuhDb8efYOkiGI=; b=BFpUcjw9EZMmAMaQ2bsTun7bOnEVMJRwCHAZ56Nq23BqXa/cq+ZiknNpfs2CVPWUgC zqd3CNLT2tlGuDHlYAetKIHcyQlPWbFCFAUCpMr0NtVPH1Av7QNX7QEl6AD+NbZNNy0D 8HjHA47CrLAQoznlmHTNh8S2aTbTGtOhGvtA0IFejHKwYGMjTEMSbYG2t4adDjrx64n7 GI3wcAFM0L1r8TKgIIm7TB2GVAlROo3RFT+1z8PICwUIjweLm4av35HMsQcCEiCkZVcq SMh6/gajowAlID7p3cj/JFnfRKXLfFn/65MtF09Lc2DnEkNBa8Cp/uwCmP60kJ2MS6wO VInw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707847054; x=1708451854; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ThFEwmSsic89kjVyr0919FUZo6LtjSuhDb8efYOkiGI=; b=OM/KhHaMyAjW9+vVdCcG7rvGX0LPcxLBAWxk6j6ETlE5laQpu9eoxcZjkA8TCHV9hF j8J4NbZuuU8J3UEaGOwO8s3bvNYHgAaTyQnmTjkeuvPLDaX5elrkz70YxyuWNesWuAQl MlYHEVxs/P9GFnqbSmhntk39IYL/ZrtG1q7v5riCgtZtYqfnXmBMCY5m4dqcWXTYw/co jBcrmnkNJWr8l61JOkxh7/nizpAFh93pgMo80VYay6gF/8vsJkd69zukNDH0cjGhoLtd 8GgTRprBSbUO4SsL37e58SXqbKCdGUK2ZzJYRpe4VsWCXmbOvlnjjhIpOGcVzgA0Yi3v B72A== X-Forwarded-Encrypted: i=1; AJvYcCWIdBaxelMw6KKzTwyT+aAe5i88ONOM7ZFbNYD1hEjBkKGxzLb1KfnRuEpp+4+Rv0OehOwV58t58I3fHukVCax9XANPiByzMxzHmXsh X-Gm-Message-State: AOJu0YxVxGbFSKOcG5UkXu+HHXGxDxKI7mGB18EvXSOTwcl+Nu7CHmI6 IhoLWHKYVYh6r5Izhha5J+JPhwBhIWagvnmC4ZHceMC13mW71liD30fr4heqkXAOqS3b+m9GGOv j5IcfCXu/LB/g6VgEdRcYReawlhyr+yRcAnMY/g5ZKPU4doIa7rw= X-Received: by 2002:a25:ec0c:0:b0:dc6:cd76:5ddf with SMTP id j12-20020a25ec0c000000b00dc6cd765ddfmr8977451ybh.39.1707847054395; Tue, 13 Feb 2024 09:57:34 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240210070934.2549994-1-swboyd@chromium.org> <20240210070934.2549994-3-swboyd@chromium.org> In-Reply-To: <20240210070934.2549994-3-swboyd@chromium.org> From: Linus Walleij Date: Tue, 13 Feb 2024 18:57:22 +0100 Message-ID: Subject: Re: [PATCH 02/22] gpio: Add ChromeOS EC GPIO driver To: Stephen Boyd Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Douglas Anderson , Pin-yen Lin , Bartosz Golaszewski , Benson Leung , Guenter Roeck , linux-gpio@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Stephen, thanks for your patch! Overall it looks good I have a few nitpicks On Sat, Feb 10, 2024 at 8:09=E2=80=AFAM Stephen Boyd = wrote: > 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 a driver to get and set the GPIOs on the EC through the > host command interface. > > Cc: Linus Walleij > Cc: Bartosz Golaszewski > Cc: Benson Leung > Cc: Guenter Roeck > Cc: > Cc: > Cc: Pin-yen Lin > Signed-off-by: Stephen Boyd (...) > +config GPIO_CROS_EC > + tristate "ChromeOS EC GPIO support" > + depends on CROS_EC > + help > + GPIO driver for exposing GPIOs on the ChromeOS Embedded > + Controller. > + > + This driver can also be built as a module. If so, the module > + will be called gpio-cros-ec. Classified as "MFD Expander" but I honestly don't know anything better. > +#include > +#include > +#include > +#include Do you need init.h? I guess maybe... I thought module would be enough for this. > +static int cros_ec_gpio_request(struct gpio_chip *chip, unsigned gpio_pi= n) > +{ > + if (gpio_pin < chip->ngpio) > + return 0; > + > + return -EINVAL; > +} If this check is needed, it should be in gpiolib I think? > +#ifdef CONFIG_OF This ifdef should not be needed these days. > +static const struct of_device_id cros_ec_gpio_of_match[] =3D { > + { .compatible =3D "google,cros-ec-gpio" }, > + {} > +}; > +MODULE_DEVICE_TABLE(of, cros_ec_gpio_of_match); > +#endif > + > +static struct platform_driver cros_ec_gpio_driver =3D { > + .probe =3D cros_ec_gpio_probe, > + .driver =3D { > + .name =3D "cros-ec-gpio", > + .of_match_table =3D of_match_ptr(cros_ec_gpio_of_match), Nor the of_match_ptr() business. With these fixed/addressed: Reviewed-by: Linus Walleij Yours, Linus Walleij