Ricardo Ribalda has uploaded this change for review.

View Change

acpi: Add support for privacy_gpio

Some devices, such as cameras, can implement a physical switch to
disable the input on demand. Think of it like the typical privacy
sticker on the notebooks, but more elegant.

In order to notify the system about the status this feature, a GPIO is
typically used.

The map between a GPIO and the feature is done via ACPI, the same way as
the reset_gpio works.

This patch implements an extra field for the described privacy gpio.
This gpio does not require any extra handling from the power management.

Change-Id: Idcc65c9a13eca6f076ac3c68aaa1bed3c481df3d
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
M src/drivers/usb/acpi/chip.h
M src/drivers/usb/acpi/usb_acpi.c
2 files changed, 18 insertions(+), 6 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/46961/1
diff --git a/src/drivers/usb/acpi/chip.h b/src/drivers/usb/acpi/chip.h
index 8cd9268..4a55cc6 100644
--- a/src/drivers/usb/acpi/chip.h
+++ b/src/drivers/usb/acpi/chip.h
@@ -45,6 +45,7 @@
struct acpi_pld custom_pld;

struct acpi_gpio reset_gpio;
+ struct acpi_gpio privacy_gpio;
};

#endif /* __USB_ACPI_CHIP_H__ */
diff --git a/src/drivers/usb/acpi/usb_acpi.c b/src/drivers/usb/acpi/usb_acpi.c
index d33b7de..9b45483 100644
--- a/src/drivers/usb/acpi/usb_acpi.c
+++ b/src/drivers/usb/acpi/usb_acpi.c
@@ -13,10 +13,13 @@
/*
* Return false if reset GPIO is not provided.
*/
- if (cfg->reset_gpio.pin_count == 0)
- return false;
+ if (cfg->reset_gpio.pin_count)
+ return true;

- return true;
+ if (cfg->privacy_gpio.pin_count)
+ return true;
+
+ return false;
}

static void usb_acpi_fill_ssdt_generator(const struct device *dev)
@@ -49,15 +52,23 @@
/* Resources */
if (usb_acpi_add_gpios_to_crs(config) == true) {
struct acpi_dp *dsd;
+ int idx = 0;

acpigen_write_name("_CRS");
acpigen_write_resourcetemplate_header();
- acpi_device_write_gpio(&config->reset_gpio);
+ if (config->reset_gpio.pin_count)
+ acpi_device_write_gpio(&config->reset_gpio);
+ if (config->privacy_gpio.pin_count)
+ acpi_device_write_gpio(&config->privacy_gpio);
acpigen_write_resourcetemplate_footer();

dsd = acpi_dp_new_table("_DSD");
- acpi_dp_add_gpio(dsd, "reset-gpio", path, 0, 0,
- config->reset_gpio.active_low);
+ if (config->reset_gpio.pin_count)
+ acpi_dp_add_gpio(dsd, "reset-gpio", path, idx++, 0,
+ config->reset_gpio.active_low);
+ if (config->privacy_gpio.pin_count)
+ acpi_dp_add_gpio(dsd, "privacy-gpio", path, idx++, 0,
+ config->privacy_gpio.active_low);
acpi_dp_write(dsd);
}


To view, visit change 46961. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Idcc65c9a13eca6f076ac3c68aaa1bed3c481df3d
Gerrit-Change-Number: 46961
Gerrit-PatchSet: 1
Gerrit-Owner: Ricardo Ribalda <ribalda@chromium.org>
Gerrit-MessageType: newchange