@@ -894,38 +894,64 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
894894}
895895
896896static void dvb_frontend_get_frequency_limits (struct dvb_frontend * fe ,
897- u32 * freq_min , u32 * freq_max )
897+ u32 * freq_min , u32 * freq_max ,
898+ u32 * tolerance )
898899{
899900 struct dtv_frontend_properties * c = & fe -> dtv_property_cache ;
900- __u32 tuner_min = fe -> ops .tuner_ops .info .frequency_min_hz ;
901- __u32 tuner_max = fe -> ops .tuner_ops .info .frequency_max_hz ;
901+ u32 tuner_min = fe -> ops .tuner_ops .info .frequency_min_hz ;
902+ u32 tuner_max = fe -> ops .tuner_ops .info .frequency_max_hz ;
903+ u32 frontend_min = fe -> ops .info .frequency_min_hz ;
904+ u32 frontend_max = fe -> ops .info .frequency_max_hz ;
905+
906+ * freq_min = max (frontend_min , tuner_min );
907+
908+ if (frontend_max == 0 )
909+ * freq_max = tuner_max ;
910+ else if (tuner_max == 0 )
911+ * freq_max = frontend_max ;
912+ else
913+ * freq_max = min (frontend_max , tuner_max );
914+
915+ if (* freq_min == 0 || * freq_max == 0 )
916+ dev_warn (fe -> dvb -> device ,
917+ "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n" ,
918+ fe -> dvb -> num , fe -> id );
902919
903920 /* If the standard is for satellite, convert frequencies to kHz */
904921 switch (c -> delivery_system ) {
905922 case SYS_DVBS :
906923 case SYS_DVBS2 :
907924 case SYS_TURBO :
908925 case SYS_ISDBS :
909- tuner_max /= kHz ;
910- tuner_min /= kHz ;
926+ * freq_min /= kHz ;
927+ * freq_max /= kHz ;
928+ if (tolerance )
929+ * tolerance = fe -> ops .info .frequency_tolerance_hz / kHz ;
930+
911931 break ;
912932 default :
933+ if (tolerance )
934+ * tolerance = fe -> ops .info .frequency_tolerance_hz ;
913935 break ;
914936 }
937+ }
915938
916- * freq_min = max (fe -> ops .info .frequency_min , tuner_min );
917-
918- if (fe -> ops .info .frequency_max == 0 )
919- * freq_max = tuner_max ;
920- else if (tuner_max == 0 )
921- * freq_max = fe -> ops .info .frequency_max ;
922- else
923- * freq_max = min (fe -> ops .info .frequency_max , tuner_max );
939+ static u32 dvb_frontend_get_stepsize (struct dvb_frontend * fe )
940+ {
941+ struct dtv_frontend_properties * c = & fe -> dtv_property_cache ;
942+ u32 step = fe -> ops .info .frequency_stepsize_hz ;
943+ switch (c -> delivery_system ) {
944+ case SYS_DVBS :
945+ case SYS_DVBS2 :
946+ case SYS_TURBO :
947+ case SYS_ISDBS :
948+ step /= kHz ;
949+ break ;
950+ default :
951+ break ;
952+ }
924953
925- if (* freq_min == 0 || * freq_max == 0 )
926- dev_warn (fe -> dvb -> device ,
927- "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n" ,
928- fe -> dvb -> num , fe -> id );
954+ return step ;
929955}
930956
931957static int dvb_frontend_check_parameters (struct dvb_frontend * fe )
@@ -935,7 +961,7 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
935961 u32 freq_max ;
936962
937963 /* range check: frequency */
938- dvb_frontend_get_frequency_limits (fe , & freq_min , & freq_max );
964+ dvb_frontend_get_frequency_limits (fe , & freq_min , & freq_max , NULL );
939965 if ((freq_min && c -> frequency < freq_min ) ||
940966 (freq_max && c -> frequency > freq_max )) {
941967 dev_warn (fe -> dvb -> device , "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n" ,
@@ -2261,8 +2287,8 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
22612287 case SYS_ISDBT :
22622288 case SYS_DTMB :
22632289 fepriv -> min_delay = HZ / 20 ;
2264- fepriv -> step_size = fe -> ops . info . frequency_stepsize * 2 ;
2265- fepriv -> max_drift = (fe -> ops . info . frequency_stepsize * 2 ) + 1 ;
2290+ fepriv -> step_size = dvb_frontend_get_stepsize ( fe ) * 2 ;
2291+ fepriv -> max_drift = (dvb_frontend_get_stepsize ( fe ) * 2 ) + 1 ;
22662292 break ;
22672293 default :
22682294 /*
@@ -2391,9 +2417,17 @@ static int dvb_frontend_handle_ioctl(struct file *file,
23912417
23922418 case FE_GET_INFO : {
23932419 struct dvb_frontend_info * info = parg ;
2394-
2395- memcpy (info , & fe -> ops .info , sizeof (struct dvb_frontend_info ));
2396- dvb_frontend_get_frequency_limits (fe , & info -> frequency_min , & info -> frequency_max );
2420+ memset (info , 0 , sizeof (* info ));
2421+
2422+ strcpy (info -> name , fe -> ops .info .name );
2423+ info -> symbol_rate_min = fe -> ops .info .symbol_rate_min ;
2424+ info -> symbol_rate_max = fe -> ops .info .symbol_rate_max ;
2425+ info -> symbol_rate_tolerance = fe -> ops .info .symbol_rate_tolerance ;
2426+ info -> caps = fe -> ops .info .caps ;
2427+ info -> frequency_stepsize = dvb_frontend_get_stepsize (fe );
2428+ dvb_frontend_get_frequency_limits (fe , & info -> frequency_min ,
2429+ & info -> frequency_max ,
2430+ & info -> frequency_tolerance );
23972431
23982432 /*
23992433 * Associate the 4 delivery systems supported by DVBv3
@@ -2423,10 +2457,10 @@ static int dvb_frontend_handle_ioctl(struct file *file,
24232457 dev_err (fe -> dvb -> device ,
24242458 "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n" ,
24252459 __func__ , c -> delivery_system );
2426- fe -> ops . info . type = FE_OFDM ;
2460+ info -> type = FE_OFDM ;
24272461 }
24282462 dev_dbg (fe -> dvb -> device , "%s: current delivery system on cache: %d, V3 type: %d\n" ,
2429- __func__ , c -> delivery_system , fe -> ops . info . type );
2463+ __func__ , c -> delivery_system , info -> type );
24302464
24312465 /* Set CAN_INVERSION_AUTO bit on in other than oneshot mode */
24322466 if (!(fepriv -> tune_mode_flags & FE_TUNE_MODE_ONESHOT ))
0 commit comments