^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef SI21XX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define SI21XX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/dvb/frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <media/dvb_frontend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) struct si21xx_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) /* the demodulator's i2c address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) u8 demod_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* minimum delay before retuning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) int min_delay_ms;
^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) #if IS_REACHABLE(CONFIG_DVB_SI21XX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) extern struct dvb_frontend *si21xx_attach(const struct si21xx_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct i2c_adapter *i2c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static inline struct dvb_frontend *si21xx_attach(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) const struct si21xx_config *config, struct i2c_adapter *i2c)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static inline int si21xx_writeregister(struct dvb_frontend *fe, u8 reg, u8 val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) int r = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) u8 buf[] = {reg, val};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) if (fe->ops.write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) r = fe->ops.write(fe, buf, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) return r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #endif