18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci#ifndef __BUDGET_DVB__ 48c2ecf20Sopenharmony_ci#define __BUDGET_DVB__ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h> 78c2ecf20Sopenharmony_ci#include <media/dvbdev.h> 88c2ecf20Sopenharmony_ci#include <media/demux.h> 98c2ecf20Sopenharmony_ci#include <media/dvb_demux.h> 108c2ecf20Sopenharmony_ci#include <media/dmxdev.h> 118c2ecf20Sopenharmony_ci#include "dvb_filter.h" 128c2ecf20Sopenharmony_ci#include <media/dvb_net.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <linux/module.h> 158c2ecf20Sopenharmony_ci#include <linux/mutex.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <media/drv-intf/saa7146.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciextern int budget_debug; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#ifdef dprintk 228c2ecf20Sopenharmony_ci#undef dprintk 238c2ecf20Sopenharmony_ci#endif 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define dprintk(level, fmt, arg...) do { \ 268c2ecf20Sopenharmony_ci if (level & budget_debug) \ 278c2ecf20Sopenharmony_ci printk(KERN_DEBUG KBUILD_MODNAME ": %s(): " fmt, \ 288c2ecf20Sopenharmony_ci __func__, ##arg); \ 298c2ecf20Sopenharmony_ci} while (0) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_cistruct budget_info { 338c2ecf20Sopenharmony_ci char *name; 348c2ecf20Sopenharmony_ci int type; 358c2ecf20Sopenharmony_ci}; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* place to store all the necessary device information */ 388c2ecf20Sopenharmony_cistruct budget { 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci /* devices */ 418c2ecf20Sopenharmony_ci struct dvb_device dvb_dev; 428c2ecf20Sopenharmony_ci struct dvb_net dvb_net; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci struct saa7146_dev *dev; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci struct i2c_adapter i2c_adap; 478c2ecf20Sopenharmony_ci struct budget_info *card; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci unsigned char *grabbing; 508c2ecf20Sopenharmony_ci struct saa7146_pgtable pt; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci struct tasklet_struct fidb_tasklet; 538c2ecf20Sopenharmony_ci struct tasklet_struct vpe_tasklet; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci struct dmxdev dmxdev; 568c2ecf20Sopenharmony_ci struct dvb_demux demux; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci struct dmx_frontend hw_frontend; 598c2ecf20Sopenharmony_ci struct dmx_frontend mem_frontend; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci int ci_present; 628c2ecf20Sopenharmony_ci int video_port; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci u32 buffer_width; 658c2ecf20Sopenharmony_ci u32 buffer_height; 668c2ecf20Sopenharmony_ci u32 buffer_size; 678c2ecf20Sopenharmony_ci u32 buffer_warning_threshold; 688c2ecf20Sopenharmony_ci u32 buffer_warnings; 698c2ecf20Sopenharmony_ci unsigned long buffer_warning_time; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci u32 ttbp; 728c2ecf20Sopenharmony_ci int feeding; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci spinlock_t feedlock; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci spinlock_t debilock; 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci struct dvb_adapter dvb_adapter; 798c2ecf20Sopenharmony_ci struct dvb_frontend *dvb_frontend; 808c2ecf20Sopenharmony_ci int (*read_fe_status)(struct dvb_frontend *fe, enum fe_status *status); 818c2ecf20Sopenharmony_ci int fe_synced; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci void *priv; 848c2ecf20Sopenharmony_ci}; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define MAKE_BUDGET_INFO(x_var,x_name,x_type) \ 878c2ecf20Sopenharmony_cistatic struct budget_info x_var ## _info = { \ 888c2ecf20Sopenharmony_ci .name=x_name, \ 898c2ecf20Sopenharmony_ci .type=x_type }; \ 908c2ecf20Sopenharmony_cistatic struct saa7146_pci_extension_data x_var = { \ 918c2ecf20Sopenharmony_ci .ext_priv = &x_var ## _info, \ 928c2ecf20Sopenharmony_ci .ext = &budget_extension }; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci#define BUDGET_TT 0 958c2ecf20Sopenharmony_ci#define BUDGET_TT_HW_DISEQC 1 968c2ecf20Sopenharmony_ci#define BUDGET_PATCH 3 978c2ecf20Sopenharmony_ci#define BUDGET_FS_ACTIVY 4 988c2ecf20Sopenharmony_ci#define BUDGET_CIN1200S 5 998c2ecf20Sopenharmony_ci#define BUDGET_CIN1200C 6 1008c2ecf20Sopenharmony_ci#define BUDGET_CIN1200T 7 1018c2ecf20Sopenharmony_ci#define BUDGET_KNC1S 8 1028c2ecf20Sopenharmony_ci#define BUDGET_KNC1C 9 1038c2ecf20Sopenharmony_ci#define BUDGET_KNC1T 10 1048c2ecf20Sopenharmony_ci#define BUDGET_KNC1SP 11 1058c2ecf20Sopenharmony_ci#define BUDGET_KNC1CP 12 1068c2ecf20Sopenharmony_ci#define BUDGET_KNC1TP 13 1078c2ecf20Sopenharmony_ci#define BUDGET_TVSTAR 14 1088c2ecf20Sopenharmony_ci#define BUDGET_CIN1200C_MK3 15 1098c2ecf20Sopenharmony_ci#define BUDGET_KNC1C_MK3 16 1108c2ecf20Sopenharmony_ci#define BUDGET_KNC1CP_MK3 17 1118c2ecf20Sopenharmony_ci#define BUDGET_KNC1S2 18 1128c2ecf20Sopenharmony_ci#define BUDGET_KNC1C_TDA10024 19 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#define BUDGET_VIDEO_PORTA 0 1158c2ecf20Sopenharmony_ci#define BUDGET_VIDEO_PORTB 1 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ciextern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, 1188c2ecf20Sopenharmony_ci struct saa7146_pci_extension_data *info, 1198c2ecf20Sopenharmony_ci struct module *owner, short *adapter_nums); 1208c2ecf20Sopenharmony_ciextern void ttpci_budget_init_hooks(struct budget *budget); 1218c2ecf20Sopenharmony_ciextern int ttpci_budget_deinit(struct budget *budget); 1228c2ecf20Sopenharmony_ciextern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr); 1238c2ecf20Sopenharmony_ciextern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port); 1248c2ecf20Sopenharmony_ciextern int ttpci_budget_debiread(struct budget *budget, u32 config, int addr, int count, 1258c2ecf20Sopenharmony_ci int uselocks, int nobusyloop); 1268c2ecf20Sopenharmony_ciextern int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr, int count, u32 value, 1278c2ecf20Sopenharmony_ci int uselocks, int nobusyloop); 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#endif 130