0001
0002
0003 #ifndef __CIO2_BRIDGE_H
0004 #define __CIO2_BRIDGE_H
0005
0006 #include <linux/property.h>
0007 #include <linux/types.h>
0008
0009 #include "ipu3-cio2.h"
0010
0011 struct i2c_client;
0012
0013 #define CIO2_HID "INT343E"
0014 #define CIO2_MAX_LANES 4
0015 #define MAX_NUM_LINK_FREQS 3
0016
0017
0018 #define CIO2_SENSOR_ROTATION_NORMAL 0
0019 #define CIO2_SENSOR_ROTATION_INVERTED 1
0020
0021 #define CIO2_SENSOR_CONFIG(_HID, _NR, ...) \
0022 (const struct cio2_sensor_config) { \
0023 .hid = _HID, \
0024 .nr_link_freqs = _NR, \
0025 .link_freqs = { __VA_ARGS__ } \
0026 }
0027
0028 #define NODE_SENSOR(_HID, _PROPS) \
0029 (const struct software_node) { \
0030 .name = _HID, \
0031 .properties = _PROPS, \
0032 }
0033
0034 #define NODE_PORT(_PORT, _SENSOR_NODE) \
0035 (const struct software_node) { \
0036 .name = _PORT, \
0037 .parent = _SENSOR_NODE, \
0038 }
0039
0040 #define NODE_ENDPOINT(_EP, _PORT, _PROPS) \
0041 (const struct software_node) { \
0042 .name = _EP, \
0043 .parent = _PORT, \
0044 .properties = _PROPS, \
0045 }
0046
0047 #define NODE_VCM(_TYPE) \
0048 (const struct software_node) { \
0049 .name = _TYPE, \
0050 }
0051
0052 enum cio2_sensor_swnodes {
0053 SWNODE_SENSOR_HID,
0054 SWNODE_SENSOR_PORT,
0055 SWNODE_SENSOR_ENDPOINT,
0056 SWNODE_CIO2_PORT,
0057 SWNODE_CIO2_ENDPOINT,
0058
0059 SWNODE_VCM,
0060 SWNODE_COUNT
0061 };
0062
0063
0064 struct cio2_sensor_ssdb {
0065 u8 version;
0066 u8 sku;
0067 u8 guid_csi2[16];
0068 u8 devfunction;
0069 u8 bus;
0070 u32 dphylinkenfuses;
0071 u32 clockdiv;
0072 u8 link;
0073 u8 lanes;
0074 u32 csiparams[10];
0075 u32 maxlanespeed;
0076 u8 sensorcalibfileidx;
0077 u8 sensorcalibfileidxInMBZ[3];
0078 u8 romtype;
0079 u8 vcmtype;
0080 u8 platforminfo;
0081 u8 platformsubinfo;
0082 u8 flash;
0083 u8 privacyled;
0084 u8 degree;
0085 u8 mipilinkdefined;
0086 u32 mclkspeed;
0087 u8 controllogicid;
0088 u8 reserved1[3];
0089 u8 mclkport;
0090 u8 reserved2[13];
0091 } __packed;
0092
0093 struct cio2_property_names {
0094 char clock_frequency[16];
0095 char rotation[9];
0096 char orientation[12];
0097 char bus_type[9];
0098 char data_lanes[11];
0099 char remote_endpoint[16];
0100 char link_frequencies[17];
0101 };
0102
0103 struct cio2_node_names {
0104 char port[7];
0105 char endpoint[11];
0106 char remote_port[7];
0107 };
0108
0109 struct cio2_sensor_config {
0110 const char *hid;
0111 const u8 nr_link_freqs;
0112 const u64 link_freqs[MAX_NUM_LINK_FREQS];
0113 };
0114
0115 struct cio2_sensor {
0116 char name[ACPI_ID_LEN];
0117 struct acpi_device *adev;
0118 struct i2c_client *vcm_i2c_client;
0119
0120
0121 struct software_node swnodes[SWNODE_COUNT + 1];
0122 struct cio2_node_names node_names;
0123
0124 struct cio2_sensor_ssdb ssdb;
0125 struct acpi_pld_info *pld;
0126
0127 struct cio2_property_names prop_names;
0128 struct property_entry ep_properties[5];
0129 struct property_entry dev_properties[5];
0130 struct property_entry cio2_properties[3];
0131 struct software_node_ref_args local_ref[1];
0132 struct software_node_ref_args remote_ref[1];
0133 struct software_node_ref_args vcm_ref[1];
0134 };
0135
0136 struct cio2_bridge {
0137 char cio2_node_name[ACPI_ID_LEN];
0138 struct software_node cio2_hid_node;
0139 u32 data_lanes[4];
0140 unsigned int n_sensors;
0141 struct cio2_sensor sensors[CIO2_NUM_PORTS];
0142 };
0143
0144 #endif