Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / media / dvb-frontends / stv6110x_priv.h
blobb27769558f789db0485d518b561c9b8709189187
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 STV6110(A) Silicon tuner driver
5 Copyright (C) Manu Abraham <abraham.manu@gmail.com>
7 Copyright (C) ST Microelectronics
9 */
11 #ifndef __STV6110x_PRIV_H
12 #define __STV6110x_PRIV_H
14 #define FE_ERROR 0
15 #define FE_NOTICE 1
16 #define FE_INFO 2
17 #define FE_DEBUG 3
18 #define FE_DEBUGREG 4
20 #define dprintk(__y, __z, format, arg...) do { \
21 if (__z) { \
22 if ((verbose > FE_ERROR) && (verbose > __y)) \
23 printk(KERN_ERR "%s: " format "\n", __func__ , ##arg); \
24 else if ((verbose > FE_NOTICE) && (verbose > __y)) \
25 printk(KERN_NOTICE "%s: " format "\n", __func__ , ##arg); \
26 else if ((verbose > FE_INFO) && (verbose > __y)) \
27 printk(KERN_INFO "%s: " format "\n", __func__ , ##arg); \
28 else if ((verbose > FE_DEBUG) && (verbose > __y)) \
29 printk(KERN_DEBUG "%s: " format "\n", __func__ , ##arg); \
30 } else { \
31 if (verbose > __y) \
32 printk(format, ##arg); \
33 } \
34 } while (0)
37 #define STV6110x_SETFIELD(mask, bitf, val) \
38 (mask = (mask & (~(((1 << STV6110x_WIDTH_##bitf) - 1) << \
39 STV6110x_OFFST_##bitf))) | \
40 (val << STV6110x_OFFST_##bitf))
42 #define STV6110x_GETFIELD(bitf, val) \
43 ((val >> STV6110x_OFFST_##bitf) & \
44 ((1 << STV6110x_WIDTH_##bitf) - 1))
46 #define MAKEWORD16(a, b) (((a) << 8) | (b))
48 #define LSB(x) ((x & 0xff))
49 #define MSB(y) ((y >> 8) & 0xff)
51 #define TRIALS 10
52 #define R_DIV(__div) (1 << (__div + 1))
53 #define REFCLOCK_kHz (stv6110x->config->refclk / 1000)
54 #define REFCLOCK_MHz (stv6110x->config->refclk / 1000000)
56 struct stv6110x_state {
57 struct dvb_frontend *frontend;
58 struct i2c_adapter *i2c;
59 const struct stv6110x_config *config;
60 u8 regs[8];
62 struct stv6110x_devctl *devctl;
65 #endif /* __STV6110x_PRIV_H */