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

Commit 395d00d1 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab
Browse files

[media] Montage M88DS3103 DVB-S/S2 demodulator driver



DVB-S/S2 satellite television demodulator driver.

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 0400c535
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -35,6 +35,13 @@ config DVB_STV6110x
	help
	  A Silicon tuner that supports DVB-S and DVB-S2 modes

config DVB_M88DS3103
	tristate "Montage M88DS3103"
	depends on DVB_CORE && I2C
	default m if !MEDIA_SUBDRV_AUTOSELECT
	help
	  Say Y when you want to support this frontend.

comment "Multistandard (cable + terrestrial) frontends"
	depends on DVB_CORE

+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ obj-$(CONFIG_DVB_STV6110) += stv6110.o
obj-$(CONFIG_DVB_STV0900) += stv0900.o
obj-$(CONFIG_DVB_STV090x) += stv090x.o
obj-$(CONFIG_DVB_STV6110x) += stv6110x.o
obj-$(CONFIG_DVB_M88DS3103) += m88ds3103.o
obj-$(CONFIG_DVB_ISL6423) += isl6423.o
obj-$(CONFIG_DVB_EC100) += ec100.o
obj-$(CONFIG_DVB_HD29L2) += hd29l2.o
+1293 −0

File added.

Preview size limit exceeded, changes collapsed.

+108 −0
Original line number Diff line number Diff line
/*
 * Montage M88DS3103 demodulator driver
 *
 * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
 *
 *    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.,
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef M88DS3103_H
#define M88DS3103_H

#include <linux/dvb/frontend.h>

struct m88ds3103_config {
	/*
	 * I2C address
	 * 0x68, ...
	 */
	u8 i2c_addr;

	/*
	 * clock
	 * 27000000
	 */
	u32 clock;

	/*
	 * max bytes I2C provider is asked to write at once
	 * Note: Buffer is taken from the stack currently!
	 * Value must be set.
	 * 33, 65, ...
	 */
	u16 i2c_wr_max;

	/*
	 * TS output mode
	 */
#define M88DS3103_TS_SERIAL             0 /* TS output pin D0, normal */
#define M88DS3103_TS_SERIAL_D7          1 /* TS output pin D7 */
#define M88DS3103_TS_PARALLEL           2 /* 24 MHz, normal */
#define M88DS3103_TS_PARALLEL_12        3 /* 12 MHz */
#define M88DS3103_TS_PARALLEL_16        4 /* 16 MHz */
#define M88DS3103_TS_PARALLEL_19_2      5 /* 19.2 MHz */
#define M88DS3103_TS_CI                 6 /* 6 MHz */
	u8 ts_mode;

	/*
	 * spectrum inversion
	 */
	u8 spec_inv:1;

	/*
	 * AGC polarity
	 */
	u8 agc_inv:1;

	/*
	 * clock output
	 */
#define M88DS3103_CLOCK_OUT_DISABLED        0
#define M88DS3103_CLOCK_OUT_ENABLED         1
#define M88DS3103_CLOCK_OUT_ENABLED_DIV2    2
	u8 clock_out;

	/*
	 * DiSEqC envelope mode
	 */
	u8 envelope_mode:1;

	u8 agc;
};

/*
 * Driver implements own I2C-adapter for tuner I2C access. That's since chip
 * has I2C-gate control which closes gate automatically after I2C transfer.
 * Using own I2C adapter we can workaround that.
 */

#if defined(CONFIG_DVB_M88DS3103) || \
		(defined(CONFIG_DVB_M88DS3103_MODULE) && defined(MODULE))
extern struct dvb_frontend *m88ds3103_attach(
		const struct m88ds3103_config *config,
		struct i2c_adapter *i2c,
		struct i2c_adapter **tuner_i2c);
#else
static inline struct dvb_frontend *m88ds3103_attach(
		const struct m88ds3103_config *config,
		struct i2c_adapter *i2c,
		struct i2c_adapter **tuner_i2c)
{
	pr_warn("%s: driver disabled by Kconfig\n", __func__);
	return NULL;
}
#endif

#endif
+218 −0
Original line number Diff line number Diff line
/*
 * Montage M88DS3103 demodulator driver
 *
 * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
 *
 *    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.,
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef M88DS3103_PRIV_H
#define M88DS3103_PRIV_H

#include "dvb_frontend.h"
#include "m88ds3103.h"
#include "dvb_math.h"
#include <linux/firmware.h>

#define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw"
#define M88DS3103_MCLK_KHZ 96000

struct m88ds3103_priv {
	struct i2c_adapter *i2c;
	/* mutex needed due to own tuner I2C adapter */
	struct mutex i2c_mutex;
	const struct m88ds3103_config *cfg;
	struct dvb_frontend fe;
	fe_delivery_system_t delivery_system;
	fe_status_t fe_status;
	bool warm; /* FW running */
	struct i2c_adapter i2c_adapter;
};

struct m88ds3103_reg_val {
	u8 reg;
	u8 val;
};

static const struct m88ds3103_reg_val m88ds3103_dvbs_init_reg_vals[] = {
	{0x23, 0x07},
	{0x08, 0x03},
	{0x0c, 0x02},
	{0x21, 0x54},
	{0x25, 0x8a},
	{0x27, 0x31},
	{0x30, 0x08},
	{0x31, 0x40},
	{0x32, 0x32},
	{0x33, 0x35},
	{0x35, 0xff},
	{0x3a, 0x00},
	{0x37, 0x10},
	{0x38, 0x10},
	{0x39, 0x02},
	{0x42, 0x60},
	{0x4a, 0x80},
	{0x4b, 0x04},
	{0x4d, 0x91},
	{0x5d, 0xc8},
	{0x50, 0x36},
	{0x51, 0x36},
	{0x52, 0x36},
	{0x53, 0x36},
	{0x63, 0x0f},
	{0x64, 0x30},
	{0x65, 0x40},
	{0x68, 0x26},
	{0x69, 0x4c},
	{0x70, 0x20},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0x40},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0x60},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0x80},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0xa0},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0x1f},
	{0x76, 0x38},
	{0x77, 0xa6},
	{0x78, 0x0c},
	{0x79, 0x80},
	{0x7f, 0x14},
	{0x7c, 0x00},
	{0xae, 0x82},
	{0x80, 0x64},
	{0x81, 0x66},
	{0x82, 0x44},
	{0x85, 0x04},
	{0xcd, 0xf4},
	{0x90, 0x33},
	{0xa0, 0x44},
	{0xc0, 0x08},
	{0xc3, 0x10},
	{0xc4, 0x08},
	{0xc5, 0xf0},
	{0xc6, 0xff},
	{0xc7, 0x00},
	{0xc8, 0x1a},
	{0xc9, 0x80},
	{0xe0, 0xf8},
	{0xe6, 0x8b},
	{0xd0, 0x40},
	{0xf8, 0x20},
	{0xfa, 0x0f},
	{0x00, 0x00},
	{0xbd, 0x01},
	{0xb8, 0x00},
};

static const struct m88ds3103_reg_val m88ds3103_dvbs2_init_reg_vals[] = {
	{0x23, 0x07},
	{0x08, 0x07},
	{0x0c, 0x02},
	{0x21, 0x54},
	{0x25, 0x8a},
	{0x27, 0x31},
	{0x30, 0x08},
	{0x32, 0x32},
	{0x33, 0x35},
	{0x35, 0xff},
	{0x3a, 0x00},
	{0x37, 0x10},
	{0x38, 0x10},
	{0x39, 0x02},
	{0x42, 0x60},
	{0x4a, 0x80},
	{0x4b, 0x04},
	{0x4d, 0x91},
	{0x5d, 0xc8},
	{0x50, 0x36},
	{0x51, 0x36},
	{0x52, 0x36},
	{0x53, 0x36},
	{0x63, 0x0f},
	{0x64, 0x10},
	{0x65, 0x20},
	{0x68, 0x46},
	{0x69, 0xcd},
	{0x70, 0x20},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0x40},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0x60},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0x80},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0xa0},
	{0x71, 0x70},
	{0x72, 0x04},
	{0x73, 0x00},
	{0x70, 0x1f},
	{0x76, 0x38},
	{0x77, 0xa6},
	{0x78, 0x0c},
	{0x79, 0x80},
	{0x7f, 0x14},
	{0x85, 0x08},
	{0xcd, 0xf4},
	{0x90, 0x33},
	{0x86, 0x00},
	{0x87, 0x0f},
	{0x89, 0x00},
	{0x8b, 0x44},
	{0x8c, 0x66},
	{0x9d, 0xc1},
	{0x8a, 0x10},
	{0xad, 0x40},
	{0xa0, 0x44},
	{0xc0, 0x08},
	{0xc1, 0x10},
	{0xc2, 0x08},
	{0xc3, 0x10},
	{0xc4, 0x08},
	{0xc5, 0xf0},
	{0xc6, 0xff},
	{0xc7, 0x00},
	{0xc8, 0x1a},
	{0xc9, 0x80},
	{0xca, 0x23},
	{0xcb, 0x24},
	{0xcc, 0xf4},
	{0xce, 0x74},
	{0x00, 0x00},
	{0xbd, 0x01},
	{0xb8, 0x00},
};

#endif