Re: [PATCH v4 2/3] platform/x86: int3472: Call "reset" GPIO "enable" for INT347E

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

On Fri, Jan 31, 2025 at 01:22:19PM +0200, Andy Shevchenko wrote:
> On Fri, Jan 31, 2025 at 09:37:06AM +0200, Sakari Ailus wrote:
> > The DT bindings for ov7251 specify "enable" GPIO (xshutdown in
> > documentation) but the int3472 indiscriminately provides this as a "reset"
> > GPIO to sensor drivers. Take this into account by assigning it as "enable"
> > with active high polarity for INT347E devices, i.e. ov7251. "reset" with
> > active low polarity remains the default GPIO name for other devices.
> 
> ...
> 
> > +static void int3472_get_func_and_polarity(struct acpi_device *adev, u8 *type,
> > +					  const char **func, unsigned long *gpio_flags)
> >  {
> > -	switch (type) {
> > +	unsigned int i;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(int3472_gpio_map); i++) {
> 
> > +		if (*type != int3472_gpio_map[i].type_from ||
> > +		    !acpi_dev_hid_uid_match(adev, int3472_gpio_map[i].hid, NULL))
> > +			continue;
> 
> I think in a split form it is easier to read and maintain:
> 
> 		if (!acpi_dev_hid_uid_match(adev, int3472_gpio_map[i].hid, NULL))
> 			continue;
> 
> 		if (*type != int3472_gpio_map[i].type_from)
> 			continue;

Works for me, with the order reverted. I'll send v5.

> 
> > +		*type = int3472_gpio_map[i].type_to;
> 
> > +		*gpio_flags = int3472_gpio_map[i].polarity_low ?
> > +			GPIO_ACTIVE_LOW : GPIO_ACTIVE_HIGH;
> 
> Still can be one line (100 characters). But in this case I have no strong
> preference. Up to Hans.
> 
> > +		*func = int3472_gpio_map[i].func;
> > +		return;
> > +	}
> 

-- 
Regards,

Sakari Ailus




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux