diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2013-03-27 16:06:33 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-29 05:39:06 -0400 |
commit | 0af0b25a64458c3ee002efe6e7542013b94a268a (patch) | |
tree | c7e0a54a60ec7e2699eecf33fd88eb3758bbff3b /drivers/media/usb | |
parent | 176013b19e848204895bfcaea8b9b39fba5b26dd (diff) |
[media] em28xx: move the probing of Micron sensors to a separate function
Other sensors like the ones from OmniVision need a different probing procedure,
so it makes sense have separate functions for each manufacturer/sensor type.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-camera.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 2e4856aebae8..d744af6f7d08 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c | |||
@@ -83,9 +83,9 @@ static int em28xx_initialize_mt9m001(struct em28xx *dev) | |||
83 | 83 | ||
84 | 84 | ||
85 | /* | 85 | /* |
86 | * This method works for webcams with Micron sensors | 86 | * Probes Micron sensors with 8 bit address and 16 bit register width |
87 | */ | 87 | */ |
88 | int em28xx_detect_sensor(struct em28xx *dev) | 88 | static int em28xx_probe_sensor_micron(struct em28xx *dev) |
89 | { | 89 | { |
90 | int ret, i; | 90 | int ret, i; |
91 | char *name; | 91 | char *name; |
@@ -96,7 +96,6 @@ int em28xx_detect_sensor(struct em28xx *dev) | |||
96 | struct i2c_client client = dev->i2c_client[dev->def_i2c_bus]; | 96 | struct i2c_client client = dev->i2c_client[dev->def_i2c_bus]; |
97 | 97 | ||
98 | dev->em28xx_sensor = EM28XX_NOSENSOR; | 98 | dev->em28xx_sensor = EM28XX_NOSENSOR; |
99 | /* Probe Micron sensors with 8 bit address and 16 bit register width */ | ||
100 | for (i = 0; micron_sensor_addrs[i] != I2C_CLIENT_END; i++) { | 99 | for (i = 0; micron_sensor_addrs[i] != I2C_CLIENT_END; i++) { |
101 | client.addr = micron_sensor_addrs[i]; | 100 | client.addr = micron_sensor_addrs[i]; |
102 | /* NOTE: i2c_smbus_read_word_data() doesn't work with BE data */ | 101 | /* NOTE: i2c_smbus_read_word_data() doesn't work with BE data */ |
@@ -167,7 +166,7 @@ int em28xx_detect_sensor(struct em28xx *dev) | |||
167 | default: | 166 | default: |
168 | em28xx_info("unknown Micron sensor detected: 0x%04x\n", | 167 | em28xx_info("unknown Micron sensor detected: 0x%04x\n", |
169 | id); | 168 | id); |
170 | return -EINVAL; | 169 | return 0; |
171 | } | 170 | } |
172 | 171 | ||
173 | if (dev->em28xx_sensor == EM28XX_NOSENSOR) | 172 | if (dev->em28xx_sensor == EM28XX_NOSENSOR) |
@@ -182,6 +181,22 @@ int em28xx_detect_sensor(struct em28xx *dev) | |||
182 | return -ENODEV; | 181 | return -ENODEV; |
183 | } | 182 | } |
184 | 183 | ||
184 | /* | ||
185 | * This method works for webcams with Micron sensors | ||
186 | */ | ||
187 | int em28xx_detect_sensor(struct em28xx *dev) | ||
188 | { | ||
189 | int ret; | ||
190 | |||
191 | ret = em28xx_probe_sensor_micron(dev); | ||
192 | if (dev->em28xx_sensor == EM28XX_NOSENSOR && ret < 0) { | ||
193 | em28xx_info("No sensor detected\n"); | ||
194 | return -ENODEV; | ||
195 | } | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
185 | int em28xx_init_camera(struct em28xx *dev) | 200 | int em28xx_init_camera(struct em28xx *dev) |
186 | { | 201 | { |
187 | switch (dev->em28xx_sensor) { | 202 | switch (dev->em28xx_sensor) { |