18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci	Driver for ST STV0288 demodulator
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci	Copyright (C) 2006 Georg Acher, BayCom GmbH, acher (at) baycom (dot) de
68c2ecf20Sopenharmony_ci		for Reel Multimedia
78c2ecf20Sopenharmony_ci	Copyright (C) 2008 TurboSight.com, <bob@turbosight.com>
88c2ecf20Sopenharmony_ci	Copyright (C) 2008 Igor M. Liplianin <liplianin@me.by>
98c2ecf20Sopenharmony_ci		Removed stb6000 specific tuner code and revised some
108c2ecf20Sopenharmony_ci		procedures.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci*/
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#ifndef STV0288_H
168c2ecf20Sopenharmony_ci#define STV0288_H
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
198c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct stv0288_config {
228c2ecf20Sopenharmony_ci	/* the demodulator's i2c address */
238c2ecf20Sopenharmony_ci	u8 demod_address;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	u8* inittab;
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	/* minimum delay before retuning */
288c2ecf20Sopenharmony_ci	int min_delay_ms;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_STV0288)
348c2ecf20Sopenharmony_ciextern struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
358c2ecf20Sopenharmony_ci					   struct i2c_adapter *i2c);
368c2ecf20Sopenharmony_ci#else
378c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
388c2ecf20Sopenharmony_ci					   struct i2c_adapter *i2c)
398c2ecf20Sopenharmony_ci{
408c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
418c2ecf20Sopenharmony_ci	return NULL;
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci#endif /* CONFIG_DVB_STV0288 */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistatic inline int stv0288_writereg(struct dvb_frontend *fe, u8 reg, u8 val)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci	int r = 0;
488c2ecf20Sopenharmony_ci	u8 buf[] = { reg, val };
498c2ecf20Sopenharmony_ci	if (fe->ops.write)
508c2ecf20Sopenharmony_ci		r = fe->ops.write(fe, buf, 2);
518c2ecf20Sopenharmony_ci	return r;
528c2ecf20Sopenharmony_ci}
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#endif /* STV0288_H */
55