diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-02-01 12:20:07 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:37 -0400 |
commit | b083b92f9386d82e8ff3c1cfe04eefae488cbf1f (patch) | |
tree | 835bdeda2498491a932f1135dedfa21b5fc5e8d4 /drivers/media | |
parent | 5e31dc8dda6e52934acfa4706854cc2a22542949 (diff) |
V4L/DVB (10428): gspca - sonixj: Specific gamma tables per sensor.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index d9a7d1157f92..a5b58374333b 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -379,11 +379,21 @@ static const u8 *sn_tb[] = { | |||
379 | sn_sp80708 | 379 | sn_sp80708 |
380 | }; | 380 | }; |
381 | 381 | ||
382 | /* default gamma table */ | ||
382 | static const u8 gamma_def[17] = { | 383 | static const u8 gamma_def[17] = { |
383 | 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, | 384 | 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, |
384 | 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff | 385 | 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff |
385 | }; | 386 | }; |
386 | 387 | /* gamma for sensors HV7131R and MT9V111 */ | |
388 | static const u8 gamma_spec_1[17] = { | ||
389 | 0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d, | ||
390 | 0xa9, 0xb4, 0xbe, 0xc8, 0xd2, 0xdb, 0xe4, 0xed, 0xf5 | ||
391 | }; | ||
392 | /* gamma for sensor SP80708 */ | ||
393 | static const u8 gamma_spec_2[17] = { | ||
394 | 0x0a, 0x2d, 0x4e, 0x68, 0x7d, 0x8f, 0x9f, 0xab, | ||
395 | 0xb7, 0xc2, 0xcc, 0xd3, 0xd8, 0xde, 0xe2, 0xe5, 0xe6 | ||
396 | }; | ||
387 | 397 | ||
388 | /* color matrix and offsets */ | 398 | /* color matrix and offsets */ |
389 | static const u8 reg84[] = { | 399 | static const u8 reg84[] = { |
@@ -1514,14 +1524,27 @@ static void setgamma(struct gspca_dev *gspca_dev) | |||
1514 | struct sd *sd = (struct sd *) gspca_dev; | 1524 | struct sd *sd = (struct sd *) gspca_dev; |
1515 | int i; | 1525 | int i; |
1516 | u8 gamma[17]; | 1526 | u8 gamma[17]; |
1527 | const u8 *gamma_base; | ||
1517 | static const u8 delta[17] = { | 1528 | static const u8 delta[17] = { |
1518 | 0x00, 0x14, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1a, | 1529 | 0x00, 0x14, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1a, |
1519 | 0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00 | 1530 | 0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00 |
1520 | }; | 1531 | }; |
1521 | 1532 | ||
1533 | switch (sd->sensor) { | ||
1534 | case SENSOR_HV7131R: | ||
1535 | case SENSOR_MT9V111: | ||
1536 | gamma_base = gamma_spec_1; | ||
1537 | break; | ||
1538 | case SENSOR_SP80708: | ||
1539 | gamma_base = gamma_spec_2; | ||
1540 | break; | ||
1541 | default: | ||
1542 | gamma_base = gamma_def; | ||
1543 | break; | ||
1544 | } | ||
1522 | 1545 | ||
1523 | for (i = 0; i < sizeof gamma; i++) | 1546 | for (i = 0; i < sizeof gamma; i++) |
1524 | gamma[i] = gamma_def[i] | 1547 | gamma[i] = gamma_base[i] |
1525 | + delta[i] * (sd->gamma - GAMMA_DEF) / 32; | 1548 | + delta[i] * (sd->gamma - GAMMA_DEF) / 32; |
1526 | reg_w(gspca_dev, 0x20, gamma, sizeof gamma); | 1549 | reg_w(gspca_dev, 0x20, gamma, sizeof gamma); |
1527 | } | 1550 | } |
@@ -1608,6 +1631,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1608 | reg_w1(gspca_dev, 0x07, sn9c1xx[7]); /* green */ | 1631 | reg_w1(gspca_dev, 0x07, sn9c1xx[7]); /* green */ |
1609 | reg_w1(gspca_dev, 0x06, sn9c1xx[6]); /* blue */ | 1632 | reg_w1(gspca_dev, 0x06, sn9c1xx[6]); /* blue */ |
1610 | reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]); | 1633 | reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]); |
1634 | |||
1611 | setgamma(gspca_dev); | 1635 | setgamma(gspca_dev); |
1612 | 1636 | ||
1613 | for (i = 0; i < 8; i++) | 1637 | for (i = 0; i < 8; i++) |
@@ -1702,7 +1726,6 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1702 | sp80708_InitSensor(gspca_dev); | 1726 | sp80708_InitSensor(gspca_dev); |
1703 | if (mode) { | 1727 | if (mode) { |
1704 | /*?? reg1 = 0x04; * 320 clk 48Mhz */ | 1728 | /*?? reg1 = 0x04; * 320 clk 48Mhz */ |
1705 | ; | ||
1706 | } else { | 1729 | } else { |
1707 | reg1 = 0x46; /* 640 clk 48Mz */ | 1730 | reg1 = 0x46; /* 640 clk 48Mz */ |
1708 | reg17 = 0xa2; | 1731 | reg17 = 0xa2; |