Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97028ce6 authored by Mika Westerberg's avatar Mika Westerberg Committed by Rafael J. Wysocki
Browse files

ACPICA: ACPI 6.2: Add support for PinConfig() resource

ACPICA commit a06fdba686cefccd5dd5b93b52fa0f1e3f984906

ACPI 6.2 introduced a new resource that is used to specify fine-grained
configuration of a pin or set of pins used by a device. The ASL syntax of
this new resource looks like:

  PinConfig (Shared/Exclusive, PinConfigType, PinConfigValue,
             ResourceSource, ResourceSourceIndex, ResourceUsage,
             DescriptorName, Vendordata) {Pin List}

PinConfigType is an integer with following accepted values:

  0x00 (Default) - No configuration is applied to the pin
  0x01 (Bias Pull-up) - Pin is pulled up using certain size resistor
  0x02 (Bias Pull-down) - Pin is pulled down using certain size resistor
  0x03 (Bias Default) - Set to default biasing
  0x04 (Bias Disable) - All bias settings will be disabled
  0x05 (Bias High Impedance) - Configure the pin as hi_z
  0x06 (Bias Bus Hold) - Configure the pin in a weak latch state where
                         it drives the last value on a tristate bus
  0x07 (Drive Open Drain) - Configure the pin into open drain state
  0x08 (Drive Open Source) - Configure the pin into open source state
  0x09 (Drive Push Pull) - Configure the pin into push-pull state
  0x0a (Drive Strength) - How much the pin can supply current
  0x0b (Slew Rate) - Configure slew rate of the pin
  0x0c (Input Debounce) - Enable input debouncer for the pin
  0x0d (Input Schmitt Trigger) - Enable schmitt trigger for the pin
  0x0e - 0x7f - Reserved
  0x80 - 0xff - Vendor defined types

The PinConfigValue depends on the type and is expressed as units
suitable for that type (for example bias uses Ohms).

Link: https://github.com/acpica/acpica/commit/a06fdba6


Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 2b726930
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1144,7 +1144,8 @@ struct acpi_port_info {
#define ACPI_RESOURCE_NAME_GPIO                 0x8C
#define ACPI_RESOURCE_NAME_PIN_FUNCTION         0x8D
#define ACPI_RESOURCE_NAME_SERIAL_BUS           0x8E
#define ACPI_RESOURCE_NAME_LARGE_MAX            0x8E
#define ACPI_RESOURCE_NAME_PIN_CONFIG           0x8F
#define ACPI_RESOURCE_NAME_LARGE_MAX            0x8F

/*****************************************************************************
 *
+2 −0
Original line number Diff line number Diff line
@@ -330,6 +330,7 @@ extern struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[];
extern struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[];
extern struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[];
extern struct acpi_rsconvert_info acpi_rs_convert_pin_function[];
extern struct acpi_rsconvert_info acpi_rs_convert_pin_config[];

/* These resources require separate get/set tables */

@@ -380,6 +381,7 @@ extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[];
extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[];
extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[];
extern struct acpi_rsdump_info acpi_rs_dump_general_flags[];
extern struct acpi_rsdump_info acpi_rs_dump_pin_config[];
#endif

#endif				/* __ACRESRC_H__ */
+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ extern const char *acpi_gbl_bpb_decode[];
extern const char *acpi_gbl_sb_decode[];
extern const char *acpi_gbl_fc_decode[];
extern const char *acpi_gbl_pt_decode[];
extern const char *acpi_gbl_ptyp_decode[];
#endif

/*
+23 −0
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@
#define ACPI_RESTAG_PHASE                       "_PHA"
#define ACPI_RESTAG_PIN                         "_PIN"
#define ACPI_RESTAG_PINCONFIG                   "_PPI"
#define ACPI_RESTAG_PINCONFIG_TYPE              "_TYP"
#define ACPI_RESTAG_PINCONFIG_VALUE             "_VAL"
#define ACPI_RESTAG_POLARITY                    "_POL"
#define ACPI_RESTAG_REGISTERBITOFFSET           "_RBO"
#define ACPI_RESTAG_REGISTERBITWIDTH            "_RBW"
@@ -425,6 +427,26 @@ struct aml_resource_pin_function {

#define AML_RESOURCE_PIN_FUNCTION_REVISION      1	/* ACPI 6.2 */

struct aml_resource_pin_config {
	AML_RESOURCE_LARGE_HEADER_COMMON u8 revision_id;
	u16 flags;
	u8 pin_config_type;
	u32 pin_config_value;
	u16 pin_table_offset;
	u8 res_source_index;
	u16 res_source_offset;
	u16 vendor_offset;
	u16 vendor_length;
	/*
	 * Optional fields follow immediately:
	 * 1) PIN list (Words)
	 * 2) Resource Source String
	 * 3) Vendor Data bytes
	 */
};

#define AML_RESOURCE_PIN_CONFIG_REVISION      1	/* ACPI 6.2 */

/* restore default alignment */

#pragma pack()
@@ -468,6 +490,7 @@ union aml_resource {
	struct aml_resource_uart_serialbus uart_serial_bus;
	struct aml_resource_common_serialbus common_serial_bus;
	struct aml_resource_pin_function pin_function;
	struct aml_resource_pin_config pin_config;

	/* Utility overlays */

+31 −0
Original line number Diff line number Diff line
@@ -375,6 +375,20 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,

			break;

		case ACPI_RESOURCE_TYPE_PIN_CONFIG:

			total_size = (acpi_rs_length)(total_size +
						      (resource->data.
						       pin_config.
						       pin_table_length * 2) +
						      resource->data.pin_config.
						      resource_source.
						      string_length +
						      resource->data.pin_config.
						      vendor_length);

			break;

		default:

			break;
@@ -581,6 +595,23 @@ acpi_rs_get_list_length(u8 *aml_buffer,
			    minimum_aml_resource_length;
			break;

		case ACPI_RESOURCE_NAME_PIN_CONFIG:

			/* Vendor data is optional */

			if (aml_resource->pin_config.vendor_length) {
				extra_struct_bytes +=
				    aml_resource->pin_config.vendor_offset -
				    aml_resource->pin_config.pin_table_offset +
				    aml_resource->pin_config.vendor_length;
			} else {
				extra_struct_bytes +=
				    aml_resource->large_header.resource_length +
				    sizeof(struct aml_resource_large_header) -
				    aml_resource->pin_config.pin_table_offset;
			}
			break;

		default:

			break;
Loading