|
@@ -28,6 +28,8 @@ static int s5k4aa_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
|
|
|
static int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val);
|
|
|
static int s5k4aa_get_noise(struct gspca_dev *gspca_dev, __s32 *val);
|
|
|
static int s5k4aa_set_noise(struct gspca_dev *gspca_dev, __s32 val);
|
|
|
+static int s5k4aa_get_brightness(struct gspca_dev *gspca_dev, __s32 *val);
|
|
|
+static int s5k4aa_set_brightness(struct gspca_dev *gspca_dev, __s32 val);
|
|
|
|
|
|
static
|
|
|
const
|
|
@@ -113,7 +115,7 @@ const static struct ctrl s5k4aa_ctrls[] = {
|
|
|
.minimum = 0,
|
|
|
.maximum = 127,
|
|
|
.step = 1,
|
|
|
- .default_value = DEFAULT_GAIN_2,
|
|
|
+ .default_value = S5K4AA_DEFAULT_GAIN,
|
|
|
.flags = V4L2_CTRL_FLAG_SLIDER
|
|
|
},
|
|
|
.set = s5k4aa_set_gain,
|
|
@@ -148,6 +150,21 @@ const static struct ctrl s5k4aa_ctrls[] = {
|
|
|
.set = s5k4aa_set_noise,
|
|
|
.get = s5k4aa_get_noise
|
|
|
},
|
|
|
+#define BRIGHTNESS_IDX 5
|
|
|
+ {
|
|
|
+ {
|
|
|
+ .id = V4L2_CID_BRIGHTNESS,
|
|
|
+ .type = V4L2_CTRL_TYPE_INTEGER,
|
|
|
+ .name = "Brightness",
|
|
|
+ .minimum = 0,
|
|
|
+ .maximum = 0x1f,
|
|
|
+ .step = 1,
|
|
|
+ .default_value = S5K4AA_DEFAULT_BRIGHTNESS,
|
|
|
+ },
|
|
|
+ .set = s5k4aa_set_brightness,
|
|
|
+ .get = s5k4aa_get_brightness
|
|
|
+ },
|
|
|
+
|
|
|
};
|
|
|
|
|
|
static void s5k4aa_dump_registers(struct sd *sd);
|
|
@@ -320,6 +337,11 @@ int s5k4aa_init(struct sd *sd)
|
|
|
if (err < 0)
|
|
|
return err;
|
|
|
|
|
|
+ err = s5k4aa_set_brightness(&sd->gspca_dev,
|
|
|
+ sensor_settings[BRIGHTNESS_IDX]);
|
|
|
+ if (err < 0)
|
|
|
+ return err;
|
|
|
+
|
|
|
err = s5k4aa_set_noise(&sd->gspca_dev, sensor_settings[NOISE_SUPP_IDX]);
|
|
|
if (err < 0)
|
|
|
return err;
|
|
@@ -508,11 +530,39 @@ static int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val)
|
|
|
return err;
|
|
|
|
|
|
data = val & 0xff;
|
|
|
- err = m5602_write_sensor(sd, S5K4AA_GAIN_2, &data, 1);
|
|
|
+ err = m5602_write_sensor(sd, S5K4AA_GAIN, &data, 1);
|
|
|
|
|
|
return err;
|
|
|
}
|
|
|
|
|
|
+static int s5k4aa_get_brightness(struct gspca_dev *gspca_dev, __s32 *val)
|
|
|
+{
|
|
|
+ struct sd *sd = (struct sd *) gspca_dev;
|
|
|
+ s32 *sensor_settings = sd->sensor_priv;
|
|
|
+
|
|
|
+ *val = sensor_settings[BRIGHTNESS_IDX];
|
|
|
+ PDEBUG(D_V4L2, "Read brightness %d", *val);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int s5k4aa_set_brightness(struct gspca_dev *gspca_dev, __s32 val)
|
|
|
+{
|
|
|
+ struct sd *sd = (struct sd *) gspca_dev;
|
|
|
+ s32 *sensor_settings = sd->sensor_priv;
|
|
|
+ u8 data = S5K4AA_PAGE_MAP_2;
|
|
|
+ int err;
|
|
|
+
|
|
|
+ sensor_settings[BRIGHTNESS_IDX] = val;
|
|
|
+
|
|
|
+ PDEBUG(D_V4L2, "Set brightness to %d", val);
|
|
|
+ err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
|
|
|
+ if (err < 0)
|
|
|
+ return err;
|
|
|
+
|
|
|
+ data = val & 0xff;
|
|
|
+ return m5602_write_sensor(sd, S5K4AA_BRIGHTNESS, &data, 1);
|
|
|
+}
|
|
|
+
|
|
|
static int s5k4aa_get_noise(struct gspca_dev *gspca_dev, __s32 *val)
|
|
|
{
|
|
|
struct sd *sd = (struct sd *) gspca_dev;
|