From 8201e5ad96a23f50d346e5b08a63351e380b85dc Mon Sep 17 00:00:00 2001 From: GWater Date: Tue, 28 Oct 2008 01:27:30 +0100 Subject: [PATCH] Restore flip detection for 6260 and 624f devices. Signed-off-by: GWater --- microdia-dev.c | 55 ------------------------------------------------------- omnivision.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ov7670.h | 1 + ov965x.h | 1 + 4 files changed, 58 insertions(+), 55 deletions(-) diff --git a/microdia-dev.c b/microdia-dev.c index cfd702b..6a100dd 100644 --- a/microdia-dev.c +++ b/microdia-dev.c @@ -296,58 +296,3 @@ int dev_microdia_enable_video(struct usb_microdia *dev, int enable) return ret; } - -/** - * @brief Detect whether the image for 624f has to be flipped - * - * @param dev Pointer to device structure - * - * @returns 0 or negative error code - * - */ -int microdia_624f_flip_detect(struct usb_microdia *dev) -{ - int ret = 0; - __u8 val; - - ret = usb_microdia_control_read(dev, 0x1009, &val, 1); - if (ret < 0) - return -EAGAIN; - if (val & 0x01) - dev->vsettings.vflip = 1; - else - dev->vsettings.vflip = 0; - return ret; -} - -/** - * @brief Detect whether the image for 6260 has to be flipped - * - * @param dev Pointer to device structure - * - * @returns 0 or negative error code - * - */ -/* -int microdia_6260_flip_detect(struct usb_microdia *dev) -{ - const __u8 flip_bit = 0x01; - int ret = 0; - __u8 val; - static __u8 flip_reg = flip_bit; - __u8 vflip; - - ret = usb_microdia_control_read(dev, 0x1009, &val, 1); - if (ret < 0) - return -EAGAIN; - if (flip_reg != (val & flip_bit)) { - if (val & flip_bit) - vflip = 0; - else - vflip = 1; - ret = ov7670_auto_flip(dev, vflip); - flip_reg = (val & flip_bit); - } - - return ret; -}*/ diff --git a/omnivision.c b/omnivision.c index 0457091..36938f7 100644 --- a/omnivision.c +++ b/omnivision.c @@ -542,6 +542,7 @@ int ov_probe(struct usb_microdia *dev) } if (buf[1] == 0x70) { ov_initialize(dev, ov7670_init, ARRAY_SIZE(ov7670_init)); + dev->camera.flip_detect = ov7670_flip_detect; dev->camera.modes = ov_resolutions; dev->camera.nmodes = ARRAY_SIZE(ov_resolutions); dev->camera.fmts = ov_fmts; @@ -553,6 +554,7 @@ int ov_probe(struct usb_microdia *dev) dev->camera.set_hvflip = ov965x_set_hvflip; dev->camera.set_exposure = ov965x_set_exposure; dev->camera.set_auto_exposure = ov965x_set_autoexposure; + dev->camera.flip_detect = ov965x_flip_detect; dev->camera.modes = ov_resolutions; dev->camera.nmodes = ARRAY_SIZE(ov_resolutions); dev->camera.fmts = ov_fmts; @@ -934,3 +936,57 @@ int soi968_set_exposure(struct usb_microdia *dev) return 0; } + +/** + * @brief Detect whether the image for 6260 has to be flipped + * + * @param dev Pointer to device structure + * + * @returns 0 or negative error code + * + */ +int ov7670_flip_detect(struct usb_microdia *dev) +{ + const __u8 flip_bit = 0x01; + int ret = 0; + __u8 val; + static __u8 flip_reg = flip_bit; + __u8 vflip; + + ret = usb_microdia_control_read(dev, 0x1009, &val, 1); + if (ret < 0) + return -EAGAIN; + if (flip_reg != (val & flip_bit)) { + if (val & flip_bit) + vflip = 0; + else + vflip = 1; + ret = ov7670_auto_flip(dev, vflip); + flip_reg = (val & flip_bit); + } + + return ret; +} + +/** + * @brief Detect whether the image for 624f has to be flipped + * + * @param dev Pointer to device structure + * + * @returns 0 or negative error code + * + */ +int ov965x_flip_detect(struct usb_microdia *dev) +{ + int ret = 0; + __u8 val; + + ret = usb_microdia_control_read(dev, 0x1009, &val, 1); + if (ret < 0) + return -EAGAIN; + if (val & 0x01) + dev->vsettings.vflip = 1; + else + dev->vsettings.vflip = 0; + return ret; +} diff --git a/ov7670.h b/ov7670.h index 5a36255..e61a748 100644 --- a/ov7670.h +++ b/ov7670.h @@ -181,4 +181,5 @@ #define OV7670_CTL_SATCTR 0xc9 int ov7670_auto_flip(struct usb_microdia *, __u8); +int ov7670_flip_detect(struct usb_microdia *dev); #endif diff --git a/ov965x.h b/ov965x.h index 7d2fe5e..dd9d24e 100644 --- a/ov965x.h +++ b/ov965x.h @@ -233,4 +233,5 @@ int soi968_set_exposure(struct usb_microdia *dev); int ov965x_set_hvflip(struct usb_microdia *); int ov965x_set_exposure(struct usb_microdia *); int ov965x_set_autoexposure(struct usb_microdia *dev); +int ov965x_flip_detect(struct usb_microdia *dev); #endif -- 2.11.4.GIT