diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-12-19 05:03:43 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:35 -0500 |
commit | de2d1549c2083e45ed84c779b64acf438ba5bf7f (patch) | |
tree | 3b936774dc85270ca6e87af939394cdadfaeee69 | |
parent | 310b26286e5a88387feba0412a75aa2a943ec844 (diff) |
V4L/DVB (13869): gspca - sn9c20x: Cleanup code.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/gspca/sn9c20x.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index e8dd2c36f0e6..4a1bc08f82b9 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -1506,36 +1506,36 @@ static int set_cmatrix(struct gspca_dev *gspca_dev) | |||
1506 | struct sd *sd = (struct sd *) gspca_dev; | 1506 | struct sd *sd = (struct sd *) gspca_dev; |
1507 | s32 hue_coord, hue_index = 180 + sd->hue; | 1507 | s32 hue_coord, hue_index = 180 + sd->hue; |
1508 | u8 cmatrix[21]; | 1508 | u8 cmatrix[21]; |
1509 | memset(cmatrix, 0, 21); | ||
1510 | 1509 | ||
1510 | memset(cmatrix, 0, sizeof cmatrix); | ||
1511 | cmatrix[2] = (sd->contrast * 0x25 / 0x100) + 0x26; | 1511 | cmatrix[2] = (sd->contrast * 0x25 / 0x100) + 0x26; |
1512 | cmatrix[0] = 0x13 + (cmatrix[2] - 0x26) * 0x13 / 0x25; | 1512 | cmatrix[0] = 0x13 + (cmatrix[2] - 0x26) * 0x13 / 0x25; |
1513 | cmatrix[4] = 0x07 + (cmatrix[2] - 0x26) * 0x07 / 0x25; | 1513 | cmatrix[4] = 0x07 + (cmatrix[2] - 0x26) * 0x07 / 0x25; |
1514 | cmatrix[18] = sd->brightness - 0x80; | 1514 | cmatrix[18] = sd->brightness - 0x80; |
1515 | 1515 | ||
1516 | hue_coord = (hsv_red_x[hue_index] * sd->saturation) >> 8; | 1516 | hue_coord = (hsv_red_x[hue_index] * sd->saturation) >> 8; |
1517 | cmatrix[6] = (unsigned char)(hue_coord & 0xff); | 1517 | cmatrix[6] = hue_coord; |
1518 | cmatrix[7] = (unsigned char)((hue_coord >> 8) & 0x0f); | 1518 | cmatrix[7] = (hue_coord >> 8) & 0x0f; |
1519 | 1519 | ||
1520 | hue_coord = (hsv_red_y[hue_index] * sd->saturation) >> 8; | 1520 | hue_coord = (hsv_red_y[hue_index] * sd->saturation) >> 8; |
1521 | cmatrix[8] = (unsigned char)(hue_coord & 0xff); | 1521 | cmatrix[8] = hue_coord; |
1522 | cmatrix[9] = (unsigned char)((hue_coord >> 8) & 0x0f); | 1522 | cmatrix[9] = (hue_coord >> 8) & 0x0f; |
1523 | 1523 | ||
1524 | hue_coord = (hsv_green_x[hue_index] * sd->saturation) >> 8; | 1524 | hue_coord = (hsv_green_x[hue_index] * sd->saturation) >> 8; |
1525 | cmatrix[10] = (unsigned char)(hue_coord & 0xff); | 1525 | cmatrix[10] = hue_coord; |
1526 | cmatrix[11] = (unsigned char)((hue_coord >> 8) & 0x0f); | 1526 | cmatrix[11] = (hue_coord >> 8) & 0x0f; |
1527 | 1527 | ||
1528 | hue_coord = (hsv_green_y[hue_index] * sd->saturation) >> 8; | 1528 | hue_coord = (hsv_green_y[hue_index] * sd->saturation) >> 8; |
1529 | cmatrix[12] = (unsigned char)(hue_coord & 0xff); | 1529 | cmatrix[12] = hue_coord; |
1530 | cmatrix[13] = (unsigned char)((hue_coord >> 8) & 0x0f); | 1530 | cmatrix[13] = (hue_coord >> 8) & 0x0f; |
1531 | 1531 | ||
1532 | hue_coord = (hsv_blue_x[hue_index] * sd->saturation) >> 8; | 1532 | hue_coord = (hsv_blue_x[hue_index] * sd->saturation) >> 8; |
1533 | cmatrix[14] = (unsigned char)(hue_coord & 0xff); | 1533 | cmatrix[14] = hue_coord; |
1534 | cmatrix[15] = (unsigned char)((hue_coord >> 8) & 0x0f); | 1534 | cmatrix[15] = (hue_coord >> 8) & 0x0f; |
1535 | 1535 | ||
1536 | hue_coord = (hsv_blue_y[hue_index] * sd->saturation) >> 8; | 1536 | hue_coord = (hsv_blue_y[hue_index] * sd->saturation) >> 8; |
1537 | cmatrix[16] = (unsigned char)(hue_coord & 0xff); | 1537 | cmatrix[16] = hue_coord; |
1538 | cmatrix[17] = (unsigned char)((hue_coord >> 8) & 0x0f); | 1538 | cmatrix[17] = (hue_coord >> 8) & 0x0f; |
1539 | 1539 | ||
1540 | return reg_w(gspca_dev, 0x10e1, cmatrix, 21); | 1540 | return reg_w(gspca_dev, 0x10e1, cmatrix, 21); |
1541 | } | 1541 | } |
@@ -2015,6 +2015,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
2015 | default: | 2015 | default: |
2016 | cam->cam_mode = vga_mode; | 2016 | cam->cam_mode = vga_mode; |
2017 | cam->nmodes = ARRAY_SIZE(vga_mode); | 2017 | cam->nmodes = ARRAY_SIZE(vga_mode); |
2018 | break; | ||
2018 | } | 2019 | } |
2019 | 2020 | ||
2020 | sd->old_step = 0; | 2021 | sd->old_step = 0; |
@@ -2319,7 +2320,7 @@ static void do_autogain(struct gspca_dev *gspca_dev, u16 avg_lum) | |||
2319 | } | 2320 | } |
2320 | } | 2321 | } |
2321 | if (avg_lum > MAX_AVG_LUM) { | 2322 | if (avg_lum > MAX_AVG_LUM) { |
2322 | if (sd->gain >= 1) { | 2323 | if (sd->gain > 0) { |
2323 | sd->gain--; | 2324 | sd->gain--; |
2324 | set_gain(gspca_dev); | 2325 | set_gain(gspca_dev); |
2325 | } | 2326 | } |
@@ -2347,7 +2348,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
2347 | { | 2348 | { |
2348 | struct sd *sd = (struct sd *) gspca_dev; | 2349 | struct sd *sd = (struct sd *) gspca_dev; |
2349 | int avg_lum; | 2350 | int avg_lum; |
2350 | static unsigned char frame_header[] = | 2351 | static u8 frame_header[] = |
2351 | {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96}; | 2352 | {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96}; |
2352 | if (len == 64 && memcmp(data, frame_header, 6) == 0) { | 2353 | if (len == 64 && memcmp(data, frame_header, 6) == 0) { |
2353 | avg_lum = ((data[35] >> 2) & 3) | | 2354 | avg_lum = ((data[35] >> 2) & 3) | |