18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* z0194a.h Sharp z0194a tuner support 38c2ecf20Sopenharmony_ci* 48c2ecf20Sopenharmony_ci* Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by) 58c2ecf20Sopenharmony_ci* 68c2ecf20Sopenharmony_ci* see Documentation/driver-api/media/drivers/dvb-usb.rst for more information 78c2ecf20Sopenharmony_ci*/ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef Z0194A 108c2ecf20Sopenharmony_ci#define Z0194A 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cistatic int sharp_z0194a_set_symbol_rate(struct dvb_frontend *fe, 138c2ecf20Sopenharmony_ci u32 srate, u32 ratio) 148c2ecf20Sopenharmony_ci{ 158c2ecf20Sopenharmony_ci u8 aclk = 0; 168c2ecf20Sopenharmony_ci u8 bclk = 0; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci if (srate < 1500000) { 198c2ecf20Sopenharmony_ci aclk = 0xb7; bclk = 0x47; } 208c2ecf20Sopenharmony_ci else if (srate < 3000000) { 218c2ecf20Sopenharmony_ci aclk = 0xb7; bclk = 0x4b; } 228c2ecf20Sopenharmony_ci else if (srate < 7000000) { 238c2ecf20Sopenharmony_ci aclk = 0xb7; bclk = 0x4f; } 248c2ecf20Sopenharmony_ci else if (srate < 14000000) { 258c2ecf20Sopenharmony_ci aclk = 0xb7; bclk = 0x53; } 268c2ecf20Sopenharmony_ci else if (srate < 30000000) { 278c2ecf20Sopenharmony_ci aclk = 0xb6; bclk = 0x53; } 288c2ecf20Sopenharmony_ci else if (srate < 45000000) { 298c2ecf20Sopenharmony_ci aclk = 0xb4; bclk = 0x51; } 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci stv0299_writereg(fe, 0x13, aclk); 328c2ecf20Sopenharmony_ci stv0299_writereg(fe, 0x14, bclk); 338c2ecf20Sopenharmony_ci stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff); 348c2ecf20Sopenharmony_ci stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff); 358c2ecf20Sopenharmony_ci stv0299_writereg(fe, 0x21, (ratio) & 0xf0); 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci return 0; 388c2ecf20Sopenharmony_ci} 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cistatic u8 sharp_z0194a_inittab[] = { 418c2ecf20Sopenharmony_ci 0x01, 0x15, 428c2ecf20Sopenharmony_ci 0x02, 0x30, 438c2ecf20Sopenharmony_ci 0x03, 0x00, 448c2ecf20Sopenharmony_ci 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ 458c2ecf20Sopenharmony_ci 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ 468c2ecf20Sopenharmony_ci 0x06, 0x40, /* DAC not used, set to high impendance mode */ 478c2ecf20Sopenharmony_ci 0x07, 0x00, /* DAC LSB */ 488c2ecf20Sopenharmony_ci 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ 498c2ecf20Sopenharmony_ci 0x09, 0x00, /* FIFO */ 508c2ecf20Sopenharmony_ci 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ 518c2ecf20Sopenharmony_ci 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ 528c2ecf20Sopenharmony_ci 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 538c2ecf20Sopenharmony_ci 0x10, 0x3f, /* AGC2 0x3d */ 548c2ecf20Sopenharmony_ci 0x11, 0x84, 558c2ecf20Sopenharmony_ci 0x12, 0xb9, 568c2ecf20Sopenharmony_ci 0x15, 0xc9, /* lock detector threshold */ 578c2ecf20Sopenharmony_ci 0x16, 0x00, 588c2ecf20Sopenharmony_ci 0x17, 0x00, 598c2ecf20Sopenharmony_ci 0x18, 0x00, 608c2ecf20Sopenharmony_ci 0x19, 0x00, 618c2ecf20Sopenharmony_ci 0x1a, 0x00, 628c2ecf20Sopenharmony_ci 0x1f, 0x50, 638c2ecf20Sopenharmony_ci 0x20, 0x00, 648c2ecf20Sopenharmony_ci 0x21, 0x00, 658c2ecf20Sopenharmony_ci 0x22, 0x00, 668c2ecf20Sopenharmony_ci 0x23, 0x00, 678c2ecf20Sopenharmony_ci 0x28, 0x00, /* out imp: normal out type: parallel FEC mode:0 */ 688c2ecf20Sopenharmony_ci 0x29, 0x1e, /* 1/2 threshold */ 698c2ecf20Sopenharmony_ci 0x2a, 0x14, /* 2/3 threshold */ 708c2ecf20Sopenharmony_ci 0x2b, 0x0f, /* 3/4 threshold */ 718c2ecf20Sopenharmony_ci 0x2c, 0x09, /* 5/6 threshold */ 728c2ecf20Sopenharmony_ci 0x2d, 0x05, /* 7/8 threshold */ 738c2ecf20Sopenharmony_ci 0x2e, 0x01, 748c2ecf20Sopenharmony_ci 0x31, 0x1f, /* test all FECs */ 758c2ecf20Sopenharmony_ci 0x32, 0x19, /* viterbi and synchro search */ 768c2ecf20Sopenharmony_ci 0x33, 0xfc, /* rs control */ 778c2ecf20Sopenharmony_ci 0x34, 0x93, /* error control */ 788c2ecf20Sopenharmony_ci 0x0f, 0x52, 798c2ecf20Sopenharmony_ci 0xff, 0xff 808c2ecf20Sopenharmony_ci}; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#endif 83