18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Driver for Microtune MT2060 "Single chip dual conversion broadband tuner"
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (c) 2006 Olivier DANET <odanet@caramail.com>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef MT2060_H
98c2ecf20Sopenharmony_ci#define MT2060_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistruct dvb_frontend;
128c2ecf20Sopenharmony_cistruct i2c_adapter;
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * I2C address
168c2ecf20Sopenharmony_ci * 0x60, ...
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/**
208c2ecf20Sopenharmony_ci * struct mt2060_platform_data - Platform data for the mt2060 driver
218c2ecf20Sopenharmony_ci * @clock_out: Clock output setting. 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1.
228c2ecf20Sopenharmony_ci * @if1: First IF used [MHz]. 0 defaults to 1220.
238c2ecf20Sopenharmony_ci * @i2c_write_max: Maximum number of bytes I2C adapter can write at once.
248c2ecf20Sopenharmony_ci *  0 defaults to maximum.
258c2ecf20Sopenharmony_ci * @dvb_frontend: DVB frontend.
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistruct mt2060_platform_data {
298c2ecf20Sopenharmony_ci	u8 clock_out;
308c2ecf20Sopenharmony_ci	u16 if1;
318c2ecf20Sopenharmony_ci	unsigned int i2c_write_max:5;
328c2ecf20Sopenharmony_ci	struct dvb_frontend *dvb_frontend;
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* configuration struct for mt2060_attach() */
378c2ecf20Sopenharmony_cistruct mt2060_config {
388c2ecf20Sopenharmony_ci	u8 i2c_address;
398c2ecf20Sopenharmony_ci	u8 clock_out; /* 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1 */
408c2ecf20Sopenharmony_ci};
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MT2060)
438c2ecf20Sopenharmony_ciextern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1);
448c2ecf20Sopenharmony_ci#else
458c2ecf20Sopenharmony_cistatic inline struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
488c2ecf20Sopenharmony_ci	return NULL;
498c2ecf20Sopenharmony_ci}
508c2ecf20Sopenharmony_ci#endif // CONFIG_MEDIA_TUNER_MT2060
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#endif
53