18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * v4l2 device driver for cx2388x based TV cards 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * (c) 2003,04 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs] 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef CX88_H 98c2ecf20Sopenharmony_ci#define CX88_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/pci.h> 148c2ecf20Sopenharmony_ci#include <linux/i2c.h> 158c2ecf20Sopenharmony_ci#include <linux/i2c-algo-bit.h> 168c2ecf20Sopenharmony_ci#include <linux/videodev2.h> 178c2ecf20Sopenharmony_ci#include <linux/kdev_t.h> 188c2ecf20Sopenharmony_ci#include <linux/refcount.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include <media/v4l2-device.h> 218c2ecf20Sopenharmony_ci#include <media/v4l2-fh.h> 228c2ecf20Sopenharmony_ci#include <media/tuner.h> 238c2ecf20Sopenharmony_ci#include <media/tveeprom.h> 248c2ecf20Sopenharmony_ci#include <media/videobuf2-dma-sg.h> 258c2ecf20Sopenharmony_ci#include <media/drv-intf/cx2341x.h> 268c2ecf20Sopenharmony_ci#include <media/videobuf2-dvb.h> 278c2ecf20Sopenharmony_ci#include <media/i2c/ir-kbd-i2c.h> 288c2ecf20Sopenharmony_ci#include <media/i2c/wm8775.h> 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#include "cx88-reg.h" 318c2ecf20Sopenharmony_ci#include "tuner-xc2028.h" 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#include <linux/mutex.h> 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define CX88_VERSION "1.0.0" 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define UNSET (-1U) 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define CX88_MAXBOARDS 8 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* Max number of inputs by card */ 428c2ecf20Sopenharmony_ci#define MAX_CX88_INPUT 8 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 458c2ecf20Sopenharmony_ci/* defines and enums */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM/LC */ 488c2ecf20Sopenharmony_ci#define CX88_NORMS (V4L2_STD_ALL \ 498c2ecf20Sopenharmony_ci & ~V4L2_STD_PAL_H \ 508c2ecf20Sopenharmony_ci & ~V4L2_STD_NTSC_M_KR \ 518c2ecf20Sopenharmony_ci & ~V4L2_STD_SECAM_LC) 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define FORMAT_FLAGS_PACKED 0x01 548c2ecf20Sopenharmony_ci#define FORMAT_FLAGS_PLANAR 0x02 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define VBI_LINE_PAL_COUNT 18 578c2ecf20Sopenharmony_ci#define VBI_LINE_NTSC_COUNT 12 588c2ecf20Sopenharmony_ci#define VBI_LINE_LENGTH 2048 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define AUD_RDS_LINES 4 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* need "shadow" registers for some write-only ones ... */ 638c2ecf20Sopenharmony_ci#define SHADOW_AUD_VOL_CTL 1 648c2ecf20Sopenharmony_ci#define SHADOW_AUD_BAL_CTL 2 658c2ecf20Sopenharmony_ci#define SHADOW_MAX 3 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* FM Radio deemphasis type */ 688c2ecf20Sopenharmony_cienum cx88_deemph_type { 698c2ecf20Sopenharmony_ci FM_NO_DEEMPH = 0, 708c2ecf20Sopenharmony_ci FM_DEEMPH_50, 718c2ecf20Sopenharmony_ci FM_DEEMPH_75 728c2ecf20Sopenharmony_ci}; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_cienum cx88_board_type { 758c2ecf20Sopenharmony_ci CX88_BOARD_NONE = 0, 768c2ecf20Sopenharmony_ci CX88_MPEG_DVB, 778c2ecf20Sopenharmony_ci CX88_MPEG_BLACKBIRD 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_cienum cx8802_board_access { 818c2ecf20Sopenharmony_ci CX8802_DRVCTL_SHARED = 1, 828c2ecf20Sopenharmony_ci CX8802_DRVCTL_EXCLUSIVE = 2, 838c2ecf20Sopenharmony_ci}; 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 868c2ecf20Sopenharmony_ci/* tv norms */ 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistatic inline unsigned int norm_maxw(v4l2_std_id norm) 898c2ecf20Sopenharmony_ci{ 908c2ecf20Sopenharmony_ci return 720; 918c2ecf20Sopenharmony_ci} 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cistatic inline unsigned int norm_maxh(v4l2_std_id norm) 948c2ecf20Sopenharmony_ci{ 958c2ecf20Sopenharmony_ci return (norm & V4L2_STD_525_60) ? 480 : 576; 968c2ecf20Sopenharmony_ci} 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 998c2ecf20Sopenharmony_ci/* static data */ 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_cistruct cx8800_fmt { 1028c2ecf20Sopenharmony_ci u32 fourcc; /* v4l2 format id */ 1038c2ecf20Sopenharmony_ci int depth; 1048c2ecf20Sopenharmony_ci int flags; 1058c2ecf20Sopenharmony_ci u32 cxformat; 1068c2ecf20Sopenharmony_ci}; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 1098c2ecf20Sopenharmony_ci/* SRAM memory management data (see cx88-core.c) */ 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define SRAM_CH21 0 /* video */ 1128c2ecf20Sopenharmony_ci#define SRAM_CH22 1 1138c2ecf20Sopenharmony_ci#define SRAM_CH23 2 1148c2ecf20Sopenharmony_ci#define SRAM_CH24 3 /* vbi */ 1158c2ecf20Sopenharmony_ci#define SRAM_CH25 4 /* audio */ 1168c2ecf20Sopenharmony_ci#define SRAM_CH26 5 1178c2ecf20Sopenharmony_ci#define SRAM_CH28 6 /* mpeg */ 1188c2ecf20Sopenharmony_ci#define SRAM_CH27 7 /* audio rds */ 1198c2ecf20Sopenharmony_ci/* more */ 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_cistruct sram_channel { 1228c2ecf20Sopenharmony_ci const char *name; 1238c2ecf20Sopenharmony_ci u32 cmds_start; 1248c2ecf20Sopenharmony_ci u32 ctrl_start; 1258c2ecf20Sopenharmony_ci u32 cdt; 1268c2ecf20Sopenharmony_ci u32 fifo_start; 1278c2ecf20Sopenharmony_ci u32 fifo_size; 1288c2ecf20Sopenharmony_ci u32 ptr1_reg; 1298c2ecf20Sopenharmony_ci u32 ptr2_reg; 1308c2ecf20Sopenharmony_ci u32 cnt1_reg; 1318c2ecf20Sopenharmony_ci u32 cnt2_reg; 1328c2ecf20Sopenharmony_ci}; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ciextern const struct sram_channel cx88_sram_channels[]; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 1378c2ecf20Sopenharmony_ci/* card configuration */ 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci#define CX88_BOARD_NOAUTO UNSET 1408c2ecf20Sopenharmony_ci#define CX88_BOARD_UNKNOWN 0 1418c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE 1 1428c2ecf20Sopenharmony_ci#define CX88_BOARD_GDI 2 1438c2ecf20Sopenharmony_ci#define CX88_BOARD_PIXELVIEW 3 1448c2ecf20Sopenharmony_ci#define CX88_BOARD_ATI_WONDER_PRO 4 1458c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST2000XP_EXPERT 5 1468c2ecf20Sopenharmony_ci#define CX88_BOARD_AVERTV_STUDIO_303 6 1478c2ecf20Sopenharmony_ci#define CX88_BOARD_MSI_TVANYWHERE_MASTER 7 1488c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_DV2000 8 1498c2ecf20Sopenharmony_ci#define CX88_BOARD_LEADTEK_PVR2000 9 1508c2ecf20Sopenharmony_ci#define CX88_BOARD_IODATA_GVVCP3PCI 10 1518c2ecf20Sopenharmony_ci#define CX88_BOARD_PROLINK_PLAYTVPVR 11 1528c2ecf20Sopenharmony_ci#define CX88_BOARD_ASUS_PVR_416 12 1538c2ecf20Sopenharmony_ci#define CX88_BOARD_MSI_TVANYWHERE 13 1548c2ecf20Sopenharmony_ci#define CX88_BOARD_KWORLD_DVB_T 14 1558c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1 15 1568c2ecf20Sopenharmony_ci#define CX88_BOARD_KWORLD_LTV883 16 1578c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q 17 1588c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_DVB_T1 18 1598c2ecf20Sopenharmony_ci#define CX88_BOARD_CONEXANT_DVB_T1 19 1608c2ecf20Sopenharmony_ci#define CX88_BOARD_PROVIDEO_PV259 20 1618c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21 1628c2ecf20Sopenharmony_ci#define CX88_BOARD_PCHDTV_HD3000 22 1638c2ecf20Sopenharmony_ci#define CX88_BOARD_DNTV_LIVE_DVB_T 23 1648c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_ROSLYN 24 1658c2ecf20Sopenharmony_ci#define CX88_BOARD_DIGITALLOGIC_MEC 25 1668c2ecf20Sopenharmony_ci#define CX88_BOARD_IODATA_GVBCTV7E 26 1678c2ecf20Sopenharmony_ci#define CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO 27 1688c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28 1698c2ecf20Sopenharmony_ci#define CX88_BOARD_ADSTECH_DVB_T_PCI 29 1708c2ecf20Sopenharmony_ci#define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30 1718c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31 1728c2ecf20Sopenharmony_ci#define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550 32 1738c2ecf20Sopenharmony_ci#define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD 33 1748c2ecf20Sopenharmony_ci#define CX88_BOARD_ATI_HDTVWONDER 34 1758c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_DTV1000 35 1768c2ecf20Sopenharmony_ci#define CX88_BOARD_AVERTV_303 36 1778c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1 37 1788c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_NOVASE2_S1 38 1798c2ecf20Sopenharmony_ci#define CX88_BOARD_KWORLD_DVBS_100 39 1808c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_HVR1100 40 1818c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_HVR1100LP 41 1828c2ecf20Sopenharmony_ci#define CX88_BOARD_DNTV_LIVE_DVB_T_PRO 42 1838c2ecf20Sopenharmony_ci#define CX88_BOARD_KWORLD_DVB_T_CX22702 43 1848c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL 44 1858c2ecf20Sopenharmony_ci#define CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT 45 1868c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID 46 1878c2ecf20Sopenharmony_ci#define CX88_BOARD_PCHDTV_HD5500 47 1888c2ecf20Sopenharmony_ci#define CX88_BOARD_KWORLD_MCE200_DELUXE 48 1898c2ecf20Sopenharmony_ci#define CX88_BOARD_PIXELVIEW_PLAYTV_P7000 49 1908c2ecf20Sopenharmony_ci#define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50 1918c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_DTV2000H 51 1928c2ecf20Sopenharmony_ci#define CX88_BOARD_GENIATECH_DVBS 52 1938c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_HVR3000 53 1948c2ecf20Sopenharmony_ci#define CX88_BOARD_NORWOOD_MICRO 54 1958c2ecf20Sopenharmony_ci#define CX88_BOARD_TE_DTV_250_OEM_SWANN 55 1968c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_HVR1300 56 1978c2ecf20Sopenharmony_ci#define CX88_BOARD_ADSTECH_PTV_390 57 1988c2ecf20Sopenharmony_ci#define CX88_BOARD_PINNACLE_PCTV_HD_800i 58 1998c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO 59 2008c2ecf20Sopenharmony_ci#define CX88_BOARD_PINNACLE_HYBRID_PCTV 60 2018c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL 61 2028c2ecf20Sopenharmony_ci#define CX88_BOARD_POWERCOLOR_REAL_ANGEL 62 2038c2ecf20Sopenharmony_ci#define CX88_BOARD_GENIATECH_X8000_MT 63 2048c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO 64 2058c2ecf20Sopenharmony_ci#define CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD 65 2068c2ecf20Sopenharmony_ci#define CX88_BOARD_PROLINK_PV_8000GT 66 2078c2ecf20Sopenharmony_ci#define CX88_BOARD_KWORLD_ATSC_120 67 2088c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_HVR4000 68 2098c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_HVR4000LITE 69 2108c2ecf20Sopenharmony_ci#define CX88_BOARD_TEVII_S460 70 2118c2ecf20Sopenharmony_ci#define CX88_BOARD_OMICOM_SS4_PCI 71 2128c2ecf20Sopenharmony_ci#define CX88_BOARD_TBS_8920 72 2138c2ecf20Sopenharmony_ci#define CX88_BOARD_TEVII_S420 73 2148c2ecf20Sopenharmony_ci#define CX88_BOARD_PROLINK_PV_GLOBAL_XTREME 74 2158c2ecf20Sopenharmony_ci#define CX88_BOARD_PROF_7300 75 2168c2ecf20Sopenharmony_ci#define CX88_BOARD_SATTRADE_ST4200 76 2178c2ecf20Sopenharmony_ci#define CX88_BOARD_TBS_8910 77 2188c2ecf20Sopenharmony_ci#define CX88_BOARD_PROF_6200 78 2198c2ecf20Sopenharmony_ci#define CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII 79 2208c2ecf20Sopenharmony_ci#define CX88_BOARD_HAUPPAUGE_IRONLY 80 2218c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_DTV1800H 81 2228c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_DTV2000H_J 82 2238c2ecf20Sopenharmony_ci#define CX88_BOARD_PROF_7301 83 2248c2ecf20Sopenharmony_ci#define CX88_BOARD_SAMSUNG_SMT_7020 84 2258c2ecf20Sopenharmony_ci#define CX88_BOARD_TWINHAN_VP1027_DVBS 85 2268c2ecf20Sopenharmony_ci#define CX88_BOARD_TEVII_S464 86 2278c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_DTV2000H_PLUS 87 2288c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_DTV1800H_XC4000 88 2298c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F36 89 2308c2ecf20Sopenharmony_ci#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F43 90 2318c2ecf20Sopenharmony_ci#define CX88_BOARD_NOTONLYTV_LV3H 91 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_cienum cx88_itype { 2348c2ecf20Sopenharmony_ci CX88_VMUX_COMPOSITE1 = 1, 2358c2ecf20Sopenharmony_ci CX88_VMUX_COMPOSITE2, 2368c2ecf20Sopenharmony_ci CX88_VMUX_COMPOSITE3, 2378c2ecf20Sopenharmony_ci CX88_VMUX_COMPOSITE4, 2388c2ecf20Sopenharmony_ci CX88_VMUX_SVIDEO, 2398c2ecf20Sopenharmony_ci CX88_VMUX_TELEVISION, 2408c2ecf20Sopenharmony_ci CX88_VMUX_CABLE, 2418c2ecf20Sopenharmony_ci CX88_VMUX_DVB, 2428c2ecf20Sopenharmony_ci CX88_VMUX_DEBUG, 2438c2ecf20Sopenharmony_ci CX88_RADIO, 2448c2ecf20Sopenharmony_ci}; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_cistruct cx88_input { 2478c2ecf20Sopenharmony_ci enum cx88_itype type; 2488c2ecf20Sopenharmony_ci u32 gpio0, gpio1, gpio2, gpio3; 2498c2ecf20Sopenharmony_ci unsigned int vmux:2; 2508c2ecf20Sopenharmony_ci unsigned int audioroute:4; 2518c2ecf20Sopenharmony_ci}; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_cienum cx88_audio_chip { 2548c2ecf20Sopenharmony_ci CX88_AUDIO_WM8775 = 1, 2558c2ecf20Sopenharmony_ci CX88_AUDIO_TVAUDIO, 2568c2ecf20Sopenharmony_ci}; 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistruct cx88_board { 2598c2ecf20Sopenharmony_ci const char *name; 2608c2ecf20Sopenharmony_ci unsigned int tuner_type; 2618c2ecf20Sopenharmony_ci unsigned int radio_type; 2628c2ecf20Sopenharmony_ci unsigned char tuner_addr; 2638c2ecf20Sopenharmony_ci unsigned char radio_addr; 2648c2ecf20Sopenharmony_ci int tda9887_conf; 2658c2ecf20Sopenharmony_ci struct cx88_input input[MAX_CX88_INPUT]; 2668c2ecf20Sopenharmony_ci struct cx88_input radio; 2678c2ecf20Sopenharmony_ci enum cx88_board_type mpeg; 2688c2ecf20Sopenharmony_ci enum cx88_audio_chip audio_chip; 2698c2ecf20Sopenharmony_ci int num_frontends; 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci /* Used for I2S devices */ 2728c2ecf20Sopenharmony_ci int i2sinputcntl; 2738c2ecf20Sopenharmony_ci}; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_cistruct cx88_subid { 2768c2ecf20Sopenharmony_ci u16 subvendor; 2778c2ecf20Sopenharmony_ci u16 subdevice; 2788c2ecf20Sopenharmony_ci u32 card; 2798c2ecf20Sopenharmony_ci}; 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_cienum cx88_tvaudio { 2828c2ecf20Sopenharmony_ci WW_NONE = 1, 2838c2ecf20Sopenharmony_ci WW_BTSC, 2848c2ecf20Sopenharmony_ci WW_BG, 2858c2ecf20Sopenharmony_ci WW_DK, 2868c2ecf20Sopenharmony_ci WW_I, 2878c2ecf20Sopenharmony_ci WW_L, 2888c2ecf20Sopenharmony_ci WW_EIAJ, 2898c2ecf20Sopenharmony_ci WW_I2SPT, 2908c2ecf20Sopenharmony_ci WW_FM, 2918c2ecf20Sopenharmony_ci WW_I2SADC, 2928c2ecf20Sopenharmony_ci WW_M 2938c2ecf20Sopenharmony_ci}; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci#define INPUT(nr) (core->board.input[nr]) 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 2988c2ecf20Sopenharmony_ci/* device / file handle status */ 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci#define RESOURCE_OVERLAY 1 3018c2ecf20Sopenharmony_ci#define RESOURCE_VIDEO 2 3028c2ecf20Sopenharmony_ci#define RESOURCE_VBI 4 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci#define BUFFER_TIMEOUT msecs_to_jiffies(2000) 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_cistruct cx88_riscmem { 3078c2ecf20Sopenharmony_ci unsigned int size; 3088c2ecf20Sopenharmony_ci __le32 *cpu; 3098c2ecf20Sopenharmony_ci __le32 *jmp; 3108c2ecf20Sopenharmony_ci dma_addr_t dma; 3118c2ecf20Sopenharmony_ci}; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci/* buffer for one video frame */ 3148c2ecf20Sopenharmony_cistruct cx88_buffer { 3158c2ecf20Sopenharmony_ci /* common v4l buffer stuff -- must be first */ 3168c2ecf20Sopenharmony_ci struct vb2_v4l2_buffer vb; 3178c2ecf20Sopenharmony_ci struct list_head list; 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci /* cx88 specific */ 3208c2ecf20Sopenharmony_ci unsigned int bpl; 3218c2ecf20Sopenharmony_ci struct cx88_riscmem risc; 3228c2ecf20Sopenharmony_ci}; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_cistruct cx88_dmaqueue { 3258c2ecf20Sopenharmony_ci struct list_head active; 3268c2ecf20Sopenharmony_ci u32 count; 3278c2ecf20Sopenharmony_ci}; 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_cistruct cx8800_dev; 3308c2ecf20Sopenharmony_cistruct cx8802_dev; 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_cistruct cx88_core { 3338c2ecf20Sopenharmony_ci struct list_head devlist; 3348c2ecf20Sopenharmony_ci refcount_t refcount; 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci /* board name */ 3378c2ecf20Sopenharmony_ci int nr; 3388c2ecf20Sopenharmony_ci char name[32]; 3398c2ecf20Sopenharmony_ci u32 model; 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci /* pci stuff */ 3428c2ecf20Sopenharmony_ci int pci_bus; 3438c2ecf20Sopenharmony_ci int pci_slot; 3448c2ecf20Sopenharmony_ci u32 __iomem *lmmio; 3458c2ecf20Sopenharmony_ci u8 __iomem *bmmio; 3468c2ecf20Sopenharmony_ci u32 shadow[SHADOW_MAX]; 3478c2ecf20Sopenharmony_ci int pci_irqmask; 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci /* i2c i/o */ 3508c2ecf20Sopenharmony_ci struct i2c_adapter i2c_adap; 3518c2ecf20Sopenharmony_ci struct i2c_algo_bit_data i2c_algo; 3528c2ecf20Sopenharmony_ci struct i2c_client i2c_client; 3538c2ecf20Sopenharmony_ci u32 i2c_state, i2c_rc; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci /* config info -- analog */ 3568c2ecf20Sopenharmony_ci struct v4l2_device v4l2_dev; 3578c2ecf20Sopenharmony_ci struct v4l2_ctrl_handler video_hdl; 3588c2ecf20Sopenharmony_ci struct v4l2_ctrl *chroma_agc; 3598c2ecf20Sopenharmony_ci struct v4l2_ctrl_handler audio_hdl; 3608c2ecf20Sopenharmony_ci struct v4l2_subdev *sd_wm8775; 3618c2ecf20Sopenharmony_ci struct i2c_client *i2c_rtc; 3628c2ecf20Sopenharmony_ci unsigned int boardnr; 3638c2ecf20Sopenharmony_ci struct cx88_board board; 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_ci /* Supported V4L _STD_ tuner formats */ 3668c2ecf20Sopenharmony_ci unsigned int tuner_formats; 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci /* config info -- dvb */ 3698c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_VIDEO_CX88_DVB) 3708c2ecf20Sopenharmony_ci int (*prev_set_voltage)(struct dvb_frontend *fe, 3718c2ecf20Sopenharmony_ci enum fe_sec_voltage voltage); 3728c2ecf20Sopenharmony_ci#endif 3738c2ecf20Sopenharmony_ci void (*gate_ctrl)(struct cx88_core *core, int open); 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_ci /* state info */ 3768c2ecf20Sopenharmony_ci struct task_struct *kthread; 3778c2ecf20Sopenharmony_ci v4l2_std_id tvnorm; 3788c2ecf20Sopenharmony_ci unsigned int width, height; 3798c2ecf20Sopenharmony_ci unsigned int field; 3808c2ecf20Sopenharmony_ci enum cx88_tvaudio tvaudio; 3818c2ecf20Sopenharmony_ci u32 audiomode_manual; 3828c2ecf20Sopenharmony_ci u32 audiomode_current; 3838c2ecf20Sopenharmony_ci u32 input; 3848c2ecf20Sopenharmony_ci u32 last_analog_input; 3858c2ecf20Sopenharmony_ci u32 astat; 3868c2ecf20Sopenharmony_ci u32 use_nicam; 3878c2ecf20Sopenharmony_ci unsigned long last_change; 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci /* IR remote control state */ 3908c2ecf20Sopenharmony_ci struct cx88_IR *ir; 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci /* I2C remote data */ 3938c2ecf20Sopenharmony_ci struct IR_i2c_init_data init_data; 3948c2ecf20Sopenharmony_ci struct wm8775_platform_data wm8775_data; 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci struct mutex lock; 3978c2ecf20Sopenharmony_ci /* various v4l controls */ 3988c2ecf20Sopenharmony_ci u32 freq; 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci /* 4018c2ecf20Sopenharmony_ci * cx88-video needs to access cx8802 for hybrid tuner pll access and 4028c2ecf20Sopenharmony_ci * for vb2_is_busy() checks. 4038c2ecf20Sopenharmony_ci */ 4048c2ecf20Sopenharmony_ci struct cx8802_dev *dvbdev; 4058c2ecf20Sopenharmony_ci /* cx88-blackbird needs to access cx8800 for vb2_is_busy() checks */ 4068c2ecf20Sopenharmony_ci struct cx8800_dev *v4ldev; 4078c2ecf20Sopenharmony_ci enum cx88_board_type active_type_id; 4088c2ecf20Sopenharmony_ci int active_ref; 4098c2ecf20Sopenharmony_ci int active_fe_id; 4108c2ecf20Sopenharmony_ci}; 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_cistatic inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev) 4138c2ecf20Sopenharmony_ci{ 4148c2ecf20Sopenharmony_ci return container_of(v4l2_dev, struct cx88_core, v4l2_dev); 4158c2ecf20Sopenharmony_ci} 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_ci#define call_hw(core, grpid, o, f, args...) \ 4188c2ecf20Sopenharmony_ci do { \ 4198c2ecf20Sopenharmony_ci if (!core->i2c_rc) { \ 4208c2ecf20Sopenharmony_ci if (core->gate_ctrl) \ 4218c2ecf20Sopenharmony_ci core->gate_ctrl(core, 1); \ 4228c2ecf20Sopenharmony_ci v4l2_device_call_all(&core->v4l2_dev, \ 4238c2ecf20Sopenharmony_ci grpid, o, f, ##args); \ 4248c2ecf20Sopenharmony_ci if (core->gate_ctrl) \ 4258c2ecf20Sopenharmony_ci core->gate_ctrl(core, 0); \ 4268c2ecf20Sopenharmony_ci } \ 4278c2ecf20Sopenharmony_ci } while (0) 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args) 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_ci#define WM8775_GID (1 << 0) 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ci#define wm8775_s_ctrl(core, id, val) \ 4348c2ecf20Sopenharmony_ci do { \ 4358c2ecf20Sopenharmony_ci struct v4l2_ctrl *ctrl_ = \ 4368c2ecf20Sopenharmony_ci v4l2_ctrl_find(core->sd_wm8775->ctrl_handler, id);\ 4378c2ecf20Sopenharmony_ci if (ctrl_ && !core->i2c_rc) { \ 4388c2ecf20Sopenharmony_ci if (core->gate_ctrl) \ 4398c2ecf20Sopenharmony_ci core->gate_ctrl(core, 1); \ 4408c2ecf20Sopenharmony_ci v4l2_ctrl_s_ctrl(ctrl_, val); \ 4418c2ecf20Sopenharmony_ci if (core->gate_ctrl) \ 4428c2ecf20Sopenharmony_ci core->gate_ctrl(core, 0); \ 4438c2ecf20Sopenharmony_ci } \ 4448c2ecf20Sopenharmony_ci } while (0) 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci#define wm8775_g_ctrl(core, id) \ 4478c2ecf20Sopenharmony_ci ({ \ 4488c2ecf20Sopenharmony_ci struct v4l2_ctrl *ctrl_ = \ 4498c2ecf20Sopenharmony_ci v4l2_ctrl_find(core->sd_wm8775->ctrl_handler, id);\ 4508c2ecf20Sopenharmony_ci s32 val = 0; \ 4518c2ecf20Sopenharmony_ci if (ctrl_ && !core->i2c_rc) { \ 4528c2ecf20Sopenharmony_ci if (core->gate_ctrl) \ 4538c2ecf20Sopenharmony_ci core->gate_ctrl(core, 1); \ 4548c2ecf20Sopenharmony_ci val = v4l2_ctrl_g_ctrl(ctrl_); \ 4558c2ecf20Sopenharmony_ci if (core->gate_ctrl) \ 4568c2ecf20Sopenharmony_ci core->gate_ctrl(core, 0); \ 4578c2ecf20Sopenharmony_ci } \ 4588c2ecf20Sopenharmony_ci val; \ 4598c2ecf20Sopenharmony_ci }) 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 4628c2ecf20Sopenharmony_ci/* function 0: video stuff */ 4638c2ecf20Sopenharmony_ci 4648c2ecf20Sopenharmony_cistruct cx8800_suspend_state { 4658c2ecf20Sopenharmony_ci int disabled; 4668c2ecf20Sopenharmony_ci}; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cistruct cx8800_dev { 4698c2ecf20Sopenharmony_ci struct cx88_core *core; 4708c2ecf20Sopenharmony_ci spinlock_t slock; 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci /* various device info */ 4738c2ecf20Sopenharmony_ci unsigned int resources; 4748c2ecf20Sopenharmony_ci struct video_device video_dev; 4758c2ecf20Sopenharmony_ci struct video_device vbi_dev; 4768c2ecf20Sopenharmony_ci struct video_device radio_dev; 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci /* pci i/o */ 4798c2ecf20Sopenharmony_ci struct pci_dev *pci; 4808c2ecf20Sopenharmony_ci unsigned char pci_rev, pci_lat; 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci const struct cx8800_fmt *fmt; 4838c2ecf20Sopenharmony_ci 4848c2ecf20Sopenharmony_ci /* capture queues */ 4858c2ecf20Sopenharmony_ci struct cx88_dmaqueue vidq; 4868c2ecf20Sopenharmony_ci struct vb2_queue vb2_vidq; 4878c2ecf20Sopenharmony_ci struct cx88_dmaqueue vbiq; 4888c2ecf20Sopenharmony_ci struct vb2_queue vb2_vbiq; 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ci /* various v4l controls */ 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci /* other global state info */ 4938c2ecf20Sopenharmony_ci struct cx8800_suspend_state state; 4948c2ecf20Sopenharmony_ci}; 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 4978c2ecf20Sopenharmony_ci/* function 1: audio/alsa stuff */ 4988c2ecf20Sopenharmony_ci/* =============> moved to cx88-alsa.c <====================== */ 4998c2ecf20Sopenharmony_ci 5008c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 5018c2ecf20Sopenharmony_ci/* function 2: mpeg stuff */ 5028c2ecf20Sopenharmony_ci 5038c2ecf20Sopenharmony_cistruct cx8802_suspend_state { 5048c2ecf20Sopenharmony_ci int disabled; 5058c2ecf20Sopenharmony_ci}; 5068c2ecf20Sopenharmony_ci 5078c2ecf20Sopenharmony_cistruct cx8802_driver { 5088c2ecf20Sopenharmony_ci struct cx88_core *core; 5098c2ecf20Sopenharmony_ci 5108c2ecf20Sopenharmony_ci /* List of drivers attached to device */ 5118c2ecf20Sopenharmony_ci struct list_head drvlist; 5128c2ecf20Sopenharmony_ci 5138c2ecf20Sopenharmony_ci /* Type of driver and access required */ 5148c2ecf20Sopenharmony_ci enum cx88_board_type type_id; 5158c2ecf20Sopenharmony_ci enum cx8802_board_access hw_access; 5168c2ecf20Sopenharmony_ci 5178c2ecf20Sopenharmony_ci /* MPEG 8802 internal only */ 5188c2ecf20Sopenharmony_ci int (*suspend)(struct pci_dev *pci_dev, pm_message_t state); 5198c2ecf20Sopenharmony_ci int (*resume)(struct pci_dev *pci_dev); 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci /* Callers to the following functions must hold core->lock */ 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_ci /* MPEG 8802 -> mini driver - Driver probe and configuration */ 5248c2ecf20Sopenharmony_ci int (*probe)(struct cx8802_driver *drv); 5258c2ecf20Sopenharmony_ci int (*remove)(struct cx8802_driver *drv); 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci /* MPEG 8802 -> mini driver - Access for hardware control */ 5288c2ecf20Sopenharmony_ci int (*advise_acquire)(struct cx8802_driver *drv); 5298c2ecf20Sopenharmony_ci int (*advise_release)(struct cx8802_driver *drv); 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ci /* MPEG 8802 <- mini driver - Access for hardware control */ 5328c2ecf20Sopenharmony_ci int (*request_acquire)(struct cx8802_driver *drv); 5338c2ecf20Sopenharmony_ci int (*request_release)(struct cx8802_driver *drv); 5348c2ecf20Sopenharmony_ci}; 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_cistruct cx8802_dev { 5378c2ecf20Sopenharmony_ci struct cx88_core *core; 5388c2ecf20Sopenharmony_ci spinlock_t slock; 5398c2ecf20Sopenharmony_ci 5408c2ecf20Sopenharmony_ci /* pci i/o */ 5418c2ecf20Sopenharmony_ci struct pci_dev *pci; 5428c2ecf20Sopenharmony_ci unsigned char pci_rev, pci_lat; 5438c2ecf20Sopenharmony_ci 5448c2ecf20Sopenharmony_ci /* dma queues */ 5458c2ecf20Sopenharmony_ci struct cx88_dmaqueue mpegq; 5468c2ecf20Sopenharmony_ci struct vb2_queue vb2_mpegq; 5478c2ecf20Sopenharmony_ci u32 ts_packet_size; 5488c2ecf20Sopenharmony_ci u32 ts_packet_count; 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci /* other global state info */ 5518c2ecf20Sopenharmony_ci struct cx8802_suspend_state state; 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_ci /* for blackbird only */ 5548c2ecf20Sopenharmony_ci struct list_head devlist; 5558c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_VIDEO_CX88_BLACKBIRD) 5568c2ecf20Sopenharmony_ci struct video_device mpeg_dev; 5578c2ecf20Sopenharmony_ci u32 mailbox; 5588c2ecf20Sopenharmony_ci 5598c2ecf20Sopenharmony_ci /* mpeg params */ 5608c2ecf20Sopenharmony_ci struct cx2341x_handler cxhdl; 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_ci#endif 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_VIDEO_CX88_DVB) 5658c2ecf20Sopenharmony_ci /* for dvb only */ 5668c2ecf20Sopenharmony_ci struct vb2_dvb_frontends frontends; 5678c2ecf20Sopenharmony_ci#endif 5688c2ecf20Sopenharmony_ci 5698c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_VIDEO_CX88_VP3054) 5708c2ecf20Sopenharmony_ci /* For VP3045 secondary I2C bus support */ 5718c2ecf20Sopenharmony_ci struct vp3054_i2c_state *vp3054; 5728c2ecf20Sopenharmony_ci#endif 5738c2ecf20Sopenharmony_ci /* for switching modulation types */ 5748c2ecf20Sopenharmony_ci unsigned char ts_gen_cntrl; 5758c2ecf20Sopenharmony_ci 5768c2ecf20Sopenharmony_ci /* List of attached drivers; must hold core->lock to access */ 5778c2ecf20Sopenharmony_ci struct list_head drvlist; 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_ci struct work_struct request_module_wk; 5808c2ecf20Sopenharmony_ci}; 5818c2ecf20Sopenharmony_ci 5828c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 5838c2ecf20Sopenharmony_ci 5848c2ecf20Sopenharmony_ci#define cx_read(reg) readl(core->lmmio + ((reg) >> 2)) 5858c2ecf20Sopenharmony_ci#define cx_write(reg, value) writel((value), core->lmmio + ((reg) >> 2)) 5868c2ecf20Sopenharmony_ci#define cx_writeb(reg, value) writeb((value), core->bmmio + (reg)) 5878c2ecf20Sopenharmony_ci 5888c2ecf20Sopenharmony_ci#define cx_andor(reg, mask, value) \ 5898c2ecf20Sopenharmony_ci writel((readl(core->lmmio + ((reg) >> 2)) & ~(mask)) |\ 5908c2ecf20Sopenharmony_ci ((value) & (mask)), core->lmmio + ((reg) >> 2)) 5918c2ecf20Sopenharmony_ci#define cx_set(reg, bit) cx_andor((reg), (bit), (bit)) 5928c2ecf20Sopenharmony_ci#define cx_clear(reg, bit) cx_andor((reg), (bit), 0) 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_ci#define cx_wait(d) { if (need_resched()) schedule(); else udelay(d); } 5958c2ecf20Sopenharmony_ci 5968c2ecf20Sopenharmony_ci/* shadow registers */ 5978c2ecf20Sopenharmony_ci#define cx_sread(sreg) (core->shadow[sreg]) 5988c2ecf20Sopenharmony_ci#define cx_swrite(sreg, reg, value) \ 5998c2ecf20Sopenharmony_ci (core->shadow[sreg] = value, \ 6008c2ecf20Sopenharmony_ci writel(core->shadow[sreg], core->lmmio + ((reg) >> 2))) 6018c2ecf20Sopenharmony_ci#define cx_sandor(sreg, reg, mask, value) \ 6028c2ecf20Sopenharmony_ci (core->shadow[sreg] = (core->shadow[sreg] & ~(mask)) | \ 6038c2ecf20Sopenharmony_ci ((value) & (mask)), \ 6048c2ecf20Sopenharmony_ci writel(core->shadow[sreg], \ 6058c2ecf20Sopenharmony_ci core->lmmio + ((reg) >> 2))) 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 6088c2ecf20Sopenharmony_ci/* cx88-core.c */ 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_ciextern unsigned int cx88_core_debug; 6118c2ecf20Sopenharmony_ci 6128c2ecf20Sopenharmony_civoid cx88_print_irqbits(const char *tag, const char *strings[], 6138c2ecf20Sopenharmony_ci int len, u32 bits, u32 mask); 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ciint cx88_core_irq(struct cx88_core *core, u32 status); 6168c2ecf20Sopenharmony_civoid cx88_wakeup(struct cx88_core *core, 6178c2ecf20Sopenharmony_ci struct cx88_dmaqueue *q, u32 count); 6188c2ecf20Sopenharmony_civoid cx88_shutdown(struct cx88_core *core); 6198c2ecf20Sopenharmony_ciint cx88_reset(struct cx88_core *core); 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_ciextern int 6228c2ecf20Sopenharmony_cicx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc, 6238c2ecf20Sopenharmony_ci struct scatterlist *sglist, 6248c2ecf20Sopenharmony_ci unsigned int top_offset, unsigned int bottom_offset, 6258c2ecf20Sopenharmony_ci unsigned int bpl, unsigned int padding, unsigned int lines); 6268c2ecf20Sopenharmony_ciextern int 6278c2ecf20Sopenharmony_cicx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc, 6288c2ecf20Sopenharmony_ci struct scatterlist *sglist, unsigned int bpl, 6298c2ecf20Sopenharmony_ci unsigned int lines, unsigned int lpi); 6308c2ecf20Sopenharmony_ci 6318c2ecf20Sopenharmony_civoid cx88_risc_disasm(struct cx88_core *core, 6328c2ecf20Sopenharmony_ci struct cx88_riscmem *risc); 6338c2ecf20Sopenharmony_ciint cx88_sram_channel_setup(struct cx88_core *core, 6348c2ecf20Sopenharmony_ci const struct sram_channel *ch, 6358c2ecf20Sopenharmony_ci unsigned int bpl, u32 risc); 6368c2ecf20Sopenharmony_civoid cx88_sram_channel_dump(struct cx88_core *core, 6378c2ecf20Sopenharmony_ci const struct sram_channel *ch); 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ciint cx88_set_scale(struct cx88_core *core, unsigned int width, 6408c2ecf20Sopenharmony_ci unsigned int height, enum v4l2_field field); 6418c2ecf20Sopenharmony_ciint cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm); 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_civoid cx88_vdev_init(struct cx88_core *core, 6448c2ecf20Sopenharmony_ci struct pci_dev *pci, 6458c2ecf20Sopenharmony_ci struct video_device *vfd, 6468c2ecf20Sopenharmony_ci const struct video_device *template_, 6478c2ecf20Sopenharmony_ci const char *type); 6488c2ecf20Sopenharmony_cistruct cx88_core *cx88_core_get(struct pci_dev *pci); 6498c2ecf20Sopenharmony_civoid cx88_core_put(struct cx88_core *core, 6508c2ecf20Sopenharmony_ci struct pci_dev *pci); 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ciint cx88_start_audio_dma(struct cx88_core *core); 6538c2ecf20Sopenharmony_ciint cx88_stop_audio_dma(struct cx88_core *core); 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 6568c2ecf20Sopenharmony_ci/* cx88-vbi.c */ 6578c2ecf20Sopenharmony_ci 6588c2ecf20Sopenharmony_ci/* Can be used as g_vbi_fmt, try_vbi_fmt and s_vbi_fmt */ 6598c2ecf20Sopenharmony_ciint cx8800_vbi_fmt(struct file *file, void *priv, 6608c2ecf20Sopenharmony_ci struct v4l2_format *f); 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_civoid cx8800_stop_vbi_dma(struct cx8800_dev *dev); 6638c2ecf20Sopenharmony_ciint cx8800_restart_vbi_queue(struct cx8800_dev *dev, struct cx88_dmaqueue *q); 6648c2ecf20Sopenharmony_ci 6658c2ecf20Sopenharmony_ciextern const struct vb2_ops cx8800_vbi_qops; 6668c2ecf20Sopenharmony_ci 6678c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 6688c2ecf20Sopenharmony_ci/* cx88-i2c.c */ 6698c2ecf20Sopenharmony_ci 6708c2ecf20Sopenharmony_ciint cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci); 6718c2ecf20Sopenharmony_ci 6728c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 6738c2ecf20Sopenharmony_ci/* cx88-cards.c */ 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_ciint cx88_tuner_callback(void *dev, int component, int command, int arg); 6768c2ecf20Sopenharmony_ciint cx88_get_resources(const struct cx88_core *core, 6778c2ecf20Sopenharmony_ci struct pci_dev *pci); 6788c2ecf20Sopenharmony_cistruct cx88_core *cx88_core_create(struct pci_dev *pci, int nr); 6798c2ecf20Sopenharmony_civoid cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl); 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 6828c2ecf20Sopenharmony_ci/* cx88-tvaudio.c */ 6838c2ecf20Sopenharmony_ci 6848c2ecf20Sopenharmony_civoid cx88_set_tvaudio(struct cx88_core *core); 6858c2ecf20Sopenharmony_civoid cx88_newstation(struct cx88_core *core); 6868c2ecf20Sopenharmony_civoid cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t); 6878c2ecf20Sopenharmony_civoid cx88_set_stereo(struct cx88_core *core, u32 mode, int manual); 6888c2ecf20Sopenharmony_ciint cx88_audio_thread(void *data); 6898c2ecf20Sopenharmony_ci 6908c2ecf20Sopenharmony_ciint cx8802_register_driver(struct cx8802_driver *drv); 6918c2ecf20Sopenharmony_ciint cx8802_unregister_driver(struct cx8802_driver *drv); 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_ci/* Caller must hold core->lock */ 6948c2ecf20Sopenharmony_cistruct cx8802_driver *cx8802_get_driver(struct cx8802_dev *dev, 6958c2ecf20Sopenharmony_ci enum cx88_board_type btype); 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 6988c2ecf20Sopenharmony_ci/* cx88-dsp.c */ 6998c2ecf20Sopenharmony_ci 7008c2ecf20Sopenharmony_cis32 cx88_dsp_detect_stereo_sap(struct cx88_core *core); 7018c2ecf20Sopenharmony_ci 7028c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 7038c2ecf20Sopenharmony_ci/* cx88-input.c */ 7048c2ecf20Sopenharmony_ci 7058c2ecf20Sopenharmony_ciint cx88_ir_init(struct cx88_core *core, struct pci_dev *pci); 7068c2ecf20Sopenharmony_ciint cx88_ir_fini(struct cx88_core *core); 7078c2ecf20Sopenharmony_civoid cx88_ir_irq(struct cx88_core *core); 7088c2ecf20Sopenharmony_ciint cx88_ir_start(struct cx88_core *core); 7098c2ecf20Sopenharmony_civoid cx88_ir_stop(struct cx88_core *core); 7108c2ecf20Sopenharmony_civoid cx88_i2c_init_ir(struct cx88_core *core); 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 7138c2ecf20Sopenharmony_ci/* cx88-mpeg.c */ 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ciint cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev, 7168c2ecf20Sopenharmony_ci struct cx88_buffer *buf); 7178c2ecf20Sopenharmony_civoid cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf); 7188c2ecf20Sopenharmony_civoid cx8802_cancel_buffers(struct cx8802_dev *dev); 7198c2ecf20Sopenharmony_ciint cx8802_start_dma(struct cx8802_dev *dev, 7208c2ecf20Sopenharmony_ci struct cx88_dmaqueue *q, 7218c2ecf20Sopenharmony_ci struct cx88_buffer *buf); 7228c2ecf20Sopenharmony_ci 7238c2ecf20Sopenharmony_ci/* ----------------------------------------------------------- */ 7248c2ecf20Sopenharmony_ci/* cx88-video.c*/ 7258c2ecf20Sopenharmony_ciint cx88_enum_input(struct cx88_core *core, struct v4l2_input *i); 7268c2ecf20Sopenharmony_ciint cx88_set_freq(struct cx88_core *core, const struct v4l2_frequency *f); 7278c2ecf20Sopenharmony_ciint cx88_video_mux(struct cx88_core *core, unsigned int input); 7288c2ecf20Sopenharmony_ciint cx88_querycap(struct file *file, struct cx88_core *core, 7298c2ecf20Sopenharmony_ci struct v4l2_capability *cap); 7308c2ecf20Sopenharmony_ci 7318c2ecf20Sopenharmony_ci#endif 732