From mboxrd@z Thu Jan 1 00:00:00 1970 From: Quentin Schulz Subject: Re: [PATCH v2 03/10] pinctrl: axp209: use drv_data of pinctrl_pin_desc to store pin reg Date: Tue, 26 Sep 2017 15:17:05 +0200 Message-ID: <0ae64e95-ee49-fb4c-e79b-e8c25c86580c@free-electrons.com> References: <7993a30fbc2e50a2d228fa0c8fad643c4034b101.1506428208.git-series.quentin.schulz@free-electrons.com> <20170926130108.uibnri32b73elfy6@flea> Reply-To: quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vSHPog3EoUl0rPKW3pRvkEVwkG1WG7sTx" Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org In-Reply-To: <20170926130108.uibnri32b73elfy6@flea> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Maxime Ripard Cc: linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, wens-jdAy2FN1RRM@public.gmane.org, linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org, lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org List-Id: linux-gpio@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vSHPog3EoUl0rPKW3pRvkEVwkG1WG7sTx Content-Type: multipart/mixed; boundary="vrocQsabtXwawM6sGkv2mo3NPT4vHRvTS"; protected-headers="v1" From: Quentin Schulz To: Maxime Ripard Cc: linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, wens-jdAy2FN1RRM@public.gmane.org, linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org, lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org Message-ID: <0ae64e95-ee49-fb4c-e79b-e8c25c86580c-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> Subject: Re: [PATCH v2 03/10] pinctrl: axp209: use drv_data of pinctrl_pin_desc to store pin reg References: <7993a30fbc2e50a2d228fa0c8fad643c4034b101.1506428208.git-series.quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> <20170926130108.uibnri32b73elfy6@flea> In-Reply-To: <20170926130108.uibnri32b73elfy6@flea> --vrocQsabtXwawM6sGkv2mo3NPT4vHRvTS Content-Type: text/plain; charset="UTF-8" Content-Language: en-US Hi Maxime, On 26/09/2017 15:01, Maxime Ripard wrote: > On Tue, Sep 26, 2017 at 12:17:13PM +0000, Quentin Schulz wrote: >> Instead of using a function to retrieve each pin's correct control >> register, use drv_data within pinctrl_pin_desc to store the ctrl reg. >> >> Remove axp20x_gpio_get_reg and replace every occurrence by a get from >> drv_data. > > Why do you need to do that? This should be explained. > Agreed that it misses an explanation. Today, to get a register addr of one of the GPIOs in the PMIC, we basically get the GPIO number and returns the register via this info. There are 3 GPIOs in AXP209, 2 in AXP813. I didn't want to have a switch case for the GPIO number and then an if/else inside one of the case to check if the device is AXP209 or AXP813 in which case we return -EINVAL instead of the GPIO2 reg. With support for new PMIC, we would have a bunch of if conditions and complexify the process for something really simple. IMHO, this also allows easier integration of future PMICs which might have different regs for the GPIOs. I don't *need* it but I find this solution nicer. Thanks, Quentin -- Quentin Schulz, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. --vrocQsabtXwawM6sGkv2mo3NPT4vHRvTS-- --vSHPog3EoUl0rPKW3pRvkEVwkG1WG7sTx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJZylNRAAoJEIS4mnU+4PGjausP/jCLjovT11NgMXFOVjpQzfXz MzOgi+lsdHY9fX+D3+l/RzC6ptBJbokeaWC6nqhiwMBHx5m3yI0hiNOQKQjn9HSi 7APd+jVP5DGJfKhPORSbggGuWOU1c19Yf+GdtTV2PuEysXGztU4m2Ye+JHFd3ywA +Ky7t8mrpi1yRVVoqGROnMqHARaWqzLqKF308gL4Xi5nnUgrUht4TFS0K2z67hoX JqAN8ewqBVfx1RAOct6KYL051QbP1rp7uRahWEDchBCrJ706oF7iFpLhJ7JkQPaN 0fASEfTeC8T7SOdYImJCY1Sr8H98FKyBeshYxNTjnZKqzDJoui7/D2+b5XbbUEo3 V6SC6FCVCFVlWut/h3Y9HIzi8d9nFKrHYXZpOUqVta8hi0L/TuKpNAl07uuI6sKm 2zQjcKAN15L3SqyLsLNgtfEFQM0a+PXnseK99lTgFihzipayfTAwUDRGUmU2MTXn hLXQSFLTIjJsWT8ci0x0BrIS80/GrFc8NCw75zr1F9XmYqNzS+qpckdg2iIaCuUp 39mNK8u4Y+AAs17GtNXzvi/wT0sh2tKLb7Fb4PWMXg3rhNBJt8a+UGS5aN5lklLy SR5GAUjZX2d9+nSnIb3OUb0Ranw7bKzz9yzXIA7o82IxzHv/GLUpIaNrrDyki5LB gE0rot06wA11hwv9ZDua =Oin5 -----END PGP SIGNATURE----- --vSHPog3EoUl0rPKW3pRvkEVwkG1WG7sTx--