Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89f9257c authored by Henk Vergonet's avatar Henk Vergonet Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (7736): This patch adds support for the Micronas DRX3975D/DRX3977D DVB-T demodulator



The module needs an external firmware file.

The module has been tested on a Pinnacle 330e, but with modules that
are currently not part of the linux-dvb tree. So consider this highly
experimental, don't use this code unless you are an experienced kernel
developer.

 create mode 100644 drivers/media/dvb/frontends/drx397xD.c
 create mode 100644 drivers/media/dvb/frontends/drx397xD.h
 create mode 100644 drivers/media/dvb/frontends/drx397xD_fw.h

Signed-off-by: default avatarHenk Vergonet <henk.vergonet@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 14b395e3
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -135,6 +135,20 @@ config DVB_CX22702
	help
	  A DVB-T tuner module. Say Y when you want to support this frontend.

config DVB_DRX397XD
	tristate "Micronas DRX3975D/DRX3977D based"
	depends on DVB_CORE && I2C && HOTPLUG
	default m if DVB_FE_CUSTOMISE
	select FW_LOADER
	help
	  A DVB-T tuner module. Say Y when you want to support this frontend.

	  TODO:
	  This driver needs external firmware. Please use the command
	  "<kerneldir>/Documentation/dvb/get_dvb_firmware drx397xD" to
	  download/extract them, and then copy them to /usr/lib/hotplug/firmware
	  or /lib/firmware (depending on configuration of firmware hotplug).

config DVB_L64781
	tristate "LSI L64781"
	depends on DVB_CORE && I2C
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ obj-$(CONFIG_DVB_NXT6000) += nxt6000.o
obj-$(CONFIG_DVB_MT352) += mt352.o
obj-$(CONFIG_DVB_ZL10353) += zl10353.o
obj-$(CONFIG_DVB_CX22702) += cx22702.o
obj-$(CONFIG_DVB_DRX397XD) += drx397xD.o
obj-$(CONFIG_DVB_TDA10021) += tda10021.o
obj-$(CONFIG_DVB_TDA10023) += tda10023.o
obj-$(CONFIG_DVB_STV0297) += stv0297.o
+1505 −0

File added.

Preview size limit exceeded, changes collapsed.

+130 −0
Original line number Diff line number Diff line
/*
 *  Driver for Micronas DVB-T drx397xD demodulator
 *
 *  Copyright (C) 2007 Henk vergonet <Henk.Vergonet@gmail.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
 */

#ifndef _DRX397XD_H_INCLUDED
#define _DRX397XD_H_INCLUDED

#include <linux/dvb/frontend.h>

#define DRX_F_STEPSIZE	166667
#define DRX_F_OFFSET	36000000

#define I2C_ADR_C0(x) \
(	(u32)cpu_to_le32( \
		(u32)( \
			(((u32)(x) & (u32)0x000000ffUL)      ) | \
			(((u32)(x) & (u32)0x0000ff00UL) << 16) | \
			(((u32)(x) & (u32)0x0fff0000UL) >>  8) | \
			 (	     (u32)0x00c00000UL)          \
		      )) \
)

#define I2C_ADR_E0(x) \
(	(u32)cpu_to_le32( \
		(u32)( \
			(((u32)(x) & (u32)0x000000ffUL)      ) | \
			(((u32)(x) & (u32)0x0000ff00UL) << 16) | \
			(((u32)(x) & (u32)0x0fff0000UL) >>  8) | \
			 (	     (u32)0x00e00000UL)          \
		      )) \
)

struct drx397xD_CfgRfAgc	/* 0x7c */
{
	int d00;	/* 2 */
	u16 w04;
	u16 w06;
};

struct drx397xD_CfgIfAgc	/* 0x68 */
{
	int d00;	/* 0 */
	u16 w04;	/* 0 */
	u16 w06;
	u16 w08;
	u16 w0A;
	u16 w0C;
};

struct drx397xD_s20 {
	int d04;
	u32 d18;
	u32 d1C;
	u32 d20;
	u32 d14;
	u32 d24;
	u32 d0C;
	u32 d08;
};

struct drx397xD_config
{
	/* demodulator's I2C address */
	u8	demod_address;		/* 0x0f */

	struct drx397xD_CfgIfAgc  ifagc;  /* 0x68 */
	struct drx397xD_CfgRfAgc  rfagc;  /* 0x7c */
	u32	s20d24;

	/* HI_CfgCommand parameters */
	u16	w50, w52, /* w54, */ w56;

	int	d5C;
	int	d60;
	int	d48;
	int	d28;

	u32	f_if;	/* d14: intermediate frequency [Hz]		*/
			/*	36000000 on Cinergy 2400i DT		*/
			/*	42800000 on Pinnacle Hybrid PRO 330e	*/

	u16	f_osc;	/* s66: 48000 oscillator frequency [kHz]	*/

	u16	w92;	/* 20000 */

	u16	wA0;
	u16	w98;
	u16	w9A;

	u16	w9C;	/* 0xe0 */
	u16	w9E;	/* 0x00 */

	/* used for signal strength calculations in
	   drx397x_read_signal_strength
	*/
	u16	ss78;	// 2200
	u16	ss7A;	// 150
	u16	ss76;	// 820
};

#if defined(CONFIG_DVB_DRX397XD) || (defined(CONFIG_DVB_DRX397XD_MODULE) && defined(MODULE))
extern struct dvb_frontend* drx397xD_attach(const struct drx397xD_config *config,
					   struct i2c_adapter *i2c);
#else
static inline struct dvb_frontend* drx397xD_attach(const struct drx397xD_config *config,
					   struct i2c_adapter *i2c)
{
	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
	return NULL;
}
#endif /* CONFIG_DVB_DRX397XD */

#endif /* _DRX397XD_H_INCLUDED */
+40 −0
Original line number Diff line number Diff line
/*
 * Firmware definitions for Micronas drx397xD
 *
 * Copyright (C) 2007 Henk Vergonet <Henk.Vergonet@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; If not, see <http://www.gnu.org/licenses/>.
 */

#ifdef _FW_ENTRY
	_FW_ENTRY("drx397xD.A2.fw",	DRXD_FW_A2 = 0		),
	_FW_ENTRY("drx397xD.B1.fw",	DRXD_FW_B1		),
#undef _FW_ENTRY
#endif /* _FW_ENTRY */

#ifdef _BLOB_ENTRY
	_BLOB_ENTRY("InitAtomicRead",	DRXD_InitAtomicRead = 0	),
	_BLOB_ENTRY("InitCE",		DRXD_InitCE		),
	_BLOB_ENTRY("InitCP",		DRXD_InitCP		),
	_BLOB_ENTRY("InitEC",		DRXD_InitEC		),
	_BLOB_ENTRY("InitEQ",		DRXD_InitEQ		),
	_BLOB_ENTRY("InitFE_1",		DRXD_InitFE_1		),
	_BLOB_ENTRY("InitFE_2",		DRXD_InitFE_2		),
	_BLOB_ENTRY("InitFT",		DRXD_InitFT		),
	_BLOB_ENTRY("InitSC",		DRXD_InitSC		),
	_BLOB_ENTRY("ResetCEFR",	DRXD_ResetCEFR		),
	_BLOB_ENTRY("ResetECRAM",	DRXD_ResetECRAM		),
	_BLOB_ENTRY("microcode",	DRXD_microcode		),
#undef _BLOB_ENTRY
#endif /* _BLOB_ENTRY */