Commit 881ca259 authored by Bingbu Cao's avatar Bingbu Cao Committed by Mauro Carvalho Chehab

media: ipu3-cio2: rename cio2 bridge to ipu bridge and move out of ipu3

cio2 bridge was involved along with IPU3. However, in fact all Intel IPUs
besides IPU3 CIO2 need this bridge driver. This patch move bridge driver
out of ipu3 directory and rename as ipu-bridge. Then it can be worked with
IPU3 and other Intel IPUs.
Signed-off-by: default avatarBingbu Cao <bingbu.cao@intel.com>
Reviewed-by: default avatarDaniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 71e8d6e4
......@@ -73,7 +73,7 @@ config VIDEO_PCI_SKELETON
Enable build of the skeleton PCI driver, used as a reference
when developing new drivers.
source "drivers/media/pci/intel/ipu3/Kconfig"
source "drivers/media/pci/intel/Kconfig"
endif #MEDIA_PCI_SUPPORT
endif #PCI
# SPDX-License-Identifier: GPL-2.0-only
config IPU_BRIDGE
bool "Intel IPU Sensors Bridge"
depends on VIDEO_IPU3_CIO2 && ACPI
depends on I2C
help
This extension provides an API for the Intel IPU driver to create
connections to cameras that are hidden in the SSDB buffer in ACPI.
It can be used to enable support for cameras in detachable / hybrid
devices that ship with Windows.
Say Y here if your device is a detachable / hybrid laptop that comes
with Windows installed by the OEM, for example:
- Microsoft Surface models (except Surface Pro 3)
- The Lenovo Miix line (for example the 510, 520, 710 and 720)
- Dell 7285
If in doubt, say N here.
source "drivers/media/pci/intel/ipu3/Kconfig"
# SPDX-License-Identifier: GPL-2.0-only
#
# Makefile for the IPU3 cio2 and ImGU drivers
# Makefile for the IPU drivers
#
obj-$(CONFIG_IPU_BRIDGE) += ipu-bridge.o
obj-y += ipu3/
/* SPDX-License-Identifier: GPL-2.0 */
/* Author: Dan Scally <djrscally@gmail.com> */
#ifndef __CIO2_BRIDGE_H
#define __CIO2_BRIDGE_H
#ifndef __IPU_BRIDGE_H
#define __IPU_BRIDGE_H
#include <linux/property.h>
#include <linux/types.h>
#include "ipu3-cio2.h"
#include "ipu3/ipu3-cio2.h"
struct i2c_client;
#define CIO2_HID "INT343E"
#define CIO2_MAX_LANES 4
#define IPU_HID "INT343E"
#define IPU_MAX_LANES 4
#define MAX_NUM_LINK_FREQS 3
/* Values are educated guesses as we don't have a spec */
#define CIO2_SENSOR_ROTATION_NORMAL 0
#define CIO2_SENSOR_ROTATION_INVERTED 1
#define IPU_SENSOR_ROTATION_NORMAL 0
#define IPU_SENSOR_ROTATION_INVERTED 1
#define CIO2_SENSOR_CONFIG(_HID, _NR, ...) \
(const struct cio2_sensor_config) { \
#define IPU_SENSOR_CONFIG(_HID, _NR, ...) \
(const struct ipu_sensor_config) { \
.hid = _HID, \
.nr_link_freqs = _NR, \
.link_freqs = { __VA_ARGS__ } \
......@@ -49,19 +49,19 @@ struct i2c_client;
.name = _TYPE, \
}
enum cio2_sensor_swnodes {
enum ipu_sensor_swnodes {
SWNODE_SENSOR_HID,
SWNODE_SENSOR_PORT,
SWNODE_SENSOR_ENDPOINT,
SWNODE_CIO2_PORT,
SWNODE_CIO2_ENDPOINT,
SWNODE_IPU_PORT,
SWNODE_IPU_ENDPOINT,
/* Must be last because it is optional / maybe empty */
SWNODE_VCM,
SWNODE_COUNT
};
/* Data representation as it is in ACPI SSDB buffer */
struct cio2_sensor_ssdb {
struct ipu_sensor_ssdb {
u8 version;
u8 sku;
u8 guid_csi2[16];
......@@ -90,7 +90,7 @@ struct cio2_sensor_ssdb {
u8 reserved2[13];
} __packed;
struct cio2_property_names {
struct ipu_property_names {
char clock_frequency[16];
char rotation[9];
char orientation[12];
......@@ -100,19 +100,19 @@ struct cio2_property_names {
char link_frequencies[17];
};
struct cio2_node_names {
struct ipu_node_names {
char port[7];
char endpoint[11];
char remote_port[7];
};
struct cio2_sensor_config {
struct ipu_sensor_config {
const char *hid;
const u8 nr_link_freqs;
const u64 link_freqs[MAX_NUM_LINK_FREQS];
};
struct cio2_sensor {
struct ipu_sensor {
/* append ssdb.link(u8) in "-%u" format as suffix of HID */
char name[ACPI_ID_LEN + 4];
struct acpi_device *adev;
......@@ -121,26 +121,32 @@ struct cio2_sensor {
/* SWNODE_COUNT + 1 for terminating NULL */
const struct software_node *group[SWNODE_COUNT + 1];
struct software_node swnodes[SWNODE_COUNT];
struct cio2_node_names node_names;
struct ipu_node_names node_names;
struct cio2_sensor_ssdb ssdb;
struct ipu_sensor_ssdb ssdb;
struct acpi_pld_info *pld;
struct cio2_property_names prop_names;
struct ipu_property_names prop_names;
struct property_entry ep_properties[5];
struct property_entry dev_properties[5];
struct property_entry cio2_properties[3];
struct property_entry ipu_properties[3];
struct software_node_ref_args local_ref[1];
struct software_node_ref_args remote_ref[1];
struct software_node_ref_args vcm_ref[1];
};
struct cio2_bridge {
char cio2_node_name[ACPI_ID_LEN];
struct software_node cio2_hid_node;
struct ipu_bridge {
char ipu_node_name[ACPI_ID_LEN];
struct software_node ipu_hid_node;
u32 data_lanes[4];
unsigned int n_sensors;
struct cio2_sensor sensors[CIO2_NUM_PORTS];
struct ipu_sensor sensors[CIO2_NUM_PORTS];
};
#if IS_ENABLED(CONFIG_IPU_BRIDGE)
int ipu_bridge_init(struct pci_dev *ipu);
#else
static inline int ipu_bridge_init(struct pci_dev *ipu) { return 0; }
#endif
#endif
......@@ -17,22 +17,3 @@ config VIDEO_IPU3_CIO2
Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2
connected camera.
The module will be called ipu3-cio2.
config CIO2_BRIDGE
bool "IPU3 CIO2 Sensors Bridge"
depends on VIDEO_IPU3_CIO2 && ACPI
depends on I2C
help
This extension provides an API for the ipu3-cio2 driver to create
connections to cameras that are hidden in the SSDB buffer in ACPI.
It can be used to enable support for cameras in detachable / hybrid
devices that ship with Windows.
Say Y here if your device is a detachable / hybrid laptop that comes
with Windows installed by the OEM, for example:
- Microsoft Surface models (except Surface Pro 3)
- The Lenovo Miix line (for example the 510, 520, 710 and 720)
- Dell 7285
If in doubt, say N here.
......@@ -2,4 +2,3 @@
obj-$(CONFIG_VIDEO_IPU3_CIO2) += ipu3-cio2.o
ipu3-cio2-y += ipu3-cio2-main.o
ipu3-cio2-$(CONFIG_CIO2_BRIDGE) += cio2-bridge.o
......@@ -29,6 +29,7 @@
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-dma-sg.h>
#include "../ipu-bridge.h"
#include "ipu3-cio2.h"
struct ipu3_cio2_fmt {
......@@ -1724,7 +1725,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
return -EINVAL;
}
r = cio2_bridge_init(pci_dev);
r = ipu_bridge_init(pci_dev);
if (r)
return r;
}
......@@ -2057,3 +2058,4 @@ MODULE_AUTHOR("Yuning Pu <yuning.pu@intel.com>");
MODULE_AUTHOR("Yong Zhi <yong.zhi@intel.com>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("IPU3 CIO2 driver");
MODULE_IMPORT_NS(INTEL_IPU_BRIDGE);
......@@ -459,10 +459,4 @@ static inline struct cio2_queue *vb2q_to_cio2_queue(struct vb2_queue *vq)
return container_of(vq, struct cio2_queue, vbq);
}
#if IS_ENABLED(CONFIG_CIO2_BRIDGE)
int cio2_bridge_init(struct pci_dev *cio2);
#else
static inline int cio2_bridge_init(struct pci_dev *cio2) { return 0; }
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment