mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-08 14:23:19 +00:00
gpiolib: acpi: change acpi_find_gpio() to accept firmware node
In preparation of switching all ACPI-based GPIO lookups to go through acpi_find_gpio() let's change it to accept device node as its argument as we do not always have access to device structure. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
07445ae1c2
commit
2b6bce80ae
@ -906,18 +906,22 @@ static bool acpi_can_fallback_to_crs(struct acpi_device *adev,
|
|||||||
return con_id == NULL;
|
return con_id == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gpio_desc *acpi_find_gpio(struct device *dev,
|
struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
|
||||||
const char *con_id,
|
const char *con_id,
|
||||||
unsigned int idx,
|
unsigned int idx,
|
||||||
enum gpiod_flags *dflags,
|
enum gpiod_flags *dflags,
|
||||||
unsigned long *lookupflags)
|
unsigned long *lookupflags)
|
||||||
{
|
{
|
||||||
struct acpi_device *adev = ACPI_COMPANION(dev);
|
struct acpi_device *adev;
|
||||||
struct acpi_gpio_info info;
|
struct acpi_gpio_info info;
|
||||||
struct gpio_desc *desc;
|
struct gpio_desc *desc;
|
||||||
char propname[32];
|
char propname[32];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
adev = to_acpi_device_node(fwnode);
|
||||||
|
if (!adev)
|
||||||
|
return ERR_PTR(-ENODEV);
|
||||||
|
|
||||||
/* Try first from _DSD */
|
/* Try first from _DSD */
|
||||||
for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) {
|
for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) {
|
||||||
if (con_id) {
|
if (con_id) {
|
||||||
|
@ -48,7 +48,7 @@ int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags,
|
|||||||
int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
|
int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
|
||||||
struct acpi_gpio_info *info);
|
struct acpi_gpio_info *info);
|
||||||
|
|
||||||
struct gpio_desc *acpi_find_gpio(struct device *dev,
|
struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
|
||||||
const char *con_id,
|
const char *con_id,
|
||||||
unsigned int idx,
|
unsigned int idx,
|
||||||
enum gpiod_flags *dflags,
|
enum gpiod_flags *dflags,
|
||||||
@ -83,7 +83,7 @@ acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline struct gpio_desc *
|
static inline struct gpio_desc *
|
||||||
acpi_find_gpio(struct device *dev, const char *con_id,
|
acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id,
|
||||||
unsigned int idx, enum gpiod_flags *dflags,
|
unsigned int idx, enum gpiod_flags *dflags,
|
||||||
unsigned long *lookupflags)
|
unsigned long *lookupflags)
|
||||||
{
|
{
|
||||||
|
@ -4133,7 +4133,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
|
|||||||
con_id, idx, &lookupflags);
|
con_id, idx, &lookupflags);
|
||||||
} else if (is_acpi_node(fwnode)) {
|
} else if (is_acpi_node(fwnode)) {
|
||||||
dev_dbg(dev, "using ACPI for GPIO lookup\n");
|
dev_dbg(dev, "using ACPI for GPIO lookup\n");
|
||||||
desc = acpi_find_gpio(dev, con_id, idx, &flags, &lookupflags);
|
desc = acpi_find_gpio(fwnode,
|
||||||
|
con_id, idx, &flags, &lookupflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user