aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/sn9c102/sn9c102_pas106b.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/sn9c102/sn9c102_pas106b.c')
-rw-r--r--drivers/media/video/sn9c102/sn9c102_pas106b.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/media/video/sn9c102/sn9c102_pas106b.c b/drivers/media/video/sn9c102/sn9c102_pas106b.c
index 8d79a5fae5de..67151964801f 100644
--- a/drivers/media/video/sn9c102/sn9c102_pas106b.c
+++ b/drivers/media/video/sn9c102/sn9c102_pas106b.c
@@ -23,19 +23,13 @@
23#include "sn9c102_sensor.h" 23#include "sn9c102_sensor.h"
24 24
25 25
26static struct sn9c102_sensor pas106b;
27
28
29static int pas106b_init(struct sn9c102_device* cam) 26static int pas106b_init(struct sn9c102_device* cam)
30{ 27{
31 int err = 0; 28 int err = 0;
32 29
33 err += sn9c102_write_reg(cam, 0x00, 0x10); 30 err = sn9c102_write_const_regs(cam, {0x00, 0x10}, {0x00, 0x11},
34 err += sn9c102_write_reg(cam, 0x00, 0x11); 31 {0x00, 0x14}, {0x20, 0x17},
35 err += sn9c102_write_reg(cam, 0x00, 0x14); 32 {0x20, 0x19}, {0x09, 0x18});
36 err += sn9c102_write_reg(cam, 0x20, 0x17);
37 err += sn9c102_write_reg(cam, 0x20, 0x19);
38 err += sn9c102_write_reg(cam, 0x09, 0x18);
39 33
40 err += sn9c102_i2c_write(cam, 0x02, 0x0c); 34 err += sn9c102_i2c_write(cam, 0x02, 0x0c);
41 err += sn9c102_i2c_write(cam, 0x05, 0x5a); 35 err += sn9c102_i2c_write(cam, 0x05, 0x5a);
@@ -172,7 +166,7 @@ static int pas106b_set_pix_format(struct sn9c102_device* cam,
172static struct sn9c102_sensor pas106b = { 166static struct sn9c102_sensor pas106b = {
173 .name = "PAS106B", 167 .name = "PAS106B",
174 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 168 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>",
175 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102 | BRIDGE_SN9C103, 169 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102,
176 .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, 170 .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE,
177 .frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ, 171 .frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ,
178 .interface = SN9C102_I2C_2WIRES, 172 .interface = SN9C102_I2C_2WIRES,
@@ -279,16 +273,17 @@ static struct sn9c102_sensor pas106b = {
279 273
280int sn9c102_probe_pas106b(struct sn9c102_device* cam) 274int sn9c102_probe_pas106b(struct sn9c102_device* cam)
281{ 275{
282 int r0 = 0, r1 = 0, err = 0; 276 int r0 = 0, r1 = 0, err;
283 unsigned int pid = 0; 277 unsigned int pid = 0;
284 278
285 /* 279 /*
286 Minimal initialization to enable the I2C communication 280 Minimal initialization to enable the I2C communication
287 NOTE: do NOT change the values! 281 NOTE: do NOT change the values!
288 */ 282 */
289 err += sn9c102_write_reg(cam, 0x01, 0x01); /* sensor power down */ 283 err = sn9c102_write_const_regs(cam,
290 err += sn9c102_write_reg(cam, 0x00, 0x01); /* sensor power on */ 284 {0x01, 0x01}, /* sensor power down */
291 err += sn9c102_write_reg(cam, 0x28, 0x17); /* sensor clock at 24 MHz */ 285 {0x00, 0x01}, /* sensor power on */
286 {0x28, 0x17});/* sensor clock 24 MHz */
292 if (err) 287 if (err)
293 return -EIO; 288 return -EIO;
294 289