diff --git a/system/camerad/cameras/camera_common.h b/system/camerad/cameras/camera_common.h index e0e16e18fc..a52fc59c41 100644 --- a/system/camerad/cameras/camera_common.h +++ b/system/camerad/cameras/camera_common.h @@ -13,11 +13,8 @@ const int YUV_BUFFER_COUNT = 20; typedef struct FrameMetadata { uint32_t frame_id; uint32_t request_id; - - // Timestamps uint64_t timestamp_sof; uint64_t timestamp_eof; - float processing_time; } FrameMetadata; diff --git a/system/camerad/cameras/camera_qcom2.cc b/system/camerad/cameras/camera_qcom2.cc index 3d5507add9..df884e7b92 100644 --- a/system/camerad/cameras/camera_qcom2.cc +++ b/system/camerad/cameras/camera_qcom2.cc @@ -64,6 +64,8 @@ public: }; void CameraState::init(VisionIpcServer *v, cl_device_id device_id, cl_context ctx) { + if (!camera.enabled) return; + camera.camera_open(v, device_id, ctx); fl_pix = camera.cc.focal_len / camera.sensor->pixel_size_mm; @@ -73,7 +75,7 @@ void CameraState::init(VisionIpcServer *v, cl_device_id device_id, cl_context ct gain_idx = camera.sensor->analog_gain_rec_idx; cur_ev[0] = cur_ev[1] = cur_ev[2] = get_gain_factor() * camera.sensor->sensor_analog_gains[gain_idx] * exposure_time; - if (camera.enabled) thread = std::thread(&CameraState::run, this); + thread = std::thread(&CameraState::run, this); } CameraState::~CameraState() { diff --git a/system/camerad/cameras/cdm.h b/system/camerad/cameras/cdm.h new file mode 100644 index 0000000000..413c4e23d7 --- /dev/null +++ b/system/camerad/cameras/cdm.h @@ -0,0 +1,66 @@ +// from drivers/media/platform/msm/camera/cam_cdm/cam_cdm_util.{c,h} + +enum cam_cdm_command { + CAM_CDM_CMD_UNUSED = 0x0, + CAM_CDM_CMD_DMI = 0x1, + CAM_CDM_CMD_NOT_DEFINED = 0x2, + CAM_CDM_CMD_REG_CONT = 0x3, + CAM_CDM_CMD_REG_RANDOM = 0x4, + CAM_CDM_CMD_BUFF_INDIRECT = 0x5, + CAM_CDM_CMD_GEN_IRQ = 0x6, + CAM_CDM_CMD_WAIT_EVENT = 0x7, + CAM_CDM_CMD_CHANGE_BASE = 0x8, + CAM_CDM_CMD_PERF_CTRL = 0x9, + CAM_CDM_CMD_DMI_32 = 0xa, + CAM_CDM_CMD_DMI_64 = 0xb, + CAM_CDM_CMD_PRIVATE_BASE = 0xc, + CAM_CDM_CMD_SWD_DMI_32 = (CAM_CDM_CMD_PRIVATE_BASE + 0x64), + CAM_CDM_CMD_SWD_DMI_64 = (CAM_CDM_CMD_PRIVATE_BASE + 0x65), + CAM_CDM_CMD_PRIVATE_BASE_MAX = 0x7F +}; + +/** + * struct cdm_regrandom_cmd - Definition for CDM random register command. + * @count: Number of register writes + * @reserved: reserved bits + * @cmd: Command ID (CDMCmd) + */ +struct cdm_regrandom_cmd { + unsigned int count : 16; + unsigned int reserved : 8; + unsigned int cmd : 8; +} __attribute__((__packed__)); + +/** + * struct cdm_regcontinuous_cmd - Definition for a CDM register range command. + * @count: Number of register writes + * @reserved0: reserved bits + * @cmd: Command ID (CDMCmd) + * @offset: Start address of the range of registers + * @reserved1: reserved bits + */ +struct cdm_regcontinuous_cmd { + unsigned int count : 16; + unsigned int reserved0 : 8; + unsigned int cmd : 8; + unsigned int offset : 24; + unsigned int reserved1 : 8; +} __attribute__((__packed__)); + +/** + * struct cdm_dmi_cmd - Definition for a CDM DMI command. + * @length: Number of bytes in LUT - 1 + * @reserved: reserved bits + * @cmd: Command ID (CDMCmd) + * @addr: Address of the LUT in memory + * @DMIAddr: Address of the target DMI config register + * @DMISel: DMI identifier + */ +struct cdm_dmi_cmd { + unsigned int length : 16; + unsigned int reserved : 8; + unsigned int cmd : 8; + unsigned int addr; + unsigned int DMIAddr : 24; + unsigned int DMISel : 8; +} __attribute__((__packed__)); diff --git a/system/camerad/test/debug.sh b/system/camerad/test/debug.sh new file mode 100755 index 0000000000..40d2dda237 --- /dev/null +++ b/system/camerad/test/debug.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e + +#echo 4294967295 | sudo tee /sys/module/cam_debug_util/parameters/debug_mdl + +# no CCI and UTIL, very spammy +echo 0xfffdbfff | sudo tee /sys/module/cam_debug_util/parameters/debug_mdl + +sudo dmesg -C +scons -u -j8 --minimal . +export DEBUG_FRAMES=1 +#export DISABLE_ROAD=1 DISABLE_WIDE_ROAD=1 +export DISABLE_DRIVER=1 +#export LOGPRINT=debug +./camerad