ACPI / gpio: Updates to properties
Subsystems (3)
PATCH 1/5 ACPI / documentation: Use recommended name in GPIO property names
In reply to Mika WesterbergThe recommended property name for all kinds of GPIOs is to end it with "-gpios" even if there is only one GPIO. Update the documentation to follow this fact.
--- Documentation/acpi/gpio-properties.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Documentation/acpi/gpio-properties.txt +5 -5
@@ -28,8 +28,8 @@ index, like the ASL example below shows: ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { - Package () {"reset-gpio", Package() {^BTH, 1, 1, 0 }}, - Package () {"shutdown-gpio", Package() {^BTH, 0, 0, 0 }}, + Package () {"reset-gpios", Package() {^BTH, 1, 1, 0 }}, + Package () {"shutdown-gpios", Package() {^BTH, 0, 0, 0 }}, } }) }
@@ -48,7 +48,7 @@ Since ACPI GpioIo() resource does not have a field saying whether it is active low or high, the "active_low" argument can be used here. Setting it to 1 marks the GPIO as active low. -In our Bluetooth example the "reset-gpio" refers to the second GpioIo() +In our Bluetooth example the "reset-gpios" refers to the second GpioIo() resource, second pin in that resource with the GPIO number of 31. ACPI GPIO Mappings Provided by Drivers
@@ -83,8 +83,8 @@ static const struct acpi_gpio_params reset_gpio = { 1, 1, false }; static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false }; static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = { - { "reset-gpio", &reset_gpio, 1 }, - { "shutdown-gpio", &shutdown_gpio, 1 }, + { "reset-gpios", &reset_gpio, 1 }, + { "shutdown-gpios", &shutdown_gpio, 1 }, { }, };
Signature · 1 line
2.9.3
PATCH 3/5 ACPI / gpio: Add hogging support
In reply to Mika WesterbergGPIO hogging means that the GPIO controller can "hog" and configure certain GPIOs without need for a driver or userspace to do that. This is useful in open-connected boards where BIOS cannot possibly know beforehand which devices will be connected to the board.
This adds GPIO hogging mechanism to ACPI analogous to Device Tree.
--- Documentation/acpi/gpio-properties.txt | 26 ++++++++++++ drivers/gpio/gpiolib-acpi.c | 72 ++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+)
Documentation/acpi/gpio-properties.txt +26 -0
@@ -69,6 +69,32 @@ Example: } } +- gpio-hog +- output-high +- output-low +- input +- line-name + +Example: + + Name (_DSD, Package () { + // _DSD Hierarchical Properties Extension UUID + ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), + Package () { + Package () {"hog-gpio8", "G8PU"} + } + }) + + Name (G8PU, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () {"gpio-hog", 1}, + Package () {"gpios", Package () {8, 0}}, + Package () {"output-high", 1}, + Package () {"line-name", "gpio8-pullup"}, + } + }) + See Documentation/devicetree/bindings/gpio/gpio.tx for more information about these properties.
drivers/gpio/gpiolib-acpi.c +72 -0
90 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 4/5 ACPI / property: Allow holes in reference properties
In reply to Mika WesterbergDT allows holes or empty phandles for references. This is used for example in SPI subsystem where some chip selects are native and others are regular GPIOs. In ACPI _DSD we currently do not support this but instead the preceding reference "consumes" all following integer arguments.
For example we would like to support something like the below ASL fragment for SPI:
Package () {
"cs-gpios",
Package () {
^GPIO, 19, 0, 0, // GPIO CS0
0, // Native CS
^GPIO, 20, 0, 0, // GPIO CS1
}
}The zero in the middle means "no entry" or NULL reference. To support this we add a new function acpi_node_get_property_reference_fixed_args() that takes number of expected arguments as parameter. Function returns -ENOENT if the corresponding index resolves to the "no entry" reference.
--- drivers/acpi/property.c | 116 +++++++++++++++++++++++++++++++++++------------- include/linux/acpi.h | 3 ++ 2 files changed, 89 insertions(+), 30 deletions(-)
drivers/acpi/property.c +86 -30
@@ -472,6 +472,7 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* @data: ACPI device data object containing the property * @propname: Name of the property * @index: Index of the reference to return +* @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments * * Find property with @name, verifify that it is a package containing at least
@@ -485,8 +486,8 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* Return: %0 on success, negative error code on failure. */ static int acpi_data_get_property_reference (struct acpi_device_data *data, -const char *propname,size_t index, -struct acpi_reference_args *args) +const char *propname,size_t index,size_t num_args, +struct acpi_reference_args *args) {const union acpi_object *element, *end;const union acpi_object *obj;
@@ -532,41 +533,52 @@ static int acpi_data_get_property_reference(struct acpi_device_data *data,while (element < end) {u32 nargs, i; -if (element->type !=ACPI_TYPE_LOCAL_REFERENCE ) -return -EPROTO ; - - ret =acpi_bus_get_device (element->reference.handle, &device); -if (ret) -return -ENODEV ; - - element++; - nargs =0 ; - -/* assume following integer elements are all args */ -for (i =0 ; element + i < end; i++) { -int type = element[i].type; +if (element->type ==ACPI_TYPE_LOCAL_REFERENCE ) { + ret =acpi_bus_get_device (element->reference.handle, + &device); +if (ret) +return -ENODEV ; + + nargs =0 ; + element++; + +/* assume following integer elements are all args */ +for (i =0 ; element + i < end && i < num_args; i++) { +int type = element[i].type; + +if (type ==ACPI_TYPE_INTEGER ) + nargs++; +else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) +break ; +else +return -EPROTO ; + } -if (type ==ACPI_TYPE_INTEGER ) - nargs++; -else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) -break ; -else +if (nargs >MAX_ACPI_REFERENCE_ARGS )return -EPROTO ; - } -if (idx++ == index) { - args->adev = device; - args->nargs = nargs; -for (i =0 ; i < nargs; i++) - args->args[i] = element[i].integer.value; +if (idx == index) { + args->adev = device; + args->nargs = nargs; +for (i =0 ; i < nargs; i++) + args->args[i] = element[i].integer.value; -return 0 ; +return 0 ; + } + + element += nargs; + }else if (element->type ==ACPI_TYPE_INTEGER ) { +if (idx == index) +return -ENOENT ; + element++; + }else { +return -EPROTO ; } - element += nargs; + idx++; } -return -EPROTO ; +return -ENODATA ; }/**
@@ -582,10 +594,54 @@ int acpi_node_get_property_reference(struct fwnode_handle *fwnode, {struct acpi_device_data *data =acpi_device_data_of_node (fwnode); -return data ?acpi_data_get_property_reference (data, name, index, args) : -EINVAL ; +if (!data) +return -EINVAL ; + +return acpi_data_get_property_reference (data, name, index, +MAX_ACPI_REFERENCE_ARGS , args); }EXPORT_SYMBOL_GPL (acpi_node_get_property_reference); +/** +* acpi_node_get_property_reference_fixed_args - get a reference from property +* @fwnode: Firmware node to get the property from. +* @propname: Name of the property. +* @index: Index of the reference to return. +* @num_args: Expected number of arguments following each reference. +* @args: Location to store the returned reference with optional arguments. +* +* Using this function it is possible to leave "holes" in the property +* value set like in an example below: +* +* Package () { +* "cs-gpios", +* Package () { +* ^GPIO, 19, 0, 0, +* ^GPIO, 20, 0, 0, +* 0, +* ^GPIO, 21, 0, 0, +* } +* } +* +* Calling this function with index %2 return %-ENOENT and with index %3 +* returns the last entry. If the property does not contain any more values +* %-ENODATA is returned. The NULL entry must be single integer and +* preferably contain value %0. +*/ +int acpi_node_get_property_reference_fixed_args (struct fwnode_handle *fwnode, +const char *name,size_t index,size_t num_args, +struct acpi_reference_args *args) +{ +struct acpi_device_data *data =acpi_device_data_of_node (fwnode); + +if (!data) +return -EINVAL ; + +return acpi_data_get_property_reference (data, name, index, num_args, + args); +} +EXPORT_SYMBOL_GPL (acpi_node_get_property_reference_fixed_args); +static int acpi_data_prop_read_single (struct acpi_device_data *data,const char *propname,enum dev_prop_type proptype,void *val)
include/linux/acpi.h +3 -0
@@ -930,6 +930,9 @@ int acpi_dev_get_property(struct acpi_device *adev, const char *name,int acpi_node_get_property_reference (struct fwnode_handle *fwnode,const char *name,size_t index,struct acpi_reference_args *args); +int acpi_node_get_property_reference_fixed_args (struct fwnode_handle *fwnode, +const char *name,size_t index,size_t num_args, +struct acpi_reference_args *args);int acpi_node_prop_get (struct fwnode_handle *fwnode,const char *propname,void **valptr);
Signature · 1 line
2.9.3
PATCH 2/5 ACPI / gpio: Add support for naming GPIOs
In reply to Mika WesterbergDT has property 'gpio-line-names' to name GPIO lines the controller has if present. Use this very same property in ACPI as well to provide nice names for the GPIOS.
--- Documentation/acpi/gpio-properties.txt | 21 +++++++++++++++++ drivers/gpio/gpiolib-acpi.c | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+)
Documentation/acpi/gpio-properties.txt +21 -0
@@ -51,6 +51,27 @@ it to 1 marks the GPIO as active low. In our Bluetooth example the "reset-gpios" refers to the second GpioIo() resource, second pin in that resource with the GPIO number of 31. +Other supported properties +-------------------------- + +Following Device Tree compatible device properties are also supported by +_DSD device properties for GPIO controllers: + +- gpio-line-names + +Example: + + Package () { + "gpio-line-names", + Package () { + "SPI0_CS_N", "EXP2_INT", "MUX6_IO", "UART0_RXD", "MUX7_IO", + "LVL_C_A1", "MUX0_IO", "SPI1_MISO" + } + } + +See Documentation/devicetree/bindings/gpio/gpio.tx for more information +about these properties. + ACPI GPIO Mappings Provided by Drivers --------------------------------------
drivers/gpio/gpiolib-acpi.c +43 -0
55 lines not on this page · raw message
Signature · 1 line
2.9.3
cover ACPI / gpio: Updates to properties
Hi,
This series brings couple of useful GPIO related properties from Device Tree to ACPI _DSD device properties:
- Names for GPIO lines
- GPIO hogging
- Holes in GPIO property lists
We are using these to get Intel Galileo better supported in the mainline kernel (but these may be useful for other boards as well). For example SPI chip select on Galileo is connected to a GPIO line so we need to be able to describe it in ACPI, and at the same time allow native chip selects.
GPIO hogging can be used to set initial state of certain GPIOs available on the headers regardless of the BIOS settings (which may be wrong as it knows nothing about which devices have been connected).
Mika Westerberg (5):
ACPI / documentation: Use recommended name in GPIO property names ACPI / gpio: Add support for naming GPIOs
ACPI / gpio: Add hogging support
ACPI / property: Allow holes in reference properties ACPI / gpio: Allow holes in list of GPIOs for a device
Documentation/acpi/gpio-properties.txt | 72 ++++++++++++++-- drivers/acpi/property.c | 116 +++++++++++++++++++------- drivers/gpio/gpiolib-acpi.c | 147 ++++++++++++++++++++++++++++++--- include/linux/acpi.h | 3 + 4 files changed, 292 insertions(+), 46 deletions(-)
Signature · 1 line
2.9.3
PATCH 5/5 ACPI / gpio: Allow holes in list of GPIOs for a device
Make it possible to have an empty GPIOs in a GPIO list for device. For example a SPI master may use both GPIOs and native pins as chip selects and we need to be able to distinguish between the two.
This makes it mandatory to have exactly 3 arguments for GPIOs and then converts gpiolib to use of acpi_node_get_property_reference_fixed_args() instead. In addition we make acpi_gpio_package_count() to handle holes as well (this matches the DT version).
--- Documentation/acpi/gpio-properties.txt | 15 +++++++++++++++ drivers/gpio/gpiolib-acpi.c | 32 +++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 11 deletions(-)
Documentation/acpi/gpio-properties.txt +15 -0
@@ -51,6 +51,21 @@ it to 1 marks the GPIO as active low. In our Bluetooth example the "reset-gpios" refers to the second GpioIo() resource, second pin in that resource with the GPIO number of 31. +It is possible to leave holes in the array of GPIOs. This is useful in +cases like with SPI host controllers where some chip selects may be +implemented as GPIOs and some as native signals. For example a SPI host +controller can have chip selects 0 and 2 implemented as GPIOs and 1 as +native: + + Package () { + "cs-gpios", + Package () { + ^GPIO, 19, 0, 0, // chip select 0: GPIO + 0, // chip select 1: native signal + ^GPIO, 20, 0, 0, // chip select 2: GPIO + } + } + Other supported properties --------------------------
drivers/gpio/gpiolib-acpi.c +21 -11
@@ -467,7 +467,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,int ret;memset (&args,0 ,sizeof (args)); - ret =acpi_node_get_property_reference (fwnode, propname, index, &args); + ret =acpi_node_get_property_reference_fixed_args (fwnode, propname, + index,3 , &args);if (ret) {struct acpi_device *adev =to_acpi_device_node (fwnode);
@@ -482,13 +483,13 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,* on returned args. */ lookup->adev = args.adev; -if (args.nargs >=2 ) { - lookup->index = args.args[0 ]; - lookup->pin_index = args.args[1 ]; -/* 3rd argument, if present is used to specify active_low. */ -if (args.nargs >=3 ) - lookup->active_low = !!args.args[2 ]; - } +if (args.nargs !=3 ) +return -EPROTO ; + + lookup->index = args.args[0 ]; + lookup->pin_index = args.args[1 ]; + lookup->active_low = !!args.args[2 ]; +return 0 ; }
@@ -979,18 +980,27 @@ void acpi_gpiochip_remove(struct gpio_chip *chip)kfree (acpi_gpio); } -static unsigned int acpi_gpio_package_count (const union acpi_object *obj) +static int acpi_gpio_package_count (const union acpi_object *obj) {const union acpi_object *element = obj->package.elements;const union acpi_object *end = element + obj->package.count;unsigned int count =0 ;while (element < end) { -if (element->type ==ACPI_TYPE_LOCAL_REFERENCE ) +switch (element->type) { +case ACPI_TYPE_LOCAL_REFERENCE : + element +=3 ; +/* Fallthrough */ +case ACPI_TYPE_INTEGER : + element++; count++; +break ; - element++; +default : +return -EPROTO ; + } } +return count; }
Signature · 1 line
2.9.3
Rafael J. Wysocki
maintainerHi,
Quoted 25 lines · Mika Westerberg
Hi,
This series brings couple of useful GPIO related properties from Device Tree to ACPI
_DSDdevice properties:- Names for GPIO lines
- GPIO hogging
- Holes in GPIO property listsWe are using these to get Intel Galileo better supported in the mainline kernel (but these may be useful for other boards as well). For example SPI chip select on Galileo is connected to a GPIO line so we need to be able to describe it in ACPI, and at the same time allow native chip selects.
GPIO hogging can be used to set initial state of certain GPIOs available on the headers regardless of the BIOS settings (which may be wrong as it knows nothing about which devices have been connected).
Mika Westerberg (5):
ACPI / documentation: Use recommended name in GPIO property names ACPI / gpio: Add support for naming GPIOs
ACPI / gpio: Add hogging support
ACPI / property: Allow holes in reference properties ACPI / gpio: Allow holes in list of GPIOs for a device
Quoted 5 lines
Documentation/acpi/gpio-properties.txt | 72 ++++++++++++++-- drivers/acpi/property.c | 116 +++++++++++++++++++------- drivers/gpio/gpiolib-acpi.c | 147 ++++++++++++++++++++++++++++++--- include/linux/acpi.h | 3 + 4 files changed, 292 insertions(+), 46 deletions(-)
I would like to tackle patches [1/5] and [4/5] first, as they are core patches and the rest is against gpiolib-acpi.
Moreover, the documentation patch [1/5] looks like immediately applicable to me.
Thanks,
Rafael
Rafael J. Wysocki
maintainerRe: [PATCH 4/5] ACPI / property: Allow holes in reference properties
In reply to Mika WesterbergQuoted 133 lines · Mika Westerberg
DT allows holes or empty phandles for references. This is used for example in SPI subsystem where some chip selects are native and others are regular GPIOs. In ACPI
_DSDwe currently do not support this but instead the preceding reference "consumes" all following integer arguments.For example we would like to support something like the below ASL fragment for SPI:
Package () { "cs-gpios", Package () { ^GPIO, 19, 0, 0, // GPIO CS0 0, // Native CS ^GPIO, 20, 0, 0, // GPIO CS1 } }The zero in the middle means "no entry" or NULL reference. To support this we add a new function
acpi_node_get_property_reference_fixed_args()that takes number of expected arguments as parameter. Function returns-ENOENTif the corresponding index resolves to the "no entry" reference.Signed-off-by Mika Westerberg <[email protected]>--- drivers/acpi/property.c | 116 +++++++++++++++++++++++++++++++++++------------- include/linux/acpi.h | 3 ++ 2 files changed, 89 insertions(+), 30 deletions(-)drivers/acpi/property.c +41
-29@@ -472,6 +472,7 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* @data: ACPI device data object containing the property * @propname: Name of the property * @index: Index of the reference to return +* @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments * * Find property with @name, verifify that it is a package containing at least @@ -485,8 +486,8 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* Return: %0 on success, negative error code on failure. */ static int acpi_data_get_property_reference (struct acpi_device_data *data, -const char *propname,size_t index, -struct acpi_reference_args *args) +const char *propname,size_t index,size_t num_args, +struct acpi_reference_args *args) {const union acpi_object *element, *end;const union acpi_object *obj;@@ -532,41 +533,52 @@ static int acpi_data_get_property_reference(struct acpi_device_data *data,while (element < end) {u32 nargs, i; -if (element->type !=ACPI_TYPE_LOCAL_REFERENCE ) -return -EPROTO ; - - ret =acpi_bus_get_device (element->reference.handle, &device); -if (ret) -return -ENODEV ; - - element++; - nargs =0 ; - -/* assume following integer elements are all args */ -for (i =0 ; element + i < end; i++) { -int type = element[i].type; +if (element->type ==ACPI_TYPE_LOCAL_REFERENCE ) { + ret =acpi_bus_get_device (element->reference.handle, + &device); +if (ret) +return -ENODEV ; + + nargs =0 ; + element++; + +/* assume following integer elements are all args */ +for (i =0 ; element + i < end && i < num_args; i++) { +int type = element[i].type; + +if (type ==ACPI_TYPE_INTEGER ) + nargs++; +else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) +break ; +else +return -EPROTO ; + } -if (type ==ACPI_TYPE_INTEGER ) - nargs++; -else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) -break ; -else +if (nargs >MAX_ACPI_REFERENCE_ARGS )return -EPROTO ; - } -if (idx++ == index) { - args->adev = device; - args->nargs = nargs; -for (i =0 ; i < nargs; i++) - args->args[i] = element[i].integer.value; +if (idx == index) { + args->adev = device; + args->nargs = nargs; +for (i =0 ; i < nargs; i++) + args->args[i] = element[i].integer.value; -return 0 ; +return 0 ; + } + + element += nargs; + }else if (element->type ==ACPI_TYPE_INTEGER ) { +if (idx == index) +return -ENOENT ; + element++; + }else { +return -EPROTO ; } - element += nargs; + idx++; } -return -EPROTO ; +return -ENODATA ; }/** @@ -582,10 +594,54 @@ int acpi_node_get_property_reference(struct fwnode_handle *fwnode, {
drivers/acpi/property.c int acpi_node_get_property_reference(struct fwnode_handle *fwnode, · line 603
Quoted 10 lines
drivers/acpi/property.c +5
-1struct acpi_device_data *data =acpi_device_data_of_node (fwnode); -return data ?acpi_data_get_property_reference (data, name, index, args) : -EINVAL ; +if (!data) +return -EINVAL ; + +return acpi_data_get_property_reference (data, name, index, +MAX_ACPI_REFERENCE_ARGS , args); }EXPORT_SYMBOL_GPL (acpi_node_get_property_reference);
gpiolib-acpi is the only user of this AFAICS, so why don't we change the definition of acpi_node_get_property_reference() to take one extra argument and update the caller to pass MAX_ACPI_REFERENCE_ARGS?
We'd avoid having to define the thing below then.
Quoted 49 lines
drivers/acpi/property.c +40
-0+/** +* acpi_node_get_property_reference_fixed_args - get a reference from property +* @fwnode: Firmware node to get the property from. +* @propname: Name of the property. +* @index: Index of the reference to return. +* @num_args: Expected number of arguments following each reference. +* @args: Location to store the returned reference with optional arguments. +* +* Using this function it is possible to leave "holes" in the property +* value set like in an example below: +* +* Package () { +* "cs-gpios", +* Package () { +* ^GPIO, 19, 0, 0, +* ^GPIO, 20, 0, 0, +* 0, +* ^GPIO, 21, 0, 0, +* } +* } +* +* Calling this function with index %2 return %-ENOENT and with index %3 +* returns the last entry. If the property does not contain any more values +* %-ENODATA is returned. The NULL entry must be single integer and +* preferably contain value %0. +*/ +int acpi_node_get_property_reference_fixed_args (struct fwnode_handle *fwnode, +const char *name,size_t index,size_t num_args, +struct acpi_reference_args *args) +{ +struct acpi_device_data *data =acpi_device_data_of_node (fwnode); + +if (!data) +return -EINVAL ; + +return acpi_data_get_property_reference (data, name, index, num_args, + args); +} +EXPORT_SYMBOL_GPL (acpi_node_get_property_reference_fixed_args); +static int acpi_data_prop_read_single (struct acpi_device_data *data,const char *propname,enum dev_prop_type proptype,void *val)include/linux/acpi.h +0
-0
include/linux/acpi.h int acpi_dev_get_property(struct acpi_device *adev, const char *name,
Quoted 10 lines
include/linux/acpi.h +3
-1@@ -930,6 +930,9 @@ int acpi_dev_get_property(struct acpi_device *adev, const char *name,int acpi_node_get_property_reference (struct fwnode_handle *fwnode,const char *name,size_t index,struct acpi_reference_args *args); +int acpi_node_get_property_reference_fixed_args (struct fwnode_handle *fwnode, +const char *name,size_t index,size_t num_args, +struct acpi_reference_args *args);int acpi_node_prop_get (struct fwnode_handle *fwnode,const char *propname,void **valptr); --
Thanks,
Rafael
Re: [PATCH 4/5] ACPI / property: Allow holes in reference properties
Quoted 137 lines · Rafael J. Wysocki
Quoted 135 lines · Mika Westerberg
DT allows holes or empty phandles for references. This is used for example in SPI subsystem where some chip selects are native and others are regular GPIOs. In ACPI
_DSDwe currently do not support this but instead the preceding reference "consumes" all following integer arguments.For example we would like to support something like the below ASL fragment for SPI:
Package () { "cs-gpios", Package () { ^GPIO, 19, 0, 0, // GPIO CS0 0, // Native CS ^GPIO, 20, 0, 0, // GPIO CS1 } }The zero in the middle means "no entry" or NULL reference. To support this we add a new function
acpi_node_get_property_reference_fixed_args()that takes number of expected arguments as parameter. Function returns-ENOENTif the corresponding index resolves to the "no entry" reference.Signed-off-by Mika Westerberg <[email protected]>--- drivers/acpi/property.c | 116 +++++++++++++++++++++++++++++++++++------------- include/linux/acpi.h | 3 ++ 2 files changed, 89 insertions(+), 30 deletions(-)drivers/acpi/property.c +41
-29@@ -472,6 +472,7 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* @data: ACPI device data object containing the property * @propname: Name of the property * @index: Index of the reference to return +* @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments * * Find property with @name, verifify that it is a package containing at least @@ -485,8 +486,8 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* Return: %0 on success, negative error code on failure. */ static int acpi_data_get_property_reference (struct acpi_device_data *data, -const char *propname,size_t index, -struct acpi_reference_args *args) +const char *propname,size_t index,size_t num_args, +struct acpi_reference_args *args) {const union acpi_object *element, *end;const union acpi_object *obj;@@ -532,41 +533,52 @@ static int acpi_data_get_property_reference(struct acpi_device_data *data,while (element < end) {u32 nargs, i; -if (element->type !=ACPI_TYPE_LOCAL_REFERENCE ) -return -EPROTO ; - - ret =acpi_bus_get_device (element->reference.handle, &device); -if (ret) -return -ENODEV ; - - element++; - nargs =0 ; - -/* assume following integer elements are all args */ -for (i =0 ; element + i < end; i++) { -int type = element[i].type; +if (element->type ==ACPI_TYPE_LOCAL_REFERENCE ) { + ret =acpi_bus_get_device (element->reference.handle, + &device); +if (ret) +return -ENODEV ; + + nargs =0 ; + element++; + +/* assume following integer elements are all args */ +for (i =0 ; element + i < end && i < num_args; i++) { +int type = element[i].type; + +if (type ==ACPI_TYPE_INTEGER ) + nargs++; +else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) +break ; +else +return -EPROTO ; + } -if (type ==ACPI_TYPE_INTEGER ) - nargs++; -else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) -break ; -else +if (nargs >MAX_ACPI_REFERENCE_ARGS )return -EPROTO ; - } -if (idx++ == index) { - args->adev = device; - args->nargs = nargs; -for (i =0 ; i < nargs; i++) - args->args[i] = element[i].integer.value; +if (idx == index) { + args->adev = device; + args->nargs = nargs; +for (i =0 ; i < nargs; i++) + args->args[i] = element[i].integer.value; -return 0 ; +return 0 ; + } + + element += nargs; + }else if (element->type ==ACPI_TYPE_INTEGER ) { +if (idx == index) +return -ENOENT ; + element++; + }else { +return -EPROTO ; } - element += nargs; + idx++; } -return -EPROTO ; +return -ENODATA ; }/** @@ -582,10 +594,54 @@ int acpi_node_get_property_reference(struct fwnode_handle *fwnode, {struct acpi_device_data *data =acpi_device_data_of_node (fwnode);
Quoted 12 lines
drivers/acpi/property.c int acpi_node_get_property_reference(struct fwnode_handle *fwnode, · line 603
Quoted 8 lines
drivers/acpi/property.c +5
-1-return data ?acpi_data_get_property_reference (data, name, index, args) : -EINVAL ; +if (!data) +return -EINVAL ; + +return acpi_data_get_property_reference (data, name, index, +MAX_ACPI_REFERENCE_ARGS , args); }EXPORT_SYMBOL_GPL (acpi_node_get_property_reference);gpiolib-acpi is the only user of this AFAICS, so why don't we change the definition of
acpi_node_get_property_reference()to take one extra argument and update the caller to passMAX_ACPI_REFERENCE_ARGS?
Unfortunately there are these (which I think should not call that function directly anyway):
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c: status = acpi_node_get_property_reference(fw_node, "phy-handle", 0,drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c: rc = acpi_node_get_property_reference(drivers/net/ethernet/hisilicon/hns/hns_enet.c: ret = acpi_node_get_property_reference(dev->fwnode,
So we would need to update those as well. Not a big deal, though.
Quoted 29 lines · Rafael J. Wysocki
Hi,
Quoted 25 lines · Mika Westerberg
Hi,
This series brings couple of useful GPIO related properties from Device Tree to ACPI
_DSDdevice properties:- Names for GPIO lines
- GPIO hogging
- Holes in GPIO property listsWe are using these to get Intel Galileo better supported in the mainline kernel (but these may be useful for other boards as well). For example SPI chip select on Galileo is connected to a GPIO line so we need to be able to describe it in ACPI, and at the same time allow native chip selects.
GPIO hogging can be used to set initial state of certain GPIOs available on the headers regardless of the BIOS settings (which may be wrong as it knows nothing about which devices have been connected).
Mika Westerberg (5):
ACPI / documentation: Use recommended name in GPIO property names ACPI / gpio: Add support for naming GPIOs
ACPI / gpio: Add hogging support
ACPI / property: Allow holes in reference properties ACPI / gpio: Allow holes in list of GPIOs for a device
Quoted 8 lines
Quoted 5 lines
Documentation/acpi/gpio-properties.txt | 72 ++++++++++++++-- drivers/acpi/property.c | 116 +++++++++++++++++++------- drivers/gpio/gpiolib-acpi.c | 147 ++++++++++++++++++++++++++++++--- include/linux/acpi.h | 3 + 4 files changed, 292 insertions(+), 46 deletions(-)I would like to tackle patches [1/5] and [4/5] first, as they are core patches and the rest is against gpiolib-acpi.
Works for me.
I can re-arrange the series so that the two core patches (1,4/5) are first and then the GPIO parts.
Quoted 1 line
Moreover, the documentation patch [1/5] looks like immediately applicable to me.
Yes, it just fixes the names to match what is preferred.
Re: [PATCH 4/5] ACPI / property: Allow holes in reference properties
In reply to Mika WesterbergQuoted 8 lines · Mika Westerberg
Quoted 7 lines · Rafael J. Wysocki
Quoted 5 lines · Mika Westerberg
DT allows holes or empty phandles for references. This is used for example in SPI subsystem where some chip selects are native and others are regular GPIOs. In ACPI
_DSDwe currently do not support this but instead the preceding reference "consumes" all following integer arguments.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
For example we would like to support something like the below ASL fragment for SPI:
Package () { "cs-gpios", Package () { ^GPIO, 19, 0, 0, // GPIO CS0 0, // Native CS
One thing just occurred to me: what if this value is not 0?
Quoted 135 lines
Quoted 122 lines
Quoted 122 lines
^GPIO, 20, 0, 0, // GPIO CS1 }}
The zero in the middle means "no entry" or NULL reference. To support this we add a new function
acpi_node_get_property_reference_fixed_args()that takes number of expected arguments as parameter. Function returns-ENOENTif the corresponding index resolves to the "no entry" reference.Signed-off-by Mika Westerberg <[email protected]>--- drivers/acpi/property.c | 116 +++++++++++++++++++++++++++++++++++------------- include/linux/acpi.h | 3 ++ 2 files changed, 89 insertions(+), 30 deletions(-)drivers/acpi/property.c +41
-29@@ -472,6 +472,7 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* @data: ACPI device data object containing the property * @propname: Name of the property * @index: Index of the reference to return +* @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments * * Find property with @name, verifify that it is a package containing at least @@ -485,8 +486,8 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* Return: %0 on success, negative error code on failure. */ static int acpi_data_get_property_reference (struct acpi_device_data *data, -const char *propname,size_t index, -struct acpi_reference_args *args) +const char *propname,size_t index,size_t num_args, +struct acpi_reference_args *args) {const union acpi_object *element, *end;const union acpi_object *obj;@@ -532,41 +533,52 @@ static int acpi_data_get_property_reference(struct acpi_device_data *data,while (element < end) {u32 nargs, i; -if (element->type !=ACPI_TYPE_LOCAL_REFERENCE ) -return -EPROTO ; - - ret =acpi_bus_get_device (element->reference.handle, &device); -if (ret) -return -ENODEV ; - - element++; - nargs =0 ; - -/* assume following integer elements are all args */ -for (i =0 ; element + i < end; i++) { -int type = element[i].type; +if (element->type ==ACPI_TYPE_LOCAL_REFERENCE ) { + ret =acpi_bus_get_device (element->reference.handle, + &device); +if (ret) +return -ENODEV ; + + nargs =0 ; + element++; + +/* assume following integer elements are all args */ +for (i =0 ; element + i < end && i < num_args; i++) { +int type = element[i].type; + +if (type ==ACPI_TYPE_INTEGER ) + nargs++; +else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) +break ; +else +return -EPROTO ; + } -if (type ==ACPI_TYPE_INTEGER ) - nargs++; -else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) -break ; -else +if (nargs >MAX_ACPI_REFERENCE_ARGS )return -EPROTO ; - } -if (idx++ == index) { - args->adev = device; - args->nargs = nargs; -for (i =0 ; i < nargs; i++) - args->args[i] = element[i].integer.value; +if (idx == index) { + args->adev = device; + args->nargs = nargs; +for (i =0 ; i < nargs; i++) + args->args[i] = element[i].integer.value; -return 0 ; +return 0 ; + } + + element += nargs; + }else if (element->type ==ACPI_TYPE_INTEGER ) { +if (idx == index) +return -ENOENT ; + element++; + }else { +return -EPROTO ; } - element += nargs; + idx++; } -return -EPROTO ; +return -ENODATA ; }/** @@ -582,10 +594,54 @@ int acpi_node_get_property_reference(struct fwnode_handle *fwnode, {struct acpi_device_data *data =acpi_device_data_of_node (fwnode);Quoted 12 lines
drivers/acpi/property.c int acpi_node_get_property_reference(struct fwnode_handle *fwnode, · line 603
Quoted 8 lines
drivers/acpi/property.c +5
-1-return data ?acpi_data_get_property_reference (data, name, index, args) : -EINVAL ; +if (!data) +return -EINVAL ; + +return acpi_data_get_property_reference (data, name, index, +MAX_ACPI_REFERENCE_ARGS , args); }EXPORT_SYMBOL_GPL (acpi_node_get_property_reference);gpiolib-acpi is the only user of this AFAICS, so why don't we change the definition of
acpi_node_get_property_reference()to take one extra argument and update the caller to passMAX_ACPI_REFERENCE_ARGS?
Quoted 2 lines
Unfortunately there are these (which I think should not call that function directly anyway):
Right.
It looks like exactly the same usage pattern that should better be implemented as a library function, ie. workarounds for something missing.
Quoted 5 lines
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c: status = acpi_node_get_property_reference(fw_node, "phy-handle", 0,drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c: rc = acpi_node_get_property_reference(drivers/net/ethernet/hisilicon/hns/hns_enet.c: ret = acpi_node_get_property_reference(dev->fwnode,So we would need to update those as well. Not a big deal, though.
Or rename it to __acpi_node_get_property_reference() and define acpi_node_get_property_reference() as a static inline wrapper passing MAX_ACPI_REFERENCE_ARGS to it.
Thanks,
Rafael
Re: [PATCH 4/5] ACPI / property: Allow holes in reference properties
Quoted 12 lines · Rafael J. Wysocki
Quoted 11 lines · Mika Westerberg
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines · Mika Westerberg
DT allows holes or empty phandles for references. This is used for example in SPI subsystem where some chip selects are native and others are regular GPIOs. In ACPI
_DSDwe currently do not support this but instead the preceding reference "consumes" all following integer arguments.For example we would like to support something like the below ASL fragment for SPI:
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Package () { "cs-gpios", Package () { ^GPIO, 19, 0, 0, // GPIO CS0 0, // Native CSOne thing just occurred to me: what if this value is not 0?
It can be any integer value actually. We allow it but 0 is the preferred value. I did not find anything in DT saying what it should be either.
Alternatively I can add a check that it must be 0.
Quoted 147 lines
Quoted 135 lines
Quoted 122 lines
Quoted 122 lines
^GPIO, 20, 0, 0, // GPIO CS1 }}
The zero in the middle means "no entry" or NULL reference. To support this we add a new function
acpi_node_get_property_reference_fixed_args()that takes number of expected arguments as parameter. Function returns-ENOENTif the corresponding index resolves to the "no entry" reference.Signed-off-by Mika Westerberg <[email protected]>--- drivers/acpi/property.c | 116 +++++++++++++++++++++++++++++++++++------------- include/linux/acpi.h | 3 ++ 2 files changed, 89 insertions(+), 30 deletions(-)drivers/acpi/property.c +41
-29@@ -472,6 +472,7 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* @data: ACPI device data object containing the property * @propname: Name of the property * @index: Index of the reference to return +* @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments * * Find property with @name, verifify that it is a package containing at least @@ -485,8 +486,8 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* Return: %0 on success, negative error code on failure. */ static int acpi_data_get_property_reference (struct acpi_device_data *data, -const char *propname,size_t index, -struct acpi_reference_args *args) +const char *propname,size_t index,size_t num_args, +struct acpi_reference_args *args) {const union acpi_object *element, *end;const union acpi_object *obj;@@ -532,41 +533,52 @@ static int acpi_data_get_property_reference(struct acpi_device_data *data,while (element < end) {u32 nargs, i; -if (element->type !=ACPI_TYPE_LOCAL_REFERENCE ) -return -EPROTO ; - - ret =acpi_bus_get_device (element->reference.handle, &device); -if (ret) -return -ENODEV ; - - element++; - nargs =0 ; - -/* assume following integer elements are all args */ -for (i =0 ; element + i < end; i++) { -int type = element[i].type; +if (element->type ==ACPI_TYPE_LOCAL_REFERENCE ) { + ret =acpi_bus_get_device (element->reference.handle, + &device); +if (ret) +return -ENODEV ; + + nargs =0 ; + element++; + +/* assume following integer elements are all args */ +for (i =0 ; element + i < end && i < num_args; i++) { +int type = element[i].type; + +if (type ==ACPI_TYPE_INTEGER ) + nargs++; +else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) +break ; +else +return -EPROTO ; + } -if (type ==ACPI_TYPE_INTEGER ) - nargs++; -else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) -break ; -else +if (nargs >MAX_ACPI_REFERENCE_ARGS )return -EPROTO ; - } -if (idx++ == index) { - args->adev = device; - args->nargs = nargs; -for (i =0 ; i < nargs; i++) - args->args[i] = element[i].integer.value; +if (idx == index) { + args->adev = device; + args->nargs = nargs; +for (i =0 ; i < nargs; i++) + args->args[i] = element[i].integer.value; -return 0 ; +return 0 ; + } + + element += nargs; + }else if (element->type ==ACPI_TYPE_INTEGER ) { +if (idx == index) +return -ENOENT ; + element++; + }else { +return -EPROTO ; } - element += nargs; + idx++; } -return -EPROTO ; +return -ENODATA ; }/** @@ -582,10 +594,54 @@ int acpi_node_get_property_reference(struct fwnode_handle *fwnode, {struct acpi_device_data *data =acpi_device_data_of_node (fwnode);Quoted 12 lines
drivers/acpi/property.c int acpi_node_get_property_reference(struct fwnode_handle *fwnode, · line 603
Quoted 8 lines
drivers/acpi/property.c +5
-1-return data ?acpi_data_get_property_reference (data, name, index, args) : -EINVAL ; +if (!data) +return -EINVAL ; + +return acpi_data_get_property_reference (data, name, index, +MAX_ACPI_REFERENCE_ARGS , args); }EXPORT_SYMBOL_GPL (acpi_node_get_property_reference);gpiolib-acpi is the only user of this AFAICS, so why don't we change the definition of
acpi_node_get_property_reference()to take one extra argument and update the caller to passMAX_ACPI_REFERENCE_ARGS?Quoted 2 lines
Unfortunately there are these (which I think should not call that function directly anyway):
Right.
It looks like exactly the same usage pattern that should better be implemented as a library function, ie. workarounds for something missing.
Quoted 4 lines
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c: status = acpi_node_get_property_reference(fw_node, "phy-handle", 0,drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c: rc = acpi_node_get_property_reference(drivers/net/ethernet/hisilicon/hns/hns_enet.c: ret = acpi_node_get_property_reference(dev->fwnode,
Quoted 5 lines
Quoted 1 line
So we would need to update those as well. Not a big deal, though.
Or rename it to
__acpi_node_get_property_reference()and defineacpi_node_get_property_reference()as a static inline wrapper passingMAX_ACPI_REFERENCE_ARGSto it.
OK, I'll do this.
Quoted 39 lines · Mika Westerberg
Quoted 29 lines · Rafael J. Wysocki
Hi,
Quoted 25 lines · Mika Westerberg
Hi,
This series brings couple of useful GPIO related properties from Device Tree to ACPI
_DSDdevice properties:- Names for GPIO lines
- GPIO hogging
- Holes in GPIO property listsWe are using these to get Intel Galileo better supported in the mainline kernel (but these may be useful for other boards as well). For example SPI chip select on Galileo is connected to a GPIO line so we need to be able to describe it in ACPI, and at the same time allow native chip selects.
GPIO hogging can be used to set initial state of certain GPIOs available on the headers regardless of the BIOS settings (which may be wrong as it knows nothing about which devices have been connected).
Mika Westerberg (5):
ACPI / documentation: Use recommended name in GPIO property names ACPI / gpio: Add support for naming GPIOs
ACPI / gpio: Add hogging support
ACPI / property: Allow holes in reference properties ACPI / gpio: Allow holes in list of GPIOs for a deviceQuoted 8 lines
Quoted 5 lines
Documentation/acpi/gpio-properties.txt | 72 ++++++++++++++-- drivers/acpi/property.c | 116 +++++++++++++++++++------- drivers/gpio/gpiolib-acpi.c | 147 ++++++++++++++++++++++++++++++--- include/linux/acpi.h | 3 + 4 files changed, 292 insertions(+), 46 deletions(-)I would like to tackle patches [1/5] and [4/5] first, as they are core patches and the rest is against gpiolib-acpi.
Quoted 8 lines
Works for me.
I can re-arrange the series so that the two core patches (1,4/5) are first and then the GPIO parts.
Quoted 1 line
Moreover, the documentation patch [1/5] looks like immediately applicable to me.
Yes, it just fixes the names to match what is preferred.
OK, I'll apply it then, no need to resend.
Thanks,
Rafael
Re: [PATCH 4/5] ACPI / property: Allow holes in reference properties
In reply to Mika WesterbergQuoted 19 lines · Mika Westerberg
Quoted 18 lines · Rafael J. Wysocki
Quoted 16 lines · Mika Westerberg
Quoted 15 lines · Rafael J. Wysocki
Quoted 13 lines · Mika Westerberg
DT allows holes or empty phandles for references. This is used for example in SPI subsystem where some chip selects are native and others are regular GPIOs. In ACPI
_DSDwe currently do not support this but instead the preceding reference "consumes" all following integer arguments.For example we would like to support something like the below ASL fragment for SPI:
Package () { "cs-gpios", Package () { ^GPIO, 19, 0, 0, // GPIO CS0 0, // Native CS
Quoted 6 lines
Quoted 1 line
One thing just occurred to me: what if this value is not 0?
It can be any integer value actually. We allow it but 0 is the preferred value. I did not find anything in DT saying what it should be either.
Alternatively I can add a check that it must be 0.
No need, I just was wondering. :-)
I think it's best to follow DT exactly here.
Quoted 147 lines
Quoted 147 lines
Quoted 135 lines
Quoted 122 lines
Quoted 122 lines
^GPIO, 20, 0, 0, // GPIO CS1 }}
The zero in the middle means "no entry" or NULL reference. To support this we add a new function
acpi_node_get_property_reference_fixed_args()that takes number of expected arguments as parameter. Function returns-ENOENTif the corresponding index resolves to the "no entry" reference.Signed-off-by Mika Westerberg <[email protected]>--- drivers/acpi/property.c | 116 +++++++++++++++++++++++++++++++++++------------- include/linux/acpi.h | 3 ++ 2 files changed, 89 insertions(+), 30 deletions(-)drivers/acpi/property.c +41
-29@@ -472,6 +472,7 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* @data: ACPI device data object containing the property * @propname: Name of the property * @index: Index of the reference to return +* @num_args: Maximum number of arguments after each reference * @args: Location to store the returned reference with optional arguments * * Find property with @name, verifify that it is a package containing at least @@ -485,8 +486,8 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,* Return: %0 on success, negative error code on failure. */ static int acpi_data_get_property_reference (struct acpi_device_data *data, -const char *propname,size_t index, -struct acpi_reference_args *args) +const char *propname,size_t index,size_t num_args, +struct acpi_reference_args *args) {const union acpi_object *element, *end;const union acpi_object *obj;@@ -532,41 +533,52 @@ static int acpi_data_get_property_reference(struct acpi_device_data *data,while (element < end) {u32 nargs, i; -if (element->type !=ACPI_TYPE_LOCAL_REFERENCE ) -return -EPROTO ; - - ret =acpi_bus_get_device (element->reference.handle, &device); -if (ret) -return -ENODEV ; - - element++; - nargs =0 ; - -/* assume following integer elements are all args */ -for (i =0 ; element + i < end; i++) { -int type = element[i].type; +if (element->type ==ACPI_TYPE_LOCAL_REFERENCE ) { + ret =acpi_bus_get_device (element->reference.handle, + &device); +if (ret) +return -ENODEV ; + + nargs =0 ; + element++; + +/* assume following integer elements are all args */ +for (i =0 ; element + i < end && i < num_args; i++) { +int type = element[i].type; + +if (type ==ACPI_TYPE_INTEGER ) + nargs++; +else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) +break ; +else +return -EPROTO ; + } -if (type ==ACPI_TYPE_INTEGER ) - nargs++; -else if (type ==ACPI_TYPE_LOCAL_REFERENCE ) -break ; -else +if (nargs >MAX_ACPI_REFERENCE_ARGS )return -EPROTO ; - } -if (idx++ == index) { - args->adev = device; - args->nargs = nargs; -for (i =0 ; i < nargs; i++) - args->args[i] = element[i].integer.value; +if (idx == index) { + args->adev = device; + args->nargs = nargs; +for (i =0 ; i < nargs; i++) + args->args[i] = element[i].integer.value; -return 0 ; +return 0 ; + } + + element += nargs; + }else if (element->type ==ACPI_TYPE_INTEGER ) { +if (idx == index) +return -ENOENT ; + element++; + }else { +return -EPROTO ; } - element += nargs; + idx++; } -return -EPROTO ; +return -ENODATA ; }/** @@ -582,10 +594,54 @@ int acpi_node_get_property_reference(struct fwnode_handle *fwnode, {struct acpi_device_data *data =acpi_device_data_of_node (fwnode);Quoted 12 lines
drivers/acpi/property.c int acpi_node_get_property_reference(struct fwnode_handle *fwnode, · line 603
Quoted 8 lines
drivers/acpi/property.c +5
-1-return data ?acpi_data_get_property_reference (data, name, index, args) : -EINVAL ; +if (!data) +return -EINVAL ; + +return acpi_data_get_property_reference (data, name, index, +MAX_ACPI_REFERENCE_ARGS , args); }EXPORT_SYMBOL_GPL (acpi_node_get_property_reference);gpiolib-acpi is the only user of this AFAICS, so why don't we change the definition of
acpi_node_get_property_reference()to take one extra argument and update the caller to passMAX_ACPI_REFERENCE_ARGS?Quoted 2 lines
Unfortunately there are these (which I think should not call that function directly anyway):
Right.
It looks like exactly the same usage pattern that should better be implemented as a library function, ie. workarounds for something missing.
Quoted 4 lines
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c: status = acpi_node_get_property_reference(fw_node, "phy-handle", 0,drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c: rc = acpi_node_get_property_reference(drivers/net/ethernet/hisilicon/hns/hns_enet.c: ret = acpi_node_get_property_reference(dev->fwnode,
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
So we would need to update those as well. Not a big deal, though.
Or rename it to
__acpi_node_get_property_reference()and defineacpi_node_get_property_reference()as a static inline wrapper passingMAX_ACPI_REFERENCE_ARGSto it.OK, I'll do this.
Thanks!
Rafael
Quoted 18 lines · Mika Westerberg
Hi,
This series brings couple of useful GPIO related properties from Device Tree to ACPI
_DSDdevice properties:- Names for GPIO lines
- GPIO hogging
- Holes in GPIO property listsWe are using these to get Intel Galileo better supported in the mainline kernel (but these may be useful for other boards as well). For example SPI chip select on Galileo is connected to a GPIO line so we need to be able to describe it in ACPI, and at the same time allow native chip selects.
GPIO hogging can be used to set initial state of certain GPIOs available on the headers regardless of the BIOS settings (which may be wrong as it knows nothing about which devices have been connected).
Quoted 6 lines
Mika Westerberg (5):
ACPI / documentation: Use recommended name in GPIO property names ACPI / gpio: Add support for naming GPIOs
ACPI / gpio: Add hogging support
ACPI / property: Allow holes in reference properties ACPI / gpio: Allow holes in list of GPIOs for a device
Any comments on the GPIO patches in this series?
At least the last one does not add any new bindings so it should be fine to apply.
Rafael J. Wysocki
maintainerQuoted 26 lines · Mika Westerberg
Quoted 18 lines · Mika Westerberg
Hi,
This series brings couple of useful GPIO related properties from Device Tree to ACPI
_DSDdevice properties:- Names for GPIO lines
- GPIO hogging
- Holes in GPIO property listsWe are using these to get Intel Galileo better supported in the mainline kernel (but these may be useful for other boards as well). For example SPI chip select on Galileo is connected to a GPIO line so we need to be able to describe it in ACPI, and at the same time allow native chip selects.
GPIO hogging can be used to set initial state of certain GPIOs available on the headers regardless of the BIOS settings (which may be wrong as it knows nothing about which devices have been connected).
Quoted 6 lines
Mika Westerberg (5):
ACPI / documentation: Use recommended name in GPIO property names ACPI / gpio: Add support for naming GPIOs
ACPI / gpio: Add hogging support
ACPI / property: Allow holes in reference properties ACPI / gpio: Allow holes in list of GPIOs for a device
Quoted 4 lines
Any comments on the GPIO patches in this series?
At least the last one does not add any new bindings so it should be fine to apply.
I have no comments, but I'd suggest resending them as a new series on top of 4.9-rc1 (which includes the generic patches from this series).
You can add my ACK to them if that helps.
Thanks,
Rafael
Quoted 30 lines · Rafael J. Wysocki
Quoted 28 lines · Mika Westerberg
Quoted 18 lines · Mika Westerberg
Hi,
This series brings couple of useful GPIO related properties from Device Tree to ACPI
_DSDdevice properties:- Names for GPIO lines
- GPIO hogging
- Holes in GPIO property listsWe are using these to get Intel Galileo better supported in the mainline kernel (but these may be useful for other boards as well). For example SPI chip select on Galileo is connected to a GPIO line so we need to be able to describe it in ACPI, and at the same time allow native chip selects.
GPIO hogging can be used to set initial state of certain GPIOs available on the headers regardless of the BIOS settings (which may be wrong as it knows nothing about which devices have been connected).
Quoted 6 lines
Mika Westerberg (5):
ACPI / documentation: Use recommended name in GPIO property names ACPI / gpio: Add support for naming GPIOs
ACPI / gpio: Add hogging support
ACPI / property: Allow holes in reference properties ACPI / gpio: Allow holes in list of GPIOs for a deviceAny comments on the GPIO patches in this series?
Quoted 7 lines
Quoted 2 lines
At least the last one does not add any new bindings so it should be fine to apply.
I have no comments, but I'd suggest resending them as a new series on top of 4.9-rc1 (which includes the generic patches from this series).
You can add my ACK to them if that helps.
OK, I will do that. Thanks!
Quoted 11 lines · Rafael J. Wysocki
On Wed, Oct 19, 2016 at 2:41 PM, Mika Westerberg
Quoted 4 lines
Any comments on the GPIO patches in this series?
At least the last one does not add any new bindings so it should be fine to apply.
I have no comments, but I'd suggest resending them as a new series on top of 4.9-rc1 (which includes the generic patches from this series).
You can add my ACK to them if that helps.
OK I had some comments so please adress these but resend on top of v4.9-rc1 indeed. If they are already higher up in my mailbox then look into my comments and post again, hehe.
Thanks!
Yours,
Linus Walleij
Quoted 8 lines · Linus Walleij
Quoted 7 lines · Rafael J. Wysocki
On Wed, Oct 19, 2016 at 2:41 PM, Mika Westerberg
Quoted 4 lines
Any comments on the GPIO patches in this series?
At least the last one does not add any new bindings so it should be fine to apply.
Quoted 8 lines
Quoted 4 lines
I have no comments, but I'd suggest resending them as a new series on top of 4.9-rc1 (which includes the generic patches from this series).
You can add my ACK to them if that helps.
OK I had some comments so please adress these but resend on top of v4.9-rc1 indeed. If they are already higher up in my mailbox then look into my comments and post again, hehe.
I will, thanks!