182041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair/*
282041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair * Realtek RTL2832 DVB-T demodulator driver
382041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *
482041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair * Copyright (C) 2012 Thomas Mair <thomas.mair86@gmail.com>
582041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *
682041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	This program is free software; you can redistribute it and/or modify
782041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	it under the terms of the GNU General Public License as published by
882041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	the Free Software Foundation; either version 2 of the License, or
982041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	(at your option) any later version.
1082041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *
1182041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	This program is distributed in the hope that it will be useful,
1282041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	but WITHOUT ANY WARRANTY; without even the implied warranty of
1382041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1482041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	GNU General Public License for more details.
1582041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *
1682041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	You should have received a copy of the GNU General Public License along
1782041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	with this program; if not, write to the Free Software Foundation, Inc.,
1882041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair *	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1982041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair */
2082041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair
2182041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair#ifndef RTL2832_H
2282041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair#define RTL2832_H
2382041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair
24782d8b743aad7dfffa4c01e9e8b57fd35247d70aMauro Carvalho Chehab#include <linux/kconfig.h>
2582041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair#include <linux/dvb/frontend.h>
2682041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair
2782041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mairstruct rtl2832_config {
2882041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	/*
2982041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	 * Demodulator I2C address.
3082041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	 */
3182041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	u8 i2c_addr;
3282041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair
3382041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	/*
3482041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	 * Xtal frequency.
3582041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	 * Hz
3682041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	 * 4000000, 16000000, 25000000, 28800000
3782041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	 */
3882041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	u32 xtal;
3982041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair
4082041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	/*
41832cc7cdfb8ba78e03cf5c8c0ad9701ed0e20fb6Antti Palosaari	 * tuner
42832cc7cdfb8ba78e03cf5c8c0ad9701ed0e20fb6Antti Palosaari	 * XXX: This must be keep sync with dvb_usb_rtl28xxu demod driver.
4382041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	 */
445db4187a037fb9e4b6908ef7bcef0f79395b398fAntti Palosaari#define RTL2832_TUNER_TUA9001   0x24
45832cc7cdfb8ba78e03cf5c8c0ad9701ed0e20fb6Antti Palosaari#define RTL2832_TUNER_FC0012    0x26
467e688de0006dd02583332c14e07ab2560a92e37dAntti Palosaari#define RTL2832_TUNER_E4000     0x27
47832cc7cdfb8ba78e03cf5c8c0ad9701ed0e20fb6Antti Palosaari#define RTL2832_TUNER_FC0013    0x29
48fa4bfd2bd0548c0e5e0d931147df45157686de71Mauro Carvalho Chehab#define RTL2832_TUNER_R820T	0x2a
49a26758edff8e65b598213112521fe411ac2933aeAntti Palosaari#define RTL2832_TUNER_R828D	0x2b
5082041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	u8 tuner;
5182041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair};
5282041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair
53782d8b743aad7dfffa4c01e9e8b57fd35247d70aMauro Carvalho Chehab#if IS_ENABLED(CONFIG_DVB_RTL2832)
543ca2418d707c9eeafa76f6096eb8e06d1cfa8bdbAntti Palosaaristruct dvb_frontend *rtl2832_attach(
5582041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	const struct rtl2832_config *cfg,
5682041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	struct i2c_adapter *i2c
5782041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair);
588823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari
598823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaariextern struct i2c_adapter *rtl2832_get_i2c_adapter(
608823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari	struct dvb_frontend *fe
618823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari);
628823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari
6392d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaariextern struct i2c_adapter *rtl2832_get_private_i2c_adapter(
6492d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari	struct dvb_frontend *fe
6592d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari);
6692d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari
6782041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair#else
688823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari
6982041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mairstatic inline struct dvb_frontend *rtl2832_attach(
7082041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	const struct rtl2832_config *config,
7182041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	struct i2c_adapter *i2c
7282041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair)
7382041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair{
74298efdd3765dfdfb92976d3bb7113061f8b0a92aAntti Palosaari	pr_warn("%s: driver disabled by Kconfig\n", __func__);
7582041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair	return NULL;
7682041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair}
778823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari
788823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaaristatic inline struct i2c_adapter *rtl2832_get_i2c_adapter(
798823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari	struct dvb_frontend *fe
808823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari)
818823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari{
828823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari	return NULL;
838823f0288d345a26b27502c71f8ca3d05b4ac013Antti Palosaari}
8492d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari
8592d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaaristatic inline struct i2c_adapter *rtl2832_get_private_i2c_adapter(
8692d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari	struct dvb_frontend *fe
8792d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari)
8892d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari{
8992d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari	return NULL;
9092d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari}
9192d20d9fd13a2616294dc804ba3bb78312b84850Antti Palosaari
9282041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair#endif
9382041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair
9482041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair
9582041c0a15fdd45336f11c893c4ff69d48dcc4f1Thomas Mair#endif /* RTL2832_H */
96