xref: /linux/drivers/media/dvb-frontends/zd1301_demod.h (revision cbecf716ca618fd44feda6bd9a64a8179d031fc5)
1*c942fddfSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
247d65372SAntti Palosaari /*
347d65372SAntti Palosaari  * ZyDAS ZD1301 driver (demodulator)
447d65372SAntti Palosaari  *
547d65372SAntti Palosaari  * Copyright (C) 2015 Antti Palosaari <crope@iki.fi>
647d65372SAntti Palosaari  */
747d65372SAntti Palosaari 
847d65372SAntti Palosaari #ifndef ZD1301_DEMOD_H
947d65372SAntti Palosaari #define ZD1301_DEMOD_H
1047d65372SAntti Palosaari 
1147d65372SAntti Palosaari #include <linux/platform_device.h>
1247d65372SAntti Palosaari #include <linux/dvb/frontend.h>
13fada1935SMauro Carvalho Chehab #include <media/dvb_frontend.h>
1447d65372SAntti Palosaari 
1547d65372SAntti Palosaari /**
1647d65372SAntti Palosaari  * struct zd1301_demod_platform_data - Platform data for the zd1301_demod driver
1747d65372SAntti Palosaari  * @reg_priv: First argument of reg_read and reg_write callbacks.
1847d65372SAntti Palosaari  * @reg_read: Register read callback.
1947d65372SAntti Palosaari  * @reg_write: Register write callback.
2047d65372SAntti Palosaari  */
2147d65372SAntti Palosaari struct zd1301_demod_platform_data {
2247d65372SAntti Palosaari 	void *reg_priv;
2347d65372SAntti Palosaari 	int (*reg_read)(void *, u16, u8 *);
2447d65372SAntti Palosaari 	int (*reg_write)(void *, u16, u8);
2547d65372SAntti Palosaari };
2647d65372SAntti Palosaari 
270d1270dfSArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_ZD1301_DEMOD)
2847d65372SAntti Palosaari /**
2947d65372SAntti Palosaari  * zd1301_demod_get_dvb_frontend() - Get pointer to DVB frontend
3047d65372SAntti Palosaari  * @pdev: Pointer to platform device
3147d65372SAntti Palosaari  *
3247d65372SAntti Palosaari  * Return: Pointer to DVB frontend which given platform device owns.
3347d65372SAntti Palosaari  */
34b95b0c98SMauro Carvalho Chehab struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *pdev);
3547d65372SAntti Palosaari 
3647d65372SAntti Palosaari /**
3747d65372SAntti Palosaari  * zd1301_demod_get_i2c_adapter() - Get pointer to I2C adapter
3847d65372SAntti Palosaari  * @pdev: Pointer to platform device
3947d65372SAntti Palosaari  *
4047d65372SAntti Palosaari  * Return: Pointer to I2C adapter which given platform device owns.
4147d65372SAntti Palosaari  */
42b95b0c98SMauro Carvalho Chehab struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *pdev);
4347d65372SAntti Palosaari 
440d1270dfSArnd Bergmann #else
450d1270dfSArnd Bergmann 
zd1301_demod_get_dvb_frontend(struct platform_device * dev)460d1270dfSArnd Bergmann static inline struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *dev)
470d1270dfSArnd Bergmann {
480d1270dfSArnd Bergmann 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
490d1270dfSArnd Bergmann 
500d1270dfSArnd Bergmann 	return NULL;
510d1270dfSArnd Bergmann }
zd1301_demod_get_i2c_adapter(struct platform_device * dev)520d1270dfSArnd Bergmann static inline struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *dev)
530d1270dfSArnd Bergmann {
540d1270dfSArnd Bergmann 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
550d1270dfSArnd Bergmann 
560d1270dfSArnd Bergmann 	return NULL;
570d1270dfSArnd Bergmann }
580d1270dfSArnd Bergmann 
590d1270dfSArnd Bergmann #endif
600d1270dfSArnd Bergmann 
6147d65372SAntti Palosaari #endif /* ZD1301_DEMOD_H */
62