Commit b9df978f authored by Luca Risolia's avatar Luca Risolia Committed by Greg Kroah-Hartman

[PATCH] USB: SN9C10x driver updates

SN9C10x driver updates.

Changes: + new, - removed, * cleanup, @ bugfix

@ Remove bad get_ctrl()'s
* Documentation updates
+ Add 0x0c45/0x602d to the list of SN9C10x based devices
+ Add support for OV7630 image sensors
Signed-off-by: default avatarLuca Risolia <luca.risolia@studio.unibo.it>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8fd6db47
...@@ -297,6 +297,7 @@ Vendor ID Product ID ...@@ -297,6 +297,7 @@ Vendor ID Product ID
0x0c45 0x602a 0x0c45 0x602a
0x0c45 0x602b 0x0c45 0x602b
0x0c45 0x602c 0x0c45 0x602c
0x0c45 0x602d
0x0c45 0x6030 0x0c45 0x6030
0x0c45 0x6080 0x0c45 0x6080
0x0c45 0x6082 0x0c45 0x6082
...@@ -333,6 +334,7 @@ Model Manufacturer ...@@ -333,6 +334,7 @@ Model Manufacturer
----- ------------ ----- ------------
HV7131D Hynix Semiconductor, Inc. HV7131D Hynix Semiconductor, Inc.
MI-0343 Micron Technology, Inc. MI-0343 Micron Technology, Inc.
OV7630 OmniVision Technologies, Inc.
PAS106B PixArt Imaging, Inc. PAS106B PixArt Imaging, Inc.
PAS202BCB PixArt Imaging, Inc. PAS202BCB PixArt Imaging, Inc.
TAS5110C1B Taiwan Advanced Sensor Corporation TAS5110C1B Taiwan Advanced Sensor Corporation
...@@ -470,9 +472,11 @@ order): ...@@ -470,9 +472,11 @@ order):
- Luca Capello for the donation of a webcam; - Luca Capello for the donation of a webcam;
- Joao Rodrigo Fuzaro, Joao Limirio, Claudio Filho and Caio Begotti for the - Joao Rodrigo Fuzaro, Joao Limirio, Claudio Filho and Caio Begotti for the
donation of a webcam; donation of a webcam;
- Jon Hollstrom for the donation of a webcam;
- Carlos Eduardo Medaglia Dyonisio, who added the support for the PAS202BCB - Carlos Eduardo Medaglia Dyonisio, who added the support for the PAS202BCB
image sensor; image sensor;
- Stefano Mozzi, who donated 45 EU; - Stefano Mozzi, who donated 45 EU;
- Andrew Pearce for the donation of a webcam;
- Bertrik Sikken, who reverse-engineered and documented the Huffman compression - Bertrik Sikken, who reverse-engineered and documented the Huffman compression
algorithm used in the SN9C10x controllers and implemented the first decoder; algorithm used in the SN9C10x controllers and implemented the first decoder;
- Mizuno Takafumi for the donation of a webcam; - Mizuno Takafumi for the donation of a webcam;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for USB Media drivers # Makefile for USB Media drivers
# #
sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o
obj-$(CONFIG_USB_DABUSB) += dabusb.o obj-$(CONFIG_USB_DABUSB) += dabusb.o
obj-$(CONFIG_USB_DSBR) += dsbr100.o obj-$(CONFIG_USB_DSBR) += dsbr100.o
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#define SN9C102_MODULE_AUTHOR "(C) 2004-2005 Luca Risolia" #define SN9C102_MODULE_AUTHOR "(C) 2004-2005 Luca Risolia"
#define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
#define SN9C102_MODULE_LICENSE "GPL" #define SN9C102_MODULE_LICENSE "GPL"
#define SN9C102_MODULE_VERSION "1:1.24" #define SN9C102_MODULE_VERSION "1:1.24a"
#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 24) #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 24)
enum sn9c102_bridge { enum sn9c102_bridge {
......
...@@ -429,7 +429,7 @@ sn9c102_i2c_try_read(struct sn9c102_device* cam, ...@@ -429,7 +429,7 @@ sn9c102_i2c_try_read(struct sn9c102_device* cam,
} }
static int int
sn9c102_i2c_try_write(struct sn9c102_device* cam, sn9c102_i2c_try_write(struct sn9c102_device* cam,
struct sn9c102_sensor* sensor, u8 address, u8 value) struct sn9c102_sensor* sensor, u8 address, u8 value)
{ {
......
This diff is collapsed.
...@@ -64,6 +64,7 @@ struct sn9c102_sensor; ...@@ -64,6 +64,7 @@ struct sn9c102_sensor;
*/ */
extern int sn9c102_probe_hv7131d(struct sn9c102_device* cam); extern int sn9c102_probe_hv7131d(struct sn9c102_device* cam);
extern int sn9c102_probe_mi0343(struct sn9c102_device* cam); extern int sn9c102_probe_mi0343(struct sn9c102_device* cam);
extern int sn9c102_probe_ov7630(struct sn9c102_device* cam);
extern int sn9c102_probe_pas106b(struct sn9c102_device* cam); extern int sn9c102_probe_pas106b(struct sn9c102_device* cam);
extern int sn9c102_probe_pas202bcb(struct sn9c102_device* cam); extern int sn9c102_probe_pas202bcb(struct sn9c102_device* cam);
extern int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam); extern int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam);
...@@ -80,6 +81,7 @@ static int (*sn9c102_sensor_table[])(struct sn9c102_device*) = { \ ...@@ -80,6 +81,7 @@ static int (*sn9c102_sensor_table[])(struct sn9c102_device*) = { \
&sn9c102_probe_pas106b, /* strong detection based on SENSOR ids */ \ &sn9c102_probe_pas106b, /* strong detection based on SENSOR ids */ \
&sn9c102_probe_pas202bcb, /* strong detection based on SENSOR ids */ \ &sn9c102_probe_pas202bcb, /* strong detection based on SENSOR ids */ \
&sn9c102_probe_hv7131d, /* strong detection based on SENSOR ids */ \ &sn9c102_probe_hv7131d, /* strong detection based on SENSOR ids */ \
&sn9c102_probe_ov7630, /* detection mostly based on USB pid/vid */ \
&sn9c102_probe_tas5110c1b, /* detection based on USB pid/vid */ \ &sn9c102_probe_tas5110c1b, /* detection based on USB pid/vid */ \
&sn9c102_probe_tas5130d1b, /* detection based on USB pid/vid */ \ &sn9c102_probe_tas5130d1b, /* detection based on USB pid/vid */ \
NULL, \ NULL, \
...@@ -103,7 +105,8 @@ static const struct usb_device_id sn9c102_id_table[] = { \ ...@@ -103,7 +105,8 @@ static const struct usb_device_id sn9c102_id_table[] = { \
{ USB_DEVICE(0x0c45, 0x6029), }, /* PAS106B */ \ { USB_DEVICE(0x0c45, 0x6029), }, /* PAS106B */ \
{ USB_DEVICE(0x0c45, 0x602a), }, /* HV7131D */ \ { USB_DEVICE(0x0c45, 0x602a), }, /* HV7131D */ \
{ USB_DEVICE(0x0c45, 0x602b), }, /* MI-0343 */ \ { USB_DEVICE(0x0c45, 0x602b), }, /* MI-0343 */ \
{ USB_DEVICE(0x0c45, 0x602c), }, /* OV7620 */ \ { USB_DEVICE(0x0c45, 0x602c), }, /* OV7630 */ \
{ USB_DEVICE(0x0c45, 0x602d), }, \
{ USB_DEVICE(0x0c45, 0x6030), }, /* MI03x */ \ { USB_DEVICE(0x0c45, 0x6030), }, /* MI03x */ \
{ USB_DEVICE(0x0c45, 0x6080), }, \ { USB_DEVICE(0x0c45, 0x6080), }, \
{ USB_DEVICE(0x0c45, 0x6082), }, /* MI0343 and MI0360 */ \ { USB_DEVICE(0x0c45, 0x6082), }, /* MI0343 and MI0360 */ \
...@@ -145,6 +148,8 @@ static const struct usb_device_id sn9c102_id_table[] = { \ ...@@ -145,6 +148,8 @@ static const struct usb_device_id sn9c102_id_table[] = { \
*/ */
/* The "try" I2C I/O versions are used when probing the sensor */ /* The "try" I2C I/O versions are used when probing the sensor */
extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*,
u8 address, u8 value);
extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*,
u8 address); u8 address);
...@@ -201,6 +206,8 @@ enum sn9c102_i2c_interface { ...@@ -201,6 +206,8 @@ enum sn9c102_i2c_interface {
SN9C102_I2C_3WIRES, SN9C102_I2C_3WIRES,
}; };
#define SN9C102_MAX_CTRLS V4L2_CID_LASTP1-V4L2_CID_BASE+10
struct sn9c102_sensor { struct sn9c102_sensor {
char name[32], /* sensor name */ char name[32], /* sensor name */
maintainer[64]; /* name of the mantainer <email> */ maintainer[64]; /* name of the mantainer <email> */
...@@ -243,7 +250,7 @@ struct sn9c102_sensor { ...@@ -243,7 +250,7 @@ struct sn9c102_sensor {
sensor according to the default configuration structures below. sensor according to the default configuration structures below.
*/ */
struct v4l2_queryctrl qctrl[V4L2_CID_LASTP1-V4L2_CID_BASE]; struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS];
/* /*
Optional list of default controls, defined as indicated in the Optional list of default controls, defined as indicated in the
V4L2 API. Menu type controls are not handled by this interface. V4L2 API. Menu type controls are not handled by this interface.
...@@ -356,7 +363,7 @@ struct sn9c102_sensor { ...@@ -356,7 +363,7 @@ struct sn9c102_sensor {
core module to store successfully updated values of the above core module to store successfully updated values of the above
settings, for rollbacks..etc..in case of errors during atomic I/O settings, for rollbacks..etc..in case of errors during atomic I/O
*/ */
struct v4l2_queryctrl _qctrl[V4L2_CID_LASTP1-V4L2_CID_BASE]; struct v4l2_queryctrl _qctrl[SN9C102_MAX_CTRLS];
struct v4l2_rect _rect; struct v4l2_rect _rect;
}; };
...@@ -367,5 +374,8 @@ struct sn9c102_sensor { ...@@ -367,5 +374,8 @@ struct sn9c102_sensor {
#define SN9C102_V4L2_CID_GREEN_BALANCE V4L2_CID_PRIVATE_BASE + 1 #define SN9C102_V4L2_CID_GREEN_BALANCE V4L2_CID_PRIVATE_BASE + 1
#define SN9C102_V4L2_CID_RESET_LEVEL V4L2_CID_PRIVATE_BASE + 2 #define SN9C102_V4L2_CID_RESET_LEVEL V4L2_CID_PRIVATE_BASE + 2
#define SN9C102_V4L2_CID_PIXEL_BIAS_VOLTAGE V4L2_CID_PRIVATE_BASE + 3 #define SN9C102_V4L2_CID_PIXEL_BIAS_VOLTAGE V4L2_CID_PRIVATE_BASE + 3
#define SN9C102_V4L2_CID_GAMMA V4L2_CID_PRIVATE_BASE + 4
#define SN9C102_V4L2_CID_BAND_FILTER V4L2_CID_PRIVATE_BASE + 5
#define SN9C102_V4L2_CID_BRIGHT_LEVEL V4L2_CID_PRIVATE_BASE + 6
#endif /* _SN9C102_SENSOR_H_ */ #endif /* _SN9C102_SENSOR_H_ */
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
static struct sn9c102_sensor tas5110c1b; static struct sn9c102_sensor tas5110c1b;
static struct v4l2_control tas5110c1b_gain;
static int tas5110c1b_init(struct sn9c102_device* cam) static int tas5110c1b_init(struct sn9c102_device* cam)
{ {
...@@ -46,21 +44,6 @@ static int tas5110c1b_init(struct sn9c102_device* cam) ...@@ -46,21 +44,6 @@ static int tas5110c1b_init(struct sn9c102_device* cam)
} }
static int tas5110c1b_get_ctrl(struct sn9c102_device* cam,
struct v4l2_control* ctrl)
{
switch (ctrl->id) {
case V4L2_CID_GAIN:
ctrl->value = tas5110c1b_gain.value;
break;
default:
return -EINVAL;
}
return 0;
}
static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, static int tas5110c1b_set_ctrl(struct sn9c102_device* cam,
const struct v4l2_control* ctrl) const struct v4l2_control* ctrl)
{ {
...@@ -68,8 +51,7 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, ...@@ -68,8 +51,7 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam,
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_GAIN: case V4L2_CID_GAIN:
if (!(err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value))) err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value);
tas5110c1b_gain.value = ctrl->value;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -147,7 +129,6 @@ static struct sn9c102_sensor tas5110c1b = { ...@@ -147,7 +129,6 @@ static struct sn9c102_sensor tas5110c1b = {
.height = 288, .height = 288,
}, },
}, },
.get_ctrl = &tas5110c1b_get_ctrl,
.set_crop = &tas5110c1b_set_crop, .set_crop = &tas5110c1b_set_crop,
.pix_format = { .pix_format = {
.width = 352, .width = 352,
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
static struct sn9c102_sensor tas5130d1b; static struct sn9c102_sensor tas5130d1b;
static struct v4l2_control tas5130d1b_gain, tas5130d1b_exposure;
static int tas5130d1b_init(struct sn9c102_device* cam) static int tas5130d1b_init(struct sn9c102_device* cam)
{ {
...@@ -44,24 +42,6 @@ static int tas5130d1b_init(struct sn9c102_device* cam) ...@@ -44,24 +42,6 @@ static int tas5130d1b_init(struct sn9c102_device* cam)
} }
static int tas5130d1b_get_ctrl(struct sn9c102_device* cam,
struct v4l2_control* ctrl)
{
switch (ctrl->id) {
case V4L2_CID_GAIN:
ctrl->value = tas5130d1b_gain.value;
break;
case V4L2_CID_EXPOSURE:
ctrl->value = tas5130d1b_exposure.value;
break;
default:
return -EINVAL;
}
return 0;
}
static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, static int tas5130d1b_set_ctrl(struct sn9c102_device* cam,
const struct v4l2_control* ctrl) const struct v4l2_control* ctrl)
{ {
...@@ -69,12 +49,10 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, ...@@ -69,12 +49,10 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam,
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_GAIN: case V4L2_CID_GAIN:
if (!(err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value))) err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value);
tas5130d1b_gain.value = ctrl->value;
break; break;
case V4L2_CID_EXPOSURE: case V4L2_CID_EXPOSURE:
if (!(err += sn9c102_i2c_write(cam, 0x40, 0x47 - ctrl->value))) err += sn9c102_i2c_write(cam, 0x40, 0x47 - ctrl->value);
tas5130d1b_exposure.value = ctrl->value;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -147,7 +125,6 @@ static struct sn9c102_sensor tas5130d1b = { ...@@ -147,7 +125,6 @@ static struct sn9c102_sensor tas5130d1b = {
.flags = 0, .flags = 0,
}, },
}, },
.get_ctrl = &tas5130d1b_get_ctrl,
.set_ctrl = &tas5130d1b_set_ctrl, .set_ctrl = &tas5130d1b_set_ctrl,
.cropcap = { .cropcap = {
.bounds = { .bounds = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment