Lines Matching refs:qcam
74 static inline void qcam_set_ack(struct qcam_device *qcam, unsigned int i) in qcam_set_ack() argument
78 parport_frob_control(qcam->pport, 8, i?8:0); in qcam_set_ack()
81 static inline unsigned int qcam_ready1(struct qcam_device *qcam) in qcam_ready1() argument
83 return (parport_read_status(qcam->pport) & 0x8)?1:0; in qcam_ready1()
86 static inline unsigned int qcam_ready2(struct qcam_device *qcam) in qcam_ready2() argument
88 return (parport_read_data(qcam->pport) & 0x1)?1:0; in qcam_ready2()
91 static unsigned int qcam_await_ready1(struct qcam_device *qcam, in qcam_await_ready1() argument
98 if (qcam_ready1(qcam) == value) in qcam_await_ready1()
105 if (qcam_ready1(qcam) == value) in qcam_await_ready1()
113 parport_read_status(qcam->pport), in qcam_await_ready1()
114 parport_read_control(qcam->pport)); in qcam_await_ready1()
118 static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) in qcam_await_ready2() argument
124 if (qcam_ready2(qcam) == value) in qcam_await_ready2()
131 if (qcam_ready2(qcam) == value) in qcam_await_ready2()
139 parport_read_status(qcam->pport), in qcam_await_ready2()
140 parport_read_control(qcam->pport), in qcam_await_ready2()
141 parport_read_data(qcam->pport)); in qcam_await_ready2()
145 static int qcam_read_data(struct qcam_device *qcam) in qcam_read_data() argument
148 qcam_set_ack(qcam, 0); in qcam_read_data()
149 if (qcam_await_ready1(qcam, 1)) return -1; in qcam_read_data()
150 idata = parport_read_status(qcam->pport) & 0xf0; in qcam_read_data()
151 qcam_set_ack(qcam, 1); in qcam_read_data()
152 if (qcam_await_ready1(qcam, 0)) return -1; in qcam_read_data()
153 idata |= (parport_read_status(qcam->pport) >> 4); in qcam_read_data()
157 static int qcam_write_data(struct qcam_device *qcam, unsigned int data) in qcam_write_data() argument
160 parport_write_data(qcam->pport, data); in qcam_write_data()
161 idata = qcam_read_data(qcam); in qcam_write_data()
171 static inline int qcam_set(struct qcam_device *qcam, unsigned int cmd, unsigned int data) in qcam_set() argument
173 if (qcam_write_data(qcam, cmd)) in qcam_set()
175 if (qcam_write_data(qcam, data)) in qcam_set()
180 static inline int qcam_get(struct qcam_device *qcam, unsigned int cmd) in qcam_get() argument
182 if (qcam_write_data(qcam, cmd)) in qcam_get()
184 return qcam_read_data(qcam); in qcam_get()
187 static int qc_detect(struct qcam_device *qcam) in qc_detect() argument
196 if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA in qc_detect()
197 && qcam->pport->probe_info[0].model in qc_detect()
198 && !strcmp(qcam->pdev->port->probe_info[0].model, in qc_detect()
207 parport_write_control(qcam->pport, 0xc); in qc_detect()
210 ostat = stat = parport_read_status(qcam->pport); in qc_detect()
214 stat = parport_read_status(qcam->pport); in qc_detect()
223 parport_write_control(qcam->pport, 0xc); in qc_detect()
224 parport_write_control(qcam->pport, 0x8); in qc_detect()
226 parport_write_control(qcam->pport, 0xc); in qc_detect()
230 ostat = stat = parport_read_status(qcam->pport); in qc_detect()
234 stat = parport_read_status(qcam->pport); in qc_detect()
246 static void qc_reset(struct qcam_device *qcam) in qc_reset() argument
248 parport_write_control(qcam->pport, 0xc); in qc_reset()
249 parport_write_control(qcam->pport, 0x8); in qc_reset()
251 parport_write_control(qcam->pport, 0xc); in qc_reset()
518 struct qcam_device *qcam=(struct qcam_device *)dev; in qcam_ioctl() local
594 p.brightness=qcam->brightness<<8; in qcam_ioctl()
595 p.contrast=qcam->contrast<<8; in qcam_ioctl()
596 p.whiteness=qcam->whitebal<<8; in qcam_ioctl()
618 qcam->brightness = p.brightness>>8; in qcam_ioctl()
619 qcam->contrast = p.contrast>>8; in qcam_ioctl()
620 qcam->whitebal = p.whiteness>>8; in qcam_ioctl()
622 down(&qcam->lock); in qcam_ioctl()
623 parport_claim_or_block(qcam->pdev); in qcam_ioctl()
624 qc_setup(qcam); in qcam_ioctl()
625 parport_release(qcam->pdev); in qcam_ioctl()
626 up(&qcam->lock); in qcam_ioctl()
644 qcam->width = 80; in qcam_ioctl()
645 qcam->height = 60; in qcam_ioctl()
646 qcam->mode = QC_DECIMATION_4; in qcam_ioctl()
650 qcam->width = 160; in qcam_ioctl()
651 qcam->height = 120; in qcam_ioctl()
652 qcam->mode = QC_DECIMATION_2; in qcam_ioctl()
656 qcam->width = 320; in qcam_ioctl()
657 qcam->height = 240; in qcam_ioctl()
658 qcam->mode = QC_DECIMATION_1; in qcam_ioctl()
660 qcam->mode |= QC_MILLIONS; in qcam_ioctl()
664 qcam->width = 640; in qcam_ioctl()
665 qcam->height = 480; in qcam_ioctl()
666 qcam->mode = QC_BILLIONS | QC_DECIMATION_1; in qcam_ioctl()
671 down(&qcam->lock); in qcam_ioctl()
672 parport_claim_or_block(qcam->pdev); in qcam_ioctl()
673 qc_setup(qcam); in qcam_ioctl()
674 parport_release(qcam->pdev); in qcam_ioctl()
675 up(&qcam->lock); in qcam_ioctl()
682 vw.width=qcam->width; in qcam_ioctl()
683 vw.height=qcam->height; in qcam_ioctl()
712 struct qcam_device *qcam=(struct qcam_device *)v; in qcam_read() local
715 down(&qcam->lock); in qcam_read()
716 parport_claim_or_block(qcam->pdev); in qcam_read()
718 len = qc_capture(qcam, buf,count); in qcam_read()
719 parport_release(qcam->pdev); in qcam_read()
720 up(&qcam->lock); in qcam_read()
781 struct qcam_device *qcam; in init_cqcam() local
799 qcam = qcam_init(port); in init_cqcam()
800 if (qcam==NULL) in init_cqcam()
803 parport_claim_or_block(qcam->pdev); in init_cqcam()
805 qc_reset(qcam); in init_cqcam()
807 if (probe && qc_detect(qcam)==0) in init_cqcam()
809 parport_release(qcam->pdev); in init_cqcam()
810 parport_unregister_device(qcam->pdev); in init_cqcam()
811 kfree(qcam); in init_cqcam()
815 qc_setup(qcam); in init_cqcam()
817 parport_release(qcam->pdev); in init_cqcam()
819 if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) in init_cqcam()
822 qcam->pport->name); in init_cqcam()
823 parport_unregister_device(qcam->pdev); in init_cqcam()
824 kfree(qcam); in init_cqcam()
829 qcam->vdev.minor, qcam->pport->name); in init_cqcam()
831 qcams[num_cams++] = qcam; in init_cqcam()
836 void close_cqcam(struct qcam_device *qcam) in close_cqcam() argument
838 video_unregister_device(&qcam->vdev); in close_cqcam()
839 parport_unregister_device(qcam->pdev); in close_cqcam()
840 kfree(qcam); in close_cqcam()