Skip to content

Commit a3ad74e

Browse files
committed
mira220: testing new i2c method
1 parent ccc9798 commit a3ad74e

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

drivers/media/i2c/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ config VIDEO_MIRA220
154154
depends on I2C && VIDEO_DEV
155155
select MEDIA_CONTROLLER
156156
select VIDEO_V4L2_SUBDEV_API
157+
select V4L2_CCI_I2C
157158
select V4L2_FWNODE
158159
help
159160
This is a Video4Linux2 sensor driver for the ams

drivers/media/i2c/mira220.c

+14-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <media/v4l2-event.h>
2222
#include <media/v4l2-fwnode.h>
2323
#include <media/v4l2-mediabus.h>
24-
24+
#include <media/v4l2-cci.h>
2525
#include <linux/unaligned.h>
2626

2727
/*
@@ -79,6 +79,8 @@
7979
// Exposure time is indicated in number of rows
8080
#define MIRA220_EXP_TIME_LO_REG 0x100C
8181
#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)
8284

8385
// VBLANK is indicated in number of rows
8486
#define MIRA220_VBLANK_LO_REG 0x1012
@@ -2987,6 +2989,7 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
29872989

29882990
/* User specified I2C device address */
29892991
u32 tbd_client_i2c_addr;
2992+
struct regmap *regmap;
29902993

29912994
};
29922995

@@ -4192,7 +4195,8 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
41924195
struct device *dev = &client->dev;
41934196
struct mira220 *mira220;
41944197
int ret;
4195-
4198+
u64 readval;
4199+
41964200
printk(KERN_INFO "[MIRA220]: probing v4l2 sensor.\n");
41974201
printk(KERN_INFO "[MIRA220]: Driver Version 0.0.\n");
41984202

@@ -4203,7 +4207,8 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
42034207
return -ENOMEM;
42044208

42054209
v4l2_i2c_subdev_init(&mira220->sd, client, &mira220_subdev_ops);
4206-
4210+
mira220->regmap = devm_cci_regmap_init_i2c(client, 16);
4211+
42074212
/* Check the hardware configuration in device tree */
42084213
if (mira220_check_hwcfg(dev))
42094214
return -EINVAL;
@@ -4231,7 +4236,6 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
42314236
dev_err(dev, "failed to get regulators\n");
42324237
return ret;
42334238
}
4234-
42354239

42364240

42374241
usleep_range(1000000, 1000000+100);
@@ -4252,6 +4256,12 @@ static const struct mira220_reg full_400_400_250fps_12b_2lanes_reg[] = {
42524256

42534257
printk(KERN_INFO "[MIRA220]: Setting support function.\n");
42544258

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);
42554265
/* Set default mode to max resolution */
42564266
mira220->mode = &supported_modes[0];
42574267

0 commit comments

Comments
 (0)