1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * Copyright (C) 2008-2009 Texas Instruments Inc 4 * 5 * ccdc device API 6 */ 7 #ifndef _CCDC_HW_DEVICE_H 8 #define _CCDC_HW_DEVICE_H 9 10 #ifdef __KERNEL__ 11 #include <linux/videodev2.h> 12 #include <linux/device.h> 13 #include <media/davinci/vpfe_types.h> 14 #include <media/davinci/ccdc_types.h> 15 16 /* 17 * ccdc hw operations 18 */ 19 struct ccdc_hw_ops { 20 /* Pointer to initialize function to initialize ccdc device */ 21 int (*open) (struct device *dev); 22 /* Pointer to deinitialize function */ 23 int (*close) (struct device *dev); 24 /* set ccdc base address */ 25 void (*set_ccdc_base)(void *base, int size); 26 /* Pointer to function to enable or disable ccdc */ 27 void (*enable) (int en); 28 /* reset sbl. only for 6446 */ 29 void (*reset) (void); 30 /* enable output to sdram */ 31 void (*enable_out_to_sdram) (int en); 32 /* Pointer to function to set hw parameters */ 33 int (*set_hw_if_params) (struct vpfe_hw_if_param *param); 34 /* get interface parameters */ 35 int (*get_hw_if_params) (struct vpfe_hw_if_param *param); 36 /* Pointer to function to configure ccdc */ 37 int (*configure) (void); 38 39 /* Pointer to function to set buffer type */ 40 int (*set_buftype) (enum ccdc_buftype buf_type); 41 /* Pointer to function to get buffer type */ 42 enum ccdc_buftype (*get_buftype) (void); 43 /* Pointer to function to set frame format */ 44 int (*set_frame_format) (enum ccdc_frmfmt frm_fmt); 45 /* Pointer to function to get frame format */ 46 enum ccdc_frmfmt (*get_frame_format) (void); 47 /* enumerate hw pix formats */ 48 int (*enum_pix)(u32 *hw_pix, int i); 49 /* Pointer to function to set buffer type */ 50 u32 (*get_pixel_format) (void); 51 /* Pointer to function to get pixel format. */ 52 int (*set_pixel_format) (u32 pixfmt); 53 /* Pointer to function to set image window */ 54 int (*set_image_window) (struct v4l2_rect *win); 55 /* Pointer to function to set image window */ 56 void (*get_image_window) (struct v4l2_rect *win); 57 /* Pointer to function to get line length */ 58 unsigned int (*get_line_length) (void); 59 60 /* Pointer to function to set frame buffer address */ 61 void (*setfbaddr) (unsigned long addr); 62 /* Pointer to function to get field id */ 63 int (*getfid) (void); 64 }; 65 66 struct ccdc_hw_device { 67 /* ccdc device name */ 68 char name[32]; 69 /* module owner */ 70 struct module *owner; 71 /* hw ops */ 72 struct ccdc_hw_ops hw_ops; 73 }; 74 75 /* Used by CCDC module to register & unregister with vpfe capture driver */ 76 int vpfe_register_ccdc_device(const struct ccdc_hw_device *dev); 77 void vpfe_unregister_ccdc_device(const struct ccdc_hw_device *dev); 78 79 #endif 80 #endif 81