diff options
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 82 |
1 files changed, 54 insertions, 28 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 7172f66a6a28..c8ee379159e2 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -1143,6 +1143,13 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) | |||
1143 | fw_files_24xxx, ARRAY_SIZE(fw_files_24xxx) | 1143 | fw_files_24xxx, ARRAY_SIZE(fw_files_24xxx) |
1144 | }, | 1144 | }, |
1145 | }; | 1145 | }; |
1146 | |||
1147 | if ((hdw->hdw_type >= ARRAY_SIZE(fw_file_defs)) || | ||
1148 | (!fw_file_defs[hdw->hdw_type].lst)) { | ||
1149 | hdw->fw1_state = FW1_STATE_OK; | ||
1150 | return 0; | ||
1151 | } | ||
1152 | |||
1146 | hdw->fw1_state = FW1_STATE_FAILED; // default result | 1153 | hdw->fw1_state = FW1_STATE_FAILED; // default result |
1147 | 1154 | ||
1148 | trace_firmware("pvr2_upload_firmware1"); | 1155 | trace_firmware("pvr2_upload_firmware1"); |
@@ -1224,6 +1231,11 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) | |||
1224 | CX2341X_FIRM_ENC_FILENAME, | 1231 | CX2341X_FIRM_ENC_FILENAME, |
1225 | }; | 1232 | }; |
1226 | 1233 | ||
1234 | if ((hdw->hdw_type != PVR2_HDW_TYPE_29XXX) && | ||
1235 | (hdw->hdw_type != PVR2_HDW_TYPE_24XXX)) { | ||
1236 | return 0; | ||
1237 | } | ||
1238 | |||
1227 | trace_firmware("pvr2_upload_firmware2"); | 1239 | trace_firmware("pvr2_upload_firmware2"); |
1228 | 1240 | ||
1229 | ret = pvr2_locate_firmware(hdw,&fw_entry,"encoder", | 1241 | ret = pvr2_locate_firmware(hdw,&fw_entry,"encoder", |
@@ -1742,29 +1754,35 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) | |||
1742 | unsigned int idx; | 1754 | unsigned int idx; |
1743 | struct pvr2_ctrl *cptr; | 1755 | struct pvr2_ctrl *cptr; |
1744 | int reloadFl = 0; | 1756 | int reloadFl = 0; |
1745 | if (!reloadFl) { | 1757 | if ((hdw->hdw_type == PVR2_HDW_TYPE_29XXX) || |
1746 | reloadFl = (hdw->usb_intf->cur_altsetting->desc.bNumEndpoints | 1758 | (hdw->hdw_type == PVR2_HDW_TYPE_24XXX)) { |
1747 | == 0); | 1759 | if (!reloadFl) { |
1748 | if (reloadFl) { | 1760 | reloadFl = |
1749 | pvr2_trace(PVR2_TRACE_INIT, | 1761 | (hdw->usb_intf->cur_altsetting->desc.bNumEndpoints |
1750 | "USB endpoint config looks strange" | 1762 | == 0); |
1751 | "; possibly firmware needs to be loaded"); | 1763 | if (reloadFl) { |
1764 | pvr2_trace(PVR2_TRACE_INIT, | ||
1765 | "USB endpoint config looks strange" | ||
1766 | "; possibly firmware needs to be" | ||
1767 | " loaded"); | ||
1768 | } | ||
1752 | } | 1769 | } |
1753 | } | 1770 | if (!reloadFl) { |
1754 | if (!reloadFl) { | 1771 | reloadFl = !pvr2_hdw_check_firmware(hdw); |
1755 | reloadFl = !pvr2_hdw_check_firmware(hdw); | 1772 | if (reloadFl) { |
1756 | if (reloadFl) { | 1773 | pvr2_trace(PVR2_TRACE_INIT, |
1757 | pvr2_trace(PVR2_TRACE_INIT, | 1774 | "Check for FX2 firmware failed" |
1758 | "Check for FX2 firmware failed" | 1775 | "; possibly firmware needs to be" |
1759 | "; possibly firmware needs to be loaded"); | 1776 | " loaded"); |
1777 | } | ||
1760 | } | 1778 | } |
1761 | } | 1779 | if (reloadFl) { |
1762 | if (reloadFl) { | 1780 | if (pvr2_upload_firmware1(hdw) != 0) { |
1763 | if (pvr2_upload_firmware1(hdw) != 0) { | 1781 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
1764 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 1782 | "Failure uploading firmware1"); |
1765 | "Failure uploading firmware1"); | 1783 | } |
1784 | return; | ||
1766 | } | 1785 | } |
1767 | return; | ||
1768 | } | 1786 | } |
1769 | hdw->fw1_state = FW1_STATE_OK; | 1787 | hdw->fw1_state = FW1_STATE_OK; |
1770 | 1788 | ||
@@ -1773,17 +1791,25 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) | |||
1773 | } | 1791 | } |
1774 | if (!pvr2_hdw_dev_ok(hdw)) return; | 1792 | if (!pvr2_hdw_dev_ok(hdw)) return; |
1775 | 1793 | ||
1776 | for (idx = 0; idx < pvr2_client_lists[hdw->hdw_type].cnt; idx++) { | 1794 | if (hdw->hdw_type < ARRAY_SIZE(pvr2_client_lists)) { |
1777 | request_module(pvr2_client_lists[hdw->hdw_type].lst[idx]); | 1795 | for (idx = 0; |
1796 | idx < pvr2_client_lists[hdw->hdw_type].cnt; | ||
1797 | idx++) { | ||
1798 | request_module( | ||
1799 | pvr2_client_lists[hdw->hdw_type].lst[idx]); | ||
1800 | } | ||
1778 | } | 1801 | } |
1779 | 1802 | ||
1780 | pvr2_hdw_cmd_powerup(hdw); | 1803 | if ((hdw->hdw_type == PVR2_HDW_TYPE_29XXX) || |
1781 | if (!pvr2_hdw_dev_ok(hdw)) return; | 1804 | (hdw->hdw_type == PVR2_HDW_TYPE_24XXX)) { |
1805 | pvr2_hdw_cmd_powerup(hdw); | ||
1806 | if (!pvr2_hdw_dev_ok(hdw)) return; | ||
1782 | 1807 | ||
1783 | if (pvr2_upload_firmware2(hdw)){ | 1808 | if (pvr2_upload_firmware2(hdw)){ |
1784 | pvr2_trace(PVR2_TRACE_ERROR_LEGS,"device unstable!!"); | 1809 | pvr2_trace(PVR2_TRACE_ERROR_LEGS,"device unstable!!"); |
1785 | pvr2_hdw_render_useless(hdw); | 1810 | pvr2_hdw_render_useless(hdw); |
1786 | return; | 1811 | return; |
1812 | } | ||
1787 | } | 1813 | } |
1788 | 1814 | ||
1789 | // This step MUST happen after the earlier powerup step. | 1815 | // This step MUST happen after the earlier powerup step. |