Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef SI21XX_H
0003 #define SI21XX_H
0004 
0005 #include <linux/dvb/frontend.h>
0006 #include <media/dvb_frontend.h>
0007 
0008 struct si21xx_config {
0009     /* the demodulator's i2c address */
0010     u8 demod_address;
0011 
0012     /* minimum delay before retuning */
0013     int min_delay_ms;
0014 };
0015 
0016 #if IS_REACHABLE(CONFIG_DVB_SI21XX)
0017 extern struct dvb_frontend *si21xx_attach(const struct si21xx_config *config,
0018                         struct i2c_adapter *i2c);
0019 #else
0020 static inline struct dvb_frontend *si21xx_attach(
0021         const struct si21xx_config *config, struct i2c_adapter *i2c)
0022 {
0023     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0024     return NULL;
0025 }
0026 #endif
0027 
0028 static inline int si21xx_writeregister(struct dvb_frontend *fe, u8 reg, u8 val)
0029 {
0030     int r = 0;
0031     u8 buf[] = {reg, val};
0032     if (fe->ops.write)
0033         r = fe->ops.write(fe, buf, 2);
0034     return r;
0035 }
0036 
0037 #endif