indycam.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * indycam.h - Silicon Graphics IndyCam digital camera driver
  3. *
  4. * Copyright (C) 2003 Ladislav Michl <ladis@linux-mips.org>
  5. * Copyright (C) 2004,2005 Mikael Nousiainen <tmnousia@cc.hut.fi>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _INDYCAM_H_
  12. #define _INDYCAM_H_
  13. /* I2C address for the Guinness Camera */
  14. #define INDYCAM_ADDR 0x56
  15. /* Camera version */
  16. #define CAMERA_VERSION_INDY 0x10 /* v1.0 */
  17. #define CAMERA_VERSION_MOOSE 0x12 /* v1.2 */
  18. #define INDYCAM_VERSION_MAJOR(x) (((x) & 0xf0) >> 4)
  19. #define INDYCAM_VERSION_MINOR(x) ((x) & 0x0f)
  20. /* Register bus addresses */
  21. #define INDYCAM_CONTROL 0x00
  22. #define INDYCAM_SHUTTER 0x01
  23. #define INDYCAM_GAIN 0x02
  24. #define INDYCAM_BRIGHTNESS 0x03 /* read-only */
  25. #define INDYCAM_RED_BALANCE 0x04
  26. #define INDYCAM_BLUE_BALANCE 0x05
  27. #define INDYCAM_RED_SATURATION 0x06
  28. #define INDYCAM_BLUE_SATURATION 0x07
  29. #define INDYCAM_GAMMA 0x08
  30. #define INDYCAM_VERSION 0x0e /* read-only */
  31. #define INDYCAM_RESET 0x0f /* write-only */
  32. #define INDYCAM_LED 0x46
  33. #define INDYCAM_ORIENTATION 0x47
  34. #define INDYCAM_BUTTON 0x48
  35. /* Field definitions of registers */
  36. #define INDYCAM_CONTROL_AGCENA (1<<0) /* automatic gain control */
  37. #define INDYCAM_CONTROL_AWBCTL (1<<1) /* automatic white balance */
  38. /* 2-3 are reserved */
  39. #define INDYCAM_CONTROL_EVNFLD (1<<4) /* read-only */
  40. #define INDYCAM_SHUTTER_10000 0x02 /* 1/10000 second */
  41. #define INDYCAM_SHUTTER_4000 0x04 /* 1/4000 second */
  42. #define INDYCAM_SHUTTER_2000 0x08 /* 1/2000 second */
  43. #define INDYCAM_SHUTTER_1000 0x10 /* 1/1000 second */
  44. #define INDYCAM_SHUTTER_500 0x20 /* 1/500 second */
  45. #define INDYCAM_SHUTTER_250 0x3f /* 1/250 second */
  46. #define INDYCAM_SHUTTER_125 0x7e /* 1/125 second */
  47. #define INDYCAM_SHUTTER_100 0x9e /* 1/100 second */
  48. #define INDYCAM_SHUTTER_60 0x00 /* 1/60 second */
  49. #define INDYCAM_LED_ACTIVE 0x10
  50. #define INDYCAM_LED_INACTIVE 0x30
  51. #define INDYCAM_ORIENTATION_BOTTOM_TO_TOP 0x40
  52. #define INDYCAM_BUTTON_RELEASED 0x10
  53. #define INDYCAM_SHUTTER_MIN 0x00
  54. #define INDYCAM_SHUTTER_MAX 0xff
  55. #define INDYCAM_GAIN_MIN 0x00
  56. #define INDYCAM_GAIN_MAX 0xff
  57. #define INDYCAM_RED_BALANCE_MIN 0x00 /* the effect is the opposite? */
  58. #define INDYCAM_RED_BALANCE_MAX 0xff
  59. #define INDYCAM_BLUE_BALANCE_MIN 0x00 /* the effect is the opposite? */
  60. #define INDYCAM_BLUE_BALANCE_MAX 0xff
  61. #define INDYCAM_RED_SATURATION_MIN 0x00
  62. #define INDYCAM_RED_SATURATION_MAX 0xff
  63. #define INDYCAM_BLUE_SATURATION_MIN 0x00
  64. #define INDYCAM_BLUE_SATURATION_MAX 0xff
  65. #define INDYCAM_GAMMA_MIN 0x00
  66. #define INDYCAM_GAMMA_MAX 0xff
  67. /* Driver interface definitions */
  68. #define INDYCAM_VALUE_ENABLED 1
  69. #define INDYCAM_VALUE_DISABLED 0
  70. #define INDYCAM_VALUE_UNCHANGED -1
  71. /* When setting controls, a value of -1 leaves the control unchanged. */
  72. struct indycam_control {
  73. int agc; /* boolean */
  74. int awb; /* boolean */
  75. int shutter;
  76. int gain;
  77. int red_balance;
  78. int blue_balance;
  79. int red_saturation;
  80. int blue_saturation;
  81. int gamma;
  82. };
  83. #define DECODER_INDYCAM_GET_CONTROLS _IOR('d', 193, struct indycam_control)
  84. #define DECODER_INDYCAM_SET_CONTROLS _IOW('d', 194, struct indycam_control)
  85. /* Default values for controls */
  86. #define INDYCAM_AGC_DEFAULT INDYCAM_VALUE_ENABLED
  87. #define INDYCAM_AWB_DEFAULT INDYCAM_VALUE_ENABLED
  88. #define INDYCAM_SHUTTER_DEFAULT INDYCAM_SHUTTER_60
  89. #define INDYCAM_GAIN_DEFAULT 0x80
  90. #define INDYCAM_RED_BALANCE_DEFAULT 0x18
  91. #define INDYCAM_BLUE_BALANCE_DEFAULT 0xa4
  92. #define INDYCAM_RED_SATURATION_DEFAULT 0x80
  93. #define INDYCAM_BLUE_SATURATION_DEFAULT 0xc0
  94. #define INDYCAM_GAMMA_DEFAULT 0x80
  95. #endif