Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /* z0194a.h Sharp z0194a tuner support
0003 *
0004 * Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by)
0005 *
0006 * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
0007 */
0008 
0009 #ifndef Z0194A
0010 #define Z0194A
0011 
0012 static int sharp_z0194a_set_symbol_rate(struct dvb_frontend *fe,
0013                      u32 srate, u32 ratio)
0014 {
0015     u8 aclk = 0;
0016     u8 bclk = 0;
0017 
0018     if (srate < 1500000) {
0019         aclk = 0xb7; bclk = 0x47; }
0020     else if (srate < 3000000) {
0021         aclk = 0xb7; bclk = 0x4b; }
0022     else if (srate < 7000000) {
0023         aclk = 0xb7; bclk = 0x4f; }
0024     else if (srate < 14000000) {
0025         aclk = 0xb7; bclk = 0x53; }
0026     else if (srate < 30000000) {
0027         aclk = 0xb6; bclk = 0x53; }
0028     else if (srate < 45000000) {
0029         aclk = 0xb4; bclk = 0x51; }
0030 
0031     stv0299_writereg(fe, 0x13, aclk);
0032     stv0299_writereg(fe, 0x14, bclk);
0033     stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
0034     stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
0035     stv0299_writereg(fe, 0x21, (ratio) & 0xf0);
0036 
0037     return 0;
0038 }
0039 
0040 static u8 sharp_z0194a_inittab[] = {
0041     0x01, 0x15,
0042     0x02, 0x30,
0043     0x03, 0x00,
0044     0x04, 0x7d,   /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0045     0x05, 0x35,   /* I2CT = 0, SCLT = 1, SDAT = 1 */
0046     0x06, 0x40,   /* DAC not used, set to high impendance mode */
0047     0x07, 0x00,   /* DAC LSB */
0048     0x08, 0x40,   /* DiSEqC off, LNB power on OP2/LOCK pin on */
0049     0x09, 0x00,   /* FIFO */
0050     0x0c, 0x51,   /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0051     0x0d, 0x82,   /* DC offset compensation = ON, beta_agc1 = 2 */
0052     0x0e, 0x23,   /* alpha_tmg = 2, beta_tmg = 3 */
0053     0x10, 0x3f,   /* AGC2  0x3d */
0054     0x11, 0x84,
0055     0x12, 0xb9,
0056     0x15, 0xc9,   /* lock detector threshold */
0057     0x16, 0x00,
0058     0x17, 0x00,
0059     0x18, 0x00,
0060     0x19, 0x00,
0061     0x1a, 0x00,
0062     0x1f, 0x50,
0063     0x20, 0x00,
0064     0x21, 0x00,
0065     0x22, 0x00,
0066     0x23, 0x00,
0067     0x28, 0x00,  /* out imp: normal  out type: parallel FEC mode:0 */
0068     0x29, 0x1e,  /* 1/2 threshold */
0069     0x2a, 0x14,  /* 2/3 threshold */
0070     0x2b, 0x0f,  /* 3/4 threshold */
0071     0x2c, 0x09,  /* 5/6 threshold */
0072     0x2d, 0x05,  /* 7/8 threshold */
0073     0x2e, 0x01,
0074     0x31, 0x1f,  /* test all FECs */
0075     0x32, 0x19,  /* viterbi and synchro search */
0076     0x33, 0xfc,  /* rs control */
0077     0x34, 0x93,  /* error control */
0078     0x0f, 0x52,
0079     0xff, 0xff
0080 };
0081 
0082 #endif