blob: 6cd8f6f9c415632700101efecc131fdc59bc916a [file] [log] [blame]
Antti Palosaari47d65372015-07-23 18:43:06 -03001/*
2 * ZyDAS ZD1301 driver (demodulator)
3 *
4 * Copyright (C) 2015 Antti Palosaari <crope@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef ZD1301_DEMOD_H
18#define ZD1301_DEMOD_H
19
20#include <linux/platform_device.h>
21#include <linux/dvb/frontend.h>
22#include "dvb_frontend.h"
23
24/**
25 * struct zd1301_demod_platform_data - Platform data for the zd1301_demod driver
26 * @reg_priv: First argument of reg_read and reg_write callbacks.
27 * @reg_read: Register read callback.
28 * @reg_write: Register write callback.
29 */
Antti Palosaari47d65372015-07-23 18:43:06 -030030struct zd1301_demod_platform_data {
31 void *reg_priv;
32 int (*reg_read)(void *, u16, u8 *);
33 int (*reg_write)(void *, u16, u8);
34};
35
Arnd Bergmann0d1270d2017-02-07 11:01:41 -020036#if IS_REACHABLE(CONFIG_DVB_ZD1301_DEMOD)
Antti Palosaari47d65372015-07-23 18:43:06 -030037/**
38 * zd1301_demod_get_dvb_frontend() - Get pointer to DVB frontend
39 * @pdev: Pointer to platform device
40 *
41 * Return: Pointer to DVB frontend which given platform device owns.
42 */
Mauro Carvalho Chehabb95b0c92017-11-29 12:39:19 -050043struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *pdev);
Antti Palosaari47d65372015-07-23 18:43:06 -030044
45/**
46 * zd1301_demod_get_i2c_adapter() - Get pointer to I2C adapter
47 * @pdev: Pointer to platform device
48 *
49 * Return: Pointer to I2C adapter which given platform device owns.
50 */
Mauro Carvalho Chehabb95b0c92017-11-29 12:39:19 -050051struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *pdev);
Antti Palosaari47d65372015-07-23 18:43:06 -030052
Arnd Bergmann0d1270d2017-02-07 11:01:41 -020053#else
54
Mauro Carvalho Chehabbe9b53c2017-11-29 14:02:22 -050055/**
56 * zd1301_demod_get_dvb_frontend() - Attach a zd1301 frontend
57 * @dev: Pointer to platform device
58 *
59 * Return: Pointer to %struct dvb_frontend or NULL if attach fails.
60 */
Arnd Bergmann0d1270d2017-02-07 11:01:41 -020061static inline struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *dev)
62{
63 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
64
65 return NULL;
66}
67static inline struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *dev)
68{
69 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
70
71 return NULL;
72}
73
74#endif
75
Antti Palosaari47d65372015-07-23 18:43:06 -030076#endif /* ZD1301_DEMOD_H */