21
21
#include <media/v4l2-event.h>
22
22
#include <media/v4l2-fwnode.h>
23
23
#include <media/v4l2-mediabus.h>
24
-
24
+ #include <media/v4l2-cci.h>
25
25
#include <linux/unaligned.h>
26
26
27
27
/*
79
79
// Exposure time is indicated in number of rows
80
80
#define MIRA220_EXP_TIME_LO_REG 0x100C
81
81
#define MIRA220_EXP_TIME_HI_REG 0x100D
82
+ #define MIRA220_EXP_TIME_LO_REG_NEW CCI_REG8(0x100C)
83
+ #define MIRA220_EXP_TIME_HI_REG_NEW CCI_REG8(0x100D)
82
84
83
85
// VBLANK is indicated in number of rows
84
86
#define MIRA220_VBLANK_LO_REG 0x1012
@@ -2987,6 +2989,7 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
2987
2989
2988
2990
/* User specified I2C device address */
2989
2991
u32 tbd_client_i2c_addr ;
2992
+ struct regmap * regmap ;
2990
2993
2991
2994
};
2992
2995
@@ -4192,7 +4195,8 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
4192
4195
struct device * dev = & client -> dev ;
4193
4196
struct mira220 * mira220 ;
4194
4197
int ret ;
4195
-
4198
+ u64 readval ;
4199
+
4196
4200
printk (KERN_INFO "[MIRA220]: probing v4l2 sensor.\n" );
4197
4201
printk (KERN_INFO "[MIRA220]: Driver Version 0.0.\n" );
4198
4202
@@ -4203,7 +4207,8 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
4203
4207
return - ENOMEM ;
4204
4208
4205
4209
v4l2_i2c_subdev_init (& mira220 -> sd , client , & mira220_subdev_ops );
4206
-
4210
+ mira220 -> regmap = devm_cci_regmap_init_i2c (client , 16 );
4211
+
4207
4212
/* Check the hardware configuration in device tree */
4208
4213
if (mira220_check_hwcfg (dev ))
4209
4214
return - EINVAL ;
@@ -4231,7 +4236,6 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
4231
4236
dev_err (dev , "failed to get regulators\n" );
4232
4237
return ret ;
4233
4238
}
4234
-
4235
4239
4236
4240
4237
4241
usleep_range (1000000 , 1000000 + 100 );
@@ -4252,6 +4256,12 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
4252
4256
4253
4257
printk (KERN_INFO "[MIRA220]: Setting support function.\n" );
4254
4258
4259
+ /*test cci write*/
4260
+ ret = cci_write (mira220 -> regmap , MIRA220_EXP_TIME_LO_REG_NEW ,
4261
+ 0xAA , NULL );
4262
+ ret = cci_read (mira220 -> regmap ,MIRA220_EXP_TIME_LO_REG_NEW , & readval , NULL );
4263
+ printk (KERN_INFO "[MIRA220]: NEW Read reg 0x%4.4x, val = 0x%x.\n" ,
4264
+ MIRA220_EXP_TIME_LO_REG_NEW , readval );
4255
4265
/* Set default mode to max resolution */
4256
4266
mira220 -> mode = & supported_modes [0 ];
4257
4267
0 commit comments