162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci*/
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifndef __TEA5767_H__
662306a36Sopenharmony_ci#define __TEA5767_H__
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/i2c.h>
962306a36Sopenharmony_ci#include <media/dvb_frontend.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_cienum tea5767_xtal {
1262306a36Sopenharmony_ci	TEA5767_LOW_LO_32768    = 0,
1362306a36Sopenharmony_ci	TEA5767_HIGH_LO_32768   = 1,
1462306a36Sopenharmony_ci	TEA5767_LOW_LO_13MHz    = 2,
1562306a36Sopenharmony_ci	TEA5767_HIGH_LO_13MHz   = 3,
1662306a36Sopenharmony_ci};
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_cistruct tea5767_ctrl {
1962306a36Sopenharmony_ci	unsigned int		port1:1;
2062306a36Sopenharmony_ci	unsigned int		port2:1;
2162306a36Sopenharmony_ci	unsigned int		high_cut:1;
2262306a36Sopenharmony_ci	unsigned int		st_noise:1;
2362306a36Sopenharmony_ci	unsigned int		soft_mute:1;
2462306a36Sopenharmony_ci	unsigned int		japan_band:1;
2562306a36Sopenharmony_ci	unsigned int		deemph_75:1;
2662306a36Sopenharmony_ci	unsigned int		pllref:1;
2762306a36Sopenharmony_ci	enum tea5767_xtal	xtal_freq;
2862306a36Sopenharmony_ci};
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TEA5767)
3162306a36Sopenharmony_ciextern int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr);
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciextern struct dvb_frontend *tea5767_attach(struct dvb_frontend *fe,
3462306a36Sopenharmony_ci					   struct i2c_adapter* i2c_adap,
3562306a36Sopenharmony_ci					   u8 i2c_addr);
3662306a36Sopenharmony_ci#else
3762306a36Sopenharmony_cistatic inline int tea5767_autodetection(struct i2c_adapter* i2c_adap,
3862306a36Sopenharmony_ci					u8 i2c_addr)
3962306a36Sopenharmony_ci{
4062306a36Sopenharmony_ci	printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
4162306a36Sopenharmony_ci	       __func__);
4262306a36Sopenharmony_ci	return -EINVAL;
4362306a36Sopenharmony_ci}
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_cistatic inline struct dvb_frontend *tea5767_attach(struct dvb_frontend *fe,
4662306a36Sopenharmony_ci						   struct i2c_adapter* i2c_adap,
4762306a36Sopenharmony_ci						   u8 i2c_addr)
4862306a36Sopenharmony_ci{
4962306a36Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
5062306a36Sopenharmony_ci	return NULL;
5162306a36Sopenharmony_ci}
5262306a36Sopenharmony_ci#endif
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#endif /* __TEA5767_H__ */
55