root/drivers/media/dvb-frontends/m88ds3103_priv.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-or-later */
   2 /*
   3  * Montage Technology M88DS3103/M88RS6000 demodulator driver
   4  *
   5  * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
   6  */
   7 
   8 #ifndef M88DS3103_PRIV_H
   9 #define M88DS3103_PRIV_H
  10 
  11 #include <media/dvb_frontend.h>
  12 #include "m88ds3103.h"
  13 #include <media/dvb_math.h>
  14 #include <linux/firmware.h>
  15 #include <linux/i2c-mux.h>
  16 #include <linux/regmap.h>
  17 #include <linux/math64.h>
  18 
  19 #define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw"
  20 #define M88RS6000_FIRMWARE "dvb-demod-m88rs6000.fw"
  21 #define M88RS6000_CHIP_ID 0x74
  22 #define M88DS3103_CHIP_ID 0x70
  23 
  24 struct m88ds3103_dev {
  25         struct i2c_client *client;
  26         struct regmap_config regmap_config;
  27         struct regmap *regmap;
  28         struct m88ds3103_config config;
  29         const struct m88ds3103_config *cfg;
  30         struct dvb_frontend fe;
  31         enum fe_delivery_system delivery_system;
  32         enum fe_status fe_status;
  33         u32 dvbv3_ber; /* for old DVBv3 API read_ber */
  34         bool warm; /* FW running */
  35         struct i2c_mux_core *muxc;
  36         /* auto detect chip id to do different config */
  37         u8 chip_id;
  38         /* main mclk is calculated for M88RS6000 dynamically */
  39         s32 mclk;
  40         u64 post_bit_error;
  41         u64 post_bit_count;
  42 };
  43 
  44 struct m88ds3103_reg_val {
  45         u8 reg;
  46         u8 val;
  47 };
  48 
  49 static const struct m88ds3103_reg_val m88ds3103_dvbs_init_reg_vals[] = {
  50         {0x23, 0x07},
  51         {0x08, 0x03},
  52         {0x0c, 0x02},
  53         {0x21, 0x54},
  54         {0x25, 0x8a},
  55         {0x27, 0x31},
  56         {0x30, 0x08},
  57         {0x31, 0x40},
  58         {0x32, 0x32},
  59         {0x35, 0xff},
  60         {0x3a, 0x00},
  61         {0x37, 0x10},
  62         {0x38, 0x10},
  63         {0x39, 0x02},
  64         {0x42, 0x60},
  65         {0x4a, 0x80},
  66         {0x4b, 0x04},
  67         {0x4d, 0x91},
  68         {0x5d, 0xc8},
  69         {0x50, 0x36},
  70         {0x51, 0x36},
  71         {0x52, 0x36},
  72         {0x53, 0x36},
  73         {0x56, 0x01},
  74         {0x63, 0x0f},
  75         {0x64, 0x30},
  76         {0x65, 0x40},
  77         {0x68, 0x26},
  78         {0x69, 0x4c},
  79         {0x70, 0x20},
  80         {0x71, 0x70},
  81         {0x72, 0x04},
  82         {0x73, 0x00},
  83         {0x70, 0x40},
  84         {0x71, 0x70},
  85         {0x72, 0x04},
  86         {0x73, 0x00},
  87         {0x70, 0x60},
  88         {0x71, 0x70},
  89         {0x72, 0x04},
  90         {0x73, 0x00},
  91         {0x70, 0x80},
  92         {0x71, 0x70},
  93         {0x72, 0x04},
  94         {0x73, 0x00},
  95         {0x70, 0xa0},
  96         {0x71, 0x70},
  97         {0x72, 0x04},
  98         {0x73, 0x00},
  99         {0x70, 0x1f},
 100         {0x76, 0x38},
 101         {0x77, 0xa6},
 102         {0x78, 0x0c},
 103         {0x79, 0x80},
 104         {0x7f, 0x14},
 105         {0x7c, 0x00},
 106         {0xae, 0x82},
 107         {0x80, 0x64},
 108         {0x81, 0x66},
 109         {0x82, 0x44},
 110         {0x85, 0x04},
 111         {0xcd, 0xf4},
 112         {0x90, 0x33},
 113         {0xa0, 0x44},
 114         {0xc0, 0x08},
 115         {0xc3, 0x10},
 116         {0xc4, 0x08},
 117         {0xc5, 0xf0},
 118         {0xc6, 0xff},
 119         {0xc7, 0x00},
 120         {0xc8, 0x1a},
 121         {0xc9, 0x80},
 122         {0xe0, 0xf8},
 123         {0xe6, 0x8b},
 124         {0xd0, 0x40},
 125         {0xf8, 0x20},
 126         {0xfa, 0x0f},
 127         {0x00, 0x00},
 128         {0xbd, 0x01},
 129         {0xb8, 0x00},
 130 };
 131 
 132 static const struct m88ds3103_reg_val m88ds3103_dvbs2_init_reg_vals[] = {
 133         {0x23, 0x07},
 134         {0x08, 0x07},
 135         {0x0c, 0x02},
 136         {0x21, 0x54},
 137         {0x25, 0x8a},
 138         {0x27, 0x31},
 139         {0x30, 0x08},
 140         {0x32, 0x32},
 141         {0x35, 0xff},
 142         {0x3a, 0x00},
 143         {0x37, 0x10},
 144         {0x38, 0x10},
 145         {0x39, 0x02},
 146         {0x42, 0x60},
 147         {0x4a, 0x80},
 148         {0x4b, 0x04},
 149         {0x4d, 0x91},
 150         {0x5d, 0xc8},
 151         {0x50, 0x36},
 152         {0x51, 0x36},
 153         {0x52, 0x36},
 154         {0x53, 0x36},
 155         {0x56, 0x01},
 156         {0x63, 0x0f},
 157         {0x64, 0x10},
 158         {0x65, 0x20},
 159         {0x68, 0x46},
 160         {0x69, 0xcd},
 161         {0x70, 0x20},
 162         {0x71, 0x70},
 163         {0x72, 0x04},
 164         {0x73, 0x00},
 165         {0x70, 0x40},
 166         {0x71, 0x70},
 167         {0x72, 0x04},
 168         {0x73, 0x00},
 169         {0x70, 0x60},
 170         {0x71, 0x70},
 171         {0x72, 0x04},
 172         {0x73, 0x00},
 173         {0x70, 0x80},
 174         {0x71, 0x70},
 175         {0x72, 0x04},
 176         {0x73, 0x00},
 177         {0x70, 0xa0},
 178         {0x71, 0x70},
 179         {0x72, 0x04},
 180         {0x73, 0x00},
 181         {0x70, 0x1f},
 182         {0x76, 0x38},
 183         {0x77, 0xa6},
 184         {0x78, 0x0c},
 185         {0x79, 0x80},
 186         {0x7f, 0x14},
 187         {0x85, 0x08},
 188         {0xcd, 0xf4},
 189         {0x90, 0x33},
 190         {0x86, 0x00},
 191         {0x87, 0x0f},
 192         {0x89, 0x00},
 193         {0x8b, 0x44},
 194         {0x8c, 0x66},
 195         {0x9d, 0xc1},
 196         {0x8a, 0x10},
 197         {0xad, 0x40},
 198         {0xa0, 0x44},
 199         {0xc0, 0x08},
 200         {0xc1, 0x10},
 201         {0xc2, 0x08},
 202         {0xc3, 0x10},
 203         {0xc4, 0x08},
 204         {0xc5, 0xf0},
 205         {0xc6, 0xff},
 206         {0xc7, 0x00},
 207         {0xc8, 0x1a},
 208         {0xc9, 0x80},
 209         {0xca, 0x23},
 210         {0xcb, 0x24},
 211         {0xcc, 0xf4},
 212         {0xce, 0x74},
 213         {0x00, 0x00},
 214         {0xbd, 0x01},
 215         {0xb8, 0x00},
 216 };
 217 
 218 static const struct m88ds3103_reg_val m88rs6000_dvbs_init_reg_vals[] = {
 219         {0x23, 0x07},
 220         {0x08, 0x03},
 221         {0x0c, 0x02},
 222         {0x20, 0x00},
 223         {0x21, 0x54},
 224         {0x25, 0x82},
 225         {0x27, 0x31},
 226         {0x30, 0x08},
 227         {0x31, 0x40},
 228         {0x32, 0x32},
 229         {0x33, 0x35},
 230         {0x35, 0xff},
 231         {0x3a, 0x00},
 232         {0x37, 0x10},
 233         {0x38, 0x10},
 234         {0x39, 0x02},
 235         {0x42, 0x60},
 236         {0x4a, 0x80},
 237         {0x4b, 0x04},
 238         {0x4d, 0x91},
 239         {0x5d, 0xc8},
 240         {0x50, 0x36},
 241         {0x51, 0x36},
 242         {0x52, 0x36},
 243         {0x53, 0x36},
 244         {0x63, 0x0f},
 245         {0x64, 0x30},
 246         {0x65, 0x40},
 247         {0x68, 0x26},
 248         {0x69, 0x4c},
 249         {0x70, 0x20},
 250         {0x71, 0x70},
 251         {0x72, 0x04},
 252         {0x73, 0x00},
 253         {0x70, 0x40},
 254         {0x71, 0x70},
 255         {0x72, 0x04},
 256         {0x73, 0x00},
 257         {0x70, 0x60},
 258         {0x71, 0x70},
 259         {0x72, 0x04},
 260         {0x73, 0x00},
 261         {0x70, 0x80},
 262         {0x71, 0x70},
 263         {0x72, 0x04},
 264         {0x73, 0x00},
 265         {0x70, 0xa0},
 266         {0x71, 0x70},
 267         {0x72, 0x04},
 268         {0x73, 0x00},
 269         {0x70, 0x1f},
 270         {0x76, 0x38},
 271         {0x77, 0xa6},
 272         {0x78, 0x0c},
 273         {0x79, 0x80},
 274         {0x7f, 0x14},
 275         {0x7c, 0x00},
 276         {0xae, 0x82},
 277         {0x80, 0x64},
 278         {0x81, 0x66},
 279         {0x82, 0x44},
 280         {0x85, 0x04},
 281         {0xcd, 0xf4},
 282         {0x90, 0x33},
 283         {0xa0, 0x44},
 284         {0xbe, 0x00},
 285         {0xc0, 0x08},
 286         {0xc3, 0x10},
 287         {0xc4, 0x08},
 288         {0xc5, 0xf0},
 289         {0xc6, 0xff},
 290         {0xc7, 0x00},
 291         {0xc8, 0x1a},
 292         {0xc9, 0x80},
 293         {0xe0, 0xf8},
 294         {0xe6, 0x8b},
 295         {0xd0, 0x40},
 296         {0xf8, 0x20},
 297         {0xfa, 0x0f},
 298         {0x00, 0x00},
 299         {0xbd, 0x01},
 300         {0xb8, 0x00},
 301         {0x29, 0x11},
 302 };
 303 
 304 static const struct m88ds3103_reg_val m88rs6000_dvbs2_init_reg_vals[] = {
 305         {0x23, 0x07},
 306         {0x08, 0x07},
 307         {0x0c, 0x02},
 308         {0x20, 0x00},
 309         {0x21, 0x54},
 310         {0x25, 0x82},
 311         {0x27, 0x31},
 312         {0x30, 0x08},
 313         {0x32, 0x32},
 314         {0x33, 0x35},
 315         {0x35, 0xff},
 316         {0x3a, 0x00},
 317         {0x37, 0x10},
 318         {0x38, 0x10},
 319         {0x39, 0x02},
 320         {0x42, 0x60},
 321         {0x4a, 0x80},
 322         {0x4b, 0x04},
 323         {0x4d, 0x91},
 324         {0x5d, 0xc8},
 325         {0x50, 0x36},
 326         {0x51, 0x36},
 327         {0x52, 0x36},
 328         {0x53, 0x36},
 329         {0x63, 0x0f},
 330         {0x64, 0x10},
 331         {0x65, 0x20},
 332         {0x68, 0x46},
 333         {0x69, 0xcd},
 334         {0x70, 0x20},
 335         {0x71, 0x70},
 336         {0x72, 0x04},
 337         {0x73, 0x00},
 338         {0x70, 0x40},
 339         {0x71, 0x70},
 340         {0x72, 0x04},
 341         {0x73, 0x00},
 342         {0x70, 0x60},
 343         {0x71, 0x70},
 344         {0x72, 0x04},
 345         {0x73, 0x00},
 346         {0x70, 0x80},
 347         {0x71, 0x70},
 348         {0x72, 0x04},
 349         {0x73, 0x00},
 350         {0x70, 0xa0},
 351         {0x71, 0x70},
 352         {0x72, 0x04},
 353         {0x73, 0x00},
 354         {0x70, 0x1f},
 355         {0x76, 0x38},
 356         {0x77, 0xa6},
 357         {0x78, 0x0c},
 358         {0x79, 0x80},
 359         {0x7f, 0x14},
 360         {0x85, 0x08},
 361         {0xcd, 0xf4},
 362         {0x90, 0x33},
 363         {0x86, 0x00},
 364         {0x87, 0x0f},
 365         {0x89, 0x00},
 366         {0x8b, 0x44},
 367         {0x8c, 0x66},
 368         {0x9d, 0xc1},
 369         {0x8a, 0x10},
 370         {0xad, 0x40},
 371         {0xa0, 0x44},
 372         {0xbe, 0x00},
 373         {0xc0, 0x08},
 374         {0xc1, 0x10},
 375         {0xc2, 0x08},
 376         {0xc3, 0x10},
 377         {0xc4, 0x08},
 378         {0xc5, 0xf0},
 379         {0xc6, 0xff},
 380         {0xc7, 0x00},
 381         {0xc8, 0x1a},
 382         {0xc9, 0x80},
 383         {0xca, 0x23},
 384         {0xcb, 0x24},
 385         {0xcc, 0xf4},
 386         {0xce, 0x74},
 387         {0x00, 0x00},
 388         {0xbd, 0x01},
 389         {0xb8, 0x00},
 390         {0x29, 0x01},
 391 };
 392 #endif

/* [<][>][^][v][top][bottom][index][help] */