Immutable branch betweeb the GPIO and I2C trees for v7.2-rc1

- add the gpiod_is_single_ended() helper function
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEkeUTLeW1Rh17omX8BZ0uy/82hMMFAmoByxQACgkQBZ0uy/82
 hMNJlA/7BdwjUu7DNcpIujhMEcNjDcyzHxOCU/e7uP9qO1Y4JGZbCCqP/AOXwekF
 PtCqlnsmA5sx5ILQ+TbIp8aS9DIcJsmBjSrG4J24514Yj850WoIvh+ZqG3w4yE7d
 06G9kLmGiyTI2KrKyI3lDy3KzmIGODYvSpf2vxb/Dub8MdcQ8swt1bBJINc704Rl
 2RNpvfim7bo5AeE5LQl+IT+RQTzuFZs2TAb0a2ZQ3vB8zgc1jt1OeQH9r6+c6MzI
 Mrku79E6ZEp5nIjp3Lhsa0iGlZ1j2X+QisQGJImZgEFTJrcOHpSfUwEbvYoNa+PM
 FLomkvLbuq4nZGz6QDiIZh4YT3qdhXmQnG6fTcmO4ZkTQCkSem+YLilOUPeg9Vgb
 AFzybELEbRXQAe/EGuDlviuPhdnYsOHRwPo9L0aMO5cYdionGCNRt6jpRSRFKcIF
 6C8OcXPcVFfAfbSZ2ftj8GVb34c7f4zHHzNYVUtCJhlHrzmbHGpvh+zRU9O5u1PU
 ZTGqEXUxv9Mer+2/7bUEasrXcERMLfx38Q6sgQTVh9uA8/C7hdtEdwL4TujuJmMC
 gZL0ZudAQ8csoFV3LEOC3DIhNZIRZEKum3UwxW9FQ0Xc6MvXUaqf8XaHDy7AKtde
 xAq5VcuIesZ8pkTICOSxio5y6AHYTdhmG0jRs0avpQLiupdVyfU=
 =J9un
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQScDfrjQa34uOld1VLaeAVmJtMtbgUCaiKNHQAKCRDaeAVmJtMt
 bsBQAQCS8uZRIrHUF6tlb150Pl0vdbwNrXa+nfcV16D3HtI7ZAD+K7K3QrwM/K8m
 55J4xpKHZDomz4pwOUp5vgnn8ets3Qc=
 =9/aq
 -----END PGP SIGNATURE-----

Merge tag 'ib-gpio-add-gpiod-is-single-ended-for-v7.2' into i2c/i2c-host

Immutable branch between the GPIO and I2C trees for v7.2-rc1

- add the gpiod_is_single_ended() helper function
This commit is contained in:
Andi Shyti 2026-06-05 10:46:58 +02:00
commit afd9ada24b
2 changed files with 27 additions and 0 deletions

View File

@ -491,6 +491,28 @@ int gpiod_get_direction(struct gpio_desc *desc)
}
EXPORT_SYMBOL_GPL(gpiod_get_direction);
/**
* gpiod_is_single_ended - check if the GPIO is configured as single-ended
* @desc: the GPIO descriptor to check
*
* Returns true if the GPIO is configured as either Open Drain or Open Source.
* In these modes, the direction of the line cannot always be reliably
* determined by reading hardware registers, as the "off" state (High-Z)
* is physically indistinguishable from an input state.
*/
bool gpiod_is_single_ended(struct gpio_desc *desc)
{
if (!desc)
return false;
if (test_bit(GPIOD_FLAG_OPEN_DRAIN, &desc->flags) ||
test_bit(GPIOD_FLAG_OPEN_SOURCE, &desc->flags))
return true;
return false;
}
EXPORT_SYMBOL_GPL(gpiod_is_single_ended);
/*
* Add a new chip to the global chips list, keeping the list of chips sorted
* by range(means [base, base + ngpio - 1]) order.

View File

@ -111,6 +111,7 @@ void devm_gpiod_unhinge(struct device *dev, struct gpio_desc *desc);
void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs);
int gpiod_get_direction(struct gpio_desc *desc);
bool gpiod_is_single_ended(struct gpio_desc *desc);
int gpiod_direction_input(struct gpio_desc *desc);
int gpiod_direction_output(struct gpio_desc *desc, int value);
int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
@ -337,6 +338,10 @@ static inline int gpiod_get_direction(const struct gpio_desc *desc)
WARN_ON(desc);
return -ENOSYS;
}
static inline bool gpiod_is_single_ended(struct gpio_desc *desc)
{
return false;
}
static inline int gpiod_direction_input(struct gpio_desc *desc)
{
/* GPIO can never have been requested */