^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 Xceive XC5000 "QAM/8VSB single chip tuner"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef __XC5000_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define __XC5000_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/firmware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct dvb_frontend;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct i2c_adapter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define XC5000A 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define XC5000C 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct xc5000_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) u8 i2c_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) u32 if_khz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) u8 radio_input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) u16 xtal_khz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) u16 output_amp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int chip_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* xc5000 callback command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define XC5000_TUNER_RESET 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* Possible Radio inputs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define XC5000_RADIO_NOT_CONFIGURED 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define XC5000_RADIO_FM1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define XC5000_RADIO_FM2 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define XC5000_RADIO_FM1_MONO 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* For each bridge framework, when it attaches either analog or digital,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * it has to store a reference back to its _core equivalent structure,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * so that it can service the hardware by steering gpio's etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * Each bridge implementation is different so cast devptr accordingly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * The xc5000 driver cares not for this value, other than ensuring
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * it's passed back to a bridge during tuner_callback().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC5000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) extern struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct i2c_adapter *i2c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) const struct xc5000_config *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static inline struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct i2c_adapter *i2c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) const struct xc5000_config *cfg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #endif