2 * @file sn9c20x-sysfs.c
3 * @author Nicolas VIVIEN
6 * @brief Sysfs interface for image settings
8 * @note Copyright (C) Nicolas VIVIEN
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <linux/module.h>
28 #include <linux/init.h>
29 #include <linux/kernel.h>
30 #include <linux/version.h>
31 #include <linux/errno.h>
32 #include <linux/slab.h>
33 #include <linux/kref.h>
34 #include <linux/device.h>
36 #include <linux/usb.h>
37 #include <media/v4l2-common.h>
40 #include "sn9c20x-bridge.h"
46 * @param class Class device
48 * @retval buf Adress of buffer with the 'release' value
50 * @returns Size of buffer
52 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
53 static ssize_t
show_release(struct class_device
*class, char *buf
)
55 static ssize_t
show_release(struct device
*class, struct device_attribute
*attr
, char *buf
)
58 struct video_device
*vdev
= to_video_device(class);
59 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
61 return sprintf(buf
, "%d\n", dev
->release
);
66 * @brief show_videostatus
68 * @param class Class device
70 * @retval buf Adress of buffer with the 'videostatus' value
72 * @returns Size of buffer
74 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
75 static ssize_t
show_videostatus(struct class_device
*class, char *buf
)
77 static ssize_t
show_videostatus(struct device
*class, struct device_attribute
*attr
, char *buf
)
80 struct video_device
*vdev
= to_video_device(class);
81 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
84 "Overflow frames : %d\n"
85 "Incomplete frames : %d\n"
86 "Dropped frames : %d\n",
87 dev
->vframes_overflow
,
88 dev
->vframes_incomplete
,
89 dev
->vframes_dropped
);
94 * @brief show_informations
96 * @param class Class device
98 * @retval buf Adress of buffer with the 'informations' value
100 * @returns Size of buffer
102 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
103 static ssize_t
show_informations(struct class_device
*class, char *buf
)
105 static ssize_t
show_informations(struct device
*class, struct device_attribute
*attr
, char *buf
)
108 char *pixelfmt
= NULL
;
110 struct video_device
*vdev
= to_video_device(class);
111 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
113 char *palette_bgr24
= "BGR24 - BGR-8-8-8 - 24 bits";
114 char *palette_rgb24
= "RGB24 - RGB-8-8-8 - 24 bits";
115 char *palette_yuyv
= "YUYV - YUV 4:2:2 - 16 bits";
116 char *palette_i420
= "I420 - YUV 4:2:0 - 12 bits";
119 switch (dev
->vsettings
.format
.pixelformat
) {
120 case V4L2_PIX_FMT_BGR24
:
121 pixelfmt
= palette_bgr24
;
124 case V4L2_PIX_FMT_RGB24
:
125 pixelfmt
= palette_rgb24
;
128 case V4L2_PIX_FMT_YUYV
:
129 pixelfmt
= palette_yuyv
;
132 case V4L2_PIX_FMT_YUV420
:
133 pixelfmt
= palette_i420
;
138 "Driver Resolution : %dx%d\n"
142 "Brightness : 0x%X\n"
147 "Horizontal flip : %d\n"
148 "Vertical flip : %d\n"
149 "Auto-exposure : %d\n"
150 "Auto-whitebalance : %d\n",
151 dev
->vsettings
.format
.width
,
152 dev
->vsettings
.format
.height
,
154 0xFFFF & dev
->vsettings
.brightness
,
155 0xFFFF & dev
->vsettings
.contrast
,
156 0xFFFF & dev
->vsettings
.gamma
,
157 0xFFFF & dev
->vsettings
.exposure
,
158 0x3F & dev
->vsettings
.sharpness
,
159 dev
->vsettings
.hflip
,
160 dev
->vsettings
.vflip
,
161 dev
->vsettings
.auto_exposure
,
162 dev
->vsettings
.auto_whitebalance
);
169 * @param class Class device
171 * @retval buf Adress of buffer with the 'fps' value
173 * @returns Size of buffer
175 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
176 static ssize_t
show_fps(struct class_device
*class, char *buf
)
178 static ssize_t
show_fps(struct device
*class, struct device_attribute
*attr
, char *buf
)
181 struct video_device
*vdev
= to_video_device(class);
182 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
184 return sprintf(buf
, "%d\n", dev
->vsettings
.fps
);
188 * @brief show_exposure
190 * @param class Class device
192 * @retval buf Adress of buffer with the 'exposure' value
194 * @returns Size of buffer
196 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
197 static ssize_t
show_exposure(struct class_device
*class, char *buf
)
199 static ssize_t
show_exposure(struct device
*class, struct device_attribute
*attr
, char *buf
)
202 struct video_device
*vdev
= to_video_device(class);
203 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
205 return sprintf(buf
, "%X\n", dev
->vsettings
.exposure
);
209 * @brief store_exposure
211 * @param class Class device
213 * @param count Counter
216 * @returns Size of buffer
218 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
219 static ssize_t
store_exposure(struct class_device
*class, const char *buf
, size_t count
)
221 static ssize_t
store_exposure(struct device
*class, struct device_attribute
*attr
,
222 const char *buf
, size_t count
)
228 struct video_device
*vdev
= to_video_device(class);
229 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
231 value
= simple_strtoul(buf
, &endp
, 16);
233 sn9c20x_set_camera_control(dev
,
241 * @brief show_brightness
243 * @param class Class device
245 * @retval buf Adress of buffer with the 'brightness' value
247 * @returns Size of buffer
249 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
250 static ssize_t
show_brightness(struct class_device
*class, char *buf
)
252 static ssize_t
show_brightness(struct device
*class, struct device_attribute
*attr
, char *buf
)
255 struct video_device
*vdev
= to_video_device(class);
256 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
258 return sprintf(buf
, "%X\n", dev
->vsettings
.brightness
);
262 * @brief store_brightness
264 * @param class Class device
266 * @param count Counter
269 * @returns Size of buffer
271 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
272 static ssize_t
store_brightness(struct class_device
*class, const char *buf
, size_t count
)
274 static ssize_t
store_brightness(struct device
*class, struct device_attribute
*attr
,
275 const char *buf
, size_t count
)
281 struct video_device
*vdev
= to_video_device(class);
282 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
284 value
= simple_strtoul(buf
, &endp
, 16);
286 sn9c20x_set_camera_control(dev
,
294 * @brief show_contrast
296 * @param class Class device
298 * @retval buf Adress of buffer with the 'contrast' value
300 * @returns Size of buffer
302 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
303 static ssize_t
show_contrast(struct class_device
*class, char *buf
)
305 static ssize_t
show_contrast(struct device
*class, struct device_attribute
*attr
, char *buf
)
308 struct video_device
*vdev
= to_video_device(class);
309 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
311 return sprintf(buf
, "%X\n", dev
->vsettings
.contrast
);
316 * @brief store_contrast
318 * @param class Class device
320 * @param count Counter
323 * @returns Size of buffer
325 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
326 static ssize_t
store_contrast(struct class_device
*class, const char *buf
, size_t count
)
328 static ssize_t
store_contrast(struct device
*class, struct device_attribute
*attr
,
329 const char *buf
, size_t count
)
335 struct video_device
*vdev
= to_video_device(class);
336 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
338 value
= simple_strtoul(buf
, &endp
, 16);
340 sn9c20x_set_camera_control(dev
,
349 * @brief show_whitebalance
351 * @param class Class device
353 * @retval buf Adress of buffer with the 'whitebalance' value
355 * @returns Size of buffer
357 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
358 static ssize_t
show_gamma(struct class_device
*class, char *buf
)
360 static ssize_t
show_gamma(struct device
*class, struct device_attribute
*attr
, char *buf
)
363 struct video_device
*vdev
= to_video_device(class);
364 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
366 return sprintf(buf
, "%X\n", dev
->vsettings
.gamma
);
373 * @param class Class device
375 * @param count Counter
378 * @returns Size of buffer
380 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
381 static ssize_t
store_gamma(struct class_device
*class, const char *buf
, size_t count
)
383 static ssize_t
store_gamma(struct device
*class, struct device_attribute
*attr
,
384 const char *buf
, size_t count
)
390 struct video_device
*vdev
= to_video_device(class);
391 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
393 value
= simple_strtoul(buf
, &endp
, 16);
395 sn9c20x_set_camera_control(dev
,
406 * @param class Class device
408 * @retval buf Adress of buffer with the 'colour' value
410 * @returns Size of buffer
412 /*#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
413 static ssize_t show_colour(struct class_device *class, char *buf)
415 static ssize_t show_colour(struct device *class, struct device_attribute *attr, char *buf)
418 struct video_device *vdev = to_video_device(class);
419 struct usb_sn9c20x *dev = video_get_drvdata(vdev);
421 return sprintf(buf, "%X\n", dev->vsettings.colour);
426 * @brief store_colour
428 * @param class Class device
430 * @param count Counter
433 * @returns Size of buffer
435 /*#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
436 static ssize_t store_colour(struct class_device *class, const char *buf, size_t count)
438 static ssize_t store_colour(struct device *class, struct device_attribute *attr,
439 const char *buf, size_t count)
445 struct video_device *vdev = to_video_device(class);
446 struct usb_sn9c20x *dev = video_get_drvdata(vdev);
448 value = simple_strtoul(buf, &endp, 16);
450 dev->vsettings.colour = (int) value;
452 / dev_sn9c20x_set_camera_quality(dev); /
460 * @brief show_sharpness
462 * @param class Class device
464 * @retval buf Adress of buffer with the 'sharpness' value
466 * @returns Size of buffer
468 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
469 static ssize_t
show_sharpness(struct class_device
*class, char *buf
)
471 static ssize_t
show_sharpness(struct device
*class, struct device_attribute
*attr
, char *buf
)
474 struct video_device
*vdev
= to_video_device(class);
475 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
477 return sprintf(buf
, "%X\n", dev
->vsettings
.sharpness
);
481 * @brief store_sharpness
483 * @param class Class device
485 * @param count Counter
488 * @returns Size of buffer
490 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
491 static ssize_t
store_sharpness(struct class_device
*class, const char *buf
, size_t count
)
493 static ssize_t
store_sharpness(struct device
*class, struct device_attribute
*attr
,
494 const char *buf
, size_t count
)
500 struct video_device
*vdev
= to_video_device(class);
501 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
503 value
= simple_strtoul(buf
, &endp
, 16);
505 if (value
< 0 || value
> 0x3f)
508 sn9c20x_set_camera_control(dev
,
519 * @param class Class device
521 * @retval buf Adress of buffer with the 'hflip' value
523 * @returns Size of buffer
525 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
526 static ssize_t
show_hflip(struct class_device
*class, char *buf
)
528 static ssize_t
show_hflip(struct device
*class, struct device_attribute
*attr
, char *buf
)
531 struct video_device
*vdev
= to_video_device(class);
532 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
534 return sprintf(buf
, "%d\n", dev
->vsettings
.hflip
);
541 * @param class Class device
543 * @param count Counter
546 * @returns Size of buffer
548 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
549 static ssize_t
store_hflip(struct class_device
*class, const char *buf
, size_t count
)
551 static ssize_t
store_hflip(struct device
*class, struct device_attribute
*attr
,
552 const char *buf
, size_t count
)
557 struct video_device
*vdev
= to_video_device(class);
558 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
560 value
= simple_strtoul(buf
, &endp
, 10);
562 if (value
!= 0 && value
!= 1)
565 sn9c20x_set_camera_control(dev
,
576 * @param class Class device
578 * @retval buf Adress of buffer with the 'vflip' value
580 * @returns Size of buffer
582 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
583 static ssize_t
show_vflip(struct class_device
*class, char *buf
)
585 static ssize_t
show_vflip(struct device
*class, struct device_attribute
*attr
, char *buf
)
588 struct video_device
*vdev
= to_video_device(class);
589 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
591 return sprintf(buf
, "%d\n", dev
->vsettings
.vflip
);
598 * @param class Class device
600 * @param count Counter
603 * @returns Size of buffer
605 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
606 static ssize_t
store_vflip(struct class_device
*class, const char *buf
, size_t count
)
608 static ssize_t
store_vflip(struct device
*class, struct device_attribute
*attr
, const char *buf
, size_t count
)
613 struct video_device
*vdev
= to_video_device(class);
614 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
616 value
= simple_strtoul(buf
, &endp
, 10);
618 if (value
!= 0 && value
!= 1)
621 sn9c20x_set_camera_control(dev
,
630 * @brief show_autoexposure
632 * @param class Class device
634 * @retval buf Adress of buffer with the 'hflip' value
636 * @returns Size of buffer
638 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
639 static ssize_t
show_autoexposure(struct class_device
*class, char *buf
)
641 static ssize_t
show_autoexposure(struct device
*class, struct device_attribute
*attr
, char *buf
)
644 struct video_device
*vdev
= to_video_device(class);
645 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
647 return sprintf(buf
, "%d\n", dev
->vsettings
.auto_exposure
);
652 * @brief store_autoexposure
654 * @param class Class device
656 * @param count Counter
659 * @returns Size of buffer
661 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
662 static ssize_t
store_autoexposure(struct class_device
*class, const char *buf
, size_t count
)
664 static ssize_t
store_autoexposure(struct device
*class, struct device_attribute
*attr
,
665 const char *buf
, size_t count
)
669 struct video_device
*vdev
= to_video_device(class);
670 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
672 if (strncmp(buf
, "1", 1) == 0)
673 value
= V4L2_EXPOSURE_AUTO
;
674 else if (strncmp(buf
, "0", 1) == 0)
675 value
= V4L2_EXPOSURE_MANUAL
;
679 sn9c20x_set_camera_control(dev
,
680 V4L2_CID_EXPOSURE_AUTO
,
688 * @brief show_autowhitebalance
690 * @param class Class device
692 * @retval buf Adress of buffer with the 'vflip' value
694 * @returns Size of buffer
696 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
697 static ssize_t
show_autowhitebalance(struct class_device
*class, char *buf
)
699 static ssize_t
show_autowhitebalance(struct device
*class, struct device_attribute
*attr
, char *buf
)
702 struct video_device
*vdev
= to_video_device(class);
703 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
705 return sprintf(buf
, "%d\n", dev
->vsettings
.auto_whitebalance
);
710 * @brief store_autowhitebalance
712 * @param class Class device
714 * @param count Counter
717 * @returns Size of buffer
719 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
720 static ssize_t
store_autowhitebalance(struct class_device
*class, const char *buf
, size_t count
)
722 static ssize_t
store_autowhitebalance(struct device
*class, struct device_attribute
*attr
, const char *buf
, size_t count
)
727 struct video_device
*vdev
= to_video_device(class);
728 struct usb_sn9c20x
*dev
= video_get_drvdata(vdev
);
730 value
= simple_strtoul(buf
, &endp
, 10);
732 if (value
!= 0 && value
!= 1)
735 sn9c20x_set_camera_control(dev
,
736 V4L2_CID_AUTO_WHITE_BALANCE
,
742 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
743 static CLASS_DEVICE_ATTR(release
, S_IRUGO
, show_release
, NULL
); /**< Release value */
744 static CLASS_DEVICE_ATTR(videostatus
, S_IRUGO
, show_videostatus
, NULL
); /**< Video status */
745 static CLASS_DEVICE_ATTR(informations
, S_IRUGO
, show_informations
, NULL
); /**< Informations */
746 static CLASS_DEVICE_ATTR(fps
, S_IRUGO
, show_fps
, NULL
); /**< FPS value */
747 static CLASS_DEVICE_ATTR(brightness
, S_IRUGO
| S_IWUGO
, show_brightness
, store_brightness
); /**< Brightness value */
748 static CLASS_DEVICE_ATTR(exposure
, S_IRUGO
| S_IWUGO
, show_exposure
, store_exposure
); /**< Brightness exposure */
749 static CLASS_DEVICE_ATTR(contrast
, S_IRUGO
| S_IWUGO
, show_contrast
, store_contrast
); /**< Contrast value */
750 static CLASS_DEVICE_ATTR(gamma
, S_IRUGO
| S_IWUGO
, show_gamma
, store_gamma
); /**< Gamma value */
751 static CLASS_DEVICE_ATTR(sharpness
, S_IRUGO
| S_IWUGO
, show_sharpness
, store_sharpness
); /**< Sharpness value */
752 /*static CLASS_DEVICE_ATTR(colour, S_IRUGO | S_IWUGO, show_colour, store_colour); /< Hue value */
753 static CLASS_DEVICE_ATTR(hflip
, S_IRUGO
| S_IWUGO
, show_hflip
, store_hflip
); /**< Horizontal flip value */
754 static CLASS_DEVICE_ATTR(vflip
, S_IRUGO
| S_IWUGO
, show_vflip
, store_vflip
); /**< Vertical flip value */
755 static CLASS_DEVICE_ATTR(auto_exposure
, S_IRUGO
| S_IWUGO
, show_autoexposure
, store_autoexposure
); /**< Automatic exposure control value */
756 static CLASS_DEVICE_ATTR(auto_whitebalance
, S_IRUGO
| S_IWUGO
, show_autowhitebalance
, store_autowhitebalance
); /**< Automatic whitebalance control value */
758 static DEVICE_ATTR(release
, S_IRUGO
, show_release
, NULL
); /**< Release value */
759 static DEVICE_ATTR(videostatus
, S_IRUGO
, show_videostatus
, NULL
); /**< Video status */
760 static DEVICE_ATTR(informations
, S_IRUGO
, show_informations
, NULL
); /**< Informations */
761 static DEVICE_ATTR(fps
, S_IRUGO
, show_fps
, NULL
); /**< FPS value */
762 static DEVICE_ATTR(brightness
, S_IRUGO
| S_IWUGO
, show_brightness
, store_brightness
); /**< Brightness value */
763 static DEVICE_ATTR(exposure
, S_IRUGO
| S_IWUGO
, show_exposure
, store_exposure
); /**< Exposure value */
764 static DEVICE_ATTR(contrast
, S_IRUGO
| S_IWUGO
, show_contrast
, store_contrast
); /**< Contrast value */
765 static DEVICE_ATTR(gamma
, S_IRUGO
| S_IWUGO
, show_gamma
, store_gamma
); /**< Gamma value */
766 static DEVICE_ATTR(sharpness
, S_IRUGO
| S_IWUGO
, show_sharpness
, store_sharpness
); /**< Sharpness value */
767 /*static DEVICE_ATTR(colour, S_IRUGO | S_IWUGO, show_colour, store_colour); /< Hue value */
768 static DEVICE_ATTR(hflip
, S_IRUGO
| S_IWUGO
, show_hflip
, store_hflip
); /**< Horizontal flip value */
769 static DEVICE_ATTR(vflip
, S_IRUGO
| S_IWUGO
, show_vflip
, store_vflip
); /**< Vertical flip value */
770 static DEVICE_ATTR(auto_exposure
, S_IRUGO
| S_IWUGO
, show_autoexposure
, store_autoexposure
); /**< Automatic exposure control value */
771 static DEVICE_ATTR(auto_whitebalance
, S_IRUGO
| S_IWUGO
, show_autowhitebalance
, store_autowhitebalance
); /**< Automatic whitebalance control value */
776 * @brief Create the 'sys' entries.
778 * This function permits to create all the entries in the 'sys' filesystem.
780 * @param vdev Video device structure
782 * @returns 0 if all is OK
784 int sn9c20x_create_sysfs_files(struct video_device
*vdev
)
788 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
789 ret
= video_device_create_file(vdev
, &class_device_attr_release
);
790 ret
= video_device_create_file(vdev
, &class_device_attr_videostatus
);
791 ret
= video_device_create_file(vdev
, &class_device_attr_informations
);
792 ret
= video_device_create_file(vdev
, &class_device_attr_fps
);
793 ret
= video_device_create_file(vdev
, &class_device_attr_brightness
);
794 ret
= video_device_create_file(vdev
, &class_device_attr_exposure
);
795 ret
= video_device_create_file(vdev
, &class_device_attr_contrast
);
796 ret
= video_device_create_file(vdev
, &class_device_attr_gamma
);
797 ret
= video_device_create_file(vdev
, &class_device_attr_sharpness
);
798 /*ret = video_device_create_file(vdev, &class_device_attr_colour);*/
799 ret
= video_device_create_file(vdev
, &class_device_attr_hflip
);
800 ret
= video_device_create_file(vdev
, &class_device_attr_vflip
);
801 ret
= video_device_create_file(vdev
, &class_device_attr_auto_exposure
);
802 ret
= video_device_create_file(vdev
, &class_device_attr_auto_whitebalance
);
803 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
804 ret
= video_device_create_file(vdev
, &dev_attr_release
);
805 ret
= video_device_create_file(vdev
, &dev_attr_videostatus
);
806 ret
= video_device_create_file(vdev
, &dev_attr_informations
);
807 ret
= video_device_create_file(vdev
, &dev_attr_fps
);
808 ret
= video_device_create_file(vdev
, &dev_attr_brightness
);
809 ret
= video_device_create_file(vdev
, &dev_attr_exposure
);
810 ret
= video_device_create_file(vdev
, &dev_attr_contrast
);
811 ret
= video_device_create_file(vdev
, &dev_attr_gamma
);
812 ret
= video_device_create_file(vdev
, &dev_attr_sharpness
);
813 /*ret = video_device_create_file(vdev, &dev_attr_colour);*/
814 ret
= video_device_create_file(vdev
, &dev_attr_hflip
);
815 ret
= video_device_create_file(vdev
, &dev_attr_vflip
);
816 ret
= video_device_create_file(vdev
, &dev_attr_auto_exposure
);
817 ret
= video_device_create_file(vdev
, &dev_attr_auto_whitebalance
);
819 ret
= device_create_file(&vdev
->dev
, &dev_attr_release
);
820 ret
= device_create_file(&vdev
->dev
, &dev_attr_videostatus
);
821 ret
= device_create_file(&vdev
->dev
, &dev_attr_informations
);
822 ret
= device_create_file(&vdev
->dev
, &dev_attr_fps
);
823 ret
= device_create_file(&vdev
->dev
, &dev_attr_brightness
);
824 ret
= device_create_file(&vdev
->dev
, &dev_attr_exposure
);
825 ret
= device_create_file(&vdev
->dev
, &dev_attr_contrast
);
826 ret
= device_create_file(&vdev
->dev
, &dev_attr_gamma
);
827 ret
= device_create_file(&vdev
->dev
, &dev_attr_sharpness
);
828 /*ret = video_device_create_file(vdev, &dev_attr_colour);*/
829 ret
= device_create_file(&vdev
->dev
, &dev_attr_hflip
);
830 ret
= device_create_file(&vdev
->dev
, &dev_attr_vflip
);
831 ret
= device_create_file(&vdev
->dev
, &dev_attr_auto_exposure
);
832 ret
= device_create_file(&vdev
->dev
, &dev_attr_auto_whitebalance
);
839 * @brief Remove the 'sys' entries.
841 * This function permits to remove all the entries in the 'sys' filesystem.
843 * @param vdev Video device structure
845 * @returns 0 if all is OK
847 void sn9c20x_remove_sysfs_files(struct video_device
*vdev
)
849 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
850 video_device_remove_file(vdev
, &class_device_attr_release
);
851 video_device_remove_file(vdev
, &class_device_attr_videostatus
);
852 video_device_remove_file(vdev
, &class_device_attr_informations
);
853 video_device_remove_file(vdev
, &class_device_attr_fps
);
854 video_device_remove_file(vdev
, &class_device_attr_brightness
);
855 video_device_remove_file(vdev
, &class_device_attr_exposure
);
856 video_device_remove_file(vdev
, &class_device_attr_contrast
);
857 video_device_remove_file(vdev
, &class_device_attr_gamma
);
858 video_device_remove_file(vdev
, &class_device_attr_sharpness
);
859 /*video_device_remove_file(vdev, &class_device_attr_colour);*/
860 video_device_remove_file(vdev
, &class_device_attr_hflip
);
861 video_device_remove_file(vdev
, &class_device_attr_vflip
);
862 video_device_remove_file(vdev
, &class_device_attr_auto_exposure
);
863 video_device_remove_file(vdev
, &class_device_attr_auto_whitebalance
);
864 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
865 video_device_remove_file(vdev
, &dev_attr_release
);
866 video_device_remove_file(vdev
, &dev_attr_videostatus
);
867 video_device_remove_file(vdev
, &dev_attr_informations
);
868 video_device_remove_file(vdev
, &dev_attr_fps
);
869 video_device_remove_file(vdev
, &dev_attr_brightness
);
870 video_device_remove_file(vdev
, &dev_attr_exposure
);
871 video_device_remove_file(vdev
, &dev_attr_contrast
);
872 video_device_remove_file(vdev
, &dev_attr_gamma
);
873 video_device_remove_file(vdev
, &dev_attr_sharpness
);
874 /*video_device_remove_file(vdev, &dev_attr_colour);*/
875 video_device_remove_file(vdev
, &dev_attr_hflip
);
876 video_device_remove_file(vdev
, &dev_attr_vflip
);
877 video_device_remove_file(vdev
, &dev_attr_auto_exposure
);
878 video_device_remove_file(vdev
, &dev_attr_auto_whitebalance
);
880 device_remove_file(&vdev
->dev
, &dev_attr_release
);
881 device_remove_file(&vdev
->dev
, &dev_attr_videostatus
);
882 device_remove_file(&vdev
->dev
, &dev_attr_informations
);
883 device_remove_file(&vdev
->dev
, &dev_attr_fps
);
884 device_remove_file(&vdev
->dev
, &dev_attr_brightness
);
885 device_remove_file(&vdev
->dev
, &dev_attr_exposure
);
886 device_remove_file(&vdev
->dev
, &dev_attr_contrast
);
887 device_remove_file(&vdev
->dev
, &dev_attr_gamma
);
888 device_remove_file(&vdev
->dev
, &dev_attr_sharpness
);
889 /*video_device_remove_file(vdev, &dev_attr_colour);*/
890 device_remove_file(&vdev
->dev
, &dev_attr_hflip
);
891 device_remove_file(&vdev
->dev
, &dev_attr_vflip
);
892 device_remove_file(&vdev
->dev
, &dev_attr_auto_exposure
);
893 device_remove_file(&vdev
->dev
, &dev_attr_auto_whitebalance
);