/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Montage Technology M88DS3103/M88RS6000 demodulator driver
*
* Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
*/
#ifndef M88DS3103_PRIV_H
#define M88DS3103_PRIV_H
#include <media/dvb_frontend.h>
#include "m88ds3103.h"
#include <linux/int_log.h>
#include <linux/firmware.h>
#include <linux/i2c-mux.h>
#include <linux/regmap.h>
#include <linux/math64.h>
#define M88DS3103B_FIRMWARE "dvb-demod-m88ds3103b.fw"
#define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw"
#define M88RS6000_FIRMWARE "dvb-demod-m88rs6000.fw"
#define M88RS6000_CHIP_ID 0 x74
#define M88DS3103_CHIP_ID 0 x70
#define M88DS3103_CHIPTYPE_3103 0
#define M88DS3103_CHIPTYPE_RS6000 1
#define M88DS3103_CHIPTYPE_3103B 2
struct m88ds3103_dev {
struct i2c_client *client;
struct i2c_client *dt_client;
struct regmap_config regmap_config;
struct regmap *regmap;
struct m88ds3103_config config;
const struct m88ds3103_config *cfg;
struct dvb_frontend fe;
enum fe_delivery_system delivery_system;
enum fe_status fe_status;
u32 dvbv3_ber; /* for old DVBv3 API read_ber */
bool warm; /* FW running */
struct i2c_mux_core *muxc;
/* auto detect chip id to do different config */
u8 chip_id;
/* chip type to differentiate m88rs6000 from m88ds3103b */
u8 chiptype;
/* main mclk is calculated for M88RS6000 dynamically */
s32 mclk;
u64 post_bit_error;
u64 post_bit_count;
u8 dt_addr;
};
struct m88ds3103_reg_val {
u8 reg;
u8 val;
};
static const struct m88ds3103_reg_val m88ds3103_dvbs_init_reg_vals[] = {
{0 x23, 0 x07},
{0 x08, 0 x03},
{0 x0c, 0 x02},
{0 x21, 0 x54},
{0 x25, 0 x8a},
{0 x27, 0 x31},
{0 x30, 0 x08},
{0 x31, 0 x40},
{0 x32, 0 x32},
{0 x35, 0 xff},
{0 x3a, 0 x00},
{0 x37, 0 x10},
{0 x38, 0 x10},
{0 x39, 0 x02},
{0 x42, 0 x60},
{0 x4a, 0 x80},
{0 x4b, 0 x04},
{0 x4d, 0 x91},
{0 x5d, 0 xc8},
{0 x50, 0 x36},
{0 x51, 0 x36},
{0 x52, 0 x36},
{0 x53, 0 x36},
{0 x56, 0 x01},
{0 x63, 0 x0f},
{0 x64, 0 x30},
{0 x65, 0 x40},
{0 x68, 0 x26},
{0 x69, 0 x4c},
{0 x70, 0 x20},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x40},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x60},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x80},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 xa0},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x1f},
{0 x76, 0 x38},
{0 x77, 0 xa6},
{0 x78, 0 x0c},
{0 x79, 0 x80},
{0 x7f, 0 x14},
{0 x7c, 0 x00},
{0 xae, 0 x82},
{0 x80, 0 x64},
{0 x81, 0 x66},
{0 x82, 0 x44},
{0 x85, 0 x04},
{0 xcd, 0 xf4},
{0 x90, 0 x33},
{0 xa0, 0 x44},
{0 xc0, 0 x08},
{0 xc3, 0 x10},
{0 xc4, 0 x08},
{0 xc5, 0 xf0},
{0 xc6, 0 xff},
{0 xc7, 0 x00},
{0 xc8, 0 x1a},
{0 xc9, 0 x80},
{0 xe0, 0 xf8},
{0 xe6, 0 x8b},
{0 xd0, 0 x40},
{0 xf8, 0 x20},
{0 xfa, 0 x0f},
{0 x00, 0 x00},
{0 xbd, 0 x01},
{0 xb8, 0 x00},
};
static const struct m88ds3103_reg_val m88ds3103_dvbs2_init_reg_vals[] = {
{0 x23, 0 x07},
{0 x08, 0 x07},
{0 x0c, 0 x02},
{0 x21, 0 x54},
{0 x25, 0 x8a},
{0 x27, 0 x31},
{0 x30, 0 x08},
{0 x32, 0 x32},
{0 x35, 0 xff},
{0 x3a, 0 x00},
{0 x37, 0 x10},
{0 x38, 0 x10},
{0 x39, 0 x02},
{0 x42, 0 x60},
{0 x4a, 0 x80},
{0 x4b, 0 x04},
{0 x4d, 0 x91},
{0 x5d, 0 xc8},
{0 x50, 0 x36},
{0 x51, 0 x36},
{0 x52, 0 x36},
{0 x53, 0 x36},
{0 x56, 0 x01},
{0 x63, 0 x0f},
{0 x64, 0 x10},
{0 x65, 0 x20},
{0 x68, 0 x46},
{0 x69, 0 xcd},
{0 x70, 0 x20},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x40},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x60},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x80},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 xa0},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x1f},
{0 x76, 0 x38},
{0 x77, 0 xa6},
{0 x78, 0 x0c},
{0 x79, 0 x80},
{0 x7f, 0 x14},
{0 x85, 0 x08},
{0 xcd, 0 xf4},
{0 x90, 0 x33},
{0 x86, 0 x00},
{0 x87, 0 x0f},
{0 x89, 0 x00},
{0 x8b, 0 x44},
{0 x8c, 0 x66},
{0 x9d, 0 xc1},
{0 x8a, 0 x10},
{0 xad, 0 x40},
{0 xa0, 0 x44},
{0 xc0, 0 x08},
{0 xc1, 0 x10},
{0 xc2, 0 x08},
{0 xc3, 0 x10},
{0 xc4, 0 x08},
{0 xc5, 0 xf0},
{0 xc6, 0 xff},
{0 xc7, 0 x00},
{0 xc8, 0 x1a},
{0 xc9, 0 x80},
{0 xca, 0 x23},
{0 xcb, 0 x24},
{0 xcc, 0 xf4},
{0 xce, 0 x74},
{0 x00, 0 x00},
{0 xbd, 0 x01},
{0 xb8, 0 x00},
};
static const struct m88ds3103_reg_val m88rs6000_dvbs_init_reg_vals[] = {
{0 x23, 0 x07},
{0 x08, 0 x03},
{0 x0c, 0 x02},
{0 x20, 0 x00},
{0 x21, 0 x54},
{0 x25, 0 x82},
{0 x27, 0 x31},
{0 x30, 0 x08},
{0 x31, 0 x40},
{0 x32, 0 x32},
{0 x33, 0 x35},
{0 x35, 0 xff},
{0 x3a, 0 x00},
{0 x37, 0 x10},
{0 x38, 0 x10},
{0 x39, 0 x02},
{0 x42, 0 x60},
{0 x4a, 0 x80},
{0 x4b, 0 x04},
{0 x4d, 0 x91},
{0 x5d, 0 xc8},
{0 x50, 0 x36},
{0 x51, 0 x36},
{0 x52, 0 x36},
{0 x53, 0 x36},
{0 x63, 0 x0f},
{0 x64, 0 x30},
{0 x65, 0 x40},
{0 x68, 0 x26},
{0 x69, 0 x4c},
{0 x70, 0 x20},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x40},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x60},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x80},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 xa0},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x1f},
{0 x76, 0 x38},
{0 x77, 0 xa6},
{0 x78, 0 x0c},
{0 x79, 0 x80},
{0 x7f, 0 x14},
{0 x7c, 0 x00},
{0 xae, 0 x82},
{0 x80, 0 x64},
{0 x81, 0 x66},
{0 x82, 0 x44},
{0 x85, 0 x04},
{0 xcd, 0 xf4},
{0 x90, 0 x33},
{0 xa0, 0 x44},
{0 xbe, 0 x00},
{0 xc0, 0 x08},
{0 xc3, 0 x10},
{0 xc4, 0 x08},
{0 xc5, 0 xf0},
{0 xc6, 0 xff},
{0 xc7, 0 x00},
{0 xc8, 0 x1a},
{0 xc9, 0 x80},
{0 xe0, 0 xf8},
{0 xe6, 0 x8b},
{0 xd0, 0 x40},
{0 xf8, 0 x20},
{0 xfa, 0 x0f},
{0 x00, 0 x00},
{0 xbd, 0 x01},
{0 xb8, 0 x00},
{0 x29, 0 x11},
};
static const struct m88ds3103_reg_val m88rs6000_dvbs2_init_reg_vals[] = {
{0 x23, 0 x07},
{0 x08, 0 x07},
{0 x0c, 0 x02},
{0 x20, 0 x00},
{0 x21, 0 x54},
{0 x25, 0 x82},
{0 x27, 0 x31},
{0 x30, 0 x08},
{0 x32, 0 x32},
{0 x33, 0 x35},
{0 x35, 0 xff},
{0 x3a, 0 x00},
{0 x37, 0 x10},
{0 x38, 0 x10},
{0 x39, 0 x02},
{0 x42, 0 x60},
{0 x4a, 0 x80},
{0 x4b, 0 x04},
{0 x4d, 0 x91},
{0 x5d, 0 xc8},
{0 x50, 0 x36},
{0 x51, 0 x36},
{0 x52, 0 x36},
{0 x53, 0 x36},
{0 x63, 0 x0f},
{0 x64, 0 x10},
{0 x65, 0 x20},
{0 x68, 0 x46},
{0 x69, 0 xcd},
{0 x70, 0 x20},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x40},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x60},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x80},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 xa0},
{0 x71, 0 x70},
{0 x72, 0 x04},
{0 x73, 0 x00},
{0 x70, 0 x1f},
{0 x76, 0 x38},
{0 x77, 0 xa6},
{0 x78, 0 x0c},
{0 x79, 0 x80},
{0 x7f, 0 x14},
{0 x85, 0 x08},
{0 xcd, 0 xf4},
{0 x90, 0 x33},
{0 x86, 0 x00},
{0 x87, 0 x0f},
{0 x89, 0 x00},
{0 x8b, 0 x44},
{0 x8c, 0 x66},
{0 x9d, 0 xc1},
{0 x8a, 0 x10},
{0 xad, 0 x40},
{0 xa0, 0 x44},
{0 xbe, 0 x00},
{0 xc0, 0 x08},
{0 xc1, 0 x10},
{0 xc2, 0 x08},
{0 xc3, 0 x10},
{0 xc4, 0 x08},
{0 xc5, 0 xf0},
{0 xc6, 0 xff},
{0 xc7, 0 x00},
{0 xc8, 0 x1a},
{0 xc9, 0 x80},
{0 xca, 0 x23},
{0 xcb, 0 x24},
{0 xcc, 0 xf4},
{0 xce, 0 x74},
{0 x00, 0 x00},
{0 xbd, 0 x01},
{0 xb8, 0 x00},
{0 x29, 0 x01},
};
#endif
Messung V0.5 in Prozent C=97 H=98 G=97