diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-12-13 11:45:34 +0100 |
---|---|---|
committer | Jean-Francois Moine <moinejf@free.fr> | 2008-12-13 11:45:34 +0100 |
commit | 1433f6ed5f77ef1a1fedc0aa910800f4e6b60c12 (patch) | |
tree | 639ca9f308ac61c3e17acfe971e7c40df26cd8ed /linux | |
parent | 387f75a867f3844275f727de62d0dc8e7f25a64b (diff) | |
download | mediapointer-dvb-s2-1433f6ed5f77ef1a1fedc0aa910800f4e6b60c12.tar.gz mediapointer-dvb-s2-1433f6ed5f77ef1a1fedc0aa910800f4e6b60c12.tar.bz2 |
gspca - vc032x: Add V&H flips and sharpness controls for sensor po1200.
From: Jean-Francois Moine <moinejf@free.fr>
Priority: normal
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/video/gspca/vc032x.c | 83 |
1 files changed, 78 insertions, 5 deletions
diff --git a/linux/drivers/media/video/gspca/vc032x.c b/linux/drivers/media/video/gspca/vc032x.c index 5812af963..4cc1f69f1 100644 --- a/linux/drivers/media/video/gspca/vc032x.c +++ b/linux/drivers/media/video/gspca/vc032x.c @@ -35,6 +35,7 @@ struct sd { __u8 hflip; __u8 vflip; __u8 lightfreq; + __u8 sharpness; char bridge; #define BRIDGE_VC0321 0 @@ -57,6 +58,8 @@ static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { /* next 2 controls work with ov7660 and ov7670 only */ @@ -105,6 +108,22 @@ static struct ctrl sd_ctrls[] = { .set = sd_setfreq, .get = sd_getfreq, }, +/* po1200 only */ +#define SHARPNESS_IDX 3 + { + { + .id = V4L2_CID_SHARPNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Sharpness", + .minimum = 0, + .maximum = 2, + .step = 1, +#define SHARPNESS_DEF 1 + .default_value = SHARPNESS_DEF, + }, + .set = sd_setsharpness, + .get = sd_getsharpness, + }, }; static struct v4l2_pix_format vc0321_mode[] = { @@ -1531,7 +1550,7 @@ static const __u8 po1200_initVGA_data[][4] = { {0x00, 0x03, 0x00, 0xaa}, {0x00, 0x12, 0x05, 0xaa}, {0x00, 0x13, 0x02, 0xaa}, - {0x00, 0x1e, 0xc6, 0xaa}, + {0x00, 0x1e, 0xc6, 0xaa}, /* h/v flip */ {0x00, 0x21, 0x00, 0xaa}, {0x00, 0x25, 0x02, 0xaa}, {0x00, 0x3c, 0x4f, 0xaa}, @@ -1541,7 +1560,7 @@ static const __u8 po1200_initVGA_data[][4] = { {0x00, 0x55, 0xfe, 0xaa}, {0x00, 0x59, 0xd3, 0xaa}, {0x00, 0x5e, 0x04, 0xaa}, - {0x00, 0x61, 0xb8, 0xaa}, + {0x00, 0x61, 0xb8, 0xaa}, /* sharpness */ {0x00, 0x62, 0x02, 0xaa}, {0x00, 0xa7, 0x31, 0xaa}, {0x00, 0xa9, 0x66, 0xaa}, @@ -1637,7 +1656,7 @@ static const __u8 po1200_initVGA_data[][4] = { {0x00, 0x20, 0xc4, 0xaa}, {0x00, 0x13, 0x03, 0xaa}, {0x00, 0x3c, 0x50, 0xaa}, - {0x00, 0x61, 0x6a, 0xaa}, + {0x00, 0x61, 0x6a, 0xaa}, /* sharpness? */ {0x00, 0x51, 0x5b, 0xaa}, {0x00, 0x52, 0x91, 0xaa}, {0x00, 0x53, 0x4c, 0xaa}, @@ -1692,7 +1711,12 @@ static const __u8 po1200_initVGA_data[][4] = { {0x00, 0xe2, 0x01, 0xaa}, {0x00, 0xd6, 0x40, 0xaa}, {0x00, 0xe4, 0x40, 0xaa}, +#if 1 + {0x00, 0xa8, 0x8f, 0xaa}, +#else +/*modified later*/ {0x00, 0xa8, 0x9f, 0xaa}, +#endif {0x00, 0xb4, 0x16, 0xaa}, {0xb0, 0x02, 0x06, 0xcc}, {0xb0, 0x18, 0x06, 0xcc}, @@ -1729,8 +1753,10 @@ static const __u8 po1200_initVGA_data[][4] = { {0x00, 0x03, 0x00, 0xaa}, {0x00, 0x95, 0x85, 0xaa}, /*matrix*/ +#if 0 {0x00, 0x03, 0x00, 0xaa}, - {0x00, 0x61, 0xb8, 0xaa}, + {0x00, 0x61, 0xb8, 0xaa}, /* sharpness */ +#endif {0x00, 0x03, 0x00, 0xaa}, {0x00, 0x4d, 0x20, 0xaa}, {0xb8, 0x22, 0x40, 0xcc}, @@ -1750,9 +1776,11 @@ static const __u8 po1200_initVGA_data[][4] = { {0x00, 0x46, 0x3c, 0xaa}, {0x00, 0x00, 0x18, 0xdd}, /*read bfff*/ +#if 0 {0x00, 0x03, 0x00, 0xaa}, - {0x00, 0x1e, 0x46, 0xaa}, + {0x00, 0x1e, 0x46, 0xaa}, /* h/v flip */ {0x00, 0xa8, 0x8f, 0xaa}, +#endif {0x00, 0x03, 0x00, 0xaa}, {0x00, 0xb4, 0x1c, 0xaa}, {0x00, 0xb5, 0x92, 0xaa}, @@ -2039,6 +2067,7 @@ static int sd_config(struct gspca_dev *gspca_dev, switch (sd->sensor) { case SENSOR_OV7660: case SENSOR_OV7670: + case SENSOR_PO1200: break; default: gspca_dev->ctrl_dis = (1 << HFLIP_IDX) @@ -2046,6 +2075,8 @@ static int sd_config(struct gspca_dev *gspca_dev, break; } + sd->sharpness = SHARPNESS_DEF; + if (sd->bridge == BRIDGE_VC0321) { reg_r(gspca_dev, 0x8a, 0, 3); reg_w(dev, 0x87, 0x00, 0x0f0f); @@ -2075,6 +2106,14 @@ static void sethvflip(struct gspca_dev *gspca_dev) case SENSOR_OV7670: data = 7; break; + case SENSOR_PO1200: + data = 0; + i2c_write(gspca_dev, 0x03, &data, 1); + data = 0x80 * sd->hflip + | 0x40 * sd->vflip + | 0x06; + i2c_write(gspca_dev, 0x1e, &data, 1); + return; default: return; } @@ -2094,6 +2133,20 @@ static void setlightfreq(struct gspca_dev *gspca_dev) usb_exchange(gspca_dev, ov7660_freq_tb[sd->lightfreq]); } +/* po1200 only */ +static void setsharpness(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + __u8 data; + + if (sd->sensor != SENSOR_PO1200) + return; + data = 0; + i2c_write(gspca_dev, 0x03, &data, 1); + data = 0xb5 + sd->sharpness * 3; + i2c_write(gspca_dev, 0x61, &data, 1); +} + static int sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -2230,6 +2283,8 @@ static int sd_start(struct gspca_dev *gspca_dev) sethvflip(gspca_dev); setlightfreq(gspca_dev); } else { + setsharpness(gspca_dev); + sethvflip(gspca_dev); reg_w(gspca_dev->dev, 0x89, 0x0400, 0x1415); } } @@ -2340,6 +2395,24 @@ static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val) return 0; } +static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->sharpness = val; + if (gspca_dev->streaming) + setsharpness(gspca_dev); + return 0; +} + +static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->sharpness; + return 0; +} + static int sd_querymenu(struct gspca_dev *gspca_dev, struct v4l2_querymenu *menu) { |