| 1 |
|
| 2 |
|
| 3 |
#ifndef __INTEL_MIPI_CAMERA_CHIP_H__ |
| 4 |
#define __INTEL_MIPI_CAMERA_CHIP_H__ |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
#include <acpi/acpi_pld.h> |
| 8 |
#include <uuid.h> |
| 9 |
|
| 10 |
#define DEFAULT_LINK_FREQ 450000000 |
| 11 |
#define MAX_PWDB_ENTRIES 12 |
| 12 |
#define MAX_PORT_ENTRIES 4 |
| 13 |
#define MAX_LINK_FREQ_ENTRIES 4 |
| 14 |
#define MAX_CLK_CONFIGS 2 |
| 15 |
#define MAX_GPIO_CONFIGS 4 |
| 16 |
#define MAX_PWR_OPS 6 |
| 17 |
#define MAX_GUARDED_RESOURCES 10 |
| 18 |
#define IMGCLKOUT_0 0 |
| 19 |
#define IMGCLKOUT_1 1 |
| 20 |
#define IMGCLKOUT_2 2 |
| 21 |
#define IMGCLKOUT_3 3 |
| 22 |
#define IMGCLKOUT_4 4 |
| 23 |
#define IMGCLKOUT_5 5 |
| 24 |
#define FREQ_24_MHZ 0 |
| 25 |
#define FREQ_19_2_MHZ 1 |
| 26 |
|
| 27 |
#define SEQ_OPS_CLK_ENABLE(ind, delay) \ |
| 28 |
{ .type = IMGCLK, .index = (ind), .action = ENABLE, .delay_ms = (delay) } |
| 29 |
#define SEQ_OPS_CLK_DISABLE(ind, delay) \ |
| 30 |
{ .type = IMGCLK, .index = (ind), .action = DISABLE, .delay_ms = (delay) } |
| 31 |
#define SEQ_OPS_GPIO_ENABLE(ind, delay) \ |
| 32 |
{ .type = GPIO, .index = (ind), .action = ENABLE, .delay_ms = (delay) } |
| 33 |
#define SEQ_OPS_GPIO_DISABLE(ind, delay) \ |
| 34 |
{ .type = GPIO, .index = (ind), .action = DISABLE, .delay_ms = (delay) } |
| 35 |
|
| 36 |
enum camera_device_type { |
| 37 |
DEV_TYPE_SENSOR = 0, |
| 38 |
DEV_TYPE_VCM, |
| 39 |
DEV_TYPE_ROM |
| 40 |
}; |
| 41 |
|
| 42 |
enum intel_camera_platform_type { |
| 43 |
PLATFORM_BXT = 8, |
| 44 |
PLATFORM_SKC = 9, |
| 45 |
PLATFORM_CNL = 10, |
| 46 |
PLATFORM_TGL = 12, |
| 47 |
PLATFORM_JSL = 14, |
| 48 |
PLATFORM_ADL = 15, |
| 49 |
PLATFORM_MTL = 16, |
| 50 |
PLATFORM_LNL = 17 |
| 51 |
}; |
| 52 |
|
| 53 |
enum intel_camera_flash_type { |
| 54 |
FLASH_DEFAULT = 0, |
| 55 |
FLASH_DISABLE = 2, |
| 56 |
FLASH_ENABLE = 3 |
| 57 |
}; |
| 58 |
|
| 59 |
enum intel_camera_led_type { |
| 60 |
PRIVACY_LED_DEFAULT = 0, |
| 61 |
PRIVACY_LED_A_16mA |
| 62 |
}; |
| 63 |
|
| 64 |
enum intel_camera_mipi_info { |
| 65 |
MIPI_INFO_SENSOR_DRIVER = 0, |
| 66 |
MIPI_INFO_ACPI_DEFINED |
| 67 |
}; |
| 68 |
|
| 69 |
#define CLK_FREQ_19_2MHZ 19200000 |
| 70 |
#define CLK_FREQ_24MHZ 24000000 |
| 71 |
#define CLK_FREQ_20MHZ 20000000 |
| 72 |
|
| 73 |
enum intel_camera_device_type { |
| 74 |
INTEL_ACPI_CAMERA_CIO2, |
| 75 |
INTEL_ACPI_CAMERA_IMGU, |
| 76 |
INTEL_ACPI_CAMERA_SENSOR, |
| 77 |
INTEL_ACPI_CAMERA_VCM, |
| 78 |
INTEL_ACPI_CAMERA_NVM, |
| 79 |
INTEL_ACPI_CAMERA_PMIC = 100, |
| 80 |
}; |
| 81 |
|
| 82 |
enum intel_power_action_type { |
| 83 |
INTEL_ACPI_CAMERA_REGULATOR, |
| 84 |
INTEL_ACPI_CAMERA_CLK, |
| 85 |
INTEL_ACPI_CAMERA_GPIO, |
| 86 |
}; |
| 87 |
|
| 88 |
enum ctrl_type { |
| 89 |
UNKNOWN_CTRL, |
| 90 |
IMGCLK, |
| 91 |
GPIO |
| 92 |
}; |
| 93 |
|
| 94 |
enum action_type { |
| 95 |
UNKNOWN_ACTION, |
| 96 |
ENABLE, |
| 97 |
DISABLE |
| 98 |
}; |
| 99 |
|
| 100 |
struct camera_resource { |
| 101 |
uint8_t type; |
| 102 |
uint8_t id; |
| 103 |
}; |
| 104 |
|
| 105 |
struct camera_resource_manager { |
| 106 |
uint8_t cnt; |
| 107 |
struct camera_resource resource[MAX_GUARDED_RESOURCES]; |
| 108 |
}; |
| 109 |
|
| 110 |
struct resource_config { |
| 111 |
enum action_type action; |
| 112 |
enum ctrl_type type; |
| 113 |
union { |
| 114 |
const struct clk_config *clk_conf; |
| 115 |
const struct gpio_config *gpio_conf; |
| 116 |
}; |
| 117 |
}; |
| 118 |
|
| 119 |
struct clk_config { |
| 120 |
|
| 121 |
uint8_t clknum; |
| 122 |
|
| 123 |
uint8_t freq; |
| 124 |
}; |
| 125 |
|
| 126 |
struct gpio_config { |
| 127 |
uint16_t gpio_num; |
| 128 |
}; |
| 129 |
|
| 130 |
struct clock_ctrl_panel { |
| 131 |
struct clk_config clks[MAX_CLK_CONFIGS]; |
| 132 |
}; |
| 133 |
|
| 134 |
struct gpio_ctrl_panel { |
| 135 |
struct gpio_config gpio[MAX_GPIO_CONFIGS]; |
| 136 |
}; |
| 137 |
|
| 138 |
struct operation_type { |
| 139 |
enum ctrl_type type; |
| 140 |
uint8_t index; |
| 141 |
enum action_type action; |
| 142 |
uint32_t delay_ms; |
| 143 |
}; |
| 144 |
|
| 145 |
struct operation_seq { |
| 146 |
struct operation_type ops[MAX_PWR_OPS]; |
| 147 |
uint8_t ops_cnt; |
| 148 |
}; |
| 149 |
|
| 150 |
struct intel_ssdb { |
| 151 |
uint8_t version; |
| 152 |
uint8_t sensor_card_sku; |
| 153 |
guid_t csi2_data_stream_interface; |
| 154 |
uint16_t bdf_value; |
| 155 |
|
| 156 |
uint32_t dphy_link_en_fuses; |
| 157 |
|
| 158 |
|
| 159 |
uint32_t lanes_clock_division; |
| 160 |
|
| 161 |
uint8_t link_used; |
| 162 |
|
| 163 |
uint8_t lanes_used; |
| 164 |
|
| 165 |
uint32_t csi_rx_dly_cnt_termen_clane; |
| 166 |
uint32_t csi_rx_dly_cnt_settle_clane; |
| 167 |
uint32_t csi_rx_dly_cnt_termen_dlane0; |
| 168 |
uint32_t csi_rx_dly_cnt_settle_dlane0; |
| 169 |
uint32_t csi_rx_dly_cnt_termen_dlane1; |
| 170 |
uint32_t csi_rx_dly_cnt_settle_dlane1; |
| 171 |
uint32_t csi_rx_dly_cnt_termen_dlane2; |
| 172 |
uint32_t csi_rx_dly_cnt_settle_dlane2; |
| 173 |
uint32_t csi_rx_dly_cnt_termen_dlane3; |
| 174 |
uint32_t csi_rx_dly_cnt_settle_dlane3; |
| 175 |
uint32_t max_lane_speed; |
| 176 |
|
| 177 |
uint8_t sensor_cal_file_idx; |
| 178 |
|
| 179 |
uint8_t sensor_cal_file_idx_mbz[3]; |
| 180 |
|
| 181 |
uint8_t rom_type; |
| 182 |
|
| 183 |
uint8_t vcm_type; |
| 184 |
|
| 185 |
uint8_t platform; |
| 186 |
uint8_t platform_sub; |
| 187 |
uint8_t flash_support; |
| 188 |
|
| 189 |
uint8_t privacy_led; |
| 190 |
uint8_t degree; |
| 191 |
uint8_t mipi_define; |
| 192 |
|
| 193 |
uint32_t mclk_speed; |
| 194 |
uint8_t control_logic_id; |
| 195 |
|
| 196 |
uint8_t mipi_data_format; |
| 197 |
uint8_t silicon_version; |
| 198 |
uint8_t customer_id; |
| 199 |
uint8_t mclk_port; |
| 200 |
uint8_t reserved[13]; |
| 201 |
|
| 202 |
} __packed; |
| 203 |
|
| 204 |
struct intel_pwdb { |
| 205 |
char name[32]; |
| 206 |
|
| 207 |
uint32_t value; |
| 208 |
uint32_t entry_type; |
| 209 |
uint32_t delay_usec; |
| 210 |
|
| 211 |
} __packed; |
| 212 |
|
| 213 |
struct drivers_intel_mipi_camera_config { |
| 214 |
struct clock_ctrl_panel clk_panel; |
| 215 |
struct gpio_ctrl_panel gpio_panel; |
| 216 |
struct operation_seq on_seq; |
| 217 |
struct operation_seq off_seq; |
| 218 |
|
| 219 |
struct intel_ssdb ssdb; |
| 220 |
struct intel_pwdb pwdb[MAX_PWDB_ENTRIES]; |
| 221 |
enum intel_camera_device_type device_type; |
| 222 |
uint8_t num_pwdb_entries; |
| 223 |
const char *acpi_hid; |
| 224 |
const char *acpi_name; |
| 225 |
const char *chip_name; |
| 226 |
unsigned int acpi_uid; |
| 227 |
const char *pr0; |
| 228 |
|
| 229 |
|
| 230 |
uint32_t cio2_num_ports; |
| 231 |
uint32_t cio2_lanes_used[MAX_PORT_ENTRIES]; |
| 232 |
const char *cio2_lane_endpoint[MAX_PORT_ENTRIES]; |
| 233 |
uint32_t cio2_prt[MAX_PORT_ENTRIES]; |
| 234 |
|
| 235 |
|
| 236 |
bool disable_ssdb_defaults; |
| 237 |
|
| 238 |
uint8_t num_freq_entries; |
| 239 |
uint32_t link_freq[MAX_LINK_FREQ_ENTRIES]; |
| 240 |
const char *sensor_name; |
| 241 |
const char *remote_name; |
| 242 |
const char *vcm_name; |
| 243 |
bool use_pld; |
| 244 |
bool disable_pld_defaults; |
| 245 |
struct acpi_pld pld; |
| 246 |
uint16_t rom_address; |
| 247 |
uint16_t vcm_address; |
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
bool disable_nvm_defaults; |
| 254 |
uint32_t nvm_size; |
| 255 |
uint32_t nvm_pagesize; |
| 256 |
uint32_t nvm_readonly; |
| 257 |
uint32_t nvm_width; |
| 258 |
const char *nvm_compat; |
| 259 |
|
| 260 |
|
| 261 |
const char *vcm_compat; |
| 262 |
|
| 263 |
bool has_power_resource; |
| 264 |
|
| 265 |
bool low_power_probe; |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
uint8_t max_dstate_for_probe; |
| 277 |
}; |
| 278 |
|
| 279 |
#endif |