^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) Samsung S5H1409 VSB/QAM demodulator driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Copyright (C) 2006 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) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef __S5H1409_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define __S5H1409_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/dvb/frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct s5h1409_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /* the demodulator's i2c address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) u8 demod_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /* serial/parallel output */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define S5H1409_PARALLEL_OUTPUT 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define S5H1409_SERIAL_OUTPUT 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) u8 output_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* GPIO Setting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define S5H1409_GPIO_OFF 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define S5H1409_GPIO_ON 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) u8 gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* IF Freq for QAM in KHz, VSB is hardcoded to 5380 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) u16 qam_if;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* Spectral Inversion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define S5H1409_INVERSION_OFF 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define S5H1409_INVERSION_ON 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u8 inversion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* Return lock status based on tuner lock, or demod lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define S5H1409_TUNERLOCKING 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define S5H1409_DEMODLOCKING 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) u8 status_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /* MPEG signal timing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define S5H1409_MPEGTIMING_CONTINUOUS_INVERTING_CLOCK 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define S5H1409_MPEGTIMING_CONTINUOUS_NONINVERTING_CLOCK 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define S5H1409_MPEGTIMING_NONCONTINUOUS_INVERTING_CLOCK 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define S5H1409_MPEGTIMING_NONCONTINUOUS_NONINVERTING_CLOCK 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) u16 mpeg_timing;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* HVR-1600 optimizations (to better work with MXL5005s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) Note: some of these are likely to be folded into the generic driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) after being regression tested with other boards */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define S5H1409_HVR1600_NOOPTIMIZE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define S5H1409_HVR1600_OPTIMIZE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) u8 hvr1600_opt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #if IS_REACHABLE(CONFIG_DVB_S5H1409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) extern struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct i2c_adapter *i2c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static inline struct dvb_frontend *s5h1409_attach(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) const struct s5h1409_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) struct i2c_adapter *i2c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #endif /* CONFIG_DVB_S5H1409 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #endif /* __S5H1409_H__ */