summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/zd1301_demod.h
blob: d56196f5c80170063e77ccbd0d5b79aadc5ba0c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * ZyDAS ZD1301 driver (demodulator)
 *
 * Copyright (C) 2015 Antti Palosaari <crope@iki.fi>
 */

#ifndef ZD1301_DEMOD_H
#define ZD1301_DEMOD_H

#include <linux/platform_device.h>
#include <linux/dvb/frontend.h>
#include <media/dvb_frontend.h>

/**
 * struct zd1301_demod_platform_data - Platform data for the zd1301_demod driver
 * @reg_priv: First argument of reg_read and reg_write callbacks.
 * @reg_read: Register read callback.
 * @reg_write: Register write callback.
 */
struct zd1301_demod_platform_data {
	void *reg_priv;
	int (*reg_read)(void *, u16, u8 *);
	int (*reg_write)(void *, u16, u8);
};

#if IS_REACHABLE(CONFIG_DVB_ZD1301_DEMOD)
/**
 * zd1301_demod_get_dvb_frontend() - Get pointer to DVB frontend
 * @pdev: Pointer to platform device
 *
 * Return: Pointer to DVB frontend which given platform device owns.
 */
struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *pdev);

/**
 * zd1301_demod_get_i2c_adapter() - Get pointer to I2C adapter
 * @pdev: Pointer to platform device
 *
 * Return: Pointer to I2C adapter which given platform device owns.
 */
struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *pdev);

#else

/**
 * zd1301_demod_get_dvb_frontend() - Attach a zd1301 frontend
 * @dev: Pointer to platform device
 *
 * Return: Pointer to %struct dvb_frontend or NULL if attach fails.
 */
static inline struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *dev)
{
	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);

	return NULL;
}
static inline struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *dev)
{
	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);

	return NULL;
}

#endif

#endif /* ZD1301_DEMOD_H */