1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * Driver for the MaxLinear MxL5xx family of tuners/demods
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright (C) 2014-2015 Ralph Metzler <rjkm@metzlerbros.de>
6*4882a593Smuzhiyun * Marcus Metzler <mocm@metzlerbros.de>
7*4882a593Smuzhiyun * developed for Digital Devices GmbH
8*4882a593Smuzhiyun *
9*4882a593Smuzhiyun * based on code:
10*4882a593Smuzhiyun * Copyright (c) 2011-2013 MaxLinear, Inc. All rights reserved
11*4882a593Smuzhiyun * which was released under GPL V2
12*4882a593Smuzhiyun *
13*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or
14*4882a593Smuzhiyun * modify it under the terms of the GNU General Public License
15*4882a593Smuzhiyun * version 2, as published by the Free Software Foundation.
16*4882a593Smuzhiyun *
17*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful,
18*4882a593Smuzhiyun * but WITHOUT ANY WARRANTY; without even the implied warranty of
19*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20*4882a593Smuzhiyun * GNU General Public License for more details.
21*4882a593Smuzhiyun */
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun #ifndef _MXL5XX_H_
24*4882a593Smuzhiyun #define _MXL5XX_H_
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun #include <linux/types.h>
27*4882a593Smuzhiyun #include <linux/i2c.h>
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun #include <media/dvb_frontend.h>
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun struct mxl5xx_cfg {
32*4882a593Smuzhiyun u8 adr;
33*4882a593Smuzhiyun u8 type;
34*4882a593Smuzhiyun u32 cap;
35*4882a593Smuzhiyun u32 clk;
36*4882a593Smuzhiyun u32 ts_clk;
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun u8 *fw;
39*4882a593Smuzhiyun u32 fw_len;
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun int (*fw_read)(void *priv, u8 *buf, u32 len);
42*4882a593Smuzhiyun void *fw_priv;
43*4882a593Smuzhiyun };
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun #if IS_REACHABLE(CONFIG_DVB_MXL5XX)
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun extern struct dvb_frontend *mxl5xx_attach(struct i2c_adapter *i2c,
48*4882a593Smuzhiyun struct mxl5xx_cfg *cfg, u32 demod, u32 tuner,
49*4882a593Smuzhiyun int (**fn_set_input)(struct dvb_frontend *, int));
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun #else
52*4882a593Smuzhiyun
mxl5xx_attach(struct i2c_adapter * i2c,struct mxl5xx_cfg * cfg,u32 demod,u32 tuner,int (** fn_set_input)(struct dvb_frontend *,int))53*4882a593Smuzhiyun static inline struct dvb_frontend *mxl5xx_attach(struct i2c_adapter *i2c,
54*4882a593Smuzhiyun struct mxl5xx_cfg *cfg, u32 demod, u32 tuner,
55*4882a593Smuzhiyun int (**fn_set_input)(struct dvb_frontend *, int))
56*4882a593Smuzhiyun {
57*4882a593Smuzhiyun pr_warn("%s: driver disabled by Kconfig\n", __func__);
58*4882a593Smuzhiyun return NULL;
59*4882a593Smuzhiyun }
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun #endif /* CONFIG_DVB_MXL5XX */
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun #endif /* _MXL5XX_H_ */
64