diff options
author | Dean Anderson <linux-dev@sensoray.com> | 2010-04-12 14:05:37 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:57:48 -0400 |
commit | eb78deecb496a8b0888d24f1cfa73f6e907b82e2 (patch) | |
tree | 30065068a2392064d276ad1d24b2fc38a488b1b7 | |
parent | b187913c77adbd865194c6b8072764e3474d56ea (diff) |
V4L/DVB: s2255drv: firmware reload on timeout
Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/s2255drv.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 4dc001b0519a..ac9c40cf5835 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -58,7 +58,7 @@ | |||
58 | #include <linux/usb.h> | 58 | #include <linux/usb.h> |
59 | 59 | ||
60 | #define S2255_MAJOR_VERSION 1 | 60 | #define S2255_MAJOR_VERSION 1 |
61 | #define S2255_MINOR_VERSION 19 | 61 | #define S2255_MINOR_VERSION 20 |
62 | #define S2255_RELEASE 0 | 62 | #define S2255_RELEASE 0 |
63 | #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ | 63 | #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ |
64 | S2255_MINOR_VERSION, \ | 64 | S2255_MINOR_VERSION, \ |
@@ -1755,7 +1755,7 @@ static int s2255_open(struct file *file) | |||
1755 | == S2255_FW_SUCCESS) || | 1755 | == S2255_FW_SUCCESS) || |
1756 | (atomic_read(&dev->fw_data->fw_state) | 1756 | (atomic_read(&dev->fw_data->fw_state) |
1757 | == S2255_FW_DISCONNECTING)), | 1757 | == S2255_FW_DISCONNECTING)), |
1758 | msecs_to_jiffies(S2255_LOAD_TIMEOUT)); | 1758 | msecs_to_jiffies(S2255_LOAD_TIMEOUT)); |
1759 | /* state may have changed, re-read */ | 1759 | /* state may have changed, re-read */ |
1760 | state = atomic_read(&dev->fw_data->fw_state); | 1760 | state = atomic_read(&dev->fw_data->fw_state); |
1761 | break; | 1761 | break; |
@@ -1763,27 +1763,38 @@ static int s2255_open(struct file *file) | |||
1763 | default: | 1763 | default: |
1764 | break; | 1764 | break; |
1765 | } | 1765 | } |
1766 | mutex_unlock(&dev->open_lock); | ||
1767 | /* state may have changed in above switch statement */ | 1766 | /* state may have changed in above switch statement */ |
1768 | switch (state) { | 1767 | switch (state) { |
1769 | case S2255_FW_SUCCESS: | 1768 | case S2255_FW_SUCCESS: |
1770 | break; | 1769 | break; |
1771 | case S2255_FW_FAILED: | 1770 | case S2255_FW_FAILED: |
1772 | printk(KERN_INFO "2255 firmware load failed.\n"); | 1771 | printk(KERN_INFO "2255 firmware load failed.\n"); |
1772 | mutex_unlock(&dev->open_lock); | ||
1773 | return -ENODEV; | 1773 | return -ENODEV; |
1774 | case S2255_FW_DISCONNECTING: | 1774 | case S2255_FW_DISCONNECTING: |
1775 | printk(KERN_INFO "%s: disconnecting\n", __func__); | 1775 | printk(KERN_INFO "%s: disconnecting\n", __func__); |
1776 | mutex_unlock(&dev->open_lock); | ||
1776 | return -ENODEV; | 1777 | return -ENODEV; |
1777 | case S2255_FW_LOADED_DSPWAIT: | 1778 | case S2255_FW_LOADED_DSPWAIT: |
1778 | case S2255_FW_NOTLOADED: | 1779 | case S2255_FW_NOTLOADED: |
1779 | printk(KERN_INFO "%s: firmware not loaded yet" | 1780 | printk(KERN_INFO "%s: firmware not loaded yet" |
1780 | "please try again later\n", | 1781 | "please try again later\n", |
1781 | __func__); | 1782 | __func__); |
1783 | /* | ||
1784 | * Timeout on firmware load means device unusable. | ||
1785 | * Set firmware failure state. | ||
1786 | * On next s2255_open the firmware will be reloaded. | ||
1787 | */ | ||
1788 | atomic_set(&dev->fw_data->fw_state, | ||
1789 | S2255_FW_FAILED); | ||
1790 | mutex_unlock(&dev->open_lock); | ||
1782 | return -EAGAIN; | 1791 | return -EAGAIN; |
1783 | default: | 1792 | default: |
1784 | printk(KERN_INFO "%s: unknown state\n", __func__); | 1793 | printk(KERN_INFO "%s: unknown state\n", __func__); |
1794 | mutex_unlock(&dev->open_lock); | ||
1785 | return -EFAULT; | 1795 | return -EFAULT; |
1786 | } | 1796 | } |
1797 | mutex_unlock(&dev->open_lock); | ||
1787 | /* allocate + initialize per filehandle data */ | 1798 | /* allocate + initialize per filehandle data */ |
1788 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 1799 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
1789 | if (NULL == fh) | 1800 | if (NULL == fh) |
@@ -2074,7 +2085,6 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info) | |||
2074 | dprintk(5, "setmode ready %d\n", cc); | 2085 | dprintk(5, "setmode ready %d\n", cc); |
2075 | break; | 2086 | break; |
2076 | case S2255_RESPONSE_FW: | 2087 | case S2255_RESPONSE_FW: |
2077 | |||
2078 | dev->chn_ready |= (1 << cc); | 2088 | dev->chn_ready |= (1 << cc); |
2079 | if ((dev->chn_ready & 0x0f) != 0x0f) | 2089 | if ((dev->chn_ready & 0x0f) != 0x0f) |
2080 | break; | 2090 | break; |