18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * cxd2841er.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Sony CXD2441ER digital demodulator driver public definitions
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright 2012 Sony Corporation
88c2ecf20Sopenharmony_ci * Copyright (C) 2014 NetUP Inc.
98c2ecf20Sopenharmony_ci * Copyright (C) 2014 Sergey Kozlov <serjk@netup.ru>
108c2ecf20Sopenharmony_ci * Copyright (C) 2014 Abylay Ospan <aospan@netup.ru>
118c2ecf20Sopenharmony_ci  */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef CXD2841ER_H
148c2ecf20Sopenharmony_ci#define CXD2841ER_H
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define CXD2841ER_USE_GATECTRL	1	/* bit 0 */
198c2ecf20Sopenharmony_ci#define CXD2841ER_AUTO_IFHZ	2	/* bit 1 */
208c2ecf20Sopenharmony_ci#define CXD2841ER_TS_SERIAL	4	/* bit 2 */
218c2ecf20Sopenharmony_ci#define CXD2841ER_ASCOT		8	/* bit 3 */
228c2ecf20Sopenharmony_ci#define CXD2841ER_EARLY_TUNE	16	/* bit 4 */
238c2ecf20Sopenharmony_ci#define CXD2841ER_NO_WAIT_LOCK	32	/* bit 5 */
248c2ecf20Sopenharmony_ci#define CXD2841ER_NO_AGCNEG	64	/* bit 6 */
258c2ecf20Sopenharmony_ci#define CXD2841ER_TSBITS	128	/* bit 7 */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cienum cxd2841er_xtal {
288c2ecf20Sopenharmony_ci	SONY_XTAL_20500, /* 20.5 MHz */
298c2ecf20Sopenharmony_ci	SONY_XTAL_24000, /* 24 MHz */
308c2ecf20Sopenharmony_ci	SONY_XTAL_41000 /* 41 MHz */
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct cxd2841er_config {
348c2ecf20Sopenharmony_ci	u8	i2c_addr;
358c2ecf20Sopenharmony_ci	enum cxd2841er_xtal	xtal;
368c2ecf20Sopenharmony_ci	u32	flags;
378c2ecf20Sopenharmony_ci};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_CXD2841ER)
408c2ecf20Sopenharmony_ciextern struct dvb_frontend *cxd2841er_attach_s(struct cxd2841er_config *cfg,
418c2ecf20Sopenharmony_ci					       struct i2c_adapter *i2c);
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciextern struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg,
448c2ecf20Sopenharmony_ci					       struct i2c_adapter *i2c);
458c2ecf20Sopenharmony_ci#else
468c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *cxd2841er_attach_s(
478c2ecf20Sopenharmony_ci					struct cxd2841er_config *cfg,
488c2ecf20Sopenharmony_ci					struct i2c_adapter *i2c)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
518c2ecf20Sopenharmony_ci	return NULL;
528c2ecf20Sopenharmony_ci}
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *cxd2841er_attach_t_c(
558c2ecf20Sopenharmony_ci		struct cxd2841er_config *cfg, struct i2c_adapter *i2c)
568c2ecf20Sopenharmony_ci{
578c2ecf20Sopenharmony_ci	pr_warn("%s: driver disabled by Kconfig\n", __func__);
588c2ecf20Sopenharmony_ci	return NULL;
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#endif
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#endif
64