diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-19 17:06:36 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-19 17:06:36 -0400 |
commit | 809b4e00baf006a990a73329ba381d536c6fa277 (patch) | |
tree | e949e0efd019d6f932537aba762792b07a84351c /drivers | |
parent | a0a55682b83fd5f012afadcf415b030d7424ae68 (diff) | |
parent | 79a94c3538bda6869d7bb150b5e02dd3a72314dd (diff) |
Merge branch 'devel-stable' into devel
Diffstat (limited to 'drivers')
162 files changed, 2197 insertions, 759 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b811f2173f6f..88681aca88c5 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -105,7 +105,7 @@ config ACPI_EC_DEBUGFS | |||
105 | 105 | ||
106 | Be aware that using this interface can confuse your Embedded | 106 | Be aware that using this interface can confuse your Embedded |
107 | Controller in a way that a normal reboot is not enough. You then | 107 | Controller in a way that a normal reboot is not enough. You then |
108 | have to power of your system, and remove the laptop battery for | 108 | have to power off your system, and remove the laptop battery for |
109 | some seconds. | 109 | some seconds. |
110 | An Embedded Controller typically is available on laptops and reads | 110 | An Embedded Controller typically is available on laptops and reads |
111 | sensor values like battery state and temperature. | 111 | sensor values like battery state and temperature. |
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index b76848c80be3..6b115f6c4313 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -382,31 +382,32 @@ static void acpi_pad_remove_sysfs(struct acpi_device *device) | |||
382 | device_remove_file(&device->dev, &dev_attr_rrtime); | 382 | device_remove_file(&device->dev, &dev_attr_rrtime); |
383 | } | 383 | } |
384 | 384 | ||
385 | /* Query firmware how many CPUs should be idle */ | 385 | /* |
386 | static int acpi_pad_pur(acpi_handle handle, int *num_cpus) | 386 | * Query firmware how many CPUs should be idle |
387 | * return -1 on failure | ||
388 | */ | ||
389 | static int acpi_pad_pur(acpi_handle handle) | ||
387 | { | 390 | { |
388 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 391 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
389 | union acpi_object *package; | 392 | union acpi_object *package; |
390 | int rev, num, ret = -EINVAL; | 393 | int num = -1; |
391 | 394 | ||
392 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) | 395 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) |
393 | return -EINVAL; | 396 | return num; |
394 | 397 | ||
395 | if (!buffer.length || !buffer.pointer) | 398 | if (!buffer.length || !buffer.pointer) |
396 | return -EINVAL; | 399 | return num; |
397 | 400 | ||
398 | package = buffer.pointer; | 401 | package = buffer.pointer; |
399 | if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) | 402 | |
400 | goto out; | 403 | if (package->type == ACPI_TYPE_PACKAGE && |
401 | rev = package->package.elements[0].integer.value; | 404 | package->package.count == 2 && |
402 | num = package->package.elements[1].integer.value; | 405 | package->package.elements[0].integer.value == 1) /* rev 1 */ |
403 | if (rev != 1 || num < 0) | 406 | |
404 | goto out; | 407 | num = package->package.elements[1].integer.value; |
405 | *num_cpus = num; | 408 | |
406 | ret = 0; | ||
407 | out: | ||
408 | kfree(buffer.pointer); | 409 | kfree(buffer.pointer); |
409 | return ret; | 410 | return num; |
410 | } | 411 | } |
411 | 412 | ||
412 | /* Notify firmware how many CPUs are idle */ | 413 | /* Notify firmware how many CPUs are idle */ |
@@ -433,7 +434,8 @@ static void acpi_pad_handle_notify(acpi_handle handle) | |||
433 | uint32_t idle_cpus; | 434 | uint32_t idle_cpus; |
434 | 435 | ||
435 | mutex_lock(&isolated_cpus_lock); | 436 | mutex_lock(&isolated_cpus_lock); |
436 | if (acpi_pad_pur(handle, &num_cpus)) { | 437 | num_cpus = acpi_pad_pur(handle); |
438 | if (num_cpus < 0) { | ||
437 | mutex_unlock(&isolated_cpus_lock); | 439 | mutex_unlock(&isolated_cpus_lock); |
438 | return; | 440 | return; |
439 | } | 441 | } |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index df85b53a674f..7dad9160f209 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -854,6 +854,7 @@ struct acpi_bit_register_info { | |||
854 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | 854 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ |
855 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | 855 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ |
856 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | 856 | ACPI_BITMASK_RT_CLOCK_STATUS | \ |
857 | ACPI_BITMASK_PCIEXP_WAKE_DISABLE | \ | ||
857 | ACPI_BITMASK_WAKE_STATUS) | 858 | ACPI_BITMASK_WAKE_STATUS) |
858 | 859 | ||
859 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | 860 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 |
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 74c24d517f81..4093522eed45 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -109,7 +109,7 @@ void acpi_ex_enter_interpreter(void) | |||
109 | * | 109 | * |
110 | * DESCRIPTION: Reacquire the interpreter execution region from within the | 110 | * DESCRIPTION: Reacquire the interpreter execution region from within the |
111 | * interpreter code. Failure to enter the interpreter region is a | 111 | * interpreter code. Failure to enter the interpreter region is a |
112 | * fatal system error. Used in conjuction with | 112 | * fatal system error. Used in conjunction with |
113 | * relinquish_interpreter | 113 | * relinquish_interpreter |
114 | * | 114 | * |
115 | ******************************************************************************/ | 115 | ******************************************************************************/ |
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index 22cfcfbd9fff..491191e6cf69 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c | |||
@@ -149,7 +149,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) | |||
149 | 149 | ||
150 | /* | 150 | /* |
151 | * 16-, 32-, and 64-bit cases must use the move macros that perform | 151 | * 16-, 32-, and 64-bit cases must use the move macros that perform |
152 | * endian conversion and/or accomodate hardware that cannot perform | 152 | * endian conversion and/or accommodate hardware that cannot perform |
153 | * misaligned memory transfers | 153 | * misaligned memory transfers |
154 | */ | 154 | */ |
155 | case ACPI_RSC_MOVE16: | 155 | case ACPI_RSC_MOVE16: |
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 907e350f1c7d..fca34ccfd294 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig | |||
@@ -34,6 +34,6 @@ config ACPI_APEI_ERST_DEBUG | |||
34 | depends on ACPI_APEI | 34 | depends on ACPI_APEI |
35 | help | 35 | help |
36 | ERST is a way provided by APEI to save and retrieve hardware | 36 | ERST is a way provided by APEI to save and retrieve hardware |
37 | error infomation to and from a persistent store. Enable this | 37 | error information to and from a persistent store. Enable this |
38 | if you want to debugging and testing the ERST kernel support | 38 | if you want to debugging and testing the ERST kernel support |
39 | and firmware implementation. | 39 | and firmware implementation. |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 73fd0c7487c1..4a904a4bf05f 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
@@ -445,11 +445,15 @@ EXPORT_SYMBOL_GPL(apei_resources_sub); | |||
445 | int apei_resources_request(struct apei_resources *resources, | 445 | int apei_resources_request(struct apei_resources *resources, |
446 | const char *desc) | 446 | const char *desc) |
447 | { | 447 | { |
448 | struct apei_res *res, *res_bak; | 448 | struct apei_res *res, *res_bak = NULL; |
449 | struct resource *r; | 449 | struct resource *r; |
450 | int rc; | ||
450 | 451 | ||
451 | apei_resources_sub(resources, &apei_resources_all); | 452 | rc = apei_resources_sub(resources, &apei_resources_all); |
453 | if (rc) | ||
454 | return rc; | ||
452 | 455 | ||
456 | rc = -EINVAL; | ||
453 | list_for_each_entry(res, &resources->iomem, list) { | 457 | list_for_each_entry(res, &resources->iomem, list) { |
454 | r = request_mem_region(res->start, res->end - res->start, | 458 | r = request_mem_region(res->start, res->end - res->start, |
455 | desc); | 459 | desc); |
@@ -475,7 +479,11 @@ int apei_resources_request(struct apei_resources *resources, | |||
475 | } | 479 | } |
476 | } | 480 | } |
477 | 481 | ||
478 | apei_resources_merge(&apei_resources_all, resources); | 482 | rc = apei_resources_merge(&apei_resources_all, resources); |
483 | if (rc) { | ||
484 | pr_err(APEI_PFX "Fail to merge resources!\n"); | ||
485 | goto err_unmap_ioport; | ||
486 | } | ||
479 | 487 | ||
480 | return 0; | 488 | return 0; |
481 | err_unmap_ioport: | 489 | err_unmap_ioport: |
@@ -491,12 +499,13 @@ err_unmap_iomem: | |||
491 | break; | 499 | break; |
492 | release_mem_region(res->start, res->end - res->start); | 500 | release_mem_region(res->start, res->end - res->start); |
493 | } | 501 | } |
494 | return -EINVAL; | 502 | return rc; |
495 | } | 503 | } |
496 | EXPORT_SYMBOL_GPL(apei_resources_request); | 504 | EXPORT_SYMBOL_GPL(apei_resources_request); |
497 | 505 | ||
498 | void apei_resources_release(struct apei_resources *resources) | 506 | void apei_resources_release(struct apei_resources *resources) |
499 | { | 507 | { |
508 | int rc; | ||
500 | struct apei_res *res; | 509 | struct apei_res *res; |
501 | 510 | ||
502 | list_for_each_entry(res, &resources->iomem, list) | 511 | list_for_each_entry(res, &resources->iomem, list) |
@@ -504,7 +513,9 @@ void apei_resources_release(struct apei_resources *resources) | |||
504 | list_for_each_entry(res, &resources->ioport, list) | 513 | list_for_each_entry(res, &resources->ioport, list) |
505 | release_region(res->start, res->end - res->start); | 514 | release_region(res->start, res->end - res->start); |
506 | 515 | ||
507 | apei_resources_sub(&apei_resources_all, resources); | 516 | rc = apei_resources_sub(&apei_resources_all, resources); |
517 | if (rc) | ||
518 | pr_err(APEI_PFX "Fail to sub resources!\n"); | ||
508 | } | 519 | } |
509 | EXPORT_SYMBOL_GPL(apei_resources_release); | 520 | EXPORT_SYMBOL_GPL(apei_resources_release); |
510 | 521 | ||
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 465c885938ee..cf29df69380b 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c | |||
@@ -426,7 +426,9 @@ DEFINE_SIMPLE_ATTRIBUTE(error_inject_fops, NULL, | |||
426 | 426 | ||
427 | static int einj_check_table(struct acpi_table_einj *einj_tab) | 427 | static int einj_check_table(struct acpi_table_einj *einj_tab) |
428 | { | 428 | { |
429 | if (einj_tab->header_length != sizeof(struct acpi_table_einj)) | 429 | if ((einj_tab->header_length != |
430 | (sizeof(struct acpi_table_einj) - sizeof(einj_tab->header))) | ||
431 | && (einj_tab->header_length != sizeof(struct acpi_table_einj))) | ||
430 | return -EINVAL; | 432 | return -EINVAL; |
431 | if (einj_tab->header.length < sizeof(struct acpi_table_einj)) | 433 | if (einj_tab->header.length < sizeof(struct acpi_table_einj)) |
432 | return -EINVAL; | 434 | return -EINVAL; |
diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c index 5281ddda2777..da1228a9a544 100644 --- a/drivers/acpi/apei/erst-dbg.c +++ b/drivers/acpi/apei/erst-dbg.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * APEI Error Record Serialization Table debug support | 2 | * APEI Error Record Serialization Table debug support |
3 | * | 3 | * |
4 | * ERST is a way provided by APEI to save and retrieve hardware error | 4 | * ERST is a way provided by APEI to save and retrieve hardware error |
5 | * infomation to and from a persistent store. This file provide the | 5 | * information to and from a persistent store. This file provide the |
6 | * debugging/testing support for ERST kernel support and firmware | 6 | * debugging/testing support for ERST kernel support and firmware |
7 | * implementation. | 7 | * implementation. |
8 | * | 8 | * |
@@ -111,11 +111,13 @@ retry: | |||
111 | goto out; | 111 | goto out; |
112 | } | 112 | } |
113 | if (len > erst_dbg_buf_len) { | 113 | if (len > erst_dbg_buf_len) { |
114 | kfree(erst_dbg_buf); | 114 | void *p; |
115 | rc = -ENOMEM; | 115 | rc = -ENOMEM; |
116 | erst_dbg_buf = kmalloc(len, GFP_KERNEL); | 116 | p = kmalloc(len, GFP_KERNEL); |
117 | if (!erst_dbg_buf) | 117 | if (!p) |
118 | goto out; | 118 | goto out; |
119 | kfree(erst_dbg_buf); | ||
120 | erst_dbg_buf = p; | ||
119 | erst_dbg_buf_len = len; | 121 | erst_dbg_buf_len = len; |
120 | goto retry; | 122 | goto retry; |
121 | } | 123 | } |
@@ -150,11 +152,13 @@ static ssize_t erst_dbg_write(struct file *filp, const char __user *ubuf, | |||
150 | if (mutex_lock_interruptible(&erst_dbg_mutex)) | 152 | if (mutex_lock_interruptible(&erst_dbg_mutex)) |
151 | return -EINTR; | 153 | return -EINTR; |
152 | if (usize > erst_dbg_buf_len) { | 154 | if (usize > erst_dbg_buf_len) { |
153 | kfree(erst_dbg_buf); | 155 | void *p; |
154 | rc = -ENOMEM; | 156 | rc = -ENOMEM; |
155 | erst_dbg_buf = kmalloc(usize, GFP_KERNEL); | 157 | p = kmalloc(usize, GFP_KERNEL); |
156 | if (!erst_dbg_buf) | 158 | if (!p) |
157 | goto out; | 159 | goto out; |
160 | kfree(erst_dbg_buf); | ||
161 | erst_dbg_buf = p; | ||
158 | erst_dbg_buf_len = usize; | 162 | erst_dbg_buf_len = usize; |
159 | } | 163 | } |
160 | rc = copy_from_user(erst_dbg_buf, ubuf, usize); | 164 | rc = copy_from_user(erst_dbg_buf, ubuf, usize); |
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 18645f4e83cd..1211c03149e8 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * APEI Error Record Serialization Table support | 2 | * APEI Error Record Serialization Table support |
3 | * | 3 | * |
4 | * ERST is a way provided by APEI to save and retrieve hardware error | 4 | * ERST is a way provided by APEI to save and retrieve hardware error |
5 | * infomation to and from a persistent store. | 5 | * information to and from a persistent store. |
6 | * | 6 | * |
7 | * For more information about ERST, please refer to ACPI Specification | 7 | * For more information about ERST, please refer to ACPI Specification |
8 | * version 4.0, section 17.4. | 8 | * version 4.0, section 17.4. |
@@ -266,13 +266,30 @@ static int erst_exec_move_data(struct apei_exec_context *ctx, | |||
266 | { | 266 | { |
267 | int rc; | 267 | int rc; |
268 | u64 offset; | 268 | u64 offset; |
269 | void *src, *dst; | ||
270 | |||
271 | /* ioremap does not work in interrupt context */ | ||
272 | if (in_interrupt()) { | ||
273 | pr_warning(ERST_PFX | ||
274 | "MOVE_DATA can not be used in interrupt context"); | ||
275 | return -EBUSY; | ||
276 | } | ||
269 | 277 | ||
270 | rc = __apei_exec_read_register(entry, &offset); | 278 | rc = __apei_exec_read_register(entry, &offset); |
271 | if (rc) | 279 | if (rc) |
272 | return rc; | 280 | return rc; |
273 | memmove((void *)ctx->dst_base + offset, | 281 | |
274 | (void *)ctx->src_base + offset, | 282 | src = ioremap(ctx->src_base + offset, ctx->var2); |
275 | ctx->var2); | 283 | if (!src) |
284 | return -ENOMEM; | ||
285 | dst = ioremap(ctx->dst_base + offset, ctx->var2); | ||
286 | if (!dst) | ||
287 | return -ENOMEM; | ||
288 | |||
289 | memmove(dst, src, ctx->var2); | ||
290 | |||
291 | iounmap(src); | ||
292 | iounmap(dst); | ||
276 | 293 | ||
277 | return 0; | 294 | return 0; |
278 | } | 295 | } |
@@ -750,7 +767,9 @@ __setup("erst_disable", setup_erst_disable); | |||
750 | 767 | ||
751 | static int erst_check_table(struct acpi_table_erst *erst_tab) | 768 | static int erst_check_table(struct acpi_table_erst *erst_tab) |
752 | { | 769 | { |
753 | if (erst_tab->header_length != sizeof(struct acpi_table_erst)) | 770 | if ((erst_tab->header_length != |
771 | (sizeof(struct acpi_table_erst) - sizeof(erst_tab->header))) | ||
772 | && (erst_tab->header_length != sizeof(struct acpi_table_einj))) | ||
754 | return -EINVAL; | 773 | return -EINVAL; |
755 | if (erst_tab->header.length < sizeof(struct acpi_table_erst)) | 774 | if (erst_tab->header.length < sizeof(struct acpi_table_erst)) |
756 | return -EINVAL; | 775 | return -EINVAL; |
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 385a6059714a..0d505e59214d 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
@@ -302,7 +302,7 @@ static int __devinit ghes_probe(struct platform_device *ghes_dev) | |||
302 | struct ghes *ghes = NULL; | 302 | struct ghes *ghes = NULL; |
303 | int rc = -EINVAL; | 303 | int rc = -EINVAL; |
304 | 304 | ||
305 | generic = ghes_dev->dev.platform_data; | 305 | generic = *(struct acpi_hest_generic **)ghes_dev->dev.platform_data; |
306 | if (!generic->enabled) | 306 | if (!generic->enabled) |
307 | return -ENODEV; | 307 | return -ENODEV; |
308 | 308 | ||
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c index 343168d18266..1a3508a7fe03 100644 --- a/drivers/acpi/apei/hest.c +++ b/drivers/acpi/apei/hest.c | |||
@@ -137,20 +137,23 @@ static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) | |||
137 | 137 | ||
138 | static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) | 138 | static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) |
139 | { | 139 | { |
140 | struct acpi_hest_generic *generic; | ||
141 | struct platform_device *ghes_dev; | 140 | struct platform_device *ghes_dev; |
142 | struct ghes_arr *ghes_arr = data; | 141 | struct ghes_arr *ghes_arr = data; |
143 | int rc; | 142 | int rc; |
144 | 143 | ||
145 | if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) | 144 | if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) |
146 | return 0; | 145 | return 0; |
147 | generic = (struct acpi_hest_generic *)hest_hdr; | 146 | |
148 | if (!generic->enabled) | 147 | if (!((struct acpi_hest_generic *)hest_hdr)->enabled) |
149 | return 0; | 148 | return 0; |
150 | ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id); | 149 | ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id); |
151 | if (!ghes_dev) | 150 | if (!ghes_dev) |
152 | return -ENOMEM; | 151 | return -ENOMEM; |
153 | ghes_dev->dev.platform_data = generic; | 152 | |
153 | rc = platform_device_add_data(ghes_dev, &hest_hdr, sizeof(void *)); | ||
154 | if (rc) | ||
155 | goto err; | ||
156 | |||
154 | rc = platform_device_add(ghes_dev); | 157 | rc = platform_device_add(ghes_dev); |
155 | if (rc) | 158 | if (rc) |
156 | goto err; | 159 | goto err; |
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c index 8f8bd736d4ff..542e53903891 100644 --- a/drivers/acpi/atomicio.c +++ b/drivers/acpi/atomicio.c | |||
@@ -142,7 +142,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr, | |||
142 | list_add_tail_rcu(&map->list, &acpi_iomaps); | 142 | list_add_tail_rcu(&map->list, &acpi_iomaps); |
143 | spin_unlock_irqrestore(&acpi_iomaps_lock, flags); | 143 | spin_unlock_irqrestore(&acpi_iomaps_lock, flags); |
144 | 144 | ||
145 | return vaddr + (paddr - pg_off); | 145 | return map->vaddr + (paddr - map->paddr); |
146 | err_unmap: | 146 | err_unmap: |
147 | iounmap(vaddr); | 147 | iounmap(vaddr); |
148 | return NULL; | 148 | return NULL; |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index dc58402b0a17..98417201e9ce 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -273,7 +273,6 @@ static enum power_supply_property energy_battery_props[] = { | |||
273 | POWER_SUPPLY_PROP_CYCLE_COUNT, | 273 | POWER_SUPPLY_PROP_CYCLE_COUNT, |
274 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 274 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
275 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 275 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
276 | POWER_SUPPLY_PROP_CURRENT_NOW, | ||
277 | POWER_SUPPLY_PROP_POWER_NOW, | 276 | POWER_SUPPLY_PROP_POWER_NOW, |
278 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, | 277 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, |
279 | POWER_SUPPLY_PROP_ENERGY_FULL, | 278 | POWER_SUPPLY_PROP_ENERGY_FULL, |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 2bb28b9d91c4..af308d03f492 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -183,6 +183,8 @@ static int __init dmi_disable_osi_vista(const struct dmi_system_id *d) | |||
183 | { | 183 | { |
184 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); | 184 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); |
185 | acpi_osi_setup("!Windows 2006"); | 185 | acpi_osi_setup("!Windows 2006"); |
186 | acpi_osi_setup("!Windows 2006 SP1"); | ||
187 | acpi_osi_setup("!Windows 2006 SP2"); | ||
186 | return 0; | 188 | return 0; |
187 | } | 189 | } |
188 | static int __init dmi_disable_osi_win7(const struct dmi_system_id *d) | 190 | static int __init dmi_disable_osi_win7(const struct dmi_system_id *d) |
@@ -202,6 +204,23 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
202 | }, | 204 | }, |
203 | }, | 205 | }, |
204 | { | 206 | { |
207 | /* | ||
208 | * There have a NVIF method in MSI GX723 DSDT need call by Nvidia | ||
209 | * driver (e.g. nouveau) when user press brightness hotkey. | ||
210 | * Currently, nouveau driver didn't do the job and it causes there | ||
211 | * have a infinite while loop in DSDT when user press hotkey. | ||
212 | * We add MSI GX723's dmi information to this table for workaround | ||
213 | * this issue. | ||
214 | * Will remove MSI GX723 from the table after nouveau grows support. | ||
215 | */ | ||
216 | .callback = dmi_disable_osi_vista, | ||
217 | .ident = "MSI GX723", | ||
218 | .matches = { | ||
219 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), | ||
220 | DMI_MATCH(DMI_PRODUCT_NAME, "GX723"), | ||
221 | }, | ||
222 | }, | ||
223 | { | ||
205 | .callback = dmi_disable_osi_vista, | 224 | .callback = dmi_disable_osi_vista, |
206 | .ident = "Sony VGN-NS10J_S", | 225 | .ident = "Sony VGN-NS10J_S", |
207 | .matches = { | 226 | .matches = { |
@@ -226,6 +245,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
226 | }, | 245 | }, |
227 | }, | 246 | }, |
228 | { | 247 | { |
248 | .callback = dmi_disable_osi_vista, | ||
249 | .ident = "Toshiba Satellite L355", | ||
250 | .matches = { | ||
251 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
252 | DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"), | ||
253 | }, | ||
254 | }, | ||
255 | { | ||
229 | .callback = dmi_disable_osi_win7, | 256 | .callback = dmi_disable_osi_win7, |
230 | .ident = "ASUS K50IJ", | 257 | .ident = "ASUS K50IJ", |
231 | .matches = { | 258 | .matches = { |
@@ -233,6 +260,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
233 | DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"), | 260 | DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"), |
234 | }, | 261 | }, |
235 | }, | 262 | }, |
263 | { | ||
264 | .callback = dmi_disable_osi_vista, | ||
265 | .ident = "Toshiba P305D", | ||
266 | .matches = { | ||
267 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
268 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"), | ||
269 | }, | ||
270 | }, | ||
236 | 271 | ||
237 | /* | 272 | /* |
238 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. | 273 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5c221ab535d5..310e3b9749cb 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -55,7 +55,7 @@ EXPORT_SYMBOL(acpi_root_dir); | |||
55 | static int set_power_nocheck(const struct dmi_system_id *id) | 55 | static int set_power_nocheck(const struct dmi_system_id *id) |
56 | { | 56 | { |
57 | printk(KERN_NOTICE PREFIX "%s detected - " | 57 | printk(KERN_NOTICE PREFIX "%s detected - " |
58 | "disable power check in power transistion\n", id->ident); | 58 | "disable power check in power transition\n", id->ident); |
59 | acpi_power_nocheck = 1; | 59 | acpi_power_nocheck = 1; |
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
@@ -80,23 +80,15 @@ static int set_copy_dsdt(const struct dmi_system_id *id) | |||
80 | 80 | ||
81 | static struct dmi_system_id dsdt_dmi_table[] __initdata = { | 81 | static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
82 | /* | 82 | /* |
83 | * Insyde BIOS on some TOSHIBA machines corrupt the DSDT. | 83 | * Invoke DSDT corruption work-around on all Toshiba Satellite. |
84 | * https://bugzilla.kernel.org/show_bug.cgi?id=14679 | 84 | * https://bugzilla.kernel.org/show_bug.cgi?id=14679 |
85 | */ | 85 | */ |
86 | { | 86 | { |
87 | .callback = set_copy_dsdt, | 87 | .callback = set_copy_dsdt, |
88 | .ident = "TOSHIBA Satellite A505", | 88 | .ident = "TOSHIBA Satellite", |
89 | .matches = { | 89 | .matches = { |
90 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 90 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
91 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite A505"), | 91 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), |
92 | }, | ||
93 | }, | ||
94 | { | ||
95 | .callback = set_copy_dsdt, | ||
96 | .ident = "TOSHIBA Satellite L505D", | ||
97 | .matches = { | ||
98 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
99 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite L505D"), | ||
100 | }, | 92 | }, |
101 | }, | 93 | }, |
102 | {} | 94 | {} |
@@ -1027,7 +1019,7 @@ static int __init acpi_init(void) | |||
1027 | 1019 | ||
1028 | /* | 1020 | /* |
1029 | * If the laptop falls into the DMI check table, the power state check | 1021 | * If the laptop falls into the DMI check table, the power state check |
1030 | * will be disabled in the course of device power transistion. | 1022 | * will be disabled in the course of device power transition. |
1031 | */ | 1023 | */ |
1032 | dmi_check_system(power_nocheck_dmi_table); | 1024 | dmi_check_system(power_nocheck_dmi_table); |
1033 | 1025 | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 8a3b840c0bb2..d94d2953c974 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -369,7 +369,9 @@ static void __exit acpi_fan_exit(void) | |||
369 | 369 | ||
370 | acpi_bus_unregister_driver(&acpi_fan_driver); | 370 | acpi_bus_unregister_driver(&acpi_fan_driver); |
371 | 371 | ||
372 | #ifdef CONFIG_ACPI_PROCFS | ||
372 | remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); | 373 | remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); |
374 | #endif | ||
373 | 375 | ||
374 | return; | 376 | return; |
375 | } | 377 | } |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index e9699aaed109..bec561c14beb 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -29,12 +29,6 @@ static int set_no_mwait(const struct dmi_system_id *id) | |||
29 | 29 | ||
30 | static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { | 30 | static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { |
31 | { | 31 | { |
32 | set_no_mwait, "IFL91 board", { | ||
33 | DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), | ||
34 | DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"), | ||
35 | DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"), | ||
36 | DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL}, | ||
37 | { | ||
38 | set_no_mwait, "Extensa 5220", { | 32 | set_no_mwait, "Extensa 5220", { |
39 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), | 33 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), |
40 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 34 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
@@ -352,4 +346,5 @@ void __init acpi_early_processor_set_pdc(void) | |||
352 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, | 346 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
353 | ACPI_UINT32_MAX, | 347 | ACPI_UINT32_MAX, |
354 | early_init_pdc, NULL, NULL, NULL); | 348 | early_init_pdc, NULL, NULL, NULL); |
349 | acpi_get_devices("ACPI0007", early_init_pdc, NULL, NULL); | ||
355 | } | 350 | } |
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 156021892389..347eb21b2353 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -850,7 +850,7 @@ static int __init acpi_processor_init(void) | |||
850 | printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", | 850 | printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", |
851 | acpi_idle_driver.name); | 851 | acpi_idle_driver.name); |
852 | } else { | 852 | } else { |
853 | printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s", | 853 | printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s\n", |
854 | cpuidle_get_driver()->name); | 854 | cpuidle_get_driver()->name); |
855 | } | 855 | } |
856 | 856 | ||
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index ba1bd263d903..3a73a93596e8 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -447,8 +447,8 @@ int acpi_processor_notify_smm(struct module *calling_module) | |||
447 | if (!try_module_get(calling_module)) | 447 | if (!try_module_get(calling_module)) |
448 | return -EINVAL; | 448 | return -EINVAL; |
449 | 449 | ||
450 | /* is_done is set to negative if an error occured, | 450 | /* is_done is set to negative if an error occurred, |
451 | * and to postitive if _no_ error occured, but SMM | 451 | * and to postitive if _no_ error occurred, but SMM |
452 | * was already notified. This avoids double notification | 452 | * was already notified. This avoids double notification |
453 | * which might lead to unexpected results... | 453 | * which might lead to unexpected results... |
454 | */ | 454 | */ |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index cf82989ae756..4754ff6e70e6 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -363,6 +363,12 @@ static int __init init_old_suspend_ordering(const struct dmi_system_id *d) | |||
363 | return 0; | 363 | return 0; |
364 | } | 364 | } |
365 | 365 | ||
366 | static int __init init_nvs_nosave(const struct dmi_system_id *d) | ||
367 | { | ||
368 | acpi_nvs_nosave(); | ||
369 | return 0; | ||
370 | } | ||
371 | |||
366 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | 372 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { |
367 | { | 373 | { |
368 | .callback = init_old_suspend_ordering, | 374 | .callback = init_old_suspend_ordering, |
@@ -397,6 +403,22 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |||
397 | DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), | 403 | DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), |
398 | }, | 404 | }, |
399 | }, | 405 | }, |
406 | { | ||
407 | .callback = init_nvs_nosave, | ||
408 | .ident = "Sony Vaio VGN-SR11M", | ||
409 | .matches = { | ||
410 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
411 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"), | ||
412 | }, | ||
413 | }, | ||
414 | { | ||
415 | .callback = init_nvs_nosave, | ||
416 | .ident = "Everex StepNote Series", | ||
417 | .matches = { | ||
418 | DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."), | ||
419 | DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"), | ||
420 | }, | ||
421 | }, | ||
400 | {}, | 422 | {}, |
401 | }; | 423 | }; |
402 | #endif /* CONFIG_SUSPEND */ | 424 | #endif /* CONFIG_SUSPEND */ |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 68e2e4582fa2..f8588f81048a 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -100,7 +100,7 @@ static const struct acpi_dlevel acpi_debug_levels[] = { | |||
100 | ACPI_DEBUG_INIT(ACPI_LV_EVENTS), | 100 | ACPI_DEBUG_INIT(ACPI_LV_EVENTS), |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static int param_get_debug_layer(char *buffer, struct kernel_param *kp) | 103 | static int param_get_debug_layer(char *buffer, const struct kernel_param *kp) |
104 | { | 104 | { |
105 | int result = 0; | 105 | int result = 0; |
106 | int i; | 106 | int i; |
@@ -128,7 +128,7 @@ static int param_get_debug_layer(char *buffer, struct kernel_param *kp) | |||
128 | return result; | 128 | return result; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int param_get_debug_level(char *buffer, struct kernel_param *kp) | 131 | static int param_get_debug_level(char *buffer, const struct kernel_param *kp) |
132 | { | 132 | { |
133 | int result = 0; | 133 | int result = 0; |
134 | int i; | 134 | int i; |
@@ -149,10 +149,18 @@ static int param_get_debug_level(char *buffer, struct kernel_param *kp) | |||
149 | return result; | 149 | return result; |
150 | } | 150 | } |
151 | 151 | ||
152 | module_param_call(debug_layer, param_set_uint, param_get_debug_layer, | 152 | static struct kernel_param_ops param_ops_debug_layer = { |
153 | &acpi_dbg_layer, 0644); | 153 | .set = param_set_uint, |
154 | module_param_call(debug_level, param_set_uint, param_get_debug_level, | 154 | .get = param_get_debug_layer, |
155 | &acpi_dbg_level, 0644); | 155 | }; |
156 | |||
157 | static struct kernel_param_ops param_ops_debug_level = { | ||
158 | .set = param_set_uint, | ||
159 | .get = param_get_debug_level, | ||
160 | }; | ||
161 | |||
162 | module_param_cb(debug_layer, ¶m_ops_debug_layer, &acpi_dbg_layer, 0644); | ||
163 | module_param_cb(debug_level, ¶m_ops_debug_level, &acpi_dbg_level, 0644); | ||
156 | 164 | ||
157 | static char trace_method_name[6]; | 165 | static char trace_method_name[6]; |
158 | module_param_string(trace_method_name, trace_method_name, 6, 0644); | 166 | module_param_string(trace_method_name, trace_method_name, 6, 0644); |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index c5fef01b3c95..b83676126598 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -59,8 +59,8 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | |||
59 | "support\n")); | 59 | "support\n")); |
60 | *cap |= ACPI_VIDEO_BACKLIGHT; | 60 | *cap |= ACPI_VIDEO_BACKLIGHT; |
61 | if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy))) | 61 | if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy))) |
62 | printk(KERN_WARNING FW_BUG PREFIX "ACPI brightness " | 62 | printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, " |
63 | "control misses _BQC function\n"); | 63 | "cannot determine initial brightness\n"); |
64 | /* We have backlight support, no need to scan further */ | 64 | /* We have backlight support, no need to scan further */ |
65 | return AE_CTRL_TERMINATE; | 65 | return AE_CTRL_TERMINATE; |
66 | } | 66 | } |
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index ee9ddeb53417..8cb0347dec28 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c | |||
@@ -3156,7 +3156,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev, | |||
3156 | { | 3156 | { |
3157 | struct atm_dev *dev; | 3157 | struct atm_dev *dev; |
3158 | IADEV *iadev; | 3158 | IADEV *iadev; |
3159 | unsigned long flags; | ||
3160 | int ret; | 3159 | int ret; |
3161 | 3160 | ||
3162 | iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); | 3161 | iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); |
@@ -3188,19 +3187,14 @@ static int __devinit ia_init_one(struct pci_dev *pdev, | |||
3188 | ia_dev[iadev_count] = iadev; | 3187 | ia_dev[iadev_count] = iadev; |
3189 | _ia_dev[iadev_count] = dev; | 3188 | _ia_dev[iadev_count] = dev; |
3190 | iadev_count++; | 3189 | iadev_count++; |
3191 | spin_lock_init(&iadev->misc_lock); | ||
3192 | /* First fixes first. I don't want to think about this now. */ | ||
3193 | spin_lock_irqsave(&iadev->misc_lock, flags); | ||
3194 | if (ia_init(dev) || ia_start(dev)) { | 3190 | if (ia_init(dev) || ia_start(dev)) { |
3195 | IF_INIT(printk("IA register failed!\n");) | 3191 | IF_INIT(printk("IA register failed!\n");) |
3196 | iadev_count--; | 3192 | iadev_count--; |
3197 | ia_dev[iadev_count] = NULL; | 3193 | ia_dev[iadev_count] = NULL; |
3198 | _ia_dev[iadev_count] = NULL; | 3194 | _ia_dev[iadev_count] = NULL; |
3199 | spin_unlock_irqrestore(&iadev->misc_lock, flags); | ||
3200 | ret = -EINVAL; | 3195 | ret = -EINVAL; |
3201 | goto err_out_deregister_dev; | 3196 | goto err_out_deregister_dev; |
3202 | } | 3197 | } |
3203 | spin_unlock_irqrestore(&iadev->misc_lock, flags); | ||
3204 | IF_EVENT(printk("iadev_count = %d\n", iadev_count);) | 3198 | IF_EVENT(printk("iadev_count = %d\n", iadev_count);) |
3205 | 3199 | ||
3206 | iadev->next_board = ia_boards; | 3200 | iadev->next_board = ia_boards; |
diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h index b2cd20f549cb..077735e0e04b 100644 --- a/drivers/atm/iphase.h +++ b/drivers/atm/iphase.h | |||
@@ -1022,7 +1022,7 @@ typedef struct iadev_t { | |||
1022 | struct dle_q rx_dle_q; | 1022 | struct dle_q rx_dle_q; |
1023 | struct free_desc_q *rx_free_desc_qhead; | 1023 | struct free_desc_q *rx_free_desc_qhead; |
1024 | struct sk_buff_head rx_dma_q; | 1024 | struct sk_buff_head rx_dma_q; |
1025 | spinlock_t rx_lock, misc_lock; | 1025 | spinlock_t rx_lock; |
1026 | struct atm_vcc **rx_open; /* list of all open VCs */ | 1026 | struct atm_vcc **rx_open; /* list of all open VCs */ |
1027 | u16 num_rx_desc, rx_buf_sz, rxing; | 1027 | u16 num_rx_desc, rx_buf_sz, rxing; |
1028 | u32 rx_pkt_ram, rx_tmp_cnt; | 1028 | u32 rx_pkt_ram, rx_tmp_cnt; |
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index f916ddf63938..f46138ab38b6 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -444,6 +444,7 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr, | |||
444 | struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev); | 444 | struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev); |
445 | struct solos_card *card = atmdev->dev_data; | 445 | struct solos_card *card = atmdev->dev_data; |
446 | struct sk_buff *skb; | 446 | struct sk_buff *skb; |
447 | unsigned int len; | ||
447 | 448 | ||
448 | spin_lock(&card->cli_queue_lock); | 449 | spin_lock(&card->cli_queue_lock); |
449 | skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]); | 450 | skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]); |
@@ -451,11 +452,12 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr, | |||
451 | if(skb == NULL) | 452 | if(skb == NULL) |
452 | return sprintf(buf, "No data.\n"); | 453 | return sprintf(buf, "No data.\n"); |
453 | 454 | ||
454 | memcpy(buf, skb->data, skb->len); | 455 | len = skb->len; |
455 | dev_dbg(&card->dev->dev, "len: %d\n", skb->len); | 456 | memcpy(buf, skb->data, len); |
457 | dev_dbg(&card->dev->dev, "len: %d\n", len); | ||
456 | 458 | ||
457 | kfree_skb(skb); | 459 | kfree_skb(skb); |
458 | return skb->len; | 460 | return len; |
459 | } | 461 | } |
460 | 462 | ||
461 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size) | 463 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size) |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 2aafafca2b13..1101e251a629 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -202,6 +202,7 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) | |||
202 | struct virtio_blk *vblk = disk->private_data; | 202 | struct virtio_blk *vblk = disk->private_data; |
203 | struct request *req; | 203 | struct request *req; |
204 | struct bio *bio; | 204 | struct bio *bio; |
205 | int err; | ||
205 | 206 | ||
206 | bio = bio_map_kern(vblk->disk->queue, id_str, VIRTIO_BLK_ID_BYTES, | 207 | bio = bio_map_kern(vblk->disk->queue, id_str, VIRTIO_BLK_ID_BYTES, |
207 | GFP_KERNEL); | 208 | GFP_KERNEL); |
@@ -215,7 +216,10 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) | |||
215 | } | 216 | } |
216 | 217 | ||
217 | req->cmd_type = REQ_TYPE_SPECIAL; | 218 | req->cmd_type = REQ_TYPE_SPECIAL; |
218 | return blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); | 219 | err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); |
220 | blk_put_request(req); | ||
221 | |||
222 | return err; | ||
219 | } | 223 | } |
220 | 224 | ||
221 | static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode, | 225 | static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode, |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index c2408bbe9c2e..f508690eb958 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -80,7 +80,7 @@ | |||
80 | * Limiting Performance Impact | 80 | * Limiting Performance Impact |
81 | * --------------------------- | 81 | * --------------------------- |
82 | * C states, especially those with large exit latencies, can have a real | 82 | * C states, especially those with large exit latencies, can have a real |
83 | * noticable impact on workloads, which is not acceptable for most sysadmins, | 83 | * noticeable impact on workloads, which is not acceptable for most sysadmins, |
84 | * and in addition, less performance has a power price of its own. | 84 | * and in addition, less performance has a power price of its own. |
85 | * | 85 | * |
86 | * As a general rule of thumb, menu assumes that the following heuristic | 86 | * As a general rule of thumb, menu assumes that the following heuristic |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 216f9d383b5b..effd140fc042 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -879,7 +879,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca) | |||
879 | dma->device_issue_pending = ioat2_issue_pending; | 879 | dma->device_issue_pending = ioat2_issue_pending; |
880 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; | 880 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; |
881 | dma->device_free_chan_resources = ioat2_free_chan_resources; | 881 | dma->device_free_chan_resources = ioat2_free_chan_resources; |
882 | dma->device_tx_status = ioat_tx_status; | 882 | dma->device_tx_status = ioat_dma_tx_status; |
883 | 883 | ||
884 | err = ioat_probe(device); | 884 | err = ioat_probe(device); |
885 | if (err) | 885 | if (err) |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index fb64cf36ba61..eb6b54dbb806 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -580,7 +580,6 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg( | |||
580 | 580 | ||
581 | sh_chan = to_sh_chan(chan); | 581 | sh_chan = to_sh_chan(chan); |
582 | param = chan->private; | 582 | param = chan->private; |
583 | slave_addr = param->config->addr; | ||
584 | 583 | ||
585 | /* Someone calling slave DMA on a public channel? */ | 584 | /* Someone calling slave DMA on a public channel? */ |
586 | if (!param || !sg_len) { | 585 | if (!param || !sg_len) { |
@@ -589,6 +588,8 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg( | |||
589 | return NULL; | 588 | return NULL; |
590 | } | 589 | } |
591 | 590 | ||
591 | slave_addr = param->config->addr; | ||
592 | |||
592 | /* | 593 | /* |
593 | * if (param != NULL), this is a successfully requested slave channel, | 594 | * if (param != NULL), this is a successfully requested slave channel, |
594 | * therefore param->config != NULL too. | 595 | * therefore param->config != NULL too. |
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index e0187d16dd7c..0fd5b85a0f75 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
@@ -1140,6 +1140,7 @@ static struct mcidev_sysfs_attribute i7core_udimm_counters_attrs[] = { | |||
1140 | ATTR_COUNTER(0), | 1140 | ATTR_COUNTER(0), |
1141 | ATTR_COUNTER(1), | 1141 | ATTR_COUNTER(1), |
1142 | ATTR_COUNTER(2), | 1142 | ATTR_COUNTER(2), |
1143 | { .attr = { .name = NULL } } | ||
1143 | }; | 1144 | }; |
1144 | 1145 | ||
1145 | static struct mcidev_sysfs_group i7core_udimm_counters = { | 1146 | static struct mcidev_sysfs_group i7core_udimm_counters = { |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index bf92d07510df..5663d2719063 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -148,7 +148,7 @@ int drm_gem_object_init(struct drm_device *dev, | |||
148 | return -ENOMEM; | 148 | return -ENOMEM; |
149 | 149 | ||
150 | kref_init(&obj->refcount); | 150 | kref_init(&obj->refcount); |
151 | kref_init(&obj->handlecount); | 151 | atomic_set(&obj->handle_count, 0); |
152 | obj->size = size; | 152 | obj->size = size; |
153 | 153 | ||
154 | atomic_inc(&dev->object_count); | 154 | atomic_inc(&dev->object_count); |
@@ -462,28 +462,6 @@ drm_gem_object_free(struct kref *kref) | |||
462 | } | 462 | } |
463 | EXPORT_SYMBOL(drm_gem_object_free); | 463 | EXPORT_SYMBOL(drm_gem_object_free); |
464 | 464 | ||
465 | /** | ||
466 | * Called after the last reference to the object has been lost. | ||
467 | * Must be called without holding struct_mutex | ||
468 | * | ||
469 | * Frees the object | ||
470 | */ | ||
471 | void | ||
472 | drm_gem_object_free_unlocked(struct kref *kref) | ||
473 | { | ||
474 | struct drm_gem_object *obj = (struct drm_gem_object *) kref; | ||
475 | struct drm_device *dev = obj->dev; | ||
476 | |||
477 | if (dev->driver->gem_free_object_unlocked != NULL) | ||
478 | dev->driver->gem_free_object_unlocked(obj); | ||
479 | else if (dev->driver->gem_free_object != NULL) { | ||
480 | mutex_lock(&dev->struct_mutex); | ||
481 | dev->driver->gem_free_object(obj); | ||
482 | mutex_unlock(&dev->struct_mutex); | ||
483 | } | ||
484 | } | ||
485 | EXPORT_SYMBOL(drm_gem_object_free_unlocked); | ||
486 | |||
487 | static void drm_gem_object_ref_bug(struct kref *list_kref) | 465 | static void drm_gem_object_ref_bug(struct kref *list_kref) |
488 | { | 466 | { |
489 | BUG(); | 467 | BUG(); |
@@ -496,12 +474,8 @@ static void drm_gem_object_ref_bug(struct kref *list_kref) | |||
496 | * called before drm_gem_object_free or we'll be touching | 474 | * called before drm_gem_object_free or we'll be touching |
497 | * freed memory | 475 | * freed memory |
498 | */ | 476 | */ |
499 | void | 477 | void drm_gem_object_handle_free(struct drm_gem_object *obj) |
500 | drm_gem_object_handle_free(struct kref *kref) | ||
501 | { | 478 | { |
502 | struct drm_gem_object *obj = container_of(kref, | ||
503 | struct drm_gem_object, | ||
504 | handlecount); | ||
505 | struct drm_device *dev = obj->dev; | 479 | struct drm_device *dev = obj->dev; |
506 | 480 | ||
507 | /* Remove any name for this object */ | 481 | /* Remove any name for this object */ |
@@ -528,6 +502,10 @@ void drm_gem_vm_open(struct vm_area_struct *vma) | |||
528 | struct drm_gem_object *obj = vma->vm_private_data; | 502 | struct drm_gem_object *obj = vma->vm_private_data; |
529 | 503 | ||
530 | drm_gem_object_reference(obj); | 504 | drm_gem_object_reference(obj); |
505 | |||
506 | mutex_lock(&obj->dev->struct_mutex); | ||
507 | drm_vm_open_locked(vma); | ||
508 | mutex_unlock(&obj->dev->struct_mutex); | ||
531 | } | 509 | } |
532 | EXPORT_SYMBOL(drm_gem_vm_open); | 510 | EXPORT_SYMBOL(drm_gem_vm_open); |
533 | 511 | ||
@@ -535,7 +513,10 @@ void drm_gem_vm_close(struct vm_area_struct *vma) | |||
535 | { | 513 | { |
536 | struct drm_gem_object *obj = vma->vm_private_data; | 514 | struct drm_gem_object *obj = vma->vm_private_data; |
537 | 515 | ||
538 | drm_gem_object_unreference_unlocked(obj); | 516 | mutex_lock(&obj->dev->struct_mutex); |
517 | drm_vm_close_locked(vma); | ||
518 | drm_gem_object_unreference(obj); | ||
519 | mutex_unlock(&obj->dev->struct_mutex); | ||
539 | } | 520 | } |
540 | EXPORT_SYMBOL(drm_gem_vm_close); | 521 | EXPORT_SYMBOL(drm_gem_vm_close); |
541 | 522 | ||
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index 2ef2c7827243..974e970ce3f8 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c | |||
@@ -255,7 +255,7 @@ int drm_gem_one_name_info(int id, void *ptr, void *data) | |||
255 | 255 | ||
256 | seq_printf(m, "%6d %8zd %7d %8d\n", | 256 | seq_printf(m, "%6d %8zd %7d %8d\n", |
257 | obj->name, obj->size, | 257 | obj->name, obj->size, |
258 | atomic_read(&obj->handlecount.refcount), | 258 | atomic_read(&obj->handle_count), |
259 | atomic_read(&obj->refcount.refcount)); | 259 | atomic_read(&obj->refcount.refcount)); |
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index fda67468e603..5df450683aab 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c | |||
@@ -433,15 +433,7 @@ static void drm_vm_open(struct vm_area_struct *vma) | |||
433 | mutex_unlock(&dev->struct_mutex); | 433 | mutex_unlock(&dev->struct_mutex); |
434 | } | 434 | } |
435 | 435 | ||
436 | /** | 436 | void drm_vm_close_locked(struct vm_area_struct *vma) |
437 | * \c close method for all virtual memory types. | ||
438 | * | ||
439 | * \param vma virtual memory area. | ||
440 | * | ||
441 | * Search the \p vma private data entry in drm_device::vmalist, unlink it, and | ||
442 | * free it. | ||
443 | */ | ||
444 | static void drm_vm_close(struct vm_area_struct *vma) | ||
445 | { | 437 | { |
446 | struct drm_file *priv = vma->vm_file->private_data; | 438 | struct drm_file *priv = vma->vm_file->private_data; |
447 | struct drm_device *dev = priv->minor->dev; | 439 | struct drm_device *dev = priv->minor->dev; |
@@ -451,7 +443,6 @@ static void drm_vm_close(struct vm_area_struct *vma) | |||
451 | vma->vm_start, vma->vm_end - vma->vm_start); | 443 | vma->vm_start, vma->vm_end - vma->vm_start); |
452 | atomic_dec(&dev->vma_count); | 444 | atomic_dec(&dev->vma_count); |
453 | 445 | ||
454 | mutex_lock(&dev->struct_mutex); | ||
455 | list_for_each_entry_safe(pt, temp, &dev->vmalist, head) { | 446 | list_for_each_entry_safe(pt, temp, &dev->vmalist, head) { |
456 | if (pt->vma == vma) { | 447 | if (pt->vma == vma) { |
457 | list_del(&pt->head); | 448 | list_del(&pt->head); |
@@ -459,6 +450,23 @@ static void drm_vm_close(struct vm_area_struct *vma) | |||
459 | break; | 450 | break; |
460 | } | 451 | } |
461 | } | 452 | } |
453 | } | ||
454 | |||
455 | /** | ||
456 | * \c close method for all virtual memory types. | ||
457 | * | ||
458 | * \param vma virtual memory area. | ||
459 | * | ||
460 | * Search the \p vma private data entry in drm_device::vmalist, unlink it, and | ||
461 | * free it. | ||
462 | */ | ||
463 | static void drm_vm_close(struct vm_area_struct *vma) | ||
464 | { | ||
465 | struct drm_file *priv = vma->vm_file->private_data; | ||
466 | struct drm_device *dev = priv->minor->dev; | ||
467 | |||
468 | mutex_lock(&dev->struct_mutex); | ||
469 | drm_vm_close_locked(vma); | ||
462 | mutex_unlock(&dev->struct_mutex); | 470 | mutex_unlock(&dev->struct_mutex); |
463 | } | 471 | } |
464 | 472 | ||
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 61b4caf220fa..fb07e73581e8 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -116,7 +116,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
116 | static const struct file_operations i810_buffer_fops = { | 116 | static const struct file_operations i810_buffer_fops = { |
117 | .open = drm_open, | 117 | .open = drm_open, |
118 | .release = drm_release, | 118 | .release = drm_release, |
119 | .unlocked_ioctl = drm_ioctl, | 119 | .unlocked_ioctl = i810_ioctl, |
120 | .mmap = i810_mmap_buffers, | 120 | .mmap = i810_mmap_buffers, |
121 | .fasync = drm_fasync, | 121 | .fasync = drm_fasync, |
122 | }; | 122 | }; |
diff --git a/drivers/gpu/drm/i830/i830_dma.c b/drivers/gpu/drm/i830/i830_dma.c index 671aa18415ac..cc92c7e6236f 100644 --- a/drivers/gpu/drm/i830/i830_dma.c +++ b/drivers/gpu/drm/i830/i830_dma.c | |||
@@ -118,7 +118,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
118 | static const struct file_operations i830_buffer_fops = { | 118 | static const struct file_operations i830_buffer_fops = { |
119 | .open = drm_open, | 119 | .open = drm_open, |
120 | .release = drm_release, | 120 | .release = drm_release, |
121 | .unlocked_ioctl = drm_ioctl, | 121 | .unlocked_ioctl = i830_ioctl, |
122 | .mmap = i830_mmap_buffers, | 122 | .mmap = i830_mmap_buffers, |
123 | .fasync = drm_fasync, | 123 | .fasync = drm_fasync, |
124 | }; | 124 | }; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 9d67b4853030..2dd2c93ebfa3 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1787,9 +1787,9 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv) | |||
1787 | } | 1787 | } |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | div_u64(diff, diff1); | 1790 | diff = div_u64(diff, diff1); |
1791 | ret = ((m * diff) + c); | 1791 | ret = ((m * diff) + c); |
1792 | div_u64(ret, 10); | 1792 | ret = div_u64(ret, 10); |
1793 | 1793 | ||
1794 | dev_priv->last_count1 = total_count; | 1794 | dev_priv->last_count1 = total_count; |
1795 | dev_priv->last_time1 = now; | 1795 | dev_priv->last_time1 = now; |
@@ -1858,7 +1858,7 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv) | |||
1858 | 1858 | ||
1859 | /* More magic constants... */ | 1859 | /* More magic constants... */ |
1860 | diff = diff * 1181; | 1860 | diff = diff * 1181; |
1861 | div_u64(diff, diffms * 10); | 1861 | diff = div_u64(diff, diffms * 10); |
1862 | dev_priv->gfx_power = diff; | 1862 | dev_priv->gfx_power = diff; |
1863 | } | 1863 | } |
1864 | 1864 | ||
@@ -2231,6 +2231,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
2231 | dev_priv->mchdev_lock = &mchdev_lock; | 2231 | dev_priv->mchdev_lock = &mchdev_lock; |
2232 | spin_unlock(&mchdev_lock); | 2232 | spin_unlock(&mchdev_lock); |
2233 | 2233 | ||
2234 | /* XXX Prevent module unload due to memory corruption bugs. */ | ||
2235 | __module_get(THIS_MODULE); | ||
2236 | |||
2234 | return 0; | 2237 | return 0; |
2235 | 2238 | ||
2236 | out_workqueue_free: | 2239 | out_workqueue_free: |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index bced9b25c71e..90b1d6753b9d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -136,14 +136,12 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, | |||
136 | return -ENOMEM; | 136 | return -ENOMEM; |
137 | 137 | ||
138 | ret = drm_gem_handle_create(file_priv, obj, &handle); | 138 | ret = drm_gem_handle_create(file_priv, obj, &handle); |
139 | /* drop reference from allocate - handle holds it now */ | ||
140 | drm_gem_object_unreference_unlocked(obj); | ||
139 | if (ret) { | 141 | if (ret) { |
140 | drm_gem_object_unreference_unlocked(obj); | ||
141 | return ret; | 142 | return ret; |
142 | } | 143 | } |
143 | 144 | ||
144 | /* Sink the floating reference from kref_init(handlecount) */ | ||
145 | drm_gem_object_handle_unreference_unlocked(obj); | ||
146 | |||
147 | args->handle = handle; | 145 | args->handle = handle; |
148 | return 0; | 146 | return 0; |
149 | } | 147 | } |
@@ -471,14 +469,17 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
471 | return -ENOENT; | 469 | return -ENOENT; |
472 | obj_priv = to_intel_bo(obj); | 470 | obj_priv = to_intel_bo(obj); |
473 | 471 | ||
474 | /* Bounds check source. | 472 | /* Bounds check source. */ |
475 | * | 473 | if (args->offset > obj->size || args->size > obj->size - args->offset) { |
476 | * XXX: This could use review for overflow issues... | 474 | ret = -EINVAL; |
477 | */ | 475 | goto err; |
478 | if (args->offset > obj->size || args->size > obj->size || | 476 | } |
479 | args->offset + args->size > obj->size) { | 477 | |
480 | drm_gem_object_unreference_unlocked(obj); | 478 | if (!access_ok(VERIFY_WRITE, |
481 | return -EINVAL; | 479 | (char __user *)(uintptr_t)args->data_ptr, |
480 | args->size)) { | ||
481 | ret = -EFAULT; | ||
482 | goto err; | ||
482 | } | 483 | } |
483 | 484 | ||
484 | if (i915_gem_object_needs_bit17_swizzle(obj)) { | 485 | if (i915_gem_object_needs_bit17_swizzle(obj)) { |
@@ -490,8 +491,8 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
490 | file_priv); | 491 | file_priv); |
491 | } | 492 | } |
492 | 493 | ||
494 | err: | ||
493 | drm_gem_object_unreference_unlocked(obj); | 495 | drm_gem_object_unreference_unlocked(obj); |
494 | |||
495 | return ret; | 496 | return ret; |
496 | } | 497 | } |
497 | 498 | ||
@@ -580,8 +581,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj, | |||
580 | 581 | ||
581 | user_data = (char __user *) (uintptr_t) args->data_ptr; | 582 | user_data = (char __user *) (uintptr_t) args->data_ptr; |
582 | remain = args->size; | 583 | remain = args->size; |
583 | if (!access_ok(VERIFY_READ, user_data, remain)) | ||
584 | return -EFAULT; | ||
585 | 584 | ||
586 | 585 | ||
587 | mutex_lock(&dev->struct_mutex); | 586 | mutex_lock(&dev->struct_mutex); |
@@ -934,14 +933,17 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
934 | return -ENOENT; | 933 | return -ENOENT; |
935 | obj_priv = to_intel_bo(obj); | 934 | obj_priv = to_intel_bo(obj); |
936 | 935 | ||
937 | /* Bounds check destination. | 936 | /* Bounds check destination. */ |
938 | * | 937 | if (args->offset > obj->size || args->size > obj->size - args->offset) { |
939 | * XXX: This could use review for overflow issues... | 938 | ret = -EINVAL; |
940 | */ | 939 | goto err; |
941 | if (args->offset > obj->size || args->size > obj->size || | 940 | } |
942 | args->offset + args->size > obj->size) { | 941 | |
943 | drm_gem_object_unreference_unlocked(obj); | 942 | if (!access_ok(VERIFY_READ, |
944 | return -EINVAL; | 943 | (char __user *)(uintptr_t)args->data_ptr, |
944 | args->size)) { | ||
945 | ret = -EFAULT; | ||
946 | goto err; | ||
945 | } | 947 | } |
946 | 948 | ||
947 | /* We can only do the GTT pwrite on untiled buffers, as otherwise | 949 | /* We can only do the GTT pwrite on untiled buffers, as otherwise |
@@ -975,8 +977,8 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
975 | DRM_INFO("pwrite failed %d\n", ret); | 977 | DRM_INFO("pwrite failed %d\n", ret); |
976 | #endif | 978 | #endif |
977 | 979 | ||
980 | err: | ||
978 | drm_gem_object_unreference_unlocked(obj); | 981 | drm_gem_object_unreference_unlocked(obj); |
979 | |||
980 | return ret; | 982 | return ret; |
981 | } | 983 | } |
982 | 984 | ||
@@ -3258,6 +3260,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
3258 | (int) reloc->offset, | 3260 | (int) reloc->offset, |
3259 | reloc->read_domains, | 3261 | reloc->read_domains, |
3260 | reloc->write_domain); | 3262 | reloc->write_domain); |
3263 | drm_gem_object_unreference(target_obj); | ||
3264 | i915_gem_object_unpin(obj); | ||
3261 | return -EINVAL; | 3265 | return -EINVAL; |
3262 | } | 3266 | } |
3263 | if (reloc->write_domain & I915_GEM_DOMAIN_CPU || | 3267 | if (reloc->write_domain & I915_GEM_DOMAIN_CPU || |
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index e85246ef691c..5c428fa3e0b3 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c | |||
@@ -93,7 +93,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen | |||
93 | { | 93 | { |
94 | drm_i915_private_t *dev_priv = dev->dev_private; | 94 | drm_i915_private_t *dev_priv = dev->dev_private; |
95 | struct list_head eviction_list, unwind_list; | 95 | struct list_head eviction_list, unwind_list; |
96 | struct drm_i915_gem_object *obj_priv, *tmp_obj_priv; | 96 | struct drm_i915_gem_object *obj_priv; |
97 | struct list_head *render_iter, *bsd_iter; | 97 | struct list_head *render_iter, *bsd_iter; |
98 | int ret = 0; | 98 | int ret = 0; |
99 | 99 | ||
@@ -175,39 +175,34 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen | |||
175 | return -ENOSPC; | 175 | return -ENOSPC; |
176 | 176 | ||
177 | found: | 177 | found: |
178 | /* drm_mm doesn't allow any other other operations while | ||
179 | * scanning, therefore store to be evicted objects on a | ||
180 | * temporary list. */ | ||
178 | INIT_LIST_HEAD(&eviction_list); | 181 | INIT_LIST_HEAD(&eviction_list); |
179 | list_for_each_entry_safe(obj_priv, tmp_obj_priv, | 182 | while (!list_empty(&unwind_list)) { |
180 | &unwind_list, evict_list) { | 183 | obj_priv = list_first_entry(&unwind_list, |
184 | struct drm_i915_gem_object, | ||
185 | evict_list); | ||
181 | if (drm_mm_scan_remove_block(obj_priv->gtt_space)) { | 186 | if (drm_mm_scan_remove_block(obj_priv->gtt_space)) { |
182 | /* drm_mm doesn't allow any other other operations while | ||
183 | * scanning, therefore store to be evicted objects on a | ||
184 | * temporary list. */ | ||
185 | list_move(&obj_priv->evict_list, &eviction_list); | 187 | list_move(&obj_priv->evict_list, &eviction_list); |
186 | } else | 188 | continue; |
187 | drm_gem_object_unreference(&obj_priv->base); | 189 | } |
190 | list_del(&obj_priv->evict_list); | ||
191 | drm_gem_object_unreference(&obj_priv->base); | ||
188 | } | 192 | } |
189 | 193 | ||
190 | /* Unbinding will emit any required flushes */ | 194 | /* Unbinding will emit any required flushes */ |
191 | list_for_each_entry_safe(obj_priv, tmp_obj_priv, | 195 | while (!list_empty(&eviction_list)) { |
192 | &eviction_list, evict_list) { | 196 | obj_priv = list_first_entry(&eviction_list, |
193 | #if WATCH_LRU | 197 | struct drm_i915_gem_object, |
194 | DRM_INFO("%s: evicting %p\n", __func__, &obj_priv->base); | 198 | evict_list); |
195 | #endif | 199 | if (ret == 0) |
196 | ret = i915_gem_object_unbind(&obj_priv->base); | 200 | ret = i915_gem_object_unbind(&obj_priv->base); |
197 | if (ret) | 201 | list_del(&obj_priv->evict_list); |
198 | return ret; | ||
199 | |||
200 | drm_gem_object_unreference(&obj_priv->base); | 202 | drm_gem_object_unreference(&obj_priv->base); |
201 | } | 203 | } |
202 | 204 | ||
203 | /* The just created free hole should be on the top of the free stack | 205 | return ret; |
204 | * maintained by drm_mm, so this BUG_ON actually executes in O(1). | ||
205 | * Furthermore all accessed data has just recently been used, so it | ||
206 | * should be really fast, too. */ | ||
207 | BUG_ON(!drm_mm_search_free(&dev_priv->mm.gtt_space, min_size, | ||
208 | alignment, 0)); | ||
209 | |||
210 | return 0; | ||
211 | } | 206 | } |
212 | 207 | ||
213 | int | 208 | int |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index b5bf51a4502d..979228594599 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1013,8 +1013,8 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) | |||
1013 | DRM_DEBUG_KMS("vblank wait timed out\n"); | 1013 | DRM_DEBUG_KMS("vblank wait timed out\n"); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | /** | 1016 | /* |
1017 | * intel_wait_for_vblank_off - wait for vblank after disabling a pipe | 1017 | * intel_wait_for_pipe_off - wait for pipe to turn off |
1018 | * @dev: drm device | 1018 | * @dev: drm device |
1019 | * @pipe: pipe to wait for | 1019 | * @pipe: pipe to wait for |
1020 | * | 1020 | * |
@@ -1022,25 +1022,39 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) | |||
1022 | * spinning on the vblank interrupt status bit, since we won't actually | 1022 | * spinning on the vblank interrupt status bit, since we won't actually |
1023 | * see an interrupt when the pipe is disabled. | 1023 | * see an interrupt when the pipe is disabled. |
1024 | * | 1024 | * |
1025 | * So this function waits for the display line value to settle (it | 1025 | * On Gen4 and above: |
1026 | * usually ends up stopping at the start of the next frame). | 1026 | * wait for the pipe register state bit to turn off |
1027 | * | ||
1028 | * Otherwise: | ||
1029 | * wait for the display line value to settle (it usually | ||
1030 | * ends up stopping at the start of the next frame). | ||
1031 | * | ||
1027 | */ | 1032 | */ |
1028 | void intel_wait_for_vblank_off(struct drm_device *dev, int pipe) | 1033 | static void intel_wait_for_pipe_off(struct drm_device *dev, int pipe) |
1029 | { | 1034 | { |
1030 | struct drm_i915_private *dev_priv = dev->dev_private; | 1035 | struct drm_i915_private *dev_priv = dev->dev_private; |
1031 | int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL); | 1036 | |
1032 | unsigned long timeout = jiffies + msecs_to_jiffies(100); | 1037 | if (INTEL_INFO(dev)->gen >= 4) { |
1033 | u32 last_line; | 1038 | int pipeconf_reg = (pipe == 0 ? PIPEACONF : PIPEBCONF); |
1034 | 1039 | ||
1035 | /* Wait for the display line to settle */ | 1040 | /* Wait for the Pipe State to go off */ |
1036 | do { | 1041 | if (wait_for((I915_READ(pipeconf_reg) & I965_PIPECONF_ACTIVE) == 0, |
1037 | last_line = I915_READ(pipedsl_reg) & DSL_LINEMASK; | 1042 | 100, 0)) |
1038 | mdelay(5); | 1043 | DRM_DEBUG_KMS("pipe_off wait timed out\n"); |
1039 | } while (((I915_READ(pipedsl_reg) & DSL_LINEMASK) != last_line) && | 1044 | } else { |
1040 | time_after(timeout, jiffies)); | 1045 | u32 last_line; |
1041 | 1046 | int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL); | |
1042 | if (time_after(jiffies, timeout)) | 1047 | unsigned long timeout = jiffies + msecs_to_jiffies(100); |
1043 | DRM_DEBUG_KMS("vblank wait timed out\n"); | 1048 | |
1049 | /* Wait for the display line to settle */ | ||
1050 | do { | ||
1051 | last_line = I915_READ(pipedsl_reg) & DSL_LINEMASK; | ||
1052 | mdelay(5); | ||
1053 | } while (((I915_READ(pipedsl_reg) & DSL_LINEMASK) != last_line) && | ||
1054 | time_after(timeout, jiffies)); | ||
1055 | if (time_after(jiffies, timeout)) | ||
1056 | DRM_DEBUG_KMS("pipe_off wait timed out\n"); | ||
1057 | } | ||
1044 | } | 1058 | } |
1045 | 1059 | ||
1046 | /* Parameters have changed, update FBC info */ | 1060 | /* Parameters have changed, update FBC info */ |
@@ -2328,13 +2342,13 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2328 | I915_READ(dspbase_reg); | 2342 | I915_READ(dspbase_reg); |
2329 | } | 2343 | } |
2330 | 2344 | ||
2331 | /* Wait for vblank for the disable to take effect */ | ||
2332 | intel_wait_for_vblank_off(dev, pipe); | ||
2333 | |||
2334 | /* Don't disable pipe A or pipe A PLLs if needed */ | 2345 | /* Don't disable pipe A or pipe A PLLs if needed */ |
2335 | if (pipeconf_reg == PIPEACONF && | 2346 | if (pipeconf_reg == PIPEACONF && |
2336 | (dev_priv->quirks & QUIRK_PIPEA_FORCE)) | 2347 | (dev_priv->quirks & QUIRK_PIPEA_FORCE)) { |
2348 | /* Wait for vblank for the disable to take effect */ | ||
2349 | intel_wait_for_vblank(dev, pipe); | ||
2337 | goto skip_pipe_off; | 2350 | goto skip_pipe_off; |
2351 | } | ||
2338 | 2352 | ||
2339 | /* Next, disable display pipes */ | 2353 | /* Next, disable display pipes */ |
2340 | temp = I915_READ(pipeconf_reg); | 2354 | temp = I915_READ(pipeconf_reg); |
@@ -2343,8 +2357,8 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2343 | I915_READ(pipeconf_reg); | 2357 | I915_READ(pipeconf_reg); |
2344 | } | 2358 | } |
2345 | 2359 | ||
2346 | /* Wait for vblank for the disable to take effect. */ | 2360 | /* Wait for the pipe to turn off */ |
2347 | intel_wait_for_vblank_off(dev, pipe); | 2361 | intel_wait_for_pipe_off(dev, pipe); |
2348 | 2362 | ||
2349 | temp = I915_READ(dpll_reg); | 2363 | temp = I915_READ(dpll_reg); |
2350 | if ((temp & DPLL_VCO_ENABLE) != 0) { | 2364 | if ((temp & DPLL_VCO_ENABLE) != 0) { |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 1a51ee07de3e..9ab8708ac6ba 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1138,18 +1138,14 @@ static bool | |||
1138 | intel_dp_set_link_train(struct intel_dp *intel_dp, | 1138 | intel_dp_set_link_train(struct intel_dp *intel_dp, |
1139 | uint32_t dp_reg_value, | 1139 | uint32_t dp_reg_value, |
1140 | uint8_t dp_train_pat, | 1140 | uint8_t dp_train_pat, |
1141 | uint8_t train_set[4], | 1141 | uint8_t train_set[4]) |
1142 | bool first) | ||
1143 | { | 1142 | { |
1144 | struct drm_device *dev = intel_dp->base.enc.dev; | 1143 | struct drm_device *dev = intel_dp->base.enc.dev; |
1145 | struct drm_i915_private *dev_priv = dev->dev_private; | 1144 | struct drm_i915_private *dev_priv = dev->dev_private; |
1146 | struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.enc.crtc); | ||
1147 | int ret; | 1145 | int ret; |
1148 | 1146 | ||
1149 | I915_WRITE(intel_dp->output_reg, dp_reg_value); | 1147 | I915_WRITE(intel_dp->output_reg, dp_reg_value); |
1150 | POSTING_READ(intel_dp->output_reg); | 1148 | POSTING_READ(intel_dp->output_reg); |
1151 | if (first) | ||
1152 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
1153 | 1149 | ||
1154 | intel_dp_aux_native_write_1(intel_dp, | 1150 | intel_dp_aux_native_write_1(intel_dp, |
1155 | DP_TRAINING_PATTERN_SET, | 1151 | DP_TRAINING_PATTERN_SET, |
@@ -1174,10 +1170,15 @@ intel_dp_link_train(struct intel_dp *intel_dp) | |||
1174 | uint8_t voltage; | 1170 | uint8_t voltage; |
1175 | bool clock_recovery = false; | 1171 | bool clock_recovery = false; |
1176 | bool channel_eq = false; | 1172 | bool channel_eq = false; |
1177 | bool first = true; | ||
1178 | int tries; | 1173 | int tries; |
1179 | u32 reg; | 1174 | u32 reg; |
1180 | uint32_t DP = intel_dp->DP; | 1175 | uint32_t DP = intel_dp->DP; |
1176 | struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.enc.crtc); | ||
1177 | |||
1178 | /* Enable output, wait for it to become active */ | ||
1179 | I915_WRITE(intel_dp->output_reg, intel_dp->DP); | ||
1180 | POSTING_READ(intel_dp->output_reg); | ||
1181 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
1181 | 1182 | ||
1182 | /* Write the link configuration data */ | 1183 | /* Write the link configuration data */ |
1183 | intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, | 1184 | intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, |
@@ -1210,9 +1211,8 @@ intel_dp_link_train(struct intel_dp *intel_dp) | |||
1210 | reg = DP | DP_LINK_TRAIN_PAT_1; | 1211 | reg = DP | DP_LINK_TRAIN_PAT_1; |
1211 | 1212 | ||
1212 | if (!intel_dp_set_link_train(intel_dp, reg, | 1213 | if (!intel_dp_set_link_train(intel_dp, reg, |
1213 | DP_TRAINING_PATTERN_1, train_set, first)) | 1214 | DP_TRAINING_PATTERN_1, train_set)) |
1214 | break; | 1215 | break; |
1215 | first = false; | ||
1216 | /* Set training pattern 1 */ | 1216 | /* Set training pattern 1 */ |
1217 | 1217 | ||
1218 | udelay(100); | 1218 | udelay(100); |
@@ -1266,8 +1266,7 @@ intel_dp_link_train(struct intel_dp *intel_dp) | |||
1266 | 1266 | ||
1267 | /* channel eq pattern */ | 1267 | /* channel eq pattern */ |
1268 | if (!intel_dp_set_link_train(intel_dp, reg, | 1268 | if (!intel_dp_set_link_train(intel_dp, reg, |
1269 | DP_TRAINING_PATTERN_2, train_set, | 1269 | DP_TRAINING_PATTERN_2, train_set)) |
1270 | false)) | ||
1271 | break; | 1270 | break; |
1272 | 1271 | ||
1273 | udelay(400); | 1272 | udelay(400); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index ad312ca6b3e5..8828b3ac6414 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -229,7 +229,6 @@ extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, | |||
229 | struct drm_crtc *crtc); | 229 | struct drm_crtc *crtc); |
230 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | 230 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, |
231 | struct drm_file *file_priv); | 231 | struct drm_file *file_priv); |
232 | extern void intel_wait_for_vblank_off(struct drm_device *dev, int pipe); | ||
233 | extern void intel_wait_for_vblank(struct drm_device *dev, int pipe); | 232 | extern void intel_wait_for_vblank(struct drm_device *dev, int pipe); |
234 | extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe); | 233 | extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe); |
235 | extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, | 234 | extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 7bdc96256bf5..b61966c126d3 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -237,8 +237,10 @@ int intel_fbdev_destroy(struct drm_device *dev, | |||
237 | drm_fb_helper_fini(&ifbdev->helper); | 237 | drm_fb_helper_fini(&ifbdev->helper); |
238 | 238 | ||
239 | drm_framebuffer_cleanup(&ifb->base); | 239 | drm_framebuffer_cleanup(&ifb->base); |
240 | if (ifb->obj) | 240 | if (ifb->obj) { |
241 | drm_gem_object_unreference(ifb->obj); | 241 | drm_gem_object_unreference(ifb->obj); |
242 | ifb->obj = NULL; | ||
243 | } | ||
242 | 244 | ||
243 | return 0; | 245 | return 0; |
244 | } | 246 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index ead7b8fc53fc..19620a6709f5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -167,11 +167,9 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, | |||
167 | goto out; | 167 | goto out; |
168 | 168 | ||
169 | ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); | 169 | ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); |
170 | /* drop reference from allocate - handle holds it now */ | ||
171 | drm_gem_object_unreference_unlocked(nvbo->gem); | ||
170 | out: | 172 | out: |
171 | drm_gem_object_handle_unreference_unlocked(nvbo->gem); | ||
172 | |||
173 | if (ret) | ||
174 | drm_gem_object_unreference_unlocked(nvbo->gem); | ||
175 | return ret; | 173 | return ret; |
176 | } | 174 | } |
177 | 175 | ||
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 79082d4398ae..2f93d46ae69a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1137,7 +1137,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1137 | 1137 | ||
1138 | WREG32(RCU_IND_INDEX, 0x203); | 1138 | WREG32(RCU_IND_INDEX, 0x203); |
1139 | efuse_straps_3 = RREG32(RCU_IND_DATA); | 1139 | efuse_straps_3 = RREG32(RCU_IND_DATA); |
1140 | efuse_box_bit_127_124 = (u8)(efuse_straps_3 & 0xF0000000) >> 28; | 1140 | efuse_box_bit_127_124 = (u8)((efuse_straps_3 & 0xF0000000) >> 28); |
1141 | 1141 | ||
1142 | switch(efuse_box_bit_127_124) { | 1142 | switch(efuse_box_bit_127_124) { |
1143 | case 0x0: | 1143 | case 0x0: |
@@ -1407,6 +1407,7 @@ int evergreen_mc_init(struct radeon_device *rdev) | |||
1407 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 1407 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; |
1408 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 1408 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; |
1409 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 1409 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
1410 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1410 | r600_vram_gtt_location(rdev, &rdev->mc); | 1411 | r600_vram_gtt_location(rdev, &rdev->mc); |
1411 | radeon_update_bandwidth_info(rdev); | 1412 | radeon_update_bandwidth_info(rdev); |
1412 | 1413 | ||
@@ -1520,7 +1521,7 @@ void evergreen_disable_interrupt_state(struct radeon_device *rdev) | |||
1520 | { | 1521 | { |
1521 | u32 tmp; | 1522 | u32 tmp; |
1522 | 1523 | ||
1523 | WREG32(CP_INT_CNTL, 0); | 1524 | WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); |
1524 | WREG32(GRBM_INT_CNTL, 0); | 1525 | WREG32(GRBM_INT_CNTL, 0); |
1525 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); | 1526 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); |
1526 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | 1527 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index e151f16a8f86..e59422320bb6 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -1030,6 +1030,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) | |||
1030 | return r; | 1030 | return r; |
1031 | } | 1031 | } |
1032 | rdev->cp.ready = true; | 1032 | rdev->cp.ready = true; |
1033 | rdev->mc.active_vram_size = rdev->mc.real_vram_size; | ||
1033 | return 0; | 1034 | return 0; |
1034 | } | 1035 | } |
1035 | 1036 | ||
@@ -1047,6 +1048,7 @@ void r100_cp_fini(struct radeon_device *rdev) | |||
1047 | void r100_cp_disable(struct radeon_device *rdev) | 1048 | void r100_cp_disable(struct radeon_device *rdev) |
1048 | { | 1049 | { |
1049 | /* Disable ring */ | 1050 | /* Disable ring */ |
1051 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1050 | rdev->cp.ready = false; | 1052 | rdev->cp.ready = false; |
1051 | WREG32(RADEON_CP_CSQ_MODE, 0); | 1053 | WREG32(RADEON_CP_CSQ_MODE, 0); |
1052 | WREG32(RADEON_CP_CSQ_CNTL, 0); | 1054 | WREG32(RADEON_CP_CSQ_CNTL, 0); |
@@ -2295,6 +2297,7 @@ void r100_vram_init_sizes(struct radeon_device *rdev) | |||
2295 | /* FIXME we don't use the second aperture yet when we could use it */ | 2297 | /* FIXME we don't use the second aperture yet when we could use it */ |
2296 | if (rdev->mc.visible_vram_size > rdev->mc.aper_size) | 2298 | if (rdev->mc.visible_vram_size > rdev->mc.aper_size) |
2297 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 2299 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
2300 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
2298 | config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); | 2301 | config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); |
2299 | if (rdev->flags & RADEON_IS_IGP) { | 2302 | if (rdev->flags & RADEON_IS_IGP) { |
2300 | uint32_t tom; | 2303 | uint32_t tom; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index ddc3adea1dda..7b65e4efe8af 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1248,6 +1248,7 @@ int r600_mc_init(struct radeon_device *rdev) | |||
1248 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); | 1248 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); |
1249 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); | 1249 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); |
1250 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 1250 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
1251 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1251 | r600_vram_gtt_location(rdev, &rdev->mc); | 1252 | r600_vram_gtt_location(rdev, &rdev->mc); |
1252 | 1253 | ||
1253 | if (rdev->flags & RADEON_IS_IGP) { | 1254 | if (rdev->flags & RADEON_IS_IGP) { |
@@ -1917,6 +1918,7 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) | |||
1917 | */ | 1918 | */ |
1918 | void r600_cp_stop(struct radeon_device *rdev) | 1919 | void r600_cp_stop(struct radeon_device *rdev) |
1919 | { | 1920 | { |
1921 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1920 | WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); | 1922 | WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); |
1921 | } | 1923 | } |
1922 | 1924 | ||
@@ -2910,7 +2912,7 @@ static void r600_disable_interrupt_state(struct radeon_device *rdev) | |||
2910 | { | 2912 | { |
2911 | u32 tmp; | 2913 | u32 tmp; |
2912 | 2914 | ||
2913 | WREG32(CP_INT_CNTL, 0); | 2915 | WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); |
2914 | WREG32(GRBM_INT_CNTL, 0); | 2916 | WREG32(GRBM_INT_CNTL, 0); |
2915 | WREG32(DxMODE_INT_MASK, 0); | 2917 | WREG32(DxMODE_INT_MASK, 0); |
2916 | if (ASIC_IS_DCE3(rdev)) { | 2918 | if (ASIC_IS_DCE3(rdev)) { |
@@ -3528,7 +3530,8 @@ void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) | |||
3528 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read | 3530 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read |
3529 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL | 3531 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL |
3530 | */ | 3532 | */ |
3531 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { | 3533 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && |
3534 | rdev->vram_scratch.ptr) { | ||
3532 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | 3535 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; |
3533 | u32 tmp; | 3536 | u32 tmp; |
3534 | 3537 | ||
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 9ceb2a1ce799..3473c00781ff 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -532,6 +532,7 @@ int r600_blit_init(struct radeon_device *rdev) | |||
532 | memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); | 532 | memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); |
533 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); | 533 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); |
534 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | 534 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); |
535 | rdev->mc.active_vram_size = rdev->mc.real_vram_size; | ||
535 | return 0; | 536 | return 0; |
536 | } | 537 | } |
537 | 538 | ||
@@ -539,6 +540,7 @@ void r600_blit_fini(struct radeon_device *rdev) | |||
539 | { | 540 | { |
540 | int r; | 541 | int r; |
541 | 542 | ||
543 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
542 | if (rdev->r600_blit.shader_obj == NULL) | 544 | if (rdev->r600_blit.shader_obj == NULL) |
543 | return; | 545 | return; |
544 | /* If we can't reserve the bo, unref should be enough to destroy | 546 | /* If we can't reserve the bo, unref should be enough to destroy |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index a168d644bf9e..9ff38c99a6ea 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -344,6 +344,7 @@ struct radeon_mc { | |||
344 | * about vram size near mc fb location */ | 344 | * about vram size near mc fb location */ |
345 | u64 mc_vram_size; | 345 | u64 mc_vram_size; |
346 | u64 visible_vram_size; | 346 | u64 visible_vram_size; |
347 | u64 active_vram_size; | ||
347 | u64 gtt_size; | 348 | u64 gtt_size; |
348 | u64 gtt_start; | 349 | u64 gtt_start; |
349 | u64 gtt_end; | 350 | u64 gtt_end; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index ebae14c4b768..8e43ddae70cc 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -317,6 +317,15 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
317 | *connector_type = DRM_MODE_CONNECTOR_DVID; | 317 | *connector_type = DRM_MODE_CONNECTOR_DVID; |
318 | } | 318 | } |
319 | 319 | ||
320 | /* MSI K9A2GM V2/V3 board has no HDMI or DVI */ | ||
321 | if ((dev->pdev->device == 0x796e) && | ||
322 | (dev->pdev->subsystem_vendor == 0x1462) && | ||
323 | (dev->pdev->subsystem_device == 0x7302)) { | ||
324 | if ((supported_device == ATOM_DEVICE_DFP2_SUPPORT) || | ||
325 | (supported_device == ATOM_DEVICE_DFP3_SUPPORT)) | ||
326 | return false; | ||
327 | } | ||
328 | |||
320 | /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */ | 329 | /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */ |
321 | if ((dev->pdev->device == 0x7941) && | 330 | if ((dev->pdev->device == 0x7941) && |
322 | (dev->pdev->subsystem_vendor == 0x147b) && | 331 | (dev->pdev->subsystem_vendor == 0x147b) && |
@@ -1549,39 +1558,39 @@ radeon_atombios_get_tv_info(struct radeon_device *rdev) | |||
1549 | switch (tv_info->ucTV_BootUpDefaultStandard) { | 1558 | switch (tv_info->ucTV_BootUpDefaultStandard) { |
1550 | case ATOM_TV_NTSC: | 1559 | case ATOM_TV_NTSC: |
1551 | tv_std = TV_STD_NTSC; | 1560 | tv_std = TV_STD_NTSC; |
1552 | DRM_INFO("Default TV standard: NTSC\n"); | 1561 | DRM_DEBUG_KMS("Default TV standard: NTSC\n"); |
1553 | break; | 1562 | break; |
1554 | case ATOM_TV_NTSCJ: | 1563 | case ATOM_TV_NTSCJ: |
1555 | tv_std = TV_STD_NTSC_J; | 1564 | tv_std = TV_STD_NTSC_J; |
1556 | DRM_INFO("Default TV standard: NTSC-J\n"); | 1565 | DRM_DEBUG_KMS("Default TV standard: NTSC-J\n"); |
1557 | break; | 1566 | break; |
1558 | case ATOM_TV_PAL: | 1567 | case ATOM_TV_PAL: |
1559 | tv_std = TV_STD_PAL; | 1568 | tv_std = TV_STD_PAL; |
1560 | DRM_INFO("Default TV standard: PAL\n"); | 1569 | DRM_DEBUG_KMS("Default TV standard: PAL\n"); |
1561 | break; | 1570 | break; |
1562 | case ATOM_TV_PALM: | 1571 | case ATOM_TV_PALM: |
1563 | tv_std = TV_STD_PAL_M; | 1572 | tv_std = TV_STD_PAL_M; |
1564 | DRM_INFO("Default TV standard: PAL-M\n"); | 1573 | DRM_DEBUG_KMS("Default TV standard: PAL-M\n"); |
1565 | break; | 1574 | break; |
1566 | case ATOM_TV_PALN: | 1575 | case ATOM_TV_PALN: |
1567 | tv_std = TV_STD_PAL_N; | 1576 | tv_std = TV_STD_PAL_N; |
1568 | DRM_INFO("Default TV standard: PAL-N\n"); | 1577 | DRM_DEBUG_KMS("Default TV standard: PAL-N\n"); |
1569 | break; | 1578 | break; |
1570 | case ATOM_TV_PALCN: | 1579 | case ATOM_TV_PALCN: |
1571 | tv_std = TV_STD_PAL_CN; | 1580 | tv_std = TV_STD_PAL_CN; |
1572 | DRM_INFO("Default TV standard: PAL-CN\n"); | 1581 | DRM_DEBUG_KMS("Default TV standard: PAL-CN\n"); |
1573 | break; | 1582 | break; |
1574 | case ATOM_TV_PAL60: | 1583 | case ATOM_TV_PAL60: |
1575 | tv_std = TV_STD_PAL_60; | 1584 | tv_std = TV_STD_PAL_60; |
1576 | DRM_INFO("Default TV standard: PAL-60\n"); | 1585 | DRM_DEBUG_KMS("Default TV standard: PAL-60\n"); |
1577 | break; | 1586 | break; |
1578 | case ATOM_TV_SECAM: | 1587 | case ATOM_TV_SECAM: |
1579 | tv_std = TV_STD_SECAM; | 1588 | tv_std = TV_STD_SECAM; |
1580 | DRM_INFO("Default TV standard: SECAM\n"); | 1589 | DRM_DEBUG_KMS("Default TV standard: SECAM\n"); |
1581 | break; | 1590 | break; |
1582 | default: | 1591 | default: |
1583 | tv_std = TV_STD_NTSC; | 1592 | tv_std = TV_STD_NTSC; |
1584 | DRM_INFO("Unknown TV standard; defaulting to NTSC\n"); | 1593 | DRM_DEBUG_KMS("Unknown TV standard; defaulting to NTSC\n"); |
1585 | break; | 1594 | break; |
1586 | } | 1595 | } |
1587 | } | 1596 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index a04b7a6ad95f..7b7ea269549c 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -913,47 +913,47 @@ radeon_combios_get_tv_info(struct radeon_device *rdev) | |||
913 | switch (RBIOS8(tv_info + 7) & 0xf) { | 913 | switch (RBIOS8(tv_info + 7) & 0xf) { |
914 | case 1: | 914 | case 1: |
915 | tv_std = TV_STD_NTSC; | 915 | tv_std = TV_STD_NTSC; |
916 | DRM_INFO("Default TV standard: NTSC\n"); | 916 | DRM_DEBUG_KMS("Default TV standard: NTSC\n"); |
917 | break; | 917 | break; |
918 | case 2: | 918 | case 2: |
919 | tv_std = TV_STD_PAL; | 919 | tv_std = TV_STD_PAL; |
920 | DRM_INFO("Default TV standard: PAL\n"); | 920 | DRM_DEBUG_KMS("Default TV standard: PAL\n"); |
921 | break; | 921 | break; |
922 | case 3: | 922 | case 3: |
923 | tv_std = TV_STD_PAL_M; | 923 | tv_std = TV_STD_PAL_M; |
924 | DRM_INFO("Default TV standard: PAL-M\n"); | 924 | DRM_DEBUG_KMS("Default TV standard: PAL-M\n"); |
925 | break; | 925 | break; |
926 | case 4: | 926 | case 4: |
927 | tv_std = TV_STD_PAL_60; | 927 | tv_std = TV_STD_PAL_60; |
928 | DRM_INFO("Default TV standard: PAL-60\n"); | 928 | DRM_DEBUG_KMS("Default TV standard: PAL-60\n"); |
929 | break; | 929 | break; |
930 | case 5: | 930 | case 5: |
931 | tv_std = TV_STD_NTSC_J; | 931 | tv_std = TV_STD_NTSC_J; |
932 | DRM_INFO("Default TV standard: NTSC-J\n"); | 932 | DRM_DEBUG_KMS("Default TV standard: NTSC-J\n"); |
933 | break; | 933 | break; |
934 | case 6: | 934 | case 6: |
935 | tv_std = TV_STD_SCART_PAL; | 935 | tv_std = TV_STD_SCART_PAL; |
936 | DRM_INFO("Default TV standard: SCART-PAL\n"); | 936 | DRM_DEBUG_KMS("Default TV standard: SCART-PAL\n"); |
937 | break; | 937 | break; |
938 | default: | 938 | default: |
939 | tv_std = TV_STD_NTSC; | 939 | tv_std = TV_STD_NTSC; |
940 | DRM_INFO | 940 | DRM_DEBUG_KMS |
941 | ("Unknown TV standard; defaulting to NTSC\n"); | 941 | ("Unknown TV standard; defaulting to NTSC\n"); |
942 | break; | 942 | break; |
943 | } | 943 | } |
944 | 944 | ||
945 | switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) { | 945 | switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) { |
946 | case 0: | 946 | case 0: |
947 | DRM_INFO("29.498928713 MHz TV ref clk\n"); | 947 | DRM_DEBUG_KMS("29.498928713 MHz TV ref clk\n"); |
948 | break; | 948 | break; |
949 | case 1: | 949 | case 1: |
950 | DRM_INFO("28.636360000 MHz TV ref clk\n"); | 950 | DRM_DEBUG_KMS("28.636360000 MHz TV ref clk\n"); |
951 | break; | 951 | break; |
952 | case 2: | 952 | case 2: |
953 | DRM_INFO("14.318180000 MHz TV ref clk\n"); | 953 | DRM_DEBUG_KMS("14.318180000 MHz TV ref clk\n"); |
954 | break; | 954 | break; |
955 | case 3: | 955 | case 3: |
956 | DRM_INFO("27.000000000 MHz TV ref clk\n"); | 956 | DRM_DEBUG_KMS("27.000000000 MHz TV ref clk\n"); |
957 | break; | 957 | break; |
958 | default: | 958 | default: |
959 | break; | 959 | break; |
@@ -1324,7 +1324,7 @@ bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder, | |||
1324 | 1324 | ||
1325 | if (tmds_info) { | 1325 | if (tmds_info) { |
1326 | ver = RBIOS8(tmds_info); | 1326 | ver = RBIOS8(tmds_info); |
1327 | DRM_INFO("DFP table revision: %d\n", ver); | 1327 | DRM_DEBUG_KMS("DFP table revision: %d\n", ver); |
1328 | if (ver == 3) { | 1328 | if (ver == 3) { |
1329 | n = RBIOS8(tmds_info + 5) + 1; | 1329 | n = RBIOS8(tmds_info + 5) + 1; |
1330 | if (n > 4) | 1330 | if (n > 4) |
@@ -1408,7 +1408,7 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder | |||
1408 | offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); | 1408 | offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); |
1409 | if (offset) { | 1409 | if (offset) { |
1410 | ver = RBIOS8(offset); | 1410 | ver = RBIOS8(offset); |
1411 | DRM_INFO("External TMDS Table revision: %d\n", ver); | 1411 | DRM_DEBUG_KMS("External TMDS Table revision: %d\n", ver); |
1412 | tmds->slave_addr = RBIOS8(offset + 4 + 2); | 1412 | tmds->slave_addr = RBIOS8(offset + 4 + 2); |
1413 | tmds->slave_addr >>= 1; /* 7 bit addressing */ | 1413 | tmds->slave_addr >>= 1; /* 7 bit addressing */ |
1414 | gpio = RBIOS8(offset + 4 + 3); | 1414 | gpio = RBIOS8(offset + 4 + 3); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 127a395f70fb..b92d2f2fcbed 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -349,6 +349,8 @@ static void radeon_print_display_setup(struct drm_device *dev) | |||
349 | DRM_INFO(" DFP4: %s\n", encoder_names[radeon_encoder->encoder_id]); | 349 | DRM_INFO(" DFP4: %s\n", encoder_names[radeon_encoder->encoder_id]); |
350 | if (devices & ATOM_DEVICE_DFP5_SUPPORT) | 350 | if (devices & ATOM_DEVICE_DFP5_SUPPORT) |
351 | DRM_INFO(" DFP5: %s\n", encoder_names[radeon_encoder->encoder_id]); | 351 | DRM_INFO(" DFP5: %s\n", encoder_names[radeon_encoder->encoder_id]); |
352 | if (devices & ATOM_DEVICE_DFP6_SUPPORT) | ||
353 | DRM_INFO(" DFP6: %s\n", encoder_names[radeon_encoder->encoder_id]); | ||
352 | if (devices & ATOM_DEVICE_TV1_SUPPORT) | 354 | if (devices & ATOM_DEVICE_TV1_SUPPORT) |
353 | DRM_INFO(" TV1: %s\n", encoder_names[radeon_encoder->encoder_id]); | 355 | DRM_INFO(" TV1: %s\n", encoder_names[radeon_encoder->encoder_id]); |
354 | if (devices & ATOM_DEVICE_CV_SUPPORT) | 356 | if (devices & ATOM_DEVICE_CV_SUPPORT) |
@@ -841,8 +843,9 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) | |||
841 | { | 843 | { |
842 | struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb); | 844 | struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb); |
843 | 845 | ||
844 | if (radeon_fb->obj) | 846 | if (radeon_fb->obj) { |
845 | drm_gem_object_unreference_unlocked(radeon_fb->obj); | 847 | drm_gem_object_unreference_unlocked(radeon_fb->obj); |
848 | } | ||
846 | drm_framebuffer_cleanup(fb); | 849 | drm_framebuffer_cleanup(fb); |
847 | kfree(radeon_fb); | 850 | kfree(radeon_fb); |
848 | } | 851 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index c74a8b20d941..40b0c087b592 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -94,6 +94,7 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj) | |||
94 | ret = radeon_bo_reserve(rbo, false); | 94 | ret = radeon_bo_reserve(rbo, false); |
95 | if (likely(ret == 0)) { | 95 | if (likely(ret == 0)) { |
96 | radeon_bo_kunmap(rbo); | 96 | radeon_bo_kunmap(rbo); |
97 | radeon_bo_unpin(rbo); | ||
97 | radeon_bo_unreserve(rbo); | 98 | radeon_bo_unreserve(rbo); |
98 | } | 99 | } |
99 | drm_gem_object_unreference_unlocked(gobj); | 100 | drm_gem_object_unreference_unlocked(gobj); |
@@ -325,8 +326,6 @@ static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfb | |||
325 | { | 326 | { |
326 | struct fb_info *info; | 327 | struct fb_info *info; |
327 | struct radeon_framebuffer *rfb = &rfbdev->rfb; | 328 | struct radeon_framebuffer *rfb = &rfbdev->rfb; |
328 | struct radeon_bo *rbo; | ||
329 | int r; | ||
330 | 329 | ||
331 | if (rfbdev->helper.fbdev) { | 330 | if (rfbdev->helper.fbdev) { |
332 | info = rfbdev->helper.fbdev; | 331 | info = rfbdev->helper.fbdev; |
@@ -338,14 +337,8 @@ static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfb | |||
338 | } | 337 | } |
339 | 338 | ||
340 | if (rfb->obj) { | 339 | if (rfb->obj) { |
341 | rbo = rfb->obj->driver_private; | 340 | radeonfb_destroy_pinned_object(rfb->obj); |
342 | r = radeon_bo_reserve(rbo, false); | 341 | rfb->obj = NULL; |
343 | if (likely(r == 0)) { | ||
344 | radeon_bo_kunmap(rbo); | ||
345 | radeon_bo_unpin(rbo); | ||
346 | radeon_bo_unreserve(rbo); | ||
347 | } | ||
348 | drm_gem_object_unreference_unlocked(rfb->obj); | ||
349 | } | 342 | } |
350 | drm_fb_helper_fini(&rfbdev->helper); | 343 | drm_fb_helper_fini(&rfbdev->helper); |
351 | drm_framebuffer_cleanup(&rfb->base); | 344 | drm_framebuffer_cleanup(&rfb->base); |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index c578f265b24c..d1e595d91723 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -201,11 +201,11 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data, | |||
201 | return r; | 201 | return r; |
202 | } | 202 | } |
203 | r = drm_gem_handle_create(filp, gobj, &handle); | 203 | r = drm_gem_handle_create(filp, gobj, &handle); |
204 | /* drop reference from allocate - handle holds it now */ | ||
205 | drm_gem_object_unreference_unlocked(gobj); | ||
204 | if (r) { | 206 | if (r) { |
205 | drm_gem_object_unreference_unlocked(gobj); | ||
206 | return r; | 207 | return r; |
207 | } | 208 | } |
208 | drm_gem_object_handle_unreference_unlocked(gobj); | ||
209 | args->handle = handle; | 209 | args->handle = handle; |
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 0afd1e62347d..b3b5306bb578 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -69,7 +69,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) | |||
69 | u32 c = 0; | 69 | u32 c = 0; |
70 | 70 | ||
71 | rbo->placement.fpfn = 0; | 71 | rbo->placement.fpfn = 0; |
72 | rbo->placement.lpfn = 0; | 72 | rbo->placement.lpfn = rbo->rdev->mc.active_vram_size >> PAGE_SHIFT; |
73 | rbo->placement.placement = rbo->placements; | 73 | rbo->placement.placement = rbo->placements; |
74 | rbo->placement.busy_placement = rbo->placements; | 74 | rbo->placement.busy_placement = rbo->placements; |
75 | if (domain & RADEON_GEM_DOMAIN_VRAM) | 75 | if (domain & RADEON_GEM_DOMAIN_VRAM) |
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 353998dc2c03..3481bc7f6f58 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h | |||
@@ -124,11 +124,8 @@ static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, | |||
124 | int r; | 124 | int r; |
125 | 125 | ||
126 | r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0); | 126 | r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0); |
127 | if (unlikely(r != 0)) { | 127 | if (unlikely(r != 0)) |
128 | if (r != -ERESTARTSYS) | ||
129 | dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo); | ||
130 | return r; | 128 | return r; |
131 | } | ||
132 | spin_lock(&bo->tbo.lock); | 129 | spin_lock(&bo->tbo.lock); |
133 | if (mem_type) | 130 | if (mem_type) |
134 | *mem_type = bo->tbo.mem.mem_type; | 131 | *mem_type = bo->tbo.mem.mem_type; |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index cc05b230d7ef..51d5f7b5ab21 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -693,6 +693,7 @@ void rs600_mc_init(struct radeon_device *rdev) | |||
693 | rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); | 693 | rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); |
694 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; | 694 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; |
695 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 695 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
696 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
696 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | 697 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
697 | base = RREG32_MC(R_000004_MC_FB_LOCATION); | 698 | base = RREG32_MC(R_000004_MC_FB_LOCATION); |
698 | base = G_000004_MC_FB_START(base) << 16; | 699 | base = G_000004_MC_FB_START(base) << 16; |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 3e3f75718be3..4dc2a87ea680 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -157,6 +157,7 @@ void rs690_mc_init(struct radeon_device *rdev) | |||
157 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); | 157 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); |
158 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); | 158 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); |
159 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 159 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
160 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
160 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); | 161 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); |
161 | base = G_000100_MC_FB_START(base) << 16; | 162 | base = G_000100_MC_FB_START(base) << 16; |
162 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | 163 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index bfa59db374d2..9490da700749 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -267,6 +267,7 @@ static void rv770_mc_program(struct radeon_device *rdev) | |||
267 | */ | 267 | */ |
268 | void r700_cp_stop(struct radeon_device *rdev) | 268 | void r700_cp_stop(struct radeon_device *rdev) |
269 | { | 269 | { |
270 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
270 | WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); | 271 | WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); |
271 | } | 272 | } |
272 | 273 | ||
@@ -992,6 +993,7 @@ int rv770_mc_init(struct radeon_device *rdev) | |||
992 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); | 993 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); |
993 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); | 994 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); |
994 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 995 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
996 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
995 | r600_vram_gtt_location(rdev, &rdev->mc); | 997 | r600_vram_gtt_location(rdev, &rdev->mc); |
996 | radeon_update_bandwidth_info(rdev); | 998 | radeon_update_bandwidth_info(rdev); |
997 | 999 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index cb4cf7ef4d1e..db809e034cc4 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -442,6 +442,43 @@ out_err: | |||
442 | } | 442 | } |
443 | 443 | ||
444 | /** | 444 | /** |
445 | * Call bo::reserved and with the lru lock held. | ||
446 | * Will release GPU memory type usage on destruction. | ||
447 | * This is the place to put in driver specific hooks. | ||
448 | * Will release the bo::reserved lock and the | ||
449 | * lru lock on exit. | ||
450 | */ | ||
451 | |||
452 | static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) | ||
453 | { | ||
454 | struct ttm_bo_global *glob = bo->glob; | ||
455 | |||
456 | if (bo->ttm) { | ||
457 | |||
458 | /** | ||
459 | * Release the lru_lock, since we don't want to have | ||
460 | * an atomic requirement on ttm_tt[unbind|destroy]. | ||
461 | */ | ||
462 | |||
463 | spin_unlock(&glob->lru_lock); | ||
464 | ttm_tt_unbind(bo->ttm); | ||
465 | ttm_tt_destroy(bo->ttm); | ||
466 | bo->ttm = NULL; | ||
467 | spin_lock(&glob->lru_lock); | ||
468 | } | ||
469 | |||
470 | if (bo->mem.mm_node) { | ||
471 | drm_mm_put_block(bo->mem.mm_node); | ||
472 | bo->mem.mm_node = NULL; | ||
473 | } | ||
474 | |||
475 | atomic_set(&bo->reserved, 0); | ||
476 | wake_up_all(&bo->event_queue); | ||
477 | spin_unlock(&glob->lru_lock); | ||
478 | } | ||
479 | |||
480 | |||
481 | /** | ||
445 | * If bo idle, remove from delayed- and lru lists, and unref. | 482 | * If bo idle, remove from delayed- and lru lists, and unref. |
446 | * If not idle, and already on delayed list, do nothing. | 483 | * If not idle, and already on delayed list, do nothing. |
447 | * If not idle, and not on delayed list, put on delayed list, | 484 | * If not idle, and not on delayed list, put on delayed list, |
@@ -456,6 +493,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) | |||
456 | int ret; | 493 | int ret; |
457 | 494 | ||
458 | spin_lock(&bo->lock); | 495 | spin_lock(&bo->lock); |
496 | retry: | ||
459 | (void) ttm_bo_wait(bo, false, false, !remove_all); | 497 | (void) ttm_bo_wait(bo, false, false, !remove_all); |
460 | 498 | ||
461 | if (!bo->sync_obj) { | 499 | if (!bo->sync_obj) { |
@@ -464,31 +502,52 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) | |||
464 | spin_unlock(&bo->lock); | 502 | spin_unlock(&bo->lock); |
465 | 503 | ||
466 | spin_lock(&glob->lru_lock); | 504 | spin_lock(&glob->lru_lock); |
467 | put_count = ttm_bo_del_from_lru(bo); | 505 | ret = ttm_bo_reserve_locked(bo, false, !remove_all, false, 0); |
506 | |||
507 | /** | ||
508 | * Someone else has the object reserved. Bail and retry. | ||
509 | */ | ||
468 | 510 | ||
469 | ret = ttm_bo_reserve_locked(bo, false, false, false, 0); | 511 | if (unlikely(ret == -EBUSY)) { |
470 | BUG_ON(ret); | 512 | spin_unlock(&glob->lru_lock); |
471 | if (bo->ttm) | 513 | spin_lock(&bo->lock); |
472 | ttm_tt_unbind(bo->ttm); | 514 | goto requeue; |
515 | } | ||
516 | |||
517 | /** | ||
518 | * We can re-check for sync object without taking | ||
519 | * the bo::lock since setting the sync object requires | ||
520 | * also bo::reserved. A busy object at this point may | ||
521 | * be caused by another thread starting an accelerated | ||
522 | * eviction. | ||
523 | */ | ||
524 | |||
525 | if (unlikely(bo->sync_obj)) { | ||
526 | atomic_set(&bo->reserved, 0); | ||
527 | wake_up_all(&bo->event_queue); | ||
528 | spin_unlock(&glob->lru_lock); | ||
529 | spin_lock(&bo->lock); | ||
530 | if (remove_all) | ||
531 | goto retry; | ||
532 | else | ||
533 | goto requeue; | ||
534 | } | ||
535 | |||
536 | put_count = ttm_bo_del_from_lru(bo); | ||
473 | 537 | ||
474 | if (!list_empty(&bo->ddestroy)) { | 538 | if (!list_empty(&bo->ddestroy)) { |
475 | list_del_init(&bo->ddestroy); | 539 | list_del_init(&bo->ddestroy); |
476 | ++put_count; | 540 | ++put_count; |
477 | } | 541 | } |
478 | if (bo->mem.mm_node) { | ||
479 | drm_mm_put_block(bo->mem.mm_node); | ||
480 | bo->mem.mm_node = NULL; | ||
481 | } | ||
482 | spin_unlock(&glob->lru_lock); | ||
483 | 542 | ||
484 | atomic_set(&bo->reserved, 0); | 543 | ttm_bo_cleanup_memtype_use(bo); |
485 | 544 | ||
486 | while (put_count--) | 545 | while (put_count--) |
487 | kref_put(&bo->list_kref, ttm_bo_ref_bug); | 546 | kref_put(&bo->list_kref, ttm_bo_ref_bug); |
488 | 547 | ||
489 | return 0; | 548 | return 0; |
490 | } | 549 | } |
491 | 550 | requeue: | |
492 | spin_lock(&glob->lru_lock); | 551 | spin_lock(&glob->lru_lock); |
493 | if (list_empty(&bo->ddestroy)) { | 552 | if (list_empty(&bo->ddestroy)) { |
494 | void *sync_obj = bo->sync_obj; | 553 | void *sync_obj = bo->sync_obj; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 72ec2e2b6e97..a96ed6d9d010 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -148,13 +148,16 @@ static struct pci_device_id vmw_pci_id_list[] = { | |||
148 | {0, 0, 0} | 148 | {0, 0, 0} |
149 | }; | 149 | }; |
150 | 150 | ||
151 | static char *vmw_devname = "vmwgfx"; | 151 | static int enable_fbdev; |
152 | 152 | ||
153 | static int vmw_probe(struct pci_dev *, const struct pci_device_id *); | 153 | static int vmw_probe(struct pci_dev *, const struct pci_device_id *); |
154 | static void vmw_master_init(struct vmw_master *); | 154 | static void vmw_master_init(struct vmw_master *); |
155 | static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, | 155 | static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, |
156 | void *ptr); | 156 | void *ptr); |
157 | 157 | ||
158 | MODULE_PARM_DESC(enable_fbdev, "Enable vmwgfx fbdev"); | ||
159 | module_param_named(enable_fbdev, enable_fbdev, int, 0600); | ||
160 | |||
158 | static void vmw_print_capabilities(uint32_t capabilities) | 161 | static void vmw_print_capabilities(uint32_t capabilities) |
159 | { | 162 | { |
160 | DRM_INFO("Capabilities:\n"); | 163 | DRM_INFO("Capabilities:\n"); |
@@ -192,8 +195,6 @@ static int vmw_request_device(struct vmw_private *dev_priv) | |||
192 | { | 195 | { |
193 | int ret; | 196 | int ret; |
194 | 197 | ||
195 | vmw_kms_save_vga(dev_priv); | ||
196 | |||
197 | ret = vmw_fifo_init(dev_priv, &dev_priv->fifo); | 198 | ret = vmw_fifo_init(dev_priv, &dev_priv->fifo); |
198 | if (unlikely(ret != 0)) { | 199 | if (unlikely(ret != 0)) { |
199 | DRM_ERROR("Unable to initialize FIFO.\n"); | 200 | DRM_ERROR("Unable to initialize FIFO.\n"); |
@@ -206,9 +207,35 @@ static int vmw_request_device(struct vmw_private *dev_priv) | |||
206 | static void vmw_release_device(struct vmw_private *dev_priv) | 207 | static void vmw_release_device(struct vmw_private *dev_priv) |
207 | { | 208 | { |
208 | vmw_fifo_release(dev_priv, &dev_priv->fifo); | 209 | vmw_fifo_release(dev_priv, &dev_priv->fifo); |
209 | vmw_kms_restore_vga(dev_priv); | ||
210 | } | 210 | } |
211 | 211 | ||
212 | int vmw_3d_resource_inc(struct vmw_private *dev_priv) | ||
213 | { | ||
214 | int ret = 0; | ||
215 | |||
216 | mutex_lock(&dev_priv->release_mutex); | ||
217 | if (unlikely(dev_priv->num_3d_resources++ == 0)) { | ||
218 | ret = vmw_request_device(dev_priv); | ||
219 | if (unlikely(ret != 0)) | ||
220 | --dev_priv->num_3d_resources; | ||
221 | } | ||
222 | mutex_unlock(&dev_priv->release_mutex); | ||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | |||
227 | void vmw_3d_resource_dec(struct vmw_private *dev_priv) | ||
228 | { | ||
229 | int32_t n3d; | ||
230 | |||
231 | mutex_lock(&dev_priv->release_mutex); | ||
232 | if (unlikely(--dev_priv->num_3d_resources == 0)) | ||
233 | vmw_release_device(dev_priv); | ||
234 | n3d = (int32_t) dev_priv->num_3d_resources; | ||
235 | mutex_unlock(&dev_priv->release_mutex); | ||
236 | |||
237 | BUG_ON(n3d < 0); | ||
238 | } | ||
212 | 239 | ||
213 | static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | 240 | static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) |
214 | { | 241 | { |
@@ -228,6 +255,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
228 | dev_priv->last_read_sequence = (uint32_t) -100; | 255 | dev_priv->last_read_sequence = (uint32_t) -100; |
229 | mutex_init(&dev_priv->hw_mutex); | 256 | mutex_init(&dev_priv->hw_mutex); |
230 | mutex_init(&dev_priv->cmdbuf_mutex); | 257 | mutex_init(&dev_priv->cmdbuf_mutex); |
258 | mutex_init(&dev_priv->release_mutex); | ||
231 | rwlock_init(&dev_priv->resource_lock); | 259 | rwlock_init(&dev_priv->resource_lock); |
232 | idr_init(&dev_priv->context_idr); | 260 | idr_init(&dev_priv->context_idr); |
233 | idr_init(&dev_priv->surface_idr); | 261 | idr_init(&dev_priv->surface_idr); |
@@ -244,6 +272,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
244 | dev_priv->vram_start = pci_resource_start(dev->pdev, 1); | 272 | dev_priv->vram_start = pci_resource_start(dev->pdev, 1); |
245 | dev_priv->mmio_start = pci_resource_start(dev->pdev, 2); | 273 | dev_priv->mmio_start = pci_resource_start(dev->pdev, 2); |
246 | 274 | ||
275 | dev_priv->enable_fb = enable_fbdev; | ||
276 | |||
247 | mutex_lock(&dev_priv->hw_mutex); | 277 | mutex_lock(&dev_priv->hw_mutex); |
248 | 278 | ||
249 | vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); | 279 | vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); |
@@ -343,17 +373,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
343 | 373 | ||
344 | dev->dev_private = dev_priv; | 374 | dev->dev_private = dev_priv; |
345 | 375 | ||
346 | if (!dev->devname) | ||
347 | dev->devname = vmw_devname; | ||
348 | |||
349 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { | ||
350 | ret = drm_irq_install(dev); | ||
351 | if (unlikely(ret != 0)) { | ||
352 | DRM_ERROR("Failed installing irq: %d\n", ret); | ||
353 | goto out_no_irq; | ||
354 | } | ||
355 | } | ||
356 | |||
357 | ret = pci_request_regions(dev->pdev, "vmwgfx probe"); | 376 | ret = pci_request_regions(dev->pdev, "vmwgfx probe"); |
358 | dev_priv->stealth = (ret != 0); | 377 | dev_priv->stealth = (ret != 0); |
359 | if (dev_priv->stealth) { | 378 | if (dev_priv->stealth) { |
@@ -369,26 +388,52 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
369 | goto out_no_device; | 388 | goto out_no_device; |
370 | } | 389 | } |
371 | } | 390 | } |
372 | ret = vmw_request_device(dev_priv); | 391 | ret = vmw_kms_init(dev_priv); |
373 | if (unlikely(ret != 0)) | 392 | if (unlikely(ret != 0)) |
374 | goto out_no_device; | 393 | goto out_no_kms; |
375 | vmw_kms_init(dev_priv); | ||
376 | vmw_overlay_init(dev_priv); | 394 | vmw_overlay_init(dev_priv); |
377 | vmw_fb_init(dev_priv); | 395 | if (dev_priv->enable_fb) { |
396 | ret = vmw_3d_resource_inc(dev_priv); | ||
397 | if (unlikely(ret != 0)) | ||
398 | goto out_no_fifo; | ||
399 | vmw_kms_save_vga(dev_priv); | ||
400 | vmw_fb_init(dev_priv); | ||
401 | DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ? | ||
402 | "Detected device 3D availability.\n" : | ||
403 | "Detected no device 3D availability.\n"); | ||
404 | } else { | ||
405 | DRM_INFO("Delayed 3D detection since we're not " | ||
406 | "running the device in SVGA mode yet.\n"); | ||
407 | } | ||
408 | |||
409 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { | ||
410 | ret = drm_irq_install(dev); | ||
411 | if (unlikely(ret != 0)) { | ||
412 | DRM_ERROR("Failed installing irq: %d\n", ret); | ||
413 | goto out_no_irq; | ||
414 | } | ||
415 | } | ||
378 | 416 | ||
379 | dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier; | 417 | dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier; |
380 | register_pm_notifier(&dev_priv->pm_nb); | 418 | register_pm_notifier(&dev_priv->pm_nb); |
381 | 419 | ||
382 | DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ? "Have 3D\n" : "No 3D\n"); | ||
383 | |||
384 | return 0; | 420 | return 0; |
385 | 421 | ||
386 | out_no_device: | ||
387 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | ||
388 | drm_irq_uninstall(dev_priv->dev); | ||
389 | if (dev->devname == vmw_devname) | ||
390 | dev->devname = NULL; | ||
391 | out_no_irq: | 422 | out_no_irq: |
423 | if (dev_priv->enable_fb) { | ||
424 | vmw_fb_close(dev_priv); | ||
425 | vmw_kms_restore_vga(dev_priv); | ||
426 | vmw_3d_resource_dec(dev_priv); | ||
427 | } | ||
428 | out_no_fifo: | ||
429 | vmw_overlay_close(dev_priv); | ||
430 | vmw_kms_close(dev_priv); | ||
431 | out_no_kms: | ||
432 | if (dev_priv->stealth) | ||
433 | pci_release_region(dev->pdev, 2); | ||
434 | else | ||
435 | pci_release_regions(dev->pdev); | ||
436 | out_no_device: | ||
392 | ttm_object_device_release(&dev_priv->tdev); | 437 | ttm_object_device_release(&dev_priv->tdev); |
393 | out_err4: | 438 | out_err4: |
394 | iounmap(dev_priv->mmio_virt); | 439 | iounmap(dev_priv->mmio_virt); |
@@ -415,19 +460,20 @@ static int vmw_driver_unload(struct drm_device *dev) | |||
415 | 460 | ||
416 | unregister_pm_notifier(&dev_priv->pm_nb); | 461 | unregister_pm_notifier(&dev_priv->pm_nb); |
417 | 462 | ||
418 | vmw_fb_close(dev_priv); | 463 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) |
464 | drm_irq_uninstall(dev_priv->dev); | ||
465 | if (dev_priv->enable_fb) { | ||
466 | vmw_fb_close(dev_priv); | ||
467 | vmw_kms_restore_vga(dev_priv); | ||
468 | vmw_3d_resource_dec(dev_priv); | ||
469 | } | ||
419 | vmw_kms_close(dev_priv); | 470 | vmw_kms_close(dev_priv); |
420 | vmw_overlay_close(dev_priv); | 471 | vmw_overlay_close(dev_priv); |
421 | vmw_release_device(dev_priv); | ||
422 | if (dev_priv->stealth) | 472 | if (dev_priv->stealth) |
423 | pci_release_region(dev->pdev, 2); | 473 | pci_release_region(dev->pdev, 2); |
424 | else | 474 | else |
425 | pci_release_regions(dev->pdev); | 475 | pci_release_regions(dev->pdev); |
426 | 476 | ||
427 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | ||
428 | drm_irq_uninstall(dev_priv->dev); | ||
429 | if (dev->devname == vmw_devname) | ||
430 | dev->devname = NULL; | ||
431 | ttm_object_device_release(&dev_priv->tdev); | 477 | ttm_object_device_release(&dev_priv->tdev); |
432 | iounmap(dev_priv->mmio_virt); | 478 | iounmap(dev_priv->mmio_virt); |
433 | drm_mtrr_del(dev_priv->mmio_mtrr, dev_priv->mmio_start, | 479 | drm_mtrr_del(dev_priv->mmio_mtrr, dev_priv->mmio_start, |
@@ -500,7 +546,7 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd, | |||
500 | struct drm_ioctl_desc *ioctl = | 546 | struct drm_ioctl_desc *ioctl = |
501 | &vmw_ioctls[nr - DRM_COMMAND_BASE]; | 547 | &vmw_ioctls[nr - DRM_COMMAND_BASE]; |
502 | 548 | ||
503 | if (unlikely(ioctl->cmd != cmd)) { | 549 | if (unlikely(ioctl->cmd_drv != cmd)) { |
504 | DRM_ERROR("Invalid command format, ioctl %d\n", | 550 | DRM_ERROR("Invalid command format, ioctl %d\n", |
505 | nr - DRM_COMMAND_BASE); | 551 | nr - DRM_COMMAND_BASE); |
506 | return -EINVAL; | 552 | return -EINVAL; |
@@ -589,6 +635,16 @@ static int vmw_master_set(struct drm_device *dev, | |||
589 | struct vmw_master *vmaster = vmw_master(file_priv->master); | 635 | struct vmw_master *vmaster = vmw_master(file_priv->master); |
590 | int ret = 0; | 636 | int ret = 0; |
591 | 637 | ||
638 | if (!dev_priv->enable_fb) { | ||
639 | ret = vmw_3d_resource_inc(dev_priv); | ||
640 | if (unlikely(ret != 0)) | ||
641 | return ret; | ||
642 | vmw_kms_save_vga(dev_priv); | ||
643 | mutex_lock(&dev_priv->hw_mutex); | ||
644 | vmw_write(dev_priv, SVGA_REG_TRACES, 0); | ||
645 | mutex_unlock(&dev_priv->hw_mutex); | ||
646 | } | ||
647 | |||
592 | if (active) { | 648 | if (active) { |
593 | BUG_ON(active != &dev_priv->fbdev_master); | 649 | BUG_ON(active != &dev_priv->fbdev_master); |
594 | ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile); | 650 | ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile); |
@@ -617,7 +673,13 @@ static int vmw_master_set(struct drm_device *dev, | |||
617 | return 0; | 673 | return 0; |
618 | 674 | ||
619 | out_no_active_lock: | 675 | out_no_active_lock: |
620 | vmw_release_device(dev_priv); | 676 | if (!dev_priv->enable_fb) { |
677 | mutex_lock(&dev_priv->hw_mutex); | ||
678 | vmw_write(dev_priv, SVGA_REG_TRACES, 1); | ||
679 | mutex_unlock(&dev_priv->hw_mutex); | ||
680 | vmw_kms_restore_vga(dev_priv); | ||
681 | vmw_3d_resource_dec(dev_priv); | ||
682 | } | ||
621 | return ret; | 683 | return ret; |
622 | } | 684 | } |
623 | 685 | ||
@@ -645,11 +707,23 @@ static void vmw_master_drop(struct drm_device *dev, | |||
645 | 707 | ||
646 | ttm_lock_set_kill(&vmaster->lock, true, SIGTERM); | 708 | ttm_lock_set_kill(&vmaster->lock, true, SIGTERM); |
647 | 709 | ||
710 | if (!dev_priv->enable_fb) { | ||
711 | ret = ttm_bo_evict_mm(&dev_priv->bdev, TTM_PL_VRAM); | ||
712 | if (unlikely(ret != 0)) | ||
713 | DRM_ERROR("Unable to clean VRAM on master drop.\n"); | ||
714 | mutex_lock(&dev_priv->hw_mutex); | ||
715 | vmw_write(dev_priv, SVGA_REG_TRACES, 1); | ||
716 | mutex_unlock(&dev_priv->hw_mutex); | ||
717 | vmw_kms_restore_vga(dev_priv); | ||
718 | vmw_3d_resource_dec(dev_priv); | ||
719 | } | ||
720 | |||
648 | dev_priv->active_master = &dev_priv->fbdev_master; | 721 | dev_priv->active_master = &dev_priv->fbdev_master; |
649 | ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); | 722 | ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); |
650 | ttm_vt_unlock(&dev_priv->fbdev_master.lock); | 723 | ttm_vt_unlock(&dev_priv->fbdev_master.lock); |
651 | 724 | ||
652 | vmw_fb_on(dev_priv); | 725 | if (dev_priv->enable_fb) |
726 | vmw_fb_on(dev_priv); | ||
653 | } | 727 | } |
654 | 728 | ||
655 | 729 | ||
@@ -722,6 +796,7 @@ static struct drm_driver driver = { | |||
722 | .irq_postinstall = vmw_irq_postinstall, | 796 | .irq_postinstall = vmw_irq_postinstall, |
723 | .irq_uninstall = vmw_irq_uninstall, | 797 | .irq_uninstall = vmw_irq_uninstall, |
724 | .irq_handler = vmw_irq_handler, | 798 | .irq_handler = vmw_irq_handler, |
799 | .get_vblank_counter = vmw_get_vblank_counter, | ||
725 | .reclaim_buffers_locked = NULL, | 800 | .reclaim_buffers_locked = NULL, |
726 | .get_map_ofs = drm_core_get_map_ofs, | 801 | .get_map_ofs = drm_core_get_map_ofs, |
727 | .get_reg_ofs = drm_core_get_reg_ofs, | 802 | .get_reg_ofs = drm_core_get_reg_ofs, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 429f917b60bf..58de6393f611 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -277,6 +277,7 @@ struct vmw_private { | |||
277 | 277 | ||
278 | bool stealth; | 278 | bool stealth; |
279 | bool is_opened; | 279 | bool is_opened; |
280 | bool enable_fb; | ||
280 | 281 | ||
281 | /** | 282 | /** |
282 | * Master management. | 283 | * Master management. |
@@ -285,6 +286,9 @@ struct vmw_private { | |||
285 | struct vmw_master *active_master; | 286 | struct vmw_master *active_master; |
286 | struct vmw_master fbdev_master; | 287 | struct vmw_master fbdev_master; |
287 | struct notifier_block pm_nb; | 288 | struct notifier_block pm_nb; |
289 | |||
290 | struct mutex release_mutex; | ||
291 | uint32_t num_3d_resources; | ||
288 | }; | 292 | }; |
289 | 293 | ||
290 | static inline struct vmw_private *vmw_priv(struct drm_device *dev) | 294 | static inline struct vmw_private *vmw_priv(struct drm_device *dev) |
@@ -319,6 +323,9 @@ static inline uint32_t vmw_read(struct vmw_private *dev_priv, | |||
319 | return val; | 323 | return val; |
320 | } | 324 | } |
321 | 325 | ||
326 | int vmw_3d_resource_inc(struct vmw_private *dev_priv); | ||
327 | void vmw_3d_resource_dec(struct vmw_private *dev_priv); | ||
328 | |||
322 | /** | 329 | /** |
323 | * GMR utilities - vmwgfx_gmr.c | 330 | * GMR utilities - vmwgfx_gmr.c |
324 | */ | 331 | */ |
@@ -511,6 +518,7 @@ void vmw_kms_write_svga(struct vmw_private *vmw_priv, | |||
511 | unsigned bbp, unsigned depth); | 518 | unsigned bbp, unsigned depth); |
512 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | 519 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, |
513 | struct drm_file *file_priv); | 520 | struct drm_file *file_priv); |
521 | u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc); | ||
514 | 522 | ||
515 | /** | 523 | /** |
516 | * Overlay control - vmwgfx_overlay.c | 524 | * Overlay control - vmwgfx_overlay.c |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index 870967a97c15..409e172f4abf 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | |||
@@ -615,6 +615,11 @@ int vmw_dmabuf_to_start_of_vram(struct vmw_private *vmw_priv, | |||
615 | if (unlikely(ret != 0)) | 615 | if (unlikely(ret != 0)) |
616 | goto err_unlock; | 616 | goto err_unlock; |
617 | 617 | ||
618 | if (bo->mem.mem_type == TTM_PL_VRAM && | ||
619 | bo->mem.mm_node->start < bo->num_pages) | ||
620 | (void) ttm_bo_validate(bo, &vmw_sys_placement, false, | ||
621 | false, false); | ||
622 | |||
618 | ret = ttm_bo_validate(bo, &ne_placement, false, false, false); | 623 | ret = ttm_bo_validate(bo, &ne_placement, false, false, false); |
619 | 624 | ||
620 | /* Could probably bug on */ | 625 | /* Could probably bug on */ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index e6a1eb7ea954..0fe31766e4cf 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | |||
@@ -106,6 +106,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) | |||
106 | mutex_lock(&dev_priv->hw_mutex); | 106 | mutex_lock(&dev_priv->hw_mutex); |
107 | dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE); | 107 | dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE); |
108 | dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE); | 108 | dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE); |
109 | dev_priv->traces_state = vmw_read(dev_priv, SVGA_REG_TRACES); | ||
109 | vmw_write(dev_priv, SVGA_REG_ENABLE, 1); | 110 | vmw_write(dev_priv, SVGA_REG_ENABLE, 1); |
110 | 111 | ||
111 | min = 4; | 112 | min = 4; |
@@ -175,6 +176,8 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) | |||
175 | dev_priv->config_done_state); | 176 | dev_priv->config_done_state); |
176 | vmw_write(dev_priv, SVGA_REG_ENABLE, | 177 | vmw_write(dev_priv, SVGA_REG_ENABLE, |
177 | dev_priv->enable_state); | 178 | dev_priv->enable_state); |
179 | vmw_write(dev_priv, SVGA_REG_TRACES, | ||
180 | dev_priv->traces_state); | ||
178 | 181 | ||
179 | mutex_unlock(&dev_priv->hw_mutex); | 182 | mutex_unlock(&dev_priv->hw_mutex); |
180 | vmw_fence_queue_takedown(&fifo->fence_queue); | 183 | vmw_fence_queue_takedown(&fifo->fence_queue); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 64d7f47df868..e882ba099f0c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -898,7 +898,19 @@ int vmw_kms_save_vga(struct vmw_private *vmw_priv) | |||
898 | save->width = vmw_read(vmw_priv, SVGA_REG_DISPLAY_WIDTH); | 898 | save->width = vmw_read(vmw_priv, SVGA_REG_DISPLAY_WIDTH); |
899 | save->height = vmw_read(vmw_priv, SVGA_REG_DISPLAY_HEIGHT); | 899 | save->height = vmw_read(vmw_priv, SVGA_REG_DISPLAY_HEIGHT); |
900 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); | 900 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); |
901 | if (i == 0 && vmw_priv->num_displays == 1 && | ||
902 | save->width == 0 && save->height == 0) { | ||
903 | |||
904 | /* | ||
905 | * It should be fairly safe to assume that these | ||
906 | * values are uninitialized. | ||
907 | */ | ||
908 | |||
909 | save->width = vmw_priv->vga_width - save->pos_x; | ||
910 | save->height = vmw_priv->vga_height - save->pos_y; | ||
911 | } | ||
901 | } | 912 | } |
913 | |||
902 | return 0; | 914 | return 0; |
903 | } | 915 | } |
904 | 916 | ||
@@ -984,3 +996,8 @@ out_unlock: | |||
984 | ttm_read_unlock(&vmaster->lock); | 996 | ttm_read_unlock(&vmaster->lock); |
985 | return ret; | 997 | return ret; |
986 | } | 998 | } |
999 | |||
1000 | u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc) | ||
1001 | { | ||
1002 | return 0; | ||
1003 | } | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index 7083b1a24df3..11cb39e3accb 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | #include "vmwgfx_kms.h" | 28 | #include "vmwgfx_kms.h" |
29 | 29 | ||
30 | #define VMWGFX_LDU_NUM_DU 8 | ||
31 | |||
30 | #define vmw_crtc_to_ldu(x) \ | 32 | #define vmw_crtc_to_ldu(x) \ |
31 | container_of(x, struct vmw_legacy_display_unit, base.crtc) | 33 | container_of(x, struct vmw_legacy_display_unit, base.crtc) |
32 | #define vmw_encoder_to_ldu(x) \ | 34 | #define vmw_encoder_to_ldu(x) \ |
@@ -536,6 +538,10 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) | |||
536 | 538 | ||
537 | int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv) | 539 | int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv) |
538 | { | 540 | { |
541 | struct drm_device *dev = dev_priv->dev; | ||
542 | int i; | ||
543 | int ret; | ||
544 | |||
539 | if (dev_priv->ldu_priv) { | 545 | if (dev_priv->ldu_priv) { |
540 | DRM_INFO("ldu system already on\n"); | 546 | DRM_INFO("ldu system already on\n"); |
541 | return -EINVAL; | 547 | return -EINVAL; |
@@ -553,23 +559,24 @@ int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv) | |||
553 | 559 | ||
554 | drm_mode_create_dirty_info_property(dev_priv->dev); | 560 | drm_mode_create_dirty_info_property(dev_priv->dev); |
555 | 561 | ||
556 | vmw_ldu_init(dev_priv, 0); | ||
557 | /* for old hardware without multimon only enable one display */ | ||
558 | if (dev_priv->capabilities & SVGA_CAP_MULTIMON) { | 562 | if (dev_priv->capabilities & SVGA_CAP_MULTIMON) { |
559 | vmw_ldu_init(dev_priv, 1); | 563 | for (i = 0; i < VMWGFX_LDU_NUM_DU; ++i) |
560 | vmw_ldu_init(dev_priv, 2); | 564 | vmw_ldu_init(dev_priv, i); |
561 | vmw_ldu_init(dev_priv, 3); | 565 | ret = drm_vblank_init(dev, VMWGFX_LDU_NUM_DU); |
562 | vmw_ldu_init(dev_priv, 4); | 566 | } else { |
563 | vmw_ldu_init(dev_priv, 5); | 567 | /* for old hardware without multimon only enable one display */ |
564 | vmw_ldu_init(dev_priv, 6); | 568 | vmw_ldu_init(dev_priv, 0); |
565 | vmw_ldu_init(dev_priv, 7); | 569 | ret = drm_vblank_init(dev, 1); |
566 | } | 570 | } |
567 | 571 | ||
568 | return 0; | 572 | return ret; |
569 | } | 573 | } |
570 | 574 | ||
571 | int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv) | 575 | int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv) |
572 | { | 576 | { |
577 | struct drm_device *dev = dev_priv->dev; | ||
578 | |||
579 | drm_vblank_cleanup(dev); | ||
573 | if (!dev_priv->ldu_priv) | 580 | if (!dev_priv->ldu_priv) |
574 | return -ENOSYS; | 581 | return -ENOSYS; |
575 | 582 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 5f2d5df01e5c..c8c40e9979db 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -211,6 +211,7 @@ static void vmw_hw_context_destroy(struct vmw_resource *res) | |||
211 | cmd->body.cid = cpu_to_le32(res->id); | 211 | cmd->body.cid = cpu_to_le32(res->id); |
212 | 212 | ||
213 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 213 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
214 | vmw_3d_resource_dec(dev_priv); | ||
214 | } | 215 | } |
215 | 216 | ||
216 | static int vmw_context_init(struct vmw_private *dev_priv, | 217 | static int vmw_context_init(struct vmw_private *dev_priv, |
@@ -247,6 +248,7 @@ static int vmw_context_init(struct vmw_private *dev_priv, | |||
247 | cmd->body.cid = cpu_to_le32(res->id); | 248 | cmd->body.cid = cpu_to_le32(res->id); |
248 | 249 | ||
249 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 250 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
251 | (void) vmw_3d_resource_inc(dev_priv); | ||
250 | vmw_resource_activate(res, vmw_hw_context_destroy); | 252 | vmw_resource_activate(res, vmw_hw_context_destroy); |
251 | return 0; | 253 | return 0; |
252 | } | 254 | } |
@@ -406,6 +408,7 @@ static void vmw_hw_surface_destroy(struct vmw_resource *res) | |||
406 | cmd->body.sid = cpu_to_le32(res->id); | 408 | cmd->body.sid = cpu_to_le32(res->id); |
407 | 409 | ||
408 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 410 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
411 | vmw_3d_resource_dec(dev_priv); | ||
409 | } | 412 | } |
410 | 413 | ||
411 | void vmw_surface_res_free(struct vmw_resource *res) | 414 | void vmw_surface_res_free(struct vmw_resource *res) |
@@ -473,6 +476,7 @@ int vmw_surface_init(struct vmw_private *dev_priv, | |||
473 | } | 476 | } |
474 | 477 | ||
475 | vmw_fifo_commit(dev_priv, submit_size); | 478 | vmw_fifo_commit(dev_priv, submit_size); |
479 | (void) vmw_3d_resource_inc(dev_priv); | ||
476 | vmw_resource_activate(res, vmw_hw_surface_destroy); | 480 | vmw_resource_activate(res, vmw_hw_surface_destroy); |
477 | return 0; | 481 | return 0; |
478 | } | 482 | } |
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 537841ef44b9..75afb3b0e076 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -111,7 +111,7 @@ static struct platform_device *f71882fg_pdev; | |||
111 | /* Super-I/O Function prototypes */ | 111 | /* Super-I/O Function prototypes */ |
112 | static inline int superio_inb(int base, int reg); | 112 | static inline int superio_inb(int base, int reg); |
113 | static inline int superio_inw(int base, int reg); | 113 | static inline int superio_inw(int base, int reg); |
114 | static inline void superio_enter(int base); | 114 | static inline int superio_enter(int base); |
115 | static inline void superio_select(int base, int ld); | 115 | static inline void superio_select(int base, int ld); |
116 | static inline void superio_exit(int base); | 116 | static inline void superio_exit(int base); |
117 | 117 | ||
@@ -861,11 +861,20 @@ static int superio_inw(int base, int reg) | |||
861 | return val; | 861 | return val; |
862 | } | 862 | } |
863 | 863 | ||
864 | static inline void superio_enter(int base) | 864 | static inline int superio_enter(int base) |
865 | { | 865 | { |
866 | /* Don't step on other drivers' I/O space by accident */ | ||
867 | if (!request_muxed_region(base, 2, DRVNAME)) { | ||
868 | printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n", | ||
869 | base); | ||
870 | return -EBUSY; | ||
871 | } | ||
872 | |||
866 | /* according to the datasheet the key must be send twice! */ | 873 | /* according to the datasheet the key must be send twice! */ |
867 | outb(SIO_UNLOCK_KEY, base); | 874 | outb(SIO_UNLOCK_KEY, base); |
868 | outb(SIO_UNLOCK_KEY, base); | 875 | outb(SIO_UNLOCK_KEY, base); |
876 | |||
877 | return 0; | ||
869 | } | 878 | } |
870 | 879 | ||
871 | static inline void superio_select(int base, int ld) | 880 | static inline void superio_select(int base, int ld) |
@@ -877,6 +886,7 @@ static inline void superio_select(int base, int ld) | |||
877 | static inline void superio_exit(int base) | 886 | static inline void superio_exit(int base) |
878 | { | 887 | { |
879 | outb(SIO_LOCK_KEY, base); | 888 | outb(SIO_LOCK_KEY, base); |
889 | release_region(base, 2); | ||
880 | } | 890 | } |
881 | 891 | ||
882 | static inline int fan_from_reg(u16 reg) | 892 | static inline int fan_from_reg(u16 reg) |
@@ -2175,21 +2185,15 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2175 | static int __init f71882fg_find(int sioaddr, unsigned short *address, | 2185 | static int __init f71882fg_find(int sioaddr, unsigned short *address, |
2176 | struct f71882fg_sio_data *sio_data) | 2186 | struct f71882fg_sio_data *sio_data) |
2177 | { | 2187 | { |
2178 | int err = -ENODEV; | ||
2179 | u16 devid; | 2188 | u16 devid; |
2180 | 2189 | int err = superio_enter(sioaddr); | |
2181 | /* Don't step on other drivers' I/O space by accident */ | 2190 | if (err) |
2182 | if (!request_region(sioaddr, 2, DRVNAME)) { | 2191 | return err; |
2183 | printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n", | ||
2184 | (int)sioaddr); | ||
2185 | return -EBUSY; | ||
2186 | } | ||
2187 | |||
2188 | superio_enter(sioaddr); | ||
2189 | 2192 | ||
2190 | devid = superio_inw(sioaddr, SIO_REG_MANID); | 2193 | devid = superio_inw(sioaddr, SIO_REG_MANID); |
2191 | if (devid != SIO_FINTEK_ID) { | 2194 | if (devid != SIO_FINTEK_ID) { |
2192 | pr_debug(DRVNAME ": Not a Fintek device\n"); | 2195 | pr_debug(DRVNAME ": Not a Fintek device\n"); |
2196 | err = -ENODEV; | ||
2193 | goto exit; | 2197 | goto exit; |
2194 | } | 2198 | } |
2195 | 2199 | ||
@@ -2213,6 +2217,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2213 | default: | 2217 | default: |
2214 | printk(KERN_INFO DRVNAME ": Unsupported Fintek device: %04x\n", | 2218 | printk(KERN_INFO DRVNAME ": Unsupported Fintek device: %04x\n", |
2215 | (unsigned int)devid); | 2219 | (unsigned int)devid); |
2220 | err = -ENODEV; | ||
2216 | goto exit; | 2221 | goto exit; |
2217 | } | 2222 | } |
2218 | 2223 | ||
@@ -2223,12 +2228,14 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2223 | 2228 | ||
2224 | if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { | 2229 | if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { |
2225 | printk(KERN_WARNING DRVNAME ": Device not activated\n"); | 2230 | printk(KERN_WARNING DRVNAME ": Device not activated\n"); |
2231 | err = -ENODEV; | ||
2226 | goto exit; | 2232 | goto exit; |
2227 | } | 2233 | } |
2228 | 2234 | ||
2229 | *address = superio_inw(sioaddr, SIO_REG_ADDR); | 2235 | *address = superio_inw(sioaddr, SIO_REG_ADDR); |
2230 | if (*address == 0) { | 2236 | if (*address == 0) { |
2231 | printk(KERN_WARNING DRVNAME ": Base address not set\n"); | 2237 | printk(KERN_WARNING DRVNAME ": Base address not set\n"); |
2238 | err = -ENODEV; | ||
2232 | goto exit; | 2239 | goto exit; |
2233 | } | 2240 | } |
2234 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ | 2241 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ |
@@ -2239,7 +2246,6 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2239 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); | 2246 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); |
2240 | exit: | 2247 | exit: |
2241 | superio_exit(sioaddr); | 2248 | superio_exit(sioaddr); |
2242 | release_region(sioaddr, 2); | ||
2243 | return err; | 2249 | return err; |
2244 | } | 2250 | } |
2245 | 2251 | ||
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index f7bd2613cecc..f2de3be35df3 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -677,6 +677,11 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev, | |||
677 | dev_dbg(&ofdev->dev, "hw routines for %s registered.\n", | 677 | dev_dbg(&ofdev->dev, "hw routines for %s registered.\n", |
678 | cpm->adap.name); | 678 | cpm->adap.name); |
679 | 679 | ||
680 | /* | ||
681 | * register OF I2C devices | ||
682 | */ | ||
683 | of_i2c_register_devices(&cpm->adap); | ||
684 | |||
680 | return 0; | 685 | return 0; |
681 | out_shut: | 686 | out_shut: |
682 | cpm_i2c_shutdown(cpm); | 687 | cpm_i2c_shutdown(cpm); |
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 2222c87876b9..b8feac5f2ef4 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -357,9 +357,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
357 | 357 | ||
358 | dev->terminate = 0; | 358 | dev->terminate = 0; |
359 | 359 | ||
360 | /* write the data into mode register */ | ||
361 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); | ||
362 | |||
363 | /* | 360 | /* |
364 | * First byte should be set here, not after interrupt, | 361 | * First byte should be set here, not after interrupt, |
365 | * because transmit-data-ready interrupt can come before | 362 | * because transmit-data-ready interrupt can come before |
@@ -371,6 +368,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
371 | dev->buf_len--; | 368 | dev->buf_len--; |
372 | } | 369 | } |
373 | 370 | ||
371 | /* write the data into mode register; start transmitting */ | ||
372 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); | ||
373 | |||
374 | r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, | 374 | r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, |
375 | dev->adapter.timeout); | 375 | dev->adapter.timeout); |
376 | if (r == 0) { | 376 | if (r == 0) { |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 43ca32fddde2..89eedf45d30e 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -761,6 +761,9 @@ static int __devinit iic_probe(struct platform_device *ofdev, | |||
761 | dev_info(&ofdev->dev, "using %s mode\n", | 761 | dev_info(&ofdev->dev, "using %s mode\n", |
762 | dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); | 762 | dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); |
763 | 763 | ||
764 | /* Now register all the child nodes */ | ||
765 | of_i2c_register_devices(adap); | ||
766 | |||
764 | return 0; | 767 | return 0; |
765 | 768 | ||
766 | error_cleanup: | 769 | error_cleanup: |
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index a1c419a716af..b74e6dc6886c 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -632,6 +632,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op, | |||
632 | dev_err(i2c->dev, "failed to add adapter\n"); | 632 | dev_err(i2c->dev, "failed to add adapter\n"); |
633 | goto fail_add; | 633 | goto fail_add; |
634 | } | 634 | } |
635 | of_i2c_register_devices(&i2c->adap); | ||
635 | 636 | ||
636 | return result; | 637 | return result; |
637 | 638 | ||
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c index 0e9f85d0a835..56dbe54e8811 100644 --- a/drivers/i2c/busses/i2c-octeon.c +++ b/drivers/i2c/busses/i2c-octeon.c | |||
@@ -218,7 +218,7 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c) | |||
218 | return result; | 218 | return result; |
219 | } else if (result == 0) { | 219 | } else if (result == 0) { |
220 | dev_dbg(i2c->dev, "%s: timeout\n", __func__); | 220 | dev_dbg(i2c->dev, "%s: timeout\n", __func__); |
221 | result = -ETIMEDOUT; | 221 | return -ETIMEDOUT; |
222 | } | 222 | } |
223 | 223 | ||
224 | return 0; | 224 | return 0; |
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index bbd77603a417..29933f87d8fa 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
@@ -71,8 +71,8 @@ static int pca_isa_readbyte(void *pd, int reg) | |||
71 | 71 | ||
72 | static int pca_isa_waitforcompletion(void *pd) | 72 | static int pca_isa_waitforcompletion(void *pd) |
73 | { | 73 | { |
74 | long ret = ~0; | ||
75 | unsigned long timeout; | 74 | unsigned long timeout; |
75 | long ret; | ||
76 | 76 | ||
77 | if (irq > -1) { | 77 | if (irq > -1) { |
78 | ret = wait_event_timeout(pca_wait, | 78 | ret = wait_event_timeout(pca_wait, |
@@ -81,11 +81,15 @@ static int pca_isa_waitforcompletion(void *pd) | |||
81 | } else { | 81 | } else { |
82 | /* Do polling */ | 82 | /* Do polling */ |
83 | timeout = jiffies + pca_isa_ops.timeout; | 83 | timeout = jiffies + pca_isa_ops.timeout; |
84 | while (((pca_isa_readbyte(pd, I2C_PCA_CON) | 84 | do { |
85 | & I2C_PCA_CON_SI) == 0) | 85 | ret = time_before(jiffies, timeout); |
86 | && (ret = time_before(jiffies, timeout))) | 86 | if (pca_isa_readbyte(pd, I2C_PCA_CON) |
87 | & I2C_PCA_CON_SI) | ||
88 | break; | ||
87 | udelay(100); | 89 | udelay(100); |
90 | } while (ret); | ||
88 | } | 91 | } |
92 | |||
89 | return ret > 0; | 93 | return ret > 0; |
90 | } | 94 | } |
91 | 95 | ||
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index ef5c78487eb7..5f6d7f89e225 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c | |||
@@ -80,8 +80,8 @@ static void i2c_pca_pf_writebyte32(void *pd, int reg, int val) | |||
80 | static int i2c_pca_pf_waitforcompletion(void *pd) | 80 | static int i2c_pca_pf_waitforcompletion(void *pd) |
81 | { | 81 | { |
82 | struct i2c_pca_pf_data *i2c = pd; | 82 | struct i2c_pca_pf_data *i2c = pd; |
83 | long ret = ~0; | ||
84 | unsigned long timeout; | 83 | unsigned long timeout; |
84 | long ret; | ||
85 | 85 | ||
86 | if (i2c->irq) { | 86 | if (i2c->irq) { |
87 | ret = wait_event_timeout(i2c->wait, | 87 | ret = wait_event_timeout(i2c->wait, |
@@ -90,10 +90,13 @@ static int i2c_pca_pf_waitforcompletion(void *pd) | |||
90 | } else { | 90 | } else { |
91 | /* Do polling */ | 91 | /* Do polling */ |
92 | timeout = jiffies + i2c->adap.timeout; | 92 | timeout = jiffies + i2c->adap.timeout; |
93 | while (((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) | 93 | do { |
94 | & I2C_PCA_CON_SI) == 0) | 94 | ret = time_before(jiffies, timeout); |
95 | && (ret = time_before(jiffies, timeout))) | 95 | if (i2c->algo_data.read_byte(i2c, I2C_PCA_CON) |
96 | & I2C_PCA_CON_SI) | ||
97 | break; | ||
96 | udelay(100); | 98 | udelay(100); |
99 | } while (ret); | ||
97 | } | 100 | } |
98 | 101 | ||
99 | return ret > 0; | 102 | return ret > 0; |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 72902e0bbfa7..bf831bf81587 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -662,8 +662,8 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got) | |||
662 | unsigned long sda_delay; | 662 | unsigned long sda_delay; |
663 | 663 | ||
664 | if (pdata->sda_delay) { | 664 | if (pdata->sda_delay) { |
665 | sda_delay = (freq / 1000) * pdata->sda_delay; | 665 | sda_delay = clkin * pdata->sda_delay; |
666 | sda_delay /= 1000000; | 666 | sda_delay = DIV_ROUND_UP(sda_delay, 1000000); |
667 | sda_delay = DIV_ROUND_UP(sda_delay, 5); | 667 | sda_delay = DIV_ROUND_UP(sda_delay, 5); |
668 | if (sda_delay > 3) | 668 | if (sda_delay > 3) |
669 | sda_delay = 3; | 669 | sda_delay = 3; |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 6649176de940..bea4c5021d26 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/idr.h> | 33 | #include <linux/idr.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/of_i2c.h> | ||
36 | #include <linux/of_device.h> | 35 | #include <linux/of_device.h> |
37 | #include <linux/completion.h> | 36 | #include <linux/completion.h> |
38 | #include <linux/hardirq.h> | 37 | #include <linux/hardirq.h> |
@@ -197,11 +196,12 @@ static int i2c_device_pm_suspend(struct device *dev) | |||
197 | { | 196 | { |
198 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 197 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
199 | 198 | ||
200 | if (pm_runtime_suspended(dev)) | 199 | if (pm) { |
201 | return 0; | 200 | if (pm_runtime_suspended(dev)) |
202 | 201 | return 0; | |
203 | if (pm) | 202 | else |
204 | return pm->suspend ? pm->suspend(dev) : 0; | 203 | return pm->suspend ? pm->suspend(dev) : 0; |
204 | } | ||
205 | 205 | ||
206 | return i2c_legacy_suspend(dev, PMSG_SUSPEND); | 206 | return i2c_legacy_suspend(dev, PMSG_SUSPEND); |
207 | } | 207 | } |
@@ -216,12 +216,6 @@ static int i2c_device_pm_resume(struct device *dev) | |||
216 | else | 216 | else |
217 | ret = i2c_legacy_resume(dev); | 217 | ret = i2c_legacy_resume(dev); |
218 | 218 | ||
219 | if (!ret) { | ||
220 | pm_runtime_disable(dev); | ||
221 | pm_runtime_set_active(dev); | ||
222 | pm_runtime_enable(dev); | ||
223 | } | ||
224 | |||
225 | return ret; | 219 | return ret; |
226 | } | 220 | } |
227 | 221 | ||
@@ -229,11 +223,12 @@ static int i2c_device_pm_freeze(struct device *dev) | |||
229 | { | 223 | { |
230 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 224 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
231 | 225 | ||
232 | if (pm_runtime_suspended(dev)) | 226 | if (pm) { |
233 | return 0; | 227 | if (pm_runtime_suspended(dev)) |
234 | 228 | return 0; | |
235 | if (pm) | 229 | else |
236 | return pm->freeze ? pm->freeze(dev) : 0; | 230 | return pm->freeze ? pm->freeze(dev) : 0; |
231 | } | ||
237 | 232 | ||
238 | return i2c_legacy_suspend(dev, PMSG_FREEZE); | 233 | return i2c_legacy_suspend(dev, PMSG_FREEZE); |
239 | } | 234 | } |
@@ -242,11 +237,12 @@ static int i2c_device_pm_thaw(struct device *dev) | |||
242 | { | 237 | { |
243 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 238 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
244 | 239 | ||
245 | if (pm_runtime_suspended(dev)) | 240 | if (pm) { |
246 | return 0; | 241 | if (pm_runtime_suspended(dev)) |
247 | 242 | return 0; | |
248 | if (pm) | 243 | else |
249 | return pm->thaw ? pm->thaw(dev) : 0; | 244 | return pm->thaw ? pm->thaw(dev) : 0; |
245 | } | ||
250 | 246 | ||
251 | return i2c_legacy_resume(dev); | 247 | return i2c_legacy_resume(dev); |
252 | } | 248 | } |
@@ -255,11 +251,12 @@ static int i2c_device_pm_poweroff(struct device *dev) | |||
255 | { | 251 | { |
256 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 252 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
257 | 253 | ||
258 | if (pm_runtime_suspended(dev)) | 254 | if (pm) { |
259 | return 0; | 255 | if (pm_runtime_suspended(dev)) |
260 | 256 | return 0; | |
261 | if (pm) | 257 | else |
262 | return pm->poweroff ? pm->poweroff(dev) : 0; | 258 | return pm->poweroff ? pm->poweroff(dev) : 0; |
259 | } | ||
263 | 260 | ||
264 | return i2c_legacy_suspend(dev, PMSG_HIBERNATE); | 261 | return i2c_legacy_suspend(dev, PMSG_HIBERNATE); |
265 | } | 262 | } |
@@ -876,9 +873,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap) | |||
876 | if (adap->nr < __i2c_first_dynamic_bus_num) | 873 | if (adap->nr < __i2c_first_dynamic_bus_num) |
877 | i2c_scan_static_board_info(adap); | 874 | i2c_scan_static_board_info(adap); |
878 | 875 | ||
879 | /* Register devices from the device tree */ | ||
880 | of_i2c_register_devices(adap); | ||
881 | |||
882 | /* Notify drivers */ | 876 | /* Notify drivers */ |
883 | mutex_lock(&core_lock); | 877 | mutex_lock(&core_lock); |
884 | bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter); | 878 | bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter); |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index a10152bb1427..c37ef64d1465 100755..100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -83,7 +83,7 @@ static unsigned int mwait_substates; | |||
83 | /* Reliable LAPIC Timer States, bit 1 for C1 etc. */ | 83 | /* Reliable LAPIC Timer States, bit 1 for C1 etc. */ |
84 | static unsigned int lapic_timer_reliable_states; | 84 | static unsigned int lapic_timer_reliable_states; |
85 | 85 | ||
86 | static struct cpuidle_device *intel_idle_cpuidle_devices; | 86 | static struct cpuidle_device __percpu *intel_idle_cpuidle_devices; |
87 | static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state); | 87 | static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state); |
88 | 88 | ||
89 | static struct cpuidle_state *cpuidle_state_table; | 89 | static struct cpuidle_state *cpuidle_state_table; |
@@ -108,7 +108,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
108 | .name = "NHM-C3", | 108 | .name = "NHM-C3", |
109 | .desc = "MWAIT 0x10", | 109 | .desc = "MWAIT 0x10", |
110 | .driver_data = (void *) 0x10, | 110 | .driver_data = (void *) 0x10, |
111 | .flags = CPUIDLE_FLAG_TIME_VALID, | 111 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
112 | .exit_latency = 20, | 112 | .exit_latency = 20, |
113 | .power_usage = 500, | 113 | .power_usage = 500, |
114 | .target_residency = 80, | 114 | .target_residency = 80, |
@@ -117,7 +117,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
117 | .name = "NHM-C6", | 117 | .name = "NHM-C6", |
118 | .desc = "MWAIT 0x20", | 118 | .desc = "MWAIT 0x20", |
119 | .driver_data = (void *) 0x20, | 119 | .driver_data = (void *) 0x20, |
120 | .flags = CPUIDLE_FLAG_TIME_VALID, | 120 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
121 | .exit_latency = 200, | 121 | .exit_latency = 200, |
122 | .power_usage = 350, | 122 | .power_usage = 350, |
123 | .target_residency = 800, | 123 | .target_residency = 800, |
@@ -149,7 +149,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
149 | .name = "ATM-C4", | 149 | .name = "ATM-C4", |
150 | .desc = "MWAIT 0x30", | 150 | .desc = "MWAIT 0x30", |
151 | .driver_data = (void *) 0x30, | 151 | .driver_data = (void *) 0x30, |
152 | .flags = CPUIDLE_FLAG_TIME_VALID, | 152 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
153 | .exit_latency = 100, | 153 | .exit_latency = 100, |
154 | .power_usage = 250, | 154 | .power_usage = 250, |
155 | .target_residency = 400, | 155 | .target_residency = 400, |
@@ -157,13 +157,13 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
157 | { /* MWAIT C5 */ }, | 157 | { /* MWAIT C5 */ }, |
158 | { /* MWAIT C6 */ | 158 | { /* MWAIT C6 */ |
159 | .name = "ATM-C6", | 159 | .name = "ATM-C6", |
160 | .desc = "MWAIT 0x40", | 160 | .desc = "MWAIT 0x52", |
161 | .driver_data = (void *) 0x40, | 161 | .driver_data = (void *) 0x52, |
162 | .flags = CPUIDLE_FLAG_TIME_VALID, | 162 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
163 | .exit_latency = 200, | 163 | .exit_latency = 140, |
164 | .power_usage = 150, | 164 | .power_usage = 150, |
165 | .target_residency = 800, | 165 | .target_residency = 560, |
166 | .enter = NULL }, /* disabled */ | 166 | .enter = &intel_idle }, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | /** | 169 | /** |
@@ -185,6 +185,16 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state) | |||
185 | 185 | ||
186 | local_irq_disable(); | 186 | local_irq_disable(); |
187 | 187 | ||
188 | /* | ||
189 | * If the state flag indicates that the TLB will be flushed or if this | ||
190 | * is the deepest c-state supported, do a voluntary leave mm to avoid | ||
191 | * costly and mostly unnecessary wakeups for flushing the user TLB's | ||
192 | * associated with the active mm. | ||
193 | */ | ||
194 | if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED || | ||
195 | (&dev->states[dev->state_count - 1] == state)) | ||
196 | leave_mm(cpu); | ||
197 | |||
188 | if (!(lapic_timer_reliable_states & (1 << (cstate)))) | 198 | if (!(lapic_timer_reliable_states & (1 << (cstate)))) |
189 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); | 199 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); |
190 | 200 | ||
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index d85bd8a7967d..22239e988498 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -483,6 +483,9 @@ static int joydev_handle_JSIOCSAXMAP(struct joydev *joydev, | |||
483 | 483 | ||
484 | memcpy(joydev->abspam, abspam, len); | 484 | memcpy(joydev->abspam, abspam, len); |
485 | 485 | ||
486 | for (i = 0; i < joydev->nabs; i++) | ||
487 | joydev->absmap[joydev->abspam[i]] = i; | ||
488 | |||
486 | out: | 489 | out: |
487 | kfree(abspam); | 490 | kfree(abspam); |
488 | return retval; | 491 | return retval; |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 9cc488d21490..aa037fec2f86 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -338,7 +338,7 @@ config KEYBOARD_OPENCORES | |||
338 | 338 | ||
339 | config KEYBOARD_PXA27x | 339 | config KEYBOARD_PXA27x |
340 | tristate "PXA27x/PXA3xx keypad support" | 340 | tristate "PXA27x/PXA3xx keypad support" |
341 | depends on PXA27x || PXA3xx | 341 | depends on PXA27x || PXA3xx || ARCH_MMP |
342 | help | 342 | help |
343 | Enable support for PXA27x/PXA3xx keypad controller. | 343 | Enable support for PXA27x/PXA3xx keypad controller. |
344 | 344 | ||
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index f32404f99189..4b0ec35259a1 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
33 | 33 | ||
34 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
35 | #include <mach/pxa27x_keypad.h> | 35 | #include <plat/pxa27x_keypad.h> |
36 | /* | 36 | /* |
37 | * Keypad Controller registers | 37 | * Keypad Controller registers |
38 | */ | 38 | */ |
@@ -330,11 +330,21 @@ static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad) | |||
330 | keypad->direct_key_state = new_state; | 330 | keypad->direct_key_state = new_state; |
331 | } | 331 | } |
332 | 332 | ||
333 | static void clear_wakeup_event(struct pxa27x_keypad *keypad) | ||
334 | { | ||
335 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; | ||
336 | |||
337 | if (pdata->clear_wakeup_event) | ||
338 | (pdata->clear_wakeup_event)(); | ||
339 | } | ||
340 | |||
333 | static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id) | 341 | static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id) |
334 | { | 342 | { |
335 | struct pxa27x_keypad *keypad = dev_id; | 343 | struct pxa27x_keypad *keypad = dev_id; |
336 | unsigned long kpc = keypad_readl(KPC); | 344 | unsigned long kpc = keypad_readl(KPC); |
337 | 345 | ||
346 | clear_wakeup_event(keypad); | ||
347 | |||
338 | if (kpc & KPC_DI) | 348 | if (kpc & KPC_DI) |
339 | pxa27x_keypad_scan_direct(keypad); | 349 | pxa27x_keypad_scan_direct(keypad); |
340 | 350 | ||
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 0d4266a533a5..360698553eb5 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -404,6 +404,13 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu | |||
404 | retval = uinput_validate_absbits(dev); | 404 | retval = uinput_validate_absbits(dev); |
405 | if (retval < 0) | 405 | if (retval < 0) |
406 | goto exit; | 406 | goto exit; |
407 | if (test_bit(ABS_MT_SLOT, dev->absbit)) { | ||
408 | int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1; | ||
409 | input_mt_create_slots(dev, nslot); | ||
410 | input_set_events_per_packet(dev, 6 * nslot); | ||
411 | } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) { | ||
412 | input_set_events_per_packet(dev, 60); | ||
413 | } | ||
407 | } | 414 | } |
408 | 415 | ||
409 | udev->state = UIST_SETUP_COMPLETE; | 416 | udev->state = UIST_SETUP_COMPLETE; |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 42ba3691d908..b35876ee6908 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -103,27 +103,26 @@ static void wacom_sys_irq(struct urb *urb) | |||
103 | static int wacom_open(struct input_dev *dev) | 103 | static int wacom_open(struct input_dev *dev) |
104 | { | 104 | { |
105 | struct wacom *wacom = input_get_drvdata(dev); | 105 | struct wacom *wacom = input_get_drvdata(dev); |
106 | int retval = 0; | ||
106 | 107 | ||
107 | mutex_lock(&wacom->lock); | 108 | if (usb_autopm_get_interface(wacom->intf) < 0) |
108 | |||
109 | wacom->irq->dev = wacom->usbdev; | ||
110 | |||
111 | if (usb_autopm_get_interface(wacom->intf) < 0) { | ||
112 | mutex_unlock(&wacom->lock); | ||
113 | return -EIO; | 109 | return -EIO; |
114 | } | 110 | |
111 | mutex_lock(&wacom->lock); | ||
115 | 112 | ||
116 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { | 113 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { |
117 | usb_autopm_put_interface(wacom->intf); | 114 | retval = -EIO; |
118 | mutex_unlock(&wacom->lock); | 115 | goto out; |
119 | return -EIO; | ||
120 | } | 116 | } |
121 | 117 | ||
122 | wacom->open = true; | 118 | wacom->open = true; |
123 | wacom->intf->needs_remote_wakeup = 1; | 119 | wacom->intf->needs_remote_wakeup = 1; |
124 | 120 | ||
121 | out: | ||
125 | mutex_unlock(&wacom->lock); | 122 | mutex_unlock(&wacom->lock); |
126 | return 0; | 123 | if (retval) |
124 | usb_autopm_put_interface(wacom->intf); | ||
125 | return retval; | ||
127 | } | 126 | } |
128 | 127 | ||
129 | static void wacom_close(struct input_dev *dev) | 128 | static void wacom_close(struct input_dev *dev) |
@@ -135,6 +134,8 @@ static void wacom_close(struct input_dev *dev) | |||
135 | wacom->open = false; | 134 | wacom->open = false; |
136 | wacom->intf->needs_remote_wakeup = 0; | 135 | wacom->intf->needs_remote_wakeup = 0; |
137 | mutex_unlock(&wacom->lock); | 136 | mutex_unlock(&wacom->lock); |
137 | |||
138 | usb_autopm_put_interface(wacom->intf); | ||
138 | } | 139 | } |
139 | 140 | ||
140 | static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, | 141 | static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 6e29badb969e..47fd7a041c52 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -442,8 +442,10 @@ static void wacom_intuos_general(struct wacom_wac *wacom) | |||
442 | /* general pen packet */ | 442 | /* general pen packet */ |
443 | if ((data[1] & 0xb8) == 0xa0) { | 443 | if ((data[1] & 0xb8) == 0xa0) { |
444 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | 444 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
445 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) | 445 | if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || |
446 | features->type == WACOM_21UX2) { | ||
446 | t = (t << 1) | (data[1] & 1); | 447 | t = (t << 1) | (data[1] & 1); |
448 | } | ||
447 | input_report_abs(input, ABS_PRESSURE, t); | 449 | input_report_abs(input, ABS_PRESSURE, t); |
448 | input_report_abs(input, ABS_TILT_X, | 450 | input_report_abs(input, ABS_TILT_X, |
449 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); | 451 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
diff --git a/drivers/isdn/sc/interrupt.c b/drivers/isdn/sc/interrupt.c index 485be8b1e1b3..f0225bc0f267 100644 --- a/drivers/isdn/sc/interrupt.c +++ b/drivers/isdn/sc/interrupt.c | |||
@@ -112,11 +112,19 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
112 | } | 112 | } |
113 | else if(callid>=0x0000 && callid<=0x7FFF) | 113 | else if(callid>=0x0000 && callid<=0x7FFF) |
114 | { | 114 | { |
115 | int len; | ||
116 | |||
115 | pr_debug("%s: Got Incoming Call\n", | 117 | pr_debug("%s: Got Incoming Call\n", |
116 | sc_adapter[card]->devicename); | 118 | sc_adapter[card]->devicename); |
117 | strcpy(setup.phone,&(rcvmsg.msg_data.byte_array[4])); | 119 | len = strlcpy(setup.phone, &(rcvmsg.msg_data.byte_array[4]), |
118 | strcpy(setup.eazmsn, | 120 | sizeof(setup.phone)); |
119 | sc_adapter[card]->channel[rcvmsg.phy_link_no-1].dn); | 121 | if (len >= sizeof(setup.phone)) |
122 | continue; | ||
123 | len = strlcpy(setup.eazmsn, | ||
124 | sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, | ||
125 | sizeof(setup.eazmsn)); | ||
126 | if (len >= sizeof(setup.eazmsn)) | ||
127 | continue; | ||
120 | setup.si1 = 7; | 128 | setup.si1 = 7; |
121 | setup.si2 = 0; | 129 | setup.si2 = 0; |
122 | setup.plan = 0; | 130 | setup.plan = 0; |
@@ -176,7 +184,9 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
176 | * Handle a GetMyNumber Rsp | 184 | * Handle a GetMyNumber Rsp |
177 | */ | 185 | */ |
178 | if (IS_CE_MESSAGE(rcvmsg,Call,0,GetMyNumber)){ | 186 | if (IS_CE_MESSAGE(rcvmsg,Call,0,GetMyNumber)){ |
179 | strcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no-1].dn,rcvmsg.msg_data.byte_array); | 187 | strlcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, |
188 | rcvmsg.msg_data.byte_array, | ||
189 | sizeof(rcvmsg.msg_data.byte_array)); | ||
180 | continue; | 190 | continue; |
181 | } | 191 | } |
182 | 192 | ||
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index e4112622e5a2..cc2a88d5192f 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -304,13 +304,22 @@ config LEDS_MC13783 | |||
304 | 304 | ||
305 | config LEDS_NS2 | 305 | config LEDS_NS2 |
306 | tristate "LED support for Network Space v2 GPIO LEDs" | 306 | tristate "LED support for Network Space v2 GPIO LEDs" |
307 | depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 | 307 | depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 || D2NET_V2 |
308 | default y | 308 | default y |
309 | help | 309 | help |
310 | This option enable support for the dual-GPIO LED found on the | 310 | This option enable support for the dual-GPIO LED found on the |
311 | Network Space v2 board (and parents). This include Internet Space v2, | 311 | Network Space v2 board (and parents). This include Internet Space v2, |
312 | Network Space (Max) v2 and d2 Network v2 boards. | 312 | Network Space (Max) v2 and d2 Network v2 boards. |
313 | 313 | ||
314 | config LEDS_NETXBIG | ||
315 | tristate "LED support for Big Network series LEDs" | ||
316 | depends on MACH_NET2BIG_V2 || MACH_NET5BIG_V2 | ||
317 | default y | ||
318 | help | ||
319 | This option enable support for LEDs found on the LaCie 2Big | ||
320 | and 5Big Network v2 boards. The LEDs are wired to a CPLD and are | ||
321 | controlled through a GPIO extension bus. | ||
322 | |||
314 | config LEDS_TRIGGERS | 323 | config LEDS_TRIGGERS |
315 | bool "LED Trigger support" | 324 | bool "LED Trigger support" |
316 | help | 325 | help |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 7d6b95831f8e..9c96db40ef6d 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -38,6 +38,7 @@ obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o | |||
38 | obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o | 38 | obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o |
39 | obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o | 39 | obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o |
40 | obj-$(CONFIG_LEDS_NS2) += leds-ns2.o | 40 | obj-$(CONFIG_LEDS_NS2) += leds-ns2.o |
41 | obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o | ||
41 | 42 | ||
42 | # LED SPI Drivers | 43 | # LED SPI Drivers |
43 | obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o | 44 | obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o |
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c new file mode 100644 index 000000000000..f2e51c134399 --- /dev/null +++ b/drivers/leds/leds-netxbig.c | |||
@@ -0,0 +1,449 @@ | |||
1 | /* | ||
2 | * leds-netxbig.c - Driver for the 2Big and 5Big Network series LEDs | ||
3 | * | ||
4 | * Copyright (C) 2010 LaCie | ||
5 | * | ||
6 | * Author: Simon Guinot <sguinot@lacie.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/gpio.h> | ||
30 | #include <linux/leds.h> | ||
31 | #include <mach/leds-netxbig.h> | ||
32 | |||
33 | /* | ||
34 | * GPIO extension bus. | ||
35 | */ | ||
36 | |||
37 | static DEFINE_SPINLOCK(gpio_ext_lock); | ||
38 | |||
39 | static void gpio_ext_set_addr(struct netxbig_gpio_ext *gpio_ext, int addr) | ||
40 | { | ||
41 | int pin; | ||
42 | |||
43 | for (pin = 0; pin < gpio_ext->num_addr; pin++) | ||
44 | gpio_set_value(gpio_ext->addr[pin], (addr >> pin) & 1); | ||
45 | } | ||
46 | |||
47 | static void gpio_ext_set_data(struct netxbig_gpio_ext *gpio_ext, int data) | ||
48 | { | ||
49 | int pin; | ||
50 | |||
51 | for (pin = 0; pin < gpio_ext->num_data; pin++) | ||
52 | gpio_set_value(gpio_ext->data[pin], (data >> pin) & 1); | ||
53 | } | ||
54 | |||
55 | static void gpio_ext_enable_select(struct netxbig_gpio_ext *gpio_ext) | ||
56 | { | ||
57 | /* Enable select is done on the raising edge. */ | ||
58 | gpio_set_value(gpio_ext->enable, 0); | ||
59 | gpio_set_value(gpio_ext->enable, 1); | ||
60 | } | ||
61 | |||
62 | static void gpio_ext_set_value(struct netxbig_gpio_ext *gpio_ext, | ||
63 | int addr, int value) | ||
64 | { | ||
65 | unsigned long flags; | ||
66 | |||
67 | spin_lock_irqsave(&gpio_ext_lock, flags); | ||
68 | gpio_ext_set_addr(gpio_ext, addr); | ||
69 | gpio_ext_set_data(gpio_ext, value); | ||
70 | gpio_ext_enable_select(gpio_ext); | ||
71 | spin_unlock_irqrestore(&gpio_ext_lock, flags); | ||
72 | } | ||
73 | |||
74 | static int __devinit gpio_ext_init(struct netxbig_gpio_ext *gpio_ext) | ||
75 | { | ||
76 | int err; | ||
77 | int i; | ||
78 | |||
79 | if (unlikely(!gpio_ext)) | ||
80 | return -EINVAL; | ||
81 | |||
82 | /* Configure address GPIOs. */ | ||
83 | for (i = 0; i < gpio_ext->num_addr; i++) { | ||
84 | err = gpio_request(gpio_ext->addr[i], "GPIO extension addr"); | ||
85 | if (err) | ||
86 | goto err_free_addr; | ||
87 | err = gpio_direction_output(gpio_ext->addr[i], 0); | ||
88 | if (err) { | ||
89 | gpio_free(gpio_ext->addr[i]); | ||
90 | goto err_free_addr; | ||
91 | } | ||
92 | } | ||
93 | /* Configure data GPIOs. */ | ||
94 | for (i = 0; i < gpio_ext->num_data; i++) { | ||
95 | err = gpio_request(gpio_ext->data[i], "GPIO extension data"); | ||
96 | if (err) | ||
97 | goto err_free_data; | ||
98 | err = gpio_direction_output(gpio_ext->data[i], 0); | ||
99 | if (err) { | ||
100 | gpio_free(gpio_ext->data[i]); | ||
101 | goto err_free_data; | ||
102 | } | ||
103 | } | ||
104 | /* Configure "enable select" GPIO. */ | ||
105 | err = gpio_request(gpio_ext->enable, "GPIO extension enable"); | ||
106 | if (err) | ||
107 | goto err_free_data; | ||
108 | err = gpio_direction_output(gpio_ext->enable, 0); | ||
109 | if (err) { | ||
110 | gpio_free(gpio_ext->enable); | ||
111 | goto err_free_data; | ||
112 | } | ||
113 | |||
114 | return 0; | ||
115 | |||
116 | err_free_data: | ||
117 | for (i = i - 1; i >= 0; i--) | ||
118 | gpio_free(gpio_ext->data[i]); | ||
119 | i = gpio_ext->num_addr; | ||
120 | err_free_addr: | ||
121 | for (i = i - 1; i >= 0; i--) | ||
122 | gpio_free(gpio_ext->addr[i]); | ||
123 | |||
124 | return err; | ||
125 | } | ||
126 | |||
127 | static void __devexit gpio_ext_free(struct netxbig_gpio_ext *gpio_ext) | ||
128 | { | ||
129 | int i; | ||
130 | |||
131 | gpio_free(gpio_ext->enable); | ||
132 | for (i = gpio_ext->num_addr - 1; i >= 0; i--) | ||
133 | gpio_free(gpio_ext->addr[i]); | ||
134 | for (i = gpio_ext->num_data - 1; i >= 0; i--) | ||
135 | gpio_free(gpio_ext->data[i]); | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * Class LED driver. | ||
140 | */ | ||
141 | |||
142 | struct netxbig_led_data { | ||
143 | struct netxbig_gpio_ext *gpio_ext; | ||
144 | struct led_classdev cdev; | ||
145 | int mode_addr; | ||
146 | int *mode_val; | ||
147 | int bright_addr; | ||
148 | int bright_max; | ||
149 | struct netxbig_led_timer *timer; | ||
150 | int num_timer; | ||
151 | enum netxbig_led_mode mode; | ||
152 | int sata; | ||
153 | spinlock_t lock; | ||
154 | }; | ||
155 | |||
156 | static int netxbig_led_get_timer_mode(enum netxbig_led_mode *mode, | ||
157 | unsigned long delay_on, | ||
158 | unsigned long delay_off, | ||
159 | struct netxbig_led_timer *timer, | ||
160 | int num_timer) | ||
161 | { | ||
162 | int i; | ||
163 | |||
164 | for (i = 0; i < num_timer; i++) { | ||
165 | if (timer[i].delay_on == delay_on && | ||
166 | timer[i].delay_off == delay_off) { | ||
167 | *mode = timer[i].mode; | ||
168 | return 0; | ||
169 | } | ||
170 | } | ||
171 | return -EINVAL; | ||
172 | } | ||
173 | |||
174 | static int netxbig_led_blink_set(struct led_classdev *led_cdev, | ||
175 | unsigned long *delay_on, | ||
176 | unsigned long *delay_off) | ||
177 | { | ||
178 | struct netxbig_led_data *led_dat = | ||
179 | container_of(led_cdev, struct netxbig_led_data, cdev); | ||
180 | enum netxbig_led_mode mode; | ||
181 | int mode_val; | ||
182 | int ret; | ||
183 | |||
184 | /* Look for a LED mode with the requested timer frequency. */ | ||
185 | ret = netxbig_led_get_timer_mode(&mode, *delay_on, *delay_off, | ||
186 | led_dat->timer, led_dat->num_timer); | ||
187 | if (ret < 0) | ||
188 | return ret; | ||
189 | |||
190 | mode_val = led_dat->mode_val[mode]; | ||
191 | if (mode_val == NETXBIG_LED_INVALID_MODE) | ||
192 | return -EINVAL; | ||
193 | |||
194 | spin_lock_irq(&led_dat->lock); | ||
195 | |||
196 | gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val); | ||
197 | led_dat->mode = mode; | ||
198 | |||
199 | spin_unlock_irq(&led_dat->lock); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static void netxbig_led_set(struct led_classdev *led_cdev, | ||
205 | enum led_brightness value) | ||
206 | { | ||
207 | struct netxbig_led_data *led_dat = | ||
208 | container_of(led_cdev, struct netxbig_led_data, cdev); | ||
209 | enum netxbig_led_mode mode; | ||
210 | int mode_val, bright_val; | ||
211 | int set_brightness = 1; | ||
212 | unsigned long flags; | ||
213 | |||
214 | spin_lock_irqsave(&led_dat->lock, flags); | ||
215 | |||
216 | if (value == LED_OFF) { | ||
217 | mode = NETXBIG_LED_OFF; | ||
218 | set_brightness = 0; | ||
219 | } else { | ||
220 | if (led_dat->sata) | ||
221 | mode = NETXBIG_LED_SATA; | ||
222 | else if (led_dat->mode == NETXBIG_LED_OFF) | ||
223 | mode = NETXBIG_LED_ON; | ||
224 | else /* Keep 'timer' mode. */ | ||
225 | mode = led_dat->mode; | ||
226 | } | ||
227 | mode_val = led_dat->mode_val[mode]; | ||
228 | |||
229 | gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val); | ||
230 | led_dat->mode = mode; | ||
231 | /* | ||
232 | * Note that the brightness register is shared between all the | ||
233 | * SATA LEDs. So, change the brightness setting for a single | ||
234 | * SATA LED will affect all the others. | ||
235 | */ | ||
236 | if (set_brightness) { | ||
237 | bright_val = DIV_ROUND_UP(value * led_dat->bright_max, | ||
238 | LED_FULL); | ||
239 | gpio_ext_set_value(led_dat->gpio_ext, | ||
240 | led_dat->bright_addr, bright_val); | ||
241 | } | ||
242 | |||
243 | spin_unlock_irqrestore(&led_dat->lock, flags); | ||
244 | } | ||
245 | |||
246 | static ssize_t netxbig_led_sata_store(struct device *dev, | ||
247 | struct device_attribute *attr, | ||
248 | const char *buff, size_t count) | ||
249 | { | ||
250 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
251 | struct netxbig_led_data *led_dat = | ||
252 | container_of(led_cdev, struct netxbig_led_data, cdev); | ||
253 | unsigned long enable; | ||
254 | enum netxbig_led_mode mode; | ||
255 | int mode_val; | ||
256 | int ret; | ||
257 | |||
258 | ret = strict_strtoul(buff, 10, &enable); | ||
259 | if (ret < 0) | ||
260 | return ret; | ||
261 | |||
262 | enable = !!enable; | ||
263 | |||
264 | spin_lock_irq(&led_dat->lock); | ||
265 | |||
266 | if (led_dat->sata == enable) { | ||
267 | ret = count; | ||
268 | goto exit_unlock; | ||
269 | } | ||
270 | |||
271 | if (led_dat->mode != NETXBIG_LED_ON && | ||
272 | led_dat->mode != NETXBIG_LED_SATA) | ||
273 | mode = led_dat->mode; /* Keep modes 'off' and 'timer'. */ | ||
274 | else if (enable) | ||
275 | mode = NETXBIG_LED_SATA; | ||
276 | else | ||
277 | mode = NETXBIG_LED_ON; | ||
278 | |||
279 | mode_val = led_dat->mode_val[mode]; | ||
280 | if (mode_val == NETXBIG_LED_INVALID_MODE) { | ||
281 | ret = -EINVAL; | ||
282 | goto exit_unlock; | ||
283 | } | ||
284 | |||
285 | gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val); | ||
286 | led_dat->mode = mode; | ||
287 | led_dat->sata = enable; | ||
288 | |||
289 | ret = count; | ||
290 | |||
291 | exit_unlock: | ||
292 | spin_unlock_irq(&led_dat->lock); | ||
293 | |||
294 | return ret; | ||
295 | } | ||
296 | |||
297 | static ssize_t netxbig_led_sata_show(struct device *dev, | ||
298 | struct device_attribute *attr, char *buf) | ||
299 | { | ||
300 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
301 | struct netxbig_led_data *led_dat = | ||
302 | container_of(led_cdev, struct netxbig_led_data, cdev); | ||
303 | |||
304 | return sprintf(buf, "%d\n", led_dat->sata); | ||
305 | } | ||
306 | |||
307 | static DEVICE_ATTR(sata, 0644, netxbig_led_sata_show, netxbig_led_sata_store); | ||
308 | |||
309 | static void __devexit delete_netxbig_led(struct netxbig_led_data *led_dat) | ||
310 | { | ||
311 | if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) | ||
312 | device_remove_file(led_dat->cdev.dev, &dev_attr_sata); | ||
313 | led_classdev_unregister(&led_dat->cdev); | ||
314 | } | ||
315 | |||
316 | static int __devinit | ||
317 | create_netxbig_led(struct platform_device *pdev, | ||
318 | struct netxbig_led_data *led_dat, | ||
319 | const struct netxbig_led *template) | ||
320 | { | ||
321 | struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | ||
322 | int ret; | ||
323 | |||
324 | spin_lock_init(&led_dat->lock); | ||
325 | led_dat->gpio_ext = pdata->gpio_ext; | ||
326 | led_dat->cdev.name = template->name; | ||
327 | led_dat->cdev.default_trigger = template->default_trigger; | ||
328 | led_dat->cdev.blink_set = netxbig_led_blink_set; | ||
329 | led_dat->cdev.brightness_set = netxbig_led_set; | ||
330 | /* | ||
331 | * Because the GPIO extension bus don't allow to read registers | ||
332 | * value, there is no way to probe the LED initial state. | ||
333 | * So, the initial sysfs LED value for the "brightness" and "sata" | ||
334 | * attributes are inconsistent. | ||
335 | * | ||
336 | * Note that the initial LED state can't be reconfigured. | ||
337 | * The reason is that the LED behaviour must stay uniform during | ||
338 | * the whole boot process (bootloader+linux). | ||
339 | */ | ||
340 | led_dat->sata = 0; | ||
341 | led_dat->cdev.brightness = LED_OFF; | ||
342 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; | ||
343 | led_dat->mode_addr = template->mode_addr; | ||
344 | led_dat->mode_val = template->mode_val; | ||
345 | led_dat->bright_addr = template->bright_addr; | ||
346 | led_dat->bright_max = (1 << pdata->gpio_ext->num_data) - 1; | ||
347 | led_dat->timer = pdata->timer; | ||
348 | led_dat->num_timer = pdata->num_timer; | ||
349 | |||
350 | ret = led_classdev_register(&pdev->dev, &led_dat->cdev); | ||
351 | if (ret < 0) | ||
352 | return ret; | ||
353 | |||
354 | /* | ||
355 | * If available, expose the SATA activity blink capability through | ||
356 | * a "sata" sysfs attribute. | ||
357 | */ | ||
358 | if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) { | ||
359 | ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); | ||
360 | if (ret) | ||
361 | led_classdev_unregister(&led_dat->cdev); | ||
362 | } | ||
363 | |||
364 | return ret; | ||
365 | } | ||
366 | |||
367 | static int __devinit netxbig_led_probe(struct platform_device *pdev) | ||
368 | { | ||
369 | struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | ||
370 | struct netxbig_led_data *leds_data; | ||
371 | int i; | ||
372 | int ret; | ||
373 | |||
374 | if (!pdata) | ||
375 | return -EINVAL; | ||
376 | |||
377 | leds_data = kzalloc(sizeof(struct netxbig_led_data) * pdata->num_leds, | ||
378 | GFP_KERNEL); | ||
379 | if (!leds_data) | ||
380 | return -ENOMEM; | ||
381 | |||
382 | ret = gpio_ext_init(pdata->gpio_ext); | ||
383 | if (ret < 0) | ||
384 | goto err_free_data; | ||
385 | |||
386 | for (i = 0; i < pdata->num_leds; i++) { | ||
387 | ret = create_netxbig_led(pdev, &leds_data[i], &pdata->leds[i]); | ||
388 | if (ret < 0) | ||
389 | goto err_free_leds; | ||
390 | } | ||
391 | |||
392 | platform_set_drvdata(pdev, leds_data); | ||
393 | |||
394 | return 0; | ||
395 | |||
396 | err_free_leds: | ||
397 | for (i = i - 1; i >= 0; i--) | ||
398 | delete_netxbig_led(&leds_data[i]); | ||
399 | |||
400 | gpio_ext_free(pdata->gpio_ext); | ||
401 | err_free_data: | ||
402 | kfree(leds_data); | ||
403 | |||
404 | return ret; | ||
405 | } | ||
406 | |||
407 | static int __devexit netxbig_led_remove(struct platform_device *pdev) | ||
408 | { | ||
409 | struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | ||
410 | struct netxbig_led_data *leds_data; | ||
411 | int i; | ||
412 | |||
413 | leds_data = platform_get_drvdata(pdev); | ||
414 | |||
415 | for (i = 0; i < pdata->num_leds; i++) | ||
416 | delete_netxbig_led(&leds_data[i]); | ||
417 | |||
418 | gpio_ext_free(pdata->gpio_ext); | ||
419 | kfree(leds_data); | ||
420 | |||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | static struct platform_driver netxbig_led_driver = { | ||
425 | .probe = netxbig_led_probe, | ||
426 | .remove = __devexit_p(netxbig_led_remove), | ||
427 | .driver = { | ||
428 | .name = "leds-netxbig", | ||
429 | .owner = THIS_MODULE, | ||
430 | }, | ||
431 | }; | ||
432 | MODULE_ALIAS("platform:leds-netxbig"); | ||
433 | |||
434 | static int __init netxbig_led_init(void) | ||
435 | { | ||
436 | return platform_driver_register(&netxbig_led_driver); | ||
437 | } | ||
438 | |||
439 | static void __exit netxbig_led_exit(void) | ||
440 | { | ||
441 | platform_driver_unregister(&netxbig_led_driver); | ||
442 | } | ||
443 | |||
444 | module_init(netxbig_led_init); | ||
445 | module_exit(netxbig_led_exit); | ||
446 | |||
447 | MODULE_AUTHOR("Simon Guinot <sguinot@lacie.com>"); | ||
448 | MODULE_DESCRIPTION("LED driver for LaCie xBig Network boards"); | ||
449 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 350eb34f049c..f77d48d0b3e4 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c | |||
@@ -141,10 +141,12 @@ static ssize_t ns2_led_sata_store(struct device *dev, | |||
141 | struct device_attribute *attr, | 141 | struct device_attribute *attr, |
142 | const char *buff, size_t count) | 142 | const char *buff, size_t count) |
143 | { | 143 | { |
144 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
145 | struct ns2_led_data *led_dat = | ||
146 | container_of(led_cdev, struct ns2_led_data, cdev); | ||
144 | int ret; | 147 | int ret; |
145 | unsigned long enable; | 148 | unsigned long enable; |
146 | enum ns2_led_modes mode; | 149 | enum ns2_led_modes mode; |
147 | struct ns2_led_data *led_dat = dev_get_drvdata(dev); | ||
148 | 150 | ||
149 | ret = strict_strtoul(buff, 10, &enable); | 151 | ret = strict_strtoul(buff, 10, &enable); |
150 | if (ret < 0) | 152 | if (ret < 0) |
@@ -172,7 +174,9 @@ static ssize_t ns2_led_sata_store(struct device *dev, | |||
172 | static ssize_t ns2_led_sata_show(struct device *dev, | 174 | static ssize_t ns2_led_sata_show(struct device *dev, |
173 | struct device_attribute *attr, char *buf) | 175 | struct device_attribute *attr, char *buf) |
174 | { | 176 | { |
175 | struct ns2_led_data *led_dat = dev_get_drvdata(dev); | 177 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
178 | struct ns2_led_data *led_dat = | ||
179 | container_of(led_cdev, struct ns2_led_data, cdev); | ||
176 | 180 | ||
177 | return sprintf(buf, "%d\n", led_dat->sata); | 181 | return sprintf(buf, "%d\n", led_dat->sata); |
178 | } | 182 | } |
@@ -234,7 +238,6 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, | |||
234 | if (ret < 0) | 238 | if (ret < 0) |
235 | goto err_free_slow; | 239 | goto err_free_slow; |
236 | 240 | ||
237 | dev_set_drvdata(led_dat->cdev.dev, led_dat); | ||
238 | ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); | 241 | ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); |
239 | if (ret < 0) | 242 | if (ret < 0) |
240 | goto err_free_cdev; | 243 | goto err_free_cdev; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index ed4900ade93a..e4fb58db5454 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1000,10 +1000,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
1000 | page = bitmap->sb_page; | 1000 | page = bitmap->sb_page; |
1001 | offset = sizeof(bitmap_super_t); | 1001 | offset = sizeof(bitmap_super_t); |
1002 | if (!file) | 1002 | if (!file) |
1003 | read_sb_page(bitmap->mddev, | 1003 | page = read_sb_page( |
1004 | bitmap->mddev->bitmap_info.offset, | 1004 | bitmap->mddev, |
1005 | page, | 1005 | bitmap->mddev->bitmap_info.offset, |
1006 | index, count); | 1006 | page, |
1007 | index, count); | ||
1007 | } else if (file) { | 1008 | } else if (file) { |
1008 | page = read_page(file, index, bitmap, count); | 1009 | page = read_page(file, index, bitmap, count); |
1009 | offset = 0; | 1010 | offset = 0; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ad83a4dcadc3..0b830bbe1d8b 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1839,7 +1839,9 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1839 | 1839 | ||
1840 | /* take from bio_init */ | 1840 | /* take from bio_init */ |
1841 | bio->bi_next = NULL; | 1841 | bio->bi_next = NULL; |
1842 | bio->bi_flags &= ~(BIO_POOL_MASK-1); | ||
1842 | bio->bi_flags |= 1 << BIO_UPTODATE; | 1843 | bio->bi_flags |= 1 << BIO_UPTODATE; |
1844 | bio->bi_comp_cpu = -1; | ||
1843 | bio->bi_rw = READ; | 1845 | bio->bi_rw = READ; |
1844 | bio->bi_vcnt = 0; | 1846 | bio->bi_vcnt = 0; |
1845 | bio->bi_idx = 0; | 1847 | bio->bi_idx = 0; |
@@ -1912,7 +1914,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1912 | !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) | 1914 | !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) |
1913 | break; | 1915 | break; |
1914 | BUG_ON(sync_blocks < (PAGE_SIZE>>9)); | 1916 | BUG_ON(sync_blocks < (PAGE_SIZE>>9)); |
1915 | if (len > (sync_blocks<<9)) | 1917 | if ((len >> 9) > sync_blocks) |
1916 | len = sync_blocks<<9; | 1918 | len = sync_blocks<<9; |
1917 | } | 1919 | } |
1918 | 1920 | ||
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 7e82a9df726b..7961d59f5cac 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c | |||
@@ -319,7 +319,7 @@ static void ir_timer_keyup(unsigned long cookie) | |||
319 | * a keyup event might follow immediately after the keydown. | 319 | * a keyup event might follow immediately after the keydown. |
320 | */ | 320 | */ |
321 | spin_lock_irqsave(&ir->keylock, flags); | 321 | spin_lock_irqsave(&ir->keylock, flags); |
322 | if (time_is_after_eq_jiffies(ir->keyup_jiffies)) | 322 | if (time_is_before_eq_jiffies(ir->keyup_jiffies)) |
323 | ir_keyup(ir); | 323 | ir_keyup(ir); |
324 | spin_unlock_irqrestore(&ir->keylock, flags); | 324 | spin_unlock_irqrestore(&ir->keylock, flags); |
325 | } | 325 | } |
@@ -510,6 +510,13 @@ int __ir_input_register(struct input_dev *input_dev, | |||
510 | (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ? | 510 | (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ? |
511 | " in raw mode" : ""); | 511 | " in raw mode" : ""); |
512 | 512 | ||
513 | /* | ||
514 | * Default delay of 250ms is too short for some protocols, expecially | ||
515 | * since the timeout is currently set to 250ms. Increase it to 500ms, | ||
516 | * to avoid wrong repetition of the keycodes. | ||
517 | */ | ||
518 | input_dev->rep[REP_DELAY] = 500; | ||
519 | |||
513 | return 0; | 520 | return 0; |
514 | 521 | ||
515 | out_event: | 522 | out_event: |
diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c index 77b5946413c0..e63f757d5d72 100644 --- a/drivers/media/IR/ir-lirc-codec.c +++ b/drivers/media/IR/ir-lirc-codec.c | |||
@@ -267,7 +267,7 @@ static int ir_lirc_register(struct input_dev *input_dev) | |||
267 | features |= LIRC_CAN_SET_SEND_CARRIER; | 267 | features |= LIRC_CAN_SET_SEND_CARRIER; |
268 | 268 | ||
269 | if (ir_dev->props->s_tx_duty_cycle) | 269 | if (ir_dev->props->s_tx_duty_cycle) |
270 | features |= LIRC_CAN_SET_REC_DUTY_CYCLE; | 270 | features |= LIRC_CAN_SET_SEND_DUTY_CYCLE; |
271 | } | 271 | } |
272 | 272 | ||
273 | if (ir_dev->props->s_rx_carrier_range) | 273 | if (ir_dev->props->s_rx_carrier_range) |
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 43094e7eccfa..8e0e1b1f8c87 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c | |||
@@ -279,9 +279,11 @@ int ir_raw_event_register(struct input_dev *input_dev) | |||
279 | "rc%u", (unsigned int)ir->devno); | 279 | "rc%u", (unsigned int)ir->devno); |
280 | 280 | ||
281 | if (IS_ERR(ir->raw->thread)) { | 281 | if (IS_ERR(ir->raw->thread)) { |
282 | int ret = PTR_ERR(ir->raw->thread); | ||
283 | |||
282 | kfree(ir->raw); | 284 | kfree(ir->raw); |
283 | ir->raw = NULL; | 285 | ir->raw = NULL; |
284 | return PTR_ERR(ir->raw->thread); | 286 | return ret; |
285 | } | 287 | } |
286 | 288 | ||
287 | mutex_lock(&ir_raw_handler_lock); | 289 | mutex_lock(&ir_raw_handler_lock); |
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 96dafc425c8e..46d42467f9b4 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c | |||
@@ -67,13 +67,14 @@ static ssize_t show_protocols(struct device *d, | |||
67 | char *tmp = buf; | 67 | char *tmp = buf; |
68 | int i; | 68 | int i; |
69 | 69 | ||
70 | if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { | 70 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { |
71 | enabled = ir_dev->rc_tab.ir_type; | 71 | enabled = ir_dev->rc_tab.ir_type; |
72 | allowed = ir_dev->props->allowed_protos; | 72 | allowed = ir_dev->props->allowed_protos; |
73 | } else { | 73 | } else if (ir_dev->raw) { |
74 | enabled = ir_dev->raw->enabled_protocols; | 74 | enabled = ir_dev->raw->enabled_protocols; |
75 | allowed = ir_raw_get_allowed_protocols(); | 75 | allowed = ir_raw_get_allowed_protocols(); |
76 | } | 76 | } else |
77 | return sprintf(tmp, "[builtin]\n"); | ||
77 | 78 | ||
78 | IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", | 79 | IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", |
79 | (long long)allowed, | 80 | (long long)allowed, |
@@ -121,10 +122,14 @@ static ssize_t store_protocols(struct device *d, | |||
121 | int rc, i, count = 0; | 122 | int rc, i, count = 0; |
122 | unsigned long flags; | 123 | unsigned long flags; |
123 | 124 | ||
124 | if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) | 125 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) |
125 | type = ir_dev->rc_tab.ir_type; | 126 | type = ir_dev->rc_tab.ir_type; |
126 | else | 127 | else if (ir_dev->raw) |
127 | type = ir_dev->raw->enabled_protocols; | 128 | type = ir_dev->raw->enabled_protocols; |
129 | else { | ||
130 | IR_dprintk(1, "Protocol switching not supported\n"); | ||
131 | return -EINVAL; | ||
132 | } | ||
128 | 133 | ||
129 | while ((tmp = strsep((char **) &data, " \n")) != NULL) { | 134 | while ((tmp = strsep((char **) &data, " \n")) != NULL) { |
130 | if (!*tmp) | 135 | if (!*tmp) |
@@ -185,7 +190,7 @@ static ssize_t store_protocols(struct device *d, | |||
185 | } | 190 | } |
186 | } | 191 | } |
187 | 192 | ||
188 | if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { | 193 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { |
189 | spin_lock_irqsave(&ir_dev->rc_tab.lock, flags); | 194 | spin_lock_irqsave(&ir_dev->rc_tab.lock, flags); |
190 | ir_dev->rc_tab.ir_type = type; | 195 | ir_dev->rc_tab.ir_type = type; |
191 | spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); | 196 | spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); |
diff --git a/drivers/media/IR/keymaps/rc-rc6-mce.c b/drivers/media/IR/keymaps/rc-rc6-mce.c index 64264f7f838f..39557ad401b6 100644 --- a/drivers/media/IR/keymaps/rc-rc6-mce.c +++ b/drivers/media/IR/keymaps/rc-rc6-mce.c | |||
@@ -19,6 +19,7 @@ static struct ir_scancode rc6_mce[] = { | |||
19 | 19 | ||
20 | { 0x800f0416, KEY_PLAY }, | 20 | { 0x800f0416, KEY_PLAY }, |
21 | { 0x800f0418, KEY_PAUSE }, | 21 | { 0x800f0418, KEY_PAUSE }, |
22 | { 0x800f046e, KEY_PLAYPAUSE }, | ||
22 | { 0x800f0419, KEY_STOP }, | 23 | { 0x800f0419, KEY_STOP }, |
23 | { 0x800f0417, KEY_RECORD }, | 24 | { 0x800f0417, KEY_RECORD }, |
24 | 25 | ||
@@ -37,6 +38,8 @@ static struct ir_scancode rc6_mce[] = { | |||
37 | { 0x800f0411, KEY_VOLUMEDOWN }, | 38 | { 0x800f0411, KEY_VOLUMEDOWN }, |
38 | { 0x800f0412, KEY_CHANNELUP }, | 39 | { 0x800f0412, KEY_CHANNELUP }, |
39 | { 0x800f0413, KEY_CHANNELDOWN }, | 40 | { 0x800f0413, KEY_CHANNELDOWN }, |
41 | { 0x800f043a, KEY_BRIGHTNESSUP }, | ||
42 | { 0x800f0480, KEY_BRIGHTNESSDOWN }, | ||
40 | 43 | ||
41 | { 0x800f0401, KEY_NUMERIC_1 }, | 44 | { 0x800f0401, KEY_NUMERIC_1 }, |
42 | { 0x800f0402, KEY_NUMERIC_2 }, | 45 | { 0x800f0402, KEY_NUMERIC_2 }, |
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index ac6bb2c01a48..bc620e10ef77 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c | |||
@@ -120,6 +120,10 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
120 | { USB_DEVICE(VENDOR_PHILIPS, 0x0613) }, | 120 | { USB_DEVICE(VENDOR_PHILIPS, 0x0613) }, |
121 | /* Philips eHome Infrared Transceiver */ | 121 | /* Philips eHome Infrared Transceiver */ |
122 | { USB_DEVICE(VENDOR_PHILIPS, 0x0815) }, | 122 | { USB_DEVICE(VENDOR_PHILIPS, 0x0815) }, |
123 | /* Philips/Spinel plus IR transceiver for ASUS */ | ||
124 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, | ||
125 | /* Philips/Spinel plus IR transceiver for ASUS */ | ||
126 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, | ||
123 | /* Realtek MCE IR Receiver */ | 127 | /* Realtek MCE IR Receiver */ |
124 | { USB_DEVICE(VENDOR_REALTEK, 0x0161) }, | 128 | { USB_DEVICE(VENDOR_REALTEK, 0x0161) }, |
125 | /* SMK/Toshiba G83C0004D410 */ | 129 | /* SMK/Toshiba G83C0004D410 */ |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index fe818348b8a3..48397f103d32 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c | |||
@@ -673,9 +673,6 @@ static int dib0700_probe(struct usb_interface *intf, | |||
673 | else | 673 | else |
674 | dev->props.rc.core.bulk_mode = false; | 674 | dev->props.rc.core.bulk_mode = false; |
675 | 675 | ||
676 | /* Need a higher delay, to avoid wrong repeat */ | ||
677 | dev->rc_input_dev->rep[REP_DELAY] = 500; | ||
678 | |||
679 | dib0700_rc_setup(dev); | 676 | dib0700_rc_setup(dev); |
680 | 677 | ||
681 | return 0; | 678 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index f634d2e784b2..e06acd1fecb6 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -940,6 +940,58 @@ static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) | |||
940 | return adap->fe == NULL ? -ENODEV : 0; | 940 | return adap->fe == NULL ? -ENODEV : 0; |
941 | } | 941 | } |
942 | 942 | ||
943 | /* STK7770P */ | ||
944 | static struct dib7000p_config dib7770p_dib7000p_config = { | ||
945 | .output_mpeg2_in_188_bytes = 1, | ||
946 | |||
947 | .agc_config_count = 1, | ||
948 | .agc = &dib7070_agc_config, | ||
949 | .bw = &dib7070_bw_config_12_mhz, | ||
950 | .tuner_is_baseband = 1, | ||
951 | .spur_protect = 1, | ||
952 | |||
953 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | ||
954 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | ||
955 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | ||
956 | |||
957 | .hostbus_diversity = 1, | ||
958 | .enable_current_mirror = 1, | ||
959 | .disable_sample_and_hold = 0, | ||
960 | }; | ||
961 | |||
962 | static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap) | ||
963 | { | ||
964 | struct usb_device_descriptor *p = &adap->dev->udev->descriptor; | ||
965 | if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) && | ||
966 | p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E)) | ||
967 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | ||
968 | else | ||
969 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | ||
970 | msleep(10); | ||
971 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | ||
972 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | ||
973 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | ||
974 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | ||
975 | |||
976 | dib0700_ctrl_clock(adap->dev, 72, 1); | ||
977 | |||
978 | msleep(10); | ||
979 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | ||
980 | msleep(10); | ||
981 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | ||
982 | |||
983 | if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | ||
984 | &dib7770p_dib7000p_config) != 0) { | ||
985 | err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", | ||
986 | __func__); | ||
987 | return -ENODEV; | ||
988 | } | ||
989 | |||
990 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, | ||
991 | &dib7770p_dib7000p_config); | ||
992 | return adap->fe == NULL ? -ENODEV : 0; | ||
993 | } | ||
994 | |||
943 | /* DIB807x generic */ | 995 | /* DIB807x generic */ |
944 | static struct dibx000_agc_config dib807x_agc_config[2] = { | 996 | static struct dibx000_agc_config dib807x_agc_config[2] = { |
945 | { | 997 | { |
@@ -1781,7 +1833,7 @@ struct usb_device_id dib0700_usb_id_table[] = { | |||
1781 | /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) }, | 1833 | /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) }, |
1782 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) }, | 1834 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) }, |
1783 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) }, | 1835 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) }, |
1784 | { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) }, | 1836 | { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) }, |
1785 | { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) }, | 1837 | { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) }, |
1786 | /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) }, | 1838 | /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) }, |
1787 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, | 1839 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, |
@@ -2406,7 +2458,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2406 | .pid_filter_count = 32, | 2458 | .pid_filter_count = 32, |
2407 | .pid_filter = stk70x0p_pid_filter, | 2459 | .pid_filter = stk70x0p_pid_filter, |
2408 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 2460 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
2409 | .frontend_attach = stk7070p_frontend_attach, | 2461 | .frontend_attach = stk7770p_frontend_attach, |
2410 | .tuner_attach = dib7770p_tuner_attach, | 2462 | .tuner_attach = dib7770p_tuner_attach, |
2411 | 2463 | ||
2412 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 2464 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 6b22ec64ab0c..f896337b4535 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
@@ -483,9 +483,7 @@ static int opera1_xilinx_load_firmware(struct usb_device *dev, | |||
483 | } | 483 | } |
484 | } | 484 | } |
485 | kfree(p); | 485 | kfree(p); |
486 | if (fw) { | 486 | release_firmware(fw); |
487 | release_firmware(fw); | ||
488 | } | ||
489 | return ret; | 487 | return ret; |
490 | } | 488 | } |
491 | 489 | ||
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 2e28b973dfd3..3aed0d433921 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c | |||
@@ -260,6 +260,9 @@ static void dib7000p_set_adc_state(struct dib7000p_state *state, enum dibx000_ad | |||
260 | 260 | ||
261 | // dprintk( "908: %x, 909: %x\n", reg_908, reg_909); | 261 | // dprintk( "908: %x, 909: %x\n", reg_908, reg_909); |
262 | 262 | ||
263 | reg_909 |= (state->cfg.disable_sample_and_hold & 1) << 4; | ||
264 | reg_908 |= (state->cfg.enable_current_mirror & 1) << 7; | ||
265 | |||
263 | dib7000p_write_word(state, 908, reg_908); | 266 | dib7000p_write_word(state, 908, reg_908); |
264 | dib7000p_write_word(state, 909, reg_909); | 267 | dib7000p_write_word(state, 909, reg_909); |
265 | } | 268 | } |
@@ -778,7 +781,10 @@ static void dib7000p_set_channel(struct dib7000p_state *state, struct dvb_fronte | |||
778 | default: | 781 | default: |
779 | case GUARD_INTERVAL_1_32: value *= 1; break; | 782 | case GUARD_INTERVAL_1_32: value *= 1; break; |
780 | } | 783 | } |
781 | state->div_sync_wait = (value * 3) / 2 + 32; // add 50% SFN margin + compensate for one DVSY-fifo TODO | 784 | if (state->cfg.diversity_delay == 0) |
785 | state->div_sync_wait = (value * 3) / 2 + 48; // add 50% SFN margin + compensate for one DVSY-fifo | ||
786 | else | ||
787 | state->div_sync_wait = (value * 3) / 2 + state->cfg.diversity_delay; // add 50% SFN margin + compensate for one DVSY-fifo | ||
782 | 788 | ||
783 | /* deactive the possibility of diversity reception if extended interleaver */ | 789 | /* deactive the possibility of diversity reception if extended interleaver */ |
784 | state->div_force_off = !1 && ch->u.ofdm.transmission_mode != TRANSMISSION_MODE_8K; | 790 | state->div_force_off = !1 && ch->u.ofdm.transmission_mode != TRANSMISSION_MODE_8K; |
diff --git a/drivers/media/dvb/frontends/dib7000p.h b/drivers/media/dvb/frontends/dib7000p.h index 805dd13a97ee..da17345bf5bd 100644 --- a/drivers/media/dvb/frontends/dib7000p.h +++ b/drivers/media/dvb/frontends/dib7000p.h | |||
@@ -33,6 +33,11 @@ struct dib7000p_config { | |||
33 | int (*agc_control) (struct dvb_frontend *, u8 before); | 33 | int (*agc_control) (struct dvb_frontend *, u8 before); |
34 | 34 | ||
35 | u8 output_mode; | 35 | u8 output_mode; |
36 | u8 disable_sample_and_hold : 1; | ||
37 | |||
38 | u8 enable_current_mirror : 1; | ||
39 | u8 diversity_delay; | ||
40 | |||
36 | }; | 41 | }; |
37 | 42 | ||
38 | #define DEFAULT_DIB7000P_I2C_ADDRESS 18 | 43 | #define DEFAULT_DIB7000P_I2C_ADDRESS 18 |
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index d93468cd3a85..ff3b0fa901b3 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c | |||
@@ -1098,33 +1098,26 @@ EXPORT_SYMBOL_GPL(smscore_onresponse); | |||
1098 | * | 1098 | * |
1099 | * @return pointer to descriptor on success, NULL on error. | 1099 | * @return pointer to descriptor on success, NULL on error. |
1100 | */ | 1100 | */ |
1101 | struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev) | 1101 | |
1102 | struct smscore_buffer_t *get_entry(struct smscore_device_t *coredev) | ||
1102 | { | 1103 | { |
1103 | struct smscore_buffer_t *cb = NULL; | 1104 | struct smscore_buffer_t *cb = NULL; |
1104 | unsigned long flags; | 1105 | unsigned long flags; |
1105 | 1106 | ||
1106 | DEFINE_WAIT(wait); | ||
1107 | |||
1108 | spin_lock_irqsave(&coredev->bufferslock, flags); | 1107 | spin_lock_irqsave(&coredev->bufferslock, flags); |
1109 | 1108 | if (!list_empty(&coredev->buffers)) { | |
1110 | /* This function must return a valid buffer, since the buffer list is | 1109 | cb = (struct smscore_buffer_t *) coredev->buffers.next; |
1111 | * finite, we check that there is an available buffer, if not, we wait | 1110 | list_del(&cb->entry); |
1112 | * until such buffer become available. | ||
1113 | */ | ||
1114 | |||
1115 | prepare_to_wait(&coredev->buffer_mng_waitq, &wait, TASK_INTERRUPTIBLE); | ||
1116 | if (list_empty(&coredev->buffers)) { | ||
1117 | spin_unlock_irqrestore(&coredev->bufferslock, flags); | ||
1118 | schedule(); | ||
1119 | spin_lock_irqsave(&coredev->bufferslock, flags); | ||
1120 | } | 1111 | } |
1112 | spin_unlock_irqrestore(&coredev->bufferslock, flags); | ||
1113 | return cb; | ||
1114 | } | ||
1121 | 1115 | ||
1122 | finish_wait(&coredev->buffer_mng_waitq, &wait); | 1116 | struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev) |
1123 | 1117 | { | |
1124 | cb = (struct smscore_buffer_t *) coredev->buffers.next; | 1118 | struct smscore_buffer_t *cb = NULL; |
1125 | list_del(&cb->entry); | ||
1126 | 1119 | ||
1127 | spin_unlock_irqrestore(&coredev->bufferslock, flags); | 1120 | wait_event(coredev->buffer_mng_waitq, (cb = get_entry(coredev))); |
1128 | 1121 | ||
1129 | return cb; | 1122 | return cb; |
1130 | } | 1123 | } |
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 67a4ec8768a6..4ce541a5eb47 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c | |||
@@ -395,7 +395,7 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client, | |||
395 | radio->registers[POWERCFG] = POWERCFG_ENABLE; | 395 | radio->registers[POWERCFG] = POWERCFG_ENABLE; |
396 | if (si470x_set_register(radio, POWERCFG) < 0) { | 396 | if (si470x_set_register(radio, POWERCFG) < 0) { |
397 | retval = -EIO; | 397 | retval = -EIO; |
398 | goto err_all; | 398 | goto err_video; |
399 | } | 399 | } |
400 | msleep(110); | 400 | msleep(110); |
401 | 401 | ||
diff --git a/drivers/media/video/cx231xx/Makefile b/drivers/media/video/cx231xx/Makefile index 755dd0ce65ff..6f2b57384488 100644 --- a/drivers/media/video/cx231xx/Makefile +++ b/drivers/media/video/cx231xx/Makefile | |||
@@ -11,4 +11,5 @@ EXTRA_CFLAGS += -Idrivers/media/video | |||
11 | EXTRA_CFLAGS += -Idrivers/media/common/tuners | 11 | EXTRA_CFLAGS += -Idrivers/media/common/tuners |
12 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | 12 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
13 | EXTRA_CFLAGS += -Idrivers/media/dvb/frontends | 13 | EXTRA_CFLAGS += -Idrivers/media/dvb/frontends |
14 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-usb | ||
14 | 15 | ||
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 6bdc0ef18119..f2a4900014bc 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <media/v4l2-chip-ident.h> | 32 | #include <media/v4l2-chip-ident.h> |
33 | 33 | ||
34 | #include <media/cx25840.h> | 34 | #include <media/cx25840.h> |
35 | #include "dvb-usb-ids.h" | ||
35 | #include "xc5000.h" | 36 | #include "xc5000.h" |
36 | 37 | ||
37 | #include "cx231xx.h" | 38 | #include "cx231xx.h" |
@@ -175,6 +176,8 @@ struct usb_device_id cx231xx_id_table[] = { | |||
175 | .driver_info = CX231XX_BOARD_CNXT_RDE_250}, | 176 | .driver_info = CX231XX_BOARD_CNXT_RDE_250}, |
176 | {USB_DEVICE(0x0572, 0x58A1), | 177 | {USB_DEVICE(0x0572, 0x58A1), |
177 | .driver_info = CX231XX_BOARD_CNXT_RDU_250}, | 178 | .driver_info = CX231XX_BOARD_CNXT_RDU_250}, |
179 | {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000,0x4fff), | ||
180 | .driver_info = CX231XX_BOARD_UNKNOWN}, | ||
178 | {}, | 181 | {}, |
179 | }; | 182 | }; |
180 | 183 | ||
@@ -226,14 +229,16 @@ void cx231xx_pre_card_setup(struct cx231xx *dev) | |||
226 | dev->board.name, dev->model); | 229 | dev->board.name, dev->model); |
227 | 230 | ||
228 | /* set the direction for GPIO pins */ | 231 | /* set the direction for GPIO pins */ |
229 | cx231xx_set_gpio_direction(dev, dev->board.tuner_gpio->bit, 1); | 232 | if (dev->board.tuner_gpio) { |
230 | cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1); | 233 | cx231xx_set_gpio_direction(dev, dev->board.tuner_gpio->bit, 1); |
231 | cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1); | 234 | cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1); |
235 | cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1); | ||
232 | 236 | ||
233 | /* request some modules if any required */ | 237 | /* request some modules if any required */ |
234 | 238 | ||
235 | /* reset the Tuner */ | 239 | /* reset the Tuner */ |
236 | cx231xx_gpio_set(dev, dev->board.tuner_gpio); | 240 | cx231xx_gpio_set(dev, dev->board.tuner_gpio); |
241 | } | ||
237 | 242 | ||
238 | /* set the mode to Analog mode initially */ | 243 | /* set the mode to Analog mode initially */ |
239 | cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); | 244 | cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 86ca8c2359dd..f5a3e74c3c7c 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1996,7 +1996,7 @@ static int cx25840_probe(struct i2c_client *client, | |||
1996 | 1996 | ||
1997 | state->volume = v4l2_ctrl_new_std(&state->hdl, | 1997 | state->volume = v4l2_ctrl_new_std(&state->hdl, |
1998 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, | 1998 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, |
1999 | 0, 65335, 65535 / 100, default_volume); | 1999 | 0, 65535, 65535 / 100, default_volume); |
2000 | state->mute = v4l2_ctrl_new_std(&state->hdl, | 2000 | state->mute = v4l2_ctrl_new_std(&state->hdl, |
2001 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_MUTE, | 2001 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_MUTE, |
2002 | 0, 1, 1, 0); | 2002 | 0, 1, 1, 0); |
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 99dbae117591..0fa85cbefbb1 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig | |||
@@ -17,7 +17,7 @@ config VIDEO_CX88 | |||
17 | 17 | ||
18 | config VIDEO_CX88_ALSA | 18 | config VIDEO_CX88_ALSA |
19 | tristate "Conexant 2388x DMA audio support" | 19 | tristate "Conexant 2388x DMA audio support" |
20 | depends on VIDEO_CX88 && SND && EXPERIMENTAL | 20 | depends on VIDEO_CX88 && SND |
21 | select SND_PCM | 21 | select SND_PCM |
22 | ---help--- | 22 | ---help--- |
23 | This is a video4linux driver for direct (DMA) audio on | 23 | This is a video4linux driver for direct (DMA) audio on |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index b9846106913e..78abc1c1f9d5 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -223,6 +223,7 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev, | |||
223 | usb_rcvintpipe(dev, ep->bEndpointAddress), | 223 | usb_rcvintpipe(dev, ep->bEndpointAddress), |
224 | buffer, buffer_len, | 224 | buffer, buffer_len, |
225 | int_irq, (void *)gspca_dev, interval); | 225 | int_irq, (void *)gspca_dev, interval); |
226 | urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
226 | gspca_dev->int_urb = urb; | 227 | gspca_dev->int_urb = urb; |
227 | ret = usb_submit_urb(urb, GFP_KERNEL); | 228 | ret = usb_submit_urb(urb, GFP_KERNEL); |
228 | if (ret < 0) { | 229 | if (ret < 0) { |
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 83a718f0f3f9..9052d5702556 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -2357,8 +2357,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
2357 | (data[33] << 10); | 2357 | (data[33] << 10); |
2358 | avg_lum >>= 9; | 2358 | avg_lum >>= 9; |
2359 | atomic_set(&sd->avg_lum, avg_lum); | 2359 | atomic_set(&sd->avg_lum, avg_lum); |
2360 | gspca_frame_add(gspca_dev, LAST_PACKET, | 2360 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); |
2361 | data, len); | ||
2362 | return; | 2361 | return; |
2363 | } | 2362 | } |
2364 | if (gspca_dev->last_packet_type == LAST_PACKET) { | 2363 | if (gspca_dev->last_packet_type == LAST_PACKET) { |
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index be03a712731c..f0316d02f09f 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c | |||
@@ -466,6 +466,8 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar | |||
466 | struct fb_vblank vblank; | 466 | struct fb_vblank vblank; |
467 | u32 trace; | 467 | u32 trace; |
468 | 468 | ||
469 | memset(&vblank, 0, sizeof(struct fb_vblank)); | ||
470 | |||
469 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | | 471 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | |
470 | FB_VBLANK_HAVE_VSYNC; | 472 | FB_VBLANK_HAVE_VSYNC; |
471 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; | 473 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; |
diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index 4525335f9bd4..a7210d981388 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c | |||
@@ -239,7 +239,7 @@ static int device_process(struct m2mtest_ctx *ctx, | |||
239 | return -EFAULT; | 239 | return -EFAULT; |
240 | } | 240 | } |
241 | 241 | ||
242 | if (in_buf->vb.size < out_buf->vb.size) { | 242 | if (in_buf->vb.size > out_buf->vb.size) { |
243 | v4l2_err(&dev->v4l2_dev, "Output buffer is too small\n"); | 243 | v4l2_err(&dev->v4l2_dev, "Output buffer is too small\n"); |
244 | return -EINVAL; | 244 | return -EINVAL; |
245 | } | 245 | } |
@@ -1014,6 +1014,7 @@ static int m2mtest_remove(struct platform_device *pdev) | |||
1014 | v4l2_m2m_release(dev->m2m_dev); | 1014 | v4l2_m2m_release(dev->m2m_dev); |
1015 | del_timer_sync(&dev->timer); | 1015 | del_timer_sync(&dev->timer); |
1016 | video_unregister_device(dev->vfd); | 1016 | video_unregister_device(dev->vfd); |
1017 | video_device_release(dev->vfd); | ||
1017 | v4l2_device_unregister(&dev->v4l2_dev); | 1018 | v4l2_device_unregister(&dev->v4l2_dev); |
1018 | kfree(dev); | 1019 | kfree(dev); |
1019 | 1020 | ||
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index 758a4db27d65..c71af4e0e517 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c | |||
@@ -447,6 +447,9 @@ static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | |||
447 | dev_dbg(&client->dev, "%s left=%d, top=%d, width=%d, height=%d\n", | 447 | dev_dbg(&client->dev, "%s left=%d, top=%d, width=%d, height=%d\n", |
448 | __func__, rect.left, rect.top, rect.width, rect.height); | 448 | __func__, rect.left, rect.top, rect.width, rect.height); |
449 | 449 | ||
450 | if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
451 | return -EINVAL; | ||
452 | |||
450 | ret = mt9m111_make_rect(client, &rect); | 453 | ret = mt9m111_make_rect(client, &rect); |
451 | if (!ret) | 454 | if (!ret) |
452 | mt9m111->rect = rect; | 455 | mt9m111->rect = rect; |
@@ -466,12 +469,14 @@ static int mt9m111_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | |||
466 | 469 | ||
467 | static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) | 470 | static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) |
468 | { | 471 | { |
472 | if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
473 | return -EINVAL; | ||
474 | |||
469 | a->bounds.left = MT9M111_MIN_DARK_COLS; | 475 | a->bounds.left = MT9M111_MIN_DARK_COLS; |
470 | a->bounds.top = MT9M111_MIN_DARK_ROWS; | 476 | a->bounds.top = MT9M111_MIN_DARK_ROWS; |
471 | a->bounds.width = MT9M111_MAX_WIDTH; | 477 | a->bounds.width = MT9M111_MAX_WIDTH; |
472 | a->bounds.height = MT9M111_MAX_HEIGHT; | 478 | a->bounds.height = MT9M111_MAX_HEIGHT; |
473 | a->defrect = a->bounds; | 479 | a->defrect = a->bounds; |
474 | a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
475 | a->pixelaspect.numerator = 1; | 480 | a->pixelaspect.numerator = 1; |
476 | a->pixelaspect.denominator = 1; | 481 | a->pixelaspect.denominator = 1; |
477 | 482 | ||
@@ -487,6 +492,7 @@ static int mt9m111_g_fmt(struct v4l2_subdev *sd, | |||
487 | mf->width = mt9m111->rect.width; | 492 | mf->width = mt9m111->rect.width; |
488 | mf->height = mt9m111->rect.height; | 493 | mf->height = mt9m111->rect.height; |
489 | mf->code = mt9m111->fmt->code; | 494 | mf->code = mt9m111->fmt->code; |
495 | mf->colorspace = mt9m111->fmt->colorspace; | ||
490 | mf->field = V4L2_FIELD_NONE; | 496 | mf->field = V4L2_FIELD_NONE; |
491 | 497 | ||
492 | return 0; | 498 | return 0; |
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index e7cd23cd6394..b48473c7896b 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
@@ -402,9 +402,6 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd, | |||
402 | if (mt9v022->model != V4L2_IDENT_MT9V022IX7ATC) | 402 | if (mt9v022->model != V4L2_IDENT_MT9V022IX7ATC) |
403 | return -EINVAL; | 403 | return -EINVAL; |
404 | break; | 404 | break; |
405 | case 0: | ||
406 | /* No format change, only geometry */ | ||
407 | break; | ||
408 | default: | 405 | default: |
409 | return -EINVAL; | 406 | return -EINVAL; |
410 | } | 407 | } |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 66ff174151b5..b6ea67221d1d 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -378,6 +378,9 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb, | |||
378 | 378 | ||
379 | spin_lock_irqsave(&pcdev->lock, flags); | 379 | spin_lock_irqsave(&pcdev->lock, flags); |
380 | 380 | ||
381 | if (*fb_active == NULL) | ||
382 | goto out; | ||
383 | |||
381 | vb = &(*fb_active)->vb; | 384 | vb = &(*fb_active)->vb; |
382 | dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 385 | dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
383 | vb, vb->baddr, vb->bsize); | 386 | vb, vb->baddr, vb->bsize); |
@@ -402,6 +405,7 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb, | |||
402 | 405 | ||
403 | *fb_active = buf; | 406 | *fb_active = buf; |
404 | 407 | ||
408 | out: | ||
405 | spin_unlock_irqrestore(&pcdev->lock, flags); | 409 | spin_unlock_irqrestore(&pcdev->lock, flags); |
406 | } | 410 | } |
407 | 411 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index 1b992b847198..55ea914c7fcd 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |||
@@ -513,7 +513,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, | |||
513 | if (ret >= 0) { | 513 | if (ret >= 0) { |
514 | ret = pvr2_ctrl_range_check(cptr,*valptr); | 514 | ret = pvr2_ctrl_range_check(cptr,*valptr); |
515 | } | 515 | } |
516 | if (maskptr) *maskptr = ~0; | 516 | *maskptr = ~0; |
517 | } else if (cptr->info->type == pvr2_ctl_bool) { | 517 | } else if (cptr->info->type == pvr2_ctl_bool) { |
518 | ret = parse_token(ptr,len,valptr,boolNames, | 518 | ret = parse_token(ptr,len,valptr,boolNames, |
519 | ARRAY_SIZE(boolNames)); | 519 | ARRAY_SIZE(boolNames)); |
@@ -522,7 +522,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, | |||
522 | } else if (ret == 0) { | 522 | } else if (ret == 0) { |
523 | *valptr = (*valptr & 1) ? !0 : 0; | 523 | *valptr = (*valptr & 1) ? !0 : 0; |
524 | } | 524 | } |
525 | if (maskptr) *maskptr = 1; | 525 | *maskptr = 1; |
526 | } else if (cptr->info->type == pvr2_ctl_enum) { | 526 | } else if (cptr->info->type == pvr2_ctl_enum) { |
527 | ret = parse_token( | 527 | ret = parse_token( |
528 | ptr,len,valptr, | 528 | ptr,len,valptr, |
@@ -531,7 +531,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, | |||
531 | if (ret >= 0) { | 531 | if (ret >= 0) { |
532 | ret = pvr2_ctrl_range_check(cptr,*valptr); | 532 | ret = pvr2_ctrl_range_check(cptr,*valptr); |
533 | } | 533 | } |
534 | if (maskptr) *maskptr = ~0; | 534 | *maskptr = ~0; |
535 | } else if (cptr->info->type == pvr2_ctl_bitmask) { | 535 | } else if (cptr->info->type == pvr2_ctl_bitmask) { |
536 | ret = parse_tlist( | 536 | ret = parse_tlist( |
537 | ptr,len,maskptr,valptr, | 537 | ptr,len,maskptr,valptr, |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index b151c7be8a50..6961c55baf9b 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -393,6 +393,37 @@ static void fimc_set_yuv_order(struct fimc_ctx *ctx) | |||
393 | dbg("ctx->out_order_1p= %d", ctx->out_order_1p); | 393 | dbg("ctx->out_order_1p= %d", ctx->out_order_1p); |
394 | } | 394 | } |
395 | 395 | ||
396 | static void fimc_prepare_dma_offset(struct fimc_ctx *ctx, struct fimc_frame *f) | ||
397 | { | ||
398 | struct samsung_fimc_variant *variant = ctx->fimc_dev->variant; | ||
399 | |||
400 | f->dma_offset.y_h = f->offs_h; | ||
401 | if (!variant->pix_hoff) | ||
402 | f->dma_offset.y_h *= (f->fmt->depth >> 3); | ||
403 | |||
404 | f->dma_offset.y_v = f->offs_v; | ||
405 | |||
406 | f->dma_offset.cb_h = f->offs_h; | ||
407 | f->dma_offset.cb_v = f->offs_v; | ||
408 | |||
409 | f->dma_offset.cr_h = f->offs_h; | ||
410 | f->dma_offset.cr_v = f->offs_v; | ||
411 | |||
412 | if (!variant->pix_hoff) { | ||
413 | if (f->fmt->planes_cnt == 3) { | ||
414 | f->dma_offset.cb_h >>= 1; | ||
415 | f->dma_offset.cr_h >>= 1; | ||
416 | } | ||
417 | if (f->fmt->color == S5P_FIMC_YCBCR420) { | ||
418 | f->dma_offset.cb_v >>= 1; | ||
419 | f->dma_offset.cr_v >>= 1; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | dbg("in_offset: color= %d, y_h= %d, y_v= %d", | ||
424 | f->fmt->color, f->dma_offset.y_h, f->dma_offset.y_v); | ||
425 | } | ||
426 | |||
396 | /** | 427 | /** |
397 | * fimc_prepare_config - check dimensions, operation and color mode | 428 | * fimc_prepare_config - check dimensions, operation and color mode |
398 | * and pre-calculate offset and the scaling coefficients. | 429 | * and pre-calculate offset and the scaling coefficients. |
@@ -406,7 +437,6 @@ static int fimc_prepare_config(struct fimc_ctx *ctx, u32 flags) | |||
406 | { | 437 | { |
407 | struct fimc_frame *s_frame, *d_frame; | 438 | struct fimc_frame *s_frame, *d_frame; |
408 | struct fimc_vid_buffer *buf = NULL; | 439 | struct fimc_vid_buffer *buf = NULL; |
409 | struct samsung_fimc_variant *variant = ctx->fimc_dev->variant; | ||
410 | int ret = 0; | 440 | int ret = 0; |
411 | 441 | ||
412 | s_frame = &ctx->s_frame; | 442 | s_frame = &ctx->s_frame; |
@@ -419,61 +449,16 @@ static int fimc_prepare_config(struct fimc_ctx *ctx, u32 flags) | |||
419 | swap(d_frame->width, d_frame->height); | 449 | swap(d_frame->width, d_frame->height); |
420 | } | 450 | } |
421 | 451 | ||
422 | /* Prepare the output offset ratios for scaler. */ | 452 | /* Prepare the DMA offset ratios for scaler. */ |
423 | d_frame->dma_offset.y_h = d_frame->offs_h; | 453 | fimc_prepare_dma_offset(ctx, &ctx->s_frame); |
424 | if (!variant->pix_hoff) | 454 | fimc_prepare_dma_offset(ctx, &ctx->d_frame); |
425 | d_frame->dma_offset.y_h *= (d_frame->fmt->depth >> 3); | ||
426 | |||
427 | d_frame->dma_offset.y_v = d_frame->offs_v; | ||
428 | |||
429 | d_frame->dma_offset.cb_h = d_frame->offs_h; | ||
430 | d_frame->dma_offset.cb_v = d_frame->offs_v; | ||
431 | |||
432 | d_frame->dma_offset.cr_h = d_frame->offs_h; | ||
433 | d_frame->dma_offset.cr_v = d_frame->offs_v; | ||
434 | 455 | ||
435 | if (!variant->pix_hoff && d_frame->fmt->planes_cnt == 3) { | ||
436 | d_frame->dma_offset.cb_h >>= 1; | ||
437 | d_frame->dma_offset.cb_v >>= 1; | ||
438 | d_frame->dma_offset.cr_h >>= 1; | ||
439 | d_frame->dma_offset.cr_v >>= 1; | ||
440 | } | ||
441 | |||
442 | dbg("out offset: color= %d, y_h= %d, y_v= %d", | ||
443 | d_frame->fmt->color, | ||
444 | d_frame->dma_offset.y_h, d_frame->dma_offset.y_v); | ||
445 | |||
446 | /* Prepare the input offset ratios for scaler. */ | ||
447 | s_frame->dma_offset.y_h = s_frame->offs_h; | ||
448 | if (!variant->pix_hoff) | ||
449 | s_frame->dma_offset.y_h *= (s_frame->fmt->depth >> 3); | ||
450 | s_frame->dma_offset.y_v = s_frame->offs_v; | ||
451 | |||
452 | s_frame->dma_offset.cb_h = s_frame->offs_h; | ||
453 | s_frame->dma_offset.cb_v = s_frame->offs_v; | ||
454 | |||
455 | s_frame->dma_offset.cr_h = s_frame->offs_h; | ||
456 | s_frame->dma_offset.cr_v = s_frame->offs_v; | ||
457 | |||
458 | if (!variant->pix_hoff && s_frame->fmt->planes_cnt == 3) { | ||
459 | s_frame->dma_offset.cb_h >>= 1; | ||
460 | s_frame->dma_offset.cb_v >>= 1; | ||
461 | s_frame->dma_offset.cr_h >>= 1; | ||
462 | s_frame->dma_offset.cr_v >>= 1; | ||
463 | } | ||
464 | |||
465 | dbg("in offset: color= %d, y_h= %d, y_v= %d", | ||
466 | s_frame->fmt->color, s_frame->dma_offset.y_h, | ||
467 | s_frame->dma_offset.y_v); | ||
468 | |||
469 | fimc_set_yuv_order(ctx); | ||
470 | |||
471 | /* Check against the scaler ratio. */ | ||
472 | if (s_frame->height > (SCALER_MAX_VRATIO * d_frame->height) || | 456 | if (s_frame->height > (SCALER_MAX_VRATIO * d_frame->height) || |
473 | s_frame->width > (SCALER_MAX_HRATIO * d_frame->width)) { | 457 | s_frame->width > (SCALER_MAX_HRATIO * d_frame->width)) { |
474 | err("out of scaler range"); | 458 | err("out of scaler range"); |
475 | return -EINVAL; | 459 | return -EINVAL; |
476 | } | 460 | } |
461 | fimc_set_yuv_order(ctx); | ||
477 | } | 462 | } |
478 | 463 | ||
479 | /* Input DMA mode is not allowed when the scaler is disabled. */ | 464 | /* Input DMA mode is not allowed when the scaler is disabled. */ |
@@ -822,7 +807,8 @@ static int fimc_m2m_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
822 | } else { | 807 | } else { |
823 | v4l2_err(&ctx->fimc_dev->m2m.v4l2_dev, | 808 | v4l2_err(&ctx->fimc_dev->m2m.v4l2_dev, |
824 | "Wrong buffer/video queue type (%d)\n", f->type); | 809 | "Wrong buffer/video queue type (%d)\n", f->type); |
825 | return -EINVAL; | 810 | ret = -EINVAL; |
811 | goto s_fmt_out; | ||
826 | } | 812 | } |
827 | 813 | ||
828 | pix = &f->fmt.pix; | 814 | pix = &f->fmt.pix; |
@@ -1414,8 +1400,10 @@ static int fimc_probe(struct platform_device *pdev) | |||
1414 | } | 1400 | } |
1415 | 1401 | ||
1416 | fimc->work_queue = create_workqueue(dev_name(&fimc->pdev->dev)); | 1402 | fimc->work_queue = create_workqueue(dev_name(&fimc->pdev->dev)); |
1417 | if (!fimc->work_queue) | 1403 | if (!fimc->work_queue) { |
1404 | ret = -ENOMEM; | ||
1418 | goto err_irq; | 1405 | goto err_irq; |
1406 | } | ||
1419 | 1407 | ||
1420 | ret = fimc_register_m2m_device(fimc); | 1408 | ret = fimc_register_m2m_device(fimc); |
1421 | if (ret) | 1409 | if (ret) |
@@ -1492,6 +1480,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = { | |||
1492 | }; | 1480 | }; |
1493 | 1481 | ||
1494 | static struct samsung_fimc_variant fimc01_variant_s5pv210 = { | 1482 | static struct samsung_fimc_variant fimc01_variant_s5pv210 = { |
1483 | .pix_hoff = 1, | ||
1495 | .has_inp_rot = 1, | 1484 | .has_inp_rot = 1, |
1496 | .has_out_rot = 1, | 1485 | .has_out_rot = 1, |
1497 | .min_inp_pixsize = 16, | 1486 | .min_inp_pixsize = 16, |
@@ -1506,6 +1495,7 @@ static struct samsung_fimc_variant fimc01_variant_s5pv210 = { | |||
1506 | }; | 1495 | }; |
1507 | 1496 | ||
1508 | static struct samsung_fimc_variant fimc2_variant_s5pv210 = { | 1497 | static struct samsung_fimc_variant fimc2_variant_s5pv210 = { |
1498 | .pix_hoff = 1, | ||
1509 | .min_inp_pixsize = 16, | 1499 | .min_inp_pixsize = 16, |
1510 | .min_out_pixsize = 32, | 1500 | .min_out_pixsize = 32, |
1511 | 1501 | ||
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index ec697fcd406e..bb8d83d8ddaf 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -4323,13 +4323,13 @@ struct saa7134_board saa7134_boards[] = { | |||
4323 | }, | 4323 | }, |
4324 | [SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM] = { | 4324 | [SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM] = { |
4325 | /* Beholder Intl. Ltd. 2008 */ | 4325 | /* Beholder Intl. Ltd. 2008 */ |
4326 | /*Dmitry Belimov <d.belimov@gmail.com> */ | 4326 | /* Dmitry Belimov <d.belimov@gmail.com> */ |
4327 | .name = "Beholder BeholdTV Columbus TVFM", | 4327 | .name = "Beholder BeholdTV Columbus TV/FM", |
4328 | .audio_clock = 0x00187de7, | 4328 | .audio_clock = 0x00187de7, |
4329 | .tuner_type = TUNER_ALPS_TSBE5_PAL, | 4329 | .tuner_type = TUNER_ALPS_TSBE5_PAL, |
4330 | .radio_type = UNSET, | 4330 | .radio_type = TUNER_TEA5767, |
4331 | .tuner_addr = ADDR_UNSET, | 4331 | .tuner_addr = 0xc2 >> 1, |
4332 | .radio_addr = ADDR_UNSET, | 4332 | .radio_addr = 0xc0 >> 1, |
4333 | .tda9887_conf = TDA9887_PRESENT, | 4333 | .tda9887_conf = TDA9887_PRESENT, |
4334 | .gpiomask = 0x000A8004, | 4334 | .gpiomask = 0x000A8004, |
4335 | .inputs = {{ | 4335 | .inputs = {{ |
diff --git a/drivers/media/video/saa7164/saa7164-buffer.c b/drivers/media/video/saa7164/saa7164-buffer.c index 5713f3a4b76c..ddd25d32723d 100644 --- a/drivers/media/video/saa7164/saa7164-buffer.c +++ b/drivers/media/video/saa7164/saa7164-buffer.c | |||
@@ -136,10 +136,11 @@ ret: | |||
136 | int saa7164_buffer_dealloc(struct saa7164_tsport *port, | 136 | int saa7164_buffer_dealloc(struct saa7164_tsport *port, |
137 | struct saa7164_buffer *buf) | 137 | struct saa7164_buffer *buf) |
138 | { | 138 | { |
139 | struct saa7164_dev *dev = port->dev; | 139 | struct saa7164_dev *dev; |
140 | 140 | ||
141 | if ((buf == 0) || (port == 0)) | 141 | if (!buf || !port) |
142 | return SAA_ERR_BAD_PARAMETER; | 142 | return SAA_ERR_BAD_PARAMETER; |
143 | dev = port->dev; | ||
143 | 144 | ||
144 | dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf); | 145 | dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf); |
145 | 146 | ||
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 8bdd940f32e6..2ac85d8984f0 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c | |||
@@ -486,6 +486,12 @@ static int uvc_parse_format(struct uvc_device *dev, | |||
486 | max(frame->dwFrameInterval[0], | 486 | max(frame->dwFrameInterval[0], |
487 | frame->dwDefaultFrameInterval)); | 487 | frame->dwDefaultFrameInterval)); |
488 | 488 | ||
489 | if (dev->quirks & UVC_QUIRK_RESTRICT_FRAME_RATE) { | ||
490 | frame->bFrameIntervalType = 1; | ||
491 | frame->dwFrameInterval[0] = | ||
492 | frame->dwDefaultFrameInterval; | ||
493 | } | ||
494 | |||
489 | uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n", | 495 | uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n", |
490 | frame->wWidth, frame->wHeight, | 496 | frame->wWidth, frame->wHeight, |
491 | 10000000/frame->dwDefaultFrameInterval, | 497 | 10000000/frame->dwDefaultFrameInterval, |
@@ -2026,6 +2032,15 @@ static struct usb_device_id uvc_ids[] = { | |||
2026 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, | 2032 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, |
2027 | .bInterfaceSubClass = 1, | 2033 | .bInterfaceSubClass = 1, |
2028 | .bInterfaceProtocol = 0 }, | 2034 | .bInterfaceProtocol = 0 }, |
2035 | /* Chicony CNF7129 (Asus EEE 100HE) */ | ||
2036 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
2037 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
2038 | .idVendor = 0x04f2, | ||
2039 | .idProduct = 0xb071, | ||
2040 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
2041 | .bInterfaceSubClass = 1, | ||
2042 | .bInterfaceProtocol = 0, | ||
2043 | .driver_info = UVC_QUIRK_RESTRICT_FRAME_RATE }, | ||
2029 | /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */ | 2044 | /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */ |
2030 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2045 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2031 | | USB_DEVICE_ID_MATCH_INT_INFO, | 2046 | | USB_DEVICE_ID_MATCH_INT_INFO, |
@@ -2091,6 +2106,15 @@ static struct usb_device_id uvc_ids[] = { | |||
2091 | .bInterfaceProtocol = 0, | 2106 | .bInterfaceProtocol = 0, |
2092 | .driver_info = UVC_QUIRK_PROBE_MINMAX | 2107 | .driver_info = UVC_QUIRK_PROBE_MINMAX |
2093 | | UVC_QUIRK_PROBE_DEF }, | 2108 | | UVC_QUIRK_PROBE_DEF }, |
2109 | /* IMC Networks (Medion Akoya) */ | ||
2110 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
2111 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
2112 | .idVendor = 0x13d3, | ||
2113 | .idProduct = 0x5103, | ||
2114 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
2115 | .bInterfaceSubClass = 1, | ||
2116 | .bInterfaceProtocol = 0, | ||
2117 | .driver_info = UVC_QUIRK_STREAM_NO_FID }, | ||
2094 | /* Syntek (HP Spartan) */ | 2118 | /* Syntek (HP Spartan) */ |
2095 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2119 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2096 | | USB_DEVICE_ID_MATCH_INT_INFO, | 2120 | | USB_DEVICE_ID_MATCH_INT_INFO, |
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h index bdacf3beabf5..892e0e51916c 100644 --- a/drivers/media/video/uvc/uvcvideo.h +++ b/drivers/media/video/uvc/uvcvideo.h | |||
@@ -182,6 +182,7 @@ struct uvc_xu_control { | |||
182 | #define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020 | 182 | #define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020 |
183 | #define UVC_QUIRK_FIX_BANDWIDTH 0x00000080 | 183 | #define UVC_QUIRK_FIX_BANDWIDTH 0x00000080 |
184 | #define UVC_QUIRK_PROBE_DEF 0x00000100 | 184 | #define UVC_QUIRK_PROBE_DEF 0x00000100 |
185 | #define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200 | ||
185 | 186 | ||
186 | /* Format flags */ | 187 | /* Format flags */ |
187 | #define UVC_FMT_FLAG_COMPRESSED 0x00000001 | 188 | #define UVC_FMT_FLAG_COMPRESSED 0x00000001 |
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index 372b87efcd05..6ff9e4bac3ea 100644 --- a/drivers/media/video/videobuf-dma-contig.c +++ b/drivers/media/video/videobuf-dma-contig.c | |||
@@ -393,8 +393,10 @@ void videobuf_dma_contig_free(struct videobuf_queue *q, | |||
393 | } | 393 | } |
394 | 394 | ||
395 | /* read() method */ | 395 | /* read() method */ |
396 | dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle); | 396 | if (mem->vaddr) { |
397 | mem->vaddr = NULL; | 397 | dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle); |
398 | mem->vaddr = NULL; | ||
399 | } | ||
398 | } | 400 | } |
399 | EXPORT_SYMBOL_GPL(videobuf_dma_contig_free); | 401 | EXPORT_SYMBOL_GPL(videobuf_dma_contig_free); |
400 | 402 | ||
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 06f9a9c2a39a..2ad0bc252b0e 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -94,7 +94,7 @@ err: | |||
94 | * must free the memory. | 94 | * must free the memory. |
95 | */ | 95 | */ |
96 | static struct scatterlist *videobuf_pages_to_sg(struct page **pages, | 96 | static struct scatterlist *videobuf_pages_to_sg(struct page **pages, |
97 | int nr_pages, int offset) | 97 | int nr_pages, int offset, size_t size) |
98 | { | 98 | { |
99 | struct scatterlist *sglist; | 99 | struct scatterlist *sglist; |
100 | int i; | 100 | int i; |
@@ -110,12 +110,14 @@ static struct scatterlist *videobuf_pages_to_sg(struct page **pages, | |||
110 | /* DMA to highmem pages might not work */ | 110 | /* DMA to highmem pages might not work */ |
111 | goto highmem; | 111 | goto highmem; |
112 | sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset); | 112 | sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset); |
113 | size -= PAGE_SIZE - offset; | ||
113 | for (i = 1; i < nr_pages; i++) { | 114 | for (i = 1; i < nr_pages; i++) { |
114 | if (NULL == pages[i]) | 115 | if (NULL == pages[i]) |
115 | goto nopage; | 116 | goto nopage; |
116 | if (PageHighMem(pages[i])) | 117 | if (PageHighMem(pages[i])) |
117 | goto highmem; | 118 | goto highmem; |
118 | sg_set_page(&sglist[i], pages[i], PAGE_SIZE, 0); | 119 | sg_set_page(&sglist[i], pages[i], min(PAGE_SIZE, size), 0); |
120 | size -= min(PAGE_SIZE, size); | ||
119 | } | 121 | } |
120 | return sglist; | 122 | return sglist; |
121 | 123 | ||
@@ -170,7 +172,8 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, | |||
170 | 172 | ||
171 | first = (data & PAGE_MASK) >> PAGE_SHIFT; | 173 | first = (data & PAGE_MASK) >> PAGE_SHIFT; |
172 | last = ((data+size-1) & PAGE_MASK) >> PAGE_SHIFT; | 174 | last = ((data+size-1) & PAGE_MASK) >> PAGE_SHIFT; |
173 | dma->offset = data & ~PAGE_MASK; | 175 | dma->offset = data & ~PAGE_MASK; |
176 | dma->size = size; | ||
174 | dma->nr_pages = last-first+1; | 177 | dma->nr_pages = last-first+1; |
175 | dma->pages = kmalloc(dma->nr_pages * sizeof(struct page *), GFP_KERNEL); | 178 | dma->pages = kmalloc(dma->nr_pages * sizeof(struct page *), GFP_KERNEL); |
176 | if (NULL == dma->pages) | 179 | if (NULL == dma->pages) |
@@ -252,7 +255,7 @@ int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma) | |||
252 | 255 | ||
253 | if (dma->pages) { | 256 | if (dma->pages) { |
254 | dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages, | 257 | dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages, |
255 | dma->offset); | 258 | dma->offset, dma->size); |
256 | } | 259 | } |
257 | if (dma->vaddr) { | 260 | if (dma->vaddr) { |
258 | dma->sglist = videobuf_vmalloc_to_sg(dma->vaddr, | 261 | dma->sglist = videobuf_vmalloc_to_sg(dma->vaddr, |
diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 04028a9ee082..428377a5a6f5 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c | |||
@@ -429,24 +429,25 @@ static void max8925_irq_sync_unlock(unsigned int irq) | |||
429 | irq_tsc = cache_tsc; | 429 | irq_tsc = cache_tsc; |
430 | for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) { | 430 | for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) { |
431 | irq_data = &max8925_irqs[i]; | 431 | irq_data = &max8925_irqs[i]; |
432 | /* 1 -- disable, 0 -- enable */ | ||
432 | switch (irq_data->mask_reg) { | 433 | switch (irq_data->mask_reg) { |
433 | case MAX8925_CHG_IRQ1_MASK: | 434 | case MAX8925_CHG_IRQ1_MASK: |
434 | irq_chg[0] &= irq_data->enable; | 435 | irq_chg[0] &= ~irq_data->enable; |
435 | break; | 436 | break; |
436 | case MAX8925_CHG_IRQ2_MASK: | 437 | case MAX8925_CHG_IRQ2_MASK: |
437 | irq_chg[1] &= irq_data->enable; | 438 | irq_chg[1] &= ~irq_data->enable; |
438 | break; | 439 | break; |
439 | case MAX8925_ON_OFF_IRQ1_MASK: | 440 | case MAX8925_ON_OFF_IRQ1_MASK: |
440 | irq_on[0] &= irq_data->enable; | 441 | irq_on[0] &= ~irq_data->enable; |
441 | break; | 442 | break; |
442 | case MAX8925_ON_OFF_IRQ2_MASK: | 443 | case MAX8925_ON_OFF_IRQ2_MASK: |
443 | irq_on[1] &= irq_data->enable; | 444 | irq_on[1] &= ~irq_data->enable; |
444 | break; | 445 | break; |
445 | case MAX8925_RTC_IRQ_MASK: | 446 | case MAX8925_RTC_IRQ_MASK: |
446 | irq_rtc &= irq_data->enable; | 447 | irq_rtc &= ~irq_data->enable; |
447 | break; | 448 | break; |
448 | case MAX8925_TSC_IRQ_MASK: | 449 | case MAX8925_TSC_IRQ_MASK: |
449 | irq_tsc &= irq_data->enable; | 450 | irq_tsc &= ~irq_data->enable; |
450 | break; | 451 | break; |
451 | default: | 452 | default: |
452 | dev_err(chip->dev, "wrong IRQ\n"); | 453 | dev_err(chip->dev, "wrong IRQ\n"); |
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c index 7dabe4dbd373..294183b6260b 100644 --- a/drivers/mfd/wm831x-irq.c +++ b/drivers/mfd/wm831x-irq.c | |||
@@ -394,8 +394,13 @@ static int wm831x_irq_set_type(unsigned int irq, unsigned int type) | |||
394 | 394 | ||
395 | irq = irq - wm831x->irq_base; | 395 | irq = irq - wm831x->irq_base; |
396 | 396 | ||
397 | if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) | 397 | if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) { |
398 | return -EINVAL; | 398 | /* Ignore internal-only IRQs */ |
399 | if (irq >= 0 && irq < WM831X_NUM_IRQS) | ||
400 | return 0; | ||
401 | else | ||
402 | return -EINVAL; | ||
403 | } | ||
399 | 404 | ||
400 | switch (type) { | 405 | switch (type) { |
401 | case IRQ_TYPE_EDGE_BOTH: | 406 | case IRQ_TYPE_EDGE_BOTH: |
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c index 714c6b487313..d5f3a3fd2319 100644 --- a/drivers/misc/bh1780gli.c +++ b/drivers/misc/bh1780gli.c | |||
@@ -190,7 +190,6 @@ static int __devexit bh1780_remove(struct i2c_client *client) | |||
190 | 190 | ||
191 | ddata = i2c_get_clientdata(client); | 191 | ddata = i2c_get_clientdata(client); |
192 | sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group); | 192 | sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group); |
193 | i2c_set_clientdata(client, NULL); | ||
194 | kfree(ddata); | 193 | kfree(ddata); |
195 | 194 | ||
196 | return 0; | 195 | return 0; |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 133d51528f8d..513e0a76a4a7 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -413,7 +413,7 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr, | |||
413 | prefetch_status = gpmc_read_status(GPMC_PREFETCH_COUNT); | 413 | prefetch_status = gpmc_read_status(GPMC_PREFETCH_COUNT); |
414 | } while (prefetch_status); | 414 | } while (prefetch_status); |
415 | /* disable and stop the PFPW engine */ | 415 | /* disable and stop the PFPW engine */ |
416 | gpmc_prefetch_reset(); | 416 | gpmc_prefetch_reset(info->gpmc_cs); |
417 | 417 | ||
418 | dma_unmap_single(&info->pdev->dev, dma_addr, len, dir); | 418 | dma_unmap_single(&info->pdev->dev, dma_addr, len, dir); |
419 | return 0; | 419 | return 0; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 2cc81a54cbf3..77efe462b921 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2,6 +2,9 @@ | |||
2 | # Network device configuration | 2 | # Network device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | config HAVE_NET_MACB | ||
6 | bool | ||
7 | |||
5 | menuconfig NETDEVICES | 8 | menuconfig NETDEVICES |
6 | default y if UML | 9 | default y if UML |
7 | depends on NET | 10 | depends on NET |
@@ -221,7 +224,7 @@ config MII | |||
221 | 224 | ||
222 | config MACB | 225 | config MACB |
223 | tristate "Atmel MACB support" | 226 | tristate "Atmel MACB support" |
224 | depends on AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263 || ARCH_AT91SAM9G20 || ARCH_AT91SAM9G45 || ARCH_AT91CAP9 | 227 | depends on HAVE_NET_MACB |
225 | select PHYLIB | 228 | select PHYLIB |
226 | help | 229 | help |
227 | The Atmel MACB ethernet interface is found on many AT32 and AT91 | 230 | The Atmel MACB ethernet interface is found on many AT32 and AT91 |
@@ -2428,7 +2431,7 @@ config UGETH_TX_ON_DEMAND | |||
2428 | 2431 | ||
2429 | config MV643XX_ETH | 2432 | config MV643XX_ETH |
2430 | tristate "Marvell Discovery (643XX) and Orion ethernet support" | 2433 | tristate "Marvell Discovery (643XX) and Orion ethernet support" |
2431 | depends on MV64X60 || PPC32 || PLAT_ORION | 2434 | depends on (MV64X60 || PPC32 || PLAT_ORION) && INET |
2432 | select INET_LRO | 2435 | select INET_LRO |
2433 | select PHYLIB | 2436 | select PHYLIB |
2434 | help | 2437 | help |
@@ -2803,7 +2806,7 @@ config NIU | |||
2803 | 2806 | ||
2804 | config PASEMI_MAC | 2807 | config PASEMI_MAC |
2805 | tristate "PA Semi 1/10Gbit MAC" | 2808 | tristate "PA Semi 1/10Gbit MAC" |
2806 | depends on PPC_PASEMI && PCI | 2809 | depends on PPC_PASEMI && PCI && INET |
2807 | select PHYLIB | 2810 | select PHYLIB |
2808 | select INET_LRO | 2811 | select INET_LRO |
2809 | help | 2812 | help |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 1e620e287ae0..efeffdf9e5fa 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -2170,8 +2170,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
2170 | dev->irq = sdev->irq; | 2170 | dev->irq = sdev->irq; |
2171 | SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); | 2171 | SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); |
2172 | 2172 | ||
2173 | netif_carrier_off(dev); | ||
2174 | |||
2175 | err = ssb_bus_powerup(sdev->bus, 0); | 2173 | err = ssb_bus_powerup(sdev->bus, 0); |
2176 | if (err) { | 2174 | if (err) { |
2177 | dev_err(sdev->dev, | 2175 | dev_err(sdev->dev, |
@@ -2213,6 +2211,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
2213 | goto err_out_powerdown; | 2211 | goto err_out_powerdown; |
2214 | } | 2212 | } |
2215 | 2213 | ||
2214 | netif_carrier_off(dev); | ||
2215 | |||
2216 | ssb_set_drvdata(sdev, dev); | 2216 | ssb_set_drvdata(sdev, dev); |
2217 | 2217 | ||
2218 | /* Chip reset provides power to the b44 MAC & PCI cores, which | 2218 | /* Chip reset provides power to the b44 MAC & PCI cores, which |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3b16f62d5606..e953c6ad6e6d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -5164,6 +5164,15 @@ int bond_create(struct net *net, const char *name) | |||
5164 | res = dev_alloc_name(bond_dev, "bond%d"); | 5164 | res = dev_alloc_name(bond_dev, "bond%d"); |
5165 | if (res < 0) | 5165 | if (res < 0) |
5166 | goto out; | 5166 | goto out; |
5167 | } else { | ||
5168 | /* | ||
5169 | * If we're given a name to register | ||
5170 | * we need to ensure that its not already | ||
5171 | * registered | ||
5172 | */ | ||
5173 | res = -EEXIST; | ||
5174 | if (__dev_get_by_name(net, name) != NULL) | ||
5175 | goto out; | ||
5167 | } | 5176 | } |
5168 | 5177 | ||
5169 | res = register_netdevice(bond_dev); | 5178 | res = register_netdevice(bond_dev); |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index a333b42111b8..6372610ed240 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -533,8 +533,15 @@ static inline void ehea_fill_skb(struct net_device *dev, | |||
533 | int length = cqe->num_bytes_transfered - 4; /*remove CRC */ | 533 | int length = cqe->num_bytes_transfered - 4; /*remove CRC */ |
534 | 534 | ||
535 | skb_put(skb, length); | 535 | skb_put(skb, length); |
536 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
537 | skb->protocol = eth_type_trans(skb, dev); | 536 | skb->protocol = eth_type_trans(skb, dev); |
537 | |||
538 | /* The packet was not an IPV4 packet so a complemented checksum was | ||
539 | calculated. The value is found in the Internet Checksum field. */ | ||
540 | if (cqe->status & EHEA_CQE_BLIND_CKSUM) { | ||
541 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
542 | skb->csum = csum_unfold(~cqe->inet_checksum_value); | ||
543 | } else | ||
544 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
538 | } | 545 | } |
539 | 546 | ||
540 | static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, | 547 | static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, |
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h index f608a6c54af5..38104734a3be 100644 --- a/drivers/net/ehea/ehea_qmr.h +++ b/drivers/net/ehea/ehea_qmr.h | |||
@@ -150,6 +150,7 @@ struct ehea_rwqe { | |||
150 | #define EHEA_CQE_TYPE_RQ 0x60 | 150 | #define EHEA_CQE_TYPE_RQ 0x60 |
151 | #define EHEA_CQE_STAT_ERR_MASK 0x700F | 151 | #define EHEA_CQE_STAT_ERR_MASK 0x700F |
152 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF | 152 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF |
153 | #define EHEA_CQE_BLIND_CKSUM 0x8000 | ||
153 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 | 154 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 |
154 | #define EHEA_CQE_STAT_ERR_IP 0x2000 | 155 | #define EHEA_CQE_STAT_ERR_IP 0x2000 |
155 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 | 156 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 768b840aeb6b..cce32d43175f 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -678,24 +678,37 @@ static int fec_enet_mii_probe(struct net_device *dev) | |||
678 | { | 678 | { |
679 | struct fec_enet_private *fep = netdev_priv(dev); | 679 | struct fec_enet_private *fep = netdev_priv(dev); |
680 | struct phy_device *phy_dev = NULL; | 680 | struct phy_device *phy_dev = NULL; |
681 | int ret; | 681 | char mdio_bus_id[MII_BUS_ID_SIZE]; |
682 | char phy_name[MII_BUS_ID_SIZE + 3]; | ||
683 | int phy_id; | ||
682 | 684 | ||
683 | fep->phy_dev = NULL; | 685 | fep->phy_dev = NULL; |
684 | 686 | ||
685 | /* find the first phy */ | 687 | /* check for attached phy */ |
686 | phy_dev = phy_find_first(fep->mii_bus); | 688 | for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) { |
687 | if (!phy_dev) { | 689 | if ((fep->mii_bus->phy_mask & (1 << phy_id))) |
688 | printk(KERN_ERR "%s: no PHY found\n", dev->name); | 690 | continue; |
689 | return -ENODEV; | 691 | if (fep->mii_bus->phy_map[phy_id] == NULL) |
692 | continue; | ||
693 | if (fep->mii_bus->phy_map[phy_id]->phy_id == 0) | ||
694 | continue; | ||
695 | strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE); | ||
696 | break; | ||
690 | } | 697 | } |
691 | 698 | ||
692 | /* attach the mac to the phy */ | 699 | if (phy_id >= PHY_MAX_ADDR) { |
693 | ret = phy_connect_direct(dev, phy_dev, | 700 | printk(KERN_INFO "%s: no PHY, assuming direct connection " |
694 | &fec_enet_adjust_link, 0, | 701 | "to switch\n", dev->name); |
695 | PHY_INTERFACE_MODE_MII); | 702 | strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); |
696 | if (ret) { | 703 | phy_id = 0; |
697 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 704 | } |
698 | return ret; | 705 | |
706 | snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); | ||
707 | phy_dev = phy_connect(dev, phy_name, &fec_enet_adjust_link, 0, | ||
708 | PHY_INTERFACE_MODE_MII); | ||
709 | if (IS_ERR(phy_dev)) { | ||
710 | printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); | ||
711 | return PTR_ERR(phy_dev); | ||
699 | } | 712 | } |
700 | 713 | ||
701 | /* mask with MAC supported features */ | 714 | /* mask with MAC supported features */ |
@@ -738,7 +751,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
738 | fep->mii_bus->read = fec_enet_mdio_read; | 751 | fep->mii_bus->read = fec_enet_mdio_read; |
739 | fep->mii_bus->write = fec_enet_mdio_write; | 752 | fep->mii_bus->write = fec_enet_mdio_write; |
740 | fep->mii_bus->reset = fec_enet_mdio_reset; | 753 | fep->mii_bus->reset = fec_enet_mdio_reset; |
741 | snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); | 754 | snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id + 1); |
742 | fep->mii_bus->priv = fep; | 755 | fep->mii_bus->priv = fep; |
743 | fep->mii_bus->parent = &pdev->dev; | 756 | fep->mii_bus->parent = &pdev->dev; |
744 | 757 | ||
@@ -1311,6 +1324,9 @@ fec_probe(struct platform_device *pdev) | |||
1311 | if (ret) | 1324 | if (ret) |
1312 | goto failed_mii_init; | 1325 | goto failed_mii_init; |
1313 | 1326 | ||
1327 | /* Carrier starts down, phylib will bring it up */ | ||
1328 | netif_carrier_off(ndev); | ||
1329 | |||
1314 | ret = register_netdev(ndev); | 1330 | ret = register_netdev(ndev); |
1315 | if (ret) | 1331 | if (ret) |
1316 | goto failed_register; | 1332 | goto failed_register; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index a0da4a17b025..992db2fa136e 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1212,7 +1212,8 @@ static void rtl8169_update_counters(struct net_device *dev) | |||
1212 | if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) | 1212 | if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) |
1213 | return; | 1213 | return; |
1214 | 1214 | ||
1215 | counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); | 1215 | counters = dma_alloc_coherent(&tp->pci_dev->dev, sizeof(*counters), |
1216 | &paddr, GFP_KERNEL); | ||
1216 | if (!counters) | 1217 | if (!counters) |
1217 | return; | 1218 | return; |
1218 | 1219 | ||
@@ -1233,7 +1234,8 @@ static void rtl8169_update_counters(struct net_device *dev) | |||
1233 | RTL_W32(CounterAddrLow, 0); | 1234 | RTL_W32(CounterAddrLow, 0); |
1234 | RTL_W32(CounterAddrHigh, 0); | 1235 | RTL_W32(CounterAddrHigh, 0); |
1235 | 1236 | ||
1236 | pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); | 1237 | dma_free_coherent(&tp->pci_dev->dev, sizeof(*counters), counters, |
1238 | paddr); | ||
1237 | } | 1239 | } |
1238 | 1240 | ||
1239 | static void rtl8169_get_ethtool_stats(struct net_device *dev, | 1241 | static void rtl8169_get_ethtool_stats(struct net_device *dev, |
@@ -3292,15 +3294,15 @@ static int rtl8169_open(struct net_device *dev) | |||
3292 | 3294 | ||
3293 | /* | 3295 | /* |
3294 | * Rx and Tx desscriptors needs 256 bytes alignment. | 3296 | * Rx and Tx desscriptors needs 256 bytes alignment. |
3295 | * pci_alloc_consistent provides more. | 3297 | * dma_alloc_coherent provides more. |
3296 | */ | 3298 | */ |
3297 | tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, | 3299 | tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES, |
3298 | &tp->TxPhyAddr); | 3300 | &tp->TxPhyAddr, GFP_KERNEL); |
3299 | if (!tp->TxDescArray) | 3301 | if (!tp->TxDescArray) |
3300 | goto err_pm_runtime_put; | 3302 | goto err_pm_runtime_put; |
3301 | 3303 | ||
3302 | tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, | 3304 | tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES, |
3303 | &tp->RxPhyAddr); | 3305 | &tp->RxPhyAddr, GFP_KERNEL); |
3304 | if (!tp->RxDescArray) | 3306 | if (!tp->RxDescArray) |
3305 | goto err_free_tx_0; | 3307 | goto err_free_tx_0; |
3306 | 3308 | ||
@@ -3334,12 +3336,12 @@ out: | |||
3334 | err_release_ring_2: | 3336 | err_release_ring_2: |
3335 | rtl8169_rx_clear(tp); | 3337 | rtl8169_rx_clear(tp); |
3336 | err_free_rx_1: | 3338 | err_free_rx_1: |
3337 | pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, | 3339 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
3338 | tp->RxPhyAddr); | 3340 | tp->RxPhyAddr); |
3339 | tp->RxDescArray = NULL; | 3341 | tp->RxDescArray = NULL; |
3340 | err_free_tx_0: | 3342 | err_free_tx_0: |
3341 | pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, | 3343 | dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray, |
3342 | tp->TxPhyAddr); | 3344 | tp->TxPhyAddr); |
3343 | tp->TxDescArray = NULL; | 3345 | tp->TxDescArray = NULL; |
3344 | err_pm_runtime_put: | 3346 | err_pm_runtime_put: |
3345 | pm_runtime_put_noidle(&pdev->dev); | 3347 | pm_runtime_put_noidle(&pdev->dev); |
@@ -3975,7 +3977,7 @@ static void rtl8169_free_rx_skb(struct rtl8169_private *tp, | |||
3975 | { | 3977 | { |
3976 | struct pci_dev *pdev = tp->pci_dev; | 3978 | struct pci_dev *pdev = tp->pci_dev; |
3977 | 3979 | ||
3978 | pci_unmap_single(pdev, le64_to_cpu(desc->addr), tp->rx_buf_sz, | 3980 | dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz, |
3979 | PCI_DMA_FROMDEVICE); | 3981 | PCI_DMA_FROMDEVICE); |
3980 | dev_kfree_skb(*sk_buff); | 3982 | dev_kfree_skb(*sk_buff); |
3981 | *sk_buff = NULL; | 3983 | *sk_buff = NULL; |
@@ -4000,7 +4002,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, | |||
4000 | static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, | 4002 | static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, |
4001 | struct net_device *dev, | 4003 | struct net_device *dev, |
4002 | struct RxDesc *desc, int rx_buf_sz, | 4004 | struct RxDesc *desc, int rx_buf_sz, |
4003 | unsigned int align) | 4005 | unsigned int align, gfp_t gfp) |
4004 | { | 4006 | { |
4005 | struct sk_buff *skb; | 4007 | struct sk_buff *skb; |
4006 | dma_addr_t mapping; | 4008 | dma_addr_t mapping; |
@@ -4008,13 +4010,13 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, | |||
4008 | 4010 | ||
4009 | pad = align ? align : NET_IP_ALIGN; | 4011 | pad = align ? align : NET_IP_ALIGN; |
4010 | 4012 | ||
4011 | skb = netdev_alloc_skb(dev, rx_buf_sz + pad); | 4013 | skb = __netdev_alloc_skb(dev, rx_buf_sz + pad, gfp); |
4012 | if (!skb) | 4014 | if (!skb) |
4013 | goto err_out; | 4015 | goto err_out; |
4014 | 4016 | ||
4015 | skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); | 4017 | skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); |
4016 | 4018 | ||
4017 | mapping = pci_map_single(pdev, skb->data, rx_buf_sz, | 4019 | mapping = dma_map_single(&pdev->dev, skb->data, rx_buf_sz, |
4018 | PCI_DMA_FROMDEVICE); | 4020 | PCI_DMA_FROMDEVICE); |
4019 | 4021 | ||
4020 | rtl8169_map_to_asic(desc, mapping, rx_buf_sz); | 4022 | rtl8169_map_to_asic(desc, mapping, rx_buf_sz); |
@@ -4039,7 +4041,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp) | |||
4039 | } | 4041 | } |
4040 | 4042 | ||
4041 | static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, | 4043 | static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, |
4042 | u32 start, u32 end) | 4044 | u32 start, u32 end, gfp_t gfp) |
4043 | { | 4045 | { |
4044 | u32 cur; | 4046 | u32 cur; |
4045 | 4047 | ||
@@ -4054,7 +4056,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, | |||
4054 | 4056 | ||
4055 | skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, | 4057 | skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, |
4056 | tp->RxDescArray + i, | 4058 | tp->RxDescArray + i, |
4057 | tp->rx_buf_sz, tp->align); | 4059 | tp->rx_buf_sz, tp->align, gfp); |
4058 | if (!skb) | 4060 | if (!skb) |
4059 | break; | 4061 | break; |
4060 | 4062 | ||
@@ -4082,7 +4084,7 @@ static int rtl8169_init_ring(struct net_device *dev) | |||
4082 | memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); | 4084 | memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); |
4083 | memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); | 4085 | memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); |
4084 | 4086 | ||
4085 | if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) | 4087 | if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, GFP_KERNEL) != NUM_RX_DESC) |
4086 | goto err_out; | 4088 | goto err_out; |
4087 | 4089 | ||
4088 | rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); | 4090 | rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); |
@@ -4099,7 +4101,8 @@ static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb, | |||
4099 | { | 4101 | { |
4100 | unsigned int len = tx_skb->len; | 4102 | unsigned int len = tx_skb->len; |
4101 | 4103 | ||
4102 | pci_unmap_single(pdev, le64_to_cpu(desc->addr), len, PCI_DMA_TODEVICE); | 4104 | dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len, |
4105 | PCI_DMA_TODEVICE); | ||
4103 | desc->opts1 = 0x00; | 4106 | desc->opts1 = 0x00; |
4104 | desc->opts2 = 0x00; | 4107 | desc->opts2 = 0x00; |
4105 | desc->addr = 0x00; | 4108 | desc->addr = 0x00; |
@@ -4243,7 +4246,8 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, | |||
4243 | txd = tp->TxDescArray + entry; | 4246 | txd = tp->TxDescArray + entry; |
4244 | len = frag->size; | 4247 | len = frag->size; |
4245 | addr = ((void *) page_address(frag->page)) + frag->page_offset; | 4248 | addr = ((void *) page_address(frag->page)) + frag->page_offset; |
4246 | mapping = pci_map_single(tp->pci_dev, addr, len, PCI_DMA_TODEVICE); | 4249 | mapping = dma_map_single(&tp->pci_dev->dev, addr, len, |
4250 | PCI_DMA_TODEVICE); | ||
4247 | 4251 | ||
4248 | /* anti gcc 2.95.3 bugware (sic) */ | 4252 | /* anti gcc 2.95.3 bugware (sic) */ |
4249 | status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); | 4253 | status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); |
@@ -4313,7 +4317,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
4313 | tp->tx_skb[entry].skb = skb; | 4317 | tp->tx_skb[entry].skb = skb; |
4314 | } | 4318 | } |
4315 | 4319 | ||
4316 | mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); | 4320 | mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len, |
4321 | PCI_DMA_TODEVICE); | ||
4317 | 4322 | ||
4318 | tp->tx_skb[entry].len = len; | 4323 | tp->tx_skb[entry].len = len; |
4319 | txd->addr = cpu_to_le64(mapping); | 4324 | txd->addr = cpu_to_le64(mapping); |
@@ -4477,8 +4482,8 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, | |||
4477 | if (!skb) | 4482 | if (!skb) |
4478 | goto out; | 4483 | goto out; |
4479 | 4484 | ||
4480 | pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size, | 4485 | dma_sync_single_for_cpu(&tp->pci_dev->dev, addr, pkt_size, |
4481 | PCI_DMA_FROMDEVICE); | 4486 | PCI_DMA_FROMDEVICE); |
4482 | skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); | 4487 | skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); |
4483 | *sk_buff = skb; | 4488 | *sk_buff = skb; |
4484 | done = true; | 4489 | done = true; |
@@ -4549,11 +4554,11 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
4549 | rtl8169_rx_csum(skb, desc); | 4554 | rtl8169_rx_csum(skb, desc); |
4550 | 4555 | ||
4551 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { | 4556 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { |
4552 | pci_dma_sync_single_for_device(pdev, addr, | 4557 | dma_sync_single_for_device(&pdev->dev, addr, |
4553 | pkt_size, PCI_DMA_FROMDEVICE); | 4558 | pkt_size, PCI_DMA_FROMDEVICE); |
4554 | rtl8169_mark_to_asic(desc, tp->rx_buf_sz); | 4559 | rtl8169_mark_to_asic(desc, tp->rx_buf_sz); |
4555 | } else { | 4560 | } else { |
4556 | pci_unmap_single(pdev, addr, tp->rx_buf_sz, | 4561 | dma_unmap_single(&pdev->dev, addr, tp->rx_buf_sz, |
4557 | PCI_DMA_FROMDEVICE); | 4562 | PCI_DMA_FROMDEVICE); |
4558 | tp->Rx_skbuff[entry] = NULL; | 4563 | tp->Rx_skbuff[entry] = NULL; |
4559 | } | 4564 | } |
@@ -4583,7 +4588,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
4583 | count = cur_rx - tp->cur_rx; | 4588 | count = cur_rx - tp->cur_rx; |
4584 | tp->cur_rx = cur_rx; | 4589 | tp->cur_rx = cur_rx; |
4585 | 4590 | ||
4586 | delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); | 4591 | delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, GFP_ATOMIC); |
4587 | if (!delta && count) | 4592 | if (!delta && count) |
4588 | netif_info(tp, intr, dev, "no Rx buffer allocated\n"); | 4593 | netif_info(tp, intr, dev, "no Rx buffer allocated\n"); |
4589 | tp->dirty_rx += delta; | 4594 | tp->dirty_rx += delta; |
@@ -4769,10 +4774,10 @@ static int rtl8169_close(struct net_device *dev) | |||
4769 | 4774 | ||
4770 | free_irq(dev->irq, dev); | 4775 | free_irq(dev->irq, dev); |
4771 | 4776 | ||
4772 | pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, | 4777 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
4773 | tp->RxPhyAddr); | 4778 | tp->RxPhyAddr); |
4774 | pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, | 4779 | dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray, |
4775 | tp->TxPhyAddr); | 4780 | tp->TxPhyAddr); |
4776 | tp->TxDescArray = NULL; | 4781 | tp->TxDescArray = NULL; |
4777 | tp->RxDescArray = NULL; | 4782 | tp->RxDescArray = NULL; |
4778 | 4783 | ||
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 40e5c46e7571..465ae7e84507 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/seq_file.h> | 43 | #include <linux/seq_file.h> |
44 | #include <linux/mii.h> | 44 | #include <linux/mii.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/dmi.h> | ||
46 | #include <asm/irq.h> | 47 | #include <asm/irq.h> |
47 | 48 | ||
48 | #include "skge.h" | 49 | #include "skge.h" |
@@ -3868,6 +3869,8 @@ static void __devinit skge_show_addr(struct net_device *dev) | |||
3868 | netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); | 3869 | netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); |
3869 | } | 3870 | } |
3870 | 3871 | ||
3872 | static int only_32bit_dma; | ||
3873 | |||
3871 | static int __devinit skge_probe(struct pci_dev *pdev, | 3874 | static int __devinit skge_probe(struct pci_dev *pdev, |
3872 | const struct pci_device_id *ent) | 3875 | const struct pci_device_id *ent) |
3873 | { | 3876 | { |
@@ -3889,7 +3892,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3889 | 3892 | ||
3890 | pci_set_master(pdev); | 3893 | pci_set_master(pdev); |
3891 | 3894 | ||
3892 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | 3895 | if (!only_32bit_dma && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
3893 | using_dac = 1; | 3896 | using_dac = 1; |
3894 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | 3897 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); |
3895 | } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { | 3898 | } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { |
@@ -4147,8 +4150,21 @@ static struct pci_driver skge_driver = { | |||
4147 | .shutdown = skge_shutdown, | 4150 | .shutdown = skge_shutdown, |
4148 | }; | 4151 | }; |
4149 | 4152 | ||
4153 | static struct dmi_system_id skge_32bit_dma_boards[] = { | ||
4154 | { | ||
4155 | .ident = "Gigabyte nForce boards", | ||
4156 | .matches = { | ||
4157 | DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"), | ||
4158 | DMI_MATCH(DMI_BOARD_NAME, "nForce"), | ||
4159 | }, | ||
4160 | }, | ||
4161 | {} | ||
4162 | }; | ||
4163 | |||
4150 | static int __init skge_init_module(void) | 4164 | static int __init skge_init_module(void) |
4151 | { | 4165 | { |
4166 | if (dmi_check_system(skge_32bit_dma_boards)) | ||
4167 | only_32bit_dma = 1; | ||
4152 | skge_debug_init(); | 4168 | skge_debug_init(); |
4153 | return pci_register_driver(&skge_driver); | 4169 | return pci_register_driver(&skge_driver); |
4154 | } | 4170 | } |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index bc3af78a869f..1ec4b9e0239a 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -4666,7 +4666,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4666 | desc_idx, *post_ptr); | 4666 | desc_idx, *post_ptr); |
4667 | drop_it_no_recycle: | 4667 | drop_it_no_recycle: |
4668 | /* Other statistics kept track of by card. */ | 4668 | /* Other statistics kept track of by card. */ |
4669 | tp->net_stats.rx_dropped++; | 4669 | tp->rx_dropped++; |
4670 | goto next_pkt; | 4670 | goto next_pkt; |
4671 | } | 4671 | } |
4672 | 4672 | ||
@@ -4726,7 +4726,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4726 | if (len > (tp->dev->mtu + ETH_HLEN) && | 4726 | if (len > (tp->dev->mtu + ETH_HLEN) && |
4727 | skb->protocol != htons(ETH_P_8021Q)) { | 4727 | skb->protocol != htons(ETH_P_8021Q)) { |
4728 | dev_kfree_skb(skb); | 4728 | dev_kfree_skb(skb); |
4729 | goto next_pkt; | 4729 | goto drop_it_no_recycle; |
4730 | } | 4730 | } |
4731 | 4731 | ||
4732 | if (desc->type_flags & RXD_FLAG_VLAN && | 4732 | if (desc->type_flags & RXD_FLAG_VLAN && |
@@ -9240,6 +9240,8 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev, | |||
9240 | stats->rx_missed_errors = old_stats->rx_missed_errors + | 9240 | stats->rx_missed_errors = old_stats->rx_missed_errors + |
9241 | get_stat64(&hw_stats->rx_discards); | 9241 | get_stat64(&hw_stats->rx_discards); |
9242 | 9242 | ||
9243 | stats->rx_dropped = tp->rx_dropped; | ||
9244 | |||
9243 | return stats; | 9245 | return stats; |
9244 | } | 9246 | } |
9245 | 9247 | ||
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 4937bd190964..be7ff138a7f9 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2759,7 +2759,7 @@ struct tg3 { | |||
2759 | 2759 | ||
2760 | 2760 | ||
2761 | /* begin "everything else" cacheline(s) section */ | 2761 | /* begin "everything else" cacheline(s) section */ |
2762 | struct rtnl_link_stats64 net_stats; | 2762 | unsigned long rx_dropped; |
2763 | struct rtnl_link_stats64 net_stats_prev; | 2763 | struct rtnl_link_stats64 net_stats_prev; |
2764 | struct tg3_ethtool_stats estats; | 2764 | struct tg3_ethtool_stats estats; |
2765 | struct tg3_ethtool_stats estats_prev; | 2765 | struct tg3_ethtool_stats estats_prev; |
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c index 8cc9e319f435..1737d1488b35 100644 --- a/drivers/net/wimax/i2400m/rx.c +++ b/drivers/net/wimax/i2400m/rx.c | |||
@@ -1244,16 +1244,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1244 | int i, result; | 1244 | int i, result; |
1245 | struct device *dev = i2400m_dev(i2400m); | 1245 | struct device *dev = i2400m_dev(i2400m); |
1246 | const struct i2400m_msg_hdr *msg_hdr; | 1246 | const struct i2400m_msg_hdr *msg_hdr; |
1247 | size_t pl_itr, pl_size, skb_len; | 1247 | size_t pl_itr, pl_size; |
1248 | unsigned long flags; | 1248 | unsigned long flags; |
1249 | unsigned num_pls, single_last; | 1249 | unsigned num_pls, single_last, skb_len; |
1250 | 1250 | ||
1251 | skb_len = skb->len; | 1251 | skb_len = skb->len; |
1252 | d_fnstart(4, dev, "(i2400m %p skb %p [size %zu])\n", | 1252 | d_fnstart(4, dev, "(i2400m %p skb %p [size %u])\n", |
1253 | i2400m, skb, skb_len); | 1253 | i2400m, skb, skb_len); |
1254 | result = -EIO; | 1254 | result = -EIO; |
1255 | msg_hdr = (void *) skb->data; | 1255 | msg_hdr = (void *) skb->data; |
1256 | result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb->len); | 1256 | result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb_len); |
1257 | if (result < 0) | 1257 | if (result < 0) |
1258 | goto error_msg_hdr_check; | 1258 | goto error_msg_hdr_check; |
1259 | result = -EIO; | 1259 | result = -EIO; |
@@ -1261,10 +1261,10 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1261 | pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ | 1261 | pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ |
1262 | num_pls * sizeof(msg_hdr->pld[0]); | 1262 | num_pls * sizeof(msg_hdr->pld[0]); |
1263 | pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); | 1263 | pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); |
1264 | if (pl_itr > skb->len) { /* got all the payload descriptors? */ | 1264 | if (pl_itr > skb_len) { /* got all the payload descriptors? */ |
1265 | dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " | 1265 | dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " |
1266 | "%u payload descriptors (%zu each, total %zu)\n", | 1266 | "%u payload descriptors (%zu each, total %zu)\n", |
1267 | skb->len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); | 1267 | skb_len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); |
1268 | goto error_pl_descr_short; | 1268 | goto error_pl_descr_short; |
1269 | } | 1269 | } |
1270 | /* Walk each payload payload--check we really got it */ | 1270 | /* Walk each payload payload--check we really got it */ |
@@ -1272,7 +1272,7 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1272 | /* work around old gcc warnings */ | 1272 | /* work around old gcc warnings */ |
1273 | pl_size = i2400m_pld_size(&msg_hdr->pld[i]); | 1273 | pl_size = i2400m_pld_size(&msg_hdr->pld[i]); |
1274 | result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], | 1274 | result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], |
1275 | pl_itr, skb->len); | 1275 | pl_itr, skb_len); |
1276 | if (result < 0) | 1276 | if (result < 0) |
1277 | goto error_pl_descr_check; | 1277 | goto error_pl_descr_check; |
1278 | single_last = num_pls == 1 || i == num_pls - 1; | 1278 | single_last = num_pls == 1 || i == num_pls - 1; |
@@ -1290,16 +1290,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1290 | if (i < i2400m->rx_pl_min) | 1290 | if (i < i2400m->rx_pl_min) |
1291 | i2400m->rx_pl_min = i; | 1291 | i2400m->rx_pl_min = i; |
1292 | i2400m->rx_num++; | 1292 | i2400m->rx_num++; |
1293 | i2400m->rx_size_acc += skb->len; | 1293 | i2400m->rx_size_acc += skb_len; |
1294 | if (skb->len < i2400m->rx_size_min) | 1294 | if (skb_len < i2400m->rx_size_min) |
1295 | i2400m->rx_size_min = skb->len; | 1295 | i2400m->rx_size_min = skb_len; |
1296 | if (skb->len > i2400m->rx_size_max) | 1296 | if (skb_len > i2400m->rx_size_max) |
1297 | i2400m->rx_size_max = skb->len; | 1297 | i2400m->rx_size_max = skb_len; |
1298 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); | 1298 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); |
1299 | error_pl_descr_check: | 1299 | error_pl_descr_check: |
1300 | error_pl_descr_short: | 1300 | error_pl_descr_short: |
1301 | error_msg_hdr_check: | 1301 | error_msg_hdr_check: |
1302 | d_fnend(4, dev, "(i2400m %p skb %p [size %zu]) = %d\n", | 1302 | d_fnend(4, dev, "(i2400m %p skb %p [size %u]) = %d\n", |
1303 | i2400m, skb, skb_len, result); | 1303 | i2400m, skb, skb_len, result); |
1304 | return result; | 1304 | return result; |
1305 | } | 1305 | } |
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index cc648b6ae31c..a3d95cca8f0c 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -543,7 +543,7 @@ static u8 ath9k_hw_chan_2_clockrate_mhz(struct ath_hw *ah) | |||
543 | if (conf_is_ht40(conf)) | 543 | if (conf_is_ht40(conf)) |
544 | return clockrate * 2; | 544 | return clockrate * 2; |
545 | 545 | ||
546 | return clockrate * 2; | 546 | return clockrate; |
547 | } | 547 | } |
548 | 548 | ||
549 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) | 549 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 9dd9e64c2b0b..8fd00a6e5120 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -1411,7 +1411,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1411 | clear_bit(STATUS_SCAN_HW, &priv->status); | 1411 | clear_bit(STATUS_SCAN_HW, &priv->status); |
1412 | clear_bit(STATUS_SCANNING, &priv->status); | 1412 | clear_bit(STATUS_SCANNING, &priv->status); |
1413 | /* inform mac80211 scan aborted */ | 1413 | /* inform mac80211 scan aborted */ |
1414 | queue_work(priv->workqueue, &priv->scan_completed); | 1414 | queue_work(priv->workqueue, &priv->abort_scan); |
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, | 1417 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 59a308b02f95..d31661c1ce77 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -3018,7 +3018,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
3018 | clear_bit(STATUS_SCANNING, &priv->status); | 3018 | clear_bit(STATUS_SCANNING, &priv->status); |
3019 | 3019 | ||
3020 | /* inform mac80211 scan aborted */ | 3020 | /* inform mac80211 scan aborted */ |
3021 | queue_work(priv->workqueue, &priv->scan_completed); | 3021 | queue_work(priv->workqueue, &priv->abort_scan); |
3022 | } | 3022 | } |
3023 | 3023 | ||
3024 | static void iwl3945_bg_restart(struct work_struct *data) | 3024 | static void iwl3945_bg_restart(struct work_struct *data) |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 89ed181cd90c..857ae01734a6 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -163,6 +163,26 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_d | |||
163 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs); | 163 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear | ||
167 | * for some HT machines to use C4 w/o hanging. | ||
168 | */ | ||
169 | static void __devinit quirk_tigerpoint_bm_sts(struct pci_dev *dev) | ||
170 | { | ||
171 | u32 pmbase; | ||
172 | u16 pm1a; | ||
173 | |||
174 | pci_read_config_dword(dev, 0x40, &pmbase); | ||
175 | pmbase = pmbase & 0xff80; | ||
176 | pm1a = inw(pmbase); | ||
177 | |||
178 | if (pm1a & 0x10) { | ||
179 | dev_info(&dev->dev, FW_BUG "TigerPoint LPC.BM_STS cleared\n"); | ||
180 | outw(0x10, pmbase); | ||
181 | } | ||
182 | } | ||
183 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk_tigerpoint_bm_sts); | ||
184 | |||
185 | /* | ||
166 | * Chipsets where PCI->PCI transfers vanish or hang | 186 | * Chipsets where PCI->PCI transfers vanish or hang |
167 | */ | 187 | */ |
168 | static void __devinit quirk_nopcipci(struct pci_dev *dev) | 188 | static void __devinit quirk_nopcipci(struct pci_dev *dev) |
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index 9024480a8228..c44a5e8b8b82 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
@@ -51,7 +51,6 @@ | |||
51 | * TODO: | 51 | * TODO: |
52 | * - handle CPU hotplug | 52 | * - handle CPU hotplug |
53 | * - provide turbo enable/disable api | 53 | * - provide turbo enable/disable api |
54 | * - make sure we can write turbo enable/disable reg based on MISC_EN | ||
55 | * | 54 | * |
56 | * Related documents: | 55 | * Related documents: |
57 | * - CDI 403777, 403778 - Auburndale EDS vol 1 & 2 | 56 | * - CDI 403777, 403778 - Auburndale EDS vol 1 & 2 |
@@ -230,7 +229,7 @@ | |||
230 | #define THM_TC2 0xac | 229 | #define THM_TC2 0xac |
231 | #define THM_DTV 0xb0 | 230 | #define THM_DTV 0xb0 |
232 | #define THM_ITV 0xd8 | 231 | #define THM_ITV 0xd8 |
233 | #define ITV_ME_SEQNO_MASK 0x000f0000 /* ME should update every ~200ms */ | 232 | #define ITV_ME_SEQNO_MASK 0x00ff0000 /* ME should update every ~200ms */ |
234 | #define ITV_ME_SEQNO_SHIFT (16) | 233 | #define ITV_ME_SEQNO_SHIFT (16) |
235 | #define ITV_MCH_TEMP_MASK 0x0000ff00 | 234 | #define ITV_MCH_TEMP_MASK 0x0000ff00 |
236 | #define ITV_MCH_TEMP_SHIFT (8) | 235 | #define ITV_MCH_TEMP_SHIFT (8) |
@@ -325,6 +324,7 @@ struct ips_driver { | |||
325 | bool gpu_preferred; | 324 | bool gpu_preferred; |
326 | bool poll_turbo_status; | 325 | bool poll_turbo_status; |
327 | bool second_cpu; | 326 | bool second_cpu; |
327 | bool turbo_toggle_allowed; | ||
328 | struct ips_mcp_limits *limits; | 328 | struct ips_mcp_limits *limits; |
329 | 329 | ||
330 | /* Optional MCH interfaces for if i915 is in use */ | 330 | /* Optional MCH interfaces for if i915 is in use */ |
@@ -415,7 +415,7 @@ static void ips_cpu_lower(struct ips_driver *ips) | |||
415 | new_limit = cur_limit - 8; /* 1W decrease */ | 415 | new_limit = cur_limit - 8; /* 1W decrease */ |
416 | 416 | ||
417 | /* Clamp to SKU TDP limit */ | 417 | /* Clamp to SKU TDP limit */ |
418 | if (((new_limit * 10) / 8) < (ips->orig_turbo_limit & TURBO_TDP_MASK)) | 418 | if (new_limit < (ips->orig_turbo_limit & TURBO_TDP_MASK)) |
419 | new_limit = ips->orig_turbo_limit & TURBO_TDP_MASK; | 419 | new_limit = ips->orig_turbo_limit & TURBO_TDP_MASK; |
420 | 420 | ||
421 | thm_writew(THM_MPCPC, (new_limit * 10) / 8); | 421 | thm_writew(THM_MPCPC, (new_limit * 10) / 8); |
@@ -461,7 +461,8 @@ static void ips_enable_cpu_turbo(struct ips_driver *ips) | |||
461 | if (ips->__cpu_turbo_on) | 461 | if (ips->__cpu_turbo_on) |
462 | return; | 462 | return; |
463 | 463 | ||
464 | on_each_cpu(do_enable_cpu_turbo, ips, 1); | 464 | if (ips->turbo_toggle_allowed) |
465 | on_each_cpu(do_enable_cpu_turbo, ips, 1); | ||
465 | 466 | ||
466 | ips->__cpu_turbo_on = true; | 467 | ips->__cpu_turbo_on = true; |
467 | } | 468 | } |
@@ -498,7 +499,8 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips) | |||
498 | if (!ips->__cpu_turbo_on) | 499 | if (!ips->__cpu_turbo_on) |
499 | return; | 500 | return; |
500 | 501 | ||
501 | on_each_cpu(do_disable_cpu_turbo, ips, 1); | 502 | if (ips->turbo_toggle_allowed) |
503 | on_each_cpu(do_disable_cpu_turbo, ips, 1); | ||
502 | 504 | ||
503 | ips->__cpu_turbo_on = false; | 505 | ips->__cpu_turbo_on = false; |
504 | } | 506 | } |
@@ -598,17 +600,29 @@ static bool mcp_exceeded(struct ips_driver *ips) | |||
598 | { | 600 | { |
599 | unsigned long flags; | 601 | unsigned long flags; |
600 | bool ret = false; | 602 | bool ret = false; |
603 | u32 temp_limit; | ||
604 | u32 avg_power; | ||
605 | const char *msg = "MCP limit exceeded: "; | ||
601 | 606 | ||
602 | spin_lock_irqsave(&ips->turbo_status_lock, flags); | 607 | spin_lock_irqsave(&ips->turbo_status_lock, flags); |
603 | if (ips->mcp_avg_temp > (ips->mcp_temp_limit * 100)) | 608 | |
604 | ret = true; | 609 | temp_limit = ips->mcp_temp_limit * 100; |
605 | if (ips->cpu_avg_power + ips->mch_avg_power > ips->mcp_power_limit) | 610 | if (ips->mcp_avg_temp > temp_limit) { |
611 | dev_info(&ips->dev->dev, | ||
612 | "%sAvg temp %u, limit %u\n", msg, ips->mcp_avg_temp, | ||
613 | temp_limit); | ||
606 | ret = true; | 614 | ret = true; |
607 | spin_unlock_irqrestore(&ips->turbo_status_lock, flags); | 615 | } |
608 | 616 | ||
609 | if (ret) | 617 | avg_power = ips->cpu_avg_power + ips->mch_avg_power; |
618 | if (avg_power > ips->mcp_power_limit) { | ||
610 | dev_info(&ips->dev->dev, | 619 | dev_info(&ips->dev->dev, |
611 | "MCP power or thermal limit exceeded\n"); | 620 | "%sAvg power %u, limit %u\n", msg, avg_power, |
621 | ips->mcp_power_limit); | ||
622 | ret = true; | ||
623 | } | ||
624 | |||
625 | spin_unlock_irqrestore(&ips->turbo_status_lock, flags); | ||
612 | 626 | ||
613 | return ret; | 627 | return ret; |
614 | } | 628 | } |
@@ -663,6 +677,27 @@ static bool mch_exceeded(struct ips_driver *ips) | |||
663 | } | 677 | } |
664 | 678 | ||
665 | /** | 679 | /** |
680 | * verify_limits - verify BIOS provided limits | ||
681 | * @ips: IPS structure | ||
682 | * | ||
683 | * BIOS can optionally provide non-default limits for power and temp. Check | ||
684 | * them here and use the defaults if the BIOS values are not provided or | ||
685 | * are otherwise unusable. | ||
686 | */ | ||
687 | static void verify_limits(struct ips_driver *ips) | ||
688 | { | ||
689 | if (ips->mcp_power_limit < ips->limits->mcp_power_limit || | ||
690 | ips->mcp_power_limit > 35000) | ||
691 | ips->mcp_power_limit = ips->limits->mcp_power_limit; | ||
692 | |||
693 | if (ips->mcp_temp_limit < ips->limits->core_temp_limit || | ||
694 | ips->mcp_temp_limit < ips->limits->mch_temp_limit || | ||
695 | ips->mcp_temp_limit > 150) | ||
696 | ips->mcp_temp_limit = min(ips->limits->core_temp_limit, | ||
697 | ips->limits->mch_temp_limit); | ||
698 | } | ||
699 | |||
700 | /** | ||
666 | * update_turbo_limits - get various limits & settings from regs | 701 | * update_turbo_limits - get various limits & settings from regs |
667 | * @ips: IPS driver struct | 702 | * @ips: IPS driver struct |
668 | * | 703 | * |
@@ -680,12 +715,21 @@ static void update_turbo_limits(struct ips_driver *ips) | |||
680 | u32 hts = thm_readl(THM_HTS); | 715 | u32 hts = thm_readl(THM_HTS); |
681 | 716 | ||
682 | ips->cpu_turbo_enabled = !(hts & HTS_PCTD_DIS); | 717 | ips->cpu_turbo_enabled = !(hts & HTS_PCTD_DIS); |
683 | ips->gpu_turbo_enabled = !(hts & HTS_GTD_DIS); | 718 | /* |
719 | * Disable turbo for now, until we can figure out why the power figures | ||
720 | * are wrong | ||
721 | */ | ||
722 | ips->cpu_turbo_enabled = false; | ||
723 | |||
724 | if (ips->gpu_busy) | ||
725 | ips->gpu_turbo_enabled = !(hts & HTS_GTD_DIS); | ||
726 | |||
684 | ips->core_power_limit = thm_readw(THM_MPCPC); | 727 | ips->core_power_limit = thm_readw(THM_MPCPC); |
685 | ips->mch_power_limit = thm_readw(THM_MMGPC); | 728 | ips->mch_power_limit = thm_readw(THM_MMGPC); |
686 | ips->mcp_temp_limit = thm_readw(THM_PTL); | 729 | ips->mcp_temp_limit = thm_readw(THM_PTL); |
687 | ips->mcp_power_limit = thm_readw(THM_MPPC); | 730 | ips->mcp_power_limit = thm_readw(THM_MPPC); |
688 | 731 | ||
732 | verify_limits(ips); | ||
689 | /* Ignore BIOS CPU vs GPU pref */ | 733 | /* Ignore BIOS CPU vs GPU pref */ |
690 | } | 734 | } |
691 | 735 | ||
@@ -858,7 +902,7 @@ static u32 get_cpu_power(struct ips_driver *ips, u32 *last, int period) | |||
858 | ret = (ret * 1000) / 65535; | 902 | ret = (ret * 1000) / 65535; |
859 | *last = val; | 903 | *last = val; |
860 | 904 | ||
861 | return ret; | 905 | return 0; |
862 | } | 906 | } |
863 | 907 | ||
864 | static const u16 temp_decay_factor = 2; | 908 | static const u16 temp_decay_factor = 2; |
@@ -940,7 +984,6 @@ static int ips_monitor(void *data) | |||
940 | kfree(mch_samples); | 984 | kfree(mch_samples); |
941 | kfree(cpu_samples); | 985 | kfree(cpu_samples); |
942 | kfree(mchp_samples); | 986 | kfree(mchp_samples); |
943 | kthread_stop(ips->adjust); | ||
944 | return -ENOMEM; | 987 | return -ENOMEM; |
945 | } | 988 | } |
946 | 989 | ||
@@ -948,7 +991,7 @@ static int ips_monitor(void *data) | |||
948 | ITV_ME_SEQNO_SHIFT; | 991 | ITV_ME_SEQNO_SHIFT; |
949 | seqno_timestamp = get_jiffies_64(); | 992 | seqno_timestamp = get_jiffies_64(); |
950 | 993 | ||
951 | old_cpu_power = thm_readl(THM_CEC) / 65535; | 994 | old_cpu_power = thm_readl(THM_CEC); |
952 | schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD)); | 995 | schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD)); |
953 | 996 | ||
954 | /* Collect an initial average */ | 997 | /* Collect an initial average */ |
@@ -1150,11 +1193,18 @@ static irqreturn_t ips_irq_handler(int irq, void *arg) | |||
1150 | STS_GPL_SHIFT; | 1193 | STS_GPL_SHIFT; |
1151 | /* ignore EC CPU vs GPU pref */ | 1194 | /* ignore EC CPU vs GPU pref */ |
1152 | ips->cpu_turbo_enabled = !(sts & STS_PCTD_DIS); | 1195 | ips->cpu_turbo_enabled = !(sts & STS_PCTD_DIS); |
1153 | ips->gpu_turbo_enabled = !(sts & STS_GTD_DIS); | 1196 | /* |
1197 | * Disable turbo for now, until we can figure | ||
1198 | * out why the power figures are wrong | ||
1199 | */ | ||
1200 | ips->cpu_turbo_enabled = false; | ||
1201 | if (ips->gpu_busy) | ||
1202 | ips->gpu_turbo_enabled = !(sts & STS_GTD_DIS); | ||
1154 | ips->mcp_temp_limit = (sts & STS_PTL_MASK) >> | 1203 | ips->mcp_temp_limit = (sts & STS_PTL_MASK) >> |
1155 | STS_PTL_SHIFT; | 1204 | STS_PTL_SHIFT; |
1156 | ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >> | 1205 | ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >> |
1157 | STS_PPL_SHIFT; | 1206 | STS_PPL_SHIFT; |
1207 | verify_limits(ips); | ||
1158 | spin_unlock(&ips->turbo_status_lock); | 1208 | spin_unlock(&ips->turbo_status_lock); |
1159 | 1209 | ||
1160 | thm_writeb(THM_SEC, SEC_ACK); | 1210 | thm_writeb(THM_SEC, SEC_ACK); |
@@ -1333,8 +1383,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips) | |||
1333 | * turbo manually or we'll get an illegal MSR access, even though | 1383 | * turbo manually or we'll get an illegal MSR access, even though |
1334 | * turbo will still be available. | 1384 | * turbo will still be available. |
1335 | */ | 1385 | */ |
1336 | if (!(misc_en & IA32_MISC_TURBO_EN)) | 1386 | if (misc_en & IA32_MISC_TURBO_EN) |
1337 | ; /* add turbo MSR write allowed flag if necessary */ | 1387 | ips->turbo_toggle_allowed = true; |
1388 | else | ||
1389 | ips->turbo_toggle_allowed = false; | ||
1338 | 1390 | ||
1339 | if (strstr(boot_cpu_data.x86_model_id, "CPU M")) | 1391 | if (strstr(boot_cpu_data.x86_model_id, "CPU M")) |
1340 | limits = &ips_sv_limits; | 1392 | limits = &ips_sv_limits; |
@@ -1351,9 +1403,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips) | |||
1351 | tdp = turbo_power & TURBO_TDP_MASK; | 1403 | tdp = turbo_power & TURBO_TDP_MASK; |
1352 | 1404 | ||
1353 | /* Sanity check TDP against CPU */ | 1405 | /* Sanity check TDP against CPU */ |
1354 | if (limits->mcp_power_limit != (tdp / 8) * 1000) { | 1406 | if (limits->core_power_limit != (tdp / 8) * 1000) { |
1355 | dev_warn(&ips->dev->dev, "Warning: CPU TDP doesn't match expected value (found %d, expected %d)\n", | 1407 | dev_info(&ips->dev->dev, "CPU TDP doesn't match expected value (found %d, expected %d)\n", |
1356 | tdp / 8, limits->mcp_power_limit / 1000); | 1408 | tdp / 8, limits->core_power_limit / 1000); |
1409 | limits->core_power_limit = (tdp / 8) * 1000; | ||
1357 | } | 1410 | } |
1358 | 1411 | ||
1359 | out: | 1412 | out: |
@@ -1390,7 +1443,7 @@ static bool ips_get_i915_syms(struct ips_driver *ips) | |||
1390 | return true; | 1443 | return true; |
1391 | 1444 | ||
1392 | out_put_busy: | 1445 | out_put_busy: |
1393 | symbol_put(i915_gpu_turbo_disable); | 1446 | symbol_put(i915_gpu_busy); |
1394 | out_put_lower: | 1447 | out_put_lower: |
1395 | symbol_put(i915_gpu_lower); | 1448 | symbol_put(i915_gpu_lower); |
1396 | out_put_raise: | 1449 | out_put_raise: |
@@ -1532,22 +1585,27 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1532 | /* Save turbo limits & ratios */ | 1585 | /* Save turbo limits & ratios */ |
1533 | rdmsrl(TURBO_POWER_CURRENT_LIMIT, ips->orig_turbo_limit); | 1586 | rdmsrl(TURBO_POWER_CURRENT_LIMIT, ips->orig_turbo_limit); |
1534 | 1587 | ||
1535 | ips_enable_cpu_turbo(ips); | 1588 | ips_disable_cpu_turbo(ips); |
1536 | ips->cpu_turbo_enabled = true; | 1589 | ips->cpu_turbo_enabled = false; |
1537 | 1590 | ||
1538 | /* Set up the work queue and monitor/adjust threads */ | 1591 | /* Create thermal adjust thread */ |
1539 | ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor"); | 1592 | ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust"); |
1540 | if (IS_ERR(ips->monitor)) { | 1593 | if (IS_ERR(ips->adjust)) { |
1541 | dev_err(&dev->dev, | 1594 | dev_err(&dev->dev, |
1542 | "failed to create thermal monitor thread, aborting\n"); | 1595 | "failed to create thermal adjust thread, aborting\n"); |
1543 | ret = -ENOMEM; | 1596 | ret = -ENOMEM; |
1544 | goto error_free_irq; | 1597 | goto error_free_irq; |
1598 | |||
1545 | } | 1599 | } |
1546 | 1600 | ||
1547 | ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust"); | 1601 | /* |
1548 | if (IS_ERR(ips->adjust)) { | 1602 | * Set up the work queue and monitor thread. The monitor thread |
1603 | * will wake up ips_adjust thread. | ||
1604 | */ | ||
1605 | ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor"); | ||
1606 | if (IS_ERR(ips->monitor)) { | ||
1549 | dev_err(&dev->dev, | 1607 | dev_err(&dev->dev, |
1550 | "failed to create thermal adjust thread, aborting\n"); | 1608 | "failed to create thermal monitor thread, aborting\n"); |
1551 | ret = -ENOMEM; | 1609 | ret = -ENOMEM; |
1552 | goto error_thread_cleanup; | 1610 | goto error_thread_cleanup; |
1553 | } | 1611 | } |
@@ -1566,7 +1624,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1566 | return ret; | 1624 | return ret; |
1567 | 1625 | ||
1568 | error_thread_cleanup: | 1626 | error_thread_cleanup: |
1569 | kthread_stop(ips->monitor); | 1627 | kthread_stop(ips->adjust); |
1570 | error_free_irq: | 1628 | error_free_irq: |
1571 | free_irq(ips->dev->irq, ips); | 1629 | free_irq(ips->dev->irq, ips); |
1572 | error_unmap: | 1630 | error_unmap: |
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index df1fb53c09d2..a4be41614eeb 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c | |||
@@ -256,7 +256,6 @@ static int __devexit ad5398_remove(struct i2c_client *client) | |||
256 | 256 | ||
257 | regulator_unregister(chip->rdev); | 257 | regulator_unregister(chip->rdev); |
258 | kfree(chip); | 258 | kfree(chip); |
259 | i2c_set_clientdata(client, NULL); | ||
260 | 259 | ||
261 | return 0; | 260 | return 0; |
262 | } | 261 | } |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 422a709d271d..cc8b337b9119 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -700,7 +700,7 @@ static void print_constraints(struct regulator_dev *rdev) | |||
700 | constraints->min_uA != constraints->max_uA) { | 700 | constraints->min_uA != constraints->max_uA) { |
701 | ret = _regulator_get_current_limit(rdev); | 701 | ret = _regulator_get_current_limit(rdev); |
702 | if (ret > 0) | 702 | if (ret > 0) |
703 | count += sprintf(buf + count, "at %d uA ", ret / 1000); | 703 | count += sprintf(buf + count, "at %d mA ", ret / 1000); |
704 | } | 704 | } |
705 | 705 | ||
706 | if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) | 706 | if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) |
@@ -2302,8 +2302,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | |||
2302 | dev_set_name(&rdev->dev, "regulator.%d", | 2302 | dev_set_name(&rdev->dev, "regulator.%d", |
2303 | atomic_inc_return(®ulator_no) - 1); | 2303 | atomic_inc_return(®ulator_no) - 1); |
2304 | ret = device_register(&rdev->dev); | 2304 | ret = device_register(&rdev->dev); |
2305 | if (ret != 0) | 2305 | if (ret != 0) { |
2306 | put_device(&rdev->dev); | ||
2306 | goto clean; | 2307 | goto clean; |
2308 | } | ||
2307 | 2309 | ||
2308 | dev_set_drvdata(&rdev->dev, rdev); | 2310 | dev_set_drvdata(&rdev->dev, rdev); |
2309 | 2311 | ||
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c index d61ecb885a8c..b8cc6389a541 100644 --- a/drivers/regulator/isl6271a-regulator.c +++ b/drivers/regulator/isl6271a-regulator.c | |||
@@ -191,8 +191,6 @@ static int __devexit isl6271a_remove(struct i2c_client *i2c) | |||
191 | struct isl_pmic *pmic = i2c_get_clientdata(i2c); | 191 | struct isl_pmic *pmic = i2c_get_clientdata(i2c); |
192 | int i; | 192 | int i; |
193 | 193 | ||
194 | i2c_set_clientdata(i2c, NULL); | ||
195 | |||
196 | for (i = 0; i < 3; i++) | 194 | for (i = 0; i < 3; i++) |
197 | regulator_unregister(pmic->rdev[i]); | 195 | regulator_unregister(pmic->rdev[i]); |
198 | 196 | ||
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 4520ace3f7e7..6b60a9c0366b 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c | |||
@@ -330,7 +330,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client, | |||
330 | /* set external clock frequency */ | 330 | /* set external clock frequency */ |
331 | info->extclk_freq = pdata->extclk_freq; | 331 | info->extclk_freq = pdata->extclk_freq; |
332 | max8649_set_bits(info->i2c, MAX8649_SYNC, MAX8649_EXT_MASK, | 332 | max8649_set_bits(info->i2c, MAX8649_SYNC, MAX8649_EXT_MASK, |
333 | info->extclk_freq); | 333 | info->extclk_freq << 6); |
334 | } | 334 | } |
335 | 335 | ||
336 | if (pdata->ramp_timing) { | 336 | if (pdata->ramp_timing) { |
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 9daed8db83d3..9de8516e3531 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c | |||
@@ -268,7 +268,6 @@ out_irq: | |||
268 | free_irq(client->irq, client); | 268 | free_irq(client->irq, client); |
269 | 269 | ||
270 | out_free: | 270 | out_free: |
271 | i2c_set_clientdata(client, NULL); | ||
272 | kfree(ds3232); | 271 | kfree(ds3232); |
273 | return ret; | 272 | return ret; |
274 | } | 273 | } |
@@ -287,7 +286,6 @@ static int __devexit ds3232_remove(struct i2c_client *client) | |||
287 | } | 286 | } |
288 | 287 | ||
289 | rtc_device_unregister(ds3232->rtc); | 288 | rtc_device_unregister(ds3232->rtc); |
290 | i2c_set_clientdata(client, NULL); | ||
291 | kfree(ds3232); | 289 | kfree(ds3232); |
292 | return 0; | 290 | return 0; |
293 | } | 291 | } |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 12900f7083b0..3198c5335f0b 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -458,6 +458,7 @@ config SERIAL_SAMSUNG_UARTS | |||
458 | int | 458 | int |
459 | depends on ARM && PLAT_SAMSUNG | 459 | depends on ARM && PLAT_SAMSUNG |
460 | default 2 if ARCH_S3C2400 | 460 | default 2 if ARCH_S3C2400 |
461 | default 6 if ARCH_S5P6450 | ||
461 | default 4 if SERIAL_SAMSUNG_UARTS_4 | 462 | default 4 if SERIAL_SAMSUNG_UARTS_4 |
462 | default 3 | 463 | default 3 |
463 | help | 464 | help |
@@ -526,12 +527,12 @@ config SERIAL_S3C24A0 | |||
526 | Serial port support for the Samsung S3C24A0 SoC | 527 | Serial port support for the Samsung S3C24A0 SoC |
527 | 528 | ||
528 | config SERIAL_S3C6400 | 529 | config SERIAL_S3C6400 |
529 | tristate "Samsung S3C6400/S3C6410/S5P6440/S5PC100 Serial port support" | 530 | tristate "Samsung S3C6400/S3C6410/S5P6440/S5P6450/S5PC100 Serial port support" |
530 | depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5PC100) | 531 | depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5P6450 || CPU_S5PC100) |
531 | select SERIAL_SAMSUNG_UARTS_4 | 532 | select SERIAL_SAMSUNG_UARTS_4 |
532 | default y | 533 | default y |
533 | help | 534 | help |
534 | Serial port support for the Samsung S3C6400, S3C6410, S5P6440 | 535 | Serial port support for the Samsung S3C6400, S3C6410, S5P6440, S5P6450 |
535 | and S5PC100 SoCs | 536 | and S5PC100 SoCs |
536 | 537 | ||
537 | config SERIAL_S5PV210 | 538 | config SERIAL_S5PV210 |
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c index 324c385a653d..5dff45c76d32 100644 --- a/drivers/serial/mfd.c +++ b/drivers/serial/mfd.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/console.h> | 28 | #include <linux/console.h> |
29 | #include <linux/sysrq.h> | 29 | #include <linux/sysrq.h> |
30 | #include <linux/slab.h> | ||
30 | #include <linux/serial_reg.h> | 31 | #include <linux/serial_reg.h> |
31 | #include <linux/circ_buf.h> | 32 | #include <linux/circ_buf.h> |
32 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
diff --git a/drivers/serial/mrst_max3110.c b/drivers/serial/mrst_max3110.c index f6ad1ecbff79..51c15f58e01e 100644 --- a/drivers/serial/mrst_max3110.c +++ b/drivers/serial/mrst_max3110.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
32 | #include <linux/irq.h> | ||
32 | #include <linux/init.h> | 33 | #include <linux/init.h> |
33 | #include <linux/console.h> | 34 | #include <linux/console.h> |
34 | #include <linux/sysrq.h> | 35 | #include <linux/sysrq.h> |
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c index b1156ba8ad14..7ac2bf5167cd 100644 --- a/drivers/serial/samsung.c +++ b/drivers/serial/samsung.c | |||
@@ -1101,7 +1101,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1101 | dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); | 1101 | dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); |
1102 | 1102 | ||
1103 | port->mapbase = res->start; | 1103 | port->mapbase = res->start; |
1104 | port->membase = S3C_VA_UART + res->start - (S3C_PA_UART & 0xfff00000); | 1104 | port->membase = S3C_VA_UART + (res->start & 0xfffff); |
1105 | ret = platform_get_irq(platdev, 0); | 1105 | ret = platform_get_irq(platdev, 0); |
1106 | if (ret < 0) | 1106 | if (ret < 0) |
1107 | port->irq = 0; | 1107 | port->irq = 0; |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 91c2f4f3af10..7e631fa51098 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -143,10 +143,26 @@ config SPI_GPIO | |||
143 | GPIO operations, you should be able to leverage that for better | 143 | GPIO operations, you should be able to leverage that for better |
144 | speed with a custom version of this driver; see the source code. | 144 | speed with a custom version of this driver; see the source code. |
145 | 145 | ||
146 | config SPI_IMX_VER_IMX1 | ||
147 | def_bool y if SOC_IMX1 | ||
148 | |||
149 | config SPI_IMX_VER_0_0 | ||
150 | def_bool y if SOC_IMX21 || SOC_IMX27 | ||
151 | |||
152 | config SPI_IMX_VER_0_4 | ||
153 | def_bool y if ARCH_MX31 | ||
154 | |||
155 | config SPI_IMX_VER_0_7 | ||
156 | def_bool y if ARCH_MX25 || ARCH_MX35 || ARCH_MX51 | ||
157 | |||
158 | config SPI_IMX_VER_2_3 | ||
159 | def_bool y if ARCH_MX51 | ||
160 | |||
146 | config SPI_IMX | 161 | config SPI_IMX |
147 | tristate "Freescale i.MX SPI controllers" | 162 | tristate "Freescale i.MX SPI controllers" |
148 | depends on ARCH_MXC | 163 | depends on ARCH_MXC |
149 | select SPI_BITBANG | 164 | select SPI_BITBANG |
165 | default m if IMX_HAVE_PLATFORM_SPI_IMX | ||
150 | help | 166 | help |
151 | This enables using the Freescale i.MX SPI controllers in master | 167 | This enables using the Freescale i.MX SPI controllers in master |
152 | mode. | 168 | mode. |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 0bcf4c1601a2..b5a78a1f4421 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/cache.h> | 24 | #include <linux/cache.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/of_device.h> | ||
26 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
27 | #include <linux/mod_devicetable.h> | 28 | #include <linux/mod_devicetable.h> |
28 | #include <linux/spi/spi.h> | 29 | #include <linux/spi/spi.h> |
@@ -86,6 +87,10 @@ static int spi_match_device(struct device *dev, struct device_driver *drv) | |||
86 | const struct spi_device *spi = to_spi_device(dev); | 87 | const struct spi_device *spi = to_spi_device(dev); |
87 | const struct spi_driver *sdrv = to_spi_driver(drv); | 88 | const struct spi_driver *sdrv = to_spi_driver(drv); |
88 | 89 | ||
90 | /* Attempt an OF style match */ | ||
91 | if (of_driver_match_device(dev, drv)) | ||
92 | return 1; | ||
93 | |||
89 | if (sdrv->id_table) | 94 | if (sdrv->id_table) |
90 | return !!spi_match_id(sdrv->id_table, spi); | 95 | return !!spi_match_id(sdrv->id_table, spi); |
91 | 96 | ||
diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c index e24a63498acb..63e51b011d50 100644 --- a/drivers/spi/spi_gpio.c +++ b/drivers/spi/spi_gpio.c | |||
@@ -350,7 +350,7 @@ static int __init spi_gpio_probe(struct platform_device *pdev) | |||
350 | spi_gpio->bitbang.master = spi_master_get(master); | 350 | spi_gpio->bitbang.master = spi_master_get(master); |
351 | spi_gpio->bitbang.chipselect = spi_gpio_chipselect; | 351 | spi_gpio->bitbang.chipselect = spi_gpio_chipselect; |
352 | 352 | ||
353 | if ((master_flags & (SPI_MASTER_NO_RX | SPI_MASTER_NO_RX)) == 0) { | 353 | if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) { |
354 | spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0; | 354 | spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0; |
355 | spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1; | 355 | spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1; |
356 | spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_word_mode2; | 356 | spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_word_mode2; |
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 7972e9077473..55a38e2c6c13 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -56,7 +56,28 @@ struct spi_imx_config { | |||
56 | unsigned int speed_hz; | 56 | unsigned int speed_hz; |
57 | unsigned int bpw; | 57 | unsigned int bpw; |
58 | unsigned int mode; | 58 | unsigned int mode; |
59 | int cs; | 59 | u8 cs; |
60 | }; | ||
61 | |||
62 | enum spi_imx_devtype { | ||
63 | SPI_IMX_VER_IMX1, | ||
64 | SPI_IMX_VER_0_0, | ||
65 | SPI_IMX_VER_0_4, | ||
66 | SPI_IMX_VER_0_5, | ||
67 | SPI_IMX_VER_0_7, | ||
68 | SPI_IMX_VER_2_3, | ||
69 | SPI_IMX_VER_AUTODETECT, | ||
70 | }; | ||
71 | |||
72 | struct spi_imx_data; | ||
73 | |||
74 | struct spi_imx_devtype_data { | ||
75 | void (*intctrl)(struct spi_imx_data *, int); | ||
76 | int (*config)(struct spi_imx_data *, struct spi_imx_config *); | ||
77 | void (*trigger)(struct spi_imx_data *); | ||
78 | int (*rx_available)(struct spi_imx_data *); | ||
79 | void (*reset)(struct spi_imx_data *); | ||
80 | unsigned int fifosize; | ||
60 | }; | 81 | }; |
61 | 82 | ||
62 | struct spi_imx_data { | 83 | struct spi_imx_data { |
@@ -76,11 +97,7 @@ struct spi_imx_data { | |||
76 | const void *tx_buf; | 97 | const void *tx_buf; |
77 | unsigned int txfifo; /* number of words pushed in tx FIFO */ | 98 | unsigned int txfifo; /* number of words pushed in tx FIFO */ |
78 | 99 | ||
79 | /* SoC specific functions */ | 100 | struct spi_imx_devtype_data devtype_data; |
80 | void (*intctrl)(struct spi_imx_data *, int); | ||
81 | int (*config)(struct spi_imx_data *, struct spi_imx_config *); | ||
82 | void (*trigger)(struct spi_imx_data *); | ||
83 | int (*rx_available)(struct spi_imx_data *); | ||
84 | }; | 101 | }; |
85 | 102 | ||
86 | #define MXC_SPI_BUF_RX(type) \ | 103 | #define MXC_SPI_BUF_RX(type) \ |
@@ -140,7 +157,7 @@ static unsigned int spi_imx_clkdiv_1(unsigned int fin, | |||
140 | return max; | 157 | return max; |
141 | } | 158 | } |
142 | 159 | ||
143 | /* MX1, MX31, MX35 */ | 160 | /* MX1, MX31, MX35, MX51 CSPI */ |
144 | static unsigned int spi_imx_clkdiv_2(unsigned int fin, | 161 | static unsigned int spi_imx_clkdiv_2(unsigned int fin, |
145 | unsigned int fspi) | 162 | unsigned int fspi) |
146 | { | 163 | { |
@@ -155,6 +172,128 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin, | |||
155 | return 7; | 172 | return 7; |
156 | } | 173 | } |
157 | 174 | ||
175 | #define SPI_IMX2_3_CTRL 0x08 | ||
176 | #define SPI_IMX2_3_CTRL_ENABLE (1 << 0) | ||
177 | #define SPI_IMX2_3_CTRL_XCH (1 << 2) | ||
178 | #define SPI_IMX2_3_CTRL_MODE(cs) (1 << ((cs) + 4)) | ||
179 | #define SPI_IMX2_3_CTRL_POSTDIV_OFFSET 8 | ||
180 | #define SPI_IMX2_3_CTRL_PREDIV_OFFSET 12 | ||
181 | #define SPI_IMX2_3_CTRL_CS(cs) ((cs) << 18) | ||
182 | #define SPI_IMX2_3_CTRL_BL_OFFSET 20 | ||
183 | |||
184 | #define SPI_IMX2_3_CONFIG 0x0c | ||
185 | #define SPI_IMX2_3_CONFIG_SCLKPHA(cs) (1 << ((cs) + 0)) | ||
186 | #define SPI_IMX2_3_CONFIG_SCLKPOL(cs) (1 << ((cs) + 4)) | ||
187 | #define SPI_IMX2_3_CONFIG_SBBCTRL(cs) (1 << ((cs) + 8)) | ||
188 | #define SPI_IMX2_3_CONFIG_SSBPOL(cs) (1 << ((cs) + 12)) | ||
189 | |||
190 | #define SPI_IMX2_3_INT 0x10 | ||
191 | #define SPI_IMX2_3_INT_TEEN (1 << 0) | ||
192 | #define SPI_IMX2_3_INT_RREN (1 << 3) | ||
193 | |||
194 | #define SPI_IMX2_3_STAT 0x18 | ||
195 | #define SPI_IMX2_3_STAT_RR (1 << 3) | ||
196 | |||
197 | /* MX51 eCSPI */ | ||
198 | static unsigned int spi_imx2_3_clkdiv(unsigned int fin, unsigned int fspi) | ||
199 | { | ||
200 | /* | ||
201 | * there are two 4-bit dividers, the pre-divider divides by | ||
202 | * $pre, the post-divider by 2^$post | ||
203 | */ | ||
204 | unsigned int pre, post; | ||
205 | |||
206 | if (unlikely(fspi > fin)) | ||
207 | return 0; | ||
208 | |||
209 | post = fls(fin) - fls(fspi); | ||
210 | if (fin > fspi << post) | ||
211 | post++; | ||
212 | |||
213 | /* now we have: (fin <= fspi << post) with post being minimal */ | ||
214 | |||
215 | post = max(4U, post) - 4; | ||
216 | if (unlikely(post > 0xf)) { | ||
217 | pr_err("%s: cannot set clock freq: %u (base freq: %u)\n", | ||
218 | __func__, fspi, fin); | ||
219 | return 0xff; | ||
220 | } | ||
221 | |||
222 | pre = DIV_ROUND_UP(fin, fspi << post) - 1; | ||
223 | |||
224 | pr_debug("%s: fin: %u, fspi: %u, post: %u, pre: %u\n", | ||
225 | __func__, fin, fspi, post, pre); | ||
226 | return (pre << SPI_IMX2_3_CTRL_PREDIV_OFFSET) | | ||
227 | (post << SPI_IMX2_3_CTRL_POSTDIV_OFFSET); | ||
228 | } | ||
229 | |||
230 | static void __maybe_unused spi_imx2_3_intctrl(struct spi_imx_data *spi_imx, int enable) | ||
231 | { | ||
232 | unsigned val = 0; | ||
233 | |||
234 | if (enable & MXC_INT_TE) | ||
235 | val |= SPI_IMX2_3_INT_TEEN; | ||
236 | |||
237 | if (enable & MXC_INT_RR) | ||
238 | val |= SPI_IMX2_3_INT_RREN; | ||
239 | |||
240 | writel(val, spi_imx->base + SPI_IMX2_3_INT); | ||
241 | } | ||
242 | |||
243 | static void __maybe_unused spi_imx2_3_trigger(struct spi_imx_data *spi_imx) | ||
244 | { | ||
245 | u32 reg; | ||
246 | |||
247 | reg = readl(spi_imx->base + SPI_IMX2_3_CTRL); | ||
248 | reg |= SPI_IMX2_3_CTRL_XCH; | ||
249 | writel(reg, spi_imx->base + SPI_IMX2_3_CTRL); | ||
250 | } | ||
251 | |||
252 | static int __maybe_unused spi_imx2_3_config(struct spi_imx_data *spi_imx, | ||
253 | struct spi_imx_config *config) | ||
254 | { | ||
255 | u32 ctrl = SPI_IMX2_3_CTRL_ENABLE, cfg = 0; | ||
256 | |||
257 | /* set master mode */ | ||
258 | ctrl |= SPI_IMX2_3_CTRL_MODE(config->cs); | ||
259 | |||
260 | /* set clock speed */ | ||
261 | ctrl |= spi_imx2_3_clkdiv(spi_imx->spi_clk, config->speed_hz); | ||
262 | |||
263 | /* set chip select to use */ | ||
264 | ctrl |= SPI_IMX2_3_CTRL_CS(config->cs); | ||
265 | |||
266 | ctrl |= (config->bpw - 1) << SPI_IMX2_3_CTRL_BL_OFFSET; | ||
267 | |||
268 | cfg |= SPI_IMX2_3_CONFIG_SBBCTRL(config->cs); | ||
269 | |||
270 | if (config->mode & SPI_CPHA) | ||
271 | cfg |= SPI_IMX2_3_CONFIG_SCLKPHA(config->cs); | ||
272 | |||
273 | if (config->mode & SPI_CPOL) | ||
274 | cfg |= SPI_IMX2_3_CONFIG_SCLKPOL(config->cs); | ||
275 | |||
276 | if (config->mode & SPI_CS_HIGH) | ||
277 | cfg |= SPI_IMX2_3_CONFIG_SSBPOL(config->cs); | ||
278 | |||
279 | writel(ctrl, spi_imx->base + SPI_IMX2_3_CTRL); | ||
280 | writel(cfg, spi_imx->base + SPI_IMX2_3_CONFIG); | ||
281 | |||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | static int __maybe_unused spi_imx2_3_rx_available(struct spi_imx_data *spi_imx) | ||
286 | { | ||
287 | return readl(spi_imx->base + SPI_IMX2_3_STAT) & SPI_IMX2_3_STAT_RR; | ||
288 | } | ||
289 | |||
290 | static void __maybe_unused spi_imx2_3_reset(struct spi_imx_data *spi_imx) | ||
291 | { | ||
292 | /* drain receive buffer */ | ||
293 | while (spi_imx2_3_rx_available(spi_imx)) | ||
294 | readl(spi_imx->base + MXC_CSPIRXDATA); | ||
295 | } | ||
296 | |||
158 | #define MX31_INTREG_TEEN (1 << 0) | 297 | #define MX31_INTREG_TEEN (1 << 0) |
159 | #define MX31_INTREG_RREN (1 << 3) | 298 | #define MX31_INTREG_RREN (1 << 3) |
160 | 299 | ||
@@ -178,7 +317,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin, | |||
178 | * the i.MX35 has a slightly different register layout for bits | 317 | * the i.MX35 has a slightly different register layout for bits |
179 | * we do not use here. | 318 | * we do not use here. |
180 | */ | 319 | */ |
181 | static void mx31_intctrl(struct spi_imx_data *spi_imx, int enable) | 320 | static void __maybe_unused mx31_intctrl(struct spi_imx_data *spi_imx, int enable) |
182 | { | 321 | { |
183 | unsigned int val = 0; | 322 | unsigned int val = 0; |
184 | 323 | ||
@@ -190,7 +329,7 @@ static void mx31_intctrl(struct spi_imx_data *spi_imx, int enable) | |||
190 | writel(val, spi_imx->base + MXC_CSPIINT); | 329 | writel(val, spi_imx->base + MXC_CSPIINT); |
191 | } | 330 | } |
192 | 331 | ||
193 | static void mx31_trigger(struct spi_imx_data *spi_imx) | 332 | static void __maybe_unused mx31_trigger(struct spi_imx_data *spi_imx) |
194 | { | 333 | { |
195 | unsigned int reg; | 334 | unsigned int reg; |
196 | 335 | ||
@@ -199,20 +338,16 @@ static void mx31_trigger(struct spi_imx_data *spi_imx) | |||
199 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 338 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
200 | } | 339 | } |
201 | 340 | ||
202 | static int mx31_config(struct spi_imx_data *spi_imx, | 341 | static int __maybe_unused spi_imx0_4_config(struct spi_imx_data *spi_imx, |
203 | struct spi_imx_config *config) | 342 | struct spi_imx_config *config) |
204 | { | 343 | { |
205 | unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; | 344 | unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; |
345 | int cs = spi_imx->chipselect[config->cs]; | ||
206 | 346 | ||
207 | reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << | 347 | reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << |
208 | MX31_CSPICTRL_DR_SHIFT; | 348 | MX31_CSPICTRL_DR_SHIFT; |
209 | 349 | ||
210 | if (cpu_is_mx31()) | 350 | reg |= (config->bpw - 1) << MX31_CSPICTRL_BC_SHIFT; |
211 | reg |= (config->bpw - 1) << MX31_CSPICTRL_BC_SHIFT; | ||
212 | else if (cpu_is_mx25() || cpu_is_mx35()) { | ||
213 | reg |= (config->bpw - 1) << MX35_CSPICTRL_BL_SHIFT; | ||
214 | reg |= MX31_CSPICTRL_SSCTL; | ||
215 | } | ||
216 | 351 | ||
217 | if (config->mode & SPI_CPHA) | 352 | if (config->mode & SPI_CPHA) |
218 | reg |= MX31_CSPICTRL_PHA; | 353 | reg |= MX31_CSPICTRL_PHA; |
@@ -220,23 +355,52 @@ static int mx31_config(struct spi_imx_data *spi_imx, | |||
220 | reg |= MX31_CSPICTRL_POL; | 355 | reg |= MX31_CSPICTRL_POL; |
221 | if (config->mode & SPI_CS_HIGH) | 356 | if (config->mode & SPI_CS_HIGH) |
222 | reg |= MX31_CSPICTRL_SSPOL; | 357 | reg |= MX31_CSPICTRL_SSPOL; |
223 | if (config->cs < 0) { | 358 | if (cs < 0) |
224 | if (cpu_is_mx31()) | 359 | reg |= (cs + 32) << MX31_CSPICTRL_CS_SHIFT; |
225 | reg |= (config->cs + 32) << MX31_CSPICTRL_CS_SHIFT; | 360 | |
226 | else if (cpu_is_mx25() || cpu_is_mx35()) | 361 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
227 | reg |= (config->cs + 32) << MX35_CSPICTRL_CS_SHIFT; | 362 | |
228 | } | 363 | return 0; |
364 | } | ||
365 | |||
366 | static int __maybe_unused spi_imx0_7_config(struct spi_imx_data *spi_imx, | ||
367 | struct spi_imx_config *config) | ||
368 | { | ||
369 | unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; | ||
370 | int cs = spi_imx->chipselect[config->cs]; | ||
371 | |||
372 | reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << | ||
373 | MX31_CSPICTRL_DR_SHIFT; | ||
374 | |||
375 | reg |= (config->bpw - 1) << MX35_CSPICTRL_BL_SHIFT; | ||
376 | reg |= MX31_CSPICTRL_SSCTL; | ||
377 | |||
378 | if (config->mode & SPI_CPHA) | ||
379 | reg |= MX31_CSPICTRL_PHA; | ||
380 | if (config->mode & SPI_CPOL) | ||
381 | reg |= MX31_CSPICTRL_POL; | ||
382 | if (config->mode & SPI_CS_HIGH) | ||
383 | reg |= MX31_CSPICTRL_SSPOL; | ||
384 | if (cs < 0) | ||
385 | reg |= (cs + 32) << MX35_CSPICTRL_CS_SHIFT; | ||
229 | 386 | ||
230 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 387 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
231 | 388 | ||
232 | return 0; | 389 | return 0; |
233 | } | 390 | } |
234 | 391 | ||
235 | static int mx31_rx_available(struct spi_imx_data *spi_imx) | 392 | static int __maybe_unused mx31_rx_available(struct spi_imx_data *spi_imx) |
236 | { | 393 | { |
237 | return readl(spi_imx->base + MX31_CSPISTATUS) & MX31_STATUS_RR; | 394 | return readl(spi_imx->base + MX31_CSPISTATUS) & MX31_STATUS_RR; |
238 | } | 395 | } |
239 | 396 | ||
397 | static void __maybe_unused spi_imx0_4_reset(struct spi_imx_data *spi_imx) | ||
398 | { | ||
399 | /* drain receive buffer */ | ||
400 | while (readl(spi_imx->base + MX3_CSPISTAT) & MX3_CSPISTAT_RR) | ||
401 | readl(spi_imx->base + MXC_CSPIRXDATA); | ||
402 | } | ||
403 | |||
240 | #define MX27_INTREG_RR (1 << 4) | 404 | #define MX27_INTREG_RR (1 << 4) |
241 | #define MX27_INTREG_TEEN (1 << 9) | 405 | #define MX27_INTREG_TEEN (1 << 9) |
242 | #define MX27_INTREG_RREN (1 << 13) | 406 | #define MX27_INTREG_RREN (1 << 13) |
@@ -250,7 +414,7 @@ static int mx31_rx_available(struct spi_imx_data *spi_imx) | |||
250 | #define MX27_CSPICTRL_DR_SHIFT 14 | 414 | #define MX27_CSPICTRL_DR_SHIFT 14 |
251 | #define MX27_CSPICTRL_CS_SHIFT 19 | 415 | #define MX27_CSPICTRL_CS_SHIFT 19 |
252 | 416 | ||
253 | static void mx27_intctrl(struct spi_imx_data *spi_imx, int enable) | 417 | static void __maybe_unused mx27_intctrl(struct spi_imx_data *spi_imx, int enable) |
254 | { | 418 | { |
255 | unsigned int val = 0; | 419 | unsigned int val = 0; |
256 | 420 | ||
@@ -262,7 +426,7 @@ static void mx27_intctrl(struct spi_imx_data *spi_imx, int enable) | |||
262 | writel(val, spi_imx->base + MXC_CSPIINT); | 426 | writel(val, spi_imx->base + MXC_CSPIINT); |
263 | } | 427 | } |
264 | 428 | ||
265 | static void mx27_trigger(struct spi_imx_data *spi_imx) | 429 | static void __maybe_unused mx27_trigger(struct spi_imx_data *spi_imx) |
266 | { | 430 | { |
267 | unsigned int reg; | 431 | unsigned int reg; |
268 | 432 | ||
@@ -271,10 +435,11 @@ static void mx27_trigger(struct spi_imx_data *spi_imx) | |||
271 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 435 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
272 | } | 436 | } |
273 | 437 | ||
274 | static int mx27_config(struct spi_imx_data *spi_imx, | 438 | static int __maybe_unused mx27_config(struct spi_imx_data *spi_imx, |
275 | struct spi_imx_config *config) | 439 | struct spi_imx_config *config) |
276 | { | 440 | { |
277 | unsigned int reg = MX27_CSPICTRL_ENABLE | MX27_CSPICTRL_MASTER; | 441 | unsigned int reg = MX27_CSPICTRL_ENABLE | MX27_CSPICTRL_MASTER; |
442 | int cs = spi_imx->chipselect[config->cs]; | ||
278 | 443 | ||
279 | reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, config->speed_hz) << | 444 | reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, config->speed_hz) << |
280 | MX27_CSPICTRL_DR_SHIFT; | 445 | MX27_CSPICTRL_DR_SHIFT; |
@@ -286,19 +451,24 @@ static int mx27_config(struct spi_imx_data *spi_imx, | |||
286 | reg |= MX27_CSPICTRL_POL; | 451 | reg |= MX27_CSPICTRL_POL; |
287 | if (config->mode & SPI_CS_HIGH) | 452 | if (config->mode & SPI_CS_HIGH) |
288 | reg |= MX27_CSPICTRL_SSPOL; | 453 | reg |= MX27_CSPICTRL_SSPOL; |
289 | if (config->cs < 0) | 454 | if (cs < 0) |
290 | reg |= (config->cs + 32) << MX27_CSPICTRL_CS_SHIFT; | 455 | reg |= (cs + 32) << MX27_CSPICTRL_CS_SHIFT; |
291 | 456 | ||
292 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 457 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
293 | 458 | ||
294 | return 0; | 459 | return 0; |
295 | } | 460 | } |
296 | 461 | ||
297 | static int mx27_rx_available(struct spi_imx_data *spi_imx) | 462 | static int __maybe_unused mx27_rx_available(struct spi_imx_data *spi_imx) |
298 | { | 463 | { |
299 | return readl(spi_imx->base + MXC_CSPIINT) & MX27_INTREG_RR; | 464 | return readl(spi_imx->base + MXC_CSPIINT) & MX27_INTREG_RR; |
300 | } | 465 | } |
301 | 466 | ||
467 | static void __maybe_unused spi_imx0_0_reset(struct spi_imx_data *spi_imx) | ||
468 | { | ||
469 | writel(1, spi_imx->base + MXC_RESET); | ||
470 | } | ||
471 | |||
302 | #define MX1_INTREG_RR (1 << 3) | 472 | #define MX1_INTREG_RR (1 << 3) |
303 | #define MX1_INTREG_TEEN (1 << 8) | 473 | #define MX1_INTREG_TEEN (1 << 8) |
304 | #define MX1_INTREG_RREN (1 << 11) | 474 | #define MX1_INTREG_RREN (1 << 11) |
@@ -310,7 +480,7 @@ static int mx27_rx_available(struct spi_imx_data *spi_imx) | |||
310 | #define MX1_CSPICTRL_MASTER (1 << 10) | 480 | #define MX1_CSPICTRL_MASTER (1 << 10) |
311 | #define MX1_CSPICTRL_DR_SHIFT 13 | 481 | #define MX1_CSPICTRL_DR_SHIFT 13 |
312 | 482 | ||
313 | static void mx1_intctrl(struct spi_imx_data *spi_imx, int enable) | 483 | static void __maybe_unused mx1_intctrl(struct spi_imx_data *spi_imx, int enable) |
314 | { | 484 | { |
315 | unsigned int val = 0; | 485 | unsigned int val = 0; |
316 | 486 | ||
@@ -322,7 +492,7 @@ static void mx1_intctrl(struct spi_imx_data *spi_imx, int enable) | |||
322 | writel(val, spi_imx->base + MXC_CSPIINT); | 492 | writel(val, spi_imx->base + MXC_CSPIINT); |
323 | } | 493 | } |
324 | 494 | ||
325 | static void mx1_trigger(struct spi_imx_data *spi_imx) | 495 | static void __maybe_unused mx1_trigger(struct spi_imx_data *spi_imx) |
326 | { | 496 | { |
327 | unsigned int reg; | 497 | unsigned int reg; |
328 | 498 | ||
@@ -331,7 +501,7 @@ static void mx1_trigger(struct spi_imx_data *spi_imx) | |||
331 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 501 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
332 | } | 502 | } |
333 | 503 | ||
334 | static int mx1_config(struct spi_imx_data *spi_imx, | 504 | static int __maybe_unused mx1_config(struct spi_imx_data *spi_imx, |
335 | struct spi_imx_config *config) | 505 | struct spi_imx_config *config) |
336 | { | 506 | { |
337 | unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; | 507 | unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; |
@@ -350,11 +520,73 @@ static int mx1_config(struct spi_imx_data *spi_imx, | |||
350 | return 0; | 520 | return 0; |
351 | } | 521 | } |
352 | 522 | ||
353 | static int mx1_rx_available(struct spi_imx_data *spi_imx) | 523 | static int __maybe_unused mx1_rx_available(struct spi_imx_data *spi_imx) |
354 | { | 524 | { |
355 | return readl(spi_imx->base + MXC_CSPIINT) & MX1_INTREG_RR; | 525 | return readl(spi_imx->base + MXC_CSPIINT) & MX1_INTREG_RR; |
356 | } | 526 | } |
357 | 527 | ||
528 | static void __maybe_unused mx1_reset(struct spi_imx_data *spi_imx) | ||
529 | { | ||
530 | writel(1, spi_imx->base + MXC_RESET); | ||
531 | } | ||
532 | |||
533 | /* | ||
534 | * These version numbers are taken from the Freescale driver. Unfortunately it | ||
535 | * doesn't support i.MX1, so this entry doesn't match the scheme. :-( | ||
536 | */ | ||
537 | static struct spi_imx_devtype_data spi_imx_devtype_data[] __devinitdata = { | ||
538 | #ifdef CONFIG_SPI_IMX_VER_IMX1 | ||
539 | [SPI_IMX_VER_IMX1] = { | ||
540 | .intctrl = mx1_intctrl, | ||
541 | .config = mx1_config, | ||
542 | .trigger = mx1_trigger, | ||
543 | .rx_available = mx1_rx_available, | ||
544 | .reset = mx1_reset, | ||
545 | .fifosize = 8, | ||
546 | }, | ||
547 | #endif | ||
548 | #ifdef CONFIG_SPI_IMX_VER_0_0 | ||
549 | [SPI_IMX_VER_0_0] = { | ||
550 | .intctrl = mx27_intctrl, | ||
551 | .config = mx27_config, | ||
552 | .trigger = mx27_trigger, | ||
553 | .rx_available = mx27_rx_available, | ||
554 | .reset = spi_imx0_0_reset, | ||
555 | .fifosize = 8, | ||
556 | }, | ||
557 | #endif | ||
558 | #ifdef CONFIG_SPI_IMX_VER_0_4 | ||
559 | [SPI_IMX_VER_0_4] = { | ||
560 | .intctrl = mx31_intctrl, | ||
561 | .config = spi_imx0_4_config, | ||
562 | .trigger = mx31_trigger, | ||
563 | .rx_available = mx31_rx_available, | ||
564 | .reset = spi_imx0_4_reset, | ||
565 | .fifosize = 8, | ||
566 | }, | ||
567 | #endif | ||
568 | #ifdef CONFIG_SPI_IMX_VER_0_7 | ||
569 | [SPI_IMX_VER_0_7] = { | ||
570 | .intctrl = mx31_intctrl, | ||
571 | .config = spi_imx0_7_config, | ||
572 | .trigger = mx31_trigger, | ||
573 | .rx_available = mx31_rx_available, | ||
574 | .reset = spi_imx0_4_reset, | ||
575 | .fifosize = 8, | ||
576 | }, | ||
577 | #endif | ||
578 | #ifdef CONFIG_SPI_IMX_VER_2_3 | ||
579 | [SPI_IMX_VER_2_3] = { | ||
580 | .intctrl = spi_imx2_3_intctrl, | ||
581 | .config = spi_imx2_3_config, | ||
582 | .trigger = spi_imx2_3_trigger, | ||
583 | .rx_available = spi_imx2_3_rx_available, | ||
584 | .reset = spi_imx2_3_reset, | ||
585 | .fifosize = 64, | ||
586 | }, | ||
587 | #endif | ||
588 | }; | ||
589 | |||
358 | static void spi_imx_chipselect(struct spi_device *spi, int is_active) | 590 | static void spi_imx_chipselect(struct spi_device *spi, int is_active) |
359 | { | 591 | { |
360 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); | 592 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); |
@@ -370,21 +602,21 @@ static void spi_imx_chipselect(struct spi_device *spi, int is_active) | |||
370 | 602 | ||
371 | static void spi_imx_push(struct spi_imx_data *spi_imx) | 603 | static void spi_imx_push(struct spi_imx_data *spi_imx) |
372 | { | 604 | { |
373 | while (spi_imx->txfifo < 8) { | 605 | while (spi_imx->txfifo < spi_imx->devtype_data.fifosize) { |
374 | if (!spi_imx->count) | 606 | if (!spi_imx->count) |
375 | break; | 607 | break; |
376 | spi_imx->tx(spi_imx); | 608 | spi_imx->tx(spi_imx); |
377 | spi_imx->txfifo++; | 609 | spi_imx->txfifo++; |
378 | } | 610 | } |
379 | 611 | ||
380 | spi_imx->trigger(spi_imx); | 612 | spi_imx->devtype_data.trigger(spi_imx); |
381 | } | 613 | } |
382 | 614 | ||
383 | static irqreturn_t spi_imx_isr(int irq, void *dev_id) | 615 | static irqreturn_t spi_imx_isr(int irq, void *dev_id) |
384 | { | 616 | { |
385 | struct spi_imx_data *spi_imx = dev_id; | 617 | struct spi_imx_data *spi_imx = dev_id; |
386 | 618 | ||
387 | while (spi_imx->rx_available(spi_imx)) { | 619 | while (spi_imx->devtype_data.rx_available(spi_imx)) { |
388 | spi_imx->rx(spi_imx); | 620 | spi_imx->rx(spi_imx); |
389 | spi_imx->txfifo--; | 621 | spi_imx->txfifo--; |
390 | } | 622 | } |
@@ -398,11 +630,12 @@ static irqreturn_t spi_imx_isr(int irq, void *dev_id) | |||
398 | /* No data left to push, but still waiting for rx data, | 630 | /* No data left to push, but still waiting for rx data, |
399 | * enable receive data available interrupt. | 631 | * enable receive data available interrupt. |
400 | */ | 632 | */ |
401 | spi_imx->intctrl(spi_imx, MXC_INT_RR); | 633 | spi_imx->devtype_data.intctrl( |
634 | spi_imx, MXC_INT_RR); | ||
402 | return IRQ_HANDLED; | 635 | return IRQ_HANDLED; |
403 | } | 636 | } |
404 | 637 | ||
405 | spi_imx->intctrl(spi_imx, 0); | 638 | spi_imx->devtype_data.intctrl(spi_imx, 0); |
406 | complete(&spi_imx->xfer_done); | 639 | complete(&spi_imx->xfer_done); |
407 | 640 | ||
408 | return IRQ_HANDLED; | 641 | return IRQ_HANDLED; |
@@ -417,7 +650,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, | |||
417 | config.bpw = t ? t->bits_per_word : spi->bits_per_word; | 650 | config.bpw = t ? t->bits_per_word : spi->bits_per_word; |
418 | config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; | 651 | config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; |
419 | config.mode = spi->mode; | 652 | config.mode = spi->mode; |
420 | config.cs = spi_imx->chipselect[spi->chip_select]; | 653 | config.cs = spi->chip_select; |
421 | 654 | ||
422 | if (!config.speed_hz) | 655 | if (!config.speed_hz) |
423 | config.speed_hz = spi->max_speed_hz; | 656 | config.speed_hz = spi->max_speed_hz; |
@@ -439,7 +672,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, | |||
439 | } else | 672 | } else |
440 | BUG(); | 673 | BUG(); |
441 | 674 | ||
442 | spi_imx->config(spi_imx, &config); | 675 | spi_imx->devtype_data.config(spi_imx, &config); |
443 | 676 | ||
444 | return 0; | 677 | return 0; |
445 | } | 678 | } |
@@ -458,7 +691,7 @@ static int spi_imx_transfer(struct spi_device *spi, | |||
458 | 691 | ||
459 | spi_imx_push(spi_imx); | 692 | spi_imx_push(spi_imx); |
460 | 693 | ||
461 | spi_imx->intctrl(spi_imx, MXC_INT_TE); | 694 | spi_imx->devtype_data.intctrl(spi_imx, MXC_INT_TE); |
462 | 695 | ||
463 | wait_for_completion(&spi_imx->xfer_done); | 696 | wait_for_completion(&spi_imx->xfer_done); |
464 | 697 | ||
@@ -485,6 +718,39 @@ static void spi_imx_cleanup(struct spi_device *spi) | |||
485 | { | 718 | { |
486 | } | 719 | } |
487 | 720 | ||
721 | static struct platform_device_id spi_imx_devtype[] = { | ||
722 | { | ||
723 | .name = DRIVER_NAME, | ||
724 | .driver_data = SPI_IMX_VER_AUTODETECT, | ||
725 | }, { | ||
726 | .name = "imx1-cspi", | ||
727 | .driver_data = SPI_IMX_VER_IMX1, | ||
728 | }, { | ||
729 | .name = "imx21-cspi", | ||
730 | .driver_data = SPI_IMX_VER_0_0, | ||
731 | }, { | ||
732 | .name = "imx25-cspi", | ||
733 | .driver_data = SPI_IMX_VER_0_7, | ||
734 | }, { | ||
735 | .name = "imx27-cspi", | ||
736 | .driver_data = SPI_IMX_VER_0_0, | ||
737 | }, { | ||
738 | .name = "imx31-cspi", | ||
739 | .driver_data = SPI_IMX_VER_0_4, | ||
740 | }, { | ||
741 | .name = "imx35-cspi", | ||
742 | .driver_data = SPI_IMX_VER_0_7, | ||
743 | }, { | ||
744 | .name = "imx51-cspi", | ||
745 | .driver_data = SPI_IMX_VER_0_7, | ||
746 | }, { | ||
747 | .name = "imx51-ecspi", | ||
748 | .driver_data = SPI_IMX_VER_2_3, | ||
749 | }, { | ||
750 | /* sentinel */ | ||
751 | } | ||
752 | }; | ||
753 | |||
488 | static int __devinit spi_imx_probe(struct platform_device *pdev) | 754 | static int __devinit spi_imx_probe(struct platform_device *pdev) |
489 | { | 755 | { |
490 | struct spi_imx_master *mxc_platform_info; | 756 | struct spi_imx_master *mxc_platform_info; |
@@ -536,6 +802,31 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
536 | 802 | ||
537 | init_completion(&spi_imx->xfer_done); | 803 | init_completion(&spi_imx->xfer_done); |
538 | 804 | ||
805 | if (pdev->id_entry->driver_data == SPI_IMX_VER_AUTODETECT) { | ||
806 | if (cpu_is_mx25() || cpu_is_mx35()) | ||
807 | spi_imx->devtype_data = | ||
808 | spi_imx_devtype_data[SPI_IMX_VER_0_7]; | ||
809 | else if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35()) | ||
810 | spi_imx->devtype_data = | ||
811 | spi_imx_devtype_data[SPI_IMX_VER_0_4]; | ||
812 | else if (cpu_is_mx27() || cpu_is_mx21()) | ||
813 | spi_imx->devtype_data = | ||
814 | spi_imx_devtype_data[SPI_IMX_VER_0_0]; | ||
815 | else if (cpu_is_mx1()) | ||
816 | spi_imx->devtype_data = | ||
817 | spi_imx_devtype_data[SPI_IMX_VER_IMX1]; | ||
818 | else | ||
819 | BUG(); | ||
820 | } else | ||
821 | spi_imx->devtype_data = | ||
822 | spi_imx_devtype_data[pdev->id_entry->driver_data]; | ||
823 | |||
824 | if (!spi_imx->devtype_data.intctrl) { | ||
825 | dev_err(&pdev->dev, "no support for this device compiled in\n"); | ||
826 | ret = -ENODEV; | ||
827 | goto out_gpio_free; | ||
828 | } | ||
829 | |||
539 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 830 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
540 | if (!res) { | 831 | if (!res) { |
541 | dev_err(&pdev->dev, "can't get platform resource\n"); | 832 | dev_err(&pdev->dev, "can't get platform resource\n"); |
@@ -567,24 +858,6 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
567 | goto out_iounmap; | 858 | goto out_iounmap; |
568 | } | 859 | } |
569 | 860 | ||
570 | if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35()) { | ||
571 | spi_imx->intctrl = mx31_intctrl; | ||
572 | spi_imx->config = mx31_config; | ||
573 | spi_imx->trigger = mx31_trigger; | ||
574 | spi_imx->rx_available = mx31_rx_available; | ||
575 | } else if (cpu_is_mx27() || cpu_is_mx21()) { | ||
576 | spi_imx->intctrl = mx27_intctrl; | ||
577 | spi_imx->config = mx27_config; | ||
578 | spi_imx->trigger = mx27_trigger; | ||
579 | spi_imx->rx_available = mx27_rx_available; | ||
580 | } else if (cpu_is_mx1()) { | ||
581 | spi_imx->intctrl = mx1_intctrl; | ||
582 | spi_imx->config = mx1_config; | ||
583 | spi_imx->trigger = mx1_trigger; | ||
584 | spi_imx->rx_available = mx1_rx_available; | ||
585 | } else | ||
586 | BUG(); | ||
587 | |||
588 | spi_imx->clk = clk_get(&pdev->dev, NULL); | 861 | spi_imx->clk = clk_get(&pdev->dev, NULL); |
589 | if (IS_ERR(spi_imx->clk)) { | 862 | if (IS_ERR(spi_imx->clk)) { |
590 | dev_err(&pdev->dev, "unable to get clock\n"); | 863 | dev_err(&pdev->dev, "unable to get clock\n"); |
@@ -595,15 +868,9 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
595 | clk_enable(spi_imx->clk); | 868 | clk_enable(spi_imx->clk); |
596 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk); | 869 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk); |
597 | 870 | ||
598 | if (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27()) | 871 | spi_imx->devtype_data.reset(spi_imx); |
599 | writel(1, spi_imx->base + MXC_RESET); | ||
600 | |||
601 | /* drain receive buffer */ | ||
602 | if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35()) | ||
603 | while (readl(spi_imx->base + MX3_CSPISTAT) & MX3_CSPISTAT_RR) | ||
604 | readl(spi_imx->base + MXC_CSPIRXDATA); | ||
605 | 872 | ||
606 | spi_imx->intctrl(spi_imx, 0); | 873 | spi_imx->devtype_data.intctrl(spi_imx, 0); |
607 | 874 | ||
608 | ret = spi_bitbang_start(&spi_imx->bitbang); | 875 | ret = spi_bitbang_start(&spi_imx->bitbang); |
609 | if (ret) { | 876 | if (ret) { |
@@ -668,6 +935,7 @@ static struct platform_driver spi_imx_driver = { | |||
668 | .name = DRIVER_NAME, | 935 | .name = DRIVER_NAME, |
669 | .owner = THIS_MODULE, | 936 | .owner = THIS_MODULE, |
670 | }, | 937 | }, |
938 | .id_table = spi_imx_devtype, | ||
671 | .probe = spi_imx_probe, | 939 | .probe = spi_imx_probe, |
672 | .remove = __devexit_p(spi_imx_remove), | 940 | .remove = __devexit_p(spi_imx_remove), |
673 | }; | 941 | }; |
diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c index d31b57f7baaf..1dd86b835cd8 100644 --- a/drivers/spi/spi_mpc8xxx.c +++ b/drivers/spi/spi_mpc8xxx.c | |||
@@ -408,11 +408,17 @@ static void mpc8xxx_spi_cpm_bufs_start(struct mpc8xxx_spi *mspi) | |||
408 | 408 | ||
409 | xfer_ofs = mspi->xfer_in_progress->len - mspi->count; | 409 | xfer_ofs = mspi->xfer_in_progress->len - mspi->count; |
410 | 410 | ||
411 | out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs); | 411 | if (mspi->rx_dma == mspi->dma_dummy_rx) |
412 | out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma); | ||
413 | else | ||
414 | out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs); | ||
412 | out_be16(&rx_bd->cbd_datlen, 0); | 415 | out_be16(&rx_bd->cbd_datlen, 0); |
413 | out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP); | 416 | out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP); |
414 | 417 | ||
415 | out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs); | 418 | if (mspi->tx_dma == mspi->dma_dummy_tx) |
419 | out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma); | ||
420 | else | ||
421 | out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs); | ||
416 | out_be16(&tx_bd->cbd_datlen, xfer_len); | 422 | out_be16(&tx_bd->cbd_datlen, xfer_len); |
417 | out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP | | 423 | out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP | |
418 | BD_SC_LAST); | 424 | BD_SC_LAST); |
diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index c725356cc346..de7ebb99d8f6 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_TM6000 | 1 | config VIDEO_TM6000 |
2 | tristate "TV Master TM5600/6000/6010 driver" | 2 | tristate "TV Master TM5600/6000/6010 driver" |
3 | depends on VIDEO_DEV && I2C && INPUT && USB && EXPERIMENTAL | 3 | depends on VIDEO_DEV && I2C && INPUT && IR_CORE && USB && EXPERIMENTAL |
4 | select VIDEO_TUNER | 4 | select VIDEO_TUNER |
5 | select MEDIA_TUNER_XC2028 | 5 | select MEDIA_TUNER_XC2028 |
6 | select MEDIA_TUNER_XC5000 | 6 | select MEDIA_TUNER_XC5000 |
diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c index 32f7a0af6938..54f7667cc706 100644 --- a/drivers/staging/tm6000/tm6000-input.c +++ b/drivers/staging/tm6000/tm6000-input.c | |||
@@ -46,7 +46,7 @@ MODULE_PARM_DESC(enable_ir, "enable ir (default is enable"); | |||
46 | } | 46 | } |
47 | 47 | ||
48 | struct tm6000_ir_poll_result { | 48 | struct tm6000_ir_poll_result { |
49 | u8 rc_data[4]; | 49 | u16 rc_data; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | struct tm6000_IR { | 52 | struct tm6000_IR { |
@@ -60,9 +60,9 @@ struct tm6000_IR { | |||
60 | int polling; | 60 | int polling; |
61 | struct delayed_work work; | 61 | struct delayed_work work; |
62 | u8 wait:1; | 62 | u8 wait:1; |
63 | u8 key:1; | ||
63 | struct urb *int_urb; | 64 | struct urb *int_urb; |
64 | u8 *urb_data; | 65 | u8 *urb_data; |
65 | u8 key:1; | ||
66 | 66 | ||
67 | int (*get_key) (struct tm6000_IR *, struct tm6000_ir_poll_result *); | 67 | int (*get_key) (struct tm6000_IR *, struct tm6000_ir_poll_result *); |
68 | 68 | ||
@@ -122,13 +122,14 @@ static void tm6000_ir_urb_received(struct urb *urb) | |||
122 | 122 | ||
123 | if (urb->status != 0) | 123 | if (urb->status != 0) |
124 | printk(KERN_INFO "not ready\n"); | 124 | printk(KERN_INFO "not ready\n"); |
125 | else if (urb->actual_length > 0) | 125 | else if (urb->actual_length > 0) { |
126 | memcpy(ir->urb_data, urb->transfer_buffer, urb->actual_length); | 126 | memcpy(ir->urb_data, urb->transfer_buffer, urb->actual_length); |
127 | 127 | ||
128 | dprintk("data %02x %02x %02x %02x\n", ir->urb_data[0], | 128 | dprintk("data %02x %02x %02x %02x\n", ir->urb_data[0], |
129 | ir->urb_data[1], ir->urb_data[2], ir->urb_data[3]); | 129 | ir->urb_data[1], ir->urb_data[2], ir->urb_data[3]); |
130 | 130 | ||
131 | ir->key = 1; | 131 | ir->key = 1; |
132 | } | ||
132 | 133 | ||
133 | rc = usb_submit_urb(urb, GFP_ATOMIC); | 134 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
134 | } | 135 | } |
@@ -140,30 +141,47 @@ static int default_polling_getkey(struct tm6000_IR *ir, | |||
140 | int rc; | 141 | int rc; |
141 | u8 buf[2]; | 142 | u8 buf[2]; |
142 | 143 | ||
143 | if (ir->wait && !&dev->int_in) { | 144 | if (ir->wait && !&dev->int_in) |
144 | poll_result->rc_data[0] = 0xff; | ||
145 | return 0; | 145 | return 0; |
146 | } | ||
147 | 146 | ||
148 | if (&dev->int_in) { | 147 | if (&dev->int_in) { |
149 | poll_result->rc_data[0] = ir->urb_data[0]; | 148 | if (ir->ir.ir_type == IR_TYPE_RC5) |
150 | poll_result->rc_data[1] = ir->urb_data[1]; | 149 | poll_result->rc_data = ir->urb_data[0]; |
150 | else | ||
151 | poll_result->rc_data = ir->urb_data[0] | ir->urb_data[1] << 8; | ||
151 | } else { | 152 | } else { |
152 | tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 0); | 153 | tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 0); |
153 | msleep(10); | 154 | msleep(10); |
154 | tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 1); | 155 | tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 1); |
155 | msleep(10); | 156 | msleep(10); |
156 | 157 | ||
157 | rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | | 158 | if (ir->ir.ir_type == IR_TYPE_RC5) { |
158 | USB_RECIP_DEVICE, REQ_02_GET_IR_CODE, 0, 0, buf, 1); | 159 | rc = tm6000_read_write_usb(dev, USB_DIR_IN | |
160 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
161 | REQ_02_GET_IR_CODE, 0, 0, buf, 1); | ||
159 | 162 | ||
160 | msleep(10); | 163 | msleep(10); |
161 | 164 | ||
162 | dprintk("read data=%02x\n", buf[0]); | 165 | dprintk("read data=%02x\n", buf[0]); |
163 | if (rc < 0) | 166 | if (rc < 0) |
164 | return rc; | 167 | return rc; |
165 | 168 | ||
166 | poll_result->rc_data[0] = buf[0]; | 169 | poll_result->rc_data = buf[0]; |
170 | } else { | ||
171 | rc = tm6000_read_write_usb(dev, USB_DIR_IN | | ||
172 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
173 | REQ_02_GET_IR_CODE, 0, 0, buf, 2); | ||
174 | |||
175 | msleep(10); | ||
176 | |||
177 | dprintk("read data=%04x\n", buf[0] | buf[1] << 8); | ||
178 | if (rc < 0) | ||
179 | return rc; | ||
180 | |||
181 | poll_result->rc_data = buf[0] | buf[1] << 8; | ||
182 | } | ||
183 | if ((poll_result->rc_data & 0x00ff) != 0xff) | ||
184 | ir->key = 1; | ||
167 | } | 185 | } |
168 | return 0; | 186 | return 0; |
169 | } | 187 | } |
@@ -180,12 +198,11 @@ static void tm6000_ir_handle_key(struct tm6000_IR *ir) | |||
180 | return; | 198 | return; |
181 | } | 199 | } |
182 | 200 | ||
183 | dprintk("ir->get_key result data=%02x %02x\n", | 201 | dprintk("ir->get_key result data=%04x\n", poll_result.rc_data); |
184 | poll_result.rc_data[0], poll_result.rc_data[1]); | ||
185 | 202 | ||
186 | if (poll_result.rc_data[0] != 0xff && ir->key == 1) { | 203 | if (ir->key) { |
187 | ir_input_keydown(ir->input->input_dev, &ir->ir, | 204 | ir_input_keydown(ir->input->input_dev, &ir->ir, |
188 | poll_result.rc_data[0] | poll_result.rc_data[1] << 8); | 205 | (u32)poll_result.rc_data); |
189 | 206 | ||
190 | ir_input_nokey(ir->input->input_dev, &ir->ir); | 207 | ir_input_nokey(ir->input->input_dev, &ir->ir); |
191 | ir->key = 0; | 208 | ir->key = 0; |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 418163894775..afef7b0a4195 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <mach/ohci.h> | 26 | #include <mach/ohci.h> |
27 | #include <mach/pxa3xx-u2d.h> | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * UHC: USB Host Controller (OHCI-like) register definitions | 30 | * UHC: USB Host Controller (OHCI-like) register definitions |
@@ -235,6 +236,9 @@ static int pxa27x_start_hc(struct pxa27x_ohci *ohci, struct device *dev) | |||
235 | if (retval < 0) | 236 | if (retval < 0) |
236 | return retval; | 237 | return retval; |
237 | 238 | ||
239 | if (cpu_is_pxa3xx()) | ||
240 | pxa3xx_u2d_start_hc(&ohci_to_hcd(&ohci->ohci)->self); | ||
241 | |||
238 | uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE; | 242 | uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE; |
239 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); | 243 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); |
240 | __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE); | 244 | __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE); |
@@ -251,6 +255,9 @@ static void pxa27x_stop_hc(struct pxa27x_ohci *ohci, struct device *dev) | |||
251 | 255 | ||
252 | inf = dev->platform_data; | 256 | inf = dev->platform_data; |
253 | 257 | ||
258 | if (cpu_is_pxa3xx()) | ||
259 | pxa3xx_u2d_stop_hc(&ohci_to_hcd(&ohci->ohci)->self); | ||
260 | |||
254 | if (inf->exit) | 261 | if (inf->exit) |
255 | inf->exit(dev); | 262 | inf->exit(dev); |
256 | 263 | ||
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c index a31a77ff6f3d..cea6403ae71c 100644 --- a/drivers/video/pxa168fb.c +++ b/drivers/video/pxa168fb.c | |||
@@ -784,12 +784,53 @@ failed: | |||
784 | return ret; | 784 | return ret; |
785 | } | 785 | } |
786 | 786 | ||
787 | static int __devexit pxa168fb_remove(struct platform_device *pdev) | ||
788 | { | ||
789 | struct pxa168fb_info *fbi = platform_get_drvdata(pdev); | ||
790 | struct fb_info *info; | ||
791 | int irq; | ||
792 | unsigned int data; | ||
793 | |||
794 | if (!fbi) | ||
795 | return 0; | ||
796 | |||
797 | /* disable DMA transfer */ | ||
798 | data = readl(fbi->reg_base + LCD_SPU_DMA_CTRL0); | ||
799 | data &= ~CFG_GRA_ENA_MASK; | ||
800 | writel(data, fbi->reg_base + LCD_SPU_DMA_CTRL0); | ||
801 | |||
802 | info = fbi->info; | ||
803 | |||
804 | unregister_framebuffer(info); | ||
805 | |||
806 | writel(GRA_FRAME_IRQ0_ENA(0x0), fbi->reg_base + SPU_IRQ_ENA); | ||
807 | |||
808 | if (info->cmap.len) | ||
809 | fb_dealloc_cmap(&info->cmap); | ||
810 | |||
811 | irq = platform_get_irq(pdev, 0); | ||
812 | free_irq(irq, fbi); | ||
813 | |||
814 | dma_free_writecombine(fbi->dev, PAGE_ALIGN(info->fix.smem_len), | ||
815 | info->screen_base, info->fix.smem_start); | ||
816 | |||
817 | iounmap(fbi->reg_base); | ||
818 | |||
819 | clk_disable(fbi->clk); | ||
820 | clk_put(fbi->clk); | ||
821 | |||
822 | framebuffer_release(info); | ||
823 | |||
824 | return 0; | ||
825 | } | ||
826 | |||
787 | static struct platform_driver pxa168fb_driver = { | 827 | static struct platform_driver pxa168fb_driver = { |
788 | .driver = { | 828 | .driver = { |
789 | .name = "pxa168-fb", | 829 | .name = "pxa168-fb", |
790 | .owner = THIS_MODULE, | 830 | .owner = THIS_MODULE, |
791 | }, | 831 | }, |
792 | .probe = pxa168fb_probe, | 832 | .probe = pxa168fb_probe, |
833 | .remove = __devexit_p(pxa168fb_remove), | ||
793 | }; | 834 | }; |
794 | 835 | ||
795 | static int __init pxa168fb_init(void) | 836 | static int __init pxa168fb_init(void) |
@@ -798,6 +839,12 @@ static int __init pxa168fb_init(void) | |||
798 | } | 839 | } |
799 | module_init(pxa168fb_init); | 840 | module_init(pxa168fb_init); |
800 | 841 | ||
842 | static void __exit pxa168fb_exit(void) | ||
843 | { | ||
844 | platform_driver_unregister(&pxa168fb_driver); | ||
845 | } | ||
846 | module_exit(pxa168fb_exit); | ||
847 | |||
801 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> " | 848 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> " |
802 | "Green Wan <gwan@marvell.com>"); | 849 | "Green Wan <gwan@marvell.com>"); |
803 | MODULE_DESCRIPTION("Framebuffer driver for PXA168/910"); | 850 | MODULE_DESCRIPTION("Framebuffer driver for PXA168/910"); |
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 29bac5118877..d409495876f1 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -755,7 +755,10 @@ int register_xenstore_notifier(struct notifier_block *nb) | |||
755 | { | 755 | { |
756 | int ret = 0; | 756 | int ret = 0; |
757 | 757 | ||
758 | blocking_notifier_chain_register(&xenstore_chain, nb); | 758 | if (xenstored_ready > 0) |
759 | ret = nb->notifier_call(nb, 0, NULL); | ||
760 | else | ||
761 | blocking_notifier_chain_register(&xenstore_chain, nb); | ||
759 | 762 | ||
760 | return ret; | 763 | return ret; |
761 | } | 764 | } |
@@ -769,7 +772,7 @@ EXPORT_SYMBOL_GPL(unregister_xenstore_notifier); | |||
769 | 772 | ||
770 | void xenbus_probe(struct work_struct *unused) | 773 | void xenbus_probe(struct work_struct *unused) |
771 | { | 774 | { |
772 | BUG_ON((xenstored_ready <= 0)); | 775 | xenstored_ready = 1; |
773 | 776 | ||
774 | /* Enumerate devices in xenstore and watch for changes. */ | 777 | /* Enumerate devices in xenstore and watch for changes. */ |
775 | xenbus_probe_devices(&xenbus_frontend); | 778 | xenbus_probe_devices(&xenbus_frontend); |
@@ -835,8 +838,8 @@ static int __init xenbus_init(void) | |||
835 | xen_store_evtchn = xen_start_info->store_evtchn; | 838 | xen_store_evtchn = xen_start_info->store_evtchn; |
836 | xen_store_mfn = xen_start_info->store_mfn; | 839 | xen_store_mfn = xen_start_info->store_mfn; |
837 | xen_store_interface = mfn_to_virt(xen_store_mfn); | 840 | xen_store_interface = mfn_to_virt(xen_store_mfn); |
841 | xenstored_ready = 1; | ||
838 | } | 842 | } |
839 | xenstored_ready = 1; | ||
840 | } | 843 | } |
841 | 844 | ||
842 | /* Initialize the interface to xenstore. */ | 845 | /* Initialize the interface to xenstore. */ |