Skip to content

Commit

Permalink
setup common regs
Browse files Browse the repository at this point in the history
  • Loading branch information
Comma Device committed Feb 8, 2025
1 parent 1b57e66 commit cca0c1c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 31 deletions.
50 changes: 34 additions & 16 deletions system/camerad/cameras/ife.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@
#include "system/camerad/cameras/tici.h"
#include "system/camerad/sensors/sensor.h"

int build_common_ife_bps(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t> &patches, int camera_num, bool ife) {
uint8_t *start = dst;

/*
Common between IFE and BPS.
*/

// IFE -> BPS addresses
/*
std::map<uint32_t, uint32_t> addrs = {
{0xf30, 0x3468},
};
*/

// YUV
dst += write_cont(dst, ife ? 0xf30 : 0x3468, {
0x00680208,
0x00000108,
0x00400000,
0x03ff0000,
0x01c01ed8,
0x00001f68,
0x02000000,
0x03ff0000,
0x1fb81e88,
0x000001c0,
0x02000000,
0x03ff0000,
});

return dst - start;
}

int build_update(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t> &patches, int camera_num) {
uint8_t *start = dst;
Expand Down Expand Up @@ -164,22 +196,6 @@ int build_initial_config(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t
dst += write_dmi(dst, &addr, s->gamma_lut_rgb.size()*sizeof(uint32_t), 0xc24, 30); // R
patches.push_back(addr - (uint64_t)start);

// YUV
dst += write_cont(dst, 0xf30, {
0x00680208,
0x00000108,
0x00400000,
0x03ff0000,
0x01c01ed8,
0x00001f68,
0x02000000,
0x03ff0000,
0x1fb81e88,
0x000001c0,
0x02000000,
0x03ff0000,
});

// TODO: remove this
dst += write_cont(dst, 0xa3c, {
0x00000003,
Expand Down Expand Up @@ -226,6 +242,8 @@ int build_initial_config(uint8_t *dst, const SensorInfo *s, std::vector<uint32_t
0x00000017,
});

dst += build_common_ife_bps(dst, s, patches, camera_num, true);

return dst - start;
}

Expand Down
21 changes: 6 additions & 15 deletions system/camerad/cameras/spectra.cc
Original file line number Diff line number Diff line change
Expand Up @@ -558,21 +558,12 @@ void SpectraCamera::config_bps(int idx, int request_id) {
0x00800066,
});

// YUV color xform
cdm_len += write_cont((unsigned char *)bps_cdm_program_array.ptr + cdm_len, 0x3468, {
0x00680208,
0x00000108,
0x00400000,
0x03ff0000,
0x01c01ed8,
0x00001f68,
0x02000000,
0x03ff0000,
0x1fb81e88,
0x000001c0,
0x02000000,
0x03ff0000,
});
// YUV
std::vector<uint32_t> patches;
cdm_len += build_common_ife_bps((unsigned char *)bps_cdm_program_array.ptr + cdm_len, sensor.get(), patches, cc.camera_num, false);

// TODO: handle patches
assert(patches.size() == 0);

pa->length = cdm_len - 1;

Expand Down

0 comments on commit cca0c1c

Please sign in to comment.