18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2010-2013 Bluecherry, LLC <https://www.bluecherrydvr.com> 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Original author: 68c2ecf20Sopenharmony_ci * Ben Collins <bcollins@ubuntu.com> 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Additional work by: 98c2ecf20Sopenharmony_ci * John Brooks <john.brooks@bluecherry.net> 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#ifndef __SOLO6X10_H 138c2ecf20Sopenharmony_ci#define __SOLO6X10_H 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include <linux/pci.h> 168c2ecf20Sopenharmony_ci#include <linux/i2c.h> 178c2ecf20Sopenharmony_ci#include <linux/mutex.h> 188c2ecf20Sopenharmony_ci#include <linux/list.h> 198c2ecf20Sopenharmony_ci#include <linux/wait.h> 208c2ecf20Sopenharmony_ci#include <linux/stringify.h> 218c2ecf20Sopenharmony_ci#include <linux/io.h> 228c2ecf20Sopenharmony_ci#include <linux/atomic.h> 238c2ecf20Sopenharmony_ci#include <linux/slab.h> 248c2ecf20Sopenharmony_ci#include <linux/videodev2.h> 258c2ecf20Sopenharmony_ci#include <linux/gpio/driver.h> 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include <media/v4l2-dev.h> 288c2ecf20Sopenharmony_ci#include <media/v4l2-device.h> 298c2ecf20Sopenharmony_ci#include <media/v4l2-ctrls.h> 308c2ecf20Sopenharmony_ci#include <media/videobuf2-v4l2.h> 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#include "solo6x10-regs.h" 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#ifndef PCI_VENDOR_ID_SOFTLOGIC 358c2ecf20Sopenharmony_ci#define PCI_VENDOR_ID_SOFTLOGIC 0x9413 368c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_SOLO6010 0x6010 378c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_SOLO6110 0x6110 388c2ecf20Sopenharmony_ci#endif 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#ifndef PCI_VENDOR_ID_BLUECHERRY 418c2ecf20Sopenharmony_ci#define PCI_VENDOR_ID_BLUECHERRY 0x1BB3 428c2ecf20Sopenharmony_ci/* Neugent Softlogic 6010 based cards */ 438c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_NEUSOLO_4 0x4304 448c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_NEUSOLO_9 0x4309 458c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_NEUSOLO_16 0x4310 468c2ecf20Sopenharmony_ci/* Bluecherry Softlogic 6010 based cards */ 478c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_BC_SOLO_4 0x4E04 488c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_BC_SOLO_9 0x4E09 498c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_BC_SOLO_16 0x4E10 508c2ecf20Sopenharmony_ci/* Bluecherry Softlogic 6110 based cards */ 518c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_BC_6110_4 0x5304 528c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_BC_6110_8 0x5308 538c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_BC_6110_16 0x5310 548c2ecf20Sopenharmony_ci#endif /* Bluecherry */ 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* Used in pci_device_id, and solo_dev->type */ 578c2ecf20Sopenharmony_ci#define SOLO_DEV_6010 0 588c2ecf20Sopenharmony_ci#define SOLO_DEV_6110 1 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define SOLO6X10_NAME "solo6x10" 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define SOLO_MAX_CHANNELS 16 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define SOLO6X10_VERSION "3.0.0" 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/* 678c2ecf20Sopenharmony_ci * The SOLO6x10 actually has 8 i2c channels, but we only use 2. 688c2ecf20Sopenharmony_ci * 0 - Techwell chip(s) 698c2ecf20Sopenharmony_ci * 1 - SAA7128 708c2ecf20Sopenharmony_ci */ 718c2ecf20Sopenharmony_ci#define SOLO_I2C_ADAPTERS 2 728c2ecf20Sopenharmony_ci#define SOLO_I2C_TW 0 738c2ecf20Sopenharmony_ci#define SOLO_I2C_SAA 1 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci/* DMA Engine setup */ 768c2ecf20Sopenharmony_ci#define SOLO_NR_P2M 4 778c2ecf20Sopenharmony_ci#define SOLO_NR_P2M_DESC 256 788c2ecf20Sopenharmony_ci#define SOLO_P2M_DESC_SIZE (SOLO_NR_P2M_DESC * 16) 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci/* Encoder standard modes */ 818c2ecf20Sopenharmony_ci#define SOLO_ENC_MODE_CIF 2 828c2ecf20Sopenharmony_ci#define SOLO_ENC_MODE_HD1 1 838c2ecf20Sopenharmony_ci#define SOLO_ENC_MODE_D1 9 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define SOLO_DEFAULT_QP 3 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define SOLO_CID_CUSTOM_BASE (V4L2_CID_USER_BASE | 0xf000) 888c2ecf20Sopenharmony_ci#define V4L2_CID_MOTION_TRACE (SOLO_CID_CUSTOM_BASE+2) 898c2ecf20Sopenharmony_ci#define V4L2_CID_OSD_TEXT (SOLO_CID_CUSTOM_BASE+3) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/* 928c2ecf20Sopenharmony_ci * Motion thresholds are in a table of 64x64 samples, with 938c2ecf20Sopenharmony_ci * each sample representing 16x16 pixels of the source. In 948c2ecf20Sopenharmony_ci * effect, 44x30 samples are used for NTSC, and 44x36 for PAL. 958c2ecf20Sopenharmony_ci * The 5th sample on the 10th row is (10*64)+5 = 645. 968c2ecf20Sopenharmony_ci * 978c2ecf20Sopenharmony_ci * Internally it is stored as a 45x45 array (45*16 = 720, which is the 988c2ecf20Sopenharmony_ci * maximum PAL/NTSC width). 998c2ecf20Sopenharmony_ci */ 1008c2ecf20Sopenharmony_ci#define SOLO_MOTION_SZ (45) 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cienum SOLO_I2C_STATE { 1038c2ecf20Sopenharmony_ci IIC_STATE_IDLE, 1048c2ecf20Sopenharmony_ci IIC_STATE_START, 1058c2ecf20Sopenharmony_ci IIC_STATE_READ, 1068c2ecf20Sopenharmony_ci IIC_STATE_WRITE, 1078c2ecf20Sopenharmony_ci IIC_STATE_STOP 1088c2ecf20Sopenharmony_ci}; 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci/* Defined in Table 4-16, Page 68-69 of the 6010 Datasheet */ 1118c2ecf20Sopenharmony_cistruct solo_p2m_desc { 1128c2ecf20Sopenharmony_ci u32 ctrl; 1138c2ecf20Sopenharmony_ci u32 cfg; 1148c2ecf20Sopenharmony_ci u32 dma_addr; 1158c2ecf20Sopenharmony_ci u32 ext_addr; 1168c2ecf20Sopenharmony_ci}; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_cistruct solo_p2m_dev { 1198c2ecf20Sopenharmony_ci struct mutex mutex; 1208c2ecf20Sopenharmony_ci struct completion completion; 1218c2ecf20Sopenharmony_ci int desc_count; 1228c2ecf20Sopenharmony_ci int desc_idx; 1238c2ecf20Sopenharmony_ci struct solo_p2m_desc *descs; 1248c2ecf20Sopenharmony_ci int error; 1258c2ecf20Sopenharmony_ci}; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define OSD_TEXT_MAX 44 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_cistruct solo_vb2_buf { 1308c2ecf20Sopenharmony_ci struct vb2_v4l2_buffer vb; 1318c2ecf20Sopenharmony_ci struct list_head list; 1328c2ecf20Sopenharmony_ci}; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_cienum solo_enc_types { 1358c2ecf20Sopenharmony_ci SOLO_ENC_TYPE_STD, 1368c2ecf20Sopenharmony_ci SOLO_ENC_TYPE_EXT, 1378c2ecf20Sopenharmony_ci}; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_cistruct solo_enc_dev { 1408c2ecf20Sopenharmony_ci struct solo_dev *solo_dev; 1418c2ecf20Sopenharmony_ci /* V4L2 Items */ 1428c2ecf20Sopenharmony_ci struct v4l2_ctrl_handler hdl; 1438c2ecf20Sopenharmony_ci struct v4l2_ctrl *md_thresholds; 1448c2ecf20Sopenharmony_ci struct video_device *vfd; 1458c2ecf20Sopenharmony_ci /* General accounting */ 1468c2ecf20Sopenharmony_ci struct mutex lock; 1478c2ecf20Sopenharmony_ci spinlock_t motion_lock; 1488c2ecf20Sopenharmony_ci u8 ch; 1498c2ecf20Sopenharmony_ci u8 mode, gop, qp, interlaced, interval; 1508c2ecf20Sopenharmony_ci u8 bw_weight; 1518c2ecf20Sopenharmony_ci u16 motion_thresh; 1528c2ecf20Sopenharmony_ci bool motion_global; 1538c2ecf20Sopenharmony_ci bool motion_enabled; 1548c2ecf20Sopenharmony_ci u16 width; 1558c2ecf20Sopenharmony_ci u16 height; 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci /* OSD buffers */ 1588c2ecf20Sopenharmony_ci char osd_text[OSD_TEXT_MAX + 1]; 1598c2ecf20Sopenharmony_ci u8 osd_buf[SOLO_EOSD_EXT_SIZE_MAX] 1608c2ecf20Sopenharmony_ci __aligned(4); 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci /* VOP stuff */ 1638c2ecf20Sopenharmony_ci u8 vop[64]; 1648c2ecf20Sopenharmony_ci int vop_len; 1658c2ecf20Sopenharmony_ci u8 jpeg_header[1024]; 1668c2ecf20Sopenharmony_ci int jpeg_len; 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci u32 fmt; 1698c2ecf20Sopenharmony_ci enum solo_enc_types type; 1708c2ecf20Sopenharmony_ci u32 sequence; 1718c2ecf20Sopenharmony_ci struct vb2_queue vidq; 1728c2ecf20Sopenharmony_ci struct list_head vidq_active; 1738c2ecf20Sopenharmony_ci int desc_count; 1748c2ecf20Sopenharmony_ci int desc_nelts; 1758c2ecf20Sopenharmony_ci struct solo_p2m_desc *desc_items; 1768c2ecf20Sopenharmony_ci dma_addr_t desc_dma; 1778c2ecf20Sopenharmony_ci spinlock_t av_lock; 1788c2ecf20Sopenharmony_ci}; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci/* The SOLO6x10 PCI Device */ 1818c2ecf20Sopenharmony_cistruct solo_dev { 1828c2ecf20Sopenharmony_ci /* General stuff */ 1838c2ecf20Sopenharmony_ci struct pci_dev *pdev; 1848c2ecf20Sopenharmony_ci int type; 1858c2ecf20Sopenharmony_ci unsigned int time_sync; 1868c2ecf20Sopenharmony_ci unsigned int usec_lsb; 1878c2ecf20Sopenharmony_ci unsigned int clock_mhz; 1888c2ecf20Sopenharmony_ci u8 __iomem *reg_base; 1898c2ecf20Sopenharmony_ci int nr_chans; 1908c2ecf20Sopenharmony_ci int nr_ext; 1918c2ecf20Sopenharmony_ci u32 irq_mask; 1928c2ecf20Sopenharmony_ci u32 motion_mask; 1938c2ecf20Sopenharmony_ci struct v4l2_device v4l2_dev; 1948c2ecf20Sopenharmony_ci#ifdef CONFIG_GPIOLIB 1958c2ecf20Sopenharmony_ci /* GPIO */ 1968c2ecf20Sopenharmony_ci struct gpio_chip gpio_dev; 1978c2ecf20Sopenharmony_ci#endif 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci /* tw28xx accounting */ 2008c2ecf20Sopenharmony_ci u8 tw2865, tw2864, tw2815; 2018c2ecf20Sopenharmony_ci u8 tw28_cnt; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci /* i2c related items */ 2048c2ecf20Sopenharmony_ci struct i2c_adapter i2c_adap[SOLO_I2C_ADAPTERS]; 2058c2ecf20Sopenharmony_ci enum SOLO_I2C_STATE i2c_state; 2068c2ecf20Sopenharmony_ci struct mutex i2c_mutex; 2078c2ecf20Sopenharmony_ci int i2c_id; 2088c2ecf20Sopenharmony_ci wait_queue_head_t i2c_wait; 2098c2ecf20Sopenharmony_ci struct i2c_msg *i2c_msg; 2108c2ecf20Sopenharmony_ci unsigned int i2c_msg_num; 2118c2ecf20Sopenharmony_ci unsigned int i2c_msg_ptr; 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci /* P2M DMA Engine */ 2148c2ecf20Sopenharmony_ci struct solo_p2m_dev p2m_dev[SOLO_NR_P2M]; 2158c2ecf20Sopenharmony_ci atomic_t p2m_count; 2168c2ecf20Sopenharmony_ci int p2m_jiffies; 2178c2ecf20Sopenharmony_ci unsigned int p2m_timeouts; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci /* V4L2 Display items */ 2208c2ecf20Sopenharmony_ci struct video_device *vfd; 2218c2ecf20Sopenharmony_ci unsigned int erasing; 2228c2ecf20Sopenharmony_ci unsigned int frame_blank; 2238c2ecf20Sopenharmony_ci u8 cur_disp_ch; 2248c2ecf20Sopenharmony_ci wait_queue_head_t disp_thread_wait; 2258c2ecf20Sopenharmony_ci struct v4l2_ctrl_handler disp_hdl; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci /* V4L2 Encoder items */ 2288c2ecf20Sopenharmony_ci struct solo_enc_dev *v4l2_enc[SOLO_MAX_CHANNELS]; 2298c2ecf20Sopenharmony_ci u16 enc_bw_remain; 2308c2ecf20Sopenharmony_ci /* IDX into hw mp4 encoder */ 2318c2ecf20Sopenharmony_ci u8 enc_idx; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci /* Current video settings */ 2348c2ecf20Sopenharmony_ci u32 video_type; 2358c2ecf20Sopenharmony_ci u16 video_hsize, video_vsize; 2368c2ecf20Sopenharmony_ci u16 vout_hstart, vout_vstart; 2378c2ecf20Sopenharmony_ci u16 vin_hstart, vin_vstart; 2388c2ecf20Sopenharmony_ci u8 fps; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci /* JPEG Qp setting */ 2418c2ecf20Sopenharmony_ci spinlock_t jpeg_qp_lock; 2428c2ecf20Sopenharmony_ci u32 jpeg_qp[2]; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci /* Audio components */ 2458c2ecf20Sopenharmony_ci struct snd_card *snd_card; 2468c2ecf20Sopenharmony_ci struct snd_pcm *snd_pcm; 2478c2ecf20Sopenharmony_ci atomic_t snd_users; 2488c2ecf20Sopenharmony_ci int g723_hw_idx; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci /* sysfs stuffs */ 2518c2ecf20Sopenharmony_ci struct device dev; 2528c2ecf20Sopenharmony_ci int sdram_size; 2538c2ecf20Sopenharmony_ci struct bin_attribute sdram_attr; 2548c2ecf20Sopenharmony_ci unsigned int sys_config; 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci /* Ring thread */ 2578c2ecf20Sopenharmony_ci struct task_struct *ring_thread; 2588c2ecf20Sopenharmony_ci wait_queue_head_t ring_thread_wait; 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci /* VOP_HEADER handling */ 2618c2ecf20Sopenharmony_ci void *vh_buf; 2628c2ecf20Sopenharmony_ci dma_addr_t vh_dma; 2638c2ecf20Sopenharmony_ci int vh_size; 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci /* Buffer handling */ 2668c2ecf20Sopenharmony_ci struct vb2_queue vidq; 2678c2ecf20Sopenharmony_ci u32 sequence; 2688c2ecf20Sopenharmony_ci struct task_struct *kthread; 2698c2ecf20Sopenharmony_ci struct mutex lock; 2708c2ecf20Sopenharmony_ci spinlock_t slock; 2718c2ecf20Sopenharmony_ci int old_write; 2728c2ecf20Sopenharmony_ci struct list_head vidq_active; 2738c2ecf20Sopenharmony_ci}; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_cistatic inline u32 solo_reg_read(struct solo_dev *solo_dev, int reg) 2768c2ecf20Sopenharmony_ci{ 2778c2ecf20Sopenharmony_ci return readl(solo_dev->reg_base + reg); 2788c2ecf20Sopenharmony_ci} 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_cistatic inline void solo_reg_write(struct solo_dev *solo_dev, int reg, 2818c2ecf20Sopenharmony_ci u32 data) 2828c2ecf20Sopenharmony_ci{ 2838c2ecf20Sopenharmony_ci u16 val; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci writel(data, solo_dev->reg_base + reg); 2868c2ecf20Sopenharmony_ci pci_read_config_word(solo_dev->pdev, PCI_STATUS, &val); 2878c2ecf20Sopenharmony_ci} 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_cistatic inline void solo_irq_on(struct solo_dev *dev, u32 mask) 2908c2ecf20Sopenharmony_ci{ 2918c2ecf20Sopenharmony_ci dev->irq_mask |= mask; 2928c2ecf20Sopenharmony_ci solo_reg_write(dev, SOLO_IRQ_MASK, dev->irq_mask); 2938c2ecf20Sopenharmony_ci} 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_cistatic inline void solo_irq_off(struct solo_dev *dev, u32 mask) 2968c2ecf20Sopenharmony_ci{ 2978c2ecf20Sopenharmony_ci dev->irq_mask &= ~mask; 2988c2ecf20Sopenharmony_ci solo_reg_write(dev, SOLO_IRQ_MASK, dev->irq_mask); 2998c2ecf20Sopenharmony_ci} 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci/* Init/exit routines for subsystems */ 3028c2ecf20Sopenharmony_ciint solo_disp_init(struct solo_dev *solo_dev); 3038c2ecf20Sopenharmony_civoid solo_disp_exit(struct solo_dev *solo_dev); 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ciint solo_gpio_init(struct solo_dev *solo_dev); 3068c2ecf20Sopenharmony_civoid solo_gpio_exit(struct solo_dev *solo_dev); 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ciint solo_i2c_init(struct solo_dev *solo_dev); 3098c2ecf20Sopenharmony_civoid solo_i2c_exit(struct solo_dev *solo_dev); 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ciint solo_p2m_init(struct solo_dev *solo_dev); 3128c2ecf20Sopenharmony_civoid solo_p2m_exit(struct solo_dev *solo_dev); 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ciint solo_v4l2_init(struct solo_dev *solo_dev, unsigned nr); 3158c2ecf20Sopenharmony_civoid solo_v4l2_exit(struct solo_dev *solo_dev); 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ciint solo_enc_init(struct solo_dev *solo_dev); 3188c2ecf20Sopenharmony_civoid solo_enc_exit(struct solo_dev *solo_dev); 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ciint solo_enc_v4l2_init(struct solo_dev *solo_dev, unsigned nr); 3218c2ecf20Sopenharmony_civoid solo_enc_v4l2_exit(struct solo_dev *solo_dev); 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ciint solo_g723_init(struct solo_dev *solo_dev); 3248c2ecf20Sopenharmony_civoid solo_g723_exit(struct solo_dev *solo_dev); 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci/* ISR's */ 3278c2ecf20Sopenharmony_ciint solo_i2c_isr(struct solo_dev *solo_dev); 3288c2ecf20Sopenharmony_civoid solo_p2m_isr(struct solo_dev *solo_dev, int id); 3298c2ecf20Sopenharmony_civoid solo_p2m_error_isr(struct solo_dev *solo_dev); 3308c2ecf20Sopenharmony_civoid solo_enc_v4l2_isr(struct solo_dev *solo_dev); 3318c2ecf20Sopenharmony_civoid solo_g723_isr(struct solo_dev *solo_dev); 3328c2ecf20Sopenharmony_civoid solo_motion_isr(struct solo_dev *solo_dev); 3338c2ecf20Sopenharmony_civoid solo_video_in_isr(struct solo_dev *solo_dev); 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci/* i2c read/write */ 3368c2ecf20Sopenharmony_ciu8 solo_i2c_readbyte(struct solo_dev *solo_dev, int id, u8 addr, u8 off); 3378c2ecf20Sopenharmony_civoid solo_i2c_writebyte(struct solo_dev *solo_dev, int id, u8 addr, u8 off, 3388c2ecf20Sopenharmony_ci u8 data); 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci/* P2M DMA */ 3418c2ecf20Sopenharmony_ciint solo_p2m_dma_t(struct solo_dev *solo_dev, int wr, 3428c2ecf20Sopenharmony_ci dma_addr_t dma_addr, u32 ext_addr, u32 size, 3438c2ecf20Sopenharmony_ci int repeat, u32 ext_size); 3448c2ecf20Sopenharmony_ciint solo_p2m_dma(struct solo_dev *solo_dev, int wr, 3458c2ecf20Sopenharmony_ci void *sys_addr, u32 ext_addr, u32 size, 3468c2ecf20Sopenharmony_ci int repeat, u32 ext_size); 3478c2ecf20Sopenharmony_civoid solo_p2m_fill_desc(struct solo_p2m_desc *desc, int wr, 3488c2ecf20Sopenharmony_ci dma_addr_t dma_addr, u32 ext_addr, u32 size, 3498c2ecf20Sopenharmony_ci int repeat, u32 ext_size); 3508c2ecf20Sopenharmony_ciint solo_p2m_dma_desc(struct solo_dev *solo_dev, 3518c2ecf20Sopenharmony_ci struct solo_p2m_desc *desc, dma_addr_t desc_dma, 3528c2ecf20Sopenharmony_ci int desc_cnt); 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci/* Global s_std ioctl */ 3558c2ecf20Sopenharmony_ciint solo_set_video_type(struct solo_dev *solo_dev, bool is_50hz); 3568c2ecf20Sopenharmony_civoid solo_update_mode(struct solo_enc_dev *solo_enc); 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci/* Set the threshold for motion detection */ 3598c2ecf20Sopenharmony_ciint solo_set_motion_threshold(struct solo_dev *solo_dev, u8 ch, u16 val); 3608c2ecf20Sopenharmony_ciint solo_set_motion_block(struct solo_dev *solo_dev, u8 ch, 3618c2ecf20Sopenharmony_ci const u16 *thresholds); 3628c2ecf20Sopenharmony_ci#define SOLO_DEF_MOT_THRESH 0x0300 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci/* Write text on OSD */ 3658c2ecf20Sopenharmony_ciint solo_osd_print(struct solo_enc_dev *solo_enc); 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci/* EEPROM commands */ 3688c2ecf20Sopenharmony_ciunsigned int solo_eeprom_ewen(struct solo_dev *solo_dev, int w_en); 3698c2ecf20Sopenharmony_ci__be16 solo_eeprom_read(struct solo_dev *solo_dev, int loc); 3708c2ecf20Sopenharmony_ciint solo_eeprom_write(struct solo_dev *solo_dev, int loc, 3718c2ecf20Sopenharmony_ci __be16 data); 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci/* JPEG Qp functions */ 3748c2ecf20Sopenharmony_civoid solo_s_jpeg_qp(struct solo_dev *solo_dev, unsigned int ch, 3758c2ecf20Sopenharmony_ci unsigned int qp); 3768c2ecf20Sopenharmony_ciint solo_g_jpeg_qp(struct solo_dev *solo_dev, unsigned int ch); 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci#define CHK_FLAGS(v, flags) (((v) & (flags)) == (flags)) 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci#endif /* __SOLO6X10_H */ 381