Lines Matching +full:sd +full:- +full:lines
1 // SPDX-License-Identifier: GPL-2.0-or-later
9 * Strongly based on qc-usb-messenger, which is:
10 * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
11 * Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
20 /* Note we actually get 124 lines of data, of which we skip the 4st
32 /* Note we actually get 248 lines of data, of which we skip the 4st
34 first 240 of the 244 lines it actually gets, so that it ignores
49 static int setbrightness(struct sd *sd, s32 val);
50 static int setcontrast(struct sd *sd, s32 val);
51 static int setgain(struct sd *sd, u8 gain);
52 static int setexposure(struct sd *sd, s16 expo);
57 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in st6422_s_ctrl()
58 struct sd *sd = (struct sd *)gspca_dev; in st6422_s_ctrl() local
59 int err = -EINVAL; in st6422_s_ctrl()
61 switch (ctrl->id) { in st6422_s_ctrl()
63 err = setbrightness(sd, ctrl->val); in st6422_s_ctrl()
66 err = setcontrast(sd, ctrl->val); in st6422_s_ctrl()
69 err = setgain(sd, ctrl->val); in st6422_s_ctrl()
72 err = setexposure(sd, ctrl->val); in st6422_s_ctrl()
78 err = stv06xx_write_bridge(sd, 0x143f, 0x01); in st6422_s_ctrl()
79 sd->gspca_dev.usb_err = err; in st6422_s_ctrl()
87 static int st6422_init_controls(struct sd *sd) in st6422_init_controls() argument
89 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; in st6422_init_controls()
101 return hdl->error; in st6422_init_controls()
104 static int st6422_probe(struct sd *sd) in st6422_probe() argument
106 if (sd->bridge != BRIDGE_ST6422) in st6422_probe()
107 return -ENODEV; in st6422_probe()
111 sd->gspca_dev.cam.cam_mode = st6422_mode; in st6422_probe()
112 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(st6422_mode); in st6422_probe()
116 static int st6422_init(struct sd *sd) in st6422_init() argument
123 { 0x1432, 0x03 }, /* 0x00-0x1F brightness */ in st6422_init()
124 { 0x143a, 0xf9 }, /* 0x00-0x0F contrast */ in st6422_init()
132 { 0x1431, 0x00 }, /* 0x00-0x07 ??? */ in st6422_init()
133 { 0x1433, 0x34 }, /* 160x120, 0x00-0x01 night filter */ in st6422_init()
139 /* anti-noise? 0xa2 gives a perfect image */ in st6422_init()
142 { 0x143c, 0x00 }, /* 0x00-0x01 - ??? */ in st6422_init()
145 /* shutter time 0x0000-0x03FF */ in st6422_init()
162 /* if(urb->iso_frame_desc[i].status == 0x80) { */ in st6422_init()
163 /* if(urb->iso_frame_desc[i].status == 0x88) { */ in st6422_init()
167 { 0x1500, 0x50 }, /* 0x00 - 0xFF 0x80 == compr ? */ in st6422_init()
170 /* high val-> light area gets darker */ in st6422_init()
171 /* low val -> light area gets lighter */ in st6422_init()
173 /* high val-> light area gets darker */ in st6422_init()
174 /* low val -> light area gets lighter */ in st6422_init()
176 /* high val-> light area gets darker */ in st6422_init()
177 /* low val -> light area gets lighter */ in st6422_init()
194 err = stv06xx_write_bridge(sd, st6422_bridge_init[i][0], in st6422_init()
201 static int setbrightness(struct sd *sd, s32 val) in setbrightness() argument
203 /* val goes from 0 -> 31 */ in setbrightness()
204 return stv06xx_write_bridge(sd, 0x1432, val); in setbrightness()
207 static int setcontrast(struct sd *sd, s32 val) in setcontrast() argument
209 /* Val goes from 0 -> 15 */ in setcontrast()
210 return stv06xx_write_bridge(sd, 0x143a, val | 0xf0); in setcontrast()
213 static int setgain(struct sd *sd, u8 gain) in setgain() argument
218 err = stv06xx_write_bridge(sd, 0x0509, gain); in setgain()
222 err = stv06xx_write_bridge(sd, 0x050a, gain); in setgain()
226 err = stv06xx_write_bridge(sd, 0x050b, gain); in setgain()
231 err = stv06xx_write_bridge(sd, 0x050c, 0x2a); in setgain()
235 return stv06xx_write_bridge(sd, 0x050d, 0x01); in setgain()
238 static int setexposure(struct sd *sd, s16 expo) in setexposure() argument
242 err = stv06xx_write_bridge(sd, 0x143d, expo & 0xff); in setexposure()
246 return stv06xx_write_bridge(sd, 0x143e, expo >> 8); in setexposure()
249 static int st6422_start(struct sd *sd) in st6422_start() argument
252 struct cam *cam = &sd->gspca_dev.cam; in st6422_start()
254 if (cam->cam_mode[sd->gspca_dev.curr_mode].priv) in st6422_start()
255 err = stv06xx_write_bridge(sd, 0x1505, 0x0f); in st6422_start()
257 err = stv06xx_write_bridge(sd, 0x1505, 0x02); in st6422_start()
262 err = stv06xx_write_bridge(sd, 0x143f, 0x01); in st6422_start()
266 static int st6422_stop(struct sd *sd) in st6422_stop() argument
268 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; in st6422_stop()