1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Author: Dan Scally <djrscally@gmail.com> */
6 #include <linux/property.h>
7 #include <linux/types.h>
11 #define IPU_HID "INT343E"
12 #define IPU_MAX_LANES 4
13 #define IPU_MAX_PORTS 4
14 #define MAX_NUM_LINK_FREQS 3
16 /* Values are educated guesses as we don't have a spec */
17 #define IPU_SENSOR_ROTATION_NORMAL 0
18 #define IPU_SENSOR_ROTATION_INVERTED 1
20 #define IPU_SENSOR_CONFIG(_HID, _NR, ...) \
21 (const struct ipu_sensor_config) { \
23 .nr_link_freqs = _NR, \
24 .link_freqs = { __VA_ARGS__ } \
27 #define NODE_SENSOR(_HID, _PROPS) \
28 (const struct software_node) { \
30 .properties = _PROPS, \
33 #define NODE_PORT(_PORT, _SENSOR_NODE) \
34 (const struct software_node) { \
36 .parent = _SENSOR_NODE, \
39 #define NODE_ENDPOINT(_EP, _PORT, _PROPS) \
40 (const struct software_node) { \
43 .properties = _PROPS, \
46 #define NODE_VCM(_TYPE) \
47 (const struct software_node) { \
51 enum ipu_sensor_swnodes {
54 SWNODE_SENSOR_ENDPOINT,
57 /* Must be last because it is optional / maybe empty */
62 /* Data representation as it is in ACPI SSDB buffer */
63 struct ipu_sensor_ssdb {
75 u8 sensorcalibfileidx;
76 u8 sensorcalibfileidxInMBZ[3];
92 struct ipu_property_names {
93 char clock_frequency[16];
98 char remote_endpoint[16];
99 char link_frequencies[17];
102 struct ipu_node_names {
109 struct ipu_sensor_config {
111 const u8 nr_link_freqs;
112 const u64 link_freqs[MAX_NUM_LINK_FREQS];
116 /* append ssdb.link(u8) in "-%u" format as suffix of HID */
117 char name[ACPI_ID_LEN + 4];
118 struct acpi_device *adev;
119 struct i2c_client *vcm_i2c_client;
121 /* SWNODE_COUNT + 1 for terminating NULL */
122 const struct software_node *group[SWNODE_COUNT + 1];
123 struct software_node swnodes[SWNODE_COUNT];
124 struct ipu_node_names node_names;
126 struct ipu_sensor_ssdb ssdb;
128 struct ipu_property_names prop_names;
129 struct property_entry ep_properties[5];
130 struct property_entry dev_properties[5];
131 struct property_entry ipu_properties[3];
132 struct software_node_ref_args local_ref[1];
133 struct software_node_ref_args remote_ref[1];
134 struct software_node_ref_args vcm_ref[1];
139 char ipu_node_name[ACPI_ID_LEN];
140 struct software_node ipu_hid_node;
142 unsigned int n_sensors;
143 struct ipu_sensor sensors[IPU_MAX_PORTS];
146 #if IS_ENABLED(CONFIG_IPU_BRIDGE)
147 int ipu_bridge_init(struct device *dev);
149 static inline int ipu_bridge_init(struct device *dev) { return 0; }