1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * altera-ci.c
4  *
5  *  CI driver in conjunction with NetUp Dual DVB-T/C RF CI card
6  *
7  * Copyright (C) 2010 NetUP Inc.
8  * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
9  */
10 #ifndef __ALTERA_CI_H
11 #define __ALTERA_CI_H
12 
13 #define ALT_DATA	0x000000ff
14 #define ALT_TDI		0x00008000
15 #define ALT_TDO		0x00004000
16 #define ALT_TCK		0x00002000
17 #define ALT_RDY		0x00001000
18 #define ALT_RD		0x00000800
19 #define ALT_WR		0x00000400
20 #define ALT_AD_RG	0x00000200
21 #define ALT_CS		0x00000100
22 
23 struct altera_ci_config {
24 	void *dev;/* main dev, for example cx23885_dev */
25 	void *adapter;/* for CI to connect to */
26 	struct dvb_demux *demux;/* for hardware PID filter to connect to */
27 	int (*fpga_rw) (void *dev, int ad_rg, int val, int rw);
28 };
29 
30 #if IS_REACHABLE(CONFIG_MEDIA_ALTERA_CI)
31 
32 extern int altera_ci_init(struct altera_ci_config *config, int ci_nr);
33 extern void altera_ci_release(void *dev, int ci_nr);
34 extern int altera_ci_irq(void *dev);
35 extern int altera_ci_tuner_reset(void *dev, int ci_nr);
36 
37 #else
38 
altera_ci_init(struct altera_ci_config * config,int ci_nr)39 static inline int altera_ci_init(struct altera_ci_config *config, int ci_nr)
40 {
41 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
42 	return 0;
43 }
44 
altera_ci_release(void * dev,int ci_nr)45 static inline void altera_ci_release(void *dev, int ci_nr)
46 {
47 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
48 }
49 
altera_ci_irq(void * dev)50 static inline int altera_ci_irq(void *dev)
51 {
52 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
53 	return 0;
54 }
55 
altera_ci_tuner_reset(void * dev,int ci_nr)56 static inline int altera_ci_tuner_reset(void *dev, int ci_nr)
57 {
58 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
59 	return 0;
60 }
61 
62 #endif
63 #if 0
64 static inline int altera_hw_filt_init(struct altera_ci_config *config,
65 							int hw_filt_nr)
66 {
67 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
68 	return 0;
69 }
70 
71 static inline void altera_hw_filt_release(void *dev, int filt_nr)
72 {
73 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
74 }
75 
76 static inline int altera_pid_feed_control(void *dev, int filt_nr,
77 		struct dvb_demux_feed *dvbdmxfeed, int onoff)
78 {
79 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
80 	return 0;
81 }
82 
83 #endif /* CONFIG_MEDIA_ALTERA_CI */
84 
85 #endif /* __ALTERA_CI_H */
86