summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-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 */
/*