summaryrefslogtreecommitdiff
path: root/src/drivers/intel
diff options
context:
space:
mode:
authorMatt Delco <delco@chromium.org>2020-06-17 12:55:35 +0530
committerPatrick Georgi <pgeorgi@google.com>2020-07-07 14:44:33 +0000
commit1ffee9d7f1065e6eee94a8b6ca45be9673122a19 (patch)
tree4e62fb813df5e7d813aecbc2673f8a69893bf56a /src/drivers/intel
parent964033f7d2d7440059705f8ef6aaf09c33065f34 (diff)
downloadcoreboot-1ffee9d7f1065e6eee94a8b6ca45be9673122a19.tar.xz
drivers/intel/mipi_camera: SSDT changes to add PLD
This change updates mipi_camera driver to add PLD section to SSDT. Change-Id: If65b9cbabca95e9645d8e5023ce7fd78b0625d1e Signed-off-by: Sugnan Prabhu S <sugnan.prabhu.s@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42469 Reviewed-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/intel')
-rw-r--r--src/drivers/intel/mipi_camera/camera.c50
-rw-r--r--src/drivers/intel/mipi_camera/chip.h4
2 files changed, 54 insertions, 0 deletions
diff --git a/src/drivers/intel/mipi_camera/camera.c b/src/drivers/intel/mipi_camera/camera.c
index c4caccec5b..7c0774dd7a 100644
--- a/src/drivers/intel/mipi_camera/camera.c
+++ b/src/drivers/intel/mipi_camera/camera.c
@@ -14,6 +14,54 @@
#define SENSOR_TYPE_UUID "26257549-9271-4ca4-bb43-c4899d5a4881"
#define DEFAULT_ENDPOINT 0
+static void apply_pld_defaults(struct drivers_intel_mipi_camera_config *config)
+{
+ if (!config->pld.ignore_color)
+ config->pld.ignore_color = 1;
+
+ if (!config->pld.visible)
+ config->pld.visible = 1;
+
+ if (!config->pld.vertical_offset)
+ config->pld.vertical_offset = 0xffff;
+
+ if (!config->pld.horizontal_offset)
+ config->pld.horizontal_offset = 0xffff;
+
+ /*
+ * PLD_PANEL_TOP has a value of zero, so the following will change any instance of
+ * PLD_PANEL_TOP to PLD_PANEL_FRONT unless disable_pld_defaults is set.
+ */
+ if (!config->pld.panel)
+ config->pld.panel = PLD_PANEL_FRONT;
+
+ /*
+ * PLD_HORIZONTAL_POSITION_LEFT has a value of zero, so the following will change any
+ * instance of that value to PLD_HORIZONTAL_POSITION_CENTER unless disable_pld_defaults
+ * is set.
+ */
+ if (!config->pld.horizontal_position)
+ config->pld.horizontal_position = PLD_HORIZONTAL_POSITION_CENTER;
+
+ /*
+ * The desired default for |vertical_position| is PLD_VERTICAL_POSITION_UPPER, which
+ * has a value of zero so no work is needed to set a default. The same applies for
+ * setting |shape| to PLD_SHAPE_ROUND.
+ */
+}
+
+static void camera_generate_pld(const struct device *dev)
+{
+ struct drivers_intel_mipi_camera_config *config = dev->chip_info;
+
+ if (config->use_pld) {
+ if (!config->disable_pld_defaults)
+ apply_pld_defaults(config);
+
+ acpigen_write_pld(&config->pld);
+ }
+}
+
static uint32_t address_for_dev_type(const struct device *dev, uint8_t dev_type)
{
struct drivers_intel_mipi_camera_config *config = dev->chip_info;
@@ -146,6 +194,8 @@ static void camera_fill_sensor(const struct device *dev)
const char *vcm_name = NULL;
struct acpi_dp *lens_focus = NULL;
+ camera_generate_pld(dev);
+
camera_fill_sensor_defaults(config);
/* _DSM */
diff --git a/src/drivers/intel/mipi_camera/chip.h b/src/drivers/intel/mipi_camera/chip.h
index c962c9a0f6..32b11c1656 100644
--- a/src/drivers/intel/mipi_camera/chip.h
+++ b/src/drivers/intel/mipi_camera/chip.h
@@ -4,6 +4,7 @@
#define __INTEL_MIPI_CAMERA_CHIP_H__
#include <stdint.h>
+#include <acpi/acpi_pld.h>
#define DEFAULT_LINK_FREQ 450000000
#define MAX_PWDB_ENTRIES 12
@@ -138,6 +139,9 @@ struct drivers_intel_mipi_camera_config {
const char *sensor_name; /* default "UNKNOWN" */
const char *remote_name; /* default "\_SB.PCI0.CIO2" */
const char *vcm_name; /* defaults to |vcm_address| device */
+ bool use_pld;
+ bool disable_pld_defaults;
+ struct acpi_pld pld;
uint16_t rom_address; /* I2C to use if ssdb.rom_type != 0 */
uint16_t vcm_address; /* I2C to use if ssdb.vcm_type != 0 */
/*