aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGianluca Gennari <gennarone@gmail.com>2012-02-20 05:50:33 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-08 09:20:12 -0500
commitd138210ffa90e6c78e3f7a2c348f50e865ff735c (patch)
treefe67b12533e79aa800cdf713d710d11f75d810d8 /drivers
parent9bd58e77e656abe08f3f781d982bc9e29167e1c3 (diff)
[media] smsdvb: fix get_frontend
In the get_frontend function, an internal copy of the dtv_frontend_properties struct (which is never initialized) is copied over the frontend property cache data structure, resetting everything to 0. In particular, the delivery system is reset to 0 (which is an invalid value) so the driver stops working as soon as a DVBv3 application calls the get_frontend function, giving this error: dvb_frontend_ioctl_legacy: doesn't know how to handle a DVBv3 call to delivery system 0 This patch eliminates the unused internal copy of the dtv_frontend_properties struct, and gives a proper implementation of the get_frontend function. The original author of the patch is Panagiotis Malakoudis, who also tested this new version on Ubuntu 11.10 with the latest media_build tree installed. The original patch has been used on MIPS set-top-boxes for over one year, but it was never posted on the linux-media list. I ported the code to the current media_build tree (converting it to use the dtv_frontend_properties struct) and added basic support for ISDB-T (untested). Signed-off-by: Panagiotis Malakoudis <malakudi@gmail.com> Signed-off-by: Gianluca Gennari <gennarone@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/siano/smsdvb.c123
1 files changed, 116 insertions, 7 deletions
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c
index e2dc80da82cc..aa77e54a8fae 100644
--- a/drivers/media/dvb/siano/smsdvb.c
+++ b/drivers/media/dvb/siano/smsdvb.c
@@ -49,9 +49,6 @@ struct smsdvb_client_t {
49 49
50 struct completion tune_done; 50 struct completion tune_done;
51 51
52 /* todo: save freq/band instead whole struct */
53 struct dtv_frontend_properties fe_params;
54
55 struct SMSHOSTLIB_STATISTICS_DVB_S sms_stat_dvb; 52 struct SMSHOSTLIB_STATISTICS_DVB_S sms_stat_dvb;
56 int event_fe_state; 53 int event_fe_state;
57 int event_unc_state; 54 int event_unc_state;
@@ -744,12 +741,124 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe)
744 struct dtv_frontend_properties *fep = &fe->dtv_property_cache; 741 struct dtv_frontend_properties *fep = &fe->dtv_property_cache;
745 struct smsdvb_client_t *client = 742 struct smsdvb_client_t *client =
746 container_of(fe, struct smsdvb_client_t, frontend); 743 container_of(fe, struct smsdvb_client_t, frontend);
744 struct smscore_device_t *coredev = client->coredev;
745 struct TRANSMISSION_STATISTICS_S *td =
746 &client->sms_stat_dvb.TransmissionData;
747 747
748 sms_debug(""); 748 switch (smscore_get_device_mode(coredev)) {
749 case DEVICE_MODE_DVBT:
750 case DEVICE_MODE_DVBT_BDA:
751 fep->frequency = td->Frequency;
752
753 switch (td->Bandwidth) {
754 case 6:
755 fep->bandwidth_hz = 6000000;
756 break;
757 case 7:
758 fep->bandwidth_hz = 7000000;
759 break;
760 case 8:
761 fep->bandwidth_hz = 8000000;
762 break;
763 }
764
765 switch (td->TransmissionMode) {
766 case 2:
767 fep->transmission_mode = TRANSMISSION_MODE_2K;
768 break;
769 case 8:
770 fep->transmission_mode = TRANSMISSION_MODE_8K;
771 }
772
773 switch (td->GuardInterval) {
774 case 0:
775 fep->guard_interval = GUARD_INTERVAL_1_32;
776 break;
777 case 1:
778 fep->guard_interval = GUARD_INTERVAL_1_16;
779 break;
780 case 2:
781 fep->guard_interval = GUARD_INTERVAL_1_8;
782 break;
783 case 3:
784 fep->guard_interval = GUARD_INTERVAL_1_4;
785 break;
786 }
787
788 switch (td->CodeRate) {
789 case 0:
790 fep->code_rate_HP = FEC_1_2;
791 break;
792 case 1:
793 fep->code_rate_HP = FEC_2_3;
794 break;
795 case 2:
796 fep->code_rate_HP = FEC_3_4;
797 break;
798 case 3:
799 fep->code_rate_HP = FEC_5_6;
800 break;
801 case 4:
802 fep->code_rate_HP = FEC_7_8;
803 break;
804 }
805
806 switch (td->LPCodeRate) {
807 case 0:
808 fep->code_rate_LP = FEC_1_2;
809 break;
810 case 1:
811 fep->code_rate_LP = FEC_2_3;
812 break;
813 case 2:
814 fep->code_rate_LP = FEC_3_4;
815 break;
816 case 3:
817 fep->code_rate_LP = FEC_5_6;
818 break;
819 case 4:
820 fep->code_rate_LP = FEC_7_8;
821 break;
822 }
823
824 switch (td->Constellation) {
825 case 0:
826 fep->modulation = QPSK;
827 break;
828 case 1:
829 fep->modulation = QAM_16;
830 break;
831 case 2:
832 fep->modulation = QAM_64;
833 break;
834 }
835
836 switch (td->Hierarchy) {
837 case 0:
838 fep->hierarchy = HIERARCHY_NONE;
839 break;
840 case 1:
841 fep->hierarchy = HIERARCHY_1;
842 break;
843 case 2:
844 fep->hierarchy = HIERARCHY_2;
845 break;
846 case 3:
847 fep->hierarchy = HIERARCHY_4;
848 break;
849 }
749 850
750 /* todo: */ 851 fep->inversion = INVERSION_AUTO;
751 memcpy(fep, &client->fe_params, 852 break;
752 sizeof(struct dtv_frontend_properties)); 853 case DEVICE_MODE_ISDBT:
854 case DEVICE_MODE_ISDBT_BDA:
855 fep->frequency = td->Frequency;
856 fep->bandwidth_hz = 6000000;
857 /* todo: retrive the other parameters */
858 break;
859 default:
860 return -EINVAL;
861 }
753 862
754 return 0; 863 return 0;
755} 864}