18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Driver for the MaxLinear MxL5xx family of tuners/demods
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2014-2015 Ralph Metzler <rjkm@metzlerbros.de>
68c2ecf20Sopenharmony_ci *                         Marcus Metzler <mocm@metzlerbros.de>
78c2ecf20Sopenharmony_ci *                         developed for Digital Devices GmbH
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * based on code:
108c2ecf20Sopenharmony_ci * Copyright (c) 2011-2013 MaxLinear, Inc. All rights reserved
118c2ecf20Sopenharmony_ci * which was released under GPL V2
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or
148c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License
158c2ecf20Sopenharmony_ci * version 2, as published by the Free Software Foundation.
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful,
188c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
198c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
208c2ecf20Sopenharmony_ci * GNU General Public License for more details.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#ifndef _MXL5XX_H_
248c2ecf20Sopenharmony_ci#define _MXL5XX_H_
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#include <linux/types.h>
278c2ecf20Sopenharmony_ci#include <linux/i2c.h>
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h>
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistruct mxl5xx_cfg {
328c2ecf20Sopenharmony_ci	u8   adr;
338c2ecf20Sopenharmony_ci	u8   type;
348c2ecf20Sopenharmony_ci	u32  cap;
358c2ecf20Sopenharmony_ci	u32  clk;
368c2ecf20Sopenharmony_ci	u32  ts_clk;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci	u8  *fw;
398c2ecf20Sopenharmony_ci	u32  fw_len;
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	int (*fw_read)(void *priv, u8 *buf, u32 len);
428c2ecf20Sopenharmony_ci	void *fw_priv;
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_MXL5XX)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciextern struct dvb_frontend *mxl5xx_attach(struct i2c_adapter *i2c,
488c2ecf20Sopenharmony_ci	struct mxl5xx_cfg *cfg, u32 demod, u32 tuner,
498c2ecf20Sopenharmony_ci	int (**fn_set_input)(struct dvb_frontend *, int));
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#else
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *mxl5xx_attach(struct i2c_adapter *i2c,
548c2ecf20Sopenharmony_ci	struct mxl5xx_cfg *cfg, u32 demod, u32 tuner,
558c2ecf20Sopenharmony_ci	int (**fn_set_input)(struct dvb_frontend *, int))
568c2ecf20Sopenharmony_ci{
578c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
588c2ecf20Sopenharmony_ci	return NULL;
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#endif /* CONFIG_DVB_MXL5XX */
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#endif /* _MXL5XX_H_ */
64