1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Author: Dan Scally <djrscally@gmail.com> */
6 #include <linux/property.h>
7 #include <linux/types.h>
8 #include <media/v4l2-fwnode.h>
12 #define IPU_HID "INT343E"
13 #define IPU_MAX_LANES 4
14 #define IPU_MAX_PORTS 4
15 #define MAX_NUM_LINK_FREQS 3
17 /* Values are educated guesses as we don't have a spec */
18 #define IPU_SENSOR_ROTATION_NORMAL 0
19 #define IPU_SENSOR_ROTATION_INVERTED 1
21 #define IPU_SENSOR_CONFIG(_HID, _NR, ...) \
22 (const struct ipu_sensor_config) { \
24 .nr_link_freqs = _NR, \
25 .link_freqs = { __VA_ARGS__ } \
28 #define NODE_SENSOR(_HID, _PROPS) \
29 (const struct software_node) { \
31 .properties = _PROPS, \
34 #define NODE_PORT(_PORT, _SENSOR_NODE) \
35 (const struct software_node) { \
37 .parent = _SENSOR_NODE, \
40 #define NODE_ENDPOINT(_EP, _PORT, _PROPS) \
41 (const struct software_node) { \
44 .properties = _PROPS, \
47 #define NODE_VCM(_TYPE) \
48 (const struct software_node) { \
52 enum ipu_sensor_swnodes {
55 SWNODE_SENSOR_ENDPOINT,
58 /* Must be last because it is optional / maybe empty */
63 /* Data representation as it is in ACPI SSDB buffer */
64 struct ipu_sensor_ssdb {
76 u8 sensorcalibfileidx;
77 u8 sensorcalibfileidxInMBZ[3];
93 struct ipu_property_names {
94 char clock_frequency[16];
99 char remote_endpoint[16];
100 char link_frequencies[17];
103 struct ipu_node_names {
110 struct ipu_sensor_config {
112 const u8 nr_link_freqs;
113 const u64 link_freqs[MAX_NUM_LINK_FREQS];
117 /* append ssdb.link(u8) in "-%u" format as suffix of HID */
118 char name[ACPI_ID_LEN + 4];
119 struct acpi_device *adev;
120 struct i2c_client *vcm_i2c_client;
122 /* SWNODE_COUNT + 1 for terminating NULL */
123 const struct software_node *group[SWNODE_COUNT + 1];
124 struct software_node swnodes[SWNODE_COUNT];
125 struct ipu_node_names node_names;
131 enum v4l2_fwnode_orientation orientation;
132 const char *vcm_type;
134 struct ipu_property_names prop_names;
135 struct property_entry ep_properties[5];
136 struct property_entry dev_properties[5];
137 struct property_entry ipu_properties[3];
138 struct software_node_ref_args local_ref[1];
139 struct software_node_ref_args remote_ref[1];
140 struct software_node_ref_args vcm_ref[1];
145 char ipu_node_name[ACPI_ID_LEN];
146 struct software_node ipu_hid_node;
148 unsigned int n_sensors;
149 struct ipu_sensor sensors[IPU_MAX_PORTS];
152 #if IS_ENABLED(CONFIG_IPU_BRIDGE)
153 int ipu_bridge_init(struct device *dev);
155 static inline int ipu_bridge_init(struct device *dev) { return 0; }