diff options
Diffstat (limited to 'drivers')
308 files changed, 4298 insertions, 2188 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index a43fa1a57d57..1502c50273b5 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" | 36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" |
37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 | 37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 |
38 | static DEFINE_MUTEX(isolated_cpus_lock); | 38 | static DEFINE_MUTEX(isolated_cpus_lock); |
39 | static DEFINE_MUTEX(round_robin_lock); | ||
39 | 40 | ||
40 | static unsigned long power_saving_mwait_eax; | 41 | static unsigned long power_saving_mwait_eax; |
41 | 42 | ||
@@ -107,7 +108,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
107 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) | 108 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) |
108 | return; | 109 | return; |
109 | 110 | ||
110 | mutex_lock(&isolated_cpus_lock); | 111 | mutex_lock(&round_robin_lock); |
111 | cpumask_clear(tmp); | 112 | cpumask_clear(tmp); |
112 | for_each_cpu(cpu, pad_busy_cpus) | 113 | for_each_cpu(cpu, pad_busy_cpus) |
113 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); | 114 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); |
@@ -116,7 +117,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
116 | if (cpumask_empty(tmp)) | 117 | if (cpumask_empty(tmp)) |
117 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); | 118 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); |
118 | if (cpumask_empty(tmp)) { | 119 | if (cpumask_empty(tmp)) { |
119 | mutex_unlock(&isolated_cpus_lock); | 120 | mutex_unlock(&round_robin_lock); |
120 | return; | 121 | return; |
121 | } | 122 | } |
122 | for_each_cpu(cpu, tmp) { | 123 | for_each_cpu(cpu, tmp) { |
@@ -131,7 +132,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
131 | tsk_in_cpu[tsk_index] = preferred_cpu; | 132 | tsk_in_cpu[tsk_index] = preferred_cpu; |
132 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); | 133 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); |
133 | cpu_weight[preferred_cpu]++; | 134 | cpu_weight[preferred_cpu]++; |
134 | mutex_unlock(&isolated_cpus_lock); | 135 | mutex_unlock(&round_robin_lock); |
135 | 136 | ||
136 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); | 137 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); |
137 | } | 138 | } |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 0ed85cac3231..615996a36bed 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -95,18 +95,6 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags) | |||
95 | return_ACPI_STATUS(status); | 95 | return_ACPI_STATUS(status); |
96 | } | 96 | } |
97 | 97 | ||
98 | if (sleep_state != ACPI_STATE_S5) { | ||
99 | /* | ||
100 | * Disable BM arbitration. This feature is contained within an | ||
101 | * optional register (PM2 Control), so ignore a BAD_ADDRESS | ||
102 | * exception. | ||
103 | */ | ||
104 | status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1); | ||
105 | if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) { | ||
106 | return_ACPI_STATUS(status); | ||
107 | } | ||
108 | } | ||
109 | |||
110 | /* | 98 | /* |
111 | * 1) Disable/Clear all GPEs | 99 | * 1) Disable/Clear all GPEs |
112 | * 2) Enable all wakeup GPEs | 100 | * 2) Enable all wakeup GPEs |
@@ -364,16 +352,6 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state, u8 flags) | |||
364 | [ACPI_EVENT_POWER_BUTTON]. | 352 | [ACPI_EVENT_POWER_BUTTON]. |
365 | status_register_id, ACPI_CLEAR_STATUS); | 353 | status_register_id, ACPI_CLEAR_STATUS); |
366 | 354 | ||
367 | /* | ||
368 | * Enable BM arbitration. This feature is contained within an | ||
369 | * optional register (PM2 Control), so ignore a BAD_ADDRESS | ||
370 | * exception. | ||
371 | */ | ||
372 | status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0); | ||
373 | if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) { | ||
374 | return_ACPI_STATUS(status); | ||
375 | } | ||
376 | |||
377 | acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING); | 355 | acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING); |
378 | return_ACPI_STATUS(status); | 356 | return_ACPI_STATUS(status); |
379 | } | 357 | } |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index 23ce09686418..fe6626035495 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -638,7 +638,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data, | |||
638 | /* Create the new outer package and populate it */ | 638 | /* Create the new outer package and populate it */ |
639 | 639 | ||
640 | status = | 640 | status = |
641 | acpi_ns_wrap_with_package(data, *elements, | 641 | acpi_ns_wrap_with_package(data, return_object, |
642 | return_object_ptr); | 642 | return_object_ptr); |
643 | if (ACPI_FAILURE(status)) { | 643 | if (ACPI_FAILURE(status)) { |
644 | return (status); | 644 | return (status); |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 5577762daee1..6686b1eaf13e 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
@@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct apei_exec_context *ctx, | |||
243 | u8 ins = entry->instruction; | 243 | u8 ins = entry->instruction; |
244 | 244 | ||
245 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) | 245 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) |
246 | return acpi_os_map_generic_address(&entry->register_region); | 246 | return apei_map_generic_address(&entry->register_region); |
247 | 247 | ||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
@@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struct apei_exec_context *ctx, | |||
276 | u8 ins = entry->instruction; | 276 | u8 ins = entry->instruction; |
277 | 277 | ||
278 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) | 278 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) |
279 | acpi_os_unmap_generic_address(&entry->register_region); | 279 | apei_unmap_generic_address(&entry->register_region); |
280 | 280 | ||
281 | return 0; | 281 | return 0; |
282 | } | 282 | } |
@@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr, | |||
606 | return 0; | 606 | return 0; |
607 | } | 607 | } |
608 | 608 | ||
609 | int apei_map_generic_address(struct acpi_generic_address *reg) | ||
610 | { | ||
611 | int rc; | ||
612 | u32 access_bit_width; | ||
613 | u64 address; | ||
614 | |||
615 | rc = apei_check_gar(reg, &address, &access_bit_width); | ||
616 | if (rc) | ||
617 | return rc; | ||
618 | return acpi_os_map_generic_address(reg); | ||
619 | } | ||
620 | EXPORT_SYMBOL_GPL(apei_map_generic_address); | ||
621 | |||
609 | /* read GAR in interrupt (including NMI) or process context */ | 622 | /* read GAR in interrupt (including NMI) or process context */ |
610 | int apei_read(u64 *val, struct acpi_generic_address *reg) | 623 | int apei_read(u64 *val, struct acpi_generic_address *reg) |
611 | { | 624 | { |
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h index cca240a33038..f220d642136e 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h | |||
@@ -7,6 +7,8 @@ | |||
7 | #define APEI_INTERNAL_H | 7 | #define APEI_INTERNAL_H |
8 | 8 | ||
9 | #include <linux/cper.h> | 9 | #include <linux/cper.h> |
10 | #include <linux/acpi.h> | ||
11 | #include <linux/acpi_io.h> | ||
10 | 12 | ||
11 | struct apei_exec_context; | 13 | struct apei_exec_context; |
12 | 14 | ||
@@ -68,6 +70,13 @@ static inline int apei_exec_run_optional(struct apei_exec_context *ctx, u8 actio | |||
68 | /* IP has been set in instruction function */ | 70 | /* IP has been set in instruction function */ |
69 | #define APEI_EXEC_SET_IP 1 | 71 | #define APEI_EXEC_SET_IP 1 |
70 | 72 | ||
73 | int apei_map_generic_address(struct acpi_generic_address *reg); | ||
74 | |||
75 | static inline void apei_unmap_generic_address(struct acpi_generic_address *reg) | ||
76 | { | ||
77 | acpi_os_unmap_generic_address(reg); | ||
78 | } | ||
79 | |||
71 | int apei_read(u64 *val, struct acpi_generic_address *reg); | 80 | int apei_read(u64 *val, struct acpi_generic_address *reg); |
72 | int apei_write(u64 val, struct acpi_generic_address *reg); | 81 | int apei_write(u64 val, struct acpi_generic_address *reg); |
73 | 82 | ||
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 9b3cac0abecc..1599566ed1fe 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
@@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic) | |||
301 | if (!ghes) | 301 | if (!ghes) |
302 | return ERR_PTR(-ENOMEM); | 302 | return ERR_PTR(-ENOMEM); |
303 | ghes->generic = generic; | 303 | ghes->generic = generic; |
304 | rc = acpi_os_map_generic_address(&generic->error_status_address); | 304 | rc = apei_map_generic_address(&generic->error_status_address); |
305 | if (rc) | 305 | if (rc) |
306 | goto err_free; | 306 | goto err_free; |
307 | error_block_length = generic->error_block_length; | 307 | error_block_length = generic->error_block_length; |
@@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic) | |||
321 | return ghes; | 321 | return ghes; |
322 | 322 | ||
323 | err_unmap: | 323 | err_unmap: |
324 | acpi_os_unmap_generic_address(&generic->error_status_address); | 324 | apei_unmap_generic_address(&generic->error_status_address); |
325 | err_free: | 325 | err_free: |
326 | kfree(ghes); | 326 | kfree(ghes); |
327 | return ERR_PTR(rc); | 327 | return ERR_PTR(rc); |
@@ -330,7 +330,7 @@ err_free: | |||
330 | static void ghes_fini(struct ghes *ghes) | 330 | static void ghes_fini(struct ghes *ghes) |
331 | { | 331 | { |
332 | kfree(ghes->estatus); | 332 | kfree(ghes->estatus); |
333 | acpi_os_unmap_generic_address(&ghes->generic->error_status_address); | 333 | apei_unmap_generic_address(&ghes->generic->error_status_address); |
334 | } | 334 | } |
335 | 335 | ||
336 | enum { | 336 | enum { |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index c850de4c9a14..eff722278ff5 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -189,10 +189,12 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) | |||
189 | * Processor (CPU3, 0x03, 0x00000410, 0x06) {} | 189 | * Processor (CPU3, 0x03, 0x00000410, 0x06) {} |
190 | * } | 190 | * } |
191 | * | 191 | * |
192 | * Ignores apic_id and always return 0 for CPU0's handle. | 192 | * Ignores apic_id and always returns 0 for the processor |
193 | * handle with acpi id 0 if nr_cpu_ids is 1. | ||
194 | * This should be the case if SMP tables are not found. | ||
193 | * Return -1 for other CPU's handle. | 195 | * Return -1 for other CPU's handle. |
194 | */ | 196 | */ |
195 | if (acpi_id == 0) | 197 | if (nr_cpu_ids <= 1 && acpi_id == 0) |
196 | return acpi_id; | 198 | return acpi_id; |
197 | else | 199 | else |
198 | return apic_id; | 200 | return apic_id; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f3decb30223f..47a8caa89dbe 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -224,6 +224,7 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, | |||
224 | /* | 224 | /* |
225 | * Suspend / resume control | 225 | * Suspend / resume control |
226 | */ | 226 | */ |
227 | static int acpi_idle_suspend; | ||
227 | static u32 saved_bm_rld; | 228 | static u32 saved_bm_rld; |
228 | 229 | ||
229 | static void acpi_idle_bm_rld_save(void) | 230 | static void acpi_idle_bm_rld_save(void) |
@@ -242,13 +243,21 @@ static void acpi_idle_bm_rld_restore(void) | |||
242 | 243 | ||
243 | int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) | 244 | int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) |
244 | { | 245 | { |
246 | if (acpi_idle_suspend == 1) | ||
247 | return 0; | ||
248 | |||
245 | acpi_idle_bm_rld_save(); | 249 | acpi_idle_bm_rld_save(); |
250 | acpi_idle_suspend = 1; | ||
246 | return 0; | 251 | return 0; |
247 | } | 252 | } |
248 | 253 | ||
249 | int acpi_processor_resume(struct acpi_device * device) | 254 | int acpi_processor_resume(struct acpi_device * device) |
250 | { | 255 | { |
256 | if (acpi_idle_suspend == 0) | ||
257 | return 0; | ||
258 | |||
251 | acpi_idle_bm_rld_restore(); | 259 | acpi_idle_bm_rld_restore(); |
260 | acpi_idle_suspend = 0; | ||
252 | return 0; | 261 | return 0; |
253 | } | 262 | } |
254 | 263 | ||
@@ -754,6 +763,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
754 | 763 | ||
755 | local_irq_disable(); | 764 | local_irq_disable(); |
756 | 765 | ||
766 | if (acpi_idle_suspend) { | ||
767 | local_irq_enable(); | ||
768 | cpu_relax(); | ||
769 | return -EBUSY; | ||
770 | } | ||
771 | |||
757 | lapic_timer_state_broadcast(pr, cx, 1); | 772 | lapic_timer_state_broadcast(pr, cx, 1); |
758 | kt1 = ktime_get_real(); | 773 | kt1 = ktime_get_real(); |
759 | acpi_idle_do_entry(cx); | 774 | acpi_idle_do_entry(cx); |
@@ -823,6 +838,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
823 | 838 | ||
824 | local_irq_disable(); | 839 | local_irq_disable(); |
825 | 840 | ||
841 | if (acpi_idle_suspend) { | ||
842 | local_irq_enable(); | ||
843 | cpu_relax(); | ||
844 | return -EBUSY; | ||
845 | } | ||
846 | |||
826 | if (cx->entry_method != ACPI_CSTATE_FFH) { | 847 | if (cx->entry_method != ACPI_CSTATE_FFH) { |
827 | current_thread_info()->status &= ~TS_POLLING; | 848 | current_thread_info()->status &= ~TS_POLLING; |
828 | /* | 849 | /* |
@@ -907,14 +928,21 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
907 | drv, drv->safe_state_index); | 928 | drv, drv->safe_state_index); |
908 | } else { | 929 | } else { |
909 | local_irq_disable(); | 930 | local_irq_disable(); |
910 | acpi_safe_halt(); | 931 | if (!acpi_idle_suspend) |
932 | acpi_safe_halt(); | ||
911 | local_irq_enable(); | 933 | local_irq_enable(); |
912 | return -EINVAL; | 934 | return -EBUSY; |
913 | } | 935 | } |
914 | } | 936 | } |
915 | 937 | ||
916 | local_irq_disable(); | 938 | local_irq_disable(); |
917 | 939 | ||
940 | if (acpi_idle_suspend) { | ||
941 | local_irq_enable(); | ||
942 | cpu_relax(); | ||
943 | return -EBUSY; | ||
944 | } | ||
945 | |||
918 | if (cx->entry_method != ACPI_CSTATE_FFH) { | 946 | if (cx->entry_method != ACPI_CSTATE_FFH) { |
919 | current_thread_info()->status &= ~TS_POLLING; | 947 | current_thread_info()->status &= ~TS_POLLING; |
920 | /* | 948 | /* |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 9f66181c814e..240a24400976 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -173,7 +173,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp) | |||
173 | { | 173 | { |
174 | int result = 0; | 174 | int result = 0; |
175 | 175 | ||
176 | if (!strncmp(val, "enable", strlen("enable") - 1)) { | 176 | if (!strncmp(val, "enable", strlen("enable"))) { |
177 | result = acpi_debug_trace(trace_method_name, trace_debug_level, | 177 | result = acpi_debug_trace(trace_method_name, trace_debug_level, |
178 | trace_debug_layer, 0); | 178 | trace_debug_layer, 0); |
179 | if (result) | 179 | if (result) |
@@ -181,7 +181,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp) | |||
181 | goto exit; | 181 | goto exit; |
182 | } | 182 | } |
183 | 183 | ||
184 | if (!strncmp(val, "disable", strlen("disable") - 1)) { | 184 | if (!strncmp(val, "disable", strlen("disable"))) { |
185 | int name = 0; | 185 | int name = 0; |
186 | result = acpi_debug_trace((char *)&name, trace_debug_level, | 186 | result = acpi_debug_trace((char *)&name, trace_debug_level, |
187 | trace_debug_layer, 0); | 187 | trace_debug_layer, 0); |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index a576575617d7..1e0a9e17c31d 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -558,6 +558,8 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
558 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 558 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
559 | struct acpi_object_list args = { 1, &arg0 }; | 559 | struct acpi_object_list args = { 1, &arg0 }; |
560 | 560 | ||
561 | if (!video->cap._DOS) | ||
562 | return 0; | ||
561 | 563 | ||
562 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) | 564 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) |
563 | return -EINVAL; | 565 | return -EINVAL; |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index dcb8a6e48692..4b01ab3d2c24 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
25 | #include <linux/async.h> | 25 | #include <linux/async.h> |
26 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
27 | #include <scsi/scsi_scan.h> | ||
27 | 28 | ||
28 | #include "base.h" | 29 | #include "base.h" |
29 | #include "power/power.h" | 30 | #include "power/power.h" |
@@ -332,6 +333,7 @@ void wait_for_device_probe(void) | |||
332 | /* wait for the known devices to complete their probing */ | 333 | /* wait for the known devices to complete their probing */ |
333 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); | 334 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); |
334 | async_synchronize_full(); | 335 | async_synchronize_full(); |
336 | scsi_complete_async_scans(); | ||
335 | } | 337 | } |
336 | EXPORT_SYMBOL_GPL(wait_for_device_probe); | 338 | EXPORT_SYMBOL_GPL(wait_for_device_probe); |
337 | 339 | ||
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index e0fb5b0435a3..9cb845e49334 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
1031 | dpm_wait_for_children(dev, async); | 1031 | dpm_wait_for_children(dev, async); |
1032 | 1032 | ||
1033 | if (async_error) | 1033 | if (async_error) |
1034 | return 0; | 1034 | goto Complete; |
1035 | 1035 | ||
1036 | pm_runtime_get_noresume(dev); | 1036 | pm_runtime_get_noresume(dev); |
1037 | if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) | 1037 | if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) |
@@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
1040 | if (pm_wakeup_pending()) { | 1040 | if (pm_wakeup_pending()) { |
1041 | pm_runtime_put_sync(dev); | 1041 | pm_runtime_put_sync(dev); |
1042 | async_error = -EBUSY; | 1042 | async_error = -EBUSY; |
1043 | return 0; | 1043 | goto Complete; |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | device_lock(dev); | 1046 | device_lock(dev); |
@@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | device_unlock(dev); | 1099 | device_unlock(dev); |
1100 | |||
1101 | Complete: | ||
1100 | complete_all(&dev->power.completion); | 1102 | complete_all(&dev->power.completion); |
1101 | 1103 | ||
1102 | if (error) { | 1104 | if (error) { |
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index b5c5ff53cb57..fcb956bb4b4c 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c | |||
@@ -1475,10 +1475,17 @@ void _drbd_bm_set_bits(struct drbd_conf *mdev, const unsigned long s, const unsi | |||
1475 | first_word = 0; | 1475 | first_word = 0; |
1476 | spin_lock_irq(&b->bm_lock); | 1476 | spin_lock_irq(&b->bm_lock); |
1477 | } | 1477 | } |
1478 | |||
1479 | /* last page (respectively only page, for first page == last page) */ | 1478 | /* last page (respectively only page, for first page == last page) */ |
1480 | last_word = MLPP(el >> LN2_BPL); | 1479 | last_word = MLPP(el >> LN2_BPL); |
1481 | bm_set_full_words_within_one_page(mdev->bitmap, last_page, first_word, last_word); | 1480 | |
1481 | /* consider bitmap->bm_bits = 32768, bitmap->bm_number_of_pages = 1. (or multiples). | ||
1482 | * ==> e = 32767, el = 32768, last_page = 2, | ||
1483 | * and now last_word = 0. | ||
1484 | * We do not want to touch last_page in this case, | ||
1485 | * as we did not allocate it, it is not present in bitmap->bm_pages. | ||
1486 | */ | ||
1487 | if (last_word) | ||
1488 | bm_set_full_words_within_one_page(mdev->bitmap, last_page, first_word, last_word); | ||
1482 | 1489 | ||
1483 | /* possibly trailing bits. | 1490 | /* possibly trailing bits. |
1484 | * example: (e & 63) == 63, el will be e+1. | 1491 | * example: (e & 63) == 63, el will be e+1. |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index 9c5c84946b05..8e93a6ac9bb6 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -472,12 +472,17 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
472 | req->rq_state |= RQ_LOCAL_COMPLETED; | 472 | req->rq_state |= RQ_LOCAL_COMPLETED; |
473 | req->rq_state &= ~RQ_LOCAL_PENDING; | 473 | req->rq_state &= ~RQ_LOCAL_PENDING; |
474 | 474 | ||
475 | D_ASSERT(!(req->rq_state & RQ_NET_MASK)); | 475 | if (req->rq_state & RQ_LOCAL_ABORTED) { |
476 | _req_may_be_done(req, m); | ||
477 | break; | ||
478 | } | ||
476 | 479 | ||
477 | __drbd_chk_io_error(mdev, false); | 480 | __drbd_chk_io_error(mdev, false); |
478 | 481 | ||
479 | goto_queue_for_net_read: | 482 | goto_queue_for_net_read: |
480 | 483 | ||
484 | D_ASSERT(!(req->rq_state & RQ_NET_MASK)); | ||
485 | |||
481 | /* no point in retrying if there is no good remote data, | 486 | /* no point in retrying if there is no good remote data, |
482 | * or we have no connection. */ | 487 | * or we have no connection. */ |
483 | if (mdev->state.pdsk != D_UP_TO_DATE) { | 488 | if (mdev->state.pdsk != D_UP_TO_DATE) { |
@@ -765,6 +770,40 @@ static int drbd_may_do_local_read(struct drbd_conf *mdev, sector_t sector, int s | |||
765 | return 0 == drbd_bm_count_bits(mdev, sbnr, ebnr); | 770 | return 0 == drbd_bm_count_bits(mdev, sbnr, ebnr); |
766 | } | 771 | } |
767 | 772 | ||
773 | static void maybe_pull_ahead(struct drbd_conf *mdev) | ||
774 | { | ||
775 | int congested = 0; | ||
776 | |||
777 | /* If I don't even have good local storage, we can not reasonably try | ||
778 | * to pull ahead of the peer. We also need the local reference to make | ||
779 | * sure mdev->act_log is there. | ||
780 | * Note: caller has to make sure that net_conf is there. | ||
781 | */ | ||
782 | if (!get_ldev_if_state(mdev, D_UP_TO_DATE)) | ||
783 | return; | ||
784 | |||
785 | if (mdev->net_conf->cong_fill && | ||
786 | atomic_read(&mdev->ap_in_flight) >= mdev->net_conf->cong_fill) { | ||
787 | dev_info(DEV, "Congestion-fill threshold reached\n"); | ||
788 | congested = 1; | ||
789 | } | ||
790 | |||
791 | if (mdev->act_log->used >= mdev->net_conf->cong_extents) { | ||
792 | dev_info(DEV, "Congestion-extents threshold reached\n"); | ||
793 | congested = 1; | ||
794 | } | ||
795 | |||
796 | if (congested) { | ||
797 | queue_barrier(mdev); /* last barrier, after mirrored writes */ | ||
798 | |||
799 | if (mdev->net_conf->on_congestion == OC_PULL_AHEAD) | ||
800 | _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL); | ||
801 | else /*mdev->net_conf->on_congestion == OC_DISCONNECT */ | ||
802 | _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL); | ||
803 | } | ||
804 | put_ldev(mdev); | ||
805 | } | ||
806 | |||
768 | static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, unsigned long start_time) | 807 | static int drbd_make_request_common(struct drbd_conf *mdev, struct bio *bio, unsigned long start_time) |
769 | { | 808 | { |
770 | const int rw = bio_rw(bio); | 809 | const int rw = bio_rw(bio); |
@@ -972,29 +1011,8 @@ allocate_barrier: | |||
972 | _req_mod(req, queue_for_send_oos); | 1011 | _req_mod(req, queue_for_send_oos); |
973 | 1012 | ||
974 | if (remote && | 1013 | if (remote && |
975 | mdev->net_conf->on_congestion != OC_BLOCK && mdev->agreed_pro_version >= 96) { | 1014 | mdev->net_conf->on_congestion != OC_BLOCK && mdev->agreed_pro_version >= 96) |
976 | int congested = 0; | 1015 | maybe_pull_ahead(mdev); |
977 | |||
978 | if (mdev->net_conf->cong_fill && | ||
979 | atomic_read(&mdev->ap_in_flight) >= mdev->net_conf->cong_fill) { | ||
980 | dev_info(DEV, "Congestion-fill threshold reached\n"); | ||
981 | congested = 1; | ||
982 | } | ||
983 | |||
984 | if (mdev->act_log->used >= mdev->net_conf->cong_extents) { | ||
985 | dev_info(DEV, "Congestion-extents threshold reached\n"); | ||
986 | congested = 1; | ||
987 | } | ||
988 | |||
989 | if (congested) { | ||
990 | queue_barrier(mdev); /* last barrier, after mirrored writes */ | ||
991 | |||
992 | if (mdev->net_conf->on_congestion == OC_PULL_AHEAD) | ||
993 | _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL); | ||
994 | else /*mdev->net_conf->on_congestion == OC_DISCONNECT */ | ||
995 | _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL); | ||
996 | } | ||
997 | } | ||
998 | 1016 | ||
999 | spin_unlock_irq(&mdev->req_lock); | 1017 | spin_unlock_irq(&mdev->req_lock); |
1000 | kfree(b); /* if someone else has beaten us to it... */ | 1018 | kfree(b); /* if someone else has beaten us to it... */ |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index cce7df367b79..553f43a90953 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -671,6 +671,7 @@ static void __reschedule_timeout(int drive, const char *message) | |||
671 | 671 | ||
672 | if (drive == current_reqD) | 672 | if (drive == current_reqD) |
673 | drive = current_drive; | 673 | drive = current_drive; |
674 | __cancel_delayed_work(&fd_timeout); | ||
674 | 675 | ||
675 | if (drive < 0 || drive >= N_DRIVE) { | 676 | if (drive < 0 || drive >= N_DRIVE) { |
676 | delay = 20UL * HZ; | 677 | delay = 20UL * HZ; |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index bbca966f8f66..3bba65510d23 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -1597,14 +1597,12 @@ static int loop_add(struct loop_device **l, int i) | |||
1597 | struct gendisk *disk; | 1597 | struct gendisk *disk; |
1598 | int err; | 1598 | int err; |
1599 | 1599 | ||
1600 | err = -ENOMEM; | ||
1600 | lo = kzalloc(sizeof(*lo), GFP_KERNEL); | 1601 | lo = kzalloc(sizeof(*lo), GFP_KERNEL); |
1601 | if (!lo) { | 1602 | if (!lo) |
1602 | err = -ENOMEM; | ||
1603 | goto out; | 1603 | goto out; |
1604 | } | ||
1605 | 1604 | ||
1606 | err = idr_pre_get(&loop_index_idr, GFP_KERNEL); | 1605 | if (!idr_pre_get(&loop_index_idr, GFP_KERNEL)) |
1607 | if (err < 0) | ||
1608 | goto out_free_dev; | 1606 | goto out_free_dev; |
1609 | 1607 | ||
1610 | if (i >= 0) { | 1608 | if (i >= 0) { |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 264bc77dcb91..a8fddeb3d638 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/kthread.h> | 37 | #include <linux/kthread.h> |
38 | #include <../drivers/ata/ahci.h> | 38 | #include <../drivers/ata/ahci.h> |
39 | #include <linux/export.h> | 39 | #include <linux/export.h> |
40 | #include <linux/debugfs.h> | ||
40 | #include "mtip32xx.h" | 41 | #include "mtip32xx.h" |
41 | 42 | ||
42 | #define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) | 43 | #define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) |
@@ -85,6 +86,7 @@ static int instance; | |||
85 | * allocated in mtip_init(). | 86 | * allocated in mtip_init(). |
86 | */ | 87 | */ |
87 | static int mtip_major; | 88 | static int mtip_major; |
89 | static struct dentry *dfs_parent; | ||
88 | 90 | ||
89 | static DEFINE_SPINLOCK(rssd_index_lock); | 91 | static DEFINE_SPINLOCK(rssd_index_lock); |
90 | static DEFINE_IDA(rssd_index_ida); | 92 | static DEFINE_IDA(rssd_index_ida); |
@@ -2546,7 +2548,7 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2546 | } | 2548 | } |
2547 | 2549 | ||
2548 | /* | 2550 | /* |
2549 | * Sysfs register/status dump. | 2551 | * Sysfs status dump. |
2550 | * | 2552 | * |
2551 | * @dev Pointer to the device structure, passed by the kernrel. | 2553 | * @dev Pointer to the device structure, passed by the kernrel. |
2552 | * @attr Pointer to the device_attribute structure passed by the kernel. | 2554 | * @attr Pointer to the device_attribute structure passed by the kernel. |
@@ -2555,45 +2557,68 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2555 | * return value | 2557 | * return value |
2556 | * The size, in bytes, of the data copied into buf. | 2558 | * The size, in bytes, of the data copied into buf. |
2557 | */ | 2559 | */ |
2558 | static ssize_t mtip_hw_show_registers(struct device *dev, | 2560 | static ssize_t mtip_hw_show_status(struct device *dev, |
2559 | struct device_attribute *attr, | 2561 | struct device_attribute *attr, |
2560 | char *buf) | 2562 | char *buf) |
2561 | { | 2563 | { |
2562 | u32 group_allocated; | ||
2563 | struct driver_data *dd = dev_to_disk(dev)->private_data; | 2564 | struct driver_data *dd = dev_to_disk(dev)->private_data; |
2564 | int size = 0; | 2565 | int size = 0; |
2566 | |||
2567 | if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag)) | ||
2568 | size += sprintf(buf, "%s", "thermal_shutdown\n"); | ||
2569 | else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag)) | ||
2570 | size += sprintf(buf, "%s", "write_protect\n"); | ||
2571 | else | ||
2572 | size += sprintf(buf, "%s", "online\n"); | ||
2573 | |||
2574 | return size; | ||
2575 | } | ||
2576 | |||
2577 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); | ||
2578 | |||
2579 | static ssize_t mtip_hw_read_registers(struct file *f, char __user *ubuf, | ||
2580 | size_t len, loff_t *offset) | ||
2581 | { | ||
2582 | struct driver_data *dd = (struct driver_data *)f->private_data; | ||
2583 | char buf[MTIP_DFS_MAX_BUF_SIZE]; | ||
2584 | u32 group_allocated; | ||
2585 | int size = *offset; | ||
2565 | int n; | 2586 | int n; |
2566 | 2587 | ||
2567 | size += sprintf(&buf[size], "Hardware\n--------\n"); | 2588 | if (!len || size) |
2568 | size += sprintf(&buf[size], "S ACTive : [ 0x"); | 2589 | return 0; |
2590 | |||
2591 | if (size < 0) | ||
2592 | return -EINVAL; | ||
2593 | |||
2594 | size += sprintf(&buf[size], "H/ S ACTive : [ 0x"); | ||
2569 | 2595 | ||
2570 | for (n = dd->slot_groups-1; n >= 0; n--) | 2596 | for (n = dd->slot_groups-1; n >= 0; n--) |
2571 | size += sprintf(&buf[size], "%08X ", | 2597 | size += sprintf(&buf[size], "%08X ", |
2572 | readl(dd->port->s_active[n])); | 2598 | readl(dd->port->s_active[n])); |
2573 | 2599 | ||
2574 | size += sprintf(&buf[size], "]\n"); | 2600 | size += sprintf(&buf[size], "]\n"); |
2575 | size += sprintf(&buf[size], "Command Issue : [ 0x"); | 2601 | size += sprintf(&buf[size], "H/ Command Issue : [ 0x"); |
2576 | 2602 | ||
2577 | for (n = dd->slot_groups-1; n >= 0; n--) | 2603 | for (n = dd->slot_groups-1; n >= 0; n--) |
2578 | size += sprintf(&buf[size], "%08X ", | 2604 | size += sprintf(&buf[size], "%08X ", |
2579 | readl(dd->port->cmd_issue[n])); | 2605 | readl(dd->port->cmd_issue[n])); |
2580 | 2606 | ||
2581 | size += sprintf(&buf[size], "]\n"); | 2607 | size += sprintf(&buf[size], "]\n"); |
2582 | size += sprintf(&buf[size], "Completed : [ 0x"); | 2608 | size += sprintf(&buf[size], "H/ Completed : [ 0x"); |
2583 | 2609 | ||
2584 | for (n = dd->slot_groups-1; n >= 0; n--) | 2610 | for (n = dd->slot_groups-1; n >= 0; n--) |
2585 | size += sprintf(&buf[size], "%08X ", | 2611 | size += sprintf(&buf[size], "%08X ", |
2586 | readl(dd->port->completed[n])); | 2612 | readl(dd->port->completed[n])); |
2587 | 2613 | ||
2588 | size += sprintf(&buf[size], "]\n"); | 2614 | size += sprintf(&buf[size], "]\n"); |
2589 | size += sprintf(&buf[size], "PORT IRQ STAT : [ 0x%08X ]\n", | 2615 | size += sprintf(&buf[size], "H/ PORT IRQ STAT : [ 0x%08X ]\n", |
2590 | readl(dd->port->mmio + PORT_IRQ_STAT)); | 2616 | readl(dd->port->mmio + PORT_IRQ_STAT)); |
2591 | size += sprintf(&buf[size], "HOST IRQ STAT : [ 0x%08X ]\n", | 2617 | size += sprintf(&buf[size], "H/ HOST IRQ STAT : [ 0x%08X ]\n", |
2592 | readl(dd->mmio + HOST_IRQ_STAT)); | 2618 | readl(dd->mmio + HOST_IRQ_STAT)); |
2593 | size += sprintf(&buf[size], "\n"); | 2619 | size += sprintf(&buf[size], "\n"); |
2594 | 2620 | ||
2595 | size += sprintf(&buf[size], "Local\n-----\n"); | 2621 | size += sprintf(&buf[size], "L/ Allocated : [ 0x"); |
2596 | size += sprintf(&buf[size], "Allocated : [ 0x"); | ||
2597 | 2622 | ||
2598 | for (n = dd->slot_groups-1; n >= 0; n--) { | 2623 | for (n = dd->slot_groups-1; n >= 0; n--) { |
2599 | if (sizeof(long) > sizeof(u32)) | 2624 | if (sizeof(long) > sizeof(u32)) |
@@ -2605,7 +2630,7 @@ static ssize_t mtip_hw_show_registers(struct device *dev, | |||
2605 | } | 2630 | } |
2606 | size += sprintf(&buf[size], "]\n"); | 2631 | size += sprintf(&buf[size], "]\n"); |
2607 | 2632 | ||
2608 | size += sprintf(&buf[size], "Commands in Q: [ 0x"); | 2633 | size += sprintf(&buf[size], "L/ Commands in Q : [ 0x"); |
2609 | 2634 | ||
2610 | for (n = dd->slot_groups-1; n >= 0; n--) { | 2635 | for (n = dd->slot_groups-1; n >= 0; n--) { |
2611 | if (sizeof(long) > sizeof(u32)) | 2636 | if (sizeof(long) > sizeof(u32)) |
@@ -2617,44 +2642,53 @@ static ssize_t mtip_hw_show_registers(struct device *dev, | |||
2617 | } | 2642 | } |
2618 | size += sprintf(&buf[size], "]\n"); | 2643 | size += sprintf(&buf[size], "]\n"); |
2619 | 2644 | ||
2620 | return size; | 2645 | *offset = size <= len ? size : len; |
2646 | size = copy_to_user(ubuf, buf, *offset); | ||
2647 | if (size) | ||
2648 | return -EFAULT; | ||
2649 | |||
2650 | return *offset; | ||
2621 | } | 2651 | } |
2622 | 2652 | ||
2623 | static ssize_t mtip_hw_show_status(struct device *dev, | 2653 | static ssize_t mtip_hw_read_flags(struct file *f, char __user *ubuf, |
2624 | struct device_attribute *attr, | 2654 | size_t len, loff_t *offset) |
2625 | char *buf) | ||
2626 | { | 2655 | { |
2627 | struct driver_data *dd = dev_to_disk(dev)->private_data; | 2656 | struct driver_data *dd = (struct driver_data *)f->private_data; |
2628 | int size = 0; | 2657 | char buf[MTIP_DFS_MAX_BUF_SIZE]; |
2658 | int size = *offset; | ||
2629 | 2659 | ||
2630 | if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag)) | 2660 | if (!len || size) |
2631 | size += sprintf(buf, "%s", "thermal_shutdown\n"); | 2661 | return 0; |
2632 | else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag)) | ||
2633 | size += sprintf(buf, "%s", "write_protect\n"); | ||
2634 | else | ||
2635 | size += sprintf(buf, "%s", "online\n"); | ||
2636 | |||
2637 | return size; | ||
2638 | } | ||
2639 | 2662 | ||
2640 | static ssize_t mtip_hw_show_flags(struct device *dev, | 2663 | if (size < 0) |
2641 | struct device_attribute *attr, | 2664 | return -EINVAL; |
2642 | char *buf) | ||
2643 | { | ||
2644 | struct driver_data *dd = dev_to_disk(dev)->private_data; | ||
2645 | int size = 0; | ||
2646 | 2665 | ||
2647 | size += sprintf(&buf[size], "Flag in port struct : [ %08lX ]\n", | 2666 | size += sprintf(&buf[size], "Flag-port : [ %08lX ]\n", |
2648 | dd->port->flags); | 2667 | dd->port->flags); |
2649 | size += sprintf(&buf[size], "Flag in dd struct : [ %08lX ]\n", | 2668 | size += sprintf(&buf[size], "Flag-dd : [ %08lX ]\n", |
2650 | dd->dd_flag); | 2669 | dd->dd_flag); |
2651 | 2670 | ||
2652 | return size; | 2671 | *offset = size <= len ? size : len; |
2672 | size = copy_to_user(ubuf, buf, *offset); | ||
2673 | if (size) | ||
2674 | return -EFAULT; | ||
2675 | |||
2676 | return *offset; | ||
2653 | } | 2677 | } |
2654 | 2678 | ||
2655 | static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL); | 2679 | static const struct file_operations mtip_regs_fops = { |
2656 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); | 2680 | .owner = THIS_MODULE, |
2657 | static DEVICE_ATTR(flags, S_IRUGO, mtip_hw_show_flags, NULL); | 2681 | .open = simple_open, |
2682 | .read = mtip_hw_read_registers, | ||
2683 | .llseek = no_llseek, | ||
2684 | }; | ||
2685 | |||
2686 | static const struct file_operations mtip_flags_fops = { | ||
2687 | .owner = THIS_MODULE, | ||
2688 | .open = simple_open, | ||
2689 | .read = mtip_hw_read_flags, | ||
2690 | .llseek = no_llseek, | ||
2691 | }; | ||
2658 | 2692 | ||
2659 | /* | 2693 | /* |
2660 | * Create the sysfs related attributes. | 2694 | * Create the sysfs related attributes. |
@@ -2671,15 +2705,9 @@ static int mtip_hw_sysfs_init(struct driver_data *dd, struct kobject *kobj) | |||
2671 | if (!kobj || !dd) | 2705 | if (!kobj || !dd) |
2672 | return -EINVAL; | 2706 | return -EINVAL; |
2673 | 2707 | ||
2674 | if (sysfs_create_file(kobj, &dev_attr_registers.attr)) | ||
2675 | dev_warn(&dd->pdev->dev, | ||
2676 | "Error creating 'registers' sysfs entry\n"); | ||
2677 | if (sysfs_create_file(kobj, &dev_attr_status.attr)) | 2708 | if (sysfs_create_file(kobj, &dev_attr_status.attr)) |
2678 | dev_warn(&dd->pdev->dev, | 2709 | dev_warn(&dd->pdev->dev, |
2679 | "Error creating 'status' sysfs entry\n"); | 2710 | "Error creating 'status' sysfs entry\n"); |
2680 | if (sysfs_create_file(kobj, &dev_attr_flags.attr)) | ||
2681 | dev_warn(&dd->pdev->dev, | ||
2682 | "Error creating 'flags' sysfs entry\n"); | ||
2683 | return 0; | 2711 | return 0; |
2684 | } | 2712 | } |
2685 | 2713 | ||
@@ -2698,13 +2726,39 @@ static int mtip_hw_sysfs_exit(struct driver_data *dd, struct kobject *kobj) | |||
2698 | if (!kobj || !dd) | 2726 | if (!kobj || !dd) |
2699 | return -EINVAL; | 2727 | return -EINVAL; |
2700 | 2728 | ||
2701 | sysfs_remove_file(kobj, &dev_attr_registers.attr); | ||
2702 | sysfs_remove_file(kobj, &dev_attr_status.attr); | 2729 | sysfs_remove_file(kobj, &dev_attr_status.attr); |
2703 | sysfs_remove_file(kobj, &dev_attr_flags.attr); | ||
2704 | 2730 | ||
2705 | return 0; | 2731 | return 0; |
2706 | } | 2732 | } |
2707 | 2733 | ||
2734 | static int mtip_hw_debugfs_init(struct driver_data *dd) | ||
2735 | { | ||
2736 | if (!dfs_parent) | ||
2737 | return -1; | ||
2738 | |||
2739 | dd->dfs_node = debugfs_create_dir(dd->disk->disk_name, dfs_parent); | ||
2740 | if (IS_ERR_OR_NULL(dd->dfs_node)) { | ||
2741 | dev_warn(&dd->pdev->dev, | ||
2742 | "Error creating node %s under debugfs\n", | ||
2743 | dd->disk->disk_name); | ||
2744 | dd->dfs_node = NULL; | ||
2745 | return -1; | ||
2746 | } | ||
2747 | |||
2748 | debugfs_create_file("flags", S_IRUGO, dd->dfs_node, dd, | ||
2749 | &mtip_flags_fops); | ||
2750 | debugfs_create_file("registers", S_IRUGO, dd->dfs_node, dd, | ||
2751 | &mtip_regs_fops); | ||
2752 | |||
2753 | return 0; | ||
2754 | } | ||
2755 | |||
2756 | static void mtip_hw_debugfs_exit(struct driver_data *dd) | ||
2757 | { | ||
2758 | debugfs_remove_recursive(dd->dfs_node); | ||
2759 | } | ||
2760 | |||
2761 | |||
2708 | /* | 2762 | /* |
2709 | * Perform any init/resume time hardware setup | 2763 | * Perform any init/resume time hardware setup |
2710 | * | 2764 | * |
@@ -3730,6 +3784,7 @@ skip_create_disk: | |||
3730 | mtip_hw_sysfs_init(dd, kobj); | 3784 | mtip_hw_sysfs_init(dd, kobj); |
3731 | kobject_put(kobj); | 3785 | kobject_put(kobj); |
3732 | } | 3786 | } |
3787 | mtip_hw_debugfs_init(dd); | ||
3733 | 3788 | ||
3734 | if (dd->mtip_svc_handler) { | 3789 | if (dd->mtip_svc_handler) { |
3735 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); | 3790 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); |
@@ -3755,6 +3810,8 @@ start_service_thread: | |||
3755 | return rv; | 3810 | return rv; |
3756 | 3811 | ||
3757 | kthread_run_error: | 3812 | kthread_run_error: |
3813 | mtip_hw_debugfs_exit(dd); | ||
3814 | |||
3758 | /* Delete our gendisk. This also removes the device from /dev */ | 3815 | /* Delete our gendisk. This also removes the device from /dev */ |
3759 | del_gendisk(dd->disk); | 3816 | del_gendisk(dd->disk); |
3760 | 3817 | ||
@@ -3805,6 +3862,7 @@ static int mtip_block_remove(struct driver_data *dd) | |||
3805 | kobject_put(kobj); | 3862 | kobject_put(kobj); |
3806 | } | 3863 | } |
3807 | } | 3864 | } |
3865 | mtip_hw_debugfs_exit(dd); | ||
3808 | 3866 | ||
3809 | /* | 3867 | /* |
3810 | * Delete our gendisk structure. This also removes the device | 3868 | * Delete our gendisk structure. This also removes the device |
@@ -4152,10 +4210,20 @@ static int __init mtip_init(void) | |||
4152 | } | 4210 | } |
4153 | mtip_major = error; | 4211 | mtip_major = error; |
4154 | 4212 | ||
4213 | if (!dfs_parent) { | ||
4214 | dfs_parent = debugfs_create_dir("rssd", NULL); | ||
4215 | if (IS_ERR_OR_NULL(dfs_parent)) { | ||
4216 | printk(KERN_WARNING "Error creating debugfs parent\n"); | ||
4217 | dfs_parent = NULL; | ||
4218 | } | ||
4219 | } | ||
4220 | |||
4155 | /* Register our PCI operations. */ | 4221 | /* Register our PCI operations. */ |
4156 | error = pci_register_driver(&mtip_pci_driver); | 4222 | error = pci_register_driver(&mtip_pci_driver); |
4157 | if (error) | 4223 | if (error) { |
4224 | debugfs_remove(dfs_parent); | ||
4158 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); | 4225 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); |
4226 | } | ||
4159 | 4227 | ||
4160 | return error; | 4228 | return error; |
4161 | } | 4229 | } |
@@ -4172,6 +4240,8 @@ static int __init mtip_init(void) | |||
4172 | */ | 4240 | */ |
4173 | static void __exit mtip_exit(void) | 4241 | static void __exit mtip_exit(void) |
4174 | { | 4242 | { |
4243 | debugfs_remove_recursive(dfs_parent); | ||
4244 | |||
4175 | /* Release the allocated major block device number. */ | 4245 | /* Release the allocated major block device number. */ |
4176 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); | 4246 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); |
4177 | 4247 | ||
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index b2c88da26b2a..f51fc23d17bb 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/ata.h> | 26 | #include <linux/ata.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/genhd.h> | 28 | #include <linux/genhd.h> |
29 | #include <linux/version.h> | ||
30 | 29 | ||
31 | /* Offset of Subsystem Device ID in pci confoguration space */ | 30 | /* Offset of Subsystem Device ID in pci confoguration space */ |
32 | #define PCI_SUBSYSTEM_DEVICEID 0x2E | 31 | #define PCI_SUBSYSTEM_DEVICEID 0x2E |
@@ -111,6 +110,8 @@ | |||
111 | #define dbg_printk(format, arg...) | 110 | #define dbg_printk(format, arg...) |
112 | #endif | 111 | #endif |
113 | 112 | ||
113 | #define MTIP_DFS_MAX_BUF_SIZE 1024 | ||
114 | |||
114 | #define __force_bit2int (unsigned int __force) | 115 | #define __force_bit2int (unsigned int __force) |
115 | 116 | ||
116 | enum { | 117 | enum { |
@@ -447,6 +448,8 @@ struct driver_data { | |||
447 | unsigned long dd_flag; /* NOTE: use atomic bit operations on this */ | 448 | unsigned long dd_flag; /* NOTE: use atomic bit operations on this */ |
448 | 449 | ||
449 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ | 450 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ |
451 | |||
452 | struct dentry *dfs_node; | ||
450 | }; | 453 | }; |
451 | 454 | ||
452 | #endif | 455 | #endif |
diff --git a/drivers/block/umem.c b/drivers/block/umem.c index aa2712060bfb..9a72277a31df 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c | |||
@@ -513,6 +513,44 @@ static void process_page(unsigned long data) | |||
513 | } | 513 | } |
514 | } | 514 | } |
515 | 515 | ||
516 | struct mm_plug_cb { | ||
517 | struct blk_plug_cb cb; | ||
518 | struct cardinfo *card; | ||
519 | }; | ||
520 | |||
521 | static void mm_unplug(struct blk_plug_cb *cb) | ||
522 | { | ||
523 | struct mm_plug_cb *mmcb = container_of(cb, struct mm_plug_cb, cb); | ||
524 | |||
525 | spin_lock_irq(&mmcb->card->lock); | ||
526 | activate(mmcb->card); | ||
527 | spin_unlock_irq(&mmcb->card->lock); | ||
528 | kfree(mmcb); | ||
529 | } | ||
530 | |||
531 | static int mm_check_plugged(struct cardinfo *card) | ||
532 | { | ||
533 | struct blk_plug *plug = current->plug; | ||
534 | struct mm_plug_cb *mmcb; | ||
535 | |||
536 | if (!plug) | ||
537 | return 0; | ||
538 | |||
539 | list_for_each_entry(mmcb, &plug->cb_list, cb.list) { | ||
540 | if (mmcb->cb.callback == mm_unplug && mmcb->card == card) | ||
541 | return 1; | ||
542 | } | ||
543 | /* Not currently on the callback list */ | ||
544 | mmcb = kmalloc(sizeof(*mmcb), GFP_ATOMIC); | ||
545 | if (!mmcb) | ||
546 | return 0; | ||
547 | |||
548 | mmcb->card = card; | ||
549 | mmcb->cb.callback = mm_unplug; | ||
550 | list_add(&mmcb->cb.list, &plug->cb_list); | ||
551 | return 1; | ||
552 | } | ||
553 | |||
516 | static void mm_make_request(struct request_queue *q, struct bio *bio) | 554 | static void mm_make_request(struct request_queue *q, struct bio *bio) |
517 | { | 555 | { |
518 | struct cardinfo *card = q->queuedata; | 556 | struct cardinfo *card = q->queuedata; |
@@ -523,6 +561,8 @@ static void mm_make_request(struct request_queue *q, struct bio *bio) | |||
523 | *card->biotail = bio; | 561 | *card->biotail = bio; |
524 | bio->bi_next = NULL; | 562 | bio->bi_next = NULL; |
525 | card->biotail = &bio->bi_next; | 563 | card->biotail = &bio->bi_next; |
564 | if (bio->bi_rw & REQ_SYNC || !mm_check_plugged(card)) | ||
565 | activate(card); | ||
526 | spin_unlock_irq(&card->lock); | 566 | spin_unlock_irq(&card->lock); |
527 | 567 | ||
528 | return; | 568 | return; |
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 773cf27dc23f..9ad3b5ec1dc1 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -257,6 +257,7 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst, | |||
257 | break; | 257 | break; |
258 | case BLKIF_OP_DISCARD: | 258 | case BLKIF_OP_DISCARD: |
259 | dst->u.discard.flag = src->u.discard.flag; | 259 | dst->u.discard.flag = src->u.discard.flag; |
260 | dst->u.discard.id = src->u.discard.id; | ||
260 | dst->u.discard.sector_number = src->u.discard.sector_number; | 261 | dst->u.discard.sector_number = src->u.discard.sector_number; |
261 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; | 262 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; |
262 | break; | 263 | break; |
@@ -287,6 +288,7 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst, | |||
287 | break; | 288 | break; |
288 | case BLKIF_OP_DISCARD: | 289 | case BLKIF_OP_DISCARD: |
289 | dst->u.discard.flag = src->u.discard.flag; | 290 | dst->u.discard.flag = src->u.discard.flag; |
291 | dst->u.discard.id = src->u.discard.id; | ||
290 | dst->u.discard.sector_number = src->u.discard.sector_number; | 292 | dst->u.discard.sector_number = src->u.discard.sector_number; |
291 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; | 293 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; |
292 | break; | 294 | break; |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 60eed4bdd2e4..e4fb3374dcd2 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -141,14 +141,36 @@ static int get_id_from_freelist(struct blkfront_info *info) | |||
141 | return free; | 141 | return free; |
142 | } | 142 | } |
143 | 143 | ||
144 | static void add_id_to_freelist(struct blkfront_info *info, | 144 | static int add_id_to_freelist(struct blkfront_info *info, |
145 | unsigned long id) | 145 | unsigned long id) |
146 | { | 146 | { |
147 | if (info->shadow[id].req.u.rw.id != id) | ||
148 | return -EINVAL; | ||
149 | if (info->shadow[id].request == NULL) | ||
150 | return -EINVAL; | ||
147 | info->shadow[id].req.u.rw.id = info->shadow_free; | 151 | info->shadow[id].req.u.rw.id = info->shadow_free; |
148 | info->shadow[id].request = NULL; | 152 | info->shadow[id].request = NULL; |
149 | info->shadow_free = id; | 153 | info->shadow_free = id; |
154 | return 0; | ||
150 | } | 155 | } |
151 | 156 | ||
157 | static const char *op_name(int op) | ||
158 | { | ||
159 | static const char *const names[] = { | ||
160 | [BLKIF_OP_READ] = "read", | ||
161 | [BLKIF_OP_WRITE] = "write", | ||
162 | [BLKIF_OP_WRITE_BARRIER] = "barrier", | ||
163 | [BLKIF_OP_FLUSH_DISKCACHE] = "flush", | ||
164 | [BLKIF_OP_DISCARD] = "discard" }; | ||
165 | |||
166 | if (op < 0 || op >= ARRAY_SIZE(names)) | ||
167 | return "unknown"; | ||
168 | |||
169 | if (!names[op]) | ||
170 | return "reserved"; | ||
171 | |||
172 | return names[op]; | ||
173 | } | ||
152 | static int xlbd_reserve_minors(unsigned int minor, unsigned int nr) | 174 | static int xlbd_reserve_minors(unsigned int minor, unsigned int nr) |
153 | { | 175 | { |
154 | unsigned int end = minor + nr; | 176 | unsigned int end = minor + nr; |
@@ -746,20 +768,36 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
746 | 768 | ||
747 | bret = RING_GET_RESPONSE(&info->ring, i); | 769 | bret = RING_GET_RESPONSE(&info->ring, i); |
748 | id = bret->id; | 770 | id = bret->id; |
771 | /* | ||
772 | * The backend has messed up and given us an id that we would | ||
773 | * never have given to it (we stamp it up to BLK_RING_SIZE - | ||
774 | * look in get_id_from_freelist. | ||
775 | */ | ||
776 | if (id >= BLK_RING_SIZE) { | ||
777 | WARN(1, "%s: response to %s has incorrect id (%ld)\n", | ||
778 | info->gd->disk_name, op_name(bret->operation), id); | ||
779 | /* We can't safely get the 'struct request' as | ||
780 | * the id is busted. */ | ||
781 | continue; | ||
782 | } | ||
749 | req = info->shadow[id].request; | 783 | req = info->shadow[id].request; |
750 | 784 | ||
751 | if (bret->operation != BLKIF_OP_DISCARD) | 785 | if (bret->operation != BLKIF_OP_DISCARD) |
752 | blkif_completion(&info->shadow[id]); | 786 | blkif_completion(&info->shadow[id]); |
753 | 787 | ||
754 | add_id_to_freelist(info, id); | 788 | if (add_id_to_freelist(info, id)) { |
789 | WARN(1, "%s: response to %s (id %ld) couldn't be recycled!\n", | ||
790 | info->gd->disk_name, op_name(bret->operation), id); | ||
791 | continue; | ||
792 | } | ||
755 | 793 | ||
756 | error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; | 794 | error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; |
757 | switch (bret->operation) { | 795 | switch (bret->operation) { |
758 | case BLKIF_OP_DISCARD: | 796 | case BLKIF_OP_DISCARD: |
759 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { | 797 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { |
760 | struct request_queue *rq = info->rq; | 798 | struct request_queue *rq = info->rq; |
761 | printk(KERN_WARNING "blkfront: %s: discard op failed\n", | 799 | printk(KERN_WARNING "blkfront: %s: %s op failed\n", |
762 | info->gd->disk_name); | 800 | info->gd->disk_name, op_name(bret->operation)); |
763 | error = -EOPNOTSUPP; | 801 | error = -EOPNOTSUPP; |
764 | info->feature_discard = 0; | 802 | info->feature_discard = 0; |
765 | info->feature_secdiscard = 0; | 803 | info->feature_secdiscard = 0; |
@@ -771,18 +809,14 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
771 | case BLKIF_OP_FLUSH_DISKCACHE: | 809 | case BLKIF_OP_FLUSH_DISKCACHE: |
772 | case BLKIF_OP_WRITE_BARRIER: | 810 | case BLKIF_OP_WRITE_BARRIER: |
773 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { | 811 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { |
774 | printk(KERN_WARNING "blkfront: %s: write %s op failed\n", | 812 | printk(KERN_WARNING "blkfront: %s: %s op failed\n", |
775 | info->flush_op == BLKIF_OP_WRITE_BARRIER ? | 813 | info->gd->disk_name, op_name(bret->operation)); |
776 | "barrier" : "flush disk cache", | ||
777 | info->gd->disk_name); | ||
778 | error = -EOPNOTSUPP; | 814 | error = -EOPNOTSUPP; |
779 | } | 815 | } |
780 | if (unlikely(bret->status == BLKIF_RSP_ERROR && | 816 | if (unlikely(bret->status == BLKIF_RSP_ERROR && |
781 | info->shadow[id].req.u.rw.nr_segments == 0)) { | 817 | info->shadow[id].req.u.rw.nr_segments == 0)) { |
782 | printk(KERN_WARNING "blkfront: %s: empty write %s op failed\n", | 818 | printk(KERN_WARNING "blkfront: %s: empty %s op failed\n", |
783 | info->flush_op == BLKIF_OP_WRITE_BARRIER ? | 819 | info->gd->disk_name, op_name(bret->operation)); |
784 | "barrier" : "flush disk cache", | ||
785 | info->gd->disk_name); | ||
786 | error = -EOPNOTSUPP; | 820 | error = -EOPNOTSUPP; |
787 | } | 821 | } |
788 | if (unlikely(error)) { | 822 | if (unlikely(error)) { |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index ad591bd240ec..10308cd8a7ed 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -63,6 +63,7 @@ static struct usb_device_id ath3k_table[] = { | |||
63 | 63 | ||
64 | /* Atheros AR3011 with sflash firmware*/ | 64 | /* Atheros AR3011 with sflash firmware*/ |
65 | { USB_DEVICE(0x0CF3, 0x3002) }, | 65 | { USB_DEVICE(0x0CF3, 0x3002) }, |
66 | { USB_DEVICE(0x0CF3, 0xE019) }, | ||
66 | { USB_DEVICE(0x13d3, 0x3304) }, | 67 | { USB_DEVICE(0x13d3, 0x3304) }, |
67 | { USB_DEVICE(0x0930, 0x0215) }, | 68 | { USB_DEVICE(0x0930, 0x0215) }, |
68 | { USB_DEVICE(0x0489, 0xE03D) }, | 69 | { USB_DEVICE(0x0489, 0xE03D) }, |
@@ -77,6 +78,7 @@ static struct usb_device_id ath3k_table[] = { | |||
77 | { USB_DEVICE(0x04CA, 0x3005) }, | 78 | { USB_DEVICE(0x04CA, 0x3005) }, |
78 | { USB_DEVICE(0x13d3, 0x3362) }, | 79 | { USB_DEVICE(0x13d3, 0x3362) }, |
79 | { USB_DEVICE(0x0CF3, 0xE004) }, | 80 | { USB_DEVICE(0x0CF3, 0xE004) }, |
81 | { USB_DEVICE(0x0930, 0x0219) }, | ||
80 | 82 | ||
81 | /* Atheros AR5BBU12 with sflash firmware */ | 83 | /* Atheros AR5BBU12 with sflash firmware */ |
82 | { USB_DEVICE(0x0489, 0xE02C) }, | 84 | { USB_DEVICE(0x0489, 0xE02C) }, |
@@ -101,6 +103,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
101 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 103 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
102 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 104 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
103 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 105 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
106 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | ||
104 | 107 | ||
105 | /* Atheros AR5BBU22 with sflash firmware */ | 108 | /* Atheros AR5BBU22 with sflash firmware */ |
106 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, | 109 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h index 94f2d65131c4..27068d149380 100644 --- a/drivers/bluetooth/btmrvl_drv.h +++ b/drivers/bluetooth/btmrvl_drv.h | |||
@@ -136,7 +136,7 @@ int btmrvl_remove_card(struct btmrvl_private *priv); | |||
136 | 136 | ||
137 | void btmrvl_interrupt(struct btmrvl_private *priv); | 137 | void btmrvl_interrupt(struct btmrvl_private *priv); |
138 | 138 | ||
139 | void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); | 139 | bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); |
140 | int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); | 140 | int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); |
141 | 141 | ||
142 | int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd); | 142 | int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd); |
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 681ca9d18e12..dc304def8400 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
@@ -44,23 +44,33 @@ void btmrvl_interrupt(struct btmrvl_private *priv) | |||
44 | } | 44 | } |
45 | EXPORT_SYMBOL_GPL(btmrvl_interrupt); | 45 | EXPORT_SYMBOL_GPL(btmrvl_interrupt); |
46 | 46 | ||
47 | void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb) | 47 | bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb) |
48 | { | 48 | { |
49 | struct hci_event_hdr *hdr = (void *) skb->data; | 49 | struct hci_event_hdr *hdr = (void *) skb->data; |
50 | struct hci_ev_cmd_complete *ec; | 50 | struct hci_ev_cmd_complete *ec; |
51 | u16 opcode, ocf; | 51 | u16 opcode, ocf, ogf; |
52 | 52 | ||
53 | if (hdr->evt == HCI_EV_CMD_COMPLETE) { | 53 | if (hdr->evt == HCI_EV_CMD_COMPLETE) { |
54 | ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE); | 54 | ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE); |
55 | opcode = __le16_to_cpu(ec->opcode); | 55 | opcode = __le16_to_cpu(ec->opcode); |
56 | ocf = hci_opcode_ocf(opcode); | 56 | ocf = hci_opcode_ocf(opcode); |
57 | ogf = hci_opcode_ogf(opcode); | ||
58 | |||
57 | if (ocf == BT_CMD_MODULE_CFG_REQ && | 59 | if (ocf == BT_CMD_MODULE_CFG_REQ && |
58 | priv->btmrvl_dev.sendcmdflag) { | 60 | priv->btmrvl_dev.sendcmdflag) { |
59 | priv->btmrvl_dev.sendcmdflag = false; | 61 | priv->btmrvl_dev.sendcmdflag = false; |
60 | priv->adapter->cmd_complete = true; | 62 | priv->adapter->cmd_complete = true; |
61 | wake_up_interruptible(&priv->adapter->cmd_wait_q); | 63 | wake_up_interruptible(&priv->adapter->cmd_wait_q); |
62 | } | 64 | } |
65 | |||
66 | if (ogf == OGF) { | ||
67 | BT_DBG("vendor event skipped: ogf 0x%4.4x", ogf); | ||
68 | kfree_skb(skb); | ||
69 | return false; | ||
70 | } | ||
63 | } | 71 | } |
72 | |||
73 | return true; | ||
64 | } | 74 | } |
65 | EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt); | 75 | EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt); |
66 | 76 | ||
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index a853244e7fd7..0cd61d9f07cd 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c | |||
@@ -562,10 +562,12 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) | |||
562 | skb_put(skb, buf_len); | 562 | skb_put(skb, buf_len); |
563 | skb_pull(skb, SDIO_HEADER_LEN); | 563 | skb_pull(skb, SDIO_HEADER_LEN); |
564 | 564 | ||
565 | if (type == HCI_EVENT_PKT) | 565 | if (type == HCI_EVENT_PKT) { |
566 | btmrvl_check_evtpkt(priv, skb); | 566 | if (btmrvl_check_evtpkt(priv, skb)) |
567 | hci_recv_frame(skb); | ||
568 | } else | ||
569 | hci_recv_frame(skb); | ||
567 | 570 | ||
568 | hci_recv_frame(skb); | ||
569 | hdev->stat.byte_rx += buf_len; | 571 | hdev->stat.byte_rx += buf_len; |
570 | break; | 572 | break; |
571 | 573 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c9463af8e564..83ebb241bfcc 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -125,6 +125,7 @@ static struct usb_device_id blacklist_table[] = { | |||
125 | 125 | ||
126 | /* Atheros 3011 with sflash firmware */ | 126 | /* Atheros 3011 with sflash firmware */ |
127 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, | 127 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, |
128 | { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE }, | ||
128 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, | 129 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, |
129 | { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, | 130 | { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, |
130 | { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, | 131 | { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, |
@@ -139,6 +140,7 @@ static struct usb_device_id blacklist_table[] = { | |||
139 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 140 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
140 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
141 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 142 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
143 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | ||
142 | 144 | ||
143 | /* Atheros AR5BBU12 with sflash firmware */ | 145 | /* Atheros AR5BBU12 with sflash firmware */ |
144 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 146 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 687b00d67c8a..9a1eb0cfa95f 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -850,18 +850,21 @@ static void clk_change_rate(struct clk *clk) | |||
850 | { | 850 | { |
851 | struct clk *child; | 851 | struct clk *child; |
852 | unsigned long old_rate; | 852 | unsigned long old_rate; |
853 | unsigned long best_parent_rate = 0; | ||
853 | struct hlist_node *tmp; | 854 | struct hlist_node *tmp; |
854 | 855 | ||
855 | old_rate = clk->rate; | 856 | old_rate = clk->rate; |
856 | 857 | ||
858 | if (clk->parent) | ||
859 | best_parent_rate = clk->parent->rate; | ||
860 | |||
857 | if (clk->ops->set_rate) | 861 | if (clk->ops->set_rate) |
858 | clk->ops->set_rate(clk->hw, clk->new_rate, clk->parent->rate); | 862 | clk->ops->set_rate(clk->hw, clk->new_rate, best_parent_rate); |
859 | 863 | ||
860 | if (clk->ops->recalc_rate) | 864 | if (clk->ops->recalc_rate) |
861 | clk->rate = clk->ops->recalc_rate(clk->hw, | 865 | clk->rate = clk->ops->recalc_rate(clk->hw, best_parent_rate); |
862 | clk->parent->rate); | ||
863 | else | 866 | else |
864 | clk->rate = clk->parent->rate; | 867 | clk->rate = best_parent_rate; |
865 | 868 | ||
866 | if (clk->notifier_count && old_rate != clk->rate) | 869 | if (clk->notifier_count && old_rate != clk->rate) |
867 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); | 870 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); |
@@ -999,7 +1002,7 @@ static struct clk *__clk_init_parent(struct clk *clk) | |||
999 | 1002 | ||
1000 | if (!clk->parents) | 1003 | if (!clk->parents) |
1001 | clk->parents = | 1004 | clk->parents = |
1002 | kmalloc((sizeof(struct clk*) * clk->num_parents), | 1005 | kzalloc((sizeof(struct clk*) * clk->num_parents), |
1003 | GFP_KERNEL); | 1006 | GFP_KERNEL); |
1004 | 1007 | ||
1005 | if (!clk->parents) | 1008 | if (!clk->parents) |
@@ -1064,21 +1067,24 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent) | |||
1064 | 1067 | ||
1065 | old_parent = clk->parent; | 1068 | old_parent = clk->parent; |
1066 | 1069 | ||
1067 | /* find index of new parent clock using cached parent ptrs */ | 1070 | if (!clk->parents) |
1068 | for (i = 0; i < clk->num_parents; i++) | 1071 | clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), |
1069 | if (clk->parents[i] == parent) | 1072 | GFP_KERNEL); |
1070 | break; | ||
1071 | 1073 | ||
1072 | /* | 1074 | /* |
1073 | * find index of new parent clock using string name comparison | 1075 | * find index of new parent clock using cached parent ptrs, |
1074 | * also try to cache the parent to avoid future calls to __clk_lookup | 1076 | * or if not yet cached, use string name comparison and cache |
1077 | * them now to avoid future calls to __clk_lookup. | ||
1075 | */ | 1078 | */ |
1076 | if (i == clk->num_parents) | 1079 | for (i = 0; i < clk->num_parents; i++) { |
1077 | for (i = 0; i < clk->num_parents; i++) | 1080 | if (clk->parents && clk->parents[i] == parent) |
1078 | if (!strcmp(clk->parent_names[i], parent->name)) { | 1081 | break; |
1082 | else if (!strcmp(clk->parent_names[i], parent->name)) { | ||
1083 | if (clk->parents) | ||
1079 | clk->parents[i] = __clk_lookup(parent->name); | 1084 | clk->parents[i] = __clk_lookup(parent->name); |
1080 | break; | 1085 | break; |
1081 | } | 1086 | } |
1087 | } | ||
1082 | 1088 | ||
1083 | if (i == clk->num_parents) { | 1089 | if (i == clk->num_parents) { |
1084 | pr_debug("%s: clock %s is not a possible parent of clock %s\n", | 1090 | pr_debug("%s: clock %s is not a possible parent of clock %s\n", |
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c index f7be225f544c..db2391c054ee 100644 --- a/drivers/clk/mxs/clk-imx23.c +++ b/drivers/clk/mxs/clk-imx23.c | |||
@@ -71,7 +71,7 @@ static void __init clk_misc_init(void) | |||
71 | __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); | 71 | __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); |
72 | } | 72 | } |
73 | 73 | ||
74 | static struct clk_lookup uart_lookups[] __initdata = { | 74 | static struct clk_lookup uart_lookups[] = { |
75 | { .dev_id = "duart", }, | 75 | { .dev_id = "duart", }, |
76 | { .dev_id = "mxs-auart.0", }, | 76 | { .dev_id = "mxs-auart.0", }, |
77 | { .dev_id = "mxs-auart.1", }, | 77 | { .dev_id = "mxs-auart.1", }, |
@@ -80,31 +80,31 @@ static struct clk_lookup uart_lookups[] __initdata = { | |||
80 | { .dev_id = "80070000.serial", }, | 80 | { .dev_id = "80070000.serial", }, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static struct clk_lookup hbus_lookups[] __initdata = { | 83 | static struct clk_lookup hbus_lookups[] = { |
84 | { .dev_id = "imx23-dma-apbh", }, | 84 | { .dev_id = "imx23-dma-apbh", }, |
85 | { .dev_id = "80004000.dma-apbh", }, | 85 | { .dev_id = "80004000.dma-apbh", }, |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static struct clk_lookup xbus_lookups[] __initdata = { | 88 | static struct clk_lookup xbus_lookups[] = { |
89 | { .dev_id = "duart", .con_id = "apb_pclk"}, | 89 | { .dev_id = "duart", .con_id = "apb_pclk"}, |
90 | { .dev_id = "80070000.serial", .con_id = "apb_pclk"}, | 90 | { .dev_id = "80070000.serial", .con_id = "apb_pclk"}, |
91 | { .dev_id = "imx23-dma-apbx", }, | 91 | { .dev_id = "imx23-dma-apbx", }, |
92 | { .dev_id = "80024000.dma-apbx", }, | 92 | { .dev_id = "80024000.dma-apbx", }, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static struct clk_lookup ssp_lookups[] __initdata = { | 95 | static struct clk_lookup ssp_lookups[] = { |
96 | { .dev_id = "imx23-mmc.0", }, | 96 | { .dev_id = "imx23-mmc.0", }, |
97 | { .dev_id = "imx23-mmc.1", }, | 97 | { .dev_id = "imx23-mmc.1", }, |
98 | { .dev_id = "80010000.ssp", }, | 98 | { .dev_id = "80010000.ssp", }, |
99 | { .dev_id = "80034000.ssp", }, | 99 | { .dev_id = "80034000.ssp", }, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | static struct clk_lookup lcdif_lookups[] __initdata = { | 102 | static struct clk_lookup lcdif_lookups[] = { |
103 | { .dev_id = "imx23-fb", }, | 103 | { .dev_id = "imx23-fb", }, |
104 | { .dev_id = "80030000.lcdif", }, | 104 | { .dev_id = "80030000.lcdif", }, |
105 | }; | 105 | }; |
106 | 106 | ||
107 | static struct clk_lookup gpmi_lookups[] __initdata = { | 107 | static struct clk_lookup gpmi_lookups[] = { |
108 | { .dev_id = "imx23-gpmi-nand", }, | 108 | { .dev_id = "imx23-gpmi-nand", }, |
109 | { .dev_id = "8000c000.gpmi", }, | 109 | { .dev_id = "8000c000.gpmi", }, |
110 | }; | 110 | }; |
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c index 2826a2606a29..7fad6c8c13d2 100644 --- a/drivers/clk/mxs/clk-imx28.c +++ b/drivers/clk/mxs/clk-imx28.c | |||
@@ -120,7 +120,7 @@ static void __init clk_misc_init(void) | |||
120 | writel_relaxed(val, FRAC0); | 120 | writel_relaxed(val, FRAC0); |
121 | } | 121 | } |
122 | 122 | ||
123 | static struct clk_lookup uart_lookups[] __initdata = { | 123 | static struct clk_lookup uart_lookups[] = { |
124 | { .dev_id = "duart", }, | 124 | { .dev_id = "duart", }, |
125 | { .dev_id = "mxs-auart.0", }, | 125 | { .dev_id = "mxs-auart.0", }, |
126 | { .dev_id = "mxs-auart.1", }, | 126 | { .dev_id = "mxs-auart.1", }, |
@@ -135,71 +135,71 @@ static struct clk_lookup uart_lookups[] __initdata = { | |||
135 | { .dev_id = "80074000.serial", }, | 135 | { .dev_id = "80074000.serial", }, |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static struct clk_lookup hbus_lookups[] __initdata = { | 138 | static struct clk_lookup hbus_lookups[] = { |
139 | { .dev_id = "imx28-dma-apbh", }, | 139 | { .dev_id = "imx28-dma-apbh", }, |
140 | { .dev_id = "80004000.dma-apbh", }, | 140 | { .dev_id = "80004000.dma-apbh", }, |
141 | }; | 141 | }; |
142 | 142 | ||
143 | static struct clk_lookup xbus_lookups[] __initdata = { | 143 | static struct clk_lookup xbus_lookups[] = { |
144 | { .dev_id = "duart", .con_id = "apb_pclk"}, | 144 | { .dev_id = "duart", .con_id = "apb_pclk"}, |
145 | { .dev_id = "80074000.serial", .con_id = "apb_pclk"}, | 145 | { .dev_id = "80074000.serial", .con_id = "apb_pclk"}, |
146 | { .dev_id = "imx28-dma-apbx", }, | 146 | { .dev_id = "imx28-dma-apbx", }, |
147 | { .dev_id = "80024000.dma-apbx", }, | 147 | { .dev_id = "80024000.dma-apbx", }, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | static struct clk_lookup ssp0_lookups[] __initdata = { | 150 | static struct clk_lookup ssp0_lookups[] = { |
151 | { .dev_id = "imx28-mmc.0", }, | 151 | { .dev_id = "imx28-mmc.0", }, |
152 | { .dev_id = "80010000.ssp", }, | 152 | { .dev_id = "80010000.ssp", }, |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static struct clk_lookup ssp1_lookups[] __initdata = { | 155 | static struct clk_lookup ssp1_lookups[] = { |
156 | { .dev_id = "imx28-mmc.1", }, | 156 | { .dev_id = "imx28-mmc.1", }, |
157 | { .dev_id = "80012000.ssp", }, | 157 | { .dev_id = "80012000.ssp", }, |
158 | }; | 158 | }; |
159 | 159 | ||
160 | static struct clk_lookup ssp2_lookups[] __initdata = { | 160 | static struct clk_lookup ssp2_lookups[] = { |
161 | { .dev_id = "imx28-mmc.2", }, | 161 | { .dev_id = "imx28-mmc.2", }, |
162 | { .dev_id = "80014000.ssp", }, | 162 | { .dev_id = "80014000.ssp", }, |
163 | }; | 163 | }; |
164 | 164 | ||
165 | static struct clk_lookup ssp3_lookups[] __initdata = { | 165 | static struct clk_lookup ssp3_lookups[] = { |
166 | { .dev_id = "imx28-mmc.3", }, | 166 | { .dev_id = "imx28-mmc.3", }, |
167 | { .dev_id = "80016000.ssp", }, | 167 | { .dev_id = "80016000.ssp", }, |
168 | }; | 168 | }; |
169 | 169 | ||
170 | static struct clk_lookup lcdif_lookups[] __initdata = { | 170 | static struct clk_lookup lcdif_lookups[] = { |
171 | { .dev_id = "imx28-fb", }, | 171 | { .dev_id = "imx28-fb", }, |
172 | { .dev_id = "80030000.lcdif", }, | 172 | { .dev_id = "80030000.lcdif", }, |
173 | }; | 173 | }; |
174 | 174 | ||
175 | static struct clk_lookup gpmi_lookups[] __initdata = { | 175 | static struct clk_lookup gpmi_lookups[] = { |
176 | { .dev_id = "imx28-gpmi-nand", }, | 176 | { .dev_id = "imx28-gpmi-nand", }, |
177 | { .dev_id = "8000c000.gpmi", }, | 177 | { .dev_id = "8000c000.gpmi", }, |
178 | }; | 178 | }; |
179 | 179 | ||
180 | static struct clk_lookup fec_lookups[] __initdata = { | 180 | static struct clk_lookup fec_lookups[] = { |
181 | { .dev_id = "imx28-fec.0", }, | 181 | { .dev_id = "imx28-fec.0", }, |
182 | { .dev_id = "imx28-fec.1", }, | 182 | { .dev_id = "imx28-fec.1", }, |
183 | { .dev_id = "800f0000.ethernet", }, | 183 | { .dev_id = "800f0000.ethernet", }, |
184 | { .dev_id = "800f4000.ethernet", }, | 184 | { .dev_id = "800f4000.ethernet", }, |
185 | }; | 185 | }; |
186 | 186 | ||
187 | static struct clk_lookup can0_lookups[] __initdata = { | 187 | static struct clk_lookup can0_lookups[] = { |
188 | { .dev_id = "flexcan.0", }, | 188 | { .dev_id = "flexcan.0", }, |
189 | { .dev_id = "80032000.can", }, | 189 | { .dev_id = "80032000.can", }, |
190 | }; | 190 | }; |
191 | 191 | ||
192 | static struct clk_lookup can1_lookups[] __initdata = { | 192 | static struct clk_lookup can1_lookups[] = { |
193 | { .dev_id = "flexcan.1", }, | 193 | { .dev_id = "flexcan.1", }, |
194 | { .dev_id = "80034000.can", }, | 194 | { .dev_id = "80034000.can", }, |
195 | }; | 195 | }; |
196 | 196 | ||
197 | static struct clk_lookup saif0_lookups[] __initdata = { | 197 | static struct clk_lookup saif0_lookups[] = { |
198 | { .dev_id = "mxs-saif.0", }, | 198 | { .dev_id = "mxs-saif.0", }, |
199 | { .dev_id = "80042000.saif", }, | 199 | { .dev_id = "80042000.saif", }, |
200 | }; | 200 | }; |
201 | 201 | ||
202 | static struct clk_lookup saif1_lookups[] __initdata = { | 202 | static struct clk_lookup saif1_lookups[] = { |
203 | { .dev_id = "mxs-saif.1", }, | 203 | { .dev_id = "mxs-saif.1", }, |
204 | { .dev_id = "80046000.saif", }, | 204 | { .dev_id = "80046000.saif", }, |
205 | }; | 205 | }; |
@@ -245,8 +245,8 @@ int __init mx28_clocks_init(void) | |||
245 | clks[pll2] = mxs_clk_pll("pll2", "ref_xtal", PLL2CTRL0, 23, 50000000); | 245 | clks[pll2] = mxs_clk_pll("pll2", "ref_xtal", PLL2CTRL0, 23, 50000000); |
246 | clks[ref_cpu] = mxs_clk_ref("ref_cpu", "pll0", FRAC0, 0); | 246 | clks[ref_cpu] = mxs_clk_ref("ref_cpu", "pll0", FRAC0, 0); |
247 | clks[ref_emi] = mxs_clk_ref("ref_emi", "pll0", FRAC0, 1); | 247 | clks[ref_emi] = mxs_clk_ref("ref_emi", "pll0", FRAC0, 1); |
248 | clks[ref_io0] = mxs_clk_ref("ref_io0", "pll0", FRAC0, 2); | 248 | clks[ref_io1] = mxs_clk_ref("ref_io1", "pll0", FRAC0, 2); |
249 | clks[ref_io1] = mxs_clk_ref("ref_io1", "pll0", FRAC0, 3); | 249 | clks[ref_io0] = mxs_clk_ref("ref_io0", "pll0", FRAC0, 3); |
250 | clks[ref_pix] = mxs_clk_ref("ref_pix", "pll0", FRAC1, 0); | 250 | clks[ref_pix] = mxs_clk_ref("ref_pix", "pll0", FRAC1, 0); |
251 | clks[ref_hsadc] = mxs_clk_ref("ref_hsadc", "pll0", FRAC1, 1); | 251 | clks[ref_hsadc] = mxs_clk_ref("ref_hsadc", "pll0", FRAC1, 1); |
252 | clks[ref_gpmi] = mxs_clk_ref("ref_gpmi", "pll0", FRAC1, 2); | 252 | clks[ref_gpmi] = mxs_clk_ref("ref_gpmi", "pll0", FRAC1, 2); |
diff --git a/drivers/clk/spear/spear1310_clock.c b/drivers/clk/spear/spear1310_clock.c index 8f05652d53e6..0fcec2aae19c 100644 --- a/drivers/clk/spear/spear1310_clock.c +++ b/drivers/clk/spear/spear1310_clock.c | |||
@@ -345,31 +345,30 @@ static struct frac_rate_tbl gen_rtbl[] = { | |||
345 | /* clock parents */ | 345 | /* clock parents */ |
346 | static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", }; | 346 | static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", }; |
347 | static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", }; | 347 | static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", }; |
348 | static const char *uart0_parents[] = { "pll5_clk", "uart_synth_gate_clk", }; | 348 | static const char *uart0_parents[] = { "pll5_clk", "uart_syn_gclk", }; |
349 | static const char *c3_parents[] = { "pll5_clk", "c3_synth_gate_clk", }; | 349 | static const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", }; |
350 | static const char *gmac_phy_input_parents[] = { "gmii_125m_pad_clk", "pll2_clk", | 350 | static const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk", |
351 | "osc_25m_clk", }; | 351 | "osc_25m_clk", }; |
352 | static const char *gmac_phy_parents[] = { "gmac_phy_input_mux_clk", | 352 | static const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", }; |
353 | "gmac_phy_synth_gate_clk", }; | ||
354 | static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", }; | 353 | static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", }; |
355 | static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_synth_clk", }; | 354 | static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", }; |
356 | static const char *i2s_src_parents[] = { "vco1div2_clk", "none", "pll3_clk", | 355 | static const char *i2s_src_parents[] = { "vco1div2_clk", "none", "pll3_clk", |
357 | "i2s_src_pad_clk", }; | 356 | "i2s_src_pad_clk", }; |
358 | static const char *i2s_ref_parents[] = { "i2s_src_mux_clk", "i2s_prs1_clk", }; | 357 | static const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", }; |
359 | static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", | 358 | static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", |
360 | "pll3_clk", }; | 359 | "pll3_clk", }; |
361 | static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco3div2_clk", | 360 | static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco3div2_clk", |
362 | "pll2_clk", }; | 361 | "pll2_clk", }; |
363 | static const char *rmii_phy_parents[] = { "ras_tx50_clk", "none", | 362 | static const char *rmii_phy_parents[] = { "ras_tx50_clk", "none", |
364 | "ras_pll2_clk", "ras_synth0_clk", }; | 363 | "ras_pll2_clk", "ras_syn0_clk", }; |
365 | static const char *smii_rgmii_phy_parents[] = { "none", "ras_tx125_clk", | 364 | static const char *smii_rgmii_phy_parents[] = { "none", "ras_tx125_clk", |
366 | "ras_pll2_clk", "ras_synth0_clk", }; | 365 | "ras_pll2_clk", "ras_syn0_clk", }; |
367 | static const char *uart_parents[] = { "ras_apb_clk", "gen_synth3_clk", }; | 366 | static const char *uart_parents[] = { "ras_apb_clk", "gen_syn3_clk", }; |
368 | static const char *i2c_parents[] = { "ras_apb_clk", "gen_synth1_clk", }; | 367 | static const char *i2c_parents[] = { "ras_apb_clk", "gen_syn1_clk", }; |
369 | static const char *ssp1_parents[] = { "ras_apb_clk", "gen_synth1_clk", | 368 | static const char *ssp1_parents[] = { "ras_apb_clk", "gen_syn1_clk", |
370 | "ras_plclk0_clk", }; | 369 | "ras_plclk0_clk", }; |
371 | static const char *pci_parents[] = { "ras_pll3_clk", "gen_synth2_clk", }; | 370 | static const char *pci_parents[] = { "ras_pll3_clk", "gen_syn2_clk", }; |
372 | static const char *tdm_parents[] = { "ras_pll3_clk", "gen_synth1_clk", }; | 371 | static const char *tdm_parents[] = { "ras_pll3_clk", "gen_syn1_clk", }; |
373 | 372 | ||
374 | void __init spear1310_clk_init(void) | 373 | void __init spear1310_clk_init(void) |
375 | { | 374 | { |
@@ -390,9 +389,9 @@ void __init spear1310_clk_init(void) | |||
390 | 25000000); | 389 | 25000000); |
391 | clk_register_clkdev(clk, "osc_25m_clk", NULL); | 390 | clk_register_clkdev(clk, "osc_25m_clk", NULL); |
392 | 391 | ||
393 | clk = clk_register_fixed_rate(NULL, "gmii_125m_pad_clk", NULL, | 392 | clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, CLK_IS_ROOT, |
394 | CLK_IS_ROOT, 125000000); | 393 | 125000000); |
395 | clk_register_clkdev(clk, "gmii_125m_pad_clk", NULL); | 394 | clk_register_clkdev(clk, "gmii_pad_clk", NULL); |
396 | 395 | ||
397 | clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, | 396 | clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, |
398 | CLK_IS_ROOT, 12288000); | 397 | CLK_IS_ROOT, 12288000); |
@@ -406,34 +405,34 @@ void __init spear1310_clk_init(void) | |||
406 | 405 | ||
407 | /* clock derived from 24 or 25 MHz osc clk */ | 406 | /* clock derived from 24 or 25 MHz osc clk */ |
408 | /* vco-pll */ | 407 | /* vco-pll */ |
409 | clk = clk_register_mux(NULL, "vco1_mux_clk", vco_parents, | 408 | clk = clk_register_mux(NULL, "vco1_mclk", vco_parents, |
410 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, | 409 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, |
411 | SPEAR1310_PLL1_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, | 410 | SPEAR1310_PLL1_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, |
412 | &_lock); | 411 | &_lock); |
413 | clk_register_clkdev(clk, "vco1_mux_clk", NULL); | 412 | clk_register_clkdev(clk, "vco1_mclk", NULL); |
414 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mux_clk", | 413 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk", |
415 | 0, SPEAR1310_PLL1_CTR, SPEAR1310_PLL1_FRQ, pll_rtbl, | 414 | 0, SPEAR1310_PLL1_CTR, SPEAR1310_PLL1_FRQ, pll_rtbl, |
416 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 415 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
417 | clk_register_clkdev(clk, "vco1_clk", NULL); | 416 | clk_register_clkdev(clk, "vco1_clk", NULL); |
418 | clk_register_clkdev(clk1, "pll1_clk", NULL); | 417 | clk_register_clkdev(clk1, "pll1_clk", NULL); |
419 | 418 | ||
420 | clk = clk_register_mux(NULL, "vco2_mux_clk", vco_parents, | 419 | clk = clk_register_mux(NULL, "vco2_mclk", vco_parents, |
421 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, | 420 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, |
422 | SPEAR1310_PLL2_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, | 421 | SPEAR1310_PLL2_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, |
423 | &_lock); | 422 | &_lock); |
424 | clk_register_clkdev(clk, "vco2_mux_clk", NULL); | 423 | clk_register_clkdev(clk, "vco2_mclk", NULL); |
425 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mux_clk", | 424 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk", |
426 | 0, SPEAR1310_PLL2_CTR, SPEAR1310_PLL2_FRQ, pll_rtbl, | 425 | 0, SPEAR1310_PLL2_CTR, SPEAR1310_PLL2_FRQ, pll_rtbl, |
427 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 426 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
428 | clk_register_clkdev(clk, "vco2_clk", NULL); | 427 | clk_register_clkdev(clk, "vco2_clk", NULL); |
429 | clk_register_clkdev(clk1, "pll2_clk", NULL); | 428 | clk_register_clkdev(clk1, "pll2_clk", NULL); |
430 | 429 | ||
431 | clk = clk_register_mux(NULL, "vco3_mux_clk", vco_parents, | 430 | clk = clk_register_mux(NULL, "vco3_mclk", vco_parents, |
432 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, | 431 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, |
433 | SPEAR1310_PLL3_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, | 432 | SPEAR1310_PLL3_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, |
434 | &_lock); | 433 | &_lock); |
435 | clk_register_clkdev(clk, "vco3_mux_clk", NULL); | 434 | clk_register_clkdev(clk, "vco3_mclk", NULL); |
436 | clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mux_clk", | 435 | clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk", |
437 | 0, SPEAR1310_PLL3_CTR, SPEAR1310_PLL3_FRQ, pll_rtbl, | 436 | 0, SPEAR1310_PLL3_CTR, SPEAR1310_PLL3_FRQ, pll_rtbl, |
438 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 437 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
439 | clk_register_clkdev(clk, "vco3_clk", NULL); | 438 | clk_register_clkdev(clk, "vco3_clk", NULL); |
@@ -473,7 +472,7 @@ void __init spear1310_clk_init(void) | |||
473 | /* peripherals */ | 472 | /* peripherals */ |
474 | clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1, | 473 | clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1, |
475 | 128); | 474 | 128); |
476 | clk = clk_register_gate(NULL, "thermal_gate_clk", "thermal_clk", 0, | 475 | clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0, |
477 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_THSENS_CLK_ENB, 0, | 476 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_THSENS_CLK_ENB, 0, |
478 | &_lock); | 477 | &_lock); |
479 | clk_register_clkdev(clk, NULL, "spear_thermal"); | 478 | clk_register_clkdev(clk, NULL, "spear_thermal"); |
@@ -500,177 +499,176 @@ void __init spear1310_clk_init(void) | |||
500 | clk_register_clkdev(clk, "apb_clk", NULL); | 499 | clk_register_clkdev(clk, "apb_clk", NULL); |
501 | 500 | ||
502 | /* gpt clocks */ | 501 | /* gpt clocks */ |
503 | clk = clk_register_mux(NULL, "gpt0_mux_clk", gpt_parents, | 502 | clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents, |
504 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 503 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
505 | SPEAR1310_GPT0_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, | 504 | SPEAR1310_GPT0_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, |
506 | &_lock); | 505 | &_lock); |
507 | clk_register_clkdev(clk, "gpt0_mux_clk", NULL); | 506 | clk_register_clkdev(clk, "gpt0_mclk", NULL); |
508 | clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mux_clk", 0, | 507 | clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0, |
509 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT0_CLK_ENB, 0, | 508 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT0_CLK_ENB, 0, |
510 | &_lock); | 509 | &_lock); |
511 | clk_register_clkdev(clk, NULL, "gpt0"); | 510 | clk_register_clkdev(clk, NULL, "gpt0"); |
512 | 511 | ||
513 | clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt_parents, | 512 | clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents, |
514 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 513 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
515 | SPEAR1310_GPT1_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, | 514 | SPEAR1310_GPT1_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, |
516 | &_lock); | 515 | &_lock); |
517 | clk_register_clkdev(clk, "gpt1_mux_clk", NULL); | 516 | clk_register_clkdev(clk, "gpt1_mclk", NULL); |
518 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0, | 517 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0, |
519 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT1_CLK_ENB, 0, | 518 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT1_CLK_ENB, 0, |
520 | &_lock); | 519 | &_lock); |
521 | clk_register_clkdev(clk, NULL, "gpt1"); | 520 | clk_register_clkdev(clk, NULL, "gpt1"); |
522 | 521 | ||
523 | clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt_parents, | 522 | clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents, |
524 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 523 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
525 | SPEAR1310_GPT2_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, | 524 | SPEAR1310_GPT2_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, |
526 | &_lock); | 525 | &_lock); |
527 | clk_register_clkdev(clk, "gpt2_mux_clk", NULL); | 526 | clk_register_clkdev(clk, "gpt2_mclk", NULL); |
528 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0, | 527 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0, |
529 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT2_CLK_ENB, 0, | 528 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT2_CLK_ENB, 0, |
530 | &_lock); | 529 | &_lock); |
531 | clk_register_clkdev(clk, NULL, "gpt2"); | 530 | clk_register_clkdev(clk, NULL, "gpt2"); |
532 | 531 | ||
533 | clk = clk_register_mux(NULL, "gpt3_mux_clk", gpt_parents, | 532 | clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents, |
534 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 533 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
535 | SPEAR1310_GPT3_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, | 534 | SPEAR1310_GPT3_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, |
536 | &_lock); | 535 | &_lock); |
537 | clk_register_clkdev(clk, "gpt3_mux_clk", NULL); | 536 | clk_register_clkdev(clk, "gpt3_mclk", NULL); |
538 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mux_clk", 0, | 537 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0, |
539 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT3_CLK_ENB, 0, | 538 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT3_CLK_ENB, 0, |
540 | &_lock); | 539 | &_lock); |
541 | clk_register_clkdev(clk, NULL, "gpt3"); | 540 | clk_register_clkdev(clk, NULL, "gpt3"); |
542 | 541 | ||
543 | /* others */ | 542 | /* others */ |
544 | clk = clk_register_aux("uart_synth_clk", "uart_synth_gate_clk", | 543 | clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "vco1div2_clk", |
545 | "vco1div2_clk", 0, SPEAR1310_UART_CLK_SYNT, NULL, | 544 | 0, SPEAR1310_UART_CLK_SYNT, NULL, aux_rtbl, |
546 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 545 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
547 | clk_register_clkdev(clk, "uart_synth_clk", NULL); | 546 | clk_register_clkdev(clk, "uart_syn_clk", NULL); |
548 | clk_register_clkdev(clk1, "uart_synth_gate_clk", NULL); | 547 | clk_register_clkdev(clk1, "uart_syn_gclk", NULL); |
549 | 548 | ||
550 | clk = clk_register_mux(NULL, "uart0_mux_clk", uart0_parents, | 549 | clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents, |
551 | ARRAY_SIZE(uart0_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 550 | ARRAY_SIZE(uart0_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
552 | SPEAR1310_UART_CLK_SHIFT, SPEAR1310_UART_CLK_MASK, 0, | 551 | SPEAR1310_UART_CLK_SHIFT, SPEAR1310_UART_CLK_MASK, 0, |
553 | &_lock); | 552 | &_lock); |
554 | clk_register_clkdev(clk, "uart0_mux_clk", NULL); | 553 | clk_register_clkdev(clk, "uart0_mclk", NULL); |
555 | 554 | ||
556 | clk = clk_register_gate(NULL, "uart0_clk", "uart0_mux_clk", 0, | 555 | clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk", 0, |
557 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UART_CLK_ENB, 0, | 556 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UART_CLK_ENB, 0, |
558 | &_lock); | 557 | &_lock); |
559 | clk_register_clkdev(clk, NULL, "e0000000.serial"); | 558 | clk_register_clkdev(clk, NULL, "e0000000.serial"); |
560 | 559 | ||
561 | clk = clk_register_aux("sdhci_synth_clk", "sdhci_synth_gate_clk", | 560 | clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk", |
562 | "vco1div2_clk", 0, SPEAR1310_SDHCI_CLK_SYNT, NULL, | 561 | "vco1div2_clk", 0, SPEAR1310_SDHCI_CLK_SYNT, NULL, |
563 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 562 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
564 | clk_register_clkdev(clk, "sdhci_synth_clk", NULL); | 563 | clk_register_clkdev(clk, "sdhci_syn_clk", NULL); |
565 | clk_register_clkdev(clk1, "sdhci_synth_gate_clk", NULL); | 564 | clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL); |
566 | 565 | ||
567 | clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_synth_gate_clk", 0, | 566 | clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk", 0, |
568 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SDHCI_CLK_ENB, 0, | 567 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SDHCI_CLK_ENB, 0, |
569 | &_lock); | 568 | &_lock); |
570 | clk_register_clkdev(clk, NULL, "b3000000.sdhci"); | 569 | clk_register_clkdev(clk, NULL, "b3000000.sdhci"); |
571 | 570 | ||
572 | clk = clk_register_aux("cfxd_synth_clk", "cfxd_synth_gate_clk", | 571 | clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk", |
573 | "vco1div2_clk", 0, SPEAR1310_CFXD_CLK_SYNT, NULL, | 572 | 0, SPEAR1310_CFXD_CLK_SYNT, NULL, aux_rtbl, |
574 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 573 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
575 | clk_register_clkdev(clk, "cfxd_synth_clk", NULL); | 574 | clk_register_clkdev(clk, "cfxd_syn_clk", NULL); |
576 | clk_register_clkdev(clk1, "cfxd_synth_gate_clk", NULL); | 575 | clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL); |
577 | 576 | ||
578 | clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_synth_gate_clk", 0, | 577 | clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk", 0, |
579 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CFXD_CLK_ENB, 0, | 578 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CFXD_CLK_ENB, 0, |
580 | &_lock); | 579 | &_lock); |
581 | clk_register_clkdev(clk, NULL, "b2800000.cf"); | 580 | clk_register_clkdev(clk, NULL, "b2800000.cf"); |
582 | clk_register_clkdev(clk, NULL, "arasan_xd"); | 581 | clk_register_clkdev(clk, NULL, "arasan_xd"); |
583 | 582 | ||
584 | clk = clk_register_aux("c3_synth_clk", "c3_synth_gate_clk", | 583 | clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk", |
585 | "vco1div2_clk", 0, SPEAR1310_C3_CLK_SYNT, NULL, | 584 | 0, SPEAR1310_C3_CLK_SYNT, NULL, aux_rtbl, |
586 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 585 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
587 | clk_register_clkdev(clk, "c3_synth_clk", NULL); | 586 | clk_register_clkdev(clk, "c3_syn_clk", NULL); |
588 | clk_register_clkdev(clk1, "c3_synth_gate_clk", NULL); | 587 | clk_register_clkdev(clk1, "c3_syn_gclk", NULL); |
589 | 588 | ||
590 | clk = clk_register_mux(NULL, "c3_mux_clk", c3_parents, | 589 | clk = clk_register_mux(NULL, "c3_mclk", c3_parents, |
591 | ARRAY_SIZE(c3_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 590 | ARRAY_SIZE(c3_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
592 | SPEAR1310_C3_CLK_SHIFT, SPEAR1310_C3_CLK_MASK, 0, | 591 | SPEAR1310_C3_CLK_SHIFT, SPEAR1310_C3_CLK_MASK, 0, |
593 | &_lock); | 592 | &_lock); |
594 | clk_register_clkdev(clk, "c3_mux_clk", NULL); | 593 | clk_register_clkdev(clk, "c3_mclk", NULL); |
595 | 594 | ||
596 | clk = clk_register_gate(NULL, "c3_clk", "c3_mux_clk", 0, | 595 | clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", 0, |
597 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_C3_CLK_ENB, 0, | 596 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_C3_CLK_ENB, 0, |
598 | &_lock); | 597 | &_lock); |
599 | clk_register_clkdev(clk, NULL, "c3"); | 598 | clk_register_clkdev(clk, NULL, "c3"); |
600 | 599 | ||
601 | /* gmac */ | 600 | /* gmac */ |
602 | clk = clk_register_mux(NULL, "gmac_phy_input_mux_clk", | 601 | clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents, |
603 | gmac_phy_input_parents, | ||
604 | ARRAY_SIZE(gmac_phy_input_parents), 0, | 602 | ARRAY_SIZE(gmac_phy_input_parents), 0, |
605 | SPEAR1310_GMAC_CLK_CFG, | 603 | SPEAR1310_GMAC_CLK_CFG, |
606 | SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT, | 604 | SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT, |
607 | SPEAR1310_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock); | 605 | SPEAR1310_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock); |
608 | clk_register_clkdev(clk, "gmac_phy_input_mux_clk", NULL); | 606 | clk_register_clkdev(clk, "phy_input_mclk", NULL); |
609 | 607 | ||
610 | clk = clk_register_aux("gmac_phy_synth_clk", "gmac_phy_synth_gate_clk", | 608 | clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk", |
611 | "gmac_phy_input_mux_clk", 0, SPEAR1310_GMAC_CLK_SYNT, | 609 | 0, SPEAR1310_GMAC_CLK_SYNT, NULL, gmac_rtbl, |
612 | NULL, gmac_rtbl, ARRAY_SIZE(gmac_rtbl), &_lock, &clk1); | 610 | ARRAY_SIZE(gmac_rtbl), &_lock, &clk1); |
613 | clk_register_clkdev(clk, "gmac_phy_synth_clk", NULL); | 611 | clk_register_clkdev(clk, "phy_syn_clk", NULL); |
614 | clk_register_clkdev(clk1, "gmac_phy_synth_gate_clk", NULL); | 612 | clk_register_clkdev(clk1, "phy_syn_gclk", NULL); |
615 | 613 | ||
616 | clk = clk_register_mux(NULL, "gmac_phy_mux_clk", gmac_phy_parents, | 614 | clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents, |
617 | ARRAY_SIZE(gmac_phy_parents), 0, | 615 | ARRAY_SIZE(gmac_phy_parents), 0, |
618 | SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GMAC_PHY_CLK_SHIFT, | 616 | SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GMAC_PHY_CLK_SHIFT, |
619 | SPEAR1310_GMAC_PHY_CLK_MASK, 0, &_lock); | 617 | SPEAR1310_GMAC_PHY_CLK_MASK, 0, &_lock); |
620 | clk_register_clkdev(clk, NULL, "stmmacphy.0"); | 618 | clk_register_clkdev(clk, NULL, "stmmacphy.0"); |
621 | 619 | ||
622 | /* clcd */ | 620 | /* clcd */ |
623 | clk = clk_register_mux(NULL, "clcd_synth_mux_clk", clcd_synth_parents, | 621 | clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents, |
624 | ARRAY_SIZE(clcd_synth_parents), 0, | 622 | ARRAY_SIZE(clcd_synth_parents), 0, |
625 | SPEAR1310_CLCD_CLK_SYNT, SPEAR1310_CLCD_SYNT_CLK_SHIFT, | 623 | SPEAR1310_CLCD_CLK_SYNT, SPEAR1310_CLCD_SYNT_CLK_SHIFT, |
626 | SPEAR1310_CLCD_SYNT_CLK_MASK, 0, &_lock); | 624 | SPEAR1310_CLCD_SYNT_CLK_MASK, 0, &_lock); |
627 | clk_register_clkdev(clk, "clcd_synth_mux_clk", NULL); | 625 | clk_register_clkdev(clk, "clcd_syn_mclk", NULL); |
628 | 626 | ||
629 | clk = clk_register_frac("clcd_synth_clk", "clcd_synth_mux_clk", 0, | 627 | clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0, |
630 | SPEAR1310_CLCD_CLK_SYNT, clcd_rtbl, | 628 | SPEAR1310_CLCD_CLK_SYNT, clcd_rtbl, |
631 | ARRAY_SIZE(clcd_rtbl), &_lock); | 629 | ARRAY_SIZE(clcd_rtbl), &_lock); |
632 | clk_register_clkdev(clk, "clcd_synth_clk", NULL); | 630 | clk_register_clkdev(clk, "clcd_syn_clk", NULL); |
633 | 631 | ||
634 | clk = clk_register_mux(NULL, "clcd_pixel_mux_clk", clcd_pixel_parents, | 632 | clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents, |
635 | ARRAY_SIZE(clcd_pixel_parents), 0, | 633 | ARRAY_SIZE(clcd_pixel_parents), 0, |
636 | SPEAR1310_PERIP_CLK_CFG, SPEAR1310_CLCD_CLK_SHIFT, | 634 | SPEAR1310_PERIP_CLK_CFG, SPEAR1310_CLCD_CLK_SHIFT, |
637 | SPEAR1310_CLCD_CLK_MASK, 0, &_lock); | 635 | SPEAR1310_CLCD_CLK_MASK, 0, &_lock); |
638 | clk_register_clkdev(clk, "clcd_pixel_clk", NULL); | 636 | clk_register_clkdev(clk, "clcd_pixel_clk", NULL); |
639 | 637 | ||
640 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mux_clk", 0, | 638 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0, |
641 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CLCD_CLK_ENB, 0, | 639 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CLCD_CLK_ENB, 0, |
642 | &_lock); | 640 | &_lock); |
643 | clk_register_clkdev(clk, "clcd_clk", NULL); | 641 | clk_register_clkdev(clk, "clcd_clk", NULL); |
644 | 642 | ||
645 | /* i2s */ | 643 | /* i2s */ |
646 | clk = clk_register_mux(NULL, "i2s_src_mux_clk", i2s_src_parents, | 644 | clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents, |
647 | ARRAY_SIZE(i2s_src_parents), 0, SPEAR1310_I2S_CLK_CFG, | 645 | ARRAY_SIZE(i2s_src_parents), 0, SPEAR1310_I2S_CLK_CFG, |
648 | SPEAR1310_I2S_SRC_CLK_SHIFT, SPEAR1310_I2S_SRC_CLK_MASK, | 646 | SPEAR1310_I2S_SRC_CLK_SHIFT, SPEAR1310_I2S_SRC_CLK_MASK, |
649 | 0, &_lock); | 647 | 0, &_lock); |
650 | clk_register_clkdev(clk, "i2s_src_clk", NULL); | 648 | clk_register_clkdev(clk, "i2s_src_clk", NULL); |
651 | 649 | ||
652 | clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mux_clk", 0, | 650 | clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk", 0, |
653 | SPEAR1310_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl, | 651 | SPEAR1310_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl, |
654 | ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL); | 652 | ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL); |
655 | clk_register_clkdev(clk, "i2s_prs1_clk", NULL); | 653 | clk_register_clkdev(clk, "i2s_prs1_clk", NULL); |
656 | 654 | ||
657 | clk = clk_register_mux(NULL, "i2s_ref_mux_clk", i2s_ref_parents, | 655 | clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents, |
658 | ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1310_I2S_CLK_CFG, | 656 | ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1310_I2S_CLK_CFG, |
659 | SPEAR1310_I2S_REF_SHIFT, SPEAR1310_I2S_REF_SEL_MASK, 0, | 657 | SPEAR1310_I2S_REF_SHIFT, SPEAR1310_I2S_REF_SEL_MASK, 0, |
660 | &_lock); | 658 | &_lock); |
661 | clk_register_clkdev(clk, "i2s_ref_clk", NULL); | 659 | clk_register_clkdev(clk, "i2s_ref_clk", NULL); |
662 | 660 | ||
663 | clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mux_clk", 0, | 661 | clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0, |
664 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_I2S_REF_PAD_CLK_ENB, | 662 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_I2S_REF_PAD_CLK_ENB, |
665 | 0, &_lock); | 663 | 0, &_lock); |
666 | clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL); | 664 | clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL); |
667 | 665 | ||
668 | clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gate_clk", | 666 | clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk", |
669 | "i2s_ref_pad_clk", 0, SPEAR1310_I2S_CLK_CFG, | 667 | "i2s_ref_pad_clk", 0, SPEAR1310_I2S_CLK_CFG, |
670 | &i2s_sclk_masks, i2s_sclk_rtbl, | 668 | &i2s_sclk_masks, i2s_sclk_rtbl, |
671 | ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1); | 669 | ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1); |
672 | clk_register_clkdev(clk, "i2s_sclk_clk", NULL); | 670 | clk_register_clkdev(clk, "i2s_sclk_clk", NULL); |
673 | clk_register_clkdev(clk1, "i2s_sclk_gate_clk", NULL); | 671 | clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL); |
674 | 672 | ||
675 | /* clock derived from ahb clk */ | 673 | /* clock derived from ahb clk */ |
676 | clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0, | 674 | clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0, |
@@ -747,13 +745,13 @@ void __init spear1310_clk_init(void) | |||
747 | &_lock); | 745 | &_lock); |
748 | clk_register_clkdev(clk, "sysram1_clk", NULL); | 746 | clk_register_clkdev(clk, "sysram1_clk", NULL); |
749 | 747 | ||
750 | clk = clk_register_aux("adc_synth_clk", "adc_synth_gate_clk", "ahb_clk", | 748 | clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk", |
751 | 0, SPEAR1310_ADC_CLK_SYNT, NULL, adc_rtbl, | 749 | 0, SPEAR1310_ADC_CLK_SYNT, NULL, adc_rtbl, |
752 | ARRAY_SIZE(adc_rtbl), &_lock, &clk1); | 750 | ARRAY_SIZE(adc_rtbl), &_lock, &clk1); |
753 | clk_register_clkdev(clk, "adc_synth_clk", NULL); | 751 | clk_register_clkdev(clk, "adc_syn_clk", NULL); |
754 | clk_register_clkdev(clk1, "adc_synth_gate_clk", NULL); | 752 | clk_register_clkdev(clk1, "adc_syn_gclk", NULL); |
755 | 753 | ||
756 | clk = clk_register_gate(NULL, "adc_clk", "adc_synth_gate_clk", 0, | 754 | clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk", 0, |
757 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_ADC_CLK_ENB, 0, | 755 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_ADC_CLK_ENB, 0, |
758 | &_lock); | 756 | &_lock); |
759 | clk_register_clkdev(clk, NULL, "adc_clk"); | 757 | clk_register_clkdev(clk, NULL, "adc_clk"); |
@@ -790,37 +788,37 @@ void __init spear1310_clk_init(void) | |||
790 | clk_register_clkdev(clk, NULL, "e0300000.kbd"); | 788 | clk_register_clkdev(clk, NULL, "e0300000.kbd"); |
791 | 789 | ||
792 | /* RAS clks */ | 790 | /* RAS clks */ |
793 | clk = clk_register_mux(NULL, "gen_synth0_1_mux_clk", | 791 | clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents, |
794 | gen_synth0_1_parents, ARRAY_SIZE(gen_synth0_1_parents), | 792 | ARRAY_SIZE(gen_synth0_1_parents), 0, SPEAR1310_PLL_CFG, |
795 | 0, SPEAR1310_PLL_CFG, SPEAR1310_RAS_SYNT0_1_CLK_SHIFT, | 793 | SPEAR1310_RAS_SYNT0_1_CLK_SHIFT, |
796 | SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock); | 794 | SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock); |
797 | clk_register_clkdev(clk, "gen_synth0_1_clk", NULL); | 795 | clk_register_clkdev(clk, "gen_syn0_1_clk", NULL); |
798 | 796 | ||
799 | clk = clk_register_mux(NULL, "gen_synth2_3_mux_clk", | 797 | clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents, |
800 | gen_synth2_3_parents, ARRAY_SIZE(gen_synth2_3_parents), | 798 | ARRAY_SIZE(gen_synth2_3_parents), 0, SPEAR1310_PLL_CFG, |
801 | 0, SPEAR1310_PLL_CFG, SPEAR1310_RAS_SYNT2_3_CLK_SHIFT, | 799 | SPEAR1310_RAS_SYNT2_3_CLK_SHIFT, |
802 | SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock); | 800 | SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock); |
803 | clk_register_clkdev(clk, "gen_synth2_3_clk", NULL); | 801 | clk_register_clkdev(clk, "gen_syn2_3_clk", NULL); |
804 | 802 | ||
805 | clk = clk_register_frac("gen_synth0_clk", "gen_synth0_1_clk", 0, | 803 | clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_clk", 0, |
806 | SPEAR1310_RAS_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 804 | SPEAR1310_RAS_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
807 | &_lock); | 805 | &_lock); |
808 | clk_register_clkdev(clk, "gen_synth0_clk", NULL); | 806 | clk_register_clkdev(clk, "gen_syn0_clk", NULL); |
809 | 807 | ||
810 | clk = clk_register_frac("gen_synth1_clk", "gen_synth0_1_clk", 0, | 808 | clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_clk", 0, |
811 | SPEAR1310_RAS_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 809 | SPEAR1310_RAS_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
812 | &_lock); | 810 | &_lock); |
813 | clk_register_clkdev(clk, "gen_synth1_clk", NULL); | 811 | clk_register_clkdev(clk, "gen_syn1_clk", NULL); |
814 | 812 | ||
815 | clk = clk_register_frac("gen_synth2_clk", "gen_synth2_3_clk", 0, | 813 | clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_clk", 0, |
816 | SPEAR1310_RAS_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 814 | SPEAR1310_RAS_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
817 | &_lock); | 815 | &_lock); |
818 | clk_register_clkdev(clk, "gen_synth2_clk", NULL); | 816 | clk_register_clkdev(clk, "gen_syn2_clk", NULL); |
819 | 817 | ||
820 | clk = clk_register_frac("gen_synth3_clk", "gen_synth2_3_clk", 0, | 818 | clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_clk", 0, |
821 | SPEAR1310_RAS_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 819 | SPEAR1310_RAS_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
822 | &_lock); | 820 | &_lock); |
823 | clk_register_clkdev(clk, "gen_synth3_clk", NULL); | 821 | clk_register_clkdev(clk, "gen_syn3_clk", NULL); |
824 | 822 | ||
825 | clk = clk_register_gate(NULL, "ras_osc_24m_clk", "osc_24m_clk", 0, | 823 | clk = clk_register_gate(NULL, "ras_osc_24m_clk", "osc_24m_clk", 0, |
826 | SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_24M_CLK_ENB, 0, | 824 | SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_24M_CLK_ENB, 0, |
@@ -847,7 +845,7 @@ void __init spear1310_clk_init(void) | |||
847 | &_lock); | 845 | &_lock); |
848 | clk_register_clkdev(clk, "ras_pll3_clk", NULL); | 846 | clk_register_clkdev(clk, "ras_pll3_clk", NULL); |
849 | 847 | ||
850 | clk = clk_register_gate(NULL, "ras_tx125_clk", "gmii_125m_pad_clk", 0, | 848 | clk = clk_register_gate(NULL, "ras_tx125_clk", "gmii_pad_clk", 0, |
851 | SPEAR1310_RAS_CLK_ENB, SPEAR1310_C125M_PAD_CLK_ENB, 0, | 849 | SPEAR1310_RAS_CLK_ENB, SPEAR1310_C125M_PAD_CLK_ENB, 0, |
852 | &_lock); | 850 | &_lock); |
853 | clk_register_clkdev(clk, "ras_tx125_clk", NULL); | 851 | clk_register_clkdev(clk, "ras_tx125_clk", NULL); |
@@ -912,7 +910,7 @@ void __init spear1310_clk_init(void) | |||
912 | &_lock); | 910 | &_lock); |
913 | clk_register_clkdev(clk, NULL, "5c700000.eth"); | 911 | clk_register_clkdev(clk, NULL, "5c700000.eth"); |
914 | 912 | ||
915 | clk = clk_register_mux(NULL, "smii_rgmii_phy_mux_clk", | 913 | clk = clk_register_mux(NULL, "smii_rgmii_phy_mclk", |
916 | smii_rgmii_phy_parents, | 914 | smii_rgmii_phy_parents, |
917 | ARRAY_SIZE(smii_rgmii_phy_parents), 0, | 915 | ARRAY_SIZE(smii_rgmii_phy_parents), 0, |
918 | SPEAR1310_RAS_CTRL_REG1, | 916 | SPEAR1310_RAS_CTRL_REG1, |
@@ -922,184 +920,184 @@ void __init spear1310_clk_init(void) | |||
922 | clk_register_clkdev(clk, NULL, "stmmacphy.2"); | 920 | clk_register_clkdev(clk, NULL, "stmmacphy.2"); |
923 | clk_register_clkdev(clk, NULL, "stmmacphy.4"); | 921 | clk_register_clkdev(clk, NULL, "stmmacphy.4"); |
924 | 922 | ||
925 | clk = clk_register_mux(NULL, "rmii_phy_mux_clk", rmii_phy_parents, | 923 | clk = clk_register_mux(NULL, "rmii_phy_mclk", rmii_phy_parents, |
926 | ARRAY_SIZE(rmii_phy_parents), 0, | 924 | ARRAY_SIZE(rmii_phy_parents), 0, |
927 | SPEAR1310_RAS_CTRL_REG1, SPEAR1310_RMII_PHY_CLK_SHIFT, | 925 | SPEAR1310_RAS_CTRL_REG1, SPEAR1310_RMII_PHY_CLK_SHIFT, |
928 | SPEAR1310_PHY_CLK_MASK, 0, &_lock); | 926 | SPEAR1310_PHY_CLK_MASK, 0, &_lock); |
929 | clk_register_clkdev(clk, NULL, "stmmacphy.3"); | 927 | clk_register_clkdev(clk, NULL, "stmmacphy.3"); |
930 | 928 | ||
931 | clk = clk_register_mux(NULL, "uart1_mux_clk", uart_parents, | 929 | clk = clk_register_mux(NULL, "uart1_mclk", uart_parents, |
932 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 930 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
933 | SPEAR1310_UART1_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 931 | SPEAR1310_UART1_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
934 | 0, &_lock); | 932 | 0, &_lock); |
935 | clk_register_clkdev(clk, "uart1_mux_clk", NULL); | 933 | clk_register_clkdev(clk, "uart1_mclk", NULL); |
936 | 934 | ||
937 | clk = clk_register_gate(NULL, "uart1_clk", "uart1_mux_clk", 0, | 935 | clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0, |
938 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART1_CLK_ENB, 0, | 936 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART1_CLK_ENB, 0, |
939 | &_lock); | 937 | &_lock); |
940 | clk_register_clkdev(clk, NULL, "5c800000.serial"); | 938 | clk_register_clkdev(clk, NULL, "5c800000.serial"); |
941 | 939 | ||
942 | clk = clk_register_mux(NULL, "uart2_mux_clk", uart_parents, | 940 | clk = clk_register_mux(NULL, "uart2_mclk", uart_parents, |
943 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 941 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
944 | SPEAR1310_UART2_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 942 | SPEAR1310_UART2_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
945 | 0, &_lock); | 943 | 0, &_lock); |
946 | clk_register_clkdev(clk, "uart2_mux_clk", NULL); | 944 | clk_register_clkdev(clk, "uart2_mclk", NULL); |
947 | 945 | ||
948 | clk = clk_register_gate(NULL, "uart2_clk", "uart2_mux_clk", 0, | 946 | clk = clk_register_gate(NULL, "uart2_clk", "uart2_mclk", 0, |
949 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART2_CLK_ENB, 0, | 947 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART2_CLK_ENB, 0, |
950 | &_lock); | 948 | &_lock); |
951 | clk_register_clkdev(clk, NULL, "5c900000.serial"); | 949 | clk_register_clkdev(clk, NULL, "5c900000.serial"); |
952 | 950 | ||
953 | clk = clk_register_mux(NULL, "uart3_mux_clk", uart_parents, | 951 | clk = clk_register_mux(NULL, "uart3_mclk", uart_parents, |
954 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 952 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
955 | SPEAR1310_UART3_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 953 | SPEAR1310_UART3_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
956 | 0, &_lock); | 954 | 0, &_lock); |
957 | clk_register_clkdev(clk, "uart3_mux_clk", NULL); | 955 | clk_register_clkdev(clk, "uart3_mclk", NULL); |
958 | 956 | ||
959 | clk = clk_register_gate(NULL, "uart3_clk", "uart3_mux_clk", 0, | 957 | clk = clk_register_gate(NULL, "uart3_clk", "uart3_mclk", 0, |
960 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART3_CLK_ENB, 0, | 958 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART3_CLK_ENB, 0, |
961 | &_lock); | 959 | &_lock); |
962 | clk_register_clkdev(clk, NULL, "5ca00000.serial"); | 960 | clk_register_clkdev(clk, NULL, "5ca00000.serial"); |
963 | 961 | ||
964 | clk = clk_register_mux(NULL, "uart4_mux_clk", uart_parents, | 962 | clk = clk_register_mux(NULL, "uart4_mclk", uart_parents, |
965 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 963 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
966 | SPEAR1310_UART4_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 964 | SPEAR1310_UART4_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
967 | 0, &_lock); | 965 | 0, &_lock); |
968 | clk_register_clkdev(clk, "uart4_mux_clk", NULL); | 966 | clk_register_clkdev(clk, "uart4_mclk", NULL); |
969 | 967 | ||
970 | clk = clk_register_gate(NULL, "uart4_clk", "uart4_mux_clk", 0, | 968 | clk = clk_register_gate(NULL, "uart4_clk", "uart4_mclk", 0, |
971 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART4_CLK_ENB, 0, | 969 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART4_CLK_ENB, 0, |
972 | &_lock); | 970 | &_lock); |
973 | clk_register_clkdev(clk, NULL, "5cb00000.serial"); | 971 | clk_register_clkdev(clk, NULL, "5cb00000.serial"); |
974 | 972 | ||
975 | clk = clk_register_mux(NULL, "uart5_mux_clk", uart_parents, | 973 | clk = clk_register_mux(NULL, "uart5_mclk", uart_parents, |
976 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 974 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
977 | SPEAR1310_UART5_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 975 | SPEAR1310_UART5_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
978 | 0, &_lock); | 976 | 0, &_lock); |
979 | clk_register_clkdev(clk, "uart5_mux_clk", NULL); | 977 | clk_register_clkdev(clk, "uart5_mclk", NULL); |
980 | 978 | ||
981 | clk = clk_register_gate(NULL, "uart5_clk", "uart5_mux_clk", 0, | 979 | clk = clk_register_gate(NULL, "uart5_clk", "uart5_mclk", 0, |
982 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART5_CLK_ENB, 0, | 980 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART5_CLK_ENB, 0, |
983 | &_lock); | 981 | &_lock); |
984 | clk_register_clkdev(clk, NULL, "5cc00000.serial"); | 982 | clk_register_clkdev(clk, NULL, "5cc00000.serial"); |
985 | 983 | ||
986 | clk = clk_register_mux(NULL, "i2c1_mux_clk", i2c_parents, | 984 | clk = clk_register_mux(NULL, "i2c1_mclk", i2c_parents, |
987 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 985 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
988 | SPEAR1310_I2C1_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 986 | SPEAR1310_I2C1_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
989 | &_lock); | 987 | &_lock); |
990 | clk_register_clkdev(clk, "i2c1_mux_clk", NULL); | 988 | clk_register_clkdev(clk, "i2c1_mclk", NULL); |
991 | 989 | ||
992 | clk = clk_register_gate(NULL, "i2c1_clk", "i2c1_mux_clk", 0, | 990 | clk = clk_register_gate(NULL, "i2c1_clk", "i2c1_mclk", 0, |
993 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C1_CLK_ENB, 0, | 991 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C1_CLK_ENB, 0, |
994 | &_lock); | 992 | &_lock); |
995 | clk_register_clkdev(clk, NULL, "5cd00000.i2c"); | 993 | clk_register_clkdev(clk, NULL, "5cd00000.i2c"); |
996 | 994 | ||
997 | clk = clk_register_mux(NULL, "i2c2_mux_clk", i2c_parents, | 995 | clk = clk_register_mux(NULL, "i2c2_mclk", i2c_parents, |
998 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 996 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
999 | SPEAR1310_I2C2_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 997 | SPEAR1310_I2C2_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
1000 | &_lock); | 998 | &_lock); |
1001 | clk_register_clkdev(clk, "i2c2_mux_clk", NULL); | 999 | clk_register_clkdev(clk, "i2c2_mclk", NULL); |
1002 | 1000 | ||
1003 | clk = clk_register_gate(NULL, "i2c2_clk", "i2c2_mux_clk", 0, | 1001 | clk = clk_register_gate(NULL, "i2c2_clk", "i2c2_mclk", 0, |
1004 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C2_CLK_ENB, 0, | 1002 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C2_CLK_ENB, 0, |
1005 | &_lock); | 1003 | &_lock); |
1006 | clk_register_clkdev(clk, NULL, "5ce00000.i2c"); | 1004 | clk_register_clkdev(clk, NULL, "5ce00000.i2c"); |
1007 | 1005 | ||
1008 | clk = clk_register_mux(NULL, "i2c3_mux_clk", i2c_parents, | 1006 | clk = clk_register_mux(NULL, "i2c3_mclk", i2c_parents, |
1009 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1007 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1010 | SPEAR1310_I2C3_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1008 | SPEAR1310_I2C3_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
1011 | &_lock); | 1009 | &_lock); |
1012 | clk_register_clkdev(clk, "i2c3_mux_clk", NULL); | 1010 | clk_register_clkdev(clk, "i2c3_mclk", NULL); |
1013 | 1011 | ||
1014 | clk = clk_register_gate(NULL, "i2c3_clk", "i2c3_mux_clk", 0, | 1012 | clk = clk_register_gate(NULL, "i2c3_clk", "i2c3_mclk", 0, |
1015 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C3_CLK_ENB, 0, | 1013 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C3_CLK_ENB, 0, |
1016 | &_lock); | 1014 | &_lock); |
1017 | clk_register_clkdev(clk, NULL, "5cf00000.i2c"); | 1015 | clk_register_clkdev(clk, NULL, "5cf00000.i2c"); |
1018 | 1016 | ||
1019 | clk = clk_register_mux(NULL, "i2c4_mux_clk", i2c_parents, | 1017 | clk = clk_register_mux(NULL, "i2c4_mclk", i2c_parents, |
1020 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1018 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1021 | SPEAR1310_I2C4_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1019 | SPEAR1310_I2C4_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
1022 | &_lock); | 1020 | &_lock); |
1023 | clk_register_clkdev(clk, "i2c4_mux_clk", NULL); | 1021 | clk_register_clkdev(clk, "i2c4_mclk", NULL); |
1024 | 1022 | ||
1025 | clk = clk_register_gate(NULL, "i2c4_clk", "i2c4_mux_clk", 0, | 1023 | clk = clk_register_gate(NULL, "i2c4_clk", "i2c4_mclk", 0, |
1026 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C4_CLK_ENB, 0, | 1024 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C4_CLK_ENB, 0, |
1027 | &_lock); | 1025 | &_lock); |
1028 | clk_register_clkdev(clk, NULL, "5d000000.i2c"); | 1026 | clk_register_clkdev(clk, NULL, "5d000000.i2c"); |
1029 | 1027 | ||
1030 | clk = clk_register_mux(NULL, "i2c5_mux_clk", i2c_parents, | 1028 | clk = clk_register_mux(NULL, "i2c5_mclk", i2c_parents, |
1031 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1029 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1032 | SPEAR1310_I2C5_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1030 | SPEAR1310_I2C5_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
1033 | &_lock); | 1031 | &_lock); |
1034 | clk_register_clkdev(clk, "i2c5_mux_clk", NULL); | 1032 | clk_register_clkdev(clk, "i2c5_mclk", NULL); |
1035 | 1033 | ||
1036 | clk = clk_register_gate(NULL, "i2c5_clk", "i2c5_mux_clk", 0, | 1034 | clk = clk_register_gate(NULL, "i2c5_clk", "i2c5_mclk", 0, |
1037 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C5_CLK_ENB, 0, | 1035 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C5_CLK_ENB, 0, |
1038 | &_lock); | 1036 | &_lock); |
1039 | clk_register_clkdev(clk, NULL, "5d100000.i2c"); | 1037 | clk_register_clkdev(clk, NULL, "5d100000.i2c"); |
1040 | 1038 | ||
1041 | clk = clk_register_mux(NULL, "i2c6_mux_clk", i2c_parents, | 1039 | clk = clk_register_mux(NULL, "i2c6_mclk", i2c_parents, |
1042 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1040 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1043 | SPEAR1310_I2C6_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1041 | SPEAR1310_I2C6_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
1044 | &_lock); | 1042 | &_lock); |
1045 | clk_register_clkdev(clk, "i2c6_mux_clk", NULL); | 1043 | clk_register_clkdev(clk, "i2c6_mclk", NULL); |
1046 | 1044 | ||
1047 | clk = clk_register_gate(NULL, "i2c6_clk", "i2c6_mux_clk", 0, | 1045 | clk = clk_register_gate(NULL, "i2c6_clk", "i2c6_mclk", 0, |
1048 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C6_CLK_ENB, 0, | 1046 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C6_CLK_ENB, 0, |
1049 | &_lock); | 1047 | &_lock); |
1050 | clk_register_clkdev(clk, NULL, "5d200000.i2c"); | 1048 | clk_register_clkdev(clk, NULL, "5d200000.i2c"); |
1051 | 1049 | ||
1052 | clk = clk_register_mux(NULL, "i2c7_mux_clk", i2c_parents, | 1050 | clk = clk_register_mux(NULL, "i2c7_mclk", i2c_parents, |
1053 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1051 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1054 | SPEAR1310_I2C7_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1052 | SPEAR1310_I2C7_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
1055 | &_lock); | 1053 | &_lock); |
1056 | clk_register_clkdev(clk, "i2c7_mux_clk", NULL); | 1054 | clk_register_clkdev(clk, "i2c7_mclk", NULL); |
1057 | 1055 | ||
1058 | clk = clk_register_gate(NULL, "i2c7_clk", "i2c7_mux_clk", 0, | 1056 | clk = clk_register_gate(NULL, "i2c7_clk", "i2c7_mclk", 0, |
1059 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C7_CLK_ENB, 0, | 1057 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C7_CLK_ENB, 0, |
1060 | &_lock); | 1058 | &_lock); |
1061 | clk_register_clkdev(clk, NULL, "5d300000.i2c"); | 1059 | clk_register_clkdev(clk, NULL, "5d300000.i2c"); |
1062 | 1060 | ||
1063 | clk = clk_register_mux(NULL, "ssp1_mux_clk", ssp1_parents, | 1061 | clk = clk_register_mux(NULL, "ssp1_mclk", ssp1_parents, |
1064 | ARRAY_SIZE(ssp1_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1062 | ARRAY_SIZE(ssp1_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1065 | SPEAR1310_SSP1_CLK_SHIFT, SPEAR1310_SSP1_CLK_MASK, 0, | 1063 | SPEAR1310_SSP1_CLK_SHIFT, SPEAR1310_SSP1_CLK_MASK, 0, |
1066 | &_lock); | 1064 | &_lock); |
1067 | clk_register_clkdev(clk, "ssp1_mux_clk", NULL); | 1065 | clk_register_clkdev(clk, "ssp1_mclk", NULL); |
1068 | 1066 | ||
1069 | clk = clk_register_gate(NULL, "ssp1_clk", "ssp1_mux_clk", 0, | 1067 | clk = clk_register_gate(NULL, "ssp1_clk", "ssp1_mclk", 0, |
1070 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_SSP1_CLK_ENB, 0, | 1068 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_SSP1_CLK_ENB, 0, |
1071 | &_lock); | 1069 | &_lock); |
1072 | clk_register_clkdev(clk, NULL, "5d400000.spi"); | 1070 | clk_register_clkdev(clk, NULL, "5d400000.spi"); |
1073 | 1071 | ||
1074 | clk = clk_register_mux(NULL, "pci_mux_clk", pci_parents, | 1072 | clk = clk_register_mux(NULL, "pci_mclk", pci_parents, |
1075 | ARRAY_SIZE(pci_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1073 | ARRAY_SIZE(pci_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1076 | SPEAR1310_PCI_CLK_SHIFT, SPEAR1310_PCI_CLK_MASK, 0, | 1074 | SPEAR1310_PCI_CLK_SHIFT, SPEAR1310_PCI_CLK_MASK, 0, |
1077 | &_lock); | 1075 | &_lock); |
1078 | clk_register_clkdev(clk, "pci_mux_clk", NULL); | 1076 | clk_register_clkdev(clk, "pci_mclk", NULL); |
1079 | 1077 | ||
1080 | clk = clk_register_gate(NULL, "pci_clk", "pci_mux_clk", 0, | 1078 | clk = clk_register_gate(NULL, "pci_clk", "pci_mclk", 0, |
1081 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_PCI_CLK_ENB, 0, | 1079 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_PCI_CLK_ENB, 0, |
1082 | &_lock); | 1080 | &_lock); |
1083 | clk_register_clkdev(clk, NULL, "pci"); | 1081 | clk_register_clkdev(clk, NULL, "pci"); |
1084 | 1082 | ||
1085 | clk = clk_register_mux(NULL, "tdm1_mux_clk", tdm_parents, | 1083 | clk = clk_register_mux(NULL, "tdm1_mclk", tdm_parents, |
1086 | ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1084 | ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1087 | SPEAR1310_TDM1_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0, | 1085 | SPEAR1310_TDM1_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0, |
1088 | &_lock); | 1086 | &_lock); |
1089 | clk_register_clkdev(clk, "tdm1_mux_clk", NULL); | 1087 | clk_register_clkdev(clk, "tdm1_mclk", NULL); |
1090 | 1088 | ||
1091 | clk = clk_register_gate(NULL, "tdm1_clk", "tdm1_mux_clk", 0, | 1089 | clk = clk_register_gate(NULL, "tdm1_clk", "tdm1_mclk", 0, |
1092 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM1_CLK_ENB, 0, | 1090 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM1_CLK_ENB, 0, |
1093 | &_lock); | 1091 | &_lock); |
1094 | clk_register_clkdev(clk, NULL, "tdm_hdlc.0"); | 1092 | clk_register_clkdev(clk, NULL, "tdm_hdlc.0"); |
1095 | 1093 | ||
1096 | clk = clk_register_mux(NULL, "tdm2_mux_clk", tdm_parents, | 1094 | clk = clk_register_mux(NULL, "tdm2_mclk", tdm_parents, |
1097 | ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1095 | ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
1098 | SPEAR1310_TDM2_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0, | 1096 | SPEAR1310_TDM2_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0, |
1099 | &_lock); | 1097 | &_lock); |
1100 | clk_register_clkdev(clk, "tdm2_mux_clk", NULL); | 1098 | clk_register_clkdev(clk, "tdm2_mclk", NULL); |
1101 | 1099 | ||
1102 | clk = clk_register_gate(NULL, "tdm2_clk", "tdm2_mux_clk", 0, | 1100 | clk = clk_register_gate(NULL, "tdm2_clk", "tdm2_mclk", 0, |
1103 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM2_CLK_ENB, 0, | 1101 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM2_CLK_ENB, 0, |
1104 | &_lock); | 1102 | &_lock); |
1105 | clk_register_clkdev(clk, NULL, "tdm_hdlc.1"); | 1103 | clk_register_clkdev(clk, NULL, "tdm_hdlc.1"); |
diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c index e3ea72162236..2352cee7f645 100644 --- a/drivers/clk/spear/spear1340_clock.c +++ b/drivers/clk/spear/spear1340_clock.c | |||
@@ -369,27 +369,25 @@ static struct frac_rate_tbl gen_rtbl[] = { | |||
369 | 369 | ||
370 | /* clock parents */ | 370 | /* clock parents */ |
371 | static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", }; | 371 | static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", }; |
372 | static const char *sys_parents[] = { "none", "pll1_clk", "none", "none", | 372 | static const char *sys_parents[] = { "pll1_clk", "pll1_clk", "pll1_clk", |
373 | "sys_synth_clk", "none", "pll2_clk", "pll3_clk", }; | 373 | "pll1_clk", "sys_synth_clk", "sys_synth_clk", "pll2_clk", "pll3_clk", }; |
374 | static const char *ahb_parents[] = { "cpu_div3_clk", "amba_synth_clk", }; | 374 | static const char *ahb_parents[] = { "cpu_div3_clk", "amba_syn_clk", }; |
375 | static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", }; | 375 | static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", }; |
376 | static const char *uart0_parents[] = { "pll5_clk", "osc_24m_clk", | 376 | static const char *uart0_parents[] = { "pll5_clk", "osc_24m_clk", |
377 | "uart0_synth_gate_clk", }; | 377 | "uart0_syn_gclk", }; |
378 | static const char *uart1_parents[] = { "pll5_clk", "osc_24m_clk", | 378 | static const char *uart1_parents[] = { "pll5_clk", "osc_24m_clk", |
379 | "uart1_synth_gate_clk", }; | 379 | "uart1_syn_gclk", }; |
380 | static const char *c3_parents[] = { "pll5_clk", "c3_synth_gate_clk", }; | 380 | static const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", }; |
381 | static const char *gmac_phy_input_parents[] = { "gmii_125m_pad_clk", "pll2_clk", | 381 | static const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk", |
382 | "osc_25m_clk", }; | 382 | "osc_25m_clk", }; |
383 | static const char *gmac_phy_parents[] = { "gmac_phy_input_mux_clk", | 383 | static const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", }; |
384 | "gmac_phy_synth_gate_clk", }; | ||
385 | static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", }; | 384 | static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", }; |
386 | static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_synth_clk", }; | 385 | static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", }; |
387 | static const char *i2s_src_parents[] = { "vco1div2_clk", "pll2_clk", "pll3_clk", | 386 | static const char *i2s_src_parents[] = { "vco1div2_clk", "pll2_clk", "pll3_clk", |
388 | "i2s_src_pad_clk", }; | 387 | "i2s_src_pad_clk", }; |
389 | static const char *i2s_ref_parents[] = { "i2s_src_mux_clk", "i2s_prs1_clk", }; | 388 | static const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", }; |
390 | static const char *spdif_out_parents[] = { "i2s_src_pad_clk", "gen_synth2_clk", | 389 | static const char *spdif_out_parents[] = { "i2s_src_pad_clk", "gen_syn2_clk", }; |
391 | }; | 390 | static const char *spdif_in_parents[] = { "pll2_clk", "gen_syn3_clk", }; |
392 | static const char *spdif_in_parents[] = { "pll2_clk", "gen_synth3_clk", }; | ||
393 | 391 | ||
394 | static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", | 392 | static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", |
395 | "pll3_clk", }; | 393 | "pll3_clk", }; |
@@ -415,9 +413,9 @@ void __init spear1340_clk_init(void) | |||
415 | 25000000); | 413 | 25000000); |
416 | clk_register_clkdev(clk, "osc_25m_clk", NULL); | 414 | clk_register_clkdev(clk, "osc_25m_clk", NULL); |
417 | 415 | ||
418 | clk = clk_register_fixed_rate(NULL, "gmii_125m_pad_clk", NULL, | 416 | clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, CLK_IS_ROOT, |
419 | CLK_IS_ROOT, 125000000); | 417 | 125000000); |
420 | clk_register_clkdev(clk, "gmii_125m_pad_clk", NULL); | 418 | clk_register_clkdev(clk, "gmii_pad_clk", NULL); |
421 | 419 | ||
422 | clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, | 420 | clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, |
423 | CLK_IS_ROOT, 12288000); | 421 | CLK_IS_ROOT, 12288000); |
@@ -431,35 +429,35 @@ void __init spear1340_clk_init(void) | |||
431 | 429 | ||
432 | /* clock derived from 24 or 25 MHz osc clk */ | 430 | /* clock derived from 24 or 25 MHz osc clk */ |
433 | /* vco-pll */ | 431 | /* vco-pll */ |
434 | clk = clk_register_mux(NULL, "vco1_mux_clk", vco_parents, | 432 | clk = clk_register_mux(NULL, "vco1_mclk", vco_parents, |
435 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, | 433 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, |
436 | SPEAR1340_PLL1_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, | 434 | SPEAR1340_PLL1_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, |
437 | &_lock); | 435 | &_lock); |
438 | clk_register_clkdev(clk, "vco1_mux_clk", NULL); | 436 | clk_register_clkdev(clk, "vco1_mclk", NULL); |
439 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mux_clk", | 437 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk", 0, |
440 | 0, SPEAR1340_PLL1_CTR, SPEAR1340_PLL1_FRQ, pll_rtbl, | 438 | SPEAR1340_PLL1_CTR, SPEAR1340_PLL1_FRQ, pll_rtbl, |
441 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 439 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
442 | clk_register_clkdev(clk, "vco1_clk", NULL); | 440 | clk_register_clkdev(clk, "vco1_clk", NULL); |
443 | clk_register_clkdev(clk1, "pll1_clk", NULL); | 441 | clk_register_clkdev(clk1, "pll1_clk", NULL); |
444 | 442 | ||
445 | clk = clk_register_mux(NULL, "vco2_mux_clk", vco_parents, | 443 | clk = clk_register_mux(NULL, "vco2_mclk", vco_parents, |
446 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, | 444 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, |
447 | SPEAR1340_PLL2_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, | 445 | SPEAR1340_PLL2_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, |
448 | &_lock); | 446 | &_lock); |
449 | clk_register_clkdev(clk, "vco2_mux_clk", NULL); | 447 | clk_register_clkdev(clk, "vco2_mclk", NULL); |
450 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mux_clk", | 448 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk", 0, |
451 | 0, SPEAR1340_PLL2_CTR, SPEAR1340_PLL2_FRQ, pll_rtbl, | 449 | SPEAR1340_PLL2_CTR, SPEAR1340_PLL2_FRQ, pll_rtbl, |
452 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 450 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
453 | clk_register_clkdev(clk, "vco2_clk", NULL); | 451 | clk_register_clkdev(clk, "vco2_clk", NULL); |
454 | clk_register_clkdev(clk1, "pll2_clk", NULL); | 452 | clk_register_clkdev(clk1, "pll2_clk", NULL); |
455 | 453 | ||
456 | clk = clk_register_mux(NULL, "vco3_mux_clk", vco_parents, | 454 | clk = clk_register_mux(NULL, "vco3_mclk", vco_parents, |
457 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, | 455 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, |
458 | SPEAR1340_PLL3_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, | 456 | SPEAR1340_PLL3_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, |
459 | &_lock); | 457 | &_lock); |
460 | clk_register_clkdev(clk, "vco3_mux_clk", NULL); | 458 | clk_register_clkdev(clk, "vco3_mclk", NULL); |
461 | clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mux_clk", | 459 | clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk", 0, |
462 | 0, SPEAR1340_PLL3_CTR, SPEAR1340_PLL3_FRQ, pll_rtbl, | 460 | SPEAR1340_PLL3_CTR, SPEAR1340_PLL3_FRQ, pll_rtbl, |
463 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 461 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
464 | clk_register_clkdev(clk, "vco3_clk", NULL); | 462 | clk_register_clkdev(clk, "vco3_clk", NULL); |
465 | clk_register_clkdev(clk1, "pll3_clk", NULL); | 463 | clk_register_clkdev(clk1, "pll3_clk", NULL); |
@@ -498,7 +496,7 @@ void __init spear1340_clk_init(void) | |||
498 | /* peripherals */ | 496 | /* peripherals */ |
499 | clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1, | 497 | clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1, |
500 | 128); | 498 | 128); |
501 | clk = clk_register_gate(NULL, "thermal_gate_clk", "thermal_clk", 0, | 499 | clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0, |
502 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_THSENS_CLK_ENB, 0, | 500 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_THSENS_CLK_ENB, 0, |
503 | &_lock); | 501 | &_lock); |
504 | clk_register_clkdev(clk, NULL, "spear_thermal"); | 502 | clk_register_clkdev(clk, NULL, "spear_thermal"); |
@@ -509,23 +507,23 @@ void __init spear1340_clk_init(void) | |||
509 | clk_register_clkdev(clk, "ddr_clk", NULL); | 507 | clk_register_clkdev(clk, "ddr_clk", NULL); |
510 | 508 | ||
511 | /* clock derived from pll1 clk */ | 509 | /* clock derived from pll1 clk */ |
512 | clk = clk_register_frac("sys_synth_clk", "vco1div2_clk", 0, | 510 | clk = clk_register_frac("sys_syn_clk", "vco1div2_clk", 0, |
513 | SPEAR1340_SYS_CLK_SYNT, sys_synth_rtbl, | 511 | SPEAR1340_SYS_CLK_SYNT, sys_synth_rtbl, |
514 | ARRAY_SIZE(sys_synth_rtbl), &_lock); | 512 | ARRAY_SIZE(sys_synth_rtbl), &_lock); |
515 | clk_register_clkdev(clk, "sys_synth_clk", NULL); | 513 | clk_register_clkdev(clk, "sys_syn_clk", NULL); |
516 | 514 | ||
517 | clk = clk_register_frac("amba_synth_clk", "vco1div2_clk", 0, | 515 | clk = clk_register_frac("amba_syn_clk", "vco1div2_clk", 0, |
518 | SPEAR1340_AMBA_CLK_SYNT, amba_synth_rtbl, | 516 | SPEAR1340_AMBA_CLK_SYNT, amba_synth_rtbl, |
519 | ARRAY_SIZE(amba_synth_rtbl), &_lock); | 517 | ARRAY_SIZE(amba_synth_rtbl), &_lock); |
520 | clk_register_clkdev(clk, "amba_synth_clk", NULL); | 518 | clk_register_clkdev(clk, "amba_syn_clk", NULL); |
521 | 519 | ||
522 | clk = clk_register_mux(NULL, "sys_mux_clk", sys_parents, | 520 | clk = clk_register_mux(NULL, "sys_mclk", sys_parents, |
523 | ARRAY_SIZE(sys_parents), 0, SPEAR1340_SYS_CLK_CTRL, | 521 | ARRAY_SIZE(sys_parents), 0, SPEAR1340_SYS_CLK_CTRL, |
524 | SPEAR1340_SCLK_SRC_SEL_SHIFT, | 522 | SPEAR1340_SCLK_SRC_SEL_SHIFT, |
525 | SPEAR1340_SCLK_SRC_SEL_MASK, 0, &_lock); | 523 | SPEAR1340_SCLK_SRC_SEL_MASK, 0, &_lock); |
526 | clk_register_clkdev(clk, "sys_clk", NULL); | 524 | clk_register_clkdev(clk, "sys_clk", NULL); |
527 | 525 | ||
528 | clk = clk_register_fixed_factor(NULL, "cpu_clk", "sys_mux_clk", 0, 1, | 526 | clk = clk_register_fixed_factor(NULL, "cpu_clk", "sys_mclk", 0, 1, |
529 | 2); | 527 | 2); |
530 | clk_register_clkdev(clk, "cpu_clk", NULL); | 528 | clk_register_clkdev(clk, "cpu_clk", NULL); |
531 | 529 | ||
@@ -548,194 +546,193 @@ void __init spear1340_clk_init(void) | |||
548 | clk_register_clkdev(clk, "apb_clk", NULL); | 546 | clk_register_clkdev(clk, "apb_clk", NULL); |
549 | 547 | ||
550 | /* gpt clocks */ | 548 | /* gpt clocks */ |
551 | clk = clk_register_mux(NULL, "gpt0_mux_clk", gpt_parents, | 549 | clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents, |
552 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 550 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
553 | SPEAR1340_GPT0_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, | 551 | SPEAR1340_GPT0_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, |
554 | &_lock); | 552 | &_lock); |
555 | clk_register_clkdev(clk, "gpt0_mux_clk", NULL); | 553 | clk_register_clkdev(clk, "gpt0_mclk", NULL); |
556 | clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mux_clk", 0, | 554 | clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0, |
557 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT0_CLK_ENB, 0, | 555 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT0_CLK_ENB, 0, |
558 | &_lock); | 556 | &_lock); |
559 | clk_register_clkdev(clk, NULL, "gpt0"); | 557 | clk_register_clkdev(clk, NULL, "gpt0"); |
560 | 558 | ||
561 | clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt_parents, | 559 | clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents, |
562 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 560 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
563 | SPEAR1340_GPT1_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, | 561 | SPEAR1340_GPT1_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, |
564 | &_lock); | 562 | &_lock); |
565 | clk_register_clkdev(clk, "gpt1_mux_clk", NULL); | 563 | clk_register_clkdev(clk, "gpt1_mclk", NULL); |
566 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0, | 564 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0, |
567 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT1_CLK_ENB, 0, | 565 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT1_CLK_ENB, 0, |
568 | &_lock); | 566 | &_lock); |
569 | clk_register_clkdev(clk, NULL, "gpt1"); | 567 | clk_register_clkdev(clk, NULL, "gpt1"); |
570 | 568 | ||
571 | clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt_parents, | 569 | clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents, |
572 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 570 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
573 | SPEAR1340_GPT2_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, | 571 | SPEAR1340_GPT2_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, |
574 | &_lock); | 572 | &_lock); |
575 | clk_register_clkdev(clk, "gpt2_mux_clk", NULL); | 573 | clk_register_clkdev(clk, "gpt2_mclk", NULL); |
576 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0, | 574 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0, |
577 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT2_CLK_ENB, 0, | 575 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT2_CLK_ENB, 0, |
578 | &_lock); | 576 | &_lock); |
579 | clk_register_clkdev(clk, NULL, "gpt2"); | 577 | clk_register_clkdev(clk, NULL, "gpt2"); |
580 | 578 | ||
581 | clk = clk_register_mux(NULL, "gpt3_mux_clk", gpt_parents, | 579 | clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents, |
582 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 580 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
583 | SPEAR1340_GPT3_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, | 581 | SPEAR1340_GPT3_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, |
584 | &_lock); | 582 | &_lock); |
585 | clk_register_clkdev(clk, "gpt3_mux_clk", NULL); | 583 | clk_register_clkdev(clk, "gpt3_mclk", NULL); |
586 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mux_clk", 0, | 584 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0, |
587 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT3_CLK_ENB, 0, | 585 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT3_CLK_ENB, 0, |
588 | &_lock); | 586 | &_lock); |
589 | clk_register_clkdev(clk, NULL, "gpt3"); | 587 | clk_register_clkdev(clk, NULL, "gpt3"); |
590 | 588 | ||
591 | /* others */ | 589 | /* others */ |
592 | clk = clk_register_aux("uart0_synth_clk", "uart0_synth_gate_clk", | 590 | clk = clk_register_aux("uart0_syn_clk", "uart0_syn_gclk", |
593 | "vco1div2_clk", 0, SPEAR1340_UART0_CLK_SYNT, NULL, | 591 | "vco1div2_clk", 0, SPEAR1340_UART0_CLK_SYNT, NULL, |
594 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 592 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
595 | clk_register_clkdev(clk, "uart0_synth_clk", NULL); | 593 | clk_register_clkdev(clk, "uart0_syn_clk", NULL); |
596 | clk_register_clkdev(clk1, "uart0_synth_gate_clk", NULL); | 594 | clk_register_clkdev(clk1, "uart0_syn_gclk", NULL); |
597 | 595 | ||
598 | clk = clk_register_mux(NULL, "uart0_mux_clk", uart0_parents, | 596 | clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents, |
599 | ARRAY_SIZE(uart0_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 597 | ARRAY_SIZE(uart0_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
600 | SPEAR1340_UART0_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0, | 598 | SPEAR1340_UART0_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0, |
601 | &_lock); | 599 | &_lock); |
602 | clk_register_clkdev(clk, "uart0_mux_clk", NULL); | 600 | clk_register_clkdev(clk, "uart0_mclk", NULL); |
603 | 601 | ||
604 | clk = clk_register_gate(NULL, "uart0_clk", "uart0_mux_clk", 0, | 602 | clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk", 0, |
605 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UART0_CLK_ENB, 0, | 603 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UART0_CLK_ENB, 0, |
606 | &_lock); | 604 | &_lock); |
607 | clk_register_clkdev(clk, NULL, "e0000000.serial"); | 605 | clk_register_clkdev(clk, NULL, "e0000000.serial"); |
608 | 606 | ||
609 | clk = clk_register_aux("uart1_synth_clk", "uart1_synth_gate_clk", | 607 | clk = clk_register_aux("uart1_syn_clk", "uart1_syn_gclk", |
610 | "vco1div2_clk", 0, SPEAR1340_UART1_CLK_SYNT, NULL, | 608 | "vco1div2_clk", 0, SPEAR1340_UART1_CLK_SYNT, NULL, |
611 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 609 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
612 | clk_register_clkdev(clk, "uart1_synth_clk", NULL); | 610 | clk_register_clkdev(clk, "uart1_syn_clk", NULL); |
613 | clk_register_clkdev(clk1, "uart1_synth_gate_clk", NULL); | 611 | clk_register_clkdev(clk1, "uart1_syn_gclk", NULL); |
614 | 612 | ||
615 | clk = clk_register_mux(NULL, "uart1_mux_clk", uart1_parents, | 613 | clk = clk_register_mux(NULL, "uart1_mclk", uart1_parents, |
616 | ARRAY_SIZE(uart1_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 614 | ARRAY_SIZE(uart1_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
617 | SPEAR1340_UART1_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0, | 615 | SPEAR1340_UART1_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0, |
618 | &_lock); | 616 | &_lock); |
619 | clk_register_clkdev(clk, "uart1_mux_clk", NULL); | 617 | clk_register_clkdev(clk, "uart1_mclk", NULL); |
620 | 618 | ||
621 | clk = clk_register_gate(NULL, "uart1_clk", "uart1_mux_clk", 0, | 619 | clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0, |
622 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UART1_CLK_ENB, 0, | 620 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_UART1_CLK_ENB, 0, |
623 | &_lock); | 621 | &_lock); |
624 | clk_register_clkdev(clk, NULL, "b4100000.serial"); | 622 | clk_register_clkdev(clk, NULL, "b4100000.serial"); |
625 | 623 | ||
626 | clk = clk_register_aux("sdhci_synth_clk", "sdhci_synth_gate_clk", | 624 | clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk", |
627 | "vco1div2_clk", 0, SPEAR1340_SDHCI_CLK_SYNT, NULL, | 625 | "vco1div2_clk", 0, SPEAR1340_SDHCI_CLK_SYNT, NULL, |
628 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 626 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
629 | clk_register_clkdev(clk, "sdhci_synth_clk", NULL); | 627 | clk_register_clkdev(clk, "sdhci_syn_clk", NULL); |
630 | clk_register_clkdev(clk1, "sdhci_synth_gate_clk", NULL); | 628 | clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL); |
631 | 629 | ||
632 | clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_synth_gate_clk", 0, | 630 | clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk", 0, |
633 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SDHCI_CLK_ENB, 0, | 631 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SDHCI_CLK_ENB, 0, |
634 | &_lock); | 632 | &_lock); |
635 | clk_register_clkdev(clk, NULL, "b3000000.sdhci"); | 633 | clk_register_clkdev(clk, NULL, "b3000000.sdhci"); |
636 | 634 | ||
637 | clk = clk_register_aux("cfxd_synth_clk", "cfxd_synth_gate_clk", | 635 | clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk", |
638 | "vco1div2_clk", 0, SPEAR1340_CFXD_CLK_SYNT, NULL, | 636 | 0, SPEAR1340_CFXD_CLK_SYNT, NULL, aux_rtbl, |
639 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 637 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
640 | clk_register_clkdev(clk, "cfxd_synth_clk", NULL); | 638 | clk_register_clkdev(clk, "cfxd_syn_clk", NULL); |
641 | clk_register_clkdev(clk1, "cfxd_synth_gate_clk", NULL); | 639 | clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL); |
642 | 640 | ||
643 | clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_synth_gate_clk", 0, | 641 | clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk", 0, |
644 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CFXD_CLK_ENB, 0, | 642 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CFXD_CLK_ENB, 0, |
645 | &_lock); | 643 | &_lock); |
646 | clk_register_clkdev(clk, NULL, "b2800000.cf"); | 644 | clk_register_clkdev(clk, NULL, "b2800000.cf"); |
647 | clk_register_clkdev(clk, NULL, "arasan_xd"); | 645 | clk_register_clkdev(clk, NULL, "arasan_xd"); |
648 | 646 | ||
649 | clk = clk_register_aux("c3_synth_clk", "c3_synth_gate_clk", | 647 | clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk", 0, |
650 | "vco1div2_clk", 0, SPEAR1340_C3_CLK_SYNT, NULL, | 648 | SPEAR1340_C3_CLK_SYNT, NULL, aux_rtbl, |
651 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 649 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
652 | clk_register_clkdev(clk, "c3_synth_clk", NULL); | 650 | clk_register_clkdev(clk, "c3_syn_clk", NULL); |
653 | clk_register_clkdev(clk1, "c3_synth_gate_clk", NULL); | 651 | clk_register_clkdev(clk1, "c3_syn_gclk", NULL); |
654 | 652 | ||
655 | clk = clk_register_mux(NULL, "c3_mux_clk", c3_parents, | 653 | clk = clk_register_mux(NULL, "c3_mclk", c3_parents, |
656 | ARRAY_SIZE(c3_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 654 | ARRAY_SIZE(c3_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
657 | SPEAR1340_C3_CLK_SHIFT, SPEAR1340_C3_CLK_MASK, 0, | 655 | SPEAR1340_C3_CLK_SHIFT, SPEAR1340_C3_CLK_MASK, 0, |
658 | &_lock); | 656 | &_lock); |
659 | clk_register_clkdev(clk, "c3_mux_clk", NULL); | 657 | clk_register_clkdev(clk, "c3_mclk", NULL); |
660 | 658 | ||
661 | clk = clk_register_gate(NULL, "c3_clk", "c3_mux_clk", 0, | 659 | clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", 0, |
662 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_C3_CLK_ENB, 0, | 660 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_C3_CLK_ENB, 0, |
663 | &_lock); | 661 | &_lock); |
664 | clk_register_clkdev(clk, NULL, "c3"); | 662 | clk_register_clkdev(clk, NULL, "c3"); |
665 | 663 | ||
666 | /* gmac */ | 664 | /* gmac */ |
667 | clk = clk_register_mux(NULL, "gmac_phy_input_mux_clk", | 665 | clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents, |
668 | gmac_phy_input_parents, | ||
669 | ARRAY_SIZE(gmac_phy_input_parents), 0, | 666 | ARRAY_SIZE(gmac_phy_input_parents), 0, |
670 | SPEAR1340_GMAC_CLK_CFG, | 667 | SPEAR1340_GMAC_CLK_CFG, |
671 | SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT, | 668 | SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT, |
672 | SPEAR1340_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock); | 669 | SPEAR1340_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock); |
673 | clk_register_clkdev(clk, "gmac_phy_input_mux_clk", NULL); | 670 | clk_register_clkdev(clk, "phy_input_mclk", NULL); |
674 | 671 | ||
675 | clk = clk_register_aux("gmac_phy_synth_clk", "gmac_phy_synth_gate_clk", | 672 | clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk", |
676 | "gmac_phy_input_mux_clk", 0, SPEAR1340_GMAC_CLK_SYNT, | 673 | 0, SPEAR1340_GMAC_CLK_SYNT, NULL, gmac_rtbl, |
677 | NULL, gmac_rtbl, ARRAY_SIZE(gmac_rtbl), &_lock, &clk1); | 674 | ARRAY_SIZE(gmac_rtbl), &_lock, &clk1); |
678 | clk_register_clkdev(clk, "gmac_phy_synth_clk", NULL); | 675 | clk_register_clkdev(clk, "phy_syn_clk", NULL); |
679 | clk_register_clkdev(clk1, "gmac_phy_synth_gate_clk", NULL); | 676 | clk_register_clkdev(clk1, "phy_syn_gclk", NULL); |
680 | 677 | ||
681 | clk = clk_register_mux(NULL, "gmac_phy_mux_clk", gmac_phy_parents, | 678 | clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents, |
682 | ARRAY_SIZE(gmac_phy_parents), 0, | 679 | ARRAY_SIZE(gmac_phy_parents), 0, |
683 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GMAC_PHY_CLK_SHIFT, | 680 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GMAC_PHY_CLK_SHIFT, |
684 | SPEAR1340_GMAC_PHY_CLK_MASK, 0, &_lock); | 681 | SPEAR1340_GMAC_PHY_CLK_MASK, 0, &_lock); |
685 | clk_register_clkdev(clk, NULL, "stmmacphy.0"); | 682 | clk_register_clkdev(clk, NULL, "stmmacphy.0"); |
686 | 683 | ||
687 | /* clcd */ | 684 | /* clcd */ |
688 | clk = clk_register_mux(NULL, "clcd_synth_mux_clk", clcd_synth_parents, | 685 | clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents, |
689 | ARRAY_SIZE(clcd_synth_parents), 0, | 686 | ARRAY_SIZE(clcd_synth_parents), 0, |
690 | SPEAR1340_CLCD_CLK_SYNT, SPEAR1340_CLCD_SYNT_CLK_SHIFT, | 687 | SPEAR1340_CLCD_CLK_SYNT, SPEAR1340_CLCD_SYNT_CLK_SHIFT, |
691 | SPEAR1340_CLCD_SYNT_CLK_MASK, 0, &_lock); | 688 | SPEAR1340_CLCD_SYNT_CLK_MASK, 0, &_lock); |
692 | clk_register_clkdev(clk, "clcd_synth_mux_clk", NULL); | 689 | clk_register_clkdev(clk, "clcd_syn_mclk", NULL); |
693 | 690 | ||
694 | clk = clk_register_frac("clcd_synth_clk", "clcd_synth_mux_clk", 0, | 691 | clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0, |
695 | SPEAR1340_CLCD_CLK_SYNT, clcd_rtbl, | 692 | SPEAR1340_CLCD_CLK_SYNT, clcd_rtbl, |
696 | ARRAY_SIZE(clcd_rtbl), &_lock); | 693 | ARRAY_SIZE(clcd_rtbl), &_lock); |
697 | clk_register_clkdev(clk, "clcd_synth_clk", NULL); | 694 | clk_register_clkdev(clk, "clcd_syn_clk", NULL); |
698 | 695 | ||
699 | clk = clk_register_mux(NULL, "clcd_pixel_mux_clk", clcd_pixel_parents, | 696 | clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents, |
700 | ARRAY_SIZE(clcd_pixel_parents), 0, | 697 | ARRAY_SIZE(clcd_pixel_parents), 0, |
701 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_CLCD_CLK_SHIFT, | 698 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_CLCD_CLK_SHIFT, |
702 | SPEAR1340_CLCD_CLK_MASK, 0, &_lock); | 699 | SPEAR1340_CLCD_CLK_MASK, 0, &_lock); |
703 | clk_register_clkdev(clk, "clcd_pixel_clk", NULL); | 700 | clk_register_clkdev(clk, "clcd_pixel_clk", NULL); |
704 | 701 | ||
705 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mux_clk", 0, | 702 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0, |
706 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CLCD_CLK_ENB, 0, | 703 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CLCD_CLK_ENB, 0, |
707 | &_lock); | 704 | &_lock); |
708 | clk_register_clkdev(clk, "clcd_clk", NULL); | 705 | clk_register_clkdev(clk, "clcd_clk", NULL); |
709 | 706 | ||
710 | /* i2s */ | 707 | /* i2s */ |
711 | clk = clk_register_mux(NULL, "i2s_src_mux_clk", i2s_src_parents, | 708 | clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents, |
712 | ARRAY_SIZE(i2s_src_parents), 0, SPEAR1340_I2S_CLK_CFG, | 709 | ARRAY_SIZE(i2s_src_parents), 0, SPEAR1340_I2S_CLK_CFG, |
713 | SPEAR1340_I2S_SRC_CLK_SHIFT, SPEAR1340_I2S_SRC_CLK_MASK, | 710 | SPEAR1340_I2S_SRC_CLK_SHIFT, SPEAR1340_I2S_SRC_CLK_MASK, |
714 | 0, &_lock); | 711 | 0, &_lock); |
715 | clk_register_clkdev(clk, "i2s_src_clk", NULL); | 712 | clk_register_clkdev(clk, "i2s_src_clk", NULL); |
716 | 713 | ||
717 | clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mux_clk", 0, | 714 | clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk", 0, |
718 | SPEAR1340_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl, | 715 | SPEAR1340_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl, |
719 | ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL); | 716 | ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL); |
720 | clk_register_clkdev(clk, "i2s_prs1_clk", NULL); | 717 | clk_register_clkdev(clk, "i2s_prs1_clk", NULL); |
721 | 718 | ||
722 | clk = clk_register_mux(NULL, "i2s_ref_mux_clk", i2s_ref_parents, | 719 | clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents, |
723 | ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1340_I2S_CLK_CFG, | 720 | ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1340_I2S_CLK_CFG, |
724 | SPEAR1340_I2S_REF_SHIFT, SPEAR1340_I2S_REF_SEL_MASK, 0, | 721 | SPEAR1340_I2S_REF_SHIFT, SPEAR1340_I2S_REF_SEL_MASK, 0, |
725 | &_lock); | 722 | &_lock); |
726 | clk_register_clkdev(clk, "i2s_ref_clk", NULL); | 723 | clk_register_clkdev(clk, "i2s_ref_clk", NULL); |
727 | 724 | ||
728 | clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mux_clk", 0, | 725 | clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0, |
729 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_I2S_REF_PAD_CLK_ENB, | 726 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_I2S_REF_PAD_CLK_ENB, |
730 | 0, &_lock); | 727 | 0, &_lock); |
731 | clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL); | 728 | clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL); |
732 | 729 | ||
733 | clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gate_clk", | 730 | clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk", "i2s_ref_mclk", |
734 | "i2s_ref_mux_clk", 0, SPEAR1340_I2S_CLK_CFG, | 731 | 0, SPEAR1340_I2S_CLK_CFG, &i2s_sclk_masks, |
735 | &i2s_sclk_masks, i2s_sclk_rtbl, | 732 | i2s_sclk_rtbl, ARRAY_SIZE(i2s_sclk_rtbl), &_lock, |
736 | ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1); | 733 | &clk1); |
737 | clk_register_clkdev(clk, "i2s_sclk_clk", NULL); | 734 | clk_register_clkdev(clk, "i2s_sclk_clk", NULL); |
738 | clk_register_clkdev(clk1, "i2s_sclk_gate_clk", NULL); | 735 | clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL); |
739 | 736 | ||
740 | /* clock derived from ahb clk */ | 737 | /* clock derived from ahb clk */ |
741 | clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0, | 738 | clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0, |
@@ -744,7 +741,7 @@ void __init spear1340_clk_init(void) | |||
744 | clk_register_clkdev(clk, NULL, "e0280000.i2c"); | 741 | clk_register_clkdev(clk, NULL, "e0280000.i2c"); |
745 | 742 | ||
746 | clk = clk_register_gate(NULL, "i2c1_clk", "ahb_clk", 0, | 743 | clk = clk_register_gate(NULL, "i2c1_clk", "ahb_clk", 0, |
747 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2C1_CLK_ENB, 0, | 744 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_I2C1_CLK_ENB, 0, |
748 | &_lock); | 745 | &_lock); |
749 | clk_register_clkdev(clk, NULL, "b4000000.i2c"); | 746 | clk_register_clkdev(clk, NULL, "b4000000.i2c"); |
750 | 747 | ||
@@ -800,13 +797,13 @@ void __init spear1340_clk_init(void) | |||
800 | &_lock); | 797 | &_lock); |
801 | clk_register_clkdev(clk, "sysram1_clk", NULL); | 798 | clk_register_clkdev(clk, "sysram1_clk", NULL); |
802 | 799 | ||
803 | clk = clk_register_aux("adc_synth_clk", "adc_synth_gate_clk", "ahb_clk", | 800 | clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk", |
804 | 0, SPEAR1340_ADC_CLK_SYNT, NULL, adc_rtbl, | 801 | 0, SPEAR1340_ADC_CLK_SYNT, NULL, adc_rtbl, |
805 | ARRAY_SIZE(adc_rtbl), &_lock, &clk1); | 802 | ARRAY_SIZE(adc_rtbl), &_lock, &clk1); |
806 | clk_register_clkdev(clk, "adc_synth_clk", NULL); | 803 | clk_register_clkdev(clk, "adc_syn_clk", NULL); |
807 | clk_register_clkdev(clk1, "adc_synth_gate_clk", NULL); | 804 | clk_register_clkdev(clk1, "adc_syn_gclk", NULL); |
808 | 805 | ||
809 | clk = clk_register_gate(NULL, "adc_clk", "adc_synth_gate_clk", 0, | 806 | clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk", 0, |
810 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_ADC_CLK_ENB, 0, | 807 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_ADC_CLK_ENB, 0, |
811 | &_lock); | 808 | &_lock); |
812 | clk_register_clkdev(clk, NULL, "adc_clk"); | 809 | clk_register_clkdev(clk, NULL, "adc_clk"); |
@@ -843,39 +840,39 @@ void __init spear1340_clk_init(void) | |||
843 | clk_register_clkdev(clk, NULL, "e0300000.kbd"); | 840 | clk_register_clkdev(clk, NULL, "e0300000.kbd"); |
844 | 841 | ||
845 | /* RAS clks */ | 842 | /* RAS clks */ |
846 | clk = clk_register_mux(NULL, "gen_synth0_1_mux_clk", | 843 | clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents, |
847 | gen_synth0_1_parents, ARRAY_SIZE(gen_synth0_1_parents), | 844 | ARRAY_SIZE(gen_synth0_1_parents), 0, SPEAR1340_PLL_CFG, |
848 | 0, SPEAR1340_PLL_CFG, SPEAR1340_GEN_SYNT0_1_CLK_SHIFT, | 845 | SPEAR1340_GEN_SYNT0_1_CLK_SHIFT, |
849 | SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock); | 846 | SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock); |
850 | clk_register_clkdev(clk, "gen_synth0_1_clk", NULL); | 847 | clk_register_clkdev(clk, "gen_syn0_1_clk", NULL); |
851 | 848 | ||
852 | clk = clk_register_mux(NULL, "gen_synth2_3_mux_clk", | 849 | clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents, |
853 | gen_synth2_3_parents, ARRAY_SIZE(gen_synth2_3_parents), | 850 | ARRAY_SIZE(gen_synth2_3_parents), 0, SPEAR1340_PLL_CFG, |
854 | 0, SPEAR1340_PLL_CFG, SPEAR1340_GEN_SYNT2_3_CLK_SHIFT, | 851 | SPEAR1340_GEN_SYNT2_3_CLK_SHIFT, |
855 | SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock); | 852 | SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock); |
856 | clk_register_clkdev(clk, "gen_synth2_3_clk", NULL); | 853 | clk_register_clkdev(clk, "gen_syn2_3_clk", NULL); |
857 | 854 | ||
858 | clk = clk_register_frac("gen_synth0_clk", "gen_synth0_1_clk", 0, | 855 | clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_clk", 0, |
859 | SPEAR1340_GEN_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 856 | SPEAR1340_GEN_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
860 | &_lock); | 857 | &_lock); |
861 | clk_register_clkdev(clk, "gen_synth0_clk", NULL); | 858 | clk_register_clkdev(clk, "gen_syn0_clk", NULL); |
862 | 859 | ||
863 | clk = clk_register_frac("gen_synth1_clk", "gen_synth0_1_clk", 0, | 860 | clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_clk", 0, |
864 | SPEAR1340_GEN_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 861 | SPEAR1340_GEN_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
865 | &_lock); | 862 | &_lock); |
866 | clk_register_clkdev(clk, "gen_synth1_clk", NULL); | 863 | clk_register_clkdev(clk, "gen_syn1_clk", NULL); |
867 | 864 | ||
868 | clk = clk_register_frac("gen_synth2_clk", "gen_synth2_3_clk", 0, | 865 | clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_clk", 0, |
869 | SPEAR1340_GEN_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 866 | SPEAR1340_GEN_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
870 | &_lock); | 867 | &_lock); |
871 | clk_register_clkdev(clk, "gen_synth2_clk", NULL); | 868 | clk_register_clkdev(clk, "gen_syn2_clk", NULL); |
872 | 869 | ||
873 | clk = clk_register_frac("gen_synth3_clk", "gen_synth2_3_clk", 0, | 870 | clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_clk", 0, |
874 | SPEAR1340_GEN_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 871 | SPEAR1340_GEN_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
875 | &_lock); | 872 | &_lock); |
876 | clk_register_clkdev(clk, "gen_synth3_clk", NULL); | 873 | clk_register_clkdev(clk, "gen_syn3_clk", NULL); |
877 | 874 | ||
878 | clk = clk_register_gate(NULL, "mali_clk", "gen_synth3_clk", 0, | 875 | clk = clk_register_gate(NULL, "mali_clk", "gen_syn3_clk", 0, |
879 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_MALI_CLK_ENB, 0, | 876 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_MALI_CLK_ENB, 0, |
880 | &_lock); | 877 | &_lock); |
881 | clk_register_clkdev(clk, NULL, "mali"); | 878 | clk_register_clkdev(clk, NULL, "mali"); |
@@ -890,74 +887,74 @@ void __init spear1340_clk_init(void) | |||
890 | &_lock); | 887 | &_lock); |
891 | clk_register_clkdev(clk, NULL, "spear_cec.1"); | 888 | clk_register_clkdev(clk, NULL, "spear_cec.1"); |
892 | 889 | ||
893 | clk = clk_register_mux(NULL, "spdif_out_mux_clk", spdif_out_parents, | 890 | clk = clk_register_mux(NULL, "spdif_out_mclk", spdif_out_parents, |
894 | ARRAY_SIZE(spdif_out_parents), 0, | 891 | ARRAY_SIZE(spdif_out_parents), 0, |
895 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_OUT_CLK_SHIFT, | 892 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_OUT_CLK_SHIFT, |
896 | SPEAR1340_SPDIF_CLK_MASK, 0, &_lock); | 893 | SPEAR1340_SPDIF_CLK_MASK, 0, &_lock); |
897 | clk_register_clkdev(clk, "spdif_out_mux_clk", NULL); | 894 | clk_register_clkdev(clk, "spdif_out_mclk", NULL); |
898 | 895 | ||
899 | clk = clk_register_gate(NULL, "spdif_out_clk", "spdif_out_mux_clk", 0, | 896 | clk = clk_register_gate(NULL, "spdif_out_clk", "spdif_out_mclk", 0, |
900 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_SPDIF_OUT_CLK_ENB, | 897 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_SPDIF_OUT_CLK_ENB, |
901 | 0, &_lock); | 898 | 0, &_lock); |
902 | clk_register_clkdev(clk, NULL, "spdif-out"); | 899 | clk_register_clkdev(clk, NULL, "spdif-out"); |
903 | 900 | ||
904 | clk = clk_register_mux(NULL, "spdif_in_mux_clk", spdif_in_parents, | 901 | clk = clk_register_mux(NULL, "spdif_in_mclk", spdif_in_parents, |
905 | ARRAY_SIZE(spdif_in_parents), 0, | 902 | ARRAY_SIZE(spdif_in_parents), 0, |
906 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_IN_CLK_SHIFT, | 903 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_IN_CLK_SHIFT, |
907 | SPEAR1340_SPDIF_CLK_MASK, 0, &_lock); | 904 | SPEAR1340_SPDIF_CLK_MASK, 0, &_lock); |
908 | clk_register_clkdev(clk, "spdif_in_mux_clk", NULL); | 905 | clk_register_clkdev(clk, "spdif_in_mclk", NULL); |
909 | 906 | ||
910 | clk = clk_register_gate(NULL, "spdif_in_clk", "spdif_in_mux_clk", 0, | 907 | clk = clk_register_gate(NULL, "spdif_in_clk", "spdif_in_mclk", 0, |
911 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_SPDIF_IN_CLK_ENB, 0, | 908 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_SPDIF_IN_CLK_ENB, 0, |
912 | &_lock); | 909 | &_lock); |
913 | clk_register_clkdev(clk, NULL, "spdif-in"); | 910 | clk_register_clkdev(clk, NULL, "spdif-in"); |
914 | 911 | ||
915 | clk = clk_register_gate(NULL, "acp_clk", "acp_mux_clk", 0, | 912 | clk = clk_register_gate(NULL, "acp_clk", "acp_mclk", 0, |
916 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0, | 913 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0, |
917 | &_lock); | 914 | &_lock); |
918 | clk_register_clkdev(clk, NULL, "acp_clk"); | 915 | clk_register_clkdev(clk, NULL, "acp_clk"); |
919 | 916 | ||
920 | clk = clk_register_gate(NULL, "plgpio_clk", "plgpio_mux_clk", 0, | 917 | clk = clk_register_gate(NULL, "plgpio_clk", "plgpio_mclk", 0, |
921 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0, | 918 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0, |
922 | &_lock); | 919 | &_lock); |
923 | clk_register_clkdev(clk, NULL, "plgpio"); | 920 | clk_register_clkdev(clk, NULL, "plgpio"); |
924 | 921 | ||
925 | clk = clk_register_gate(NULL, "video_dec_clk", "video_dec_mux_clk", 0, | 922 | clk = clk_register_gate(NULL, "video_dec_clk", "video_dec_mclk", 0, |
926 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB, | 923 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB, |
927 | 0, &_lock); | 924 | 0, &_lock); |
928 | clk_register_clkdev(clk, NULL, "video_dec"); | 925 | clk_register_clkdev(clk, NULL, "video_dec"); |
929 | 926 | ||
930 | clk = clk_register_gate(NULL, "video_enc_clk", "video_enc_mux_clk", 0, | 927 | clk = clk_register_gate(NULL, "video_enc_clk", "video_enc_mclk", 0, |
931 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB, | 928 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB, |
932 | 0, &_lock); | 929 | 0, &_lock); |
933 | clk_register_clkdev(clk, NULL, "video_enc"); | 930 | clk_register_clkdev(clk, NULL, "video_enc"); |
934 | 931 | ||
935 | clk = clk_register_gate(NULL, "video_in_clk", "video_in_mux_clk", 0, | 932 | clk = clk_register_gate(NULL, "video_in_clk", "video_in_mclk", 0, |
936 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0, | 933 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0, |
937 | &_lock); | 934 | &_lock); |
938 | clk_register_clkdev(clk, NULL, "spear_vip"); | 935 | clk_register_clkdev(clk, NULL, "spear_vip"); |
939 | 936 | ||
940 | clk = clk_register_gate(NULL, "cam0_clk", "cam0_mux_clk", 0, | 937 | clk = clk_register_gate(NULL, "cam0_clk", "cam0_mclk", 0, |
941 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0, | 938 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0, |
942 | &_lock); | 939 | &_lock); |
943 | clk_register_clkdev(clk, NULL, "spear_camif.0"); | 940 | clk_register_clkdev(clk, NULL, "spear_camif.0"); |
944 | 941 | ||
945 | clk = clk_register_gate(NULL, "cam1_clk", "cam1_mux_clk", 0, | 942 | clk = clk_register_gate(NULL, "cam1_clk", "cam1_mclk", 0, |
946 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0, | 943 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0, |
947 | &_lock); | 944 | &_lock); |
948 | clk_register_clkdev(clk, NULL, "spear_camif.1"); | 945 | clk_register_clkdev(clk, NULL, "spear_camif.1"); |
949 | 946 | ||
950 | clk = clk_register_gate(NULL, "cam2_clk", "cam2_mux_clk", 0, | 947 | clk = clk_register_gate(NULL, "cam2_clk", "cam2_mclk", 0, |
951 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0, | 948 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0, |
952 | &_lock); | 949 | &_lock); |
953 | clk_register_clkdev(clk, NULL, "spear_camif.2"); | 950 | clk_register_clkdev(clk, NULL, "spear_camif.2"); |
954 | 951 | ||
955 | clk = clk_register_gate(NULL, "cam3_clk", "cam3_mux_clk", 0, | 952 | clk = clk_register_gate(NULL, "cam3_clk", "cam3_mclk", 0, |
956 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0, | 953 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0, |
957 | &_lock); | 954 | &_lock); |
958 | clk_register_clkdev(clk, NULL, "spear_camif.3"); | 955 | clk_register_clkdev(clk, NULL, "spear_camif.3"); |
959 | 956 | ||
960 | clk = clk_register_gate(NULL, "pwm_clk", "pwm_mux_clk", 0, | 957 | clk = clk_register_gate(NULL, "pwm_clk", "pwm_mclk", 0, |
961 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PWM_CLK_ENB, 0, | 958 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PWM_CLK_ENB, 0, |
962 | &_lock); | 959 | &_lock); |
963 | clk_register_clkdev(clk, NULL, "pwm"); | 960 | clk_register_clkdev(clk, NULL, "pwm"); |
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c index 01dd6daff2a1..c3157454bb3f 100644 --- a/drivers/clk/spear/spear3xx_clock.c +++ b/drivers/clk/spear/spear3xx_clock.c | |||
@@ -122,12 +122,12 @@ static struct gpt_rate_tbl gpt_rtbl[] = { | |||
122 | }; | 122 | }; |
123 | 123 | ||
124 | /* clock parents */ | 124 | /* clock parents */ |
125 | static const char *uart0_parents[] = { "pll3_48m_clk", "uart_synth_gate_clk", }; | 125 | static const char *uart0_parents[] = { "pll3_clk", "uart_syn_gclk", }; |
126 | static const char *firda_parents[] = { "pll3_48m_clk", "firda_synth_gate_clk", | 126 | static const char *firda_parents[] = { "pll3_clk", "firda_syn_gclk", |
127 | }; | 127 | }; |
128 | static const char *gpt0_parents[] = { "pll3_48m_clk", "gpt0_synth_clk", }; | 128 | static const char *gpt0_parents[] = { "pll3_clk", "gpt0_syn_clk", }; |
129 | static const char *gpt1_parents[] = { "pll3_48m_clk", "gpt1_synth_clk", }; | 129 | static const char *gpt1_parents[] = { "pll3_clk", "gpt1_syn_clk", }; |
130 | static const char *gpt2_parents[] = { "pll3_48m_clk", "gpt2_synth_clk", }; | 130 | static const char *gpt2_parents[] = { "pll3_clk", "gpt2_syn_clk", }; |
131 | static const char *gen2_3_parents[] = { "pll1_clk", "pll2_clk", }; | 131 | static const char *gen2_3_parents[] = { "pll1_clk", "pll2_clk", }; |
132 | static const char *ddr_parents[] = { "ahb_clk", "ahbmult2_clk", "none", | 132 | static const char *ddr_parents[] = { "ahb_clk", "ahbmult2_clk", "none", |
133 | "pll2_clk", }; | 133 | "pll2_clk", }; |
@@ -137,7 +137,7 @@ static void __init spear300_clk_init(void) | |||
137 | { | 137 | { |
138 | struct clk *clk; | 138 | struct clk *clk; |
139 | 139 | ||
140 | clk = clk_register_fixed_factor(NULL, "clcd_clk", "ras_pll3_48m_clk", 0, | 140 | clk = clk_register_fixed_factor(NULL, "clcd_clk", "ras_pll3_clk", 0, |
141 | 1, 1); | 141 | 1, 1); |
142 | clk_register_clkdev(clk, NULL, "60000000.clcd"); | 142 | clk_register_clkdev(clk, NULL, "60000000.clcd"); |
143 | 143 | ||
@@ -219,15 +219,11 @@ static void __init spear310_clk_init(void) | |||
219 | #define SPEAR320_UARTX_PCLK_VAL_SYNTH1 0x0 | 219 | #define SPEAR320_UARTX_PCLK_VAL_SYNTH1 0x0 |
220 | #define SPEAR320_UARTX_PCLK_VAL_APB 0x1 | 220 | #define SPEAR320_UARTX_PCLK_VAL_APB 0x1 |
221 | 221 | ||
222 | static const char *i2s_ref_parents[] = { "ras_pll2_clk", | 222 | static const char *i2s_ref_parents[] = { "ras_pll2_clk", "ras_syn2_gclk", }; |
223 | "ras_gen2_synth_gate_clk", }; | 223 | static const char *sdhci_parents[] = { "ras_pll3_clk", "ras_syn3_gclk", }; |
224 | static const char *sdhci_parents[] = { "ras_pll3_48m_clk", | ||
225 | "ras_gen3_synth_gate_clk", | ||
226 | }; | ||
227 | static const char *smii0_parents[] = { "smii_125m_pad", "ras_pll2_clk", | 224 | static const char *smii0_parents[] = { "smii_125m_pad", "ras_pll2_clk", |
228 | "ras_gen0_synth_gate_clk", }; | 225 | "ras_syn0_gclk", }; |
229 | static const char *uartx_parents[] = { "ras_gen1_synth_gate_clk", "ras_apb_clk", | 226 | static const char *uartx_parents[] = { "ras_syn1_gclk", "ras_apb_clk", }; |
230 | }; | ||
231 | 227 | ||
232 | static void __init spear320_clk_init(void) | 228 | static void __init spear320_clk_init(void) |
233 | { | 229 | { |
@@ -237,7 +233,7 @@ static void __init spear320_clk_init(void) | |||
237 | CLK_IS_ROOT, 125000000); | 233 | CLK_IS_ROOT, 125000000); |
238 | clk_register_clkdev(clk, "smii_125m_pad", NULL); | 234 | clk_register_clkdev(clk, "smii_125m_pad", NULL); |
239 | 235 | ||
240 | clk = clk_register_fixed_factor(NULL, "clcd_clk", "ras_pll3_48m_clk", 0, | 236 | clk = clk_register_fixed_factor(NULL, "clcd_clk", "ras_pll3_clk", 0, |
241 | 1, 1); | 237 | 1, 1); |
242 | clk_register_clkdev(clk, NULL, "90000000.clcd"); | 238 | clk_register_clkdev(clk, NULL, "90000000.clcd"); |
243 | 239 | ||
@@ -363,9 +359,9 @@ void __init spear3xx_clk_init(void) | |||
363 | clk_register_clkdev(clk, NULL, "fc900000.rtc"); | 359 | clk_register_clkdev(clk, NULL, "fc900000.rtc"); |
364 | 360 | ||
365 | /* clock derived from 24 MHz osc clk */ | 361 | /* clock derived from 24 MHz osc clk */ |
366 | clk = clk_register_fixed_rate(NULL, "pll3_48m_clk", "osc_24m_clk", 0, | 362 | clk = clk_register_fixed_rate(NULL, "pll3_clk", "osc_24m_clk", 0, |
367 | 48000000); | 363 | 48000000); |
368 | clk_register_clkdev(clk, "pll3_48m_clk", NULL); | 364 | clk_register_clkdev(clk, "pll3_clk", NULL); |
369 | 365 | ||
370 | clk = clk_register_fixed_factor(NULL, "wdt_clk", "osc_24m_clk", 0, 1, | 366 | clk = clk_register_fixed_factor(NULL, "wdt_clk", "osc_24m_clk", 0, 1, |
371 | 1); | 367 | 1); |
@@ -392,98 +388,98 @@ void __init spear3xx_clk_init(void) | |||
392 | HCLK_RATIO_MASK, 0, &_lock); | 388 | HCLK_RATIO_MASK, 0, &_lock); |
393 | clk_register_clkdev(clk, "ahb_clk", NULL); | 389 | clk_register_clkdev(clk, "ahb_clk", NULL); |
394 | 390 | ||
395 | clk = clk_register_aux("uart_synth_clk", "uart_synth_gate_clk", | 391 | clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "pll1_clk", 0, |
396 | "pll1_clk", 0, UART_CLK_SYNT, NULL, aux_rtbl, | 392 | UART_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
397 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 393 | &_lock, &clk1); |
398 | clk_register_clkdev(clk, "uart_synth_clk", NULL); | 394 | clk_register_clkdev(clk, "uart_syn_clk", NULL); |
399 | clk_register_clkdev(clk1, "uart_synth_gate_clk", NULL); | 395 | clk_register_clkdev(clk1, "uart_syn_gclk", NULL); |
400 | 396 | ||
401 | clk = clk_register_mux(NULL, "uart0_mux_clk", uart0_parents, | 397 | clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents, |
402 | ARRAY_SIZE(uart0_parents), 0, PERIP_CLK_CFG, | 398 | ARRAY_SIZE(uart0_parents), 0, PERIP_CLK_CFG, |
403 | UART_CLK_SHIFT, UART_CLK_MASK, 0, &_lock); | 399 | UART_CLK_SHIFT, UART_CLK_MASK, 0, &_lock); |
404 | clk_register_clkdev(clk, "uart0_mux_clk", NULL); | 400 | clk_register_clkdev(clk, "uart0_mclk", NULL); |
405 | 401 | ||
406 | clk = clk_register_gate(NULL, "uart0", "uart0_mux_clk", 0, | 402 | clk = clk_register_gate(NULL, "uart0", "uart0_mclk", 0, PERIP1_CLK_ENB, |
407 | PERIP1_CLK_ENB, UART_CLK_ENB, 0, &_lock); | 403 | UART_CLK_ENB, 0, &_lock); |
408 | clk_register_clkdev(clk, NULL, "d0000000.serial"); | 404 | clk_register_clkdev(clk, NULL, "d0000000.serial"); |
409 | 405 | ||
410 | clk = clk_register_aux("firda_synth_clk", "firda_synth_gate_clk", | 406 | clk = clk_register_aux("firda_syn_clk", "firda_syn_gclk", "pll1_clk", 0, |
411 | "pll1_clk", 0, FIRDA_CLK_SYNT, NULL, aux_rtbl, | 407 | FIRDA_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
412 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 408 | &_lock, &clk1); |
413 | clk_register_clkdev(clk, "firda_synth_clk", NULL); | 409 | clk_register_clkdev(clk, "firda_syn_clk", NULL); |
414 | clk_register_clkdev(clk1, "firda_synth_gate_clk", NULL); | 410 | clk_register_clkdev(clk1, "firda_syn_gclk", NULL); |
415 | 411 | ||
416 | clk = clk_register_mux(NULL, "firda_mux_clk", firda_parents, | 412 | clk = clk_register_mux(NULL, "firda_mclk", firda_parents, |
417 | ARRAY_SIZE(firda_parents), 0, PERIP_CLK_CFG, | 413 | ARRAY_SIZE(firda_parents), 0, PERIP_CLK_CFG, |
418 | FIRDA_CLK_SHIFT, FIRDA_CLK_MASK, 0, &_lock); | 414 | FIRDA_CLK_SHIFT, FIRDA_CLK_MASK, 0, &_lock); |
419 | clk_register_clkdev(clk, "firda_mux_clk", NULL); | 415 | clk_register_clkdev(clk, "firda_mclk", NULL); |
420 | 416 | ||
421 | clk = clk_register_gate(NULL, "firda_clk", "firda_mux_clk", 0, | 417 | clk = clk_register_gate(NULL, "firda_clk", "firda_mclk", 0, |
422 | PERIP1_CLK_ENB, FIRDA_CLK_ENB, 0, &_lock); | 418 | PERIP1_CLK_ENB, FIRDA_CLK_ENB, 0, &_lock); |
423 | clk_register_clkdev(clk, NULL, "firda"); | 419 | clk_register_clkdev(clk, NULL, "firda"); |
424 | 420 | ||
425 | /* gpt clocks */ | 421 | /* gpt clocks */ |
426 | clk_register_gpt("gpt0_synth_clk", "pll1_clk", 0, PRSC0_CLK_CFG, | 422 | clk_register_gpt("gpt0_syn_clk", "pll1_clk", 0, PRSC0_CLK_CFG, gpt_rtbl, |
427 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 423 | ARRAY_SIZE(gpt_rtbl), &_lock); |
428 | clk = clk_register_mux(NULL, "gpt0_clk", gpt0_parents, | 424 | clk = clk_register_mux(NULL, "gpt0_clk", gpt0_parents, |
429 | ARRAY_SIZE(gpt0_parents), 0, PERIP_CLK_CFG, | 425 | ARRAY_SIZE(gpt0_parents), 0, PERIP_CLK_CFG, |
430 | GPT0_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 426 | GPT0_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
431 | clk_register_clkdev(clk, NULL, "gpt0"); | 427 | clk_register_clkdev(clk, NULL, "gpt0"); |
432 | 428 | ||
433 | clk_register_gpt("gpt1_synth_clk", "pll1_clk", 0, PRSC1_CLK_CFG, | 429 | clk_register_gpt("gpt1_syn_clk", "pll1_clk", 0, PRSC1_CLK_CFG, gpt_rtbl, |
434 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 430 | ARRAY_SIZE(gpt_rtbl), &_lock); |
435 | clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt1_parents, | 431 | clk = clk_register_mux(NULL, "gpt1_mclk", gpt1_parents, |
436 | ARRAY_SIZE(gpt1_parents), 0, PERIP_CLK_CFG, | 432 | ARRAY_SIZE(gpt1_parents), 0, PERIP_CLK_CFG, |
437 | GPT1_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 433 | GPT1_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
438 | clk_register_clkdev(clk, "gpt1_mux_clk", NULL); | 434 | clk_register_clkdev(clk, "gpt1_mclk", NULL); |
439 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0, | 435 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0, |
440 | PERIP1_CLK_ENB, GPT1_CLK_ENB, 0, &_lock); | 436 | PERIP1_CLK_ENB, GPT1_CLK_ENB, 0, &_lock); |
441 | clk_register_clkdev(clk, NULL, "gpt1"); | 437 | clk_register_clkdev(clk, NULL, "gpt1"); |
442 | 438 | ||
443 | clk_register_gpt("gpt2_synth_clk", "pll1_clk", 0, PRSC2_CLK_CFG, | 439 | clk_register_gpt("gpt2_syn_clk", "pll1_clk", 0, PRSC2_CLK_CFG, gpt_rtbl, |
444 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 440 | ARRAY_SIZE(gpt_rtbl), &_lock); |
445 | clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt2_parents, | 441 | clk = clk_register_mux(NULL, "gpt2_mclk", gpt2_parents, |
446 | ARRAY_SIZE(gpt2_parents), 0, PERIP_CLK_CFG, | 442 | ARRAY_SIZE(gpt2_parents), 0, PERIP_CLK_CFG, |
447 | GPT2_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 443 | GPT2_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
448 | clk_register_clkdev(clk, "gpt2_mux_clk", NULL); | 444 | clk_register_clkdev(clk, "gpt2_mclk", NULL); |
449 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0, | 445 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0, |
450 | PERIP1_CLK_ENB, GPT2_CLK_ENB, 0, &_lock); | 446 | PERIP1_CLK_ENB, GPT2_CLK_ENB, 0, &_lock); |
451 | clk_register_clkdev(clk, NULL, "gpt2"); | 447 | clk_register_clkdev(clk, NULL, "gpt2"); |
452 | 448 | ||
453 | /* general synths clocks */ | 449 | /* general synths clocks */ |
454 | clk = clk_register_aux("gen0_synth_clk", "gen0_synth_gate_clk", | 450 | clk = clk_register_aux("gen0_syn_clk", "gen0_syn_gclk", "pll1_clk", |
455 | "pll1_clk", 0, GEN0_CLK_SYNT, NULL, aux_rtbl, | 451 | 0, GEN0_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
456 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 452 | &_lock, &clk1); |
457 | clk_register_clkdev(clk, "gen0_synth_clk", NULL); | 453 | clk_register_clkdev(clk, "gen0_syn_clk", NULL); |
458 | clk_register_clkdev(clk1, "gen0_synth_gate_clk", NULL); | 454 | clk_register_clkdev(clk1, "gen0_syn_gclk", NULL); |
459 | 455 | ||
460 | clk = clk_register_aux("gen1_synth_clk", "gen1_synth_gate_clk", | 456 | clk = clk_register_aux("gen1_syn_clk", "gen1_syn_gclk", "pll1_clk", |
461 | "pll1_clk", 0, GEN1_CLK_SYNT, NULL, aux_rtbl, | 457 | 0, GEN1_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
462 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 458 | &_lock, &clk1); |
463 | clk_register_clkdev(clk, "gen1_synth_clk", NULL); | 459 | clk_register_clkdev(clk, "gen1_syn_clk", NULL); |
464 | clk_register_clkdev(clk1, "gen1_synth_gate_clk", NULL); | 460 | clk_register_clkdev(clk1, "gen1_syn_gclk", NULL); |
465 | 461 | ||
466 | clk = clk_register_mux(NULL, "gen2_3_parent_clk", gen2_3_parents, | 462 | clk = clk_register_mux(NULL, "gen2_3_par_clk", gen2_3_parents, |
467 | ARRAY_SIZE(gen2_3_parents), 0, CORE_CLK_CFG, | 463 | ARRAY_SIZE(gen2_3_parents), 0, CORE_CLK_CFG, |
468 | GEN_SYNTH2_3_CLK_SHIFT, GEN_SYNTH2_3_CLK_MASK, 0, | 464 | GEN_SYNTH2_3_CLK_SHIFT, GEN_SYNTH2_3_CLK_MASK, 0, |
469 | &_lock); | 465 | &_lock); |
470 | clk_register_clkdev(clk, "gen2_3_parent_clk", NULL); | 466 | clk_register_clkdev(clk, "gen2_3_par_clk", NULL); |
471 | 467 | ||
472 | clk = clk_register_aux("gen2_synth_clk", "gen2_synth_gate_clk", | 468 | clk = clk_register_aux("gen2_syn_clk", "gen2_syn_gclk", |
473 | "gen2_3_parent_clk", 0, GEN2_CLK_SYNT, NULL, aux_rtbl, | 469 | "gen2_3_par_clk", 0, GEN2_CLK_SYNT, NULL, aux_rtbl, |
474 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 470 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
475 | clk_register_clkdev(clk, "gen2_synth_clk", NULL); | 471 | clk_register_clkdev(clk, "gen2_syn_clk", NULL); |
476 | clk_register_clkdev(clk1, "gen2_synth_gate_clk", NULL); | 472 | clk_register_clkdev(clk1, "gen2_syn_gclk", NULL); |
477 | 473 | ||
478 | clk = clk_register_aux("gen3_synth_clk", "gen3_synth_gate_clk", | 474 | clk = clk_register_aux("gen3_syn_clk", "gen3_syn_gclk", |
479 | "gen2_3_parent_clk", 0, GEN3_CLK_SYNT, NULL, aux_rtbl, | 475 | "gen2_3_par_clk", 0, GEN3_CLK_SYNT, NULL, aux_rtbl, |
480 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 476 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
481 | clk_register_clkdev(clk, "gen3_synth_clk", NULL); | 477 | clk_register_clkdev(clk, "gen3_syn_clk", NULL); |
482 | clk_register_clkdev(clk1, "gen3_synth_gate_clk", NULL); | 478 | clk_register_clkdev(clk1, "gen3_syn_gclk", NULL); |
483 | 479 | ||
484 | /* clock derived from pll3 clk */ | 480 | /* clock derived from pll3 clk */ |
485 | clk = clk_register_gate(NULL, "usbh_clk", "pll3_48m_clk", 0, | 481 | clk = clk_register_gate(NULL, "usbh_clk", "pll3_clk", 0, PERIP1_CLK_ENB, |
486 | PERIP1_CLK_ENB, USBH_CLK_ENB, 0, &_lock); | 482 | USBH_CLK_ENB, 0, &_lock); |
487 | clk_register_clkdev(clk, "usbh_clk", NULL); | 483 | clk_register_clkdev(clk, "usbh_clk", NULL); |
488 | 484 | ||
489 | clk = clk_register_fixed_factor(NULL, "usbh.0_clk", "usbh_clk", 0, 1, | 485 | clk = clk_register_fixed_factor(NULL, "usbh.0_clk", "usbh_clk", 0, 1, |
@@ -494,8 +490,8 @@ void __init spear3xx_clk_init(void) | |||
494 | 1); | 490 | 1); |
495 | clk_register_clkdev(clk, "usbh.1_clk", NULL); | 491 | clk_register_clkdev(clk, "usbh.1_clk", NULL); |
496 | 492 | ||
497 | clk = clk_register_gate(NULL, "usbd_clk", "pll3_48m_clk", 0, | 493 | clk = clk_register_gate(NULL, "usbd_clk", "pll3_clk", 0, PERIP1_CLK_ENB, |
498 | PERIP1_CLK_ENB, USBD_CLK_ENB, 0, &_lock); | 494 | USBD_CLK_ENB, 0, &_lock); |
499 | clk_register_clkdev(clk, NULL, "designware_udc"); | 495 | clk_register_clkdev(clk, NULL, "designware_udc"); |
500 | 496 | ||
501 | /* clock derived from ahb clk */ | 497 | /* clock derived from ahb clk */ |
@@ -579,29 +575,25 @@ void __init spear3xx_clk_init(void) | |||
579 | RAS_CLK_ENB, RAS_PLL2_CLK_ENB, 0, &_lock); | 575 | RAS_CLK_ENB, RAS_PLL2_CLK_ENB, 0, &_lock); |
580 | clk_register_clkdev(clk, "ras_pll2_clk", NULL); | 576 | clk_register_clkdev(clk, "ras_pll2_clk", NULL); |
581 | 577 | ||
582 | clk = clk_register_gate(NULL, "ras_pll3_48m_clk", "pll3_48m_clk", 0, | 578 | clk = clk_register_gate(NULL, "ras_pll3_clk", "pll3_clk", 0, |
583 | RAS_CLK_ENB, RAS_48M_CLK_ENB, 0, &_lock); | 579 | RAS_CLK_ENB, RAS_48M_CLK_ENB, 0, &_lock); |
584 | clk_register_clkdev(clk, "ras_pll3_48m_clk", NULL); | 580 | clk_register_clkdev(clk, "ras_pll3_clk", NULL); |
585 | 581 | ||
586 | clk = clk_register_gate(NULL, "ras_gen0_synth_gate_clk", | 582 | clk = clk_register_gate(NULL, "ras_syn0_gclk", "gen0_syn_gclk", 0, |
587 | "gen0_synth_gate_clk", 0, RAS_CLK_ENB, | 583 | RAS_CLK_ENB, RAS_SYNT0_CLK_ENB, 0, &_lock); |
588 | RAS_SYNT0_CLK_ENB, 0, &_lock); | 584 | clk_register_clkdev(clk, "ras_syn0_gclk", NULL); |
589 | clk_register_clkdev(clk, "ras_gen0_synth_gate_clk", NULL); | 585 | |
590 | 586 | clk = clk_register_gate(NULL, "ras_syn1_gclk", "gen1_syn_gclk", 0, | |
591 | clk = clk_register_gate(NULL, "ras_gen1_synth_gate_clk", | 587 | RAS_CLK_ENB, RAS_SYNT1_CLK_ENB, 0, &_lock); |
592 | "gen1_synth_gate_clk", 0, RAS_CLK_ENB, | 588 | clk_register_clkdev(clk, "ras_syn1_gclk", NULL); |
593 | RAS_SYNT1_CLK_ENB, 0, &_lock); | 589 | |
594 | clk_register_clkdev(clk, "ras_gen1_synth_gate_clk", NULL); | 590 | clk = clk_register_gate(NULL, "ras_syn2_gclk", "gen2_syn_gclk", 0, |
595 | 591 | RAS_CLK_ENB, RAS_SYNT2_CLK_ENB, 0, &_lock); | |
596 | clk = clk_register_gate(NULL, "ras_gen2_synth_gate_clk", | 592 | clk_register_clkdev(clk, "ras_syn2_gclk", NULL); |
597 | "gen2_synth_gate_clk", 0, RAS_CLK_ENB, | 593 | |
598 | RAS_SYNT2_CLK_ENB, 0, &_lock); | 594 | clk = clk_register_gate(NULL, "ras_syn3_gclk", "gen3_syn_gclk", 0, |
599 | clk_register_clkdev(clk, "ras_gen2_synth_gate_clk", NULL); | 595 | RAS_CLK_ENB, RAS_SYNT3_CLK_ENB, 0, &_lock); |
600 | 596 | clk_register_clkdev(clk, "ras_syn3_gclk", NULL); | |
601 | clk = clk_register_gate(NULL, "ras_gen3_synth_gate_clk", | ||
602 | "gen3_synth_gate_clk", 0, RAS_CLK_ENB, | ||
603 | RAS_SYNT3_CLK_ENB, 0, &_lock); | ||
604 | clk_register_clkdev(clk, "ras_gen3_synth_gate_clk", NULL); | ||
605 | 597 | ||
606 | if (of_machine_is_compatible("st,spear300")) | 598 | if (of_machine_is_compatible("st,spear300")) |
607 | spear300_clk_init(); | 599 | spear300_clk_init(); |
diff --git a/drivers/clk/spear/spear6xx_clock.c b/drivers/clk/spear/spear6xx_clock.c index 554d64b062a1..a98d0866f541 100644 --- a/drivers/clk/spear/spear6xx_clock.c +++ b/drivers/clk/spear/spear6xx_clock.c | |||
@@ -97,13 +97,12 @@ static struct aux_rate_tbl aux_rtbl[] = { | |||
97 | {.xscale = 1, .yscale = 2, .eq = 1}, /* 166 MHz */ | 97 | {.xscale = 1, .yscale = 2, .eq = 1}, /* 166 MHz */ |
98 | }; | 98 | }; |
99 | 99 | ||
100 | static const char *clcd_parents[] = { "pll3_48m_clk", "clcd_synth_gate_clk", }; | 100 | static const char *clcd_parents[] = { "pll3_clk", "clcd_syn_gclk", }; |
101 | static const char *firda_parents[] = { "pll3_48m_clk", "firda_synth_gate_clk", | 101 | static const char *firda_parents[] = { "pll3_clk", "firda_syn_gclk", }; |
102 | }; | 102 | static const char *uart_parents[] = { "pll3_clk", "uart_syn_gclk", }; |
103 | static const char *uart_parents[] = { "pll3_48m_clk", "uart_synth_gate_clk", }; | 103 | static const char *gpt0_1_parents[] = { "pll3_clk", "gpt0_1_syn_clk", }; |
104 | static const char *gpt0_1_parents[] = { "pll3_48m_clk", "gpt0_1_synth_clk", }; | 104 | static const char *gpt2_parents[] = { "pll3_clk", "gpt2_syn_clk", }; |
105 | static const char *gpt2_parents[] = { "pll3_48m_clk", "gpt2_synth_clk", }; | 105 | static const char *gpt3_parents[] = { "pll3_clk", "gpt3_syn_clk", }; |
106 | static const char *gpt3_parents[] = { "pll3_48m_clk", "gpt3_synth_clk", }; | ||
107 | static const char *ddr_parents[] = { "ahb_clk", "ahbmult2_clk", "none", | 106 | static const char *ddr_parents[] = { "ahb_clk", "ahbmult2_clk", "none", |
108 | "pll2_clk", }; | 107 | "pll2_clk", }; |
109 | 108 | ||
@@ -136,9 +135,9 @@ void __init spear6xx_clk_init(void) | |||
136 | clk_register_clkdev(clk, NULL, "rtc-spear"); | 135 | clk_register_clkdev(clk, NULL, "rtc-spear"); |
137 | 136 | ||
138 | /* clock derived from 30 MHz osc clk */ | 137 | /* clock derived from 30 MHz osc clk */ |
139 | clk = clk_register_fixed_rate(NULL, "pll3_48m_clk", "osc_24m_clk", 0, | 138 | clk = clk_register_fixed_rate(NULL, "pll3_clk", "osc_24m_clk", 0, |
140 | 48000000); | 139 | 48000000); |
141 | clk_register_clkdev(clk, "pll3_48m_clk", NULL); | 140 | clk_register_clkdev(clk, "pll3_clk", NULL); |
142 | 141 | ||
143 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "osc_30m_clk", | 142 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "osc_30m_clk", |
144 | 0, PLL1_CTR, PLL1_FRQ, pll_rtbl, ARRAY_SIZE(pll_rtbl), | 143 | 0, PLL1_CTR, PLL1_FRQ, pll_rtbl, ARRAY_SIZE(pll_rtbl), |
@@ -146,9 +145,9 @@ void __init spear6xx_clk_init(void) | |||
146 | clk_register_clkdev(clk, "vco1_clk", NULL); | 145 | clk_register_clkdev(clk, "vco1_clk", NULL); |
147 | clk_register_clkdev(clk1, "pll1_clk", NULL); | 146 | clk_register_clkdev(clk1, "pll1_clk", NULL); |
148 | 147 | ||
149 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, | 148 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "osc_30m_clk", |
150 | "osc_30m_clk", 0, PLL2_CTR, PLL2_FRQ, pll_rtbl, | 149 | 0, PLL2_CTR, PLL2_FRQ, pll_rtbl, ARRAY_SIZE(pll_rtbl), |
151 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 150 | &_lock, &clk1, NULL); |
152 | clk_register_clkdev(clk, "vco2_clk", NULL); | 151 | clk_register_clkdev(clk, "vco2_clk", NULL); |
153 | clk_register_clkdev(clk1, "pll2_clk", NULL); | 152 | clk_register_clkdev(clk1, "pll2_clk", NULL); |
154 | 153 | ||
@@ -165,111 +164,111 @@ void __init spear6xx_clk_init(void) | |||
165 | HCLK_RATIO_MASK, 0, &_lock); | 164 | HCLK_RATIO_MASK, 0, &_lock); |
166 | clk_register_clkdev(clk, "ahb_clk", NULL); | 165 | clk_register_clkdev(clk, "ahb_clk", NULL); |
167 | 166 | ||
168 | clk = clk_register_aux("uart_synth_clk", "uart_synth_gate_clk", | 167 | clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "pll1_clk", 0, |
169 | "pll1_clk", 0, UART_CLK_SYNT, NULL, aux_rtbl, | 168 | UART_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
170 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 169 | &_lock, &clk1); |
171 | clk_register_clkdev(clk, "uart_synth_clk", NULL); | 170 | clk_register_clkdev(clk, "uart_syn_clk", NULL); |
172 | clk_register_clkdev(clk1, "uart_synth_gate_clk", NULL); | 171 | clk_register_clkdev(clk1, "uart_syn_gclk", NULL); |
173 | 172 | ||
174 | clk = clk_register_mux(NULL, "uart_mux_clk", uart_parents, | 173 | clk = clk_register_mux(NULL, "uart_mclk", uart_parents, |
175 | ARRAY_SIZE(uart_parents), 0, PERIP_CLK_CFG, | 174 | ARRAY_SIZE(uart_parents), 0, PERIP_CLK_CFG, |
176 | UART_CLK_SHIFT, UART_CLK_MASK, 0, &_lock); | 175 | UART_CLK_SHIFT, UART_CLK_MASK, 0, &_lock); |
177 | clk_register_clkdev(clk, "uart_mux_clk", NULL); | 176 | clk_register_clkdev(clk, "uart_mclk", NULL); |
178 | 177 | ||
179 | clk = clk_register_gate(NULL, "uart0", "uart_mux_clk", 0, | 178 | clk = clk_register_gate(NULL, "uart0", "uart_mclk", 0, PERIP1_CLK_ENB, |
180 | PERIP1_CLK_ENB, UART0_CLK_ENB, 0, &_lock); | 179 | UART0_CLK_ENB, 0, &_lock); |
181 | clk_register_clkdev(clk, NULL, "d0000000.serial"); | 180 | clk_register_clkdev(clk, NULL, "d0000000.serial"); |
182 | 181 | ||
183 | clk = clk_register_gate(NULL, "uart1", "uart_mux_clk", 0, | 182 | clk = clk_register_gate(NULL, "uart1", "uart_mclk", 0, PERIP1_CLK_ENB, |
184 | PERIP1_CLK_ENB, UART1_CLK_ENB, 0, &_lock); | 183 | UART1_CLK_ENB, 0, &_lock); |
185 | clk_register_clkdev(clk, NULL, "d0080000.serial"); | 184 | clk_register_clkdev(clk, NULL, "d0080000.serial"); |
186 | 185 | ||
187 | clk = clk_register_aux("firda_synth_clk", "firda_synth_gate_clk", | 186 | clk = clk_register_aux("firda_syn_clk", "firda_syn_gclk", "pll1_clk", |
188 | "pll1_clk", 0, FIRDA_CLK_SYNT, NULL, aux_rtbl, | 187 | 0, FIRDA_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
189 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 188 | &_lock, &clk1); |
190 | clk_register_clkdev(clk, "firda_synth_clk", NULL); | 189 | clk_register_clkdev(clk, "firda_syn_clk", NULL); |
191 | clk_register_clkdev(clk1, "firda_synth_gate_clk", NULL); | 190 | clk_register_clkdev(clk1, "firda_syn_gclk", NULL); |
192 | 191 | ||
193 | clk = clk_register_mux(NULL, "firda_mux_clk", firda_parents, | 192 | clk = clk_register_mux(NULL, "firda_mclk", firda_parents, |
194 | ARRAY_SIZE(firda_parents), 0, PERIP_CLK_CFG, | 193 | ARRAY_SIZE(firda_parents), 0, PERIP_CLK_CFG, |
195 | FIRDA_CLK_SHIFT, FIRDA_CLK_MASK, 0, &_lock); | 194 | FIRDA_CLK_SHIFT, FIRDA_CLK_MASK, 0, &_lock); |
196 | clk_register_clkdev(clk, "firda_mux_clk", NULL); | 195 | clk_register_clkdev(clk, "firda_mclk", NULL); |
197 | 196 | ||
198 | clk = clk_register_gate(NULL, "firda_clk", "firda_mux_clk", 0, | 197 | clk = clk_register_gate(NULL, "firda_clk", "firda_mclk", 0, |
199 | PERIP1_CLK_ENB, FIRDA_CLK_ENB, 0, &_lock); | 198 | PERIP1_CLK_ENB, FIRDA_CLK_ENB, 0, &_lock); |
200 | clk_register_clkdev(clk, NULL, "firda"); | 199 | clk_register_clkdev(clk, NULL, "firda"); |
201 | 200 | ||
202 | clk = clk_register_aux("clcd_synth_clk", "clcd_synth_gate_clk", | 201 | clk = clk_register_aux("clcd_syn_clk", "clcd_syn_gclk", "pll1_clk", |
203 | "pll1_clk", 0, CLCD_CLK_SYNT, NULL, aux_rtbl, | 202 | 0, CLCD_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
204 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 203 | &_lock, &clk1); |
205 | clk_register_clkdev(clk, "clcd_synth_clk", NULL); | 204 | clk_register_clkdev(clk, "clcd_syn_clk", NULL); |
206 | clk_register_clkdev(clk1, "clcd_synth_gate_clk", NULL); | 205 | clk_register_clkdev(clk1, "clcd_syn_gclk", NULL); |
207 | 206 | ||
208 | clk = clk_register_mux(NULL, "clcd_mux_clk", clcd_parents, | 207 | clk = clk_register_mux(NULL, "clcd_mclk", clcd_parents, |
209 | ARRAY_SIZE(clcd_parents), 0, PERIP_CLK_CFG, | 208 | ARRAY_SIZE(clcd_parents), 0, PERIP_CLK_CFG, |
210 | CLCD_CLK_SHIFT, CLCD_CLK_MASK, 0, &_lock); | 209 | CLCD_CLK_SHIFT, CLCD_CLK_MASK, 0, &_lock); |
211 | clk_register_clkdev(clk, "clcd_mux_clk", NULL); | 210 | clk_register_clkdev(clk, "clcd_mclk", NULL); |
212 | 211 | ||
213 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_mux_clk", 0, | 212 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_mclk", 0, |
214 | PERIP1_CLK_ENB, CLCD_CLK_ENB, 0, &_lock); | 213 | PERIP1_CLK_ENB, CLCD_CLK_ENB, 0, &_lock); |
215 | clk_register_clkdev(clk, NULL, "clcd"); | 214 | clk_register_clkdev(clk, NULL, "clcd"); |
216 | 215 | ||
217 | /* gpt clocks */ | 216 | /* gpt clocks */ |
218 | clk = clk_register_gpt("gpt0_1_synth_clk", "pll1_clk", 0, PRSC0_CLK_CFG, | 217 | clk = clk_register_gpt("gpt0_1_syn_clk", "pll1_clk", 0, PRSC0_CLK_CFG, |
219 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 218 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); |
220 | clk_register_clkdev(clk, "gpt0_1_synth_clk", NULL); | 219 | clk_register_clkdev(clk, "gpt0_1_syn_clk", NULL); |
221 | 220 | ||
222 | clk = clk_register_mux(NULL, "gpt0_mux_clk", gpt0_1_parents, | 221 | clk = clk_register_mux(NULL, "gpt0_mclk", gpt0_1_parents, |
223 | ARRAY_SIZE(gpt0_1_parents), 0, PERIP_CLK_CFG, | 222 | ARRAY_SIZE(gpt0_1_parents), 0, PERIP_CLK_CFG, |
224 | GPT0_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 223 | GPT0_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
225 | clk_register_clkdev(clk, NULL, "gpt0"); | 224 | clk_register_clkdev(clk, NULL, "gpt0"); |
226 | 225 | ||
227 | clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt0_1_parents, | 226 | clk = clk_register_mux(NULL, "gpt1_mclk", gpt0_1_parents, |
228 | ARRAY_SIZE(gpt0_1_parents), 0, PERIP_CLK_CFG, | 227 | ARRAY_SIZE(gpt0_1_parents), 0, PERIP_CLK_CFG, |
229 | GPT1_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 228 | GPT1_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
230 | clk_register_clkdev(clk, "gpt1_mux_clk", NULL); | 229 | clk_register_clkdev(clk, "gpt1_mclk", NULL); |
231 | 230 | ||
232 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0, | 231 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0, |
233 | PERIP1_CLK_ENB, GPT1_CLK_ENB, 0, &_lock); | 232 | PERIP1_CLK_ENB, GPT1_CLK_ENB, 0, &_lock); |
234 | clk_register_clkdev(clk, NULL, "gpt1"); | 233 | clk_register_clkdev(clk, NULL, "gpt1"); |
235 | 234 | ||
236 | clk = clk_register_gpt("gpt2_synth_clk", "pll1_clk", 0, PRSC1_CLK_CFG, | 235 | clk = clk_register_gpt("gpt2_syn_clk", "pll1_clk", 0, PRSC1_CLK_CFG, |
237 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 236 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); |
238 | clk_register_clkdev(clk, "gpt2_synth_clk", NULL); | 237 | clk_register_clkdev(clk, "gpt2_syn_clk", NULL); |
239 | 238 | ||
240 | clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt2_parents, | 239 | clk = clk_register_mux(NULL, "gpt2_mclk", gpt2_parents, |
241 | ARRAY_SIZE(gpt2_parents), 0, PERIP_CLK_CFG, | 240 | ARRAY_SIZE(gpt2_parents), 0, PERIP_CLK_CFG, |
242 | GPT2_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 241 | GPT2_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
243 | clk_register_clkdev(clk, "gpt2_mux_clk", NULL); | 242 | clk_register_clkdev(clk, "gpt2_mclk", NULL); |
244 | 243 | ||
245 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0, | 244 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0, |
246 | PERIP1_CLK_ENB, GPT2_CLK_ENB, 0, &_lock); | 245 | PERIP1_CLK_ENB, GPT2_CLK_ENB, 0, &_lock); |
247 | clk_register_clkdev(clk, NULL, "gpt2"); | 246 | clk_register_clkdev(clk, NULL, "gpt2"); |
248 | 247 | ||
249 | clk = clk_register_gpt("gpt3_synth_clk", "pll1_clk", 0, PRSC2_CLK_CFG, | 248 | clk = clk_register_gpt("gpt3_syn_clk", "pll1_clk", 0, PRSC2_CLK_CFG, |
250 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 249 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); |
251 | clk_register_clkdev(clk, "gpt3_synth_clk", NULL); | 250 | clk_register_clkdev(clk, "gpt3_syn_clk", NULL); |
252 | 251 | ||
253 | clk = clk_register_mux(NULL, "gpt3_mux_clk", gpt3_parents, | 252 | clk = clk_register_mux(NULL, "gpt3_mclk", gpt3_parents, |
254 | ARRAY_SIZE(gpt3_parents), 0, PERIP_CLK_CFG, | 253 | ARRAY_SIZE(gpt3_parents), 0, PERIP_CLK_CFG, |
255 | GPT3_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 254 | GPT3_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
256 | clk_register_clkdev(clk, "gpt3_mux_clk", NULL); | 255 | clk_register_clkdev(clk, "gpt3_mclk", NULL); |
257 | 256 | ||
258 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mux_clk", 0, | 257 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0, |
259 | PERIP1_CLK_ENB, GPT3_CLK_ENB, 0, &_lock); | 258 | PERIP1_CLK_ENB, GPT3_CLK_ENB, 0, &_lock); |
260 | clk_register_clkdev(clk, NULL, "gpt3"); | 259 | clk_register_clkdev(clk, NULL, "gpt3"); |
261 | 260 | ||
262 | /* clock derived from pll3 clk */ | 261 | /* clock derived from pll3 clk */ |
263 | clk = clk_register_gate(NULL, "usbh0_clk", "pll3_48m_clk", 0, | 262 | clk = clk_register_gate(NULL, "usbh0_clk", "pll3_clk", 0, |
264 | PERIP1_CLK_ENB, USBH0_CLK_ENB, 0, &_lock); | 263 | PERIP1_CLK_ENB, USBH0_CLK_ENB, 0, &_lock); |
265 | clk_register_clkdev(clk, NULL, "usbh.0_clk"); | 264 | clk_register_clkdev(clk, NULL, "usbh.0_clk"); |
266 | 265 | ||
267 | clk = clk_register_gate(NULL, "usbh1_clk", "pll3_48m_clk", 0, | 266 | clk = clk_register_gate(NULL, "usbh1_clk", "pll3_clk", 0, |
268 | PERIP1_CLK_ENB, USBH1_CLK_ENB, 0, &_lock); | 267 | PERIP1_CLK_ENB, USBH1_CLK_ENB, 0, &_lock); |
269 | clk_register_clkdev(clk, NULL, "usbh.1_clk"); | 268 | clk_register_clkdev(clk, NULL, "usbh.1_clk"); |
270 | 269 | ||
271 | clk = clk_register_gate(NULL, "usbd_clk", "pll3_48m_clk", 0, | 270 | clk = clk_register_gate(NULL, "usbd_clk", "pll3_clk", 0, PERIP1_CLK_ENB, |
272 | PERIP1_CLK_ENB, USBD_CLK_ENB, 0, &_lock); | 271 | USBD_CLK_ENB, 0, &_lock); |
273 | clk_register_clkdev(clk, NULL, "designware_udc"); | 272 | clk_register_clkdev(clk, NULL, "designware_udc"); |
274 | 273 | ||
275 | /* clock derived from ahb clk */ | 274 | /* clock derived from ahb clk */ |
@@ -278,9 +277,8 @@ void __init spear6xx_clk_init(void) | |||
278 | clk_register_clkdev(clk, "ahbmult2_clk", NULL); | 277 | clk_register_clkdev(clk, "ahbmult2_clk", NULL); |
279 | 278 | ||
280 | clk = clk_register_mux(NULL, "ddr_clk", ddr_parents, | 279 | clk = clk_register_mux(NULL, "ddr_clk", ddr_parents, |
281 | ARRAY_SIZE(ddr_parents), | 280 | ARRAY_SIZE(ddr_parents), 0, PLL_CLK_CFG, MCTR_CLK_SHIFT, |
282 | 0, PLL_CLK_CFG, MCTR_CLK_SHIFT, MCTR_CLK_MASK, 0, | 281 | MCTR_CLK_MASK, 0, &_lock); |
283 | &_lock); | ||
284 | clk_register_clkdev(clk, "ddr_clk", NULL); | 282 | clk_register_clkdev(clk, "ddr_clk", NULL); |
285 | 283 | ||
286 | clk = clk_register_divider(NULL, "apb_clk", "ahb_clk", | 284 | clk = clk_register_divider(NULL, "apb_clk", "ahb_clk", |
@@ -298,7 +296,7 @@ void __init spear6xx_clk_init(void) | |||
298 | 296 | ||
299 | clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0, PERIP1_CLK_ENB, | 297 | clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0, PERIP1_CLK_ENB, |
300 | GMAC_CLK_ENB, 0, &_lock); | 298 | GMAC_CLK_ENB, 0, &_lock); |
301 | clk_register_clkdev(clk, NULL, "gmac"); | 299 | clk_register_clkdev(clk, NULL, "e0800000.ethernet"); |
302 | 300 | ||
303 | clk = clk_register_gate(NULL, "i2c_clk", "ahb_clk", 0, PERIP1_CLK_ENB, | 301 | clk = clk_register_gate(NULL, "i2c_clk", "ahb_clk", 0, PERIP1_CLK_ENB, |
304 | I2C_CLK_ENB, 0, &_lock); | 302 | I2C_CLK_ENB, 0, &_lock); |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index c4067d0141f7..542f0c04b695 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -136,7 +136,7 @@ config GPIO_MPC8XXX | |||
136 | 136 | ||
137 | config GPIO_MSM_V1 | 137 | config GPIO_MSM_V1 |
138 | tristate "Qualcomm MSM GPIO v1" | 138 | tristate "Qualcomm MSM GPIO v1" |
139 | depends on GPIOLIB && ARCH_MSM | 139 | depends on GPIOLIB && ARCH_MSM && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50) |
140 | help | 140 | help |
141 | Say yes here to support the GPIO interface on ARM v6 based | 141 | Say yes here to support the GPIO interface on ARM v6 based |
142 | Qualcomm MSM chips. Most of the pins on the MSM can be | 142 | Qualcomm MSM chips. Most of the pins on the MSM can be |
diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c index 9e9947cb86a3..1077754f8289 100644 --- a/drivers/gpio/devres.c +++ b/drivers/gpio/devres.c | |||
@@ -98,6 +98,7 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio, | |||
98 | 98 | ||
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | EXPORT_SYMBOL(devm_gpio_request_one); | ||
101 | 102 | ||
102 | /** | 103 | /** |
103 | * devm_gpio_free - free an interrupt | 104 | * devm_gpio_free - free an interrupt |
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index c337143b18f8..c89c4c1e668d 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c | |||
@@ -398,10 +398,12 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
398 | writel(~0, port->base + GPIO_ISR); | 398 | writel(~0, port->base + GPIO_ISR); |
399 | 399 | ||
400 | if (mxc_gpio_hwtype == IMX21_GPIO) { | 400 | if (mxc_gpio_hwtype == IMX21_GPIO) { |
401 | /* setup one handler for all GPIO interrupts */ | 401 | /* |
402 | if (pdev->id == 0) | 402 | * Setup one handler for all GPIO interrupts. Actually setting |
403 | irq_set_chained_handler(port->irq, | 403 | * the handler is needed only once, but doing it for every port |
404 | mx2_gpio_irq_handler); | 404 | * is more robust and easier. |
405 | */ | ||
406 | irq_set_chained_handler(port->irq, mx2_gpio_irq_handler); | ||
405 | } else { | 407 | } else { |
406 | /* setup one handler for each entry */ | 408 | /* setup one handler for each entry */ |
407 | irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); | 409 | irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c4ed1722734c..4fbc208c32cf 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -174,12 +174,22 @@ static inline void _gpio_dbck_enable(struct gpio_bank *bank) | |||
174 | if (bank->dbck_enable_mask && !bank->dbck_enabled) { | 174 | if (bank->dbck_enable_mask && !bank->dbck_enabled) { |
175 | clk_enable(bank->dbck); | 175 | clk_enable(bank->dbck); |
176 | bank->dbck_enabled = true; | 176 | bank->dbck_enabled = true; |
177 | |||
178 | __raw_writel(bank->dbck_enable_mask, | ||
179 | bank->base + bank->regs->debounce_en); | ||
177 | } | 180 | } |
178 | } | 181 | } |
179 | 182 | ||
180 | static inline void _gpio_dbck_disable(struct gpio_bank *bank) | 183 | static inline void _gpio_dbck_disable(struct gpio_bank *bank) |
181 | { | 184 | { |
182 | if (bank->dbck_enable_mask && bank->dbck_enabled) { | 185 | if (bank->dbck_enable_mask && bank->dbck_enabled) { |
186 | /* | ||
187 | * Disable debounce before cutting it's clock. If debounce is | ||
188 | * enabled but the clock is not, GPIO module seems to be unable | ||
189 | * to detect events and generate interrupts at least on OMAP3. | ||
190 | */ | ||
191 | __raw_writel(0, bank->base + bank->regs->debounce_en); | ||
192 | |||
183 | clk_disable(bank->dbck); | 193 | clk_disable(bank->dbck); |
184 | bank->dbck_enabled = false; | 194 | bank->dbck_enabled = false; |
185 | } | 195 | } |
@@ -1081,7 +1091,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
1081 | bank->is_mpuio = pdata->is_mpuio; | 1091 | bank->is_mpuio = pdata->is_mpuio; |
1082 | bank->non_wakeup_gpios = pdata->non_wakeup_gpios; | 1092 | bank->non_wakeup_gpios = pdata->non_wakeup_gpios; |
1083 | bank->loses_context = pdata->loses_context; | 1093 | bank->loses_context = pdata->loses_context; |
1084 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
1085 | bank->regs = pdata->regs; | 1094 | bank->regs = pdata->regs; |
1086 | #ifdef CONFIG_OF_GPIO | 1095 | #ifdef CONFIG_OF_GPIO |
1087 | bank->chip.of_node = of_node_get(node); | 1096 | bank->chip.of_node = of_node_get(node); |
@@ -1135,6 +1144,9 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
1135 | omap_gpio_chip_init(bank); | 1144 | omap_gpio_chip_init(bank); |
1136 | omap_gpio_show_rev(bank); | 1145 | omap_gpio_show_rev(bank); |
1137 | 1146 | ||
1147 | if (bank->loses_context) | ||
1148 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
1149 | |||
1138 | pm_runtime_put(bank->dev); | 1150 | pm_runtime_put(bank->dev); |
1139 | 1151 | ||
1140 | list_add_tail(&bank->node, &omap_gpio_list); | 1152 | list_add_tail(&bank->node, &omap_gpio_list); |
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c index 38416be8ba11..6064fb376e11 100644 --- a/drivers/gpio/gpio-sta2x11.c +++ b/drivers/gpio/gpio-sta2x11.c | |||
@@ -383,8 +383,9 @@ static int __devinit gsta_probe(struct platform_device *dev) | |||
383 | } | 383 | } |
384 | spin_lock_init(&chip->lock); | 384 | spin_lock_init(&chip->lock); |
385 | gsta_gpio_setup(chip); | 385 | gsta_gpio_setup(chip); |
386 | for (i = 0; i < GSTA_NR_GPIO; i++) | 386 | if (gpio_pdata) |
387 | gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); | 387 | for (i = 0; i < GSTA_NR_GPIO; i++) |
388 | gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); | ||
388 | 389 | ||
389 | /* 384 was used in previous code: be compatible for other drivers */ | 390 | /* 384 was used in previous code: be compatible for other drivers */ |
390 | err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); | 391 | err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); |
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c index c1ad2884f2ed..11f29c82253c 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c | |||
@@ -149,6 +149,9 @@ static int __devinit tps65910_gpio_probe(struct platform_device *pdev) | |||
149 | tps65910_gpio->gpio_chip.set = tps65910_gpio_set; | 149 | tps65910_gpio->gpio_chip.set = tps65910_gpio_set; |
150 | tps65910_gpio->gpio_chip.get = tps65910_gpio_get; | 150 | tps65910_gpio->gpio_chip.get = tps65910_gpio_get; |
151 | tps65910_gpio->gpio_chip.dev = &pdev->dev; | 151 | tps65910_gpio->gpio_chip.dev = &pdev->dev; |
152 | #ifdef CONFIG_OF_GPIO | ||
153 | tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node; | ||
154 | #endif | ||
152 | if (pdata && pdata->gpio_base) | 155 | if (pdata && pdata->gpio_base) |
153 | tps65910_gpio->gpio_chip.base = pdata->gpio_base; | 156 | tps65910_gpio->gpio_chip.base = pdata->gpio_base; |
154 | else | 157 | else |
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c index 92ea5350dfe9..aa61ad2fcaaa 100644 --- a/drivers/gpio/gpio-wm8994.c +++ b/drivers/gpio/gpio-wm8994.c | |||
@@ -89,8 +89,11 @@ static int wm8994_gpio_direction_out(struct gpio_chip *chip, | |||
89 | struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); | 89 | struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); |
90 | struct wm8994 *wm8994 = wm8994_gpio->wm8994; | 90 | struct wm8994 *wm8994 = wm8994_gpio->wm8994; |
91 | 91 | ||
92 | if (value) | ||
93 | value = WM8994_GPN_LVL; | ||
94 | |||
92 | return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset, | 95 | return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset, |
93 | WM8994_GPN_DIR, 0); | 96 | WM8994_GPN_DIR | WM8994_GPN_LVL, value); |
94 | } | 97 | } |
95 | 98 | ||
96 | static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 99 | static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5873e481e5d2..a8743c399e83 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -1039,6 +1039,24 @@ mode_in_range(const struct drm_display_mode *mode, struct edid *edid, | |||
1039 | return true; | 1039 | return true; |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | static bool valid_inferred_mode(const struct drm_connector *connector, | ||
1043 | const struct drm_display_mode *mode) | ||
1044 | { | ||
1045 | struct drm_display_mode *m; | ||
1046 | bool ok = false; | ||
1047 | |||
1048 | list_for_each_entry(m, &connector->probed_modes, head) { | ||
1049 | if (mode->hdisplay == m->hdisplay && | ||
1050 | mode->vdisplay == m->vdisplay && | ||
1051 | drm_mode_vrefresh(mode) == drm_mode_vrefresh(m)) | ||
1052 | return false; /* duplicated */ | ||
1053 | if (mode->hdisplay <= m->hdisplay && | ||
1054 | mode->vdisplay <= m->vdisplay) | ||
1055 | ok = true; | ||
1056 | } | ||
1057 | return ok; | ||
1058 | } | ||
1059 | |||
1042 | static int | 1060 | static int |
1043 | drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, | 1061 | drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, |
1044 | struct detailed_timing *timing) | 1062 | struct detailed_timing *timing) |
@@ -1048,7 +1066,8 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
1048 | struct drm_device *dev = connector->dev; | 1066 | struct drm_device *dev = connector->dev; |
1049 | 1067 | ||
1050 | for (i = 0; i < drm_num_dmt_modes; i++) { | 1068 | for (i = 0; i < drm_num_dmt_modes; i++) { |
1051 | if (mode_in_range(drm_dmt_modes + i, edid, timing)) { | 1069 | if (mode_in_range(drm_dmt_modes + i, edid, timing) && |
1070 | valid_inferred_mode(connector, drm_dmt_modes + i)) { | ||
1052 | newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); | 1071 | newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); |
1053 | if (newmode) { | 1072 | if (newmode) { |
1054 | drm_mode_probed_add(connector, newmode); | 1073 | drm_mode_probed_add(connector, newmode); |
@@ -1088,7 +1107,8 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
1088 | return modes; | 1107 | return modes; |
1089 | 1108 | ||
1090 | fixup_mode_1366x768(newmode); | 1109 | fixup_mode_1366x768(newmode); |
1091 | if (!mode_in_range(newmode, edid, timing)) { | 1110 | if (!mode_in_range(newmode, edid, timing) || |
1111 | !valid_inferred_mode(connector, newmode)) { | ||
1092 | drm_mode_destroy(dev, newmode); | 1112 | drm_mode_destroy(dev, newmode); |
1093 | continue; | 1113 | continue; |
1094 | } | 1114 | } |
@@ -1116,7 +1136,8 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
1116 | return modes; | 1136 | return modes; |
1117 | 1137 | ||
1118 | fixup_mode_1366x768(newmode); | 1138 | fixup_mode_1366x768(newmode); |
1119 | if (!mode_in_range(newmode, edid, timing)) { | 1139 | if (!mode_in_range(newmode, edid, timing) || |
1140 | !valid_inferred_mode(connector, newmode)) { | ||
1120 | drm_mode_destroy(dev, newmode); | 1141 | drm_mode_destroy(dev, newmode); |
1121 | continue; | 1142 | continue; |
1122 | } | 1143 | } |
diff --git a/drivers/gpu/drm/gma500/cdv_device.c b/drivers/gpu/drm/gma500/cdv_device.c index 9764045428ce..b7e7b49d8f62 100644 --- a/drivers/gpu/drm/gma500/cdv_device.c +++ b/drivers/gpu/drm/gma500/cdv_device.c | |||
@@ -78,21 +78,6 @@ static int cdv_backlight_combination_mode(struct drm_device *dev) | |||
78 | return REG_READ(BLC_PWM_CTL2) & PWM_LEGACY_MODE; | 78 | return REG_READ(BLC_PWM_CTL2) & PWM_LEGACY_MODE; |
79 | } | 79 | } |
80 | 80 | ||
81 | static int cdv_get_brightness(struct backlight_device *bd) | ||
82 | { | ||
83 | struct drm_device *dev = bl_get_data(bd); | ||
84 | u32 val = REG_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | ||
85 | |||
86 | if (cdv_backlight_combination_mode(dev)) { | ||
87 | u8 lbpc; | ||
88 | |||
89 | val &= ~1; | ||
90 | pci_read_config_byte(dev->pdev, 0xF4, &lbpc); | ||
91 | val *= lbpc; | ||
92 | } | ||
93 | return val; | ||
94 | } | ||
95 | |||
96 | static u32 cdv_get_max_backlight(struct drm_device *dev) | 81 | static u32 cdv_get_max_backlight(struct drm_device *dev) |
97 | { | 82 | { |
98 | u32 max = REG_READ(BLC_PWM_CTL); | 83 | u32 max = REG_READ(BLC_PWM_CTL); |
@@ -110,6 +95,22 @@ static u32 cdv_get_max_backlight(struct drm_device *dev) | |||
110 | return max; | 95 | return max; |
111 | } | 96 | } |
112 | 97 | ||
98 | static int cdv_get_brightness(struct backlight_device *bd) | ||
99 | { | ||
100 | struct drm_device *dev = bl_get_data(bd); | ||
101 | u32 val = REG_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | ||
102 | |||
103 | if (cdv_backlight_combination_mode(dev)) { | ||
104 | u8 lbpc; | ||
105 | |||
106 | val &= ~1; | ||
107 | pci_read_config_byte(dev->pdev, 0xF4, &lbpc); | ||
108 | val *= lbpc; | ||
109 | } | ||
110 | return (val * 100)/cdv_get_max_backlight(dev); | ||
111 | |||
112 | } | ||
113 | |||
113 | static int cdv_set_brightness(struct backlight_device *bd) | 114 | static int cdv_set_brightness(struct backlight_device *bd) |
114 | { | 115 | { |
115 | struct drm_device *dev = bl_get_data(bd); | 116 | struct drm_device *dev = bl_get_data(bd); |
@@ -120,6 +121,9 @@ static int cdv_set_brightness(struct backlight_device *bd) | |||
120 | if (level < 1) | 121 | if (level < 1) |
121 | level = 1; | 122 | level = 1; |
122 | 123 | ||
124 | level *= cdv_get_max_backlight(dev); | ||
125 | level /= 100; | ||
126 | |||
123 | if (cdv_backlight_combination_mode(dev)) { | 127 | if (cdv_backlight_combination_mode(dev)) { |
124 | u32 max = cdv_get_max_backlight(dev); | 128 | u32 max = cdv_get_max_backlight(dev); |
125 | u8 lbpc; | 129 | u8 lbpc; |
@@ -157,7 +161,6 @@ static int cdv_backlight_init(struct drm_device *dev) | |||
157 | 161 | ||
158 | cdv_backlight_device->props.brightness = | 162 | cdv_backlight_device->props.brightness = |
159 | cdv_get_brightness(cdv_backlight_device); | 163 | cdv_get_brightness(cdv_backlight_device); |
160 | cdv_backlight_device->props.max_brightness = cdv_get_max_backlight(dev); | ||
161 | backlight_update_status(cdv_backlight_device); | 164 | backlight_update_status(cdv_backlight_device); |
162 | dev_priv->backlight_device = cdv_backlight_device; | 165 | dev_priv->backlight_device = cdv_backlight_device; |
163 | return 0; | 166 | return 0; |
diff --git a/drivers/gpu/drm/gma500/opregion.c b/drivers/gpu/drm/gma500/opregion.c index 4f186eca3a30..c430bd424681 100644 --- a/drivers/gpu/drm/gma500/opregion.c +++ b/drivers/gpu/drm/gma500/opregion.c | |||
@@ -144,6 +144,8 @@ struct opregion_asle { | |||
144 | 144 | ||
145 | #define ASLE_CBLV_VALID (1<<31) | 145 | #define ASLE_CBLV_VALID (1<<31) |
146 | 146 | ||
147 | static struct psb_intel_opregion *system_opregion; | ||
148 | |||
147 | static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) | 149 | static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) |
148 | { | 150 | { |
149 | struct drm_psb_private *dev_priv = dev->dev_private; | 151 | struct drm_psb_private *dev_priv = dev->dev_private; |
@@ -205,7 +207,7 @@ void psb_intel_opregion_enable_asle(struct drm_device *dev) | |||
205 | struct drm_psb_private *dev_priv = dev->dev_private; | 207 | struct drm_psb_private *dev_priv = dev->dev_private; |
206 | struct opregion_asle *asle = dev_priv->opregion.asle; | 208 | struct opregion_asle *asle = dev_priv->opregion.asle; |
207 | 209 | ||
208 | if (asle) { | 210 | if (asle && system_opregion ) { |
209 | /* Don't do this on Medfield or other non PC like devices, they | 211 | /* Don't do this on Medfield or other non PC like devices, they |
210 | use the bit for something different altogether */ | 212 | use the bit for something different altogether */ |
211 | psb_enable_pipestat(dev_priv, 0, PIPE_LEGACY_BLC_EVENT_ENABLE); | 213 | psb_enable_pipestat(dev_priv, 0, PIPE_LEGACY_BLC_EVENT_ENABLE); |
@@ -221,7 +223,6 @@ void psb_intel_opregion_enable_asle(struct drm_device *dev) | |||
221 | #define ACPI_EV_LID (1<<1) | 223 | #define ACPI_EV_LID (1<<1) |
222 | #define ACPI_EV_DOCK (1<<2) | 224 | #define ACPI_EV_DOCK (1<<2) |
223 | 225 | ||
224 | static struct psb_intel_opregion *system_opregion; | ||
225 | 226 | ||
226 | static int psb_intel_opregion_video_event(struct notifier_block *nb, | 227 | static int psb_intel_opregion_video_event(struct notifier_block *nb, |
227 | unsigned long val, void *data) | 228 | unsigned long val, void *data) |
@@ -266,9 +267,6 @@ void psb_intel_opregion_init(struct drm_device *dev) | |||
266 | system_opregion = opregion; | 267 | system_opregion = opregion; |
267 | register_acpi_notifier(&psb_intel_opregion_notifier); | 268 | register_acpi_notifier(&psb_intel_opregion_notifier); |
268 | } | 269 | } |
269 | |||
270 | if (opregion->asle) | ||
271 | psb_intel_opregion_enable_asle(dev); | ||
272 | } | 270 | } |
273 | 271 | ||
274 | void psb_intel_opregion_fini(struct drm_device *dev) | 272 | void psb_intel_opregion_fini(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/gma500/opregion.h b/drivers/gpu/drm/gma500/opregion.h index 72dc6b921265..4a90f8b0e16c 100644 --- a/drivers/gpu/drm/gma500/opregion.h +++ b/drivers/gpu/drm/gma500/opregion.h | |||
@@ -27,6 +27,7 @@ extern void psb_intel_opregion_asle_intr(struct drm_device *dev); | |||
27 | extern void psb_intel_opregion_init(struct drm_device *dev); | 27 | extern void psb_intel_opregion_init(struct drm_device *dev); |
28 | extern void psb_intel_opregion_fini(struct drm_device *dev); | 28 | extern void psb_intel_opregion_fini(struct drm_device *dev); |
29 | extern int psb_intel_opregion_setup(struct drm_device *dev); | 29 | extern int psb_intel_opregion_setup(struct drm_device *dev); |
30 | extern void psb_intel_opregion_enable_asle(struct drm_device *dev); | ||
30 | 31 | ||
31 | #else | 32 | #else |
32 | 33 | ||
@@ -46,4 +47,8 @@ extern inline int psb_intel_opregion_setup(struct drm_device *dev) | |||
46 | { | 47 | { |
47 | return 0; | 48 | return 0; |
48 | } | 49 | } |
50 | |||
51 | extern inline void psb_intel_opregion_enable_asle(struct drm_device *dev) | ||
52 | { | ||
53 | } | ||
49 | #endif | 54 | #endif |
diff --git a/drivers/gpu/drm/gma500/psb_device.c b/drivers/gpu/drm/gma500/psb_device.c index eff039bf92d4..5971bc82b765 100644 --- a/drivers/gpu/drm/gma500/psb_device.c +++ b/drivers/gpu/drm/gma500/psb_device.c | |||
@@ -144,6 +144,10 @@ static int psb_backlight_init(struct drm_device *dev) | |||
144 | psb_backlight_device->props.max_brightness = 100; | 144 | psb_backlight_device->props.max_brightness = 100; |
145 | backlight_update_status(psb_backlight_device); | 145 | backlight_update_status(psb_backlight_device); |
146 | dev_priv->backlight_device = psb_backlight_device; | 146 | dev_priv->backlight_device = psb_backlight_device; |
147 | |||
148 | /* This must occur after the backlight is properly initialised */ | ||
149 | psb_lid_timer_init(dev_priv); | ||
150 | |||
147 | return 0; | 151 | return 0; |
148 | } | 152 | } |
149 | 153 | ||
@@ -354,13 +358,6 @@ static int psb_chip_setup(struct drm_device *dev) | |||
354 | return 0; | 358 | return 0; |
355 | } | 359 | } |
356 | 360 | ||
357 | /* Not exactly an erratum more an irritation */ | ||
358 | static void psb_chip_errata(struct drm_device *dev) | ||
359 | { | ||
360 | struct drm_psb_private *dev_priv = dev->dev_private; | ||
361 | psb_lid_timer_init(dev_priv); | ||
362 | } | ||
363 | |||
364 | static void psb_chip_teardown(struct drm_device *dev) | 361 | static void psb_chip_teardown(struct drm_device *dev) |
365 | { | 362 | { |
366 | struct drm_psb_private *dev_priv = dev->dev_private; | 363 | struct drm_psb_private *dev_priv = dev->dev_private; |
@@ -379,7 +376,6 @@ const struct psb_ops psb_chip_ops = { | |||
379 | .sgx_offset = PSB_SGX_OFFSET, | 376 | .sgx_offset = PSB_SGX_OFFSET, |
380 | .chip_setup = psb_chip_setup, | 377 | .chip_setup = psb_chip_setup, |
381 | .chip_teardown = psb_chip_teardown, | 378 | .chip_teardown = psb_chip_teardown, |
382 | .errata = psb_chip_errata, | ||
383 | 379 | ||
384 | .crtc_helper = &psb_intel_helper_funcs, | 380 | .crtc_helper = &psb_intel_helper_funcs, |
385 | .crtc_funcs = &psb_intel_crtc_funcs, | 381 | .crtc_funcs = &psb_intel_crtc_funcs, |
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index caba6e08693c..a8858a907f47 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c | |||
@@ -374,6 +374,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) | |||
374 | 374 | ||
375 | if (ret) | 375 | if (ret) |
376 | return ret; | 376 | return ret; |
377 | psb_intel_opregion_enable_asle(dev); | ||
377 | #if 0 | 378 | #if 0 |
378 | /*enable runtime pm at last*/ | 379 | /*enable runtime pm at last*/ |
379 | pm_runtime_enable(&dev->pdev->dev); | 380 | pm_runtime_enable(&dev->pdev->dev); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index f94792626b94..36822b924eb1 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1401,6 +1401,27 @@ i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base, | |||
1401 | } | 1401 | } |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) | ||
1405 | { | ||
1406 | struct apertures_struct *ap; | ||
1407 | struct pci_dev *pdev = dev_priv->dev->pdev; | ||
1408 | bool primary; | ||
1409 | |||
1410 | ap = alloc_apertures(1); | ||
1411 | if (!ap) | ||
1412 | return; | ||
1413 | |||
1414 | ap->ranges[0].base = dev_priv->dev->agp->base; | ||
1415 | ap->ranges[0].size = | ||
1416 | dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | ||
1417 | primary = | ||
1418 | pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | ||
1419 | |||
1420 | remove_conflicting_framebuffers(ap, "inteldrmfb", primary); | ||
1421 | |||
1422 | kfree(ap); | ||
1423 | } | ||
1424 | |||
1404 | /** | 1425 | /** |
1405 | * i915_driver_load - setup chip and create an initial config | 1426 | * i915_driver_load - setup chip and create an initial config |
1406 | * @dev: DRM device | 1427 | * @dev: DRM device |
@@ -1446,6 +1467,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1446 | goto free_priv; | 1467 | goto free_priv; |
1447 | } | 1468 | } |
1448 | 1469 | ||
1470 | dev_priv->mm.gtt = intel_gtt_get(); | ||
1471 | if (!dev_priv->mm.gtt) { | ||
1472 | DRM_ERROR("Failed to initialize GTT\n"); | ||
1473 | ret = -ENODEV; | ||
1474 | goto put_bridge; | ||
1475 | } | ||
1476 | |||
1477 | i915_kick_out_firmware_fb(dev_priv); | ||
1478 | |||
1449 | pci_set_master(dev->pdev); | 1479 | pci_set_master(dev->pdev); |
1450 | 1480 | ||
1451 | /* overlay on gen2 is broken and can't address above 1G */ | 1481 | /* overlay on gen2 is broken and can't address above 1G */ |
@@ -1471,13 +1501,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1471 | goto put_bridge; | 1501 | goto put_bridge; |
1472 | } | 1502 | } |
1473 | 1503 | ||
1474 | dev_priv->mm.gtt = intel_gtt_get(); | ||
1475 | if (!dev_priv->mm.gtt) { | ||
1476 | DRM_ERROR("Failed to initialize GTT\n"); | ||
1477 | ret = -ENODEV; | ||
1478 | goto out_rmmap; | ||
1479 | } | ||
1480 | |||
1481 | aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | 1504 | aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; |
1482 | 1505 | ||
1483 | dev_priv->mm.gtt_mapping = | 1506 | dev_priv->mm.gtt_mapping = |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index b1fe0edda955..ed3224c37423 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -412,7 +412,6 @@ static void gen6_queue_rps_work(struct drm_i915_private *dev_priv, | |||
412 | */ | 412 | */ |
413 | 413 | ||
414 | spin_lock_irqsave(&dev_priv->rps_lock, flags); | 414 | spin_lock_irqsave(&dev_priv->rps_lock, flags); |
415 | WARN(dev_priv->pm_iir & pm_iir, "Missed a PM interrupt\n"); | ||
416 | dev_priv->pm_iir |= pm_iir; | 415 | dev_priv->pm_iir |= pm_iir; |
417 | I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir); | 416 | I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir); |
418 | POSTING_READ(GEN6_PMIMR); | 417 | POSTING_READ(GEN6_PMIMR); |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 0ede02a99d91..a748e5cabe14 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -740,8 +740,11 @@ static void i915_restore_display(struct drm_device *dev) | |||
740 | if (HAS_PCH_SPLIT(dev)) { | 740 | if (HAS_PCH_SPLIT(dev)) { |
741 | I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL); | 741 | I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL); |
742 | I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2); | 742 | I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2); |
743 | I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL); | 743 | /* NOTE: BLC_PWM_CPU_CTL must be written after BLC_PWM_CPU_CTL2; |
744 | * otherwise we get blank eDP screen after S3 on some machines | ||
745 | */ | ||
744 | I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2); | 746 | I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2); |
747 | I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL); | ||
745 | I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); | 748 | I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); |
746 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | 749 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); |
747 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); | 750 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index a7c727d0c105..a8538ac0299d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -6921,19 +6921,6 @@ static void i915_disable_vga(struct drm_device *dev) | |||
6921 | POSTING_READ(vga_reg); | 6921 | POSTING_READ(vga_reg); |
6922 | } | 6922 | } |
6923 | 6923 | ||
6924 | static void ivb_pch_pwm_override(struct drm_device *dev) | ||
6925 | { | ||
6926 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
6927 | |||
6928 | /* | ||
6929 | * IVB has CPU eDP backlight regs too, set things up to let the | ||
6930 | * PCH regs control the backlight | ||
6931 | */ | ||
6932 | I915_WRITE(BLC_PWM_CPU_CTL2, PWM_ENABLE); | ||
6933 | I915_WRITE(BLC_PWM_CPU_CTL, 0); | ||
6934 | I915_WRITE(BLC_PWM_PCH_CTL1, PWM_ENABLE | (1<<30)); | ||
6935 | } | ||
6936 | |||
6937 | void intel_modeset_init_hw(struct drm_device *dev) | 6924 | void intel_modeset_init_hw(struct drm_device *dev) |
6938 | { | 6925 | { |
6939 | struct drm_i915_private *dev_priv = dev->dev_private; | 6926 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -6950,9 +6937,6 @@ void intel_modeset_init_hw(struct drm_device *dev) | |||
6950 | gen6_enable_rps(dev_priv); | 6937 | gen6_enable_rps(dev_priv); |
6951 | gen6_update_ring_freq(dev_priv); | 6938 | gen6_update_ring_freq(dev_priv); |
6952 | } | 6939 | } |
6953 | |||
6954 | if (IS_IVYBRIDGE(dev)) | ||
6955 | ivb_pch_pwm_override(dev); | ||
6956 | } | 6940 | } |
6957 | 6941 | ||
6958 | void intel_modeset_init(struct drm_device *dev) | 6942 | void intel_modeset_init(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 153b9a15469b..1074bc5dd418 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -467,7 +467,7 @@ int nouveau_fbcon_init(struct drm_device *dev) | |||
467 | nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; | 467 | nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; |
468 | 468 | ||
469 | ret = drm_fb_helper_init(dev, &nfbdev->helper, | 469 | ret = drm_fb_helper_init(dev, &nfbdev->helper, |
470 | nv_two_heads(dev) ? 2 : 1, 4); | 470 | dev->mode_config.num_crtc, 4); |
471 | if (ret) { | 471 | if (ret) { |
472 | kfree(nfbdev); | 472 | kfree(nfbdev); |
473 | return ret; | 473 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c index a89240e5fb29..a25cf2cb931f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c | |||
@@ -1,3 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Dave Airlie | ||
23 | */ | ||
1 | 24 | ||
2 | #include "drmP.h" | 25 | #include "drmP.h" |
3 | #include "drm.h" | 26 | #include "drm.h" |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 59d44937dd9f..84b648a7ddd8 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -289,8 +289,9 @@ int radeon_vm_manager_init(struct radeon_device *rdev) | |||
289 | rdev->vm_manager.enabled = false; | 289 | rdev->vm_manager.enabled = false; |
290 | 290 | ||
291 | /* mark first vm as always in use, it's the system one */ | 291 | /* mark first vm as always in use, it's the system one */ |
292 | /* allocate enough for 2 full VM pts */ | ||
292 | r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, | 293 | r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, |
293 | rdev->vm_manager.max_pfn * 8, | 294 | rdev->vm_manager.max_pfn * 8 * 2, |
294 | RADEON_GEM_DOMAIN_VRAM); | 295 | RADEON_GEM_DOMAIN_VRAM); |
295 | if (r) { | 296 | if (r) { |
296 | dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", | 297 | dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", |
@@ -633,7 +634,15 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
633 | mutex_init(&vm->mutex); | 634 | mutex_init(&vm->mutex); |
634 | INIT_LIST_HEAD(&vm->list); | 635 | INIT_LIST_HEAD(&vm->list); |
635 | INIT_LIST_HEAD(&vm->va); | 636 | INIT_LIST_HEAD(&vm->va); |
636 | vm->last_pfn = 0; | 637 | /* SI requires equal sized PTs for all VMs, so always set |
638 | * last_pfn to max_pfn. cayman allows variable sized | ||
639 | * pts so we can grow then as needed. Once we switch | ||
640 | * to two level pts we can unify this again. | ||
641 | */ | ||
642 | if (rdev->family >= CHIP_TAHITI) | ||
643 | vm->last_pfn = rdev->vm_manager.max_pfn; | ||
644 | else | ||
645 | vm->last_pfn = 0; | ||
637 | /* map the ib pool buffer at 0 in virtual address space, set | 646 | /* map the ib pool buffer at 0 in virtual address space, set |
638 | * read only | 647 | * read only |
639 | */ | 648 | */ |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index f28bd4b7ef98..21ec9f5653ce 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -292,6 +292,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
292 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | 292 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
293 | struct drm_file *filp) | 293 | struct drm_file *filp) |
294 | { | 294 | { |
295 | struct radeon_device *rdev = dev->dev_private; | ||
295 | struct drm_radeon_gem_busy *args = data; | 296 | struct drm_radeon_gem_busy *args = data; |
296 | struct drm_gem_object *gobj; | 297 | struct drm_gem_object *gobj; |
297 | struct radeon_bo *robj; | 298 | struct radeon_bo *robj; |
@@ -317,13 +318,14 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
317 | break; | 318 | break; |
318 | } | 319 | } |
319 | drm_gem_object_unreference_unlocked(gobj); | 320 | drm_gem_object_unreference_unlocked(gobj); |
320 | r = radeon_gem_handle_lockup(robj->rdev, r); | 321 | r = radeon_gem_handle_lockup(rdev, r); |
321 | return r; | 322 | return r; |
322 | } | 323 | } |
323 | 324 | ||
324 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | 325 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, |
325 | struct drm_file *filp) | 326 | struct drm_file *filp) |
326 | { | 327 | { |
328 | struct radeon_device *rdev = dev->dev_private; | ||
327 | struct drm_radeon_gem_wait_idle *args = data; | 329 | struct drm_radeon_gem_wait_idle *args = data; |
328 | struct drm_gem_object *gobj; | 330 | struct drm_gem_object *gobj; |
329 | struct radeon_bo *robj; | 331 | struct radeon_bo *robj; |
@@ -336,10 +338,10 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
336 | robj = gem_to_radeon_bo(gobj); | 338 | robj = gem_to_radeon_bo(gobj); |
337 | r = radeon_bo_wait(robj, NULL, false); | 339 | r = radeon_bo_wait(robj, NULL, false); |
338 | /* callback hw specific functions if any */ | 340 | /* callback hw specific functions if any */ |
339 | if (robj->rdev->asic->ioctl_wait_idle) | 341 | if (rdev->asic->ioctl_wait_idle) |
340 | robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); | 342 | robj->rdev->asic->ioctl_wait_idle(rdev, robj); |
341 | drm_gem_object_unreference_unlocked(gobj); | 343 | drm_gem_object_unreference_unlocked(gobj); |
342 | r = radeon_gem_handle_lockup(robj->rdev, r); | 344 | r = radeon_gem_handle_lockup(rdev, r); |
343 | return r; | 345 | return r; |
344 | } | 346 | } |
345 | 347 | ||
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index c7b61f16ecfd..0b0279291a73 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2365,12 +2365,12 @@ int si_pcie_gart_enable(struct radeon_device *rdev) | |||
2365 | WREG32(0x15DC, 0); | 2365 | WREG32(0x15DC, 0); |
2366 | 2366 | ||
2367 | /* empty context1-15 */ | 2367 | /* empty context1-15 */ |
2368 | /* FIXME start with 1G, once using 2 level pt switch to full | 2368 | /* FIXME start with 4G, once using 2 level pt switch to full |
2369 | * vm size space | 2369 | * vm size space |
2370 | */ | 2370 | */ |
2371 | /* set vm size, must be a multiple of 4 */ | 2371 | /* set vm size, must be a multiple of 4 */ |
2372 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); | 2372 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
2373 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, (1 << 30) / RADEON_GPU_PAGE_SIZE); | 2373 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); |
2374 | for (i = 1; i < 16; i++) { | 2374 | for (i = 1; i < 16; i++) { |
2375 | if (i < 8) | 2375 | if (i < 8) |
2376 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), | 2376 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index a8d5f09428c7..4c2d836a0893 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c | |||
@@ -61,7 +61,7 @@ static int udl_parse_vendor_descriptor(struct drm_device *dev, | |||
61 | u8 length; | 61 | u8 length; |
62 | u16 key; | 62 | u16 key; |
63 | 63 | ||
64 | key = *((u16 *) desc); | 64 | key = le16_to_cpu(*((u16 *) desc)); |
65 | desc += sizeof(u16); | 65 | desc += sizeof(u16); |
66 | length = *desc; | 66 | length = *desc; |
67 | desc++; | 67 | desc++; |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index bef04c192768..00445bc3019c 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -193,10 +193,12 @@ config HID_EZKEY | |||
193 | Support for Ezkey BTC 8193 keyboard. | 193 | Support for Ezkey BTC 8193 keyboard. |
194 | 194 | ||
195 | config HID_HOLTEK | 195 | config HID_HOLTEK |
196 | tristate "Holtek On Line Grip based game controller support" | 196 | tristate "Holtek HID devices" |
197 | depends on USB_HID | 197 | depends on USB_HID |
198 | ---help--- | 198 | ---help--- |
199 | Say Y here if you have a Holtek On Line Grip based game controller. | 199 | Support for Holtek based devices: |
200 | - Holtek On Line Grip based game controller | ||
201 | - Trust GXT 18 Gaming Keyboard | ||
200 | 202 | ||
201 | config HOLTEK_FF | 203 | config HOLTEK_FF |
202 | bool "Holtek On Line Grip force feedback support" | 204 | bool "Holtek On Line Grip force feedback support" |
@@ -261,6 +263,19 @@ config HID_LCPOWER | |||
261 | ---help--- | 263 | ---help--- |
262 | Support for LC-Power RC1000MCE RF remote control. | 264 | Support for LC-Power RC1000MCE RF remote control. |
263 | 265 | ||
266 | config HID_LENOVO_TPKBD | ||
267 | tristate "Lenovo ThinkPad USB Keyboard with TrackPoint" | ||
268 | depends on USB_HID | ||
269 | select NEW_LEDS | ||
270 | select LEDS_CLASS | ||
271 | ---help--- | ||
272 | Support for the Lenovo ThinkPad USB Keyboard with TrackPoint. | ||
273 | |||
274 | Say Y here if you have a Lenovo ThinkPad USB Keyboard with TrackPoint | ||
275 | and would like to use device-specific features like changing the | ||
276 | sensitivity of the trackpoint, using the microphone mute button or | ||
277 | controlling the mute and microphone mute LEDs. | ||
278 | |||
264 | config HID_LOGITECH | 279 | config HID_LOGITECH |
265 | tristate "Logitech devices" if EXPERT | 280 | tristate "Logitech devices" if EXPERT |
266 | depends on USB_HID | 281 | depends on USB_HID |
@@ -386,6 +401,7 @@ config HID_MULTITOUCH | |||
386 | - Unitec Panels | 401 | - Unitec Panels |
387 | - XAT optical touch panels | 402 | - XAT optical touch panels |
388 | - Xiroku optical touch panels | 403 | - Xiroku optical touch panels |
404 | - Zytronic touch panels | ||
389 | 405 | ||
390 | If unsure, say N. | 406 | If unsure, say N. |
391 | 407 | ||
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index ca6cc9f0485c..02fa93896951 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
@@ -48,12 +48,14 @@ obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o | |||
48 | obj-$(CONFIG_HID_ELECOM) += hid-elecom.o | 48 | obj-$(CONFIG_HID_ELECOM) += hid-elecom.o |
49 | obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o | 49 | obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o |
50 | obj-$(CONFIG_HID_GYRATION) += hid-gyration.o | 50 | obj-$(CONFIG_HID_GYRATION) += hid-gyration.o |
51 | obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o | ||
51 | obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o | 52 | obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o |
52 | obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o | 53 | obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o |
53 | obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o | 54 | obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o |
54 | obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o | 55 | obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o |
55 | obj-$(CONFIG_HID_KYE) += hid-kye.o | 56 | obj-$(CONFIG_HID_KYE) += hid-kye.o |
56 | obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o | 57 | obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o |
58 | obj-$(CONFIG_HID_LENOVO_TPKBD) += hid-lenovo-tpkbd.o | ||
57 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o | 59 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o |
58 | obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o | 60 | obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o |
59 | obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o | 61 | obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o |
@@ -69,7 +71,8 @@ obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o | |||
69 | obj-$(CONFIG_HID_PRIMAX) += hid-primax.o | 71 | obj-$(CONFIG_HID_PRIMAX) += hid-primax.o |
70 | obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \ | 72 | obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \ |
71 | hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \ | 73 | hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \ |
72 | hid-roccat-koneplus.o hid-roccat-kovaplus.o hid-roccat-pyra.o | 74 | hid-roccat-koneplus.o hid-roccat-kovaplus.o hid-roccat-pyra.o \ |
75 | hid-roccat-savu.o | ||
73 | obj-$(CONFIG_HID_SAITEK) += hid-saitek.o | 76 | obj-$(CONFIG_HID_SAITEK) += hid-saitek.o |
74 | obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o | 77 | obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o |
75 | obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o | 78 | obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o |
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index fa10f847f7db..585344b6d338 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -517,6 +517,12 @@ static const struct hid_device_id apple_devices[] = { | |||
517 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | 517 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
518 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), | 518 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), |
519 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | 519 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
520 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), | ||
521 | .driver_data = APPLE_HAS_FN }, | ||
522 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), | ||
523 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | ||
524 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | ||
525 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | ||
520 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), | 526 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
521 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 527 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
522 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), | 528 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
diff --git a/drivers/hid/hid-chicony.c b/drivers/hid/hid-chicony.c index b99af346fdff..a2abb8e15727 100644 --- a/drivers/hid/hid-chicony.c +++ b/drivers/hid/hid-chicony.c | |||
@@ -60,6 +60,7 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
60 | static const struct hid_device_id ch_devices[] = { | 60 | static const struct hid_device_id ch_devices[] = { |
61 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, | 61 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
62 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, | 62 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
63 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, | ||
63 | { } | 64 | { } |
64 | }; | 65 | }; |
65 | MODULE_DEVICE_TABLE(hid, ch_devices); | 66 | MODULE_DEVICE_TABLE(hid, ch_devices); |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 6ac0286b5375..500844f04f93 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1194,8 +1194,10 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | |||
1194 | goto out; | 1194 | goto out; |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | for (a = 0; a < report->maxfield; a++) | 1197 | if (hid->claimed != HID_CLAIMED_HIDRAW) { |
1198 | hid_input_field(hid, report->field[a], cdata, interrupt); | 1198 | for (a = 0; a < report->maxfield; a++) |
1199 | hid_input_field(hid, report->field[a], cdata, interrupt); | ||
1200 | } | ||
1199 | 1201 | ||
1200 | if (hid->claimed & HID_CLAIMED_INPUT) | 1202 | if (hid->claimed & HID_CLAIMED_INPUT) |
1201 | hidinput_report_event(hid, report); | 1203 | hidinput_report_event(hid, report); |
@@ -1243,6 +1245,10 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
1243 | goto unlock; | 1245 | goto unlock; |
1244 | } | 1246 | } |
1245 | 1247 | ||
1248 | /* Avoid unnecessary overhead if debugfs is disabled */ | ||
1249 | if (list_empty(&hid->debug_list)) | ||
1250 | goto nomem; | ||
1251 | |||
1246 | buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); | 1252 | buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); |
1247 | 1253 | ||
1248 | if (!buf) | 1254 | if (!buf) |
@@ -1373,8 +1379,10 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) | |||
1373 | if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) | 1379 | if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) |
1374 | hdev->claimed |= HID_CLAIMED_HIDRAW; | 1380 | hdev->claimed |= HID_CLAIMED_HIDRAW; |
1375 | 1381 | ||
1376 | if (!hdev->claimed) { | 1382 | /* Drivers with the ->raw_event callback set are not required to connect |
1377 | hid_err(hdev, "claimed by neither input, hiddev nor hidraw\n"); | 1383 | * to any other listener. */ |
1384 | if (!hdev->claimed && !hdev->driver->raw_event) { | ||
1385 | hid_err(hdev, "device has no listeners, quitting\n"); | ||
1378 | return -ENODEV; | 1386 | return -ENODEV; |
1379 | } | 1387 | } |
1380 | 1388 | ||
@@ -1503,6 +1511,9 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1503 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, | 1511 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, |
1504 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, | 1512 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, |
1505 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, | 1513 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, |
1514 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | ||
1515 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | ||
1516 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | ||
1506 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, | 1517 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, |
1507 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, | 1518 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, |
1508 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1519 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
@@ -1518,10 +1529,12 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1518 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, | 1529 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
1519 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, | 1530 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, |
1520 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, | 1531 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
1532 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, | ||
1521 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | 1533 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, |
1522 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, | 1534 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
1523 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, | 1535 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, |
1524 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, | 1536 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, |
1537 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) }, | ||
1525 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, | 1538 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, |
1526 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, | 1539 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, |
1527 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, | 1540 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, |
@@ -1536,6 +1549,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1536 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, | 1549 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, |
1537 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, | 1550 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, |
1538 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, | 1551 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, |
1552 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, | ||
1539 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, | 1553 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, |
1540 | { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, | 1554 | { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, |
1541 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, | 1555 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, |
@@ -1544,6 +1558,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1544 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, | 1558 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
1545 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | 1559 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, |
1546 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, | 1560 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, |
1561 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, | ||
1547 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, | 1562 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, |
1548 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, | 1563 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, |
1549 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, | 1564 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, |
@@ -1617,6 +1632,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1617 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, | 1632 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, |
1618 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, | 1633 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, |
1619 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, | 1634 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, |
1635 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_SAVU) }, | ||
1620 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, | 1636 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, |
1621 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | 1637 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
1622 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, | 1638 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, |
@@ -1995,6 +2011,7 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1995 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, | 2011 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, |
1996 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, | 2012 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, |
1997 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, | 2013 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, |
2014 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, | ||
1998 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, | 2015 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, |
1999 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, | 2016 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
2000 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, | 2017 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
@@ -2089,6 +2106,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { | |||
2089 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, | 2106 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, |
2090 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, | 2107 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, |
2091 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, | 2108 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, |
2109 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | ||
2110 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | ||
2111 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | ||
2092 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 2112 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
2093 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 2113 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
2094 | { } | 2114 | { } |
diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c index 2f0be4c66af7..9e43aaca9774 100644 --- a/drivers/hid/hid-cypress.c +++ b/drivers/hid/hid-cypress.c | |||
@@ -129,6 +129,8 @@ static const struct hid_device_id cp_devices[] = { | |||
129 | .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, | 129 | .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, |
130 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3), | 130 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3), |
131 | .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, | 131 | .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, |
132 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4), | ||
133 | .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, | ||
132 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE), | 134 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE), |
133 | .driver_data = CP_2WHEEL_MOUSE_HACK }, | 135 | .driver_data = CP_2WHEEL_MOUSE_HACK }, |
134 | { } | 136 | { } |
diff --git a/drivers/hid/hid-holtek-kbd.c b/drivers/hid/hid-holtek-kbd.c new file mode 100644 index 000000000000..e0a5d1739fc3 --- /dev/null +++ b/drivers/hid/hid-holtek-kbd.c | |||
@@ -0,0 +1,183 @@ | |||
1 | /* | ||
2 | * HID driver for Holtek keyboard | ||
3 | * Copyright (c) 2012 Tom Harwood | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the Free | ||
9 | * Software Foundation; either version 2 of the License, or (at your option) | ||
10 | * any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/device.h> | ||
14 | #include <linux/hid.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/usb.h> | ||
17 | |||
18 | #include "hid-ids.h" | ||
19 | #include "usbhid/usbhid.h" | ||
20 | |||
21 | /* Holtek based keyboards (USB ID 04d9:a055) have the following issues: | ||
22 | * - The report descriptor specifies an excessively large number of consumer | ||
23 | * usages (2^15), which is more than HID_MAX_USAGES. This prevents proper | ||
24 | * parsing of the report descriptor. | ||
25 | * - The report descriptor reports on caps/scroll/num lock key presses, but | ||
26 | * doesn't have an LED output usage block. | ||
27 | * | ||
28 | * The replacement descriptor below fixes the number of consumer usages, | ||
29 | * and provides an LED output usage block. LED output events are redirected | ||
30 | * to the boot interface. | ||
31 | */ | ||
32 | |||
33 | static __u8 holtek_kbd_rdesc_fixed[] = { | ||
34 | /* Original report descriptor, with reduced number of consumer usages */ | ||
35 | 0x05, 0x01, /* Usage Page (Desktop), */ | ||
36 | 0x09, 0x80, /* Usage (Sys Control), */ | ||
37 | 0xA1, 0x01, /* Collection (Application), */ | ||
38 | 0x85, 0x01, /* Report ID (1), */ | ||
39 | 0x19, 0x81, /* Usage Minimum (Sys Power Down), */ | ||
40 | 0x29, 0x83, /* Usage Maximum (Sys Wake Up), */ | ||
41 | 0x15, 0x00, /* Logical Minimum (0), */ | ||
42 | 0x25, 0x01, /* Logical Maximum (1), */ | ||
43 | 0x95, 0x03, /* Report Count (3), */ | ||
44 | 0x75, 0x01, /* Report Size (1), */ | ||
45 | 0x81, 0x02, /* Input (Variable), */ | ||
46 | 0x95, 0x01, /* Report Count (1), */ | ||
47 | 0x75, 0x05, /* Report Size (5), */ | ||
48 | 0x81, 0x01, /* Input (Constant), */ | ||
49 | 0xC0, /* End Collection, */ | ||
50 | 0x05, 0x0C, /* Usage Page (Consumer), */ | ||
51 | 0x09, 0x01, /* Usage (Consumer Control), */ | ||
52 | 0xA1, 0x01, /* Collection (Application), */ | ||
53 | 0x85, 0x02, /* Report ID (2), */ | ||
54 | 0x19, 0x00, /* Usage Minimum (00h), */ | ||
55 | 0x2A, 0xFF, 0x2F, /* Usage Maximum (0x2FFF), previously 0x7FFF */ | ||
56 | 0x15, 0x00, /* Logical Minimum (0), */ | ||
57 | 0x26, 0xFF, 0x2F, /* Logical Maximum (0x2FFF),previously 0x7FFF*/ | ||
58 | 0x95, 0x01, /* Report Count (1), */ | ||
59 | 0x75, 0x10, /* Report Size (16), */ | ||
60 | 0x81, 0x00, /* Input, */ | ||
61 | 0xC0, /* End Collection, */ | ||
62 | 0x05, 0x01, /* Usage Page (Desktop), */ | ||
63 | 0x09, 0x06, /* Usage (Keyboard), */ | ||
64 | 0xA1, 0x01, /* Collection (Application), */ | ||
65 | 0x85, 0x03, /* Report ID (3), */ | ||
66 | 0x95, 0x38, /* Report Count (56), */ | ||
67 | 0x75, 0x01, /* Report Size (1), */ | ||
68 | 0x15, 0x00, /* Logical Minimum (0), */ | ||
69 | 0x25, 0x01, /* Logical Maximum (1), */ | ||
70 | 0x05, 0x07, /* Usage Page (Keyboard), */ | ||
71 | 0x19, 0xE0, /* Usage Minimum (KB Leftcontrol), */ | ||
72 | 0x29, 0xE7, /* Usage Maximum (KB Right GUI), */ | ||
73 | 0x19, 0x00, /* Usage Minimum (None), */ | ||
74 | 0x29, 0x2F, /* Usage Maximum (KB Lboxbracket And Lbrace),*/ | ||
75 | 0x81, 0x02, /* Input (Variable), */ | ||
76 | 0xC0, /* End Collection, */ | ||
77 | 0x05, 0x01, /* Usage Page (Desktop), */ | ||
78 | 0x09, 0x06, /* Usage (Keyboard), */ | ||
79 | 0xA1, 0x01, /* Collection (Application), */ | ||
80 | 0x85, 0x04, /* Report ID (4), */ | ||
81 | 0x95, 0x38, /* Report Count (56), */ | ||
82 | 0x75, 0x01, /* Report Size (1), */ | ||
83 | 0x15, 0x00, /* Logical Minimum (0), */ | ||
84 | 0x25, 0x01, /* Logical Maximum (1), */ | ||
85 | 0x05, 0x07, /* Usage Page (Keyboard), */ | ||
86 | 0x19, 0x30, /* Usage Minimum (KB Rboxbracket And Rbrace),*/ | ||
87 | 0x29, 0x67, /* Usage Maximum (KP Equals), */ | ||
88 | 0x81, 0x02, /* Input (Variable), */ | ||
89 | 0xC0, /* End Collection */ | ||
90 | |||
91 | /* LED usage for the boot protocol interface */ | ||
92 | 0x05, 0x01, /* Usage Page (Desktop), */ | ||
93 | 0x09, 0x06, /* Usage (Keyboard), */ | ||
94 | 0xA1, 0x01, /* Collection (Application), */ | ||
95 | 0x05, 0x08, /* Usage Page (LED), */ | ||
96 | 0x19, 0x01, /* Usage Minimum (01h), */ | ||
97 | 0x29, 0x03, /* Usage Maximum (03h), */ | ||
98 | 0x15, 0x00, /* Logical Minimum (0), */ | ||
99 | 0x25, 0x01, /* Logical Maximum (1), */ | ||
100 | 0x75, 0x01, /* Report Size (1), */ | ||
101 | 0x95, 0x03, /* Report Count (3), */ | ||
102 | 0x91, 0x02, /* Output (Variable), */ | ||
103 | 0x95, 0x05, /* Report Count (5), */ | ||
104 | 0x91, 0x01, /* Output (Constant), */ | ||
105 | 0xC0, /* End Collection */ | ||
106 | }; | ||
107 | |||
108 | static __u8 *holtek_kbd_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
109 | unsigned int *rsize) | ||
110 | { | ||
111 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
112 | |||
113 | if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { | ||
114 | rdesc = holtek_kbd_rdesc_fixed; | ||
115 | *rsize = sizeof(holtek_kbd_rdesc_fixed); | ||
116 | } | ||
117 | return rdesc; | ||
118 | } | ||
119 | |||
120 | static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type, | ||
121 | unsigned int code, | ||
122 | int value) | ||
123 | { | ||
124 | struct hid_device *hid = input_get_drvdata(dev); | ||
125 | struct usb_device *usb_dev = hid_to_usb_dev(hid); | ||
126 | |||
127 | /* Locate the boot interface, to receive the LED change events */ | ||
128 | struct usb_interface *boot_interface = usb_ifnum_to_if(usb_dev, 0); | ||
129 | |||
130 | struct hid_device *boot_hid = usb_get_intfdata(boot_interface); | ||
131 | struct hid_input *boot_hid_input = list_first_entry(&boot_hid->inputs, | ||
132 | struct hid_input, list); | ||
133 | |||
134 | return boot_hid_input->input->event(boot_hid_input->input, type, code, | ||
135 | value); | ||
136 | } | ||
137 | |||
138 | static int holtek_kbd_probe(struct hid_device *hdev, | ||
139 | const struct hid_device_id *id) | ||
140 | { | ||
141 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
142 | int ret = hid_parse(hdev); | ||
143 | |||
144 | if (!ret) | ||
145 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
146 | |||
147 | if (!ret && intf->cur_altsetting->desc.bInterfaceNumber == 1) { | ||
148 | struct hid_input *hidinput; | ||
149 | list_for_each_entry(hidinput, &hdev->inputs, list) { | ||
150 | hidinput->input->event = holtek_kbd_input_event; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | return ret; | ||
155 | } | ||
156 | |||
157 | static const struct hid_device_id holtek_kbd_devices[] = { | ||
158 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, | ||
159 | USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, | ||
160 | { } | ||
161 | }; | ||
162 | MODULE_DEVICE_TABLE(hid, holtek_kbd_devices); | ||
163 | |||
164 | static struct hid_driver holtek_kbd_driver = { | ||
165 | .name = "holtek_kbd", | ||
166 | .id_table = holtek_kbd_devices, | ||
167 | .report_fixup = holtek_kbd_report_fixup, | ||
168 | .probe = holtek_kbd_probe | ||
169 | }; | ||
170 | |||
171 | static int __init holtek_kbd_init(void) | ||
172 | { | ||
173 | return hid_register_driver(&holtek_kbd_driver); | ||
174 | } | ||
175 | |||
176 | static void __exit holtek_kbd_exit(void) | ||
177 | { | ||
178 | hid_unregister_driver(&holtek_kbd_driver); | ||
179 | } | ||
180 | |||
181 | module_exit(holtek_kbd_exit); | ||
182 | module_init(holtek_kbd_init); | ||
183 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index d1cdd2d28409..41c34f21bd00 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -125,6 +125,9 @@ | |||
125 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c | 125 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c |
126 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d | 126 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d |
127 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS 0x024e | 127 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS 0x024e |
128 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 | ||
129 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 | ||
130 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 | ||
128 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 | 131 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 |
129 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a | 132 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a |
130 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b | 133 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b |
@@ -205,6 +208,7 @@ | |||
205 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d | 208 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d |
206 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 | 209 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 |
207 | #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 | 210 | #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 |
211 | #define USB_DEVICE_ID_CHICONY_AK1D 0x1125 | ||
208 | 212 | ||
209 | #define USB_VENDOR_ID_CHUNGHWAT 0x2247 | 213 | #define USB_VENDOR_ID_CHUNGHWAT 0x2247 |
210 | #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 | 214 | #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 |
@@ -234,6 +238,7 @@ | |||
234 | #define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 | 238 | #define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 |
235 | #define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 | 239 | #define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 |
236 | #define USB_DEVICE_ID_CYPRESS_BARCODE_3 0xbca1 | 240 | #define USB_DEVICE_ID_CYPRESS_BARCODE_3 0xbca1 |
241 | #define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81 | ||
237 | #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001 | 242 | #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001 |
238 | 243 | ||
239 | #define USB_VENDOR_ID_DEALEXTREAME 0x10c5 | 244 | #define USB_VENDOR_ID_DEALEXTREAME 0x10c5 |
@@ -407,6 +412,9 @@ | |||
407 | #define USB_VENDOR_ID_HOLTEK 0x1241 | 412 | #define USB_VENDOR_ID_HOLTEK 0x1241 |
408 | #define USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP 0x5015 | 413 | #define USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP 0x5015 |
409 | 414 | ||
415 | #define USB_VENDOR_ID_HOLTEK_ALT 0x04d9 | ||
416 | #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 | ||
417 | |||
410 | #define USB_VENDOR_ID_IMATION 0x0718 | 418 | #define USB_VENDOR_ID_IMATION 0x0718 |
411 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 | 419 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 |
412 | 420 | ||
@@ -476,6 +484,9 @@ | |||
476 | #define USB_DEVICE_ID_LD_HYBRID 0x2090 | 484 | #define USB_DEVICE_ID_LD_HYBRID 0x2090 |
477 | #define USB_DEVICE_ID_LD_HEATCONTROL 0x20A0 | 485 | #define USB_DEVICE_ID_LD_HEATCONTROL 0x20A0 |
478 | 486 | ||
487 | #define USB_VENDOR_ID_LENOVO 0x17ef | ||
488 | #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009 | ||
489 | |||
479 | #define USB_VENDOR_ID_LG 0x1fd2 | 490 | #define USB_VENDOR_ID_LG 0x1fd2 |
480 | #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064 | 491 | #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064 |
481 | 492 | ||
@@ -518,6 +529,9 @@ | |||
518 | #define USB_DEVICE_ID_CRYSTALTOUCH 0x0006 | 529 | #define USB_DEVICE_ID_CRYSTALTOUCH 0x0006 |
519 | #define USB_DEVICE_ID_CRYSTALTOUCH_DUAL 0x0007 | 530 | #define USB_DEVICE_ID_CRYSTALTOUCH_DUAL 0x0007 |
520 | 531 | ||
532 | #define USB_VENDOR_ID_MADCATZ 0x0738 | ||
533 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 | ||
534 | |||
521 | #define USB_VENDOR_ID_MCC 0x09db | 535 | #define USB_VENDOR_ID_MCC 0x09db |
522 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 | 536 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 |
523 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a | 537 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a |
@@ -567,6 +581,9 @@ | |||
567 | #define USB_VENDOR_ID_NINTENDO 0x057e | 581 | #define USB_VENDOR_ID_NINTENDO 0x057e |
568 | #define USB_DEVICE_ID_NINTENDO_WIIMOTE 0x0306 | 582 | #define USB_DEVICE_ID_NINTENDO_WIIMOTE 0x0306 |
569 | 583 | ||
584 | #define USB_VENDOR_ID_NOVATEK 0x0603 | ||
585 | #define USB_DEVICE_ID_NOVATEK_PCT 0x0600 | ||
586 | |||
570 | #define USB_VENDOR_ID_NTRIG 0x1b96 | 587 | #define USB_VENDOR_ID_NTRIG 0x1b96 |
571 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001 | 588 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001 |
572 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003 | 589 | #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1 0x0003 |
@@ -644,6 +661,7 @@ | |||
644 | #define USB_DEVICE_ID_ROCCAT_KOVAPLUS 0x2d50 | 661 | #define USB_DEVICE_ID_ROCCAT_KOVAPLUS 0x2d50 |
645 | #define USB_DEVICE_ID_ROCCAT_PYRA_WIRED 0x2c24 | 662 | #define USB_DEVICE_ID_ROCCAT_PYRA_WIRED 0x2c24 |
646 | #define USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS 0x2cf6 | 663 | #define USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS 0x2cf6 |
664 | #define USB_DEVICE_ID_ROCCAT_SAVU 0x2d5a | ||
647 | 665 | ||
648 | #define USB_VENDOR_ID_SAITEK 0x06a3 | 666 | #define USB_VENDOR_ID_SAITEK 0x06a3 |
649 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | 667 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 |
@@ -653,6 +671,9 @@ | |||
653 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | 671 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
654 | #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600 | 672 | #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600 |
655 | 673 | ||
674 | #define USB_VENDOR_ID_SENNHEISER 0x1395 | ||
675 | #define USB_DEVICE_ID_SENNHEISER_BTD500USB 0x002c | ||
676 | |||
656 | #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f | 677 | #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f |
657 | #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 | 678 | #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 |
658 | 679 | ||
@@ -802,6 +823,9 @@ | |||
802 | #define USB_VENDOR_ID_ZYDACRON 0x13EC | 823 | #define USB_VENDOR_ID_ZYDACRON 0x13EC |
803 | #define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006 | 824 | #define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006 |
804 | 825 | ||
826 | #define USB_VENDOR_ID_ZYTRONIC 0x14c8 | ||
827 | #define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005 | ||
828 | |||
805 | #define USB_VENDOR_ID_PRIMAX 0x0461 | 829 | #define USB_VENDOR_ID_PRIMAX 0x0461 |
806 | #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05 | 830 | #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05 |
807 | 831 | ||
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 132b0019365e..811bfad64609 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -301,6 +301,9 @@ static const struct hid_device_id hid_battery_quirks[] = { | |||
301 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | 301 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
302 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), | 302 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), |
303 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | 303 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, |
304 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | ||
305 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), | ||
306 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | ||
304 | {} | 307 | {} |
305 | }; | 308 | }; |
306 | 309 | ||
@@ -834,6 +837,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
834 | } | 837 | } |
835 | break; | 838 | break; |
836 | 839 | ||
840 | case HID_UP_HPVENDOR2: | ||
841 | set_bit(EV_REP, input->evbit); | ||
842 | switch (usage->hid & HID_USAGE) { | ||
843 | case 0x003: map_key_clear(KEY_BRIGHTNESSDOWN); break; | ||
844 | case 0x004: map_key_clear(KEY_BRIGHTNESSUP); break; | ||
845 | default: goto ignore; | ||
846 | } | ||
847 | break; | ||
848 | |||
837 | case HID_UP_MSVENDOR: | 849 | case HID_UP_MSVENDOR: |
838 | goto ignore; | 850 | goto ignore; |
839 | 851 | ||
diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo-tpkbd.c new file mode 100644 index 000000000000..77d2df04c97b --- /dev/null +++ b/drivers/hid/hid-lenovo-tpkbd.c | |||
@@ -0,0 +1,564 @@ | |||
1 | /* | ||
2 | * HID driver for Lenovo ThinkPad USB Keyboard with TrackPoint | ||
3 | * | ||
4 | * Copyright (c) 2012 Bernhard Seibold | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation; either version 2 of the License, or (at your option) | ||
11 | * any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/sysfs.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/usb.h> | ||
18 | #include <linux/hid.h> | ||
19 | #include <linux/input.h> | ||
20 | #include <linux/leds.h> | ||
21 | #include "usbhid/usbhid.h" | ||
22 | |||
23 | #include "hid-ids.h" | ||
24 | |||
25 | /* This is only used for the trackpoint part of the driver, hence _tp */ | ||
26 | struct tpkbd_data_pointer { | ||
27 | int led_state; | ||
28 | struct led_classdev led_mute; | ||
29 | struct led_classdev led_micmute; | ||
30 | int press_to_select; | ||
31 | int dragging; | ||
32 | int release_to_select; | ||
33 | int select_right; | ||
34 | int sensitivity; | ||
35 | int press_speed; | ||
36 | }; | ||
37 | |||
38 | #define map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) | ||
39 | |||
40 | static int tpkbd_input_mapping(struct hid_device *hdev, | ||
41 | struct hid_input *hi, struct hid_field *field, | ||
42 | struct hid_usage *usage, unsigned long **bit, int *max) | ||
43 | { | ||
44 | struct usbhid_device *uhdev; | ||
45 | |||
46 | uhdev = (struct usbhid_device *) hdev->driver_data; | ||
47 | if (uhdev->ifnum == 1 && usage->hid == (HID_UP_BUTTON | 0x0010)) { | ||
48 | map_key_clear(KEY_MICMUTE); | ||
49 | return 1; | ||
50 | } | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | #undef map_key_clear | ||
55 | |||
56 | static int tpkbd_features_set(struct hid_device *hdev) | ||
57 | { | ||
58 | struct hid_report *report; | ||
59 | struct tpkbd_data_pointer *data_pointer; | ||
60 | |||
61 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
62 | report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[4]; | ||
63 | |||
64 | report->field[0]->value[0] = data_pointer->press_to_select ? 0x01 : 0x02; | ||
65 | report->field[0]->value[0] |= data_pointer->dragging ? 0x04 : 0x08; | ||
66 | report->field[0]->value[0] |= data_pointer->release_to_select ? 0x10 : 0x20; | ||
67 | report->field[0]->value[0] |= data_pointer->select_right ? 0x80 : 0x40; | ||
68 | report->field[1]->value[0] = 0x03; // unknown setting, imitate windows driver | ||
69 | report->field[2]->value[0] = data_pointer->sensitivity; | ||
70 | report->field[3]->value[0] = data_pointer->press_speed; | ||
71 | |||
72 | usbhid_submit_report(hdev, report, USB_DIR_OUT); | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | static ssize_t pointer_press_to_select_show(struct device *dev, | ||
77 | struct device_attribute *attr, | ||
78 | char *buf) | ||
79 | { | ||
80 | struct hid_device *hdev; | ||
81 | struct tpkbd_data_pointer *data_pointer; | ||
82 | |||
83 | hdev = container_of(dev, struct hid_device, dev); | ||
84 | if (hdev == NULL) | ||
85 | return -ENODEV; | ||
86 | |||
87 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
88 | |||
89 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->press_to_select); | ||
90 | } | ||
91 | |||
92 | static ssize_t pointer_press_to_select_store(struct device *dev, | ||
93 | struct device_attribute *attr, | ||
94 | const char *buf, | ||
95 | size_t count) | ||
96 | { | ||
97 | struct hid_device *hdev; | ||
98 | struct tpkbd_data_pointer *data_pointer; | ||
99 | int value; | ||
100 | |||
101 | hdev = container_of(dev, struct hid_device, dev); | ||
102 | if (hdev == NULL) | ||
103 | return -ENODEV; | ||
104 | |||
105 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
106 | |||
107 | if (kstrtoint(buf, 10, &value)) | ||
108 | return -EINVAL; | ||
109 | if (value < 0 || value > 1) | ||
110 | return -EINVAL; | ||
111 | |||
112 | data_pointer->press_to_select = value; | ||
113 | tpkbd_features_set(hdev); | ||
114 | |||
115 | return count; | ||
116 | } | ||
117 | |||
118 | static ssize_t pointer_dragging_show(struct device *dev, | ||
119 | struct device_attribute *attr, | ||
120 | char *buf) | ||
121 | { | ||
122 | struct hid_device *hdev; | ||
123 | struct tpkbd_data_pointer *data_pointer; | ||
124 | |||
125 | hdev = container_of(dev, struct hid_device, dev); | ||
126 | if (hdev == NULL) | ||
127 | return -ENODEV; | ||
128 | |||
129 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
130 | |||
131 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging); | ||
132 | } | ||
133 | |||
134 | static ssize_t pointer_dragging_store(struct device *dev, | ||
135 | struct device_attribute *attr, | ||
136 | const char *buf, | ||
137 | size_t count) | ||
138 | { | ||
139 | struct hid_device *hdev; | ||
140 | struct tpkbd_data_pointer *data_pointer; | ||
141 | int value; | ||
142 | |||
143 | hdev = container_of(dev, struct hid_device, dev); | ||
144 | if (hdev == NULL) | ||
145 | return -ENODEV; | ||
146 | |||
147 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
148 | |||
149 | if (kstrtoint(buf, 10, &value)) | ||
150 | return -EINVAL; | ||
151 | if (value < 0 || value > 1) | ||
152 | return -EINVAL; | ||
153 | |||
154 | data_pointer->dragging = value; | ||
155 | tpkbd_features_set(hdev); | ||
156 | |||
157 | return count; | ||
158 | } | ||
159 | |||
160 | static ssize_t pointer_release_to_select_show(struct device *dev, | ||
161 | struct device_attribute *attr, | ||
162 | char *buf) | ||
163 | { | ||
164 | struct hid_device *hdev; | ||
165 | struct tpkbd_data_pointer *data_pointer; | ||
166 | |||
167 | hdev = container_of(dev, struct hid_device, dev); | ||
168 | if (hdev == NULL) | ||
169 | return -ENODEV; | ||
170 | |||
171 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
172 | |||
173 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->release_to_select); | ||
174 | } | ||
175 | |||
176 | static ssize_t pointer_release_to_select_store(struct device *dev, | ||
177 | struct device_attribute *attr, | ||
178 | const char *buf, | ||
179 | size_t count) | ||
180 | { | ||
181 | struct hid_device *hdev; | ||
182 | struct tpkbd_data_pointer *data_pointer; | ||
183 | int value; | ||
184 | |||
185 | hdev = container_of(dev, struct hid_device, dev); | ||
186 | if (hdev == NULL) | ||
187 | return -ENODEV; | ||
188 | |||
189 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
190 | |||
191 | if (kstrtoint(buf, 10, &value)) | ||
192 | return -EINVAL; | ||
193 | if (value < 0 || value > 1) | ||
194 | return -EINVAL; | ||
195 | |||
196 | data_pointer->release_to_select = value; | ||
197 | tpkbd_features_set(hdev); | ||
198 | |||
199 | return count; | ||
200 | } | ||
201 | |||
202 | static ssize_t pointer_select_right_show(struct device *dev, | ||
203 | struct device_attribute *attr, | ||
204 | char *buf) | ||
205 | { | ||
206 | struct hid_device *hdev; | ||
207 | struct tpkbd_data_pointer *data_pointer; | ||
208 | |||
209 | hdev = container_of(dev, struct hid_device, dev); | ||
210 | if (hdev == NULL) | ||
211 | return -ENODEV; | ||
212 | |||
213 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
214 | |||
215 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->select_right); | ||
216 | } | ||
217 | |||
218 | static ssize_t pointer_select_right_store(struct device *dev, | ||
219 | struct device_attribute *attr, | ||
220 | const char *buf, | ||
221 | size_t count) | ||
222 | { | ||
223 | struct hid_device *hdev; | ||
224 | struct tpkbd_data_pointer *data_pointer; | ||
225 | int value; | ||
226 | |||
227 | hdev = container_of(dev, struct hid_device, dev); | ||
228 | if (hdev == NULL) | ||
229 | return -ENODEV; | ||
230 | |||
231 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
232 | |||
233 | if (kstrtoint(buf, 10, &value)) | ||
234 | return -EINVAL; | ||
235 | if (value < 0 || value > 1) | ||
236 | return -EINVAL; | ||
237 | |||
238 | data_pointer->select_right = value; | ||
239 | tpkbd_features_set(hdev); | ||
240 | |||
241 | return count; | ||
242 | } | ||
243 | |||
244 | static ssize_t pointer_sensitivity_show(struct device *dev, | ||
245 | struct device_attribute *attr, | ||
246 | char *buf) | ||
247 | { | ||
248 | struct hid_device *hdev; | ||
249 | struct tpkbd_data_pointer *data_pointer; | ||
250 | |||
251 | hdev = container_of(dev, struct hid_device, dev); | ||
252 | if (hdev == NULL) | ||
253 | return -ENODEV; | ||
254 | |||
255 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
256 | |||
257 | return snprintf(buf, PAGE_SIZE, "%u\n", | ||
258 | data_pointer->sensitivity); | ||
259 | } | ||
260 | |||
261 | static ssize_t pointer_sensitivity_store(struct device *dev, | ||
262 | struct device_attribute *attr, | ||
263 | const char *buf, | ||
264 | size_t count) | ||
265 | { | ||
266 | struct hid_device *hdev; | ||
267 | struct tpkbd_data_pointer *data_pointer; | ||
268 | int value; | ||
269 | |||
270 | hdev = container_of(dev, struct hid_device, dev); | ||
271 | if (hdev == NULL) | ||
272 | return -ENODEV; | ||
273 | |||
274 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
275 | |||
276 | if (kstrtoint(buf, 10, &value) || value < 1 || value > 255) | ||
277 | return -EINVAL; | ||
278 | |||
279 | data_pointer->sensitivity = value; | ||
280 | tpkbd_features_set(hdev); | ||
281 | |||
282 | return count; | ||
283 | } | ||
284 | |||
285 | static ssize_t pointer_press_speed_show(struct device *dev, | ||
286 | struct device_attribute *attr, | ||
287 | char *buf) | ||
288 | { | ||
289 | struct hid_device *hdev; | ||
290 | struct tpkbd_data_pointer *data_pointer; | ||
291 | |||
292 | hdev = container_of(dev, struct hid_device, dev); | ||
293 | if (hdev == NULL) | ||
294 | return -ENODEV; | ||
295 | |||
296 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
297 | |||
298 | return snprintf(buf, PAGE_SIZE, "%u\n", | ||
299 | data_pointer->press_speed); | ||
300 | } | ||
301 | |||
302 | static ssize_t pointer_press_speed_store(struct device *dev, | ||
303 | struct device_attribute *attr, | ||
304 | const char *buf, | ||
305 | size_t count) | ||
306 | { | ||
307 | struct hid_device *hdev; | ||
308 | struct tpkbd_data_pointer *data_pointer; | ||
309 | int value; | ||
310 | |||
311 | hdev = container_of(dev, struct hid_device, dev); | ||
312 | if (hdev == NULL) | ||
313 | return -ENODEV; | ||
314 | |||
315 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
316 | |||
317 | if (kstrtoint(buf, 10, &value) || value < 1 || value > 255) | ||
318 | return -EINVAL; | ||
319 | |||
320 | data_pointer->press_speed = value; | ||
321 | tpkbd_features_set(hdev); | ||
322 | |||
323 | return count; | ||
324 | } | ||
325 | |||
326 | static struct device_attribute dev_attr_pointer_press_to_select = | ||
327 | __ATTR(press_to_select, S_IWUSR | S_IRUGO, | ||
328 | pointer_press_to_select_show, | ||
329 | pointer_press_to_select_store); | ||
330 | |||
331 | static struct device_attribute dev_attr_pointer_dragging = | ||
332 | __ATTR(dragging, S_IWUSR | S_IRUGO, | ||
333 | pointer_dragging_show, | ||
334 | pointer_dragging_store); | ||
335 | |||
336 | static struct device_attribute dev_attr_pointer_release_to_select = | ||
337 | __ATTR(release_to_select, S_IWUSR | S_IRUGO, | ||
338 | pointer_release_to_select_show, | ||
339 | pointer_release_to_select_store); | ||
340 | |||
341 | static struct device_attribute dev_attr_pointer_select_right = | ||
342 | __ATTR(select_right, S_IWUSR | S_IRUGO, | ||
343 | pointer_select_right_show, | ||
344 | pointer_select_right_store); | ||
345 | |||
346 | static struct device_attribute dev_attr_pointer_sensitivity = | ||
347 | __ATTR(sensitivity, S_IWUSR | S_IRUGO, | ||
348 | pointer_sensitivity_show, | ||
349 | pointer_sensitivity_store); | ||
350 | |||
351 | static struct device_attribute dev_attr_pointer_press_speed = | ||
352 | __ATTR(press_speed, S_IWUSR | S_IRUGO, | ||
353 | pointer_press_speed_show, | ||
354 | pointer_press_speed_store); | ||
355 | |||
356 | static struct attribute *tpkbd_attributes_pointer[] = { | ||
357 | &dev_attr_pointer_press_to_select.attr, | ||
358 | &dev_attr_pointer_dragging.attr, | ||
359 | &dev_attr_pointer_release_to_select.attr, | ||
360 | &dev_attr_pointer_select_right.attr, | ||
361 | &dev_attr_pointer_sensitivity.attr, | ||
362 | &dev_attr_pointer_press_speed.attr, | ||
363 | NULL | ||
364 | }; | ||
365 | |||
366 | static const struct attribute_group tpkbd_attr_group_pointer = { | ||
367 | .attrs = tpkbd_attributes_pointer, | ||
368 | }; | ||
369 | |||
370 | static enum led_brightness tpkbd_led_brightness_get( | ||
371 | struct led_classdev *led_cdev) | ||
372 | { | ||
373 | struct device *dev; | ||
374 | struct hid_device *hdev; | ||
375 | struct tpkbd_data_pointer *data_pointer; | ||
376 | int led_nr = 0; | ||
377 | |||
378 | dev = led_cdev->dev->parent; | ||
379 | hdev = container_of(dev, struct hid_device, dev); | ||
380 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
381 | |||
382 | if (led_cdev == &data_pointer->led_micmute) | ||
383 | led_nr = 1; | ||
384 | |||
385 | return data_pointer->led_state & (1 << led_nr) | ||
386 | ? LED_FULL | ||
387 | : LED_OFF; | ||
388 | } | ||
389 | |||
390 | static void tpkbd_led_brightness_set(struct led_classdev *led_cdev, | ||
391 | enum led_brightness value) | ||
392 | { | ||
393 | struct device *dev; | ||
394 | struct hid_device *hdev; | ||
395 | struct hid_report *report; | ||
396 | struct tpkbd_data_pointer *data_pointer; | ||
397 | int led_nr = 0; | ||
398 | |||
399 | dev = led_cdev->dev->parent; | ||
400 | hdev = container_of(dev, struct hid_device, dev); | ||
401 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
402 | |||
403 | if (led_cdev == &data_pointer->led_micmute) | ||
404 | led_nr = 1; | ||
405 | |||
406 | if (value == LED_OFF) | ||
407 | data_pointer->led_state &= ~(1 << led_nr); | ||
408 | else | ||
409 | data_pointer->led_state |= 1 << led_nr; | ||
410 | |||
411 | report = hdev->report_enum[HID_OUTPUT_REPORT].report_id_hash[3]; | ||
412 | report->field[0]->value[0] = (data_pointer->led_state >> 0) & 1; | ||
413 | report->field[0]->value[1] = (data_pointer->led_state >> 1) & 1; | ||
414 | usbhid_submit_report(hdev, report, USB_DIR_OUT); | ||
415 | } | ||
416 | |||
417 | static int tpkbd_probe_tp(struct hid_device *hdev) | ||
418 | { | ||
419 | struct device *dev = &hdev->dev; | ||
420 | struct tpkbd_data_pointer *data_pointer; | ||
421 | size_t name_sz = strlen(dev_name(dev)) + 16; | ||
422 | char *name_mute, *name_micmute; | ||
423 | int ret; | ||
424 | |||
425 | if (sysfs_create_group(&hdev->dev.kobj, | ||
426 | &tpkbd_attr_group_pointer)) { | ||
427 | hid_warn(hdev, "Could not create sysfs group\n"); | ||
428 | } | ||
429 | |||
430 | data_pointer = kzalloc(sizeof(struct tpkbd_data_pointer), GFP_KERNEL); | ||
431 | if (data_pointer == NULL) { | ||
432 | hid_err(hdev, "Could not allocate memory for driver data\n"); | ||
433 | return -ENOMEM; | ||
434 | } | ||
435 | |||
436 | // set same default values as windows driver | ||
437 | data_pointer->sensitivity = 0xa0; | ||
438 | data_pointer->press_speed = 0x38; | ||
439 | |||
440 | name_mute = kzalloc(name_sz, GFP_KERNEL); | ||
441 | if (name_mute == NULL) { | ||
442 | hid_err(hdev, "Could not allocate memory for led data\n"); | ||
443 | ret = -ENOMEM; | ||
444 | goto err; | ||
445 | } | ||
446 | snprintf(name_mute, name_sz, "%s:amber:mute", dev_name(dev)); | ||
447 | |||
448 | name_micmute = kzalloc(name_sz, GFP_KERNEL); | ||
449 | if (name_micmute == NULL) { | ||
450 | hid_err(hdev, "Could not allocate memory for led data\n"); | ||
451 | ret = -ENOMEM; | ||
452 | goto err2; | ||
453 | } | ||
454 | snprintf(name_micmute, name_sz, "%s:amber:micmute", dev_name(dev)); | ||
455 | |||
456 | hid_set_drvdata(hdev, data_pointer); | ||
457 | |||
458 | data_pointer->led_mute.name = name_mute; | ||
459 | data_pointer->led_mute.brightness_get = tpkbd_led_brightness_get; | ||
460 | data_pointer->led_mute.brightness_set = tpkbd_led_brightness_set; | ||
461 | data_pointer->led_mute.dev = dev; | ||
462 | led_classdev_register(dev, &data_pointer->led_mute); | ||
463 | |||
464 | data_pointer->led_micmute.name = name_micmute; | ||
465 | data_pointer->led_micmute.brightness_get = tpkbd_led_brightness_get; | ||
466 | data_pointer->led_micmute.brightness_set = tpkbd_led_brightness_set; | ||
467 | data_pointer->led_micmute.dev = dev; | ||
468 | led_classdev_register(dev, &data_pointer->led_micmute); | ||
469 | |||
470 | tpkbd_features_set(hdev); | ||
471 | |||
472 | return 0; | ||
473 | |||
474 | err2: | ||
475 | kfree(name_mute); | ||
476 | err: | ||
477 | kfree(data_pointer); | ||
478 | return ret; | ||
479 | } | ||
480 | |||
481 | static int tpkbd_probe(struct hid_device *hdev, | ||
482 | const struct hid_device_id *id) | ||
483 | { | ||
484 | int ret; | ||
485 | struct usbhid_device *uhdev; | ||
486 | |||
487 | ret = hid_parse(hdev); | ||
488 | if (ret) { | ||
489 | hid_err(hdev, "hid_parse failed\n"); | ||
490 | goto err_free; | ||
491 | } | ||
492 | |||
493 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
494 | if (ret) { | ||
495 | hid_err(hdev, "hid_hw_start failed\n"); | ||
496 | goto err_free; | ||
497 | } | ||
498 | |||
499 | uhdev = (struct usbhid_device *) hdev->driver_data; | ||
500 | |||
501 | if (uhdev->ifnum == 1) | ||
502 | return tpkbd_probe_tp(hdev); | ||
503 | |||
504 | return 0; | ||
505 | err_free: | ||
506 | return ret; | ||
507 | } | ||
508 | |||
509 | static void tpkbd_remove_tp(struct hid_device *hdev) | ||
510 | { | ||
511 | struct tpkbd_data_pointer *data_pointer; | ||
512 | |||
513 | sysfs_remove_group(&hdev->dev.kobj, | ||
514 | &tpkbd_attr_group_pointer); | ||
515 | |||
516 | data_pointer = (struct tpkbd_data_pointer *) hid_get_drvdata(hdev); | ||
517 | |||
518 | led_classdev_unregister(&data_pointer->led_micmute); | ||
519 | led_classdev_unregister(&data_pointer->led_mute); | ||
520 | |||
521 | hid_set_drvdata(hdev, NULL); | ||
522 | kfree(data_pointer); | ||
523 | } | ||
524 | |||
525 | static void tpkbd_remove(struct hid_device *hdev) | ||
526 | { | ||
527 | struct usbhid_device *uhdev; | ||
528 | |||
529 | uhdev = (struct usbhid_device *) hdev->driver_data; | ||
530 | if (uhdev->ifnum == 1) | ||
531 | tpkbd_remove_tp(hdev); | ||
532 | |||
533 | hid_hw_stop(hdev); | ||
534 | } | ||
535 | |||
536 | static const struct hid_device_id tpkbd_devices[] = { | ||
537 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, | ||
538 | { } | ||
539 | }; | ||
540 | |||
541 | MODULE_DEVICE_TABLE(hid, tpkbd_devices); | ||
542 | |||
543 | static struct hid_driver tpkbd_driver = { | ||
544 | .name = "lenovo_tpkbd", | ||
545 | .id_table = tpkbd_devices, | ||
546 | .input_mapping = tpkbd_input_mapping, | ||
547 | .probe = tpkbd_probe, | ||
548 | .remove = tpkbd_remove, | ||
549 | }; | ||
550 | |||
551 | static int __init tpkbd_init(void) | ||
552 | { | ||
553 | return hid_register_driver(&tpkbd_driver); | ||
554 | } | ||
555 | |||
556 | static void __exit tpkbd_exit(void) | ||
557 | { | ||
558 | hid_unregister_driver(&tpkbd_driver); | ||
559 | } | ||
560 | |||
561 | module_init(tpkbd_init); | ||
562 | module_exit(tpkbd_exit); | ||
563 | |||
564 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6e3332a99976..59c8b5c1d2de 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -83,6 +83,7 @@ struct mt_device { | |||
83 | unsigned last_field_index; /* last field index of the report */ | 83 | unsigned last_field_index; /* last field index of the report */ |
84 | unsigned last_slot_field; /* the last field of a slot */ | 84 | unsigned last_slot_field; /* the last field of a slot */ |
85 | __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ | 85 | __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ |
86 | __s8 inputmode_index; /* InputMode HID feature index in the report */ | ||
86 | __s8 maxcontact_report_id; /* Maximum Contact Number HID feature, | 87 | __s8 maxcontact_report_id; /* Maximum Contact Number HID feature, |
87 | -1 if non-existent */ | 88 | -1 if non-existent */ |
88 | __u8 num_received; /* how many contacts we received */ | 89 | __u8 num_received; /* how many contacts we received */ |
@@ -260,10 +261,20 @@ static void mt_feature_mapping(struct hid_device *hdev, | |||
260 | struct hid_field *field, struct hid_usage *usage) | 261 | struct hid_field *field, struct hid_usage *usage) |
261 | { | 262 | { |
262 | struct mt_device *td = hid_get_drvdata(hdev); | 263 | struct mt_device *td = hid_get_drvdata(hdev); |
264 | int i; | ||
263 | 265 | ||
264 | switch (usage->hid) { | 266 | switch (usage->hid) { |
265 | case HID_DG_INPUTMODE: | 267 | case HID_DG_INPUTMODE: |
266 | td->inputmode = field->report->id; | 268 | td->inputmode = field->report->id; |
269 | td->inputmode_index = 0; /* has to be updated below */ | ||
270 | |||
271 | for (i=0; i < field->maxusage; i++) { | ||
272 | if (field->usage[i].hid == usage->hid) { | ||
273 | td->inputmode_index = i; | ||
274 | break; | ||
275 | } | ||
276 | } | ||
277 | |||
267 | break; | 278 | break; |
268 | case HID_DG_CONTACTMAX: | 279 | case HID_DG_CONTACTMAX: |
269 | td->maxcontact_report_id = field->report->id; | 280 | td->maxcontact_report_id = field->report->id; |
@@ -618,7 +629,7 @@ static void mt_set_input_mode(struct hid_device *hdev) | |||
618 | re = &(hdev->report_enum[HID_FEATURE_REPORT]); | 629 | re = &(hdev->report_enum[HID_FEATURE_REPORT]); |
619 | r = re->report_id_hash[td->inputmode]; | 630 | r = re->report_id_hash[td->inputmode]; |
620 | if (r) { | 631 | if (r) { |
621 | r->field[0]->value[0] = 0x02; | 632 | r->field[0]->value[td->inputmode_index] = 0x02; |
622 | usbhid_submit_report(hdev, r, USB_DIR_OUT); | 633 | usbhid_submit_report(hdev, r, USB_DIR_OUT); |
623 | } | 634 | } |
624 | } | 635 | } |
@@ -951,6 +962,11 @@ static const struct hid_device_id mt_devices[] = { | |||
951 | MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC, | 962 | MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC, |
952 | USB_DEVICE_ID_PANABOARD_UBT880) }, | 963 | USB_DEVICE_ID_PANABOARD_UBT880) }, |
953 | 964 | ||
965 | /* Novatek Panel */ | ||
966 | { .driver_data = MT_CLS_DEFAULT, | ||
967 | MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK, | ||
968 | USB_DEVICE_ID_NOVATEK_PCT) }, | ||
969 | |||
954 | /* PenMount panels */ | 970 | /* PenMount panels */ |
955 | { .driver_data = MT_CLS_CONFIDENCE, | 971 | { .driver_data = MT_CLS_CONFIDENCE, |
956 | MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, | 972 | MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, |
@@ -1048,6 +1064,11 @@ static const struct hid_device_id mt_devices[] = { | |||
1048 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, | 1064 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
1049 | USB_DEVICE_ID_XIROKU_CSR2) }, | 1065 | USB_DEVICE_ID_XIROKU_CSR2) }, |
1050 | 1066 | ||
1067 | /* Zytronic panels */ | ||
1068 | { .driver_data = MT_CLS_SERIAL, | ||
1069 | MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC, | ||
1070 | USB_DEVICE_ID_ZYTRONIC_ZXY100) }, | ||
1071 | |||
1051 | /* Generic MT device */ | 1072 | /* Generic MT device */ |
1052 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, | 1073 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, |
1053 | { } | 1074 | { } |
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index 45c3433f7986..27c8ebdfad01 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c | |||
@@ -1846,7 +1846,7 @@ static void picolcd_debug_out_report(struct picolcd_data *data, | |||
1846 | #define BUFF_SZ 256 | 1846 | #define BUFF_SZ 256 |
1847 | 1847 | ||
1848 | /* Avoid unnecessary overhead if debugfs is disabled */ | 1848 | /* Avoid unnecessary overhead if debugfs is disabled */ |
1849 | if (!hdev->debug_events) | 1849 | if (list_empty(&hdev->debug_list)) |
1850 | return; | 1850 | return; |
1851 | 1851 | ||
1852 | buff = kmalloc(BUFF_SZ, GFP_ATOMIC); | 1852 | buff = kmalloc(BUFF_SZ, GFP_ATOMIC); |
@@ -2613,11 +2613,7 @@ static int picolcd_probe(struct hid_device *hdev, | |||
2613 | goto err_cleanup_data; | 2613 | goto err_cleanup_data; |
2614 | } | 2614 | } |
2615 | 2615 | ||
2616 | /* We don't use hidinput but hid_hw_start() fails if nothing is | ||
2617 | * claimed. So spoof claimed input. */ | ||
2618 | hdev->claimed = HID_CLAIMED_INPUT; | ||
2619 | error = hid_hw_start(hdev, 0); | 2616 | error = hid_hw_start(hdev, 0); |
2620 | hdev->claimed = 0; | ||
2621 | if (error) { | 2617 | if (error) { |
2622 | hid_err(hdev, "hardware start failed\n"); | 2618 | hid_err(hdev, "hardware start failed\n"); |
2623 | goto err_cleanup_data; | 2619 | goto err_cleanup_data; |
diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c index 093bfad00b02..327f9b8ed1f4 100644 --- a/drivers/hid/hid-roccat-arvo.c +++ b/drivers/hid/hid-roccat-arvo.c | |||
@@ -39,7 +39,7 @@ static ssize_t arvo_sysfs_show_mode_key(struct device *dev, | |||
39 | int retval; | 39 | int retval; |
40 | 40 | ||
41 | mutex_lock(&arvo->arvo_lock); | 41 | mutex_lock(&arvo->arvo_lock); |
42 | retval = roccat_common_receive(usb_dev, ARVO_COMMAND_MODE_KEY, | 42 | retval = roccat_common2_receive(usb_dev, ARVO_COMMAND_MODE_KEY, |
43 | &temp_buf, sizeof(struct arvo_mode_key)); | 43 | &temp_buf, sizeof(struct arvo_mode_key)); |
44 | mutex_unlock(&arvo->arvo_lock); | 44 | mutex_unlock(&arvo->arvo_lock); |
45 | if (retval) | 45 | if (retval) |
@@ -67,7 +67,7 @@ static ssize_t arvo_sysfs_set_mode_key(struct device *dev, | |||
67 | temp_buf.state = state; | 67 | temp_buf.state = state; |
68 | 68 | ||
69 | mutex_lock(&arvo->arvo_lock); | 69 | mutex_lock(&arvo->arvo_lock); |
70 | retval = roccat_common_send(usb_dev, ARVO_COMMAND_MODE_KEY, | 70 | retval = roccat_common2_send(usb_dev, ARVO_COMMAND_MODE_KEY, |
71 | &temp_buf, sizeof(struct arvo_mode_key)); | 71 | &temp_buf, sizeof(struct arvo_mode_key)); |
72 | mutex_unlock(&arvo->arvo_lock); | 72 | mutex_unlock(&arvo->arvo_lock); |
73 | if (retval) | 73 | if (retval) |
@@ -87,7 +87,7 @@ static ssize_t arvo_sysfs_show_key_mask(struct device *dev, | |||
87 | int retval; | 87 | int retval; |
88 | 88 | ||
89 | mutex_lock(&arvo->arvo_lock); | 89 | mutex_lock(&arvo->arvo_lock); |
90 | retval = roccat_common_receive(usb_dev, ARVO_COMMAND_KEY_MASK, | 90 | retval = roccat_common2_receive(usb_dev, ARVO_COMMAND_KEY_MASK, |
91 | &temp_buf, sizeof(struct arvo_key_mask)); | 91 | &temp_buf, sizeof(struct arvo_key_mask)); |
92 | mutex_unlock(&arvo->arvo_lock); | 92 | mutex_unlock(&arvo->arvo_lock); |
93 | if (retval) | 93 | if (retval) |
@@ -115,7 +115,7 @@ static ssize_t arvo_sysfs_set_key_mask(struct device *dev, | |||
115 | temp_buf.key_mask = key_mask; | 115 | temp_buf.key_mask = key_mask; |
116 | 116 | ||
117 | mutex_lock(&arvo->arvo_lock); | 117 | mutex_lock(&arvo->arvo_lock); |
118 | retval = roccat_common_send(usb_dev, ARVO_COMMAND_KEY_MASK, | 118 | retval = roccat_common2_send(usb_dev, ARVO_COMMAND_KEY_MASK, |
119 | &temp_buf, sizeof(struct arvo_key_mask)); | 119 | &temp_buf, sizeof(struct arvo_key_mask)); |
120 | mutex_unlock(&arvo->arvo_lock); | 120 | mutex_unlock(&arvo->arvo_lock); |
121 | if (retval) | 121 | if (retval) |
@@ -130,7 +130,7 @@ static int arvo_get_actual_profile(struct usb_device *usb_dev) | |||
130 | struct arvo_actual_profile temp_buf; | 130 | struct arvo_actual_profile temp_buf; |
131 | int retval; | 131 | int retval; |
132 | 132 | ||
133 | retval = roccat_common_receive(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE, | 133 | retval = roccat_common2_receive(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE, |
134 | &temp_buf, sizeof(struct arvo_actual_profile)); | 134 | &temp_buf, sizeof(struct arvo_actual_profile)); |
135 | 135 | ||
136 | if (retval) | 136 | if (retval) |
@@ -170,7 +170,7 @@ static ssize_t arvo_sysfs_set_actual_profile(struct device *dev, | |||
170 | temp_buf.actual_profile = profile; | 170 | temp_buf.actual_profile = profile; |
171 | 171 | ||
172 | mutex_lock(&arvo->arvo_lock); | 172 | mutex_lock(&arvo->arvo_lock); |
173 | retval = roccat_common_send(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE, | 173 | retval = roccat_common2_send(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE, |
174 | &temp_buf, sizeof(struct arvo_actual_profile)); | 174 | &temp_buf, sizeof(struct arvo_actual_profile)); |
175 | if (!retval) { | 175 | if (!retval) { |
176 | arvo->actual_profile = profile; | 176 | arvo->actual_profile = profile; |
@@ -194,7 +194,7 @@ static ssize_t arvo_sysfs_write(struct file *fp, | |||
194 | return -EINVAL; | 194 | return -EINVAL; |
195 | 195 | ||
196 | mutex_lock(&arvo->arvo_lock); | 196 | mutex_lock(&arvo->arvo_lock); |
197 | retval = roccat_common_send(usb_dev, command, buf, real_size); | 197 | retval = roccat_common2_send(usb_dev, command, buf, real_size); |
198 | mutex_unlock(&arvo->arvo_lock); | 198 | mutex_unlock(&arvo->arvo_lock); |
199 | 199 | ||
200 | return (retval ? retval : real_size); | 200 | return (retval ? retval : real_size); |
@@ -217,7 +217,7 @@ static ssize_t arvo_sysfs_read(struct file *fp, | |||
217 | return -EINVAL; | 217 | return -EINVAL; |
218 | 218 | ||
219 | mutex_lock(&arvo->arvo_lock); | 219 | mutex_lock(&arvo->arvo_lock); |
220 | retval = roccat_common_receive(usb_dev, command, buf, real_size); | 220 | retval = roccat_common2_receive(usb_dev, command, buf, real_size); |
221 | mutex_unlock(&arvo->arvo_lock); | 221 | mutex_unlock(&arvo->arvo_lock); |
222 | 222 | ||
223 | return (retval ? retval : real_size); | 223 | return (retval ? retval : real_size); |
diff --git a/drivers/hid/hid-roccat-common.c b/drivers/hid/hid-roccat-common.c index a6d93992c75a..74f704032627 100644 --- a/drivers/hid/hid-roccat-common.c +++ b/drivers/hid/hid-roccat-common.c | |||
@@ -16,12 +16,12 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include "hid-roccat-common.h" | 17 | #include "hid-roccat-common.h" |
18 | 18 | ||
19 | static inline uint16_t roccat_common_feature_report(uint8_t report_id) | 19 | static inline uint16_t roccat_common2_feature_report(uint8_t report_id) |
20 | { | 20 | { |
21 | return 0x300 | report_id; | 21 | return 0x300 | report_id; |
22 | } | 22 | } |
23 | 23 | ||
24 | int roccat_common_receive(struct usb_device *usb_dev, uint report_id, | 24 | int roccat_common2_receive(struct usb_device *usb_dev, uint report_id, |
25 | void *data, uint size) | 25 | void *data, uint size) |
26 | { | 26 | { |
27 | char *buf; | 27 | char *buf; |
@@ -34,16 +34,16 @@ int roccat_common_receive(struct usb_device *usb_dev, uint report_id, | |||
34 | len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), | 34 | len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), |
35 | HID_REQ_GET_REPORT, | 35 | HID_REQ_GET_REPORT, |
36 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, | 36 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, |
37 | roccat_common_feature_report(report_id), | 37 | roccat_common2_feature_report(report_id), |
38 | 0, buf, size, USB_CTRL_SET_TIMEOUT); | 38 | 0, buf, size, USB_CTRL_SET_TIMEOUT); |
39 | 39 | ||
40 | memcpy(data, buf, size); | 40 | memcpy(data, buf, size); |
41 | kfree(buf); | 41 | kfree(buf); |
42 | return ((len < 0) ? len : ((len != size) ? -EIO : 0)); | 42 | return ((len < 0) ? len : ((len != size) ? -EIO : 0)); |
43 | } | 43 | } |
44 | EXPORT_SYMBOL_GPL(roccat_common_receive); | 44 | EXPORT_SYMBOL_GPL(roccat_common2_receive); |
45 | 45 | ||
46 | int roccat_common_send(struct usb_device *usb_dev, uint report_id, | 46 | int roccat_common2_send(struct usb_device *usb_dev, uint report_id, |
47 | void const *data, uint size) | 47 | void const *data, uint size) |
48 | { | 48 | { |
49 | char *buf; | 49 | char *buf; |
@@ -56,13 +56,71 @@ int roccat_common_send(struct usb_device *usb_dev, uint report_id, | |||
56 | len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), | 56 | len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), |
57 | HID_REQ_SET_REPORT, | 57 | HID_REQ_SET_REPORT, |
58 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, | 58 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, |
59 | roccat_common_feature_report(report_id), | 59 | roccat_common2_feature_report(report_id), |
60 | 0, buf, size, USB_CTRL_SET_TIMEOUT); | 60 | 0, buf, size, USB_CTRL_SET_TIMEOUT); |
61 | 61 | ||
62 | kfree(buf); | 62 | kfree(buf); |
63 | return ((len < 0) ? len : ((len != size) ? -EIO : 0)); | 63 | return ((len < 0) ? len : ((len != size) ? -EIO : 0)); |
64 | } | 64 | } |
65 | EXPORT_SYMBOL_GPL(roccat_common_send); | 65 | EXPORT_SYMBOL_GPL(roccat_common2_send); |
66 | |||
67 | enum roccat_common2_control_states { | ||
68 | ROCCAT_COMMON_CONTROL_STATUS_OVERLOAD = 0, | ||
69 | ROCCAT_COMMON_CONTROL_STATUS_OK = 1, | ||
70 | ROCCAT_COMMON_CONTROL_STATUS_INVALID = 2, | ||
71 | ROCCAT_COMMON_CONTROL_STATUS_WAIT = 3, | ||
72 | }; | ||
73 | |||
74 | static int roccat_common2_receive_control_status(struct usb_device *usb_dev) | ||
75 | { | ||
76 | int retval; | ||
77 | struct roccat_common2_control control; | ||
78 | |||
79 | do { | ||
80 | msleep(50); | ||
81 | retval = roccat_common2_receive(usb_dev, | ||
82 | ROCCAT_COMMON_COMMAND_CONTROL, | ||
83 | &control, sizeof(struct roccat_common2_control)); | ||
84 | |||
85 | if (retval) | ||
86 | return retval; | ||
87 | |||
88 | switch (control.value) { | ||
89 | case ROCCAT_COMMON_CONTROL_STATUS_OK: | ||
90 | return 0; | ||
91 | case ROCCAT_COMMON_CONTROL_STATUS_WAIT: | ||
92 | msleep(500); | ||
93 | continue; | ||
94 | case ROCCAT_COMMON_CONTROL_STATUS_INVALID: | ||
95 | |||
96 | case ROCCAT_COMMON_CONTROL_STATUS_OVERLOAD: | ||
97 | /* seems to be critical - replug necessary */ | ||
98 | return -EINVAL; | ||
99 | default: | ||
100 | dev_err(&usb_dev->dev, | ||
101 | "roccat_common2_receive_control_status: " | ||
102 | "unknown response value 0x%x\n", | ||
103 | control.value); | ||
104 | return -EINVAL; | ||
105 | } | ||
106 | |||
107 | } while (1); | ||
108 | } | ||
109 | |||
110 | int roccat_common2_send_with_status(struct usb_device *usb_dev, | ||
111 | uint command, void const *buf, uint size) | ||
112 | { | ||
113 | int retval; | ||
114 | |||
115 | retval = roccat_common2_send(usb_dev, command, buf, size); | ||
116 | if (retval) | ||
117 | return retval; | ||
118 | |||
119 | msleep(100); | ||
120 | |||
121 | return roccat_common2_receive_control_status(usb_dev); | ||
122 | } | ||
123 | EXPORT_SYMBOL_GPL(roccat_common2_send_with_status); | ||
66 | 124 | ||
67 | MODULE_AUTHOR("Stefan Achatz"); | 125 | MODULE_AUTHOR("Stefan Achatz"); |
68 | MODULE_DESCRIPTION("USB Roccat common driver"); | 126 | MODULE_DESCRIPTION("USB Roccat common driver"); |
diff --git a/drivers/hid/hid-roccat-common.h b/drivers/hid/hid-roccat-common.h index 9a5bc61f9699..a97746a63b70 100644 --- a/drivers/hid/hid-roccat-common.h +++ b/drivers/hid/hid-roccat-common.h | |||
@@ -15,9 +15,21 @@ | |||
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | 17 | ||
18 | int roccat_common_receive(struct usb_device *usb_dev, uint report_id, | 18 | enum roccat_common2_commands { |
19 | ROCCAT_COMMON_COMMAND_CONTROL = 0x4, | ||
20 | }; | ||
21 | |||
22 | struct roccat_common2_control { | ||
23 | uint8_t command; | ||
24 | uint8_t value; | ||
25 | uint8_t request; /* always 0 on requesting write check */ | ||
26 | } __packed; | ||
27 | |||
28 | int roccat_common2_receive(struct usb_device *usb_dev, uint report_id, | ||
19 | void *data, uint size); | 29 | void *data, uint size); |
20 | int roccat_common_send(struct usb_device *usb_dev, uint report_id, | 30 | int roccat_common2_send(struct usb_device *usb_dev, uint report_id, |
21 | void const *data, uint size); | 31 | void const *data, uint size); |
32 | int roccat_common2_send_with_status(struct usb_device *usb_dev, | ||
33 | uint command, void const *buf, uint size); | ||
22 | 34 | ||
23 | #endif | 35 | #endif |
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c index 0e4a0ab47142..5669916c2943 100644 --- a/drivers/hid/hid-roccat-isku.c +++ b/drivers/hid/hid-roccat-isku.c | |||
@@ -36,51 +36,7 @@ static void isku_profile_activated(struct isku_device *isku, uint new_profile) | |||
36 | static int isku_receive(struct usb_device *usb_dev, uint command, | 36 | static int isku_receive(struct usb_device *usb_dev, uint command, |
37 | void *buf, uint size) | 37 | void *buf, uint size) |
38 | { | 38 | { |
39 | return roccat_common_receive(usb_dev, command, buf, size); | 39 | return roccat_common2_receive(usb_dev, command, buf, size); |
40 | } | ||
41 | |||
42 | static int isku_receive_control_status(struct usb_device *usb_dev) | ||
43 | { | ||
44 | int retval; | ||
45 | struct isku_control control; | ||
46 | |||
47 | do { | ||
48 | msleep(50); | ||
49 | retval = isku_receive(usb_dev, ISKU_COMMAND_CONTROL, | ||
50 | &control, sizeof(struct isku_control)); | ||
51 | |||
52 | if (retval) | ||
53 | return retval; | ||
54 | |||
55 | switch (control.value) { | ||
56 | case ISKU_CONTROL_VALUE_STATUS_OK: | ||
57 | return 0; | ||
58 | case ISKU_CONTROL_VALUE_STATUS_WAIT: | ||
59 | continue; | ||
60 | case ISKU_CONTROL_VALUE_STATUS_INVALID: | ||
61 | /* seems to be critical - replug necessary */ | ||
62 | case ISKU_CONTROL_VALUE_STATUS_OVERLOAD: | ||
63 | return -EINVAL; | ||
64 | default: | ||
65 | hid_err(usb_dev, "isku_receive_control_status: " | ||
66 | "unknown response value 0x%x\n", | ||
67 | control.value); | ||
68 | return -EINVAL; | ||
69 | } | ||
70 | |||
71 | } while (1); | ||
72 | } | ||
73 | |||
74 | static int isku_send(struct usb_device *usb_dev, uint command, | ||
75 | void const *buf, uint size) | ||
76 | { | ||
77 | int retval; | ||
78 | |||
79 | retval = roccat_common_send(usb_dev, command, buf, size); | ||
80 | if (retval) | ||
81 | return retval; | ||
82 | |||
83 | return isku_receive_control_status(usb_dev); | ||
84 | } | 40 | } |
85 | 41 | ||
86 | static int isku_get_actual_profile(struct usb_device *usb_dev) | 42 | static int isku_get_actual_profile(struct usb_device *usb_dev) |
@@ -100,7 +56,8 @@ static int isku_set_actual_profile(struct usb_device *usb_dev, int new_profile) | |||
100 | buf.command = ISKU_COMMAND_ACTUAL_PROFILE; | 56 | buf.command = ISKU_COMMAND_ACTUAL_PROFILE; |
101 | buf.size = sizeof(struct isku_actual_profile); | 57 | buf.size = sizeof(struct isku_actual_profile); |
102 | buf.actual_profile = new_profile; | 58 | buf.actual_profile = new_profile; |
103 | return isku_send(usb_dev, ISKU_COMMAND_ACTUAL_PROFILE, &buf, | 59 | return roccat_common2_send_with_status(usb_dev, |
60 | ISKU_COMMAND_ACTUAL_PROFILE, &buf, | ||
104 | sizeof(struct isku_actual_profile)); | 61 | sizeof(struct isku_actual_profile)); |
105 | } | 62 | } |
106 | 63 | ||
@@ -197,7 +154,8 @@ static ssize_t isku_sysfs_write(struct file *fp, struct kobject *kobj, | |||
197 | return -EINVAL; | 154 | return -EINVAL; |
198 | 155 | ||
199 | mutex_lock(&isku->isku_lock); | 156 | mutex_lock(&isku->isku_lock); |
200 | retval = isku_send(usb_dev, command, (void *)buf, real_size); | 157 | retval = roccat_common2_send_with_status(usb_dev, command, |
158 | (void *)buf, real_size); | ||
201 | mutex_unlock(&isku->isku_lock); | 159 | mutex_unlock(&isku->isku_lock); |
202 | 160 | ||
203 | return retval ? retval : real_size; | 161 | return retval ? retval : real_size; |
diff --git a/drivers/hid/hid-roccat-isku.h b/drivers/hid/hid-roccat-isku.h index 075f6efaec58..605b3ce21638 100644 --- a/drivers/hid/hid-roccat-isku.h +++ b/drivers/hid/hid-roccat-isku.h | |||
@@ -25,13 +25,6 @@ struct isku_control { | |||
25 | uint8_t request; | 25 | uint8_t request; |
26 | } __packed; | 26 | } __packed; |
27 | 27 | ||
28 | enum isku_control_values { | ||
29 | ISKU_CONTROL_VALUE_STATUS_OVERLOAD = 0, | ||
30 | ISKU_CONTROL_VALUE_STATUS_OK = 1, | ||
31 | ISKU_CONTROL_VALUE_STATUS_INVALID = 2, | ||
32 | ISKU_CONTROL_VALUE_STATUS_WAIT = 3, | ||
33 | }; | ||
34 | |||
35 | struct isku_actual_profile { | 28 | struct isku_actual_profile { |
36 | uint8_t command; /* ISKU_COMMAND_ACTUAL_PROFILE */ | 29 | uint8_t command; /* ISKU_COMMAND_ACTUAL_PROFILE */ |
37 | uint8_t size; /* always 3 */ | 30 | uint8_t size; /* always 3 */ |
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index 40090d602158..9ce2d0b615a4 100644 --- a/drivers/hid/hid-roccat-kone.c +++ b/drivers/hid/hid-roccat-kone.c | |||
@@ -138,7 +138,7 @@ static int kone_check_write(struct usb_device *usb_dev) | |||
138 | return 0; | 138 | return 0; |
139 | 139 | ||
140 | /* unknown answer */ | 140 | /* unknown answer */ |
141 | hid_err(usb_dev, "got retval %d when checking write\n", data); | 141 | dev_err(&usb_dev->dev, "got retval %d when checking write\n", data); |
142 | return -EIO; | 142 | return -EIO; |
143 | } | 143 | } |
144 | 144 | ||
@@ -503,7 +503,7 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev, | |||
503 | 503 | ||
504 | retval = kone_set_settings(usb_dev, &kone->settings); | 504 | retval = kone_set_settings(usb_dev, &kone->settings); |
505 | if (retval) { | 505 | if (retval) { |
506 | hid_err(usb_dev, "couldn't set tcu state\n"); | 506 | dev_err(&usb_dev->dev, "couldn't set tcu state\n"); |
507 | /* | 507 | /* |
508 | * try to reread valid settings into buffer overwriting | 508 | * try to reread valid settings into buffer overwriting |
509 | * first error code | 509 | * first error code |
@@ -519,7 +519,7 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev, | |||
519 | 519 | ||
520 | retval = size; | 520 | retval = size; |
521 | exit_no_settings: | 521 | exit_no_settings: |
522 | hid_err(usb_dev, "couldn't read settings\n"); | 522 | dev_err(&usb_dev->dev, "couldn't read settings\n"); |
523 | exit_unlock: | 523 | exit_unlock: |
524 | mutex_unlock(&kone->kone_lock); | 524 | mutex_unlock(&kone->kone_lock); |
525 | return retval; | 525 | return retval; |
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c index 59e47770fa10..f5602fec4865 100644 --- a/drivers/hid/hid-roccat-koneplus.c +++ b/drivers/hid/hid-roccat-koneplus.c | |||
@@ -39,88 +39,26 @@ static void koneplus_profile_activated(struct koneplus_device *koneplus, | |||
39 | static int koneplus_send_control(struct usb_device *usb_dev, uint value, | 39 | static int koneplus_send_control(struct usb_device *usb_dev, uint value, |
40 | enum koneplus_control_requests request) | 40 | enum koneplus_control_requests request) |
41 | { | 41 | { |
42 | struct koneplus_control control; | 42 | struct roccat_common2_control control; |
43 | 43 | ||
44 | if ((request == KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS || | 44 | if ((request == KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS || |
45 | request == KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS) && | 45 | request == KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS) && |
46 | value > 4) | 46 | value > 4) |
47 | return -EINVAL; | 47 | return -EINVAL; |
48 | 48 | ||
49 | control.command = KONEPLUS_COMMAND_CONTROL; | 49 | control.command = ROCCAT_COMMON_COMMAND_CONTROL; |
50 | control.value = value; | 50 | control.value = value; |
51 | control.request = request; | 51 | control.request = request; |
52 | 52 | ||
53 | return roccat_common_send(usb_dev, KONEPLUS_COMMAND_CONTROL, | 53 | return roccat_common2_send_with_status(usb_dev, |
54 | &control, sizeof(struct koneplus_control)); | 54 | ROCCAT_COMMON_COMMAND_CONTROL, |
55 | } | 55 | &control, sizeof(struct roccat_common2_control)); |
56 | |||
57 | static int koneplus_receive_control_status(struct usb_device *usb_dev) | ||
58 | { | ||
59 | int retval; | ||
60 | struct koneplus_control control; | ||
61 | |||
62 | do { | ||
63 | retval = roccat_common_receive(usb_dev, KONEPLUS_COMMAND_CONTROL, | ||
64 | &control, sizeof(struct koneplus_control)); | ||
65 | |||
66 | /* check if we get a completely wrong answer */ | ||
67 | if (retval) | ||
68 | return retval; | ||
69 | |||
70 | if (control.value == KONEPLUS_CONTROL_REQUEST_STATUS_OK) | ||
71 | return 0; | ||
72 | |||
73 | /* indicates that hardware needs some more time to complete action */ | ||
74 | if (control.value == KONEPLUS_CONTROL_REQUEST_STATUS_WAIT) { | ||
75 | msleep(500); /* windows driver uses 1000 */ | ||
76 | continue; | ||
77 | } | ||
78 | |||
79 | /* seems to be critical - replug necessary */ | ||
80 | if (control.value == KONEPLUS_CONTROL_REQUEST_STATUS_OVERLOAD) | ||
81 | return -EINVAL; | ||
82 | |||
83 | hid_err(usb_dev, "koneplus_receive_control_status: " | ||
84 | "unknown response value 0x%x\n", control.value); | ||
85 | return -EINVAL; | ||
86 | } while (1); | ||
87 | } | ||
88 | |||
89 | static int koneplus_send(struct usb_device *usb_dev, uint command, | ||
90 | void const *buf, uint size) | ||
91 | { | ||
92 | int retval; | ||
93 | |||
94 | retval = roccat_common_send(usb_dev, command, buf, size); | ||
95 | if (retval) | ||
96 | return retval; | ||
97 | |||
98 | return koneplus_receive_control_status(usb_dev); | ||
99 | } | ||
100 | |||
101 | static int koneplus_select_profile(struct usb_device *usb_dev, uint number, | ||
102 | enum koneplus_control_requests request) | ||
103 | { | ||
104 | int retval; | ||
105 | |||
106 | retval = koneplus_send_control(usb_dev, number, request); | ||
107 | if (retval) | ||
108 | return retval; | ||
109 | |||
110 | /* allow time to settle things - windows driver uses 500 */ | ||
111 | msleep(100); | ||
112 | |||
113 | retval = koneplus_receive_control_status(usb_dev); | ||
114 | if (retval) | ||
115 | return retval; | ||
116 | |||
117 | return 0; | ||
118 | } | 56 | } |
119 | 57 | ||
120 | static int koneplus_get_info(struct usb_device *usb_dev, | 58 | static int koneplus_get_info(struct usb_device *usb_dev, |
121 | struct koneplus_info *buf) | 59 | struct koneplus_info *buf) |
122 | { | 60 | { |
123 | return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_INFO, | 61 | return roccat_common2_receive(usb_dev, KONEPLUS_COMMAND_INFO, |
124 | buf, sizeof(struct koneplus_info)); | 62 | buf, sizeof(struct koneplus_info)); |
125 | } | 63 | } |
126 | 64 | ||
@@ -129,19 +67,20 @@ static int koneplus_get_profile_settings(struct usb_device *usb_dev, | |||
129 | { | 67 | { |
130 | int retval; | 68 | int retval; |
131 | 69 | ||
132 | retval = koneplus_select_profile(usb_dev, number, | 70 | retval = koneplus_send_control(usb_dev, number, |
133 | KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS); | 71 | KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS); |
134 | if (retval) | 72 | if (retval) |
135 | return retval; | 73 | return retval; |
136 | 74 | ||
137 | return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_PROFILE_SETTINGS, | 75 | return roccat_common2_receive(usb_dev, KONEPLUS_COMMAND_PROFILE_SETTINGS, |
138 | buf, sizeof(struct koneplus_profile_settings)); | 76 | buf, sizeof(struct koneplus_profile_settings)); |
139 | } | 77 | } |
140 | 78 | ||
141 | static int koneplus_set_profile_settings(struct usb_device *usb_dev, | 79 | static int koneplus_set_profile_settings(struct usb_device *usb_dev, |
142 | struct koneplus_profile_settings const *settings) | 80 | struct koneplus_profile_settings const *settings) |
143 | { | 81 | { |
144 | return koneplus_send(usb_dev, KONEPLUS_COMMAND_PROFILE_SETTINGS, | 82 | return roccat_common2_send_with_status(usb_dev, |
83 | KONEPLUS_COMMAND_PROFILE_SETTINGS, | ||
145 | settings, sizeof(struct koneplus_profile_settings)); | 84 | settings, sizeof(struct koneplus_profile_settings)); |
146 | } | 85 | } |
147 | 86 | ||
@@ -150,19 +89,20 @@ static int koneplus_get_profile_buttons(struct usb_device *usb_dev, | |||
150 | { | 89 | { |
151 | int retval; | 90 | int retval; |
152 | 91 | ||
153 | retval = koneplus_select_profile(usb_dev, number, | 92 | retval = koneplus_send_control(usb_dev, number, |
154 | KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS); | 93 | KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS); |
155 | if (retval) | 94 | if (retval) |
156 | return retval; | 95 | return retval; |
157 | 96 | ||
158 | return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_PROFILE_BUTTONS, | 97 | return roccat_common2_receive(usb_dev, KONEPLUS_COMMAND_PROFILE_BUTTONS, |
159 | buf, sizeof(struct koneplus_profile_buttons)); | 98 | buf, sizeof(struct koneplus_profile_buttons)); |
160 | } | 99 | } |
161 | 100 | ||
162 | static int koneplus_set_profile_buttons(struct usb_device *usb_dev, | 101 | static int koneplus_set_profile_buttons(struct usb_device *usb_dev, |
163 | struct koneplus_profile_buttons const *buttons) | 102 | struct koneplus_profile_buttons const *buttons) |
164 | { | 103 | { |
165 | return koneplus_send(usb_dev, KONEPLUS_COMMAND_PROFILE_BUTTONS, | 104 | return roccat_common2_send_with_status(usb_dev, |
105 | KONEPLUS_COMMAND_PROFILE_BUTTONS, | ||
166 | buttons, sizeof(struct koneplus_profile_buttons)); | 106 | buttons, sizeof(struct koneplus_profile_buttons)); |
167 | } | 107 | } |
168 | 108 | ||
@@ -172,7 +112,7 @@ static int koneplus_get_actual_profile(struct usb_device *usb_dev) | |||
172 | struct koneplus_actual_profile buf; | 112 | struct koneplus_actual_profile buf; |
173 | int retval; | 113 | int retval; |
174 | 114 | ||
175 | retval = roccat_common_receive(usb_dev, KONEPLUS_COMMAND_ACTUAL_PROFILE, | 115 | retval = roccat_common2_receive(usb_dev, KONEPLUS_COMMAND_ACTUAL_PROFILE, |
176 | &buf, sizeof(struct koneplus_actual_profile)); | 116 | &buf, sizeof(struct koneplus_actual_profile)); |
177 | 117 | ||
178 | return retval ? retval : buf.actual_profile; | 118 | return retval ? retval : buf.actual_profile; |
@@ -187,7 +127,8 @@ static int koneplus_set_actual_profile(struct usb_device *usb_dev, | |||
187 | buf.size = sizeof(struct koneplus_actual_profile); | 127 | buf.size = sizeof(struct koneplus_actual_profile); |
188 | buf.actual_profile = new_profile; | 128 | buf.actual_profile = new_profile; |
189 | 129 | ||
190 | return koneplus_send(usb_dev, KONEPLUS_COMMAND_ACTUAL_PROFILE, | 130 | return roccat_common2_send_with_status(usb_dev, |
131 | KONEPLUS_COMMAND_ACTUAL_PROFILE, | ||
191 | &buf, sizeof(struct koneplus_actual_profile)); | 132 | &buf, sizeof(struct koneplus_actual_profile)); |
192 | } | 133 | } |
193 | 134 | ||
@@ -208,7 +149,7 @@ static ssize_t koneplus_sysfs_read(struct file *fp, struct kobject *kobj, | |||
208 | return -EINVAL; | 149 | return -EINVAL; |
209 | 150 | ||
210 | mutex_lock(&koneplus->koneplus_lock); | 151 | mutex_lock(&koneplus->koneplus_lock); |
211 | retval = roccat_common_receive(usb_dev, command, buf, real_size); | 152 | retval = roccat_common2_receive(usb_dev, command, buf, real_size); |
212 | mutex_unlock(&koneplus->koneplus_lock); | 153 | mutex_unlock(&koneplus->koneplus_lock); |
213 | 154 | ||
214 | if (retval) | 155 | if (retval) |
@@ -231,7 +172,8 @@ static ssize_t koneplus_sysfs_write(struct file *fp, struct kobject *kobj, | |||
231 | return -EINVAL; | 172 | return -EINVAL; |
232 | 173 | ||
233 | mutex_lock(&koneplus->koneplus_lock); | 174 | mutex_lock(&koneplus->koneplus_lock); |
234 | retval = koneplus_send(usb_dev, command, buf, real_size); | 175 | retval = roccat_common2_send_with_status(usb_dev, command, |
176 | buf, real_size); | ||
235 | mutex_unlock(&koneplus->koneplus_lock); | 177 | mutex_unlock(&koneplus->koneplus_lock); |
236 | 178 | ||
237 | if (retval) | 179 | if (retval) |
diff --git a/drivers/hid/hid-roccat-koneplus.h b/drivers/hid/hid-roccat-koneplus.h index c03332a4fa9a..7074b2a4b94b 100644 --- a/drivers/hid/hid-roccat-koneplus.h +++ b/drivers/hid/hid-roccat-koneplus.h | |||
@@ -20,32 +20,11 @@ struct koneplus_talk { | |||
20 | uint8_t data[14]; | 20 | uint8_t data[14]; |
21 | } __packed; | 21 | } __packed; |
22 | 22 | ||
23 | /* | ||
24 | * case 1: writes request 80 and reads value 1 | ||
25 | * | ||
26 | */ | ||
27 | struct koneplus_control { | ||
28 | uint8_t command; /* KONEPLUS_COMMAND_CONTROL */ | ||
29 | /* | ||
30 | * value is profile number in range 0-4 for requesting settings and buttons | ||
31 | * 1 if status ok for requesting status | ||
32 | */ | ||
33 | uint8_t value; | ||
34 | uint8_t request; | ||
35 | } __attribute__ ((__packed__)); | ||
36 | |||
37 | enum koneplus_control_requests { | 23 | enum koneplus_control_requests { |
38 | KONEPLUS_CONTROL_REQUEST_STATUS = 0x00, | ||
39 | KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80, | 24 | KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80, |
40 | KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90, | 25 | KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90, |
41 | }; | 26 | }; |
42 | 27 | ||
43 | enum koneplus_control_values { | ||
44 | KONEPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0, | ||
45 | KONEPLUS_CONTROL_REQUEST_STATUS_OK = 1, | ||
46 | KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3, | ||
47 | }; | ||
48 | |||
49 | struct koneplus_actual_profile { | 28 | struct koneplus_actual_profile { |
50 | uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */ | 29 | uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */ |
51 | uint8_t size; /* always 3 */ | 30 | uint8_t size; /* always 3 */ |
@@ -137,7 +116,6 @@ struct koneplus_tcu_image { | |||
137 | } __attribute__ ((__packed__)); | 116 | } __attribute__ ((__packed__)); |
138 | 117 | ||
139 | enum koneplus_commands { | 118 | enum koneplus_commands { |
140 | KONEPLUS_COMMAND_CONTROL = 0x4, | ||
141 | KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5, | 119 | KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5, |
142 | KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6, | 120 | KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6, |
143 | KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7, | 121 | KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7, |
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c index 112d934132c8..ca6527ac655d 100644 --- a/drivers/hid/hid-roccat-kovaplus.c +++ b/drivers/hid/hid-roccat-kovaplus.c | |||
@@ -47,69 +47,23 @@ static int kovaplus_send_control(struct usb_device *usb_dev, uint value, | |||
47 | enum kovaplus_control_requests request) | 47 | enum kovaplus_control_requests request) |
48 | { | 48 | { |
49 | int retval; | 49 | int retval; |
50 | struct kovaplus_control control; | 50 | struct roccat_common2_control control; |
51 | 51 | ||
52 | if ((request == KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS || | 52 | if ((request == KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS || |
53 | request == KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS) && | 53 | request == KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS) && |
54 | value > 4) | 54 | value > 4) |
55 | return -EINVAL; | 55 | return -EINVAL; |
56 | 56 | ||
57 | control.command = KOVAPLUS_COMMAND_CONTROL; | 57 | control.command = ROCCAT_COMMON_COMMAND_CONTROL; |
58 | control.value = value; | 58 | control.value = value; |
59 | control.request = request; | 59 | control.request = request; |
60 | 60 | ||
61 | retval = roccat_common_send(usb_dev, KOVAPLUS_COMMAND_CONTROL, | 61 | retval = roccat_common2_send(usb_dev, ROCCAT_COMMON_COMMAND_CONTROL, |
62 | &control, sizeof(struct kovaplus_control)); | 62 | &control, sizeof(struct roccat_common2_control)); |
63 | 63 | ||
64 | return retval; | 64 | return retval; |
65 | } | 65 | } |
66 | 66 | ||
67 | static int kovaplus_receive_control_status(struct usb_device *usb_dev) | ||
68 | { | ||
69 | int retval; | ||
70 | struct kovaplus_control control; | ||
71 | |||
72 | do { | ||
73 | retval = roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_CONTROL, | ||
74 | &control, sizeof(struct kovaplus_control)); | ||
75 | |||
76 | /* check if we get a completely wrong answer */ | ||
77 | if (retval) | ||
78 | return retval; | ||
79 | |||
80 | if (control.value == KOVAPLUS_CONTROL_REQUEST_STATUS_OK) | ||
81 | return 0; | ||
82 | |||
83 | /* indicates that hardware needs some more time to complete action */ | ||
84 | if (control.value == KOVAPLUS_CONTROL_REQUEST_STATUS_WAIT) { | ||
85 | msleep(500); /* windows driver uses 1000 */ | ||
86 | continue; | ||
87 | } | ||
88 | |||
89 | /* seems to be critical - replug necessary */ | ||
90 | if (control.value == KOVAPLUS_CONTROL_REQUEST_STATUS_OVERLOAD) | ||
91 | return -EINVAL; | ||
92 | |||
93 | hid_err(usb_dev, "roccat_common_receive_control_status: " | ||
94 | "unknown response value 0x%x\n", control.value); | ||
95 | return -EINVAL; | ||
96 | } while (1); | ||
97 | } | ||
98 | |||
99 | static int kovaplus_send(struct usb_device *usb_dev, uint command, | ||
100 | void const *buf, uint size) | ||
101 | { | ||
102 | int retval; | ||
103 | |||
104 | retval = roccat_common_send(usb_dev, command, buf, size); | ||
105 | if (retval) | ||
106 | return retval; | ||
107 | |||
108 | msleep(100); | ||
109 | |||
110 | return kovaplus_receive_control_status(usb_dev); | ||
111 | } | ||
112 | |||
113 | static int kovaplus_select_profile(struct usb_device *usb_dev, uint number, | 67 | static int kovaplus_select_profile(struct usb_device *usb_dev, uint number, |
114 | enum kovaplus_control_requests request) | 68 | enum kovaplus_control_requests request) |
115 | { | 69 | { |
@@ -119,7 +73,7 @@ static int kovaplus_select_profile(struct usb_device *usb_dev, uint number, | |||
119 | static int kovaplus_get_info(struct usb_device *usb_dev, | 73 | static int kovaplus_get_info(struct usb_device *usb_dev, |
120 | struct kovaplus_info *buf) | 74 | struct kovaplus_info *buf) |
121 | { | 75 | { |
122 | return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_INFO, | 76 | return roccat_common2_receive(usb_dev, KOVAPLUS_COMMAND_INFO, |
123 | buf, sizeof(struct kovaplus_info)); | 77 | buf, sizeof(struct kovaplus_info)); |
124 | } | 78 | } |
125 | 79 | ||
@@ -133,14 +87,15 @@ static int kovaplus_get_profile_settings(struct usb_device *usb_dev, | |||
133 | if (retval) | 87 | if (retval) |
134 | return retval; | 88 | return retval; |
135 | 89 | ||
136 | return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_SETTINGS, | 90 | return roccat_common2_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_SETTINGS, |
137 | buf, sizeof(struct kovaplus_profile_settings)); | 91 | buf, sizeof(struct kovaplus_profile_settings)); |
138 | } | 92 | } |
139 | 93 | ||
140 | static int kovaplus_set_profile_settings(struct usb_device *usb_dev, | 94 | static int kovaplus_set_profile_settings(struct usb_device *usb_dev, |
141 | struct kovaplus_profile_settings const *settings) | 95 | struct kovaplus_profile_settings const *settings) |
142 | { | 96 | { |
143 | return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_PROFILE_SETTINGS, | 97 | return roccat_common2_send_with_status(usb_dev, |
98 | KOVAPLUS_COMMAND_PROFILE_SETTINGS, | ||
144 | settings, sizeof(struct kovaplus_profile_settings)); | 99 | settings, sizeof(struct kovaplus_profile_settings)); |
145 | } | 100 | } |
146 | 101 | ||
@@ -154,14 +109,15 @@ static int kovaplus_get_profile_buttons(struct usb_device *usb_dev, | |||
154 | if (retval) | 109 | if (retval) |
155 | return retval; | 110 | return retval; |
156 | 111 | ||
157 | return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_BUTTONS, | 112 | return roccat_common2_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_BUTTONS, |
158 | buf, sizeof(struct kovaplus_profile_buttons)); | 113 | buf, sizeof(struct kovaplus_profile_buttons)); |
159 | } | 114 | } |
160 | 115 | ||
161 | static int kovaplus_set_profile_buttons(struct usb_device *usb_dev, | 116 | static int kovaplus_set_profile_buttons(struct usb_device *usb_dev, |
162 | struct kovaplus_profile_buttons const *buttons) | 117 | struct kovaplus_profile_buttons const *buttons) |
163 | { | 118 | { |
164 | return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_PROFILE_BUTTONS, | 119 | return roccat_common2_send_with_status(usb_dev, |
120 | KOVAPLUS_COMMAND_PROFILE_BUTTONS, | ||
165 | buttons, sizeof(struct kovaplus_profile_buttons)); | 121 | buttons, sizeof(struct kovaplus_profile_buttons)); |
166 | } | 122 | } |
167 | 123 | ||
@@ -171,7 +127,7 @@ static int kovaplus_get_actual_profile(struct usb_device *usb_dev) | |||
171 | struct kovaplus_actual_profile buf; | 127 | struct kovaplus_actual_profile buf; |
172 | int retval; | 128 | int retval; |
173 | 129 | ||
174 | retval = roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_ACTUAL_PROFILE, | 130 | retval = roccat_common2_receive(usb_dev, KOVAPLUS_COMMAND_ACTUAL_PROFILE, |
175 | &buf, sizeof(struct kovaplus_actual_profile)); | 131 | &buf, sizeof(struct kovaplus_actual_profile)); |
176 | 132 | ||
177 | return retval ? retval : buf.actual_profile; | 133 | return retval ? retval : buf.actual_profile; |
@@ -186,7 +142,8 @@ static int kovaplus_set_actual_profile(struct usb_device *usb_dev, | |||
186 | buf.size = sizeof(struct kovaplus_actual_profile); | 142 | buf.size = sizeof(struct kovaplus_actual_profile); |
187 | buf.actual_profile = new_profile; | 143 | buf.actual_profile = new_profile; |
188 | 144 | ||
189 | return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_ACTUAL_PROFILE, | 145 | return roccat_common2_send_with_status(usb_dev, |
146 | KOVAPLUS_COMMAND_ACTUAL_PROFILE, | ||
190 | &buf, sizeof(struct kovaplus_actual_profile)); | 147 | &buf, sizeof(struct kovaplus_actual_profile)); |
191 | } | 148 | } |
192 | 149 | ||
diff --git a/drivers/hid/hid-roccat-kovaplus.h b/drivers/hid/hid-roccat-kovaplus.h index fb2aed44a8e0..f82daa1cdcb9 100644 --- a/drivers/hid/hid-roccat-kovaplus.h +++ b/drivers/hid/hid-roccat-kovaplus.h | |||
@@ -14,27 +14,13 @@ | |||
14 | 14 | ||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | 16 | ||
17 | struct kovaplus_control { | ||
18 | uint8_t command; /* KOVAPLUS_COMMAND_CONTROL */ | ||
19 | uint8_t value; | ||
20 | uint8_t request; | ||
21 | } __packed; | ||
22 | |||
23 | enum kovaplus_control_requests { | 17 | enum kovaplus_control_requests { |
24 | /* read after write; value = 1 */ | ||
25 | KOVAPLUS_CONTROL_REQUEST_STATUS = 0x0, | ||
26 | /* write; value = profile number range 0-4 */ | 18 | /* write; value = profile number range 0-4 */ |
27 | KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10, | 19 | KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10, |
28 | /* write; value = profile number range 0-4 */ | 20 | /* write; value = profile number range 0-4 */ |
29 | KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20, | 21 | KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20, |
30 | }; | 22 | }; |
31 | 23 | ||
32 | enum kovaplus_control_values { | ||
33 | KOVAPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0, /* supposed */ | ||
34 | KOVAPLUS_CONTROL_REQUEST_STATUS_OK = 1, | ||
35 | KOVAPLUS_CONTROL_REQUEST_STATUS_WAIT = 3, /* supposed */ | ||
36 | }; | ||
37 | |||
38 | struct kovaplus_actual_profile { | 24 | struct kovaplus_actual_profile { |
39 | uint8_t command; /* KOVAPLUS_COMMAND_ACTUAL_PROFILE */ | 25 | uint8_t command; /* KOVAPLUS_COMMAND_ACTUAL_PROFILE */ |
40 | uint8_t size; /* always 3 */ | 26 | uint8_t size; /* always 3 */ |
@@ -75,7 +61,6 @@ struct kovaplus_a { | |||
75 | } __packed; | 61 | } __packed; |
76 | 62 | ||
77 | enum kovaplus_commands { | 63 | enum kovaplus_commands { |
78 | KOVAPLUS_COMMAND_CONTROL = 0x4, | ||
79 | KOVAPLUS_COMMAND_ACTUAL_PROFILE = 0x5, | 64 | KOVAPLUS_COMMAND_ACTUAL_PROFILE = 0x5, |
80 | KOVAPLUS_COMMAND_PROFILE_SETTINGS = 0x6, | 65 | KOVAPLUS_COMMAND_PROFILE_SETTINGS = 0x6, |
81 | KOVAPLUS_COMMAND_PROFILE_BUTTONS = 0x7, | 66 | KOVAPLUS_COMMAND_PROFILE_BUTTONS = 0x7, |
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index df05c1b1064f..1317c177a3e2 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c | |||
@@ -42,43 +42,19 @@ static void profile_activated(struct pyra_device *pyra, | |||
42 | static int pyra_send_control(struct usb_device *usb_dev, int value, | 42 | static int pyra_send_control(struct usb_device *usb_dev, int value, |
43 | enum pyra_control_requests request) | 43 | enum pyra_control_requests request) |
44 | { | 44 | { |
45 | struct pyra_control control; | 45 | struct roccat_common2_control control; |
46 | 46 | ||
47 | if ((request == PYRA_CONTROL_REQUEST_PROFILE_SETTINGS || | 47 | if ((request == PYRA_CONTROL_REQUEST_PROFILE_SETTINGS || |
48 | request == PYRA_CONTROL_REQUEST_PROFILE_BUTTONS) && | 48 | request == PYRA_CONTROL_REQUEST_PROFILE_BUTTONS) && |
49 | (value < 0 || value > 4)) | 49 | (value < 0 || value > 4)) |
50 | return -EINVAL; | 50 | return -EINVAL; |
51 | 51 | ||
52 | control.command = PYRA_COMMAND_CONTROL; | 52 | control.command = ROCCAT_COMMON_COMMAND_CONTROL; |
53 | control.value = value; | 53 | control.value = value; |
54 | control.request = request; | 54 | control.request = request; |
55 | 55 | ||
56 | return roccat_common_send(usb_dev, PYRA_COMMAND_CONTROL, | 56 | return roccat_common2_send(usb_dev, ROCCAT_COMMON_COMMAND_CONTROL, |
57 | &control, sizeof(struct pyra_control)); | 57 | &control, sizeof(struct roccat_common2_control)); |
58 | } | ||
59 | |||
60 | static int pyra_receive_control_status(struct usb_device *usb_dev) | ||
61 | { | ||
62 | int retval; | ||
63 | struct pyra_control control; | ||
64 | |||
65 | do { | ||
66 | msleep(10); | ||
67 | retval = roccat_common_receive(usb_dev, PYRA_COMMAND_CONTROL, | ||
68 | &control, sizeof(struct pyra_control)); | ||
69 | |||
70 | /* requested too early, try again */ | ||
71 | } while (retval == -EPROTO); | ||
72 | |||
73 | if (!retval && control.command == PYRA_COMMAND_CONTROL && | ||
74 | control.request == PYRA_CONTROL_REQUEST_STATUS && | ||
75 | control.value == 1) | ||
76 | return 0; | ||
77 | else { | ||
78 | hid_err(usb_dev, "receive control status: unknown response 0x%x 0x%x\n", | ||
79 | control.request, control.value); | ||
80 | return retval ? retval : -EINVAL; | ||
81 | } | ||
82 | } | 58 | } |
83 | 59 | ||
84 | static int pyra_get_profile_settings(struct usb_device *usb_dev, | 60 | static int pyra_get_profile_settings(struct usb_device *usb_dev, |
@@ -89,7 +65,7 @@ static int pyra_get_profile_settings(struct usb_device *usb_dev, | |||
89 | PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); | 65 | PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); |
90 | if (retval) | 66 | if (retval) |
91 | return retval; | 67 | return retval; |
92 | return roccat_common_receive(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, | 68 | return roccat_common2_receive(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, |
93 | buf, sizeof(struct pyra_profile_settings)); | 69 | buf, sizeof(struct pyra_profile_settings)); |
94 | } | 70 | } |
95 | 71 | ||
@@ -101,51 +77,44 @@ static int pyra_get_profile_buttons(struct usb_device *usb_dev, | |||
101 | PYRA_CONTROL_REQUEST_PROFILE_BUTTONS); | 77 | PYRA_CONTROL_REQUEST_PROFILE_BUTTONS); |
102 | if (retval) | 78 | if (retval) |
103 | return retval; | 79 | return retval; |
104 | return roccat_common_receive(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS, | 80 | return roccat_common2_receive(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS, |
105 | buf, sizeof(struct pyra_profile_buttons)); | 81 | buf, sizeof(struct pyra_profile_buttons)); |
106 | } | 82 | } |
107 | 83 | ||
108 | static int pyra_get_settings(struct usb_device *usb_dev, | 84 | static int pyra_get_settings(struct usb_device *usb_dev, |
109 | struct pyra_settings *buf) | 85 | struct pyra_settings *buf) |
110 | { | 86 | { |
111 | return roccat_common_receive(usb_dev, PYRA_COMMAND_SETTINGS, | 87 | return roccat_common2_receive(usb_dev, PYRA_COMMAND_SETTINGS, |
112 | buf, sizeof(struct pyra_settings)); | 88 | buf, sizeof(struct pyra_settings)); |
113 | } | 89 | } |
114 | 90 | ||
115 | static int pyra_get_info(struct usb_device *usb_dev, struct pyra_info *buf) | 91 | static int pyra_get_info(struct usb_device *usb_dev, struct pyra_info *buf) |
116 | { | 92 | { |
117 | return roccat_common_receive(usb_dev, PYRA_COMMAND_INFO, | 93 | return roccat_common2_receive(usb_dev, PYRA_COMMAND_INFO, |
118 | buf, sizeof(struct pyra_info)); | 94 | buf, sizeof(struct pyra_info)); |
119 | } | 95 | } |
120 | 96 | ||
121 | static int pyra_send(struct usb_device *usb_dev, uint command, | ||
122 | void const *buf, uint size) | ||
123 | { | ||
124 | int retval; | ||
125 | retval = roccat_common_send(usb_dev, command, buf, size); | ||
126 | if (retval) | ||
127 | return retval; | ||
128 | return pyra_receive_control_status(usb_dev); | ||
129 | } | ||
130 | |||
131 | static int pyra_set_profile_settings(struct usb_device *usb_dev, | 97 | static int pyra_set_profile_settings(struct usb_device *usb_dev, |
132 | struct pyra_profile_settings const *settings) | 98 | struct pyra_profile_settings const *settings) |
133 | { | 99 | { |
134 | return pyra_send(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, settings, | 100 | return roccat_common2_send_with_status(usb_dev, |
101 | PYRA_COMMAND_PROFILE_SETTINGS, settings, | ||
135 | sizeof(struct pyra_profile_settings)); | 102 | sizeof(struct pyra_profile_settings)); |
136 | } | 103 | } |
137 | 104 | ||
138 | static int pyra_set_profile_buttons(struct usb_device *usb_dev, | 105 | static int pyra_set_profile_buttons(struct usb_device *usb_dev, |
139 | struct pyra_profile_buttons const *buttons) | 106 | struct pyra_profile_buttons const *buttons) |
140 | { | 107 | { |
141 | return pyra_send(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS, buttons, | 108 | return roccat_common2_send_with_status(usb_dev, |
109 | PYRA_COMMAND_PROFILE_BUTTONS, buttons, | ||
142 | sizeof(struct pyra_profile_buttons)); | 110 | sizeof(struct pyra_profile_buttons)); |
143 | } | 111 | } |
144 | 112 | ||
145 | static int pyra_set_settings(struct usb_device *usb_dev, | 113 | static int pyra_set_settings(struct usb_device *usb_dev, |
146 | struct pyra_settings const *settings) | 114 | struct pyra_settings const *settings) |
147 | { | 115 | { |
148 | return pyra_send(usb_dev, PYRA_COMMAND_SETTINGS, settings, | 116 | return roccat_common2_send_with_status(usb_dev, |
117 | PYRA_COMMAND_SETTINGS, settings, | ||
149 | sizeof(struct pyra_settings)); | 118 | sizeof(struct pyra_settings)); |
150 | } | 119 | } |
151 | 120 | ||
diff --git a/drivers/hid/hid-roccat-pyra.h b/drivers/hid/hid-roccat-pyra.h index 0442d7fa2dcf..eada7830fa99 100644 --- a/drivers/hid/hid-roccat-pyra.h +++ b/drivers/hid/hid-roccat-pyra.h | |||
@@ -20,18 +20,7 @@ struct pyra_b { | |||
20 | uint8_t unknown; /* 1 */ | 20 | uint8_t unknown; /* 1 */ |
21 | } __attribute__ ((__packed__)); | 21 | } __attribute__ ((__packed__)); |
22 | 22 | ||
23 | struct pyra_control { | ||
24 | uint8_t command; /* PYRA_COMMAND_CONTROL */ | ||
25 | /* | ||
26 | * value is profile number for request_settings and request_buttons | ||
27 | * 1 if status ok for request_status | ||
28 | */ | ||
29 | uint8_t value; /* Range 0-4 */ | ||
30 | uint8_t request; | ||
31 | } __attribute__ ((__packed__)); | ||
32 | |||
33 | enum pyra_control_requests { | 23 | enum pyra_control_requests { |
34 | PYRA_CONTROL_REQUEST_STATUS = 0x00, | ||
35 | PYRA_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10, | 24 | PYRA_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10, |
36 | PYRA_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20 | 25 | PYRA_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20 |
37 | }; | 26 | }; |
@@ -75,7 +64,6 @@ struct pyra_info { | |||
75 | } __attribute__ ((__packed__)); | 64 | } __attribute__ ((__packed__)); |
76 | 65 | ||
77 | enum pyra_commands { | 66 | enum pyra_commands { |
78 | PYRA_COMMAND_CONTROL = 0x4, | ||
79 | PYRA_COMMAND_SETTINGS = 0x5, | 67 | PYRA_COMMAND_SETTINGS = 0x5, |
80 | PYRA_COMMAND_PROFILE_SETTINGS = 0x6, | 68 | PYRA_COMMAND_PROFILE_SETTINGS = 0x6, |
81 | PYRA_COMMAND_PROFILE_BUTTONS = 0x7, | 69 | PYRA_COMMAND_PROFILE_BUTTONS = 0x7, |
diff --git a/drivers/hid/hid-roccat-savu.c b/drivers/hid/hid-roccat-savu.c new file mode 100644 index 000000000000..014afba407e0 --- /dev/null +++ b/drivers/hid/hid-roccat-savu.c | |||
@@ -0,0 +1,316 @@ | |||
1 | /* | ||
2 | * Roccat Savu driver for Linux | ||
3 | * | ||
4 | * Copyright (c) 2012 Stefan Achatz <erazor_de@users.sourceforge.net> | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation; either version 2 of the License, or (at your option) | ||
11 | * any later version. | ||
12 | */ | ||
13 | |||
14 | /* Roccat Savu is a gamer mouse with macro keys that can be configured in | ||
15 | * 5 profiles. | ||
16 | */ | ||
17 | |||
18 | #include <linux/device.h> | ||
19 | #include <linux/input.h> | ||
20 | #include <linux/hid.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/hid-roccat.h> | ||
24 | #include "hid-ids.h" | ||
25 | #include "hid-roccat-common.h" | ||
26 | #include "hid-roccat-savu.h" | ||
27 | |||
28 | static struct class *savu_class; | ||
29 | |||
30 | static ssize_t savu_sysfs_read(struct file *fp, struct kobject *kobj, | ||
31 | char *buf, loff_t off, size_t count, | ||
32 | size_t real_size, uint command) | ||
33 | { | ||
34 | struct device *dev = | ||
35 | container_of(kobj, struct device, kobj)->parent->parent; | ||
36 | struct savu_device *savu = hid_get_drvdata(dev_get_drvdata(dev)); | ||
37 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | ||
38 | int retval; | ||
39 | |||
40 | if (off >= real_size) | ||
41 | return 0; | ||
42 | |||
43 | if (off != 0 || count != real_size) | ||
44 | return -EINVAL; | ||
45 | |||
46 | mutex_lock(&savu->savu_lock); | ||
47 | retval = roccat_common2_receive(usb_dev, command, buf, real_size); | ||
48 | mutex_unlock(&savu->savu_lock); | ||
49 | |||
50 | return retval ? retval : real_size; | ||
51 | } | ||
52 | |||
53 | static ssize_t savu_sysfs_write(struct file *fp, struct kobject *kobj, | ||
54 | void const *buf, loff_t off, size_t count, | ||
55 | size_t real_size, uint command) | ||
56 | { | ||
57 | struct device *dev = | ||
58 | container_of(kobj, struct device, kobj)->parent->parent; | ||
59 | struct savu_device *savu = hid_get_drvdata(dev_get_drvdata(dev)); | ||
60 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | ||
61 | int retval; | ||
62 | |||
63 | if (off != 0 || count != real_size) | ||
64 | return -EINVAL; | ||
65 | |||
66 | mutex_lock(&savu->savu_lock); | ||
67 | retval = roccat_common2_send_with_status(usb_dev, command, | ||
68 | (void *)buf, real_size); | ||
69 | mutex_unlock(&savu->savu_lock); | ||
70 | |||
71 | return retval ? retval : real_size; | ||
72 | } | ||
73 | |||
74 | #define SAVU_SYSFS_W(thingy, THINGY) \ | ||
75 | static ssize_t savu_sysfs_write_ ## thingy(struct file *fp, \ | ||
76 | struct kobject *kobj, struct bin_attribute *attr, char *buf, \ | ||
77 | loff_t off, size_t count) \ | ||
78 | { \ | ||
79 | return savu_sysfs_write(fp, kobj, buf, off, count, \ | ||
80 | SAVU_SIZE_ ## THINGY, SAVU_COMMAND_ ## THINGY); \ | ||
81 | } | ||
82 | |||
83 | #define SAVU_SYSFS_R(thingy, THINGY) \ | ||
84 | static ssize_t savu_sysfs_read_ ## thingy(struct file *fp, \ | ||
85 | struct kobject *kobj, struct bin_attribute *attr, char *buf, \ | ||
86 | loff_t off, size_t count) \ | ||
87 | { \ | ||
88 | return savu_sysfs_read(fp, kobj, buf, off, count, \ | ||
89 | SAVU_SIZE_ ## THINGY, SAVU_COMMAND_ ## THINGY); \ | ||
90 | } | ||
91 | |||
92 | #define SAVU_SYSFS_RW(thingy, THINGY) \ | ||
93 | SAVU_SYSFS_W(thingy, THINGY) \ | ||
94 | SAVU_SYSFS_R(thingy, THINGY) | ||
95 | |||
96 | #define SAVU_BIN_ATTRIBUTE_RW(thingy, THINGY) \ | ||
97 | { \ | ||
98 | .attr = { .name = #thingy, .mode = 0660 }, \ | ||
99 | .size = SAVU_SIZE_ ## THINGY, \ | ||
100 | .read = savu_sysfs_read_ ## thingy, \ | ||
101 | .write = savu_sysfs_write_ ## thingy \ | ||
102 | } | ||
103 | |||
104 | #define SAVU_BIN_ATTRIBUTE_R(thingy, THINGY) \ | ||
105 | { \ | ||
106 | .attr = { .name = #thingy, .mode = 0440 }, \ | ||
107 | .size = SAVU_SIZE_ ## THINGY, \ | ||
108 | .read = savu_sysfs_read_ ## thingy, \ | ||
109 | } | ||
110 | |||
111 | #define SAVU_BIN_ATTRIBUTE_W(thingy, THINGY) \ | ||
112 | { \ | ||
113 | .attr = { .name = #thingy, .mode = 0220 }, \ | ||
114 | .size = SAVU_SIZE_ ## THINGY, \ | ||
115 | .write = savu_sysfs_write_ ## thingy \ | ||
116 | } | ||
117 | |||
118 | SAVU_SYSFS_W(control, CONTROL) | ||
119 | SAVU_SYSFS_RW(profile, PROFILE) | ||
120 | SAVU_SYSFS_RW(general, GENERAL) | ||
121 | SAVU_SYSFS_RW(buttons, BUTTONS) | ||
122 | SAVU_SYSFS_RW(macro, MACRO) | ||
123 | SAVU_SYSFS_R(info, INFO) | ||
124 | SAVU_SYSFS_RW(sensor, SENSOR) | ||
125 | |||
126 | static struct bin_attribute savu_bin_attributes[] = { | ||
127 | SAVU_BIN_ATTRIBUTE_W(control, CONTROL), | ||
128 | SAVU_BIN_ATTRIBUTE_RW(profile, PROFILE), | ||
129 | SAVU_BIN_ATTRIBUTE_RW(general, GENERAL), | ||
130 | SAVU_BIN_ATTRIBUTE_RW(buttons, BUTTONS), | ||
131 | SAVU_BIN_ATTRIBUTE_RW(macro, MACRO), | ||
132 | SAVU_BIN_ATTRIBUTE_R(info, INFO), | ||
133 | SAVU_BIN_ATTRIBUTE_RW(sensor, SENSOR), | ||
134 | __ATTR_NULL | ||
135 | }; | ||
136 | |||
137 | static int savu_init_savu_device_struct(struct usb_device *usb_dev, | ||
138 | struct savu_device *savu) | ||
139 | { | ||
140 | mutex_init(&savu->savu_lock); | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | static int savu_init_specials(struct hid_device *hdev) | ||
146 | { | ||
147 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
148 | struct usb_device *usb_dev = interface_to_usbdev(intf); | ||
149 | struct savu_device *savu; | ||
150 | int retval; | ||
151 | |||
152 | if (intf->cur_altsetting->desc.bInterfaceProtocol | ||
153 | != USB_INTERFACE_PROTOCOL_MOUSE) { | ||
154 | hid_set_drvdata(hdev, NULL); | ||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | savu = kzalloc(sizeof(*savu), GFP_KERNEL); | ||
159 | if (!savu) { | ||
160 | hid_err(hdev, "can't alloc device descriptor\n"); | ||
161 | return -ENOMEM; | ||
162 | } | ||
163 | hid_set_drvdata(hdev, savu); | ||
164 | |||
165 | retval = savu_init_savu_device_struct(usb_dev, savu); | ||
166 | if (retval) { | ||
167 | hid_err(hdev, "couldn't init struct savu_device\n"); | ||
168 | goto exit_free; | ||
169 | } | ||
170 | |||
171 | retval = roccat_connect(savu_class, hdev, | ||
172 | sizeof(struct savu_roccat_report)); | ||
173 | if (retval < 0) { | ||
174 | hid_err(hdev, "couldn't init char dev\n"); | ||
175 | } else { | ||
176 | savu->chrdev_minor = retval; | ||
177 | savu->roccat_claimed = 1; | ||
178 | } | ||
179 | |||
180 | return 0; | ||
181 | exit_free: | ||
182 | kfree(savu); | ||
183 | return retval; | ||
184 | } | ||
185 | |||
186 | static void savu_remove_specials(struct hid_device *hdev) | ||
187 | { | ||
188 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
189 | struct savu_device *savu; | ||
190 | |||
191 | if (intf->cur_altsetting->desc.bInterfaceProtocol | ||
192 | != USB_INTERFACE_PROTOCOL_MOUSE) | ||
193 | return; | ||
194 | |||
195 | savu = hid_get_drvdata(hdev); | ||
196 | if (savu->roccat_claimed) | ||
197 | roccat_disconnect(savu->chrdev_minor); | ||
198 | kfree(savu); | ||
199 | } | ||
200 | |||
201 | static int savu_probe(struct hid_device *hdev, | ||
202 | const struct hid_device_id *id) | ||
203 | { | ||
204 | int retval; | ||
205 | |||
206 | retval = hid_parse(hdev); | ||
207 | if (retval) { | ||
208 | hid_err(hdev, "parse failed\n"); | ||
209 | goto exit; | ||
210 | } | ||
211 | |||
212 | retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
213 | if (retval) { | ||
214 | hid_err(hdev, "hw start failed\n"); | ||
215 | goto exit; | ||
216 | } | ||
217 | |||
218 | retval = savu_init_specials(hdev); | ||
219 | if (retval) { | ||
220 | hid_err(hdev, "couldn't install mouse\n"); | ||
221 | goto exit_stop; | ||
222 | } | ||
223 | |||
224 | return 0; | ||
225 | |||
226 | exit_stop: | ||
227 | hid_hw_stop(hdev); | ||
228 | exit: | ||
229 | return retval; | ||
230 | } | ||
231 | |||
232 | static void savu_remove(struct hid_device *hdev) | ||
233 | { | ||
234 | savu_remove_specials(hdev); | ||
235 | hid_hw_stop(hdev); | ||
236 | } | ||
237 | |||
238 | static void savu_report_to_chrdev(struct savu_device const *savu, | ||
239 | u8 const *data) | ||
240 | { | ||
241 | struct savu_roccat_report roccat_report; | ||
242 | struct savu_mouse_report_special const *special_report; | ||
243 | |||
244 | if (data[0] != SAVU_MOUSE_REPORT_NUMBER_SPECIAL) | ||
245 | return; | ||
246 | |||
247 | special_report = (struct savu_mouse_report_special const *)data; | ||
248 | |||
249 | roccat_report.type = special_report->type; | ||
250 | roccat_report.data[0] = special_report->data[0]; | ||
251 | roccat_report.data[1] = special_report->data[1]; | ||
252 | roccat_report_event(savu->chrdev_minor, | ||
253 | (uint8_t const *)&roccat_report); | ||
254 | } | ||
255 | |||
256 | static int savu_raw_event(struct hid_device *hdev, | ||
257 | struct hid_report *report, u8 *data, int size) | ||
258 | { | ||
259 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
260 | struct savu_device *savu = hid_get_drvdata(hdev); | ||
261 | |||
262 | if (intf->cur_altsetting->desc.bInterfaceProtocol | ||
263 | != USB_INTERFACE_PROTOCOL_MOUSE) | ||
264 | return 0; | ||
265 | |||
266 | if (savu == NULL) | ||
267 | return 0; | ||
268 | |||
269 | if (savu->roccat_claimed) | ||
270 | savu_report_to_chrdev(savu, data); | ||
271 | |||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | static const struct hid_device_id savu_devices[] = { | ||
276 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_SAVU) }, | ||
277 | { } | ||
278 | }; | ||
279 | |||
280 | MODULE_DEVICE_TABLE(hid, savu_devices); | ||
281 | |||
282 | static struct hid_driver savu_driver = { | ||
283 | .name = "savu", | ||
284 | .id_table = savu_devices, | ||
285 | .probe = savu_probe, | ||
286 | .remove = savu_remove, | ||
287 | .raw_event = savu_raw_event | ||
288 | }; | ||
289 | |||
290 | static int __init savu_init(void) | ||
291 | { | ||
292 | int retval; | ||
293 | |||
294 | savu_class = class_create(THIS_MODULE, "savu"); | ||
295 | if (IS_ERR(savu_class)) | ||
296 | return PTR_ERR(savu_class); | ||
297 | savu_class->dev_bin_attrs = savu_bin_attributes; | ||
298 | |||
299 | retval = hid_register_driver(&savu_driver); | ||
300 | if (retval) | ||
301 | class_destroy(savu_class); | ||
302 | return retval; | ||
303 | } | ||
304 | |||
305 | static void __exit savu_exit(void) | ||
306 | { | ||
307 | hid_unregister_driver(&savu_driver); | ||
308 | class_destroy(savu_class); | ||
309 | } | ||
310 | |||
311 | module_init(savu_init); | ||
312 | module_exit(savu_exit); | ||
313 | |||
314 | MODULE_AUTHOR("Stefan Achatz"); | ||
315 | MODULE_DESCRIPTION("USB Roccat Savu driver"); | ||
316 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/hid/hid-roccat-savu.h b/drivers/hid/hid-roccat-savu.h new file mode 100644 index 000000000000..9120ba72087f --- /dev/null +++ b/drivers/hid/hid-roccat-savu.h | |||
@@ -0,0 +1,87 @@ | |||
1 | #ifndef __HID_ROCCAT_SAVU_H | ||
2 | #define __HID_ROCCAT_SAVU_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (c) 2012 Stefan Achatz <erazor_de@users.sourceforge.net> | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation; either version 2 of the License, or (at your option) | ||
12 | * any later version. | ||
13 | */ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | enum { | ||
18 | SAVU_SIZE_CONTROL = 0x03, | ||
19 | SAVU_SIZE_PROFILE = 0x03, | ||
20 | SAVU_SIZE_GENERAL = 0x10, | ||
21 | SAVU_SIZE_BUTTONS = 0x2f, | ||
22 | SAVU_SIZE_MACRO = 0x0823, | ||
23 | SAVU_SIZE_INFO = 0x08, | ||
24 | SAVU_SIZE_SENSOR = 0x04, | ||
25 | }; | ||
26 | |||
27 | enum savu_control_requests { | ||
28 | SAVU_CONTROL_REQUEST_GENERAL = 0x80, | ||
29 | SAVU_CONTROL_REQUEST_BUTTONS = 0x90, | ||
30 | }; | ||
31 | |||
32 | enum savu_commands { | ||
33 | SAVU_COMMAND_CONTROL = 0x4, | ||
34 | SAVU_COMMAND_PROFILE = 0x5, | ||
35 | SAVU_COMMAND_GENERAL = 0x6, | ||
36 | SAVU_COMMAND_BUTTONS = 0x7, | ||
37 | SAVU_COMMAND_MACRO = 0x8, | ||
38 | SAVU_COMMAND_INFO = 0x9, | ||
39 | SAVU_COMMAND_SENSOR = 0xc, | ||
40 | }; | ||
41 | |||
42 | struct savu_mouse_report_special { | ||
43 | uint8_t report_number; /* always 3 */ | ||
44 | uint8_t zero; | ||
45 | uint8_t type; | ||
46 | uint8_t data[2]; | ||
47 | } __packed; | ||
48 | |||
49 | enum { | ||
50 | SAVU_MOUSE_REPORT_NUMBER_SPECIAL = 3, | ||
51 | }; | ||
52 | |||
53 | enum savu_mouse_report_button_types { | ||
54 | /* data1 = new profile range 1-5 */ | ||
55 | SAVU_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20, | ||
56 | |||
57 | /* data1 = button number range 1-24; data2 = action */ | ||
58 | SAVU_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60, | ||
59 | |||
60 | /* data1 = button number range 1-24; data2 = action */ | ||
61 | SAVU_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80, | ||
62 | |||
63 | /* data1 = setting number range 1-5 */ | ||
64 | SAVU_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0, | ||
65 | |||
66 | /* data1 and data2 = range 0x1-0xb */ | ||
67 | SAVU_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0, | ||
68 | |||
69 | /* data1 = 22 = next track... | ||
70 | * data2 = action | ||
71 | */ | ||
72 | SAVU_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0, | ||
73 | }; | ||
74 | |||
75 | struct savu_roccat_report { | ||
76 | uint8_t type; | ||
77 | uint8_t data[2]; | ||
78 | } __packed; | ||
79 | |||
80 | struct savu_device { | ||
81 | int roccat_claimed; | ||
82 | int chrdev_minor; | ||
83 | |||
84 | struct mutex savu_lock; | ||
85 | }; | ||
86 | |||
87 | #endif | ||
diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c index aa958706c0e5..0a1805c9b0e5 100644 --- a/drivers/hid/hid-wiimote-ext.c +++ b/drivers/hid/hid-wiimote-ext.c | |||
@@ -77,7 +77,7 @@ static __u16 wiiext_keymap[] = { | |||
77 | BTN_TR, /* WIIEXT_KEY_RT */ | 77 | BTN_TR, /* WIIEXT_KEY_RT */ |
78 | }; | 78 | }; |
79 | 79 | ||
80 | /* diable all extensions */ | 80 | /* disable all extensions */ |
81 | static void ext_disable(struct wiimote_ext *ext) | 81 | static void ext_disable(struct wiimote_ext *ext) |
82 | { | 82 | { |
83 | unsigned long flags; | 83 | unsigned long flags; |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 36fa77b40ffb..3b6f7bf5a77e 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -96,6 +96,7 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, | |||
96 | } | 96 | } |
97 | 97 | ||
98 | kfree(list->buffer[list->tail].value); | 98 | kfree(list->buffer[list->tail].value); |
99 | list->buffer[list->tail].value = NULL; | ||
99 | list->tail = (list->tail + 1) & (HIDRAW_BUFFER_SIZE - 1); | 100 | list->tail = (list->tail + 1) & (HIDRAW_BUFFER_SIZE - 1); |
100 | } | 101 | } |
101 | out: | 102 | out: |
@@ -300,6 +301,7 @@ static int hidraw_release(struct inode * inode, struct file * file) | |||
300 | struct hidraw *dev; | 301 | struct hidraw *dev; |
301 | struct hidraw_list *list = file->private_data; | 302 | struct hidraw_list *list = file->private_data; |
302 | int ret; | 303 | int ret; |
304 | int i; | ||
303 | 305 | ||
304 | mutex_lock(&minors_lock); | 306 | mutex_lock(&minors_lock); |
305 | if (!hidraw_table[minor]) { | 307 | if (!hidraw_table[minor]) { |
@@ -317,6 +319,9 @@ static int hidraw_release(struct inode * inode, struct file * file) | |||
317 | kfree(list->hidraw); | 319 | kfree(list->hidraw); |
318 | } | 320 | } |
319 | } | 321 | } |
322 | |||
323 | for (i = 0; i < HIDRAW_BUFFER_SIZE; ++i) | ||
324 | kfree(list->buffer[i].value); | ||
320 | kfree(list); | 325 | kfree(list); |
321 | ret = 0; | 326 | ret = 0; |
322 | unlock: | 327 | unlock: |
@@ -446,12 +451,17 @@ int hidraw_report_event(struct hid_device *hid, u8 *data, int len) | |||
446 | int ret = 0; | 451 | int ret = 0; |
447 | 452 | ||
448 | list_for_each_entry(list, &dev->list, node) { | 453 | list_for_each_entry(list, &dev->list, node) { |
454 | int new_head = (list->head + 1) & (HIDRAW_BUFFER_SIZE - 1); | ||
455 | |||
456 | if (new_head == list->tail) | ||
457 | continue; | ||
458 | |||
449 | if (!(list->buffer[list->head].value = kmemdup(data, len, GFP_ATOMIC))) { | 459 | if (!(list->buffer[list->head].value = kmemdup(data, len, GFP_ATOMIC))) { |
450 | ret = -ENOMEM; | 460 | ret = -ENOMEM; |
451 | break; | 461 | break; |
452 | } | 462 | } |
453 | list->buffer[list->head].len = len; | 463 | list->buffer[list->head].len = len; |
454 | list->head = (list->head + 1) & (HIDRAW_BUFFER_SIZE - 1); | 464 | list->head = new_head; |
455 | kill_fasync(&list->fasync, SIGIO, POLL_IN); | 465 | kill_fasync(&list->fasync, SIGIO, POLL_IN); |
456 | } | 466 | } |
457 | 467 | ||
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 482f936fc29b..dedd8e4e5c6d 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -84,7 +84,7 @@ static int hid_start_in(struct hid_device *hid) | |||
84 | spin_lock_irqsave(&usbhid->lock, flags); | 84 | spin_lock_irqsave(&usbhid->lock, flags); |
85 | if (hid->open > 0 && | 85 | if (hid->open > 0 && |
86 | !test_bit(HID_DISCONNECTED, &usbhid->iofl) && | 86 | !test_bit(HID_DISCONNECTED, &usbhid->iofl) && |
87 | !test_bit(HID_REPORTED_IDLE, &usbhid->iofl) && | 87 | !test_bit(HID_SUSPENDED, &usbhid->iofl) && |
88 | !test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) { | 88 | !test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) { |
89 | rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC); | 89 | rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC); |
90 | if (rc != 0) { | 90 | if (rc != 0) { |
@@ -207,15 +207,27 @@ static int usbhid_restart_out_queue(struct usbhid_device *usbhid) | |||
207 | int kicked; | 207 | int kicked; |
208 | int r; | 208 | int r; |
209 | 209 | ||
210 | if (!hid) | 210 | if (!hid || test_bit(HID_RESET_PENDING, &usbhid->iofl) || |
211 | test_bit(HID_SUSPENDED, &usbhid->iofl)) | ||
211 | return 0; | 212 | return 0; |
212 | 213 | ||
213 | if ((kicked = (usbhid->outhead != usbhid->outtail))) { | 214 | if ((kicked = (usbhid->outhead != usbhid->outtail))) { |
214 | hid_dbg(hid, "Kicking head %d tail %d", usbhid->outhead, usbhid->outtail); | 215 | hid_dbg(hid, "Kicking head %d tail %d", usbhid->outhead, usbhid->outtail); |
215 | 216 | ||
217 | /* Try to wake up from autosuspend... */ | ||
216 | r = usb_autopm_get_interface_async(usbhid->intf); | 218 | r = usb_autopm_get_interface_async(usbhid->intf); |
217 | if (r < 0) | 219 | if (r < 0) |
218 | return r; | 220 | return r; |
221 | |||
222 | /* | ||
223 | * If still suspended, don't submit. Submission will | ||
224 | * occur if/when resume drains the queue. | ||
225 | */ | ||
226 | if (test_bit(HID_SUSPENDED, &usbhid->iofl)) { | ||
227 | usb_autopm_put_interface_no_suspend(usbhid->intf); | ||
228 | return r; | ||
229 | } | ||
230 | |||
219 | /* Asynchronously flush queue. */ | 231 | /* Asynchronously flush queue. */ |
220 | set_bit(HID_OUT_RUNNING, &usbhid->iofl); | 232 | set_bit(HID_OUT_RUNNING, &usbhid->iofl); |
221 | if (hid_submit_out(hid)) { | 233 | if (hid_submit_out(hid)) { |
@@ -234,15 +246,27 @@ static int usbhid_restart_ctrl_queue(struct usbhid_device *usbhid) | |||
234 | int r; | 246 | int r; |
235 | 247 | ||
236 | WARN_ON(hid == NULL); | 248 | WARN_ON(hid == NULL); |
237 | if (!hid) | 249 | if (!hid || test_bit(HID_RESET_PENDING, &usbhid->iofl) || |
250 | test_bit(HID_SUSPENDED, &usbhid->iofl)) | ||
238 | return 0; | 251 | return 0; |
239 | 252 | ||
240 | if ((kicked = (usbhid->ctrlhead != usbhid->ctrltail))) { | 253 | if ((kicked = (usbhid->ctrlhead != usbhid->ctrltail))) { |
241 | hid_dbg(hid, "Kicking head %d tail %d", usbhid->ctrlhead, usbhid->ctrltail); | 254 | hid_dbg(hid, "Kicking head %d tail %d", usbhid->ctrlhead, usbhid->ctrltail); |
242 | 255 | ||
256 | /* Try to wake up from autosuspend... */ | ||
243 | r = usb_autopm_get_interface_async(usbhid->intf); | 257 | r = usb_autopm_get_interface_async(usbhid->intf); |
244 | if (r < 0) | 258 | if (r < 0) |
245 | return r; | 259 | return r; |
260 | |||
261 | /* | ||
262 | * If still suspended, don't submit. Submission will | ||
263 | * occur if/when resume drains the queue. | ||
264 | */ | ||
265 | if (test_bit(HID_SUSPENDED, &usbhid->iofl)) { | ||
266 | usb_autopm_put_interface_no_suspend(usbhid->intf); | ||
267 | return r; | ||
268 | } | ||
269 | |||
246 | /* Asynchronously flush queue. */ | 270 | /* Asynchronously flush queue. */ |
247 | set_bit(HID_CTRL_RUNNING, &usbhid->iofl); | 271 | set_bit(HID_CTRL_RUNNING, &usbhid->iofl); |
248 | if (hid_submit_ctrl(hid)) { | 272 | if (hid_submit_ctrl(hid)) { |
@@ -331,9 +355,12 @@ static int hid_submit_out(struct hid_device *hid) | |||
331 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + | 355 | usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + |
332 | 1 + (report->id > 0); | 356 | 1 + (report->id > 0); |
333 | usbhid->urbout->dev = hid_to_usb_dev(hid); | 357 | usbhid->urbout->dev = hid_to_usb_dev(hid); |
334 | memcpy(usbhid->outbuf, raw_report, | 358 | if (raw_report) { |
335 | usbhid->urbout->transfer_buffer_length); | 359 | memcpy(usbhid->outbuf, raw_report, |
336 | kfree(raw_report); | 360 | usbhid->urbout->transfer_buffer_length); |
361 | kfree(raw_report); | ||
362 | usbhid->out[usbhid->outtail].raw_report = NULL; | ||
363 | } | ||
337 | 364 | ||
338 | dbg_hid("submitting out urb\n"); | 365 | dbg_hid("submitting out urb\n"); |
339 | 366 | ||
@@ -362,8 +389,11 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
362 | if (dir == USB_DIR_OUT) { | 389 | if (dir == USB_DIR_OUT) { |
363 | usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0); | 390 | usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0); |
364 | usbhid->urbctrl->transfer_buffer_length = len; | 391 | usbhid->urbctrl->transfer_buffer_length = len; |
365 | memcpy(usbhid->ctrlbuf, raw_report, len); | 392 | if (raw_report) { |
366 | kfree(raw_report); | 393 | memcpy(usbhid->ctrlbuf, raw_report, len); |
394 | kfree(raw_report); | ||
395 | usbhid->ctrl[usbhid->ctrltail].raw_report = NULL; | ||
396 | } | ||
367 | } else { | 397 | } else { |
368 | int maxpacket, padlen; | 398 | int maxpacket, padlen; |
369 | 399 | ||
@@ -407,16 +437,6 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
407 | * Output interrupt completion handler. | 437 | * Output interrupt completion handler. |
408 | */ | 438 | */ |
409 | 439 | ||
410 | static int irq_out_pump_restart(struct hid_device *hid) | ||
411 | { | ||
412 | struct usbhid_device *usbhid = hid->driver_data; | ||
413 | |||
414 | if (usbhid->outhead != usbhid->outtail) | ||
415 | return hid_submit_out(hid); | ||
416 | else | ||
417 | return -1; | ||
418 | } | ||
419 | |||
420 | static void hid_irq_out(struct urb *urb) | 440 | static void hid_irq_out(struct urb *urb) |
421 | { | 441 | { |
422 | struct hid_device *hid = urb->context; | 442 | struct hid_device *hid = urb->context; |
@@ -441,15 +461,17 @@ static void hid_irq_out(struct urb *urb) | |||
441 | 461 | ||
442 | spin_lock_irqsave(&usbhid->lock, flags); | 462 | spin_lock_irqsave(&usbhid->lock, flags); |
443 | 463 | ||
444 | if (unplug) | 464 | if (unplug) { |
445 | usbhid->outtail = usbhid->outhead; | 465 | usbhid->outtail = usbhid->outhead; |
446 | else | 466 | } else { |
447 | usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1); | 467 | usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1); |
448 | 468 | ||
449 | if (!irq_out_pump_restart(hid)) { | 469 | if (usbhid->outhead != usbhid->outtail && |
450 | /* Successfully submitted next urb in queue */ | 470 | hid_submit_out(hid) == 0) { |
451 | spin_unlock_irqrestore(&usbhid->lock, flags); | 471 | /* Successfully submitted next urb in queue */ |
452 | return; | 472 | spin_unlock_irqrestore(&usbhid->lock, flags); |
473 | return; | ||
474 | } | ||
453 | } | 475 | } |
454 | 476 | ||
455 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); | 477 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); |
@@ -461,15 +483,6 @@ static void hid_irq_out(struct urb *urb) | |||
461 | /* | 483 | /* |
462 | * Control pipe completion handler. | 484 | * Control pipe completion handler. |
463 | */ | 485 | */ |
464 | static int ctrl_pump_restart(struct hid_device *hid) | ||
465 | { | ||
466 | struct usbhid_device *usbhid = hid->driver_data; | ||
467 | |||
468 | if (usbhid->ctrlhead != usbhid->ctrltail) | ||
469 | return hid_submit_ctrl(hid); | ||
470 | else | ||
471 | return -1; | ||
472 | } | ||
473 | 486 | ||
474 | static void hid_ctrl(struct urb *urb) | 487 | static void hid_ctrl(struct urb *urb) |
475 | { | 488 | { |
@@ -498,15 +511,17 @@ static void hid_ctrl(struct urb *urb) | |||
498 | hid_warn(urb->dev, "ctrl urb status %d received\n", status); | 511 | hid_warn(urb->dev, "ctrl urb status %d received\n", status); |
499 | } | 512 | } |
500 | 513 | ||
501 | if (unplug) | 514 | if (unplug) { |
502 | usbhid->ctrltail = usbhid->ctrlhead; | 515 | usbhid->ctrltail = usbhid->ctrlhead; |
503 | else | 516 | } else { |
504 | usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); | 517 | usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); |
505 | 518 | ||
506 | if (!ctrl_pump_restart(hid)) { | 519 | if (usbhid->ctrlhead != usbhid->ctrltail && |
507 | /* Successfully submitted next urb in queue */ | 520 | hid_submit_ctrl(hid) == 0) { |
508 | spin_unlock(&usbhid->lock); | 521 | /* Successfully submitted next urb in queue */ |
509 | return; | 522 | spin_unlock(&usbhid->lock); |
523 | return; | ||
524 | } | ||
510 | } | 525 | } |
511 | 526 | ||
512 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); | 527 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); |
@@ -540,49 +555,36 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re | |||
540 | usbhid->out[usbhid->outhead].report = report; | 555 | usbhid->out[usbhid->outhead].report = report; |
541 | usbhid->outhead = head; | 556 | usbhid->outhead = head; |
542 | 557 | ||
543 | /* Try to awake from autosuspend... */ | 558 | /* If the queue isn't running, restart it */ |
544 | if (usb_autopm_get_interface_async(usbhid->intf) < 0) | 559 | if (!test_bit(HID_OUT_RUNNING, &usbhid->iofl)) { |
545 | return; | 560 | usbhid_restart_out_queue(usbhid); |
546 | 561 | ||
547 | /* | 562 | /* Otherwise see if an earlier request has timed out */ |
548 | * But if still suspended, leave urb enqueued, don't submit. | 563 | } else if (time_after(jiffies, usbhid->last_out + HZ * 5)) { |
549 | * Submission will occur if/when resume() drains the queue. | 564 | |
550 | */ | 565 | /* Prevent autosuspend following the unlink */ |
551 | if (test_bit(HID_REPORTED_IDLE, &usbhid->iofl)) | 566 | usb_autopm_get_interface_no_resume(usbhid->intf); |
552 | return; | ||
553 | 567 | ||
554 | if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) { | ||
555 | if (hid_submit_out(hid)) { | ||
556 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); | ||
557 | usb_autopm_put_interface_async(usbhid->intf); | ||
558 | } | ||
559 | wake_up(&usbhid->wait); | ||
560 | } else { | ||
561 | /* | 568 | /* |
562 | * the queue is known to run | 569 | * Prevent resubmission in case the URB completes |
563 | * but an earlier request may be stuck | 570 | * before we can unlink it. We don't want to cancel |
564 | * we may need to time out | 571 | * the wrong transfer! |
565 | * no race because the URB is blocked under | ||
566 | * spinlock | ||
567 | */ | 572 | */ |
568 | if (time_after(jiffies, usbhid->last_out + HZ * 5)) { | 573 | usb_block_urb(usbhid->urbout); |
569 | usb_block_urb(usbhid->urbout); | ||
570 | /* drop lock to not deadlock if the callback is called */ | ||
571 | spin_unlock(&usbhid->lock); | ||
572 | usb_unlink_urb(usbhid->urbout); | ||
573 | spin_lock(&usbhid->lock); | ||
574 | usb_unblock_urb(usbhid->urbout); | ||
575 | /* | ||
576 | * if the unlinking has already completed | ||
577 | * the pump will have been stopped | ||
578 | * it must be restarted now | ||
579 | */ | ||
580 | if (!test_bit(HID_OUT_RUNNING, &usbhid->iofl)) | ||
581 | if (!irq_out_pump_restart(hid)) | ||
582 | set_bit(HID_OUT_RUNNING, &usbhid->iofl); | ||
583 | 574 | ||
575 | /* Drop lock to avoid deadlock if the callback runs */ | ||
576 | spin_unlock(&usbhid->lock); | ||
584 | 577 | ||
585 | } | 578 | usb_unlink_urb(usbhid->urbout); |
579 | spin_lock(&usbhid->lock); | ||
580 | usb_unblock_urb(usbhid->urbout); | ||
581 | |||
582 | /* Unlink might have stopped the queue */ | ||
583 | if (!test_bit(HID_OUT_RUNNING, &usbhid->iofl)) | ||
584 | usbhid_restart_out_queue(usbhid); | ||
585 | |||
586 | /* Now we can allow autosuspend again */ | ||
587 | usb_autopm_put_interface_async(usbhid->intf); | ||
586 | } | 588 | } |
587 | return; | 589 | return; |
588 | } | 590 | } |
@@ -604,47 +606,36 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re | |||
604 | usbhid->ctrl[usbhid->ctrlhead].dir = dir; | 606 | usbhid->ctrl[usbhid->ctrlhead].dir = dir; |
605 | usbhid->ctrlhead = head; | 607 | usbhid->ctrlhead = head; |
606 | 608 | ||
607 | /* Try to awake from autosuspend... */ | 609 | /* If the queue isn't running, restart it */ |
608 | if (usb_autopm_get_interface_async(usbhid->intf) < 0) | 610 | if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) { |
609 | return; | 611 | usbhid_restart_ctrl_queue(usbhid); |
610 | 612 | ||
611 | /* | 613 | /* Otherwise see if an earlier request has timed out */ |
612 | * If already suspended, leave urb enqueued, but don't submit. | 614 | } else if (time_after(jiffies, usbhid->last_ctrl + HZ * 5)) { |
613 | * Submission will occur if/when resume() drains the queue. | 615 | |
614 | */ | 616 | /* Prevent autosuspend following the unlink */ |
615 | if (test_bit(HID_REPORTED_IDLE, &usbhid->iofl)) | 617 | usb_autopm_get_interface_no_resume(usbhid->intf); |
616 | return; | ||
617 | 618 | ||
618 | if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl)) { | ||
619 | if (hid_submit_ctrl(hid)) { | ||
620 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); | ||
621 | usb_autopm_put_interface_async(usbhid->intf); | ||
622 | } | ||
623 | wake_up(&usbhid->wait); | ||
624 | } else { | ||
625 | /* | 619 | /* |
626 | * the queue is known to run | 620 | * Prevent resubmission in case the URB completes |
627 | * but an earlier request may be stuck | 621 | * before we can unlink it. We don't want to cancel |
628 | * we may need to time out | 622 | * the wrong transfer! |
629 | * no race because the URB is blocked under | ||
630 | * spinlock | ||
631 | */ | 623 | */ |
632 | if (time_after(jiffies, usbhid->last_ctrl + HZ * 5)) { | 624 | usb_block_urb(usbhid->urbctrl); |
633 | usb_block_urb(usbhid->urbctrl); | 625 | |
634 | /* drop lock to not deadlock if the callback is called */ | 626 | /* Drop lock to avoid deadlock if the callback runs */ |
635 | spin_unlock(&usbhid->lock); | 627 | spin_unlock(&usbhid->lock); |
636 | usb_unlink_urb(usbhid->urbctrl); | 628 | |
637 | spin_lock(&usbhid->lock); | 629 | usb_unlink_urb(usbhid->urbctrl); |
638 | usb_unblock_urb(usbhid->urbctrl); | 630 | spin_lock(&usbhid->lock); |
639 | /* | 631 | usb_unblock_urb(usbhid->urbctrl); |
640 | * if the unlinking has already completed | 632 | |
641 | * the pump will have been stopped | 633 | /* Unlink might have stopped the queue */ |
642 | * it must be restarted now | 634 | if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) |
643 | */ | 635 | usbhid_restart_ctrl_queue(usbhid); |
644 | if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) | 636 | |
645 | if (!ctrl_pump_restart(hid)) | 637 | /* Now we can allow autosuspend again */ |
646 | set_bit(HID_CTRL_RUNNING, &usbhid->iofl); | 638 | usb_autopm_put_interface_async(usbhid->intf); |
647 | } | ||
648 | } | 639 | } |
649 | } | 640 | } |
650 | 641 | ||
@@ -1002,9 +993,10 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co | |||
1002 | 993 | ||
1003 | static void usbhid_restart_queues(struct usbhid_device *usbhid) | 994 | static void usbhid_restart_queues(struct usbhid_device *usbhid) |
1004 | { | 995 | { |
1005 | if (usbhid->urbout) | 996 | if (usbhid->urbout && !test_bit(HID_OUT_RUNNING, &usbhid->iofl)) |
1006 | usbhid_restart_out_queue(usbhid); | 997 | usbhid_restart_out_queue(usbhid); |
1007 | usbhid_restart_ctrl_queue(usbhid); | 998 | if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) |
999 | usbhid_restart_ctrl_queue(usbhid); | ||
1008 | } | 1000 | } |
1009 | 1001 | ||
1010 | static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) | 1002 | static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) |
@@ -1471,11 +1463,38 @@ void usbhid_put_power(struct hid_device *hid) | |||
1471 | 1463 | ||
1472 | 1464 | ||
1473 | #ifdef CONFIG_PM | 1465 | #ifdef CONFIG_PM |
1466 | static int hid_resume_common(struct hid_device *hid, bool driver_suspended) | ||
1467 | { | ||
1468 | struct usbhid_device *usbhid = hid->driver_data; | ||
1469 | int status; | ||
1470 | |||
1471 | spin_lock_irq(&usbhid->lock); | ||
1472 | clear_bit(HID_SUSPENDED, &usbhid->iofl); | ||
1473 | usbhid_mark_busy(usbhid); | ||
1474 | |||
1475 | if (test_bit(HID_CLEAR_HALT, &usbhid->iofl) || | ||
1476 | test_bit(HID_RESET_PENDING, &usbhid->iofl)) | ||
1477 | schedule_work(&usbhid->reset_work); | ||
1478 | usbhid->retry_delay = 0; | ||
1479 | |||
1480 | usbhid_restart_queues(usbhid); | ||
1481 | spin_unlock_irq(&usbhid->lock); | ||
1482 | |||
1483 | status = hid_start_in(hid); | ||
1484 | if (status < 0) | ||
1485 | hid_io_error(hid); | ||
1486 | |||
1487 | if (driver_suspended && hid->driver && hid->driver->resume) | ||
1488 | status = hid->driver->resume(hid); | ||
1489 | return status; | ||
1490 | } | ||
1491 | |||
1474 | static int hid_suspend(struct usb_interface *intf, pm_message_t message) | 1492 | static int hid_suspend(struct usb_interface *intf, pm_message_t message) |
1475 | { | 1493 | { |
1476 | struct hid_device *hid = usb_get_intfdata(intf); | 1494 | struct hid_device *hid = usb_get_intfdata(intf); |
1477 | struct usbhid_device *usbhid = hid->driver_data; | 1495 | struct usbhid_device *usbhid = hid->driver_data; |
1478 | int status; | 1496 | int status; |
1497 | bool driver_suspended = false; | ||
1479 | 1498 | ||
1480 | if (PMSG_IS_AUTO(message)) { | 1499 | if (PMSG_IS_AUTO(message)) { |
1481 | spin_lock_irq(&usbhid->lock); /* Sync with error handler */ | 1500 | spin_lock_irq(&usbhid->lock); /* Sync with error handler */ |
@@ -1486,13 +1505,14 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1486 | && !test_bit(HID_KEYS_PRESSED, &usbhid->iofl) | 1505 | && !test_bit(HID_KEYS_PRESSED, &usbhid->iofl) |
1487 | && (!usbhid->ledcount || ignoreled)) | 1506 | && (!usbhid->ledcount || ignoreled)) |
1488 | { | 1507 | { |
1489 | set_bit(HID_REPORTED_IDLE, &usbhid->iofl); | 1508 | set_bit(HID_SUSPENDED, &usbhid->iofl); |
1490 | spin_unlock_irq(&usbhid->lock); | 1509 | spin_unlock_irq(&usbhid->lock); |
1491 | if (hid->driver && hid->driver->suspend) { | 1510 | if (hid->driver && hid->driver->suspend) { |
1492 | status = hid->driver->suspend(hid, message); | 1511 | status = hid->driver->suspend(hid, message); |
1493 | if (status < 0) | 1512 | if (status < 0) |
1494 | return status; | 1513 | goto failed; |
1495 | } | 1514 | } |
1515 | driver_suspended = true; | ||
1496 | } else { | 1516 | } else { |
1497 | usbhid_mark_busy(usbhid); | 1517 | usbhid_mark_busy(usbhid); |
1498 | spin_unlock_irq(&usbhid->lock); | 1518 | spin_unlock_irq(&usbhid->lock); |
@@ -1505,11 +1525,14 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1505 | if (status < 0) | 1525 | if (status < 0) |
1506 | return status; | 1526 | return status; |
1507 | } | 1527 | } |
1528 | driver_suspended = true; | ||
1508 | spin_lock_irq(&usbhid->lock); | 1529 | spin_lock_irq(&usbhid->lock); |
1509 | set_bit(HID_REPORTED_IDLE, &usbhid->iofl); | 1530 | set_bit(HID_SUSPENDED, &usbhid->iofl); |
1510 | spin_unlock_irq(&usbhid->lock); | 1531 | spin_unlock_irq(&usbhid->lock); |
1511 | if (usbhid_wait_io(hid) < 0) | 1532 | if (usbhid_wait_io(hid) < 0) { |
1512 | return -EIO; | 1533 | status = -EIO; |
1534 | goto failed; | ||
1535 | } | ||
1513 | } | 1536 | } |
1514 | 1537 | ||
1515 | hid_cancel_delayed_stuff(usbhid); | 1538 | hid_cancel_delayed_stuff(usbhid); |
@@ -1517,14 +1540,15 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1517 | 1540 | ||
1518 | if (PMSG_IS_AUTO(message) && test_bit(HID_KEYS_PRESSED, &usbhid->iofl)) { | 1541 | if (PMSG_IS_AUTO(message) && test_bit(HID_KEYS_PRESSED, &usbhid->iofl)) { |
1519 | /* lost race against keypresses */ | 1542 | /* lost race against keypresses */ |
1520 | status = hid_start_in(hid); | 1543 | status = -EBUSY; |
1521 | if (status < 0) | 1544 | goto failed; |
1522 | hid_io_error(hid); | ||
1523 | usbhid_mark_busy(usbhid); | ||
1524 | return -EBUSY; | ||
1525 | } | 1545 | } |
1526 | dev_dbg(&intf->dev, "suspend\n"); | 1546 | dev_dbg(&intf->dev, "suspend\n"); |
1527 | return 0; | 1547 | return 0; |
1548 | |||
1549 | failed: | ||
1550 | hid_resume_common(hid, driver_suspended); | ||
1551 | return status; | ||
1528 | } | 1552 | } |
1529 | 1553 | ||
1530 | static int hid_resume(struct usb_interface *intf) | 1554 | static int hid_resume(struct usb_interface *intf) |
@@ -1536,23 +1560,7 @@ static int hid_resume(struct usb_interface *intf) | |||
1536 | if (!test_bit(HID_STARTED, &usbhid->iofl)) | 1560 | if (!test_bit(HID_STARTED, &usbhid->iofl)) |
1537 | return 0; | 1561 | return 0; |
1538 | 1562 | ||
1539 | clear_bit(HID_REPORTED_IDLE, &usbhid->iofl); | 1563 | status = hid_resume_common(hid, true); |
1540 | usbhid_mark_busy(usbhid); | ||
1541 | |||
1542 | if (test_bit(HID_CLEAR_HALT, &usbhid->iofl) || | ||
1543 | test_bit(HID_RESET_PENDING, &usbhid->iofl)) | ||
1544 | schedule_work(&usbhid->reset_work); | ||
1545 | usbhid->retry_delay = 0; | ||
1546 | status = hid_start_in(hid); | ||
1547 | if (status < 0) | ||
1548 | hid_io_error(hid); | ||
1549 | usbhid_restart_queues(usbhid); | ||
1550 | |||
1551 | if (status >= 0 && hid->driver && hid->driver->resume) { | ||
1552 | int ret = hid->driver->resume(hid); | ||
1553 | if (ret < 0) | ||
1554 | status = ret; | ||
1555 | } | ||
1556 | dev_dbg(&intf->dev, "resume status %d\n", status); | 1564 | dev_dbg(&intf->dev, "resume status %d\n", status); |
1557 | return 0; | 1565 | return 0; |
1558 | } | 1566 | } |
@@ -1563,7 +1571,7 @@ static int hid_reset_resume(struct usb_interface *intf) | |||
1563 | struct usbhid_device *usbhid = hid->driver_data; | 1571 | struct usbhid_device *usbhid = hid->driver_data; |
1564 | int status; | 1572 | int status; |
1565 | 1573 | ||
1566 | clear_bit(HID_REPORTED_IDLE, &usbhid->iofl); | 1574 | clear_bit(HID_SUSPENDED, &usbhid->iofl); |
1567 | status = hid_post_reset(intf); | 1575 | status = hid_post_reset(intf); |
1568 | if (status >= 0 && hid->driver && hid->driver->reset_resume) { | 1576 | if (status >= 0 && hid->driver && hid->driver->reset_resume) { |
1569 | int ret = hid->driver->reset_resume(hid); | 1577 | int ret = hid->driver->reset_resume(hid); |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 0597ee604f6e..903eef3d3e10 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -76,6 +76,7 @@ static const struct hid_blacklist { | |||
76 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, | 76 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, |
77 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, | 77 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, |
78 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, | 78 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, |
79 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, | ||
79 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | 80 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
80 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, | 81 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, |
81 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, | 82 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, |
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index 1883d7b94870..bd87a61e5303 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
@@ -53,7 +53,6 @@ struct usb_interface *usbhid_find_interface(int minor); | |||
53 | #define HID_CLEAR_HALT 6 | 53 | #define HID_CLEAR_HALT 6 |
54 | #define HID_DISCONNECTED 7 | 54 | #define HID_DISCONNECTED 7 |
55 | #define HID_STARTED 8 | 55 | #define HID_STARTED 8 |
56 | #define HID_REPORTED_IDLE 9 | ||
57 | #define HID_KEYS_PRESSED 10 | 56 | #define HID_KEYS_PRESSED 10 |
58 | #define HID_NO_BANDWIDTH 11 | 57 | #define HID_NO_BANDWIDTH 11 |
59 | 58 | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 70d62f5bc909..2cde9ecf7731 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * | 8 | * |
9 | * Based on hdaps.c driver: | 9 | * Based on hdaps.c driver: |
10 | * Copyright (C) 2005 Robert Love <rml@novell.com> | 10 | * Copyright (C) 2005 Robert Love <rml@novell.com> |
11 | * Copyright (C) 2005 Jesper Juhl <jesper.juhl@gmail.com> | 11 | * Copyright (C) 2005 Jesper Juhl <jj@chaosbits.net> |
12 | * | 12 | * |
13 | * Fan control based on smcFanControl: | 13 | * Fan control based on smcFanControl: |
14 | * Copyright (C) 2006 Hendrik Holtmann <holtmann@mac.com> | 14 | * Copyright (C) 2006 Hendrik Holtmann <holtmann@mac.com> |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 7f1feb2f467a..637c51c11b44 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -693,7 +693,7 @@ static void __cpuinit get_core_online(unsigned int cpu) | |||
693 | * sensors. We check this bit only, all the early CPUs | 693 | * sensors. We check this bit only, all the early CPUs |
694 | * without thermal sensors will be filtered out. | 694 | * without thermal sensors will be filtered out. |
695 | */ | 695 | */ |
696 | if (!cpu_has(c, X86_FEATURE_DTS)) | 696 | if (!cpu_has(c, X86_FEATURE_DTHERM)) |
697 | return; | 697 | return; |
698 | 698 | ||
699 | if (!pdev) { | 699 | if (!pdev) { |
@@ -794,7 +794,7 @@ static struct notifier_block coretemp_cpu_notifier __refdata = { | |||
794 | }; | 794 | }; |
795 | 795 | ||
796 | static const struct x86_cpu_id coretemp_ids[] = { | 796 | static const struct x86_cpu_id coretemp_ids[] = { |
797 | { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTS }, | 797 | { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTHERM }, |
798 | {} | 798 | {} |
799 | }; | 799 | }; |
800 | MODULE_DEVICE_TABLE(x86cpu, coretemp_ids); | 800 | MODULE_DEVICE_TABLE(x86cpu, coretemp_ids); |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index e7701d99f8e8..f1de3979181f 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -2341,7 +2341,7 @@ static void __devinit it87_init_device(struct platform_device *pdev) | |||
2341 | 2341 | ||
2342 | /* Start monitoring */ | 2342 | /* Start monitoring */ |
2343 | it87_write_value(data, IT87_REG_CONFIG, | 2343 | it87_write_value(data, IT87_REG_CONFIG, |
2344 | (it87_read_value(data, IT87_REG_CONFIG) & 0x36) | 2344 | (it87_read_value(data, IT87_REG_CONFIG) & 0x3e) |
2345 | | (update_vbat ? 0x41 : 0x01)); | 2345 | | (update_vbat ? 0x41 : 0x01)); |
2346 | } | 2346 | } |
2347 | 2347 | ||
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c index a9bfd6736d9a..e72ba5d2a824 100644 --- a/drivers/hwmon/jc42.c +++ b/drivers/hwmon/jc42.c | |||
@@ -590,6 +590,6 @@ abort: | |||
590 | 590 | ||
591 | module_i2c_driver(jc42_driver); | 591 | module_i2c_driver(jc42_driver); |
592 | 592 | ||
593 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); | 593 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
594 | MODULE_DESCRIPTION("JC42 driver"); | 594 | MODULE_DESCRIPTION("JC42 driver"); |
595 | MODULE_LICENSE("GPL"); | 595 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c index d264937c7f5e..bd75d2415432 100644 --- a/drivers/hwmon/lineage-pem.c +++ b/drivers/hwmon/lineage-pem.c | |||
@@ -567,6 +567,6 @@ static struct i2c_driver pem_driver = { | |||
567 | 567 | ||
568 | module_i2c_driver(pem_driver); | 568 | module_i2c_driver(pem_driver); |
569 | 569 | ||
570 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); | 570 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
571 | MODULE_DESCRIPTION("Lineage CPL PEM hardware monitoring driver"); | 571 | MODULE_DESCRIPTION("Lineage CPL PEM hardware monitoring driver"); |
572 | MODULE_LICENSE("GPL"); | 572 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/ltc4261.c b/drivers/hwmon/ltc4261.c index 069b7d34d8f9..77476a575c4e 100644 --- a/drivers/hwmon/ltc4261.c +++ b/drivers/hwmon/ltc4261.c | |||
@@ -292,6 +292,6 @@ static struct i2c_driver ltc4261_driver = { | |||
292 | 292 | ||
293 | module_i2c_driver(ltc4261_driver); | 293 | module_i2c_driver(ltc4261_driver); |
294 | 294 | ||
295 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); | 295 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
296 | MODULE_DESCRIPTION("LTC4261 driver"); | 296 | MODULE_DESCRIPTION("LTC4261 driver"); |
297 | MODULE_LICENSE("GPL"); | 297 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/max16065.c b/drivers/hwmon/max16065.c index 822261be84dd..019427d7a5fd 100644 --- a/drivers/hwmon/max16065.c +++ b/drivers/hwmon/max16065.c | |||
@@ -692,6 +692,6 @@ static struct i2c_driver max16065_driver = { | |||
692 | 692 | ||
693 | module_i2c_driver(max16065_driver); | 693 | module_i2c_driver(max16065_driver); |
694 | 694 | ||
695 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); | 695 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
696 | MODULE_DESCRIPTION("MAX16065 driver"); | 696 | MODULE_DESCRIPTION("MAX16065 driver"); |
697 | MODULE_LICENSE("GPL"); | 697 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 61c9cf15fa52..1201a15784c3 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c | |||
@@ -345,7 +345,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, | |||
345 | spin_lock_init(&hwlock->lock); | 345 | spin_lock_init(&hwlock->lock); |
346 | hwlock->bank = bank; | 346 | hwlock->bank = bank; |
347 | 347 | ||
348 | ret = hwspin_lock_register_single(hwlock, i); | 348 | ret = hwspin_lock_register_single(hwlock, base_id + i); |
349 | if (ret) | 349 | if (ret) |
350 | goto reg_failed; | 350 | goto reg_failed; |
351 | } | 351 | } |
@@ -354,7 +354,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, | |||
354 | 354 | ||
355 | reg_failed: | 355 | reg_failed: |
356 | while (--i >= 0) | 356 | while (--i >= 0) |
357 | hwspin_lock_unregister_single(i); | 357 | hwspin_lock_unregister_single(base_id + i); |
358 | return ret; | 358 | return ret; |
359 | } | 359 | } |
360 | EXPORT_SYMBOL_GPL(hwspin_lock_register); | 360 | EXPORT_SYMBOL_GPL(hwspin_lock_register); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 5c1bc995e560..f10221f40803 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -123,7 +123,7 @@ static void ipoib_ud_skb_put_frags(struct ipoib_dev_priv *priv, | |||
123 | 123 | ||
124 | skb_frag_size_set(frag, size); | 124 | skb_frag_size_set(frag, size); |
125 | skb->data_len += size; | 125 | skb->data_len += size; |
126 | skb->truesize += size; | 126 | skb->truesize += PAGE_SIZE; |
127 | } else | 127 | } else |
128 | skb_put(skb, length); | 128 | skb_put(skb, length); |
129 | 129 | ||
@@ -156,14 +156,18 @@ static struct sk_buff *ipoib_alloc_rx_skb(struct net_device *dev, int id) | |||
156 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 156 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
157 | struct sk_buff *skb; | 157 | struct sk_buff *skb; |
158 | int buf_size; | 158 | int buf_size; |
159 | int tailroom; | ||
159 | u64 *mapping; | 160 | u64 *mapping; |
160 | 161 | ||
161 | if (ipoib_ud_need_sg(priv->max_ib_mtu)) | 162 | if (ipoib_ud_need_sg(priv->max_ib_mtu)) { |
162 | buf_size = IPOIB_UD_HEAD_SIZE; | 163 | buf_size = IPOIB_UD_HEAD_SIZE; |
163 | else | 164 | tailroom = 128; /* reserve some tailroom for IP/TCP headers */ |
165 | } else { | ||
164 | buf_size = IPOIB_UD_BUF_SIZE(priv->max_ib_mtu); | 166 | buf_size = IPOIB_UD_BUF_SIZE(priv->max_ib_mtu); |
167 | tailroom = 0; | ||
168 | } | ||
165 | 169 | ||
166 | skb = dev_alloc_skb(buf_size + 4); | 170 | skb = dev_alloc_skb(buf_size + tailroom + 4); |
167 | if (unlikely(!skb)) | 171 | if (unlikely(!skb)) |
168 | return NULL; | 172 | return NULL; |
169 | 173 | ||
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index 57d19d4e0a2d..c96653b58867 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c | |||
@@ -282,7 +282,8 @@ static int __devinit as5011_probe(struct i2c_client *client, | |||
282 | 282 | ||
283 | error = request_threaded_irq(as5011->button_irq, | 283 | error = request_threaded_irq(as5011->button_irq, |
284 | NULL, as5011_button_interrupt, | 284 | NULL, as5011_button_interrupt, |
285 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 285 | IRQF_TRIGGER_RISING | |
286 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | ||
286 | "as5011_button", as5011); | 287 | "as5011_button", as5011); |
287 | if (error < 0) { | 288 | if (error < 0) { |
288 | dev_err(&client->dev, | 289 | dev_err(&client->dev, |
@@ -296,7 +297,7 @@ static int __devinit as5011_probe(struct i2c_client *client, | |||
296 | 297 | ||
297 | error = request_threaded_irq(as5011->axis_irq, NULL, | 298 | error = request_threaded_irq(as5011->axis_irq, NULL, |
298 | as5011_axis_interrupt, | 299 | as5011_axis_interrupt, |
299 | plat_data->axis_irqflags, | 300 | plat_data->axis_irqflags | IRQF_ONESHOT, |
300 | "as5011_joystick", as5011); | 301 | "as5011_joystick", as5011); |
301 | if (error) { | 302 | if (error) { |
302 | dev_err(&client->dev, | 303 | dev_err(&client->dev, |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index ee16fb67b7ae..83811e45d633 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -142,6 +142,7 @@ static const struct xpad_device { | |||
142 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX }, | 142 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX }, |
143 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, | 143 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, |
144 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, | 144 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, |
145 | { 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | ||
145 | { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, | 146 | { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, |
146 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX }, | 147 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX }, |
147 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX }, | 148 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX }, |
@@ -164,6 +165,7 @@ static const struct xpad_device { | |||
164 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | 165 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, |
165 | { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, | 166 | { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
166 | { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, | 167 | { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
168 | { 0x1689, 0xfd00, "Razer Onza Tournament Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | ||
167 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, | 169 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, |
168 | { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } | 170 | { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } |
169 | }; | 171 | }; |
@@ -238,12 +240,14 @@ static struct usb_device_id xpad_table [] = { | |||
238 | XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ | 240 | XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ |
239 | XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ | 241 | XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ |
240 | XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ | 242 | XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ |
243 | { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ | ||
241 | XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ | 244 | XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ |
242 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ | 245 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ |
243 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ | 246 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ |
244 | XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ | 247 | XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ |
245 | XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ | 248 | XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ |
246 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ | 249 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ |
250 | XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ | ||
247 | { } | 251 | { } |
248 | }; | 252 | }; |
249 | 253 | ||
diff --git a/drivers/input/keyboard/mcs_touchkey.c b/drivers/input/keyboard/mcs_touchkey.c index 64a0ca4c92f3..0d77f6c84950 100644 --- a/drivers/input/keyboard/mcs_touchkey.c +++ b/drivers/input/keyboard/mcs_touchkey.c | |||
@@ -178,7 +178,8 @@ static int __devinit mcs_touchkey_probe(struct i2c_client *client, | |||
178 | } | 178 | } |
179 | 179 | ||
180 | error = request_threaded_irq(client->irq, NULL, mcs_touchkey_interrupt, | 180 | error = request_threaded_irq(client->irq, NULL, mcs_touchkey_interrupt, |
181 | IRQF_TRIGGER_FALLING, client->dev.driver->name, data); | 181 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
182 | client->dev.driver->name, data); | ||
182 | if (error) { | 183 | if (error) { |
183 | dev_err(&client->dev, "Failed to register interrupt\n"); | 184 | dev_err(&client->dev, "Failed to register interrupt\n"); |
184 | goto err_free_mem; | 185 | goto err_free_mem; |
diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index caa218a51b5a..7613f1cac951 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c | |||
@@ -248,7 +248,7 @@ static int __devinit mpr_touchkey_probe(struct i2c_client *client, | |||
248 | 248 | ||
249 | error = request_threaded_irq(client->irq, NULL, | 249 | error = request_threaded_irq(client->irq, NULL, |
250 | mpr_touchkey_interrupt, | 250 | mpr_touchkey_interrupt, |
251 | IRQF_TRIGGER_FALLING, | 251 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
252 | client->dev.driver->name, mpr121); | 252 | client->dev.driver->name, mpr121); |
253 | if (error) { | 253 | if (error) { |
254 | dev_err(&client->dev, "Failed to register interrupt\n"); | 254 | dev_err(&client->dev, "Failed to register interrupt\n"); |
diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c index 0b7b2f891752..ca68f2992d72 100644 --- a/drivers/input/keyboard/qt1070.c +++ b/drivers/input/keyboard/qt1070.c | |||
@@ -201,7 +201,8 @@ static int __devinit qt1070_probe(struct i2c_client *client, | |||
201 | msleep(QT1070_RESET_TIME); | 201 | msleep(QT1070_RESET_TIME); |
202 | 202 | ||
203 | err = request_threaded_irq(client->irq, NULL, qt1070_interrupt, | 203 | err = request_threaded_irq(client->irq, NULL, qt1070_interrupt, |
204 | IRQF_TRIGGER_NONE, client->dev.driver->name, data); | 204 | IRQF_TRIGGER_NONE | IRQF_ONESHOT, |
205 | client->dev.driver->name, data); | ||
205 | if (err) { | 206 | if (err) { |
206 | dev_err(&client->dev, "fail to request irq\n"); | 207 | dev_err(&client->dev, "fail to request irq\n"); |
207 | goto err_free_mem; | 208 | goto err_free_mem; |
diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c index 3afea3f89718..c355cdde8d22 100644 --- a/drivers/input/keyboard/tca6416-keypad.c +++ b/drivers/input/keyboard/tca6416-keypad.c | |||
@@ -278,7 +278,8 @@ static int __devinit tca6416_keypad_probe(struct i2c_client *client, | |||
278 | 278 | ||
279 | error = request_threaded_irq(chip->irqnum, NULL, | 279 | error = request_threaded_irq(chip->irqnum, NULL, |
280 | tca6416_keys_isr, | 280 | tca6416_keys_isr, |
281 | IRQF_TRIGGER_FALLING, | 281 | IRQF_TRIGGER_FALLING | |
282 | IRQF_ONESHOT, | ||
282 | "tca6416-keypad", chip); | 283 | "tca6416-keypad", chip); |
283 | if (error) { | 284 | if (error) { |
284 | dev_dbg(&client->dev, | 285 | dev_dbg(&client->dev, |
diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c index 5f87b28b3192..893869b29ed9 100644 --- a/drivers/input/keyboard/tca8418_keypad.c +++ b/drivers/input/keyboard/tca8418_keypad.c | |||
@@ -360,7 +360,7 @@ static int __devinit tca8418_keypad_probe(struct i2c_client *client, | |||
360 | client->irq = gpio_to_irq(client->irq); | 360 | client->irq = gpio_to_irq(client->irq); |
361 | 361 | ||
362 | error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler, | 362 | error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler, |
363 | IRQF_TRIGGER_FALLING, | 363 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
364 | client->name, keypad_data); | 364 | client->name, keypad_data); |
365 | if (error) { | 365 | if (error) { |
366 | dev_dbg(&client->dev, | 366 | dev_dbg(&client->dev, |
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c index a4a445fb7020..4c34f21fbe2d 100644 --- a/drivers/input/keyboard/tnetv107x-keypad.c +++ b/drivers/input/keyboard/tnetv107x-keypad.c | |||
@@ -227,15 +227,15 @@ static int __devinit keypad_probe(struct platform_device *pdev) | |||
227 | goto error_clk; | 227 | goto error_clk; |
228 | } | 228 | } |
229 | 229 | ||
230 | error = request_threaded_irq(kp->irq_press, NULL, keypad_irq, 0, | 230 | error = request_threaded_irq(kp->irq_press, NULL, keypad_irq, |
231 | dev_name(dev), kp); | 231 | IRQF_ONESHOT, dev_name(dev), kp); |
232 | if (error < 0) { | 232 | if (error < 0) { |
233 | dev_err(kp->dev, "Could not allocate keypad press key irq\n"); | 233 | dev_err(kp->dev, "Could not allocate keypad press key irq\n"); |
234 | goto error_irq_press; | 234 | goto error_irq_press; |
235 | } | 235 | } |
236 | 236 | ||
237 | error = request_threaded_irq(kp->irq_release, NULL, keypad_irq, 0, | 237 | error = request_threaded_irq(kp->irq_release, NULL, keypad_irq, |
238 | dev_name(dev), kp); | 238 | IRQF_ONESHOT, dev_name(dev), kp); |
239 | if (error < 0) { | 239 | if (error < 0) { |
240 | dev_err(kp->dev, "Could not allocate keypad release key irq\n"); | 240 | dev_err(kp->dev, "Could not allocate keypad release key irq\n"); |
241 | goto error_irq_release; | 241 | goto error_irq_release; |
diff --git a/drivers/input/misc/ad714x.c b/drivers/input/misc/ad714x.c index 0ac75bbad4d6..2e5d5e1de647 100644 --- a/drivers/input/misc/ad714x.c +++ b/drivers/input/misc/ad714x.c | |||
@@ -972,6 +972,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, | |||
972 | struct ad714x_platform_data *plat_data = dev->platform_data; | 972 | struct ad714x_platform_data *plat_data = dev->platform_data; |
973 | struct ad714x_chip *ad714x; | 973 | struct ad714x_chip *ad714x; |
974 | void *drv_mem; | 974 | void *drv_mem; |
975 | unsigned long irqflags; | ||
975 | 976 | ||
976 | struct ad714x_button_drv *bt_drv; | 977 | struct ad714x_button_drv *bt_drv; |
977 | struct ad714x_slider_drv *sd_drv; | 978 | struct ad714x_slider_drv *sd_drv; |
@@ -1162,10 +1163,11 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, | |||
1162 | alloc_idx++; | 1163 | alloc_idx++; |
1163 | } | 1164 | } |
1164 | 1165 | ||
1166 | irqflags = plat_data->irqflags ?: IRQF_TRIGGER_FALLING; | ||
1167 | irqflags |= IRQF_ONESHOT; | ||
1168 | |||
1165 | error = request_threaded_irq(ad714x->irq, NULL, ad714x_interrupt_thread, | 1169 | error = request_threaded_irq(ad714x->irq, NULL, ad714x_interrupt_thread, |
1166 | plat_data->irqflags ? | 1170 | irqflags, "ad714x_captouch", ad714x); |
1167 | plat_data->irqflags : IRQF_TRIGGER_FALLING, | ||
1168 | "ad714x_captouch", ad714x); | ||
1169 | if (error) { | 1171 | if (error) { |
1170 | dev_err(dev, "can't allocate irq %d\n", ad714x->irq); | 1172 | dev_err(dev, "can't allocate irq %d\n", ad714x->irq); |
1171 | goto err_unreg_dev; | 1173 | goto err_unreg_dev; |
diff --git a/drivers/input/misc/dm355evm_keys.c b/drivers/input/misc/dm355evm_keys.c index 35083c6836c3..c1313d8535c3 100644 --- a/drivers/input/misc/dm355evm_keys.c +++ b/drivers/input/misc/dm355evm_keys.c | |||
@@ -213,7 +213,8 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev) | |||
213 | /* REVISIT: flush the event queue? */ | 213 | /* REVISIT: flush the event queue? */ |
214 | 214 | ||
215 | status = request_threaded_irq(keys->irq, NULL, dm355evm_keys_irq, | 215 | status = request_threaded_irq(keys->irq, NULL, dm355evm_keys_irq, |
216 | IRQF_TRIGGER_FALLING, dev_name(&pdev->dev), keys); | 216 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
217 | dev_name(&pdev->dev), keys); | ||
217 | if (status < 0) | 218 | if (status < 0) |
218 | goto fail2; | 219 | goto fail2; |
219 | 220 | ||
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 2cf681d98c0d..d528c23e194f 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -79,6 +79,10 @@ | |||
79 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 | 79 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 |
80 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 | 80 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 |
81 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 | 81 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 |
82 | /* MacbookPro10,1 (unibody, June 2012) */ | ||
83 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 | ||
84 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 | ||
85 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 | ||
82 | 86 | ||
83 | #define BCM5974_DEVICE(prod) { \ | 87 | #define BCM5974_DEVICE(prod) { \ |
84 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | 88 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
@@ -128,6 +132,10 @@ static const struct usb_device_id bcm5974_table[] = { | |||
128 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), | 132 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), |
129 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), | 133 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), |
130 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), | 134 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), |
135 | /* MacbookPro10,1 */ | ||
136 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), | ||
137 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), | ||
138 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | ||
131 | /* Terminating entry */ | 139 | /* Terminating entry */ |
132 | {} | 140 | {} |
133 | }; | 141 | }; |
@@ -354,6 +362,18 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
354 | { DIM_X, DIM_X / SN_COORD, -4620, 5140 }, | 362 | { DIM_X, DIM_X / SN_COORD, -4620, 5140 }, |
355 | { DIM_Y, DIM_Y / SN_COORD, -150, 6600 } | 363 | { DIM_Y, DIM_Y / SN_COORD, -150, 6600 } |
356 | }, | 364 | }, |
365 | { | ||
366 | USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI, | ||
367 | USB_DEVICE_ID_APPLE_WELLSPRING7_ISO, | ||
368 | USB_DEVICE_ID_APPLE_WELLSPRING7_JIS, | ||
369 | HAS_INTEGRATED_BUTTON, | ||
370 | 0x84, sizeof(struct bt_data), | ||
371 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | ||
372 | { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, | ||
373 | { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, | ||
374 | { DIM_X, DIM_X / SN_COORD, -4750, 5280 }, | ||
375 | { DIM_Y, DIM_Y / SN_COORD, -150, 6730 } | ||
376 | }, | ||
357 | {} | 377 | {} |
358 | }; | 378 | }; |
359 | 379 | ||
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index cad5602d3ce4..8b31473a81fe 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -216,7 +216,7 @@ static void wacom_retrieve_report_data(struct usb_interface *intf, | |||
216 | 216 | ||
217 | rep_data[0] = 12; | 217 | rep_data[0] = 12; |
218 | result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, | 218 | result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, |
219 | rep_data[0], &rep_data, 2, | 219 | rep_data[0], rep_data, 2, |
220 | WAC_MSG_RETRIES); | 220 | WAC_MSG_RETRIES); |
221 | 221 | ||
222 | if (result >= 0 && rep_data[1] > 2) | 222 | if (result >= 0 && rep_data[1] > 2) |
@@ -401,7 +401,9 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
401 | break; | 401 | break; |
402 | 402 | ||
403 | case HID_USAGE_CONTACTMAX: | 403 | case HID_USAGE_CONTACTMAX: |
404 | wacom_retrieve_report_data(intf, features); | 404 | /* leave touch_max as is if predefined */ |
405 | if (!features->touch_max) | ||
406 | wacom_retrieve_report_data(intf, features); | ||
405 | i++; | 407 | i++; |
406 | break; | 408 | break; |
407 | } | 409 | } |
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index e2482b40da51..bd4eb4277697 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c | |||
@@ -597,7 +597,7 @@ struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq, | |||
597 | AD7879_TMR(ts->pen_down_acc_interval); | 597 | AD7879_TMR(ts->pen_down_acc_interval); |
598 | 598 | ||
599 | err = request_threaded_irq(ts->irq, NULL, ad7879_irq, | 599 | err = request_threaded_irq(ts->irq, NULL, ad7879_irq, |
600 | IRQF_TRIGGER_FALLING, | 600 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
601 | dev_name(dev), ts); | 601 | dev_name(dev), ts); |
602 | if (err) { | 602 | if (err) { |
603 | dev_err(dev, "irq %d busy?\n", ts->irq); | 603 | dev_err(dev, "irq %d busy?\n", ts->irq); |
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 42e645062c20..25fd0561a17d 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -1149,7 +1149,8 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
1149 | goto err_free_object; | 1149 | goto err_free_object; |
1150 | 1150 | ||
1151 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, | 1151 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, |
1152 | pdata->irqflags, client->dev.driver->name, data); | 1152 | pdata->irqflags | IRQF_ONESHOT, |
1153 | client->dev.driver->name, data); | ||
1153 | if (error) { | 1154 | if (error) { |
1154 | dev_err(&client->dev, "Failed to register interrupt\n"); | 1155 | dev_err(&client->dev, "Failed to register interrupt\n"); |
1155 | goto err_free_object; | 1156 | goto err_free_object; |
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index f2d03c06c2da..5c487d23f11c 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c | |||
@@ -509,7 +509,8 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
509 | input_set_drvdata(in_dev, bu21013_data); | 509 | input_set_drvdata(in_dev, bu21013_data); |
510 | 510 | ||
511 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, | 511 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, |
512 | IRQF_TRIGGER_FALLING | IRQF_SHARED, | 512 | IRQF_TRIGGER_FALLING | IRQF_SHARED | |
513 | IRQF_ONESHOT, | ||
513 | DRIVER_TP, bu21013_data); | 514 | DRIVER_TP, bu21013_data); |
514 | if (error) { | 515 | if (error) { |
515 | dev_err(&client->dev, "request irq %d failed\n", pdata->irq); | 516 | dev_err(&client->dev, "request irq %d failed\n", pdata->irq); |
diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 237753ad1031..464f1bf4b61d 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c | |||
@@ -251,7 +251,8 @@ static int __devinit cy8ctmg110_probe(struct i2c_client *client, | |||
251 | } | 251 | } |
252 | 252 | ||
253 | err = request_threaded_irq(client->irq, NULL, cy8ctmg110_irq_thread, | 253 | err = request_threaded_irq(client->irq, NULL, cy8ctmg110_irq_thread, |
254 | IRQF_TRIGGER_RISING, "touch_reset_key", ts); | 254 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
255 | "touch_reset_key", ts); | ||
255 | if (err < 0) { | 256 | if (err < 0) { |
256 | dev_err(&client->dev, | 257 | dev_err(&client->dev, |
257 | "irq %d busy? error %d\n", client->irq, err); | 258 | "irq %d busy? error %d\n", client->irq, err); |
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c index 3cd7a837f82b..cf299377fc49 100644 --- a/drivers/input/touchscreen/intel-mid-touch.c +++ b/drivers/input/touchscreen/intel-mid-touch.c | |||
@@ -620,7 +620,7 @@ static int __devinit mrstouch_probe(struct platform_device *pdev) | |||
620 | MRST_PRESSURE_MIN, MRST_PRESSURE_MAX, 0, 0); | 620 | MRST_PRESSURE_MIN, MRST_PRESSURE_MAX, 0, 0); |
621 | 621 | ||
622 | err = request_threaded_irq(tsdev->irq, NULL, mrstouch_pendet_irq, | 622 | err = request_threaded_irq(tsdev->irq, NULL, mrstouch_pendet_irq, |
623 | 0, "mrstouch", tsdev); | 623 | IRQF_ONESHOT, "mrstouch", tsdev); |
624 | if (err) { | 624 | if (err) { |
625 | dev_err(tsdev->dev, "unable to allocate irq\n"); | 625 | dev_err(tsdev->dev, "unable to allocate irq\n"); |
626 | goto err_free_mem; | 626 | goto err_free_mem; |
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index 72f6ba3a4709..953b4c105cad 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c | |||
@@ -165,7 +165,7 @@ static int __devinit pixcir_i2c_ts_probe(struct i2c_client *client, | |||
165 | input_set_drvdata(input, tsdata); | 165 | input_set_drvdata(input, tsdata); |
166 | 166 | ||
167 | error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr, | 167 | error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr, |
168 | IRQF_TRIGGER_FALLING, | 168 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
169 | client->name, tsdata); | 169 | client->name, tsdata); |
170 | if (error) { | 170 | if (error) { |
171 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | 171 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index 7e7488097359..368d2c6cf780 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
@@ -297,7 +297,7 @@ static int __devinit tsc_probe(struct platform_device *pdev) | |||
297 | goto error_clk; | 297 | goto error_clk; |
298 | } | 298 | } |
299 | 299 | ||
300 | error = request_threaded_irq(ts->tsc_irq, NULL, tsc_irq, 0, | 300 | error = request_threaded_irq(ts->tsc_irq, NULL, tsc_irq, IRQF_ONESHOT, |
301 | dev_name(dev), ts); | 301 | dev_name(dev), ts); |
302 | if (error < 0) { | 302 | if (error < 0) { |
303 | dev_err(ts->dev, "Could not allocate ts irq\n"); | 303 | dev_err(ts->dev, "Could not allocate ts irq\n"); |
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index b6adeaee9cc5..5ce3fa8ce646 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c | |||
@@ -650,7 +650,8 @@ static int __devinit tsc2005_probe(struct spi_device *spi) | |||
650 | tsc2005_stop_scan(ts); | 650 | tsc2005_stop_scan(ts); |
651 | 651 | ||
652 | error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread, | 652 | error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread, |
653 | IRQF_TRIGGER_RISING, "tsc2005", ts); | 653 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
654 | "tsc2005", ts); | ||
654 | if (error) { | 655 | if (error) { |
655 | dev_err(&spi->dev, "Failed to request irq, err: %d\n", error); | 656 | dev_err(&spi->dev, "Failed to request irq, err: %d\n", error); |
656 | goto err_free_mem; | 657 | goto err_free_mem; |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index a2e418cba0ff..625626391f2d 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -83,6 +83,8 @@ static struct iommu_ops amd_iommu_ops; | |||
83 | static ATOMIC_NOTIFIER_HEAD(ppr_notifier); | 83 | static ATOMIC_NOTIFIER_HEAD(ppr_notifier); |
84 | int amd_iommu_max_glx_val = -1; | 84 | int amd_iommu_max_glx_val = -1; |
85 | 85 | ||
86 | static struct dma_map_ops amd_iommu_dma_ops; | ||
87 | |||
86 | /* | 88 | /* |
87 | * general struct to manage commands send to an IOMMU | 89 | * general struct to manage commands send to an IOMMU |
88 | */ | 90 | */ |
@@ -402,7 +404,7 @@ static void amd_iommu_stats_init(void) | |||
402 | return; | 404 | return; |
403 | 405 | ||
404 | de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, | 406 | de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, |
405 | (u32 *)&amd_iommu_unmap_flush); | 407 | &amd_iommu_unmap_flush); |
406 | 408 | ||
407 | amd_iommu_stats_add(&compl_wait); | 409 | amd_iommu_stats_add(&compl_wait); |
408 | amd_iommu_stats_add(&cnt_map_single); | 410 | amd_iommu_stats_add(&cnt_map_single); |
@@ -2267,6 +2269,13 @@ static int device_change_notifier(struct notifier_block *nb, | |||
2267 | list_add_tail(&dma_domain->list, &iommu_pd_list); | 2269 | list_add_tail(&dma_domain->list, &iommu_pd_list); |
2268 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); | 2270 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); |
2269 | 2271 | ||
2272 | dev_data = get_dev_data(dev); | ||
2273 | |||
2274 | if (!dev_data->passthrough) | ||
2275 | dev->archdata.dma_ops = &amd_iommu_dma_ops; | ||
2276 | else | ||
2277 | dev->archdata.dma_ops = &nommu_dma_ops; | ||
2278 | |||
2270 | break; | 2279 | break; |
2271 | case BUS_NOTIFY_DEL_DEVICE: | 2280 | case BUS_NOTIFY_DEL_DEVICE: |
2272 | 2281 | ||
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 542024ba6dba..a33612f3206f 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -129,7 +129,7 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have | |||
129 | to handle */ | 129 | to handle */ |
130 | LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings | 130 | LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings |
131 | we find in ACPI */ | 131 | we find in ACPI */ |
132 | bool amd_iommu_unmap_flush; /* if true, flush on every unmap */ | 132 | u32 amd_iommu_unmap_flush; /* if true, flush on every unmap */ |
133 | 133 | ||
134 | LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the | 134 | LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the |
135 | system */ | 135 | system */ |
@@ -1641,6 +1641,8 @@ static int __init amd_iommu_init(void) | |||
1641 | 1641 | ||
1642 | amd_iommu_init_api(); | 1642 | amd_iommu_init_api(); |
1643 | 1643 | ||
1644 | x86_platform.iommu_shutdown = disable_iommus; | ||
1645 | |||
1644 | if (iommu_pass_through) | 1646 | if (iommu_pass_through) |
1645 | goto out; | 1647 | goto out; |
1646 | 1648 | ||
@@ -1649,8 +1651,6 @@ static int __init amd_iommu_init(void) | |||
1649 | else | 1651 | else |
1650 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); | 1652 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); |
1651 | 1653 | ||
1652 | x86_platform.iommu_shutdown = disable_iommus; | ||
1653 | |||
1654 | out: | 1654 | out: |
1655 | return ret; | 1655 | return ret; |
1656 | 1656 | ||
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index 24355559a2ad..c1b1d489817e 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h | |||
@@ -652,7 +652,7 @@ extern unsigned long *amd_iommu_pd_alloc_bitmap; | |||
652 | * If true, the addresses will be flushed on unmap time, not when | 652 | * If true, the addresses will be flushed on unmap time, not when |
653 | * they are reused | 653 | * they are reused |
654 | */ | 654 | */ |
655 | extern bool amd_iommu_unmap_flush; | 655 | extern u32 amd_iommu_unmap_flush; |
656 | 656 | ||
657 | /* Smallest number of PASIDs supported by any IOMMU in the system */ | 657 | /* Smallest number of PASIDs supported by any IOMMU in the system */ |
658 | extern u32 amd_iommu_max_pasids; | 658 | extern u32 amd_iommu_max_pasids; |
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index ecd679043d77..3f3d09d560ea 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c | |||
@@ -550,13 +550,13 @@ static int alloc_pdir(struct smmu_as *as) | |||
550 | return 0; | 550 | return 0; |
551 | 551 | ||
552 | as->pte_count = devm_kzalloc(smmu->dev, | 552 | as->pte_count = devm_kzalloc(smmu->dev, |
553 | sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_KERNEL); | 553 | sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_ATOMIC); |
554 | if (!as->pte_count) { | 554 | if (!as->pte_count) { |
555 | dev_err(smmu->dev, | 555 | dev_err(smmu->dev, |
556 | "failed to allocate smmu_device PTE cunters\n"); | 556 | "failed to allocate smmu_device PTE cunters\n"); |
557 | return -ENOMEM; | 557 | return -ENOMEM; |
558 | } | 558 | } |
559 | as->pdir_page = alloc_page(GFP_KERNEL | __GFP_DMA); | 559 | as->pdir_page = alloc_page(GFP_ATOMIC | __GFP_DMA); |
560 | if (!as->pdir_page) { | 560 | if (!as->pdir_page) { |
561 | dev_err(smmu->dev, | 561 | dev_err(smmu->dev, |
562 | "failed to allocate smmu_device page directory\n"); | 562 | "failed to allocate smmu_device page directory\n"); |
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c index 1a0ae4445ff2..5f21f629b7ae 100644 --- a/drivers/isdn/mISDN/stack.c +++ b/drivers/isdn/mISDN/stack.c | |||
@@ -135,8 +135,8 @@ send_layer2(struct mISDNstack *st, struct sk_buff *skb) | |||
135 | skb = NULL; | 135 | skb = NULL; |
136 | else if (*debug & DEBUG_SEND_ERR) | 136 | else if (*debug & DEBUG_SEND_ERR) |
137 | printk(KERN_DEBUG | 137 | printk(KERN_DEBUG |
138 | "%s ch%d mgr prim(%x) addr(%x) err %d\n", | 138 | "%s mgr prim(%x) err %d\n", |
139 | __func__, ch->nr, hh->prim, ch->addr, ret); | 139 | __func__, hh->prim, ret); |
140 | } | 140 | } |
141 | out: | 141 | out: |
142 | mutex_unlock(&st->lmutex); | 142 | mutex_unlock(&st->lmutex); |
diff --git a/drivers/leds/ledtrig-heartbeat.c b/drivers/leds/ledtrig-heartbeat.c index 41dc76db4311..a019fbb70880 100644 --- a/drivers/leds/ledtrig-heartbeat.c +++ b/drivers/leds/ledtrig-heartbeat.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/reboot.h> | 21 | #include <linux/reboot.h> |
22 | #include "leds.h" | 22 | #include "leds.h" |
23 | 23 | ||
24 | static int panic_heartbeats; | ||
25 | |||
24 | struct heartbeat_trig_data { | 26 | struct heartbeat_trig_data { |
25 | unsigned int phase; | 27 | unsigned int phase; |
26 | unsigned int period; | 28 | unsigned int period; |
@@ -34,6 +36,11 @@ static void led_heartbeat_function(unsigned long data) | |||
34 | unsigned long brightness = LED_OFF; | 36 | unsigned long brightness = LED_OFF; |
35 | unsigned long delay = 0; | 37 | unsigned long delay = 0; |
36 | 38 | ||
39 | if (unlikely(panic_heartbeats)) { | ||
40 | led_set_brightness(led_cdev, LED_OFF); | ||
41 | return; | ||
42 | } | ||
43 | |||
37 | /* acts like an actual heart beat -- ie thump-thump-pause... */ | 44 | /* acts like an actual heart beat -- ie thump-thump-pause... */ |
38 | switch (heartbeat_data->phase) { | 45 | switch (heartbeat_data->phase) { |
39 | case 0: | 46 | case 0: |
@@ -111,12 +118,19 @@ static int heartbeat_reboot_notifier(struct notifier_block *nb, | |||
111 | return NOTIFY_DONE; | 118 | return NOTIFY_DONE; |
112 | } | 119 | } |
113 | 120 | ||
121 | static int heartbeat_panic_notifier(struct notifier_block *nb, | ||
122 | unsigned long code, void *unused) | ||
123 | { | ||
124 | panic_heartbeats = 1; | ||
125 | return NOTIFY_DONE; | ||
126 | } | ||
127 | |||
114 | static struct notifier_block heartbeat_reboot_nb = { | 128 | static struct notifier_block heartbeat_reboot_nb = { |
115 | .notifier_call = heartbeat_reboot_notifier, | 129 | .notifier_call = heartbeat_reboot_notifier, |
116 | }; | 130 | }; |
117 | 131 | ||
118 | static struct notifier_block heartbeat_panic_nb = { | 132 | static struct notifier_block heartbeat_panic_nb = { |
119 | .notifier_call = heartbeat_reboot_notifier, | 133 | .notifier_call = heartbeat_panic_notifier, |
120 | }; | 134 | }; |
121 | 135 | ||
122 | static int __init heartbeat_trig_init(void) | 136 | static int __init heartbeat_trig_init(void) |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 37fdaf81bd1f..ce59824fb414 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -2292,6 +2292,13 @@ static int process_reserve_metadata_snap_mesg(unsigned argc, char **argv, struct | |||
2292 | if (r) | 2292 | if (r) |
2293 | return r; | 2293 | return r; |
2294 | 2294 | ||
2295 | r = dm_pool_commit_metadata(pool->pmd); | ||
2296 | if (r) { | ||
2297 | DMERR("%s: dm_pool_commit_metadata() failed, error = %d", | ||
2298 | __func__, r); | ||
2299 | return r; | ||
2300 | } | ||
2301 | |||
2295 | r = dm_pool_reserve_metadata_snap(pool->pmd); | 2302 | r = dm_pool_reserve_metadata_snap(pool->pmd); |
2296 | if (r) | 2303 | if (r) |
2297 | DMWARN("reserve_metadata_snap message failed."); | 2304 | DMWARN("reserve_metadata_snap message failed."); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1c2f9048e1ae..a4c219e3c859 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5784,8 +5784,7 @@ static int add_new_disk(struct mddev * mddev, mdu_disk_info_t *info) | |||
5784 | super_types[mddev->major_version]. | 5784 | super_types[mddev->major_version]. |
5785 | validate_super(mddev, rdev); | 5785 | validate_super(mddev, rdev); |
5786 | if ((info->state & (1<<MD_DISK_SYNC)) && | 5786 | if ((info->state & (1<<MD_DISK_SYNC)) && |
5787 | (!test_bit(In_sync, &rdev->flags) || | 5787 | rdev->raid_disk != info->raid_disk) { |
5788 | rdev->raid_disk != info->raid_disk)) { | ||
5789 | /* This was a hot-add request, but events doesn't | 5788 | /* This was a hot-add request, but events doesn't |
5790 | * match, so reject it. | 5789 | * match, so reject it. |
5791 | */ | 5790 | */ |
@@ -6751,7 +6750,7 @@ struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev | |||
6751 | thread->tsk = kthread_run(md_thread, thread, | 6750 | thread->tsk = kthread_run(md_thread, thread, |
6752 | "%s_%s", | 6751 | "%s_%s", |
6753 | mdname(thread->mddev), | 6752 | mdname(thread->mddev), |
6754 | name ?: mddev->pers->name); | 6753 | name); |
6755 | if (IS_ERR(thread->tsk)) { | 6754 | if (IS_ERR(thread->tsk)) { |
6756 | kfree(thread); | 6755 | kfree(thread); |
6757 | return NULL; | 6756 | return NULL; |
@@ -7298,6 +7297,7 @@ void md_do_sync(struct mddev *mddev) | |||
7298 | int skipped = 0; | 7297 | int skipped = 0; |
7299 | struct md_rdev *rdev; | 7298 | struct md_rdev *rdev; |
7300 | char *desc; | 7299 | char *desc; |
7300 | struct blk_plug plug; | ||
7301 | 7301 | ||
7302 | /* just incase thread restarts... */ | 7302 | /* just incase thread restarts... */ |
7303 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) | 7303 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) |
@@ -7447,6 +7447,7 @@ void md_do_sync(struct mddev *mddev) | |||
7447 | } | 7447 | } |
7448 | mddev->curr_resync_completed = j; | 7448 | mddev->curr_resync_completed = j; |
7449 | 7449 | ||
7450 | blk_start_plug(&plug); | ||
7450 | while (j < max_sectors) { | 7451 | while (j < max_sectors) { |
7451 | sector_t sectors; | 7452 | sector_t sectors; |
7452 | 7453 | ||
@@ -7552,6 +7553,7 @@ void md_do_sync(struct mddev *mddev) | |||
7552 | * this also signals 'finished resyncing' to md_stop | 7553 | * this also signals 'finished resyncing' to md_stop |
7553 | */ | 7554 | */ |
7554 | out: | 7555 | out: |
7556 | blk_finish_plug(&plug); | ||
7555 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); | 7557 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); |
7556 | 7558 | ||
7557 | /* tell personality that we are finished */ | 7559 | /* tell personality that we are finished */ |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 9339e67fcc79..61a1833ebaf3 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -474,7 +474,8 @@ static int multipath_run (struct mddev *mddev) | |||
474 | } | 474 | } |
475 | 475 | ||
476 | { | 476 | { |
477 | mddev->thread = md_register_thread(multipathd, mddev, NULL); | 477 | mddev->thread = md_register_thread(multipathd, mddev, |
478 | "multipath"); | ||
478 | if (!mddev->thread) { | 479 | if (!mddev->thread) { |
479 | printk(KERN_ERR "multipath: couldn't allocate thread" | 480 | printk(KERN_ERR "multipath: couldn't allocate thread" |
480 | " for %s\n", mdname(mddev)); | 481 | " for %s\n", mdname(mddev)); |
diff --git a/drivers/md/persistent-data/dm-space-map-checker.c b/drivers/md/persistent-data/dm-space-map-checker.c index 50ed53bf4aa2..fc90c11620ad 100644 --- a/drivers/md/persistent-data/dm-space-map-checker.c +++ b/drivers/md/persistent-data/dm-space-map-checker.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/device-mapper.h> | 9 | #include <linux/device-mapper.h> |
10 | #include <linux/export.h> | 10 | #include <linux/export.h> |
11 | #include <linux/vmalloc.h> | ||
11 | 12 | ||
12 | #ifdef CONFIG_DM_DEBUG_SPACE_MAPS | 13 | #ifdef CONFIG_DM_DEBUG_SPACE_MAPS |
13 | 14 | ||
@@ -89,13 +90,23 @@ static int ca_create(struct count_array *ca, struct dm_space_map *sm) | |||
89 | 90 | ||
90 | ca->nr = nr_blocks; | 91 | ca->nr = nr_blocks; |
91 | ca->nr_free = nr_blocks; | 92 | ca->nr_free = nr_blocks; |
92 | ca->counts = kzalloc(sizeof(*ca->counts) * nr_blocks, GFP_KERNEL); | 93 | |
93 | if (!ca->counts) | 94 | if (!nr_blocks) |
94 | return -ENOMEM; | 95 | ca->counts = NULL; |
96 | else { | ||
97 | ca->counts = vzalloc(sizeof(*ca->counts) * nr_blocks); | ||
98 | if (!ca->counts) | ||
99 | return -ENOMEM; | ||
100 | } | ||
95 | 101 | ||
96 | return 0; | 102 | return 0; |
97 | } | 103 | } |
98 | 104 | ||
105 | static void ca_destroy(struct count_array *ca) | ||
106 | { | ||
107 | vfree(ca->counts); | ||
108 | } | ||
109 | |||
99 | static int ca_load(struct count_array *ca, struct dm_space_map *sm) | 110 | static int ca_load(struct count_array *ca, struct dm_space_map *sm) |
100 | { | 111 | { |
101 | int r; | 112 | int r; |
@@ -126,12 +137,14 @@ static int ca_load(struct count_array *ca, struct dm_space_map *sm) | |||
126 | static int ca_extend(struct count_array *ca, dm_block_t extra_blocks) | 137 | static int ca_extend(struct count_array *ca, dm_block_t extra_blocks) |
127 | { | 138 | { |
128 | dm_block_t nr_blocks = ca->nr + extra_blocks; | 139 | dm_block_t nr_blocks = ca->nr + extra_blocks; |
129 | uint32_t *counts = kzalloc(sizeof(*counts) * nr_blocks, GFP_KERNEL); | 140 | uint32_t *counts = vzalloc(sizeof(*counts) * nr_blocks); |
130 | if (!counts) | 141 | if (!counts) |
131 | return -ENOMEM; | 142 | return -ENOMEM; |
132 | 143 | ||
133 | memcpy(counts, ca->counts, sizeof(*counts) * ca->nr); | 144 | if (ca->counts) { |
134 | kfree(ca->counts); | 145 | memcpy(counts, ca->counts, sizeof(*counts) * ca->nr); |
146 | ca_destroy(ca); | ||
147 | } | ||
135 | ca->nr = nr_blocks; | 148 | ca->nr = nr_blocks; |
136 | ca->nr_free += extra_blocks; | 149 | ca->nr_free += extra_blocks; |
137 | ca->counts = counts; | 150 | ca->counts = counts; |
@@ -151,11 +164,6 @@ static int ca_commit(struct count_array *old, struct count_array *new) | |||
151 | return 0; | 164 | return 0; |
152 | } | 165 | } |
153 | 166 | ||
154 | static void ca_destroy(struct count_array *ca) | ||
155 | { | ||
156 | kfree(ca->counts); | ||
157 | } | ||
158 | |||
159 | /*----------------------------------------------------------------*/ | 167 | /*----------------------------------------------------------------*/ |
160 | 168 | ||
161 | struct sm_checker { | 169 | struct sm_checker { |
@@ -343,25 +351,25 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
343 | int r; | 351 | int r; |
344 | struct sm_checker *smc; | 352 | struct sm_checker *smc; |
345 | 353 | ||
346 | if (!sm) | 354 | if (IS_ERR_OR_NULL(sm)) |
347 | return NULL; | 355 | return ERR_PTR(-EINVAL); |
348 | 356 | ||
349 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); | 357 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); |
350 | if (!smc) | 358 | if (!smc) |
351 | return NULL; | 359 | return ERR_PTR(-ENOMEM); |
352 | 360 | ||
353 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); | 361 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); |
354 | r = ca_create(&smc->old_counts, sm); | 362 | r = ca_create(&smc->old_counts, sm); |
355 | if (r) { | 363 | if (r) { |
356 | kfree(smc); | 364 | kfree(smc); |
357 | return NULL; | 365 | return ERR_PTR(r); |
358 | } | 366 | } |
359 | 367 | ||
360 | r = ca_create(&smc->counts, sm); | 368 | r = ca_create(&smc->counts, sm); |
361 | if (r) { | 369 | if (r) { |
362 | ca_destroy(&smc->old_counts); | 370 | ca_destroy(&smc->old_counts); |
363 | kfree(smc); | 371 | kfree(smc); |
364 | return NULL; | 372 | return ERR_PTR(r); |
365 | } | 373 | } |
366 | 374 | ||
367 | smc->real_sm = sm; | 375 | smc->real_sm = sm; |
@@ -371,7 +379,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
371 | ca_destroy(&smc->counts); | 379 | ca_destroy(&smc->counts); |
372 | ca_destroy(&smc->old_counts); | 380 | ca_destroy(&smc->old_counts); |
373 | kfree(smc); | 381 | kfree(smc); |
374 | return NULL; | 382 | return ERR_PTR(r); |
375 | } | 383 | } |
376 | 384 | ||
377 | r = ca_commit(&smc->old_counts, &smc->counts); | 385 | r = ca_commit(&smc->old_counts, &smc->counts); |
@@ -379,7 +387,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
379 | ca_destroy(&smc->counts); | 387 | ca_destroy(&smc->counts); |
380 | ca_destroy(&smc->old_counts); | 388 | ca_destroy(&smc->old_counts); |
381 | kfree(smc); | 389 | kfree(smc); |
382 | return NULL; | 390 | return ERR_PTR(r); |
383 | } | 391 | } |
384 | 392 | ||
385 | return &smc->sm; | 393 | return &smc->sm; |
@@ -391,25 +399,25 @@ struct dm_space_map *dm_sm_checker_create_fresh(struct dm_space_map *sm) | |||
391 | int r; | 399 | int r; |
392 | struct sm_checker *smc; | 400 | struct sm_checker *smc; |
393 | 401 | ||
394 | if (!sm) | 402 | if (IS_ERR_OR_NULL(sm)) |
395 | return NULL; | 403 | return ERR_PTR(-EINVAL); |
396 | 404 | ||
397 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); | 405 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); |
398 | if (!smc) | 406 | if (!smc) |
399 | return NULL; | 407 | return ERR_PTR(-ENOMEM); |
400 | 408 | ||
401 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); | 409 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); |
402 | r = ca_create(&smc->old_counts, sm); | 410 | r = ca_create(&smc->old_counts, sm); |
403 | if (r) { | 411 | if (r) { |
404 | kfree(smc); | 412 | kfree(smc); |
405 | return NULL; | 413 | return ERR_PTR(r); |
406 | } | 414 | } |
407 | 415 | ||
408 | r = ca_create(&smc->counts, sm); | 416 | r = ca_create(&smc->counts, sm); |
409 | if (r) { | 417 | if (r) { |
410 | ca_destroy(&smc->old_counts); | 418 | ca_destroy(&smc->old_counts); |
411 | kfree(smc); | 419 | kfree(smc); |
412 | return NULL; | 420 | return ERR_PTR(r); |
413 | } | 421 | } |
414 | 422 | ||
415 | smc->real_sm = sm; | 423 | smc->real_sm = sm; |
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c index fc469ba9f627..3d0ed5332883 100644 --- a/drivers/md/persistent-data/dm-space-map-disk.c +++ b/drivers/md/persistent-data/dm-space-map-disk.c | |||
@@ -290,7 +290,16 @@ struct dm_space_map *dm_sm_disk_create(struct dm_transaction_manager *tm, | |||
290 | dm_block_t nr_blocks) | 290 | dm_block_t nr_blocks) |
291 | { | 291 | { |
292 | struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks); | 292 | struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks); |
293 | return dm_sm_checker_create_fresh(sm); | 293 | struct dm_space_map *smc; |
294 | |||
295 | if (IS_ERR_OR_NULL(sm)) | ||
296 | return sm; | ||
297 | |||
298 | smc = dm_sm_checker_create_fresh(sm); | ||
299 | if (IS_ERR(smc)) | ||
300 | dm_sm_destroy(sm); | ||
301 | |||
302 | return smc; | ||
294 | } | 303 | } |
295 | EXPORT_SYMBOL_GPL(dm_sm_disk_create); | 304 | EXPORT_SYMBOL_GPL(dm_sm_disk_create); |
296 | 305 | ||
diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c index 400fe144c0cd..e5604b32d91f 100644 --- a/drivers/md/persistent-data/dm-transaction-manager.c +++ b/drivers/md/persistent-data/dm-transaction-manager.c | |||
@@ -138,6 +138,9 @@ EXPORT_SYMBOL_GPL(dm_tm_create_non_blocking_clone); | |||
138 | 138 | ||
139 | void dm_tm_destroy(struct dm_transaction_manager *tm) | 139 | void dm_tm_destroy(struct dm_transaction_manager *tm) |
140 | { | 140 | { |
141 | if (!tm->is_clone) | ||
142 | wipe_shadow_table(tm); | ||
143 | |||
141 | kfree(tm); | 144 | kfree(tm); |
142 | } | 145 | } |
143 | EXPORT_SYMBOL_GPL(dm_tm_destroy); | 146 | EXPORT_SYMBOL_GPL(dm_tm_destroy); |
@@ -344,8 +347,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, | |||
344 | } | 347 | } |
345 | 348 | ||
346 | *sm = dm_sm_checker_create(inner); | 349 | *sm = dm_sm_checker_create(inner); |
347 | if (!*sm) | 350 | if (IS_ERR(*sm)) { |
351 | r = PTR_ERR(*sm); | ||
348 | goto bad2; | 352 | goto bad2; |
353 | } | ||
349 | 354 | ||
350 | } else { | 355 | } else { |
351 | r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location, | 356 | r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location, |
@@ -364,8 +369,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, | |||
364 | } | 369 | } |
365 | 370 | ||
366 | *sm = dm_sm_checker_create(inner); | 371 | *sm = dm_sm_checker_create(inner); |
367 | if (!*sm) | 372 | if (IS_ERR(*sm)) { |
373 | r = PTR_ERR(*sm); | ||
368 | goto bad2; | 374 | goto bad2; |
375 | } | ||
369 | } | 376 | } |
370 | 377 | ||
371 | return 0; | 378 | return 0; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a9c7981ddd24..240ff3125040 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -517,8 +517,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
517 | int bad_sectors; | 517 | int bad_sectors; |
518 | 518 | ||
519 | int disk = start_disk + i; | 519 | int disk = start_disk + i; |
520 | if (disk >= conf->raid_disks) | 520 | if (disk >= conf->raid_disks * 2) |
521 | disk -= conf->raid_disks; | 521 | disk -= conf->raid_disks * 2; |
522 | 522 | ||
523 | rdev = rcu_dereference(conf->mirrors[disk].rdev); | 523 | rdev = rcu_dereference(conf->mirrors[disk].rdev); |
524 | if (r1_bio->bios[disk] == IO_BLOCKED | 524 | if (r1_bio->bios[disk] == IO_BLOCKED |
@@ -883,7 +883,6 @@ static void make_request(struct mddev *mddev, struct bio * bio) | |||
883 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); | 883 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); |
884 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); | 884 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); |
885 | struct md_rdev *blocked_rdev; | 885 | struct md_rdev *blocked_rdev; |
886 | int plugged; | ||
887 | int first_clone; | 886 | int first_clone; |
888 | int sectors_handled; | 887 | int sectors_handled; |
889 | int max_sectors; | 888 | int max_sectors; |
@@ -1034,7 +1033,6 @@ read_again: | |||
1034 | * the bad blocks. Each set of writes gets it's own r1bio | 1033 | * the bad blocks. Each set of writes gets it's own r1bio |
1035 | * with a set of bios attached. | 1034 | * with a set of bios attached. |
1036 | */ | 1035 | */ |
1037 | plugged = mddev_check_plugged(mddev); | ||
1038 | 1036 | ||
1039 | disks = conf->raid_disks * 2; | 1037 | disks = conf->raid_disks * 2; |
1040 | retry_write: | 1038 | retry_write: |
@@ -1191,6 +1189,8 @@ read_again: | |||
1191 | bio_list_add(&conf->pending_bio_list, mbio); | 1189 | bio_list_add(&conf->pending_bio_list, mbio); |
1192 | conf->pending_count++; | 1190 | conf->pending_count++; |
1193 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1191 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1192 | if (!mddev_check_plugged(mddev)) | ||
1193 | md_wakeup_thread(mddev->thread); | ||
1194 | } | 1194 | } |
1195 | /* Mustn't call r1_bio_write_done before this next test, | 1195 | /* Mustn't call r1_bio_write_done before this next test, |
1196 | * as it could result in the bio being freed. | 1196 | * as it could result in the bio being freed. |
@@ -1213,9 +1213,6 @@ read_again: | |||
1213 | 1213 | ||
1214 | /* In case raid1d snuck in to freeze_array */ | 1214 | /* In case raid1d snuck in to freeze_array */ |
1215 | wake_up(&conf->wait_barrier); | 1215 | wake_up(&conf->wait_barrier); |
1216 | |||
1217 | if (do_sync || !bitmap || !plugged) | ||
1218 | md_wakeup_thread(mddev->thread); | ||
1219 | } | 1216 | } |
1220 | 1217 | ||
1221 | static void status(struct seq_file *seq, struct mddev *mddev) | 1218 | static void status(struct seq_file *seq, struct mddev *mddev) |
@@ -2488,9 +2485,10 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp | |||
2488 | */ | 2485 | */ |
2489 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { | 2486 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { |
2490 | atomic_set(&r1_bio->remaining, read_targets); | 2487 | atomic_set(&r1_bio->remaining, read_targets); |
2491 | for (i = 0; i < conf->raid_disks * 2; i++) { | 2488 | for (i = 0; i < conf->raid_disks * 2 && read_targets; i++) { |
2492 | bio = r1_bio->bios[i]; | 2489 | bio = r1_bio->bios[i]; |
2493 | if (bio->bi_end_io == end_sync_read) { | 2490 | if (bio->bi_end_io == end_sync_read) { |
2491 | read_targets--; | ||
2494 | md_sync_acct(bio->bi_bdev, nr_sectors); | 2492 | md_sync_acct(bio->bi_bdev, nr_sectors); |
2495 | generic_make_request(bio); | 2493 | generic_make_request(bio); |
2496 | } | 2494 | } |
@@ -2621,7 +2619,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2621 | goto abort; | 2619 | goto abort; |
2622 | } | 2620 | } |
2623 | err = -ENOMEM; | 2621 | err = -ENOMEM; |
2624 | conf->thread = md_register_thread(raid1d, mddev, NULL); | 2622 | conf->thread = md_register_thread(raid1d, mddev, "raid1"); |
2625 | if (!conf->thread) { | 2623 | if (!conf->thread) { |
2626 | printk(KERN_ERR | 2624 | printk(KERN_ERR |
2627 | "md/raid1:%s: couldn't allocate thread\n", | 2625 | "md/raid1:%s: couldn't allocate thread\n", |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 99ae6068e456..8da6282254c3 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1039,7 +1039,6 @@ static void make_request(struct mddev *mddev, struct bio * bio) | |||
1039 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); | 1039 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); |
1040 | unsigned long flags; | 1040 | unsigned long flags; |
1041 | struct md_rdev *blocked_rdev; | 1041 | struct md_rdev *blocked_rdev; |
1042 | int plugged; | ||
1043 | int sectors_handled; | 1042 | int sectors_handled; |
1044 | int max_sectors; | 1043 | int max_sectors; |
1045 | int sectors; | 1044 | int sectors; |
@@ -1239,7 +1238,6 @@ read_again: | |||
1239 | * of r10_bios is recored in bio->bi_phys_segments just as with | 1238 | * of r10_bios is recored in bio->bi_phys_segments just as with |
1240 | * the read case. | 1239 | * the read case. |
1241 | */ | 1240 | */ |
1242 | plugged = mddev_check_plugged(mddev); | ||
1243 | 1241 | ||
1244 | r10_bio->read_slot = -1; /* make sure repl_bio gets freed */ | 1242 | r10_bio->read_slot = -1; /* make sure repl_bio gets freed */ |
1245 | raid10_find_phys(conf, r10_bio); | 1243 | raid10_find_phys(conf, r10_bio); |
@@ -1396,6 +1394,8 @@ retry_write: | |||
1396 | bio_list_add(&conf->pending_bio_list, mbio); | 1394 | bio_list_add(&conf->pending_bio_list, mbio); |
1397 | conf->pending_count++; | 1395 | conf->pending_count++; |
1398 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1396 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1397 | if (!mddev_check_plugged(mddev)) | ||
1398 | md_wakeup_thread(mddev->thread); | ||
1399 | 1399 | ||
1400 | if (!r10_bio->devs[i].repl_bio) | 1400 | if (!r10_bio->devs[i].repl_bio) |
1401 | continue; | 1401 | continue; |
@@ -1423,6 +1423,8 @@ retry_write: | |||
1423 | bio_list_add(&conf->pending_bio_list, mbio); | 1423 | bio_list_add(&conf->pending_bio_list, mbio); |
1424 | conf->pending_count++; | 1424 | conf->pending_count++; |
1425 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1425 | spin_unlock_irqrestore(&conf->device_lock, flags); |
1426 | if (!mddev_check_plugged(mddev)) | ||
1427 | md_wakeup_thread(mddev->thread); | ||
1426 | } | 1428 | } |
1427 | 1429 | ||
1428 | /* Don't remove the bias on 'remaining' (one_write_done) until | 1430 | /* Don't remove the bias on 'remaining' (one_write_done) until |
@@ -1448,9 +1450,6 @@ retry_write: | |||
1448 | 1450 | ||
1449 | /* In case raid10d snuck in to freeze_array */ | 1451 | /* In case raid10d snuck in to freeze_array */ |
1450 | wake_up(&conf->wait_barrier); | 1452 | wake_up(&conf->wait_barrier); |
1451 | |||
1452 | if (do_sync || !mddev->bitmap || !plugged) | ||
1453 | md_wakeup_thread(mddev->thread); | ||
1454 | } | 1453 | } |
1455 | 1454 | ||
1456 | static void status(struct seq_file *seq, struct mddev *mddev) | 1455 | static void status(struct seq_file *seq, struct mddev *mddev) |
@@ -2310,7 +2309,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 | |||
2310 | if (r10_sync_page_io(rdev, | 2309 | if (r10_sync_page_io(rdev, |
2311 | r10_bio->devs[sl].addr + | 2310 | r10_bio->devs[sl].addr + |
2312 | sect, | 2311 | sect, |
2313 | s<<9, conf->tmppage, WRITE) | 2312 | s, conf->tmppage, WRITE) |
2314 | == 0) { | 2313 | == 0) { |
2315 | /* Well, this device is dead */ | 2314 | /* Well, this device is dead */ |
2316 | printk(KERN_NOTICE | 2315 | printk(KERN_NOTICE |
@@ -2349,7 +2348,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 | |||
2349 | switch (r10_sync_page_io(rdev, | 2348 | switch (r10_sync_page_io(rdev, |
2350 | r10_bio->devs[sl].addr + | 2349 | r10_bio->devs[sl].addr + |
2351 | sect, | 2350 | sect, |
2352 | s<<9, conf->tmppage, | 2351 | s, conf->tmppage, |
2353 | READ)) { | 2352 | READ)) { |
2354 | case 0: | 2353 | case 0: |
2355 | /* Well, this device is dead */ | 2354 | /* Well, this device is dead */ |
@@ -2512,7 +2511,7 @@ read_more: | |||
2512 | slot = r10_bio->read_slot; | 2511 | slot = r10_bio->read_slot; |
2513 | printk_ratelimited( | 2512 | printk_ratelimited( |
2514 | KERN_ERR | 2513 | KERN_ERR |
2515 | "md/raid10:%s: %s: redirecting" | 2514 | "md/raid10:%s: %s: redirecting " |
2516 | "sector %llu to another mirror\n", | 2515 | "sector %llu to another mirror\n", |
2517 | mdname(mddev), | 2516 | mdname(mddev), |
2518 | bdevname(rdev->bdev, b), | 2517 | bdevname(rdev->bdev, b), |
@@ -2661,7 +2660,8 @@ static void raid10d(struct mddev *mddev) | |||
2661 | blk_start_plug(&plug); | 2660 | blk_start_plug(&plug); |
2662 | for (;;) { | 2661 | for (;;) { |
2663 | 2662 | ||
2664 | flush_pending_writes(conf); | 2663 | if (atomic_read(&mddev->plug_cnt) == 0) |
2664 | flush_pending_writes(conf); | ||
2665 | 2665 | ||
2666 | spin_lock_irqsave(&conf->device_lock, flags); | 2666 | spin_lock_irqsave(&conf->device_lock, flags); |
2667 | if (list_empty(head)) { | 2667 | if (list_empty(head)) { |
@@ -2890,6 +2890,12 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
2890 | /* want to reconstruct this device */ | 2890 | /* want to reconstruct this device */ |
2891 | rb2 = r10_bio; | 2891 | rb2 = r10_bio; |
2892 | sect = raid10_find_virt(conf, sector_nr, i); | 2892 | sect = raid10_find_virt(conf, sector_nr, i); |
2893 | if (sect >= mddev->resync_max_sectors) { | ||
2894 | /* last stripe is not complete - don't | ||
2895 | * try to recover this sector. | ||
2896 | */ | ||
2897 | continue; | ||
2898 | } | ||
2893 | /* Unless we are doing a full sync, or a replacement | 2899 | /* Unless we are doing a full sync, or a replacement |
2894 | * we only need to recover the block if it is set in | 2900 | * we only need to recover the block if it is set in |
2895 | * the bitmap | 2901 | * the bitmap |
@@ -3421,7 +3427,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
3421 | spin_lock_init(&conf->resync_lock); | 3427 | spin_lock_init(&conf->resync_lock); |
3422 | init_waitqueue_head(&conf->wait_barrier); | 3428 | init_waitqueue_head(&conf->wait_barrier); |
3423 | 3429 | ||
3424 | conf->thread = md_register_thread(raid10d, mddev, NULL); | 3430 | conf->thread = md_register_thread(raid10d, mddev, "raid10"); |
3425 | if (!conf->thread) | 3431 | if (!conf->thread) |
3426 | goto out; | 3432 | goto out; |
3427 | 3433 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d26767246d26..04348d76bb30 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -196,12 +196,14 @@ static void __release_stripe(struct r5conf *conf, struct stripe_head *sh) | |||
196 | BUG_ON(!list_empty(&sh->lru)); | 196 | BUG_ON(!list_empty(&sh->lru)); |
197 | BUG_ON(atomic_read(&conf->active_stripes)==0); | 197 | BUG_ON(atomic_read(&conf->active_stripes)==0); |
198 | if (test_bit(STRIPE_HANDLE, &sh->state)) { | 198 | if (test_bit(STRIPE_HANDLE, &sh->state)) { |
199 | if (test_bit(STRIPE_DELAYED, &sh->state)) | 199 | if (test_bit(STRIPE_DELAYED, &sh->state) && |
200 | !test_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | ||
200 | list_add_tail(&sh->lru, &conf->delayed_list); | 201 | list_add_tail(&sh->lru, &conf->delayed_list); |
201 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && | 202 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && |
202 | sh->bm_seq - conf->seq_write > 0) | 203 | sh->bm_seq - conf->seq_write > 0) |
203 | list_add_tail(&sh->lru, &conf->bitmap_list); | 204 | list_add_tail(&sh->lru, &conf->bitmap_list); |
204 | else { | 205 | else { |
206 | clear_bit(STRIPE_DELAYED, &sh->state); | ||
205 | clear_bit(STRIPE_BIT_DELAY, &sh->state); | 207 | clear_bit(STRIPE_BIT_DELAY, &sh->state); |
206 | list_add_tail(&sh->lru, &conf->handle_list); | 208 | list_add_tail(&sh->lru, &conf->handle_list); |
207 | } | 209 | } |
@@ -606,6 +608,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
606 | * a chance*/ | 608 | * a chance*/ |
607 | md_check_recovery(conf->mddev); | 609 | md_check_recovery(conf->mddev); |
608 | } | 610 | } |
611 | /* | ||
612 | * Because md_wait_for_blocked_rdev | ||
613 | * will dec nr_pending, we must | ||
614 | * increment it first. | ||
615 | */ | ||
616 | atomic_inc(&rdev->nr_pending); | ||
609 | md_wait_for_blocked_rdev(rdev, conf->mddev); | 617 | md_wait_for_blocked_rdev(rdev, conf->mddev); |
610 | } else { | 618 | } else { |
611 | /* Acknowledged bad block - skip the write */ | 619 | /* Acknowledged bad block - skip the write */ |
@@ -1737,6 +1745,7 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1737 | } else { | 1745 | } else { |
1738 | const char *bdn = bdevname(rdev->bdev, b); | 1746 | const char *bdn = bdevname(rdev->bdev, b); |
1739 | int retry = 0; | 1747 | int retry = 0; |
1748 | int set_bad = 0; | ||
1740 | 1749 | ||
1741 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); | 1750 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); |
1742 | atomic_inc(&rdev->read_errors); | 1751 | atomic_inc(&rdev->read_errors); |
@@ -1748,7 +1757,8 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1748 | mdname(conf->mddev), | 1757 | mdname(conf->mddev), |
1749 | (unsigned long long)s, | 1758 | (unsigned long long)s, |
1750 | bdn); | 1759 | bdn); |
1751 | else if (conf->mddev->degraded >= conf->max_degraded) | 1760 | else if (conf->mddev->degraded >= conf->max_degraded) { |
1761 | set_bad = 1; | ||
1752 | printk_ratelimited( | 1762 | printk_ratelimited( |
1753 | KERN_WARNING | 1763 | KERN_WARNING |
1754 | "md/raid:%s: read error not correctable " | 1764 | "md/raid:%s: read error not correctable " |
@@ -1756,8 +1766,9 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1756 | mdname(conf->mddev), | 1766 | mdname(conf->mddev), |
1757 | (unsigned long long)s, | 1767 | (unsigned long long)s, |
1758 | bdn); | 1768 | bdn); |
1759 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) | 1769 | } else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) { |
1760 | /* Oh, no!!! */ | 1770 | /* Oh, no!!! */ |
1771 | set_bad = 1; | ||
1761 | printk_ratelimited( | 1772 | printk_ratelimited( |
1762 | KERN_WARNING | 1773 | KERN_WARNING |
1763 | "md/raid:%s: read error NOT corrected!! " | 1774 | "md/raid:%s: read error NOT corrected!! " |
@@ -1765,7 +1776,7 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1765 | mdname(conf->mddev), | 1776 | mdname(conf->mddev), |
1766 | (unsigned long long)s, | 1777 | (unsigned long long)s, |
1767 | bdn); | 1778 | bdn); |
1768 | else if (atomic_read(&rdev->read_errors) | 1779 | } else if (atomic_read(&rdev->read_errors) |
1769 | > conf->max_nr_stripes) | 1780 | > conf->max_nr_stripes) |
1770 | printk(KERN_WARNING | 1781 | printk(KERN_WARNING |
1771 | "md/raid:%s: Too many read errors, failing device %s.\n", | 1782 | "md/raid:%s: Too many read errors, failing device %s.\n", |
@@ -1777,7 +1788,11 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1777 | else { | 1788 | else { |
1778 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 1789 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
1779 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 1790 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
1780 | md_error(conf->mddev, rdev); | 1791 | if (!(set_bad |
1792 | && test_bit(In_sync, &rdev->flags) | ||
1793 | && rdev_set_badblocks( | ||
1794 | rdev, sh->sector, STRIPE_SECTORS, 0))) | ||
1795 | md_error(conf->mddev, rdev); | ||
1781 | } | 1796 | } |
1782 | } | 1797 | } |
1783 | rdev_dec_pending(rdev, conf->mddev); | 1798 | rdev_dec_pending(rdev, conf->mddev); |
@@ -3582,8 +3597,18 @@ static void handle_stripe(struct stripe_head *sh) | |||
3582 | 3597 | ||
3583 | finish: | 3598 | finish: |
3584 | /* wait for this device to become unblocked */ | 3599 | /* wait for this device to become unblocked */ |
3585 | if (conf->mddev->external && unlikely(s.blocked_rdev)) | 3600 | if (unlikely(s.blocked_rdev)) { |
3586 | md_wait_for_blocked_rdev(s.blocked_rdev, conf->mddev); | 3601 | if (conf->mddev->external) |
3602 | md_wait_for_blocked_rdev(s.blocked_rdev, | ||
3603 | conf->mddev); | ||
3604 | else | ||
3605 | /* Internal metadata will immediately | ||
3606 | * be written by raid5d, so we don't | ||
3607 | * need to wait here. | ||
3608 | */ | ||
3609 | rdev_dec_pending(s.blocked_rdev, | ||
3610 | conf->mddev); | ||
3611 | } | ||
3587 | 3612 | ||
3588 | if (s.handle_bad_blocks) | 3613 | if (s.handle_bad_blocks) |
3589 | for (i = disks; i--; ) { | 3614 | for (i = disks; i--; ) { |
@@ -3881,8 +3906,6 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
3881 | raid_bio->bi_next = (void*)rdev; | 3906 | raid_bio->bi_next = (void*)rdev; |
3882 | align_bi->bi_bdev = rdev->bdev; | 3907 | align_bi->bi_bdev = rdev->bdev; |
3883 | align_bi->bi_flags &= ~(1 << BIO_SEG_VALID); | 3908 | align_bi->bi_flags &= ~(1 << BIO_SEG_VALID); |
3884 | /* No reshape active, so we can trust rdev->data_offset */ | ||
3885 | align_bi->bi_sector += rdev->data_offset; | ||
3886 | 3909 | ||
3887 | if (!bio_fits_rdev(align_bi) || | 3910 | if (!bio_fits_rdev(align_bi) || |
3888 | is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9, | 3911 | is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9, |
@@ -3893,6 +3916,9 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
3893 | return 0; | 3916 | return 0; |
3894 | } | 3917 | } |
3895 | 3918 | ||
3919 | /* No reshape active, so we can trust rdev->data_offset */ | ||
3920 | align_bi->bi_sector += rdev->data_offset; | ||
3921 | |||
3896 | spin_lock_irq(&conf->device_lock); | 3922 | spin_lock_irq(&conf->device_lock); |
3897 | wait_event_lock_irq(conf->wait_for_stripe, | 3923 | wait_event_lock_irq(conf->wait_for_stripe, |
3898 | conf->quiesce == 0, | 3924 | conf->quiesce == 0, |
@@ -3971,7 +3997,6 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
3971 | struct stripe_head *sh; | 3997 | struct stripe_head *sh; |
3972 | const int rw = bio_data_dir(bi); | 3998 | const int rw = bio_data_dir(bi); |
3973 | int remaining; | 3999 | int remaining; |
3974 | int plugged; | ||
3975 | 4000 | ||
3976 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { | 4001 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { |
3977 | md_flush_request(mddev, bi); | 4002 | md_flush_request(mddev, bi); |
@@ -3990,7 +4015,6 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
3990 | bi->bi_next = NULL; | 4015 | bi->bi_next = NULL; |
3991 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ | 4016 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ |
3992 | 4017 | ||
3993 | plugged = mddev_check_plugged(mddev); | ||
3994 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { | 4018 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { |
3995 | DEFINE_WAIT(w); | 4019 | DEFINE_WAIT(w); |
3996 | int previous; | 4020 | int previous; |
@@ -4092,6 +4116,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
4092 | if ((bi->bi_rw & REQ_SYNC) && | 4116 | if ((bi->bi_rw & REQ_SYNC) && |
4093 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | 4117 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) |
4094 | atomic_inc(&conf->preread_active_stripes); | 4118 | atomic_inc(&conf->preread_active_stripes); |
4119 | mddev_check_plugged(mddev); | ||
4095 | release_stripe(sh); | 4120 | release_stripe(sh); |
4096 | } else { | 4121 | } else { |
4097 | /* cannot get stripe for read-ahead, just give-up */ | 4122 | /* cannot get stripe for read-ahead, just give-up */ |
@@ -4099,10 +4124,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
4099 | finish_wait(&conf->wait_for_overlap, &w); | 4124 | finish_wait(&conf->wait_for_overlap, &w); |
4100 | break; | 4125 | break; |
4101 | } | 4126 | } |
4102 | |||
4103 | } | 4127 | } |
4104 | if (!plugged) | ||
4105 | md_wakeup_thread(mddev->thread); | ||
4106 | 4128 | ||
4107 | spin_lock_irq(&conf->device_lock); | 4129 | spin_lock_irq(&conf->device_lock); |
4108 | remaining = raid5_dec_bi_phys_segments(bi); | 4130 | remaining = raid5_dec_bi_phys_segments(bi); |
@@ -4823,6 +4845,7 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
4823 | int raid_disk, memory, max_disks; | 4845 | int raid_disk, memory, max_disks; |
4824 | struct md_rdev *rdev; | 4846 | struct md_rdev *rdev; |
4825 | struct disk_info *disk; | 4847 | struct disk_info *disk; |
4848 | char pers_name[6]; | ||
4826 | 4849 | ||
4827 | if (mddev->new_level != 5 | 4850 | if (mddev->new_level != 5 |
4828 | && mddev->new_level != 4 | 4851 | && mddev->new_level != 4 |
@@ -4946,7 +4969,8 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
4946 | printk(KERN_INFO "md/raid:%s: allocated %dkB\n", | 4969 | printk(KERN_INFO "md/raid:%s: allocated %dkB\n", |
4947 | mdname(mddev), memory); | 4970 | mdname(mddev), memory); |
4948 | 4971 | ||
4949 | conf->thread = md_register_thread(raid5d, mddev, NULL); | 4972 | sprintf(pers_name, "raid%d", mddev->new_level); |
4973 | conf->thread = md_register_thread(raid5d, mddev, pers_name); | ||
4950 | if (!conf->thread) { | 4974 | if (!conf->thread) { |
4951 | printk(KERN_ERR | 4975 | printk(KERN_ERR |
4952 | "md/raid:%s: couldn't allocate thread.\n", | 4976 | "md/raid:%s: couldn't allocate thread.\n", |
@@ -5465,10 +5489,9 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
5465 | if (rdev->saved_raid_disk >= 0 && | 5489 | if (rdev->saved_raid_disk >= 0 && |
5466 | rdev->saved_raid_disk >= first && | 5490 | rdev->saved_raid_disk >= first && |
5467 | conf->disks[rdev->saved_raid_disk].rdev == NULL) | 5491 | conf->disks[rdev->saved_raid_disk].rdev == NULL) |
5468 | disk = rdev->saved_raid_disk; | 5492 | first = rdev->saved_raid_disk; |
5469 | else | 5493 | |
5470 | disk = first; | 5494 | for (disk = first; disk <= last; disk++) { |
5471 | for ( ; disk <= last ; disk++) { | ||
5472 | p = conf->disks + disk; | 5495 | p = conf->disks + disk; |
5473 | if (p->rdev == NULL) { | 5496 | if (p->rdev == NULL) { |
5474 | clear_bit(In_sync, &rdev->flags); | 5497 | clear_bit(In_sync, &rdev->flags); |
@@ -5477,8 +5500,11 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
5477 | if (rdev->saved_raid_disk != disk) | 5500 | if (rdev->saved_raid_disk != disk) |
5478 | conf->fullsync = 1; | 5501 | conf->fullsync = 1; |
5479 | rcu_assign_pointer(p->rdev, rdev); | 5502 | rcu_assign_pointer(p->rdev, rdev); |
5480 | break; | 5503 | goto out; |
5481 | } | 5504 | } |
5505 | } | ||
5506 | for (disk = first; disk <= last; disk++) { | ||
5507 | p = conf->disks + disk; | ||
5482 | if (test_bit(WantReplacement, &p->rdev->flags) && | 5508 | if (test_bit(WantReplacement, &p->rdev->flags) && |
5483 | p->replacement == NULL) { | 5509 | p->replacement == NULL) { |
5484 | clear_bit(In_sync, &rdev->flags); | 5510 | clear_bit(In_sync, &rdev->flags); |
@@ -5490,6 +5516,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
5490 | break; | 5516 | break; |
5491 | } | 5517 | } |
5492 | } | 5518 | } |
5519 | out: | ||
5493 | print_raid5_conf(conf); | 5520 | print_raid5_conf(conf); |
5494 | return err; | 5521 | return err; |
5495 | } | 5522 | } |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 00a67326c193..39eab73b01ae 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
@@ -243,6 +243,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
243 | if (minor == MAX_DVB_MINORS) { | 243 | if (minor == MAX_DVB_MINORS) { |
244 | kfree(dvbdevfops); | 244 | kfree(dvbdevfops); |
245 | kfree(dvbdev); | 245 | kfree(dvbdev); |
246 | up_write(&minor_rwsem); | ||
246 | mutex_unlock(&dvbdev_register_lock); | 247 | mutex_unlock(&dvbdev_register_lock); |
247 | return -EINVAL; | 248 | return -EINVAL; |
248 | } | 249 | } |
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 342c2c8c1ddf..54ee34872d14 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
@@ -232,7 +232,7 @@ MODULE_PARM_DESC(invert, "Invert the signal from the IR receiver"); | |||
232 | 232 | ||
233 | static bool txandrx; /* default = 0 */ | 233 | static bool txandrx; /* default = 0 */ |
234 | module_param(txandrx, bool, 0444); | 234 | module_param(txandrx, bool, 0444); |
235 | MODULE_PARM_DESC(invert, "Allow simultaneous TX and RX"); | 235 | MODULE_PARM_DESC(txandrx, "Allow simultaneous TX and RX"); |
236 | 236 | ||
237 | static unsigned int wake_sc = 0x800F040C; | 237 | static unsigned int wake_sc = 0x800F040C; |
238 | module_param(wake_sc, uint, 0644); | 238 | module_param(wake_sc, uint, 0644); |
@@ -1032,6 +1032,8 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
1032 | data->dev->tx_ir = wbcir_tx; | 1032 | data->dev->tx_ir = wbcir_tx; |
1033 | data->dev->priv = data; | 1033 | data->dev->priv = data; |
1034 | data->dev->dev.parent = &device->dev; | 1034 | data->dev->dev.parent = &device->dev; |
1035 | data->dev->timeout = MS_TO_NS(100); | ||
1036 | data->dev->allowed_protos = RC_TYPE_ALL; | ||
1035 | 1037 | ||
1036 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { | 1038 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { |
1037 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | 1039 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", |
diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c index 068f78dc5d13..b4c99c7270cf 100644 --- a/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/drivers/media/video/cx231xx/cx231xx-audio.c | |||
@@ -307,7 +307,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
307 | urb->context = dev; | 307 | urb->context = dev; |
308 | urb->pipe = usb_rcvisocpipe(dev->udev, | 308 | urb->pipe = usb_rcvisocpipe(dev->udev, |
309 | dev->adev.end_point_addr); | 309 | dev->adev.end_point_addr); |
310 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; | 310 | urb->transfer_flags = URB_ISO_ASAP; |
311 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 311 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
312 | urb->interval = 1; | 312 | urb->interval = 1; |
313 | urb->complete = cx231xx_audio_isocirq; | 313 | urb->complete = cx231xx_audio_isocirq; |
@@ -368,7 +368,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev) | |||
368 | urb->context = dev; | 368 | urb->context = dev; |
369 | urb->pipe = usb_rcvbulkpipe(dev->udev, | 369 | urb->pipe = usb_rcvbulkpipe(dev->udev, |
370 | dev->adev.end_point_addr); | 370 | dev->adev.end_point_addr); |
371 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 371 | urb->transfer_flags = 0; |
372 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 372 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
373 | urb->complete = cx231xx_audio_bulkirq; | 373 | urb->complete = cx231xx_audio_bulkirq; |
374 | urb->transfer_buffer_length = sb_size; | 374 | urb->transfer_buffer_length = sb_size; |
diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.c b/drivers/media/video/cx231xx/cx231xx-vbi.c index 3d15314e1f88..ac7db52f404f 100644 --- a/drivers/media/video/cx231xx/cx231xx-vbi.c +++ b/drivers/media/video/cx231xx/cx231xx-vbi.c | |||
@@ -448,7 +448,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
448 | return -ENOMEM; | 448 | return -ENOMEM; |
449 | } | 449 | } |
450 | dev->vbi_mode.bulk_ctl.urb[i] = urb; | 450 | dev->vbi_mode.bulk_ctl.urb[i] = urb; |
451 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 451 | urb->transfer_flags = 0; |
452 | 452 | ||
453 | dev->vbi_mode.bulk_ctl.transfer_buffer[i] = | 453 | dev->vbi_mode.bulk_ctl.transfer_buffer[i] = |
454 | kzalloc(sb_size, GFP_KERNEL); | 454 | kzalloc(sb_size, GFP_KERNEL); |
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index 13739e002a63..080e11157e5f 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
@@ -127,22 +127,37 @@ struct cx23885_board cx23885_boards[] = { | |||
127 | }, | 127 | }, |
128 | [CX23885_BOARD_HAUPPAUGE_HVR1250] = { | 128 | [CX23885_BOARD_HAUPPAUGE_HVR1250] = { |
129 | .name = "Hauppauge WinTV-HVR1250", | 129 | .name = "Hauppauge WinTV-HVR1250", |
130 | .porta = CX23885_ANALOG_VIDEO, | ||
130 | .portc = CX23885_MPEG_DVB, | 131 | .portc = CX23885_MPEG_DVB, |
132 | #ifdef MT2131_NO_ANALOG_SUPPORT_YET | ||
133 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
134 | .tuner_addr = 0x42, /* 0x84 >> 1 */ | ||
135 | .tuner_bus = 1, | ||
136 | #endif | ||
137 | .force_bff = 1, | ||
131 | .input = {{ | 138 | .input = {{ |
139 | #ifdef MT2131_NO_ANALOG_SUPPORT_YET | ||
132 | .type = CX23885_VMUX_TELEVISION, | 140 | .type = CX23885_VMUX_TELEVISION, |
133 | .vmux = 0, | 141 | .vmux = CX25840_VIN7_CH3 | |
142 | CX25840_VIN5_CH2 | | ||
143 | CX25840_VIN2_CH1, | ||
144 | .amux = CX25840_AUDIO8, | ||
134 | .gpio0 = 0xff00, | 145 | .gpio0 = 0xff00, |
135 | }, { | 146 | }, { |
136 | .type = CX23885_VMUX_DEBUG, | 147 | #endif |
137 | .vmux = 0, | ||
138 | .gpio0 = 0xff01, | ||
139 | }, { | ||
140 | .type = CX23885_VMUX_COMPOSITE1, | 148 | .type = CX23885_VMUX_COMPOSITE1, |
141 | .vmux = 1, | 149 | .vmux = CX25840_VIN7_CH3 | |
150 | CX25840_VIN4_CH2 | | ||
151 | CX25840_VIN6_CH1, | ||
152 | .amux = CX25840_AUDIO7, | ||
142 | .gpio0 = 0xff02, | 153 | .gpio0 = 0xff02, |
143 | }, { | 154 | }, { |
144 | .type = CX23885_VMUX_SVIDEO, | 155 | .type = CX23885_VMUX_SVIDEO, |
145 | .vmux = 2, | 156 | .vmux = CX25840_VIN7_CH3 | |
157 | CX25840_VIN4_CH2 | | ||
158 | CX25840_VIN8_CH1 | | ||
159 | CX25840_SVIDEO_ON, | ||
160 | .amux = CX25840_AUDIO7, | ||
146 | .gpio0 = 0xff02, | 161 | .gpio0 = 0xff02, |
147 | } }, | 162 | } }, |
148 | }, | 163 | }, |
@@ -267,7 +282,55 @@ struct cx23885_board cx23885_boards[] = { | |||
267 | }, | 282 | }, |
268 | [CX23885_BOARD_HAUPPAUGE_HVR1255] = { | 283 | [CX23885_BOARD_HAUPPAUGE_HVR1255] = { |
269 | .name = "Hauppauge WinTV-HVR1255", | 284 | .name = "Hauppauge WinTV-HVR1255", |
285 | .porta = CX23885_ANALOG_VIDEO, | ||
286 | .portc = CX23885_MPEG_DVB, | ||
287 | .tuner_type = TUNER_ABSENT, | ||
288 | .tuner_addr = 0x42, /* 0x84 >> 1 */ | ||
289 | .force_bff = 1, | ||
290 | .input = {{ | ||
291 | .type = CX23885_VMUX_TELEVISION, | ||
292 | .vmux = CX25840_VIN7_CH3 | | ||
293 | CX25840_VIN5_CH2 | | ||
294 | CX25840_VIN2_CH1 | | ||
295 | CX25840_DIF_ON, | ||
296 | .amux = CX25840_AUDIO8, | ||
297 | }, { | ||
298 | .type = CX23885_VMUX_COMPOSITE1, | ||
299 | .vmux = CX25840_VIN7_CH3 | | ||
300 | CX25840_VIN4_CH2 | | ||
301 | CX25840_VIN6_CH1, | ||
302 | .amux = CX25840_AUDIO7, | ||
303 | }, { | ||
304 | .type = CX23885_VMUX_SVIDEO, | ||
305 | .vmux = CX25840_VIN7_CH3 | | ||
306 | CX25840_VIN4_CH2 | | ||
307 | CX25840_VIN8_CH1 | | ||
308 | CX25840_SVIDEO_ON, | ||
309 | .amux = CX25840_AUDIO7, | ||
310 | } }, | ||
311 | }, | ||
312 | [CX23885_BOARD_HAUPPAUGE_HVR1255_22111] = { | ||
313 | .name = "Hauppauge WinTV-HVR1255", | ||
314 | .porta = CX23885_ANALOG_VIDEO, | ||
270 | .portc = CX23885_MPEG_DVB, | 315 | .portc = CX23885_MPEG_DVB, |
316 | .tuner_type = TUNER_ABSENT, | ||
317 | .tuner_addr = 0x42, /* 0x84 >> 1 */ | ||
318 | .force_bff = 1, | ||
319 | .input = {{ | ||
320 | .type = CX23885_VMUX_TELEVISION, | ||
321 | .vmux = CX25840_VIN7_CH3 | | ||
322 | CX25840_VIN5_CH2 | | ||
323 | CX25840_VIN2_CH1 | | ||
324 | CX25840_DIF_ON, | ||
325 | .amux = CX25840_AUDIO8, | ||
326 | }, { | ||
327 | .type = CX23885_VMUX_SVIDEO, | ||
328 | .vmux = CX25840_VIN7_CH3 | | ||
329 | CX25840_VIN4_CH2 | | ||
330 | CX25840_VIN8_CH1 | | ||
331 | CX25840_SVIDEO_ON, | ||
332 | .amux = CX25840_AUDIO7, | ||
333 | } }, | ||
271 | }, | 334 | }, |
272 | [CX23885_BOARD_HAUPPAUGE_HVR1210] = { | 335 | [CX23885_BOARD_HAUPPAUGE_HVR1210] = { |
273 | .name = "Hauppauge WinTV-HVR1210", | 336 | .name = "Hauppauge WinTV-HVR1210", |
@@ -624,7 +687,7 @@ struct cx23885_subid cx23885_subids[] = { | |||
624 | }, { | 687 | }, { |
625 | .subvendor = 0x0070, | 688 | .subvendor = 0x0070, |
626 | .subdevice = 0x2259, | 689 | .subdevice = 0x2259, |
627 | .card = CX23885_BOARD_HAUPPAUGE_HVR1255, | 690 | .card = CX23885_BOARD_HAUPPAUGE_HVR1255_22111, |
628 | }, { | 691 | }, { |
629 | .subvendor = 0x0070, | 692 | .subvendor = 0x0070, |
630 | .subdevice = 0x2291, | 693 | .subdevice = 0x2291, |
@@ -900,7 +963,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg) | |||
900 | struct cx23885_dev *dev = port->dev; | 963 | struct cx23885_dev *dev = port->dev; |
901 | u32 bitmask = 0; | 964 | u32 bitmask = 0; |
902 | 965 | ||
903 | if (command == XC2028_RESET_CLK) | 966 | if ((command == XC2028_RESET_CLK) || (command == XC2028_I2C_FLUSH)) |
904 | return 0; | 967 | return 0; |
905 | 968 | ||
906 | if (command != 0) { | 969 | if (command != 0) { |
@@ -1130,6 +1193,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) | |||
1130 | case CX23885_BOARD_HAUPPAUGE_HVR1270: | 1193 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
1131 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | 1194 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
1132 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 1195 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
1196 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
1133 | case CX23885_BOARD_HAUPPAUGE_HVR1210: | 1197 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
1134 | /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */ | 1198 | /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */ |
1135 | /* GPIO-6 I2C Gate which can isolate the demod from the bus */ | 1199 | /* GPIO-6 I2C Gate which can isolate the demod from the bus */ |
@@ -1267,6 +1331,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) | |||
1267 | case CX23885_BOARD_HAUPPAUGE_HVR1400: | 1331 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
1268 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | 1332 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
1269 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 1333 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
1334 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
1270 | case CX23885_BOARD_HAUPPAUGE_HVR1210: | 1335 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
1271 | /* FIXME: Implement me */ | 1336 | /* FIXME: Implement me */ |
1272 | break; | 1337 | break; |
@@ -1424,6 +1489,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
1424 | case CX23885_BOARD_HAUPPAUGE_HVR1270: | 1489 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
1425 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | 1490 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
1426 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 1491 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
1492 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
1427 | case CX23885_BOARD_HAUPPAUGE_HVR1210: | 1493 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
1428 | case CX23885_BOARD_HAUPPAUGE_HVR1850: | 1494 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
1429 | case CX23885_BOARD_HAUPPAUGE_HVR1290: | 1495 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
@@ -1511,6 +1577,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
1511 | case CX23885_BOARD_HAUPPAUGE_HVR1270: | 1577 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
1512 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | 1578 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
1513 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 1579 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
1580 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
1514 | case CX23885_BOARD_HAUPPAUGE_HVR1210: | 1581 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
1515 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: | 1582 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
1516 | case CX23885_BOARD_HAUPPAUGE_HVR1290: | 1583 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
@@ -1526,10 +1593,10 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
1526 | */ | 1593 | */ |
1527 | switch (dev->board) { | 1594 | switch (dev->board) { |
1528 | case CX23885_BOARD_TEVII_S470: | 1595 | case CX23885_BOARD_TEVII_S470: |
1529 | case CX23885_BOARD_HAUPPAUGE_HVR1250: | ||
1530 | /* Currently only enabled for the integrated IR controller */ | 1596 | /* Currently only enabled for the integrated IR controller */ |
1531 | if (!enable_885_ir) | 1597 | if (!enable_885_ir) |
1532 | break; | 1598 | break; |
1599 | case CX23885_BOARD_HAUPPAUGE_HVR1250: | ||
1533 | case CX23885_BOARD_HAUPPAUGE_HVR1800: | 1600 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
1534 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: | 1601 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
1535 | case CX23885_BOARD_HAUPPAUGE_HVR1700: | 1602 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
@@ -1539,6 +1606,8 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
1539 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: | 1606 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
1540 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: | 1607 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
1541 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: | 1608 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
1609 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | ||
1610 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
1542 | case CX23885_BOARD_HAUPPAUGE_HVR1270: | 1611 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
1543 | case CX23885_BOARD_HAUPPAUGE_HVR1850: | 1612 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
1544 | case CX23885_BOARD_MYGICA_X8506: | 1613 | case CX23885_BOARD_MYGICA_X8506: |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index a80a92c47455..cd542684ba02 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -712,6 +712,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
712 | } | 712 | } |
713 | break; | 713 | break; |
714 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 714 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
715 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
715 | i2c_bus = &dev->i2c_bus[0]; | 716 | i2c_bus = &dev->i2c_bus[0]; |
716 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, | 717 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
717 | &hcw_s5h1411_config, | 718 | &hcw_s5h1411_config, |
@@ -721,6 +722,11 @@ static int dvb_register(struct cx23885_tsport *port) | |||
721 | 0x60, &dev->i2c_bus[1].i2c_adap, | 722 | 0x60, &dev->i2c_bus[1].i2c_adap, |
722 | &hauppauge_tda18271_config); | 723 | &hauppauge_tda18271_config); |
723 | } | 724 | } |
725 | |||
726 | tda18271_attach(&dev->ts1.analog_fe, | ||
727 | 0x60, &dev->i2c_bus[1].i2c_adap, | ||
728 | &hauppauge_tda18271_config); | ||
729 | |||
724 | break; | 730 | break; |
725 | case CX23885_BOARD_HAUPPAUGE_HVR1800: | 731 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
726 | i2c_bus = &dev->i2c_bus[0]; | 732 | i2c_bus = &dev->i2c_bus[0]; |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index c654bdc7ccb2..22f8e7fbd665 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -505,6 +505,9 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) | |||
505 | 505 | ||
506 | if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) || | 506 | if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) || |
507 | (dev->board == CX23885_BOARD_MPX885) || | 507 | (dev->board == CX23885_BOARD_MPX885) || |
508 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1250) || | ||
509 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) || | ||
510 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111) || | ||
508 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850)) { | 511 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850)) { |
509 | /* Configure audio routing */ | 512 | /* Configure audio routing */ |
510 | v4l2_subdev_call(dev->sd_cx25840, audio, s_routing, | 513 | v4l2_subdev_call(dev->sd_cx25840, audio, s_routing, |
@@ -1578,7 +1581,9 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev, | |||
1578 | 1581 | ||
1579 | fe = vfe->dvb.frontend; | 1582 | fe = vfe->dvb.frontend; |
1580 | 1583 | ||
1581 | if (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) | 1584 | if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) || |
1585 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) || | ||
1586 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111)) | ||
1582 | fe = &dev->ts1.analog_fe; | 1587 | fe = &dev->ts1.analog_fe; |
1583 | 1588 | ||
1584 | if (fe && fe->ops.tuner_ops.set_analog_params) { | 1589 | if (fe && fe->ops.tuner_ops.set_analog_params) { |
@@ -1608,6 +1613,8 @@ int cx23885_set_frequency(struct file *file, void *priv, | |||
1608 | int ret; | 1613 | int ret; |
1609 | 1614 | ||
1610 | switch (dev->board) { | 1615 | switch (dev->board) { |
1616 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | ||
1617 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
1611 | case CX23885_BOARD_HAUPPAUGE_HVR1850: | 1618 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
1612 | ret = cx23885_set_freq_via_ops(dev, f); | 1619 | ret = cx23885_set_freq_via_ops(dev, f); |
1613 | break; | 1620 | break; |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index d884784a1c85..13c37ec07ae7 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -90,6 +90,7 @@ | |||
90 | #define CX23885_BOARD_MYGICA_X8507 33 | 90 | #define CX23885_BOARD_MYGICA_X8507 33 |
91 | #define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL 34 | 91 | #define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL 34 |
92 | #define CX23885_BOARD_TEVII_S471 35 | 92 | #define CX23885_BOARD_TEVII_S471 35 |
93 | #define CX23885_BOARD_HAUPPAUGE_HVR1255_22111 36 | ||
93 | 94 | ||
94 | #define GPIO_0 0x00000001 | 95 | #define GPIO_0 0x00000001 |
95 | #define GPIO_1 0x00000002 | 96 | #define GPIO_1 0x00000002 |
diff --git a/drivers/media/video/cx25821/cx25821-core.c b/drivers/media/video/cx25821/cx25821-core.c index 83c1aa6b2e6c..f11f6f07e915 100644 --- a/drivers/media/video/cx25821/cx25821-core.c +++ b/drivers/media/video/cx25821/cx25821-core.c | |||
@@ -904,9 +904,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) | |||
904 | list_add_tail(&dev->devlist, &cx25821_devlist); | 904 | list_add_tail(&dev->devlist, &cx25821_devlist); |
905 | mutex_unlock(&cx25821_devlist_mutex); | 905 | mutex_unlock(&cx25821_devlist_mutex); |
906 | 906 | ||
907 | strcpy(cx25821_boards[UNKNOWN_BOARD].name, "unknown"); | ||
908 | strcpy(cx25821_boards[CX25821_BOARD].name, "cx25821"); | ||
909 | |||
910 | if (dev->pci->device != 0x8210) { | 907 | if (dev->pci->device != 0x8210) { |
911 | pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n", | 908 | pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n", |
912 | __func__, dev->pci->device); | 909 | __func__, dev->pci->device); |
diff --git a/drivers/media/video/cx25821/cx25821.h b/drivers/media/video/cx25821/cx25821.h index b9aa801b00a7..029f2934a6d8 100644 --- a/drivers/media/video/cx25821/cx25821.h +++ b/drivers/media/video/cx25821/cx25821.h | |||
@@ -187,7 +187,7 @@ enum port { | |||
187 | }; | 187 | }; |
188 | 188 | ||
189 | struct cx25821_board { | 189 | struct cx25821_board { |
190 | char *name; | 190 | const char *name; |
191 | enum port porta; | 191 | enum port porta; |
192 | enum port portb; | 192 | enum port portb; |
193 | enum port portc; | 193 | enum port portc; |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index fc1ff69cffd0..d8eac3e30a7e 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -84,7 +84,7 @@ MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]"); | |||
84 | 84 | ||
85 | 85 | ||
86 | /* ----------------------------------------------------------------------- */ | 86 | /* ----------------------------------------------------------------------- */ |
87 | static void cx23885_std_setup(struct i2c_client *client); | 87 | static void cx23888_std_setup(struct i2c_client *client); |
88 | 88 | ||
89 | int cx25840_write(struct i2c_client *client, u16 addr, u8 value) | 89 | int cx25840_write(struct i2c_client *client, u16 addr, u8 value) |
90 | { | 90 | { |
@@ -638,10 +638,13 @@ static void cx23885_initialize(struct i2c_client *client) | |||
638 | finish_wait(&state->fw_wait, &wait); | 638 | finish_wait(&state->fw_wait, &wait); |
639 | destroy_workqueue(q); | 639 | destroy_workqueue(q); |
640 | 640 | ||
641 | /* Call the cx23885 specific std setup func, we no longer rely on | 641 | /* Call the cx23888 specific std setup func, we no longer rely on |
642 | * the generic cx24840 func. | 642 | * the generic cx24840 func. |
643 | */ | 643 | */ |
644 | cx23885_std_setup(client); | 644 | if (is_cx23888(state)) |
645 | cx23888_std_setup(client); | ||
646 | else | ||
647 | cx25840_std_setup(client); | ||
645 | 648 | ||
646 | /* (re)set input */ | 649 | /* (re)set input */ |
647 | set_input(client, state->vid_input, state->aud_input); | 650 | set_input(client, state->vid_input, state->aud_input); |
@@ -1103,9 +1106,23 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
1103 | 1106 | ||
1104 | cx25840_write4(client, 0x410, 0xffff0dbf); | 1107 | cx25840_write4(client, 0x410, 0xffff0dbf); |
1105 | cx25840_write4(client, 0x414, 0x00137d03); | 1108 | cx25840_write4(client, 0x414, 0x00137d03); |
1106 | cx25840_write4(client, 0x418, 0x01008080); | 1109 | |
1110 | /* on the 887, 0x418 is HSCALE_CTRL, on the 888 it is | ||
1111 | CHROMA_CTRL */ | ||
1112 | if (is_cx23888(state)) | ||
1113 | cx25840_write4(client, 0x418, 0x01008080); | ||
1114 | else | ||
1115 | cx25840_write4(client, 0x418, 0x01000000); | ||
1116 | |||
1107 | cx25840_write4(client, 0x41c, 0x00000000); | 1117 | cx25840_write4(client, 0x41c, 0x00000000); |
1108 | cx25840_write4(client, 0x420, 0x001c3e0f); | 1118 | |
1119 | /* on the 887, 0x420 is CHROMA_CTRL, on the 888 it is | ||
1120 | CRUSH_CTRL */ | ||
1121 | if (is_cx23888(state)) | ||
1122 | cx25840_write4(client, 0x420, 0x001c3e0f); | ||
1123 | else | ||
1124 | cx25840_write4(client, 0x420, 0x001c8282); | ||
1125 | |||
1109 | cx25840_write4(client, 0x42c, 0x42600000); | 1126 | cx25840_write4(client, 0x42c, 0x42600000); |
1110 | cx25840_write4(client, 0x430, 0x0000039b); | 1127 | cx25840_write4(client, 0x430, 0x0000039b); |
1111 | cx25840_write4(client, 0x438, 0x00000000); | 1128 | cx25840_write4(client, 0x438, 0x00000000); |
@@ -1233,7 +1250,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
1233 | cx25840_write4(client, 0x8d0, 0x1f063870); | 1250 | cx25840_write4(client, 0x8d0, 0x1f063870); |
1234 | } | 1251 | } |
1235 | 1252 | ||
1236 | if (is_cx2388x(state)) { | 1253 | if (is_cx23888(state)) { |
1237 | /* HVR1850 */ | 1254 | /* HVR1850 */ |
1238 | /* AUD_IO_CTRL - I2S Input, Parallel1*/ | 1255 | /* AUD_IO_CTRL - I2S Input, Parallel1*/ |
1239 | /* - Channel 1 src - Parallel1 (Merlin out) */ | 1256 | /* - Channel 1 src - Parallel1 (Merlin out) */ |
@@ -1298,8 +1315,8 @@ static int set_v4lstd(struct i2c_client *client) | |||
1298 | } | 1315 | } |
1299 | cx25840_and_or(client, 0x400, ~0xf, fmt); | 1316 | cx25840_and_or(client, 0x400, ~0xf, fmt); |
1300 | cx25840_and_or(client, 0x403, ~0x3, pal_m); | 1317 | cx25840_and_or(client, 0x403, ~0x3, pal_m); |
1301 | if (is_cx2388x(state)) | 1318 | if (is_cx23888(state)) |
1302 | cx23885_std_setup(client); | 1319 | cx23888_std_setup(client); |
1303 | else | 1320 | else |
1304 | cx25840_std_setup(client); | 1321 | cx25840_std_setup(client); |
1305 | if (!is_cx2583x(state)) | 1322 | if (!is_cx2583x(state)) |
@@ -1312,6 +1329,7 @@ static int set_v4lstd(struct i2c_client *client) | |||
1312 | static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) | 1329 | static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) |
1313 | { | 1330 | { |
1314 | struct v4l2_subdev *sd = to_sd(ctrl); | 1331 | struct v4l2_subdev *sd = to_sd(ctrl); |
1332 | struct cx25840_state *state = to_state(sd); | ||
1315 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1333 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
1316 | 1334 | ||
1317 | switch (ctrl->id) { | 1335 | switch (ctrl->id) { |
@@ -1324,12 +1342,20 @@ static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) | |||
1324 | break; | 1342 | break; |
1325 | 1343 | ||
1326 | case V4L2_CID_SATURATION: | 1344 | case V4L2_CID_SATURATION: |
1327 | cx25840_write(client, 0x420, ctrl->val << 1); | 1345 | if (is_cx23888(state)) { |
1328 | cx25840_write(client, 0x421, ctrl->val << 1); | 1346 | cx25840_write(client, 0x418, ctrl->val << 1); |
1347 | cx25840_write(client, 0x419, ctrl->val << 1); | ||
1348 | } else { | ||
1349 | cx25840_write(client, 0x420, ctrl->val << 1); | ||
1350 | cx25840_write(client, 0x421, ctrl->val << 1); | ||
1351 | } | ||
1329 | break; | 1352 | break; |
1330 | 1353 | ||
1331 | case V4L2_CID_HUE: | 1354 | case V4L2_CID_HUE: |
1332 | cx25840_write(client, 0x422, ctrl->val); | 1355 | if (is_cx23888(state)) |
1356 | cx25840_write(client, 0x41a, ctrl->val); | ||
1357 | else | ||
1358 | cx25840_write(client, 0x422, ctrl->val); | ||
1333 | break; | 1359 | break; |
1334 | 1360 | ||
1335 | default: | 1361 | default: |
@@ -1354,11 +1380,21 @@ static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt | |||
1354 | fmt->field = V4L2_FIELD_INTERLACED; | 1380 | fmt->field = V4L2_FIELD_INTERLACED; |
1355 | fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; | 1381 | fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; |
1356 | 1382 | ||
1357 | Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; | 1383 | if (is_cx23888(state)) { |
1358 | Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; | 1384 | Vsrc = (cx25840_read(client, 0x42a) & 0x3f) << 4; |
1385 | Vsrc |= (cx25840_read(client, 0x429) & 0xf0) >> 4; | ||
1386 | } else { | ||
1387 | Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; | ||
1388 | Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; | ||
1389 | } | ||
1359 | 1390 | ||
1360 | Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; | 1391 | if (is_cx23888(state)) { |
1361 | Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; | 1392 | Hsrc = (cx25840_read(client, 0x426) & 0x3f) << 4; |
1393 | Hsrc |= (cx25840_read(client, 0x425) & 0xf0) >> 4; | ||
1394 | } else { | ||
1395 | Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; | ||
1396 | Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; | ||
1397 | } | ||
1362 | 1398 | ||
1363 | Vlines = fmt->height + (is_50Hz ? 4 : 7); | 1399 | Vlines = fmt->height + (is_50Hz ? 4 : 7); |
1364 | 1400 | ||
@@ -1782,8 +1818,8 @@ static int cx25840_s_video_routing(struct v4l2_subdev *sd, | |||
1782 | struct cx25840_state *state = to_state(sd); | 1818 | struct cx25840_state *state = to_state(sd); |
1783 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1819 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
1784 | 1820 | ||
1785 | if (is_cx2388x(state)) | 1821 | if (is_cx23888(state)) |
1786 | cx23885_std_setup(client); | 1822 | cx23888_std_setup(client); |
1787 | 1823 | ||
1788 | return set_input(client, input, state->aud_input); | 1824 | return set_input(client, input, state->aud_input); |
1789 | } | 1825 | } |
@@ -1794,8 +1830,8 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd, | |||
1794 | struct cx25840_state *state = to_state(sd); | 1830 | struct cx25840_state *state = to_state(sd); |
1795 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1831 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
1796 | 1832 | ||
1797 | if (is_cx2388x(state)) | 1833 | if (is_cx23888(state)) |
1798 | cx23885_std_setup(client); | 1834 | cx23888_std_setup(client); |
1799 | return set_input(client, state->vid_input, input); | 1835 | return set_input(client, state->vid_input, input); |
1800 | } | 1836 | } |
1801 | 1837 | ||
@@ -4939,7 +4975,7 @@ void cx23885_dif_setup(struct i2c_client *client, u32 ifHz) | |||
4939 | } | 4975 | } |
4940 | } | 4976 | } |
4941 | 4977 | ||
4942 | static void cx23885_std_setup(struct i2c_client *client) | 4978 | static void cx23888_std_setup(struct i2c_client *client) |
4943 | { | 4979 | { |
4944 | struct cx25840_state *state = to_state(i2c_get_clientdata(client)); | 4980 | struct cx25840_state *state = to_state(i2c_get_clientdata(client)); |
4945 | v4l2_std_id std = state->std; | 4981 | v4l2_std_id std = state->std; |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 92da7c28b6f0..862c6575c557 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -2893,7 +2893,7 @@ static void request_module_async(struct work_struct *work) | |||
2893 | 2893 | ||
2894 | if (dev->board.has_dvb) | 2894 | if (dev->board.has_dvb) |
2895 | request_module("em28xx-dvb"); | 2895 | request_module("em28xx-dvb"); |
2896 | if (dev->board.has_ir_i2c && !disable_ir) | 2896 | if (dev->board.ir_codes && !disable_ir) |
2897 | request_module("em28xx-rc"); | 2897 | request_module("em28xx-rc"); |
2898 | } | 2898 | } |
2899 | 2899 | ||
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 6c31e46a1fd2..b9c6f17eabb2 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -2070,10 +2070,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2070 | set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); | 2070 | set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); |
2071 | set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), | 2071 | set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), |
2072 | v4l2_ctrl_g_ctrl(sd->red)); | 2072 | v4l2_ctrl_g_ctrl(sd->red)); |
2073 | set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); | 2073 | if (sd->gain) |
2074 | set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); | 2074 | set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); |
2075 | set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), | 2075 | if (sd->exposure) |
2076 | v4l2_ctrl_g_ctrl(sd->vflip)); | 2076 | set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); |
2077 | if (sd->hflip) | ||
2078 | set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), | ||
2079 | v4l2_ctrl_g_ctrl(sd->vflip)); | ||
2077 | 2080 | ||
2078 | reg_w1(gspca_dev, 0x1007, 0x20); | 2081 | reg_w1(gspca_dev, 0x1007, 0x20); |
2079 | reg_w1(gspca_dev, 0x1061, 0x03); | 2082 | reg_w1(gspca_dev, 0x1061, 0x03); |
@@ -2176,7 +2179,7 @@ static void sd_dqcallback(struct gspca_dev *gspca_dev) | |||
2176 | struct sd *sd = (struct sd *) gspca_dev; | 2179 | struct sd *sd = (struct sd *) gspca_dev; |
2177 | int avg_lum; | 2180 | int avg_lum; |
2178 | 2181 | ||
2179 | if (!v4l2_ctrl_g_ctrl(sd->autogain)) | 2182 | if (sd->autogain == NULL || !v4l2_ctrl_g_ctrl(sd->autogain)) |
2180 | return; | 2183 | return; |
2181 | 2184 | ||
2182 | avg_lum = atomic_read(&sd->avg_lum); | 2185 | avg_lum = atomic_read(&sd->avg_lum); |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 41f9a254b245..637bde8aca28 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #define CSICR1_INV_DATA (1 << 3) | 83 | #define CSICR1_INV_DATA (1 << 3) |
84 | #define CSICR1_INV_PCLK (1 << 2) | 84 | #define CSICR1_INV_PCLK (1 << 2) |
85 | #define CSICR1_REDGE (1 << 1) | 85 | #define CSICR1_REDGE (1 << 1) |
86 | #define CSICR1_FMT_MASK (CSICR1_PACK_DIR | CSICR1_SWAP16_EN) | ||
86 | 87 | ||
87 | #define SHIFT_STATFF_LEVEL 22 | 88 | #define SHIFT_STATFF_LEVEL 22 |
88 | #define SHIFT_RXFF_LEVEL 19 | 89 | #define SHIFT_RXFF_LEVEL 19 |
@@ -230,6 +231,7 @@ struct mx2_prp_cfg { | |||
230 | u32 src_pixel; | 231 | u32 src_pixel; |
231 | u32 ch1_pixel; | 232 | u32 ch1_pixel; |
232 | u32 irq_flags; | 233 | u32 irq_flags; |
234 | u32 csicr1; | ||
233 | }; | 235 | }; |
234 | 236 | ||
235 | /* prp resizing parameters */ | 237 | /* prp resizing parameters */ |
@@ -330,6 +332,7 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
330 | .ch1_pixel = 0x2ca00565, /* RGB565 */ | 332 | .ch1_pixel = 0x2ca00565, /* RGB565 */ |
331 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH1WERR | | 333 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH1WERR | |
332 | PRP_INTR_CH1FC | PRP_INTR_LBOVF, | 334 | PRP_INTR_CH1FC | PRP_INTR_LBOVF, |
335 | .csicr1 = 0, | ||
333 | } | 336 | } |
334 | }, | 337 | }, |
335 | { | 338 | { |
@@ -343,6 +346,21 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
343 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | | 346 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | |
344 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | | 347 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | |
345 | PRP_INTR_CH2OVF, | 348 | PRP_INTR_CH2OVF, |
349 | .csicr1 = CSICR1_PACK_DIR, | ||
350 | } | ||
351 | }, | ||
352 | { | ||
353 | .in_fmt = V4L2_MBUS_FMT_UYVY8_2X8, | ||
354 | .out_fmt = V4L2_PIX_FMT_YUV420, | ||
355 | .cfg = { | ||
356 | .channel = 2, | ||
357 | .in_fmt = PRP_CNTL_DATA_IN_YUV422, | ||
358 | .out_fmt = PRP_CNTL_CH2_OUT_YUV420, | ||
359 | .src_pixel = 0x22000888, /* YUV422 (YUYV) */ | ||
360 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | | ||
361 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | | ||
362 | PRP_INTR_CH2OVF, | ||
363 | .csicr1 = CSICR1_SWAP16_EN, | ||
346 | } | 364 | } |
347 | }, | 365 | }, |
348 | }; | 366 | }; |
@@ -1015,14 +1033,14 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
1015 | return ret; | 1033 | return ret; |
1016 | } | 1034 | } |
1017 | 1035 | ||
1036 | csicr1 = (csicr1 & ~CSICR1_FMT_MASK) | pcdev->emma_prp->cfg.csicr1; | ||
1037 | |||
1018 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) | 1038 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) |
1019 | csicr1 |= CSICR1_REDGE; | 1039 | csicr1 |= CSICR1_REDGE; |
1020 | if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) | 1040 | if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) |
1021 | csicr1 |= CSICR1_SOF_POL; | 1041 | csicr1 |= CSICR1_SOF_POL; |
1022 | if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) | 1042 | if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) |
1023 | csicr1 |= CSICR1_HSYNC_POL; | 1043 | csicr1 |= CSICR1_HSYNC_POL; |
1024 | if (pcdev->platform_flags & MX2_CAMERA_SWAP16) | ||
1025 | csicr1 |= CSICR1_SWAP16_EN; | ||
1026 | if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC) | 1044 | if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC) |
1027 | csicr1 |= CSICR1_EXT_VSYNC; | 1045 | csicr1 |= CSICR1_EXT_VSYNC; |
1028 | if (pcdev->platform_flags & MX2_CAMERA_CCIR) | 1046 | if (pcdev->platform_flags & MX2_CAMERA_CCIR) |
@@ -1033,8 +1051,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
1033 | csicr1 |= CSICR1_GCLK_MODE; | 1051 | csicr1 |= CSICR1_GCLK_MODE; |
1034 | if (pcdev->platform_flags & MX2_CAMERA_INV_DATA) | 1052 | if (pcdev->platform_flags & MX2_CAMERA_INV_DATA) |
1035 | csicr1 |= CSICR1_INV_DATA; | 1053 | csicr1 |= CSICR1_INV_DATA; |
1036 | if (pcdev->platform_flags & MX2_CAMERA_PACK_DIR_MSB) | ||
1037 | csicr1 |= CSICR1_PACK_DIR; | ||
1038 | 1054 | ||
1039 | pcdev->csicr1 = csicr1; | 1055 | pcdev->csicr1 = csicr1; |
1040 | 1056 | ||
@@ -1109,7 +1125,8 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd, | |||
1109 | return 0; | 1125 | return 0; |
1110 | } | 1126 | } |
1111 | 1127 | ||
1112 | if (code == V4L2_MBUS_FMT_YUYV8_2X8) { | 1128 | if (code == V4L2_MBUS_FMT_YUYV8_2X8 || |
1129 | code == V4L2_MBUS_FMT_UYVY8_2X8) { | ||
1113 | formats++; | 1130 | formats++; |
1114 | if (xlate) { | 1131 | if (xlate) { |
1115 | /* | 1132 | /* |
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c index 8a4935ecc655..dd91da26f1b0 100644 --- a/drivers/media/video/omap3isp/isppreview.c +++ b/drivers/media/video/omap3isp/isppreview.c | |||
@@ -888,12 +888,12 @@ static const struct preview_update update_attrs[] = { | |||
888 | preview_config_contrast, | 888 | preview_config_contrast, |
889 | NULL, | 889 | NULL, |
890 | offsetof(struct prev_params, contrast), | 890 | offsetof(struct prev_params, contrast), |
891 | 0, true, | 891 | 0, 0, true, |
892 | }, /* OMAP3ISP_PREV_BRIGHTNESS */ { | 892 | }, /* OMAP3ISP_PREV_BRIGHTNESS */ { |
893 | preview_config_brightness, | 893 | preview_config_brightness, |
894 | NULL, | 894 | NULL, |
895 | offsetof(struct prev_params, brightness), | 895 | offsetof(struct prev_params, brightness), |
896 | 0, true, | 896 | 0, 0, true, |
897 | }, | 897 | }, |
898 | }; | 898 | }; |
899 | 899 | ||
@@ -1102,7 +1102,7 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active) | |||
1102 | unsigned int elv = prev->crop.top + prev->crop.height - 1; | 1102 | unsigned int elv = prev->crop.top + prev->crop.height - 1; |
1103 | u32 features; | 1103 | u32 features; |
1104 | 1104 | ||
1105 | if (format->code == V4L2_MBUS_FMT_Y10_1X10) { | 1105 | if (format->code != V4L2_MBUS_FMT_Y10_1X10) { |
1106 | sph -= 2; | 1106 | sph -= 2; |
1107 | eph += 2; | 1107 | eph += 2; |
1108 | slv -= 2; | 1108 | slv -= 2; |
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index c370c2d87c17..b4c679b3fb0f 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/slab.h> | ||
29 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
31 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 354574591908..725812aa0c30 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -350,7 +350,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, | |||
350 | if (pixm) | 350 | if (pixm) |
351 | sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); | 351 | sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); |
352 | else | 352 | else |
353 | sizes[i] = size; | 353 | sizes[i] = max_t(u32, size, frame->payload[i]); |
354 | |||
354 | allocators[i] = ctx->fimc_dev->alloc_ctx; | 355 | allocators[i] = ctx->fimc_dev->alloc_ctx; |
355 | } | 356 | } |
356 | 357 | ||
@@ -479,37 +480,39 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc); | |||
479 | static int fimc_capture_open(struct file *file) | 480 | static int fimc_capture_open(struct file *file) |
480 | { | 481 | { |
481 | struct fimc_dev *fimc = video_drvdata(file); | 482 | struct fimc_dev *fimc = video_drvdata(file); |
482 | int ret = v4l2_fh_open(file); | 483 | int ret; |
483 | |||
484 | if (ret) | ||
485 | return ret; | ||
486 | 484 | ||
487 | dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); | 485 | dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); |
488 | 486 | ||
489 | /* Return if the corresponding video mem2mem node is already opened. */ | ||
490 | if (fimc_m2m_active(fimc)) | 487 | if (fimc_m2m_active(fimc)) |
491 | return -EBUSY; | 488 | return -EBUSY; |
492 | 489 | ||
493 | set_bit(ST_CAPT_BUSY, &fimc->state); | 490 | set_bit(ST_CAPT_BUSY, &fimc->state); |
494 | pm_runtime_get_sync(&fimc->pdev->dev); | 491 | ret = pm_runtime_get_sync(&fimc->pdev->dev); |
492 | if (ret < 0) | ||
493 | return ret; | ||
495 | 494 | ||
496 | if (++fimc->vid_cap.refcnt == 1) { | 495 | ret = v4l2_fh_open(file); |
497 | ret = fimc_pipeline_initialize(&fimc->pipeline, | 496 | if (ret) |
498 | &fimc->vid_cap.vfd->entity, true); | 497 | return ret; |
499 | if (ret < 0) { | ||
500 | dev_err(&fimc->pdev->dev, | ||
501 | "Video pipeline initialization failed\n"); | ||
502 | pm_runtime_put_sync(&fimc->pdev->dev); | ||
503 | fimc->vid_cap.refcnt--; | ||
504 | v4l2_fh_release(file); | ||
505 | clear_bit(ST_CAPT_BUSY, &fimc->state); | ||
506 | return ret; | ||
507 | } | ||
508 | ret = fimc_capture_ctrls_create(fimc); | ||
509 | 498 | ||
510 | if (!ret && !fimc->vid_cap.user_subdev_api) | 499 | if (++fimc->vid_cap.refcnt != 1) |
511 | ret = fimc_capture_set_default_format(fimc); | 500 | return 0; |
501 | |||
502 | ret = fimc_pipeline_initialize(&fimc->pipeline, | ||
503 | &fimc->vid_cap.vfd->entity, true); | ||
504 | if (ret < 0) { | ||
505 | clear_bit(ST_CAPT_BUSY, &fimc->state); | ||
506 | pm_runtime_put_sync(&fimc->pdev->dev); | ||
507 | fimc->vid_cap.refcnt--; | ||
508 | v4l2_fh_release(file); | ||
509 | return ret; | ||
512 | } | 510 | } |
511 | ret = fimc_capture_ctrls_create(fimc); | ||
512 | |||
513 | if (!ret && !fimc->vid_cap.user_subdev_api) | ||
514 | ret = fimc_capture_set_default_format(fimc); | ||
515 | |||
513 | return ret; | 516 | return ret; |
514 | } | 517 | } |
515 | 518 | ||
@@ -818,9 +821,6 @@ static int fimc_cap_g_fmt_mplane(struct file *file, void *fh, | |||
818 | struct fimc_dev *fimc = video_drvdata(file); | 821 | struct fimc_dev *fimc = video_drvdata(file); |
819 | struct fimc_ctx *ctx = fimc->vid_cap.ctx; | 822 | struct fimc_ctx *ctx = fimc->vid_cap.ctx; |
820 | 823 | ||
821 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
822 | return -EINVAL; | ||
823 | |||
824 | return fimc_fill_format(&ctx->d_frame, f); | 824 | return fimc_fill_format(&ctx->d_frame, f); |
825 | } | 825 | } |
826 | 826 | ||
@@ -833,9 +833,6 @@ static int fimc_cap_try_fmt_mplane(struct file *file, void *fh, | |||
833 | struct v4l2_mbus_framefmt mf; | 833 | struct v4l2_mbus_framefmt mf; |
834 | struct fimc_fmt *ffmt = NULL; | 834 | struct fimc_fmt *ffmt = NULL; |
835 | 835 | ||
836 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
837 | return -EINVAL; | ||
838 | |||
839 | if (pix->pixelformat == V4L2_PIX_FMT_JPEG) { | 836 | if (pix->pixelformat == V4L2_PIX_FMT_JPEG) { |
840 | fimc_capture_try_format(ctx, &pix->width, &pix->height, | 837 | fimc_capture_try_format(ctx, &pix->width, &pix->height, |
841 | NULL, &pix->pixelformat, | 838 | NULL, &pix->pixelformat, |
@@ -887,8 +884,6 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) | |||
887 | struct fimc_fmt *s_fmt = NULL; | 884 | struct fimc_fmt *s_fmt = NULL; |
888 | int ret, i; | 885 | int ret, i; |
889 | 886 | ||
890 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
891 | return -EINVAL; | ||
892 | if (vb2_is_busy(&fimc->vid_cap.vbq)) | 887 | if (vb2_is_busy(&fimc->vid_cap.vbq)) |
893 | return -EBUSY; | 888 | return -EBUSY; |
894 | 889 | ||
@@ -924,10 +919,10 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) | |||
924 | pix->width = mf->width; | 919 | pix->width = mf->width; |
925 | pix->height = mf->height; | 920 | pix->height = mf->height; |
926 | } | 921 | } |
922 | |||
927 | fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); | 923 | fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); |
928 | for (i = 0; i < ff->fmt->colplanes; i++) | 924 | for (i = 0; i < ff->fmt->colplanes; i++) |
929 | ff->payload[i] = | 925 | ff->payload[i] = pix->plane_fmt[i].sizeimage; |
930 | (pix->width * pix->height * ff->fmt->depth[i]) / 8; | ||
931 | 926 | ||
932 | set_frame_bounds(ff, pix->width, pix->height); | 927 | set_frame_bounds(ff, pix->width, pix->height); |
933 | /* Reset the composition rectangle if not yet configured */ | 928 | /* Reset the composition rectangle if not yet configured */ |
@@ -1045,18 +1040,22 @@ static int fimc_cap_streamon(struct file *file, void *priv, | |||
1045 | { | 1040 | { |
1046 | struct fimc_dev *fimc = video_drvdata(file); | 1041 | struct fimc_dev *fimc = video_drvdata(file); |
1047 | struct fimc_pipeline *p = &fimc->pipeline; | 1042 | struct fimc_pipeline *p = &fimc->pipeline; |
1043 | struct v4l2_subdev *sd = p->subdevs[IDX_SENSOR]; | ||
1048 | int ret; | 1044 | int ret; |
1049 | 1045 | ||
1050 | if (fimc_capture_active(fimc)) | 1046 | if (fimc_capture_active(fimc)) |
1051 | return -EBUSY; | 1047 | return -EBUSY; |
1052 | 1048 | ||
1053 | media_entity_pipeline_start(&p->subdevs[IDX_SENSOR]->entity, | 1049 | ret = media_entity_pipeline_start(&sd->entity, p->m_pipeline); |
1054 | p->m_pipeline); | 1050 | if (ret < 0) |
1051 | return ret; | ||
1055 | 1052 | ||
1056 | if (fimc->vid_cap.user_subdev_api) { | 1053 | if (fimc->vid_cap.user_subdev_api) { |
1057 | ret = fimc_pipeline_validate(fimc); | 1054 | ret = fimc_pipeline_validate(fimc); |
1058 | if (ret) | 1055 | if (ret < 0) { |
1056 | media_entity_pipeline_stop(&sd->entity); | ||
1059 | return ret; | 1057 | return ret; |
1058 | } | ||
1060 | } | 1059 | } |
1061 | return vb2_streamon(&fimc->vid_cap.vbq, type); | 1060 | return vb2_streamon(&fimc->vid_cap.vbq, type); |
1062 | } | 1061 | } |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 92fc5a20fb76..a4646ca1d56f 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -153,7 +153,7 @@ static struct fimc_fmt fimc_formats[] = { | |||
153 | .colplanes = 2, | 153 | .colplanes = 2, |
154 | .flags = FMT_FLAGS_M2M, | 154 | .flags = FMT_FLAGS_M2M, |
155 | }, { | 155 | }, { |
156 | .name = "YUV 4:2:0 non-contiguous 2-planar, Y/CbCr", | 156 | .name = "YUV 4:2:0 non-contig. 2p, Y/CbCr", |
157 | .fourcc = V4L2_PIX_FMT_NV12M, | 157 | .fourcc = V4L2_PIX_FMT_NV12M, |
158 | .color = FIMC_FMT_YCBCR420, | 158 | .color = FIMC_FMT_YCBCR420, |
159 | .depth = { 8, 4 }, | 159 | .depth = { 8, 4 }, |
@@ -161,7 +161,7 @@ static struct fimc_fmt fimc_formats[] = { | |||
161 | .colplanes = 2, | 161 | .colplanes = 2, |
162 | .flags = FMT_FLAGS_M2M, | 162 | .flags = FMT_FLAGS_M2M, |
163 | }, { | 163 | }, { |
164 | .name = "YUV 4:2:0 non-contiguous 3-planar, Y/Cb/Cr", | 164 | .name = "YUV 4:2:0 non-contig. 3p, Y/Cb/Cr", |
165 | .fourcc = V4L2_PIX_FMT_YUV420M, | 165 | .fourcc = V4L2_PIX_FMT_YUV420M, |
166 | .color = FIMC_FMT_YCBCR420, | 166 | .color = FIMC_FMT_YCBCR420, |
167 | .depth = { 8, 2, 2 }, | 167 | .depth = { 8, 2, 2 }, |
@@ -169,7 +169,7 @@ static struct fimc_fmt fimc_formats[] = { | |||
169 | .colplanes = 3, | 169 | .colplanes = 3, |
170 | .flags = FMT_FLAGS_M2M, | 170 | .flags = FMT_FLAGS_M2M, |
171 | }, { | 171 | }, { |
172 | .name = "YUV 4:2:0 non-contiguous 2-planar, Y/CbCr, tiled", | 172 | .name = "YUV 4:2:0 non-contig. 2p, tiled", |
173 | .fourcc = V4L2_PIX_FMT_NV12MT, | 173 | .fourcc = V4L2_PIX_FMT_NV12MT, |
174 | .color = FIMC_FMT_YCBCR420, | 174 | .color = FIMC_FMT_YCBCR420, |
175 | .depth = { 8, 4 }, | 175 | .depth = { 8, 4 }, |
@@ -641,7 +641,7 @@ void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active) | |||
641 | if (!ctrls->ready) | 641 | if (!ctrls->ready) |
642 | return; | 642 | return; |
643 | 643 | ||
644 | mutex_lock(&ctrls->handler.lock); | 644 | mutex_lock(ctrls->handler.lock); |
645 | v4l2_ctrl_activate(ctrls->rotate, active); | 645 | v4l2_ctrl_activate(ctrls->rotate, active); |
646 | v4l2_ctrl_activate(ctrls->hflip, active); | 646 | v4l2_ctrl_activate(ctrls->hflip, active); |
647 | v4l2_ctrl_activate(ctrls->vflip, active); | 647 | v4l2_ctrl_activate(ctrls->vflip, active); |
@@ -660,7 +660,7 @@ void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active) | |||
660 | ctx->hflip = 0; | 660 | ctx->hflip = 0; |
661 | ctx->vflip = 0; | 661 | ctx->vflip = 0; |
662 | } | 662 | } |
663 | mutex_unlock(&ctrls->handler.lock); | 663 | mutex_unlock(ctrls->handler.lock); |
664 | } | 664 | } |
665 | 665 | ||
666 | /* Update maximum value of the alpha color control */ | 666 | /* Update maximum value of the alpha color control */ |
@@ -741,8 +741,8 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, | |||
741 | pix->width = width; | 741 | pix->width = width; |
742 | 742 | ||
743 | for (i = 0; i < pix->num_planes; ++i) { | 743 | for (i = 0; i < pix->num_planes; ++i) { |
744 | u32 bpl = pix->plane_fmt[i].bytesperline; | 744 | struct v4l2_plane_pix_format *plane_fmt = &pix->plane_fmt[i]; |
745 | u32 *sizeimage = &pix->plane_fmt[i].sizeimage; | 745 | u32 bpl = plane_fmt->bytesperline; |
746 | 746 | ||
747 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) | 747 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) |
748 | bpl = pix->width; /* Planar */ | 748 | bpl = pix->width; /* Planar */ |
@@ -754,8 +754,9 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, | |||
754 | if (i == 0) /* Same bytesperline for each plane. */ | 754 | if (i == 0) /* Same bytesperline for each plane. */ |
755 | bytesperline = bpl; | 755 | bytesperline = bpl; |
756 | 756 | ||
757 | pix->plane_fmt[i].bytesperline = bytesperline; | 757 | plane_fmt->bytesperline = bytesperline; |
758 | *sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; | 758 | plane_fmt->sizeimage = max((pix->width * pix->height * |
759 | fmt->depth[i]) / 8, plane_fmt->sizeimage); | ||
759 | } | 760 | } |
760 | } | 761 | } |
761 | 762 | ||
diff --git a/drivers/media/video/s5p-fimc/fimc-lite.c b/drivers/media/video/s5p-fimc/fimc-lite.c index 400d701aef04..74ff310db30c 100644 --- a/drivers/media/video/s5p-fimc/fimc-lite.c +++ b/drivers/media/video/s5p-fimc/fimc-lite.c | |||
@@ -451,34 +451,44 @@ static void fimc_lite_clear_event_counters(struct fimc_lite *fimc) | |||
451 | static int fimc_lite_open(struct file *file) | 451 | static int fimc_lite_open(struct file *file) |
452 | { | 452 | { |
453 | struct fimc_lite *fimc = video_drvdata(file); | 453 | struct fimc_lite *fimc = video_drvdata(file); |
454 | int ret = v4l2_fh_open(file); | 454 | int ret; |
455 | 455 | ||
456 | if (ret) | 456 | if (mutex_lock_interruptible(&fimc->lock)) |
457 | return ret; | 457 | return -ERESTARTSYS; |
458 | 458 | ||
459 | set_bit(ST_FLITE_IN_USE, &fimc->state); | 459 | set_bit(ST_FLITE_IN_USE, &fimc->state); |
460 | pm_runtime_get_sync(&fimc->pdev->dev); | 460 | ret = pm_runtime_get_sync(&fimc->pdev->dev); |
461 | if (ret < 0) | ||
462 | goto done; | ||
461 | 463 | ||
462 | if (++fimc->ref_count != 1 || fimc->out_path != FIMC_IO_DMA) | 464 | ret = v4l2_fh_open(file); |
463 | return ret; | 465 | if (ret < 0) |
466 | goto done; | ||
464 | 467 | ||
465 | ret = fimc_pipeline_initialize(&fimc->pipeline, &fimc->vfd->entity, | 468 | if (++fimc->ref_count == 1 && fimc->out_path == FIMC_IO_DMA) { |
466 | true); | 469 | ret = fimc_pipeline_initialize(&fimc->pipeline, |
467 | if (ret < 0) { | 470 | &fimc->vfd->entity, true); |
468 | v4l2_err(fimc->vfd, "Video pipeline initialization failed\n"); | 471 | if (ret < 0) { |
469 | pm_runtime_put_sync(&fimc->pdev->dev); | 472 | pm_runtime_put_sync(&fimc->pdev->dev); |
470 | fimc->ref_count--; | 473 | fimc->ref_count--; |
471 | v4l2_fh_release(file); | 474 | v4l2_fh_release(file); |
472 | clear_bit(ST_FLITE_IN_USE, &fimc->state); | 475 | clear_bit(ST_FLITE_IN_USE, &fimc->state); |
473 | } | 476 | } |
474 | 477 | ||
475 | fimc_lite_clear_event_counters(fimc); | 478 | fimc_lite_clear_event_counters(fimc); |
479 | } | ||
480 | done: | ||
481 | mutex_unlock(&fimc->lock); | ||
476 | return ret; | 482 | return ret; |
477 | } | 483 | } |
478 | 484 | ||
479 | static int fimc_lite_close(struct file *file) | 485 | static int fimc_lite_close(struct file *file) |
480 | { | 486 | { |
481 | struct fimc_lite *fimc = video_drvdata(file); | 487 | struct fimc_lite *fimc = video_drvdata(file); |
488 | int ret; | ||
489 | |||
490 | if (mutex_lock_interruptible(&fimc->lock)) | ||
491 | return -ERESTARTSYS; | ||
482 | 492 | ||
483 | if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { | 493 | if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { |
484 | clear_bit(ST_FLITE_IN_USE, &fimc->state); | 494 | clear_bit(ST_FLITE_IN_USE, &fimc->state); |
@@ -492,20 +502,39 @@ static int fimc_lite_close(struct file *file) | |||
492 | if (fimc->ref_count == 0) | 502 | if (fimc->ref_count == 0) |
493 | vb2_queue_release(&fimc->vb_queue); | 503 | vb2_queue_release(&fimc->vb_queue); |
494 | 504 | ||
495 | return v4l2_fh_release(file); | 505 | ret = v4l2_fh_release(file); |
506 | |||
507 | mutex_unlock(&fimc->lock); | ||
508 | return ret; | ||
496 | } | 509 | } |
497 | 510 | ||
498 | static unsigned int fimc_lite_poll(struct file *file, | 511 | static unsigned int fimc_lite_poll(struct file *file, |
499 | struct poll_table_struct *wait) | 512 | struct poll_table_struct *wait) |
500 | { | 513 | { |
501 | struct fimc_lite *fimc = video_drvdata(file); | 514 | struct fimc_lite *fimc = video_drvdata(file); |
502 | return vb2_poll(&fimc->vb_queue, file, wait); | 515 | int ret; |
516 | |||
517 | if (mutex_lock_interruptible(&fimc->lock)) | ||
518 | return POLL_ERR; | ||
519 | |||
520 | ret = vb2_poll(&fimc->vb_queue, file, wait); | ||
521 | mutex_unlock(&fimc->lock); | ||
522 | |||
523 | return ret; | ||
503 | } | 524 | } |
504 | 525 | ||
505 | static int fimc_lite_mmap(struct file *file, struct vm_area_struct *vma) | 526 | static int fimc_lite_mmap(struct file *file, struct vm_area_struct *vma) |
506 | { | 527 | { |
507 | struct fimc_lite *fimc = video_drvdata(file); | 528 | struct fimc_lite *fimc = video_drvdata(file); |
508 | return vb2_mmap(&fimc->vb_queue, vma); | 529 | int ret; |
530 | |||
531 | if (mutex_lock_interruptible(&fimc->lock)) | ||
532 | return -ERESTARTSYS; | ||
533 | |||
534 | ret = vb2_mmap(&fimc->vb_queue, vma); | ||
535 | mutex_unlock(&fimc->lock); | ||
536 | |||
537 | return ret; | ||
509 | } | 538 | } |
510 | 539 | ||
511 | static const struct v4l2_file_operations fimc_lite_fops = { | 540 | static const struct v4l2_file_operations fimc_lite_fops = { |
@@ -762,7 +791,9 @@ static int fimc_lite_streamon(struct file *file, void *priv, | |||
762 | if (fimc_lite_active(fimc)) | 791 | if (fimc_lite_active(fimc)) |
763 | return -EBUSY; | 792 | return -EBUSY; |
764 | 793 | ||
765 | media_entity_pipeline_start(&sensor->entity, p->m_pipeline); | 794 | ret = media_entity_pipeline_start(&sensor->entity, p->m_pipeline); |
795 | if (ret < 0) | ||
796 | return ret; | ||
766 | 797 | ||
767 | ret = fimc_pipeline_validate(fimc); | 798 | ret = fimc_pipeline_validate(fimc); |
768 | if (ret) { | 799 | if (ret) { |
@@ -1508,7 +1539,7 @@ static int fimc_lite_suspend(struct device *dev) | |||
1508 | return 0; | 1539 | return 0; |
1509 | 1540 | ||
1510 | ret = fimc_lite_stop_capture(fimc, suspend); | 1541 | ret = fimc_lite_stop_capture(fimc, suspend); |
1511 | if (ret) | 1542 | if (ret < 0 || !fimc_lite_active(fimc)) |
1512 | return ret; | 1543 | return ret; |
1513 | 1544 | ||
1514 | return fimc_pipeline_shutdown(&fimc->pipeline); | 1545 | return fimc_pipeline_shutdown(&fimc->pipeline); |
diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.c b/drivers/media/video/s5p-fimc/fimc-mdevice.c index 6753c45631b8..52cef4865423 100644 --- a/drivers/media/video/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/video/s5p-fimc/fimc-mdevice.c | |||
@@ -193,9 +193,13 @@ int __fimc_pipeline_shutdown(struct fimc_pipeline *p) | |||
193 | 193 | ||
194 | int fimc_pipeline_shutdown(struct fimc_pipeline *p) | 194 | int fimc_pipeline_shutdown(struct fimc_pipeline *p) |
195 | { | 195 | { |
196 | struct media_entity *me = &p->subdevs[IDX_SENSOR]->entity; | 196 | struct media_entity *me; |
197 | int ret; | 197 | int ret; |
198 | 198 | ||
199 | if (!p || !p->subdevs[IDX_SENSOR]) | ||
200 | return -EINVAL; | ||
201 | |||
202 | me = &p->subdevs[IDX_SENSOR]->entity; | ||
199 | mutex_lock(&me->parent->graph_mutex); | 203 | mutex_lock(&me->parent->graph_mutex); |
200 | ret = __fimc_pipeline_shutdown(p); | 204 | ret = __fimc_pipeline_shutdown(p); |
201 | mutex_unlock(&me->parent->graph_mutex); | 205 | mutex_unlock(&me->parent->graph_mutex); |
@@ -498,12 +502,12 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd) | |||
498 | * @source: the source entity to create links to all fimc entities from | 502 | * @source: the source entity to create links to all fimc entities from |
499 | * @sensor: sensor subdev linked to FIMC[fimc_id] entity, may be null | 503 | * @sensor: sensor subdev linked to FIMC[fimc_id] entity, may be null |
500 | * @pad: the source entity pad index | 504 | * @pad: the source entity pad index |
501 | * @fimc_id: index of the fimc device for which link should be enabled | 505 | * @link_mask: bitmask of the fimc devices for which link should be enabled |
502 | */ | 506 | */ |
503 | static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, | 507 | static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, |
504 | struct media_entity *source, | 508 | struct media_entity *source, |
505 | struct v4l2_subdev *sensor, | 509 | struct v4l2_subdev *sensor, |
506 | int pad, int fimc_id) | 510 | int pad, int link_mask) |
507 | { | 511 | { |
508 | struct fimc_sensor_info *s_info; | 512 | struct fimc_sensor_info *s_info; |
509 | struct media_entity *sink; | 513 | struct media_entity *sink; |
@@ -520,7 +524,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, | |||
520 | if (!fmd->fimc[i]->variant->has_cam_if) | 524 | if (!fmd->fimc[i]->variant->has_cam_if) |
521 | continue; | 525 | continue; |
522 | 526 | ||
523 | flags = (i == fimc_id) ? MEDIA_LNK_FL_ENABLED : 0; | 527 | flags = ((1 << i) & link_mask) ? MEDIA_LNK_FL_ENABLED : 0; |
524 | 528 | ||
525 | sink = &fmd->fimc[i]->vid_cap.subdev.entity; | 529 | sink = &fmd->fimc[i]->vid_cap.subdev.entity; |
526 | ret = media_entity_create_link(source, pad, sink, | 530 | ret = media_entity_create_link(source, pad, sink, |
@@ -552,7 +556,10 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, | |||
552 | if (!fmd->fimc_lite[i]) | 556 | if (!fmd->fimc_lite[i]) |
553 | continue; | 557 | continue; |
554 | 558 | ||
555 | flags = (i == fimc_id) ? MEDIA_LNK_FL_ENABLED : 0; | 559 | if (link_mask & (1 << (i + FIMC_MAX_DEVS))) |
560 | flags = MEDIA_LNK_FL_ENABLED; | ||
561 | else | ||
562 | flags = 0; | ||
556 | 563 | ||
557 | sink = &fmd->fimc_lite[i]->subdev.entity; | 564 | sink = &fmd->fimc_lite[i]->subdev.entity; |
558 | ret = media_entity_create_link(source, pad, sink, | 565 | ret = media_entity_create_link(source, pad, sink, |
@@ -614,9 +621,8 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
614 | struct s5p_fimc_isp_info *pdata; | 621 | struct s5p_fimc_isp_info *pdata; |
615 | struct fimc_sensor_info *s_info; | 622 | struct fimc_sensor_info *s_info; |
616 | struct media_entity *source, *sink; | 623 | struct media_entity *source, *sink; |
617 | int i, pad, fimc_id = 0; | 624 | int i, pad, fimc_id = 0, ret = 0; |
618 | int ret = 0; | 625 | u32 flags, link_mask = 0; |
619 | u32 flags; | ||
620 | 626 | ||
621 | for (i = 0; i < fmd->num_sensors; i++) { | 627 | for (i = 0; i < fmd->num_sensors; i++) { |
622 | if (fmd->sensor[i].subdev == NULL) | 628 | if (fmd->sensor[i].subdev == NULL) |
@@ -668,19 +674,20 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
668 | if (source == NULL) | 674 | if (source == NULL) |
669 | continue; | 675 | continue; |
670 | 676 | ||
677 | link_mask = 1 << fimc_id++; | ||
671 | ret = __fimc_md_create_fimc_sink_links(fmd, source, sensor, | 678 | ret = __fimc_md_create_fimc_sink_links(fmd, source, sensor, |
672 | pad, fimc_id++); | 679 | pad, link_mask); |
673 | } | 680 | } |
674 | 681 | ||
675 | fimc_id = 0; | ||
676 | for (i = 0; i < ARRAY_SIZE(fmd->csis); i++) { | 682 | for (i = 0; i < ARRAY_SIZE(fmd->csis); i++) { |
677 | if (fmd->csis[i].sd == NULL) | 683 | if (fmd->csis[i].sd == NULL) |
678 | continue; | 684 | continue; |
679 | source = &fmd->csis[i].sd->entity; | 685 | source = &fmd->csis[i].sd->entity; |
680 | pad = CSIS_PAD_SOURCE; | 686 | pad = CSIS_PAD_SOURCE; |
681 | 687 | ||
688 | link_mask = 1 << fimc_id++; | ||
682 | ret = __fimc_md_create_fimc_sink_links(fmd, source, NULL, | 689 | ret = __fimc_md_create_fimc_sink_links(fmd, source, NULL, |
683 | pad, fimc_id++); | 690 | pad, link_mask); |
684 | } | 691 | } |
685 | 692 | ||
686 | /* Create immutable links between each FIMC's subdev and video node */ | 693 | /* Create immutable links between each FIMC's subdev and video node */ |
@@ -734,8 +741,8 @@ static void fimc_md_put_clocks(struct fimc_md *fmd) | |||
734 | } | 741 | } |
735 | 742 | ||
736 | static int __fimc_md_set_camclk(struct fimc_md *fmd, | 743 | static int __fimc_md_set_camclk(struct fimc_md *fmd, |
737 | struct fimc_sensor_info *s_info, | 744 | struct fimc_sensor_info *s_info, |
738 | bool on) | 745 | bool on) |
739 | { | 746 | { |
740 | struct s5p_fimc_isp_info *pdata = s_info->pdata; | 747 | struct s5p_fimc_isp_info *pdata = s_info->pdata; |
741 | struct fimc_camclk_info *camclk; | 748 | struct fimc_camclk_info *camclk; |
@@ -744,12 +751,10 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
744 | if (WARN_ON(pdata->clk_id >= FIMC_MAX_CAMCLKS) || fmd == NULL) | 751 | if (WARN_ON(pdata->clk_id >= FIMC_MAX_CAMCLKS) || fmd == NULL) |
745 | return -EINVAL; | 752 | return -EINVAL; |
746 | 753 | ||
747 | if (s_info->clk_on == on) | ||
748 | return 0; | ||
749 | camclk = &fmd->camclk[pdata->clk_id]; | 754 | camclk = &fmd->camclk[pdata->clk_id]; |
750 | 755 | ||
751 | dbg("camclk %d, f: %lu, clk: %p, on: %d", | 756 | dbg("camclk %d, f: %lu, use_count: %d, on: %d", |
752 | pdata->clk_id, pdata->clk_frequency, camclk, on); | 757 | pdata->clk_id, pdata->clk_frequency, camclk->use_count, on); |
753 | 758 | ||
754 | if (on) { | 759 | if (on) { |
755 | if (camclk->use_count > 0 && | 760 | if (camclk->use_count > 0 && |
@@ -760,11 +765,9 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
760 | clk_set_rate(camclk->clock, pdata->clk_frequency); | 765 | clk_set_rate(camclk->clock, pdata->clk_frequency); |
761 | camclk->frequency = pdata->clk_frequency; | 766 | camclk->frequency = pdata->clk_frequency; |
762 | ret = clk_enable(camclk->clock); | 767 | ret = clk_enable(camclk->clock); |
768 | dbg("Enabled camclk %d: f: %lu", pdata->clk_id, | ||
769 | clk_get_rate(camclk->clock)); | ||
763 | } | 770 | } |
764 | s_info->clk_on = 1; | ||
765 | dbg("Enabled camclk %d: f: %lu", pdata->clk_id, | ||
766 | clk_get_rate(camclk->clock)); | ||
767 | |||
768 | return ret; | 771 | return ret; |
769 | } | 772 | } |
770 | 773 | ||
@@ -773,7 +776,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
773 | 776 | ||
774 | if (--camclk->use_count == 0) { | 777 | if (--camclk->use_count == 0) { |
775 | clk_disable(camclk->clock); | 778 | clk_disable(camclk->clock); |
776 | s_info->clk_on = 0; | ||
777 | dbg("Disabled camclk %d", pdata->clk_id); | 779 | dbg("Disabled camclk %d", pdata->clk_id); |
778 | } | 780 | } |
779 | return ret; | 781 | return ret; |
@@ -789,8 +791,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
789 | * devices to which sensors can be attached, either directly or through | 791 | * devices to which sensors can be attached, either directly or through |
790 | * the MIPI CSI receiver. The clock is allowed here to be used by | 792 | * the MIPI CSI receiver. The clock is allowed here to be used by |
791 | * multiple sensors concurrently if they use same frequency. | 793 | * multiple sensors concurrently if they use same frequency. |
792 | * The per sensor subdev clk_on attribute helps to synchronize accesses | ||
793 | * to the sclk_cam clocks from the video and media device nodes. | ||
794 | * This function should only be called when the graph mutex is held. | 794 | * This function should only be called when the graph mutex is held. |
795 | */ | 795 | */ |
796 | int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on) | 796 | int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on) |
diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.h b/drivers/media/video/s5p-fimc/fimc-mdevice.h index 3b8a3492a176..1f5dbaff5442 100644 --- a/drivers/media/video/s5p-fimc/fimc-mdevice.h +++ b/drivers/media/video/s5p-fimc/fimc-mdevice.h | |||
@@ -47,7 +47,6 @@ struct fimc_camclk_info { | |||
47 | * @pdata: sensor's atrributes passed as media device's platform data | 47 | * @pdata: sensor's atrributes passed as media device's platform data |
48 | * @subdev: image sensor v4l2 subdev | 48 | * @subdev: image sensor v4l2 subdev |
49 | * @host: fimc device the sensor is currently linked to | 49 | * @host: fimc device the sensor is currently linked to |
50 | * @clk_on: sclk_cam clock's state associated with this subdev | ||
51 | * | 50 | * |
52 | * This data structure applies to image sensor and the writeback subdevs. | 51 | * This data structure applies to image sensor and the writeback subdevs. |
53 | */ | 52 | */ |
@@ -55,7 +54,6 @@ struct fimc_sensor_info { | |||
55 | struct s5p_fimc_isp_info *pdata; | 54 | struct s5p_fimc_isp_info *pdata; |
56 | struct v4l2_subdev *subdev; | 55 | struct v4l2_subdev *subdev; |
57 | struct fimc_dev *host; | 56 | struct fimc_dev *host; |
58 | bool clk_on; | ||
59 | }; | 57 | }; |
60 | 58 | ||
61 | /** | 59 | /** |
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c index 4dd32fc8fd82..feea867f318c 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c | |||
@@ -996,6 +996,7 @@ int s5p_mfc_dec_ctrls_setup(struct s5p_mfc_ctx *ctx) | |||
996 | 996 | ||
997 | for (i = 0; i < NUM_CTRLS; i++) { | 997 | for (i = 0; i < NUM_CTRLS; i++) { |
998 | if (IS_MFC51_PRIV(controls[i].id)) { | 998 | if (IS_MFC51_PRIV(controls[i].id)) { |
999 | memset(&cfg, 0, sizeof(struct v4l2_ctrl_config)); | ||
999 | cfg.ops = &s5p_mfc_dec_ctrl_ops; | 1000 | cfg.ops = &s5p_mfc_dec_ctrl_ops; |
1000 | cfg.id = controls[i].id; | 1001 | cfg.id = controls[i].id; |
1001 | cfg.min = controls[i].minimum; | 1002 | cfg.min = controls[i].minimum; |
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index 03d83340e7fb..158b78989b89 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c | |||
@@ -1773,6 +1773,7 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx) | |||
1773 | } | 1773 | } |
1774 | for (i = 0; i < NUM_CTRLS; i++) { | 1774 | for (i = 0; i < NUM_CTRLS; i++) { |
1775 | if (IS_MFC51_PRIV(controls[i].id)) { | 1775 | if (IS_MFC51_PRIV(controls[i].id)) { |
1776 | memset(&cfg, 0, sizeof(struct v4l2_ctrl_config)); | ||
1776 | cfg.ops = &s5p_mfc_enc_ctrl_ops; | 1777 | cfg.ops = &s5p_mfc_enc_ctrl_ops; |
1777 | cfg.id = controls[i].id; | 1778 | cfg.id = controls[i].id; |
1778 | cfg.min = controls[i].minimum; | 1779 | cfg.min = controls[i].minimum; |
diff --git a/drivers/media/video/smiapp/smiapp-core.c b/drivers/media/video/smiapp/smiapp-core.c index e8c93c89265a..9cf5bda35fbe 100644 --- a/drivers/media/video/smiapp/smiapp-core.c +++ b/drivers/media/video/smiapp/smiapp-core.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/device.h> | 31 | #include <linux/device.h> |
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/slab.h> | ||
34 | #include <linux/regulator/consumer.h> | 35 | #include <linux/regulator/consumer.h> |
35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
36 | #include <linux/v4l2-mediabus.h> | 37 | #include <linux/v4l2-mediabus.h> |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 83dbb2ddff10..0cbada18f6f5 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -681,6 +681,7 @@ static void determine_valid_ioctls(struct video_device *vdev) | |||
681 | SET_VALID_IOCTL(ops, VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings); | 681 | SET_VALID_IOCTL(ops, VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings); |
682 | SET_VALID_IOCTL(ops, VIDIOC_ENUM_DV_TIMINGS, vidioc_enum_dv_timings); | 682 | SET_VALID_IOCTL(ops, VIDIOC_ENUM_DV_TIMINGS, vidioc_enum_dv_timings); |
683 | SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_TIMINGS, vidioc_query_dv_timings); | 683 | SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_TIMINGS, vidioc_query_dv_timings); |
684 | SET_VALID_IOCTL(ops, VIDIOC_DV_TIMINGS_CAP, vidioc_dv_timings_cap); | ||
684 | /* yes, really vidioc_subscribe_event */ | 685 | /* yes, really vidioc_subscribe_event */ |
685 | SET_VALID_IOCTL(ops, VIDIOC_DQEVENT, vidioc_subscribe_event); | 686 | SET_VALID_IOCTL(ops, VIDIOC_DQEVENT, vidioc_subscribe_event); |
686 | SET_VALID_IOCTL(ops, VIDIOC_SUBSCRIBE_EVENT, vidioc_subscribe_event); | 687 | SET_VALID_IOCTL(ops, VIDIOC_SUBSCRIBE_EVENT, vidioc_subscribe_event); |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index e129c820df7d..92144ed1ad46 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -286,6 +286,7 @@ config TWL6040_CORE | |||
286 | depends on I2C=y && GENERIC_HARDIRQS | 286 | depends on I2C=y && GENERIC_HARDIRQS |
287 | select MFD_CORE | 287 | select MFD_CORE |
288 | select REGMAP_I2C | 288 | select REGMAP_I2C |
289 | select IRQ_DOMAIN | ||
289 | default n | 290 | default n |
290 | help | 291 | help |
291 | Say yes here if you want support for Texas Instruments TWL6040 audio | 292 | Say yes here if you want support for Texas Instruments TWL6040 audio |
diff --git a/drivers/mfd/ab5500-core.h b/drivers/mfd/ab5500-core.h deleted file mode 100644 index 63b30b17e4f3..000000000000 --- a/drivers/mfd/ab5500-core.h +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 ST-Ericsson | ||
3 | * License terms: GNU General Public License (GPL) version 2 | ||
4 | * Shared definitions and data structures for the AB5500 MFD driver | ||
5 | */ | ||
6 | |||
7 | /* Read/write operation values. */ | ||
8 | #define AB5500_PERM_RD (0x01) | ||
9 | #define AB5500_PERM_WR (0x02) | ||
10 | |||
11 | /* Read/write permissions. */ | ||
12 | #define AB5500_PERM_RO (AB5500_PERM_RD) | ||
13 | #define AB5500_PERM_RW (AB5500_PERM_RD | AB5500_PERM_WR) | ||
14 | |||
15 | #define AB5500_MASK_BASE (0x60) | ||
16 | #define AB5500_MASK_END (0x79) | ||
17 | #define AB5500_CHIP_ID (0x20) | ||
18 | |||
19 | /** | ||
20 | * struct ab5500_reg_range | ||
21 | * @first: the first address of the range | ||
22 | * @last: the last address of the range | ||
23 | * @perm: access permissions for the range | ||
24 | */ | ||
25 | struct ab5500_reg_range { | ||
26 | u8 first; | ||
27 | u8 last; | ||
28 | u8 perm; | ||
29 | }; | ||
30 | |||
31 | /** | ||
32 | * struct ab5500_i2c_ranges | ||
33 | * @count: the number of ranges in the list | ||
34 | * @range: the list of register ranges | ||
35 | */ | ||
36 | struct ab5500_i2c_ranges { | ||
37 | u8 nranges; | ||
38 | u8 bankid; | ||
39 | const struct ab5500_reg_range *range; | ||
40 | }; | ||
41 | |||
42 | /** | ||
43 | * struct ab5500_i2c_banks | ||
44 | * @count: the number of ranges in the list | ||
45 | * @range: the list of register ranges | ||
46 | */ | ||
47 | struct ab5500_i2c_banks { | ||
48 | u8 nbanks; | ||
49 | const struct ab5500_i2c_ranges *bank; | ||
50 | }; | ||
51 | |||
52 | /** | ||
53 | * struct ab5500_bank | ||
54 | * @slave_addr: I2C slave_addr found in AB5500 specification | ||
55 | * @name: Documentation name of the bank. For reference | ||
56 | */ | ||
57 | struct ab5500_bank { | ||
58 | u8 slave_addr; | ||
59 | const char *name; | ||
60 | }; | ||
61 | |||
62 | static const struct ab5500_bank bankinfo[AB5500_NUM_BANKS] = { | ||
63 | [AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP] = { | ||
64 | AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP, "VIT_IO_I2C_CLK_TST_OTP"}, | ||
65 | [AB5500_BANK_VDDDIG_IO_I2C_CLK_TST] = { | ||
66 | AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST, "VDDDIG_IO_I2C_CLK_TST"}, | ||
67 | [AB5500_BANK_VDENC] = {AB5500_ADDR_VDENC, "VDENC"}, | ||
68 | [AB5500_BANK_SIM_USBSIM] = {AB5500_ADDR_SIM_USBSIM, "SIM_USBSIM"}, | ||
69 | [AB5500_BANK_LED] = {AB5500_ADDR_LED, "LED"}, | ||
70 | [AB5500_BANK_ADC] = {AB5500_ADDR_ADC, "ADC"}, | ||
71 | [AB5500_BANK_RTC] = {AB5500_ADDR_RTC, "RTC"}, | ||
72 | [AB5500_BANK_STARTUP] = {AB5500_ADDR_STARTUP, "STARTUP"}, | ||
73 | [AB5500_BANK_DBI_ECI] = {AB5500_ADDR_DBI_ECI, "DBI-ECI"}, | ||
74 | [AB5500_BANK_CHG] = {AB5500_ADDR_CHG, "CHG"}, | ||
75 | [AB5500_BANK_FG_BATTCOM_ACC] = { | ||
76 | AB5500_ADDR_FG_BATTCOM_ACC, "FG_BATCOM_ACC"}, | ||
77 | [AB5500_BANK_USB] = {AB5500_ADDR_USB, "USB"}, | ||
78 | [AB5500_BANK_IT] = {AB5500_ADDR_IT, "IT"}, | ||
79 | [AB5500_BANK_VIBRA] = {AB5500_ADDR_VIBRA, "VIBRA"}, | ||
80 | [AB5500_BANK_AUDIO_HEADSETUSB] = { | ||
81 | AB5500_ADDR_AUDIO_HEADSETUSB, "AUDIO_HEADSETUSB"}, | ||
82 | }; | ||
83 | |||
84 | int ab5500_get_register_interruptible_raw(struct ab5500 *ab, u8 bank, u8 reg, | ||
85 | u8 *value); | ||
86 | int ab5500_mask_and_set_register_interruptible_raw(struct ab5500 *ab, u8 bank, | ||
87 | u8 reg, u8 bitmask, u8 bitvalues); | ||
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c index 3fcdab3eb8eb..03df422feb76 100644 --- a/drivers/mfd/mc13xxx-spi.c +++ b/drivers/mfd/mc13xxx-spi.c | |||
@@ -49,10 +49,72 @@ static struct regmap_config mc13xxx_regmap_spi_config = { | |||
49 | .reg_bits = 7, | 49 | .reg_bits = 7, |
50 | .pad_bits = 1, | 50 | .pad_bits = 1, |
51 | .val_bits = 24, | 51 | .val_bits = 24, |
52 | .write_flag_mask = 0x80, | ||
52 | 53 | ||
53 | .max_register = MC13XXX_NUMREGS, | 54 | .max_register = MC13XXX_NUMREGS, |
54 | 55 | ||
55 | .cache_type = REGCACHE_NONE, | 56 | .cache_type = REGCACHE_NONE, |
57 | .use_single_rw = 1, | ||
58 | }; | ||
59 | |||
60 | static int mc13xxx_spi_read(void *context, const void *reg, size_t reg_size, | ||
61 | void *val, size_t val_size) | ||
62 | { | ||
63 | unsigned char w[4] = { *((unsigned char *) reg), 0, 0, 0}; | ||
64 | unsigned char r[4]; | ||
65 | unsigned char *p = val; | ||
66 | struct device *dev = context; | ||
67 | struct spi_device *spi = to_spi_device(dev); | ||
68 | struct spi_transfer t = { | ||
69 | .tx_buf = w, | ||
70 | .rx_buf = r, | ||
71 | .len = 4, | ||
72 | }; | ||
73 | |||
74 | struct spi_message m; | ||
75 | int ret; | ||
76 | |||
77 | if (val_size != 3 || reg_size != 1) | ||
78 | return -ENOTSUPP; | ||
79 | |||
80 | spi_message_init(&m); | ||
81 | spi_message_add_tail(&t, &m); | ||
82 | ret = spi_sync(spi, &m); | ||
83 | |||
84 | memcpy(p, &r[1], 3); | ||
85 | |||
86 | return ret; | ||
87 | } | ||
88 | |||
89 | static int mc13xxx_spi_write(void *context, const void *data, size_t count) | ||
90 | { | ||
91 | struct device *dev = context; | ||
92 | struct spi_device *spi = to_spi_device(dev); | ||
93 | |||
94 | if (count != 4) | ||
95 | return -ENOTSUPP; | ||
96 | |||
97 | return spi_write(spi, data, count); | ||
98 | } | ||
99 | |||
100 | /* | ||
101 | * We cannot use regmap-spi generic bus implementation here. | ||
102 | * The MC13783 chip will get corrupted if CS signal is deasserted | ||
103 | * and on i.Mx31 SoC (the target SoC for MC13783 PMIC) the SPI controller | ||
104 | * has the following errata (DSPhl22960): | ||
105 | * "The CSPI negates SS when the FIFO becomes empty with | ||
106 | * SSCTL= 0. Software cannot guarantee that the FIFO will not | ||
107 | * drain because of higher priority interrupts and the | ||
108 | * non-realtime characteristics of the operating system. As a | ||
109 | * result, the SS will negate before all of the data has been | ||
110 | * transferred to/from the peripheral." | ||
111 | * We workaround this by accessing the SPI controller with a | ||
112 | * single transfert. | ||
113 | */ | ||
114 | |||
115 | static struct regmap_bus regmap_mc13xxx_bus = { | ||
116 | .write = mc13xxx_spi_write, | ||
117 | .read = mc13xxx_spi_read, | ||
56 | }; | 118 | }; |
57 | 119 | ||
58 | static int mc13xxx_spi_probe(struct spi_device *spi) | 120 | static int mc13xxx_spi_probe(struct spi_device *spi) |
@@ -73,12 +135,13 @@ static int mc13xxx_spi_probe(struct spi_device *spi) | |||
73 | 135 | ||
74 | dev_set_drvdata(&spi->dev, mc13xxx); | 136 | dev_set_drvdata(&spi->dev, mc13xxx); |
75 | spi->mode = SPI_MODE_0 | SPI_CS_HIGH; | 137 | spi->mode = SPI_MODE_0 | SPI_CS_HIGH; |
76 | spi->bits_per_word = 32; | ||
77 | 138 | ||
78 | mc13xxx->dev = &spi->dev; | 139 | mc13xxx->dev = &spi->dev; |
79 | mutex_init(&mc13xxx->lock); | 140 | mutex_init(&mc13xxx->lock); |
80 | 141 | ||
81 | mc13xxx->regmap = regmap_init_spi(spi, &mc13xxx_regmap_spi_config); | 142 | mc13xxx->regmap = regmap_init(&spi->dev, ®map_mc13xxx_bus, &spi->dev, |
143 | &mc13xxx_regmap_spi_config); | ||
144 | |||
82 | if (IS_ERR(mc13xxx->regmap)) { | 145 | if (IS_ERR(mc13xxx->regmap)) { |
83 | ret = PTR_ERR(mc13xxx->regmap); | 146 | ret = PTR_ERR(mc13xxx->regmap); |
84 | dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", | 147 | dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 7e96bb229724..41088ecbb2a9 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/gpio.h> | ||
28 | #include <plat/cpu.h> | 29 | #include <plat/cpu.h> |
29 | #include <plat/usb.h> | 30 | #include <plat/usb.h> |
30 | #include <linux/pm_runtime.h> | 31 | #include <linux/pm_runtime.h> |
@@ -500,8 +501,21 @@ static void omap_usbhs_init(struct device *dev) | |||
500 | dev_dbg(dev, "starting TI HSUSB Controller\n"); | 501 | dev_dbg(dev, "starting TI HSUSB Controller\n"); |
501 | 502 | ||
502 | pm_runtime_get_sync(dev); | 503 | pm_runtime_get_sync(dev); |
503 | spin_lock_irqsave(&omap->lock, flags); | ||
504 | 504 | ||
505 | if (pdata->ehci_data->phy_reset) { | ||
506 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
507 | gpio_request_one(pdata->ehci_data->reset_gpio_port[0], | ||
508 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
509 | |||
510 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
511 | gpio_request_one(pdata->ehci_data->reset_gpio_port[1], | ||
512 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
513 | |||
514 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
515 | udelay(10); | ||
516 | } | ||
517 | |||
518 | spin_lock_irqsave(&omap->lock, flags); | ||
505 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); | 519 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); |
506 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); | 520 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); |
507 | 521 | ||
@@ -581,9 +595,39 @@ static void omap_usbhs_init(struct device *dev) | |||
581 | } | 595 | } |
582 | 596 | ||
583 | spin_unlock_irqrestore(&omap->lock, flags); | 597 | spin_unlock_irqrestore(&omap->lock, flags); |
598 | |||
599 | if (pdata->ehci_data->phy_reset) { | ||
600 | /* Hold the PHY in RESET for enough time till | ||
601 | * PHY is settled and ready | ||
602 | */ | ||
603 | udelay(10); | ||
604 | |||
605 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
606 | gpio_set_value_cansleep | ||
607 | (pdata->ehci_data->reset_gpio_port[0], 1); | ||
608 | |||
609 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
610 | gpio_set_value_cansleep | ||
611 | (pdata->ehci_data->reset_gpio_port[1], 1); | ||
612 | } | ||
613 | |||
584 | pm_runtime_put_sync(dev); | 614 | pm_runtime_put_sync(dev); |
585 | } | 615 | } |
586 | 616 | ||
617 | static void omap_usbhs_deinit(struct device *dev) | ||
618 | { | ||
619 | struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); | ||
620 | struct usbhs_omap_platform_data *pdata = &omap->platdata; | ||
621 | |||
622 | if (pdata->ehci_data->phy_reset) { | ||
623 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
624 | gpio_free(pdata->ehci_data->reset_gpio_port[0]); | ||
625 | |||
626 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
627 | gpio_free(pdata->ehci_data->reset_gpio_port[1]); | ||
628 | } | ||
629 | } | ||
630 | |||
587 | 631 | ||
588 | /** | 632 | /** |
589 | * usbhs_omap_probe - initialize TI-based HCDs | 633 | * usbhs_omap_probe - initialize TI-based HCDs |
@@ -767,6 +811,7 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev) | |||
767 | goto end_probe; | 811 | goto end_probe; |
768 | 812 | ||
769 | err_alloc: | 813 | err_alloc: |
814 | omap_usbhs_deinit(&pdev->dev); | ||
770 | iounmap(omap->tll_base); | 815 | iounmap(omap->tll_base); |
771 | 816 | ||
772 | err_tll: | 817 | err_tll: |
@@ -818,6 +863,7 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev) | |||
818 | { | 863 | { |
819 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); | 864 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); |
820 | 865 | ||
866 | omap_usbhs_deinit(&pdev->dev); | ||
821 | iounmap(omap->tll_base); | 867 | iounmap(omap->tll_base); |
822 | iounmap(omap->uhh_base); | 868 | iounmap(omap->uhh_base); |
823 | clk_put(omap->init_60m_fclk); | 869 | clk_put(omap->init_60m_fclk); |
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 00c0aba7eba0..c4a69f193a1d 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c | |||
@@ -356,7 +356,14 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c, | |||
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | ret = regmap_add_irq_chip(palmas->regmap[1], palmas->irq, | 359 | /* Change IRQ into clear on read mode for efficiency */ |
360 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE); | ||
361 | addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL); | ||
362 | reg = PALMAS_INT_CTRL_INT_CLEAR; | ||
363 | |||
364 | regmap_write(palmas->regmap[slave], addr, reg); | ||
365 | |||
366 | ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq, | ||
360 | IRQF_ONESHOT | IRQF_TRIGGER_LOW, -1, &palmas_irq_chip, | 367 | IRQF_ONESHOT | IRQF_TRIGGER_LOW, -1, &palmas_irq_chip, |
361 | &palmas->irq_data); | 368 | &palmas->irq_data); |
362 | if (ret < 0) | 369 | if (ret < 0) |
@@ -441,6 +448,9 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c, | |||
441 | goto err; | 448 | goto err; |
442 | } | 449 | } |
443 | 450 | ||
451 | children[PALMAS_PMIC_ID].platform_data = pdata->pmic_pdata; | ||
452 | children[PALMAS_PMIC_ID].pdata_size = sizeof(*pdata->pmic_pdata); | ||
453 | |||
444 | ret = mfd_add_devices(palmas->dev, -1, | 454 | ret = mfd_add_devices(palmas->dev, -1, |
445 | children, ARRAY_SIZE(palmas_children), | 455 | children, ARRAY_SIZE(palmas_children), |
446 | NULL, regmap_irq_chip_get_base(palmas->irq_data)); | 456 | NULL, regmap_irq_chip_get_base(palmas->irq_data)); |
@@ -472,6 +482,7 @@ static const struct i2c_device_id palmas_i2c_id[] = { | |||
472 | { "twl6035", }, | 482 | { "twl6035", }, |
473 | { "twl6037", }, | 483 | { "twl6037", }, |
474 | { "tps65913", }, | 484 | { "tps65913", }, |
485 | { /* end */ } | ||
475 | }; | 486 | }; |
476 | MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); | 487 | MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); |
477 | 488 | ||
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 7de13891e49e..783fcd7365bc 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -1147,7 +1147,7 @@ static int mei_pci_resume(struct device *device) | |||
1147 | err = request_threaded_irq(pdev->irq, | 1147 | err = request_threaded_irq(pdev->irq, |
1148 | NULL, | 1148 | NULL, |
1149 | mei_interrupt_thread_handler, | 1149 | mei_interrupt_thread_handler, |
1150 | 0, mei_driver_name, dev); | 1150 | IRQF_ONESHOT, mei_driver_name, dev); |
1151 | else | 1151 | else |
1152 | err = request_threaded_irq(pdev->irq, | 1152 | err = request_threaded_irq(pdev->irq, |
1153 | mei_interrupt_quick_handler, | 1153 | mei_interrupt_quick_handler, |
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index 17bbacb1b4b1..87b251ab6ec5 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
@@ -452,9 +452,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
452 | 452 | ||
453 | if (msg->activate_gru_mq_desc_gpa != | 453 | if (msg->activate_gru_mq_desc_gpa != |
454 | part_uv->activate_gru_mq_desc_gpa) { | 454 | part_uv->activate_gru_mq_desc_gpa) { |
455 | spin_lock_irqsave(&part_uv->flags_lock, irq_flags); | 455 | spin_lock(&part_uv->flags_lock); |
456 | part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV; | 456 | part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV; |
457 | spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags); | 457 | spin_unlock(&part_uv->flags_lock); |
458 | part_uv->activate_gru_mq_desc_gpa = | 458 | part_uv->activate_gru_mq_desc_gpa = |
459 | msg->activate_gru_mq_desc_gpa; | 459 | msg->activate_gru_mq_desc_gpa; |
460 | } | 460 | } |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index dd2d374dcc7a..276d21ce6bc1 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -554,7 +554,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
554 | struct mmc_request mrq = {NULL}; | 554 | struct mmc_request mrq = {NULL}; |
555 | struct mmc_command cmd = {0}; | 555 | struct mmc_command cmd = {0}; |
556 | struct mmc_data data = {0}; | 556 | struct mmc_data data = {0}; |
557 | unsigned int timeout_us; | ||
558 | 557 | ||
559 | struct scatterlist sg; | 558 | struct scatterlist sg; |
560 | 559 | ||
@@ -574,23 +573,12 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
574 | cmd.arg = 0; | 573 | cmd.arg = 0; |
575 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; | 574 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; |
576 | 575 | ||
577 | data.timeout_ns = card->csd.tacc_ns * 100; | ||
578 | data.timeout_clks = card->csd.tacc_clks * 100; | ||
579 | |||
580 | timeout_us = data.timeout_ns / 1000; | ||
581 | timeout_us += data.timeout_clks * 1000 / | ||
582 | (card->host->ios.clock / 1000); | ||
583 | |||
584 | if (timeout_us > 100000) { | ||
585 | data.timeout_ns = 100000000; | ||
586 | data.timeout_clks = 0; | ||
587 | } | ||
588 | |||
589 | data.blksz = 4; | 576 | data.blksz = 4; |
590 | data.blocks = 1; | 577 | data.blocks = 1; |
591 | data.flags = MMC_DATA_READ; | 578 | data.flags = MMC_DATA_READ; |
592 | data.sg = &sg; | 579 | data.sg = &sg; |
593 | data.sg_len = 1; | 580 | data.sg_len = 1; |
581 | mmc_set_data_timeout(&data, card); | ||
594 | 582 | ||
595 | mrq.cmd = &cmd; | 583 | mrq.cmd = &cmd; |
596 | mrq.data = &data; | 584 | mrq.data = &data; |
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index f13e38deceac..8f5dc08d6598 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c | |||
@@ -50,8 +50,8 @@ int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio) | |||
50 | goto egpioreq; | 50 | goto egpioreq; |
51 | 51 | ||
52 | ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt, | 52 | ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt, |
53 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 53 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | |
54 | cd->label, host); | 54 | IRQF_ONESHOT, cd->label, host); |
55 | if (ret < 0) | 55 | if (ret < 0) |
56 | goto eirqreq; | 56 | goto eirqreq; |
57 | 57 | ||
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 258b203397aa..4f4489aa6bae 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -717,10 +717,6 @@ static int mmc_select_powerclass(struct mmc_card *card, | |||
717 | card->ext_csd.generic_cmd6_time); | 717 | card->ext_csd.generic_cmd6_time); |
718 | } | 718 | } |
719 | 719 | ||
720 | if (err) | ||
721 | pr_err("%s: power class selection for ext_csd_bus_width %d" | ||
722 | " failed\n", mmc_hostname(card->host), bus_width); | ||
723 | |||
724 | return err; | 720 | return err; |
725 | } | 721 | } |
726 | 722 | ||
@@ -1104,7 +1100,9 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1104 | EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; | 1100 | EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; |
1105 | err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); | 1101 | err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); |
1106 | if (err) | 1102 | if (err) |
1107 | goto err; | 1103 | pr_warning("%s: power class selection to bus width %d" |
1104 | " failed\n", mmc_hostname(card->host), | ||
1105 | 1 << bus_width); | ||
1108 | } | 1106 | } |
1109 | 1107 | ||
1110 | /* | 1108 | /* |
@@ -1136,7 +1134,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1136 | err = mmc_select_powerclass(card, ext_csd_bits[idx][0], | 1134 | err = mmc_select_powerclass(card, ext_csd_bits[idx][0], |
1137 | ext_csd); | 1135 | ext_csd); |
1138 | if (err) | 1136 | if (err) |
1139 | goto err; | 1137 | pr_warning("%s: power class selection to " |
1138 | "bus width %d failed\n", | ||
1139 | mmc_hostname(card->host), | ||
1140 | 1 << bus_width); | ||
1140 | 1141 | ||
1141 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1142 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
1142 | EXT_CSD_BUS_WIDTH, | 1143 | EXT_CSD_BUS_WIDTH, |
@@ -1164,7 +1165,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1164 | err = mmc_select_powerclass(card, ext_csd_bits[idx][1], | 1165 | err = mmc_select_powerclass(card, ext_csd_bits[idx][1], |
1165 | ext_csd); | 1166 | ext_csd); |
1166 | if (err) | 1167 | if (err) |
1167 | goto err; | 1168 | pr_warning("%s: power class selection to " |
1169 | "bus width %d ddr %d failed\n", | ||
1170 | mmc_hostname(card->host), | ||
1171 | 1 << bus_width, ddr); | ||
1168 | 1172 | ||
1169 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1173 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
1170 | EXT_CSD_BUS_WIDTH, | 1174 | EXT_CSD_BUS_WIDTH, |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 9a7a60aeb19e..389a3eedfc24 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -85,7 +85,6 @@ | |||
85 | #define BRR_ENABLE (1 << 5) | 85 | #define BRR_ENABLE (1 << 5) |
86 | #define DTO_ENABLE (1 << 20) | 86 | #define DTO_ENABLE (1 << 20) |
87 | #define INIT_STREAM (1 << 1) | 87 | #define INIT_STREAM (1 << 1) |
88 | #define ACEN_ACMD12 (1 << 2) | ||
89 | #define DP_SELECT (1 << 21) | 88 | #define DP_SELECT (1 << 21) |
90 | #define DDIR (1 << 4) | 89 | #define DDIR (1 << 4) |
91 | #define DMA_EN 0x1 | 90 | #define DMA_EN 0x1 |
@@ -117,7 +116,6 @@ | |||
117 | #define OMAP_MMC_MAX_CLOCK 52000000 | 116 | #define OMAP_MMC_MAX_CLOCK 52000000 |
118 | #define DRIVER_NAME "omap_hsmmc" | 117 | #define DRIVER_NAME "omap_hsmmc" |
119 | 118 | ||
120 | #define AUTO_CMD12 (1 << 0) /* Auto CMD12 support */ | ||
121 | /* | 119 | /* |
122 | * One controller can have multiple slots, like on some omap boards using | 120 | * One controller can have multiple slots, like on some omap boards using |
123 | * omap.c controller driver. Luckily this is not currently done on any known | 121 | * omap.c controller driver. Luckily this is not currently done on any known |
@@ -177,7 +175,6 @@ struct omap_hsmmc_host { | |||
177 | int reqs_blocked; | 175 | int reqs_blocked; |
178 | int use_reg; | 176 | int use_reg; |
179 | int req_in_progress; | 177 | int req_in_progress; |
180 | unsigned int flags; | ||
181 | struct omap_hsmmc_next next_data; | 178 | struct omap_hsmmc_next next_data; |
182 | 179 | ||
183 | struct omap_mmc_platform_data *pdata; | 180 | struct omap_mmc_platform_data *pdata; |
@@ -773,8 +770,6 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd, | |||
773 | cmdtype = 0x3; | 770 | cmdtype = 0x3; |
774 | 771 | ||
775 | cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22); | 772 | cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22); |
776 | if ((host->flags & AUTO_CMD12) && mmc_op_multi(cmd->opcode)) | ||
777 | cmdreg |= ACEN_ACMD12; | ||
778 | 773 | ||
779 | if (data) { | 774 | if (data) { |
780 | cmdreg |= DP_SELECT | MSBS | BCE; | 775 | cmdreg |= DP_SELECT | MSBS | BCE; |
@@ -847,14 +842,11 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct mmc_data *data) | |||
847 | else | 842 | else |
848 | data->bytes_xfered = 0; | 843 | data->bytes_xfered = 0; |
849 | 844 | ||
850 | if (data->stop && ((!(host->flags & AUTO_CMD12)) || data->error)) { | 845 | if (!data->stop) { |
851 | omap_hsmmc_start_command(host, data->stop, NULL); | ||
852 | } else { | ||
853 | if (data->stop) | ||
854 | data->stop->resp[0] = OMAP_HSMMC_READ(host->base, | ||
855 | RSP76); | ||
856 | omap_hsmmc_request_done(host, data->mrq); | 846 | omap_hsmmc_request_done(host, data->mrq); |
847 | return; | ||
857 | } | 848 | } |
849 | omap_hsmmc_start_command(host, data->stop, NULL); | ||
858 | } | 850 | } |
859 | 851 | ||
860 | /* | 852 | /* |
@@ -1859,7 +1851,6 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev) | |||
1859 | host->mapbase = res->start + pdata->reg_offset; | 1851 | host->mapbase = res->start + pdata->reg_offset; |
1860 | host->base = ioremap(host->mapbase, SZ_4K); | 1852 | host->base = ioremap(host->mapbase, SZ_4K); |
1861 | host->power_mode = MMC_POWER_OFF; | 1853 | host->power_mode = MMC_POWER_OFF; |
1862 | host->flags = AUTO_CMD12; | ||
1863 | host->next_data.cookie = 1; | 1854 | host->next_data.cookie = 1; |
1864 | 1855 | ||
1865 | platform_set_drvdata(pdev, host); | 1856 | platform_set_drvdata(pdev, host); |
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c index 41371ba1a811..f3f6cfedd69e 100644 --- a/drivers/mtd/nand/cafe_nand.c +++ b/drivers/mtd/nand/cafe_nand.c | |||
@@ -102,7 +102,7 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; | |||
102 | static int cafe_device_ready(struct mtd_info *mtd) | 102 | static int cafe_device_ready(struct mtd_info *mtd) |
103 | { | 103 | { |
104 | struct cafe_priv *cafe = mtd->priv; | 104 | struct cafe_priv *cafe = mtd->priv; |
105 | int result = !!(cafe_readl(cafe, NAND_STATUS) | 0x40000000); | 105 | int result = !!(cafe_readl(cafe, NAND_STATUS) & 0x40000000); |
106 | uint32_t irqs = cafe_readl(cafe, NAND_IRQ); | 106 | uint32_t irqs = cafe_readl(cafe, NAND_IRQ); |
107 | 107 | ||
108 | cafe_writel(cafe, irqs, NAND_IRQ); | 108 | cafe_writel(cafe, irqs, NAND_IRQ); |
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index a05b7b444d4f..a6cad5caba78 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
@@ -920,12 +920,12 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip, | |||
920 | */ | 920 | */ |
921 | memset(chip->oob_poi, ~0, mtd->oobsize); | 921 | memset(chip->oob_poi, ~0, mtd->oobsize); |
922 | chip->oob_poi[0] = ((uint8_t *) auxiliary_virt)[0]; | 922 | chip->oob_poi[0] = ((uint8_t *) auxiliary_virt)[0]; |
923 | |||
924 | read_page_swap_end(this, buf, mtd->writesize, | ||
925 | this->payload_virt, this->payload_phys, | ||
926 | nfc_geo->payload_size, | ||
927 | payload_virt, payload_phys); | ||
928 | } | 923 | } |
924 | |||
925 | read_page_swap_end(this, buf, mtd->writesize, | ||
926 | this->payload_virt, this->payload_phys, | ||
927 | nfc_geo->payload_size, | ||
928 | payload_virt, payload_phys); | ||
929 | exit_nfc: | 929 | exit_nfc: |
930 | return ret; | 930 | return ret; |
931 | } | 931 | } |
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index c58e6a93f445..6acc790c2fbb 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -273,6 +273,26 @@ static struct nand_ecclayout nandv2_hw_eccoob_4k = { | |||
273 | 273 | ||
274 | static const char *part_probes[] = { "RedBoot", "cmdlinepart", "ofpart", NULL }; | 274 | static const char *part_probes[] = { "RedBoot", "cmdlinepart", "ofpart", NULL }; |
275 | 275 | ||
276 | static void memcpy32_fromio(void *trg, const void __iomem *src, size_t size) | ||
277 | { | ||
278 | int i; | ||
279 | u32 *t = trg; | ||
280 | const __iomem u32 *s = src; | ||
281 | |||
282 | for (i = 0; i < (size >> 2); i++) | ||
283 | *t++ = __raw_readl(s++); | ||
284 | } | ||
285 | |||
286 | static void memcpy32_toio(void __iomem *trg, const void *src, int size) | ||
287 | { | ||
288 | int i; | ||
289 | u32 __iomem *t = trg; | ||
290 | const u32 *s = src; | ||
291 | |||
292 | for (i = 0; i < (size >> 2); i++) | ||
293 | __raw_writel(*s++, t++); | ||
294 | } | ||
295 | |||
276 | static int check_int_v3(struct mxc_nand_host *host) | 296 | static int check_int_v3(struct mxc_nand_host *host) |
277 | { | 297 | { |
278 | uint32_t tmp; | 298 | uint32_t tmp; |
@@ -519,7 +539,7 @@ static void send_read_id_v3(struct mxc_nand_host *host) | |||
519 | 539 | ||
520 | wait_op_done(host, true); | 540 | wait_op_done(host, true); |
521 | 541 | ||
522 | memcpy_fromio(host->data_buf, host->main_area0, 16); | 542 | memcpy32_fromio(host->data_buf, host->main_area0, 16); |
523 | } | 543 | } |
524 | 544 | ||
525 | /* Request the NANDFC to perform a read of the NAND device ID. */ | 545 | /* Request the NANDFC to perform a read of the NAND device ID. */ |
@@ -535,7 +555,7 @@ static void send_read_id_v1_v2(struct mxc_nand_host *host) | |||
535 | /* Wait for operation to complete */ | 555 | /* Wait for operation to complete */ |
536 | wait_op_done(host, true); | 556 | wait_op_done(host, true); |
537 | 557 | ||
538 | memcpy_fromio(host->data_buf, host->main_area0, 16); | 558 | memcpy32_fromio(host->data_buf, host->main_area0, 16); |
539 | 559 | ||
540 | if (this->options & NAND_BUSWIDTH_16) { | 560 | if (this->options & NAND_BUSWIDTH_16) { |
541 | /* compress the ID info */ | 561 | /* compress the ID info */ |
@@ -797,16 +817,16 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom) | |||
797 | 817 | ||
798 | if (bfrom) { | 818 | if (bfrom) { |
799 | for (i = 0; i < n - 1; i++) | 819 | for (i = 0; i < n - 1; i++) |
800 | memcpy_fromio(d + i * j, s + i * t, j); | 820 | memcpy32_fromio(d + i * j, s + i * t, j); |
801 | 821 | ||
802 | /* the last section */ | 822 | /* the last section */ |
803 | memcpy_fromio(d + i * j, s + i * t, mtd->oobsize - i * j); | 823 | memcpy32_fromio(d + i * j, s + i * t, mtd->oobsize - i * j); |
804 | } else { | 824 | } else { |
805 | for (i = 0; i < n - 1; i++) | 825 | for (i = 0; i < n - 1; i++) |
806 | memcpy_toio(&s[i * t], &d[i * j], j); | 826 | memcpy32_toio(&s[i * t], &d[i * j], j); |
807 | 827 | ||
808 | /* the last section */ | 828 | /* the last section */ |
809 | memcpy_toio(&s[i * t], &d[i * j], mtd->oobsize - i * j); | 829 | memcpy32_toio(&s[i * t], &d[i * j], mtd->oobsize - i * j); |
810 | } | 830 | } |
811 | } | 831 | } |
812 | 832 | ||
@@ -1070,7 +1090,8 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
1070 | 1090 | ||
1071 | host->devtype_data->send_page(mtd, NFC_OUTPUT); | 1091 | host->devtype_data->send_page(mtd, NFC_OUTPUT); |
1072 | 1092 | ||
1073 | memcpy_fromio(host->data_buf, host->main_area0, mtd->writesize); | 1093 | memcpy32_fromio(host->data_buf, host->main_area0, |
1094 | mtd->writesize); | ||
1074 | copy_spare(mtd, true); | 1095 | copy_spare(mtd, true); |
1075 | break; | 1096 | break; |
1076 | 1097 | ||
@@ -1086,7 +1107,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
1086 | break; | 1107 | break; |
1087 | 1108 | ||
1088 | case NAND_CMD_PAGEPROG: | 1109 | case NAND_CMD_PAGEPROG: |
1089 | memcpy_toio(host->main_area0, host->data_buf, mtd->writesize); | 1110 | memcpy32_toio(host->main_area0, host->data_buf, mtd->writesize); |
1090 | copy_spare(mtd, false); | 1111 | copy_spare(mtd, false); |
1091 | host->devtype_data->send_page(mtd, NFC_INPUT); | 1112 | host->devtype_data->send_page(mtd, NFC_INPUT); |
1092 | host->devtype_data->send_cmd(host, command, true); | 1113 | host->devtype_data->send_cmd(host, command, true); |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index d47586cf64ce..a11253a0fcab 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -3501,6 +3501,13 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
3501 | /* propagate ecc info to mtd_info */ | 3501 | /* propagate ecc info to mtd_info */ |
3502 | mtd->ecclayout = chip->ecc.layout; | 3502 | mtd->ecclayout = chip->ecc.layout; |
3503 | mtd->ecc_strength = chip->ecc.strength; | 3503 | mtd->ecc_strength = chip->ecc.strength; |
3504 | /* | ||
3505 | * Initialize bitflip_threshold to its default prior scan_bbt() call. | ||
3506 | * scan_bbt() might invoke mtd_read(), thus bitflip_threshold must be | ||
3507 | * properly set. | ||
3508 | */ | ||
3509 | if (!mtd->bitflip_threshold) | ||
3510 | mtd->bitflip_threshold = mtd->ecc_strength; | ||
3504 | 3511 | ||
3505 | /* Check, if we should skip the bad block table scan */ | 3512 | /* Check, if we should skip the bad block table scan */ |
3506 | if (chip->options & NAND_SKIP_BBTSCAN) | 3513 | if (chip->options & NAND_SKIP_BBTSCAN) |
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 6cc8fbfabb8e..cf0cd3146817 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <linux/vmalloc.h> | 30 | #include <linux/vmalloc.h> |
31 | #include <asm/div64.h> | 31 | #include <linux/math64.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
@@ -546,12 +546,6 @@ static char *get_partition_name(int i) | |||
546 | return kstrdup(buf, GFP_KERNEL); | 546 | return kstrdup(buf, GFP_KERNEL); |
547 | } | 547 | } |
548 | 548 | ||
549 | static uint64_t divide(uint64_t n, uint32_t d) | ||
550 | { | ||
551 | do_div(n, d); | ||
552 | return n; | ||
553 | } | ||
554 | |||
555 | /* | 549 | /* |
556 | * Initialize the nandsim structure. | 550 | * Initialize the nandsim structure. |
557 | * | 551 | * |
@@ -580,7 +574,7 @@ static int init_nandsim(struct mtd_info *mtd) | |||
580 | ns->geom.oobsz = mtd->oobsize; | 574 | ns->geom.oobsz = mtd->oobsize; |
581 | ns->geom.secsz = mtd->erasesize; | 575 | ns->geom.secsz = mtd->erasesize; |
582 | ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; | 576 | ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; |
583 | ns->geom.pgnum = divide(ns->geom.totsz, ns->geom.pgsz); | 577 | ns->geom.pgnum = div_u64(ns->geom.totsz, ns->geom.pgsz); |
584 | ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz; | 578 | ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz; |
585 | ns->geom.secshift = ffs(ns->geom.secsz) - 1; | 579 | ns->geom.secshift = ffs(ns->geom.secsz) - 1; |
586 | ns->geom.pgshift = chip->page_shift; | 580 | ns->geom.pgshift = chip->page_shift; |
@@ -921,7 +915,7 @@ static int setup_wear_reporting(struct mtd_info *mtd) | |||
921 | 915 | ||
922 | if (!rptwear) | 916 | if (!rptwear) |
923 | return 0; | 917 | return 0; |
924 | wear_eb_count = divide(mtd->size, mtd->erasesize); | 918 | wear_eb_count = div_u64(mtd->size, mtd->erasesize); |
925 | mem = wear_eb_count * sizeof(unsigned long); | 919 | mem = wear_eb_count * sizeof(unsigned long); |
926 | if (mem / sizeof(unsigned long) != wear_eb_count) { | 920 | if (mem / sizeof(unsigned long) != wear_eb_count) { |
927 | NS_ERR("Too many erase blocks for wear reporting\n"); | 921 | NS_ERR("Too many erase blocks for wear reporting\n"); |
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index 09d4f8d9d592..7c1380305219 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -264,7 +264,7 @@ static struct dentry *dfs_rootdir; | |||
264 | */ | 264 | */ |
265 | int ubi_debugfs_init(void) | 265 | int ubi_debugfs_init(void) |
266 | { | 266 | { |
267 | if (!IS_ENABLED(DEBUG_FS)) | 267 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) |
268 | return 0; | 268 | return 0; |
269 | 269 | ||
270 | dfs_rootdir = debugfs_create_dir("ubi", NULL); | 270 | dfs_rootdir = debugfs_create_dir("ubi", NULL); |
@@ -284,7 +284,7 @@ int ubi_debugfs_init(void) | |||
284 | */ | 284 | */ |
285 | void ubi_debugfs_exit(void) | 285 | void ubi_debugfs_exit(void) |
286 | { | 286 | { |
287 | if (IS_ENABLED(DEBUG_FS)) | 287 | if (IS_ENABLED(CONFIG_DEBUG_FS)) |
288 | debugfs_remove(dfs_rootdir); | 288 | debugfs_remove(dfs_rootdir); |
289 | } | 289 | } |
290 | 290 | ||
@@ -407,7 +407,7 @@ int ubi_debugfs_init_dev(struct ubi_device *ubi) | |||
407 | struct dentry *dent; | 407 | struct dentry *dent; |
408 | struct ubi_debug_info *d = ubi->dbg; | 408 | struct ubi_debug_info *d = ubi->dbg; |
409 | 409 | ||
410 | if (!IS_ENABLED(DEBUG_FS)) | 410 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) |
411 | return 0; | 411 | return 0; |
412 | 412 | ||
413 | n = snprintf(d->dfs_dir_name, UBI_DFS_DIR_LEN + 1, UBI_DFS_DIR_NAME, | 413 | n = snprintf(d->dfs_dir_name, UBI_DFS_DIR_LEN + 1, UBI_DFS_DIR_NAME, |
@@ -477,6 +477,6 @@ out: | |||
477 | */ | 477 | */ |
478 | void ubi_debugfs_exit_dev(struct ubi_device *ubi) | 478 | void ubi_debugfs_exit_dev(struct ubi_device *ubi) |
479 | { | 479 | { |
480 | if (IS_ENABLED(DEBUG_FS)) | 480 | if (IS_ENABLED(CONFIG_DEBUG_FS)) |
481 | debugfs_remove_recursive(ubi->dbg->dfs_dir); | 481 | debugfs_remove_recursive(ubi->dbg->dfs_dir); |
482 | } | 482 | } |
diff --git a/drivers/net/bonding/bond_debugfs.c b/drivers/net/bonding/bond_debugfs.c index 3680aa251dea..2cf084eb9d52 100644 --- a/drivers/net/bonding/bond_debugfs.c +++ b/drivers/net/bonding/bond_debugfs.c | |||
@@ -6,7 +6,7 @@ | |||
6 | #include "bonding.h" | 6 | #include "bonding.h" |
7 | #include "bond_alb.h" | 7 | #include "bond_alb.h" |
8 | 8 | ||
9 | #ifdef CONFIG_DEBUG_FS | 9 | #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_NET_NS) |
10 | 10 | ||
11 | #include <linux/debugfs.h> | 11 | #include <linux/debugfs.h> |
12 | #include <linux/seq_file.h> | 12 | #include <linux/seq_file.h> |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b9c2ae62166d..2ee76993f052 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3227,6 +3227,12 @@ static int bond_master_netdev_event(unsigned long event, | |||
3227 | switch (event) { | 3227 | switch (event) { |
3228 | case NETDEV_CHANGENAME: | 3228 | case NETDEV_CHANGENAME: |
3229 | return bond_event_changename(event_bond); | 3229 | return bond_event_changename(event_bond); |
3230 | case NETDEV_UNREGISTER: | ||
3231 | bond_remove_proc_entry(event_bond); | ||
3232 | break; | ||
3233 | case NETDEV_REGISTER: | ||
3234 | bond_create_proc_entry(event_bond); | ||
3235 | break; | ||
3230 | default: | 3236 | default: |
3231 | break; | 3237 | break; |
3232 | } | 3238 | } |
@@ -4411,8 +4417,6 @@ static void bond_uninit(struct net_device *bond_dev) | |||
4411 | 4417 | ||
4412 | bond_work_cancel_all(bond); | 4418 | bond_work_cancel_all(bond); |
4413 | 4419 | ||
4414 | bond_remove_proc_entry(bond); | ||
4415 | |||
4416 | bond_debug_unregister(bond); | 4420 | bond_debug_unregister(bond); |
4417 | 4421 | ||
4418 | __hw_addr_flush(&bond->mc_list); | 4422 | __hw_addr_flush(&bond->mc_list); |
@@ -4814,7 +4818,6 @@ static int bond_init(struct net_device *bond_dev) | |||
4814 | 4818 | ||
4815 | bond_set_lockdep_class(bond_dev); | 4819 | bond_set_lockdep_class(bond_dev); |
4816 | 4820 | ||
4817 | bond_create_proc_entry(bond); | ||
4818 | list_add_tail(&bond->bond_list, &bn->dev_list); | 4821 | list_add_tail(&bond->bond_list, &bn->dev_list); |
4819 | 4822 | ||
4820 | bond_prepare_sysfs_group(bond); | 4823 | bond_prepare_sysfs_group(bond); |
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index ad284baafe87..3cea38d37344 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -150,14 +150,25 @@ static void bond_info_show_master(struct seq_file *seq) | |||
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | static const char *bond_slave_link_status(s8 link) | ||
154 | { | ||
155 | static const char * const status[] = { | ||
156 | [BOND_LINK_UP] = "up", | ||
157 | [BOND_LINK_FAIL] = "going down", | ||
158 | [BOND_LINK_DOWN] = "down", | ||
159 | [BOND_LINK_BACK] = "going back", | ||
160 | }; | ||
161 | |||
162 | return status[link]; | ||
163 | } | ||
164 | |||
153 | static void bond_info_show_slave(struct seq_file *seq, | 165 | static void bond_info_show_slave(struct seq_file *seq, |
154 | const struct slave *slave) | 166 | const struct slave *slave) |
155 | { | 167 | { |
156 | struct bonding *bond = seq->private; | 168 | struct bonding *bond = seq->private; |
157 | 169 | ||
158 | seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); | 170 | seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); |
159 | seq_printf(seq, "MII Status: %s\n", | 171 | seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link)); |
160 | (slave->link == BOND_LINK_UP) ? "up" : "down"); | ||
161 | if (slave->speed == SPEED_UNKNOWN) | 172 | if (slave->speed == SPEED_UNKNOWN) |
162 | seq_printf(seq, "Speed: %s\n", "Unknown"); | 173 | seq_printf(seq, "Speed: %s\n", "Unknown"); |
163 | else | 174 | else |
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c index 1520814c77c7..4a27adb7ae67 100644 --- a/drivers/net/caif/caif_hsi.c +++ b/drivers/net/caif/caif_hsi.c | |||
@@ -693,8 +693,6 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi) | |||
693 | */ | 693 | */ |
694 | memcpy(rx_buf, (u8 *)piggy_desc, | 694 | memcpy(rx_buf, (u8 *)piggy_desc, |
695 | CFHSI_DESC_SHORT_SZ); | 695 | CFHSI_DESC_SHORT_SZ); |
696 | /* Mark no embedded frame here */ | ||
697 | piggy_desc->offset = 0; | ||
698 | if (desc_pld_len == -EPROTO) | 696 | if (desc_pld_len == -EPROTO) |
699 | goto out_of_sync; | 697 | goto out_of_sync; |
700 | } | 698 | } |
@@ -737,6 +735,8 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi) | |||
737 | /* Extract any payload in piggyback descriptor. */ | 735 | /* Extract any payload in piggyback descriptor. */ |
738 | if (cfhsi_rx_desc(piggy_desc, cfhsi) < 0) | 736 | if (cfhsi_rx_desc(piggy_desc, cfhsi) < 0) |
739 | goto out_of_sync; | 737 | goto out_of_sync; |
738 | /* Mark no embedded frame after extracting it */ | ||
739 | piggy_desc->offset = 0; | ||
740 | } | 740 | } |
741 | } | 741 | } |
742 | 742 | ||
@@ -1178,6 +1178,7 @@ int cfhsi_probe(struct platform_device *pdev) | |||
1178 | dev_err(&ndev->dev, "%s: Registration error: %d.\n", | 1178 | dev_err(&ndev->dev, "%s: Registration error: %d.\n", |
1179 | __func__, res); | 1179 | __func__, res); |
1180 | free_netdev(ndev); | 1180 | free_netdev(ndev); |
1181 | return -ENODEV; | ||
1181 | } | 1182 | } |
1182 | /* Add CAIF HSI device to list. */ | 1183 | /* Add CAIF HSI device to list. */ |
1183 | spin_lock(&cfhsi_list_lock); | 1184 | spin_lock(&cfhsi_list_lock); |
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 8dc84d66eea1..86cd532c78f9 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
@@ -590,8 +590,8 @@ static void c_can_chip_config(struct net_device *dev) | |||
590 | priv->write_reg(priv, &priv->regs->control, | 590 | priv->write_reg(priv, &priv->regs->control, |
591 | CONTROL_ENABLE_AR); | 591 | CONTROL_ENABLE_AR); |
592 | 592 | ||
593 | if (priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY & | 593 | if ((priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) && |
594 | CAN_CTRLMODE_LOOPBACK)) { | 594 | (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)) { |
595 | /* loopback + silent mode : useful for hot self-test */ | 595 | /* loopback + silent mode : useful for hot self-test */ |
596 | priv->write_reg(priv, &priv->regs->control, CONTROL_EIE | | 596 | priv->write_reg(priv, &priv->regs->control, CONTROL_EIE | |
597 | CONTROL_SIE | CONTROL_IE | CONTROL_TEST); | 597 | CONTROL_SIE | CONTROL_IE | CONTROL_TEST); |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 38c0690df5c8..81d474102378 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -939,12 +939,12 @@ static int __devinit flexcan_probe(struct platform_device *pdev) | |||
939 | return PTR_ERR(pinctrl); | 939 | return PTR_ERR(pinctrl); |
940 | 940 | ||
941 | if (pdev->dev.of_node) { | 941 | if (pdev->dev.of_node) { |
942 | const u32 *clock_freq_p; | 942 | const __be32 *clock_freq_p; |
943 | 943 | ||
944 | clock_freq_p = of_get_property(pdev->dev.of_node, | 944 | clock_freq_p = of_get_property(pdev->dev.of_node, |
945 | "clock-frequency", NULL); | 945 | "clock-frequency", NULL); |
946 | if (clock_freq_p) | 946 | if (clock_freq_p) |
947 | clock_freq = *clock_freq_p; | 947 | clock_freq = be32_to_cpup(clock_freq_p); |
948 | } | 948 | } |
949 | 949 | ||
950 | if (!clock_freq) { | 950 | if (!clock_freq) { |
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 9cc15701101b..1f78b63d5efe 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -261,7 +261,6 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter) | |||
261 | if ((phy_data & BMSR_LSTATUS) == 0) { | 261 | if ((phy_data & BMSR_LSTATUS) == 0) { |
262 | /* link down */ | 262 | /* link down */ |
263 | netif_carrier_off(netdev); | 263 | netif_carrier_off(netdev); |
264 | netif_stop_queue(netdev); | ||
265 | hw->hibernate = true; | 264 | hw->hibernate = true; |
266 | if (atl1c_reset_mac(hw) != 0) | 265 | if (atl1c_reset_mac(hw) != 0) |
267 | if (netif_msg_hw(adapter)) | 266 | if (netif_msg_hw(adapter)) |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 46b8b7d81633..d09c6b583d17 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
@@ -656,7 +656,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
656 | dma_unmap_single(bp->sdev->dma_dev, mapping, | 656 | dma_unmap_single(bp->sdev->dma_dev, mapping, |
657 | RX_PKT_BUF_SZ, DMA_FROM_DEVICE); | 657 | RX_PKT_BUF_SZ, DMA_FROM_DEVICE); |
658 | dev_kfree_skb_any(skb); | 658 | dev_kfree_skb_any(skb); |
659 | skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA); | 659 | skb = alloc_skb(RX_PKT_BUF_SZ, GFP_ATOMIC | GFP_DMA); |
660 | if (skb == NULL) | 660 | if (skb == NULL) |
661 | return -ENOMEM; | 661 | return -ENOMEM; |
662 | mapping = dma_map_single(bp->sdev->dma_dev, skb->data, | 662 | mapping = dma_map_single(bp->sdev->dma_dev, skb->data, |
@@ -967,7 +967,7 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
967 | dma_unmap_single(bp->sdev->dma_dev, mapping, len, | 967 | dma_unmap_single(bp->sdev->dma_dev, mapping, len, |
968 | DMA_TO_DEVICE); | 968 | DMA_TO_DEVICE); |
969 | 969 | ||
970 | bounce_skb = __netdev_alloc_skb(dev, len, GFP_ATOMIC | GFP_DMA); | 970 | bounce_skb = alloc_skb(len, GFP_ATOMIC | GFP_DMA); |
971 | if (!bounce_skb) | 971 | if (!bounce_skb) |
972 | goto err_out; | 972 | goto err_out; |
973 | 973 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index ac7b74488531..1fa4927a45b1 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -5372,7 +5372,7 @@ bnx2_free_tx_skbs(struct bnx2 *bp) | |||
5372 | int k, last; | 5372 | int k, last; |
5373 | 5373 | ||
5374 | if (skb == NULL) { | 5374 | if (skb == NULL) { |
5375 | j++; | 5375 | j = NEXT_TX_BD(j); |
5376 | continue; | 5376 | continue; |
5377 | } | 5377 | } |
5378 | 5378 | ||
@@ -5384,8 +5384,8 @@ bnx2_free_tx_skbs(struct bnx2 *bp) | |||
5384 | tx_buf->skb = NULL; | 5384 | tx_buf->skb = NULL; |
5385 | 5385 | ||
5386 | last = tx_buf->nr_frags; | 5386 | last = tx_buf->nr_frags; |
5387 | j++; | 5387 | j = NEXT_TX_BD(j); |
5388 | for (k = 0; k < last; k++, j++) { | 5388 | for (k = 0; k < last; k++, j = NEXT_TX_BD(j)) { |
5389 | tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)]; | 5389 | tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)]; |
5390 | dma_unmap_page(&bp->pdev->dev, | 5390 | dma_unmap_page(&bp->pdev->dev, |
5391 | dma_unmap_addr(tx_buf, mapping), | 5391 | dma_unmap_addr(tx_buf, mapping), |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index cbc56f274e0c..8098eea9704d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -190,7 +190,7 @@ int bnx2x_tx_int(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata) | |||
190 | 190 | ||
191 | if ((netif_tx_queue_stopped(txq)) && | 191 | if ((netif_tx_queue_stopped(txq)) && |
192 | (bp->state == BNX2X_STATE_OPEN) && | 192 | (bp->state == BNX2X_STATE_OPEN) && |
193 | (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3)) | 193 | (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4)) |
194 | netif_tx_wake_queue(txq); | 194 | netif_tx_wake_queue(txq); |
195 | 195 | ||
196 | __netif_tx_unlock(txq); | 196 | __netif_tx_unlock(txq); |
@@ -2516,8 +2516,6 @@ int bnx2x_poll(struct napi_struct *napi, int budget) | |||
2516 | /* we split the first BD into headers and data BDs | 2516 | /* we split the first BD into headers and data BDs |
2517 | * to ease the pain of our fellow microcode engineers | 2517 | * to ease the pain of our fellow microcode engineers |
2518 | * we use one mapping for both BDs | 2518 | * we use one mapping for both BDs |
2519 | * So far this has only been observed to happen | ||
2520 | * in Other Operating Systems(TM) | ||
2521 | */ | 2519 | */ |
2522 | static noinline u16 bnx2x_tx_split(struct bnx2x *bp, | 2520 | static noinline u16 bnx2x_tx_split(struct bnx2x *bp, |
2523 | struct bnx2x_fp_txdata *txdata, | 2521 | struct bnx2x_fp_txdata *txdata, |
@@ -3171,7 +3169,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3171 | 3169 | ||
3172 | txdata->tx_bd_prod += nbd; | 3170 | txdata->tx_bd_prod += nbd; |
3173 | 3171 | ||
3174 | if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 3)) { | 3172 | if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 4)) { |
3175 | netif_tx_stop_queue(txq); | 3173 | netif_tx_stop_queue(txq); |
3176 | 3174 | ||
3177 | /* paired memory barrier is in bnx2x_tx_int(), we have to keep | 3175 | /* paired memory barrier is in bnx2x_tx_int(), we have to keep |
@@ -3180,7 +3178,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3180 | smp_mb(); | 3178 | smp_mb(); |
3181 | 3179 | ||
3182 | fp->eth_q_stats.driver_xoff++; | 3180 | fp->eth_q_stats.driver_xoff++; |
3183 | if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3) | 3181 | if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4) |
3184 | netif_tx_wake_queue(txq); | 3182 | netif_tx_wake_queue(txq); |
3185 | } | 3183 | } |
3186 | txdata->tx_pkt++; | 3184 | txdata->tx_pkt++; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index a3fb7215cd89..6e7d5c0843b4 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #define I2C_BSC0 0 | 40 | #define I2C_BSC0 0 |
41 | #define I2C_BSC1 1 | 41 | #define I2C_BSC1 1 |
42 | #define I2C_WA_RETRY_CNT 3 | 42 | #define I2C_WA_RETRY_CNT 3 |
43 | #define I2C_WA_PWR_ITER (I2C_WA_RETRY_CNT - 1) | ||
43 | #define MCPR_IMC_COMMAND_READ_OP 1 | 44 | #define MCPR_IMC_COMMAND_READ_OP 1 |
44 | #define MCPR_IMC_COMMAND_WRITE_OP 2 | 45 | #define MCPR_IMC_COMMAND_WRITE_OP 2 |
45 | 46 | ||
@@ -7659,6 +7660,28 @@ static int bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7659 | return -EINVAL; | 7660 | return -EINVAL; |
7660 | } | 7661 | } |
7661 | 7662 | ||
7663 | static void bnx2x_warpcore_power_module(struct link_params *params, | ||
7664 | struct bnx2x_phy *phy, | ||
7665 | u8 power) | ||
7666 | { | ||
7667 | u32 pin_cfg; | ||
7668 | struct bnx2x *bp = params->bp; | ||
7669 | |||
7670 | pin_cfg = (REG_RD(bp, params->shmem_base + | ||
7671 | offsetof(struct shmem_region, | ||
7672 | dev_info.port_hw_config[params->port].e3_sfp_ctrl)) & | ||
7673 | PORT_HW_CFG_E3_PWR_DIS_MASK) >> | ||
7674 | PORT_HW_CFG_E3_PWR_DIS_SHIFT; | ||
7675 | |||
7676 | if (pin_cfg == PIN_CFG_NA) | ||
7677 | return; | ||
7678 | DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n", | ||
7679 | power, pin_cfg); | ||
7680 | /* Low ==> corresponding SFP+ module is powered | ||
7681 | * high ==> the SFP+ module is powered down | ||
7682 | */ | ||
7683 | bnx2x_set_cfg_pin(bp, pin_cfg, power ^ 1); | ||
7684 | } | ||
7662 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | 7685 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, |
7663 | struct link_params *params, | 7686 | struct link_params *params, |
7664 | u16 addr, u8 byte_cnt, | 7687 | u16 addr, u8 byte_cnt, |
@@ -7678,6 +7701,12 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7678 | /* 4 byte aligned address */ | 7701 | /* 4 byte aligned address */ |
7679 | addr32 = addr & (~0x3); | 7702 | addr32 = addr & (~0x3); |
7680 | do { | 7703 | do { |
7704 | if (cnt == I2C_WA_PWR_ITER) { | ||
7705 | bnx2x_warpcore_power_module(params, phy, 0); | ||
7706 | /* Note that 100us are not enough here */ | ||
7707 | usleep_range(1000,1000); | ||
7708 | bnx2x_warpcore_power_module(params, phy, 1); | ||
7709 | } | ||
7681 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, | 7710 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, |
7682 | data_array); | 7711 | data_array); |
7683 | } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT)); | 7712 | } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT)); |
@@ -8200,29 +8229,6 @@ static void bnx2x_set_sfp_module_fault_led(struct link_params *params, | |||
8200 | bnx2x_set_e1e2_module_fault_led(params, gpio_mode); | 8229 | bnx2x_set_e1e2_module_fault_led(params, gpio_mode); |
8201 | } | 8230 | } |
8202 | 8231 | ||
8203 | static void bnx2x_warpcore_power_module(struct link_params *params, | ||
8204 | struct bnx2x_phy *phy, | ||
8205 | u8 power) | ||
8206 | { | ||
8207 | u32 pin_cfg; | ||
8208 | struct bnx2x *bp = params->bp; | ||
8209 | |||
8210 | pin_cfg = (REG_RD(bp, params->shmem_base + | ||
8211 | offsetof(struct shmem_region, | ||
8212 | dev_info.port_hw_config[params->port].e3_sfp_ctrl)) & | ||
8213 | PORT_HW_CFG_E3_PWR_DIS_MASK) >> | ||
8214 | PORT_HW_CFG_E3_PWR_DIS_SHIFT; | ||
8215 | |||
8216 | if (pin_cfg == PIN_CFG_NA) | ||
8217 | return; | ||
8218 | DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n", | ||
8219 | power, pin_cfg); | ||
8220 | /* Low ==> corresponding SFP+ module is powered | ||
8221 | * high ==> the SFP+ module is powered down | ||
8222 | */ | ||
8223 | bnx2x_set_cfg_pin(bp, pin_cfg, power ^ 1); | ||
8224 | } | ||
8225 | |||
8226 | static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy, | 8232 | static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy, |
8227 | struct link_params *params) | 8233 | struct link_params *params) |
8228 | { | 8234 | { |
@@ -9748,7 +9754,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
9748 | 9754 | ||
9749 | msleep(1); | 9755 | msleep(1); |
9750 | 9756 | ||
9751 | if (!(CHIP_IS_E1(bp))) | 9757 | if (!(CHIP_IS_E1x(bp))) |
9752 | port = BP_PATH(bp); | 9758 | port = BP_PATH(bp); |
9753 | else | 9759 | else |
9754 | port = params->port; | 9760 | port = params->port; |
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index c95e7b5e2b85..2c89d17cbb29 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -534,7 +534,8 @@ int cnic_unregister_driver(int ulp_type) | |||
534 | } | 534 | } |
535 | 535 | ||
536 | if (atomic_read(&ulp_ops->ref_count) != 0) | 536 | if (atomic_read(&ulp_ops->ref_count) != 0) |
537 | netdev_warn(dev->netdev, "Failed waiting for ref count to go to zero\n"); | 537 | pr_warn("%s: Failed waiting for ref count to go to zero\n", |
538 | __func__); | ||
538 | return 0; | 539 | return 0; |
539 | 540 | ||
540 | out_unlock: | 541 | out_unlock: |
@@ -1053,12 +1054,13 @@ static int cnic_init_uio(struct cnic_dev *dev) | |||
1053 | 1054 | ||
1054 | uinfo = &udev->cnic_uinfo; | 1055 | uinfo = &udev->cnic_uinfo; |
1055 | 1056 | ||
1056 | uinfo->mem[0].addr = dev->netdev->base_addr; | 1057 | uinfo->mem[0].addr = pci_resource_start(dev->pcidev, 0); |
1057 | uinfo->mem[0].internal_addr = dev->regview; | 1058 | uinfo->mem[0].internal_addr = dev->regview; |
1058 | uinfo->mem[0].size = dev->netdev->mem_end - dev->netdev->mem_start; | ||
1059 | uinfo->mem[0].memtype = UIO_MEM_PHYS; | 1059 | uinfo->mem[0].memtype = UIO_MEM_PHYS; |
1060 | 1060 | ||
1061 | if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) { | 1061 | if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) { |
1062 | uinfo->mem[0].size = MB_GET_CID_ADDR(TX_TSS_CID + | ||
1063 | TX_MAX_TSS_RINGS + 1); | ||
1062 | uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & | 1064 | uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & |
1063 | PAGE_MASK; | 1065 | PAGE_MASK; |
1064 | if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) | 1066 | if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) |
@@ -1068,6 +1070,8 @@ static int cnic_init_uio(struct cnic_dev *dev) | |||
1068 | 1070 | ||
1069 | uinfo->name = "bnx2_cnic"; | 1071 | uinfo->name = "bnx2_cnic"; |
1070 | } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { | 1072 | } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { |
1073 | uinfo->mem[0].size = pci_resource_len(dev->pcidev, 0); | ||
1074 | |||
1071 | uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & | 1075 | uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & |
1072 | PAGE_MASK; | 1076 | PAGE_MASK; |
1073 | uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk); | 1077 | uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk); |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 8d06ea381741..921c2082af4c 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -122,15 +122,15 @@ static int be_mcc_compl_process(struct be_adapter *adapter, | |||
122 | goto done; | 122 | goto done; |
123 | 123 | ||
124 | if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) { | 124 | if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) { |
125 | dev_warn(&adapter->pdev->dev, "This domain(VM) is not " | 125 | dev_warn(&adapter->pdev->dev, |
126 | "permitted to execute this cmd (opcode %d)\n", | 126 | "opcode %d-%d is not permitted\n", |
127 | opcode); | 127 | opcode, subsystem); |
128 | } else { | 128 | } else { |
129 | extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) & | 129 | extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) & |
130 | CQE_STATUS_EXTD_MASK; | 130 | CQE_STATUS_EXTD_MASK; |
131 | dev_err(&adapter->pdev->dev, "Cmd (opcode %d) failed:" | 131 | dev_err(&adapter->pdev->dev, |
132 | "status %d, extd-status %d\n", | 132 | "opcode %d-%d failed:status %d-%d\n", |
133 | opcode, compl_status, extd_status); | 133 | opcode, subsystem, compl_status, extd_status); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | done: | 136 | done: |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 9625bf420c16..b3f3fc3d1323 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -1566,7 +1566,7 @@ struct be_hw_stats_v1 { | |||
1566 | u32 rsvd0[BE_TXP_SW_SZ]; | 1566 | u32 rsvd0[BE_TXP_SW_SZ]; |
1567 | struct be_erx_stats_v1 erx; | 1567 | struct be_erx_stats_v1 erx; |
1568 | struct be_pmem_stats pmem; | 1568 | struct be_pmem_stats pmem; |
1569 | u32 rsvd1[3]; | 1569 | u32 rsvd1[18]; |
1570 | }; | 1570 | }; |
1571 | 1571 | ||
1572 | struct be_cmd_req_get_stats_v1 { | 1572 | struct be_cmd_req_get_stats_v1 { |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index fdb50cec6b51..501dfa9c88ec 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -3237,7 +3237,7 @@ static void be_netdev_init(struct net_device *netdev) | |||
3237 | 3237 | ||
3238 | netdev->flags |= IFF_MULTICAST; | 3238 | netdev->flags |= IFF_MULTICAST; |
3239 | 3239 | ||
3240 | netif_set_gso_max_size(netdev, 65535); | 3240 | netif_set_gso_max_size(netdev, 65535 - ETH_HLEN); |
3241 | 3241 | ||
3242 | netdev->netdev_ops = &be_netdev_ops; | 3242 | netdev->netdev_ops = &be_netdev_ops; |
3243 | 3243 | ||
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 0741aded9eb0..ab1d80ff0791 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -1804,18 +1804,16 @@ void gfar_configure_coalescing(struct gfar_private *priv, | |||
1804 | if (priv->mode == MQ_MG_MODE) { | 1804 | if (priv->mode == MQ_MG_MODE) { |
1805 | baddr = ®s->txic0; | 1805 | baddr = ®s->txic0; |
1806 | for_each_set_bit(i, &tx_mask, priv->num_tx_queues) { | 1806 | for_each_set_bit(i, &tx_mask, priv->num_tx_queues) { |
1807 | if (likely(priv->tx_queue[i]->txcoalescing)) { | 1807 | gfar_write(baddr + i, 0); |
1808 | gfar_write(baddr + i, 0); | 1808 | if (likely(priv->tx_queue[i]->txcoalescing)) |
1809 | gfar_write(baddr + i, priv->tx_queue[i]->txic); | 1809 | gfar_write(baddr + i, priv->tx_queue[i]->txic); |
1810 | } | ||
1811 | } | 1810 | } |
1812 | 1811 | ||
1813 | baddr = ®s->rxic0; | 1812 | baddr = ®s->rxic0; |
1814 | for_each_set_bit(i, &rx_mask, priv->num_rx_queues) { | 1813 | for_each_set_bit(i, &rx_mask, priv->num_rx_queues) { |
1815 | if (likely(priv->rx_queue[i]->rxcoalescing)) { | 1814 | gfar_write(baddr + i, 0); |
1816 | gfar_write(baddr + i, 0); | 1815 | if (likely(priv->rx_queue[i]->rxcoalescing)) |
1817 | gfar_write(baddr + i, priv->rx_queue[i]->rxic); | 1816 | gfar_write(baddr + i, priv->rx_queue[i]->rxic); |
1818 | } | ||
1819 | } | 1817 | } |
1820 | } | 1818 | } |
1821 | } | 1819 | } |
@@ -2065,10 +2063,9 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2065 | return NETDEV_TX_OK; | 2063 | return NETDEV_TX_OK; |
2066 | } | 2064 | } |
2067 | 2065 | ||
2068 | /* Steal sock reference for processing TX time stamps */ | 2066 | if (skb->sk) |
2069 | swap(skb_new->sk, skb->sk); | 2067 | skb_set_owner_w(skb_new, skb->sk); |
2070 | swap(skb_new->destructor, skb->destructor); | 2068 | consume_skb(skb); |
2071 | kfree_skb(skb); | ||
2072 | skb = skb_new; | 2069 | skb = skb_new; |
2073 | } | 2070 | } |
2074 | 2071 | ||
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig index 79b07ec6726f..0cafe4fe9406 100644 --- a/drivers/net/ethernet/intel/Kconfig +++ b/drivers/net/ethernet/intel/Kconfig | |||
@@ -122,8 +122,10 @@ config IGB_DCA | |||
122 | 122 | ||
123 | config IGB_PTP | 123 | config IGB_PTP |
124 | bool "PTP Hardware Clock (PHC)" | 124 | bool "PTP Hardware Clock (PHC)" |
125 | default y | 125 | default n |
126 | depends on IGB && PTP_1588_CLOCK | 126 | depends on IGB && EXPERIMENTAL |
127 | select PPS | ||
128 | select PTP_1588_CLOCK | ||
127 | ---help--- | 129 | ---help--- |
128 | Say Y here if you want to use PTP Hardware Clock (PHC) in the | 130 | Say Y here if you want to use PTP Hardware Clock (PHC) in the |
129 | driver. Only the basic clock operations have been implemented. | 131 | driver. Only the basic clock operations have been implemented. |
@@ -223,7 +225,9 @@ config IXGBE_DCB | |||
223 | config IXGBE_PTP | 225 | config IXGBE_PTP |
224 | bool "PTP Clock Support" | 226 | bool "PTP Clock Support" |
225 | default n | 227 | default n |
226 | depends on IXGBE && PTP_1588_CLOCK | 228 | depends on IXGBE && EXPERIMENTAL |
229 | select PPS | ||
230 | select PTP_1588_CLOCK | ||
227 | ---help--- | 231 | ---help--- |
228 | Say Y here if you want support for 1588 Timestamping with a | 232 | Say Y here if you want support for 1588 Timestamping with a |
229 | PHC device, using the PTP 1588 Clock support. This is | 233 | PHC device, using the PTP 1588 Clock support. This is |
diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c index 36db4df09aed..1f063dcd8f85 100644 --- a/drivers/net/ethernet/intel/e1000e/82571.c +++ b/drivers/net/ethernet/intel/e1000e/82571.c | |||
@@ -1572,6 +1572,9 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) | |||
1572 | ctrl = er32(CTRL); | 1572 | ctrl = er32(CTRL); |
1573 | status = er32(STATUS); | 1573 | status = er32(STATUS); |
1574 | rxcw = er32(RXCW); | 1574 | rxcw = er32(RXCW); |
1575 | /* SYNCH bit and IV bit are sticky */ | ||
1576 | udelay(10); | ||
1577 | rxcw = er32(RXCW); | ||
1575 | 1578 | ||
1576 | if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) { | 1579 | if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) { |
1577 | 1580 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h index 351a4097b2ba..76edbc1be33b 100644 --- a/drivers/net/ethernet/intel/e1000e/defines.h +++ b/drivers/net/ethernet/intel/e1000e/defines.h | |||
@@ -103,6 +103,7 @@ | |||
103 | #define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ | 103 | #define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ |
104 | #define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ | 104 | #define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ |
105 | #define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ | 105 | #define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ |
106 | #define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */ | ||
106 | #define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ | 107 | #define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ |
107 | #define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ | 108 | #define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ |
108 | 109 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 238ab2f8a5e7..e3a7b07df629 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
@@ -325,24 +325,46 @@ static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val) | |||
325 | **/ | 325 | **/ |
326 | static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) | 326 | static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) |
327 | { | 327 | { |
328 | u16 phy_reg; | 328 | u16 phy_reg = 0; |
329 | u32 phy_id; | 329 | u32 phy_id = 0; |
330 | s32 ret_val; | ||
331 | u16 retry_count; | ||
332 | |||
333 | for (retry_count = 0; retry_count < 2; retry_count++) { | ||
334 | ret_val = e1e_rphy_locked(hw, PHY_ID1, &phy_reg); | ||
335 | if (ret_val || (phy_reg == 0xFFFF)) | ||
336 | continue; | ||
337 | phy_id = (u32)(phy_reg << 16); | ||
330 | 338 | ||
331 | e1e_rphy_locked(hw, PHY_ID1, &phy_reg); | 339 | ret_val = e1e_rphy_locked(hw, PHY_ID2, &phy_reg); |
332 | phy_id = (u32)(phy_reg << 16); | 340 | if (ret_val || (phy_reg == 0xFFFF)) { |
333 | e1e_rphy_locked(hw, PHY_ID2, &phy_reg); | 341 | phy_id = 0; |
334 | phy_id |= (u32)(phy_reg & PHY_REVISION_MASK); | 342 | continue; |
343 | } | ||
344 | phy_id |= (u32)(phy_reg & PHY_REVISION_MASK); | ||
345 | break; | ||
346 | } | ||
335 | 347 | ||
336 | if (hw->phy.id) { | 348 | if (hw->phy.id) { |
337 | if (hw->phy.id == phy_id) | 349 | if (hw->phy.id == phy_id) |
338 | return true; | 350 | return true; |
339 | } else { | 351 | } else if (phy_id) { |
340 | if ((phy_id != 0) && (phy_id != PHY_REVISION_MASK)) | 352 | hw->phy.id = phy_id; |
341 | hw->phy.id = phy_id; | 353 | hw->phy.revision = (u32)(phy_reg & ~PHY_REVISION_MASK); |
342 | return true; | 354 | return true; |
343 | } | 355 | } |
344 | 356 | ||
345 | return false; | 357 | /* |
358 | * In case the PHY needs to be in mdio slow mode, | ||
359 | * set slow mode and try to get the PHY id again. | ||
360 | */ | ||
361 | hw->phy.ops.release(hw); | ||
362 | ret_val = e1000_set_mdio_slow_mode_hv(hw); | ||
363 | if (!ret_val) | ||
364 | ret_val = e1000e_get_phy_id(hw); | ||
365 | hw->phy.ops.acquire(hw); | ||
366 | |||
367 | return !ret_val; | ||
346 | } | 368 | } |
347 | 369 | ||
348 | /** | 370 | /** |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 31d37a2b5ba8..623e30b9964d 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -496,7 +496,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter, | |||
496 | * @sk_buff: socket buffer with received data | 496 | * @sk_buff: socket buffer with received data |
497 | **/ | 497 | **/ |
498 | static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | 498 | static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, |
499 | __le16 csum, struct sk_buff *skb) | 499 | struct sk_buff *skb) |
500 | { | 500 | { |
501 | u16 status = (u16)status_err; | 501 | u16 status = (u16)status_err; |
502 | u8 errors = (u8)(status_err >> 24); | 502 | u8 errors = (u8)(status_err >> 24); |
@@ -511,8 +511,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | |||
511 | if (status & E1000_RXD_STAT_IXSM) | 511 | if (status & E1000_RXD_STAT_IXSM) |
512 | return; | 512 | return; |
513 | 513 | ||
514 | /* TCP/UDP checksum error bit is set */ | 514 | /* TCP/UDP checksum error bit or IP checksum error bit is set */ |
515 | if (errors & E1000_RXD_ERR_TCPE) { | 515 | if (errors & (E1000_RXD_ERR_TCPE | E1000_RXD_ERR_IPE)) { |
516 | /* let the stack verify checksum errors */ | 516 | /* let the stack verify checksum errors */ |
517 | adapter->hw_csum_err++; | 517 | adapter->hw_csum_err++; |
518 | return; | 518 | return; |
@@ -523,19 +523,7 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | |||
523 | return; | 523 | return; |
524 | 524 | ||
525 | /* It must be a TCP or UDP packet with a valid checksum */ | 525 | /* It must be a TCP or UDP packet with a valid checksum */ |
526 | if (status & E1000_RXD_STAT_TCPCS) { | 526 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
527 | /* TCP checksum is good */ | ||
528 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
529 | } else { | ||
530 | /* | ||
531 | * IP fragment with UDP payload | ||
532 | * Hardware complements the payload checksum, so we undo it | ||
533 | * and then put the value in host order for further stack use. | ||
534 | */ | ||
535 | __sum16 sum = (__force __sum16)swab16((__force u16)csum); | ||
536 | skb->csum = csum_unfold(~sum); | ||
537 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
538 | } | ||
539 | adapter->hw_csum_good++; | 527 | adapter->hw_csum_good++; |
540 | } | 528 | } |
541 | 529 | ||
@@ -954,8 +942,7 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done, | |||
954 | skb_put(skb, length); | 942 | skb_put(skb, length); |
955 | 943 | ||
956 | /* Receive Checksum Offload */ | 944 | /* Receive Checksum Offload */ |
957 | e1000_rx_checksum(adapter, staterr, | 945 | e1000_rx_checksum(adapter, staterr, skb); |
958 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
959 | 946 | ||
960 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 947 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
961 | 948 | ||
@@ -1341,8 +1328,7 @@ copydone: | |||
1341 | total_rx_bytes += skb->len; | 1328 | total_rx_bytes += skb->len; |
1342 | total_rx_packets++; | 1329 | total_rx_packets++; |
1343 | 1330 | ||
1344 | e1000_rx_checksum(adapter, staterr, | 1331 | e1000_rx_checksum(adapter, staterr, skb); |
1345 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
1346 | 1332 | ||
1347 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 1333 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
1348 | 1334 | ||
@@ -1512,9 +1498,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done, | |||
1512 | } | 1498 | } |
1513 | } | 1499 | } |
1514 | 1500 | ||
1515 | /* Receive Checksum Offload XXX recompute due to CRC strip? */ | 1501 | /* Receive Checksum Offload */ |
1516 | e1000_rx_checksum(adapter, staterr, | 1502 | e1000_rx_checksum(adapter, staterr, skb); |
1517 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
1518 | 1503 | ||
1519 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 1504 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
1520 | 1505 | ||
@@ -3098,19 +3083,10 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
3098 | 3083 | ||
3099 | /* Enable Receive Checksum Offload for TCP and UDP */ | 3084 | /* Enable Receive Checksum Offload for TCP and UDP */ |
3100 | rxcsum = er32(RXCSUM); | 3085 | rxcsum = er32(RXCSUM); |
3101 | if (adapter->netdev->features & NETIF_F_RXCSUM) { | 3086 | if (adapter->netdev->features & NETIF_F_RXCSUM) |
3102 | rxcsum |= E1000_RXCSUM_TUOFL; | 3087 | rxcsum |= E1000_RXCSUM_TUOFL; |
3103 | 3088 | else | |
3104 | /* | ||
3105 | * IPv4 payload checksum for UDP fragments must be | ||
3106 | * used in conjunction with packet-split. | ||
3107 | */ | ||
3108 | if (adapter->rx_ps_pages) | ||
3109 | rxcsum |= E1000_RXCSUM_IPPCSE; | ||
3110 | } else { | ||
3111 | rxcsum &= ~E1000_RXCSUM_TUOFL; | 3089 | rxcsum &= ~E1000_RXCSUM_TUOFL; |
3112 | /* no need to clear IPPCSE as it defaults to 0 */ | ||
3113 | } | ||
3114 | ew32(RXCSUM, rxcsum); | 3090 | ew32(RXCSUM, rxcsum); |
3115 | 3091 | ||
3116 | if (adapter->hw.mac.type == e1000_pch2lan) { | 3092 | if (adapter->hw.mac.type == e1000_pch2lan) { |
@@ -5241,22 +5217,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
5241 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; | 5217 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
5242 | 5218 | ||
5243 | /* Jumbo frame support */ | 5219 | /* Jumbo frame support */ |
5244 | if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) { | 5220 | if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) && |
5245 | if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { | 5221 | !(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { |
5246 | e_err("Jumbo Frames not supported.\n"); | 5222 | e_err("Jumbo Frames not supported.\n"); |
5247 | return -EINVAL; | 5223 | return -EINVAL; |
5248 | } | ||
5249 | |||
5250 | /* | ||
5251 | * IP payload checksum (enabled with jumbos/packet-split when | ||
5252 | * Rx checksum is enabled) and generation of RSS hash is | ||
5253 | * mutually exclusive in the hardware. | ||
5254 | */ | ||
5255 | if ((netdev->features & NETIF_F_RXCSUM) && | ||
5256 | (netdev->features & NETIF_F_RXHASH)) { | ||
5257 | e_err("Jumbo frames cannot be enabled when both receive checksum offload and receive hashing are enabled. Disable one of the receive offload features before enabling jumbos.\n"); | ||
5258 | return -EINVAL; | ||
5259 | } | ||
5260 | } | 5224 | } |
5261 | 5225 | ||
5262 | /* Supported frame sizes */ | 5226 | /* Supported frame sizes */ |
@@ -6030,17 +5994,6 @@ static int e1000_set_features(struct net_device *netdev, | |||
6030 | NETIF_F_RXALL))) | 5994 | NETIF_F_RXALL))) |
6031 | return 0; | 5995 | return 0; |
6032 | 5996 | ||
6033 | /* | ||
6034 | * IP payload checksum (enabled with jumbos/packet-split when Rx | ||
6035 | * checksum is enabled) and generation of RSS hash is mutually | ||
6036 | * exclusive in the hardware. | ||
6037 | */ | ||
6038 | if (adapter->rx_ps_pages && | ||
6039 | (features & NETIF_F_RXCSUM) && (features & NETIF_F_RXHASH)) { | ||
6040 | e_err("Enabling both receive checksum offload and receive hashing is not possible with jumbo frames. Disable jumbos or enable only one of the receive offload features.\n"); | ||
6041 | return -EINVAL; | ||
6042 | } | ||
6043 | |||
6044 | if (changed & NETIF_F_RXFCS) { | 5997 | if (changed & NETIF_F_RXFCS) { |
6045 | if (features & NETIF_F_RXFCS) { | 5998 | if (features & NETIF_F_RXFCS) { |
6046 | adapter->flags2 &= ~FLAG2_CRC_STRIPPING; | 5999 | adapter->flags2 &= ~FLAG2_CRC_STRIPPING; |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index e65083958421..5e84eaac48c1 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -206,8 +206,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
206 | mac->rar_entry_count = E1000_RAR_ENTRIES_82580; | 206 | mac->rar_entry_count = E1000_RAR_ENTRIES_82580; |
207 | break; | 207 | break; |
208 | case e1000_i350: | 208 | case e1000_i350: |
209 | case e1000_i210: | ||
210 | case e1000_i211: | ||
211 | mac->rar_entry_count = E1000_RAR_ENTRIES_I350; | 209 | mac->rar_entry_count = E1000_RAR_ENTRIES_I350; |
212 | break; | 210 | break; |
213 | default: | 211 | default: |
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c index 8ce67064b9c5..90eef07943f4 100644 --- a/drivers/net/ethernet/intel/igbvf/ethtool.c +++ b/drivers/net/ethernet/intel/igbvf/ethtool.c | |||
@@ -357,21 +357,28 @@ static int igbvf_set_coalesce(struct net_device *netdev, | |||
357 | struct igbvf_adapter *adapter = netdev_priv(netdev); | 357 | struct igbvf_adapter *adapter = netdev_priv(netdev); |
358 | struct e1000_hw *hw = &adapter->hw; | 358 | struct e1000_hw *hw = &adapter->hw; |
359 | 359 | ||
360 | if ((ec->rx_coalesce_usecs > IGBVF_MAX_ITR_USECS) || | 360 | if ((ec->rx_coalesce_usecs >= IGBVF_MIN_ITR_USECS) && |
361 | ((ec->rx_coalesce_usecs > 3) && | 361 | (ec->rx_coalesce_usecs <= IGBVF_MAX_ITR_USECS)) { |
362 | (ec->rx_coalesce_usecs < IGBVF_MIN_ITR_USECS)) || | 362 | adapter->current_itr = ec->rx_coalesce_usecs << 2; |
363 | (ec->rx_coalesce_usecs == 2)) | 363 | adapter->requested_itr = 1000000000 / |
364 | return -EINVAL; | 364 | (adapter->current_itr * 256); |
365 | 365 | } else if ((ec->rx_coalesce_usecs == 3) || | |
366 | /* convert to rate of irq's per second */ | 366 | (ec->rx_coalesce_usecs == 2)) { |
367 | if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) { | ||
368 | adapter->current_itr = IGBVF_START_ITR; | 367 | adapter->current_itr = IGBVF_START_ITR; |
369 | adapter->requested_itr = ec->rx_coalesce_usecs; | 368 | adapter->requested_itr = ec->rx_coalesce_usecs; |
370 | } else { | 369 | } else if (ec->rx_coalesce_usecs == 0) { |
371 | adapter->current_itr = ec->rx_coalesce_usecs << 2; | 370 | /* |
371 | * The user's desire is to turn off interrupt throttling | ||
372 | * altogether, but due to HW limitations, we can't do that. | ||
373 | * Instead we set a very small value in EITR, which would | ||
374 | * allow ~967k interrupts per second, but allow the adapter's | ||
375 | * internal clocking to still function properly. | ||
376 | */ | ||
377 | adapter->current_itr = 4; | ||
372 | adapter->requested_itr = 1000000000 / | 378 | adapter->requested_itr = 1000000000 / |
373 | (adapter->current_itr * 256); | 379 | (adapter->current_itr * 256); |
374 | } | 380 | } else |
381 | return -EINVAL; | ||
375 | 382 | ||
376 | writel(adapter->current_itr, | 383 | writel(adapter->current_itr, |
377 | hw->hw_addr + adapter->rx_ring->itr_register); | 384 | hw->hw_addr + adapter->rx_ring->itr_register); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 3ef3c5284e52..7af291e236bf 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -196,7 +196,7 @@ enum ixgbe_ring_state_t { | |||
196 | __IXGBE_HANG_CHECK_ARMED, | 196 | __IXGBE_HANG_CHECK_ARMED, |
197 | __IXGBE_RX_RSC_ENABLED, | 197 | __IXGBE_RX_RSC_ENABLED, |
198 | __IXGBE_RX_CSUM_UDP_ZERO_ERR, | 198 | __IXGBE_RX_CSUM_UDP_ZERO_ERR, |
199 | __IXGBE_RX_FCOE_BUFSZ, | 199 | __IXGBE_RX_FCOE, |
200 | }; | 200 | }; |
201 | 201 | ||
202 | #define check_for_tx_hang(ring) \ | 202 | #define check_for_tx_hang(ring) \ |
@@ -290,7 +290,7 @@ struct ixgbe_ring_feature { | |||
290 | #if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192) | 290 | #if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192) |
291 | static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring) | 291 | static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring) |
292 | { | 292 | { |
293 | return test_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state) ? 1 : 0; | 293 | return test_bit(__IXGBE_RX_FCOE, &ring->state) ? 1 : 0; |
294 | } | 294 | } |
295 | #else | 295 | #else |
296 | #define ixgbe_rx_pg_order(_ring) 0 | 296 | #define ixgbe_rx_pg_order(_ring) 0 |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c index af1a5314b494..c377706e81a8 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | |||
@@ -634,7 +634,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, | |||
634 | f = &adapter->ring_feature[RING_F_FCOE]; | 634 | f = &adapter->ring_feature[RING_F_FCOE]; |
635 | if ((rxr_idx >= f->mask) && | 635 | if ((rxr_idx >= f->mask) && |
636 | (rxr_idx < f->mask + f->indices)) | 636 | (rxr_idx < f->mask + f->indices)) |
637 | set_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state); | 637 | set_bit(__IXGBE_RX_FCOE, &ring->state); |
638 | } | 638 | } |
639 | 639 | ||
640 | #endif /* IXGBE_FCOE */ | 640 | #endif /* IXGBE_FCOE */ |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 17ad6a3c1be1..e242104ab471 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -1058,17 +1058,17 @@ static inline void ixgbe_rx_hash(struct ixgbe_ring *ring, | |||
1058 | #ifdef IXGBE_FCOE | 1058 | #ifdef IXGBE_FCOE |
1059 | /** | 1059 | /** |
1060 | * ixgbe_rx_is_fcoe - check the rx desc for incoming pkt type | 1060 | * ixgbe_rx_is_fcoe - check the rx desc for incoming pkt type |
1061 | * @adapter: address of board private structure | 1061 | * @ring: structure containing ring specific data |
1062 | * @rx_desc: advanced rx descriptor | 1062 | * @rx_desc: advanced rx descriptor |
1063 | * | 1063 | * |
1064 | * Returns : true if it is FCoE pkt | 1064 | * Returns : true if it is FCoE pkt |
1065 | */ | 1065 | */ |
1066 | static inline bool ixgbe_rx_is_fcoe(struct ixgbe_adapter *adapter, | 1066 | static inline bool ixgbe_rx_is_fcoe(struct ixgbe_ring *ring, |
1067 | union ixgbe_adv_rx_desc *rx_desc) | 1067 | union ixgbe_adv_rx_desc *rx_desc) |
1068 | { | 1068 | { |
1069 | __le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; | 1069 | __le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; |
1070 | 1070 | ||
1071 | return (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && | 1071 | return test_bit(__IXGBE_RX_FCOE, &ring->state) && |
1072 | ((pkt_info & cpu_to_le16(IXGBE_RXDADV_PKTTYPE_ETQF_MASK)) == | 1072 | ((pkt_info & cpu_to_le16(IXGBE_RXDADV_PKTTYPE_ETQF_MASK)) == |
1073 | (cpu_to_le16(IXGBE_ETQF_FILTER_FCOE << | 1073 | (cpu_to_le16(IXGBE_ETQF_FILTER_FCOE << |
1074 | IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT))); | 1074 | IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT))); |
@@ -1148,7 +1148,7 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring *rx_ring, | |||
1148 | 1148 | ||
1149 | /* alloc new page for storage */ | 1149 | /* alloc new page for storage */ |
1150 | if (likely(!page)) { | 1150 | if (likely(!page)) { |
1151 | page = alloc_pages(GFP_ATOMIC | __GFP_COLD, | 1151 | page = alloc_pages(GFP_ATOMIC | __GFP_COLD | __GFP_COMP, |
1152 | ixgbe_rx_pg_order(rx_ring)); | 1152 | ixgbe_rx_pg_order(rx_ring)); |
1153 | if (unlikely(!page)) { | 1153 | if (unlikely(!page)) { |
1154 | rx_ring->rx_stats.alloc_rx_page_failed++; | 1154 | rx_ring->rx_stats.alloc_rx_page_failed++; |
@@ -1549,6 +1549,12 @@ static bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, | |||
1549 | skb->truesize -= ixgbe_rx_bufsz(rx_ring); | 1549 | skb->truesize -= ixgbe_rx_bufsz(rx_ring); |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | #ifdef IXGBE_FCOE | ||
1553 | /* do not attempt to pad FCoE Frames as this will disrupt DDP */ | ||
1554 | if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) | ||
1555 | return false; | ||
1556 | |||
1557 | #endif | ||
1552 | /* if skb_pad returns an error the skb was freed */ | 1558 | /* if skb_pad returns an error the skb was freed */ |
1553 | if (unlikely(skb->len < 60)) { | 1559 | if (unlikely(skb->len < 60)) { |
1554 | int pad_len = 60 - skb->len; | 1560 | int pad_len = 60 - skb->len; |
@@ -1775,7 +1781,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
1775 | 1781 | ||
1776 | #ifdef IXGBE_FCOE | 1782 | #ifdef IXGBE_FCOE |
1777 | /* if ddp, not passing to ULD unless for FCP_RSP or error */ | 1783 | /* if ddp, not passing to ULD unless for FCP_RSP or error */ |
1778 | if (ixgbe_rx_is_fcoe(adapter, rx_desc)) { | 1784 | if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) { |
1779 | ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb); | 1785 | ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb); |
1780 | if (!ddp_bytes) { | 1786 | if (!ddp_bytes) { |
1781 | dev_kfree_skb_any(skb); | 1787 | dev_kfree_skb_any(skb); |
@@ -6641,6 +6647,11 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) | |||
6641 | return -EINVAL; | 6647 | return -EINVAL; |
6642 | } | 6648 | } |
6643 | 6649 | ||
6650 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { | ||
6651 | e_err(drv, "Enable failed, SR-IOV enabled\n"); | ||
6652 | return -EINVAL; | ||
6653 | } | ||
6654 | |||
6644 | /* Hardware supports up to 8 traffic classes */ | 6655 | /* Hardware supports up to 8 traffic classes */ |
6645 | if (tc > adapter->dcb_cfg.num_tcs.pg_tcs || | 6656 | if (tc > adapter->dcb_cfg.num_tcs.pg_tcs || |
6646 | (hw->mac.type == ixgbe_mac_82598EB && | 6657 | (hw->mac.type == ixgbe_mac_82598EB && |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index ddc6a4d19302..dcebd128becf 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |||
@@ -708,6 +708,7 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter) | |||
708 | { | 708 | { |
709 | struct ixgbe_hw *hw = &adapter->hw; | 709 | struct ixgbe_hw *hw = &adapter->hw; |
710 | u32 incval = 0; | 710 | u32 incval = 0; |
711 | u32 timinca = 0; | ||
711 | u32 shift = 0; | 712 | u32 shift = 0; |
712 | u32 cycle_speed; | 713 | u32 cycle_speed; |
713 | unsigned long flags; | 714 | unsigned long flags; |
@@ -730,8 +731,16 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter) | |||
730 | break; | 731 | break; |
731 | } | 732 | } |
732 | 733 | ||
733 | /* Bail if the cycle speed didn't change */ | 734 | /* |
734 | if (adapter->cycle_speed == cycle_speed) | 735 | * grab the current TIMINCA value from the register so that it can be |
736 | * double checked. If the register value has been cleared, it must be | ||
737 | * reset to the correct value for generating a cyclecounter. If | ||
738 | * TIMINCA is zero, the SYSTIME registers do not increment at all. | ||
739 | */ | ||
740 | timinca = IXGBE_READ_REG(hw, IXGBE_TIMINCA); | ||
741 | |||
742 | /* Bail if the cycle speed didn't change and TIMINCA is non-zero */ | ||
743 | if (adapter->cycle_speed == cycle_speed && timinca) | ||
735 | return; | 744 | return; |
736 | 745 | ||
737 | /* disable the SDP clock out */ | 746 | /* disable the SDP clock out */ |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index f69ec4288b10..41e32257a4e8 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -201,6 +201,9 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter, | |||
201 | unsigned int i, eop, count = 0; | 201 | unsigned int i, eop, count = 0; |
202 | unsigned int total_bytes = 0, total_packets = 0; | 202 | unsigned int total_bytes = 0, total_packets = 0; |
203 | 203 | ||
204 | if (test_bit(__IXGBEVF_DOWN, &adapter->state)) | ||
205 | return true; | ||
206 | |||
204 | i = tx_ring->next_to_clean; | 207 | i = tx_ring->next_to_clean; |
205 | eop = tx_ring->tx_buffer_info[i].next_to_watch; | 208 | eop = tx_ring->tx_buffer_info[i].next_to_watch; |
206 | eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); | 209 | eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); |
@@ -969,8 +972,6 @@ static irqreturn_t ixgbevf_msix_clean_tx(int irq, void *data) | |||
969 | r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); | 972 | r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); |
970 | for (i = 0; i < q_vector->txr_count; i++) { | 973 | for (i = 0; i < q_vector->txr_count; i++) { |
971 | tx_ring = &(adapter->tx_ring[r_idx]); | 974 | tx_ring = &(adapter->tx_ring[r_idx]); |
972 | tx_ring->total_bytes = 0; | ||
973 | tx_ring->total_packets = 0; | ||
974 | ixgbevf_clean_tx_irq(adapter, tx_ring); | 975 | ixgbevf_clean_tx_irq(adapter, tx_ring); |
975 | r_idx = find_next_bit(q_vector->txr_idx, adapter->num_tx_queues, | 976 | r_idx = find_next_bit(q_vector->txr_idx, adapter->num_tx_queues, |
976 | r_idx + 1); | 977 | r_idx + 1); |
@@ -994,16 +995,6 @@ static irqreturn_t ixgbevf_msix_clean_rx(int irq, void *data) | |||
994 | struct ixgbe_hw *hw = &adapter->hw; | 995 | struct ixgbe_hw *hw = &adapter->hw; |
995 | struct ixgbevf_ring *rx_ring; | 996 | struct ixgbevf_ring *rx_ring; |
996 | int r_idx; | 997 | int r_idx; |
997 | int i; | ||
998 | |||
999 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); | ||
1000 | for (i = 0; i < q_vector->rxr_count; i++) { | ||
1001 | rx_ring = &(adapter->rx_ring[r_idx]); | ||
1002 | rx_ring->total_bytes = 0; | ||
1003 | rx_ring->total_packets = 0; | ||
1004 | r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, | ||
1005 | r_idx + 1); | ||
1006 | } | ||
1007 | 998 | ||
1008 | if (!q_vector->rxr_count) | 999 | if (!q_vector->rxr_count) |
1009 | return IRQ_HANDLED; | 1000 | return IRQ_HANDLED; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 926d8aac941c..073b85b45fc5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -929,15 +929,20 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) | |||
929 | if (priv->rx_cq[i].buf) | 929 | if (priv->rx_cq[i].buf) |
930 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); | 930 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); |
931 | } | 931 | } |
932 | |||
933 | if (priv->base_tx_qpn) { | ||
934 | mlx4_qp_release_range(priv->mdev->dev, priv->base_tx_qpn, priv->tx_ring_num); | ||
935 | priv->base_tx_qpn = 0; | ||
936 | } | ||
932 | } | 937 | } |
933 | 938 | ||
934 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | 939 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) |
935 | { | 940 | { |
936 | struct mlx4_en_port_profile *prof = priv->prof; | 941 | struct mlx4_en_port_profile *prof = priv->prof; |
937 | int i; | 942 | int i; |
938 | int base_tx_qpn, err; | 943 | int err; |
939 | 944 | ||
940 | err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &base_tx_qpn); | 945 | err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &priv->base_tx_qpn); |
941 | if (err) { | 946 | if (err) { |
942 | en_err(priv, "failed reserving range for TX rings\n"); | 947 | en_err(priv, "failed reserving range for TX rings\n"); |
943 | return err; | 948 | return err; |
@@ -949,7 +954,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
949 | prof->tx_ring_size, i, TX)) | 954 | prof->tx_ring_size, i, TX)) |
950 | goto err; | 955 | goto err; |
951 | 956 | ||
952 | if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], base_tx_qpn + i, | 957 | if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], priv->base_tx_qpn + i, |
953 | prof->tx_ring_size, TXBB_SIZE)) | 958 | prof->tx_ring_size, TXBB_SIZE)) |
954 | goto err; | 959 | goto err; |
955 | } | 960 | } |
@@ -969,7 +974,6 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
969 | 974 | ||
970 | err: | 975 | err: |
971 | en_err(priv, "Failed to allocate NIC resources\n"); | 976 | en_err(priv, "Failed to allocate NIC resources\n"); |
972 | mlx4_qp_release_range(priv->mdev->dev, base_tx_qpn, priv->tx_ring_num); | ||
973 | return -ENOMEM; | 977 | return -ENOMEM; |
974 | } | 978 | } |
975 | 979 | ||
@@ -1204,9 +1208,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
1204 | en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); | 1208 | en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); |
1205 | 1209 | ||
1206 | /* Configure port */ | 1210 | /* Configure port */ |
1211 | mlx4_en_calc_rx_buf(dev); | ||
1207 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 1212 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, |
1208 | MLX4_EN_MIN_MTU, | 1213 | priv->rx_skb_size + ETH_FCS_LEN, |
1209 | 0, 0, 0, 0); | 1214 | prof->tx_pause, prof->tx_ppp, |
1215 | prof->rx_pause, prof->rx_ppp); | ||
1210 | if (err) { | 1216 | if (err) { |
1211 | en_err(priv, "Failed setting port general configurations " | 1217 | en_err(priv, "Failed setting port general configurations " |
1212 | "for port %d, with error %d\n", priv->port, err); | 1218 | "for port %d, with error %d\n", priv->port, err); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index ee6f4fe00837..a0313de122de 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1975,6 +1975,8 @@ slave_start: | |||
1975 | if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) && | 1975 | if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) && |
1976 | !mlx4_is_mfunc(dev)) { | 1976 | !mlx4_is_mfunc(dev)) { |
1977 | dev->flags &= ~MLX4_FLAG_MSI_X; | 1977 | dev->flags &= ~MLX4_FLAG_MSI_X; |
1978 | dev->caps.num_comp_vectors = 1; | ||
1979 | dev->caps.comp_pool = 0; | ||
1978 | pci_disable_msix(pdev); | 1980 | pci_disable_msix(pdev); |
1979 | err = mlx4_setup_hca(dev); | 1981 | err = mlx4_setup_hca(dev); |
1980 | } | 1982 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 6ae350921b1a..225c20d47900 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -495,6 +495,7 @@ struct mlx4_en_priv { | |||
495 | int vids[128]; | 495 | int vids[128]; |
496 | bool wol; | 496 | bool wol; |
497 | struct device *ddev; | 497 | struct device *ddev; |
498 | int base_tx_qpn; | ||
498 | 499 | ||
499 | #ifdef CONFIG_MLX4_EN_DCB | 500 | #ifdef CONFIG_MLX4_EN_DCB |
500 | struct ieee_ets ets; | 501 | struct ieee_ets ets; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 46e77a2c5121..ad98f4d7919d 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -479,7 +479,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter) | |||
479 | 479 | ||
480 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { | 480 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { |
481 | pfn = pci_info[i].id; | 481 | pfn = pci_info[i].id; |
482 | if (pfn > QLCNIC_MAX_PCI_FUNC) { | 482 | if (pfn >= QLCNIC_MAX_PCI_FUNC) { |
483 | ret = QL_STATUS_INVALID_PARAM; | 483 | ret = QL_STATUS_INVALID_PARAM; |
484 | goto err_eswitch; | 484 | goto err_eswitch; |
485 | } | 485 | } |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 7260aa79466a..d7a04e091101 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -3894,6 +3894,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) | |||
3894 | case RTL_GIGA_MAC_VER_22: | 3894 | case RTL_GIGA_MAC_VER_22: |
3895 | case RTL_GIGA_MAC_VER_23: | 3895 | case RTL_GIGA_MAC_VER_23: |
3896 | case RTL_GIGA_MAC_VER_24: | 3896 | case RTL_GIGA_MAC_VER_24: |
3897 | case RTL_GIGA_MAC_VER_34: | ||
3897 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); | 3898 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); |
3898 | break; | 3899 | break; |
3899 | default: | 3900 | default: |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 667169b82526..79bf09b41971 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -1011,7 +1011,7 @@ static int sh_eth_txfree(struct net_device *ndev) | |||
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | /* Packet receive function */ | 1013 | /* Packet receive function */ |
1014 | static int sh_eth_rx(struct net_device *ndev) | 1014 | static int sh_eth_rx(struct net_device *ndev, u32 intr_status) |
1015 | { | 1015 | { |
1016 | struct sh_eth_private *mdp = netdev_priv(ndev); | 1016 | struct sh_eth_private *mdp = netdev_priv(ndev); |
1017 | struct sh_eth_rxdesc *rxdesc; | 1017 | struct sh_eth_rxdesc *rxdesc; |
@@ -1102,9 +1102,11 @@ static int sh_eth_rx(struct net_device *ndev) | |||
1102 | /* Restart Rx engine if stopped. */ | 1102 | /* Restart Rx engine if stopped. */ |
1103 | /* If we don't need to check status, don't. -KDU */ | 1103 | /* If we don't need to check status, don't. -KDU */ |
1104 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { | 1104 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { |
1105 | /* fix the values for the next receiving */ | 1105 | /* fix the values for the next receiving if RDE is set */ |
1106 | mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) - | 1106 | if (intr_status & EESR_RDE) |
1107 | sh_eth_read(ndev, RDLAR)) >> 4; | 1107 | mdp->cur_rx = mdp->dirty_rx = |
1108 | (sh_eth_read(ndev, RDFAR) - | ||
1109 | sh_eth_read(ndev, RDLAR)) >> 4; | ||
1108 | sh_eth_write(ndev, EDRRR_R, EDRRR); | 1110 | sh_eth_write(ndev, EDRRR_R, EDRRR); |
1109 | } | 1111 | } |
1110 | 1112 | ||
@@ -1273,7 +1275,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
1273 | EESR_RTSF | /* short frame recv */ | 1275 | EESR_RTSF | /* short frame recv */ |
1274 | EESR_PRE | /* PHY-LSI recv error */ | 1276 | EESR_PRE | /* PHY-LSI recv error */ |
1275 | EESR_CERF)){ /* recv frame CRC error */ | 1277 | EESR_CERF)){ /* recv frame CRC error */ |
1276 | sh_eth_rx(ndev); | 1278 | sh_eth_rx(ndev, intr_status); |
1277 | } | 1279 | } |
1278 | 1280 | ||
1279 | /* Tx Check */ | 1281 | /* Tx Check */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index fb8377da1687..4b785e10f2ed 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c | |||
@@ -51,7 +51,7 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
51 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 51 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
52 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, | 52 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, |
53 | csum); | 53 | csum); |
54 | 54 | wmb(); | |
55 | entry = (++priv->cur_tx) % txsize; | 55 | entry = (++priv->cur_tx) % txsize; |
56 | desc = priv->dma_tx + entry; | 56 | desc = priv->dma_tx + entry; |
57 | 57 | ||
@@ -59,6 +59,7 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
59 | len, DMA_TO_DEVICE); | 59 | len, DMA_TO_DEVICE); |
60 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 60 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
61 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum); | 61 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum); |
62 | wmb(); | ||
62 | priv->hw->desc->set_tx_owner(desc); | 63 | priv->hw->desc->set_tx_owner(desc); |
63 | priv->tx_skbuff[entry] = NULL; | 64 | priv->tx_skbuff[entry] = NULL; |
64 | } else { | 65 | } else { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 51b3b68528ee..ea3003edde18 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -1212,6 +1212,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1212 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion); | 1212 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion); |
1213 | wmb(); | 1213 | wmb(); |
1214 | priv->hw->desc->set_tx_owner(desc); | 1214 | priv->hw->desc->set_tx_owner(desc); |
1215 | wmb(); | ||
1215 | } | 1216 | } |
1216 | 1217 | ||
1217 | /* Interrupt on completition only for the latest segment */ | 1218 | /* Interrupt on completition only for the latest segment */ |
@@ -1227,6 +1228,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1227 | 1228 | ||
1228 | /* To avoid raise condition */ | 1229 | /* To avoid raise condition */ |
1229 | priv->hw->desc->set_tx_owner(first); | 1230 | priv->hw->desc->set_tx_owner(first); |
1231 | wmb(); | ||
1230 | 1232 | ||
1231 | priv->cur_tx++; | 1233 | priv->cur_tx++; |
1232 | 1234 | ||
@@ -1290,6 +1292,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) | |||
1290 | } | 1292 | } |
1291 | wmb(); | 1293 | wmb(); |
1292 | priv->hw->desc->set_rx_owner(p + entry); | 1294 | priv->hw->desc->set_rx_owner(p + entry); |
1295 | wmb(); | ||
1293 | } | 1296 | } |
1294 | } | 1297 | } |
1295 | 1298 | ||
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index d614c374ed9d..3b5c4571b55e 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/module.h> | ||
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
19 | #include <linux/err.h> | 20 | #include <linux/err.h> |
20 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c index 39ea0674dcde..5c120189ec86 100644 --- a/drivers/net/phy/mdio-mux.c +++ b/drivers/net/phy/mdio-mux.c | |||
@@ -46,7 +46,13 @@ static int mdio_mux_read(struct mii_bus *bus, int phy_id, int regnum) | |||
46 | struct mdio_mux_parent_bus *pb = cb->parent; | 46 | struct mdio_mux_parent_bus *pb = cb->parent; |
47 | int r; | 47 | int r; |
48 | 48 | ||
49 | mutex_lock(&pb->mii_bus->mdio_lock); | 49 | /* In theory multiple mdio_mux could be stacked, thus creating |
50 | * more than a single level of nesting. But in practice, | ||
51 | * SINGLE_DEPTH_NESTING will cover the vast majority of use | ||
52 | * cases. We use it, instead of trying to handle the general | ||
53 | * case. | ||
54 | */ | ||
55 | mutex_lock_nested(&pb->mii_bus->mdio_lock, SINGLE_DEPTH_NESTING); | ||
50 | r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); | 56 | r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); |
51 | if (r) | 57 | if (r) |
52 | goto out; | 58 | goto out; |
@@ -71,7 +77,7 @@ static int mdio_mux_write(struct mii_bus *bus, int phy_id, | |||
71 | 77 | ||
72 | int r; | 78 | int r; |
73 | 79 | ||
74 | mutex_lock(&pb->mii_bus->mdio_lock); | 80 | mutex_lock_nested(&pb->mii_bus->mdio_lock, SINGLE_DEPTH_NESTING); |
75 | r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); | 81 | r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); |
76 | if (r) | 82 | if (r) |
77 | goto out; | 83 | goto out; |
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 590f902deb6b..9d6c80c8a0cf 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -161,7 +161,7 @@ static struct phy_driver ks8051_driver = { | |||
161 | static struct phy_driver ks8001_driver = { | 161 | static struct phy_driver ks8001_driver = { |
162 | .phy_id = PHY_ID_KS8001, | 162 | .phy_id = PHY_ID_KS8001, |
163 | .name = "Micrel KS8001 or KS8721", | 163 | .name = "Micrel KS8001 or KS8721", |
164 | .phy_id_mask = 0x00fffff0, | 164 | .phy_id_mask = 0x00ffffff, |
165 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), | 165 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
166 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 166 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
167 | .config_init = kszphy_config_init, | 167 | .config_init = kszphy_config_init, |
@@ -174,7 +174,7 @@ static struct phy_driver ks8001_driver = { | |||
174 | 174 | ||
175 | static struct phy_driver ksz9021_driver = { | 175 | static struct phy_driver ksz9021_driver = { |
176 | .phy_id = PHY_ID_KSZ9021, | 176 | .phy_id = PHY_ID_KSZ9021, |
177 | .phy_id_mask = 0x000fff10, | 177 | .phy_id_mask = 0x000ffffe, |
178 | .name = "Micrel KSZ9021 Gigabit PHY", | 178 | .name = "Micrel KSZ9021 Gigabit PHY", |
179 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | 179 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause |
180 | | SUPPORTED_Asym_Pause), | 180 | | SUPPORTED_Asym_Pause), |
@@ -240,8 +240,8 @@ MODULE_AUTHOR("David J. Choi"); | |||
240 | MODULE_LICENSE("GPL"); | 240 | MODULE_LICENSE("GPL"); |
241 | 241 | ||
242 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { | 242 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { |
243 | { PHY_ID_KSZ9021, 0x000fff10 }, | 243 | { PHY_ID_KSZ9021, 0x000ffffe }, |
244 | { PHY_ID_KS8001, 0x00fffff0 }, | 244 | { PHY_ID_KS8001, 0x00ffffff }, |
245 | { PHY_ID_KS8737, 0x00fffff0 }, | 245 | { PHY_ID_KS8737, 0x00fffff0 }, |
246 | { PHY_ID_KS8041, 0x00fffff0 }, | 246 | { PHY_ID_KS8041, 0x00fffff0 }, |
247 | { PHY_ID_KS8051, 0x00fffff0 }, | 247 | { PHY_ID_KS8051, 0x00fffff0 }, |
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 964031e3da87..a28a983d465e 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #define USB_PRODUCT_IPHONE_3G 0x1292 | 59 | #define USB_PRODUCT_IPHONE_3G 0x1292 |
60 | #define USB_PRODUCT_IPHONE_3GS 0x1294 | 60 | #define USB_PRODUCT_IPHONE_3GS 0x1294 |
61 | #define USB_PRODUCT_IPHONE_4 0x1297 | 61 | #define USB_PRODUCT_IPHONE_4 0x1297 |
62 | #define USB_PRODUCT_IPAD 0x129a | ||
62 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c | 63 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c |
63 | #define USB_PRODUCT_IPHONE_4S 0x12a0 | 64 | #define USB_PRODUCT_IPHONE_4S 0x12a0 |
64 | 65 | ||
@@ -101,6 +102,10 @@ static struct usb_device_id ipheth_table[] = { | |||
101 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | 102 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, |
102 | IPHETH_USBINTF_PROTO) }, | 103 | IPHETH_USBINTF_PROTO) }, |
103 | { USB_DEVICE_AND_INTERFACE_INFO( | 104 | { USB_DEVICE_AND_INTERFACE_INFO( |
105 | USB_VENDOR_APPLE, USB_PRODUCT_IPAD, | ||
106 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | ||
107 | IPHETH_USBINTF_PROTO) }, | ||
108 | { USB_DEVICE_AND_INTERFACE_INFO( | ||
104 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW, | 109 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW, |
105 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | 110 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, |
106 | IPHETH_USBINTF_PROTO) }, | 111 | IPHETH_USBINTF_PROTO) }, |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 3b206786b5e7..a051cedd64bd 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -197,6 +197,10 @@ err: | |||
197 | static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) | 197 | static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) |
198 | { | 198 | { |
199 | struct usbnet *dev = usb_get_intfdata(intf); | 199 | struct usbnet *dev = usb_get_intfdata(intf); |
200 | |||
201 | /* can be called while disconnecting */ | ||
202 | if (!dev) | ||
203 | return 0; | ||
200 | return qmi_wwan_manage_power(dev, on); | 204 | return qmi_wwan_manage_power(dev, on); |
201 | } | 205 | } |
202 | 206 | ||
@@ -257,29 +261,6 @@ err: | |||
257 | return rv; | 261 | return rv; |
258 | } | 262 | } |
259 | 263 | ||
260 | /* Gobi devices uses identical class/protocol codes for all interfaces regardless | ||
261 | * of function. Some of these are CDC ACM like and have the exact same endpoints | ||
262 | * we are looking for. This leaves two possible strategies for identifying the | ||
263 | * correct interface: | ||
264 | * a) hardcoding interface number, or | ||
265 | * b) use the fact that the wwan interface is the only one lacking additional | ||
266 | * (CDC functional) descriptors | ||
267 | * | ||
268 | * Let's see if we can get away with the generic b) solution. | ||
269 | */ | ||
270 | static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf) | ||
271 | { | ||
272 | int rv = -EINVAL; | ||
273 | |||
274 | /* ignore any interface with additional descriptors */ | ||
275 | if (intf->cur_altsetting->extralen) | ||
276 | goto err; | ||
277 | |||
278 | rv = qmi_wwan_bind_shared(dev, intf); | ||
279 | err: | ||
280 | return rv; | ||
281 | } | ||
282 | |||
283 | static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf) | 264 | static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf) |
284 | { | 265 | { |
285 | struct usb_driver *subdriver = (void *)dev->data[0]; | 266 | struct usb_driver *subdriver = (void *)dev->data[0]; |
@@ -347,15 +328,15 @@ static const struct driver_info qmi_wwan_shared = { | |||
347 | .manage_power = qmi_wwan_manage_power, | 328 | .manage_power = qmi_wwan_manage_power, |
348 | }; | 329 | }; |
349 | 330 | ||
350 | static const struct driver_info qmi_wwan_gobi = { | 331 | static const struct driver_info qmi_wwan_force_int0 = { |
351 | .description = "Qualcomm Gobi wwan/QMI device", | 332 | .description = "Qualcomm WWAN/QMI device", |
352 | .flags = FLAG_WWAN, | 333 | .flags = FLAG_WWAN, |
353 | .bind = qmi_wwan_bind_gobi, | 334 | .bind = qmi_wwan_bind_shared, |
354 | .unbind = qmi_wwan_unbind_shared, | 335 | .unbind = qmi_wwan_unbind_shared, |
355 | .manage_power = qmi_wwan_manage_power, | 336 | .manage_power = qmi_wwan_manage_power, |
337 | .data = BIT(0), /* interface whitelist bitmap */ | ||
356 | }; | 338 | }; |
357 | 339 | ||
358 | /* ZTE suck at making USB descriptors */ | ||
359 | static const struct driver_info qmi_wwan_force_int1 = { | 340 | static const struct driver_info qmi_wwan_force_int1 = { |
360 | .description = "Qualcomm WWAN/QMI device", | 341 | .description = "Qualcomm WWAN/QMI device", |
361 | .flags = FLAG_WWAN, | 342 | .flags = FLAG_WWAN, |
@@ -365,6 +346,24 @@ static const struct driver_info qmi_wwan_force_int1 = { | |||
365 | .data = BIT(1), /* interface whitelist bitmap */ | 346 | .data = BIT(1), /* interface whitelist bitmap */ |
366 | }; | 347 | }; |
367 | 348 | ||
349 | static const struct driver_info qmi_wwan_force_int2 = { | ||
350 | .description = "Qualcomm WWAN/QMI device", | ||
351 | .flags = FLAG_WWAN, | ||
352 | .bind = qmi_wwan_bind_shared, | ||
353 | .unbind = qmi_wwan_unbind_shared, | ||
354 | .manage_power = qmi_wwan_manage_power, | ||
355 | .data = BIT(2), /* interface whitelist bitmap */ | ||
356 | }; | ||
357 | |||
358 | static const struct driver_info qmi_wwan_force_int3 = { | ||
359 | .description = "Qualcomm WWAN/QMI device", | ||
360 | .flags = FLAG_WWAN, | ||
361 | .bind = qmi_wwan_bind_shared, | ||
362 | .unbind = qmi_wwan_unbind_shared, | ||
363 | .manage_power = qmi_wwan_manage_power, | ||
364 | .data = BIT(3), /* interface whitelist bitmap */ | ||
365 | }; | ||
366 | |||
368 | static const struct driver_info qmi_wwan_force_int4 = { | 367 | static const struct driver_info qmi_wwan_force_int4 = { |
369 | .description = "Qualcomm WWAN/QMI device", | 368 | .description = "Qualcomm WWAN/QMI device", |
370 | .flags = FLAG_WWAN, | 369 | .flags = FLAG_WWAN, |
@@ -390,16 +389,23 @@ static const struct driver_info qmi_wwan_force_int4 = { | |||
390 | static const struct driver_info qmi_wwan_sierra = { | 389 | static const struct driver_info qmi_wwan_sierra = { |
391 | .description = "Sierra Wireless wwan/QMI device", | 390 | .description = "Sierra Wireless wwan/QMI device", |
392 | .flags = FLAG_WWAN, | 391 | .flags = FLAG_WWAN, |
393 | .bind = qmi_wwan_bind_gobi, | 392 | .bind = qmi_wwan_bind_shared, |
394 | .unbind = qmi_wwan_unbind_shared, | 393 | .unbind = qmi_wwan_unbind_shared, |
395 | .manage_power = qmi_wwan_manage_power, | 394 | .manage_power = qmi_wwan_manage_power, |
396 | .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ | 395 | .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ |
397 | }; | 396 | }; |
398 | 397 | ||
399 | #define HUAWEI_VENDOR_ID 0x12D1 | 398 | #define HUAWEI_VENDOR_ID 0x12D1 |
399 | |||
400 | /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ | ||
401 | #define QMI_GOBI1K_DEVICE(vend, prod) \ | ||
402 | USB_DEVICE(vend, prod), \ | ||
403 | .driver_info = (unsigned long)&qmi_wwan_force_int3 | ||
404 | |||
405 | /* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */ | ||
400 | #define QMI_GOBI_DEVICE(vend, prod) \ | 406 | #define QMI_GOBI_DEVICE(vend, prod) \ |
401 | USB_DEVICE(vend, prod), \ | 407 | USB_DEVICE(vend, prod), \ |
402 | .driver_info = (unsigned long)&qmi_wwan_gobi | 408 | .driver_info = (unsigned long)&qmi_wwan_force_int0 |
403 | 409 | ||
404 | static const struct usb_device_id products[] = { | 410 | static const struct usb_device_id products[] = { |
405 | { /* Huawei E392, E398 and possibly others sharing both device id and more... */ | 411 | { /* Huawei E392, E398 and possibly others sharing both device id and more... */ |
@@ -501,6 +507,15 @@ static const struct usb_device_id products[] = { | |||
501 | .bInterfaceProtocol = 0xff, | 507 | .bInterfaceProtocol = 0xff, |
502 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | 508 | .driver_info = (unsigned long)&qmi_wwan_force_int4, |
503 | }, | 509 | }, |
510 | { /* ZTE MF60 */ | ||
511 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
512 | .idVendor = 0x19d2, | ||
513 | .idProduct = 0x1402, | ||
514 | .bInterfaceClass = 0xff, | ||
515 | .bInterfaceSubClass = 0xff, | ||
516 | .bInterfaceProtocol = 0xff, | ||
517 | .driver_info = (unsigned long)&qmi_wwan_force_int2, | ||
518 | }, | ||
504 | { /* Sierra Wireless MC77xx in QMI mode */ | 519 | { /* Sierra Wireless MC77xx in QMI mode */ |
505 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | 520 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, |
506 | .idVendor = 0x1199, | 521 | .idVendor = 0x1199, |
@@ -510,20 +525,24 @@ static const struct usb_device_id products[] = { | |||
510 | .bInterfaceProtocol = 0xff, | 525 | .bInterfaceProtocol = 0xff, |
511 | .driver_info = (unsigned long)&qmi_wwan_sierra, | 526 | .driver_info = (unsigned long)&qmi_wwan_sierra, |
512 | }, | 527 | }, |
513 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 528 | |
514 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ | 529 | /* Gobi 1000 devices */ |
515 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ | 530 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
516 | {QMI_GOBI_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ | 531 | {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
517 | {QMI_GOBI_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ | 532 | {QMI_GOBI1K_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
518 | {QMI_GOBI_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ | 533 | {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ |
519 | {QMI_GOBI_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ | 534 | {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ |
520 | {QMI_GOBI_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ | 535 | {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ |
521 | {QMI_GOBI_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ | 536 | {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ |
522 | {QMI_GOBI_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ | 537 | {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ |
523 | {QMI_GOBI_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ | 538 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ |
524 | {QMI_GOBI_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ | 539 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ |
525 | {QMI_GOBI_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ | 540 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ |
526 | {QMI_GOBI_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ | 541 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ |
542 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ | ||
543 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ | ||
544 | |||
545 | /* Gobi 2000 and 3000 devices */ | ||
527 | {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ | 546 | {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ |
528 | {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ | 547 | {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ |
529 | {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ | 548 | {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 9f58330f1312..aba769d77459 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -796,11 +796,13 @@ int usbnet_open (struct net_device *net) | |||
796 | if (info->manage_power) { | 796 | if (info->manage_power) { |
797 | retval = info->manage_power(dev, 1); | 797 | retval = info->manage_power(dev, 1); |
798 | if (retval < 0) | 798 | if (retval < 0) |
799 | goto done; | 799 | goto done_manage_power_error; |
800 | usb_autopm_put_interface(dev->intf); | 800 | usb_autopm_put_interface(dev->intf); |
801 | } | 801 | } |
802 | return retval; | 802 | return retval; |
803 | 803 | ||
804 | done_manage_power_error: | ||
805 | clear_bit(EVENT_DEV_OPEN, &dev->flags); | ||
804 | done: | 806 | done: |
805 | usb_autopm_put_interface(dev->intf); | 807 | usb_autopm_put_interface(dev->intf); |
806 | done_nopm: | 808 | done_nopm: |
@@ -876,9 +878,9 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) | |||
876 | { | 878 | { |
877 | struct usbnet *dev = netdev_priv(net); | 879 | struct usbnet *dev = netdev_priv(net); |
878 | 880 | ||
879 | strncpy (info->driver, dev->driver_name, sizeof info->driver); | 881 | strlcpy (info->driver, dev->driver_name, sizeof info->driver); |
880 | strncpy (info->version, DRIVER_VERSION, sizeof info->version); | 882 | strlcpy (info->version, DRIVER_VERSION, sizeof info->version); |
881 | strncpy (info->fw_version, dev->driver_info->description, | 883 | strlcpy (info->fw_version, dev->driver_info->description, |
882 | sizeof info->fw_version); | 884 | sizeof info->fw_version); |
883 | usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); | 885 | usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); |
884 | } | 886 | } |
@@ -1202,6 +1204,21 @@ deferred: | |||
1202 | } | 1204 | } |
1203 | EXPORT_SYMBOL_GPL(usbnet_start_xmit); | 1205 | EXPORT_SYMBOL_GPL(usbnet_start_xmit); |
1204 | 1206 | ||
1207 | static void rx_alloc_submit(struct usbnet *dev, gfp_t flags) | ||
1208 | { | ||
1209 | struct urb *urb; | ||
1210 | int i; | ||
1211 | |||
1212 | /* don't refill the queue all at once */ | ||
1213 | for (i = 0; i < 10 && dev->rxq.qlen < RX_QLEN(dev); i++) { | ||
1214 | urb = usb_alloc_urb(0, flags); | ||
1215 | if (urb != NULL) { | ||
1216 | if (rx_submit(dev, urb, flags) == -ENOLINK) | ||
1217 | return; | ||
1218 | } | ||
1219 | } | ||
1220 | } | ||
1221 | |||
1205 | /*-------------------------------------------------------------------------*/ | 1222 | /*-------------------------------------------------------------------------*/ |
1206 | 1223 | ||
1207 | // tasklet (work deferred from completions, in_irq) or timer | 1224 | // tasklet (work deferred from completions, in_irq) or timer |
@@ -1241,26 +1258,14 @@ static void usbnet_bh (unsigned long param) | |||
1241 | !timer_pending (&dev->delay) && | 1258 | !timer_pending (&dev->delay) && |
1242 | !test_bit (EVENT_RX_HALT, &dev->flags)) { | 1259 | !test_bit (EVENT_RX_HALT, &dev->flags)) { |
1243 | int temp = dev->rxq.qlen; | 1260 | int temp = dev->rxq.qlen; |
1244 | int qlen = RX_QLEN (dev); | 1261 | |
1245 | 1262 | if (temp < RX_QLEN(dev)) { | |
1246 | if (temp < qlen) { | 1263 | rx_alloc_submit(dev, GFP_ATOMIC); |
1247 | struct urb *urb; | ||
1248 | int i; | ||
1249 | |||
1250 | // don't refill the queue all at once | ||
1251 | for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) { | ||
1252 | urb = usb_alloc_urb (0, GFP_ATOMIC); | ||
1253 | if (urb != NULL) { | ||
1254 | if (rx_submit (dev, urb, GFP_ATOMIC) == | ||
1255 | -ENOLINK) | ||
1256 | return; | ||
1257 | } | ||
1258 | } | ||
1259 | if (temp != dev->rxq.qlen) | 1264 | if (temp != dev->rxq.qlen) |
1260 | netif_dbg(dev, link, dev->net, | 1265 | netif_dbg(dev, link, dev->net, |
1261 | "rxqlen %d --> %d\n", | 1266 | "rxqlen %d --> %d\n", |
1262 | temp, dev->rxq.qlen); | 1267 | temp, dev->rxq.qlen); |
1263 | if (dev->rxq.qlen < qlen) | 1268 | if (dev->rxq.qlen < RX_QLEN(dev)) |
1264 | tasklet_schedule (&dev->bh); | 1269 | tasklet_schedule (&dev->bh); |
1265 | } | 1270 | } |
1266 | if (dev->txq.qlen < TX_QLEN (dev)) | 1271 | if (dev->txq.qlen < TX_QLEN (dev)) |
@@ -1513,6 +1518,7 @@ int usbnet_suspend (struct usb_interface *intf, pm_message_t message) | |||
1513 | spin_lock_irq(&dev->txq.lock); | 1518 | spin_lock_irq(&dev->txq.lock); |
1514 | /* don't autosuspend while transmitting */ | 1519 | /* don't autosuspend while transmitting */ |
1515 | if (dev->txq.qlen && PMSG_IS_AUTO(message)) { | 1520 | if (dev->txq.qlen && PMSG_IS_AUTO(message)) { |
1521 | dev->suspend_count--; | ||
1516 | spin_unlock_irq(&dev->txq.lock); | 1522 | spin_unlock_irq(&dev->txq.lock); |
1517 | return -EBUSY; | 1523 | return -EBUSY; |
1518 | } else { | 1524 | } else { |
@@ -1569,6 +1575,13 @@ int usbnet_resume (struct usb_interface *intf) | |||
1569 | spin_unlock_irq(&dev->txq.lock); | 1575 | spin_unlock_irq(&dev->txq.lock); |
1570 | 1576 | ||
1571 | if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { | 1577 | if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { |
1578 | /* handle remote wakeup ASAP */ | ||
1579 | if (!dev->wait && | ||
1580 | netif_device_present(dev->net) && | ||
1581 | !timer_pending(&dev->delay) && | ||
1582 | !test_bit(EVENT_RX_HALT, &dev->flags)) | ||
1583 | rx_alloc_submit(dev, GFP_KERNEL); | ||
1584 | |||
1572 | if (!(dev->txq.qlen >= TX_QLEN(dev))) | 1585 | if (!(dev->txq.qlen >= TX_QLEN(dev))) |
1573 | netif_tx_wake_all_queues(dev->net); | 1586 | netif_tx_wake_all_queues(dev->net); |
1574 | tasklet_schedule (&dev->bh); | 1587 | tasklet_schedule (&dev->bh); |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 520a4b2eb9cc..a747c632597a 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -7233,8 +7233,8 @@ static int airo_get_aplist(struct net_device *dev, | |||
7233 | } | 7233 | } |
7234 | } else { | 7234 | } else { |
7235 | dwrq->flags = 1; /* Should be define'd */ | 7235 | dwrq->flags = 1; /* Should be define'd */ |
7236 | memcpy(extra + sizeof(struct sockaddr)*i, | 7236 | memcpy(extra + sizeof(struct sockaddr) * i, qual, |
7237 | &qual, sizeof(struct iw_quality)*i); | 7237 | sizeof(struct iw_quality) * i); |
7238 | } | 7238 | } |
7239 | dwrq->length = i; | 7239 | dwrq->length = i; |
7240 | 7240 | ||
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index c54b7d37bff1..420d69b2674c 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -143,6 +143,7 @@ struct ath_common { | |||
143 | u32 keymax; | 143 | u32 keymax; |
144 | DECLARE_BITMAP(keymap, ATH_KEYMAX); | 144 | DECLARE_BITMAP(keymap, ATH_KEYMAX); |
145 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); | 145 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); |
146 | DECLARE_BITMAP(ccmp_keymap, ATH_KEYMAX); | ||
146 | enum ath_crypt_caps crypt_caps; | 147 | enum ath_crypt_caps crypt_caps; |
147 | 148 | ||
148 | unsigned int clockrate; | 149 | unsigned int clockrate; |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index fbaa30930076..44ad6fe0278f 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1045,11 +1045,11 @@ ath5k_drain_tx_buffs(struct ath5k_hw *ah) | |||
1045 | 1045 | ||
1046 | ath5k_txbuf_free_skb(ah, bf); | 1046 | ath5k_txbuf_free_skb(ah, bf); |
1047 | 1047 | ||
1048 | spin_lock_bh(&ah->txbuflock); | 1048 | spin_lock(&ah->txbuflock); |
1049 | list_move_tail(&bf->list, &ah->txbuf); | 1049 | list_move_tail(&bf->list, &ah->txbuf); |
1050 | ah->txbuf_len++; | 1050 | ah->txbuf_len++; |
1051 | txq->txq_len--; | 1051 | txq->txq_len--; |
1052 | spin_unlock_bh(&ah->txbuflock); | 1052 | spin_unlock(&ah->txbuflock); |
1053 | } | 1053 | } |
1054 | txq->link = NULL; | 1054 | txq->link = NULL; |
1055 | txq->txq_poll_mark = false; | 1055 | txq->txq_poll_mark = false; |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index a277cf6f339d..4866550ddd96 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -214,6 +214,7 @@ struct ath_frame_info { | |||
214 | enum ath9k_key_type keytype; | 214 | enum ath9k_key_type keytype; |
215 | u8 keyix; | 215 | u8 keyix; |
216 | u8 retries; | 216 | u8 retries; |
217 | u8 rtscts_rate; | ||
217 | }; | 218 | }; |
218 | 219 | ||
219 | struct ath_buf_state { | 220 | struct ath_buf_state { |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 2b8f61c210e1..abbd6effd60d 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -1496,6 +1496,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, | |||
1496 | priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--; | 1496 | priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--; |
1497 | 1497 | ||
1498 | if (priv->ah->opmode == NL80211_IFTYPE_STATION) { | 1498 | if (priv->ah->opmode == NL80211_IFTYPE_STATION) { |
1499 | ath9k_htc_choose_set_bssid(priv); | ||
1499 | if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1)) | 1500 | if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1)) |
1500 | ath9k_htc_start_ani(priv); | 1501 | ath9k_htc_start_ani(priv); |
1501 | else if (priv->num_sta_assoc_vif == 0) | 1502 | else if (priv->num_sta_assoc_vif == 0) |
@@ -1503,13 +1504,11 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, | |||
1503 | } | 1504 | } |
1504 | } | 1505 | } |
1505 | 1506 | ||
1506 | if (changed & BSS_CHANGED_BSSID) { | 1507 | if (changed & BSS_CHANGED_IBSS) { |
1507 | if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) { | 1508 | if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) { |
1508 | common->curaid = bss_conf->aid; | 1509 | common->curaid = bss_conf->aid; |
1509 | memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); | 1510 | memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); |
1510 | ath9k_htc_set_bssid(priv); | 1511 | ath9k_htc_set_bssid(priv); |
1511 | } else if (priv->ah->opmode == NL80211_IFTYPE_STATION) { | ||
1512 | ath9k_htc_choose_set_bssid(priv); | ||
1513 | } | 1512 | } |
1514 | } | 1513 | } |
1515 | 1514 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 7db1890448f2..995ca8e1302e 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -622,7 +622,7 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
622 | 622 | ||
623 | if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) { | 623 | if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) { |
624 | if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || | 624 | if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || |
625 | ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) && | 625 | ((AR_SREV_9160(ah) || AR_SREV_9280(ah) || AR_SREV_9287(ah)) && |
626 | !ah->is_pciexpress)) { | 626 | !ah->is_pciexpress)) { |
627 | ah->config.serialize_regmode = | 627 | ah->config.serialize_regmode = |
628 | SER_REG_MODE_ON; | 628 | SER_REG_MODE_ON; |
@@ -784,13 +784,25 @@ static void ath9k_hw_init_qos(struct ath_hw *ah) | |||
784 | 784 | ||
785 | u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) | 785 | u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) |
786 | { | 786 | { |
787 | struct ath_common *common = ath9k_hw_common(ah); | ||
788 | int i = 0; | ||
789 | |||
787 | REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); | 790 | REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); |
788 | udelay(100); | 791 | udelay(100); |
789 | REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); | 792 | REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); |
790 | 793 | ||
791 | while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) | 794 | while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) { |
795 | |||
792 | udelay(100); | 796 | udelay(100); |
793 | 797 | ||
798 | if (WARN_ON_ONCE(i >= 100)) { | ||
799 | ath_err(common, "PLL4 meaurement not done\n"); | ||
800 | break; | ||
801 | } | ||
802 | |||
803 | i++; | ||
804 | } | ||
805 | |||
794 | return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3; | 806 | return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3; |
795 | } | 807 | } |
796 | EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc); | 808 | EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 4de4473776ac..dac1a2709e3c 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -971,6 +971,15 @@ void ath_hw_pll_work(struct work_struct *work) | |||
971 | hw_pll_work.work); | 971 | hw_pll_work.work); |
972 | u32 pll_sqsum; | 972 | u32 pll_sqsum; |
973 | 973 | ||
974 | /* | ||
975 | * ensure that the PLL WAR is executed only | ||
976 | * after the STA is associated (or) if the | ||
977 | * beaconing had started in interfaces that | ||
978 | * uses beacons. | ||
979 | */ | ||
980 | if (!(sc->sc_flags & SC_OP_BEACONS)) | ||
981 | return; | ||
982 | |||
974 | if (AR_SREV_9485(sc->sc_ah)) { | 983 | if (AR_SREV_9485(sc->sc_ah)) { |
975 | 984 | ||
976 | ath9k_ps_wakeup(sc); | 985 | ath9k_ps_wakeup(sc); |
@@ -1443,15 +1452,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
1443 | } | 1452 | } |
1444 | } | 1453 | } |
1445 | 1454 | ||
1446 | if ((ah->opmode == NL80211_IFTYPE_ADHOC) || | ||
1447 | ((vif->type == NL80211_IFTYPE_ADHOC) && | ||
1448 | sc->nvifs > 0)) { | ||
1449 | ath_err(common, "Cannot create ADHOC interface when other" | ||
1450 | " interfaces already exist.\n"); | ||
1451 | ret = -EINVAL; | ||
1452 | goto out; | ||
1453 | } | ||
1454 | |||
1455 | ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); | 1455 | ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); |
1456 | 1456 | ||
1457 | sc->nvifs++; | 1457 | sc->nvifs++; |
@@ -1476,15 +1476,6 @@ static int ath9k_change_interface(struct ieee80211_hw *hw, | |||
1476 | mutex_lock(&sc->mutex); | 1476 | mutex_lock(&sc->mutex); |
1477 | ath9k_ps_wakeup(sc); | 1477 | ath9k_ps_wakeup(sc); |
1478 | 1478 | ||
1479 | /* See if new interface type is valid. */ | ||
1480 | if ((new_type == NL80211_IFTYPE_ADHOC) && | ||
1481 | (sc->nvifs > 1)) { | ||
1482 | ath_err(common, "When using ADHOC, it must be the only" | ||
1483 | " interface.\n"); | ||
1484 | ret = -EINVAL; | ||
1485 | goto out; | ||
1486 | } | ||
1487 | |||
1488 | if (ath9k_uses_beacons(new_type) && | 1479 | if (ath9k_uses_beacons(new_type) && |
1489 | !ath9k_uses_beacons(vif->type)) { | 1480 | !ath9k_uses_beacons(vif->type)) { |
1490 | if (sc->nbcnvifs >= ATH_BCBUF) { | 1481 | if (sc->nbcnvifs >= ATH_BCBUF) { |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index e1fcc68124dc..0735aeb3b26c 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -695,9 +695,9 @@ static bool ath_edma_get_buffers(struct ath_softc *sc, | |||
695 | __skb_unlink(skb, &rx_edma->rx_fifo); | 695 | __skb_unlink(skb, &rx_edma->rx_fifo); |
696 | list_add_tail(&bf->list, &sc->rx.rxbuf); | 696 | list_add_tail(&bf->list, &sc->rx.rxbuf); |
697 | ath_rx_edma_buf_link(sc, qtype); | 697 | ath_rx_edma_buf_link(sc, qtype); |
698 | } else { | ||
699 | bf = NULL; | ||
700 | } | 698 | } |
699 | |||
700 | bf = NULL; | ||
701 | } | 701 | } |
702 | 702 | ||
703 | *dest = bf; | 703 | *dest = bf; |
@@ -822,7 +822,8 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
822 | * descriptor does contain a valid key index. This has been observed | 822 | * descriptor does contain a valid key index. This has been observed |
823 | * mostly with CCMP encryption. | 823 | * mostly with CCMP encryption. |
824 | */ | 824 | */ |
825 | if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID) | 825 | if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID || |
826 | !test_bit(rx_stats->rs_keyix, common->ccmp_keymap)) | ||
826 | rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; | 827 | rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; |
827 | 828 | ||
828 | if (!rx_stats->rs_datalen) { | 829 | if (!rx_stats->rs_datalen) { |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index d59dd01d6cde..4d571394c7a8 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -938,6 +938,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, | |||
938 | struct ieee80211_tx_rate *rates; | 938 | struct ieee80211_tx_rate *rates; |
939 | const struct ieee80211_rate *rate; | 939 | const struct ieee80211_rate *rate; |
940 | struct ieee80211_hdr *hdr; | 940 | struct ieee80211_hdr *hdr; |
941 | struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); | ||
941 | int i; | 942 | int i; |
942 | u8 rix = 0; | 943 | u8 rix = 0; |
943 | 944 | ||
@@ -948,18 +949,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, | |||
948 | 949 | ||
949 | /* set dur_update_en for l-sig computation except for PS-Poll frames */ | 950 | /* set dur_update_en for l-sig computation except for PS-Poll frames */ |
950 | info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); | 951 | info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); |
951 | 952 | info->rtscts_rate = fi->rtscts_rate; | |
952 | /* | ||
953 | * We check if Short Preamble is needed for the CTS rate by | ||
954 | * checking the BSS's global flag. | ||
955 | * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. | ||
956 | */ | ||
957 | rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info); | ||
958 | info->rtscts_rate = rate->hw_value; | ||
959 | |||
960 | if (tx_info->control.vif && | ||
961 | tx_info->control.vif->bss_conf.use_short_preamble) | ||
962 | info->rtscts_rate |= rate->hw_value_short; | ||
963 | 953 | ||
964 | for (i = 0; i < 4; i++) { | 954 | for (i = 0; i < 4; i++) { |
965 | bool is_40, is_sgi, is_sp; | 955 | bool is_40, is_sgi, is_sp; |
@@ -1001,13 +991,13 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, | |||
1001 | } | 991 | } |
1002 | 992 | ||
1003 | /* legacy rates */ | 993 | /* legacy rates */ |
994 | rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx]; | ||
1004 | if ((tx_info->band == IEEE80211_BAND_2GHZ) && | 995 | if ((tx_info->band == IEEE80211_BAND_2GHZ) && |
1005 | !(rate->flags & IEEE80211_RATE_ERP_G)) | 996 | !(rate->flags & IEEE80211_RATE_ERP_G)) |
1006 | phy = WLAN_RC_PHY_CCK; | 997 | phy = WLAN_RC_PHY_CCK; |
1007 | else | 998 | else |
1008 | phy = WLAN_RC_PHY_OFDM; | 999 | phy = WLAN_RC_PHY_OFDM; |
1009 | 1000 | ||
1010 | rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx]; | ||
1011 | info->rates[i].Rate = rate->hw_value; | 1001 | info->rates[i].Rate = rate->hw_value; |
1012 | if (rate->hw_value_short) { | 1002 | if (rate->hw_value_short) { |
1013 | if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) | 1003 | if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) |
@@ -1776,10 +1766,22 @@ static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1776 | struct ieee80211_sta *sta = tx_info->control.sta; | 1766 | struct ieee80211_sta *sta = tx_info->control.sta; |
1777 | struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; | 1767 | struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; |
1778 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1768 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1769 | const struct ieee80211_rate *rate; | ||
1779 | struct ath_frame_info *fi = get_frame_info(skb); | 1770 | struct ath_frame_info *fi = get_frame_info(skb); |
1780 | struct ath_node *an = NULL; | 1771 | struct ath_node *an = NULL; |
1781 | enum ath9k_key_type keytype; | 1772 | enum ath9k_key_type keytype; |
1773 | bool short_preamble = false; | ||
1774 | |||
1775 | /* | ||
1776 | * We check if Short Preamble is needed for the CTS rate by | ||
1777 | * checking the BSS's global flag. | ||
1778 | * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. | ||
1779 | */ | ||
1780 | if (tx_info->control.vif && | ||
1781 | tx_info->control.vif->bss_conf.use_short_preamble) | ||
1782 | short_preamble = true; | ||
1782 | 1783 | ||
1784 | rate = ieee80211_get_rts_cts_rate(hw, tx_info); | ||
1783 | keytype = ath9k_cmn_get_hw_crypto_keytype(skb); | 1785 | keytype = ath9k_cmn_get_hw_crypto_keytype(skb); |
1784 | 1786 | ||
1785 | if (sta) | 1787 | if (sta) |
@@ -1794,6 +1796,9 @@ static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1794 | fi->keyix = ATH9K_TXKEYIX_INVALID; | 1796 | fi->keyix = ATH9K_TXKEYIX_INVALID; |
1795 | fi->keytype = keytype; | 1797 | fi->keytype = keytype; |
1796 | fi->framelen = framelen; | 1798 | fi->framelen = framelen; |
1799 | fi->rtscts_rate = rate->hw_value; | ||
1800 | if (short_preamble) | ||
1801 | fi->rtscts_rate |= rate->hw_value_short; | ||
1797 | } | 1802 | } |
1798 | 1803 | ||
1799 | u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) | 1804 | u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) |
diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c index 0e81904956cf..5c54aa43ca2d 100644 --- a/drivers/net/wireless/ath/key.c +++ b/drivers/net/wireless/ath/key.c | |||
@@ -556,6 +556,9 @@ int ath_key_config(struct ath_common *common, | |||
556 | return -EIO; | 556 | return -EIO; |
557 | 557 | ||
558 | set_bit(idx, common->keymap); | 558 | set_bit(idx, common->keymap); |
559 | if (key->cipher == WLAN_CIPHER_SUITE_CCMP) | ||
560 | set_bit(idx, common->ccmp_keymap); | ||
561 | |||
559 | if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { | 562 | if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { |
560 | set_bit(idx + 64, common->keymap); | 563 | set_bit(idx + 64, common->keymap); |
561 | set_bit(idx, common->tkip_keymap); | 564 | set_bit(idx, common->tkip_keymap); |
@@ -582,6 +585,7 @@ void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key) | |||
582 | return; | 585 | return; |
583 | 586 | ||
584 | clear_bit(key->hw_key_idx, common->keymap); | 587 | clear_bit(key->hw_key_idx, common->keymap); |
588 | clear_bit(key->hw_key_idx, common->ccmp_keymap); | ||
585 | if (key->cipher != WLAN_CIPHER_SUITE_TKIP) | 589 | if (key->cipher != WLAN_CIPHER_SUITE_TKIP) |
586 | return; | 590 | return; |
587 | 591 | ||
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c index f1f8bd09bd87..c8baf020c20f 100644 --- a/drivers/net/wireless/b43legacy/dma.c +++ b/drivers/net/wireless/b43legacy/dma.c | |||
@@ -1072,7 +1072,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring, | |||
1072 | meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); | 1072 | meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); |
1073 | /* create a bounce buffer in zone_dma on mapping failure. */ | 1073 | /* create a bounce buffer in zone_dma on mapping failure. */ |
1074 | if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { | 1074 | if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { |
1075 | bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); | 1075 | bounce_skb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); |
1076 | if (!bounce_skb) { | 1076 | if (!bounce_skb) { |
1077 | ring->current_slot = old_top_slot; | 1077 | ring->current_slot = old_top_slot; |
1078 | ring->used_slots = old_used_slots; | 1078 | ring->used_slots = old_used_slots; |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 509301a5e7e2..ff5d689e13f3 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -3405,7 +3405,7 @@ il4965_remove_dynamic_key(struct il_priv *il, | |||
3405 | return 0; | 3405 | return 0; |
3406 | } | 3406 | } |
3407 | 3407 | ||
3408 | if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) { | 3408 | if (il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_INVALID) { |
3409 | IL_WARN("Removing wrong key %d 0x%x\n", keyconf->keyidx, | 3409 | IL_WARN("Removing wrong key %d 0x%x\n", keyconf->keyidx, |
3410 | key_flags); | 3410 | key_flags); |
3411 | spin_unlock_irqrestore(&il->sta_lock, flags); | 3411 | spin_unlock_irqrestore(&il->sta_lock, flags); |
@@ -3420,7 +3420,7 @@ il4965_remove_dynamic_key(struct il_priv *il, | |||
3420 | memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo)); | 3420 | memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo)); |
3421 | il->stations[sta_id].sta.key.key_flags = | 3421 | il->stations[sta_id].sta.key.key_flags = |
3422 | STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; | 3422 | STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; |
3423 | il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET; | 3423 | il->stations[sta_id].sta.key.key_offset = keyconf->hw_key_idx; |
3424 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 3424 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
3425 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 3425 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
3426 | 3426 | ||
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index cbf2dc18341f..5d4807c2b56d 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -4767,14 +4767,12 @@ il_bg_watchdog(unsigned long data) | |||
4767 | return; | 4767 | return; |
4768 | 4768 | ||
4769 | /* monitor and check for other stuck queues */ | 4769 | /* monitor and check for other stuck queues */ |
4770 | if (il_is_any_associated(il)) { | 4770 | for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { |
4771 | for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { | 4771 | /* skip as we already checked the command queue */ |
4772 | /* skip as we already checked the command queue */ | 4772 | if (cnt == il->cmd_queue) |
4773 | if (cnt == il->cmd_queue) | 4773 | continue; |
4774 | continue; | 4774 | if (il_check_stuck_queue(il, cnt)) |
4775 | if (il_check_stuck_queue(il, cnt)) | 4775 | return; |
4776 | return; | ||
4777 | } | ||
4778 | } | 4776 | } |
4779 | 4777 | ||
4780 | mod_timer(&il->watchdog, | 4778 | mod_timer(&il->watchdog, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index e7c157e5ebeb..7f97dec8534d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -2239,6 +2239,7 @@ static ssize_t iwl_dbgfs_echo_test_write(struct file *file, | |||
2239 | return count; | 2239 | return count; |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
2242 | static ssize_t iwl_dbgfs_log_event_read(struct file *file, | 2243 | static ssize_t iwl_dbgfs_log_event_read(struct file *file, |
2243 | char __user *user_buf, | 2244 | char __user *user_buf, |
2244 | size_t count, loff_t *ppos) | 2245 | size_t count, loff_t *ppos) |
@@ -2276,6 +2277,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file, | |||
2276 | 2277 | ||
2277 | return count; | 2278 | return count; |
2278 | } | 2279 | } |
2280 | #endif | ||
2279 | 2281 | ||
2280 | static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file, | 2282 | static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file, |
2281 | char __user *user_buf, | 2283 | char __user *user_buf, |
@@ -2345,7 +2347,9 @@ DEBUGFS_READ_FILE_OPS(bt_traffic); | |||
2345 | DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); | 2347 | DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); |
2346 | DEBUGFS_READ_FILE_OPS(reply_tx_error); | 2348 | DEBUGFS_READ_FILE_OPS(reply_tx_error); |
2347 | DEBUGFS_WRITE_FILE_OPS(echo_test); | 2349 | DEBUGFS_WRITE_FILE_OPS(echo_test); |
2350 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
2348 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); | 2351 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); |
2352 | #endif | ||
2349 | DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); | 2353 | DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); |
2350 | 2354 | ||
2351 | /* | 2355 | /* |
@@ -2405,7 +2409,9 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2405 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 2409 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
2406 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 2410 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
2407 | DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR); | 2411 | DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR); |
2412 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
2408 | DEBUGFS_ADD_FILE(log_event, dir_debug, S_IWUSR | S_IRUSR); | 2413 | DEBUGFS_ADD_FILE(log_event, dir_debug, S_IWUSR | S_IRUSR); |
2414 | #endif | ||
2409 | 2415 | ||
2410 | if (iwl_advanced_bt_coexist(priv)) | 2416 | if (iwl_advanced_bt_coexist(priv)) |
2411 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); | 2417 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c index 3ee23134c02b..013680332f07 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
@@ -796,6 +796,18 @@ int iwlagn_mac_sta_state(struct ieee80211_hw *hw, | |||
796 | switch (op) { | 796 | switch (op) { |
797 | case ADD: | 797 | case ADD: |
798 | ret = iwlagn_mac_sta_add(hw, vif, sta); | 798 | ret = iwlagn_mac_sta_add(hw, vif, sta); |
799 | if (ret) | ||
800 | break; | ||
801 | /* | ||
802 | * Clear the in-progress flag, the AP station entry was added | ||
803 | * but we'll initialize LQ only when we've associated (which | ||
804 | * would also clear the in-progress flag). This is necessary | ||
805 | * in case we never initialize LQ because association fails. | ||
806 | */ | ||
807 | spin_lock_bh(&priv->sta_lock); | ||
808 | priv->stations[iwl_sta_id(sta)].used &= | ||
809 | ~IWL_STA_UCODE_INPROGRESS; | ||
810 | spin_unlock_bh(&priv->sta_lock); | ||
799 | break; | 811 | break; |
800 | case REMOVE: | 812 | case REMOVE: |
801 | ret = iwlagn_mac_sta_remove(hw, vif, sta); | 813 | ret = iwlagn_mac_sta_remove(hw, vif, sta); |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c index 9c44088054dd..900ee129e825 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c | |||
@@ -256,7 +256,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, | |||
256 | else | 256 | else |
257 | last_seq = priv->rx_seq[tid]; | 257 | last_seq = priv->rx_seq[tid]; |
258 | 258 | ||
259 | if (last_seq >= new_node->start_win) | 259 | if (last_seq != MWIFIEX_DEF_11N_RX_SEQ_NUM && |
260 | last_seq >= new_node->start_win) | ||
260 | new_node->start_win = last_seq + 1; | 261 | new_node->start_win = last_seq + 1; |
261 | 262 | ||
262 | new_node->win_size = win_size; | 263 | new_node->win_size = win_size; |
@@ -596,5 +597,5 @@ void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv) | |||
596 | spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); | 597 | spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); |
597 | 598 | ||
598 | INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr); | 599 | INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr); |
599 | memset(priv->rx_seq, 0, sizeof(priv->rx_seq)); | 600 | mwifiex_reset_11n_rx_seq_num(priv); |
600 | } | 601 | } |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h index f1bffebabc60..6c9815a0f5d8 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.h +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h | |||
@@ -37,6 +37,13 @@ | |||
37 | 37 | ||
38 | #define ADDBA_RSP_STATUS_ACCEPT 0 | 38 | #define ADDBA_RSP_STATUS_ACCEPT 0 |
39 | 39 | ||
40 | #define MWIFIEX_DEF_11N_RX_SEQ_NUM 0xffff | ||
41 | |||
42 | static inline void mwifiex_reset_11n_rx_seq_num(struct mwifiex_private *priv) | ||
43 | { | ||
44 | memset(priv->rx_seq, 0xff, sizeof(priv->rx_seq)); | ||
45 | } | ||
46 | |||
40 | int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *, | 47 | int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *, |
41 | u16 seqNum, | 48 | u16 seqNum, |
42 | u16 tid, u8 *ta, | 49 | u16 tid, u8 *ta, |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 015fec3371a0..5c7fd185373c 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -958,6 +958,7 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
958 | case NL80211_HIDDEN_SSID_ZERO_CONTENTS: | 958 | case NL80211_HIDDEN_SSID_ZERO_CONTENTS: |
959 | /* firmware doesn't support this type of hidden SSID */ | 959 | /* firmware doesn't support this type of hidden SSID */ |
960 | default: | 960 | default: |
961 | kfree(bss_cfg); | ||
961 | return -EINVAL; | 962 | return -EINVAL; |
962 | } | 963 | } |
963 | 964 | ||
@@ -1484,7 +1485,7 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
1484 | struct wireless_dev *wdev; | 1485 | struct wireless_dev *wdev; |
1485 | 1486 | ||
1486 | if (!adapter) | 1487 | if (!adapter) |
1487 | return NULL; | 1488 | return ERR_PTR(-EFAULT); |
1488 | 1489 | ||
1489 | switch (type) { | 1490 | switch (type) { |
1490 | case NL80211_IFTYPE_UNSPECIFIED: | 1491 | case NL80211_IFTYPE_UNSPECIFIED: |
@@ -1494,12 +1495,12 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
1494 | if (priv->bss_mode) { | 1495 | if (priv->bss_mode) { |
1495 | wiphy_err(wiphy, | 1496 | wiphy_err(wiphy, |
1496 | "cannot create multiple sta/adhoc ifaces\n"); | 1497 | "cannot create multiple sta/adhoc ifaces\n"); |
1497 | return NULL; | 1498 | return ERR_PTR(-EINVAL); |
1498 | } | 1499 | } |
1499 | 1500 | ||
1500 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); | 1501 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); |
1501 | if (!wdev) | 1502 | if (!wdev) |
1502 | return NULL; | 1503 | return ERR_PTR(-ENOMEM); |
1503 | 1504 | ||
1504 | wdev->wiphy = wiphy; | 1505 | wdev->wiphy = wiphy; |
1505 | priv->wdev = wdev; | 1506 | priv->wdev = wdev; |
@@ -1522,12 +1523,12 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
1522 | 1523 | ||
1523 | if (priv->bss_mode) { | 1524 | if (priv->bss_mode) { |
1524 | wiphy_err(wiphy, "Can't create multiple AP interfaces"); | 1525 | wiphy_err(wiphy, "Can't create multiple AP interfaces"); |
1525 | return NULL; | 1526 | return ERR_PTR(-EINVAL); |
1526 | } | 1527 | } |
1527 | 1528 | ||
1528 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); | 1529 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); |
1529 | if (!wdev) | 1530 | if (!wdev) |
1530 | return NULL; | 1531 | return ERR_PTR(-ENOMEM); |
1531 | 1532 | ||
1532 | priv->wdev = wdev; | 1533 | priv->wdev = wdev; |
1533 | wdev->wiphy = wiphy; | 1534 | wdev->wiphy = wiphy; |
@@ -1544,14 +1545,15 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
1544 | break; | 1545 | break; |
1545 | default: | 1546 | default: |
1546 | wiphy_err(wiphy, "type not supported\n"); | 1547 | wiphy_err(wiphy, "type not supported\n"); |
1547 | return NULL; | 1548 | return ERR_PTR(-EINVAL); |
1548 | } | 1549 | } |
1549 | 1550 | ||
1550 | dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), name, | 1551 | dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), name, |
1551 | ether_setup, 1); | 1552 | ether_setup, 1); |
1552 | if (!dev) { | 1553 | if (!dev) { |
1553 | wiphy_err(wiphy, "no memory available for netdevice\n"); | 1554 | wiphy_err(wiphy, "no memory available for netdevice\n"); |
1554 | goto error; | 1555 | priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; |
1556 | return ERR_PTR(-ENOMEM); | ||
1555 | } | 1557 | } |
1556 | 1558 | ||
1557 | mwifiex_init_priv_params(priv, dev); | 1559 | mwifiex_init_priv_params(priv, dev); |
@@ -1582,7 +1584,9 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
1582 | /* Register network device */ | 1584 | /* Register network device */ |
1583 | if (register_netdevice(dev)) { | 1585 | if (register_netdevice(dev)) { |
1584 | wiphy_err(wiphy, "cannot register virtual network device\n"); | 1586 | wiphy_err(wiphy, "cannot register virtual network device\n"); |
1585 | goto error; | 1587 | free_netdev(dev); |
1588 | priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; | ||
1589 | return ERR_PTR(-EFAULT); | ||
1586 | } | 1590 | } |
1587 | 1591 | ||
1588 | sema_init(&priv->async_sem, 1); | 1592 | sema_init(&priv->async_sem, 1); |
@@ -1594,12 +1598,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
1594 | mwifiex_dev_debugfs_init(priv); | 1598 | mwifiex_dev_debugfs_init(priv); |
1595 | #endif | 1599 | #endif |
1596 | return dev; | 1600 | return dev; |
1597 | error: | ||
1598 | if (dev && (dev->reg_state == NETREG_UNREGISTERED)) | ||
1599 | free_netdev(dev); | ||
1600 | priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; | ||
1601 | |||
1602 | return NULL; | ||
1603 | } | 1601 | } |
1604 | EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf); | 1602 | EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf); |
1605 | 1603 | ||
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c index ceb82cd749cc..383820a52beb 100644 --- a/drivers/net/wireless/mwifiex/ie.c +++ b/drivers/net/wireless/mwifiex/ie.c | |||
@@ -213,6 +213,7 @@ mwifiex_update_uap_custom_ie(struct mwifiex_private *priv, | |||
213 | /* save assoc resp ie index after auto-indexing */ | 213 | /* save assoc resp ie index after auto-indexing */ |
214 | *assoc_idx = *((u16 *)pos); | 214 | *assoc_idx = *((u16 *)pos); |
215 | 215 | ||
216 | kfree(ap_custom_ie); | ||
216 | return ret; | 217 | return ret; |
217 | } | 218 | } |
218 | 219 | ||
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index e0377473282f..fc8a9bfa1248 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c | |||
@@ -978,10 +978,10 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter, | |||
978 | dev_dbg(adapter->dev, "info: --- Rx: Event ---\n"); | 978 | dev_dbg(adapter->dev, "info: --- Rx: Event ---\n"); |
979 | adapter->event_cause = *(u32 *) skb->data; | 979 | adapter->event_cause = *(u32 *) skb->data; |
980 | 980 | ||
981 | skb_pull(skb, MWIFIEX_EVENT_HEADER_LEN); | ||
982 | |||
983 | if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE)) | 981 | if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE)) |
984 | memcpy(adapter->event_body, skb->data, skb->len); | 982 | memcpy(adapter->event_body, |
983 | skb->data + MWIFIEX_EVENT_HEADER_LEN, | ||
984 | skb->len); | ||
985 | 985 | ||
986 | /* event cause has been saved to adapter->event_cause */ | 986 | /* event cause has been saved to adapter->event_cause */ |
987 | adapter->event_received = true; | 987 | adapter->event_received = true; |
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index 4ace5a3dcd23..11e731f3581c 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -406,9 +406,9 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
406 | break; | 406 | break; |
407 | 407 | ||
408 | case EVENT_UAP_STA_ASSOC: | 408 | case EVENT_UAP_STA_ASSOC: |
409 | skb_pull(adapter->event_skb, MWIFIEX_UAP_EVENT_EXTRA_HEADER); | ||
410 | memset(&sinfo, 0, sizeof(sinfo)); | 409 | memset(&sinfo, 0, sizeof(sinfo)); |
411 | event = (struct mwifiex_assoc_event *)adapter->event_skb->data; | 410 | event = (struct mwifiex_assoc_event *) |
411 | (adapter->event_body + MWIFIEX_UAP_EVENT_EXTRA_HEADER); | ||
412 | if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) { | 412 | if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) { |
413 | len = -1; | 413 | len = -1; |
414 | 414 | ||
@@ -433,9 +433,8 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
433 | GFP_KERNEL); | 433 | GFP_KERNEL); |
434 | break; | 434 | break; |
435 | case EVENT_UAP_STA_DEAUTH: | 435 | case EVENT_UAP_STA_DEAUTH: |
436 | skb_pull(adapter->event_skb, MWIFIEX_UAP_EVENT_EXTRA_HEADER); | 436 | cfg80211_del_sta(priv->netdev, adapter->event_body + |
437 | cfg80211_del_sta(priv->netdev, adapter->event_skb->data, | 437 | MWIFIEX_UAP_EVENT_EXTRA_HEADER, GFP_KERNEL); |
438 | GFP_KERNEL); | ||
439 | break; | 438 | break; |
440 | case EVENT_UAP_BSS_IDLE: | 439 | case EVENT_UAP_BSS_IDLE: |
441 | priv->media_connected = false; | 440 | priv->media_connected = false; |
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index e2faec4db108..cecb27283196 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c | |||
@@ -161,15 +161,11 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, | |||
161 | goto done; | 161 | goto done; |
162 | 162 | ||
163 | for (i = 0; i < adapter->priv_num; i++) { | 163 | for (i = 0; i < adapter->priv_num; i++) { |
164 | |||
165 | tpriv = adapter->priv[i]; | 164 | tpriv = adapter->priv[i]; |
166 | 165 | ||
167 | if ((GET_BSS_ROLE(tpriv) == MWIFIEX_BSS_ROLE_STA) && | 166 | if (tpriv->media_connected && |
168 | (tpriv->media_connected)) { | 167 | netif_queue_stopped(tpriv->netdev)) |
169 | if (netif_queue_stopped(tpriv->netdev)) | 168 | mwifiex_wake_up_net_dev_queue(tpriv->netdev, adapter); |
170 | mwifiex_wake_up_net_dev_queue(tpriv->netdev, | ||
171 | adapter); | ||
172 | } | ||
173 | } | 169 | } |
174 | done: | 170 | done: |
175 | dev_kfree_skb_any(skb); | 171 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c index 8173ab66066d..89f9a2a45de3 100644 --- a/drivers/net/wireless/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/mwifiex/uap_cmd.c | |||
@@ -27,6 +27,17 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, | |||
27 | struct cfg80211_ap_settings *params) { | 27 | struct cfg80211_ap_settings *params) { |
28 | int i; | 28 | int i; |
29 | 29 | ||
30 | if (!params->privacy) { | ||
31 | bss_config->protocol = PROTOCOL_NO_SECURITY; | ||
32 | bss_config->key_mgmt = KEY_MGMT_NONE; | ||
33 | bss_config->wpa_cfg.length = 0; | ||
34 | priv->sec_info.wep_enabled = 0; | ||
35 | priv->sec_info.wpa_enabled = 0; | ||
36 | priv->sec_info.wpa2_enabled = 0; | ||
37 | |||
38 | return 0; | ||
39 | } | ||
40 | |||
30 | switch (params->auth_type) { | 41 | switch (params->auth_type) { |
31 | case NL80211_AUTHTYPE_OPEN_SYSTEM: | 42 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
32 | bss_config->auth_mode = WLAN_AUTH_OPEN; | 43 | bss_config->auth_mode = WLAN_AUTH_OPEN; |
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index 49ebf20c56eb..22a5916564b8 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c | |||
@@ -49,6 +49,7 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
49 | struct device *dev = adapter->dev; | 49 | struct device *dev = adapter->dev; |
50 | u32 recv_type; | 50 | u32 recv_type; |
51 | __le32 tmp; | 51 | __le32 tmp; |
52 | int ret; | ||
52 | 53 | ||
53 | if (adapter->hs_activated) | 54 | if (adapter->hs_activated) |
54 | mwifiex_process_hs_config(adapter); | 55 | mwifiex_process_hs_config(adapter); |
@@ -69,16 +70,19 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
69 | case MWIFIEX_USB_TYPE_CMD: | 70 | case MWIFIEX_USB_TYPE_CMD: |
70 | if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { | 71 | if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { |
71 | dev_err(dev, "CMD: skb->len too large\n"); | 72 | dev_err(dev, "CMD: skb->len too large\n"); |
72 | return -1; | 73 | ret = -1; |
74 | goto exit_restore_skb; | ||
73 | } else if (!adapter->curr_cmd) { | 75 | } else if (!adapter->curr_cmd) { |
74 | dev_dbg(dev, "CMD: no curr_cmd\n"); | 76 | dev_dbg(dev, "CMD: no curr_cmd\n"); |
75 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { | 77 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { |
76 | mwifiex_process_sleep_confirm_resp( | 78 | mwifiex_process_sleep_confirm_resp( |
77 | adapter, skb->data, | 79 | adapter, skb->data, |
78 | skb->len); | 80 | skb->len); |
79 | return 0; | 81 | ret = 0; |
82 | goto exit_restore_skb; | ||
80 | } | 83 | } |
81 | return -1; | 84 | ret = -1; |
85 | goto exit_restore_skb; | ||
82 | } | 86 | } |
83 | 87 | ||
84 | adapter->curr_cmd->resp_skb = skb; | 88 | adapter->curr_cmd->resp_skb = skb; |
@@ -87,20 +91,22 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
87 | case MWIFIEX_USB_TYPE_EVENT: | 91 | case MWIFIEX_USB_TYPE_EVENT: |
88 | if (skb->len < sizeof(u32)) { | 92 | if (skb->len < sizeof(u32)) { |
89 | dev_err(dev, "EVENT: skb->len too small\n"); | 93 | dev_err(dev, "EVENT: skb->len too small\n"); |
90 | return -1; | 94 | ret = -1; |
95 | goto exit_restore_skb; | ||
91 | } | 96 | } |
92 | skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); | 97 | skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); |
93 | adapter->event_cause = le32_to_cpu(tmp); | 98 | adapter->event_cause = le32_to_cpu(tmp); |
94 | skb_pull(skb, sizeof(u32)); | ||
95 | dev_dbg(dev, "event_cause %#x\n", adapter->event_cause); | 99 | dev_dbg(dev, "event_cause %#x\n", adapter->event_cause); |
96 | 100 | ||
97 | if (skb->len > MAX_EVENT_SIZE) { | 101 | if (skb->len > MAX_EVENT_SIZE) { |
98 | dev_err(dev, "EVENT: event body too large\n"); | 102 | dev_err(dev, "EVENT: event body too large\n"); |
99 | return -1; | 103 | ret = -1; |
104 | goto exit_restore_skb; | ||
100 | } | 105 | } |
101 | 106 | ||
102 | skb_copy_from_linear_data(skb, adapter->event_body, | 107 | memcpy(adapter->event_body, skb->data + |
103 | skb->len); | 108 | MWIFIEX_EVENT_HEADER_LEN, skb->len); |
109 | |||
104 | adapter->event_received = true; | 110 | adapter->event_received = true; |
105 | adapter->event_skb = skb; | 111 | adapter->event_skb = skb; |
106 | break; | 112 | break; |
@@ -124,6 +130,12 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
124 | } | 130 | } |
125 | 131 | ||
126 | return -EINPROGRESS; | 132 | return -EINPROGRESS; |
133 | |||
134 | exit_restore_skb: | ||
135 | /* The buffer will be reused for further cmds/events */ | ||
136 | skb_push(skb, INTF_HEADER_LEN); | ||
137 | |||
138 | return ret; | ||
127 | } | 139 | } |
128 | 140 | ||
129 | static void mwifiex_usb_rx_complete(struct urb *urb) | 141 | static void mwifiex_usb_rx_complete(struct urb *urb) |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index f3fc65515857..3fa4d4176993 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -404,6 +404,8 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter) | |||
404 | priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE; | 404 | priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE; |
405 | priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE; | 405 | priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE; |
406 | 406 | ||
407 | mwifiex_reset_11n_rx_seq_num(priv); | ||
408 | |||
407 | atomic_set(&priv->wmm.tx_pkts_queued, 0); | 409 | atomic_set(&priv->wmm.tx_pkts_queued, 0); |
408 | atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); | 410 | atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); |
409 | } | 411 | } |
@@ -1221,6 +1223,7 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter) | |||
1221 | 1223 | ||
1222 | if (!ptr->is_11n_enabled || | 1224 | if (!ptr->is_11n_enabled || |
1223 | mwifiex_is_ba_stream_setup(priv, ptr, tid) || | 1225 | mwifiex_is_ba_stream_setup(priv, ptr, tid) || |
1226 | priv->wps.session_enable || | ||
1224 | ((priv->sec_info.wpa_enabled || | 1227 | ((priv->sec_info.wpa_enabled || |
1225 | priv->sec_info.wpa2_enabled) && | 1228 | priv->sec_info.wpa2_enabled) && |
1226 | !priv->wpa_is_gtk_set)) { | 1229 | !priv->wpa_is_gtk_set)) { |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 2e9e6af21362..dfcd02ab6cae 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -2110,7 +2110,7 @@ resize_buf: | |||
2110 | while (check_bssid_list_item(bssid, bssid_len, buf, len)) { | 2110 | while (check_bssid_list_item(bssid, bssid_len, buf, len)) { |
2111 | if (rndis_bss_info_update(usbdev, bssid) && match_bssid && | 2111 | if (rndis_bss_info_update(usbdev, bssid) && match_bssid && |
2112 | matched) { | 2112 | matched) { |
2113 | if (!ether_addr_equal(bssid->mac, match_bssid)) | 2113 | if (ether_addr_equal(bssid->mac, match_bssid)) |
2114 | *matched = true; | 2114 | *matched = true; |
2115 | } | 2115 | } |
2116 | 2116 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index d357d1ed92f6..74ecc33fdd90 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -436,8 +436,8 @@ void rt2x00usb_kick_queue(struct data_queue *queue) | |||
436 | case QID_RX: | 436 | case QID_RX: |
437 | if (!rt2x00queue_full(queue)) | 437 | if (!rt2x00queue_full(queue)) |
438 | rt2x00queue_for_each_entry(queue, | 438 | rt2x00queue_for_each_entry(queue, |
439 | Q_INDEX_DONE, | ||
440 | Q_INDEX, | 439 | Q_INDEX, |
440 | Q_INDEX_DONE, | ||
441 | NULL, | 441 | NULL, |
442 | rt2x00usb_kick_rx_entry); | 442 | rt2x00usb_kick_rx_entry); |
443 | break; | 443 | break; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index d228358e6a40..9970c2b1b199 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
@@ -301,9 +301,11 @@ static struct usb_device_id rtl8192c_usb_ids[] = { | |||
301 | {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ | 301 | {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ |
302 | {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ | 302 | {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ |
303 | {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ | 303 | {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ |
304 | {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ | ||
304 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | 305 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
305 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | 306 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
306 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ | 307 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ |
308 | {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ | ||
307 | /* HP - Lite-On ,8188CUS Slim Combo */ | 309 | /* HP - Lite-On ,8188CUS Slim Combo */ |
308 | {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, | 310 | {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, |
309 | {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */ | 311 | {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */ |
@@ -346,6 +348,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { | |||
346 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ | 348 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ |
347 | {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ | 349 | {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ |
348 | {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ | 350 | {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ |
351 | {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ | ||
349 | {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ | 352 | {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ |
350 | {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/ | 353 | {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/ |
351 | {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/ | 354 | {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/ |
diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c index ad87a1ac6462..db6430c1a084 100644 --- a/drivers/net/wireless/ti/wl1251/acx.c +++ b/drivers/net/wireless/ti/wl1251/acx.c | |||
@@ -869,7 +869,7 @@ int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime) | |||
869 | } | 869 | } |
870 | 870 | ||
871 | *mactime = tsf_info->current_tsf_lsb | | 871 | *mactime = tsf_info->current_tsf_lsb | |
872 | (tsf_info->current_tsf_msb << 31); | 872 | ((u64)tsf_info->current_tsf_msb << 32); |
873 | 873 | ||
874 | out: | 874 | out: |
875 | kfree(tsf_info); | 875 | kfree(tsf_info); |
diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c index 9f15ccaf8f05..5ec50a476a69 100644 --- a/drivers/net/wireless/ti/wl1251/event.c +++ b/drivers/net/wireless/ti/wl1251/event.c | |||
@@ -76,8 +76,7 @@ static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox) | |||
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID && | 79 | if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { |
80 | wl->station_mode != STATION_ACTIVE_MODE) { | ||
81 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); | 80 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); |
82 | 81 | ||
83 | /* indicate to the stack, that beacons have been lost */ | 82 | /* indicate to the stack, that beacons have been lost */ |
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c index 87f6305bda2c..567660cd2fcd 100644 --- a/drivers/net/wireless/ti/wl1251/spi.c +++ b/drivers/net/wireless/ti/wl1251/spi.c | |||
@@ -73,6 +73,8 @@ static void wl1251_spi_reset(struct wl1251 *wl) | |||
73 | spi_sync(wl_to_spi(wl), &m); | 73 | spi_sync(wl_to_spi(wl), &m); |
74 | 74 | ||
75 | wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); | 75 | wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); |
76 | |||
77 | kfree(cmd); | ||
76 | } | 78 | } |
77 | 79 | ||
78 | static void wl1251_spi_wake(struct wl1251 *wl) | 80 | static void wl1251_spi_wake(struct wl1251 *wl) |
@@ -127,6 +129,8 @@ static void wl1251_spi_wake(struct wl1251 *wl) | |||
127 | spi_sync(wl_to_spi(wl), &m); | 129 | spi_sync(wl_to_spi(wl), &m); |
128 | 130 | ||
129 | wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); | 131 | wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); |
132 | |||
133 | kfree(cmd); | ||
130 | } | 134 | } |
131 | 135 | ||
132 | static void wl1251_spi_reset_wake(struct wl1251 *wl) | 136 | static void wl1251_spi_reset_wake(struct wl1251 *wl) |
diff --git a/drivers/net/wireless/ti/wlcore/Kconfig b/drivers/net/wireless/ti/wlcore/Kconfig index 54156b0b5c2d..d7b907e67170 100644 --- a/drivers/net/wireless/ti/wlcore/Kconfig +++ b/drivers/net/wireless/ti/wlcore/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | config WLCORE | 1 | config WLCORE |
2 | tristate "TI wlcore support" | 2 | tristate "TI wlcore support" |
3 | depends on WL_TI && GENERIC_HARDIRQS && MAC80211 | 3 | depends on WL_TI && GENERIC_HARDIRQS && MAC80211 |
4 | depends on INET | ||
5 | select FW_LOADER | 4 | select FW_LOADER |
6 | ---help--- | 5 | ---help--- |
7 | This module contains the main code for TI WLAN chips. It abstracts | 6 | This module contains the main code for TI WLAN chips. It abstracts |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 2027afe405fe..30899901aef5 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1935,14 +1935,14 @@ static int __devexit xennet_remove(struct xenbus_device *dev) | |||
1935 | 1935 | ||
1936 | dev_dbg(&dev->dev, "%s\n", dev->nodename); | 1936 | dev_dbg(&dev->dev, "%s\n", dev->nodename); |
1937 | 1937 | ||
1938 | unregister_netdev(info->netdev); | ||
1939 | |||
1940 | xennet_disconnect_backend(info); | 1938 | xennet_disconnect_backend(info); |
1941 | 1939 | ||
1942 | del_timer_sync(&info->rx_refill_timer); | ||
1943 | |||
1944 | xennet_sysfs_delif(info->netdev); | 1940 | xennet_sysfs_delif(info->netdev); |
1945 | 1941 | ||
1942 | unregister_netdev(info->netdev); | ||
1943 | |||
1944 | del_timer_sync(&info->rx_refill_timer); | ||
1945 | |||
1946 | free_percpu(info->stats); | 1946 | free_percpu(info->stats); |
1947 | 1947 | ||
1948 | free_netdev(info->netdev); | 1948 | free_netdev(info->netdev); |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 343ad29e211c..e44f8c2d239d 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -317,10 +317,9 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l | |||
317 | for(; lookup->compatible != NULL; lookup++) { | 317 | for(; lookup->compatible != NULL; lookup++) { |
318 | if (!of_device_is_compatible(np, lookup->compatible)) | 318 | if (!of_device_is_compatible(np, lookup->compatible)) |
319 | continue; | 319 | continue; |
320 | if (of_address_to_resource(np, 0, &res)) | 320 | if (!of_address_to_resource(np, 0, &res)) |
321 | continue; | 321 | if (res.start != lookup->phys_addr) |
322 | if (res.start != lookup->phys_addr) | 322 | continue; |
323 | continue; | ||
324 | pr_debug("%s: devname=%s\n", np->full_name, lookup->name); | 323 | pr_debug("%s: devname=%s\n", np->full_name, lookup->name); |
325 | return lookup; | 324 | return lookup; |
326 | } | 325 | } |
@@ -462,4 +461,5 @@ int of_platform_populate(struct device_node *root, | |||
462 | of_node_put(root); | 461 | of_node_put(root); |
463 | return rc; | 462 | return rc; |
464 | } | 463 | } |
464 | EXPORT_SYMBOL_GPL(of_platform_populate); | ||
465 | #endif /* CONFIG_OF_ADDRESS */ | 465 | #endif /* CONFIG_OF_ADDRESS */ |
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c index da14432806c6..efc4b7f308cf 100644 --- a/drivers/oprofile/oprofile_perf.c +++ b/drivers/oprofile/oprofile_perf.c | |||
@@ -25,7 +25,7 @@ static int oprofile_perf_enabled; | |||
25 | static DEFINE_MUTEX(oprofile_perf_mutex); | 25 | static DEFINE_MUTEX(oprofile_perf_mutex); |
26 | 26 | ||
27 | static struct op_counter_config *counter_config; | 27 | static struct op_counter_config *counter_config; |
28 | static struct perf_event **perf_events[nr_cpumask_bits]; | 28 | static struct perf_event **perf_events[NR_CPUS]; |
29 | static int num_counters; | 29 | static int num_counters; |
30 | 30 | ||
31 | /* | 31 | /* |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index bf0cee629b60..099f46cd8e87 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -748,6 +748,18 @@ static int pci_pm_suspend_noirq(struct device *dev) | |||
748 | 748 | ||
749 | pci_pm_set_unknown_state(pci_dev); | 749 | pci_pm_set_unknown_state(pci_dev); |
750 | 750 | ||
751 | /* | ||
752 | * Some BIOSes from ASUS have a bug: If a USB EHCI host controller's | ||
753 | * PCI COMMAND register isn't 0, the BIOS assumes that the controller | ||
754 | * hasn't been quiesced and tries to turn it off. If the controller | ||
755 | * is already in D3, this can hang or cause memory corruption. | ||
756 | * | ||
757 | * Since the value of the COMMAND register doesn't matter once the | ||
758 | * device has been suspended, we can safely set it to 0 here. | ||
759 | */ | ||
760 | if (pci_dev->class == PCI_CLASS_SERIAL_USB_EHCI) | ||
761 | pci_write_config_word(pci_dev, PCI_COMMAND, 0); | ||
762 | |||
751 | return 0; | 763 | return 0; |
752 | } | 764 | } |
753 | 765 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 77cb54a65cde..447e83472c01 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1744,11 +1744,6 @@ int pci_prepare_to_sleep(struct pci_dev *dev) | |||
1744 | if (target_state == PCI_POWER_ERROR) | 1744 | if (target_state == PCI_POWER_ERROR) |
1745 | return -EIO; | 1745 | return -EIO; |
1746 | 1746 | ||
1747 | /* Some devices mustn't be in D3 during system sleep */ | ||
1748 | if (target_state == PCI_D3hot && | ||
1749 | (dev->dev_flags & PCI_DEV_FLAGS_NO_D3_DURING_SLEEP)) | ||
1750 | return 0; | ||
1751 | |||
1752 | pci_enable_wake(dev, target_state, device_may_wakeup(&dev->dev)); | 1747 | pci_enable_wake(dev, target_state, device_may_wakeup(&dev->dev)); |
1753 | 1748 | ||
1754 | error = pci_set_power_state(dev, target_state); | 1749 | error = pci_set_power_state(dev, target_state); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 194b243a2817..2a7521677541 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -2929,32 +2929,6 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev) | |||
2929 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq); | 2929 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq); |
2930 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); | 2930 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); |
2931 | 2931 | ||
2932 | /* | ||
2933 | * The Intel 6 Series/C200 Series chipset's EHCI controllers on many | ||
2934 | * ASUS motherboards will cause memory corruption or a system crash | ||
2935 | * if they are in D3 while the system is put into S3 sleep. | ||
2936 | */ | ||
2937 | static void __devinit asus_ehci_no_d3(struct pci_dev *dev) | ||
2938 | { | ||
2939 | const char *sys_info; | ||
2940 | static const char good_Asus_board[] = "P8Z68-V"; | ||
2941 | |||
2942 | if (dev->dev_flags & PCI_DEV_FLAGS_NO_D3_DURING_SLEEP) | ||
2943 | return; | ||
2944 | if (dev->subsystem_vendor != PCI_VENDOR_ID_ASUSTEK) | ||
2945 | return; | ||
2946 | sys_info = dmi_get_system_info(DMI_BOARD_NAME); | ||
2947 | if (sys_info && memcmp(sys_info, good_Asus_board, | ||
2948 | sizeof(good_Asus_board) - 1) == 0) | ||
2949 | return; | ||
2950 | |||
2951 | dev_info(&dev->dev, "broken D3 during system sleep on ASUS\n"); | ||
2952 | dev->dev_flags |= PCI_DEV_FLAGS_NO_D3_DURING_SLEEP; | ||
2953 | device_set_wakeup_capable(&dev->dev, false); | ||
2954 | } | ||
2955 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1c26, asus_ehci_no_d3); | ||
2956 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1c2d, asus_ehci_no_d3); | ||
2957 | |||
2958 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, | 2932 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, |
2959 | struct pci_fixup *end) | 2933 | struct pci_fixup *end) |
2960 | { | 2934 | { |
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c index dd6d93aa5334..90c837f469a6 100644 --- a/drivers/pinctrl/pinctrl-imx.c +++ b/drivers/pinctrl/pinctrl-imx.c | |||
@@ -474,7 +474,9 @@ static int __devinit imx_pinctrl_parse_groups(struct device_node *np, | |||
474 | grp->configs[j] = config & ~IMX_PAD_SION; | 474 | grp->configs[j] = config & ~IMX_PAD_SION; |
475 | } | 475 | } |
476 | 476 | ||
477 | #ifdef DEBUG | ||
477 | IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins); | 478 | IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins); |
479 | #endif | ||
478 | 480 | ||
479 | return 0; | 481 | return 0; |
480 | } | 482 | } |
diff --git a/drivers/pinctrl/pinctrl-imx6q.c b/drivers/pinctrl/pinctrl-imx6q.c index 7737d4d71a3c..e9bf71fbedca 100644 --- a/drivers/pinctrl/pinctrl-imx6q.c +++ b/drivers/pinctrl/pinctrl-imx6q.c | |||
@@ -1950,6 +1950,8 @@ static struct imx_pin_reg imx6q_pin_regs[] = { | |||
1950 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 5, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__GPIO_1_12 */ | 1950 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 5, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__GPIO_1_12 */ |
1951 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 6, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__SJC_DONE */ | 1951 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 6, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__SJC_DONE */ |
1952 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 7, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__ANATOP_TESTO_3 */ | 1952 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 7, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__ANATOP_TESTO_3 */ |
1953 | IMX_PIN_REG(MX6Q_PAD_ENET_RX_ER, 0x04EC, 0x01D8, 0, 0x0000, 0), /* MX6Q_PAD_ENET_RX_ER__ANATOP_USBOTG_ID */ | ||
1954 | IMX_PIN_REG(MX6Q_PAD_GPIO_1, 0x05F4, 0x0224, 3, 0x0000, 0), /* MX6Q_PAD_GPIO_1__ANATOP_USBOTG_ID */ | ||
1953 | }; | 1955 | }; |
1954 | 1956 | ||
1955 | /* Pad names for the pinmux subsystem */ | 1957 | /* Pad names for the pinmux subsystem */ |
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 4f20f8dd3d7c..17f6dfd8dbfb 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
@@ -694,10 +694,10 @@ MODULE_DEVICE_TABLE(acpi, ideapad_device_ids); | |||
694 | static int __devinit ideapad_acpi_add(struct acpi_device *adevice) | 694 | static int __devinit ideapad_acpi_add(struct acpi_device *adevice) |
695 | { | 695 | { |
696 | int ret, i; | 696 | int ret, i; |
697 | unsigned long cfg; | 697 | int cfg; |
698 | struct ideapad_private *priv; | 698 | struct ideapad_private *priv; |
699 | 699 | ||
700 | if (read_method_int(adevice->handle, "_CFG", (int *)&cfg)) | 700 | if (read_method_int(adevice->handle, "_CFG", &cfg)) |
701 | return -ENODEV; | 701 | return -ENODEV; |
702 | 702 | ||
703 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 703 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
@@ -721,7 +721,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice) | |||
721 | goto input_failed; | 721 | goto input_failed; |
722 | 722 | ||
723 | for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) { | 723 | for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) { |
724 | if (test_bit(ideapad_rfk_data[i].cfgbit, &cfg)) | 724 | if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg)) |
725 | ideapad_register_rfkill(adevice, i); | 725 | ideapad_register_rfkill(adevice, i); |
726 | else | 726 | else |
727 | priv->rfk[i] = NULL; | 727 | priv->rfk[i] = NULL; |
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index 0ffdb3cde2bb..9af4257d4901 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #include <linux/string.h> | 72 | #include <linux/string.h> |
73 | #include <linux/tick.h> | 73 | #include <linux/tick.h> |
74 | #include <linux/timer.h> | 74 | #include <linux/timer.h> |
75 | #include <linux/dmi.h> | ||
75 | #include <drm/i915_drm.h> | 76 | #include <drm/i915_drm.h> |
76 | #include <asm/msr.h> | 77 | #include <asm/msr.h> |
77 | #include <asm/processor.h> | 78 | #include <asm/processor.h> |
@@ -1485,6 +1486,24 @@ static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { | |||
1485 | 1486 | ||
1486 | MODULE_DEVICE_TABLE(pci, ips_id_table); | 1487 | MODULE_DEVICE_TABLE(pci, ips_id_table); |
1487 | 1488 | ||
1489 | static int ips_blacklist_callback(const struct dmi_system_id *id) | ||
1490 | { | ||
1491 | pr_info("Blacklisted intel_ips for %s\n", id->ident); | ||
1492 | return 1; | ||
1493 | } | ||
1494 | |||
1495 | static const struct dmi_system_id ips_blacklist[] = { | ||
1496 | { | ||
1497 | .callback = ips_blacklist_callback, | ||
1498 | .ident = "HP ProBook", | ||
1499 | .matches = { | ||
1500 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
1501 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook"), | ||
1502 | }, | ||
1503 | }, | ||
1504 | { } /* terminating entry */ | ||
1505 | }; | ||
1506 | |||
1488 | static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | 1507 | static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) |
1489 | { | 1508 | { |
1490 | u64 platform_info; | 1509 | u64 platform_info; |
@@ -1494,6 +1513,9 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1494 | u16 htshi, trc, trc_required_mask; | 1513 | u16 htshi, trc, trc_required_mask; |
1495 | u8 tse; | 1514 | u8 tse; |
1496 | 1515 | ||
1516 | if (dmi_check_system(ips_blacklist)) | ||
1517 | return -ENODEV; | ||
1518 | |||
1497 | ips = kzalloc(sizeof(struct ips_driver), GFP_KERNEL); | 1519 | ips = kzalloc(sizeof(struct ips_driver), GFP_KERNEL); |
1498 | if (!ips) | 1520 | if (!ips) |
1499 | return -ENOMEM; | 1521 | return -ENOMEM; |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 210d4ae547c2..d456ff0c73b7 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -973,7 +973,7 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
973 | struct device_attribute *attr, | 973 | struct device_attribute *attr, |
974 | const char *buffer, size_t count) | 974 | const char *buffer, size_t count) |
975 | { | 975 | { |
976 | unsigned long value = 0; | 976 | int value; |
977 | int ret = 0; | 977 | int ret = 0; |
978 | struct sony_nc_value *item = | 978 | struct sony_nc_value *item = |
979 | container_of(attr, struct sony_nc_value, devattr); | 979 | container_of(attr, struct sony_nc_value, devattr); |
@@ -984,7 +984,7 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
984 | if (count > 31) | 984 | if (count > 31) |
985 | return -EINVAL; | 985 | return -EINVAL; |
986 | 986 | ||
987 | if (kstrtoul(buffer, 10, &value)) | 987 | if (kstrtoint(buffer, 10, &value)) |
988 | return -EINVAL; | 988 | return -EINVAL; |
989 | 989 | ||
990 | if (item->validate) | 990 | if (item->validate) |
@@ -994,7 +994,7 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
994 | return value; | 994 | return value; |
995 | 995 | ||
996 | ret = sony_nc_int_call(sony_nc_acpi_handle, *item->acpiset, | 996 | ret = sony_nc_int_call(sony_nc_acpi_handle, *item->acpiset, |
997 | (int *)&value, NULL); | 997 | &value, NULL); |
998 | if (ret < 0) | 998 | if (ret < 0) |
999 | return -EIO; | 999 | return -EIO; |
1000 | 1000 | ||
@@ -1010,6 +1010,7 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
1010 | struct sony_backlight_props { | 1010 | struct sony_backlight_props { |
1011 | struct backlight_device *dev; | 1011 | struct backlight_device *dev; |
1012 | int handle; | 1012 | int handle; |
1013 | int cmd_base; | ||
1013 | u8 offset; | 1014 | u8 offset; |
1014 | u8 maxlvl; | 1015 | u8 maxlvl; |
1015 | }; | 1016 | }; |
@@ -1037,7 +1038,7 @@ static int sony_nc_get_brightness_ng(struct backlight_device *bd) | |||
1037 | struct sony_backlight_props *sdev = | 1038 | struct sony_backlight_props *sdev = |
1038 | (struct sony_backlight_props *)bl_get_data(bd); | 1039 | (struct sony_backlight_props *)bl_get_data(bd); |
1039 | 1040 | ||
1040 | sony_call_snc_handle(sdev->handle, 0x0200, &result); | 1041 | sony_call_snc_handle(sdev->handle, sdev->cmd_base + 0x100, &result); |
1041 | 1042 | ||
1042 | return (result & 0xff) - sdev->offset; | 1043 | return (result & 0xff) - sdev->offset; |
1043 | } | 1044 | } |
@@ -1049,7 +1050,8 @@ static int sony_nc_update_status_ng(struct backlight_device *bd) | |||
1049 | (struct sony_backlight_props *)bl_get_data(bd); | 1050 | (struct sony_backlight_props *)bl_get_data(bd); |
1050 | 1051 | ||
1051 | value = bd->props.brightness + sdev->offset; | 1052 | value = bd->props.brightness + sdev->offset; |
1052 | if (sony_call_snc_handle(sdev->handle, 0x0100 | (value << 16), &result)) | 1053 | if (sony_call_snc_handle(sdev->handle, sdev->cmd_base | (value << 0x10), |
1054 | &result)) | ||
1053 | return -EIO; | 1055 | return -EIO; |
1054 | 1056 | ||
1055 | return value; | 1057 | return value; |
@@ -1172,6 +1174,11 @@ static int sony_nc_hotkeys_decode(u32 event, unsigned int handle) | |||
1172 | /* | 1174 | /* |
1173 | * ACPI callbacks | 1175 | * ACPI callbacks |
1174 | */ | 1176 | */ |
1177 | enum event_types { | ||
1178 | HOTKEY = 1, | ||
1179 | KILLSWITCH, | ||
1180 | GFX_SWITCH | ||
1181 | }; | ||
1175 | static void sony_nc_notify(struct acpi_device *device, u32 event) | 1182 | static void sony_nc_notify(struct acpi_device *device, u32 event) |
1176 | { | 1183 | { |
1177 | u32 real_ev = event; | 1184 | u32 real_ev = event; |
@@ -1196,7 +1203,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) | |||
1196 | /* hotkey event */ | 1203 | /* hotkey event */ |
1197 | case 0x0100: | 1204 | case 0x0100: |
1198 | case 0x0127: | 1205 | case 0x0127: |
1199 | ev_type = 1; | 1206 | ev_type = HOTKEY; |
1200 | real_ev = sony_nc_hotkeys_decode(event, handle); | 1207 | real_ev = sony_nc_hotkeys_decode(event, handle); |
1201 | 1208 | ||
1202 | if (real_ev > 0) | 1209 | if (real_ev > 0) |
@@ -1216,7 +1223,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) | |||
1216 | * update the rfkill device status when the | 1223 | * update the rfkill device status when the |
1217 | * switch is moved. | 1224 | * switch is moved. |
1218 | */ | 1225 | */ |
1219 | ev_type = 2; | 1226 | ev_type = KILLSWITCH; |
1220 | sony_call_snc_handle(handle, 0x0100, &result); | 1227 | sony_call_snc_handle(handle, 0x0100, &result); |
1221 | real_ev = result & 0x03; | 1228 | real_ev = result & 0x03; |
1222 | 1229 | ||
@@ -1226,6 +1233,24 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) | |||
1226 | 1233 | ||
1227 | break; | 1234 | break; |
1228 | 1235 | ||
1236 | case 0x0128: | ||
1237 | case 0x0146: | ||
1238 | /* Hybrid GFX switching */ | ||
1239 | sony_call_snc_handle(handle, 0x0000, &result); | ||
1240 | dprintk("GFX switch event received (reason: %s)\n", | ||
1241 | (result & 0x01) ? | ||
1242 | "switch change" : "unknown"); | ||
1243 | |||
1244 | /* verify the switch state | ||
1245 | * 1: discrete GFX | ||
1246 | * 0: integrated GFX | ||
1247 | */ | ||
1248 | sony_call_snc_handle(handle, 0x0100, &result); | ||
1249 | |||
1250 | ev_type = GFX_SWITCH; | ||
1251 | real_ev = result & 0xff; | ||
1252 | break; | ||
1253 | |||
1229 | default: | 1254 | default: |
1230 | dprintk("Unknown event 0x%x for handle 0x%x\n", | 1255 | dprintk("Unknown event 0x%x for handle 0x%x\n", |
1231 | event, handle); | 1256 | event, handle); |
@@ -1238,7 +1263,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) | |||
1238 | 1263 | ||
1239 | } else { | 1264 | } else { |
1240 | /* old style event */ | 1265 | /* old style event */ |
1241 | ev_type = 1; | 1266 | ev_type = HOTKEY; |
1242 | sony_laptop_report_input_event(real_ev); | 1267 | sony_laptop_report_input_event(real_ev); |
1243 | } | 1268 | } |
1244 | 1269 | ||
@@ -1893,32 +1918,33 @@ static ssize_t sony_nc_battery_care_limit_store(struct device *dev, | |||
1893 | * bits 4,5: store the limit into the EC | 1918 | * bits 4,5: store the limit into the EC |
1894 | * bits 6,7: store the limit into the battery | 1919 | * bits 6,7: store the limit into the battery |
1895 | */ | 1920 | */ |
1921 | cmd = 0; | ||
1896 | 1922 | ||
1897 | /* | 1923 | if (value > 0) { |
1898 | * handle 0x0115 should allow storing on battery too; | 1924 | if (value <= 50) |
1899 | * handle 0x0136 same as 0x0115 + health status; | 1925 | cmd = 0x20; |
1900 | * handle 0x013f, same as 0x0136 but no storing on the battery | ||
1901 | * | ||
1902 | * Store only inside the EC for now, regardless the handle number | ||
1903 | */ | ||
1904 | if (value == 0) | ||
1905 | /* disable limits */ | ||
1906 | cmd = 0x0; | ||
1907 | 1926 | ||
1908 | else if (value <= 50) | 1927 | else if (value <= 80) |
1909 | cmd = 0x21; | 1928 | cmd = 0x10; |
1910 | 1929 | ||
1911 | else if (value <= 80) | 1930 | else if (value <= 100) |
1912 | cmd = 0x11; | 1931 | cmd = 0x30; |
1913 | 1932 | ||
1914 | else if (value <= 100) | 1933 | else |
1915 | cmd = 0x31; | 1934 | return -EINVAL; |
1916 | 1935 | ||
1917 | else | 1936 | /* |
1918 | return -EINVAL; | 1937 | * handle 0x0115 should allow storing on battery too; |
1938 | * handle 0x0136 same as 0x0115 + health status; | ||
1939 | * handle 0x013f, same as 0x0136 but no storing on the battery | ||
1940 | */ | ||
1941 | if (bcare_ctl->handle != 0x013f) | ||
1942 | cmd = cmd | (cmd << 2); | ||
1919 | 1943 | ||
1920 | if (sony_call_snc_handle(bcare_ctl->handle, (cmd << 0x10) | 0x0100, | 1944 | cmd = (cmd | 0x1) << 0x10; |
1921 | &result)) | 1945 | } |
1946 | |||
1947 | if (sony_call_snc_handle(bcare_ctl->handle, cmd | 0x0100, &result)) | ||
1922 | return -EIO; | 1948 | return -EIO; |
1923 | 1949 | ||
1924 | return count; | 1950 | return count; |
@@ -2113,7 +2139,7 @@ static ssize_t sony_nc_thermal_mode_show(struct device *dev, | |||
2113 | struct device_attribute *attr, char *buffer) | 2139 | struct device_attribute *attr, char *buffer) |
2114 | { | 2140 | { |
2115 | ssize_t count = 0; | 2141 | ssize_t count = 0; |
2116 | unsigned int mode = sony_nc_thermal_mode_get(); | 2142 | int mode = sony_nc_thermal_mode_get(); |
2117 | 2143 | ||
2118 | if (mode < 0) | 2144 | if (mode < 0) |
2119 | return mode; | 2145 | return mode; |
@@ -2472,6 +2498,7 @@ static void sony_nc_backlight_ng_read_limits(int handle, | |||
2472 | { | 2498 | { |
2473 | u64 offset; | 2499 | u64 offset; |
2474 | int i; | 2500 | int i; |
2501 | int lvl_table_len = 0; | ||
2475 | u8 min = 0xff, max = 0x00; | 2502 | u8 min = 0xff, max = 0x00; |
2476 | unsigned char buffer[32] = { 0 }; | 2503 | unsigned char buffer[32] = { 0 }; |
2477 | 2504 | ||
@@ -2480,8 +2507,6 @@ static void sony_nc_backlight_ng_read_limits(int handle, | |||
2480 | props->maxlvl = 0xff; | 2507 | props->maxlvl = 0xff; |
2481 | 2508 | ||
2482 | offset = sony_find_snc_handle(handle); | 2509 | offset = sony_find_snc_handle(handle); |
2483 | if (offset < 0) | ||
2484 | return; | ||
2485 | 2510 | ||
2486 | /* try to read the boundaries from ACPI tables, if we fail the above | 2511 | /* try to read the boundaries from ACPI tables, if we fail the above |
2487 | * defaults should be reasonable | 2512 | * defaults should be reasonable |
@@ -2491,11 +2516,21 @@ static void sony_nc_backlight_ng_read_limits(int handle, | |||
2491 | if (i < 0) | 2516 | if (i < 0) |
2492 | return; | 2517 | return; |
2493 | 2518 | ||
2519 | switch (handle) { | ||
2520 | case 0x012f: | ||
2521 | case 0x0137: | ||
2522 | lvl_table_len = 9; | ||
2523 | break; | ||
2524 | case 0x143: | ||
2525 | lvl_table_len = 16; | ||
2526 | break; | ||
2527 | } | ||
2528 | |||
2494 | /* the buffer lists brightness levels available, brightness levels are | 2529 | /* the buffer lists brightness levels available, brightness levels are |
2495 | * from position 0 to 8 in the array, other values are used by ALS | 2530 | * from position 0 to 8 in the array, other values are used by ALS |
2496 | * control. | 2531 | * control. |
2497 | */ | 2532 | */ |
2498 | for (i = 0; i < 9 && i < ARRAY_SIZE(buffer); i++) { | 2533 | for (i = 0; i < lvl_table_len && i < ARRAY_SIZE(buffer); i++) { |
2499 | 2534 | ||
2500 | dprintk("Brightness level: %d\n", buffer[i]); | 2535 | dprintk("Brightness level: %d\n", buffer[i]); |
2501 | 2536 | ||
@@ -2520,16 +2555,24 @@ static void sony_nc_backlight_setup(void) | |||
2520 | const struct backlight_ops *ops = NULL; | 2555 | const struct backlight_ops *ops = NULL; |
2521 | struct backlight_properties props; | 2556 | struct backlight_properties props; |
2522 | 2557 | ||
2523 | if (sony_find_snc_handle(0x12f) != -1) { | 2558 | if (sony_find_snc_handle(0x12f) >= 0) { |
2524 | ops = &sony_backlight_ng_ops; | 2559 | ops = &sony_backlight_ng_ops; |
2560 | sony_bl_props.cmd_base = 0x0100; | ||
2525 | sony_nc_backlight_ng_read_limits(0x12f, &sony_bl_props); | 2561 | sony_nc_backlight_ng_read_limits(0x12f, &sony_bl_props); |
2526 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; | 2562 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; |
2527 | 2563 | ||
2528 | } else if (sony_find_snc_handle(0x137) != -1) { | 2564 | } else if (sony_find_snc_handle(0x137) >= 0) { |
2529 | ops = &sony_backlight_ng_ops; | 2565 | ops = &sony_backlight_ng_ops; |
2566 | sony_bl_props.cmd_base = 0x0100; | ||
2530 | sony_nc_backlight_ng_read_limits(0x137, &sony_bl_props); | 2567 | sony_nc_backlight_ng_read_limits(0x137, &sony_bl_props); |
2531 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; | 2568 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; |
2532 | 2569 | ||
2570 | } else if (sony_find_snc_handle(0x143) >= 0) { | ||
2571 | ops = &sony_backlight_ng_ops; | ||
2572 | sony_bl_props.cmd_base = 0x3000; | ||
2573 | sony_nc_backlight_ng_read_limits(0x143, &sony_bl_props); | ||
2574 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; | ||
2575 | |||
2533 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", | 2576 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", |
2534 | &unused))) { | 2577 | &unused))) { |
2535 | ops = &sony_backlight_ops; | 2578 | ops = &sony_backlight_ops; |
@@ -2597,6 +2640,12 @@ static int sony_nc_add(struct acpi_device *device) | |||
2597 | } | 2640 | } |
2598 | } | 2641 | } |
2599 | 2642 | ||
2643 | result = sony_laptop_setup_input(device); | ||
2644 | if (result) { | ||
2645 | pr_err("Unable to create input devices\n"); | ||
2646 | goto outplatform; | ||
2647 | } | ||
2648 | |||
2600 | if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON", | 2649 | if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON", |
2601 | &handle))) { | 2650 | &handle))) { |
2602 | int arg = 1; | 2651 | int arg = 1; |
@@ -2614,12 +2663,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
2614 | } | 2663 | } |
2615 | 2664 | ||
2616 | /* setup input devices and helper fifo */ | 2665 | /* setup input devices and helper fifo */ |
2617 | result = sony_laptop_setup_input(device); | ||
2618 | if (result) { | ||
2619 | pr_err("Unable to create input devices\n"); | ||
2620 | goto outsnc; | ||
2621 | } | ||
2622 | |||
2623 | if (acpi_video_backlight_support()) { | 2666 | if (acpi_video_backlight_support()) { |
2624 | pr_info("brightness ignored, must be controlled by ACPI video driver\n"); | 2667 | pr_info("brightness ignored, must be controlled by ACPI video driver\n"); |
2625 | } else { | 2668 | } else { |
@@ -2667,22 +2710,21 @@ static int sony_nc_add(struct acpi_device *device) | |||
2667 | 2710 | ||
2668 | return 0; | 2711 | return 0; |
2669 | 2712 | ||
2670 | out_sysfs: | 2713 | out_sysfs: |
2671 | for (item = sony_nc_values; item->name; ++item) { | 2714 | for (item = sony_nc_values; item->name; ++item) { |
2672 | device_remove_file(&sony_pf_device->dev, &item->devattr); | 2715 | device_remove_file(&sony_pf_device->dev, &item->devattr); |
2673 | } | 2716 | } |
2674 | sony_nc_backlight_cleanup(); | 2717 | sony_nc_backlight_cleanup(); |
2675 | |||
2676 | sony_laptop_remove_input(); | ||
2677 | |||
2678 | outsnc: | ||
2679 | sony_nc_function_cleanup(sony_pf_device); | 2718 | sony_nc_function_cleanup(sony_pf_device); |
2680 | sony_nc_handles_cleanup(sony_pf_device); | 2719 | sony_nc_handles_cleanup(sony_pf_device); |
2681 | 2720 | ||
2682 | outpresent: | 2721 | outplatform: |
2722 | sony_laptop_remove_input(); | ||
2723 | |||
2724 | outpresent: | ||
2683 | sony_pf_remove(); | 2725 | sony_pf_remove(); |
2684 | 2726 | ||
2685 | outwalk: | 2727 | outwalk: |
2686 | sony_nc_rfkill_cleanup(); | 2728 | sony_nc_rfkill_cleanup(); |
2687 | return result; | 2729 | return result; |
2688 | } | 2730 | } |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 09a737c868b5..8b4b3829d9e7 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2519,9 +2519,12 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | |||
2519 | { | 2519 | { |
2520 | struct regulator_dev *rdev = regulator->rdev; | 2520 | struct regulator_dev *rdev = regulator->rdev; |
2521 | struct regulator *consumer; | 2521 | struct regulator *consumer; |
2522 | int ret, output_uV, input_uV, total_uA_load = 0; | 2522 | int ret, output_uV, input_uV = 0, total_uA_load = 0; |
2523 | unsigned int mode; | 2523 | unsigned int mode; |
2524 | 2524 | ||
2525 | if (rdev->supply) | ||
2526 | input_uV = regulator_get_voltage(rdev->supply); | ||
2527 | |||
2525 | mutex_lock(&rdev->mutex); | 2528 | mutex_lock(&rdev->mutex); |
2526 | 2529 | ||
2527 | /* | 2530 | /* |
@@ -2554,10 +2557,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | |||
2554 | goto out; | 2557 | goto out; |
2555 | } | 2558 | } |
2556 | 2559 | ||
2557 | /* get input voltage */ | 2560 | /* No supply? Use constraint voltage */ |
2558 | input_uV = 0; | ||
2559 | if (rdev->supply) | ||
2560 | input_uV = regulator_get_voltage(rdev->supply); | ||
2561 | if (input_uV <= 0) | 2561 | if (input_uV <= 0) |
2562 | input_uV = rdev->constraints->input_uV; | 2562 | input_uV = rdev->constraints->input_uV; |
2563 | if (input_uV <= 0) { | 2563 | if (input_uV <= 0) { |
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 24d880e78ec6..f8d818abf98c 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig | |||
@@ -4,9 +4,11 @@ menu "Remoteproc drivers (EXPERIMENTAL)" | |||
4 | config REMOTEPROC | 4 | config REMOTEPROC |
5 | tristate | 5 | tristate |
6 | depends on EXPERIMENTAL | 6 | depends on EXPERIMENTAL |
7 | select FW_CONFIG | ||
7 | 8 | ||
8 | config OMAP_REMOTEPROC | 9 | config OMAP_REMOTEPROC |
9 | tristate "OMAP remoteproc support" | 10 | tristate "OMAP remoteproc support" |
11 | depends on EXPERIMENTAL | ||
10 | depends on ARCH_OMAP4 | 12 | depends on ARCH_OMAP4 |
11 | depends on OMAP_IOMMU | 13 | depends on OMAP_IOMMU |
12 | select REMOTEPROC | 14 | select REMOTEPROC |
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 75506ec2840e..f56c8ba3a861 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c | |||
@@ -188,6 +188,26 @@ static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
188 | rpdev->id.name); | 188 | rpdev->id.name); |
189 | } | 189 | } |
190 | 190 | ||
191 | /** | ||
192 | * __ept_release() - deallocate an rpmsg endpoint | ||
193 | * @kref: the ept's reference count | ||
194 | * | ||
195 | * This function deallocates an ept, and is invoked when its @kref refcount | ||
196 | * drops to zero. | ||
197 | * | ||
198 | * Never invoke this function directly! | ||
199 | */ | ||
200 | static void __ept_release(struct kref *kref) | ||
201 | { | ||
202 | struct rpmsg_endpoint *ept = container_of(kref, struct rpmsg_endpoint, | ||
203 | refcount); | ||
204 | /* | ||
205 | * At this point no one holds a reference to ept anymore, | ||
206 | * so we can directly free it | ||
207 | */ | ||
208 | kfree(ept); | ||
209 | } | ||
210 | |||
191 | /* for more info, see below documentation of rpmsg_create_ept() */ | 211 | /* for more info, see below documentation of rpmsg_create_ept() */ |
192 | static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, | 212 | static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, |
193 | struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb, | 213 | struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb, |
@@ -206,6 +226,9 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, | |||
206 | return NULL; | 226 | return NULL; |
207 | } | 227 | } |
208 | 228 | ||
229 | kref_init(&ept->refcount); | ||
230 | mutex_init(&ept->cb_lock); | ||
231 | |||
209 | ept->rpdev = rpdev; | 232 | ept->rpdev = rpdev; |
210 | ept->cb = cb; | 233 | ept->cb = cb; |
211 | ept->priv = priv; | 234 | ept->priv = priv; |
@@ -238,7 +261,7 @@ rem_idr: | |||
238 | idr_remove(&vrp->endpoints, request); | 261 | idr_remove(&vrp->endpoints, request); |
239 | free_ept: | 262 | free_ept: |
240 | mutex_unlock(&vrp->endpoints_lock); | 263 | mutex_unlock(&vrp->endpoints_lock); |
241 | kfree(ept); | 264 | kref_put(&ept->refcount, __ept_release); |
242 | return NULL; | 265 | return NULL; |
243 | } | 266 | } |
244 | 267 | ||
@@ -302,11 +325,17 @@ EXPORT_SYMBOL(rpmsg_create_ept); | |||
302 | static void | 325 | static void |
303 | __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) | 326 | __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) |
304 | { | 327 | { |
328 | /* make sure new inbound messages can't find this ept anymore */ | ||
305 | mutex_lock(&vrp->endpoints_lock); | 329 | mutex_lock(&vrp->endpoints_lock); |
306 | idr_remove(&vrp->endpoints, ept->addr); | 330 | idr_remove(&vrp->endpoints, ept->addr); |
307 | mutex_unlock(&vrp->endpoints_lock); | 331 | mutex_unlock(&vrp->endpoints_lock); |
308 | 332 | ||
309 | kfree(ept); | 333 | /* make sure in-flight inbound messages won't invoke cb anymore */ |
334 | mutex_lock(&ept->cb_lock); | ||
335 | ept->cb = NULL; | ||
336 | mutex_unlock(&ept->cb_lock); | ||
337 | |||
338 | kref_put(&ept->refcount, __ept_release); | ||
310 | } | 339 | } |
311 | 340 | ||
312 | /** | 341 | /** |
@@ -790,12 +819,28 @@ static void rpmsg_recv_done(struct virtqueue *rvq) | |||
790 | 819 | ||
791 | /* use the dst addr to fetch the callback of the appropriate user */ | 820 | /* use the dst addr to fetch the callback of the appropriate user */ |
792 | mutex_lock(&vrp->endpoints_lock); | 821 | mutex_lock(&vrp->endpoints_lock); |
822 | |||
793 | ept = idr_find(&vrp->endpoints, msg->dst); | 823 | ept = idr_find(&vrp->endpoints, msg->dst); |
824 | |||
825 | /* let's make sure no one deallocates ept while we use it */ | ||
826 | if (ept) | ||
827 | kref_get(&ept->refcount); | ||
828 | |||
794 | mutex_unlock(&vrp->endpoints_lock); | 829 | mutex_unlock(&vrp->endpoints_lock); |
795 | 830 | ||
796 | if (ept && ept->cb) | 831 | if (ept) { |
797 | ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, msg->src); | 832 | /* make sure ept->cb doesn't go away while we use it */ |
798 | else | 833 | mutex_lock(&ept->cb_lock); |
834 | |||
835 | if (ept->cb) | ||
836 | ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, | ||
837 | msg->src); | ||
838 | |||
839 | mutex_unlock(&ept->cb_lock); | ||
840 | |||
841 | /* farewell, ept, we don't need you anymore */ | ||
842 | kref_put(&ept->refcount, __ept_release); | ||
843 | } else | ||
799 | dev_warn(dev, "msg received with no recepient\n"); | 844 | dev_warn(dev, "msg received with no recepient\n"); |
800 | 845 | ||
801 | /* publish the real size of the buffer */ | 846 | /* publish the real size of the buffer */ |
@@ -1040,7 +1085,7 @@ static int __init rpmsg_init(void) | |||
1040 | 1085 | ||
1041 | return ret; | 1086 | return ret; |
1042 | } | 1087 | } |
1043 | module_init(rpmsg_init); | 1088 | subsys_initcall(rpmsg_init); |
1044 | 1089 | ||
1045 | static void __exit rpmsg_fini(void) | 1090 | static void __exit rpmsg_fini(void) |
1046 | { | 1091 | { |
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index 4bcf9ca2818a..370889d0489b 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/mfd/abx500.h> | 17 | #include <linux/mfd/abx500.h> |
18 | #include <linux/mfd/abx500/ab8500.h> | 18 | #include <linux/mfd/abx500/ab8500.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/of.h> | ||
20 | 21 | ||
21 | #define AB8500_RTC_SOFF_STAT_REG 0x00 | 22 | #define AB8500_RTC_SOFF_STAT_REG 0x00 |
22 | #define AB8500_RTC_CC_CONF_REG 0x01 | 23 | #define AB8500_RTC_CC_CONF_REG 0x01 |
@@ -422,7 +423,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
422 | } | 423 | } |
423 | 424 | ||
424 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, | 425 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, |
425 | IRQF_NO_SUSPEND, "ab8500-rtc", rtc); | 426 | IRQF_NO_SUSPEND | IRQF_ONESHOT, "ab8500-rtc", rtc); |
426 | if (err < 0) { | 427 | if (err < 0) { |
427 | rtc_device_unregister(rtc); | 428 | rtc_device_unregister(rtc); |
428 | return err; | 429 | return err; |
@@ -430,7 +431,6 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
430 | 431 | ||
431 | platform_set_drvdata(pdev, rtc); | 432 | platform_set_drvdata(pdev, rtc); |
432 | 433 | ||
433 | |||
434 | err = ab8500_sysfs_rtc_register(&pdev->dev); | 434 | err = ab8500_sysfs_rtc_register(&pdev->dev); |
435 | if (err) { | 435 | if (err) { |
436 | dev_err(&pdev->dev, "sysfs RTC failed to register\n"); | 436 | dev_err(&pdev->dev, "sysfs RTC failed to register\n"); |
@@ -454,10 +454,16 @@ static int __devexit ab8500_rtc_remove(struct platform_device *pdev) | |||
454 | return 0; | 454 | return 0; |
455 | } | 455 | } |
456 | 456 | ||
457 | static const struct of_device_id ab8500_rtc_match[] = { | ||
458 | { .compatible = "stericsson,ab8500-rtc", }, | ||
459 | {} | ||
460 | }; | ||
461 | |||
457 | static struct platform_driver ab8500_rtc_driver = { | 462 | static struct platform_driver ab8500_rtc_driver = { |
458 | .driver = { | 463 | .driver = { |
459 | .name = "ab8500-rtc", | 464 | .name = "ab8500-rtc", |
460 | .owner = THIS_MODULE, | 465 | .owner = THIS_MODULE, |
466 | .of_match_table = ab8500_rtc_match, | ||
461 | }, | 467 | }, |
462 | .probe = ab8500_rtc_probe, | 468 | .probe = ab8500_rtc_probe, |
463 | .remove = __devexit_p(ab8500_rtc_remove), | 469 | .remove = __devexit_p(ab8500_rtc_remove), |
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 5e1d64ee5228..e3e50d69baf8 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c | |||
@@ -202,10 +202,11 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
202 | struct platform_device *pdev = dev_id; | 202 | struct platform_device *pdev = dev_id; |
203 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 203 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
204 | void __iomem *ioaddr = pdata->ioaddr; | 204 | void __iomem *ioaddr = pdata->ioaddr; |
205 | unsigned long flags; | ||
205 | u32 status; | 206 | u32 status; |
206 | u32 events = 0; | 207 | u32 events = 0; |
207 | 208 | ||
208 | spin_lock_irq(&pdata->rtc->irq_lock); | 209 | spin_lock_irqsave(&pdata->rtc->irq_lock, flags); |
209 | status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR); | 210 | status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR); |
210 | /* clear interrupt sources */ | 211 | /* clear interrupt sources */ |
211 | writew(status, ioaddr + RTC_RTCISR); | 212 | writew(status, ioaddr + RTC_RTCISR); |
@@ -224,7 +225,7 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
224 | events |= (RTC_PF | RTC_IRQF); | 225 | events |= (RTC_PF | RTC_IRQF); |
225 | 226 | ||
226 | rtc_update_irq(pdata->rtc, 1, events); | 227 | rtc_update_irq(pdata->rtc, 1, events); |
227 | spin_unlock_irq(&pdata->rtc->irq_lock); | 228 | spin_unlock_irqrestore(&pdata->rtc->irq_lock, flags); |
228 | 229 | ||
229 | return IRQ_HANDLED; | 230 | return IRQ_HANDLED; |
230 | } | 231 | } |
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index 1f76320e545b..e2785479113c 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c | |||
@@ -458,12 +458,12 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev) | |||
458 | clk_disable(config->clk); | 458 | clk_disable(config->clk); |
459 | clk_put(config->clk); | 459 | clk_put(config->clk); |
460 | iounmap(config->ioaddr); | 460 | iounmap(config->ioaddr); |
461 | kfree(config); | ||
462 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 461 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
463 | if (res) | 462 | if (res) |
464 | release_mem_region(res->start, resource_size(res)); | 463 | release_mem_region(res->start, resource_size(res)); |
465 | platform_set_drvdata(pdev, NULL); | 464 | platform_set_drvdata(pdev, NULL); |
466 | rtc_device_unregister(config->rtc); | 465 | rtc_device_unregister(config->rtc); |
466 | kfree(config); | ||
467 | 467 | ||
468 | return 0; | 468 | return 0; |
469 | } | 469 | } |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 258abeabf624..c5d06fe83bba 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -510,7 +510,7 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev) | |||
510 | } | 510 | } |
511 | 511 | ||
512 | ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt, | 512 | ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt, |
513 | IRQF_TRIGGER_RISING, | 513 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
514 | dev_name(&rtc->dev), rtc); | 514 | dev_name(&rtc->dev), rtc); |
515 | if (ret < 0) { | 515 | if (ret < 0) { |
516 | dev_err(&pdev->dev, "IRQ is not free.\n"); | 516 | dev_err(&pdev->dev, "IRQ is not free.\n"); |
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c index 532d212b6b2c..393e7ce8e95a 100644 --- a/drivers/scsi/aic94xx/aic94xx_task.c +++ b/drivers/scsi/aic94xx/aic94xx_task.c | |||
@@ -201,7 +201,7 @@ static void asd_get_response_tasklet(struct asd_ascb *ascb, | |||
201 | 201 | ||
202 | if (SAS_STATUS_BUF_SIZE >= sizeof(*resp)) { | 202 | if (SAS_STATUS_BUF_SIZE >= sizeof(*resp)) { |
203 | resp->frame_len = le16_to_cpu(*(__le16 *)(r+6)); | 203 | resp->frame_len = le16_to_cpu(*(__le16 *)(r+6)); |
204 | memcpy(&resp->ending_fis[0], r+16, 24); | 204 | memcpy(&resp->ending_fis[0], r+16, ATA_RESP_FIS_SIZE); |
205 | ts->buf_valid_size = sizeof(*resp); | 205 | ts->buf_valid_size = sizeof(*resp); |
206 | } | 206 | } |
207 | } | 207 | } |
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h index 0c53c28dc3d3..7e77cf620291 100644 --- a/drivers/scsi/bnx2i/bnx2i.h +++ b/drivers/scsi/bnx2i/bnx2i.h | |||
@@ -350,6 +350,7 @@ struct bnx2i_hba { | |||
350 | struct pci_dev *pcidev; | 350 | struct pci_dev *pcidev; |
351 | struct net_device *netdev; | 351 | struct net_device *netdev; |
352 | void __iomem *regview; | 352 | void __iomem *regview; |
353 | resource_size_t reg_base; | ||
353 | 354 | ||
354 | u32 age; | 355 | u32 age; |
355 | unsigned long cnic_dev_type; | 356 | unsigned long cnic_dev_type; |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index ece47e502282..86a12b48e477 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
@@ -2724,7 +2724,6 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep) | |||
2724 | goto arm_cq; | 2724 | goto arm_cq; |
2725 | } | 2725 | } |
2726 | 2726 | ||
2727 | reg_base = ep->hba->netdev->base_addr; | ||
2728 | if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) && | 2727 | if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) && |
2729 | (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) { | 2728 | (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) { |
2730 | config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2); | 2729 | config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2); |
@@ -2740,7 +2739,7 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep) | |||
2740 | /* 5709 device in normal node and 5706/5708 devices */ | 2739 | /* 5709 device in normal node and 5706/5708 devices */ |
2741 | reg_off = CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num); | 2740 | reg_off = CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num); |
2742 | 2741 | ||
2743 | ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, | 2742 | ep->qp.ctx_base = ioremap_nocache(ep->hba->reg_base + reg_off, |
2744 | MB_KERNEL_CTX_SIZE); | 2743 | MB_KERNEL_CTX_SIZE); |
2745 | if (!ep->qp.ctx_base) | 2744 | if (!ep->qp.ctx_base) |
2746 | return -ENOMEM; | 2745 | return -ENOMEM; |
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index f8d516b53161..621538b8b544 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c | |||
@@ -811,13 +811,13 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic) | |||
811 | bnx2i_identify_device(hba); | 811 | bnx2i_identify_device(hba); |
812 | bnx2i_setup_host_queue_size(hba, shost); | 812 | bnx2i_setup_host_queue_size(hba, shost); |
813 | 813 | ||
814 | hba->reg_base = pci_resource_start(hba->pcidev, 0); | ||
814 | if (test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) { | 815 | if (test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) { |
815 | hba->regview = ioremap_nocache(hba->netdev->base_addr, | 816 | hba->regview = pci_iomap(hba->pcidev, 0, BNX2_MQ_CONFIG2); |
816 | BNX2_MQ_CONFIG2); | ||
817 | if (!hba->regview) | 817 | if (!hba->regview) |
818 | goto ioreg_map_err; | 818 | goto ioreg_map_err; |
819 | } else if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) { | 819 | } else if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) { |
820 | hba->regview = ioremap_nocache(hba->netdev->base_addr, 4096); | 820 | hba->regview = pci_iomap(hba->pcidev, 0, 4096); |
821 | if (!hba->regview) | 821 | if (!hba->regview) |
822 | goto ioreg_map_err; | 822 | goto ioreg_map_err; |
823 | } | 823 | } |
@@ -884,7 +884,7 @@ cid_que_err: | |||
884 | bnx2i_free_mp_bdt(hba); | 884 | bnx2i_free_mp_bdt(hba); |
885 | mp_bdt_mem_err: | 885 | mp_bdt_mem_err: |
886 | if (hba->regview) { | 886 | if (hba->regview) { |
887 | iounmap(hba->regview); | 887 | pci_iounmap(hba->pcidev, hba->regview); |
888 | hba->regview = NULL; | 888 | hba->regview = NULL; |
889 | } | 889 | } |
890 | ioreg_map_err: | 890 | ioreg_map_err: |
@@ -910,7 +910,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) | |||
910 | pci_dev_put(hba->pcidev); | 910 | pci_dev_put(hba->pcidev); |
911 | 911 | ||
912 | if (hba->regview) { | 912 | if (hba->regview) { |
913 | iounmap(hba->regview); | 913 | pci_iounmap(hba->pcidev, hba->regview); |
914 | hba->regview = NULL; | 914 | hba->regview = NULL; |
915 | } | 915 | } |
916 | bnx2i_free_mp_bdt(hba); | 916 | bnx2i_free_mp_bdt(hba); |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 441d88ad99a7..d109cc3a17b6 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -139,12 +139,12 @@ static void sas_ata_task_done(struct sas_task *task) | |||
139 | if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD || | 139 | if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD || |
140 | ((stat->stat == SAM_STAT_CHECK_CONDITION && | 140 | ((stat->stat == SAM_STAT_CHECK_CONDITION && |
141 | dev->sata_dev.command_set == ATAPI_COMMAND_SET))) { | 141 | dev->sata_dev.command_set == ATAPI_COMMAND_SET))) { |
142 | ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf); | 142 | memcpy(dev->sata_dev.fis, resp->ending_fis, ATA_RESP_FIS_SIZE); |
143 | 143 | ||
144 | if (!link->sactive) { | 144 | if (!link->sactive) { |
145 | qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command); | 145 | qc->err_mask |= ac_err_mask(dev->sata_dev.fis[2]); |
146 | } else { | 146 | } else { |
147 | link->eh_info.err_mask |= ac_err_mask(dev->sata_dev.tf.command); | 147 | link->eh_info.err_mask |= ac_err_mask(dev->sata_dev.fis[2]); |
148 | if (unlikely(link->eh_info.err_mask)) | 148 | if (unlikely(link->eh_info.err_mask)) |
149 | qc->flags |= ATA_QCFLAG_FAILED; | 149 | qc->flags |= ATA_QCFLAG_FAILED; |
150 | } | 150 | } |
@@ -161,8 +161,8 @@ static void sas_ata_task_done(struct sas_task *task) | |||
161 | qc->flags |= ATA_QCFLAG_FAILED; | 161 | qc->flags |= ATA_QCFLAG_FAILED; |
162 | } | 162 | } |
163 | 163 | ||
164 | dev->sata_dev.tf.feature = 0x04; /* status err */ | 164 | dev->sata_dev.fis[3] = 0x04; /* status err */ |
165 | dev->sata_dev.tf.command = ATA_ERR; | 165 | dev->sata_dev.fis[2] = ATA_ERR; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
@@ -269,7 +269,7 @@ static bool sas_ata_qc_fill_rtf(struct ata_queued_cmd *qc) | |||
269 | { | 269 | { |
270 | struct domain_device *dev = qc->ap->private_data; | 270 | struct domain_device *dev = qc->ap->private_data; |
271 | 271 | ||
272 | memcpy(&qc->result_tf, &dev->sata_dev.tf, sizeof(qc->result_tf)); | 272 | ata_tf_from_fis(dev->sata_dev.fis, &qc->result_tf); |
273 | return true; | 273 | return true; |
274 | } | 274 | } |
275 | 275 | ||
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 6986552b47e6..77759c78cc21 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -3960,7 +3960,7 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha, | |||
3960 | { | 3960 | { |
3961 | struct qla_hw_data *ha = vha->hw; | 3961 | struct qla_hw_data *ha = vha->hw; |
3962 | struct qla_tgt *tgt = ha->tgt.qla_tgt; | 3962 | struct qla_tgt *tgt = ha->tgt.qla_tgt; |
3963 | int reason_code; | 3963 | int login_code; |
3964 | 3964 | ||
3965 | ql_dbg(ql_dbg_tgt, vha, 0xe039, | 3965 | ql_dbg(ql_dbg_tgt, vha, 0xe039, |
3966 | "scsi(%ld): ha state %d init_done %d oper_mode %d topo %d\n", | 3966 | "scsi(%ld): ha state %d init_done %d oper_mode %d topo %d\n", |
@@ -4003,9 +4003,9 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha, | |||
4003 | { | 4003 | { |
4004 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03b, | 4004 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03b, |
4005 | "qla_target(%d): Async LOOP_UP occured " | 4005 | "qla_target(%d): Async LOOP_UP occured " |
4006 | "(m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, | 4006 | "(m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx, |
4007 | le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), | 4007 | le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]), |
4008 | le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); | 4008 | le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3])); |
4009 | if (tgt->link_reinit_iocb_pending) { | 4009 | if (tgt->link_reinit_iocb_pending) { |
4010 | qlt_send_notify_ack(vha, (void *)&tgt->link_reinit_iocb, | 4010 | qlt_send_notify_ack(vha, (void *)&tgt->link_reinit_iocb, |
4011 | 0, 0, 0, 0, 0, 0); | 4011 | 0, 0, 0, 0, 0, 0); |
@@ -4020,23 +4020,24 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha, | |||
4020 | case MBA_RSCN_UPDATE: | 4020 | case MBA_RSCN_UPDATE: |
4021 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03c, | 4021 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03c, |
4022 | "qla_target(%d): Async event %#x occured " | 4022 | "qla_target(%d): Async event %#x occured " |
4023 | "(m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, code, | 4023 | "(m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx, code, |
4024 | le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), | 4024 | le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]), |
4025 | le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); | 4025 | le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3])); |
4026 | break; | 4026 | break; |
4027 | 4027 | ||
4028 | case MBA_PORT_UPDATE: | 4028 | case MBA_PORT_UPDATE: |
4029 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03d, | 4029 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03d, |
4030 | "qla_target(%d): Port update async event %#x " | 4030 | "qla_target(%d): Port update async event %#x " |
4031 | "occured: updating the ports database (m[1]=%x, m[2]=%x, " | 4031 | "occured: updating the ports database (m[0]=%x, m[1]=%x, " |
4032 | "m[3]=%x, m[4]=%x)", vha->vp_idx, code, | 4032 | "m[2]=%x, m[3]=%x)", vha->vp_idx, code, |
4033 | le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), | 4033 | le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]), |
4034 | le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); | 4034 | le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3])); |
4035 | reason_code = le16_to_cpu(mailbox[2]); | 4035 | |
4036 | if (reason_code == 0x4) | 4036 | login_code = le16_to_cpu(mailbox[2]); |
4037 | if (login_code == 0x4) | ||
4037 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03e, | 4038 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03e, |
4038 | "Async MB 2: Got PLOGI Complete\n"); | 4039 | "Async MB 2: Got PLOGI Complete\n"); |
4039 | else if (reason_code == 0x7) | 4040 | else if (login_code == 0x7) |
4040 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03f, | 4041 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03f, |
4041 | "Async MB 2: Port Logged Out\n"); | 4042 | "Async MB 2: Port Logged Out\n"); |
4042 | break; | 4043 | break; |
@@ -4044,9 +4045,9 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha, | |||
4044 | default: | 4045 | default: |
4045 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf040, | 4046 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf040, |
4046 | "qla_target(%d): Async event %#x occured: " | 4047 | "qla_target(%d): Async event %#x occured: " |
4047 | "ignore (m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, | 4048 | "ignore (m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx, |
4048 | code, le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), | 4049 | code, le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]), |
4049 | le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); | 4050 | le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3])); |
4050 | break; | 4051 | break; |
4051 | } | 4052 | } |
4052 | 4053 | ||
diff --git a/drivers/scsi/scsi_wait_scan.c b/drivers/scsi/scsi_wait_scan.c index ae7814874618..072734538876 100644 --- a/drivers/scsi/scsi_wait_scan.c +++ b/drivers/scsi/scsi_wait_scan.c | |||
@@ -22,11 +22,6 @@ static int __init wait_scan_init(void) | |||
22 | * and might not yet have reached the scsi async scanning | 22 | * and might not yet have reached the scsi async scanning |
23 | */ | 23 | */ |
24 | wait_for_device_probe(); | 24 | wait_for_device_probe(); |
25 | /* | ||
26 | * and then we wait for the actual asynchronous scsi scan | ||
27 | * to finish. | ||
28 | */ | ||
29 | scsi_complete_async_scans(); | ||
30 | return 0; | 25 | return 0; |
31 | } | 26 | } |
32 | 27 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 6f0a4c612b3b..6f72b80121a0 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1899,6 +1899,8 @@ static int sd_try_rc16_first(struct scsi_device *sdp) | |||
1899 | { | 1899 | { |
1900 | if (sdp->host->max_cmd_len < 16) | 1900 | if (sdp->host->max_cmd_len < 16) |
1901 | return 0; | 1901 | return 0; |
1902 | if (sdp->try_rc_10_first) | ||
1903 | return 0; | ||
1902 | if (sdp->scsi_level > SCSI_SPC_2) | 1904 | if (sdp->scsi_level > SCSI_SPC_2) |
1903 | return 1; | 1905 | return 1; |
1904 | if (scsi_device_protection(sdp)) | 1906 | if (scsi_device_protection(sdp)) |
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 9888693a18fe..664f6e775d0e 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
@@ -1095,7 +1095,7 @@ int target_emulate_write_same(struct se_cmd *cmd) | |||
1095 | if (num_blocks != 0) | 1095 | if (num_blocks != 0) |
1096 | range = num_blocks; | 1096 | range = num_blocks; |
1097 | else | 1097 | else |
1098 | range = (dev->transport->get_blocks(dev) - lba); | 1098 | range = (dev->transport->get_blocks(dev) - lba) + 1; |
1099 | 1099 | ||
1100 | pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n", | 1100 | pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n", |
1101 | (unsigned long long)lba, (unsigned long long)range); | 1101 | (unsigned long long)lba, (unsigned long long)range); |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 85564998500a..a1bcd927a9e6 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -2031,7 +2031,7 @@ static int __core_scsi3_write_aptpl_to_file( | |||
2031 | if (IS_ERR(file) || !file || !file->f_dentry) { | 2031 | if (IS_ERR(file) || !file || !file->f_dentry) { |
2032 | pr_err("filp_open(%s) for APTPL metadata" | 2032 | pr_err("filp_open(%s) for APTPL metadata" |
2033 | " failed\n", path); | 2033 | " failed\n", path); |
2034 | return (PTR_ERR(file) < 0 ? PTR_ERR(file) : -ENOENT); | 2034 | return IS_ERR(file) ? PTR_ERR(file) : -ENOENT; |
2035 | } | 2035 | } |
2036 | 2036 | ||
2037 | iov[0].iov_base = &buf[0]; | 2037 | iov[0].iov_base = &buf[0]; |
@@ -3818,7 +3818,7 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd) | |||
3818 | " SPC-2 reservation is held, returning" | 3818 | " SPC-2 reservation is held, returning" |
3819 | " RESERVATION_CONFLICT\n"); | 3819 | " RESERVATION_CONFLICT\n"); |
3820 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; | 3820 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
3821 | ret = EINVAL; | 3821 | ret = -EINVAL; |
3822 | goto out; | 3822 | goto out; |
3823 | } | 3823 | } |
3824 | 3824 | ||
@@ -3828,7 +3828,8 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd) | |||
3828 | */ | 3828 | */ |
3829 | if (!cmd->se_sess) { | 3829 | if (!cmd->se_sess) { |
3830 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 3830 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3831 | return -EINVAL; | 3831 | ret = -EINVAL; |
3832 | goto out; | ||
3832 | } | 3833 | } |
3833 | 3834 | ||
3834 | if (cmd->data_length < 24) { | 3835 | if (cmd->data_length < 24) { |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index f03fb9730f5b..5b65f33939a8 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -230,6 +230,8 @@ u32 ft_get_task_tag(struct se_cmd *se_cmd) | |||
230 | { | 230 | { |
231 | struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); | 231 | struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); |
232 | 232 | ||
233 | if (cmd->aborted) | ||
234 | return ~0; | ||
233 | return fc_seq_exch(cmd->seq)->rxid; | 235 | return fc_seq_exch(cmd->seq)->rxid; |
234 | } | 236 | } |
235 | 237 | ||
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index cb99da920068..87901fa74dd7 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c | |||
@@ -58,7 +58,8 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport) | |||
58 | struct ft_tport *tport; | 58 | struct ft_tport *tport; |
59 | int i; | 59 | int i; |
60 | 60 | ||
61 | tport = rcu_dereference(lport->prov[FC_TYPE_FCP]); | 61 | tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP], |
62 | lockdep_is_held(&ft_lport_lock)); | ||
62 | if (tport && tport->tpg) | 63 | if (tport && tport->tpg) |
63 | return tport; | 64 | return tport; |
64 | 65 | ||
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c index ced26c8ccd57..0d2ea0c224c3 100644 --- a/drivers/tty/hvc/hvc_opal.c +++ b/drivers/tty/hvc/hvc_opal.c | |||
@@ -401,7 +401,7 @@ out: | |||
401 | } | 401 | } |
402 | 402 | ||
403 | #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW | 403 | #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW |
404 | void __init udbg_init_debug_opal(void) | 404 | void __init udbg_init_debug_opal_raw(void) |
405 | { | 405 | { |
406 | u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; | 406 | u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; |
407 | hvc_opal_privs[index] = &hvc_opal_boot_priv; | 407 | hvc_opal_privs[index] = &hvc_opal_boot_priv; |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index c691eea51537..f5ed3d75fa5a 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -46,7 +46,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/ | |||
46 | obj-$(CONFIG_USB_SERIAL) += serial/ | 46 | obj-$(CONFIG_USB_SERIAL) += serial/ |
47 | 47 | ||
48 | obj-$(CONFIG_USB) += misc/ | 48 | obj-$(CONFIG_USB) += misc/ |
49 | obj-$(CONFIG_USB) += phy/ | 49 | obj-$(CONFIG_USB_COMMON) += phy/ |
50 | obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ | 50 | obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ |
51 | 51 | ||
52 | obj-$(CONFIG_USB_ATM) += atm/ | 52 | obj-$(CONFIG_USB_ATM) += atm/ |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 8fd398dffced..ee469274a3fe 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -500,6 +500,8 @@ retry: | |||
500 | goto retry; | 500 | goto retry; |
501 | } | 501 | } |
502 | if (!desc->reslength) { /* zero length read */ | 502 | if (!desc->reslength) { /* zero length read */ |
503 | dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__); | ||
504 | clear_bit(WDM_READ, &desc->flags); | ||
503 | spin_unlock_irq(&desc->iuspin); | 505 | spin_unlock_irq(&desc->iuspin); |
504 | goto retry; | 506 | goto retry; |
505 | } | 507 | } |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 25a7422ee657..8fb484984c86 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2324,12 +2324,16 @@ static unsigned hub_is_wusb(struct usb_hub *hub) | |||
2324 | static int hub_port_reset(struct usb_hub *hub, int port1, | 2324 | static int hub_port_reset(struct usb_hub *hub, int port1, |
2325 | struct usb_device *udev, unsigned int delay, bool warm); | 2325 | struct usb_device *udev, unsigned int delay, bool warm); |
2326 | 2326 | ||
2327 | /* Is a USB 3.0 port in the Inactive state? */ | 2327 | /* Is a USB 3.0 port in the Inactive or Complinance Mode state? |
2328 | static bool hub_port_inactive(struct usb_hub *hub, u16 portstatus) | 2328 | * Port worm reset is required to recover |
2329 | */ | ||
2330 | static bool hub_port_warm_reset_required(struct usb_hub *hub, u16 portstatus) | ||
2329 | { | 2331 | { |
2330 | return hub_is_superspeed(hub->hdev) && | 2332 | return hub_is_superspeed(hub->hdev) && |
2331 | (portstatus & USB_PORT_STAT_LINK_STATE) == | 2333 | (((portstatus & USB_PORT_STAT_LINK_STATE) == |
2332 | USB_SS_PORT_LS_SS_INACTIVE; | 2334 | USB_SS_PORT_LS_SS_INACTIVE) || |
2335 | ((portstatus & USB_PORT_STAT_LINK_STATE) == | ||
2336 | USB_SS_PORT_LS_COMP_MOD)) ; | ||
2333 | } | 2337 | } |
2334 | 2338 | ||
2335 | static int hub_port_wait_reset(struct usb_hub *hub, int port1, | 2339 | static int hub_port_wait_reset(struct usb_hub *hub, int port1, |
@@ -2365,7 +2369,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | |||
2365 | * | 2369 | * |
2366 | * See https://bugzilla.kernel.org/show_bug.cgi?id=41752 | 2370 | * See https://bugzilla.kernel.org/show_bug.cgi?id=41752 |
2367 | */ | 2371 | */ |
2368 | if (hub_port_inactive(hub, portstatus)) { | 2372 | if (hub_port_warm_reset_required(hub, portstatus)) { |
2369 | int ret; | 2373 | int ret; |
2370 | 2374 | ||
2371 | if ((portchange & USB_PORT_STAT_C_CONNECTION)) | 2375 | if ((portchange & USB_PORT_STAT_C_CONNECTION)) |
@@ -4408,9 +4412,7 @@ static void hub_events(void) | |||
4408 | /* Warm reset a USB3 protocol port if it's in | 4412 | /* Warm reset a USB3 protocol port if it's in |
4409 | * SS.Inactive state. | 4413 | * SS.Inactive state. |
4410 | */ | 4414 | */ |
4411 | if (hub_is_superspeed(hub->hdev) && | 4415 | if (hub_port_warm_reset_required(hub, portstatus)) { |
4412 | (portstatus & USB_PORT_STAT_LINK_STATE) | ||
4413 | == USB_SS_PORT_LS_SS_INACTIVE) { | ||
4414 | dev_dbg(hub_dev, "warm reset port %d\n", i); | 4416 | dev_dbg(hub_dev, "warm reset port %d\n", i); |
4415 | hub_port_reset(hub, i, NULL, | 4417 | hub_port_reset(hub, i, NULL, |
4416 | HUB_BH_RESET_TIME, true); | 4418 | HUB_BH_RESET_TIME, true); |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3df1a1973b05..ec70df7aba17 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -1091,7 +1091,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, | |||
1091 | if (r == req) { | 1091 | if (r == req) { |
1092 | /* wait until it is processed */ | 1092 | /* wait until it is processed */ |
1093 | dwc3_stop_active_transfer(dwc, dep->number); | 1093 | dwc3_stop_active_transfer(dwc, dep->number); |
1094 | goto out0; | 1094 | goto out1; |
1095 | } | 1095 | } |
1096 | dev_err(dwc->dev, "request %p was not queued to %s\n", | 1096 | dev_err(dwc->dev, "request %p was not queued to %s\n", |
1097 | request, ep->name); | 1097 | request, ep->name); |
@@ -1099,6 +1099,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, | |||
1099 | goto out0; | 1099 | goto out0; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | out1: | ||
1102 | /* giveback the request */ | 1103 | /* giveback the request */ |
1103 | dwc3_gadget_giveback(dep, req, -ECONNRESET); | 1104 | dwc3_gadget_giveback(dep, req, -ECONNRESET); |
1104 | 1105 | ||
diff --git a/drivers/usb/gadget/fsl_qe_udc.h b/drivers/usb/gadget/fsl_qe_udc.h index 4c07ca9cebf3..7026919fc901 100644 --- a/drivers/usb/gadget/fsl_qe_udc.h +++ b/drivers/usb/gadget/fsl_qe_udc.h | |||
@@ -153,10 +153,10 @@ struct usb_ep_para{ | |||
153 | #define USB_BUSMODE_DTB 0x02 | 153 | #define USB_BUSMODE_DTB 0x02 |
154 | 154 | ||
155 | /* Endpoint basic handle */ | 155 | /* Endpoint basic handle */ |
156 | #define ep_index(EP) ((EP)->desc->bEndpointAddress & 0xF) | 156 | #define ep_index(EP) ((EP)->ep.desc->bEndpointAddress & 0xF) |
157 | #define ep_maxpacket(EP) ((EP)->ep.maxpacket) | 157 | #define ep_maxpacket(EP) ((EP)->ep.maxpacket) |
158 | #define ep_is_in(EP) ((ep_index(EP) == 0) ? (EP->udc->ep0_dir == \ | 158 | #define ep_is_in(EP) ((ep_index(EP) == 0) ? (EP->udc->ep0_dir == \ |
159 | USB_DIR_IN) : ((EP)->desc->bEndpointAddress \ | 159 | USB_DIR_IN) : ((EP)->ep.desc->bEndpointAddress \ |
160 | & USB_DIR_IN) == USB_DIR_IN) | 160 | & USB_DIR_IN) == USB_DIR_IN) |
161 | 161 | ||
162 | /* ep0 transfer state */ | 162 | /* ep0 transfer state */ |
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c index 262acfd53e32..2ab0388d93eb 100644 --- a/drivers/usb/gadget/lpc32xx_udc.c +++ b/drivers/usb/gadget/lpc32xx_udc.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <mach/irqs.h> | 61 | #include <mach/irqs.h> |
62 | #include <mach/board.h> | 62 | #include <mach/board.h> |
63 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES | 63 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES |
64 | #include <linux/debugfs.h> | ||
64 | #include <linux/seq_file.h> | 65 | #include <linux/seq_file.h> |
65 | #endif | 66 | #endif |
66 | 67 | ||
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 17cfb8a1131c..c30435499a02 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -281,14 +281,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | /* Hold PHYs in reset while initializing EHCI controller */ | ||
284 | if (pdata->phy_reset) { | 285 | if (pdata->phy_reset) { |
285 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | 286 | if (gpio_is_valid(pdata->reset_gpio_port[0])) |
286 | gpio_request_one(pdata->reset_gpio_port[0], | 287 | gpio_set_value_cansleep(pdata->reset_gpio_port[0], 0); |
287 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
288 | 288 | ||
289 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | 289 | if (gpio_is_valid(pdata->reset_gpio_port[1])) |
290 | gpio_request_one(pdata->reset_gpio_port[1], | 290 | gpio_set_value_cansleep(pdata->reset_gpio_port[1], 0); |
291 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
292 | 291 | ||
293 | /* Hold the PHY in RESET for enough time till DIR is high */ | 292 | /* Hold the PHY in RESET for enough time till DIR is high */ |
294 | udelay(10); | 293 | udelay(10); |
@@ -330,6 +329,11 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
330 | omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); | 329 | omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); |
331 | 330 | ||
332 | ehci_reset(omap_ehci); | 331 | ehci_reset(omap_ehci); |
332 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | ||
333 | if (ret) { | ||
334 | dev_err(dev, "failed to add hcd with err %d\n", ret); | ||
335 | goto err_add_hcd; | ||
336 | } | ||
333 | 337 | ||
334 | if (pdata->phy_reset) { | 338 | if (pdata->phy_reset) { |
335 | /* Hold the PHY in RESET for enough time till | 339 | /* Hold the PHY in RESET for enough time till |
@@ -344,12 +348,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
344 | gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1); | 348 | gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1); |
345 | } | 349 | } |
346 | 350 | ||
347 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | ||
348 | if (ret) { | ||
349 | dev_err(dev, "failed to add hcd with err %d\n", ret); | ||
350 | goto err_add_hcd; | ||
351 | } | ||
352 | |||
353 | /* root ports should always stay powered */ | 351 | /* root ports should always stay powered */ |
354 | ehci_port_power(omap_ehci, 1); | 352 | ehci_port_power(omap_ehci, 1); |
355 | 353 | ||
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 2732ef660c5c..7b01094d7993 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -462,6 +462,42 @@ void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, | |||
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | /* Updates Link Status for super Speed port */ | ||
466 | static void xhci_hub_report_link_state(u32 *status, u32 status_reg) | ||
467 | { | ||
468 | u32 pls = status_reg & PORT_PLS_MASK; | ||
469 | |||
470 | /* resume state is a xHCI internal state. | ||
471 | * Do not report it to usb core. | ||
472 | */ | ||
473 | if (pls == XDEV_RESUME) | ||
474 | return; | ||
475 | |||
476 | /* When the CAS bit is set then warm reset | ||
477 | * should be performed on port | ||
478 | */ | ||
479 | if (status_reg & PORT_CAS) { | ||
480 | /* The CAS bit can be set while the port is | ||
481 | * in any link state. | ||
482 | * Only roothubs have CAS bit, so we | ||
483 | * pretend to be in compliance mode | ||
484 | * unless we're already in compliance | ||
485 | * or the inactive state. | ||
486 | */ | ||
487 | if (pls != USB_SS_PORT_LS_COMP_MOD && | ||
488 | pls != USB_SS_PORT_LS_SS_INACTIVE) { | ||
489 | pls = USB_SS_PORT_LS_COMP_MOD; | ||
490 | } | ||
491 | /* Return also connection bit - | ||
492 | * hub state machine resets port | ||
493 | * when this bit is set. | ||
494 | */ | ||
495 | pls |= USB_PORT_STAT_CONNECTION; | ||
496 | } | ||
497 | /* update status field */ | ||
498 | *status |= pls; | ||
499 | } | ||
500 | |||
465 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | 501 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
466 | u16 wIndex, char *buf, u16 wLength) | 502 | u16 wIndex, char *buf, u16 wLength) |
467 | { | 503 | { |
@@ -606,13 +642,9 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
606 | else | 642 | else |
607 | status |= USB_PORT_STAT_POWER; | 643 | status |= USB_PORT_STAT_POWER; |
608 | } | 644 | } |
609 | /* Port Link State */ | 645 | /* Update Port Link State for super speed ports*/ |
610 | if (hcd->speed == HCD_USB3) { | 646 | if (hcd->speed == HCD_USB3) { |
611 | /* resume state is a xHCI internal state. | 647 | xhci_hub_report_link_state(&status, temp); |
612 | * Do not report it to usb core. | ||
613 | */ | ||
614 | if ((temp & PORT_PLS_MASK) != XDEV_RESUME) | ||
615 | status |= (temp & PORT_PLS_MASK); | ||
616 | } | 648 | } |
617 | if (bus_state->port_c_suspend & (1 << wIndex)) | 649 | if (bus_state->port_c_suspend & (1 << wIndex)) |
618 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | 650 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 23b4aefd1036..8275645889da 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -885,6 +885,17 @@ static void update_ring_for_set_deq_completion(struct xhci_hcd *xhci, | |||
885 | num_trbs_free_temp = ep_ring->num_trbs_free; | 885 | num_trbs_free_temp = ep_ring->num_trbs_free; |
886 | dequeue_temp = ep_ring->dequeue; | 886 | dequeue_temp = ep_ring->dequeue; |
887 | 887 | ||
888 | /* If we get two back-to-back stalls, and the first stalled transfer | ||
889 | * ends just before a link TRB, the dequeue pointer will be left on | ||
890 | * the link TRB by the code in the while loop. So we have to update | ||
891 | * the dequeue pointer one segment further, or we'll jump off | ||
892 | * the segment into la-la-land. | ||
893 | */ | ||
894 | if (last_trb(xhci, ep_ring, ep_ring->deq_seg, ep_ring->dequeue)) { | ||
895 | ep_ring->deq_seg = ep_ring->deq_seg->next; | ||
896 | ep_ring->dequeue = ep_ring->deq_seg->trbs; | ||
897 | } | ||
898 | |||
888 | while (ep_ring->dequeue != dev->eps[ep_index].queued_deq_ptr) { | 899 | while (ep_ring->dequeue != dev->eps[ep_index].queued_deq_ptr) { |
889 | /* We have more usable TRBs */ | 900 | /* We have more usable TRBs */ |
890 | ep_ring->num_trbs_free++; | 901 | ep_ring->num_trbs_free++; |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index de3d6e3e57be..55c0785810c9 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -341,7 +341,11 @@ struct xhci_op_regs { | |||
341 | #define PORT_PLC (1 << 22) | 341 | #define PORT_PLC (1 << 22) |
342 | /* port configure error change - port failed to configure its link partner */ | 342 | /* port configure error change - port failed to configure its link partner */ |
343 | #define PORT_CEC (1 << 23) | 343 | #define PORT_CEC (1 << 23) |
344 | /* bit 24 reserved */ | 344 | /* Cold Attach Status - xHC can set this bit to report device attached during |
345 | * Sx state. Warm port reset should be perfomed to clear this bit and move port | ||
346 | * to connected state. | ||
347 | */ | ||
348 | #define PORT_CAS (1 << 24) | ||
345 | /* wake on connect (enable) */ | 349 | /* wake on connect (enable) */ |
346 | #define PORT_WKCONN_E (1 << 25) | 350 | #define PORT_WKCONN_E (1 << 25) |
347 | /* wake on disconnect (enable) */ | 351 | /* wake on disconnect (enable) */ |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index ef8d744800ac..e090c799d87b 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -375,11 +375,21 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, | |||
375 | */ | 375 | */ |
376 | if (list_empty(&qh->hep->urb_list)) { | 376 | if (list_empty(&qh->hep->urb_list)) { |
377 | struct list_head *head; | 377 | struct list_head *head; |
378 | struct dma_controller *dma = musb->dma_controller; | ||
378 | 379 | ||
379 | if (is_in) | 380 | if (is_in) { |
380 | ep->rx_reinit = 1; | 381 | ep->rx_reinit = 1; |
381 | else | 382 | if (ep->rx_channel) { |
383 | dma->channel_release(ep->rx_channel); | ||
384 | ep->rx_channel = NULL; | ||
385 | } | ||
386 | } else { | ||
382 | ep->tx_reinit = 1; | 387 | ep->tx_reinit = 1; |
388 | if (ep->tx_channel) { | ||
389 | dma->channel_release(ep->tx_channel); | ||
390 | ep->tx_channel = NULL; | ||
391 | } | ||
392 | } | ||
383 | 393 | ||
384 | /* Clobber old pointers to this qh */ | 394 | /* Clobber old pointers to this qh */ |
385 | musb_ep_set_qh(ep, is_in, NULL); | 395 | musb_ep_set_qh(ep, is_in, NULL); |
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c index d2a9a8e691b9..0eabb049b6a9 100644 --- a/drivers/usb/otg/twl6030-usb.c +++ b/drivers/usb/otg/twl6030-usb.c | |||
@@ -305,9 +305,8 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
305 | 305 | ||
306 | regulator_enable(twl->usb3v3); | 306 | regulator_enable(twl->usb3v3); |
307 | twl->asleep = 1; | 307 | twl->asleep = 1; |
308 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 0x1); | 308 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_CLR); |
309 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, | 309 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET); |
310 | 0x10); | ||
311 | status = USB_EVENT_ID; | 310 | status = USB_EVENT_ID; |
312 | otg->default_a = true; | 311 | otg->default_a = true; |
313 | twl->phy.state = OTG_STATE_A_IDLE; | 312 | twl->phy.state = OTG_STATE_A_IDLE; |
@@ -316,12 +315,10 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
316 | atomic_notifier_call_chain(&twl->phy.notifier, status, | 315 | atomic_notifier_call_chain(&twl->phy.notifier, status, |
317 | otg->gadget); | 316 | otg->gadget); |
318 | } else { | 317 | } else { |
319 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, | 318 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR); |
320 | 0x10); | 319 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); |
321 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, | ||
322 | 0x1); | ||
323 | } | 320 | } |
324 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_LATCH_CLR, status); | 321 | twl6030_writeb(twl, TWL_MODULE_USB, status, USB_ID_INT_LATCH_CLR); |
325 | 322 | ||
326 | return IRQ_HANDLED; | 323 | return IRQ_HANDLED; |
327 | } | 324 | } |
@@ -343,7 +340,7 @@ static int twl6030_enable_irq(struct usb_phy *x) | |||
343 | { | 340 | { |
344 | struct twl6030_usb *twl = phy_to_twl(x); | 341 | struct twl6030_usb *twl = phy_to_twl(x); |
345 | 342 | ||
346 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, 0x1); | 343 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); |
347 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); | 344 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); |
348 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C); | 345 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C); |
349 | 346 | ||
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 3cfabcba7447..e7cf84f0751a 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig | |||
@@ -2,11 +2,11 @@ | |||
2 | # Physical Layer USB driver configuration | 2 | # Physical Layer USB driver configuration |
3 | # | 3 | # |
4 | comment "USB Physical Layer drivers" | 4 | comment "USB Physical Layer drivers" |
5 | depends on USB | 5 | depends on USB || USB_GADGET |
6 | 6 | ||
7 | config USB_ISP1301 | 7 | config USB_ISP1301 |
8 | tristate "NXP ISP1301 USB transceiver support" | 8 | tristate "NXP ISP1301 USB transceiver support" |
9 | depends on USB | 9 | depends on USB || USB_GADGET |
10 | depends on I2C | 10 | depends on I2C |
11 | help | 11 | help |
12 | Say Y here to add support for the NXP ISP1301 USB transceiver driver. | 12 | Say Y here to add support for the NXP ISP1301 USB transceiver driver. |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 73d25cd8cba5..1e71079ce33b 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -93,6 +93,7 @@ static const struct usb_device_id id_table[] = { | |||
93 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 93 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
94 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | 94 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
95 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ | 95 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ |
96 | { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ | ||
96 | { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ | 97 | { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ |
97 | { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ | 98 | { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ |
98 | { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */ | 99 | { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */ |
@@ -134,7 +135,13 @@ static const struct usb_device_id id_table[] = { | |||
134 | { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ | 135 | { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ |
135 | { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ | 136 | { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ |
136 | { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ | 137 | { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ |
138 | { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ | ||
139 | { USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */ | ||
137 | { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ | 140 | { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ |
141 | { USB_DEVICE(0x166A, 0x0304) }, /* Clipsal 5000CT2 C-Bus Black and White Touchscreen */ | ||
142 | { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ | ||
143 | { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ | ||
144 | { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ | ||
138 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ | 145 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ |
139 | { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ | 146 | { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ |
140 | { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ | 147 | { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ |
@@ -146,7 +153,11 @@ static const struct usb_device_id id_table[] = { | |||
146 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ | 153 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ |
147 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | 154 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ |
148 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | 155 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ |
156 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ | ||
157 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ | ||
149 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ | 158 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
159 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ | ||
160 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ | ||
150 | { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ | 161 | { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ |
151 | { } /* Terminating Entry */ | 162 | { } /* Terminating Entry */ |
152 | }; | 163 | }; |
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 81423f7361db..d47eb06fe463 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -222,14 +222,6 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
222 | metro_priv->throttled = 0; | 222 | metro_priv->throttled = 0; |
223 | spin_unlock_irqrestore(&metro_priv->lock, flags); | 223 | spin_unlock_irqrestore(&metro_priv->lock, flags); |
224 | 224 | ||
225 | /* | ||
226 | * Force low_latency on so that our tty_push actually forces the data | ||
227 | * through, otherwise it is scheduled, and with high data rates (like | ||
228 | * with OHCI) data can get lost. | ||
229 | */ | ||
230 | if (tty) | ||
231 | tty->low_latency = 1; | ||
232 | |||
233 | /* Clear the urb pipe. */ | 225 | /* Clear the urb pipe. */ |
234 | usb_clear_halt(serial->dev, port->interrupt_in_urb->pipe); | 226 | usb_clear_halt(serial->dev, port->interrupt_in_urb->pipe); |
235 | 227 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e668a2460bd4..417ab1b0aa30 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -236,6 +236,7 @@ static void option_instat_callback(struct urb *urb); | |||
236 | #define NOVATELWIRELESS_PRODUCT_G1 0xA001 | 236 | #define NOVATELWIRELESS_PRODUCT_G1 0xA001 |
237 | #define NOVATELWIRELESS_PRODUCT_G1_M 0xA002 | 237 | #define NOVATELWIRELESS_PRODUCT_G1_M 0xA002 |
238 | #define NOVATELWIRELESS_PRODUCT_G2 0xA010 | 238 | #define NOVATELWIRELESS_PRODUCT_G2 0xA010 |
239 | #define NOVATELWIRELESS_PRODUCT_MC551 0xB001 | ||
239 | 240 | ||
240 | /* AMOI PRODUCTS */ | 241 | /* AMOI PRODUCTS */ |
241 | #define AMOI_VENDOR_ID 0x1614 | 242 | #define AMOI_VENDOR_ID 0x1614 |
@@ -496,6 +497,19 @@ static void option_instat_callback(struct urb *urb); | |||
496 | 497 | ||
497 | /* MediaTek products */ | 498 | /* MediaTek products */ |
498 | #define MEDIATEK_VENDOR_ID 0x0e8d | 499 | #define MEDIATEK_VENDOR_ID 0x0e8d |
500 | #define MEDIATEK_PRODUCT_DC_1COM 0x00a0 | ||
501 | #define MEDIATEK_PRODUCT_DC_4COM 0x00a5 | ||
502 | #define MEDIATEK_PRODUCT_DC_5COM 0x00a4 | ||
503 | #define MEDIATEK_PRODUCT_7208_1COM 0x7101 | ||
504 | #define MEDIATEK_PRODUCT_7208_2COM 0x7102 | ||
505 | #define MEDIATEK_PRODUCT_FP_1COM 0x0003 | ||
506 | #define MEDIATEK_PRODUCT_FP_2COM 0x0023 | ||
507 | #define MEDIATEK_PRODUCT_FPDC_1COM 0x0043 | ||
508 | #define MEDIATEK_PRODUCT_FPDC_2COM 0x0033 | ||
509 | |||
510 | /* Cellient products */ | ||
511 | #define CELLIENT_VENDOR_ID 0x2692 | ||
512 | #define CELLIENT_PRODUCT_MEN200 0x9005 | ||
499 | 513 | ||
500 | /* some devices interfaces need special handling due to a number of reasons */ | 514 | /* some devices interfaces need special handling due to a number of reasons */ |
501 | enum option_blacklist_reason { | 515 | enum option_blacklist_reason { |
@@ -549,6 +563,10 @@ static const struct option_blacklist_info net_intf1_blacklist = { | |||
549 | .reserved = BIT(1), | 563 | .reserved = BIT(1), |
550 | }; | 564 | }; |
551 | 565 | ||
566 | static const struct option_blacklist_info net_intf2_blacklist = { | ||
567 | .reserved = BIT(2), | ||
568 | }; | ||
569 | |||
552 | static const struct option_blacklist_info net_intf3_blacklist = { | 570 | static const struct option_blacklist_info net_intf3_blacklist = { |
553 | .reserved = BIT(3), | 571 | .reserved = BIT(3), |
554 | }; | 572 | }; |
@@ -734,6 +752,8 @@ static const struct usb_device_id option_ids[] = { | |||
734 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) }, | 752 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) }, |
735 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) }, | 753 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) }, |
736 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) }, | 754 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) }, |
755 | /* Novatel Ovation MC551 a.k.a. Verizon USB551L */ | ||
756 | { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) }, | ||
737 | 757 | ||
738 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, | 758 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, |
739 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, | 759 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, |
@@ -1092,6 +1112,8 @@ static const struct usb_device_id option_ids[] = { | |||
1092 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, | 1112 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, |
1093 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, | 1113 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, |
1094 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, | 1114 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, |
1115 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff), | ||
1116 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
1095 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, | 1117 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, |
1096 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, | 1118 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, |
1097 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, | 1119 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, |
@@ -1233,6 +1255,18 @@ static const struct usb_device_id option_ids[] = { | |||
1233 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) }, | 1255 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) }, |
1234 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) }, | 1256 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) }, |
1235 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */ | 1257 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */ |
1258 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_1COM, 0x0a, 0x00, 0x00) }, | ||
1259 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_5COM, 0xff, 0x02, 0x01) }, | ||
1260 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_5COM, 0xff, 0x00, 0x00) }, | ||
1261 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM, 0xff, 0x02, 0x01) }, | ||
1262 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM, 0xff, 0x00, 0x00) }, | ||
1263 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7208_1COM, 0x02, 0x00, 0x00) }, | ||
1264 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7208_2COM, 0x02, 0x02, 0x01) }, | ||
1265 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_1COM, 0x0a, 0x00, 0x00) }, | ||
1266 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) }, | ||
1267 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) }, | ||
1268 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) }, | ||
1269 | { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, | ||
1236 | { } /* Terminating entry */ | 1270 | { } /* Terminating entry */ |
1237 | }; | 1271 | }; |
1238 | MODULE_DEVICE_TABLE(usb, option_ids); | 1272 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index a324a5d21e99..11418da9bc09 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -202,6 +202,12 @@ static int slave_configure(struct scsi_device *sdev) | |||
202 | if (us->fflags & US_FL_NO_READ_CAPACITY_16) | 202 | if (us->fflags & US_FL_NO_READ_CAPACITY_16) |
203 | sdev->no_read_capacity_16 = 1; | 203 | sdev->no_read_capacity_16 = 1; |
204 | 204 | ||
205 | /* | ||
206 | * Many devices do not respond properly to READ_CAPACITY_16. | ||
207 | * Tell the SCSI layer to try READ_CAPACITY_10 first. | ||
208 | */ | ||
209 | sdev->try_rc_10_first = 1; | ||
210 | |||
205 | /* assume SPC3 or latter devices support sense size > 18 */ | 211 | /* assume SPC3 or latter devices support sense size > 18 */ |
206 | if (sdev->scsi_level > SCSI_SPC_2) | 212 | if (sdev->scsi_level > SCSI_SPC_2) |
207 | us->fflags |= US_FL_SANE_SENSE; | 213 | us->fflags |= US_FL_SANE_SENSE; |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index caf22bf5f822..1719886bb9be 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1107,13 +1107,6 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999, | |||
1107 | USB_SC_RBC, USB_PR_BULK, NULL, | 1107 | USB_SC_RBC, USB_PR_BULK, NULL, |
1108 | 0 ), | 1108 | 0 ), |
1109 | 1109 | ||
1110 | /* Feiya QDI U2 DISK, reported by Hans de Goede <hdegoede@redhat.com> */ | ||
1111 | UNUSUAL_DEV( 0x090c, 0x1000, 0x0000, 0xffff, | ||
1112 | "Feiya", | ||
1113 | "QDI U2 DISK", | ||
1114 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1115 | US_FL_NO_READ_CAPACITY_16 ), | ||
1116 | |||
1117 | /* aeb */ | 1110 | /* aeb */ |
1118 | UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, | 1111 | UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, |
1119 | "Feiya", | 1112 | "Feiya", |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 94dbd25caa30..112156f68afb 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -191,7 +191,9 @@ static int vhost_worker(void *data) | |||
191 | struct vhost_dev *dev = data; | 191 | struct vhost_dev *dev = data; |
192 | struct vhost_work *work = NULL; | 192 | struct vhost_work *work = NULL; |
193 | unsigned uninitialized_var(seq); | 193 | unsigned uninitialized_var(seq); |
194 | mm_segment_t oldfs = get_fs(); | ||
194 | 195 | ||
196 | set_fs(USER_DS); | ||
195 | use_mm(dev->mm); | 197 | use_mm(dev->mm); |
196 | 198 | ||
197 | for (;;) { | 199 | for (;;) { |
@@ -229,6 +231,7 @@ static int vhost_worker(void *data) | |||
229 | 231 | ||
230 | } | 232 | } |
231 | unuse_mm(dev->mm); | 233 | unuse_mm(dev->mm); |
234 | set_fs(oldfs); | ||
232 | return 0; | 235 | return 0; |
233 | } | 236 | } |
234 | 237 | ||
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 5066eee10ccf..58bd9c27369d 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/regulator/consumer.h> | 34 | #include <linux/regulator/consumer.h> |
35 | #include <linux/suspend.h> | ||
35 | 36 | ||
36 | #include <video/omapdss.h> | 37 | #include <video/omapdss.h> |
37 | 38 | ||
@@ -201,6 +202,28 @@ int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) | |||
201 | #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ | 202 | #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ |
202 | 203 | ||
203 | /* PLATFORM DEVICE */ | 204 | /* PLATFORM DEVICE */ |
205 | static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void *d) | ||
206 | { | ||
207 | DSSDBG("pm notif %lu\n", v); | ||
208 | |||
209 | switch (v) { | ||
210 | case PM_SUSPEND_PREPARE: | ||
211 | DSSDBG("suspending displays\n"); | ||
212 | return dss_suspend_all_devices(); | ||
213 | |||
214 | case PM_POST_SUSPEND: | ||
215 | DSSDBG("resuming displays\n"); | ||
216 | return dss_resume_all_devices(); | ||
217 | |||
218 | default: | ||
219 | return 0; | ||
220 | } | ||
221 | } | ||
222 | |||
223 | static struct notifier_block omap_dss_pm_notif_block = { | ||
224 | .notifier_call = omap_dss_pm_notif, | ||
225 | }; | ||
226 | |||
204 | static int __init omap_dss_probe(struct platform_device *pdev) | 227 | static int __init omap_dss_probe(struct platform_device *pdev) |
205 | { | 228 | { |
206 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | 229 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; |
@@ -224,6 +247,8 @@ static int __init omap_dss_probe(struct platform_device *pdev) | |||
224 | else if (pdata->default_device) | 247 | else if (pdata->default_device) |
225 | core.default_display_name = pdata->default_device->name; | 248 | core.default_display_name = pdata->default_device->name; |
226 | 249 | ||
250 | register_pm_notifier(&omap_dss_pm_notif_block); | ||
251 | |||
227 | return 0; | 252 | return 0; |
228 | 253 | ||
229 | err_debugfs: | 254 | err_debugfs: |
@@ -233,6 +258,8 @@ err_debugfs: | |||
233 | 258 | ||
234 | static int omap_dss_remove(struct platform_device *pdev) | 259 | static int omap_dss_remove(struct platform_device *pdev) |
235 | { | 260 | { |
261 | unregister_pm_notifier(&omap_dss_pm_notif_block); | ||
262 | |||
236 | dss_uninitialize_debugfs(); | 263 | dss_uninitialize_debugfs(); |
237 | 264 | ||
238 | dss_uninit_overlays(pdev); | 265 | dss_uninit_overlays(pdev); |
@@ -247,25 +274,9 @@ static void omap_dss_shutdown(struct platform_device *pdev) | |||
247 | dss_disable_all_devices(); | 274 | dss_disable_all_devices(); |
248 | } | 275 | } |
249 | 276 | ||
250 | static int omap_dss_suspend(struct platform_device *pdev, pm_message_t state) | ||
251 | { | ||
252 | DSSDBG("suspend %d\n", state.event); | ||
253 | |||
254 | return dss_suspend_all_devices(); | ||
255 | } | ||
256 | |||
257 | static int omap_dss_resume(struct platform_device *pdev) | ||
258 | { | ||
259 | DSSDBG("resume\n"); | ||
260 | |||
261 | return dss_resume_all_devices(); | ||
262 | } | ||
263 | |||
264 | static struct platform_driver omap_dss_driver = { | 277 | static struct platform_driver omap_dss_driver = { |
265 | .remove = omap_dss_remove, | 278 | .remove = omap_dss_remove, |
266 | .shutdown = omap_dss_shutdown, | 279 | .shutdown = omap_dss_shutdown, |
267 | .suspend = omap_dss_suspend, | ||
268 | .resume = omap_dss_resume, | ||
269 | .driver = { | 280 | .driver = { |
270 | .name = "omapdss", | 281 | .name = "omapdss", |
271 | .owner = THIS_MODULE, | 282 | .owner = THIS_MODULE, |
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 4749ac356469..397d4eee11bb 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -384,7 +384,7 @@ void dispc_runtime_put(void) | |||
384 | DSSDBG("dispc_runtime_put\n"); | 384 | DSSDBG("dispc_runtime_put\n"); |
385 | 385 | ||
386 | r = pm_runtime_put_sync(&dispc.pdev->dev); | 386 | r = pm_runtime_put_sync(&dispc.pdev->dev); |
387 | WARN_ON(r < 0); | 387 | WARN_ON(r < 0 && r != -ENOSYS); |
388 | } | 388 | } |
389 | 389 | ||
390 | static inline bool dispc_mgr_is_lcd(enum omap_channel channel) | 390 | static inline bool dispc_mgr_is_lcd(enum omap_channel channel) |
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index ca8382d346e9..14ce8cc079e3 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -1075,7 +1075,7 @@ void dsi_runtime_put(struct platform_device *dsidev) | |||
1075 | DSSDBG("dsi_runtime_put\n"); | 1075 | DSSDBG("dsi_runtime_put\n"); |
1076 | 1076 | ||
1077 | r = pm_runtime_put_sync(&dsi->pdev->dev); | 1077 | r = pm_runtime_put_sync(&dsi->pdev->dev); |
1078 | WARN_ON(r < 0); | 1078 | WARN_ON(r < 0 && r != -ENOSYS); |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | /* source clock for DSI PLL. this could also be PCLKFREE */ | 1081 | /* source clock for DSI PLL. this could also be PCLKFREE */ |
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 770632359a17..d2b57197b292 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -731,7 +731,7 @@ static void dss_runtime_put(void) | |||
731 | DSSDBG("dss_runtime_put\n"); | 731 | DSSDBG("dss_runtime_put\n"); |
732 | 732 | ||
733 | r = pm_runtime_put_sync(&dss.pdev->dev); | 733 | r = pm_runtime_put_sync(&dss.pdev->dev); |
734 | WARN_ON(r < 0 && r != -EBUSY); | 734 | WARN_ON(r < 0 && r != -ENOSYS && r != -EBUSY); |
735 | } | 735 | } |
736 | 736 | ||
737 | /* DEBUGFS */ | 737 | /* DEBUGFS */ |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 8195c7166d20..26a2430a7028 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -138,7 +138,7 @@ static void hdmi_runtime_put(void) | |||
138 | DSSDBG("hdmi_runtime_put\n"); | 138 | DSSDBG("hdmi_runtime_put\n"); |
139 | 139 | ||
140 | r = pm_runtime_put_sync(&hdmi.pdev->dev); | 140 | r = pm_runtime_put_sync(&hdmi.pdev->dev); |
141 | WARN_ON(r < 0); | 141 | WARN_ON(r < 0 && r != -ENOSYS); |
142 | } | 142 | } |
143 | 143 | ||
144 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) | 144 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 3d8c206e90e5..7985fa12b9b4 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
@@ -141,7 +141,7 @@ static void rfbi_runtime_put(void) | |||
141 | DSSDBG("rfbi_runtime_put\n"); | 141 | DSSDBG("rfbi_runtime_put\n"); |
142 | 142 | ||
143 | r = pm_runtime_put_sync(&rfbi.pdev->dev); | 143 | r = pm_runtime_put_sync(&rfbi.pdev->dev); |
144 | WARN_ON(r < 0); | 144 | WARN_ON(r < 0 && r != -ENOSYS); |
145 | } | 145 | } |
146 | 146 | ||
147 | void rfbi_bus_lock(void) | 147 | void rfbi_bus_lock(void) |
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 2b8973931ff4..3907c8b6ecbc 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -402,7 +402,7 @@ static void venc_runtime_put(void) | |||
402 | DSSDBG("venc_runtime_put\n"); | 402 | DSSDBG("venc_runtime_put\n"); |
403 | 403 | ||
404 | r = pm_runtime_put_sync(&venc.pdev->dev); | 404 | r = pm_runtime_put_sync(&venc.pdev->dev); |
405 | WARN_ON(r < 0); | 405 | WARN_ON(r < 0 && r != -ENOSYS); |
406 | } | 406 | } |
407 | 407 | ||
408 | static const struct venc_config *venc_timings_to_config( | 408 | static const struct venc_config *venc_timings_to_config( |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index bfbc15ca38dd..0908e6044333 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -47,7 +47,7 @@ struct virtio_balloon | |||
47 | struct task_struct *thread; | 47 | struct task_struct *thread; |
48 | 48 | ||
49 | /* Waiting for host to ack the pages we released. */ | 49 | /* Waiting for host to ack the pages we released. */ |
50 | struct completion acked; | 50 | wait_queue_head_t acked; |
51 | 51 | ||
52 | /* Number of balloon pages we've told the Host we're not using. */ | 52 | /* Number of balloon pages we've told the Host we're not using. */ |
53 | unsigned int num_pages; | 53 | unsigned int num_pages; |
@@ -89,29 +89,25 @@ static struct page *balloon_pfn_to_page(u32 pfn) | |||
89 | 89 | ||
90 | static void balloon_ack(struct virtqueue *vq) | 90 | static void balloon_ack(struct virtqueue *vq) |
91 | { | 91 | { |
92 | struct virtio_balloon *vb; | 92 | struct virtio_balloon *vb = vq->vdev->priv; |
93 | unsigned int len; | ||
94 | 93 | ||
95 | vb = virtqueue_get_buf(vq, &len); | 94 | wake_up(&vb->acked); |
96 | if (vb) | ||
97 | complete(&vb->acked); | ||
98 | } | 95 | } |
99 | 96 | ||
100 | static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) | 97 | static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) |
101 | { | 98 | { |
102 | struct scatterlist sg; | 99 | struct scatterlist sg; |
100 | unsigned int len; | ||
103 | 101 | ||
104 | sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); | 102 | sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); |
105 | 103 | ||
106 | init_completion(&vb->acked); | ||
107 | |||
108 | /* We should always be able to add one buffer to an empty queue. */ | 104 | /* We should always be able to add one buffer to an empty queue. */ |
109 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) | 105 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) |
110 | BUG(); | 106 | BUG(); |
111 | virtqueue_kick(vq); | 107 | virtqueue_kick(vq); |
112 | 108 | ||
113 | /* When host has read buffer, this completes via balloon_ack */ | 109 | /* When host has read buffer, this completes via balloon_ack */ |
114 | wait_for_completion(&vb->acked); | 110 | wait_event(vb->acked, virtqueue_get_buf(vq, &len)); |
115 | } | 111 | } |
116 | 112 | ||
117 | static void set_page_pfns(u32 pfns[], struct page *page) | 113 | static void set_page_pfns(u32 pfns[], struct page *page) |
@@ -231,12 +227,8 @@ static void update_balloon_stats(struct virtio_balloon *vb) | |||
231 | */ | 227 | */ |
232 | static void stats_request(struct virtqueue *vq) | 228 | static void stats_request(struct virtqueue *vq) |
233 | { | 229 | { |
234 | struct virtio_balloon *vb; | 230 | struct virtio_balloon *vb = vq->vdev->priv; |
235 | unsigned int len; | ||
236 | 231 | ||
237 | vb = virtqueue_get_buf(vq, &len); | ||
238 | if (!vb) | ||
239 | return; | ||
240 | vb->need_stats_update = 1; | 232 | vb->need_stats_update = 1; |
241 | wake_up(&vb->config_change); | 233 | wake_up(&vb->config_change); |
242 | } | 234 | } |
@@ -245,11 +237,14 @@ static void stats_handle_request(struct virtio_balloon *vb) | |||
245 | { | 237 | { |
246 | struct virtqueue *vq; | 238 | struct virtqueue *vq; |
247 | struct scatterlist sg; | 239 | struct scatterlist sg; |
240 | unsigned int len; | ||
248 | 241 | ||
249 | vb->need_stats_update = 0; | 242 | vb->need_stats_update = 0; |
250 | update_balloon_stats(vb); | 243 | update_balloon_stats(vb); |
251 | 244 | ||
252 | vq = vb->stats_vq; | 245 | vq = vb->stats_vq; |
246 | if (!virtqueue_get_buf(vq, &len)) | ||
247 | return; | ||
253 | sg_init_one(&sg, vb->stats, sizeof(vb->stats)); | 248 | sg_init_one(&sg, vb->stats, sizeof(vb->stats)); |
254 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) | 249 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) |
255 | BUG(); | 250 | BUG(); |
@@ -358,6 +353,7 @@ static int virtballoon_probe(struct virtio_device *vdev) | |||
358 | INIT_LIST_HEAD(&vb->pages); | 353 | INIT_LIST_HEAD(&vb->pages); |
359 | vb->num_pages = 0; | 354 | vb->num_pages = 0; |
360 | init_waitqueue_head(&vb->config_change); | 355 | init_waitqueue_head(&vb->config_change); |
356 | init_waitqueue_head(&vb->acked); | ||
361 | vb->vdev = vdev; | 357 | vb->vdev = vdev; |
362 | vb->need_stats_update = 0; | 358 | vb->need_stats_update = 0; |
363 | 359 | ||
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 2b763815aeec..1eff743ec497 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -146,7 +146,7 @@ struct cmn_registers { | |||
146 | } __attribute__((packed)); | 146 | } __attribute__((packed)); |
147 | 147 | ||
148 | static unsigned int hpwdt_nmi_decoding; | 148 | static unsigned int hpwdt_nmi_decoding; |
149 | static unsigned int allow_kdump; | 149 | static unsigned int allow_kdump = 1; |
150 | static unsigned int is_icru; | 150 | static unsigned int is_icru; |
151 | static DEFINE_SPINLOCK(rom_lock); | 151 | static DEFINE_SPINLOCK(rom_lock); |
152 | static void *cru_rom_addr; | 152 | static void *cru_rom_addr; |
@@ -756,6 +756,8 @@ error: | |||
756 | static void hpwdt_exit_nmi_decoding(void) | 756 | static void hpwdt_exit_nmi_decoding(void) |
757 | { | 757 | { |
758 | unregister_nmi_handler(NMI_UNKNOWN, "hpwdt"); | 758 | unregister_nmi_handler(NMI_UNKNOWN, "hpwdt"); |
759 | unregister_nmi_handler(NMI_SERR, "hpwdt"); | ||
760 | unregister_nmi_handler(NMI_IO_CHECK, "hpwdt"); | ||
759 | if (cru_rom_addr) | 761 | if (cru_rom_addr) |
760 | iounmap(cru_rom_addr); | 762 | iounmap(cru_rom_addr); |
761 | } | 763 | } |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index bc47e9012f37..9c2c27c3b424 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -699,3 +699,4 @@ MODULE_DESCRIPTION("Intel TCO WatchDog Timer Driver"); | |||
699 | MODULE_VERSION(DRV_VERSION); | 699 | MODULE_VERSION(DRV_VERSION); |
700 | MODULE_LICENSE("GPL"); | 700 | MODULE_LICENSE("GPL"); |
701 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 701 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
702 | MODULE_ALIAS("platform:" DRV_NAME); | ||
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 672d169bf1da..ef8edecfc526 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c | |||
@@ -349,7 +349,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
349 | sizeof(struct watchdog_info)) ? -EFAULT : 0; | 349 | sizeof(struct watchdog_info)) ? -EFAULT : 0; |
350 | case WDIOC_GETSTATUS: | 350 | case WDIOC_GETSTATUS: |
351 | err = watchdog_get_status(wdd, &val); | 351 | err = watchdog_get_status(wdd, &val); |
352 | if (err) | 352 | if (err == -ENODEV) |
353 | return err; | 353 | return err; |
354 | return put_user(val, p); | 354 | return put_user(val, p); |
355 | case WDIOC_GETBOOTSTATUS: | 355 | case WDIOC_GETBOOTSTATUS: |