1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * ZyDAS ZD1301 driver (demodulator)
4  *
5  * Copyright (C) 2015 Antti Palosaari <crope@iki.fi>
6  */
7 
8 #ifndef ZD1301_DEMOD_H
9 #define ZD1301_DEMOD_H
10 
11 #include <linux/platform_device.h>
12 #include <linux/dvb/frontend.h>
13 #include <media/dvb_frontend.h>
14 
15 /**
16  * struct zd1301_demod_platform_data - Platform data for the zd1301_demod driver
17  * @reg_priv: First argument of reg_read and reg_write callbacks.
18  * @reg_read: Register read callback.
19  * @reg_write: Register write callback.
20  */
21 struct zd1301_demod_platform_data {
22 	void *reg_priv;
23 	int (*reg_read)(void *, u16, u8 *);
24 	int (*reg_write)(void *, u16, u8);
25 };
26 
27 #if IS_REACHABLE(CONFIG_DVB_ZD1301_DEMOD)
28 /**
29  * zd1301_demod_get_dvb_frontend() - Get pointer to DVB frontend
30  * @pdev: Pointer to platform device
31  *
32  * Return: Pointer to DVB frontend which given platform device owns.
33  */
34 struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *pdev);
35 
36 /**
37  * zd1301_demod_get_i2c_adapter() - Get pointer to I2C adapter
38  * @pdev: Pointer to platform device
39  *
40  * Return: Pointer to I2C adapter which given platform device owns.
41  */
42 struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *pdev);
43 
44 #else
45 
zd1301_demod_get_dvb_frontend(struct platform_device * dev)46 static inline struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *dev)
47 {
48 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
49 
50 	return NULL;
51 }
zd1301_demod_get_i2c_adapter(struct platform_device * dev)52 static inline struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *dev)
53 {
54 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
55 
56 	return NULL;
57 }
58 
59 #endif
60 
61 #endif /* ZD1301_DEMOD_H */
62