summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2009-02-01 18:20:07 +0100
committerJean-Francois Moine <moinejf@free.fr>2009-02-01 18:20:07 +0100
commit588027051d313c56ef5cea88111f5c16aed595b2 (patch)
treea4ec3f633839081d113936f553f9b68ac55d7274 /linux/drivers/media
parent29e4b3115eccc5374834648d7c8c19e67a4e1095 (diff)
downloadmediapointer-dvb-s2-588027051d313c56ef5cea88111f5c16aed595b2.tar.gz
mediapointer-dvb-s2-588027051d313c56ef5cea88111f5c16aed595b2.tar.bz2
gspca - sonixj: Specific gamma tables per sensor.
From: Jean-Francois Moine <moinejf@free.fr> Priority: normal Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/gspca/sonixj.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/linux/drivers/media/video/gspca/sonixj.c b/linux/drivers/media/video/gspca/sonixj.c
index eeedcbc72..0a96d6cdc 100644
--- a/linux/drivers/media/video/gspca/sonixj.c
+++ b/linux/drivers/media/video/gspca/sonixj.c
@@ -379,17 +379,21 @@ static const u8 *sn_tb[] = {
sn_sp80708
};
+/* default gamma table */
static const u8 gamma_def[17] = {
0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99,
0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff
};
-
-#if 0
-static const u8 gamma_hv7131r[17] = {
+/* gamma for sensors HV7131R and MT9V111 */
+static const u8 gamma_spec_1[17] = {
0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d,
0xa9, 0xb4, 0xbe, 0xc8, 0xd2, 0xdb, 0xe4, 0xed, 0xf5
};
-#endif
+/* gamma for sensor SP80708 */
+static const u8 gamma_spec_2[17] = {
+ 0x0a, 0x2d, 0x4e, 0x68, 0x7d, 0x8f, 0x9f, 0xab,
+ 0xb7, 0xc2, 0xcc, 0xd3, 0xd8, 0xde, 0xe2, 0xe5, 0xe6
+};
/* color matrix and offsets */
static const u8 reg84[] = {
@@ -1538,14 +1542,27 @@ static void setgamma(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
int i;
u8 gamma[17];
+ const u8 *gamma_base;
static const u8 delta[17] = {
0x00, 0x14, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1a,
0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00
};
+ switch (sd->sensor) {
+ case SENSOR_HV7131R:
+ case SENSOR_MT9V111:
+ gamma_base = gamma_spec_1;
+ break;
+ case SENSOR_SP80708:
+ gamma_base = gamma_spec_2;
+ break;
+ default:
+ gamma_base = gamma_def;
+ break;
+ }
for (i = 0; i < sizeof gamma; i++)
- gamma[i] = gamma_def[i]
+ gamma[i] = gamma_base[i]
+ delta[i] * (sd->gamma - GAMMA_DEF) / 32;
reg_w(gspca_dev, 0x20, gamma, sizeof gamma);
}
@@ -1640,11 +1657,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_w1(gspca_dev, 0x07, sn9c1xx[7]); /* green */
reg_w1(gspca_dev, 0x06, sn9c1xx[6]); /* blue */
reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]);
-#if 0
- if (sd->sensor == SENSOR_HV7131R || sd->sensor == SENSOR_MT9V111)
- reg_w(gspca_dev, 0x20, gamma_hv7131r, sizeof gamma_hv7131r);
- else
-#endif
+
setgamma(gspca_dev);
for (i = 0; i < 8; i++)
@@ -1739,7 +1752,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
sp80708_InitSensor(gspca_dev);
if (mode) {
/*?? reg1 = 0x04; * 320 clk 48Mhz */
- ;
} else {
reg1 = 0x46; /* 640 clk 48Mz */
reg17 = 0xa2;