diff options
Diffstat (limited to 'drivers/media/video/sn9c102/sn9c102_hv7131d.c')
-rw-r--r-- | drivers/media/video/sn9c102/sn9c102_hv7131d.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/media/video/sn9c102/sn9c102_hv7131d.c b/drivers/media/video/sn9c102/sn9c102_hv7131d.c index 7ae368f60d89..28a861aed044 100644 --- a/drivers/media/video/sn9c102/sn9c102_hv7131d.c +++ b/drivers/media/video/sn9c102/sn9c102_hv7131d.c | |||
@@ -22,19 +22,13 @@ | |||
22 | #include "sn9c102_sensor.h" | 22 | #include "sn9c102_sensor.h" |
23 | 23 | ||
24 | 24 | ||
25 | static struct sn9c102_sensor hv7131d; | ||
26 | |||
27 | |||
28 | static int hv7131d_init(struct sn9c102_device* cam) | 25 | static int hv7131d_init(struct sn9c102_device* cam) |
29 | { | 26 | { |
30 | int err = 0; | 27 | int err; |
31 | 28 | ||
32 | err += sn9c102_write_reg(cam, 0x00, 0x10); | 29 | err = sn9c102_write_const_regs(cam, {0x00, 0x10}, {0x00, 0x11}, |
33 | err += sn9c102_write_reg(cam, 0x00, 0x11); | 30 | {0x00, 0x14}, {0x60, 0x17}, |
34 | err += sn9c102_write_reg(cam, 0x00, 0x14); | 31 | {0x0e, 0x18}, {0xf2, 0x19}); |
35 | err += sn9c102_write_reg(cam, 0x60, 0x17); | ||
36 | err += sn9c102_write_reg(cam, 0x0e, 0x18); | ||
37 | err += sn9c102_write_reg(cam, 0xf2, 0x19); | ||
38 | 32 | ||
39 | err += sn9c102_i2c_write(cam, 0x01, 0x04); | 33 | err += sn9c102_i2c_write(cam, 0x01, 0x04); |
40 | err += sn9c102_i2c_write(cam, 0x02, 0x00); | 34 | err += sn9c102_i2c_write(cam, 0x02, 0x00); |
@@ -153,7 +147,7 @@ static int hv7131d_set_pix_format(struct sn9c102_device* cam, | |||
153 | static struct sn9c102_sensor hv7131d = { | 147 | static struct sn9c102_sensor hv7131d = { |
154 | .name = "HV7131D", | 148 | .name = "HV7131D", |
155 | .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", | 149 | .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", |
156 | .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102 | BRIDGE_SN9C103, | 150 | .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102, |
157 | .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, | 151 | .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, |
158 | .frequency = SN9C102_I2C_100KHZ, | 152 | .frequency = SN9C102_I2C_100KHZ, |
159 | .interface = SN9C102_I2C_2WIRES, | 153 | .interface = SN9C102_I2C_2WIRES, |
@@ -250,11 +244,10 @@ static struct sn9c102_sensor hv7131d = { | |||
250 | 244 | ||
251 | int sn9c102_probe_hv7131d(struct sn9c102_device* cam) | 245 | int sn9c102_probe_hv7131d(struct sn9c102_device* cam) |
252 | { | 246 | { |
253 | int r0 = 0, r1 = 0, err = 0; | 247 | int r0 = 0, r1 = 0, err; |
254 | 248 | ||
255 | err += sn9c102_write_reg(cam, 0x01, 0x01); | 249 | err = sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, |
256 | err += sn9c102_write_reg(cam, 0x00, 0x01); | 250 | {0x28, 0x17}); |
257 | err += sn9c102_write_reg(cam, 0x28, 0x17); | ||
258 | if (err) | 251 | if (err) |
259 | return -EIO; | 252 | return -EIO; |
260 | 253 | ||
@@ -263,7 +256,7 @@ int sn9c102_probe_hv7131d(struct sn9c102_device* cam) | |||
263 | if (r0 < 0 || r1 < 0) | 256 | if (r0 < 0 || r1 < 0) |
264 | return -EIO; | 257 | return -EIO; |
265 | 258 | ||
266 | if (r0 != 0x00 && r1 != 0x04) | 259 | if (r0 != 0x00 || r1 != 0x04) |
267 | return -ENODEV; | 260 | return -ENODEV; |
268 | 261 | ||
269 | sn9c102_attach_sensor(cam, &hv7131d); | 262 | sn9c102_attach_sensor(cam, &hv7131d); |