^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) * Support for LGDT3306A - 8VSB/QAM-B
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2013,2014 Fred Richter <frichter@hauppauge.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * based on lgdt3305.[ch] by Michael Krufky
^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) #ifndef _LGDT3306A_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _LGDT3306A_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <media/dvb_frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) enum lgdt3306a_mpeg_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) LGDT3306A_MPEG_PARALLEL = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) LGDT3306A_MPEG_SERIAL = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) enum lgdt3306a_tp_clock_edge {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) LGDT3306A_TPCLK_RISING_EDGE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) LGDT3306A_TPCLK_FALLING_EDGE = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) enum lgdt3306a_tp_valid_polarity {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) LGDT3306A_TP_VALID_LOW = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) LGDT3306A_TP_VALID_HIGH = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct lgdt3306a_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) u8 i2c_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* user defined IF frequency in KHz */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u16 qam_if_khz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u16 vsb_if_khz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* disable i2c repeater - 0:repeater enabled 1:repeater disabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) unsigned int deny_i2c_rptr:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* spectral inversion - 0:disabled 1:enabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned int spectral_inversion:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) enum lgdt3306a_mpeg_mode mpeg_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) enum lgdt3306a_tp_clock_edge tpclk_edge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) enum lgdt3306a_tp_valid_polarity tpvalid_polarity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /* demod clock freq in MHz; 24 or 25 supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int xtalMHz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /* returned by driver if using i2c bus multiplexing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct dvb_frontend **fe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct i2c_adapter **i2c_adapter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #if IS_REACHABLE(CONFIG_DVB_LGDT3306A)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct i2c_adapter *i2c_adap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct i2c_adapter *i2c_adap)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #endif /* CONFIG_DVB_LGDT3306A */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #endif /* _LGDT3306A_H_ */