aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/si470x/radio-si470x-usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/radio/si470x/radio-si470x-usb.c')
-rw-r--r--drivers/media/radio/si470x/radio-si470x-usb.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index 2f5cf6c7234d..f2d0e1ddb301 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -138,16 +138,12 @@ MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*");
138 138
139 139
140/************************************************************************** 140/**************************************************************************
141 * Software/Hardware Versions 141 * Software/Hardware Versions from Scratch Page
142 **************************************************************************/ 142 **************************************************************************/
143#define RADIO_SW_VERSION_NOT_BOOTLOADABLE 6 143#define RADIO_SW_VERSION_NOT_BOOTLOADABLE 6
144#define RADIO_SW_VERSION 7 144#define RADIO_SW_VERSION 7
145#define RADIO_SW_VERSION_CURRENT 15
146#define RADIO_HW_VERSION 1 145#define RADIO_HW_VERSION 1
147 146
148#define SCRATCH_PAGE_SW_VERSION 1
149#define SCRATCH_PAGE_HW_VERSION 2
150
151 147
152 148
153/************************************************************************** 149/**************************************************************************
@@ -745,6 +741,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
745 struct usb_host_interface *iface_desc; 741 struct usb_host_interface *iface_desc;
746 struct usb_endpoint_descriptor *endpoint; 742 struct usb_endpoint_descriptor *endpoint;
747 int i, int_end_size, retval = 0; 743 int i, int_end_size, retval = 0;
744 unsigned char version_warning = 0;
748 745
749 /* private data allocation and initialization */ 746 /* private data allocation and initialization */
750 radio = kzalloc(sizeof(struct si470x_device), GFP_KERNEL); 747 radio = kzalloc(sizeof(struct si470x_device), GFP_KERNEL);
@@ -801,13 +798,22 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
801 sizeof(si470x_viddev_template)); 798 sizeof(si470x_viddev_template));
802 video_set_drvdata(radio->videodev, radio); 799 video_set_drvdata(radio->videodev, radio);
803 800
804 /* show some infos about the specific si470x device */ 801 /* get device and chip versions */
805 if (si470x_get_all_registers(radio) < 0) { 802 if (si470x_get_all_registers(radio) < 0) {
806 retval = -EIO; 803 retval = -EIO;
807 goto err_video; 804 goto err_video;
808 } 805 }
809 dev_info(&intf->dev, "DeviceID=0x%4.4hx ChipID=0x%4.4hx\n", 806 dev_info(&intf->dev, "DeviceID=0x%4.4hx ChipID=0x%4.4hx\n",
810 radio->registers[DEVICEID], radio->registers[CHIPID]); 807 radio->registers[DEVICEID], radio->registers[CHIPID]);
808 if ((radio->registers[CHIPID] & CHIPID_FIRMWARE) < RADIO_FW_VERSION) {
809 dev_warn(&intf->dev,
810 "This driver is known to work with "
811 "firmware version %hu,\n", RADIO_FW_VERSION);
812 dev_warn(&intf->dev,
813 "but the device has firmware version %hu.\n",
814 radio->registers[CHIPID] & CHIPID_FIRMWARE);
815 version_warning = 1;
816 }
811 817
812 /* get software and hardware versions */ 818 /* get software and hardware versions */
813 if (si470x_get_scratch_page_versions(radio) < 0) { 819 if (si470x_get_scratch_page_versions(radio) < 0) {
@@ -816,16 +822,27 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
816 } 822 }
817 dev_info(&intf->dev, "software version %d, hardware version %d\n", 823 dev_info(&intf->dev, "software version %d, hardware version %d\n",
818 radio->software_version, radio->hardware_version); 824 radio->software_version, radio->hardware_version);
819 825 if (radio->software_version < RADIO_SW_VERSION) {
820 /* check if device and firmware is current */
821 if ((radio->registers[CHIPID] & CHIPID_FIRMWARE)
822 < RADIO_SW_VERSION_CURRENT) {
823 dev_warn(&intf->dev, 826 dev_warn(&intf->dev,
824 "This driver is known to work with " 827 "This driver is known to work with "
825 "firmware version %hu,\n", RADIO_SW_VERSION_CURRENT); 828 "software version %hu,\n", RADIO_SW_VERSION);
826 dev_warn(&intf->dev, 829 dev_warn(&intf->dev,
827 "but the device has firmware version %hu.\n", 830 "but the device has software version %hu.\n",
828 radio->registers[CHIPID] & CHIPID_FIRMWARE); 831 radio->software_version);
832 version_warning = 1;
833 }
834 if (radio->hardware_version < RADIO_HW_VERSION) {
835 dev_warn(&intf->dev,
836 "This driver is known to work with "
837 "hardware version %hu,\n", RADIO_HW_VERSION);
838 dev_warn(&intf->dev,
839 "but the device has hardware version %hu.\n",
840 radio->hardware_version);
841 version_warning = 1;
842 }
843
844 /* give out version warning */
845 if (version_warning == 1) {
829 dev_warn(&intf->dev, 846 dev_warn(&intf->dev,
830 "If you have some trouble using this driver,\n"); 847 "If you have some trouble using this driver,\n");
831 dev_warn(&intf->dev, 848 dev_warn(&intf->dev,