Hello Matt Delco,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/42469
to review the following change.
Change subject: drivers/intel/mipi_camera: SSDT changes to add PLD
......................................................................
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(a)intel.com>
---
M src/drivers/intel/mipi_camera/camera.c
M src/drivers/intel/mipi_camera/chip.h
2 files changed, 53 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/69/42469/1
diff --git a/src/drivers/intel/mipi_camera/camera.c b/src/drivers/intel/mipi_camera/camera.c
index a3a9323..ddafccf 100644
--- a/src/drivers/intel/mipi_camera/camera.c
+++ b/src/drivers/intel/mipi_camera/camera.c
@@ -13,6 +13,53 @@
#define SENSOR_NAME_UUID "822ace8f-2814-4174-a56b-5f029fe079ee"
#define SENSOR_TYPE_UUID "26257549-9271-4ca4-bb43-c4899d5a4881"
+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 && !config->disable_pld_defaults)
+ apply_pld_defaults(config);
+
+ if (config->use_pld)
+ 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;
@@ -140,6 +187,8 @@
const char *vcm_name = NULL;
struct acpi_dp *lens_focus = NULL;
+ camera_generate_pld(dev);
+
if (!config->disable_ssdb_defaults)
camera_fill_sensor_defaults(config);
diff --git a/src/drivers/intel/mipi_camera/chip.h b/src/drivers/intel/mipi_camera/chip.h
index f55ee1d..95a3ebb 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 MAX_PWDB_ENTRIES 12
#define MAX_PORT_ENTRIES 4
@@ -134,6 +135,9 @@
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 */
/* Settings specific to nvram. Many values, if left as zero, will be assigned a default.
--
To view, visit https://review.coreboot.org/c/coreboot/+/42469
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: If65b9cbabca95e9645d8e5023ce7fd78b0625d1e
Gerrit-Change-Number: 42469
Gerrit-PatchSet: 1
Gerrit-Owner: Sugnan Prabhu S <sugnan.prabhu.s(a)intel.com>
Gerrit-Reviewer: Matt Delco <delco(a)chromium.org>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange