18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * altera-ci.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  CI driver in conjunction with NetUp Dual DVB-T/C RF CI card
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2010 NetUP Inc.
88c2ecf20Sopenharmony_ci * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifndef __ALTERA_CI_H
118c2ecf20Sopenharmony_ci#define __ALTERA_CI_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define ALT_DATA	0x000000ff
148c2ecf20Sopenharmony_ci#define ALT_TDI		0x00008000
158c2ecf20Sopenharmony_ci#define ALT_TDO		0x00004000
168c2ecf20Sopenharmony_ci#define ALT_TCK		0x00002000
178c2ecf20Sopenharmony_ci#define ALT_RDY		0x00001000
188c2ecf20Sopenharmony_ci#define ALT_RD		0x00000800
198c2ecf20Sopenharmony_ci#define ALT_WR		0x00000400
208c2ecf20Sopenharmony_ci#define ALT_AD_RG	0x00000200
218c2ecf20Sopenharmony_ci#define ALT_CS		0x00000100
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistruct altera_ci_config {
248c2ecf20Sopenharmony_ci	void *dev;/* main dev, for example cx23885_dev */
258c2ecf20Sopenharmony_ci	void *adapter;/* for CI to connect to */
268c2ecf20Sopenharmony_ci	struct dvb_demux *demux;/* for hardware PID filter to connect to */
278c2ecf20Sopenharmony_ci	int (*fpga_rw) (void *dev, int ad_rg, int val, int rw);
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_MEDIA_ALTERA_CI)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciextern int altera_ci_init(struct altera_ci_config *config, int ci_nr);
338c2ecf20Sopenharmony_ciextern void altera_ci_release(void *dev, int ci_nr);
348c2ecf20Sopenharmony_ciextern int altera_ci_irq(void *dev);
358c2ecf20Sopenharmony_ciextern int altera_ci_tuner_reset(void *dev, int ci_nr);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#else
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistatic inline int altera_ci_init(struct altera_ci_config *config, int ci_nr)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
428c2ecf20Sopenharmony_ci	return 0;
438c2ecf20Sopenharmony_ci}
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistatic inline void altera_ci_release(void *dev, int ci_nr)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
488c2ecf20Sopenharmony_ci}
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cistatic inline int altera_ci_irq(void *dev)
518c2ecf20Sopenharmony_ci{
528c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
538c2ecf20Sopenharmony_ci	return 0;
548c2ecf20Sopenharmony_ci}
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistatic inline int altera_ci_tuner_reset(void *dev, int ci_nr)
578c2ecf20Sopenharmony_ci{
588c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
598c2ecf20Sopenharmony_ci	return 0;
608c2ecf20Sopenharmony_ci}
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#endif
638c2ecf20Sopenharmony_ci#if 0
648c2ecf20Sopenharmony_cistatic inline int altera_hw_filt_init(struct altera_ci_config *config,
658c2ecf20Sopenharmony_ci							int hw_filt_nr)
668c2ecf20Sopenharmony_ci{
678c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
688c2ecf20Sopenharmony_ci	return 0;
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistatic inline void altera_hw_filt_release(void *dev, int filt_nr)
728c2ecf20Sopenharmony_ci{
738c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
748c2ecf20Sopenharmony_ci}
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_cistatic inline int altera_pid_feed_control(void *dev, int filt_nr,
778c2ecf20Sopenharmony_ci		struct dvb_demux_feed *dvbdmxfeed, int onoff)
788c2ecf20Sopenharmony_ci{
798c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
808c2ecf20Sopenharmony_ci	return 0;
818c2ecf20Sopenharmony_ci}
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#endif /* CONFIG_MEDIA_ALTERA_CI */
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#endif /* __ALTERA_CI_H */
86