// SPDX-License-Identifier: GPL-2.0-only #ifndef GXFP_SENSOR_H #define GXFP_SENSOR_H #include #include struct gxfp_device; struct gxfp_otp_crc_info { int cp_valid; int ft_valid; int mt_valid; uint8_t cp_calculated; uint8_t ft_calculated; uint8_t mt_calculated; uint8_t cp_stored; uint8_t ft_stored; uint8_t mt_stored; }; struct gxfp_dac_info { uint16_t raw[4]; uint16_t register_value[4]; unsigned int match_count; int used_ft; int used_mt; int used_fallback; struct gxfp_otp_crc_info crc; }; struct gxfp_mcu_state { uint8_t version; uint8_t flags; int pov_image_valid; int tls_connected; int tls_used; int locked; uint8_t reserved[18]; }; int gxfp_sensor_read_version(struct gxfp_device *device, char *version, size_t version_capacity); int gxfp_sensor_query_mcu_state(struct gxfp_device *device, struct gxfp_mcu_state *state); int gxfp_sensor_recover(struct gxfp_device *device, int unstick_tls); int gxfp_sensor_reset(struct gxfp_device *device); int gxfp_sensor_start_tls(struct gxfp_device *device); int gxfp_sensor_download_config(struct gxfp_device *device, const void *config, size_t config_len); int gxfp_sensor_reset_and_download_config( struct gxfp_device *device, const void *config, size_t config_len); int gxfp_sensor_capture_oneframe(struct gxfp_device *device, void *output, size_t output_capacity, size_t *output_len); int gxfp_sensor_read_register(struct gxfp_device *device, uint16_t address, void *output, uint16_t output_len); int gxfp_sensor_read_chip_id(struct gxfp_device *device, uint16_t *chip_id); int gxfp_sensor_read_otp(struct gxfp_device *device, void *output, size_t output_capacity, size_t *output_len); int gxfp_sensor_check_chicagohu_otp_crc( const void *otp, size_t otp_len, struct gxfp_otp_crc_info *info); int gxfp_sensor_parse_dac(const void *otp, size_t otp_len, int force_ft, int force_mt, struct gxfp_dac_info *info); #endif