aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2010-06-17 19:56:27 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 15:43:12 -0400
commit8af5e3813b78e429c1774bfac67033c3948c9c8e (patch)
tree0e892da5b66acd3d1296dc01a677f411662148e2 /drivers/media
parent737fabf051e1e438f5cb81db84e559cede94dafb (diff)
V4L/DVB: af9013: af9013_read_status() refactoring
Function af9013_read_status() refactoring. Read lock bits in different order to save count of register reads. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/af9013.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/media/dvb/frontends/af9013.c b/drivers/media/dvb/frontends/af9013.c
index c85ab3e31773..c10271aa3628 100644
--- a/drivers/media/dvb/frontends/af9013.c
+++ b/drivers/media/dvb/frontends/af9013.c
@@ -1184,45 +1184,49 @@ static int af9013_read_status(struct dvb_frontend *fe, fe_status_t *status)
1184 u8 tmp; 1184 u8 tmp;
1185 *status = 0; 1185 *status = 0;
1186 1186
1187 /* TPS lock */
1188 ret = af9013_read_reg_bits(state, 0xd330, 3, 1, &tmp);
1189 if (ret)
1190 goto error;
1191 if (tmp)
1192 *status |= FE_HAS_VITERBI | FE_HAS_CARRIER | FE_HAS_SIGNAL;
1193
1194 /* MPEG2 lock */ 1187 /* MPEG2 lock */
1195 ret = af9013_read_reg_bits(state, 0xd507, 6, 1, &tmp); 1188 ret = af9013_read_reg_bits(state, 0xd507, 6, 1, &tmp);
1196 if (ret) 1189 if (ret)
1197 goto error; 1190 goto error;
1198 if (tmp) 1191 if (tmp)
1199 *status |= FE_HAS_SYNC | FE_HAS_LOCK; 1192 *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI |
1193 FE_HAS_SYNC | FE_HAS_LOCK;
1200 1194
1201 if (!(*status & FE_HAS_SIGNAL)) { 1195 if (!*status) {
1202 /* AGC lock */ 1196 /* TPS lock */
1203 ret = af9013_read_reg_bits(state, 0xd1a0, 6, 1, &tmp); 1197 ret = af9013_read_reg_bits(state, 0xd330, 3, 1, &tmp);
1204 if (ret) 1198 if (ret)
1205 goto error; 1199 goto error;
1206 if (tmp) 1200 if (tmp)
1207 *status |= FE_HAS_SIGNAL; 1201 *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER |
1202 FE_HAS_VITERBI;
1208 } 1203 }
1209 1204
1210 if (!(*status & FE_HAS_CARRIER)) { 1205 if (!*status) {
1211 /* CFO lock */ 1206 /* CFO lock */
1212 ret = af9013_read_reg_bits(state, 0xd333, 7, 1, &tmp); 1207 ret = af9013_read_reg_bits(state, 0xd333, 7, 1, &tmp);
1213 if (ret) 1208 if (ret)
1214 goto error; 1209 goto error;
1215 if (tmp) 1210 if (tmp)
1216 *status |= FE_HAS_CARRIER; 1211 *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER;
1217 } 1212 }
1218 1213
1219 if (!(*status & FE_HAS_CARRIER)) { 1214 if (!*status) {
1220 /* SFOE lock */ 1215 /* SFOE lock */
1221 ret = af9013_read_reg_bits(state, 0xd334, 6, 1, &tmp); 1216 ret = af9013_read_reg_bits(state, 0xd334, 6, 1, &tmp);
1222 if (ret) 1217 if (ret)
1223 goto error; 1218 goto error;
1224 if (tmp) 1219 if (tmp)
1225 *status |= FE_HAS_CARRIER; 1220 *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER;
1221 }
1222
1223 if (!*status) {
1224 /* AGC lock */
1225 ret = af9013_read_reg_bits(state, 0xd1a0, 6, 1, &tmp);
1226 if (ret)
1227 goto error;
1228 if (tmp)
1229 *status |= FE_HAS_SIGNAL;
1226 } 1230 }
1227 1231
1228 ret = af9013_update_statistics(fe); 1232 ret = af9013_update_statistics(fe);