From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7AFFCD13D9 for ; Sat, 31 Aug 2024 20:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zNLmAJnyx71Pfq582arlmL8j4PFld3o+5DDO21ix+4Y=; b=xgPCmR/hP/lkpHC6565dBhlCYm gJJPd7pk37NOpz4CM/lteCJdNsfpUWiZb0ItgbDDrrrk/3dEdgqAjyPQ/Sn9UVQoDguTyTGIlk5Uh SmYzuAA1QgJoCaEuiyeoN9K8T52xQVkFHwJ6S0QiQ+c6ll6rMY9yGLKkCWG/EL1wzUzHAXrh2Ku2g 8JbzhT5n1EoQpro+XhrR77+kN+mKsNukn8XUF5LdpD+kmX5Slb0lpJD42LucHUyAkCu9EawFoWcUX t1KCIFsxKADWB/yr+WBV0hZNdiuz8V0UMKdmZI6+gxw27fUg3t7+NjJ0ksyPpUoYDBVHLaBvl5PDR 60sjPyQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1skVBS-0000000A5NN-0pGp; Sat, 31 Aug 2024 20:58:58 +0000 Received: from zeus03.de ([194.117.254.33] helo=mail.zeus03.de) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1skVAW-0000000A5DJ-3482 for linux-arm-kernel@lists.infradead.org; Sat, 31 Aug 2024 20:58:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=k1; bh=zNLm AJnyx71Pfq582arlmL8j4PFld3o+5DDO21ix+4Y=; b=QRR6qaVUCK9erdhPo/Kn RM4MzI8VO1I5PIhMNETeU36cX7bmnK3ex8VQVNcx1YJirWFENkhTy/kkHs1oZfdq xJDpjgfENgK7e0KZsUobD0Z4TL/EicgbE9lngHrinfNy72RKisf4crSE+9Hec9jY dt3pJcNXldbjhL6rKMlug5rkW1pCat7yh3hfkoaFbfnFWc46CxzyRV0D90rGH1ju 3nOx4C6NiM76+vUp1/eoScCerB2ro1m6bpO7fyzC38UDvcKRSkXR0h3lDzAX0dNP kPNI+wDnc7P9fjWA5xRdfqR5/gdS5bkfSGw+obJxiEN4uigZ1Yg0+d8lQyuJXObC Vw== Received: (qmail 3635973 invoked from network); 31 Aug 2024 22:57:53 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 31 Aug 2024 22:57:53 +0200 X-UD-Smtp-Session: l3s3148p1@KE0j9gAh43xtKnBL Date: Sat, 31 Aug 2024 22:57:53 +0200 From: Wolfram Sang To: Farouk Bouabid Cc: Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Quentin Schulz , Peter Rosin , Jean Delvare , Guenter Roeck , Heiko Stuebner , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH v6 2/8] i2c: muxes: add support for tsd,mule-i2c multiplexer Message-ID: Mail-Followup-To: Wolfram Sang , Farouk Bouabid , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Quentin Schulz , Peter Rosin , Jean Delvare , Guenter Roeck , Heiko Stuebner , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org References: <20240725-dev-mule-i2c-mux-v6-0-f9f6d7b60fb2@cherry.de> <20240725-dev-mule-i2c-mux-v6-2-f9f6d7b60fb2@cherry.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dpR/Rm59Kxtb9gux" Content-Disposition: inline In-Reply-To: <20240725-dev-mule-i2c-mux-v6-2-f9f6d7b60fb2@cherry.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240831_135801_679521_0503C92C X-CRM114-Status: GOOD ( 20.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --dpR/Rm59Kxtb9gux Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Thu, Jul 25, 2024 at 03:27:48PM +0200, Farouk Bouabid wrote: > Theobroma Systems Mule is an MCU that emulates a set of I2C devices, > among which an amc6821 and devices that are reachable through an I2C-mux. > The devices on the mux can be selected by writing the appropriate device > number to an I2C config register (amc6821 reg 0xff). >=20 > This driver is expected to be probed as a platform device with amc6821 > as its parent i2c device. >=20 > Add support for the mule-i2c-mux platform driver. The amc6821 driver > support for the mux will be added in a later commit. Seems like DT maintainers are happy with the approach. From the I2C perspective, this seems suitable as well. Just a few minor comments. Can be fixed incrementally, from my POV. But basically: Reviewed-by: Wolfram Sang > +static inline int __mux_select(struct regmap *regmap, u32 dev) > +{ > + return regmap_write(regmap, MUX_CONFIG_REG, dev); > +} Does this really need to be a seperate function? I'd vote for merging it into 'mux_select'. Also the __-prefix often means unlocked versions of some call, so it is also a bit misleading. > +static int mule_i2c_mux_probe(struct platform_device *pdev) > +{ > + struct device *mux_dev =3D &pdev->dev; > + struct mule_i2c_reg_mux *priv; > + struct i2c_client *client; > + struct i2c_mux_core *muxc; > + struct device_node *dev; > + unsigned int readback; > + int ndev, ret; > + bool old_fw; > + > + /* Count devices on the mux */ > + ndev =3D of_get_child_count(mux_dev->of_node); > + dev_dbg(mux_dev, "%d devices on the mux\n", ndev); > + > + client =3D to_i2c_client(mux_dev->parent); > + > + muxc =3D i2c_mux_alloc(client->adapter, mux_dev, ndev, sizeof(*priv), > + I2C_MUX_LOCKED, mux_select, mux_deselect); > + if (!muxc) > + return dev_err_probe(mux_dev, -ENOMEM, > + "Failed to allocate mux struct\n"); alloc_functions usually print something when failing. > + ret =3D i2c_mux_add_adapter(muxc, 0, reg); > + if (ret) > + return dev_err_probe(mux_dev, ret, > + "Failed to add i2c mux adapter %d\n", reg); The 'add_adapter' functions for sure print something when failing. Thanks! Wolfram --dpR/Rm59Kxtb9gux Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmbTg8kACgkQFA3kzBSg Kbal7A/+PM4jZgxWTav2ZDGWds/ujnuVdXWpyfQu+IY/MpQVfmm2dqNa8Ru9RZW8 +RWhVE9EGt18HBsFki7E701Xv9ZwIy925OBGEk/UZEY4z5cjCPpQwCbKTjAy2+LR LzDJQ3a1lMShSYyjUHFPdmglAOKcVbk1sBBXUnRVAYrgyXpzmn2XHpro+qLc7VPP Xz+qyZfh4hgMFzThbY++4zk6PhH9fz34KDrDOJX8oToWLr84D+ItcXH2hFg2+fi8 Du0jIGP+zuhbXvaIkldW7yEjQllEXZXySUoVirgx1IRM9eO4Kgrmu35aUrKCMyOp 2KhKskdPlXDhL0IMYmUtdK3BFo3gqFC0KXNEFaSswdNCt8776BDKQnpCV+78mpTu UOIHvYSLrSH2iWGlVJxsMwbT8Y22ty6/XmiRt0kVl2TqbfYIth42zQFjq26XPAOi Ku6eQteE5AJs/098KcZpCICiJgOW/AfvuwGwRHu/5G3lUcHSr0EHGhk9TKrewA7w n6li/coMHaRt3v5UORaTJ9MopLSW/HNsWg/vm0IKMbQV7KElKd/hELnb7t6PY+46 i3dIgp3DTSAqjJIJA3VpQCqI6ZptLBt7Me0yhQe50uznOp2jykz+1bfVat5eCuZ9 r9tgtViUP8BXvjc+yqvaXtnF73dhazVyP4vUasuyhghGYbMwHG0= =ems9 -----END PGP SIGNATURE----- --dpR/Rm59Kxtb9gux--