forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/dvb-frontends/cxd2841er.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * cxd2841er.c
34 *
....@@ -9,16 +10,6 @@
910 * Copyright (C) 2014 NetUP Inc.
1011 * Copyright (C) 2014 Sergey Kozlov <serjk@netup.ru>
1112 * 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.
2213 */
2314
2415 #include <linux/module.h>
....@@ -69,6 +60,7 @@
6960 enum cxd2841er_xtal xtal;
7061 enum fe_caps caps;
7162 u32 flags;
63
+ unsigned long stats_time;
7264 };
7365
7466 static const struct cxd2841er_cnr_data s_cn_data[] = {
....@@ -2947,7 +2939,7 @@
29472939 ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01);
29482940 /* Set SLV-T Bank : 0x18 */
29492941 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18);
2950
- /* Pre-RS BER moniter setting */
2942
+ /* Pre-RS BER monitor setting */
29512943 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x36, 0x40, 0x07);
29522944 /* FEC Auto Recovery setting */
29532945 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01);
....@@ -3288,9 +3280,15 @@
32883280 p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
32893281
32903282 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
+
32913290 cxd2841er_read_snr(fe);
32923291 cxd2841er_read_ucblocks(fe);
3293
-
32943292 cxd2841er_read_ber(fe);
32953293 } else {
32963294 p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
....@@ -3368,6 +3366,9 @@
33683366 p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
33693367 p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
33703368 p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
3369
+
3370
+ /* Reset the wait for jiffies logic */
3371
+ priv->stats_time = 0;
33713372
33723373 return ret;
33733374 }
....@@ -3929,14 +3930,14 @@
39293930 {
39303931 return cxd2841er_attach(cfg, i2c, SYS_DVBS);
39313932 }
3932
-EXPORT_SYMBOL(cxd2841er_attach_s);
3933
+EXPORT_SYMBOL_GPL(cxd2841er_attach_s);
39333934
39343935 struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg,
39353936 struct i2c_adapter *i2c)
39363937 {
39373938 return cxd2841er_attach(cfg, i2c, 0);
39383939 }
3939
-EXPORT_SYMBOL(cxd2841er_attach_t_c);
3940
+EXPORT_SYMBOL_GPL(cxd2841er_attach_t_c);
39403941
39413942 static const struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = {
39423943 .delsys = { SYS_DVBS, SYS_DVBS2 },