Lines Matching +full:precondition +full:- +full:timeout
2 Copyright (c), 2004-2005,2007-2010 Trident Microsystems, Inc.
52 /*-----------------------------------------------------------------------------
54 ----------------------------------------------------------------------------*/
74 #define DRX39XX_MAIN_FIRMWARE "dvb-fe-drxj-mc-1.0.8.fw"
200 /*-----------------------------------------------------------------------------
202 ----------------------------------------------------------------------------*/
204 /*-----------------------------------------------------------------------------
206 ----------------------------------------------------------------------------*/
208 #define DRXJ_WAKE_UP_KEY (demod->my_i2c_dev_addr->i2c_addr)
225 * \brief Timeout value for waiting on demod lock during channel scan (millisec).
437 #define AUD_VOLUME_DB_MIN -60
485 * x -> lowbyte(x), highbyte(x)
526 /*-----------------------------------------------------------------------------
528 ----------------------------------------------------------------------------*/
625 {-5,
633 {-50,
649 {-160,
774 { /* ATV RF-AGC */
782 4000 /* cut-off current */
784 { /* ATV IF-AGC */
829 (151875 - 0), /* system clock frequency in kHz */
975 /*-----------------------------------------------------------------------------
977 ----------------------------------------------------------------------------*/
1001 * struct drxu_code_block_hdr - Structure of the microcode block headers
1016 /*-----------------------------------------------------------------------------
1018 ----------------------------------------------------------------------------*/
1053 * This function is used to avoid floating-point calculations as they may
1056 * frac28 performs an unsigned 28/28 bits division to 32-bit fixed point
1058 * N and D can hold numbers up to width: 28-bits.
1061 * Usage condition: ((1<<28)*n)/d < ((1<<32)-1) => (n/d) < 15.999
1063 * N: 0...(1<<28)-1 = 268435454
1064 * D: 0...(1<<28)-1
1065 * Q: 0...(1<<32)-1
1073 R0 = (N % D) << 4; /* 32-28 == 4 shifts possible at max */ in frac28()
1160 /* computing y in log(x/y) = log(x) - log(y) */ in log1_times100()
1161 if ((x & (((u32) (-1)) << (scale + 1))) == 0) { in log1_times100()
1162 for (k = scale; k > 0; k--) { in log1_times100()
1169 if ((x & (((u32) (-1)) << (scale + 1))) == 0) in log1_times100()
1175 Now x has binary point between bit[scale] and bit[scale-1] in log1_times100()
1182 x &= ((((u32) 1) << scale) - 1); in log1_times100()
1184 i = (u8) (x >> (scale - index_width)); in log1_times100()
1185 /* compute delta (x-a) */ in log1_times100()
1186 d = x & ((((u32) 1) << (scale - index_width)) - 1); in log1_times100()
1189 ((d * (log2lut[i + 1] - log2lut[i])) >> (scale - index_width)); in log1_times100()
1204 * \param N nominator 16-bits.
1205 * \param D denominator 32-bits.
1265 -conversion to short address format
1266 -access to audio block
1320 state = r_dev_addr->user_data; in drxbsp_i2c_write_read()
1321 msg[0].addr = r_dev_addr->i2c_addr >> 1; in drxbsp_i2c_write_read()
1328 state = w_dev_addr->user_data; in drxbsp_i2c_write_read()
1329 msg[0].addr = w_dev_addr->i2c_addr >> 1; in drxbsp_i2c_write_read()
1336 state = w_dev_addr->user_data; in drxbsp_i2c_write_read()
1337 msg[0].addr = w_dev_addr->i2c_addr >> 1; in drxbsp_i2c_write_read()
1341 msg[1].addr = r_dev_addr->i2c_addr >> 1; in drxbsp_i2c_write_read()
1348 if (state->i2c == NULL) { in drxbsp_i2c_write_read()
1352 if (i2c_transfer(state->i2c, msg, num_msgs) != num_msgs) { in drxbsp_i2c_write_read()
1354 return -EREMOTEIO; in drxbsp_i2c_write_read()
1361 state = w_dev_addr->user_data; in drxbsp_i2c_write_read()
1363 if (state->i2c == NULL) in drxbsp_i2c_write_read()
1366 msg[0].addr = w_dev_addr->i2c_addr; in drxbsp_i2c_write_read()
1370 msg[1].addr = r_dev_addr->i2c_addr; in drxbsp_i2c_write_read()
1377 w_dev_addr->i2c_addr, state->i2c, w_count, r_count); in drxbsp_i2c_write_read()
1379 if (i2c_transfer(state->i2c, msg, 2) != 2) { in drxbsp_i2c_write_read()
1381 return -EREMOTEIO; in drxbsp_i2c_write_read()
1392 * struct i2c_device_addr *dev_addr, -- address of I2C device
1393 * u32 addr, -- address of chip register/memory
1394 * u16 datasize, -- number of bytes to read
1395 * u8 *data, -- data to receive
1396 * u32 flags) -- special device flags
1408 * - 0 if reading was successful
1410 * - -EIO if anything went wrong
1426 return -EINVAL; in drxdap_fasi_read_block()
1428 overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) + in drxdap_fasi_read_block()
1436 return -EINVAL; in drxdap_fasi_read_block()
1494 datasize -= todo; in drxdap_fasi_read_block()
1504 * struct i2c_device_addr *dev_addr, -- address of I2C device
1505 * u32 addr, -- address of chip register/memory
1506 * u16 *data, -- data to receive
1507 * u32 flags) -- special device flags
1509 * Read one 16-bit register or memory location. The data received back is
1513 * - 0 if reading was successful
1515 * - -EIO if anything went wrong
1527 return -EINVAL; in drxdap_fasi_read_reg16()
1537 * struct i2c_device_addr *dev_addr, -- address of I2C device
1538 * u32 addr, -- address of chip register/memory
1539 * u32 *data, -- data to receive
1540 * u32 flags) -- special device flags
1542 * Read one 32-bit register or memory location. The data received back is
1546 * - 0 if reading was successful
1548 * - -EIO if anything went wrong
1560 return -EINVAL; in drxdap_fasi_read_reg32()
1572 * struct i2c_device_addr *dev_addr, -- address of I2C device
1573 * u32 addr, -- address of chip register/memory
1574 * u16 datasize, -- number of bytes to read
1575 * u8 *data, -- data to receive
1576 * u32 flags) -- special device flags
1586 * - 0 if writing was successful
1587 * - -EIO if anything went wrong
1597 int st = -EIO; in drxdap_fasi_write_block()
1604 return -EINVAL; in drxdap_fasi_write_block()
1606 overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) + in drxdap_fasi_write_block()
1614 return -EINVAL; in drxdap_fasi_write_block()
1623 block_size = ((DRXDAP_MAX_WCHUNKSIZE) - overhead_size) & ~1; in drxdap_fasi_write_block()
1668 (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1); in drxdap_fasi_write_block()
1670 (DRXDAP_MAX_WCHUNKSIZE - overhead_size_i2c_addr) & ~1; in drxdap_fasi_write_block()
1700 datasize -= todo; in drxdap_fasi_write_block()
1711 * struct i2c_device_addr *dev_addr, -- address of I2C device
1712 * u32 addr, -- address of chip register/memory
1713 * u16 data, -- data to send
1714 * u32 flags) -- special device flags
1716 * Write one 16-bit register or memory location. The data being written is
1720 * - 0 if writing was successful
1721 * - -EIO if anything went wrong
1740 * struct i2c_device_addr *dev_addr, -- address of I2C device
1741 * u32 waddr, -- address of chip register/memory
1742 * u32 raddr, -- chip address to read back from
1743 * u16 wdata, -- data to send
1744 * u16 *rdata) -- data to receive back
1746 * Write 16-bit data, then read back the original contents of that location.
1756 * - 0 if reading was successful
1758 * - -EIO if anything went wrong
1767 int rc = -EIO; in drxdap_fasi_read_modify_write_reg16()
1771 return -EINVAL; in drxdap_fasi_read_modify_write_reg16()
1784 * struct i2c_device_addr *dev_addr, -- address of I2C device
1785 * u32 addr, -- address of chip register/memory
1786 * u32 data, -- data to send
1787 * u32 flags) -- special device flags
1789 * Write one 32-bit register or memory location. The data being written is
1793 * - 0 if writing was successful
1794 * - -EIO if anything went wrong
1824 * \retval -EIO Timeout, I2C error, illegal bank
1843 return -EINVAL; in drxj_dap_rm_write_reg16short()
1901 * \retval -EIO Timeout, I2C error, illegal bank
1913 int stat = -EIO; in drxj_dap_read_aud_reg16()
1917 stat = -EINVAL; in drxj_dap_read_aud_reg16()
1927 /* RMW to aud TR IF until request is granted or timeout */ in drxj_dap_read_aud_reg16()
1937 delta_timer = current_timer - start_timer; in drxj_dap_read_aud_reg16()
1939 stat = -EIO; in drxj_dap_read_aud_reg16()
1949 /* Wait for read ready status or timeout */ in drxj_dap_read_aud_reg16()
1962 delta_timer = current_timer - start_timer; in drxj_dap_read_aud_reg16()
1964 stat = -EIO; in drxj_dap_read_aud_reg16()
1985 int stat = -EIO; in drxj_dap_read_reg16()
1989 return -EINVAL; in drxj_dap_read_reg16()
2008 * \retval -EIO Timeout, I2C error, illegal bank
2016 int stat = -EIO; in drxj_dap_write_aud_reg16()
2020 stat = -EINVAL; in drxj_dap_write_aud_reg16()
2032 /* RMW to aud TR IF until request is granted or timeout */ in drxj_dap_write_aud_reg16()
2041 delta_timer = current_timer - start_timer; in drxj_dap_write_aud_reg16()
2043 stat = -EIO; in drxj_dap_write_aud_reg16()
2063 int stat = -EIO; in drxj_dap_write_reg16()
2067 return -EINVAL; in drxj_dap_write_reg16()
2098 * \retval -EIO Timeout, I2C error, illegal bank
2115 return -EINVAL; in drxj_dap_atomic_read_write_block()
2124 hi_cmd.param3 = (u16) ((datasize / 2) - 1); in drxj_dap_atomic_read_write_block()
2189 return -EINVAL; in drxj_dap_atomic_read_reg32()
2230 * enable/disable should not need re-configuration of the HI.
2240 ext_attr = (struct drxj_data *) demod->my_ext_attr; in hi_cfg_command()
2244 hi_cmd.param2 = ext_attr->hi_cfg_timing_div; in hi_cfg_command()
2245 hi_cmd.param3 = ext_attr->hi_cfg_bridge_delay; in hi_cfg_command()
2246 hi_cmd.param4 = ext_attr->hi_cfg_wake_up_key; in hi_cfg_command()
2247 hi_cmd.param5 = ext_attr->hi_cfg_ctrl; in hi_cfg_command()
2248 hi_cmd.param6 = ext_attr->hi_cfg_transmit; in hi_cfg_command()
2250 rc = hi_command(demod->my_i2c_dev_addr, &hi_cmd, &result); in hi_cfg_command()
2257 ext_attr->hi_cfg_ctrl &= (~(SIO_HI_RA_RAM_PAR_5_CFG_SLEEP_ZZZ)); in hi_cfg_command()
2285 switch (cmd->cmd) { in hi_command()
2289 rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_PAR_6__A, cmd->param6, 0); in hi_command()
2294 rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_PAR_5__A, cmd->param5, 0); in hi_command()
2299 rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_PAR_4__A, cmd->param4, 0); in hi_command()
2304 rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_PAR_3__A, cmd->param3, 0); in hi_command()
2311 rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_PAR_2__A, cmd->param2, 0); in hi_command()
2316 rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_PAR_1__A, cmd->param1, 0); in hi_command()
2327 return -EINVAL; in hi_command()
2331 rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_CMD__A, cmd->cmd, 0); in hi_command()
2337 if ((cmd->cmd) == SIO_HI_RA_RAM_CMD_RESET) in hi_command()
2341 powerdown_cmd = (bool) ((cmd->cmd == SIO_HI_RA_RAM_CMD_CONFIG) && in hi_command()
2342 (((cmd-> in hi_command()
2350 pr_err("timeout\n"); in hi_command()
2381 * \retval -EIO Failure.
2395 ext_attr = (struct drxj_data *) demod->my_ext_attr; in init_hi()
2396 common_attr = (struct drx_common_attr *) demod->my_common_attr; in init_hi()
2397 dev_addr = demod->my_i2c_dev_addr; in init_hi()
2408 ext_attr->hi_cfg_timing_div = in init_hi()
2409 (u16) ((common_attr->sys_clock_freq / 1000) * HI_I2C_DELAY) / 1000; in init_hi()
2411 if ((ext_attr->hi_cfg_timing_div) > SIO_HI_RA_RAM_PAR_2_CFG_DIV__M) in init_hi()
2412 ext_attr->hi_cfg_timing_div = SIO_HI_RA_RAM_PAR_2_CFG_DIV__M; in init_hi()
2416 ext_attr->hi_cfg_bridge_delay = in init_hi()
2417 (u16) ((common_attr->osc_clock_freq / 1000) * HI_I2C_BRIDGE_DELAY) / in init_hi()
2420 if ((ext_attr->hi_cfg_bridge_delay) > SIO_HI_RA_RAM_PAR_3_CFG_DBL_SDA__M) in init_hi()
2421 ext_attr->hi_cfg_bridge_delay = SIO_HI_RA_RAM_PAR_3_CFG_DBL_SDA__M; in init_hi()
2423 ext_attr->hi_cfg_bridge_delay += ((ext_attr->hi_cfg_bridge_delay) << in init_hi()
2428 ext_attr->hi_cfg_wake_up_key = DRXJ_WAKE_UP_KEY; in init_hi()
2430 ext_attr->hi_cfg_ctrl = (SIO_HI_RA_RAM_PAR_5_CFG_SLV0_SLAVE); in init_hi()
2432 ext_attr->hi_cfg_transmit = SIO_HI_RA_RAM_PAR_6__PRE; in init_hi()
2462 * \retval -EIO Failure
2465 * * common_attr->osc_clock_freq
2466 * * ext_attr->has_lna
2467 * * ext_attr->has_ntsc
2468 * * ext_attr->has_btsc
2469 * * ext_attr->has_oob
2482 common_attr = (struct drx_common_attr *) demod->my_common_attr; in get_device_capabilities()
2483 ext_attr = (struct drxj_data *) demod->my_ext_attr; in get_device_capabilities()
2484 dev_addr = demod->my_i2c_dev_addr; in get_device_capabilities()
2508 common_attr->osc_clock_freq = 27000; in get_device_capabilities()
2512 common_attr->osc_clock_freq = 20250; in get_device_capabilities()
2516 common_attr->osc_clock_freq = 4000; in get_device_capabilities()
2519 return -EIO; in get_device_capabilities()
2531 ext_attr->mfx = (u8) ((sio_top_jtagid_lo >> 29) & 0xF); in get_device_capabilities()
2552 ext_attr->has_lna = true; in get_device_capabilities()
2553 ext_attr->has_ntsc = false; in get_device_capabilities()
2554 ext_attr->has_btsc = false; in get_device_capabilities()
2555 ext_attr->has_oob = false; in get_device_capabilities()
2556 ext_attr->has_smatx = true; in get_device_capabilities()
2557 ext_attr->has_smarx = false; in get_device_capabilities()
2558 ext_attr->has_gpio = false; in get_device_capabilities()
2559 ext_attr->has_irqn = false; in get_device_capabilities()
2562 ext_attr->has_lna = false; in get_device_capabilities()
2563 ext_attr->has_ntsc = false; in get_device_capabilities()
2564 ext_attr->has_btsc = false; in get_device_capabilities()
2565 ext_attr->has_oob = false; in get_device_capabilities()
2566 ext_attr->has_smatx = true; in get_device_capabilities()
2567 ext_attr->has_smarx = false; in get_device_capabilities()
2568 ext_attr->has_gpio = false; in get_device_capabilities()
2569 ext_attr->has_irqn = false; in get_device_capabilities()
2572 ext_attr->has_lna = true; in get_device_capabilities()
2573 ext_attr->has_ntsc = true; in get_device_capabilities()
2574 ext_attr->has_btsc = false; in get_device_capabilities()
2575 ext_attr->has_oob = false; in get_device_capabilities()
2576 ext_attr->has_smatx = true; in get_device_capabilities()
2577 ext_attr->has_smarx = true; in get_device_capabilities()
2578 ext_attr->has_gpio = true; in get_device_capabilities()
2579 ext_attr->has_irqn = false; in get_device_capabilities()
2582 ext_attr->has_lna = false; in get_device_capabilities()
2583 ext_attr->has_ntsc = true; in get_device_capabilities()
2584 ext_attr->has_btsc = false; in get_device_capabilities()
2585 ext_attr->has_oob = false; in get_device_capabilities()
2586 ext_attr->has_smatx = true; in get_device_capabilities()
2587 ext_attr->has_smarx = true; in get_device_capabilities()
2588 ext_attr->has_gpio = true; in get_device_capabilities()
2589 ext_attr->has_irqn = false; in get_device_capabilities()
2592 ext_attr->has_lna = true; in get_device_capabilities()
2593 ext_attr->has_ntsc = true; in get_device_capabilities()
2594 ext_attr->has_btsc = true; in get_device_capabilities()
2595 ext_attr->has_oob = false; in get_device_capabilities()
2596 ext_attr->has_smatx = true; in get_device_capabilities()
2597 ext_attr->has_smarx = true; in get_device_capabilities()
2598 ext_attr->has_gpio = true; in get_device_capabilities()
2599 ext_attr->has_irqn = false; in get_device_capabilities()
2602 ext_attr->has_lna = false; in get_device_capabilities()
2603 ext_attr->has_ntsc = true; in get_device_capabilities()
2604 ext_attr->has_btsc = true; in get_device_capabilities()
2605 ext_attr->has_oob = false; in get_device_capabilities()
2606 ext_attr->has_smatx = true; in get_device_capabilities()
2607 ext_attr->has_smarx = true; in get_device_capabilities()
2608 ext_attr->has_gpio = true; in get_device_capabilities()
2609 ext_attr->has_irqn = false; in get_device_capabilities()
2612 ext_attr->has_lna = true; in get_device_capabilities()
2613 ext_attr->has_ntsc = false; in get_device_capabilities()
2614 ext_attr->has_btsc = false; in get_device_capabilities()
2615 ext_attr->has_oob = true; in get_device_capabilities()
2616 ext_attr->has_smatx = true; in get_device_capabilities()
2617 ext_attr->has_smarx = true; in get_device_capabilities()
2618 ext_attr->has_gpio = true; in get_device_capabilities()
2619 ext_attr->has_irqn = true; in get_device_capabilities()
2622 ext_attr->has_lna = false; in get_device_capabilities()
2623 ext_attr->has_ntsc = true; in get_device_capabilities()
2624 ext_attr->has_btsc = true; in get_device_capabilities()
2625 ext_attr->has_oob = true; in get_device_capabilities()
2626 ext_attr->has_smatx = true; in get_device_capabilities()
2627 ext_attr->has_smarx = true; in get_device_capabilities()
2628 ext_attr->has_gpio = true; in get_device_capabilities()
2629 ext_attr->has_irqn = true; in get_device_capabilities()
2632 ext_attr->has_lna = true; in get_device_capabilities()
2633 ext_attr->has_ntsc = true; in get_device_capabilities()
2634 ext_attr->has_btsc = true; in get_device_capabilities()
2635 ext_attr->has_oob = true; in get_device_capabilities()
2636 ext_attr->has_smatx = true; in get_device_capabilities()
2637 ext_attr->has_smarx = true; in get_device_capabilities()
2638 ext_attr->has_gpio = true; in get_device_capabilities()
2639 ext_attr->has_irqn = true; in get_device_capabilities()
2642 ext_attr->has_lna = false; in get_device_capabilities()
2643 ext_attr->has_ntsc = true; in get_device_capabilities()
2644 ext_attr->has_btsc = true; in get_device_capabilities()
2645 ext_attr->has_oob = true; in get_device_capabilities()
2646 ext_attr->has_smatx = true; in get_device_capabilities()
2647 ext_attr->has_smarx = true; in get_device_capabilities()
2648 ext_attr->has_gpio = true; in get_device_capabilities()
2649 ext_attr->has_irqn = true; in get_device_capabilities()
2653 return -EIO; in get_device_capabilities()
2668 * \retval -EIO Failure, I2C or max retries reached
2683 dev_addr = demod->my_i2c_dev_addr; in power_up_device()
2685 wake_up_addr.i2c_dev_id = dev_addr->i2c_dev_id; in power_up_device()
2686 wake_up_addr.user_data = dev_addr->user_data; in power_up_device()
2708 return -EIO; in power_up_device()
2713 /*----------------------------------------------------------------------------*/
2714 /* MPEG Output Configuration Functions - begin */
2715 /*----------------------------------------------------------------------------*/
2749 return -EINVAL; in ctrl_set_cfg_mpeg_output()
2751 dev_addr = demod->my_i2c_dev_addr; in ctrl_set_cfg_mpeg_output()
2752 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_set_cfg_mpeg_output()
2753 common_attr = (struct drx_common_attr *) demod->my_common_attr; in ctrl_set_cfg_mpeg_output()
2755 if (cfg_data->enable_mpeg_output == true) { in ctrl_set_cfg_mpeg_output()
2758 switch (ext_attr->standard) { in ctrl_set_cfg_mpeg_output()
2773 switch (ext_attr->standard) { in ctrl_set_cfg_mpeg_output()
2820 switch (ext_attr->constellation) { in ctrl_set_cfg_mpeg_output()
2837 return -EIO; in ctrl_set_cfg_mpeg_output()
2838 } /* ext_attr->constellation */ in ctrl_set_cfg_mpeg_output()
2842 (ext_attr->curr_symbol_rate / 8) * nr_bits * 188; in ctrl_set_cfg_mpeg_output()
2870 if (cfg_data->static_clk == true) { in ctrl_set_cfg_mpeg_output()
2898 /* Check insertion of the Reed-Solomon parity bytes */ in ctrl_set_cfg_mpeg_output()
2909 if (cfg_data->insert_rs_byte == true) { in ctrl_set_cfg_mpeg_output()
2914 switch (ext_attr->standard) { in ctrl_set_cfg_mpeg_output()
2920 switch (ext_attr->constellation) { in ctrl_set_cfg_mpeg_output()
2928 return -EIO; in ctrl_set_cfg_mpeg_output()
2933 /* insert_rs_byte = true -> coef = 188/188 -> 1, RS bits are in MPEG output */ in ctrl_set_cfg_mpeg_output()
2937 (u32) (common_attr->sys_clock_freq / 8))) / in ctrl_set_cfg_mpeg_output()
2941 return -EIO; in ctrl_set_cfg_mpeg_output()
2942 } /* ext_attr->standard */ in ctrl_set_cfg_mpeg_output()
2949 switch (ext_attr->standard) { in ctrl_set_cfg_mpeg_output()
2955 switch (ext_attr->constellation) { in ctrl_set_cfg_mpeg_output()
2963 return -EIO; in ctrl_set_cfg_mpeg_output()
2968 /* insert_rs_byte = false -> coef = 188/204, RS bits not in MPEG output */ in ctrl_set_cfg_mpeg_output()
2972 (u32) (common_attr->sys_clock_freq / 8))) / in ctrl_set_cfg_mpeg_output()
2976 return -EIO; in ctrl_set_cfg_mpeg_output()
2977 } /* ext_attr->standard */ in ctrl_set_cfg_mpeg_output()
2980 if (cfg_data->enable_parallel == true) { /* MPEG data output is parallel -> clear ipr_mode[0] */ in ctrl_set_cfg_mpeg_output()
2982 } else { /* MPEG data output is serial -> set ipr_mode[0] */ in ctrl_set_cfg_mpeg_output()
2987 if (cfg_data->invert_data == true) in ctrl_set_cfg_mpeg_output()
2992 if (cfg_data->invert_err == true) in ctrl_set_cfg_mpeg_output()
2997 if (cfg_data->invert_str == true) in ctrl_set_cfg_mpeg_output()
3002 if (cfg_data->invert_val == true) in ctrl_set_cfg_mpeg_output()
3007 if (cfg_data->invert_clk == true) in ctrl_set_cfg_mpeg_output()
3013 if (cfg_data->static_clk == true) { /* Static mode */ in ctrl_set_cfg_mpeg_output()
3021 switch (ext_attr->standard) { in ctrl_set_cfg_mpeg_output()
3024 if (cfg_data->insert_rs_byte == true) in ctrl_set_cfg_mpeg_output()
3030 if (cfg_data->insert_rs_byte == true) { in ctrl_set_cfg_mpeg_output()
3034 if (ext_attr->curr_symbol_rate >= in ctrl_set_cfg_mpeg_output()
3044 if (cfg_data->insert_rs_byte == true) in ctrl_set_cfg_mpeg_output()
3049 if (cfg_data->insert_rs_byte == true) in ctrl_set_cfg_mpeg_output()
3053 return -EIO; in ctrl_set_cfg_mpeg_output()
3056 common_attr->sys_clock_freq * 1000 / (fec_oc_dto_period + in ctrl_set_cfg_mpeg_output()
3059 frac28(bit_rate, common_attr->sys_clock_freq * 1000); in ctrl_set_cfg_mpeg_output()
3086 if (ext_attr->mpeg_output_clock_rate != DRXJ_MPEGOUTPUT_CLOCK_RATE_AUTO) in ctrl_set_cfg_mpeg_output()
3087 fec_oc_dto_period = ext_attr->mpeg_output_clock_rate - 1; in ctrl_set_cfg_mpeg_output()
3166 …if (cfg_data->enable_parallel == true) { /* MPEG data output is parallel -> set MD1 to MD7 to outp… in ctrl_set_cfg_mpeg_output()
3211 } else { /* MPEG data output is serial -> set MD1 to MD7 to tri-state */ in ctrl_set_cfg_mpeg_output()
3342 /* save values for restore after re-acquire */ in ctrl_set_cfg_mpeg_output()
3343 common_attr->mpeg_cfg.enable_mpeg_output = cfg_data->enable_mpeg_output; in ctrl_set_cfg_mpeg_output()
3350 /*----------------------------------------------------------------------------*/
3353 /*----------------------------------------------------------------------------*/
3354 /* MPEG Output Configuration Functions - end */
3355 /*----------------------------------------------------------------------------*/
3357 /*----------------------------------------------------------------------------*/
3358 /* miscellaneous configurations - begin */
3359 /*----------------------------------------------------------------------------*/
3379 dev_addr = demod->my_i2c_dev_addr; in set_mpegtei_handling()
3380 ext_attr = (struct drxj_data *) demod->my_ext_attr; in set_mpegtei_handling()
3404 if (ext_attr->disable_te_ihandling) { in set_mpegtei_handling()
3433 /*----------------------------------------------------------------------------*/
3436 * \brief Set MPEG output bit-endian settings.
3450 dev_addr = demod->my_i2c_dev_addr; in bit_reverse_mpeg_output()
3451 ext_attr = (struct drxj_data *) demod->my_ext_attr; in bit_reverse_mpeg_output()
3462 if (ext_attr->bit_reverse_mpeg_outout) in bit_reverse_mpeg_output()
3476 /*----------------------------------------------------------------------------*/
3494 dev_addr = demod->my_i2c_dev_addr; in set_mpeg_start_width()
3495 ext_attr = (struct drxj_data *) demod->my_ext_attr; in set_mpeg_start_width()
3496 common_attr = demod->my_common_attr; in set_mpeg_start_width()
3498 if ((common_attr->mpeg_cfg.static_clk == true) in set_mpeg_start_width()
3499 && (common_attr->mpeg_cfg.enable_parallel == false)) { in set_mpeg_start_width()
3506 if (ext_attr->mpeg_start_width == DRXJ_MPEG_START_WIDTH_8CLKCYC) in set_mpeg_start_width()
3520 /*----------------------------------------------------------------------------*/
3521 /* miscellaneous configurations - end */
3522 /*----------------------------------------------------------------------------*/
3524 /*----------------------------------------------------------------------------*/
3525 /* UIO Configuration Functions - begin */
3526 /*----------------------------------------------------------------------------*/
3540 return -EINVAL; in ctrl_set_uio_cfg()
3542 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_set_uio_cfg()
3545 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY, 0); in ctrl_set_uio_cfg()
3550 switch (uio_cfg->uio) { in ctrl_set_uio_cfg()
3553 /* DRX_UIO1: SMA_TX UIO-1 */ in ctrl_set_uio_cfg()
3554 if (!ext_attr->has_smatx) in ctrl_set_uio_cfg()
3555 return -EIO; in ctrl_set_uio_cfg()
3556 switch (uio_cfg->mode) { in ctrl_set_uio_cfg()
3560 ext_attr->uio_sma_tx_mode = uio_cfg->mode; in ctrl_set_uio_cfg()
3563 ext_attr->uio_sma_tx_mode = uio_cfg->mode; in ctrl_set_uio_cfg()
3564 /* pad configuration register is set 0 - input mode */ in ctrl_set_uio_cfg()
3565 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_SMA_TX_CFG__A, 0, 0); in ctrl_set_uio_cfg()
3572 return -EINVAL; in ctrl_set_uio_cfg()
3573 } /* switch ( uio_cfg->mode ) */ in ctrl_set_uio_cfg()
3577 /* DRX_UIO2: SMA_RX UIO-2 */ in ctrl_set_uio_cfg()
3578 if (!ext_attr->has_smarx) in ctrl_set_uio_cfg()
3579 return -EIO; in ctrl_set_uio_cfg()
3580 switch (uio_cfg->mode) { in ctrl_set_uio_cfg()
3583 ext_attr->uio_sma_rx_mode = uio_cfg->mode; in ctrl_set_uio_cfg()
3586 ext_attr->uio_sma_rx_mode = uio_cfg->mode; in ctrl_set_uio_cfg()
3587 /* pad configuration register is set 0 - input mode */ in ctrl_set_uio_cfg()
3588 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_SMA_RX_CFG__A, 0, 0); in ctrl_set_uio_cfg()
3595 return -EINVAL; in ctrl_set_uio_cfg()
3596 } /* switch ( uio_cfg->mode ) */ in ctrl_set_uio_cfg()
3600 /* DRX_UIO3: GPIO UIO-3 */ in ctrl_set_uio_cfg()
3601 if (!ext_attr->has_gpio) in ctrl_set_uio_cfg()
3602 return -EIO; in ctrl_set_uio_cfg()
3603 switch (uio_cfg->mode) { in ctrl_set_uio_cfg()
3606 ext_attr->uio_gpio_mode = uio_cfg->mode; in ctrl_set_uio_cfg()
3609 ext_attr->uio_gpio_mode = uio_cfg->mode; in ctrl_set_uio_cfg()
3610 /* pad configuration register is set 0 - input mode */ in ctrl_set_uio_cfg()
3611 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_GPIO_CFG__A, 0, 0); in ctrl_set_uio_cfg()
3618 return -EINVAL; in ctrl_set_uio_cfg()
3619 } /* switch ( uio_cfg->mode ) */ in ctrl_set_uio_cfg()
3623 /* DRX_UIO4: IRQN UIO-4 */ in ctrl_set_uio_cfg()
3624 if (!ext_attr->has_irqn) in ctrl_set_uio_cfg()
3625 return -EIO; in ctrl_set_uio_cfg()
3626 switch (uio_cfg->mode) { in ctrl_set_uio_cfg()
3628 ext_attr->uio_irqn_mode = uio_cfg->mode; in ctrl_set_uio_cfg()
3631 /* pad configuration register is set 0 - input mode */ in ctrl_set_uio_cfg()
3632 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_IRQN_CFG__A, 0, 0); in ctrl_set_uio_cfg()
3637 ext_attr->uio_irqn_mode = uio_cfg->mode; in ctrl_set_uio_cfg()
3641 return -EINVAL; in ctrl_set_uio_cfg()
3642 } /* switch ( uio_cfg->mode ) */ in ctrl_set_uio_cfg()
3646 return -EINVAL; in ctrl_set_uio_cfg()
3647 } /* switch ( uio_cfg->uio ) */ in ctrl_set_uio_cfg()
3650 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_TOP_COMM_KEY__A, 0x0000, 0); in ctrl_set_uio_cfg()
3677 return -EINVAL; in ctrl_uio_write()
3679 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_uio_write()
3682 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY, 0); in ctrl_uio_write()
3687 switch (uio_data->uio) { in ctrl_uio_write()
3690 /* DRX_UIO1: SMA_TX UIO-1 */ in ctrl_uio_write()
3691 if (!ext_attr->has_smatx) in ctrl_uio_write()
3692 return -EIO; in ctrl_uio_write()
3693 if ((ext_attr->uio_sma_tx_mode != DRX_UIO_MODE_READWRITE) in ctrl_uio_write()
3694 && (ext_attr->uio_sma_tx_mode != DRX_UIO_MODE_FIRMWARE_SAW)) { in ctrl_uio_write()
3695 return -EIO; in ctrl_uio_write()
3703 /* write to io pad configuration register - output mode */ in ctrl_uio_write()
3704 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_SMA_TX_CFG__A, pin_cfg_value, 0); in ctrl_uio_write()
3711 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, SIO_PDR_UIO_OUT_LO__A, &value, 0); in ctrl_uio_write()
3716 if (!uio_data->value) in ctrl_uio_write()
3717 value &= 0x7FFF; /* write zero to 15th bit - 1st UIO */ in ctrl_uio_write()
3719 value |= 0x8000; /* write one to 15th bit - 1st UIO */ in ctrl_uio_write()
3722 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_UIO_OUT_LO__A, value, 0); in ctrl_uio_write()
3730 /* DRX_UIO2: SMA_RX UIO-2 */ in ctrl_uio_write()
3731 if (!ext_attr->has_smarx) in ctrl_uio_write()
3732 return -EIO; in ctrl_uio_write()
3733 if (ext_attr->uio_sma_rx_mode != DRX_UIO_MODE_READWRITE) in ctrl_uio_write()
3734 return -EIO; in ctrl_uio_write()
3742 /* write to io pad configuration register - output mode */ in ctrl_uio_write()
3743 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_SMA_RX_CFG__A, pin_cfg_value, 0); in ctrl_uio_write()
3750 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, SIO_PDR_UIO_OUT_LO__A, &value, 0); in ctrl_uio_write()
3755 if (!uio_data->value) in ctrl_uio_write()
3756 value &= 0xBFFF; /* write zero to 14th bit - 2nd UIO */ in ctrl_uio_write()
3758 value |= 0x4000; /* write one to 14th bit - 2nd UIO */ in ctrl_uio_write()
3761 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_UIO_OUT_LO__A, value, 0); in ctrl_uio_write()
3769 /* DRX_UIO3: ASEL UIO-3 */ in ctrl_uio_write()
3770 if (!ext_attr->has_gpio) in ctrl_uio_write()
3771 return -EIO; in ctrl_uio_write()
3772 if (ext_attr->uio_gpio_mode != DRX_UIO_MODE_READWRITE) in ctrl_uio_write()
3773 return -EIO; in ctrl_uio_write()
3781 /* write to io pad configuration register - output mode */ in ctrl_uio_write()
3782 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_GPIO_CFG__A, pin_cfg_value, 0); in ctrl_uio_write()
3789 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, SIO_PDR_UIO_OUT_HI__A, &value, 0); in ctrl_uio_write()
3794 if (!uio_data->value) in ctrl_uio_write()
3795 value &= 0xFFFB; /* write zero to 2nd bit - 3rd UIO */ in ctrl_uio_write()
3797 value |= 0x0004; /* write one to 2nd bit - 3rd UIO */ in ctrl_uio_write()
3800 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_UIO_OUT_HI__A, value, 0); in ctrl_uio_write()
3808 /* DRX_UIO4: IRQN UIO-4 */ in ctrl_uio_write()
3809 if (!ext_attr->has_irqn) in ctrl_uio_write()
3810 return -EIO; in ctrl_uio_write()
3812 if (ext_attr->uio_irqn_mode != DRX_UIO_MODE_READWRITE) in ctrl_uio_write()
3813 return -EIO; in ctrl_uio_write()
3821 /* write to io pad configuration register - output mode */ in ctrl_uio_write()
3822 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_IRQN_CFG__A, pin_cfg_value, 0); in ctrl_uio_write()
3829 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, SIO_PDR_UIO_OUT_LO__A, &value, 0); in ctrl_uio_write()
3834 if (uio_data->value == false) in ctrl_uio_write()
3835 value &= 0xEFFF; /* write zero to 12th bit - 4th UIO */ in ctrl_uio_write()
3837 value |= 0x1000; /* write one to 12th bit - 4th UIO */ in ctrl_uio_write()
3840 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_UIO_OUT_LO__A, value, 0); in ctrl_uio_write()
3848 return -EINVAL; in ctrl_uio_write()
3849 } /* switch ( uio_data->uio ) */ in ctrl_uio_write()
3852 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_TOP_COMM_KEY__A, 0x0000, 0); in ctrl_uio_write()
3863 /*---------------------------------------------------------------------------*/
3864 /* UIO Configuration Functions - end */
3865 /*---------------------------------------------------------------------------*/
3867 /*----------------------------------------------------------------------------*/
3868 /* I2C Bridge Functions - begin */
3869 /*----------------------------------------------------------------------------*/
3886 return -EINVAL; in ctrl_i2c_bridge()
3895 return hi_command(demod->my_i2c_dev_addr, &hi_cmd, &result); in ctrl_i2c_bridge()
3898 /*----------------------------------------------------------------------------*/
3899 /* I2C Bridge Functions - end */
3900 /*----------------------------------------------------------------------------*/
3902 /*----------------------------------------------------------------------------*/
3903 /* Smart antenna Functions - begin */
3904 /*----------------------------------------------------------------------------*/
3920 dev_addr = demod->my_i2c_dev_addr; in smart_ant_init()
3921 ext_attr = (struct drxj_data *) demod->my_ext_attr; in smart_ant_init()
3924 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY, 0); in smart_ant_init()
3935 if (ext_attr->smart_ant_inverted) { in smart_ant_init()
3955 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_SMA_TX_CFG__A, 0x13, 0); in smart_ant_init()
3960 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_PDR_SMA_TX_GPIO_FNC__A, 0x03, 0); in smart_ant_init()
3967 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, SIO_TOP_COMM_KEY__A, 0x0000, 0); in smart_ant_init()
3982 unsigned long timeout; in scu_command() local
3986 return -EINVAL; in scu_command()
3995 return -EIO; in scu_command()
3997 switch (cmd->parameter_len) { in scu_command()
3999 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_4__A, *(cmd->parameter + 4), 0); in scu_command()
4006 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_3__A, *(cmd->parameter + 3), 0); in scu_command()
4013 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_2__A, *(cmd->parameter + 2), 0); in scu_command()
4020 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_1__A, *(cmd->parameter + 1), 0); in scu_command()
4027 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_0__A, *(cmd->parameter + 0), 0); in scu_command()
4038 return -EIO; in scu_command()
4040 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_COMMAND__A, cmd->command, 0); in scu_command()
4047 timeout = jiffies + msecs_to_jiffies(DRXJ_MAX_WAITTIME); in scu_command()
4048 while (time_is_after_jiffies(timeout)) { in scu_command()
4060 return -EIO; in scu_command()
4063 if ((cmd->result_len > 0) && (cmd->result != NULL)) { in scu_command()
4066 switch (cmd->result_len) { in scu_command()
4068 rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_3__A, cmd->result + 3, 0); in scu_command()
4075 rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_2__A, cmd->result + 2, 0); in scu_command()
4082 rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_1__A, cmd->result + 1, 0); in scu_command()
4089 rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_0__A, cmd->result + 0, 0); in scu_command()
4100 return -EIO; in scu_command()
4104 err = cmd->result[0]; in scu_command()
4112 return -EINVAL; in scu_command()
4116 return -EIO; in scu_command()
4136 * \retval -EIO Timeout, I2C error, illegal bank
4139 #define ADDR_AT_SCU_SPACE(x) ((x - 0x82E000) * 2)
4151 return -EINVAL; in drxj_dap_scu_atomic_read_write_block()
4213 return -EINVAL; in drxj_dap_scu_atomic_read_reg16()
4247 /* -------------------------------------------------------------------------- */
4254 * \retval -EIO Failure: I2C error
4263 dev_addr = demod->my_i2c_dev_addr; in adc_sync_measurement()
4313 * \retval -EIO Failure: I2C error or failure to synchronize
4326 dev_addr = demod->my_i2c_dev_addr; in adc_synchronization()
4360 return -EIO; in adc_synchronization()
4407 dev_addr = demod->my_i2c_dev_addr; in init_agc()
4408 common_attr = (struct drx_common_attr *) demod->my_common_attr; in init_agc()
4409 ext_attr = (struct drxj_data *) demod->my_ext_attr; in init_agc()
4411 switch (ext_attr->standard) { in init_agc()
4414 clp_dir_to = (u16) (-9); in init_agc()
4416 sns_dir_to = (u16) (-9); in init_agc()
4417 ki_innergain_min = (u16) (-32768); in init_agc()
4489 p_agc_if_settings = &(ext_attr->vsb_if_agc_cfg); in init_agc()
4490 p_agc_rf_settings = &(ext_attr->vsb_rf_agc_cfg); in init_agc()
4498 clp_dir_to = (u16) (-5); in init_agc()
4500 sns_dir_to = (u16) (-3); in init_agc()
4557 p_agc_if_settings = &(ext_attr->qam_if_agc_cfg); in init_agc()
4558 p_agc_rf_settings = &(ext_attr->qam_rf_agc_cfg); in init_agc()
4559 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_AGC_INGAIN_TGT__A, p_agc_if_settings->top, 0); in init_agc()
4579 return -EINVAL; in init_agc()
4583 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_AGC_INGAIN_TGT_MIN__A, p_agc_if_settings->top, 0); in init_agc()
4588 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_AGC_INGAIN__A, p_agc_if_settings->top, 0); in init_agc()
4607 } /* set to p_agc_settings->top before */ in init_agc()
4714 agc_rf = 0x800 + p_agc_rf_settings->cut_off_current; in init_agc()
4715 if (common_attr->tuner_rf_agc_pol == true) in init_agc()
4716 agc_rf = 0x87ff - agc_rf; in init_agc()
4719 if (common_attr->tuner_if_agc_pol == true) in init_agc()
4720 agc_rf = 0x87ff - agc_rf; in init_agc()
4764 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in set_frequency()
4765 struct drxj_data *ext_attr = demod->my_ext_attr; in set_frequency()
4770 s32 rf_freq_residual = -1 * tuner_freq_offset; in set_frequency()
4781 rf_mirror = (ext_attr->mirror == DRX_MIRROR_YES) ? true : false; in set_frequency()
4782 tuner_mirror = demod->my_common_attr->mirror_freq_spect ? false : true; in set_frequency()
4787 switch (ext_attr->standard) { in set_frequency()
4809 return -EINVAL; in set_frequency()
4811 intermediate_freq = demod->my_common_attr->intermediate_freq; in set_frequency()
4812 sampling_frequency = demod->my_common_attr->sys_clock_freq / 3; in set_frequency()
4816 if_freq_actual = intermediate_freq - rf_freq_residual - fm_frequency_shift; in set_frequency()
4819 adc_freq = sampling_frequency - if_freq_actual; in set_frequency()
4842 ext_attr->iqm_fs_rate_ofs = iqm_fs_rate_ofs; in set_frequency()
4843 ext_attr->pos_image = (bool) (rf_mirror ^ tuner_mirror ^ select_pos_image); in set_frequency()
4857 * \retval -EINVAL sig_strength is NULL.
4858 * \retval -EIO Erroneous data, sig_strength contains invalid data.
4870 ext_attr = (struct drxj_data *) demod->my_ext_attr; in get_acc_pkt_err()
4871 dev_addr = demod->my_i2c_dev_addr; in get_acc_pkt_err()
4878 if (ext_attr->reset_pkt_err_acc) { in get_acc_pkt_err()
4881 ext_attr->reset_pkt_err_acc = false; in get_acc_pkt_err()
4885 pkt_err += 0xffff - last_pkt_err; in get_acc_pkt_err()
4888 pkt_err += (data - last_pkt_err); in get_acc_pkt_err()
4920 common_attr = (struct drx_common_attr *) demod->my_common_attr; in set_agc_rf()
4921 dev_addr = demod->my_i2c_dev_addr; in set_agc_rf()
4922 ext_attr = (struct drxj_data *) demod->my_ext_attr; in set_agc_rf()
4933 if ((ext_attr->standard == agc_settings->standard) || in set_agc_rf()
4934 (DRXJ_ISQAMSTD(ext_attr->standard) && in set_agc_rf()
4935 DRXJ_ISQAMSTD(agc_settings->standard)) || in set_agc_rf()
4936 (DRXJ_ISATVSTD(ext_attr->standard) && in set_agc_rf()
4937 DRXJ_ISATVSTD(agc_settings->standard))) { in set_agc_rf()
4940 switch (agc_settings->ctrl_mode) { in set_agc_rf()
4963 if (ext_attr->standard == DRX_STANDARD_8VSB) in set_agc_rf()
4965 else if (DRXJ_ISQAMSTD(ext_attr->standard)) in set_agc_rf()
4970 if (common_attr->tuner_rf_agc_pol) in set_agc_rf()
4987 …rc = (*scu_wr16)(dev_addr, SCU_RAM_AGC_KI_RED__A, (~(agc_settings->speed << SCU_RAM_AGC_KI_RED_RAG… in set_agc_rf()
4993 if (agc_settings->standard == DRX_STANDARD_8VSB) in set_agc_rf()
4994 p_agc_settings = &(ext_attr->vsb_if_agc_cfg); in set_agc_rf()
4995 else if (DRXJ_ISQAMSTD(agc_settings->standard)) in set_agc_rf()
4996 p_agc_settings = &(ext_attr->qam_if_agc_cfg); in set_agc_rf()
4997 else if (DRXJ_ISATVSTD(agc_settings->standard)) in set_agc_rf()
4998 p_agc_settings = &(ext_attr->atv_if_agc_cfg); in set_agc_rf()
5000 return -EINVAL; in set_agc_rf()
5002 /* Set TOP, only if IF-AGC is in AUTO mode */ in set_agc_rf()
5003 if (p_agc_settings->ctrl_mode == DRX_AGC_CTRL_AUTO) { in set_agc_rf()
5004 rc = (*scu_wr16)(dev_addr, SCU_RAM_AGC_IF_IACCU_HI_TGT_MAX__A, agc_settings->top, 0); in set_agc_rf()
5009 rc = (*scu_wr16)(dev_addr, SCU_RAM_AGC_IF_IACCU_HI_TGT__A, agc_settings->top, 0); in set_agc_rf()
5016 /* Cut-Off current */ in set_agc_rf()
5017 rc = (*scu_wr16)(dev_addr, SCU_RAM_AGC_RF_IACCU_HI_CO__A, agc_settings->cut_off_current, 0); in set_agc_rf()
5045 if (common_attr->tuner_rf_agc_pol) in set_agc_rf()
5056 rc = (*scu_wr16)(dev_addr, SCU_RAM_AGC_RF_IACCU_HI__A, agc_settings->output_level, 0); in set_agc_rf()
5091 return -EINVAL; in set_agc_rf()
5092 } /* switch ( agcsettings->ctrl_mode ) */ in set_agc_rf()
5096 switch (agc_settings->standard) { in set_agc_rf()
5098 ext_attr->vsb_rf_agc_cfg = *agc_settings; in set_agc_rf()
5104 ext_attr->qam_rf_agc_cfg = *agc_settings; in set_agc_rf()
5108 return -EIO; in set_agc_rf()
5134 common_attr = (struct drx_common_attr *) demod->my_common_attr; in set_agc_if()
5135 dev_addr = demod->my_i2c_dev_addr; in set_agc_if()
5136 ext_attr = (struct drxj_data *) demod->my_ext_attr; in set_agc_if()
5147 if ((ext_attr->standard == agc_settings->standard) || in set_agc_if()
5148 (DRXJ_ISQAMSTD(ext_attr->standard) && in set_agc_if()
5149 DRXJ_ISQAMSTD(agc_settings->standard)) || in set_agc_if()
5150 (DRXJ_ISATVSTD(ext_attr->standard) && in set_agc_if()
5151 DRXJ_ISATVSTD(agc_settings->standard))) { in set_agc_if()
5154 switch (agc_settings->ctrl_mode) { in set_agc_if()
5177 if (ext_attr->standard == DRX_STANDARD_8VSB) in set_agc_if()
5179 else if (DRXJ_ISQAMSTD(ext_attr->standard)) in set_agc_if()
5184 if (common_attr->tuner_if_agc_pol) in set_agc_if()
5201 …rc = (*scu_wr16) (dev_addr, SCU_RAM_AGC_KI_RED__A, (~(agc_settings->speed << SCU_RAM_AGC_KI_RED_IA… in set_agc_if()
5207 if (agc_settings->standard == DRX_STANDARD_8VSB) in set_agc_if()
5208 p_agc_settings = &(ext_attr->vsb_rf_agc_cfg); in set_agc_if()
5209 else if (DRXJ_ISQAMSTD(agc_settings->standard)) in set_agc_if()
5210 p_agc_settings = &(ext_attr->qam_rf_agc_cfg); in set_agc_if()
5211 else if (DRXJ_ISATVSTD(agc_settings->standard)) in set_agc_if()
5212 p_agc_settings = &(ext_attr->atv_rf_agc_cfg); in set_agc_if()
5214 return -EINVAL; in set_agc_if()
5217 if (p_agc_settings->ctrl_mode == DRX_AGC_CTRL_AUTO) { in set_agc_if()
5218 rc = (*scu_wr16)(dev_addr, SCU_RAM_AGC_IF_IACCU_HI_TGT_MAX__A, p_agc_settings->top, 0); in set_agc_if()
5223 rc = (*scu_wr16)(dev_addr, SCU_RAM_AGC_IF_IACCU_HI_TGT__A, p_agc_settings->top, 0); in set_agc_if()
5265 if (common_attr->tuner_if_agc_pol) in set_agc_if()
5276 rc = (*scu_wr16)(dev_addr, SCU_RAM_AGC_IF_IACCU_HI_TGT_MAX__A, agc_settings->output_level, 0); in set_agc_if()
5313 return -EINVAL; in set_agc_if()
5314 } /* switch ( agcsettings->ctrl_mode ) */ in set_agc_if()
5316 /* always set the top to support configurations without if-loop */ in set_agc_if()
5317 rc = (*scu_wr16) (dev_addr, SCU_RAM_AGC_INGAIN_TGT_MIN__A, agc_settings->top, 0); in set_agc_if()
5325 switch (agc_settings->standard) { in set_agc_if()
5327 ext_attr->vsb_if_agc_cfg = *agc_settings; in set_agc_if()
5333 ext_attr->qam_if_agc_cfg = *agc_settings; in set_agc_if()
5337 return -EIO; in set_agc_if()
5358 dev_addr = demod->my_i2c_dev_addr; in set_iqm_af()
5400 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in power_down_vsb()
5688 dev_addr = demod->my_i2c_dev_addr; in set_vsb_leak_n_gain()
5722 DRXJ_16TO8(-2), /* re0 */ in set_vsb()
5725 DRXJ_16TO8(-4), /* re3 */ in set_vsb()
5728 DRXJ_16TO8(-3), /* re6 */ in set_vsb()
5729 DRXJ_16TO8(-3), /* re7 */ in set_vsb()
5732 DRXJ_16TO8(-9), /* re10 */ in set_vsb()
5735 DRXJ_16TO8(-9), /* re13 */ in set_vsb()
5736 DRXJ_16TO8(-15), /* re14 */ in set_vsb()
5739 DRXJ_16TO8(-29), /* re17 */ in set_vsb()
5740 DRXJ_16TO8(-22), /* re18 */ in set_vsb()
5743 DRXJ_16TO8(-70), /* re21 */ in set_vsb()
5744 DRXJ_16TO8(-28), /* re22 */ in set_vsb()
5747 DRXJ_16TO8(-201), /* re25 */ in set_vsb()
5748 DRXJ_16TO8(-31), /* re26 */ in set_vsb()
5752 dev_addr = demod->my_i2c_dev_addr; in set_vsb()
5753 common_attr = (struct drx_common_attr *) demod->my_common_attr; in set_vsb()
5754 ext_attr = (struct drxj_data *) demod->my_ext_attr; in set_vsb()
5821 ext_attr->iqm_rc_rate_ofs = 0x00AD0D79; in set_vsb()
5822 rc = drxdap_fasi_write_reg32(dev_addr, IQM_RC_RATE_OFS_LO__A, ext_attr->iqm_rc_rate_ofs, 0); in set_vsb()
5987 } /* timeout counter for restarting */ in set_vsb()
6037 /* B-Input to ADC, PGA+filter in standby */ in set_vsb()
6038 if (!ext_attr->has_lna) { in set_vsb()
6063 rc = set_agc_if(demod, &(ext_attr->vsb_if_agc_cfg), false); in set_vsb()
6068 rc = set_agc_rf(demod, &(ext_attr->vsb_rf_agc_cfg), false); in set_vsb()
6078 vsb_pga_cfg.gain = ext_attr->vsb_pga_cfg; in set_vsb()
6085 rc = ctrl_set_cfg_pre_saw(demod, &(ext_attr->vsb_pre_saw_cfg)); in set_vsb()
6112 memcpy(&cfg_mpeg_output, &common_attr->mpeg_cfg, sizeof(cfg_mpeg_output)); in set_vsb()
6240 return -EIO; in get_vsb_post_rs_pck_err()
6284 return -EIO; in get_vs_bpost_viterbi_ber()
6287 (bit_errors_exp - 3) : bit_errors_exp); in get_vs_bpost_viterbi_ber()
6309 return -EIO; in get_vs_bpre_viterbi_ber()
6333 (u16) (log1_times100(21504) - log1_times100((data_hi << 6) / 52)); in get_vsbmer()
6367 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in power_down_qam()
6369 struct drx_common_attr *common_attr = demod->my_common_attr; in power_down_qam()
6439 memcpy(&cfg_mpeg_output, &common_attr->mpeg_cfg, sizeof(cfg_mpeg_output)); in power_down_qam()
6466 * TODO: overriding the ext_attr->fec_bits_desired by constellation dependent
6490 dev_addr = demod->my_i2c_dev_addr; in set_qam_measurement()
6491 ext_attr = (struct drxj_data *) demod->my_ext_attr; in set_qam_measurement()
6493 fec_bits_desired = ext_attr->fec_bits_desired; in set_qam_measurement()
6494 fec_rs_prescale = ext_attr->fec_rs_prescale; in set_qam_measurement()
6513 return -EINVAL; in set_qam_measurement()
6516 /* Parameters for Reed-Solomon Decoder */ in set_qam_measurement()
6519 /* result is within 32 bit arithmetic -> */ in set_qam_measurement()
6523 switch (ext_attr->standard) { in set_qam_measurement()
6532 return -EINVAL; in set_qam_measurement()
6535 ext_attr->fec_rs_plen = fec_rs_plen; /* for getSigQual */ in set_qam_measurement()
6539 return -EIO; in set_qam_measurement()
6542 if (ext_attr->standard != DRX_STANDARD_ITU_B) in set_qam_measurement()
6550 switch (ext_attr->standard) { in set_qam_measurement()
6565 return -EINVAL; in set_qam_measurement()
6569 return -EINVAL; in set_qam_measurement()
6587 ext_attr->fec_rs_period = (u16) fec_rs_period; in set_qam_measurement()
6588 ext_attr->fec_rs_prescale = fec_rs_prescale; in set_qam_measurement()
6605 if (ext_attr->standard == DRX_STANDARD_ITU_B) { in set_qam_measurement()
6610 /* result is within 32 bit arithmetic -> */ in set_qam_measurement()
6614 fec_vd_plen = ext_attr->fec_vd_plen; in set_qam_measurement()
6615 qam_vd_prescale = ext_attr->qam_vd_prescale; in set_qam_measurement()
6632 return -EINVAL; in set_qam_measurement()
6636 return -EIO; in set_qam_measurement()
6656 ext_attr->qam_vd_period = (u16) qam_vd_period; in set_qam_measurement()
6657 ext_attr->qam_vd_prescale = qam_vd_prescale; in set_qam_measurement()
6675 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in set_qam16()
6772 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16)(-24), 0); in set_qam16()
6777 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET4__A, (u16)(-65), 0); in set_qam16()
6782 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16)(-127), 0); in set_qam16()
6910 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in set_qam32()
6997 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET1__A, (u16)(-8), 0); in set_qam32()
7002 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET2__A, (u16)(-16), 0); in set_qam32()
7007 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16)(-26), 0); in set_qam32()
7012 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET4__A, (u16)(-56), 0); in set_qam32()
7017 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16)(-86), 0); in set_qam32()
7145 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in set_qam64()
7148 /* this is hw reset value. no necessary to re-write */ in set_qam64()
7243 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16)(-15), 0); in set_qam64()
7248 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET4__A, (u16)(-45), 0); in set_qam64()
7253 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16)(-80), 0); in set_qam64()
7381 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in set_qam128()
7478 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16)(-1), 0); in set_qam128()
7488 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16)(-23), 0); in set_qam128()
7616 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in set_qam256()
7723 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16)(-8), 0); in set_qam256()
7875 DRXJ_16TO8(-1), /* re0 */ in set_qam()
7878 DRXJ_16TO8(-1), /* re3 */ in set_qam()
7879 DRXJ_16TO8(-1), /* re4 */ in set_qam()
7882 DRXJ_16TO8(-2), /* re7 */ in set_qam()
7885 DRXJ_16TO8(-1), /* re10 */ in set_qam()
7886 DRXJ_16TO8(-3), /* re11 */ in set_qam()
7889 DRXJ_16TO8(-8), /* re14 */ in set_qam()
7892 DRXJ_16TO8(-13), /* re17 */ in set_qam()
7893 DRXJ_16TO8(-19), /* re18 */ in set_qam()
7896 DRXJ_16TO8(-53), /* re21 */ in set_qam()
7897 DRXJ_16TO8(-31), /* re22 */ in set_qam()
7900 DRXJ_16TO8(-190), /* re25 */ in set_qam()
7901 DRXJ_16TO8(-40), /* re26 */ in set_qam()
7906 DRXJ_16TO8(-2), /* re1 */ in set_qam()
7909 DRXJ_16TO8(-2), /* re4 */ in set_qam()
7912 DRXJ_16TO8(-2), /* re7 */ in set_qam()
7913 DRXJ_16TO8(-4), /* re8 */ in set_qam()
7916 DRXJ_16TO8(-6), /* re11 */ in set_qam()
7919 DRXJ_16TO8(-5), /* re14 */ in set_qam()
7920 DRXJ_16TO8(-3), /* re15 */ in set_qam()
7922 DRXJ_16TO8(-4), /* re17 */ in set_qam()
7923 DRXJ_16TO8(-19), /* re18 */ in set_qam()
7926 DRXJ_16TO8(-45), /* re21 */ in set_qam()
7927 DRXJ_16TO8(-36), /* re22 */ in set_qam()
7930 DRXJ_16TO8(-185), /* re25 */ in set_qam()
7931 DRXJ_16TO8(-46), /* re26 */ in set_qam()
7935 DRXJ_16TO8(-2), /* re0 */ in set_qam()
7938 DRXJ_16TO8(-4), /* re3 */ in set_qam()
7941 DRXJ_16TO8(-2), /* re6 */ in set_qam()
7942 DRXJ_16TO8(-4), /* re7 */ in set_qam()
7945 DRXJ_16TO8(-8), /* re10 */ in set_qam()
7948 DRXJ_16TO8(-8), /* re13 */ in set_qam()
7949 DRXJ_16TO8(-15), /* re14 */ in set_qam()
7952 DRXJ_16TO8(-27), /* re17 */ in set_qam()
7953 DRXJ_16TO8(-22), /* re18 */ in set_qam()
7956 DRXJ_16TO8(-69), /* re21 */ in set_qam()
7957 DRXJ_16TO8(-28), /* re22 */ in set_qam()
7960 DRXJ_16TO8(-201), /* re25 */ in set_qam()
7961 DRXJ_16TO8(-32), /* re26 */ in set_qam()
7965 DRXJ_16TO8(-3), /* re0 */ in set_qam()
7968 DRXJ_16TO8(-4), /* re3 */ in set_qam()
7971 DRXJ_16TO8(-1), /* re6 */ in set_qam()
7972 DRXJ_16TO8(-4), /* re7 */ in set_qam()
7975 DRXJ_16TO8(-5), /* re10 */ in set_qam()
7978 DRXJ_16TO8(-4), /* re13 */ in set_qam()
7979 DRXJ_16TO8(-12), /* re14 */ in set_qam()
7982 DRXJ_16TO8(-21), /* re17 */ in set_qam()
7983 DRXJ_16TO8(-20), /* re18 */ in set_qam()
7986 DRXJ_16TO8(-62), /* re21 */ in set_qam()
7987 DRXJ_16TO8(-28), /* re22 */ in set_qam()
7990 DRXJ_16TO8(-197), /* re25 */ in set_qam()
7991 DRXJ_16TO8(-33), /* re26 */ in set_qam()
7995 dev_addr = demod->my_i2c_dev_addr; in set_qam()
7996 ext_attr = (struct drxj_data *) demod->my_ext_attr; in set_qam()
7997 common_attr = (struct drx_common_attr *) demod->my_common_attr; in set_qam()
8000 if (ext_attr->standard == DRX_STANDARD_ITU_B) { in set_qam()
8001 switch (channel->constellation) { in set_qam()
8006 channel->symbolrate = 5360537; in set_qam()
8012 channel->symbolrate = 5056941; in set_qam()
8016 return -EINVAL; in set_qam()
8019 adc_frequency = (common_attr->sys_clock_freq * 1000) / 3; in set_qam()
8020 if (channel->symbolrate == 0) { in set_qam()
8022 return -EIO; in set_qam()
8025 (adc_frequency / channel->symbolrate) * (1 << 21) + in set_qam()
8027 ((adc_frequency % channel->symbolrate), in set_qam()
8028 channel->symbolrate) >> 7) - (1 << 23); in set_qam()
8031 (channel->symbolrate + in set_qam()
8040 if (ext_attr->standard == DRX_STANDARD_ITU_A) { in set_qam()
8042 set_param_parameters[0] = channel->constellation; /* constellation */ in set_qam()
8044 } else if (ext_attr->standard == DRX_STANDARD_ITU_B) { in set_qam()
8046 set_param_parameters[0] = channel->constellation; /* constellation */ in set_qam()
8047 set_param_parameters[1] = channel->interleavemode; /* interleave mode */ in set_qam()
8048 } else if (ext_attr->standard == DRX_STANDARD_ITU_C) { in set_qam()
8050 set_param_parameters[0] = channel->constellation; /* constellation */ in set_qam()
8053 return -EINVAL; in set_qam()
8116 -set env in set_qam()
8117 -set params (resets IQM,QAM,FEC HW; initializes some SCU variables ) in set_qam()
8148 ext_attr->iqm_rc_rate_ofs = iqm_rc_rate; in set_qam()
8149 rc = set_qam_measurement(demod, channel->constellation, channel->symbolrate); in set_qam()
8158 /* TODO: remove re-writes of HW reset values */ in set_qam()
8182 if (!ext_attr->has_lna) { in set_qam()
8263 if (ext_attr->standard == DRX_STANDARD_ITU_B) { in set_qam()
8280 switch (channel->constellation) { in set_qam()
8319 return -EIO; in set_qam()
8469 rc = set_agc_if(demod, &(ext_attr->qam_if_agc_cfg), false); in set_qam()
8474 rc = set_agc_rf(demod, &(ext_attr->qam_rf_agc_cfg), false); in set_qam()
8484 qam_pga_cfg.gain = ext_attr->qam_pga_cfg; in set_qam()
8491 rc = ctrl_set_cfg_pre_saw(demod, &(ext_attr->qam_pre_saw_cfg)); in set_qam()
8499 if (ext_attr->standard == DRX_STANDARD_ITU_A) { in set_qam()
8510 } else if (ext_attr->standard == DRX_STANDARD_ITU_B) { in set_qam()
8511 switch (channel->constellation) { in set_qam()
8537 return -EIO; in set_qam()
8539 } else if (ext_attr->standard == DRX_STANDARD_ITU_C) { in set_qam()
8553 switch (channel->constellation) { in set_qam()
8590 return -EIO; in set_qam()
8622 memcpy(&cfg_mpeg_output, &common_attr->mpeg_cfg, sizeof(cfg_mpeg_output)); in set_qam()
8675 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in qam_flip_spec()
8676 struct drxj_data *ext_attr = demod->my_ext_attr; in qam_flip_spec()
8721 ofsofs = iqm_fs_rate_lo - iqm_fs_rate_ofs; in qam_flip_spec()
8723 iqm_fs_rate_ofs -= 2 * ofsofs; in qam_flip_spec()
8766 ext_attr->iqm_fs_rate_ofs = iqm_fs_rate_ofs; in qam_flip_spec()
8767 ext_attr->pos_image = (ext_attr->pos_image) ? false : true; in qam_flip_spec()
8794 rc = drxj_dap_write_reg16(dev_addr, QAM_DQ_TAP_IM_EL0__A + (2 * i), -data, 0); in qam_flip_spec()
8807 rc = drxj_dap_write_reg16(dev_addr, QAM_FQ_TAP_IM_EL0__A + (2 * i), -data, 0); in qam_flip_spec()
8870 struct drxj_data *ext_attr = demod->my_ext_attr; in qam64auto()
8871 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in qam64auto()
8872 struct drx39xxj_state *state = dev_addr->user_data; in qam64auto()
8873 struct dtv_frontend_properties *p = &state->frontend.dtv_property_cache; in qam64auto()
8900 if (p->cnr.stat[0].svalue > 20800) { in qam64auto()
8910 ((jiffies_to_msecs(jiffies) - d_locked_time) > in qam64auto()
8912 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, QAM_SY_TIMEOUT__A, &data, 0); in qam64auto()
8917 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, QAM_SY_TIMEOUT__A, data | 0x1, 0); in qam64auto()
8928 if (channel->mirror == DRX_MIRROR_AUTO) { in qam64auto()
8930 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, QAM_SY_TIMEOUT__A, &data, 0); in qam64auto()
8935 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, QAM_SY_TIMEOUT__A, data & 0xFFFE, 0); in qam64auto()
8941 ext_attr->mirror = DRX_MIRROR_YES; in qam64auto()
8955 jiffies_to_msecs(jiffies) - in qam64auto()
8956 DRXJ_QAM_MAX_WAITTIME - timeout_ofs; in qam64auto()
8962 ((jiffies_to_msecs(jiffies) - d_locked_time) > in qam64auto()
8969 if (p->cnr.stat[0].svalue > 20800) { in qam64auto()
8970 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, QAM_SY_TIMEOUT__A, &data, 0); in qam64auto()
8975 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, QAM_SY_TIMEOUT__A, data | 0x1, 0); in qam64auto()
8982 jiffies_to_msecs(jiffies) - in qam64auto()
8983 DRXJ_QAM_MAX_WAITTIME - timeout_ofs; in qam64auto()
8994 ((jiffies_to_msecs(jiffies) - start_time) < in qam64auto()
9018 struct drxj_data *ext_attr = demod->my_ext_attr; in qam256auto()
9019 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in qam256auto()
9020 struct drx39xxj_state *state = dev_addr->user_data; in qam256auto()
9021 struct dtv_frontend_properties *p = &state->frontend.dtv_property_cache; in qam256auto()
9046 if (p->cnr.stat[0].svalue > 26800) { in qam256auto()
9055 if ((channel->mirror == DRX_MIRROR_AUTO) && in qam256auto()
9056 ((jiffies_to_msecs(jiffies) - d_locked_time) > in qam256auto()
9058 ext_attr->mirror = DRX_MIRROR_YES; in qam256auto()
9067 timeout_ofs = -DRXJ_QAM_MAX_WAITTIME / 2; in qam256auto()
9080 ((jiffies_to_msecs(jiffies) - start_time) < in qam256auto()
9105 ext_attr = (struct drxj_data *) demod->my_ext_attr; in set_qam_channel()
9108 switch (channel->constellation) { in set_qam_channel()
9112 return -EINVAL; in set_qam_channel()
9115 if (ext_attr->standard != DRX_STANDARD_ITU_B) in set_qam_channel()
9116 return -EINVAL; in set_qam_channel()
9118 ext_attr->constellation = channel->constellation; in set_qam_channel()
9119 if (channel->mirror == DRX_MIRROR_AUTO) in set_qam_channel()
9120 ext_attr->mirror = DRX_MIRROR_NO; in set_qam_channel()
9122 ext_attr->mirror = channel->mirror; in set_qam_channel()
9130 if (channel->constellation == DRX_CONSTELLATION_QAM64) in set_qam_channel()
9142 if (ext_attr->standard == DRX_STANDARD_ITU_B) { in set_qam_channel()
9148 channel->constellation = DRX_CONSTELLATION_QAM256; in set_qam_channel()
9149 ext_attr->constellation = DRX_CONSTELLATION_QAM256; in set_qam_channel()
9150 if (channel->mirror == DRX_MIRROR_AUTO) in set_qam_channel()
9151 ext_attr->mirror = DRX_MIRROR_NO; in set_qam_channel()
9153 ext_attr->mirror = channel->mirror; in set_qam_channel()
9168 channel->constellation = DRX_CONSTELLATION_AUTO; in set_qam_channel()
9173 channel->constellation = DRX_CONSTELLATION_QAM64; in set_qam_channel()
9174 ext_attr->constellation = DRX_CONSTELLATION_QAM64; in set_qam_channel()
9175 if (channel->mirror == DRX_MIRROR_AUTO) in set_qam_channel()
9176 ext_attr->mirror = DRX_MIRROR_NO; in set_qam_channel()
9178 ext_attr->mirror = channel->mirror; in set_qam_channel()
9180 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, in set_qam_channel()
9187 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, in set_qam_channel()
9194 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, in set_qam_channel()
9208 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, in set_qam_channel()
9223 channel->constellation = DRX_CONSTELLATION_AUTO; in set_qam_channel()
9224 } else if (ext_attr->standard == DRX_STANDARD_ITU_C) { in set_qam_channel()
9227 channel->constellation = DRX_CONSTELLATION_QAM64; in set_qam_channel()
9228 ext_attr->constellation = DRX_CONSTELLATION_QAM64; in set_qam_channel()
9231 if (channel->mirror == DRX_MIRROR_AUTO) in set_qam_channel()
9232 ext_attr->mirror = DRX_MIRROR_NO; in set_qam_channel()
9234 ext_attr->mirror = channel->mirror; in set_qam_channel()
9235 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, in set_qam_channel()
9242 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, in set_qam_channel()
9249 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, in set_qam_channel()
9263 rc = drxj_dap_write_reg16(demod->my_i2c_dev_addr, in set_qam_channel()
9276 channel->constellation = DRX_CONSTELLATION_AUTO; in set_qam_channel()
9278 return -EINVAL; in set_qam_channel()
9282 return -EINVAL; in set_qam_channel()
9289 channel->constellation = DRX_CONSTELLATION_AUTO; in set_qam_channel()
9300 * precondition: measurement period & measurement prescale must be set
9314 return -EINVAL; in get_qamrs_err_count()
9349 /* These register values are fetched in non-atomic fashion */ in get_qamrs_err_count()
9352 rs_errors->nr_bit_errors = nr_bit_errors & FEC_RS_NR_BIT_ERRORS__M; in get_qamrs_err_count()
9353 rs_errors->nr_symbol_errors = nr_symbol_errors & FEC_RS_NR_SYMBOL_ERRORS__M; in get_qamrs_err_count()
9354 rs_errors->nr_packet_errors = nr_packet_errors & FEC_RS_NR_PACKET_ERRORS__M; in get_qamrs_err_count()
9355 rs_errors->nr_failures = nr_failures & FEC_RS_NR_FAILURES__M; in get_qamrs_err_count()
9356 rs_errors->nr_snc_par_fail_count = in get_qamrs_err_count()
9370 * \param u16-t Pointer to signal strength data; range 0, .. , 100.
9373 * \retval -EINVAL sig_strength is NULL.
9374 * \retval -EIO Erroneous data, sig_strength contains invalid data.
9383 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in get_sig_strength()
9416 return -EIO; in get_sig_strength()
9419 75 + 25 * (rf_gain - rf_agc_min) / (rf_agc_max - in get_sig_strength()
9426 return -EIO; in get_sig_strength()
9429 20 + 55 * (if_gain - if_agc_sns) / (if_agc_top - if_agc_sns); in get_sig_strength()
9433 return -EIO; in get_sig_strength()
9453 * \retval -EINVAL sig_quality is NULL.
9454 * \retval -EIO Erroneous data, sig_quality contains invalid data.
9456 * Pre-condition: Device must be started and in lock.
9461 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in ctrl_get_qam_sig_quality()
9462 struct drxj_data *ext_attr = demod->my_ext_attr; in ctrl_get_qam_sig_quality()
9463 struct drx39xxj_state *state = dev_addr->user_data; in ctrl_get_qam_sig_quality()
9464 struct dtv_frontend_properties *p = &state->frontend.dtv_property_cache; in ctrl_get_qam_sig_quality()
9466 enum drx_modulation constellation = ext_attr->constellation; in ctrl_get_qam_sig_quality()
9493 p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_get_qam_sig_quality()
9516 fec_rs_period = ext_attr->fec_rs_period; in ctrl_get_qam_sig_quality()
9517 fec_rs_prescale = ext_attr->fec_rs_prescale; in ctrl_get_qam_sig_quality()
9518 rs_bit_cnt = fec_rs_period * fec_rs_prescale * ext_attr->fec_rs_plen; in ctrl_get_qam_sig_quality()
9519 qam_vd_period = ext_attr->qam_vd_period; in ctrl_get_qam_sig_quality()
9520 qam_vd_prescale = ext_attr->qam_vd_prescale; in ctrl_get_qam_sig_quality()
9521 vd_bit_cnt = qam_vd_period * qam_vd_prescale * ext_attr->fec_vd_plen; in ctrl_get_qam_sig_quality()
9541 return -EIO; in ctrl_get_qam_sig_quality()
9544 /* ------------------------------ */ in ctrl_get_qam_sig_quality()
9546 /* ------------------------------ */ in ctrl_get_qam_sig_quality()
9553 qam_sl_mer = log1_times100(qam_sl_sig_power) - log1_times100((u32)qam_sl_err_power); in ctrl_get_qam_sig_quality()
9555 /* ----------------------------------------- */ in ctrl_get_qam_sig_quality()
9557 /* ----------------------------------------- */ in ctrl_get_qam_sig_quality()
9577 qam_vd_ser = m << ((e > 2) ? (e - 3) : e); in ctrl_get_qam_sig_quality()
9579 /* --------------------------------------- */ in ctrl_get_qam_sig_quality()
9581 /* --------------------------------------- */ in ctrl_get_qam_sig_quality()
9582 /* pre RS BER is good if it is below 3.5e-4 */ in ctrl_get_qam_sig_quality()
9589 /* pre Reed-Solomon bit error count */ in ctrl_get_qam_sig_quality()
9623 p->pre_bit_count.stat[0].scale = FE_SCALE_COUNTER; in ctrl_get_qam_sig_quality()
9624 p->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; in ctrl_get_qam_sig_quality()
9625 p->pre_bit_error.stat[0].scale = FE_SCALE_COUNTER; in ctrl_get_qam_sig_quality()
9626 p->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; in ctrl_get_qam_sig_quality()
9627 p->block_error.stat[0].scale = FE_SCALE_COUNTER; in ctrl_get_qam_sig_quality()
9628 p->cnr.stat[0].scale = FE_SCALE_DECIBEL; in ctrl_get_qam_sig_quality()
9630 p->cnr.stat[0].svalue = ((u16) qam_sl_mer) * 100; in ctrl_get_qam_sig_quality()
9631 if (ext_attr->standard == DRX_STANDARD_ITU_B) { in ctrl_get_qam_sig_quality()
9632 p->pre_bit_error.stat[0].uvalue += qam_vd_ser; in ctrl_get_qam_sig_quality()
9633 p->pre_bit_count.stat[0].uvalue += vd_bit_cnt * ((e > 2) ? 1 : 8) / 8; in ctrl_get_qam_sig_quality()
9635 p->pre_bit_error.stat[0].uvalue += qam_pre_rs_ber; in ctrl_get_qam_sig_quality()
9636 p->pre_bit_count.stat[0].uvalue += rs_bit_cnt >> e; in ctrl_get_qam_sig_quality()
9639 p->post_bit_error.stat[0].uvalue += qam_post_rs_ber; in ctrl_get_qam_sig_quality()
9640 p->post_bit_count.stat[0].uvalue += rs_bit_cnt >> e; in ctrl_get_qam_sig_quality()
9642 p->block_error.stat[0].uvalue += pkt_errs; in ctrl_get_qam_sig_quality()
9645 rc = get_acc_pkt_err(demod, &sig_quality->packet_error); in ctrl_get_qam_sig_quality()
9654 p->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_get_qam_sig_quality()
9655 p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_get_qam_sig_quality()
9656 p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_get_qam_sig_quality()
9657 p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_get_qam_sig_quality()
9658 p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_get_qam_sig_quality()
9659 p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_get_qam_sig_quality()
9730 /* -------------------------------------------------------------------------- */
9746 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in power_down_atv()
9845 dev_addr = (struct i2c_device_addr *)demod->my_i2c_dev_addr; in power_down_aud()
9846 ext_attr = (struct drxj_data *) demod->my_ext_attr; in power_down_aud()
9854 ext_attr->aud_data.audio_is_active = false; in power_down_aud()
9870 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in set_orx_nsu_aox()
9912 #define IMPULSE_COSINE_ALPHA_0_3 {-3, -4, -1, 6, 10, 7, -5, -20, -25, -10, 29, 79, 123, 140} /*s…
9913 #define IMPULSE_COSINE_ALPHA_0_5 { 2, 0, -2, -2, 2, 5, 2, -10, -20, -14, 20, 74, 125, 145} /*sqr…
9914 …ne IMPULSE_COSINE_ALPHA_RO_0_5 { 0, 0, 1, 2, 3, 0, -7, -15, -16, 0, 34, 77, 114, 128} /*full rais…
9939 …{DRXJ_16TO8(-92), DRXJ_16TO8(-108), DRXJ_16TO8(100)}, /* TARGET_MODE = 0: PFI_A = -23/32; PFI_… in ctrl_set_oob()
9940 …{DRXJ_16TO8(-64), DRXJ_16TO8(-80), DRXJ_16TO8(80)}, /* TARGET_MODE = 1: PFI_A = -16/32; PFI_B … in ctrl_set_oob()
9941 …{DRXJ_16TO8(-80), DRXJ_16TO8(-98), DRXJ_16TO8(92)}, /* TARGET_MODE = 2, 3: PFI_A = -20/32; PFI_B … in ctrl_set_oob()
9942 …{DRXJ_16TO8(-80), DRXJ_16TO8(-98), DRXJ_16TO8(92)} /* TARGET_MODE = 2, 3: PFI_A = -20/32; PFI_B =… in ctrl_set_oob()
9946 dev_addr = demod->my_i2c_dev_addr; in ctrl_set_oob()
9947 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_set_oob()
9948 mirror_freq_spect_oob = ext_attr->mirror_freq_spect_oob; in ctrl_set_oob()
9974 ext_attr->oob_power_on = false; in ctrl_set_oob()
9978 freq = oob_param->frequency; in ctrl_set_oob()
9980 return -EIO; in ctrl_set_oob()
9981 freq = (freq - 50000) / 50; in ctrl_set_oob()
9986 u16 *trk_filtercfg = ext_attr->oob_trk_filter_cfg; in ctrl_set_oob()
9988 index = (u16) ((freq - 400) / 200); in ctrl_set_oob()
9989 remainder = (u16) ((freq - 400) % 200); in ctrl_set_oob()
9991 trk_filtercfg[index] - (trk_filtercfg[index] - in ctrl_set_oob()
10035 /* 1-data rate;2-frequency */ in ctrl_set_oob()
10036 switch (oob_param->standard) { in ctrl_set_oob()
10040 ((oob_param->spectrum_inverted == true) && in ctrl_set_oob()
10045 ((oob_param->spectrum_inverted == false) && in ctrl_set_oob()
10058 ((oob_param->spectrum_inverted == true) && in ctrl_set_oob()
10063 ((oob_param->spectrum_inverted == false) && in ctrl_set_oob()
10077 ((oob_param->spectrum_inverted == true) && in ctrl_set_oob()
10082 ((oob_param->spectrum_inverted == false) && in ctrl_set_oob()
10150 rc = drxj_dap_write_reg16(dev_addr, ORX_NSU_AOX_LOPOW_W__A, ext_attr->oob_lo_pow, 0); in ctrl_set_oob()
10190 /* AGN_LOCK = {2048>>3, -2048, 8, -8, 0, 1}; */ in ctrl_set_oob()
10196 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_AGN_LOCK_TOTH__A, (u16)(-2048), 0); in ctrl_set_oob()
10206 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_AGN_UNLOCK_TTH__A, (u16)(-8), 0); in ctrl_set_oob()
10217 /* DGN_LOCK = {10, -2048, 8, -8, 0, 1<<1}; */ in ctrl_set_oob()
10223 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_DGN_LOCK_TOTH__A, (u16)(-2048), 0); in ctrl_set_oob()
10233 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_DGN_UNLOCK_TTH__A, (u16)(-8), 0); in ctrl_set_oob()
10244 /* FRQ_LOCK = {15,-2048, 8, -8, 0, 1<<2}; */ in ctrl_set_oob()
10250 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_FRQ_LOCK_TOTH__A, (u16)(-2048), 0); in ctrl_set_oob()
10260 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_FRQ_UNLOCK_TTH__A, (u16)(-8), 0); in ctrl_set_oob()
10271 /* PHA_LOCK = {5000, -2048, 8, -8, 0, 1<<3}; */ in ctrl_set_oob()
10277 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_PHA_LOCK_TOTH__A, (u16)(-2048), 0); in ctrl_set_oob()
10287 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_PHA_UNLOCK_TTH__A, (u16)(-8), 0); in ctrl_set_oob()
10298 /* TIM_LOCK = {300, -2048, 8, -8, 0, 1<<4}; */ in ctrl_set_oob()
10304 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_TIM_LOCK_TOTH__A, (u16)(-2048), 0); in ctrl_set_oob()
10314 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_TIM_UNLOCK_TTH__A, (u16)(-8), 0); in ctrl_set_oob()
10325 /* EQU_LOCK = {20, -2048, 8, -8, 0, 1<<5}; */ in ctrl_set_oob()
10331 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_EQU_LOCK_TOTH__A, (u16)(-2048), 0); in ctrl_set_oob()
10341 rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_ORX_EQU_UNLOCK_TTH__A, (u16)(-4), 0); in ctrl_set_oob()
10352 /* PRE-Filter coefficients (PFI) */ in ctrl_set_oob()
10364 /* NYQUIST-Filter coefficients (NYQ) */ in ctrl_set_oob()
10406 rc = drxj_dap_write_reg16(dev_addr, ORX_NSU_AOX_STHR_W__A, ext_attr->oob_pre_saw, 0); in ctrl_set_oob()
10412 ext_attr->oob_power_on = true; in ctrl_set_oob()
10457 return -EINVAL; in ctrl_set_channel()
10459 dev_addr = demod->my_i2c_dev_addr; in ctrl_set_channel()
10460 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_set_channel()
10461 standard = ext_attr->standard; in ctrl_set_channel()
10474 return -EINVAL; in ctrl_set_channel()
10481 switch (channel->bandwidth) { in ctrl_set_channel()
10484 channel->bandwidth = DRX_BANDWIDTH_6MHZ; in ctrl_set_channel()
10489 return -EINVAL; in ctrl_set_channel()
10494 -check symbolrate and constellation in ctrl_set_channel()
10495 -derive bandwidth from symbolrate (input bandwidth is ignored) in ctrl_set_channel()
10513 if (channel->symbolrate < min_symbol_rate || in ctrl_set_channel()
10514 channel->symbolrate > max_symbol_rate) { in ctrl_set_channel()
10515 return -EINVAL; in ctrl_set_channel()
10518 switch (channel->constellation) { in ctrl_set_channel()
10524 bandwidth_temp = channel->symbolrate * bw_rolloff_factor; in ctrl_set_channel()
10531 channel->bandwidth = DRX_BANDWIDTH_6MHZ; in ctrl_set_channel()
10534 channel->bandwidth = DRX_BANDWIDTH_7MHZ; in ctrl_set_channel()
10536 channel->bandwidth = DRX_BANDWIDTH_8MHZ; in ctrl_set_channel()
10540 return -EINVAL; in ctrl_set_channel()
10545 -check constellation in ctrl_set_channel()
10548 switch (channel->constellation) { in ctrl_set_channel()
10554 return -EINVAL; in ctrl_set_channel()
10557 switch (channel->interleavemode) { in ctrl_set_channel()
10579 return -EINVAL; in ctrl_set_channel()
10583 if ((ext_attr->uio_sma_tx_mode) == DRX_UIO_MODE_FIRMWARE_SAW) { in ctrl_set_channel()
10587 switch (channel->bandwidth) { in ctrl_set_channel()
10599 return -EINVAL; in ctrl_set_channel()
10620 if (channel->mirror == DRX_MIRROR_AUTO) in ctrl_set_channel()
10621 ext_attr->mirror = DRX_MIRROR_NO; in ctrl_set_channel()
10623 ext_attr->mirror = channel->mirror; in ctrl_set_channel()
10648 return -EIO; in ctrl_set_channel()
10652 ext_attr->reset_pkt_err_acc = true; in ctrl_set_channel()
10670 * \retval -EINVAL sig_quality is NULL.
10671 * \retval -EIO Erroneous data, sig_quality contains invalid data.
10678 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in ctrl_sig_quality()
10679 struct drxj_data *ext_attr = demod->my_ext_attr; in ctrl_sig_quality()
10680 struct drx39xxj_state *state = dev_addr->user_data; in ctrl_sig_quality()
10681 struct dtv_frontend_properties *p = &state->frontend.dtv_property_cache; in ctrl_sig_quality()
10682 enum drx_standard standard = ext_attr->standard; in ctrl_sig_quality()
10690 p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10692 p->strength.stat[0].scale = FE_SCALE_RELATIVE; in ctrl_sig_quality()
10693 p->strength.stat[0].uvalue = 65535UL * strength/ 100; in ctrl_sig_quality()
10706 p->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10707 p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10708 p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10709 p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10710 p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10711 p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10712 p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10717 p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10719 p->block_error.stat[0].scale = FE_SCALE_COUNTER; in ctrl_sig_quality()
10720 p->block_error.stat[0].uvalue += err; in ctrl_sig_quality()
10721 p->block_count.stat[0].scale = FE_SCALE_COUNTER; in ctrl_sig_quality()
10722 p->block_count.stat[0].uvalue += pkt; in ctrl_sig_quality()
10725 /* PostViterbi is compute in steps of 10^(-6) */ in ctrl_sig_quality()
10728 pr_err("error %d getting pre-ber\n", rc); in ctrl_sig_quality()
10729 p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10731 p->pre_bit_error.stat[0].scale = FE_SCALE_COUNTER; in ctrl_sig_quality()
10732 p->pre_bit_error.stat[0].uvalue += ber; in ctrl_sig_quality()
10733 p->pre_bit_count.stat[0].scale = FE_SCALE_COUNTER; in ctrl_sig_quality()
10734 p->pre_bit_count.stat[0].uvalue += cnt; in ctrl_sig_quality()
10739 pr_err("error %d getting post-ber\n", rc); in ctrl_sig_quality()
10740 p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10742 p->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; in ctrl_sig_quality()
10743 p->post_bit_error.stat[0].uvalue += ber; in ctrl_sig_quality()
10744 p->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; in ctrl_sig_quality()
10745 p->post_bit_count.stat[0].uvalue += cnt; in ctrl_sig_quality()
10750 p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in ctrl_sig_quality()
10752 p->cnr.stat[0].svalue = mer * 100; in ctrl_sig_quality()
10753 p->cnr.stat[0].scale = FE_SCALE_DECIBEL; in ctrl_sig_quality()
10769 return -EIO; in ctrl_sig_quality()
10805 return -EINVAL; in ctrl_lock_status()
10807 dev_addr = demod->my_i2c_dev_addr; in ctrl_lock_status()
10808 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_lock_status()
10809 standard = ext_attr->standard; in ctrl_lock_status()
10830 return -EIO; in ctrl_lock_status()
10886 return -EINVAL; in ctrl_set_standard()
10888 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_set_standard()
10889 prev_standard = ext_attr->standard; in ctrl_set_standard()
10918 return -EINVAL; in ctrl_set_standard()
10925 ext_attr->standard = *standard; in ctrl_set_standard()
10934 rc = drxj_dap_read_reg16(demod->my_i2c_dev_addr, SCU_RAM_VERSION_HI__A, &dummy, 0); in ctrl_set_standard()
10950 ext_attr->standard = DRX_STANDARD_UNKNOWN; in ctrl_set_standard()
10951 return -EINVAL; in ctrl_set_standard()
10957 ext_attr->standard = DRX_STANDARD_UNKNOWN; in ctrl_set_standard()
10966 if (ext_attr->has_lna) { in drxj_reset_mode()
10969 ext_attr->qam_if_agc_cfg.standard = DRX_STANDARD_ITU_B; in drxj_reset_mode()
10970 ext_attr->qam_if_agc_cfg.ctrl_mode = DRX_AGC_CTRL_OFF; in drxj_reset_mode()
10971 ext_attr->qam_pga_cfg = 140 + (11 * 13); in drxj_reset_mode()
10973 ext_attr->vsb_if_agc_cfg.standard = DRX_STANDARD_8VSB; in drxj_reset_mode()
10974 ext_attr->vsb_if_agc_cfg.ctrl_mode = DRX_AGC_CTRL_OFF; in drxj_reset_mode()
10975 ext_attr->vsb_pga_cfg = 140 + (11 * 13); in drxj_reset_mode()
10979 ext_attr->qam_if_agc_cfg.standard = DRX_STANDARD_ITU_B; in drxj_reset_mode()
10980 ext_attr->qam_if_agc_cfg.ctrl_mode = DRX_AGC_CTRL_AUTO; in drxj_reset_mode()
10981 ext_attr->qam_if_agc_cfg.min_output_level = 0; in drxj_reset_mode()
10982 ext_attr->qam_if_agc_cfg.max_output_level = 0x7FFF; in drxj_reset_mode()
10983 ext_attr->qam_if_agc_cfg.speed = 3; in drxj_reset_mode()
10984 ext_attr->qam_if_agc_cfg.top = 1297; in drxj_reset_mode()
10985 ext_attr->qam_pga_cfg = 140; in drxj_reset_mode()
10987 ext_attr->vsb_if_agc_cfg.standard = DRX_STANDARD_8VSB; in drxj_reset_mode()
10988 ext_attr->vsb_if_agc_cfg.ctrl_mode = DRX_AGC_CTRL_AUTO; in drxj_reset_mode()
10989 ext_attr->vsb_if_agc_cfg.min_output_level = 0; in drxj_reset_mode()
10990 ext_attr->vsb_if_agc_cfg.max_output_level = 0x7FFF; in drxj_reset_mode()
10991 ext_attr->vsb_if_agc_cfg.speed = 3; in drxj_reset_mode()
10992 ext_attr->vsb_if_agc_cfg.top = 1024; in drxj_reset_mode()
10993 ext_attr->vsb_pga_cfg = 140; in drxj_reset_mode()
10998 ext_attr->qam_rf_agc_cfg.standard = DRX_STANDARD_ITU_B; in drxj_reset_mode()
10999 ext_attr->qam_rf_agc_cfg.ctrl_mode = DRX_AGC_CTRL_AUTO; in drxj_reset_mode()
11000 ext_attr->qam_rf_agc_cfg.min_output_level = 0; in drxj_reset_mode()
11001 ext_attr->qam_rf_agc_cfg.max_output_level = 0x7FFF; in drxj_reset_mode()
11002 ext_attr->qam_rf_agc_cfg.speed = 3; in drxj_reset_mode()
11003 ext_attr->qam_rf_agc_cfg.top = 9500; in drxj_reset_mode()
11004 ext_attr->qam_rf_agc_cfg.cut_off_current = 4000; in drxj_reset_mode()
11005 ext_attr->qam_pre_saw_cfg.standard = DRX_STANDARD_ITU_B; in drxj_reset_mode()
11006 ext_attr->qam_pre_saw_cfg.reference = 0x07; in drxj_reset_mode()
11007 ext_attr->qam_pre_saw_cfg.use_pre_saw = true; in drxj_reset_mode()
11010 ext_attr->vsb_rf_agc_cfg.standard = DRX_STANDARD_8VSB; in drxj_reset_mode()
11011 ext_attr->vsb_rf_agc_cfg.ctrl_mode = DRX_AGC_CTRL_AUTO; in drxj_reset_mode()
11012 ext_attr->vsb_rf_agc_cfg.min_output_level = 0; in drxj_reset_mode()
11013 ext_attr->vsb_rf_agc_cfg.max_output_level = 0x7FFF; in drxj_reset_mode()
11014 ext_attr->vsb_rf_agc_cfg.speed = 3; in drxj_reset_mode()
11015 ext_attr->vsb_rf_agc_cfg.top = 9500; in drxj_reset_mode()
11016 ext_attr->vsb_rf_agc_cfg.cut_off_current = 4000; in drxj_reset_mode()
11017 ext_attr->vsb_pre_saw_cfg.standard = DRX_STANDARD_8VSB; in drxj_reset_mode()
11018 ext_attr->vsb_pre_saw_cfg.reference = 0x07; in drxj_reset_mode()
11019 ext_attr->vsb_pre_saw_cfg.use_pre_saw = true; in drxj_reset_mode()
11029 * \retval -EIO I2C error or other failure
11030 * \retval -EINVAL Invalid mode argument.
11043 common_attr = (struct drx_common_attr *) demod->my_common_attr; in ctrl_power_mode()
11044 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_power_mode()
11045 dev_addr = demod->my_i2c_dev_addr; in ctrl_power_mode()
11049 return -EINVAL; in ctrl_power_mode()
11052 if (common_attr->current_power_mode == *mode) in ctrl_power_mode()
11071 return -EINVAL; in ctrl_power_mode()
11075 if ((common_attr->current_power_mode != DRX_POWER_UP)) { in ctrl_power_mode()
11091 /* Set pins with possible pull-ups connected to them in input mode */ in ctrl_power_mode()
11100 switch (ext_attr->standard) { in ctrl_power_mode()
11124 rc = power_down_atv(demod, ext_attr->standard, true); in ctrl_power_mode()
11135 return -EIO; in ctrl_power_mode()
11137 ext_attr->standard = DRX_STANDARD_UNKNOWN; in ctrl_power_mode()
11160 ext_attr->hi_cfg_ctrl |= SIO_HI_RA_RAM_PAR_5_CFG_SLEEP_ZZZ; in ctrl_power_mode()
11169 common_attr->current_power_mode = *mode; in ctrl_power_mode()
11182 * \brief Set Pre-saw reference.
11198 dev_addr = demod->my_i2c_dev_addr; in ctrl_set_cfg_pre_saw()
11199 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_set_cfg_pre_saw()
11202 if ((pre_saw == NULL) || (pre_saw->reference > IQM_AF_PDREF__M) in ctrl_set_cfg_pre_saw()
11204 return -EINVAL; in ctrl_set_cfg_pre_saw()
11208 if ((ext_attr->standard == pre_saw->standard) || in ctrl_set_cfg_pre_saw()
11209 (DRXJ_ISQAMSTD(ext_attr->standard) && in ctrl_set_cfg_pre_saw()
11210 DRXJ_ISQAMSTD(pre_saw->standard)) || in ctrl_set_cfg_pre_saw()
11211 (DRXJ_ISATVSTD(ext_attr->standard) && in ctrl_set_cfg_pre_saw()
11212 DRXJ_ISATVSTD(pre_saw->standard))) { in ctrl_set_cfg_pre_saw()
11213 rc = drxj_dap_write_reg16(dev_addr, IQM_AF_PDREF__A, pre_saw->reference, 0); in ctrl_set_cfg_pre_saw()
11220 /* Store pre-saw settings */ in ctrl_set_cfg_pre_saw()
11221 switch (pre_saw->standard) { in ctrl_set_cfg_pre_saw()
11223 ext_attr->vsb_pre_saw_cfg = *pre_saw; in ctrl_set_cfg_pre_saw()
11229 ext_attr->qam_pre_saw_cfg = *pre_saw; in ctrl_set_cfg_pre_saw()
11233 return -EINVAL; in ctrl_set_cfg_pre_saw()
11264 return -EINVAL; in ctrl_set_cfg_afe_gain()
11266 dev_addr = demod->my_i2c_dev_addr; in ctrl_set_cfg_afe_gain()
11267 ext_attr = (struct drxj_data *) demod->my_ext_attr; in ctrl_set_cfg_afe_gain()
11269 switch (afe_gain->standard) { in ctrl_set_cfg_afe_gain()
11279 return -EINVAL; in ctrl_set_cfg_afe_gain()
11285 if (afe_gain->gain >= 329) in ctrl_set_cfg_afe_gain()
11287 else if (afe_gain->gain <= 147) in ctrl_set_cfg_afe_gain()
11290 gain = (afe_gain->gain - 140 + 6) / 13; in ctrl_set_cfg_afe_gain()
11293 if (ext_attr->standard == afe_gain->standard) { in ctrl_set_cfg_afe_gain()
11302 switch (afe_gain->standard) { in ctrl_set_cfg_afe_gain()
11304 ext_attr->vsb_pga_cfg = gain * 13 + 140; in ctrl_set_cfg_afe_gain()
11310 ext_attr->qam_pga_cfg = gain * 13 + 140; in ctrl_set_cfg_afe_gain()
11314 return -EIO; in ctrl_set_cfg_afe_gain()
11356 (demod->my_common_attr == NULL) || in drxj_open()
11357 (demod->my_ext_attr == NULL) || in drxj_open()
11358 (demod->my_i2c_dev_addr == NULL) || in drxj_open()
11359 (demod->my_common_attr->is_opened)) { in drxj_open()
11360 return -EINVAL; in drxj_open()
11364 if (demod->my_ext_attr == NULL) in drxj_open()
11365 return -EINVAL; in drxj_open()
11367 dev_addr = demod->my_i2c_dev_addr; in drxj_open()
11368 ext_attr = (struct drxj_data *) demod->my_ext_attr; in drxj_open()
11369 common_attr = (struct drx_common_attr *) demod->my_common_attr; in drxj_open()
11377 rc = -EINVAL; in drxj_open()
11390 * Soft reset of sys- and osc-clockdomain in drxj_open()
11394 * Btw, this is coherent with DRX-K, where we send reset codes in drxj_open()
11395 * for modulation (OFTM, in DRX-k), SYS and OSC clock domains. in drxj_open()
11435 memcpy(&cfg_mpeg_output, &common_attr->mpeg_cfg, sizeof(cfg_mpeg_output)); in drxj_open()
11457 if (common_attr->microcode_file != NULL) { in drxj_open()
11460 common_attr->is_opened = true; in drxj_open()
11461 ucode_info.mc_file = common_attr->microcode_file; in drxj_open()
11463 if (DRX_ISPOWERDOWNMODE(demod->my_common_attr->current_power_mode)) { in drxj_open()
11465 return -EINVAL; in drxj_open()
11473 if (common_attr->verify_microcode == true) { in drxj_open()
11481 common_attr->is_opened = false; in drxj_open()
11491 /* Initialize scan timeout */ in drxj_open()
11492 common_attr->scan_demod_lock_timeout = DRXJ_SCAN_TIMEOUT; in drxj_open()
11493 common_attr->scan_desired_lock = DRX_LOCKED; in drxj_open()
11496 ext_attr->standard = DRX_STANDARD_UNKNOWN; in drxj_open()
11541 ext_attr->aud_data = drxj_default_aud_data_g; in drxj_open()
11543 demod->my_common_attr->is_opened = true; in drxj_open()
11547 common_attr->is_opened = false; in drxj_open()
11560 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in drxj_close()
11564 if ((demod->my_common_attr == NULL) || in drxj_close()
11565 (demod->my_ext_attr == NULL) || in drxj_close()
11566 (demod->my_i2c_dev_addr == NULL) || in drxj_close()
11567 (!demod->my_common_attr->is_opened)) { in drxj_close()
11568 return -EINVAL; in drxj_close()
11604 * drx_u_code_compute_crc - Compute CRC of block of microcode data.
11632 * drx_check_firmware - checks if the loaded firmware is valid
11714 return -EINVAL; in drx_check_firmware()
11718 * drx_ctrl_u_code - Handle microcode upload or verify.
11725 * - In case of UCODE_UPLOAD: code is successfully uploaded.
11726 * - In case of UCODE_VERIFY: image on device is equal to
11728 * -EIO:
11729 * - In case of UCODE_UPLOAD: I2C error.
11730 * - In case of UCODE_VERIFY: I2C error or image on device
11732 * -EINVAL:
11733 * - Invalid arguments.
11734 * - Provided image is corrupt
11740 struct i2c_device_addr *dev_addr = demod->my_i2c_dev_addr; in drx_ctrl_u_code()
11751 if (!mc_info || !mc_info->mc_file) in drx_ctrl_u_code()
11752 return -EINVAL; in drx_ctrl_u_code()
11754 mc_file = mc_info->mc_file; in drx_ctrl_u_code()
11756 if (!demod->firmware) { in drx_ctrl_u_code()
11759 rc = request_firmware(&fw, mc_file, demod->i2c->dev.parent); in drx_ctrl_u_code()
11764 demod->firmware = fw; in drx_ctrl_u_code()
11766 if (demod->firmware->size < 2 * sizeof(u16)) { in drx_ctrl_u_code()
11767 rc = -EINVAL; in drx_ctrl_u_code()
11773 mc_file, demod->firmware->size); in drx_ctrl_u_code()
11776 mc_data_init = demod->firmware->data; in drx_ctrl_u_code()
11777 size = demod->firmware->size; in drx_ctrl_u_code()
11787 rc = -EINVAL; in drx_ctrl_u_code()
11817 (mc_data - mc_data_init), block_hdr.addr, in drx_ctrl_u_code()
11821 - data larger than 64Kb in drx_ctrl_u_code()
11822 - if CRC enabled check CRC in drx_ctrl_u_code()
11829 rc = -EINVAL; in drx_ctrl_u_code()
11846 rc = -EIO; in drx_ctrl_u_code()
11848 mc_data - mc_data_init); in drx_ctrl_u_code()
11872 mc_data - mc_data_init); in drx_ctrl_u_code()
11873 return -EIO; in drx_ctrl_u_code()
11881 mc_data - mc_data_init); in drx_ctrl_u_code()
11882 return -EIO; in drx_ctrl_u_code()
11887 bytes_left -=((u32) bytes_to_comp); in drx_ctrl_u_code()
11892 return -EINVAL; in drx_ctrl_u_code()
11901 release_firmware(demod->firmware); in drx_ctrl_u_code()
11902 demod->firmware = NULL; in drx_ctrl_u_code()
11916 /* Configure user-I/O #3: enable read/write */ in drxj_set_lna_state()
11942 struct drx39xxj_state *state = fe->demodulator_priv; in drx39xxj_set_powerstate()
11943 struct drx_demod_instance *demod = state->demod; in drx39xxj_set_powerstate()
11963 struct drx39xxj_state *state = fe->demodulator_priv; in drx39xxj_read_status()
11964 struct drx_demod_instance *demod = state->demod; in drx39xxj_read_status()
12011 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in drx39xxj_read_ber()
12013 if (p->pre_bit_error.stat[0].scale == FE_SCALE_NOT_AVAILABLE) { in drx39xxj_read_ber()
12018 if (!p->pre_bit_count.stat[0].uvalue) { in drx39xxj_read_ber()
12019 if (!p->pre_bit_error.stat[0].uvalue) in drx39xxj_read_ber()
12024 *ber = frac_times1e6(p->pre_bit_error.stat[0].uvalue, in drx39xxj_read_ber()
12025 p->pre_bit_count.stat[0].uvalue); in drx39xxj_read_ber()
12033 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in drx39xxj_read_signal_strength()
12035 if (p->strength.stat[0].scale == FE_SCALE_NOT_AVAILABLE) { in drx39xxj_read_signal_strength()
12040 *strength = p->strength.stat[0].uvalue; in drx39xxj_read_signal_strength()
12046 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in drx39xxj_read_snr()
12049 if (p->cnr.stat[0].scale == FE_SCALE_NOT_AVAILABLE) { in drx39xxj_read_snr()
12054 tmp64 = p->cnr.stat[0].svalue; in drx39xxj_read_snr()
12062 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in drx39xxj_read_ucblocks()
12064 if (p->block_error.stat[0].scale == FE_SCALE_NOT_AVAILABLE) { in drx39xxj_read_ucblocks()
12069 *ucb = p->block_error.stat[0].uvalue; in drx39xxj_read_ucblocks()
12078 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in drx39xxj_set_frontend()
12079 struct drx39xxj_state *state = fe->demodulator_priv; in drx39xxj_set_frontend()
12080 struct drx_demod_instance *demod = state->demod; in drx39xxj_set_frontend()
12106 if (fe->ops.tuner_ops.set_params) { in drx39xxj_set_frontend()
12109 if (fe->ops.i2c_gate_ctrl) in drx39xxj_set_frontend()
12110 fe->ops.i2c_gate_ctrl(fe, 1); in drx39xxj_set_frontend()
12113 fe->ops.tuner_ops.set_params(fe); in drx39xxj_set_frontend()
12116 if (fe->ops.tuner_ops.get_if_frequency) { in drx39xxj_set_frontend()
12117 fe->ops.tuner_ops.get_if_frequency(fe, &int_freq); in drx39xxj_set_frontend()
12118 demod->my_common_attr->intermediate_freq = int_freq / 1000; in drx39xxj_set_frontend()
12121 if (fe->ops.i2c_gate_ctrl) in drx39xxj_set_frontend()
12122 fe->ops.i2c_gate_ctrl(fe, 0); in drx39xxj_set_frontend()
12125 switch (p->delivery_system) { in drx39xxj_set_frontend()
12132 switch (p->modulation) { in drx39xxj_set_frontend()
12145 return -EINVAL; in drx39xxj_set_frontend()
12152 return -EINVAL; in drx39xxj_set_frontend()
12157 channel.frequency = p->frequency / 1000; in drx39xxj_set_frontend()
12165 return -EINVAL; in drx39xxj_set_frontend()
12171 p->strength.stat[0].scale = FE_SCALE_RELATIVE; in drx39xxj_set_frontend()
12178 /* power-down the demodulator */ in drx39xxj_sleep()
12184 struct drx39xxj_state *state = fe->demodulator_priv; in drx39xxj_i2c_gate_ctrl()
12185 struct drx_demod_instance *demod = state->demod; in drx39xxj_i2c_gate_ctrl()
12191 state->i2c_gate_open); in drx39xxj_i2c_gate_ctrl()
12199 if (state->i2c_gate_open == enable) { in drx39xxj_i2c_gate_ctrl()
12210 state->i2c_gate_open = enable; in drx39xxj_i2c_gate_ctrl()
12217 struct drx39xxj_state *state = fe->demodulator_priv; in drx39xxj_init()
12218 struct drx_demod_instance *demod = state->demod; in drx39xxj_init()
12221 if (fe->exit == DVB_FE_DEVICE_RESUME) { in drx39xxj_init()
12223 demod->my_common_attr->is_opened = false; in drx39xxj_init()
12235 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in drx39xxj_set_lna()
12236 struct drx39xxj_state *state = fe->demodulator_priv; in drx39xxj_set_lna()
12237 struct drx_demod_instance *demod = state->demod; in drx39xxj_set_lna()
12238 struct drxj_data *ext_attr = demod->my_ext_attr; in drx39xxj_set_lna()
12240 if (c->lna) { in drx39xxj_set_lna()
12241 if (!ext_attr->has_lna) { in drx39xxj_set_lna()
12243 return -EINVAL; in drx39xxj_set_lna()
12248 return drxj_set_lna_state(demod, c->lna); in drx39xxj_set_lna()
12254 tune->min_delay_ms = 1000; in drx39xxj_get_tune_settings()
12260 struct drx39xxj_state *state = fe->demodulator_priv; in drx39xxj_release()
12261 struct drx_demod_instance *demod = state->demod; in drx39xxj_release()
12264 if (fe->exit != DVB_FE_DEVICE_REMOVED) in drx39xxj_release()
12267 kfree(demod->my_ext_attr); in drx39xxj_release()
12268 kfree(demod->my_common_attr); in drx39xxj_release()
12269 kfree(demod->my_i2c_dev_addr); in drx39xxj_release()
12270 release_firmware(demod->firmware); in drx39xxj_release()
12313 state->i2c = i2c; in drx39xxj_attach()
12314 state->demod = demod; in drx39xxj_attach()
12317 demod->my_i2c_dev_addr = demod_addr; in drx39xxj_attach()
12318 demod->my_common_attr = demod_comm_attr; in drx39xxj_attach()
12319 demod->my_i2c_dev_addr->user_data = state; in drx39xxj_attach()
12320 demod->my_common_attr->microcode_file = DRX39XX_MAIN_FIRMWARE; in drx39xxj_attach()
12321 demod->my_common_attr->verify_microcode = true; in drx39xxj_attach()
12322 demod->my_common_attr->intermediate_freq = 5000; in drx39xxj_attach()
12323 demod->my_common_attr->current_power_mode = DRX_POWER_DOWN; in drx39xxj_attach()
12324 demod->my_ext_attr = demod_ext_attr; in drx39xxj_attach()
12325 ((struct drxj_data *)demod_ext_attr)->uio_sma_tx_mode = DRX_UIO_MODE_READWRITE; in drx39xxj_attach()
12326 demod->i2c = i2c; in drx39xxj_attach()
12335 memcpy(&state->frontend.ops, &drx39xxj_ops, in drx39xxj_attach()
12338 state->frontend.demodulator_priv = state; in drx39xxj_attach()
12340 /* Initialize stats - needed for DVBv5 stats to work */ in drx39xxj_attach()
12341 p = &state->frontend.dtv_property_cache; in drx39xxj_attach()
12342 p->strength.len = 1; in drx39xxj_attach()
12343 p->pre_bit_count.len = 1; in drx39xxj_attach()
12344 p->pre_bit_error.len = 1; in drx39xxj_attach()
12345 p->post_bit_count.len = 1; in drx39xxj_attach()
12346 p->post_bit_error.len = 1; in drx39xxj_attach()
12347 p->block_count.len = 1; in drx39xxj_attach()
12348 p->block_error.len = 1; in drx39xxj_attach()
12349 p->cnr.len = 1; in drx39xxj_attach()
12351 p->strength.stat[0].scale = FE_SCALE_RELATIVE; in drx39xxj_attach()
12352 p->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in drx39xxj_attach()
12353 p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in drx39xxj_attach()
12354 p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in drx39xxj_attach()
12355 p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in drx39xxj_attach()
12356 p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in drx39xxj_attach()
12357 p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in drx39xxj_attach()
12358 p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in drx39xxj_attach()
12360 return &state->frontend; in drx39xxj_attach()