103 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 STB6100 Silicon Tuner4 Copyright (C) Manu Abraham (abraham.manu@gmail.com)5 6 Copyright (C) ST Microelectronics7 8*/9 10#ifndef __STB_6100_REG_H11#define __STB_6100_REG_H12 13#include <linux/dvb/frontend.h>14#include <media/dvb_frontend.h>15 16#define STB6100_LD 0x0017#define STB6100_LD_LOCK (1 << 0)18 19#define STB6100_VCO 0x0120#define STB6100_VCO_OSCH (0x01 << 7)21#define STB6100_VCO_OSCH_SHIFT 722#define STB6100_VCO_OCK (0x03 << 5)23#define STB6100_VCO_OCK_SHIFT 524#define STB6100_VCO_ODIV (0x01 << 4)25#define STB6100_VCO_ODIV_SHIFT 426#define STB6100_VCO_OSM (0x0f << 0)27 28#define STB6100_NI 0x0229#define STB6100_NF_LSB 0x0330 31#define STB6100_K 0x0432#define STB6100_K_PSD2 (0x01 << 2)33#define STB6100_K_PSD2_SHIFT 234#define STB6100_K_NF_MSB (0x03 << 0)35 36#define STB6100_G 0x0537#define STB6100_G_G (0x0f << 0)38#define STB6100_G_GCT (0x07 << 5)39 40#define STB6100_F 0x0641#define STB6100_F_F (0x1f << 0)42 43#define STB6100_DLB 0x0744 45#define STB6100_TEST1 0x0846 47#define STB6100_FCCK 0x0948#define STB6100_FCCK_FCCK (0x01 << 6)49 50#define STB6100_LPEN 0x0a51#define STB6100_LPEN_LPEN (0x01 << 4)52#define STB6100_LPEN_SYNP (0x01 << 5)53#define STB6100_LPEN_OSCP (0x01 << 6)54#define STB6100_LPEN_BEN (0x01 << 7)55 56#define STB6100_TEST3 0x0b57 58#define STB6100_NUMREGS 0x0c59 60 61#define INRANGE(val, x, y) (((x <= val) && (val <= y)) || \62 ((y <= val) && (val <= x)) ? 1 : 0)63 64#define CHKRANGE(val, x, y) (((val >= x) && (val < y)) ? 1 : 0)65 66struct stb6100_config {67 u8 tuner_address;68 u32 refclock;69};70 71struct stb6100_state {72 struct i2c_adapter *i2c;73 74 const struct stb6100_config *config;75 struct dvb_tuner_ops ops;76 struct dvb_frontend *frontend;77 78 u32 frequency;79 u32 srate;80 u32 bandwidth;81 u32 reference;82};83 84#if IS_REACHABLE(CONFIG_DVB_STB6100)85 86extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,87 const struct stb6100_config *config,88 struct i2c_adapter *i2c);89 90#else91 92static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,93 const struct stb6100_config *config,94 struct i2c_adapter *i2c)95{96 printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);97 return NULL;98}99 100#endif //CONFIG_DVB_STB6100101 102#endif103