aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-17 20:40:53 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:09:41 -0400
commit92b75ab0752636802da9a63093dcbbe296ec1fef (patch)
treef35e2c4ca4cb0e00535412e40dfb781fc8ac6ab8 /drivers/media
parent102a0b0879a01a413ed5f667f7db9c2085ca8474 (diff)
V4L/DVB (7605): tuner-xc3028: Avoids too much firmware reloads
xc3028_sleep function is being used with a different meaning. This should be called only before doing S1/S3 sleep. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/tuner-xc2028.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c
index 62b5de231e0d..95d5922eac95 100644
--- a/drivers/media/video/tuner-xc2028.c
+++ b/drivers/media/video/tuner-xc2028.c
@@ -235,6 +235,7 @@ static v4l2_std_id parse_audio_std_option(void)
235static void free_firmware(struct xc2028_data *priv) 235static void free_firmware(struct xc2028_data *priv)
236{ 236{
237 int i; 237 int i;
238 tuner_dbg("%s called\n", __func__);
238 239
239 if (!priv->firm) 240 if (!priv->firm)
240 return; 241 return;
@@ -1050,27 +1051,6 @@ static int xc2028_set_params(struct dvb_frontend *fe,
1050 T_DIGITAL_TV, type, 0, demod); 1051 T_DIGITAL_TV, type, 0, demod);
1051} 1052}
1052 1053
1053static int xc2028_sleep(struct dvb_frontend *fe)
1054{
1055 struct xc2028_data *priv = fe->tuner_priv;
1056 int rc = 0;
1057
1058 tuner_dbg("%s called\n", __func__);
1059
1060 mutex_lock(&priv->lock);
1061
1062 if (priv->firm_version < 0x0202)
1063 rc = send_seq(priv, {0x00, 0x08, 0x00, 0x00});
1064 else
1065 rc = send_seq(priv, {0x80, 0x08, 0x00, 0x00});
1066
1067 priv->cur_fw.type = 0; /* need firmware reload */
1068
1069 mutex_unlock(&priv->lock);
1070
1071 return rc;
1072}
1073
1074 1054
1075static int xc2028_dvb_release(struct dvb_frontend *fe) 1055static int xc2028_dvb_release(struct dvb_frontend *fe)
1076{ 1056{
@@ -1118,21 +1098,21 @@ static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)
1118 1098
1119 mutex_lock(&priv->lock); 1099 mutex_lock(&priv->lock);
1120 1100
1121 kfree(priv->ctrl.fname);
1122 free_firmware(priv);
1123
1124 memcpy(&priv->ctrl, p, sizeof(priv->ctrl)); 1101 memcpy(&priv->ctrl, p, sizeof(priv->ctrl));
1125 priv->ctrl.fname = NULL; 1102 if (priv->ctrl.max_len < 9)
1103 priv->ctrl.max_len = 13;
1126 1104
1127 if (p->fname) { 1105 if (p->fname) {
1106 if (priv->ctrl.fname && strcmp(p->fname, priv->ctrl.fname)) {
1107 kfree(priv->ctrl.fname);
1108 free_firmware(priv);
1109 }
1110
1128 priv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL); 1111 priv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL);
1129 if (priv->ctrl.fname == NULL) 1112 if (priv->ctrl.fname == NULL)
1130 rc = -ENOMEM; 1113 rc = -ENOMEM;
1131 } 1114 }
1132 1115
1133 if (priv->ctrl.max_len < 9)
1134 priv->ctrl.max_len = 13;
1135
1136 mutex_unlock(&priv->lock); 1116 mutex_unlock(&priv->lock);
1137 1117
1138 return rc; 1118 return rc;
@@ -1152,8 +1132,6 @@ static const struct dvb_tuner_ops xc2028_dvb_tuner_ops = {
1152 .get_frequency = xc2028_get_frequency, 1132 .get_frequency = xc2028_get_frequency,
1153 .get_rf_strength = xc2028_signal, 1133 .get_rf_strength = xc2028_signal,
1154 .set_params = xc2028_set_params, 1134 .set_params = xc2028_set_params,
1155 .sleep = xc2028_sleep,
1156
1157}; 1135};
1158 1136
1159struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, 1137struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,