@@ -27,14 +27,15 @@ LOG_MODULE_REGISTER(video_emul_imager, CONFIG_VIDEO_LOG_LEVEL);
2727#define EMUL_IMAGER_REG_TIMING1 0x0004
2828#define EMUL_IMAGER_REG_TIMING2 0x0005
2929#define EMUL_IMAGER_REG_TIMING3 0x0006
30- #define EMUL_IMAGER_REG_EXPOSURE 0x0007
31- #define EMUL_IMAGER_REG_GAIN 0x0008
32- #define EMUL_IMAGER_REG_PATTERN 0x0009
30+ #define EMUL_IMAGER_REG_CUSTOM 0x0007
3331#define EMUL_IMAGER_REG_FORMAT 0x000a
3432#define EMUL_IMAGER_PATTERN_OFF 0x00
3533#define EMUL_IMAGER_PATTERN_BARS1 0x01
3634#define EMUL_IMAGER_PATTERN_BARS2 0x02
3735
36+ /* Custom control that is just an I2C write for example and test purpose */
37+ #define EMUL_IMAGER_CID_CUSTOM (VIDEO_CID_PRIVATE_BASE + 0x01)
38+
3839/* Emulated register bank */
3940uint8_t emul_imager_fake_regs [10 ];
4041
@@ -198,31 +199,18 @@ static int emul_imager_write_multi(const struct device *const dev,
198199static int emul_imager_set_ctrl (const struct device * dev , unsigned int cid , void * value )
199200{
200201 switch (cid ) {
201- case VIDEO_CID_EXPOSURE :
202- return emul_imager_write_reg (dev , EMUL_IMAGER_REG_EXPOSURE , (int )value );
203- case VIDEO_CID_GAIN :
204- return emul_imager_write_reg (dev , EMUL_IMAGER_REG_GAIN , (int )value );
205- case VIDEO_CID_TEST_PATTERN :
206- return emul_imager_write_reg (dev , EMUL_IMAGER_REG_PATTERN , (int )value );
202+ case EMUL_IMAGER_CID_CUSTOM :
203+ return emul_imager_write_reg (dev , EMUL_IMAGER_REG_CUSTOM , (int )value );
207204 default :
208205 return - ENOTSUP ;
209206 }
210207}
211208
212209static int emul_imager_get_ctrl (const struct device * dev , unsigned int cid , void * value )
213210{
214- struct emul_imager_data * data = dev -> data ;
215-
216211 switch (cid ) {
217- case VIDEO_CID_EXPOSURE :
218- return emul_imager_read_int (dev , EMUL_IMAGER_REG_EXPOSURE , value );
219- case VIDEO_CID_GAIN :
220- return emul_imager_read_int (dev , EMUL_IMAGER_REG_GAIN , value );
221- case VIDEO_CID_TEST_PATTERN :
222- return emul_imager_read_int (dev , EMUL_IMAGER_REG_PATTERN , value );
223- case VIDEO_CID_PIXEL_RATE :
224- * (int64_t * )value = (int64_t )data -> fmt .width * data -> fmt .pitch * data -> mode -> fps ;
225- return 0 ;
212+ case EMUL_IMAGER_CID_CUSTOM :
213+ return emul_imager_read_int (dev , EMUL_IMAGER_REG_CUSTOM , value );
226214 default :
227215 return - ENOTSUP ;
228216 }
0 commit comments