^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) Driver for ST STV0288 demodulator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Copyright (C) 2006 Georg Acher, BayCom GmbH, acher (at) baycom (dot) de
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) for Reel Multimedia
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) Copyright (C) 2008 TurboSight.com, <bob@turbosight.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) Copyright (C) 2008 Igor M. Liplianin <liplianin@me.by>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) Removed stb6000 specific tuner code and revised some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) procedures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #ifndef STV0288_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define STV0288_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/dvb/frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <media/dvb_frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct stv0288_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* the demodulator's i2c address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) u8 demod_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) u8* inittab;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* minimum delay before retuning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int min_delay_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #if IS_REACHABLE(CONFIG_DVB_STV0288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct i2c_adapter *i2c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static inline struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct i2c_adapter *i2c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #endif /* CONFIG_DVB_STV0288 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static inline int stv0288_writereg(struct dvb_frontend *fe, u8 reg, u8 val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int r = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) u8 buf[] = { reg, val };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) if (fe->ops.write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) r = fe->ops.write(fe, buf, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) return r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #endif /* STV0288_H */