Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp289255lqd; Wed, 24 Apr 2024 02:16:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWxD85VAW1sXnbmctkf6AZDaR/w9csOSWy8Gj9IR1A9sfdp7qaRJTegzvlozZ5bzqQqvKQxR3pnEipZjEzCQ6Ey3inU4QQK8uftvGLE3A== X-Google-Smtp-Source: AGHT+IH1nozP0P4emksguXxuQXvPPriDSX94Wmd4fu4qV+dUi0yuFfzisfwSuuvIbLhwXWNX90g7 X-Received: by 2002:a25:dc4d:0:b0:dc7:6192:c688 with SMTP id y74-20020a25dc4d000000b00dc76192c688mr2382881ybe.65.1713950208658; Wed, 24 Apr 2024 02:16:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713950208; cv=pass; d=google.com; s=arc-20160816; b=grxS/TQJa0vsL5HhUdSf/dxDLOZZQC7p32HTNAXbSElh6NjlcQuJYzcuxwHV1Gth3L 3nqVzFcG3USZjNFGNiHEGeE3edtboogKOiwR8GPIZR5AcazAIwUofLXz2ePIUcQuc92e LPyBZz3EZo+4UF77HvJi3BpqTwnajpxvXvZPlKZBUKOm1FszeT/Eb2T4HMzURUv3WoIe 5eoGKLjpvqecnJJnzrNnwoD95d1qTcWYmyWh+CROZbeAvj79AtQ4lpaVdv+F+1r1Ko+H lQdKC+a5e8ux83c/vGI0jkTDOEy3+gXQix+tByQZEi5fR0D8ieLKUME/UUPXYZn9jjUQ zHCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=PEm+OOK1EqRrfqWr60niIZGDsR5MMhhHWqUso+otYlU=; fh=t/Rlprtb5kVZgOj4jZz3MBiSXVd5jcjJfSKVyh9eDy8=; b=TLhIg5HVazk1ouQqxW3piiFbaq59TqQNK7AOWsTUPDRCo7LlHUly9fIboymPjJRO7k kH3u5MOdKVFJmPrFfd9egQbHBRG9ogKLXHSEwIdldEqq7Pu1Ki9QB08z0QHIlNXdR6A6 +c8OVTSZFHJzMg2T4uTep0aj4lodh6+ymNPk880L4WjG2zOe9KLorDE2rQn3bB3HSt5O T6IG3qia+bMqER8ZDa8JYjFcJz84o2GjW1CcZdLpJqeOlwZ711eHBi6YOgyjZkdDgDJ8 S23ibS3riqSx7RSnVANxm9aWAg9/nJyzPCDWCmk3giQEF61dx36ASbWFaWI4hYMX7P2B GQEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-156619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156619-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i12-20020ad45c6c000000b00690b67ee92asi14854822qvh.460.2024.04.24.02.16.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 02:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-156619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156619-linux.lists.archive=gmail.com@vger.kernel.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 53C9A1C23CC9 for ; Wed, 24 Apr 2024 09:16:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0ECD1158DAB; Wed, 24 Apr 2024 09:16:00 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26284158D6B for ; Wed, 24 Apr 2024 09:15:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713950159; cv=none; b=ed13k1IM6ZSn+Nz6Fv/wqhDvaZDPZ1VhOjJisSePQ+/3Nkesf8DhCZlv7WCSycNPGaiH53yEJcVMwPnKRqaINEcwj1qZMTUyw80/8ERzRqNC3N+wXRlO+ey8hMhjbQgRihFwt7fYVDhnlN5o0zA+OftVL7ESTrxgr47e8z6a9ns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713950159; c=relaxed/simple; bh=NUJHTVDyXWUBLS9fMjJ9yqahqHrA5hMzPCLeMYQT6pY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ez0lgN/SoSVThP2CSh7h5Z65GU6YutLjyOD8aMttoF7GrcfqvenZANv5mVTG0w4NUoUpzuegGWFAAE+06Zsg6W8NuVR1gPu4oNnoywe+7m/lmMRQcoW9UayvR39CZqBIWlcW7FTsWPaiczcvLDMOF73PUmVdqq1ViC23sRlX2tU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rzYj8-0001Uv-OK; Wed, 24 Apr 2024 11:15:42 +0200 Received: from [2a0a:edc0:0:b01:1d::7b] (helo=bjornoya.blackshift.org) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzYj8-00E3KS-4a; Wed, 24 Apr 2024 11:15:42 +0200 Received: from pengutronix.de (unknown [172.20.34.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id AFC012BECBE; Wed, 24 Apr 2024 09:15:41 +0000 (UTC) Date: Wed, 24 Apr 2024 11:15:40 +0200 From: Marc Kleine-Budde To: Gregor Herburger Cc: Manivannan Sadhasivam , Thomas Kopp , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, alexander.stein@ew.tq-group.com Subject: Re: [PATCH 3/4] can: mcp251xfd: add gpio functionality Message-ID: <20240424-convivial-flawless-sturgeon-976592-mkl@pengutronix.de> References: <20240417-mcp251xfd-gpio-feature-v1-0-bc0c61fd0c80@ew.tq-group.com> <20240417-mcp251xfd-gpio-feature-v1-3-bc0c61fd0c80@ew.tq-group.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yiaol2clinc7dqpe" Content-Disposition: inline In-Reply-To: <20240417-mcp251xfd-gpio-feature-v1-3-bc0c61fd0c80@ew.tq-group.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org --yiaol2clinc7dqpe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 17.04.2024 15:43:56, Gregor Herburger wrote: > The mcp251xfd devices allow two pins to be configured as gpio. Add this > functionality to driver. >=20 > Signed-off-by: Gregor Herburger > --- > drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 138 +++++++++++++++++= +++++- > drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c | 21 +++- > drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 4 + > 3 files changed, 159 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net= /can/spi/mcp251xfd/mcp251xfd-core.c > index eb699288c076..5ba9fd0af4b6 100644 > --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c > +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c [...] > +static int mcp251fdx_gpio_setup(struct mcp251xfd_priv *priv) > +{ > + struct gpio_chip *gc =3D &priv->gc; > + > + if (!device_property_present(&priv->spi->dev, "gpio-controller")) > + return 0; > + > + if (priv->rx_int) > + return dev_err_probe(&priv->spi->dev, -EINVAL, > + "Can't configure gpio-controller with RX-INT!\n"); > + > + gc->label =3D dev_name(&priv->spi->dev); > + gc->parent =3D &priv->spi->dev; > + gc->owner =3D THIS_MODULE; > + gc->request =3D mcp251xfd_gpio_request; > + gc->get_direction =3D mcp251xfd_gpio_get_direction; > + gc->direction_output =3D mcp251xfd_gpio_direction_output; > + gc->direction_input =3D mcp251xfd_gpio_direction_input; > + gc->get =3D mcp251xfd_gpio_get; > + gc->set =3D mcp251xfd_gpio_set; Please also implement the get_multiple and set_multiple callbacks. > + gc->base =3D -1; > + gc->can_sleep =3D true; > + gc->ngpio =3D ARRAY_SIZE(mcp251xfd_gpio_names); > + gc->names =3D mcp251xfd_gpio_names; > + > + return devm_gpiochip_add_data(&priv->spi->dev, gc, priv); > +} > + > static int > mcp251xfd_register_get_dev_id(const struct mcp251xfd_priv *priv, u32 *de= v_id, > u32 *effective_speed_hz_slow, > @@ -2142,6 +2270,12 @@ static int mcp251xfd_probe(struct spi_device *spi) [...] > diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h b/drivers/net/can/= spi/mcp251xfd/mcp251xfd.h > index 24510b3b8020..e2ab486862d8 100644 > --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h > +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include please keep the includes alphabetically sorted. > #include > #include > #include > @@ -660,6 +661,9 @@ struct mcp251xfd_priv { > =20 > struct mcp251xfd_devtype_data devtype_data; > struct can_berr_counter bec; > +#ifdef CONFIG_GPIOLIB > + struct gpio_chip gc; > +#endif > }; > =20 > #define MCP251XFD_IS(_model) \ regards, Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung N=C3=BCrnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 | --yiaol2clinc7dqpe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEUEC6huC2BN0pvD5fKDiiPnotvG8FAmYozbkACgkQKDiiPnot vG+JlQf/Z0y+ItFFGkL6UKJDn/wg8EonNLO7KkpG/pw9rOiZGFxGjyz6g6idzKx2 u/wsIGYj0LzUxzxwLQqoNwlxmSfuiD7rtuhf+IuT2/6XZVy0FNlzrw32f2A+TsUm n0fAgKCTIVOlaoFIMaH9zn62M4A1PKffs4xYS4AvSWIGxUrNg5DJCPuZPl1vjujc FDrv2D+yqHaDCYsKTtL5PUjf5pm1Cq5UFMrpPM7rFQ4Oz77LV50rSGsqXhr5bB1M NjbIef/HNxJlFtOgVTV0a4LP3Y05yV2nTN73nSOfhWnHnmHg7j3kNsi0UVZ+RMho kdEUjwLD5cqAeHowEM+McBo47JriXg== =4O7L -----END PGP SIGNATURE----- --yiaol2clinc7dqpe--