diff options
Diffstat (limited to 'drivers/media/video/gspca/sn9c20x.c')
-rw-r--r-- | drivers/media/video/gspca/sn9c20x.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index ad098202d7f0..b9c6f17eabb2 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -1761,7 +1761,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
1761 | V4L2_CID_SATURATION, 0, 255, 1, 127); | 1761 | V4L2_CID_SATURATION, 0, 255, 1, 127); |
1762 | sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1762 | sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
1763 | V4L2_CID_HUE, -180, 180, 1, 0); | 1763 | V4L2_CID_HUE, -180, 180, 1, 0); |
1764 | v4l2_ctrl_cluster(4, &sd->brightness); | ||
1765 | 1764 | ||
1766 | sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1765 | sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
1767 | V4L2_CID_GAMMA, 0, 255, 1, 0x10); | 1766 | V4L2_CID_GAMMA, 0, 255, 1, 0x10); |
@@ -1770,7 +1769,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
1770 | V4L2_CID_BLUE_BALANCE, 0, 127, 1, 0x28); | 1769 | V4L2_CID_BLUE_BALANCE, 0, 127, 1, 0x28); |
1771 | sd->red = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1770 | sd->red = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
1772 | V4L2_CID_RED_BALANCE, 0, 127, 1, 0x28); | 1771 | V4L2_CID_RED_BALANCE, 0, 127, 1, 0x28); |
1773 | v4l2_ctrl_cluster(2, &sd->blue); | ||
1774 | 1772 | ||
1775 | if (sd->sensor != SENSOR_OV9655 && sd->sensor != SENSOR_SOI968 && | 1773 | if (sd->sensor != SENSOR_OV9655 && sd->sensor != SENSOR_SOI968 && |
1776 | sd->sensor != SENSOR_OV7670 && sd->sensor != SENSOR_MT9M001 && | 1774 | sd->sensor != SENSOR_OV7670 && sd->sensor != SENSOR_MT9M001 && |
@@ -1779,7 +1777,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
1779 | V4L2_CID_HFLIP, 0, 1, 1, 0); | 1777 | V4L2_CID_HFLIP, 0, 1, 1, 0); |
1780 | sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1778 | sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
1781 | V4L2_CID_VFLIP, 0, 1, 1, 0); | 1779 | V4L2_CID_VFLIP, 0, 1, 1, 0); |
1782 | v4l2_ctrl_cluster(2, &sd->hflip); | ||
1783 | } | 1780 | } |
1784 | 1781 | ||
1785 | if (sd->sensor != SENSOR_SOI968 && sd->sensor != SENSOR_MT9VPRB && | 1782 | if (sd->sensor != SENSOR_SOI968 && sd->sensor != SENSOR_MT9VPRB && |
@@ -1794,6 +1791,20 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
1794 | V4L2_CID_GAIN, 0, 28, 1, 0); | 1791 | V4L2_CID_GAIN, 0, 28, 1, 0); |
1795 | sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1792 | sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
1796 | V4L2_CID_AUTOGAIN, 0, 1, 1, 1); | 1793 | V4L2_CID_AUTOGAIN, 0, 1, 1, 1); |
1794 | } | ||
1795 | |||
1796 | sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | ||
1797 | V4L2_CID_JPEG_COMPRESSION_QUALITY, 50, 90, 1, 80); | ||
1798 | if (hdl->error) { | ||
1799 | pr_err("Could not initialize controls\n"); | ||
1800 | return hdl->error; | ||
1801 | } | ||
1802 | |||
1803 | v4l2_ctrl_cluster(4, &sd->brightness); | ||
1804 | v4l2_ctrl_cluster(2, &sd->blue); | ||
1805 | if (sd->hflip) | ||
1806 | v4l2_ctrl_cluster(2, &sd->hflip); | ||
1807 | if (sd->autogain) { | ||
1797 | if (sd->sensor == SENSOR_SOI968) | 1808 | if (sd->sensor == SENSOR_SOI968) |
1798 | /* this sensor doesn't have the exposure control and | 1809 | /* this sensor doesn't have the exposure control and |
1799 | autogain is clustered with gain instead. This works | 1810 | autogain is clustered with gain instead. This works |
@@ -1803,13 +1814,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
1803 | /* Otherwise autogain is clustered with exposure. */ | 1814 | /* Otherwise autogain is clustered with exposure. */ |
1804 | v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); | 1815 | v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); |
1805 | } | 1816 | } |
1806 | |||
1807 | sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | ||
1808 | V4L2_CID_JPEG_COMPRESSION_QUALITY, 50, 90, 1, 80); | ||
1809 | if (hdl->error) { | ||
1810 | pr_err("Could not initialize controls\n"); | ||
1811 | return hdl->error; | ||
1812 | } | ||
1813 | return 0; | 1817 | return 0; |
1814 | } | 1818 | } |
1815 | 1819 | ||
@@ -2066,10 +2070,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2066 | set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); | 2070 | set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); |
2067 | set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), | 2071 | set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), |
2068 | v4l2_ctrl_g_ctrl(sd->red)); | 2072 | v4l2_ctrl_g_ctrl(sd->red)); |
2069 | set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); | 2073 | if (sd->gain) |
2070 | set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); | 2074 | set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); |
2071 | set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), | 2075 | if (sd->exposure) |
2072 | v4l2_ctrl_g_ctrl(sd->vflip)); | 2076 | set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); |
2077 | if (sd->hflip) | ||
2078 | set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), | ||
2079 | v4l2_ctrl_g_ctrl(sd->vflip)); | ||
2073 | 2080 | ||
2074 | reg_w1(gspca_dev, 0x1007, 0x20); | 2081 | reg_w1(gspca_dev, 0x1007, 0x20); |
2075 | reg_w1(gspca_dev, 0x1061, 0x03); | 2082 | reg_w1(gspca_dev, 0x1061, 0x03); |
@@ -2172,7 +2179,7 @@ static void sd_dqcallback(struct gspca_dev *gspca_dev) | |||
2172 | struct sd *sd = (struct sd *) gspca_dev; | 2179 | struct sd *sd = (struct sd *) gspca_dev; |
2173 | int avg_lum; | 2180 | int avg_lum; |
2174 | 2181 | ||
2175 | if (!v4l2_ctrl_g_ctrl(sd->autogain)) | 2182 | if (sd->autogain == NULL || !v4l2_ctrl_g_ctrl(sd->autogain)) |
2176 | return; | 2183 | return; |
2177 | 2184 | ||
2178 | avg_lum = atomic_read(&sd->avg_lum); | 2185 | avg_lum = atomic_read(&sd->avg_lum); |