Commit 35480b6b authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (9292): gspca: Call the control setting functions at init time in t613.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent cbc51c6d
......@@ -502,6 +502,46 @@ static int sd_config(struct gspca_dev *gspca_dev,
return 0;
}
static void setbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
unsigned int brightness;
__u8 set6[4] = { 0x8f, 0x24, 0xc3, 0x00 };
brightness = sd->brightness;
if (brightness < 7) {
set6[1] = 0x26;
set6[3] = 0x70 - brightness * 0x10;
} else {
set6[3] = 0x00 + ((brightness - 7) * 0x10);
}
reg_w_buf(gspca_dev, set6, sizeof set6);
}
static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
unsigned int contrast = sd->contrast;
__u16 reg_to_write;
if (contrast < 7)
reg_to_write = 0x8ea9 - contrast * 0x200;
else
reg_to_write = 0x00a9 + (contrast - 7) * 0x200;
reg_w(gspca_dev, reg_to_write);
}
static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u16 reg_to_write;
reg_to_write = 0x80bb + sd->colors * 0x100; /* was 0xc0 */
reg_w(gspca_dev, reg_to_write);
}
static void setgamma(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -510,6 +550,29 @@ static void setgamma(struct gspca_dev *gspca_dev)
reg_w_buf(gspca_dev, gamma_table[sd->gamma], sizeof gamma_table[0]);
}
static void setwhitebalance(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u8 white_balance[8] =
{0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38};
if (sd->whitebalance)
white_balance[7] = 0x3c;
reg_w_buf(gspca_dev, white_balance, sizeof white_balance);
}
static void setsharpness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u16 reg_to_write;
reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
reg_w(gspca_dev, reg_to_write);
}
/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{
......@@ -551,8 +614,6 @@ static int sd_init(struct gspca_dev *gspca_dev)
0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27,
0xd8, 0xc8, 0xd9, 0xfc
};
static const __u8 missing[] =
{ 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
static const __u8 nset3[] = {
0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8,
0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8,
......@@ -617,15 +678,15 @@ static int sd_init(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x3880);
reg_w(gspca_dev, 0x3880);
reg_w(gspca_dev, 0x338e);
reg_w_buf(gspca_dev, nset5, sizeof nset5);
reg_w(gspca_dev, 0x00a9);
nset5 - missing
setbrightness(gspca_dev);
setcontrast(gspca_dev);
setgamma(gspca_dev);
reg_w(gspca_dev, 0x86bb);
reg_w(gspca_dev, 0x4aa6);
reg_w_buf(gspca_dev, missing, sizeof missing);
setcolors(gspca_dev);
setsharpness(gspca_dev);
setwhitebalance(gspca_dev);
reg_w(gspca_dev, 0x2087);
reg_w(gspca_dev, 0x2087); /* tied to white balance? */
reg_w(gspca_dev, 0x2088);
reg_w(gspca_dev, 0x2089);
......@@ -642,23 +703,6 @@ static int sd_init(struct gspca_dev *gspca_dev)
return 0;
}
static void setbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
unsigned int brightness;
__u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x00 };
brightness = sd->brightness;
if (brightness < 7) {
set6[3] = 0x70 - brightness * 0x10;
} else {
set6[1] = 0x24;
set6[3] = 0x00 + ((brightness - 7) * 0x10);
}
reg_w_buf(gspca_dev, set6, sizeof set6);
}
static void setflip(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -689,19 +733,6 @@ static void seteffect(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0xfaa6);
}
static void setwhitebalance(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u8 white_balance[8] =
{ 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
if (sd->whitebalance == 1)
white_balance[7] = 0x3c;
reg_w_buf(gspca_dev, white_balance, sizeof white_balance);
}
static void setlightfreq(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -713,39 +744,6 @@ static void setlightfreq(struct gspca_dev *gspca_dev)
reg_w_buf(gspca_dev, freq, sizeof freq);
}
static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
unsigned int contrast = sd->contrast;
__u16 reg_to_write;
if (contrast < 7)
reg_to_write = 0x8ea9 - (0x200 * contrast);
else
reg_to_write = (0x00a9 + ((contrast - 7) * 0x200));
reg_w(gspca_dev, reg_to_write);
}
static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u16 reg_to_write;
reg_to_write = 0xc0bb + sd->colors * 0x100;
reg_w(gspca_dev, reg_to_write);
}
static void setsharpness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u16 reg_to_write;
reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
reg_w(gspca_dev, reg_to_write);
}
static int sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
......
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