File 0005-ivsc-import-headers.patch of Package intel-ipu6
From: "You-Sheng Yang (vicamo)" <vicamo.yang@canonical.com>
Date: Mon, 19 Sep 2022 16:42:06 +0800
Subject: ivsc: import headers
Import IVSC headers from current HEAD
https://github.com/intel/ivsc-driver/commit/99a53bd7160452bbbcc26bcb662cad33c13b36d1.
Signed-off-by: You-Sheng Yang (vicamo) <vicamo.yang@canonical.com>
---
backport-include/linux/mfd/ljca.h | 47 ++++++++++++++++++++++
backport-include/linux/vsc.h | 83 +++++++++++++++++++++++++++++++++++++++
2 files changed, 130 insertions(+)
create mode 100644 backport-include/linux/mfd/ljca.h
create mode 100644 backport-include/linux/vsc.h
diff --git a/backport-include/linux/mfd/ljca.h b/backport-include/linux/mfd/ljca.h
new file mode 100644
index 0000000..2c19f2d
--- /dev/null
+++ b/backport-include/linux/mfd/ljca.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LINUX_USB_LJCA_H
+#define __LINUX_USB_LJCA_H
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+
+#define MAX_GPIO_NUM 64
+
+struct ljca_gpio_info {
+ int num;
+ DECLARE_BITMAP(valid_pin_map, MAX_GPIO_NUM);
+};
+
+struct ljca_i2c_info {
+ u8 id;
+ u8 capacity;
+ u8 intr_pin;
+};
+
+struct ljca_spi_info {
+ u8 id;
+ u8 capacity;
+};
+
+struct ljca_platform_data {
+ int type;
+ union {
+ struct ljca_gpio_info gpio_info;
+ struct ljca_i2c_info i2c_info;
+ struct ljca_spi_info spi_info;
+ };
+};
+
+typedef void (*ljca_event_cb_t)(struct platform_device *pdev, u8 cmd,
+ const void *evt_data, int len);
+
+int ljca_register_event_cb(struct platform_device *pdev,
+ ljca_event_cb_t event_cb);
+void ljca_unregister_event_cb(struct platform_device *pdev);
+int ljca_transfer(struct platform_device *pdev, u8 cmd, const void *obuf,
+ int obuf_len, void *ibuf, int *ibuf_len);
+int ljca_transfer_noack(struct platform_device *pdev, u8 cmd, const void *obuf,
+ int obuf_len);
+
+#endif
diff --git a/backport-include/linux/vsc.h b/backport-include/linux/vsc.h
new file mode 100644
index 0000000..8f8d404
--- /dev/null
+++ b/backport-include/linux/vsc.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _LINUX_VSC_H_
+#define _LINUX_VSC_H_
+
+#include <linux/types.h>
+
+/**
+ * @brief VSC camera ownership definition
+ */
+enum vsc_camera_owner {
+ VSC_CAMERA_NONE = 0,
+ VSC_CAMERA_CVF,
+ VSC_CAMERA_IPU,
+};
+
+/**
+ * @brief VSC privacy status definition
+ */
+enum vsc_privacy_status {
+ VSC_PRIVACY_ON = 0,
+ VSC_PRIVACY_OFF,
+};
+
+/**
+ * @brief VSC MIPI configuration definition
+ */
+struct vsc_mipi_config {
+ uint32_t freq;
+ uint32_t lane_num;
+};
+
+/**
+ * @brief VSC camera status definition
+ */
+struct vsc_camera_status {
+ enum vsc_camera_owner owner;
+ enum vsc_privacy_status status;
+ uint32_t exposure_level;
+};
+
+/**
+ * @brief VSC privacy callback type definition
+ *
+ * @param context Privacy callback handle
+ * @param status Current privacy status
+ */
+typedef void (*vsc_privacy_callback_t)(void *handle,
+ enum vsc_privacy_status status);
+
+/**
+ * @brief Acquire camera sensor ownership to IPU
+ *
+ * @param config[IN] The pointer of MIPI configuration going to set
+ * @param callback[IN] The pointer of privacy callback function
+ * @param handle[IN] Privacy callback function runtime handle from IPU driver
+ * @param status[OUT] The pointer of camera status after the acquire
+ *
+ * @retval 0 If success
+ * @retval -EIO IO error
+ * @retval -EINVAL Invalid argument
+ * @retval -EAGAIN VSC device not ready
+ * @retval negative values for other errors
+ */
+int vsc_acquire_camera_sensor(struct vsc_mipi_config *config,
+ vsc_privacy_callback_t callback,
+ void *handle,
+ struct vsc_camera_status *status);
+
+/**
+ * @brief Release camera sensor ownership
+ *
+ * @param status[OUT] Camera status after the release
+ *
+ * @retval 0 If success
+ * @retval -EIO IO error
+ * @retval -EINVAL Invalid argument
+ * @retval -EAGAIN VSC device not ready
+ * @retval negative values for other errors
+ */
+int vsc_release_camera_sensor(struct vsc_camera_status *status);
+
+#endif