aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c20
-rw-r--r--drivers/media/dvb/frontends/tda18271-priv.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
index c1da16ad07e7..e860f4c009c2 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -598,26 +598,36 @@ static int tda18271_init(struct dvb_frontend *fe)
598{ 598{
599 struct tda18271_priv *priv = fe->tuner_priv; 599 struct tda18271_priv *priv = fe->tuner_priv;
600 600
601 mutex_lock(&priv->lock);
602
601 /* initialization */ 603 /* initialization */
602 tda18271_ir_cal_init(fe); 604 tda18271_ir_cal_init(fe);
603 605
604 if (priv->id == TDA18271HDC2) 606 if (priv->id == TDA18271HDC2)
605 tda18271_rf_cal_init(fe); 607 tda18271_rf_cal_init(fe);
606 608
609 mutex_unlock(&priv->lock);
610
607 return 0; 611 return 0;
608} 612}
609 613
610static int tda18271c2_tune(struct dvb_frontend *fe, 614static int tda18271c2_tune(struct dvb_frontend *fe,
611 u32 ifc, u32 freq, u32 bw, u8 std) 615 u32 ifc, u32 freq, u32 bw, u8 std)
612{ 616{
617 struct tda18271_priv *priv = fe->tuner_priv;
618
613 tda_dbg("freq = %d, ifc = %d\n", freq, ifc); 619 tda_dbg("freq = %d, ifc = %d\n", freq, ifc);
614 620
615 tda18271_init(fe); 621 tda18271_init(fe);
616 622
623 mutex_lock(&priv->lock);
624
617 tda18271_rf_tracking_filters_correction(fe, freq); 625 tda18271_rf_tracking_filters_correction(fe, freq);
618 626
619 tda18271_channel_configuration(fe, ifc, freq, bw, std); 627 tda18271_channel_configuration(fe, ifc, freq, bw, std);
620 628
629 mutex_unlock(&priv->lock);
630
621 return 0; 631 return 0;
622} 632}
623 633
@@ -632,6 +642,8 @@ static int tda18271c1_tune(struct dvb_frontend *fe,
632 642
633 tda18271_init(fe); 643 tda18271_init(fe);
634 644
645 mutex_lock(&priv->lock);
646
635 tda_dbg("freq = %d, ifc = %d\n", freq, ifc); 647 tda_dbg("freq = %d, ifc = %d\n", freq, ifc);
636 648
637 /* RF tracking filter calibration */ 649 /* RF tracking filter calibration */
@@ -766,6 +778,7 @@ static int tda18271c1_tune(struct dvb_frontend *fe,
766 778
767 tda18271_write_regs(fe, R_TM, 15); 779 tda18271_write_regs(fe, R_TM, 15);
768 msleep(5); 780 msleep(5);
781 mutex_unlock(&priv->lock);
769 782
770 return 0; 783 return 0;
771} 784}
@@ -1012,7 +1025,9 @@ static int tda18271_get_id(struct dvb_frontend *fe)
1012 char *name; 1025 char *name;
1013 int ret = 0; 1026 int ret = 0;
1014 1027
1028 mutex_lock(&priv->lock);
1015 tda18271_read_regs(fe); 1029 tda18271_read_regs(fe);
1030 mutex_unlock(&priv->lock);
1016 1031
1017 switch (regs[R_ID] & 0x7f) { 1032 switch (regs[R_ID] & 0x7f) {
1018 case 3: 1033 case 3:
@@ -1065,6 +1080,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1065 priv->i2c_adap = i2c; 1080 priv->i2c_adap = i2c;
1066 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; 1081 priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
1067 priv->cal_initialized = false; 1082 priv->cal_initialized = false;
1083 mutex_init(&priv->lock);
1068 1084
1069 fe->tuner_priv = priv; 1085 fe->tuner_priv = priv;
1070 1086
@@ -1084,8 +1100,12 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1084 if (tda18271_debug & DBG_MAP) 1100 if (tda18271_debug & DBG_MAP)
1085 tda18271_dump_std_map(fe); 1101 tda18271_dump_std_map(fe);
1086 1102
1103 mutex_lock(&priv->lock);
1104
1087 tda18271_init_regs(fe); 1105 tda18271_init_regs(fe);
1088 1106
1107 mutex_unlock(&priv->lock);
1108
1089 return fe; 1109 return fe;
1090fail: 1110fail:
1091 tda18271_release(fe); 1111 tda18271_release(fe);
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h
index b4d1ab770ca2..af89cfab0066 100644
--- a/drivers/media/dvb/frontends/tda18271-priv.h
+++ b/drivers/media/dvb/frontends/tda18271-priv.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/mutex.h>
26#include "tda18271.h" 27#include "tda18271.h"
27 28
28#define R_ID 0x00 /* ID byte */ 29#define R_ID 0x00 /* ID byte */
@@ -112,6 +113,8 @@ struct tda18271_priv {
112 struct tda18271_std_map std; 113 struct tda18271_std_map std;
113 struct tda18271_rf_tracking_filter_cal rf_cal_state[8]; 114 struct tda18271_rf_tracking_filter_cal rf_cal_state[8];
114 115
116 struct mutex lock;
117
115 u32 frequency; 118 u32 frequency;
116 u32 bandwidth; 119 u32 bandwidth;
117}; 120};