1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * Driver for Microtune MT2060 "Single chip dual conversion broadband tuner"
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright (c) 2006 Olivier DANET <odanet@caramail.com>
6*4882a593Smuzhiyun */
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun #ifndef MT2060_H
9*4882a593Smuzhiyun #define MT2060_H
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun struct dvb_frontend;
12*4882a593Smuzhiyun struct i2c_adapter;
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun /*
15*4882a593Smuzhiyun * I2C address
16*4882a593Smuzhiyun * 0x60, ...
17*4882a593Smuzhiyun */
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun /**
20*4882a593Smuzhiyun * struct mt2060_platform_data - Platform data for the mt2060 driver
21*4882a593Smuzhiyun * @clock_out: Clock output setting. 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1.
22*4882a593Smuzhiyun * @if1: First IF used [MHz]. 0 defaults to 1220.
23*4882a593Smuzhiyun * @i2c_write_max: Maximum number of bytes I2C adapter can write at once.
24*4882a593Smuzhiyun * 0 defaults to maximum.
25*4882a593Smuzhiyun * @dvb_frontend: DVB frontend.
26*4882a593Smuzhiyun */
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun struct mt2060_platform_data {
29*4882a593Smuzhiyun u8 clock_out;
30*4882a593Smuzhiyun u16 if1;
31*4882a593Smuzhiyun unsigned int i2c_write_max:5;
32*4882a593Smuzhiyun struct dvb_frontend *dvb_frontend;
33*4882a593Smuzhiyun };
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun /* configuration struct for mt2060_attach() */
37*4882a593Smuzhiyun struct mt2060_config {
38*4882a593Smuzhiyun u8 i2c_address;
39*4882a593Smuzhiyun u8 clock_out; /* 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1 */
40*4882a593Smuzhiyun };
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun #if IS_REACHABLE(CONFIG_MEDIA_TUNER_MT2060)
43*4882a593Smuzhiyun extern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1);
44*4882a593Smuzhiyun #else
mt2060_attach(struct dvb_frontend * fe,struct i2c_adapter * i2c,struct mt2060_config * cfg,u16 if1)45*4882a593Smuzhiyun static inline struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1)
46*4882a593Smuzhiyun {
47*4882a593Smuzhiyun printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
48*4882a593Smuzhiyun return NULL;
49*4882a593Smuzhiyun }
50*4882a593Smuzhiyun #endif // CONFIG_MEDIA_TUNER_MT2060
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun #endif
53