Skip to content

Commit

Permalink
[media] gscpa_m5602: Convert to the control framework
Browse files Browse the repository at this point in the history
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Mar 5, 2013
1 parent 676fdd8 commit c84e412
Show file tree
Hide file tree
Showing 15 changed files with 569 additions and 1,710 deletions.
27 changes: 22 additions & 5 deletions drivers/media/usb/gspca/m5602/m5602_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,33 @@ struct sd {
/* A pointer to the currently connected sensor */
const struct m5602_sensor *sensor;

struct sd_desc *desc;

/* Sensor private data */
void *sensor_priv;

/* The current frame's id, used to detect frame boundaries */
u8 frame_id;

/* The current frame count */
u32 frame_count;

/* Camera rotation polling thread for "flipable" cams */
struct task_struct *rotation_thread;

struct { /* auto-white-bal + green/red/blue balance control cluster */
struct v4l2_ctrl *auto_white_bal;
struct v4l2_ctrl *red_bal;
struct v4l2_ctrl *blue_bal;
struct v4l2_ctrl *green_bal;
};
struct { /* autoexpo / expo cluster */
struct v4l2_ctrl *autoexpo;
struct v4l2_ctrl *expo;
};
struct { /* autogain / gain cluster */
struct v4l2_ctrl *autogain;
struct v4l2_ctrl *gain;
};
struct { /* hflip/vflip cluster */
struct v4l2_ctrl *hflip;
struct v4l2_ctrl *vflip;
};
};

int m5602_read_bridge(
Expand Down
16 changes: 13 additions & 3 deletions drivers/media/usb/gspca/m5602/m5602_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ static int m5602_init(struct gspca_dev *gspca_dev)
return err;
}

static int m5602_init_controls(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;

if (!sd->sensor->init_controls)
return 0;

return sd->sensor->init_controls(sd);
}

static int m5602_start_transfer(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
Expand Down Expand Up @@ -336,11 +346,12 @@ static void m5602_stop_transfer(struct gspca_dev *gspca_dev)
sd->sensor->stop(sd);
}

/* sub-driver description, the ctrl and nctrl is filled at probe time */
static struct sd_desc sd_desc = {
/* sub-driver description */
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.config = m5602_configure,
.init = m5602_init,
.init_controls = m5602_init_controls,
.start = m5602_start_transfer,
.stopN = m5602_stop_transfer,
.pkt_scan = m5602_urb_complete
Expand All @@ -355,7 +366,6 @@ static int m5602_configure(struct gspca_dev *gspca_dev,
int err;

cam = &gspca_dev->cam;
sd->desc = &sd_desc;

if (dump_bridge)
m5602_dump_bridge(sd);
Expand Down
Loading

0 comments on commit c84e412

Please sign in to comment.