| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * cxd2841er.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * Copyright (C) 2014 NetUP Inc. |
|---|
| 10 | 11 | * Copyright (C) 2014 Sergey Kozlov <serjk@netup.ru> |
|---|
| 11 | 12 | * Copyright (C) 2014 Abylay Ospan <aospan@netup.ru> |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 14 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 15 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 16 | | - * (at your option) any later version. |
|---|
| 17 | | - * |
|---|
| 18 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 19 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 20 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 21 | | - * GNU General Public License for more details. |
|---|
| 22 | 13 | */ |
|---|
| 23 | 14 | |
|---|
| 24 | 15 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 69 | 60 | enum cxd2841er_xtal xtal; |
|---|
| 70 | 61 | enum fe_caps caps; |
|---|
| 71 | 62 | u32 flags; |
|---|
| 63 | + unsigned long stats_time; |
|---|
| 72 | 64 | }; |
|---|
| 73 | 65 | |
|---|
| 74 | 66 | static const struct cxd2841er_cnr_data s_cn_data[] = { |
|---|
| .. | .. |
|---|
| 2947 | 2939 | ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); |
|---|
| 2948 | 2940 | /* Set SLV-T Bank : 0x18 */ |
|---|
| 2949 | 2941 | cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); |
|---|
| 2950 | | - /* Pre-RS BER moniter setting */ |
|---|
| 2942 | + /* Pre-RS BER monitor setting */ |
|---|
| 2951 | 2943 | cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x36, 0x40, 0x07); |
|---|
| 2952 | 2944 | /* FEC Auto Recovery setting */ |
|---|
| 2953 | 2945 | cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); |
|---|
| .. | .. |
|---|
| 3288 | 3280 | p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
|---|
| 3289 | 3281 | |
|---|
| 3290 | 3282 | if (status & FE_HAS_LOCK) { |
|---|
| 3283 | + if (priv->stats_time && |
|---|
| 3284 | + (!time_after(jiffies, priv->stats_time))) |
|---|
| 3285 | + return 0; |
|---|
| 3286 | + |
|---|
| 3287 | + /* Prevent retrieving stats faster than once per second */ |
|---|
| 3288 | + priv->stats_time = jiffies + msecs_to_jiffies(1000); |
|---|
| 3289 | + |
|---|
| 3291 | 3290 | cxd2841er_read_snr(fe); |
|---|
| 3292 | 3291 | cxd2841er_read_ucblocks(fe); |
|---|
| 3293 | | - |
|---|
| 3294 | 3292 | cxd2841er_read_ber(fe); |
|---|
| 3295 | 3293 | } else { |
|---|
| 3296 | 3294 | p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
|---|
| .. | .. |
|---|
| 3368 | 3366 | p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
|---|
| 3369 | 3367 | p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
|---|
| 3370 | 3368 | p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
|---|
| 3369 | + |
|---|
| 3370 | + /* Reset the wait for jiffies logic */ |
|---|
| 3371 | + priv->stats_time = 0; |
|---|
| 3371 | 3372 | |
|---|
| 3372 | 3373 | return ret; |
|---|
| 3373 | 3374 | } |
|---|
| .. | .. |
|---|
| 3929 | 3930 | { |
|---|
| 3930 | 3931 | return cxd2841er_attach(cfg, i2c, SYS_DVBS); |
|---|
| 3931 | 3932 | } |
|---|
| 3932 | | -EXPORT_SYMBOL(cxd2841er_attach_s); |
|---|
| 3933 | +EXPORT_SYMBOL_GPL(cxd2841er_attach_s); |
|---|
| 3933 | 3934 | |
|---|
| 3934 | 3935 | struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg, |
|---|
| 3935 | 3936 | struct i2c_adapter *i2c) |
|---|
| 3936 | 3937 | { |
|---|
| 3937 | 3938 | return cxd2841er_attach(cfg, i2c, 0); |
|---|
| 3938 | 3939 | } |
|---|
| 3939 | | -EXPORT_SYMBOL(cxd2841er_attach_t_c); |
|---|
| 3940 | +EXPORT_SYMBOL_GPL(cxd2841er_attach_t_c); |
|---|
| 3940 | 3941 | |
|---|
| 3941 | 3942 | static const struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = { |
|---|
| 3942 | 3943 | .delsys = { SYS_DVBS, SYS_DVBS2 }, |
|---|