diff options
| author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2012-03-06 05:04:26 -0500 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-14 13:04:30 -0400 |
| commit | e40a05736d4503950ec303610a51f838bd59cdc1 (patch) | |
| tree | ffd2cfa05d4fdd0d031729bc7f2deffc6003ee86 | |
| parent | d58083c949b3d76aba225be9f303ab5dab585064 (diff) | |
[media] V4L: Add an extended camera white balance control
This patch adds V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE control which is
an extended version of the V4L2_CID_AUTO_WHITE_BALANCE control,
including white balance presets. The following presets are defined:
- V4L2_WHITE_BALANCE_INCANDESCENT,
- V4L2_WHITE_BALANCE_FLUORESCENT,
- V4L2_WHITE_BALANCE_FLUORESCENT_H,
- V4L2_WHITE_BALANCE_HORIZON,
- V4L2_WHITE_BALANCE_DAYLIGHT,
- V4L2_WHITE_BALANCE_FLASH,
- V4L2_WHITE_BALANCE_CLOUDY,
- V4L2_WHITE_BALANCE_SHADE.
Signed-off-by: HeungJun Kim <riverful.kim@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
| -rw-r--r-- | Documentation/DocBook/media/v4l/controls.xml | 70 | ||||
| -rw-r--r-- | drivers/media/video/v4l2-ctrls.c | 17 | ||||
| -rw-r--r-- | include/linux/videodev2.h | 14 |
3 files changed, 101 insertions, 0 deletions
diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 745b611c3593..56dfdf02c76b 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml | |||
| @@ -3022,6 +3022,76 @@ camera sensor on or off, or specify its strength. Such band-stop filters can | |||
| 3022 | be used, for example, to filter out the fluorescent light component.</entry> | 3022 | be used, for example, to filter out the fluorescent light component.</entry> |
| 3023 | </row> | 3023 | </row> |
| 3024 | <row><entry></entry></row> | 3024 | <row><entry></entry></row> |
| 3025 | |||
| 3026 | <row id="v4l2-auto-n-preset-white-balance"> | ||
| 3027 | <entry spanname="id"><constant>V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE</constant> </entry> | ||
| 3028 | <entry>enum v4l2_auto_n_preset_white_balance</entry> | ||
| 3029 | </row><row><entry spanname="descr">Sets white balance to automatic, | ||
| 3030 | manual or a preset. The presets determine color temperature of the light as | ||
| 3031 | a hint to the camera for white balance adjustments resulting in most accurate | ||
| 3032 | color representation. The following white balance presets are listed in order | ||
| 3033 | of increasing color temperature.</entry> | ||
| 3034 | </row> | ||
| 3035 | <row> | ||
| 3036 | <entrytbl spanname="descr" cols="2"> | ||
| 3037 | <tbody valign="top"> | ||
| 3038 | <row> | ||
| 3039 | <entry><constant>V4L2_WHITE_BALANCE_MANUAL</constant> </entry> | ||
| 3040 | <entry>Manual white balance.</entry> | ||
| 3041 | </row> | ||
| 3042 | <row> | ||
| 3043 | <entry><constant>V4L2_WHITE_BALANCE_AUTO</constant> </entry> | ||
| 3044 | <entry>Automatic white balance adjustments.</entry> | ||
| 3045 | </row> | ||
| 3046 | <row> | ||
| 3047 | <entry><constant>V4L2_WHITE_BALANCE_INCANDESCENT</constant> </entry> | ||
| 3048 | <entry>White balance setting for incandescent (tungsten) lighting. | ||
| 3049 | It generally cools down the colors and corresponds approximately to 2500...3500 K | ||
| 3050 | color temperature range.</entry> | ||
| 3051 | </row> | ||
| 3052 | <row> | ||
| 3053 | <entry><constant>V4L2_WHITE_BALANCE_FLUORESCENT</constant> </entry> | ||
| 3054 | <entry>White balance preset for fluorescent lighting. | ||
| 3055 | It corresponds approximately to 4000...5000 K color temperature.</entry> | ||
| 3056 | </row> | ||
| 3057 | <row> | ||
| 3058 | <entry><constant>V4L2_WHITE_BALANCE_FLUORESCENT_H</constant> </entry> | ||
| 3059 | <entry>With this setting the camera will compensate for | ||
| 3060 | fluorescent H lighting.</entry> | ||
| 3061 | </row> | ||
| 3062 | <row> | ||
| 3063 | <entry><constant>V4L2_WHITE_BALANCE_HORIZON</constant> </entry> | ||
| 3064 | <entry>White balance setting for horizon daylight. | ||
| 3065 | It corresponds approximately to 5000 K color temperature.</entry> | ||
| 3066 | </row> | ||
| 3067 | <row> | ||
| 3068 | <entry><constant>V4L2_WHITE_BALANCE_DAYLIGHT</constant> </entry> | ||
| 3069 | <entry>White balance preset for daylight (with clear sky). | ||
| 3070 | It corresponds approximately to 5000...6500 K color temperature.</entry> | ||
| 3071 | </row> | ||
| 3072 | <row> | ||
| 3073 | <entry><constant>V4L2_WHITE_BALANCE_FLASH</constant> </entry> | ||
| 3074 | <entry>With this setting the camera will compensate for the flash | ||
| 3075 | light. It slightly warms up the colors and corresponds roughly to 5000...5500 K | ||
| 3076 | color temperature.</entry> | ||
| 3077 | </row> | ||
| 3078 | <row> | ||
| 3079 | <entry><constant>V4L2_WHITE_BALANCE_CLOUDY</constant> </entry> | ||
| 3080 | <entry>White balance preset for moderately overcast sky. | ||
| 3081 | This option corresponds approximately to 6500...8000 K color temperature | ||
| 3082 | range.</entry> | ||
| 3083 | </row> | ||
| 3084 | <row> | ||
| 3085 | <entry><constant>V4L2_WHITE_BALANCE_SHADE</constant> </entry> | ||
| 3086 | <entry>White balance preset for shade or heavily overcast | ||
| 3087 | sky. It corresponds approximately to 9000...10000 K color temperature. | ||
| 3088 | </entry> | ||
| 3089 | </row> | ||
| 3090 | </tbody> | ||
| 3091 | </entrytbl> | ||
| 3092 | </row> | ||
| 3093 | <row><entry></entry></row> | ||
| 3094 | |||
| 3025 | </tbody> | 3095 | </tbody> |
| 3026 | </tgroup> | 3096 | </tgroup> |
| 3027 | </table> | 3097 | </table> |
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 5bfef90e88ee..56ac71c8ba37 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c | |||
| @@ -249,6 +249,19 @@ const char * const *v4l2_ctrl_get_menu(u32 id) | |||
| 249 | "Set Cb/Cr", | 249 | "Set Cb/Cr", |
| 250 | NULL | 250 | NULL |
| 251 | }; | 251 | }; |
| 252 | static const char * const auto_n_preset_white_balance[] = { | ||
| 253 | "Manual", | ||
| 254 | "Auto", | ||
| 255 | "Incandescent", | ||
| 256 | "Fluorescent", | ||
| 257 | "Fluorescent H", | ||
| 258 | "Horizon", | ||
| 259 | "Daylight", | ||
| 260 | "Flash", | ||
| 261 | "Cloudy", | ||
| 262 | "Shade", | ||
| 263 | NULL, | ||
| 264 | }; | ||
| 252 | static const char * const tune_preemphasis[] = { | 265 | static const char * const tune_preemphasis[] = { |
| 253 | "No Preemphasis", | 266 | "No Preemphasis", |
| 254 | "50 Microseconds", | 267 | "50 Microseconds", |
| @@ -418,6 +431,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) | |||
| 418 | return camera_exposure_auto; | 431 | return camera_exposure_auto; |
| 419 | case V4L2_CID_COLORFX: | 432 | case V4L2_CID_COLORFX: |
| 420 | return colorfx; | 433 | return colorfx; |
| 434 | case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: | ||
| 435 | return auto_n_preset_white_balance; | ||
| 421 | case V4L2_CID_TUNE_PREEMPHASIS: | 436 | case V4L2_CID_TUNE_PREEMPHASIS: |
| 422 | return tune_preemphasis; | 437 | return tune_preemphasis; |
| 423 | case V4L2_CID_FLASH_LED_MODE: | 438 | case V4L2_CID_FLASH_LED_MODE: |
| @@ -605,6 +620,7 @@ const char *v4l2_ctrl_get_name(u32 id) | |||
| 605 | case V4L2_CID_IRIS_ABSOLUTE: return "Iris, Absolute"; | 620 | case V4L2_CID_IRIS_ABSOLUTE: return "Iris, Absolute"; |
| 606 | case V4L2_CID_IRIS_RELATIVE: return "Iris, Relative"; | 621 | case V4L2_CID_IRIS_RELATIVE: return "Iris, Relative"; |
| 607 | case V4L2_CID_AUTO_EXPOSURE_BIAS: return "Auto Exposure, Bias"; | 622 | case V4L2_CID_AUTO_EXPOSURE_BIAS: return "Auto Exposure, Bias"; |
| 623 | case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: return "White Balance, Auto & Preset"; | ||
| 608 | 624 | ||
| 609 | /* FM Radio Modulator control */ | 625 | /* FM Radio Modulator control */ |
| 610 | /* Keep the order of the 'case's the same as in videodev2.h! */ | 626 | /* Keep the order of the 'case's the same as in videodev2.h! */ |
| @@ -739,6 +755,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, | |||
| 739 | case V4L2_CID_MPEG_STREAM_VBI_FMT: | 755 | case V4L2_CID_MPEG_STREAM_VBI_FMT: |
| 740 | case V4L2_CID_EXPOSURE_AUTO: | 756 | case V4L2_CID_EXPOSURE_AUTO: |
| 741 | case V4L2_CID_COLORFX: | 757 | case V4L2_CID_COLORFX: |
| 758 | case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: | ||
| 742 | case V4L2_CID_TUNE_PREEMPHASIS: | 759 | case V4L2_CID_TUNE_PREEMPHASIS: |
| 743 | case V4L2_CID_FLASH_LED_MODE: | 760 | case V4L2_CID_FLASH_LED_MODE: |
| 744 | case V4L2_CID_FLASH_STROBE_SOURCE: | 761 | case V4L2_CID_FLASH_STROBE_SOURCE: |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index dfd209816df6..85c4e8f1090f 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -1709,6 +1709,20 @@ enum v4l2_exposure_auto_type { | |||
| 1709 | 1709 | ||
| 1710 | #define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19) | 1710 | #define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19) |
| 1711 | 1711 | ||
| 1712 | #define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20) | ||
| 1713 | enum v4l2_auto_n_preset_white_balance { | ||
| 1714 | V4L2_WHITE_BALANCE_MANUAL = 0, | ||
| 1715 | V4L2_WHITE_BALANCE_AUTO = 1, | ||
| 1716 | V4L2_WHITE_BALANCE_INCANDESCENT = 2, | ||
| 1717 | V4L2_WHITE_BALANCE_FLUORESCENT = 3, | ||
| 1718 | V4L2_WHITE_BALANCE_FLUORESCENT_H = 4, | ||
| 1719 | V4L2_WHITE_BALANCE_HORIZON = 5, | ||
| 1720 | V4L2_WHITE_BALANCE_DAYLIGHT = 6, | ||
| 1721 | V4L2_WHITE_BALANCE_FLASH = 7, | ||
| 1722 | V4L2_WHITE_BALANCE_CLOUDY = 8, | ||
| 1723 | V4L2_WHITE_BALANCE_SHADE = 9, | ||
| 1724 | }; | ||
| 1725 | |||
| 1712 | /* FM Modulator class control IDs */ | 1726 | /* FM Modulator class control IDs */ |
| 1713 | #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) | 1727 | #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) |
| 1714 | #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) | 1728 | #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) |
