Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* OmniVision* camera chip driver API |
| 2 | * |
| 3 | * Copyright (c) 1999-2004 Mark McClelland |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License as published by the |
| 7 | * Free Software Foundation; either version 2 of the License, or (at your |
| 8 | * option) any later version. NO WARRANTY OF ANY KIND is expressed or implied. |
| 9 | * |
| 10 | * * OmniVision is a trademark of OmniVision Technologies, Inc. This driver |
| 11 | * is not sponsored or developed by them. |
| 12 | */ |
| 13 | |
| 14 | #ifndef __LINUX_OVCAMCHIP_H |
| 15 | #define __LINUX_OVCAMCHIP_H |
| 16 | |
| 17 | #include <linux/videodev.h> |
| 18 | #include <linux/i2c.h> |
| 19 | |
| 20 | /* Remove these once they are officially defined */ |
| 21 | #ifndef I2C_DRIVERID_OVCAMCHIP |
| 22 | #define I2C_DRIVERID_OVCAMCHIP 0xf00f |
| 23 | #endif |
| 24 | #ifndef I2C_HW_SMBUS_OV511 |
| 25 | #define I2C_HW_SMBUS_OV511 0xfe |
| 26 | #endif |
| 27 | #ifndef I2C_HW_SMBUS_OV518 |
| 28 | #define I2C_HW_SMBUS_OV518 0xff |
| 29 | #endif |
| 30 | #ifndef I2C_HW_SMBUS_OVFX2 |
| 31 | #define I2C_HW_SMBUS_OVFX2 0xfd |
| 32 | #endif |
| 33 | |
| 34 | /* --------------------------------- */ |
| 35 | /* ENUMERATIONS */ |
| 36 | /* --------------------------------- */ |
| 37 | |
| 38 | /* Controls */ |
| 39 | enum { |
| 40 | OVCAMCHIP_CID_CONT, /* Contrast */ |
| 41 | OVCAMCHIP_CID_BRIGHT, /* Brightness */ |
| 42 | OVCAMCHIP_CID_SAT, /* Saturation */ |
| 43 | OVCAMCHIP_CID_HUE, /* Hue */ |
| 44 | OVCAMCHIP_CID_EXP, /* Exposure */ |
| 45 | OVCAMCHIP_CID_FREQ, /* Light frequency */ |
| 46 | OVCAMCHIP_CID_BANDFILT, /* Banding filter */ |
| 47 | OVCAMCHIP_CID_AUTOBRIGHT, /* Auto brightness */ |
| 48 | OVCAMCHIP_CID_AUTOEXP, /* Auto exposure */ |
| 49 | OVCAMCHIP_CID_BACKLIGHT, /* Back light compensation */ |
| 50 | OVCAMCHIP_CID_MIRROR, /* Mirror horizontally */ |
| 51 | }; |
| 52 | |
| 53 | /* Chip types */ |
| 54 | #define NUM_CC_TYPES 9 |
| 55 | enum { |
| 56 | CC_UNKNOWN, |
| 57 | CC_OV76BE, |
| 58 | CC_OV7610, |
| 59 | CC_OV7620, |
| 60 | CC_OV7620AE, |
| 61 | CC_OV6620, |
| 62 | CC_OV6630, |
| 63 | CC_OV6630AE, |
| 64 | CC_OV6630AF, |
| 65 | }; |
| 66 | |
| 67 | /* --------------------------------- */ |
| 68 | /* I2C ADDRESSES */ |
| 69 | /* --------------------------------- */ |
| 70 | |
| 71 | #define OV7xx0_SID (0x42 >> 1) |
| 72 | #define OV6xx0_SID (0xC0 >> 1) |
| 73 | |
| 74 | /* --------------------------------- */ |
| 75 | /* API */ |
| 76 | /* --------------------------------- */ |
| 77 | |
| 78 | struct ovcamchip_control { |
| 79 | __u32 id; |
| 80 | __s32 value; |
| 81 | }; |
| 82 | |
| 83 | struct ovcamchip_window { |
| 84 | int x; |
| 85 | int y; |
| 86 | int width; |
| 87 | int height; |
| 88 | int format; |
| 89 | int quarter; /* Scale width and height down 2x */ |
| 90 | |
| 91 | /* This stuff will be removed eventually */ |
| 92 | int clockdiv; /* Clock divisor setting */ |
| 93 | }; |
| 94 | |
| 95 | /* Commands */ |
| 96 | #define OVCAMCHIP_CMD_Q_SUBTYPE _IOR (0x88, 0x00, int) |
| 97 | #define OVCAMCHIP_CMD_INITIALIZE _IOW (0x88, 0x01, int) |
| 98 | /* You must call OVCAMCHIP_CMD_INITIALIZE before any of commands below! */ |
| 99 | #define OVCAMCHIP_CMD_S_CTRL _IOW (0x88, 0x02, struct ovcamchip_control) |
| 100 | #define OVCAMCHIP_CMD_G_CTRL _IOWR (0x88, 0x03, struct ovcamchip_control) |
| 101 | #define OVCAMCHIP_CMD_S_MODE _IOW (0x88, 0x04, struct ovcamchip_window) |
| 102 | #define OVCAMCHIP_MAX_CMD _IO (0x88, 0x3f) |
| 103 | |
| 104 | #endif |