diff options
Diffstat (limited to 'drivers')
656 files changed, 10756 insertions, 7208 deletions
diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c index 0a5f6b2114c5..d672cfe7ca59 100644 --- a/drivers/accessibility/braille/braille_console.c +++ b/drivers/accessibility/braille/braille_console.c | |||
| @@ -376,6 +376,8 @@ int braille_register_console(struct console *console, int index, | |||
| 376 | console->flags |= CON_ENABLED; | 376 | console->flags |= CON_ENABLED; |
| 377 | console->index = index; | 377 | console->index = index; |
| 378 | braille_co = console; | 378 | braille_co = console; |
| 379 | register_keyboard_notifier(&keyboard_notifier_block); | ||
| 380 | register_vt_notifier(&vt_notifier_block); | ||
| 379 | return 0; | 381 | return 0; |
| 380 | } | 382 | } |
| 381 | 383 | ||
| @@ -383,15 +385,8 @@ int braille_unregister_console(struct console *console) | |||
| 383 | { | 385 | { |
| 384 | if (braille_co != console) | 386 | if (braille_co != console) |
| 385 | return -EINVAL; | 387 | return -EINVAL; |
| 388 | unregister_keyboard_notifier(&keyboard_notifier_block); | ||
| 389 | unregister_vt_notifier(&vt_notifier_block); | ||
| 386 | braille_co = NULL; | 390 | braille_co = NULL; |
| 387 | return 0; | 391 | return 0; |
| 388 | } | 392 | } |
| 389 | |||
| 390 | static int __init braille_init(void) | ||
| 391 | { | ||
| 392 | register_keyboard_notifier(&keyboard_notifier_block); | ||
| 393 | register_vt_notifier(&vt_notifier_block); | ||
| 394 | return 0; | ||
| 395 | } | ||
| 396 | |||
| 397 | console_initcall(braille_init); | ||
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 1022e38994c2..0f2805899210 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
| @@ -496,7 +496,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
| 496 | arg = arg->common.next; | 496 | arg = arg->common.next; |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | ACPI_ERROR((AE_INFO, | 499 | ACPI_WARNING((AE_INFO, |
| 500 | "Package List length (%X) larger than NumElements count (%X), truncated\n", | 500 | "Package List length (%X) larger than NumElements count (%X), truncated\n", |
| 501 | i, element_count)); | 501 | i, element_count)); |
| 502 | } else if (i < element_count) { | 502 | } else if (i < element_count) { |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index bb7c51f712bd..7d2edf143f16 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
| @@ -563,9 +563,6 @@ EXPORT_SYMBOL_GPL(unregister_hotplug_dock_device); | |||
| 563 | */ | 563 | */ |
| 564 | static int handle_eject_request(struct dock_station *ds, u32 event) | 564 | static int handle_eject_request(struct dock_station *ds, u32 event) |
| 565 | { | 565 | { |
| 566 | if (!dock_present(ds)) | ||
| 567 | return -ENODEV; | ||
| 568 | |||
| 569 | if (dock_in_progress(ds)) | 566 | if (dock_in_progress(ds)) |
| 570 | return -EBUSY; | 567 | return -EBUSY; |
| 571 | 568 | ||
| @@ -573,8 +570,16 @@ static int handle_eject_request(struct dock_station *ds, u32 event) | |||
| 573 | * here we need to generate the undock | 570 | * here we need to generate the undock |
| 574 | * event prior to actually doing the undock | 571 | * event prior to actually doing the undock |
| 575 | * so that the device struct still exists. | 572 | * so that the device struct still exists. |
| 573 | * Also, even send the dock event if the | ||
| 574 | * device is not present anymore | ||
| 576 | */ | 575 | */ |
| 577 | dock_event(ds, event, UNDOCK_EVENT); | 576 | dock_event(ds, event, UNDOCK_EVENT); |
| 577 | |||
| 578 | if (!dock_present(ds)) { | ||
| 579 | complete_undock(ds); | ||
| 580 | return -ENODEV; | ||
| 581 | } | ||
| 582 | |||
| 578 | hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST); | 583 | hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST); |
| 579 | undock(ds); | 584 | undock(ds); |
| 580 | eject_dock(ds); | 585 | eject_dock(ds); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5622aee996b2..13593f9f2197 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -110,6 +110,31 @@ static struct acpi_ec { | |||
| 110 | u8 handlers_installed; | 110 | u8 handlers_installed; |
| 111 | } *boot_ec, *first_ec; | 111 | } *boot_ec, *first_ec; |
| 112 | 112 | ||
| 113 | /* | ||
| 114 | * Some Asus system have exchanged ECDT data/command IO addresses. | ||
| 115 | */ | ||
| 116 | static int print_ecdt_error(const struct dmi_system_id *id) | ||
| 117 | { | ||
| 118 | printk(KERN_NOTICE PREFIX "%s detected - " | ||
| 119 | "ECDT has exchanged control/data I/O address\n", | ||
| 120 | id->ident); | ||
| 121 | return 0; | ||
| 122 | } | ||
| 123 | |||
| 124 | static struct dmi_system_id __cpuinitdata ec_dmi_table[] = { | ||
| 125 | { | ||
| 126 | print_ecdt_error, "Asus L4R", { | ||
| 127 | DMI_MATCH(DMI_BIOS_VERSION, "1008.006"), | ||
| 128 | DMI_MATCH(DMI_PRODUCT_NAME, "L4R"), | ||
| 129 | DMI_MATCH(DMI_BOARD_NAME, "L4R") }, NULL}, | ||
| 130 | { | ||
| 131 | print_ecdt_error, "Asus M6R", { | ||
| 132 | DMI_MATCH(DMI_BIOS_VERSION, "0207"), | ||
| 133 | DMI_MATCH(DMI_PRODUCT_NAME, "M6R"), | ||
| 134 | DMI_MATCH(DMI_BOARD_NAME, "M6R") }, NULL}, | ||
| 135 | {}, | ||
| 136 | }; | ||
| 137 | |||
| 113 | /* -------------------------------------------------------------------------- | 138 | /* -------------------------------------------------------------------------- |
| 114 | Transaction Management | 139 | Transaction Management |
| 115 | -------------------------------------------------------------------------- */ | 140 | -------------------------------------------------------------------------- */ |
| @@ -196,6 +221,8 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) | |||
| 196 | return 0; | 221 | return 0; |
| 197 | msleep(1); | 222 | msleep(1); |
| 198 | } | 223 | } |
| 224 | if (acpi_ec_check_status(ec,event)) | ||
| 225 | return 0; | ||
| 199 | } | 226 | } |
| 200 | pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n", | 227 | pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n", |
| 201 | acpi_ec_read_status(ec), | 228 | acpi_ec_read_status(ec), |
| @@ -911,6 +938,15 @@ int __init acpi_ec_ecdt_probe(void) | |||
| 911 | pr_info(PREFIX "EC description table is found, configuring boot EC\n"); | 938 | pr_info(PREFIX "EC description table is found, configuring boot EC\n"); |
| 912 | boot_ec->command_addr = ecdt_ptr->control.address; | 939 | boot_ec->command_addr = ecdt_ptr->control.address; |
| 913 | boot_ec->data_addr = ecdt_ptr->data.address; | 940 | boot_ec->data_addr = ecdt_ptr->data.address; |
| 941 | if (dmi_check_system(ec_dmi_table)) { | ||
| 942 | /* | ||
| 943 | * If the board falls into ec_dmi_table, it means | ||
| 944 | * that ECDT table gives the incorrect command/status | ||
| 945 | * & data I/O address. Just fix it. | ||
| 946 | */ | ||
| 947 | boot_ec->data_addr = ecdt_ptr->control.address; | ||
| 948 | boot_ec->command_addr = ecdt_ptr->data.address; | ||
| 949 | } | ||
| 914 | boot_ec->gpe = ecdt_ptr->gpe; | 950 | boot_ec->gpe = ecdt_ptr->gpe; |
| 915 | boot_ec->handle = ACPI_ROOT_OBJECT; | 951 | boot_ec->handle = ACPI_ROOT_OBJECT; |
| 916 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); | 952 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 2a32c843cb4a..8892b9824fae 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
| @@ -479,5 +479,8 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
| 479 | 479 | ||
| 480 | acpi_tb_set_table_loaded_flag(table_index, FALSE); | 480 | acpi_tb_set_table_loaded_flag(table_index, FALSE); |
| 481 | 481 | ||
| 482 | /* Table unloaded, remove a reference to the ddb_handle object */ | ||
| 483 | |||
| 484 | acpi_ut_remove_reference(ddb_handle); | ||
| 482 | return_ACPI_STATUS(AE_OK); | 485 | return_ACPI_STATUS(AE_OK); |
| 483 | } | 486 | } |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 084109507c9f..8dd3336efd7e 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -165,8 +165,11 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
| 165 | "firmware_node"); | 165 | "firmware_node"); |
| 166 | ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | 166 | ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, |
| 167 | "physical_node"); | 167 | "physical_node"); |
| 168 | if (acpi_dev->wakeup.flags.valid) | 168 | if (acpi_dev->wakeup.flags.valid) { |
| 169 | device_set_wakeup_capable(dev, true); | 169 | device_set_wakeup_capable(dev, true); |
| 170 | device_set_wakeup_enable(dev, | ||
| 171 | acpi_dev->wakeup.state.enabled); | ||
| 172 | } | ||
| 170 | } | 173 | } |
| 171 | 174 | ||
| 172 | return 0; | 175 | return 0; |
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 549db42f16cf..bd5773878009 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
| @@ -56,13 +56,14 @@ ACPI_MODULE_NAME("nsnames") | |||
| 56 | * Size - Size of the pathname | 56 | * Size - Size of the pathname |
| 57 | * *name_buffer - Where to return the pathname | 57 | * *name_buffer - Where to return the pathname |
| 58 | * | 58 | * |
| 59 | * RETURN: Places the pathname into the name_buffer, in external format | 59 | * RETURN: Status |
| 60 | * Places the pathname into the name_buffer, in external format | ||
| 60 | * (name segments separated by path separators) | 61 | * (name segments separated by path separators) |
| 61 | * | 62 | * |
| 62 | * DESCRIPTION: Generate a full pathaname | 63 | * DESCRIPTION: Generate a full pathaname |
| 63 | * | 64 | * |
| 64 | ******************************************************************************/ | 65 | ******************************************************************************/ |
| 65 | void | 66 | acpi_status |
| 66 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | 67 | acpi_ns_build_external_path(struct acpi_namespace_node *node, |
| 67 | acpi_size size, char *name_buffer) | 68 | acpi_size size, char *name_buffer) |
| 68 | { | 69 | { |
| @@ -77,7 +78,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
| 77 | if (index < ACPI_NAME_SIZE) { | 78 | if (index < ACPI_NAME_SIZE) { |
| 78 | name_buffer[0] = AML_ROOT_PREFIX; | 79 | name_buffer[0] = AML_ROOT_PREFIX; |
| 79 | name_buffer[1] = 0; | 80 | name_buffer[1] = 0; |
| 80 | return; | 81 | return (AE_OK); |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | /* Store terminator byte, then build name backwards */ | 84 | /* Store terminator byte, then build name backwards */ |
| @@ -105,11 +106,13 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
| 105 | 106 | ||
| 106 | if (index != 0) { | 107 | if (index != 0) { |
| 107 | ACPI_ERROR((AE_INFO, | 108 | ACPI_ERROR((AE_INFO, |
| 108 | "Could not construct pathname; index=%X, size=%X, Path=%s", | 109 | "Could not construct external pathname; index=%X, size=%X, Path=%s", |
| 109 | (u32) index, (u32) size, &name_buffer[size])); | 110 | (u32) index, (u32) size, &name_buffer[size])); |
| 111 | |||
| 112 | return (AE_BAD_PARAMETER); | ||
| 110 | } | 113 | } |
| 111 | 114 | ||
| 112 | return; | 115 | return (AE_OK); |
| 113 | } | 116 | } |
| 114 | 117 | ||
| 115 | #ifdef ACPI_DEBUG_OUTPUT | 118 | #ifdef ACPI_DEBUG_OUTPUT |
| @@ -129,6 +132,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
| 129 | 132 | ||
| 130 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | 133 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) |
| 131 | { | 134 | { |
| 135 | acpi_status status; | ||
| 132 | char *name_buffer; | 136 | char *name_buffer; |
| 133 | acpi_size size; | 137 | acpi_size size; |
| 134 | 138 | ||
| @@ -138,8 +142,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
| 138 | 142 | ||
| 139 | size = acpi_ns_get_pathname_length(node); | 143 | size = acpi_ns_get_pathname_length(node); |
| 140 | if (!size) { | 144 | if (!size) { |
| 141 | ACPI_ERROR((AE_INFO, "Invalid node failure")); | 145 | return (NULL); |
| 142 | return_PTR(NULL); | ||
| 143 | } | 146 | } |
| 144 | 147 | ||
| 145 | /* Allocate a buffer to be returned to caller */ | 148 | /* Allocate a buffer to be returned to caller */ |
| @@ -152,7 +155,11 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
| 152 | 155 | ||
| 153 | /* Build the path in the allocated buffer */ | 156 | /* Build the path in the allocated buffer */ |
| 154 | 157 | ||
| 155 | acpi_ns_build_external_path(node, size, name_buffer); | 158 | status = acpi_ns_build_external_path(node, size, name_buffer); |
| 159 | if (ACPI_FAILURE(status)) { | ||
| 160 | return (NULL); | ||
| 161 | } | ||
| 162 | |||
| 156 | return_PTR(name_buffer); | 163 | return_PTR(name_buffer); |
| 157 | } | 164 | } |
| 158 | #endif | 165 | #endif |
| @@ -186,7 +193,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) | |||
| 186 | while (next_node && (next_node != acpi_gbl_root_node)) { | 193 | while (next_node && (next_node != acpi_gbl_root_node)) { |
| 187 | if (ACPI_GET_DESCRIPTOR_TYPE(next_node) != ACPI_DESC_TYPE_NAMED) { | 194 | if (ACPI_GET_DESCRIPTOR_TYPE(next_node) != ACPI_DESC_TYPE_NAMED) { |
| 188 | ACPI_ERROR((AE_INFO, | 195 | ACPI_ERROR((AE_INFO, |
| 189 | "Invalid NS Node (%p) while traversing path", | 196 | "Invalid Namespace Node (%p) while traversing namespace", |
| 190 | next_node)); | 197 | next_node)); |
| 191 | return 0; | 198 | return 0; |
| 192 | } | 199 | } |
| @@ -234,8 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
| 234 | 241 | ||
| 235 | required_size = acpi_ns_get_pathname_length(node); | 242 | required_size = acpi_ns_get_pathname_length(node); |
| 236 | if (!required_size) { | 243 | if (!required_size) { |
| 237 | ACPI_ERROR((AE_INFO, "Invalid node failure")); | 244 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 238 | return_ACPI_STATUS(AE_ERROR); | ||
| 239 | } | 245 | } |
| 240 | 246 | ||
| 241 | /* Validate/Allocate/Clear caller buffer */ | 247 | /* Validate/Allocate/Clear caller buffer */ |
| @@ -247,7 +253,11 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
| 247 | 253 | ||
| 248 | /* Build the path in the caller buffer */ | 254 | /* Build the path in the caller buffer */ |
| 249 | 255 | ||
| 250 | acpi_ns_build_external_path(node, required_size, buffer->pointer); | 256 | status = |
| 257 | acpi_ns_build_external_path(node, required_size, buffer->pointer); | ||
| 258 | if (ACPI_FAILURE(status)) { | ||
| 259 | return_ACPI_STATUS(status); | ||
| 260 | } | ||
| 251 | 261 | ||
| 252 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n", | 262 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n", |
| 253 | (char *)buffer->pointer, (u32) required_size)); | 263 | (char *)buffer->pointer, (u32) required_size)); |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 89f3b2abfdc7..cf47805a7448 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -849,7 +849,7 @@ static int __init acpi_irq_penalty_update(char *str, int used) | |||
| 849 | if (irq < 0) | 849 | if (irq < 0) |
| 850 | continue; | 850 | continue; |
| 851 | 851 | ||
| 852 | if (irq >= ACPI_MAX_IRQS) | 852 | if (irq >= ARRAY_SIZE(acpi_irq_penalty)) |
| 853 | continue; | 853 | continue; |
| 854 | 854 | ||
| 855 | if (used) | 855 | if (used) |
| @@ -872,10 +872,12 @@ static int __init acpi_irq_penalty_update(char *str, int used) | |||
| 872 | */ | 872 | */ |
| 873 | void acpi_penalize_isa_irq(int irq, int active) | 873 | void acpi_penalize_isa_irq(int irq, int active) |
| 874 | { | 874 | { |
| 875 | if (active) | 875 | if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) { |
| 876 | acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; | 876 | if (active) |
| 877 | else | 877 | acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; |
| 878 | acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; | 878 | else |
| 879 | acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; | ||
| 880 | } | ||
| 879 | } | 881 | } |
| 880 | 882 | ||
| 881 | /* | 883 | /* |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index e36422a7122c..ee68ac54c0d4 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -123,7 +123,7 @@ struct acpi_processor_errata errata __read_mostly; | |||
| 123 | static int set_no_mwait(const struct dmi_system_id *id) | 123 | static int set_no_mwait(const struct dmi_system_id *id) |
| 124 | { | 124 | { |
| 125 | printk(KERN_NOTICE PREFIX "%s detected - " | 125 | printk(KERN_NOTICE PREFIX "%s detected - " |
| 126 | "disable mwait for CPU C-stetes\n", id->ident); | 126 | "disabling mwait for CPU C-states\n", id->ident); |
| 127 | idle_nomwait = 1; | 127 | idle_nomwait = 1; |
| 128 | return 0; | 128 | return 0; |
| 129 | } | 129 | } |
| @@ -138,7 +138,7 @@ static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { | |||
| 138 | { | 138 | { |
| 139 | set_no_mwait, "Extensa 5220", { | 139 | set_no_mwait, "Extensa 5220", { |
| 140 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), | 140 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), |
| 141 | DMI_MATCH(DMI_SYS_VENDOR, "ACER"), | 141 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 142 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), | 142 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), |
| 143 | DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, | 143 | DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, |
| 144 | {}, | 144 | {}, |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 283c08f5f4d4..cf5b1b7b684f 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | #include <linux/pm_qos_params.h> | 41 | #include <linux/pm_qos_params.h> |
| 42 | #include <linux/clockchips.h> | 42 | #include <linux/clockchips.h> |
| 43 | #include <linux/cpuidle.h> | 43 | #include <linux/cpuidle.h> |
| 44 | #include <linux/cpuidle.h> | ||
| 45 | 44 | ||
| 46 | /* | 45 | /* |
| 47 | * Include the apic definitions for x86 to have the APIC timer related defines | 46 | * Include the apic definitions for x86 to have the APIC timer related defines |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 0133af49cf06..80c251ec6d2a 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
| @@ -70,8 +70,8 @@ static DEFINE_MUTEX(performance_mutex); | |||
| 70 | * 0 -> cpufreq low level drivers initialized -> consider _PPC values | 70 | * 0 -> cpufreq low level drivers initialized -> consider _PPC values |
| 71 | * 1 -> ignore _PPC totally -> forced by user through boot param | 71 | * 1 -> ignore _PPC totally -> forced by user through boot param |
| 72 | */ | 72 | */ |
| 73 | static unsigned int ignore_ppc = -1; | 73 | static int ignore_ppc = -1; |
| 74 | module_param(ignore_ppc, uint, 0644); | 74 | module_param(ignore_ppc, int, 0644); |
| 75 | MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \ | 75 | MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \ |
| 76 | "limited by BIOS, this should help"); | 76 | "limited by BIOS, this should help"); |
| 77 | 77 | ||
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index f61ebc679e66..d9063ea414e3 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
| @@ -587,6 +587,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
| 587 | } else { | 587 | } else { |
| 588 | temp_size_needed += | 588 | temp_size_needed += |
| 589 | acpi_ns_get_pathname_length((*sub_object_list)->reference.node); | 589 | acpi_ns_get_pathname_length((*sub_object_list)->reference.node); |
| 590 | if (!temp_size_needed) { | ||
| 591 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 592 | } | ||
| 590 | } | 593 | } |
| 591 | } else { | 594 | } else { |
| 592 | /* | 595 | /* |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index bcf2c70fca87..a4e3767b8c64 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
| @@ -107,6 +107,13 @@ static int wait_transaction_complete(struct acpi_smb_hc *hc, int timeout) | |||
| 107 | if (wait_event_timeout(hc->wait, smb_check_done(hc), | 107 | if (wait_event_timeout(hc->wait, smb_check_done(hc), |
| 108 | msecs_to_jiffies(timeout))) | 108 | msecs_to_jiffies(timeout))) |
| 109 | return 0; | 109 | return 0; |
| 110 | /* | ||
| 111 | * After the timeout happens, OS will try to check the status of SMbus. | ||
| 112 | * If the status is what OS expected, it will be regarded as the bogus | ||
| 113 | * timeout. | ||
| 114 | */ | ||
| 115 | if (smb_check_done(hc)) | ||
| 116 | return 0; | ||
| 110 | else | 117 | else |
| 111 | return -ETIME; | 118 | return -ETIME; |
| 112 | } | 119 | } |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index 4ebbba2b6b19..bf5b04de02d1 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
| @@ -377,6 +377,14 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
| 377 | return 0; | 377 | return 0; |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | static void physical_device_enable_wakeup(struct acpi_device *adev) | ||
| 381 | { | ||
| 382 | struct device *dev = acpi_get_physical_device(adev->handle); | ||
| 383 | |||
| 384 | if (dev && device_can_wakeup(dev)) | ||
| 385 | device_set_wakeup_enable(dev, adev->wakeup.state.enabled); | ||
| 386 | } | ||
| 387 | |||
| 380 | static ssize_t | 388 | static ssize_t |
| 381 | acpi_system_write_wakeup_device(struct file *file, | 389 | acpi_system_write_wakeup_device(struct file *file, |
| 382 | const char __user * buffer, | 390 | const char __user * buffer, |
| @@ -411,6 +419,7 @@ acpi_system_write_wakeup_device(struct file *file, | |||
| 411 | } | 419 | } |
| 412 | } | 420 | } |
| 413 | if (found_dev) { | 421 | if (found_dev) { |
| 422 | physical_device_enable_wakeup(found_dev); | ||
| 414 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 423 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
| 415 | struct acpi_device *dev = container_of(node, | 424 | struct acpi_device *dev = container_of(node, |
| 416 | struct | 425 | struct |
| @@ -428,6 +437,7 @@ acpi_system_write_wakeup_device(struct file *file, | |||
| 428 | dev->pnp.bus_id, found_dev->pnp.bus_id); | 437 | dev->pnp.bus_id, found_dev->pnp.bus_id); |
| 429 | dev->wakeup.state.enabled = | 438 | dev->wakeup.state.enabled = |
| 430 | found_dev->wakeup.state.enabled; | 439 | found_dev->wakeup.state.enabled; |
| 440 | physical_device_enable_wakeup(dev); | ||
| 431 | } | 441 | } |
| 432 | } | 442 | } |
| 433 | } | 443 | } |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index c3419182c9a7..775c97a282bd 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
| @@ -300,6 +300,8 @@ int __init acpi_table_init(void) | |||
| 300 | 300 | ||
| 301 | static int __init acpi_parse_apic_instance(char *str) | 301 | static int __init acpi_parse_apic_instance(char *str) |
| 302 | { | 302 | { |
| 303 | if (!str) | ||
| 304 | return -EINVAL; | ||
| 303 | 305 | ||
| 304 | acpi_apic_instance = simple_strtoul(str, NULL, 0); | 306 | acpi_apic_instance = simple_strtoul(str, NULL, 0); |
| 305 | 307 | ||
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index e7bf34a7b1d2..7dcb67e0b215 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
| @@ -242,10 +242,12 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
| 242 | { | 242 | { |
| 243 | acpi_status status = AE_OK; | 243 | acpi_status status = AE_OK; |
| 244 | 244 | ||
| 245 | if (!required_length) { | 245 | /* Parameter validation */ |
| 246 | WARN_ON(1); | 246 | |
| 247 | return AE_ERROR; | 247 | if (!buffer || !required_length) { |
| 248 | return (AE_BAD_PARAMETER); | ||
| 248 | } | 249 | } |
| 250 | |||
| 249 | switch (buffer->length) { | 251 | switch (buffer->length) { |
| 250 | case ACPI_NO_BUFFER: | 252 | case ACPI_NO_BUFFER: |
| 251 | 253 | ||
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index c5c791a575c9..42609d3a8aa9 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
| @@ -135,6 +135,10 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
| 135 | obj_pointer = object->package.elements; | 135 | obj_pointer = object->package.elements; |
| 136 | break; | 136 | break; |
| 137 | 137 | ||
| 138 | /* | ||
| 139 | * These objects have a possible list of notify handlers. | ||
| 140 | * Device object also may have a GPE block. | ||
| 141 | */ | ||
| 138 | case ACPI_TYPE_DEVICE: | 142 | case ACPI_TYPE_DEVICE: |
| 139 | 143 | ||
| 140 | if (object->device.gpe_block) { | 144 | if (object->device.gpe_block) { |
| @@ -142,9 +146,14 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
| 142 | gpe_block); | 146 | gpe_block); |
| 143 | } | 147 | } |
| 144 | 148 | ||
| 145 | /* Walk the handler list for this device */ | 149 | /*lint -fallthrough */ |
| 150 | |||
| 151 | case ACPI_TYPE_PROCESSOR: | ||
| 152 | case ACPI_TYPE_THERMAL: | ||
| 153 | |||
| 154 | /* Walk the notify handler list for this object */ | ||
| 146 | 155 | ||
| 147 | handler_desc = object->device.handler; | 156 | handler_desc = object->common_notify.handler; |
| 148 | while (handler_desc) { | 157 | while (handler_desc) { |
| 149 | next_desc = handler_desc->address_space.next; | 158 | next_desc = handler_desc->address_space.next; |
| 150 | acpi_ut_remove_reference(handler_desc); | 159 | acpi_ut_remove_reference(handler_desc); |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index e25484495e65..916eff399eb3 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
| @@ -425,6 +425,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
| 425 | acpi_size * obj_length) | 425 | acpi_size * obj_length) |
| 426 | { | 426 | { |
| 427 | acpi_size length; | 427 | acpi_size length; |
| 428 | acpi_size size; | ||
| 428 | acpi_status status = AE_OK; | 429 | acpi_status status = AE_OK; |
| 429 | 430 | ||
| 430 | ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); | 431 | ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); |
| @@ -484,10 +485,14 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
| 484 | * Get the actual length of the full pathname to this object. | 485 | * Get the actual length of the full pathname to this object. |
| 485 | * The reference will be converted to the pathname to the object | 486 | * The reference will be converted to the pathname to the object |
| 486 | */ | 487 | */ |
| 487 | length += | 488 | size = |
| 488 | ACPI_ROUND_UP_TO_NATIVE_WORD | 489 | acpi_ns_get_pathname_length(internal_object-> |
| 489 | (acpi_ns_get_pathname_length | 490 | reference.node); |
| 490 | (internal_object->reference.node)); | 491 | if (!size) { |
| 492 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 493 | } | ||
| 494 | |||
| 495 | length += ACPI_ROUND_UP_TO_NATIVE_WORD(size); | ||
| 491 | break; | 496 | break; |
| 492 | 497 | ||
| 493 | default: | 498 | default: |
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c index c33b1c6e93b1..cfe2c833474d 100644 --- a/drivers/acpi/wmi.c +++ b/drivers/acpi/wmi.c | |||
| @@ -347,7 +347,7 @@ struct acpi_buffer *out) | |||
| 347 | strcpy(method, "WQ"); | 347 | strcpy(method, "WQ"); |
| 348 | strncat(method, block->object_id, 2); | 348 | strncat(method, block->object_id, 2); |
| 349 | 349 | ||
| 350 | status = acpi_evaluate_object(handle, method, NULL, out); | 350 | status = acpi_evaluate_object(handle, method, &input, out); |
| 351 | 351 | ||
| 352 | /* | 352 | /* |
| 353 | * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if | 353 | * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index ae8494944c45..11c8c19f0fb7 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
| @@ -448,8 +448,10 @@ config PATA_MARVELL | |||
| 448 | tristate "Marvell PATA support via legacy mode" | 448 | tristate "Marvell PATA support via legacy mode" |
| 449 | depends on PCI | 449 | depends on PCI |
| 450 | help | 450 | help |
| 451 | This option enables limited support for the Marvell 88SE6145 ATA | 451 | This option enables limited support for the Marvell 88SE61xx ATA |
| 452 | controller. | 452 | controllers. If you wish to use only the SATA ports then select |
| 453 | the AHCI driver alone. If you wish to the use the PATA port or | ||
| 454 | both SATA and PATA include this driver. | ||
| 453 | 455 | ||
| 454 | If unsure, say N. | 456 | If unsure, say N. |
| 455 | 457 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index ef3e5522e1a4..2e1a7cb2ed5f 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -420,7 +420,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
| 420 | /* board_ahci_mv */ | 420 | /* board_ahci_mv */ |
| 421 | { | 421 | { |
| 422 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ | AHCI_HFLAG_NO_MSI | | 422 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ | AHCI_HFLAG_NO_MSI | |
| 423 | AHCI_HFLAG_MV_PATA), | 423 | AHCI_HFLAG_MV_PATA | AHCI_HFLAG_NO_PMP), |
| 424 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 424 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
| 425 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA, | 425 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA, |
| 426 | .pio_mask = 0x1f, /* pio0-4 */ | 426 | .pio_mask = 0x1f, /* pio0-4 */ |
| @@ -486,6 +486,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 486 | { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ | 486 | { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ |
| 487 | { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ | 487 | { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ |
| 488 | { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ | 488 | { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ |
| 489 | { PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */ | ||
| 490 | { PCI_VDEVICE(INTEL, 0x3b25), board_ahci }, /* PCH RAID */ | ||
| 491 | { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ | ||
| 492 | { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ | ||
| 489 | 493 | ||
| 490 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 494 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
| 491 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 495 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| @@ -575,9 +579,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 575 | { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ | 579 | { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ |
| 576 | 580 | ||
| 577 | /* SiS */ | 581 | /* SiS */ |
| 578 | { PCI_VDEVICE(SI, 0x1184), board_ahci_nopmp }, /* SiS 966 */ | 582 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ |
| 579 | { PCI_VDEVICE(SI, 0x1185), board_ahci_nopmp }, /* SiS 968 */ | 583 | { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 968 */ |
| 580 | { PCI_VDEVICE(SI, 0x0186), board_ahci_nopmp }, /* SiS 968 */ | 584 | { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */ |
| 581 | 585 | ||
| 582 | /* Marvell */ | 586 | /* Marvell */ |
| 583 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 587 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
| @@ -608,6 +612,15 @@ module_param(ahci_em_messages, int, 0444); | |||
| 608 | MODULE_PARM_DESC(ahci_em_messages, | 612 | MODULE_PARM_DESC(ahci_em_messages, |
| 609 | "Set AHCI Enclosure Management Message type (0 = disabled, 1 = LED"); | 613 | "Set AHCI Enclosure Management Message type (0 = disabled, 1 = LED"); |
| 610 | 614 | ||
| 615 | #if defined(CONFIG_PATA_MARVELL) || defined(CONFIG_PATA_MARVELL_MODULE) | ||
| 616 | static int marvell_enable; | ||
| 617 | #else | ||
| 618 | static int marvell_enable = 1; | ||
| 619 | #endif | ||
| 620 | module_param(marvell_enable, int, 0644); | ||
| 621 | MODULE_PARM_DESC(marvell_enable, "Marvell SATA via AHCI (1 = enabled)"); | ||
| 622 | |||
| 623 | |||
| 611 | static inline int ahci_nr_ports(u32 cap) | 624 | static inline int ahci_nr_ports(u32 cap) |
| 612 | { | 625 | { |
| 613 | return (cap & 0x1f) + 1; | 626 | return (cap & 0x1f) + 1; |
| @@ -730,6 +743,8 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
| 730 | "MV_AHCI HACK: port_map %x -> %x\n", | 743 | "MV_AHCI HACK: port_map %x -> %x\n", |
| 731 | port_map, | 744 | port_map, |
| 732 | port_map & mv); | 745 | port_map & mv); |
| 746 | dev_printk(KERN_ERR, &pdev->dev, | ||
| 747 | "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n"); | ||
| 733 | 748 | ||
| 734 | port_map &= mv; | 749 | port_map &= mv; |
| 735 | } | 750 | } |
| @@ -2531,6 +2546,12 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2531 | if (!printed_version++) | 2546 | if (!printed_version++) |
| 2532 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); | 2547 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
| 2533 | 2548 | ||
| 2549 | /* The AHCI driver can only drive the SATA ports, the PATA driver | ||
| 2550 | can drive them all so if both drivers are selected make sure | ||
| 2551 | AHCI stays out of the way */ | ||
| 2552 | if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable) | ||
| 2553 | return -ENODEV; | ||
| 2554 | |||
| 2534 | /* acquire resources */ | 2555 | /* acquire resources */ |
| 2535 | rc = pcim_enable_device(pdev); | 2556 | rc = pcim_enable_device(pdev); |
| 2536 | if (rc) | 2557 | if (rc) |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index c294121fd69e..e6b4606e36b6 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
| @@ -275,6 +275,14 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
| 275 | { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 275 | { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
| 276 | /* SATA Controller IDE (ICH10) */ | 276 | /* SATA Controller IDE (ICH10) */ |
| 277 | { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 277 | { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
| 278 | /* SATA Controller IDE (PCH) */ | ||
| 279 | { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
| 280 | /* SATA Controller IDE (PCH) */ | ||
| 281 | { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
| 282 | /* SATA Controller IDE (PCH) */ | ||
| 283 | { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
| 284 | /* SATA Controller IDE (PCH) */ | ||
| 285 | { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
| 278 | 286 | ||
| 279 | { } /* terminate list */ | 287 | { } /* terminate list */ |
| 280 | }; | 288 | }; |
| @@ -1491,7 +1499,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
| 1491 | * off. | 1499 | * off. |
| 1492 | */ | 1500 | */ |
| 1493 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2652) { | 1501 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2652) { |
| 1494 | int rc = piix_disable_ahci(pdev); | 1502 | rc = piix_disable_ahci(pdev); |
| 1495 | if (rc) | 1503 | if (rc) |
| 1496 | return rc; | 1504 | return rc; |
| 1497 | } | 1505 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 5ba96c5052c8..79e3a8e7a84a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -104,6 +104,7 @@ struct ata_force_param { | |||
| 104 | unsigned long xfer_mask; | 104 | unsigned long xfer_mask; |
| 105 | unsigned int horkage_on; | 105 | unsigned int horkage_on; |
| 106 | unsigned int horkage_off; | 106 | unsigned int horkage_off; |
| 107 | unsigned int lflags; | ||
| 107 | }; | 108 | }; |
| 108 | 109 | ||
| 109 | struct ata_force_ent { | 110 | struct ata_force_ent { |
| @@ -196,22 +197,23 @@ void ata_force_cbl(struct ata_port *ap) | |||
| 196 | } | 197 | } |
| 197 | 198 | ||
| 198 | /** | 199 | /** |
| 199 | * ata_force_spd_limit - force SATA spd limit according to libata.force | 200 | * ata_force_link_limits - force link limits according to libata.force |
| 200 | * @link: ATA link of interest | 201 | * @link: ATA link of interest |
| 201 | * | 202 | * |
| 202 | * Force SATA spd limit according to libata.force and whine about | 203 | * Force link flags and SATA spd limit according to libata.force |
| 203 | * it. When only the port part is specified (e.g. 1:), the limit | 204 | * and whine about it. When only the port part is specified |
| 204 | * applies to all links connected to both the host link and all | 205 | * (e.g. 1:), the limit applies to all links connected to both |
| 205 | * fan-out ports connected via PMP. If the device part is | 206 | * the host link and all fan-out ports connected via PMP. If the |
| 206 | * specified as 0 (e.g. 1.00:), it specifies the first fan-out | 207 | * device part is specified as 0 (e.g. 1.00:), it specifies the |
| 207 | * link not the host link. Device number 15 always points to the | 208 | * first fan-out link not the host link. Device number 15 always |
| 208 | * host link whether PMP is attached or not. | 209 | * points to the host link whether PMP is attached or not. |
| 209 | * | 210 | * |
| 210 | * LOCKING: | 211 | * LOCKING: |
| 211 | * EH context. | 212 | * EH context. |
| 212 | */ | 213 | */ |
| 213 | static void ata_force_spd_limit(struct ata_link *link) | 214 | static void ata_force_link_limits(struct ata_link *link) |
| 214 | { | 215 | { |
| 216 | bool did_spd = false; | ||
| 215 | int linkno, i; | 217 | int linkno, i; |
| 216 | 218 | ||
| 217 | if (ata_is_host_link(link)) | 219 | if (ata_is_host_link(link)) |
| @@ -228,13 +230,22 @@ static void ata_force_spd_limit(struct ata_link *link) | |||
| 228 | if (fe->device != -1 && fe->device != linkno) | 230 | if (fe->device != -1 && fe->device != linkno) |
| 229 | continue; | 231 | continue; |
| 230 | 232 | ||
| 231 | if (!fe->param.spd_limit) | 233 | /* only honor the first spd limit */ |
| 232 | continue; | 234 | if (!did_spd && fe->param.spd_limit) { |
| 235 | link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; | ||
| 236 | ata_link_printk(link, KERN_NOTICE, | ||
| 237 | "FORCE: PHY spd limit set to %s\n", | ||
| 238 | fe->param.name); | ||
| 239 | did_spd = true; | ||
| 240 | } | ||
| 233 | 241 | ||
| 234 | link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; | 242 | /* let lflags stack */ |
| 235 | ata_link_printk(link, KERN_NOTICE, | 243 | if (fe->param.lflags) { |
| 236 | "FORCE: PHY spd limit set to %s\n", fe->param.name); | 244 | link->flags |= fe->param.lflags; |
| 237 | return; | 245 | ata_link_printk(link, KERN_NOTICE, |
| 246 | "FORCE: link flag 0x%x forced -> 0x%x\n", | ||
| 247 | fe->param.lflags, link->flags); | ||
| 248 | } | ||
| 238 | } | 249 | } |
| 239 | } | 250 | } |
| 240 | 251 | ||
| @@ -3277,7 +3288,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
| 3277 | dev->dma_mode = ata_xfer_mask2mode(dma_mask); | 3288 | dev->dma_mode = ata_xfer_mask2mode(dma_mask); |
| 3278 | 3289 | ||
| 3279 | found = 1; | 3290 | found = 1; |
| 3280 | if (dev->dma_mode != 0xff) | 3291 | if (ata_dma_enabled(dev)) |
| 3281 | used_dma = 1; | 3292 | used_dma = 1; |
| 3282 | } | 3293 | } |
| 3283 | if (!found) | 3294 | if (!found) |
| @@ -3302,7 +3313,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
| 3302 | 3313 | ||
| 3303 | /* step 3: set host DMA timings */ | 3314 | /* step 3: set host DMA timings */ |
| 3304 | ata_link_for_each_dev(dev, link) { | 3315 | ata_link_for_each_dev(dev, link) { |
| 3305 | if (!ata_dev_enabled(dev) || dev->dma_mode == 0xff) | 3316 | if (!ata_dev_enabled(dev) || !ata_dma_enabled(dev)) |
| 3306 | continue; | 3317 | continue; |
| 3307 | 3318 | ||
| 3308 | dev->xfer_mode = dev->dma_mode; | 3319 | dev->xfer_mode = dev->dma_mode; |
| @@ -5188,19 +5199,18 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp) | |||
| 5188 | */ | 5199 | */ |
| 5189 | int sata_link_init_spd(struct ata_link *link) | 5200 | int sata_link_init_spd(struct ata_link *link) |
| 5190 | { | 5201 | { |
| 5191 | u32 scontrol; | ||
| 5192 | u8 spd; | 5202 | u8 spd; |
| 5193 | int rc; | 5203 | int rc; |
| 5194 | 5204 | ||
| 5195 | rc = sata_scr_read(link, SCR_CONTROL, &scontrol); | 5205 | rc = sata_scr_read(link, SCR_CONTROL, &link->saved_scontrol); |
| 5196 | if (rc) | 5206 | if (rc) |
| 5197 | return rc; | 5207 | return rc; |
| 5198 | 5208 | ||
| 5199 | spd = (scontrol >> 4) & 0xf; | 5209 | spd = (link->saved_scontrol >> 4) & 0xf; |
| 5200 | if (spd) | 5210 | if (spd) |
| 5201 | link->hw_sata_spd_limit &= (1 << spd) - 1; | 5211 | link->hw_sata_spd_limit &= (1 << spd) - 1; |
| 5202 | 5212 | ||
| 5203 | ata_force_spd_limit(link); | 5213 | ata_force_link_limits(link); |
| 5204 | 5214 | ||
| 5205 | link->sata_spd_limit = link->hw_sata_spd_limit; | 5215 | link->sata_spd_limit = link->hw_sata_spd_limit; |
| 5206 | 5216 | ||
| @@ -5783,9 +5793,10 @@ static void ata_port_detach(struct ata_port *ap) | |||
| 5783 | ata_port_wait_eh(ap); | 5793 | ata_port_wait_eh(ap); |
| 5784 | 5794 | ||
| 5785 | /* EH is now guaranteed to see UNLOADING - EH context belongs | 5795 | /* EH is now guaranteed to see UNLOADING - EH context belongs |
| 5786 | * to us. Disable all existing devices. | 5796 | * to us. Restore SControl and disable all existing devices. |
| 5787 | */ | 5797 | */ |
| 5788 | ata_port_for_each_link(link, ap) { | 5798 | __ata_port_for_each_link(link, ap) { |
| 5799 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol); | ||
| 5789 | ata_link_for_each_dev(dev, link) | 5800 | ata_link_for_each_dev(dev, link) |
| 5790 | ata_dev_disable(dev); | 5801 | ata_dev_disable(dev); |
| 5791 | } | 5802 | } |
| @@ -5991,6 +6002,9 @@ static int __init ata_parse_force_one(char **cur, | |||
| 5991 | { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, | 6002 | { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, |
| 5992 | { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, | 6003 | { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, |
| 5993 | { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, | 6004 | { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, |
| 6005 | { "nohrst", .lflags = ATA_LFLAG_NO_HRST }, | ||
| 6006 | { "nosrst", .lflags = ATA_LFLAG_NO_SRST }, | ||
| 6007 | { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST }, | ||
| 5994 | }; | 6008 | }; |
| 5995 | char *start = *cur, *p = *cur; | 6009 | char *start = *cur, *p = *cur; |
| 5996 | char *id, *val, *endp; | 6010 | char *id, *val, *endp; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 58bdc538d229..c1db2f234d2e 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -2040,7 +2040,7 @@ static void ata_eh_link_report(struct ata_link *link) | |||
| 2040 | } | 2040 | } |
| 2041 | 2041 | ||
| 2042 | if (ehc->i.serror) | 2042 | if (ehc->i.serror) |
| 2043 | ata_port_printk(ap, KERN_ERR, | 2043 | ata_link_printk(link, KERN_ERR, |
| 2044 | "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", | 2044 | "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", |
| 2045 | ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", | 2045 | ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", |
| 2046 | ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", | 2046 | ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", |
| @@ -2171,18 +2171,12 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | |||
| 2171 | } | 2171 | } |
| 2172 | 2172 | ||
| 2173 | static int ata_eh_followup_srst_needed(struct ata_link *link, | 2173 | static int ata_eh_followup_srst_needed(struct ata_link *link, |
| 2174 | int rc, int classify, | 2174 | int rc, const unsigned int *classes) |
| 2175 | const unsigned int *classes) | ||
| 2176 | { | 2175 | { |
| 2177 | if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) | 2176 | if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) |
| 2178 | return 0; | 2177 | return 0; |
| 2179 | if (rc == -EAGAIN) { | 2178 | if (rc == -EAGAIN) |
| 2180 | if (classify) | 2179 | return 1; |
| 2181 | return 1; | ||
| 2182 | rc = 0; | ||
| 2183 | } | ||
| 2184 | if (rc != 0) | ||
| 2185 | return 0; | ||
| 2186 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) | 2180 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) |
| 2187 | return 1; | 2181 | return 1; |
| 2188 | return 0; | 2182 | return 0; |
| @@ -2210,6 +2204,10 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
| 2210 | */ | 2204 | */ |
| 2211 | while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) | 2205 | while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) |
| 2212 | max_tries++; | 2206 | max_tries++; |
| 2207 | if (link->flags & ATA_LFLAG_NO_HRST) | ||
| 2208 | hardreset = NULL; | ||
| 2209 | if (link->flags & ATA_LFLAG_NO_SRST) | ||
| 2210 | softreset = NULL; | ||
| 2213 | 2211 | ||
| 2214 | now = jiffies; | 2212 | now = jiffies; |
| 2215 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); | 2213 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); |
| @@ -2247,10 +2245,10 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
| 2247 | ehc->i.action &= ~ATA_EH_RESET; | 2245 | ehc->i.action &= ~ATA_EH_RESET; |
| 2248 | if (hardreset) { | 2246 | if (hardreset) { |
| 2249 | reset = hardreset; | 2247 | reset = hardreset; |
| 2250 | ehc->i.action = ATA_EH_HARDRESET; | 2248 | ehc->i.action |= ATA_EH_HARDRESET; |
| 2251 | } else if (softreset) { | 2249 | } else if (softreset) { |
| 2252 | reset = softreset; | 2250 | reset = softreset; |
| 2253 | ehc->i.action = ATA_EH_SOFTRESET; | 2251 | ehc->i.action |= ATA_EH_SOFTRESET; |
| 2254 | } | 2252 | } |
| 2255 | 2253 | ||
| 2256 | if (prereset) { | 2254 | if (prereset) { |
| @@ -2305,9 +2303,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
| 2305 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; | 2303 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; |
| 2306 | 2304 | ||
| 2307 | rc = ata_do_reset(link, reset, classes, deadline); | 2305 | rc = ata_do_reset(link, reset, classes, deadline); |
| 2306 | if (rc && rc != -EAGAIN) | ||
| 2307 | goto fail; | ||
| 2308 | 2308 | ||
| 2309 | if (reset == hardreset && | 2309 | if (reset == hardreset && |
| 2310 | ata_eh_followup_srst_needed(link, rc, classify, classes)) { | 2310 | ata_eh_followup_srst_needed(link, rc, classes)) { |
| 2311 | /* okay, let's do follow-up softreset */ | 2311 | /* okay, let's do follow-up softreset */ |
| 2312 | reset = softreset; | 2312 | reset = softreset; |
| 2313 | 2313 | ||
| @@ -2322,10 +2322,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
| 2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
| 2323 | rc = ata_do_reset(link, reset, classes, deadline); | 2323 | rc = ata_do_reset(link, reset, classes, deadline); |
| 2324 | } | 2324 | } |
| 2325 | |||
| 2326 | /* -EAGAIN can happen if we skipped followup SRST */ | ||
| 2327 | if (rc && rc != -EAGAIN) | ||
| 2328 | goto fail; | ||
| 2329 | } else { | 2325 | } else { |
| 2330 | if (verbose) | 2326 | if (verbose) |
| 2331 | ata_link_printk(link, KERN_INFO, "no reset method " | 2327 | ata_link_printk(link, KERN_INFO, "no reset method " |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 304fdc6f1dc2..2a4c516894f0 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
| @@ -1315,11 +1315,6 @@ fsm_start: | |||
| 1315 | break; | 1315 | break; |
| 1316 | 1316 | ||
| 1317 | case HSM_ST_ERR: | 1317 | case HSM_ST_ERR: |
| 1318 | /* make sure qc->err_mask is available to | ||
| 1319 | * know what's wrong and recover | ||
| 1320 | */ | ||
| 1321 | WARN_ON(!(qc->err_mask & (AC_ERR_DEV | AC_ERR_HSM))); | ||
| 1322 | |||
| 1323 | ap->hsm_task_state = HSM_ST_IDLE; | 1318 | ap->hsm_task_state = HSM_ST_IDLE; |
| 1324 | 1319 | ||
| 1325 | /* complete taskfile transaction */ | 1320 | /* complete taskfile transaction */ |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index fbe605711554..eb919c16a03e 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
| @@ -181,7 +181,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc) | |||
| 181 | 181 | ||
| 182 | if (adev != acpi->last) { | 182 | if (adev != acpi->last) { |
| 183 | pacpi_set_piomode(ap, adev); | 183 | pacpi_set_piomode(ap, adev); |
| 184 | if (adev->dma_mode) | 184 | if (ata_dma_enabled(adev)) |
| 185 | pacpi_set_dmamode(ap, adev); | 185 | pacpi_set_dmamode(ap, adev); |
| 186 | acpi->last = adev; | 186 | acpi->last = adev; |
| 187 | } | 187 | } |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index d7de7baf58a8..e8a0d99d7356 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
| @@ -183,7 +183,7 @@ static void atiixp_bmdma_start(struct ata_queued_cmd *qc) | |||
| 183 | u16 tmp16; | 183 | u16 tmp16; |
| 184 | 184 | ||
| 185 | pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); | 185 | pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); |
| 186 | if (adev->dma_mode >= XFER_UDMA_0) | 186 | if (ata_using_udma(adev)) |
| 187 | tmp16 |= (1 << dn); | 187 | tmp16 |= (1 << dn); |
| 188 | else | 188 | else |
| 189 | tmp16 &= ~(1 << dn); | 189 | tmp16 &= ~(1 << dn); |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 744beebaaf49..0c4b271a9d5a 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
| @@ -149,10 +149,10 @@ static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc) | |||
| 149 | struct ata_device *prev = ap->private_data; | 149 | struct ata_device *prev = ap->private_data; |
| 150 | 150 | ||
| 151 | /* See if the DMA settings could be wrong */ | 151 | /* See if the DMA settings could be wrong */ |
| 152 | if (adev->dma_mode != 0 && adev != prev && prev != NULL) { | 152 | if (ata_dma_enabled(adev) && adev != prev && prev != NULL) { |
| 153 | /* Maybe, but do the channels match MWDMA/UDMA ? */ | 153 | /* Maybe, but do the channels match MWDMA/UDMA ? */ |
| 154 | if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || | 154 | if ((ata_using_udma(adev) && !ata_using_udma(prev)) || |
| 155 | (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) | 155 | (ata_using_udma(prev) && !ata_using_udma(adev))) |
| 156 | /* Switch the mode bits */ | 156 | /* Switch the mode bits */ |
| 157 | cs5530_set_dmamode(ap, adev); | 157 | cs5530_set_dmamode(ap, adev); |
| 158 | } | 158 | } |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 27843c70eb9d..0221c9a46769 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
| @@ -606,7 +606,7 @@ static void it821x_display_disk(int n, u8 *buf) | |||
| 606 | { | 606 | { |
| 607 | unsigned char id[41]; | 607 | unsigned char id[41]; |
| 608 | int mode = 0; | 608 | int mode = 0; |
| 609 | char *mtype; | 609 | char *mtype = ""; |
| 610 | char mbuf[8]; | 610 | char mbuf[8]; |
| 611 | char *cbl = "(40 wire cable)"; | 611 | char *cbl = "(40 wire cable)"; |
| 612 | 612 | ||
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index 24a011b25024..0d87eec84966 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
| @@ -20,29 +20,30 @@ | |||
| 20 | #include <linux/ata.h> | 20 | #include <linux/ata.h> |
| 21 | 21 | ||
| 22 | #define DRV_NAME "pata_marvell" | 22 | #define DRV_NAME "pata_marvell" |
| 23 | #define DRV_VERSION "0.1.4" | 23 | #define DRV_VERSION "0.1.6" |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * marvell_pre_reset - check for 40/80 pin | 26 | * marvell_pata_active - check if PATA is active |
| 27 | * @link: link | 27 | * @pdev: PCI device |
| 28 | * @deadline: deadline jiffies for the operation | ||
| 29 | * | 28 | * |
| 30 | * Perform the PATA port setup we need. | 29 | * Returns 1 if the PATA port may be active. We know how to check this |
| 30 | * for the 6145 but not the other devices | ||
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | static int marvell_pre_reset(struct ata_link *link, unsigned long deadline) | 33 | static int marvell_pata_active(struct pci_dev *pdev) |
| 34 | { | 34 | { |
| 35 | struct ata_port *ap = link->ap; | 35 | int i; |
| 36 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
| 37 | u32 devices; | 36 | u32 devices; |
| 38 | void __iomem *barp; | 37 | void __iomem *barp; |
| 39 | int i; | ||
| 40 | 38 | ||
| 41 | /* Check if our port is enabled */ | 39 | /* We don't yet know how to do this for other devices */ |
| 40 | if (pdev->device != 0x6145) | ||
| 41 | return 1; | ||
| 42 | 42 | ||
| 43 | barp = pci_iomap(pdev, 5, 0x10); | 43 | barp = pci_iomap(pdev, 5, 0x10); |
| 44 | if (barp == NULL) | 44 | if (barp == NULL) |
| 45 | return -ENOMEM; | 45 | return -ENOMEM; |
| 46 | |||
| 46 | printk("BAR5:"); | 47 | printk("BAR5:"); |
| 47 | for(i = 0; i <= 0x0F; i++) | 48 | for(i = 0; i <= 0x0F; i++) |
| 48 | printk("%02X:%02X ", i, ioread8(barp + i)); | 49 | printk("%02X:%02X ", i, ioread8(barp + i)); |
| @@ -51,9 +52,27 @@ static int marvell_pre_reset(struct ata_link *link, unsigned long deadline) | |||
| 51 | devices = ioread32(barp + 0x0C); | 52 | devices = ioread32(barp + 0x0C); |
| 52 | pci_iounmap(pdev, barp); | 53 | pci_iounmap(pdev, barp); |
| 53 | 54 | ||
| 54 | if ((pdev->device == 0x6145) && (ap->port_no == 0) && | 55 | if (devices & 0x10) |
| 55 | (!(devices & 0x10))) /* PATA enable ? */ | 56 | return 1; |
| 56 | return -ENOENT; | 57 | return 0; |
| 58 | } | ||
| 59 | |||
| 60 | /** | ||
| 61 | * marvell_pre_reset - check for 40/80 pin | ||
| 62 | * @link: link | ||
| 63 | * @deadline: deadline jiffies for the operation | ||
| 64 | * | ||
| 65 | * Perform the PATA port setup we need. | ||
| 66 | */ | ||
| 67 | |||
| 68 | static int marvell_pre_reset(struct ata_link *link, unsigned long deadline) | ||
| 69 | { | ||
| 70 | struct ata_port *ap = link->ap; | ||
| 71 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
| 72 | |||
| 73 | if (pdev->device == 0x6145 && ap->port_no == 0 && | ||
| 74 | !marvell_pata_active(pdev)) /* PATA enable ? */ | ||
| 75 | return -ENOENT; | ||
| 57 | 76 | ||
| 58 | return ata_sff_prereset(link, deadline); | 77 | return ata_sff_prereset(link, deadline); |
| 59 | } | 78 | } |
| @@ -128,6 +147,12 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
| 128 | if (pdev->device == 0x6101) | 147 | if (pdev->device == 0x6101) |
| 129 | ppi[1] = &ata_dummy_port_info; | 148 | ppi[1] = &ata_dummy_port_info; |
| 130 | 149 | ||
| 150 | #if defined(CONFIG_AHCI) || defined(CONFIG_AHCI_MODULE) | ||
| 151 | if (!marvell_pata_active(pdev)) { | ||
| 152 | printk(KERN_INFO DRV_NAME ": PATA port not active, deferring to AHCI driver.\n"); | ||
| 153 | return -ENODEV; | ||
| 154 | } | ||
| 155 | #endif | ||
| 131 | return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL); | 156 | return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL); |
| 132 | } | 157 | } |
| 133 | 158 | ||
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index e678af383d13..df64f2443001 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
| @@ -198,7 +198,7 @@ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc) | |||
| 198 | 198 | ||
| 199 | if (adev != ap->private_data) { | 199 | if (adev != ap->private_data) { |
| 200 | oldpiix_set_piomode(ap, adev); | 200 | oldpiix_set_piomode(ap, adev); |
| 201 | if (adev->dma_mode) | 201 | if (ata_dma_enabled(adev)) |
| 202 | oldpiix_set_dmamode(ap, adev); | 202 | oldpiix_set_dmamode(ap, adev); |
| 203 | } | 203 | } |
| 204 | return ata_sff_qc_issue(qc); | 204 | return ata_sff_qc_issue(qc); |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index cbab397e3db7..0278fd2b8fb1 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
| @@ -167,10 +167,10 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc) | |||
| 167 | struct ata_device *prev = ap->private_data; | 167 | struct ata_device *prev = ap->private_data; |
| 168 | 168 | ||
| 169 | /* See if the DMA settings could be wrong */ | 169 | /* See if the DMA settings could be wrong */ |
| 170 | if (adev->dma_mode != 0 && adev != prev && prev != NULL) { | 170 | if (ata_dma_enabled(adev) && adev != prev && prev != NULL) { |
| 171 | /* Maybe, but do the channels match MWDMA/UDMA ? */ | 171 | /* Maybe, but do the channels match MWDMA/UDMA ? */ |
| 172 | if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || | 172 | if ((ata_using_udma(adev) && !ata_using_udma(prev)) || |
| 173 | (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) | 173 | (ata_using_udma(prev) && !ata_using_udma(adev))) |
| 174 | /* Switch the mode bits */ | 174 | /* Switch the mode bits */ |
| 175 | sc1200_set_dmamode(ap, adev); | 175 | sc1200_set_dmamode(ap, adev); |
| 176 | } | 176 | } |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index 720b8645f58a..e970b227fbce 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
| @@ -322,9 +322,6 @@ static int __devinit sil680_init_one(struct pci_dev *pdev, | |||
| 322 | /* Try to acquire MMIO resources and fallback to PIO if | 322 | /* Try to acquire MMIO resources and fallback to PIO if |
| 323 | * that fails | 323 | * that fails |
| 324 | */ | 324 | */ |
| 325 | rc = pcim_enable_device(pdev); | ||
| 326 | if (rc) | ||
| 327 | return rc; | ||
| 328 | rc = pcim_iomap_regions(pdev, 1 << SIL680_MMIO_BAR, DRV_NAME); | 325 | rc = pcim_iomap_regions(pdev, 1 << SIL680_MMIO_BAR, DRV_NAME); |
| 329 | if (rc) | 326 | if (rc) |
| 330 | goto use_ioports; | 327 | goto use_ioports; |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 57d951b11f2d..8fdb2ce73210 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
| @@ -324,62 +324,26 @@ static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | /** | 326 | /** |
| 327 | * via_ata_sff_tf_load - send taskfile registers to host controller | 327 | * via_tf_load - send taskfile registers to host controller |
| 328 | * @ap: Port to which output is sent | 328 | * @ap: Port to which output is sent |
| 329 | * @tf: ATA taskfile register set | 329 | * @tf: ATA taskfile register set |
| 330 | * | 330 | * |
| 331 | * Outputs ATA taskfile to standard ATA host controller. | 331 | * Outputs ATA taskfile to standard ATA host controller. |
| 332 | * | 332 | * |
| 333 | * Note: This is to fix the internal bug of via chipsets, which | 333 | * Note: This is to fix the internal bug of via chipsets, which |
| 334 | * will reset the device register after changing the IEN bit on | 334 | * will reset the device register after changing the IEN bit on |
| 335 | * ctl register | 335 | * ctl register |
| 336 | */ | 336 | */ |
| 337 | static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | 337 | static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) |
| 338 | { | 338 | { |
| 339 | struct ata_ioports *ioaddr = &ap->ioaddr; | 339 | struct ata_taskfile tmp_tf; |
| 340 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | ||
| 341 | |||
| 342 | if (tf->ctl != ap->last_ctl) { | ||
| 343 | iowrite8(tf->ctl, ioaddr->ctl_addr); | ||
| 344 | iowrite8(tf->device, ioaddr->device_addr); | ||
| 345 | ap->last_ctl = tf->ctl; | ||
| 346 | ata_wait_idle(ap); | ||
| 347 | } | ||
| 348 | |||
| 349 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | ||
| 350 | iowrite8(tf->hob_feature, ioaddr->feature_addr); | ||
| 351 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | ||
| 352 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | ||
| 353 | iowrite8(tf->hob_lbam, ioaddr->lbam_addr); | ||
| 354 | iowrite8(tf->hob_lbah, ioaddr->lbah_addr); | ||
| 355 | VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", | ||
| 356 | tf->hob_feature, | ||
| 357 | tf->hob_nsect, | ||
| 358 | tf->hob_lbal, | ||
| 359 | tf->hob_lbam, | ||
| 360 | tf->hob_lbah); | ||
| 361 | } | ||
| 362 | 340 | ||
| 363 | if (is_addr) { | 341 | if (ap->ctl != ap->last_ctl && !(tf->flags & ATA_TFLAG_DEVICE)) { |
| 364 | iowrite8(tf->feature, ioaddr->feature_addr); | 342 | tmp_tf = *tf; |
| 365 | iowrite8(tf->nsect, ioaddr->nsect_addr); | 343 | tmp_tf.flags |= ATA_TFLAG_DEVICE; |
| 366 | iowrite8(tf->lbal, ioaddr->lbal_addr); | 344 | tf = &tmp_tf; |
| 367 | iowrite8(tf->lbam, ioaddr->lbam_addr); | ||
| 368 | iowrite8(tf->lbah, ioaddr->lbah_addr); | ||
| 369 | VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", | ||
| 370 | tf->feature, | ||
| 371 | tf->nsect, | ||
| 372 | tf->lbal, | ||
| 373 | tf->lbam, | ||
| 374 | tf->lbah); | ||
| 375 | } | 345 | } |
| 376 | 346 | ata_sff_tf_load(ap, tf); | |
| 377 | if (tf->flags & ATA_TFLAG_DEVICE) { | ||
| 378 | iowrite8(tf->device, ioaddr->device_addr); | ||
| 379 | VPRINTK("device 0x%X\n", tf->device); | ||
| 380 | } | ||
| 381 | |||
| 382 | ata_wait_idle(ap); | ||
| 383 | } | 347 | } |
| 384 | 348 | ||
| 385 | static struct scsi_host_template via_sht = { | 349 | static struct scsi_host_template via_sht = { |
| @@ -392,13 +356,12 @@ static struct ata_port_operations via_port_ops = { | |||
| 392 | .set_piomode = via_set_piomode, | 356 | .set_piomode = via_set_piomode, |
| 393 | .set_dmamode = via_set_dmamode, | 357 | .set_dmamode = via_set_dmamode, |
| 394 | .prereset = via_pre_reset, | 358 | .prereset = via_pre_reset, |
| 395 | .sff_tf_load = via_ata_tf_load, | 359 | .sff_tf_load = via_tf_load, |
| 396 | }; | 360 | }; |
| 397 | 361 | ||
| 398 | static struct ata_port_operations via_port_ops_noirq = { | 362 | static struct ata_port_operations via_port_ops_noirq = { |
| 399 | .inherits = &via_port_ops, | 363 | .inherits = &via_port_ops, |
| 400 | .sff_data_xfer = ata_sff_data_xfer_noirq, | 364 | .sff_data_xfer = ata_sff_data_xfer_noirq, |
| 401 | .sff_tf_load = via_ata_tf_load, | ||
| 402 | }; | 365 | }; |
| 403 | 366 | ||
| 404 | /** | 367 | /** |
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index 3ead02fe379e..5032c32fa505 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
| @@ -96,6 +96,7 @@ enum { | |||
| 96 | PORT_SCR = 0x20, | 96 | PORT_SCR = 0x20, |
| 97 | 97 | ||
| 98 | /* HOST_CTL bits */ | 98 | /* HOST_CTL bits */ |
| 99 | HCTL_LEDEN = (1 << 3), /* enable LED operation */ | ||
| 99 | HCTL_IRQOFF = (1 << 8), /* global IRQ off */ | 100 | HCTL_IRQOFF = (1 << 8), /* global IRQ off */ |
| 100 | HCTL_FTHD0 = (1 << 10), /* fifo threshold 0 */ | 101 | HCTL_FTHD0 = (1 << 10), /* fifo threshold 0 */ |
| 101 | HCTL_FTHD1 = (1 << 11), /* fifo threshold 1*/ | 102 | HCTL_FTHD1 = (1 << 11), /* fifo threshold 1*/ |
| @@ -540,7 +541,7 @@ static unsigned int inic_qc_issue(struct ata_queued_cmd *qc) | |||
| 540 | void __iomem *port_base = inic_port_base(ap); | 541 | void __iomem *port_base = inic_port_base(ap); |
| 541 | 542 | ||
| 542 | /* fire up the ADMA engine */ | 543 | /* fire up the ADMA engine */ |
| 543 | writew(HCTL_FTHD0, port_base + HOST_CTL); | 544 | writew(HCTL_FTHD0 | HCTL_LEDEN, port_base + HOST_CTL); |
| 544 | writew(IDMA_CTL_GO, port_base + PORT_IDMA_CTL); | 545 | writew(IDMA_CTL_GO, port_base + PORT_IDMA_CTL); |
| 545 | writeb(0, port_base + PORT_CPB_PTQFIFO); | 546 | writeb(0, port_base + PORT_CPB_PTQFIFO); |
| 546 | 547 | ||
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index ad169ffbc4cb..c815f8ecf6e6 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
| @@ -667,7 +667,8 @@ static const struct pci_device_id mv_pci_tbl[] = { | |||
| 667 | { PCI_VDEVICE(MARVELL, 0x5041), chip_504x }, | 667 | { PCI_VDEVICE(MARVELL, 0x5041), chip_504x }, |
| 668 | { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 }, | 668 | { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 }, |
| 669 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, | 669 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, |
| 670 | /* RocketRAID 1740/174x have different identifiers */ | 670 | /* RocketRAID 1720/174x have different identifiers */ |
| 671 | { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, | ||
| 671 | { PCI_VDEVICE(TTI, 0x1740), chip_508x }, | 672 | { PCI_VDEVICE(TTI, 0x1740), chip_508x }, |
| 672 | { PCI_VDEVICE(TTI, 0x1742), chip_508x }, | 673 | { PCI_VDEVICE(TTI, 0x1742), chip_508x }, |
| 673 | 674 | ||
| @@ -1134,30 +1135,16 @@ static int mv_qc_defer(struct ata_queued_cmd *qc) | |||
| 1134 | if (ap->nr_active_links == 0) | 1135 | if (ap->nr_active_links == 0) |
| 1135 | return 0; | 1136 | return 0; |
| 1136 | 1137 | ||
| 1137 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { | 1138 | /* |
| 1138 | /* | 1139 | * The port is operating in host queuing mode (EDMA) with NCQ |
| 1139 | * The port is operating in host queuing mode (EDMA). | 1140 | * enabled, allow multiple NCQ commands. EDMA also allows |
| 1140 | * It can accomodate a new qc if the qc protocol | 1141 | * queueing multiple DMA commands but libata core currently |
| 1141 | * is compatible with the current host queue mode. | 1142 | * doesn't allow it. |
| 1142 | */ | 1143 | */ |
| 1143 | if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) { | 1144 | if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) && |
| 1144 | /* | 1145 | (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol)) |
| 1145 | * The host queue (EDMA) is in NCQ mode. | 1146 | return 0; |
| 1146 | * If the new qc is also an NCQ command, | 1147 | |
| 1147 | * then allow the new qc. | ||
| 1148 | */ | ||
| 1149 | if (qc->tf.protocol == ATA_PROT_NCQ) | ||
| 1150 | return 0; | ||
| 1151 | } else { | ||
| 1152 | /* | ||
| 1153 | * The host queue (EDMA) is in non-NCQ, DMA mode. | ||
| 1154 | * If the new qc is also a non-NCQ, DMA command, | ||
| 1155 | * then allow the new qc. | ||
| 1156 | */ | ||
| 1157 | if (qc->tf.protocol == ATA_PROT_DMA) | ||
| 1158 | return 0; | ||
| 1159 | } | ||
| 1160 | } | ||
| 1161 | return ATA_DEFER_PORT; | 1148 | return ATA_DEFER_PORT; |
| 1162 | } | 1149 | } |
| 1163 | 1150 | ||
| @@ -3036,7 +3023,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
| 3036 | break; | 3023 | break; |
| 3037 | case chip_soc: | 3024 | case chip_soc: |
| 3038 | hpriv->ops = &mv_soc_ops; | 3025 | hpriv->ops = &mv_soc_ops; |
| 3039 | hp_flags |= MV_HP_FLAG_SOC | MV_HP_ERRATA_60X1C0; | 3026 | hp_flags |= MV_HP_FLAG_SOC | MV_HP_GEN_IIE | |
| 3027 | MV_HP_ERRATA_60X1C0; | ||
| 3040 | break; | 3028 | break; |
| 3041 | 3029 | ||
| 3042 | default: | 3030 | default: |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 858f70610eda..14601dc05e41 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
| @@ -405,28 +405,45 @@ static struct scsi_host_template nv_swncq_sht = { | |||
| 405 | .slave_configure = nv_swncq_slave_config, | 405 | .slave_configure = nv_swncq_slave_config, |
| 406 | }; | 406 | }; |
| 407 | 407 | ||
| 408 | static struct ata_port_operations nv_generic_ops = { | 408 | /* OSDL bz3352 reports that some nv controllers can't determine device |
| 409 | * signature reliably and nv_hardreset is implemented to work around | ||
| 410 | * the problem. This was reported on nf3 and it's unclear whether any | ||
| 411 | * other controllers are affected. However, the workaround has been | ||
| 412 | * applied to all variants and there isn't much to gain by trying to | ||
| 413 | * find out exactly which ones are affected at this point especially | ||
| 414 | * because NV has moved over to ahci for newer controllers. | ||
| 415 | */ | ||
| 416 | static struct ata_port_operations nv_common_ops = { | ||
| 409 | .inherits = &ata_bmdma_port_ops, | 417 | .inherits = &ata_bmdma_port_ops, |
| 410 | .hardreset = nv_hardreset, | 418 | .hardreset = nv_hardreset, |
| 411 | .scr_read = nv_scr_read, | 419 | .scr_read = nv_scr_read, |
| 412 | .scr_write = nv_scr_write, | 420 | .scr_write = nv_scr_write, |
| 413 | }; | 421 | }; |
| 414 | 422 | ||
| 423 | /* OSDL bz11195 reports that link doesn't come online after hardreset | ||
| 424 | * on generic nv's and there have been several other similar reports | ||
| 425 | * on linux-ide. Disable hardreset for generic nv's. | ||
| 426 | */ | ||
| 427 | static struct ata_port_operations nv_generic_ops = { | ||
| 428 | .inherits = &nv_common_ops, | ||
| 429 | .hardreset = ATA_OP_NULL, | ||
| 430 | }; | ||
| 431 | |||
| 415 | static struct ata_port_operations nv_nf2_ops = { | 432 | static struct ata_port_operations nv_nf2_ops = { |
| 416 | .inherits = &nv_generic_ops, | 433 | .inherits = &nv_common_ops, |
| 417 | .freeze = nv_nf2_freeze, | 434 | .freeze = nv_nf2_freeze, |
| 418 | .thaw = nv_nf2_thaw, | 435 | .thaw = nv_nf2_thaw, |
| 419 | }; | 436 | }; |
| 420 | 437 | ||
| 421 | static struct ata_port_operations nv_ck804_ops = { | 438 | static struct ata_port_operations nv_ck804_ops = { |
| 422 | .inherits = &nv_generic_ops, | 439 | .inherits = &nv_common_ops, |
| 423 | .freeze = nv_ck804_freeze, | 440 | .freeze = nv_ck804_freeze, |
| 424 | .thaw = nv_ck804_thaw, | 441 | .thaw = nv_ck804_thaw, |
| 425 | .host_stop = nv_ck804_host_stop, | 442 | .host_stop = nv_ck804_host_stop, |
| 426 | }; | 443 | }; |
| 427 | 444 | ||
| 428 | static struct ata_port_operations nv_adma_ops = { | 445 | static struct ata_port_operations nv_adma_ops = { |
| 429 | .inherits = &nv_generic_ops, | 446 | .inherits = &nv_common_ops, |
| 430 | 447 | ||
| 431 | .check_atapi_dma = nv_adma_check_atapi_dma, | 448 | .check_atapi_dma = nv_adma_check_atapi_dma, |
| 432 | .sff_tf_read = nv_adma_tf_read, | 449 | .sff_tf_read = nv_adma_tf_read, |
| @@ -450,7 +467,7 @@ static struct ata_port_operations nv_adma_ops = { | |||
| 450 | }; | 467 | }; |
| 451 | 468 | ||
| 452 | static struct ata_port_operations nv_swncq_ops = { | 469 | static struct ata_port_operations nv_swncq_ops = { |
| 453 | .inherits = &nv_generic_ops, | 470 | .inherits = &nv_common_ops, |
| 454 | 471 | ||
| 455 | .qc_defer = ata_std_qc_defer, | 472 | .qc_defer = ata_std_qc_defer, |
| 456 | .qc_prep = nv_swncq_qc_prep, | 473 | .qc_prep = nv_swncq_qc_prep, |
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c index 2ebd07f2ef81..5effec6f5458 100644 --- a/drivers/atm/adummy.c +++ b/drivers/atm/adummy.c | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
| 6 | #include <linux/version.h> | ||
| 7 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
| 8 | #include <linux/skbuff.h> | 7 | #include <linux/skbuff.h> |
| 9 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
diff --git a/drivers/base/class.c b/drivers/base/class.c index 5667c2f02c51..cc5e28c8885c 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
| @@ -295,6 +295,12 @@ int class_for_each_device(struct class *class, struct device *start, | |||
| 295 | 295 | ||
| 296 | if (!class) | 296 | if (!class) |
| 297 | return -EINVAL; | 297 | return -EINVAL; |
| 298 | if (!class->p) { | ||
| 299 | WARN(1, "%s called for class '%s' before it was initialized", | ||
| 300 | __func__, class->name); | ||
| 301 | return -EINVAL; | ||
| 302 | } | ||
| 303 | |||
| 298 | mutex_lock(&class->p->class_mutex); | 304 | mutex_lock(&class->p->class_mutex); |
| 299 | list_for_each_entry(dev, &class->p->class_devices, node) { | 305 | list_for_each_entry(dev, &class->p->class_devices, node) { |
| 300 | if (start) { | 306 | if (start) { |
| @@ -344,6 +350,11 @@ struct device *class_find_device(struct class *class, struct device *start, | |||
| 344 | 350 | ||
| 345 | if (!class) | 351 | if (!class) |
| 346 | return NULL; | 352 | return NULL; |
| 353 | if (!class->p) { | ||
| 354 | WARN(1, "%s called for class '%s' before it was initialized", | ||
| 355 | __func__, class->name); | ||
| 356 | return NULL; | ||
| 357 | } | ||
| 347 | 358 | ||
| 348 | mutex_lock(&class->p->class_mutex); | 359 | mutex_lock(&class->p->class_mutex); |
| 349 | list_for_each_entry(dev, &class->p->class_devices, node) { | 360 | list_for_each_entry(dev, &class->p->class_devices, node) { |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 068aa1c9538c..d021c98605b3 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -53,7 +53,7 @@ static inline int device_is_not_partition(struct device *dev) | |||
| 53 | * it is attached to. If it is not attached to a bus either, an empty | 53 | * it is attached to. If it is not attached to a bus either, an empty |
| 54 | * string will be returned. | 54 | * string will be returned. |
| 55 | */ | 55 | */ |
| 56 | const char *dev_driver_string(struct device *dev) | 56 | const char *dev_driver_string(const struct device *dev) |
| 57 | { | 57 | { |
| 58 | return dev->driver ? dev->driver->name : | 58 | return dev->driver ? dev->driver->name : |
| 59 | (dev->bus ? dev->bus->name : | 59 | (dev->bus ? dev->bus->name : |
| @@ -541,6 +541,7 @@ void device_initialize(struct device *dev) | |||
| 541 | spin_lock_init(&dev->devres_lock); | 541 | spin_lock_init(&dev->devres_lock); |
| 542 | INIT_LIST_HEAD(&dev->devres_head); | 542 | INIT_LIST_HEAD(&dev->devres_head); |
| 543 | device_init_wakeup(dev, 0); | 543 | device_init_wakeup(dev, 0); |
| 544 | device_pm_init(dev); | ||
| 544 | set_dev_node(dev, -1); | 545 | set_dev_node(dev, -1); |
| 545 | } | 546 | } |
| 546 | 547 | ||
| @@ -843,13 +844,19 @@ int device_add(struct device *dev) | |||
| 843 | { | 844 | { |
| 844 | struct device *parent = NULL; | 845 | struct device *parent = NULL; |
| 845 | struct class_interface *class_intf; | 846 | struct class_interface *class_intf; |
| 846 | int error; | 847 | int error = -EINVAL; |
| 847 | 848 | ||
| 848 | dev = get_device(dev); | 849 | dev = get_device(dev); |
| 849 | if (!dev || !strlen(dev->bus_id)) { | 850 | if (!dev) |
| 850 | error = -EINVAL; | 851 | goto done; |
| 851 | goto Done; | 852 | |
| 852 | } | 853 | /* Temporarily support init_name if it is set. |
| 854 | * It will override bus_id for now */ | ||
| 855 | if (dev->init_name) | ||
| 856 | dev_set_name(dev, "%s", dev->init_name); | ||
| 857 | |||
| 858 | if (!strlen(dev->bus_id)) | ||
| 859 | goto done; | ||
| 853 | 860 | ||
| 854 | pr_debug("device: '%s': %s\n", dev->bus_id, __func__); | 861 | pr_debug("device: '%s': %s\n", dev->bus_id, __func__); |
| 855 | 862 | ||
| @@ -897,9 +904,10 @@ int device_add(struct device *dev) | |||
| 897 | error = bus_add_device(dev); | 904 | error = bus_add_device(dev); |
| 898 | if (error) | 905 | if (error) |
| 899 | goto BusError; | 906 | goto BusError; |
| 900 | error = device_pm_add(dev); | 907 | error = dpm_sysfs_add(dev); |
| 901 | if (error) | 908 | if (error) |
| 902 | goto PMError; | 909 | goto DPMError; |
| 910 | device_pm_add(dev); | ||
| 903 | kobject_uevent(&dev->kobj, KOBJ_ADD); | 911 | kobject_uevent(&dev->kobj, KOBJ_ADD); |
| 904 | bus_attach_device(dev); | 912 | bus_attach_device(dev); |
| 905 | if (parent) | 913 | if (parent) |
| @@ -917,10 +925,10 @@ int device_add(struct device *dev) | |||
| 917 | class_intf->add_dev(dev, class_intf); | 925 | class_intf->add_dev(dev, class_intf); |
| 918 | mutex_unlock(&dev->class->p->class_mutex); | 926 | mutex_unlock(&dev->class->p->class_mutex); |
| 919 | } | 927 | } |
| 920 | Done: | 928 | done: |
| 921 | put_device(dev); | 929 | put_device(dev); |
| 922 | return error; | 930 | return error; |
| 923 | PMError: | 931 | DPMError: |
| 924 | bus_remove_device(dev); | 932 | bus_remove_device(dev); |
| 925 | BusError: | 933 | BusError: |
| 926 | if (dev->bus) | 934 | if (dev->bus) |
| @@ -944,7 +952,7 @@ int device_add(struct device *dev) | |||
| 944 | cleanup_device_parent(dev); | 952 | cleanup_device_parent(dev); |
| 945 | if (parent) | 953 | if (parent) |
| 946 | put_device(parent); | 954 | put_device(parent); |
| 947 | goto Done; | 955 | goto done; |
| 948 | } | 956 | } |
| 949 | 957 | ||
| 950 | /** | 958 | /** |
| @@ -1007,6 +1015,7 @@ void device_del(struct device *dev) | |||
| 1007 | struct class_interface *class_intf; | 1015 | struct class_interface *class_intf; |
| 1008 | 1016 | ||
| 1009 | device_pm_remove(dev); | 1017 | device_pm_remove(dev); |
| 1018 | dpm_sysfs_remove(dev); | ||
| 1010 | if (parent) | 1019 | if (parent) |
| 1011 | klist_del(&dev->knode_parent); | 1020 | klist_del(&dev->knode_parent); |
| 1012 | if (MAJOR(dev->devt)) { | 1021 | if (MAJOR(dev->devt)) { |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 2ef5acf4368b..1e2bda780e48 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
| @@ -16,9 +16,6 @@ | |||
| 16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
| 17 | #include "base.h" | 17 | #include "base.h" |
| 18 | 18 | ||
| 19 | #define to_dev(node) container_of(node, struct device, driver_list) | ||
| 20 | |||
| 21 | |||
| 22 | static struct device *next_device(struct klist_iter *i) | 19 | static struct device *next_device(struct klist_iter *i) |
| 23 | { | 20 | { |
| 24 | struct klist_node *n = klist_next(i); | 21 | struct klist_node *n = klist_next(i); |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 3250c5257b74..273a944d4040 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -67,20 +67,16 @@ void device_pm_unlock(void) | |||
| 67 | * device_pm_add - add a device to the list of active devices | 67 | * device_pm_add - add a device to the list of active devices |
| 68 | * @dev: Device to be added to the list | 68 | * @dev: Device to be added to the list |
| 69 | */ | 69 | */ |
| 70 | int device_pm_add(struct device *dev) | 70 | void device_pm_add(struct device *dev) |
| 71 | { | 71 | { |
| 72 | int error; | ||
| 73 | |||
| 74 | pr_debug("PM: Adding info for %s:%s\n", | 72 | pr_debug("PM: Adding info for %s:%s\n", |
| 75 | dev->bus ? dev->bus->name : "No Bus", | 73 | dev->bus ? dev->bus->name : "No Bus", |
| 76 | kobject_name(&dev->kobj)); | 74 | kobject_name(&dev->kobj)); |
| 77 | mutex_lock(&dpm_list_mtx); | 75 | mutex_lock(&dpm_list_mtx); |
| 78 | if (dev->parent) { | 76 | if (dev->parent) { |
| 79 | if (dev->parent->power.status >= DPM_SUSPENDING) { | 77 | if (dev->parent->power.status >= DPM_SUSPENDING) |
| 80 | dev_warn(dev, "parent %s is sleeping, will not add\n", | 78 | dev_warn(dev, "parent %s should not be sleeping\n", |
| 81 | dev->parent->bus_id); | 79 | dev->parent->bus_id); |
| 82 | WARN_ON(true); | ||
| 83 | } | ||
| 84 | } else if (transition_started) { | 80 | } else if (transition_started) { |
| 85 | /* | 81 | /* |
| 86 | * We refuse to register parentless devices while a PM | 82 | * We refuse to register parentless devices while a PM |
| @@ -89,13 +85,9 @@ int device_pm_add(struct device *dev) | |||
| 89 | */ | 85 | */ |
| 90 | WARN_ON(true); | 86 | WARN_ON(true); |
| 91 | } | 87 | } |
| 92 | error = dpm_sysfs_add(dev); | 88 | |
| 93 | if (!error) { | 89 | list_add_tail(&dev->power.entry, &dpm_list); |
| 94 | dev->power.status = DPM_ON; | ||
| 95 | list_add_tail(&dev->power.entry, &dpm_list); | ||
| 96 | } | ||
| 97 | mutex_unlock(&dpm_list_mtx); | 90 | mutex_unlock(&dpm_list_mtx); |
| 98 | return error; | ||
| 99 | } | 91 | } |
| 100 | 92 | ||
| 101 | /** | 93 | /** |
| @@ -110,7 +102,6 @@ void device_pm_remove(struct device *dev) | |||
| 110 | dev->bus ? dev->bus->name : "No Bus", | 102 | dev->bus ? dev->bus->name : "No Bus", |
| 111 | kobject_name(&dev->kobj)); | 103 | kobject_name(&dev->kobj)); |
| 112 | mutex_lock(&dpm_list_mtx); | 104 | mutex_lock(&dpm_list_mtx); |
| 113 | dpm_sysfs_remove(dev); | ||
| 114 | list_del_init(&dev->power.entry); | 105 | list_del_init(&dev->power.entry); |
| 115 | mutex_unlock(&dpm_list_mtx); | 106 | mutex_unlock(&dpm_list_mtx); |
| 116 | } | 107 | } |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index a3252c0e2887..41f51fae042f 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | static inline void device_pm_init(struct device *dev) | ||
| 2 | { | ||
| 3 | dev->power.status = DPM_ON; | ||
| 4 | } | ||
| 5 | |||
| 1 | #ifdef CONFIG_PM_SLEEP | 6 | #ifdef CONFIG_PM_SLEEP |
| 2 | 7 | ||
| 3 | /* | 8 | /* |
| @@ -11,12 +16,12 @@ static inline struct device *to_device(struct list_head *entry) | |||
| 11 | return container_of(entry, struct device, power.entry); | 16 | return container_of(entry, struct device, power.entry); |
| 12 | } | 17 | } |
| 13 | 18 | ||
| 14 | extern int device_pm_add(struct device *); | 19 | extern void device_pm_add(struct device *); |
| 15 | extern void device_pm_remove(struct device *); | 20 | extern void device_pm_remove(struct device *); |
| 16 | 21 | ||
| 17 | #else /* CONFIG_PM_SLEEP */ | 22 | #else /* CONFIG_PM_SLEEP */ |
| 18 | 23 | ||
| 19 | static inline int device_pm_add(struct device *dev) { return 0; } | 24 | static inline void device_pm_add(struct device *dev) {} |
| 20 | static inline void device_pm_remove(struct device *dev) {} | 25 | static inline void device_pm_remove(struct device *dev) {} |
| 21 | 26 | ||
| 22 | #endif | 27 | #endif |
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 24b97b0bef99..d070d492e385 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
| @@ -571,8 +571,8 @@ out_free: | |||
| 571 | list_del(&brd->brd_list); | 571 | list_del(&brd->brd_list); |
| 572 | brd_free(brd); | 572 | brd_free(brd); |
| 573 | } | 573 | } |
| 574 | unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); | ||
| 574 | 575 | ||
| 575 | unregister_blkdev(RAMDISK_MAJOR, "brd"); | ||
| 576 | return -ENOMEM; | 576 | return -ENOMEM; |
| 577 | } | 577 | } |
| 578 | 578 | ||
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index ad98dda6037d..1778e4a2c672 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
| @@ -707,15 +707,15 @@ static int __init nbd_init(void) | |||
| 707 | 707 | ||
| 708 | BUILD_BUG_ON(sizeof(struct nbd_request) != 28); | 708 | BUILD_BUG_ON(sizeof(struct nbd_request) != 28); |
| 709 | 709 | ||
| 710 | nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); | ||
| 711 | if (!nbd_dev) | ||
| 712 | return -ENOMEM; | ||
| 713 | |||
| 714 | if (max_part < 0) { | 710 | if (max_part < 0) { |
| 715 | printk(KERN_CRIT "nbd: max_part must be >= 0\n"); | 711 | printk(KERN_CRIT "nbd: max_part must be >= 0\n"); |
| 716 | return -EINVAL; | 712 | return -EINVAL; |
| 717 | } | 713 | } |
| 718 | 714 | ||
| 715 | nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); | ||
| 716 | if (!nbd_dev) | ||
| 717 | return -ENOMEM; | ||
| 718 | |||
| 719 | part_shift = 0; | 719 | part_shift = 0; |
| 720 | if (max_part > 0) | 720 | if (max_part > 0) |
| 721 | part_shift = fls(max_part); | 721 | part_shift = fls(max_part); |
| @@ -779,6 +779,7 @@ out: | |||
| 779 | blk_cleanup_queue(nbd_dev[i].disk->queue); | 779 | blk_cleanup_queue(nbd_dev[i].disk->queue); |
| 780 | put_disk(nbd_dev[i].disk); | 780 | put_disk(nbd_dev[i].disk); |
| 781 | } | 781 | } |
| 782 | kfree(nbd_dev); | ||
| 782 | return err; | 783 | return err; |
| 783 | } | 784 | } |
| 784 | 785 | ||
| @@ -795,6 +796,7 @@ static void __exit nbd_cleanup(void) | |||
| 795 | } | 796 | } |
| 796 | } | 797 | } |
| 797 | unregister_blkdev(NBD_MAJOR, "nbd"); | 798 | unregister_blkdev(NBD_MAJOR, "nbd"); |
| 799 | kfree(nbd_dev); | ||
| 798 | printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR); | 800 | printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR); |
| 799 | } | 801 | } |
| 800 | 802 | ||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 158eed4d5161..29b7a648cc6e 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
| @@ -49,7 +49,6 @@ | |||
| 49 | #include <linux/types.h> | 49 | #include <linux/types.h> |
| 50 | #include <linux/kernel.h> | 50 | #include <linux/kernel.h> |
| 51 | #include <linux/kthread.h> | 51 | #include <linux/kthread.h> |
| 52 | #include <linux/smp_lock.h> | ||
| 53 | #include <linux/errno.h> | 52 | #include <linux/errno.h> |
| 54 | #include <linux/spinlock.h> | 53 | #include <linux/spinlock.h> |
| 55 | #include <linux/file.h> | 54 | #include <linux/file.h> |
| @@ -2798,14 +2797,9 @@ out_mem: | |||
| 2798 | return ret; | 2797 | return ret; |
| 2799 | } | 2798 | } |
| 2800 | 2799 | ||
| 2801 | static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 2800 | static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
| 2802 | { | 2801 | { |
| 2803 | struct inode *inode = file->f_path.dentry->d_inode; | 2802 | struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data; |
| 2804 | struct pktcdvd_device *pd; | ||
| 2805 | long ret; | ||
| 2806 | |||
| 2807 | lock_kernel(); | ||
| 2808 | pd = inode->i_bdev->bd_disk->private_data; | ||
| 2809 | 2803 | ||
| 2810 | VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); | 2804 | VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); |
| 2811 | 2805 | ||
| @@ -2818,8 +2812,7 @@ static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 2818 | case CDROM_LAST_WRITTEN: | 2812 | case CDROM_LAST_WRITTEN: |
| 2819 | case CDROM_SEND_PACKET: | 2813 | case CDROM_SEND_PACKET: |
| 2820 | case SCSI_IOCTL_SEND_COMMAND: | 2814 | case SCSI_IOCTL_SEND_COMMAND: |
| 2821 | ret = blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); | 2815 | return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); |
| 2822 | break; | ||
| 2823 | 2816 | ||
| 2824 | case CDROMEJECT: | 2817 | case CDROMEJECT: |
| 2825 | /* | 2818 | /* |
| @@ -2828,15 +2821,14 @@ static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 2828 | */ | 2821 | */ |
| 2829 | if (pd->refcnt == 1) | 2822 | if (pd->refcnt == 1) |
| 2830 | pkt_lock_door(pd, 0); | 2823 | pkt_lock_door(pd, 0); |
| 2831 | ret = blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); | 2824 | return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); |
| 2832 | break; | ||
| 2833 | 2825 | ||
| 2834 | default: | 2826 | default: |
| 2835 | VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd); | 2827 | VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd); |
| 2836 | ret = -ENOTTY; | 2828 | return -ENOTTY; |
| 2837 | } | 2829 | } |
| 2838 | unlock_kernel(); | 2830 | |
| 2839 | return ret; | 2831 | return 0; |
| 2840 | } | 2832 | } |
| 2841 | 2833 | ||
| 2842 | static int pkt_media_changed(struct gendisk *disk) | 2834 | static int pkt_media_changed(struct gendisk *disk) |
| @@ -2858,7 +2850,7 @@ static struct block_device_operations pktcdvd_ops = { | |||
| 2858 | .owner = THIS_MODULE, | 2850 | .owner = THIS_MODULE, |
| 2859 | .open = pkt_open, | 2851 | .open = pkt_open, |
| 2860 | .release = pkt_close, | 2852 | .release = pkt_close, |
| 2861 | .unlocked_ioctl = pkt_ioctl, | 2853 | .ioctl = pkt_ioctl, |
| 2862 | .media_changed = pkt_media_changed, | 2854 | .media_changed = pkt_media_changed, |
| 2863 | }; | 2855 | }; |
| 2864 | 2856 | ||
| @@ -3023,8 +3015,7 @@ static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd) | |||
| 3023 | mutex_unlock(&ctl_mutex); | 3015 | mutex_unlock(&ctl_mutex); |
| 3024 | } | 3016 | } |
| 3025 | 3017 | ||
| 3026 | static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | 3018 | static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
| 3027 | unsigned long arg) | ||
| 3028 | { | 3019 | { |
| 3029 | void __user *argp = (void __user *)arg; | 3020 | void __user *argp = (void __user *)arg; |
| 3030 | struct pkt_ctrl_command ctrl_cmd; | 3021 | struct pkt_ctrl_command ctrl_cmd; |
| @@ -3041,22 +3032,16 @@ static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | |||
| 3041 | case PKT_CTRL_CMD_SETUP: | 3032 | case PKT_CTRL_CMD_SETUP: |
| 3042 | if (!capable(CAP_SYS_ADMIN)) | 3033 | if (!capable(CAP_SYS_ADMIN)) |
| 3043 | return -EPERM; | 3034 | return -EPERM; |
| 3044 | lock_kernel(); | ||
| 3045 | ret = pkt_setup_dev(new_decode_dev(ctrl_cmd.dev), &pkt_dev); | 3035 | ret = pkt_setup_dev(new_decode_dev(ctrl_cmd.dev), &pkt_dev); |
| 3046 | ctrl_cmd.pkt_dev = new_encode_dev(pkt_dev); | 3036 | ctrl_cmd.pkt_dev = new_encode_dev(pkt_dev); |
| 3047 | unlock_kernel(); | ||
| 3048 | break; | 3037 | break; |
| 3049 | case PKT_CTRL_CMD_TEARDOWN: | 3038 | case PKT_CTRL_CMD_TEARDOWN: |
| 3050 | if (!capable(CAP_SYS_ADMIN)) | 3039 | if (!capable(CAP_SYS_ADMIN)) |
| 3051 | return -EPERM; | 3040 | return -EPERM; |
| 3052 | lock_kernel(); | ||
| 3053 | ret = pkt_remove_dev(new_decode_dev(ctrl_cmd.pkt_dev)); | 3041 | ret = pkt_remove_dev(new_decode_dev(ctrl_cmd.pkt_dev)); |
| 3054 | unlock_kernel(); | ||
| 3055 | break; | 3042 | break; |
| 3056 | case PKT_CTRL_CMD_STATUS: | 3043 | case PKT_CTRL_CMD_STATUS: |
| 3057 | lock_kernel(); | ||
| 3058 | pkt_get_status(&ctrl_cmd); | 3044 | pkt_get_status(&ctrl_cmd); |
| 3059 | unlock_kernel(); | ||
| 3060 | break; | 3045 | break; |
| 3061 | default: | 3046 | default: |
| 3062 | return -ENOTTY; | 3047 | return -ENOTTY; |
| @@ -3069,7 +3054,7 @@ static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | |||
| 3069 | 3054 | ||
| 3070 | 3055 | ||
| 3071 | static const struct file_operations pkt_ctl_fops = { | 3056 | static const struct file_operations pkt_ctl_fops = { |
| 3072 | .unlocked_ioctl = pkt_ctl_ioctl, | 3057 | .ioctl = pkt_ctl_ioctl, |
| 3073 | .owner = THIS_MODULE, | 3058 | .owner = THIS_MODULE, |
| 3074 | }; | 3059 | }; |
| 3075 | 3060 | ||
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index a235ca787465..7cb4029a5375 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig | |||
| @@ -3,8 +3,8 @@ menu "Bluetooth device drivers" | |||
| 3 | depends on BT | 3 | depends on BT |
| 4 | 4 | ||
| 5 | config BT_HCIUSB | 5 | config BT_HCIUSB |
| 6 | tristate "HCI USB driver" | 6 | tristate "HCI USB driver (old version)" |
| 7 | depends on USB | 7 | depends on USB && BT_HCIBTUSB=n |
| 8 | help | 8 | help |
| 9 | Bluetooth HCI USB driver. | 9 | Bluetooth HCI USB driver. |
| 10 | This driver is required if you want to use Bluetooth devices with | 10 | This driver is required if you want to use Bluetooth devices with |
| @@ -23,15 +23,13 @@ config BT_HCIUSB_SCO | |||
| 23 | Say Y here to compile support for SCO over HCI USB. | 23 | Say Y here to compile support for SCO over HCI USB. |
| 24 | 24 | ||
| 25 | config BT_HCIBTUSB | 25 | config BT_HCIBTUSB |
| 26 | tristate "HCI USB driver (alternate version)" | 26 | tristate "HCI USB driver" |
| 27 | depends on USB && EXPERIMENTAL && BT_HCIUSB=n | 27 | depends on USB |
| 28 | help | 28 | help |
| 29 | Bluetooth HCI USB driver. | 29 | Bluetooth HCI USB driver. |
| 30 | This driver is required if you want to use Bluetooth devices with | 30 | This driver is required if you want to use Bluetooth devices with |
| 31 | USB interface. | 31 | USB interface. |
| 32 | 32 | ||
| 33 | This driver is still experimental and has no SCO support. | ||
| 34 | |||
| 35 | Say Y here to compile support for Bluetooth USB devices into the | 33 | Say Y here to compile support for Bluetooth USB devices into the |
| 36 | kernel or say M to compile it as module (btusb). | 34 | kernel or say M to compile it as module (btusb). |
| 37 | 35 | ||
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 593b7c595038..27058477cc8b 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | /* ======================== Module parameters ======================== */ | 60 | /* ======================== Module parameters ======================== */ |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>, Jose Orlando Pereira <jop@di.uminho.pt>"); | 63 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
| 64 | MODULE_DESCRIPTION("Bluetooth driver for the 3Com Bluetooth PCMCIA card"); | 64 | MODULE_DESCRIPTION("Bluetooth driver for the 3Com Bluetooth PCMCIA card"); |
| 65 | MODULE_LICENSE("GPL"); | 65 | MODULE_LICENSE("GPL"); |
| 66 | MODULE_FIRMWARE("BT3CPCC.bin"); | 66 | MODULE_FIRMWARE("BT3CPCC.bin"); |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 95ae9ba5661e..29ae99817c60 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * | 2 | * |
| 3 | * Generic Bluetooth USB driver | 3 | * Generic Bluetooth USB driver |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2005-2007 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2005-2008 Marcel Holtmann <marcel@holtmann.org> |
| 6 | * | 6 | * |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
| @@ -41,7 +41,7 @@ | |||
| 41 | #define BT_DBG(D...) | 41 | #define BT_DBG(D...) |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | #define VERSION "0.2" | 44 | #define VERSION "0.3" |
| 45 | 45 | ||
| 46 | static int ignore_dga; | 46 | static int ignore_dga; |
| 47 | static int ignore_csr; | 47 | static int ignore_csr; |
| @@ -104,6 +104,9 @@ static struct usb_device_id blacklist_table[] = { | |||
| 104 | /* Broadcom BCM2046 */ | 104 | /* Broadcom BCM2046 */ |
| 105 | { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET }, | 105 | { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET }, |
| 106 | 106 | ||
| 107 | /* Apple MacBook Pro with Broadcom chip */ | ||
| 108 | { USB_DEVICE(0x05ac, 0x820f), .driver_info = BTUSB_RESET }, | ||
| 109 | |||
| 107 | /* IBM/Lenovo ThinkPad with Broadcom chip */ | 110 | /* IBM/Lenovo ThinkPad with Broadcom chip */ |
| 108 | { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 111 | { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, |
| 109 | { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 112 | { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, |
| @@ -160,12 +163,17 @@ static struct usb_device_id blacklist_table[] = { | |||
| 160 | { } /* Terminating entry */ | 163 | { } /* Terminating entry */ |
| 161 | }; | 164 | }; |
| 162 | 165 | ||
| 166 | #define BTUSB_MAX_ISOC_FRAMES 10 | ||
| 167 | |||
| 163 | #define BTUSB_INTR_RUNNING 0 | 168 | #define BTUSB_INTR_RUNNING 0 |
| 164 | #define BTUSB_BULK_RUNNING 1 | 169 | #define BTUSB_BULK_RUNNING 1 |
| 170 | #define BTUSB_ISOC_RUNNING 2 | ||
| 165 | 171 | ||
| 166 | struct btusb_data { | 172 | struct btusb_data { |
| 167 | struct hci_dev *hdev; | 173 | struct hci_dev *hdev; |
| 168 | struct usb_device *udev; | 174 | struct usb_device *udev; |
| 175 | struct usb_interface *intf; | ||
| 176 | struct usb_interface *isoc; | ||
| 169 | 177 | ||
| 170 | spinlock_t lock; | 178 | spinlock_t lock; |
| 171 | 179 | ||
| @@ -176,10 +184,15 @@ struct btusb_data { | |||
| 176 | struct usb_anchor tx_anchor; | 184 | struct usb_anchor tx_anchor; |
| 177 | struct usb_anchor intr_anchor; | 185 | struct usb_anchor intr_anchor; |
| 178 | struct usb_anchor bulk_anchor; | 186 | struct usb_anchor bulk_anchor; |
| 187 | struct usb_anchor isoc_anchor; | ||
| 179 | 188 | ||
| 180 | struct usb_endpoint_descriptor *intr_ep; | 189 | struct usb_endpoint_descriptor *intr_ep; |
| 181 | struct usb_endpoint_descriptor *bulk_tx_ep; | 190 | struct usb_endpoint_descriptor *bulk_tx_ep; |
| 182 | struct usb_endpoint_descriptor *bulk_rx_ep; | 191 | struct usb_endpoint_descriptor *bulk_rx_ep; |
| 192 | struct usb_endpoint_descriptor *isoc_tx_ep; | ||
| 193 | struct usb_endpoint_descriptor *isoc_rx_ep; | ||
| 194 | |||
| 195 | int isoc_altsetting; | ||
| 183 | }; | 196 | }; |
| 184 | 197 | ||
| 185 | static void btusb_intr_complete(struct urb *urb) | 198 | static void btusb_intr_complete(struct urb *urb) |
| @@ -195,6 +208,8 @@ static void btusb_intr_complete(struct urb *urb) | |||
| 195 | return; | 208 | return; |
| 196 | 209 | ||
| 197 | if (urb->status == 0) { | 210 | if (urb->status == 0) { |
| 211 | hdev->stat.byte_rx += urb->actual_length; | ||
| 212 | |||
| 198 | if (hci_recv_fragment(hdev, HCI_EVENT_PKT, | 213 | if (hci_recv_fragment(hdev, HCI_EVENT_PKT, |
| 199 | urb->transfer_buffer, | 214 | urb->transfer_buffer, |
| 200 | urb->actual_length) < 0) { | 215 | urb->actual_length) < 0) { |
| @@ -216,7 +231,7 @@ static void btusb_intr_complete(struct urb *urb) | |||
| 216 | } | 231 | } |
| 217 | } | 232 | } |
| 218 | 233 | ||
| 219 | static inline int btusb_submit_intr_urb(struct hci_dev *hdev) | 234 | static int btusb_submit_intr_urb(struct hci_dev *hdev) |
| 220 | { | 235 | { |
| 221 | struct btusb_data *data = hdev->driver_data; | 236 | struct btusb_data *data = hdev->driver_data; |
| 222 | struct urb *urb; | 237 | struct urb *urb; |
| @@ -226,6 +241,9 @@ static inline int btusb_submit_intr_urb(struct hci_dev *hdev) | |||
| 226 | 241 | ||
| 227 | BT_DBG("%s", hdev->name); | 242 | BT_DBG("%s", hdev->name); |
| 228 | 243 | ||
| 244 | if (!data->intr_ep) | ||
| 245 | return -ENODEV; | ||
| 246 | |||
| 229 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 247 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 230 | if (!urb) | 248 | if (!urb) |
| 231 | return -ENOMEM; | 249 | return -ENOMEM; |
| @@ -274,6 +292,8 @@ static void btusb_bulk_complete(struct urb *urb) | |||
| 274 | return; | 292 | return; |
| 275 | 293 | ||
| 276 | if (urb->status == 0) { | 294 | if (urb->status == 0) { |
| 295 | hdev->stat.byte_rx += urb->actual_length; | ||
| 296 | |||
| 277 | if (hci_recv_fragment(hdev, HCI_ACLDATA_PKT, | 297 | if (hci_recv_fragment(hdev, HCI_ACLDATA_PKT, |
| 278 | urb->transfer_buffer, | 298 | urb->transfer_buffer, |
| 279 | urb->actual_length) < 0) { | 299 | urb->actual_length) < 0) { |
| @@ -295,7 +315,7 @@ static void btusb_bulk_complete(struct urb *urb) | |||
| 295 | } | 315 | } |
| 296 | } | 316 | } |
| 297 | 317 | ||
| 298 | static inline int btusb_submit_bulk_urb(struct hci_dev *hdev) | 318 | static int btusb_submit_bulk_urb(struct hci_dev *hdev) |
| 299 | { | 319 | { |
| 300 | struct btusb_data *data = hdev->driver_data; | 320 | struct btusb_data *data = hdev->driver_data; |
| 301 | struct urb *urb; | 321 | struct urb *urb; |
| @@ -305,6 +325,9 @@ static inline int btusb_submit_bulk_urb(struct hci_dev *hdev) | |||
| 305 | 325 | ||
| 306 | BT_DBG("%s", hdev->name); | 326 | BT_DBG("%s", hdev->name); |
| 307 | 327 | ||
| 328 | if (!data->bulk_rx_ep) | ||
| 329 | return -ENODEV; | ||
| 330 | |||
| 308 | urb = usb_alloc_urb(0, GFP_KERNEL); | 331 | urb = usb_alloc_urb(0, GFP_KERNEL); |
| 309 | if (!urb) | 332 | if (!urb) |
| 310 | return -ENOMEM; | 333 | return -ENOMEM; |
| @@ -339,6 +362,127 @@ static inline int btusb_submit_bulk_urb(struct hci_dev *hdev) | |||
| 339 | return err; | 362 | return err; |
| 340 | } | 363 | } |
| 341 | 364 | ||
| 365 | static void btusb_isoc_complete(struct urb *urb) | ||
| 366 | { | ||
| 367 | struct hci_dev *hdev = urb->context; | ||
| 368 | struct btusb_data *data = hdev->driver_data; | ||
| 369 | int i, err; | ||
| 370 | |||
| 371 | BT_DBG("%s urb %p status %d count %d", hdev->name, | ||
| 372 | urb, urb->status, urb->actual_length); | ||
| 373 | |||
| 374 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | ||
| 375 | return; | ||
| 376 | |||
| 377 | if (urb->status == 0) { | ||
| 378 | for (i = 0; i < urb->number_of_packets; i++) { | ||
| 379 | unsigned int offset = urb->iso_frame_desc[i].offset; | ||
| 380 | unsigned int length = urb->iso_frame_desc[i].actual_length; | ||
| 381 | |||
| 382 | if (urb->iso_frame_desc[i].status) | ||
| 383 | continue; | ||
| 384 | |||
| 385 | hdev->stat.byte_rx += length; | ||
| 386 | |||
| 387 | if (hci_recv_fragment(hdev, HCI_SCODATA_PKT, | ||
| 388 | urb->transfer_buffer + offset, | ||
| 389 | length) < 0) { | ||
| 390 | BT_ERR("%s corrupted SCO packet", hdev->name); | ||
| 391 | hdev->stat.err_rx++; | ||
| 392 | } | ||
| 393 | } | ||
| 394 | } | ||
| 395 | |||
| 396 | if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags)) | ||
| 397 | return; | ||
| 398 | |||
| 399 | usb_anchor_urb(urb, &data->isoc_anchor); | ||
| 400 | |||
| 401 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
| 402 | if (err < 0) { | ||
| 403 | BT_ERR("%s urb %p failed to resubmit (%d)", | ||
| 404 | hdev->name, urb, -err); | ||
| 405 | usb_unanchor_urb(urb); | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 409 | static void inline __fill_isoc_descriptor(struct urb *urb, int len, int mtu) | ||
| 410 | { | ||
| 411 | int i, offset = 0; | ||
| 412 | |||
| 413 | BT_DBG("len %d mtu %d", len, mtu); | ||
| 414 | |||
| 415 | for (i = 0; i < BTUSB_MAX_ISOC_FRAMES && len >= mtu; | ||
| 416 | i++, offset += mtu, len -= mtu) { | ||
| 417 | urb->iso_frame_desc[i].offset = offset; | ||
| 418 | urb->iso_frame_desc[i].length = mtu; | ||
| 419 | } | ||
| 420 | |||
| 421 | if (len && i < BTUSB_MAX_ISOC_FRAMES) { | ||
| 422 | urb->iso_frame_desc[i].offset = offset; | ||
| 423 | urb->iso_frame_desc[i].length = len; | ||
| 424 | i++; | ||
| 425 | } | ||
| 426 | |||
| 427 | urb->number_of_packets = i; | ||
| 428 | } | ||
| 429 | |||
| 430 | static int btusb_submit_isoc_urb(struct hci_dev *hdev) | ||
| 431 | { | ||
| 432 | struct btusb_data *data = hdev->driver_data; | ||
| 433 | struct urb *urb; | ||
| 434 | unsigned char *buf; | ||
| 435 | unsigned int pipe; | ||
| 436 | int err, size; | ||
| 437 | |||
| 438 | BT_DBG("%s", hdev->name); | ||
| 439 | |||
| 440 | if (!data->isoc_rx_ep) | ||
| 441 | return -ENODEV; | ||
| 442 | |||
| 443 | urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_KERNEL); | ||
| 444 | if (!urb) | ||
| 445 | return -ENOMEM; | ||
| 446 | |||
| 447 | size = le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize) * | ||
| 448 | BTUSB_MAX_ISOC_FRAMES; | ||
| 449 | |||
| 450 | buf = kmalloc(size, GFP_KERNEL); | ||
| 451 | if (!buf) { | ||
| 452 | usb_free_urb(urb); | ||
| 453 | return -ENOMEM; | ||
| 454 | } | ||
| 455 | |||
| 456 | pipe = usb_rcvisocpipe(data->udev, data->isoc_rx_ep->bEndpointAddress); | ||
| 457 | |||
| 458 | urb->dev = data->udev; | ||
| 459 | urb->pipe = pipe; | ||
| 460 | urb->context = hdev; | ||
| 461 | urb->complete = btusb_isoc_complete; | ||
| 462 | urb->interval = data->isoc_rx_ep->bInterval; | ||
| 463 | |||
| 464 | urb->transfer_flags = URB_FREE_BUFFER | URB_ISO_ASAP; | ||
| 465 | urb->transfer_buffer = buf; | ||
| 466 | urb->transfer_buffer_length = size; | ||
| 467 | |||
| 468 | __fill_isoc_descriptor(urb, size, | ||
| 469 | le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize)); | ||
| 470 | |||
| 471 | usb_anchor_urb(urb, &data->isoc_anchor); | ||
| 472 | |||
| 473 | err = usb_submit_urb(urb, GFP_KERNEL); | ||
| 474 | if (err < 0) { | ||
| 475 | BT_ERR("%s urb %p submission failed (%d)", | ||
| 476 | hdev->name, urb, -err); | ||
| 477 | usb_unanchor_urb(urb); | ||
| 478 | kfree(buf); | ||
| 479 | } | ||
| 480 | |||
| 481 | usb_free_urb(urb); | ||
| 482 | |||
| 483 | return err; | ||
| 484 | } | ||
| 485 | |||
| 342 | static void btusb_tx_complete(struct urb *urb) | 486 | static void btusb_tx_complete(struct urb *urb) |
| 343 | { | 487 | { |
| 344 | struct sk_buff *skb = urb->context; | 488 | struct sk_buff *skb = urb->context; |
| @@ -376,7 +520,7 @@ static int btusb_open(struct hci_dev *hdev) | |||
| 376 | 520 | ||
| 377 | err = btusb_submit_intr_urb(hdev); | 521 | err = btusb_submit_intr_urb(hdev); |
| 378 | if (err < 0) { | 522 | if (err < 0) { |
| 379 | clear_bit(BTUSB_INTR_RUNNING, &hdev->flags); | 523 | clear_bit(BTUSB_INTR_RUNNING, &data->flags); |
| 380 | clear_bit(HCI_RUNNING, &hdev->flags); | 524 | clear_bit(HCI_RUNNING, &hdev->flags); |
| 381 | } | 525 | } |
| 382 | 526 | ||
| @@ -392,6 +536,11 @@ static int btusb_close(struct hci_dev *hdev) | |||
| 392 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) | 536 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) |
| 393 | return 0; | 537 | return 0; |
| 394 | 538 | ||
| 539 | cancel_work_sync(&data->work); | ||
| 540 | |||
| 541 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | ||
| 542 | usb_kill_anchored_urbs(&data->isoc_anchor); | ||
| 543 | |||
| 395 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | 544 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); |
| 396 | usb_kill_anchored_urbs(&data->bulk_anchor); | 545 | usb_kill_anchored_urbs(&data->bulk_anchor); |
| 397 | 546 | ||
| @@ -453,6 +602,9 @@ static int btusb_send_frame(struct sk_buff *skb) | |||
| 453 | break; | 602 | break; |
| 454 | 603 | ||
| 455 | case HCI_ACLDATA_PKT: | 604 | case HCI_ACLDATA_PKT: |
| 605 | if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1) | ||
| 606 | return -ENODEV; | ||
| 607 | |||
| 456 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 608 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 457 | if (!urb) | 609 | if (!urb) |
| 458 | return -ENOMEM; | 610 | return -ENOMEM; |
| @@ -467,9 +619,31 @@ static int btusb_send_frame(struct sk_buff *skb) | |||
| 467 | break; | 619 | break; |
| 468 | 620 | ||
| 469 | case HCI_SCODATA_PKT: | 621 | case HCI_SCODATA_PKT: |
| 622 | if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1) | ||
| 623 | return -ENODEV; | ||
| 624 | |||
| 625 | urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC); | ||
| 626 | if (!urb) | ||
| 627 | return -ENOMEM; | ||
| 628 | |||
| 629 | pipe = usb_sndisocpipe(data->udev, | ||
| 630 | data->isoc_tx_ep->bEndpointAddress); | ||
| 631 | |||
| 632 | urb->dev = data->udev; | ||
| 633 | urb->pipe = pipe; | ||
| 634 | urb->context = skb; | ||
| 635 | urb->complete = btusb_tx_complete; | ||
| 636 | urb->interval = data->isoc_tx_ep->bInterval; | ||
| 637 | |||
| 638 | urb->transfer_flags = URB_ISO_ASAP; | ||
| 639 | urb->transfer_buffer = skb->data; | ||
| 640 | urb->transfer_buffer_length = skb->len; | ||
| 641 | |||
| 642 | __fill_isoc_descriptor(urb, skb->len, | ||
| 643 | le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize)); | ||
| 644 | |||
| 470 | hdev->stat.sco_tx++; | 645 | hdev->stat.sco_tx++; |
| 471 | kfree_skb(skb); | 646 | break; |
| 472 | return 0; | ||
| 473 | 647 | ||
| 474 | default: | 648 | default: |
| 475 | return -EILSEQ; | 649 | return -EILSEQ; |
| @@ -508,22 +682,86 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt) | |||
| 508 | schedule_work(&data->work); | 682 | schedule_work(&data->work); |
| 509 | } | 683 | } |
| 510 | 684 | ||
| 685 | static int inline __set_isoc_interface(struct hci_dev *hdev, int altsetting) | ||
| 686 | { | ||
| 687 | struct btusb_data *data = hdev->driver_data; | ||
| 688 | struct usb_interface *intf = data->isoc; | ||
| 689 | struct usb_endpoint_descriptor *ep_desc; | ||
| 690 | int i, err; | ||
| 691 | |||
| 692 | if (!data->isoc) | ||
| 693 | return -ENODEV; | ||
| 694 | |||
| 695 | err = usb_set_interface(data->udev, 1, altsetting); | ||
| 696 | if (err < 0) { | ||
| 697 | BT_ERR("%s setting interface failed (%d)", hdev->name, -err); | ||
| 698 | return err; | ||
| 699 | } | ||
| 700 | |||
| 701 | data->isoc_altsetting = altsetting; | ||
| 702 | |||
| 703 | data->isoc_tx_ep = NULL; | ||
| 704 | data->isoc_rx_ep = NULL; | ||
| 705 | |||
| 706 | for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) { | ||
| 707 | ep_desc = &intf->cur_altsetting->endpoint[i].desc; | ||
| 708 | |||
| 709 | if (!data->isoc_tx_ep && usb_endpoint_is_isoc_out(ep_desc)) { | ||
| 710 | data->isoc_tx_ep = ep_desc; | ||
| 711 | continue; | ||
| 712 | } | ||
| 713 | |||
| 714 | if (!data->isoc_rx_ep && usb_endpoint_is_isoc_in(ep_desc)) { | ||
| 715 | data->isoc_rx_ep = ep_desc; | ||
| 716 | continue; | ||
| 717 | } | ||
| 718 | } | ||
| 719 | |||
| 720 | if (!data->isoc_tx_ep || !data->isoc_rx_ep) { | ||
| 721 | BT_ERR("%s invalid SCO descriptors", hdev->name); | ||
| 722 | return -ENODEV; | ||
| 723 | } | ||
| 724 | |||
| 725 | return 0; | ||
| 726 | } | ||
| 727 | |||
| 511 | static void btusb_work(struct work_struct *work) | 728 | static void btusb_work(struct work_struct *work) |
| 512 | { | 729 | { |
| 513 | struct btusb_data *data = container_of(work, struct btusb_data, work); | 730 | struct btusb_data *data = container_of(work, struct btusb_data, work); |
| 514 | struct hci_dev *hdev = data->hdev; | 731 | struct hci_dev *hdev = data->hdev; |
| 515 | 732 | ||
| 516 | if (hdev->conn_hash.acl_num == 0) { | 733 | if (hdev->conn_hash.acl_num > 0) { |
| 734 | if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) { | ||
| 735 | if (btusb_submit_bulk_urb(hdev) < 0) | ||
| 736 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
| 737 | else | ||
| 738 | btusb_submit_bulk_urb(hdev); | ||
| 739 | } | ||
| 740 | } else { | ||
| 517 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | 741 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); |
| 518 | usb_kill_anchored_urbs(&data->bulk_anchor); | 742 | usb_kill_anchored_urbs(&data->bulk_anchor); |
| 519 | return; | ||
| 520 | } | 743 | } |
| 521 | 744 | ||
| 522 | if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) { | 745 | if (hdev->conn_hash.sco_num > 0) { |
| 523 | if (btusb_submit_bulk_urb(hdev) < 0) | 746 | if (data->isoc_altsetting != 2) { |
| 524 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | 747 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
| 525 | else | 748 | usb_kill_anchored_urbs(&data->isoc_anchor); |
| 526 | btusb_submit_bulk_urb(hdev); | 749 | |
| 750 | if (__set_isoc_interface(hdev, 2) < 0) | ||
| 751 | return; | ||
| 752 | } | ||
| 753 | |||
| 754 | if (!test_and_set_bit(BTUSB_ISOC_RUNNING, &data->flags)) { | ||
| 755 | if (btusb_submit_isoc_urb(hdev) < 0) | ||
| 756 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | ||
| 757 | else | ||
| 758 | btusb_submit_isoc_urb(hdev); | ||
| 759 | } | ||
| 760 | } else { | ||
| 761 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | ||
| 762 | usb_kill_anchored_urbs(&data->isoc_anchor); | ||
| 763 | |||
| 764 | __set_isoc_interface(hdev, 0); | ||
| 527 | } | 765 | } |
| 528 | } | 766 | } |
| 529 | 767 | ||
| @@ -589,6 +827,7 @@ static int btusb_probe(struct usb_interface *intf, | |||
| 589 | } | 827 | } |
| 590 | 828 | ||
| 591 | data->udev = interface_to_usbdev(intf); | 829 | data->udev = interface_to_usbdev(intf); |
| 830 | data->intf = intf; | ||
| 592 | 831 | ||
| 593 | spin_lock_init(&data->lock); | 832 | spin_lock_init(&data->lock); |
| 594 | 833 | ||
| @@ -597,6 +836,7 @@ static int btusb_probe(struct usb_interface *intf, | |||
| 597 | init_usb_anchor(&data->tx_anchor); | 836 | init_usb_anchor(&data->tx_anchor); |
| 598 | init_usb_anchor(&data->intr_anchor); | 837 | init_usb_anchor(&data->intr_anchor); |
| 599 | init_usb_anchor(&data->bulk_anchor); | 838 | init_usb_anchor(&data->bulk_anchor); |
| 839 | init_usb_anchor(&data->isoc_anchor); | ||
| 600 | 840 | ||
| 601 | hdev = hci_alloc_dev(); | 841 | hdev = hci_alloc_dev(); |
| 602 | if (!hdev) { | 842 | if (!hdev) { |
| @@ -620,6 +860,9 @@ static int btusb_probe(struct usb_interface *intf, | |||
| 620 | 860 | ||
| 621 | hdev->owner = THIS_MODULE; | 861 | hdev->owner = THIS_MODULE; |
| 622 | 862 | ||
| 863 | /* interface numbers are hardcoded in the spec */ | ||
| 864 | data->isoc = usb_ifnum_to_if(data->udev, 1); | ||
| 865 | |||
| 623 | if (reset || id->driver_info & BTUSB_RESET) | 866 | if (reset || id->driver_info & BTUSB_RESET) |
| 624 | set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks); | 867 | set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks); |
| 625 | 868 | ||
| @@ -628,11 +871,16 @@ static int btusb_probe(struct usb_interface *intf, | |||
| 628 | set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks); | 871 | set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks); |
| 629 | } | 872 | } |
| 630 | 873 | ||
| 874 | if (id->driver_info & BTUSB_BROKEN_ISOC) | ||
| 875 | data->isoc = NULL; | ||
| 876 | |||
| 631 | if (id->driver_info & BTUSB_SNIFFER) { | 877 | if (id->driver_info & BTUSB_SNIFFER) { |
| 632 | struct usb_device *udev = interface_to_usbdev(intf); | 878 | struct usb_device *udev = data->udev; |
| 633 | 879 | ||
| 634 | if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997) | 880 | if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997) |
| 635 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | 881 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); |
| 882 | |||
| 883 | data->isoc = NULL; | ||
| 636 | } | 884 | } |
| 637 | 885 | ||
| 638 | if (id->driver_info & BTUSB_BCM92035) { | 886 | if (id->driver_info & BTUSB_BCM92035) { |
| @@ -646,6 +894,16 @@ static int btusb_probe(struct usb_interface *intf, | |||
| 646 | } | 894 | } |
| 647 | } | 895 | } |
| 648 | 896 | ||
| 897 | if (data->isoc) { | ||
| 898 | err = usb_driver_claim_interface(&btusb_driver, | ||
| 899 | data->isoc, data); | ||
| 900 | if (err < 0) { | ||
| 901 | hci_free_dev(hdev); | ||
| 902 | kfree(data); | ||
| 903 | return err; | ||
| 904 | } | ||
| 905 | } | ||
| 906 | |||
| 649 | err = hci_register_dev(hdev); | 907 | err = hci_register_dev(hdev); |
| 650 | if (err < 0) { | 908 | if (err < 0) { |
| 651 | hci_free_dev(hdev); | 909 | hci_free_dev(hdev); |
| @@ -670,10 +928,22 @@ static void btusb_disconnect(struct usb_interface *intf) | |||
| 670 | 928 | ||
| 671 | hdev = data->hdev; | 929 | hdev = data->hdev; |
| 672 | 930 | ||
| 673 | usb_set_intfdata(intf, NULL); | 931 | __hci_dev_hold(hdev); |
| 932 | |||
| 933 | usb_set_intfdata(data->intf, NULL); | ||
| 934 | |||
| 935 | if (data->isoc) | ||
| 936 | usb_set_intfdata(data->isoc, NULL); | ||
| 674 | 937 | ||
| 675 | hci_unregister_dev(hdev); | 938 | hci_unregister_dev(hdev); |
| 676 | 939 | ||
| 940 | if (intf == data->isoc) | ||
| 941 | usb_driver_release_interface(&btusb_driver, data->intf); | ||
| 942 | else if (data->isoc) | ||
| 943 | usb_driver_release_interface(&btusb_driver, data->isoc); | ||
| 944 | |||
| 945 | __hci_dev_put(hdev); | ||
| 946 | |||
| 677 | hci_free_dev(hdev); | 947 | hci_free_dev(hdev); |
| 678 | } | 948 | } |
| 679 | 949 | ||
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 69df187d74ce..8dfcf77cb717 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
| @@ -577,7 +577,7 @@ module_exit(hci_uart_exit); | |||
| 577 | module_param(reset, bool, 0644); | 577 | module_param(reset, bool, 0644); |
| 578 | MODULE_PARM_DESC(reset, "Send HCI reset command on initialization"); | 578 | MODULE_PARM_DESC(reset, "Send HCI reset command on initialization"); |
| 579 | 579 | ||
| 580 | MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); | 580 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
| 581 | MODULE_DESCRIPTION("Bluetooth HCI UART driver ver " VERSION); | 581 | MODULE_DESCRIPTION("Bluetooth HCI UART driver ver " VERSION); |
| 582 | MODULE_VERSION(VERSION); | 582 | MODULE_VERSION(VERSION); |
| 583 | MODULE_LICENSE("GPL"); | 583 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index e397572bf574..3c453924f838 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c | |||
| @@ -1130,7 +1130,7 @@ module_param(isoc, int, 0644); | |||
| 1130 | MODULE_PARM_DESC(isoc, "Set isochronous transfers for SCO over HCI support"); | 1130 | MODULE_PARM_DESC(isoc, "Set isochronous transfers for SCO over HCI support"); |
| 1131 | #endif | 1131 | #endif |
| 1132 | 1132 | ||
| 1133 | MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); | 1133 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
| 1134 | MODULE_DESCRIPTION("Bluetooth HCI USB driver ver " VERSION); | 1134 | MODULE_DESCRIPTION("Bluetooth HCI USB driver ver " VERSION); |
| 1135 | MODULE_VERSION(VERSION); | 1135 | MODULE_VERSION(VERSION); |
| 1136 | MODULE_LICENSE("GPL"); | 1136 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index d97700aa54a9..7320a71b6368 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c | |||
| @@ -377,7 +377,7 @@ module_exit(vhci_exit); | |||
| 377 | module_param(minor, int, 0444); | 377 | module_param(minor, int, 0444); |
| 378 | MODULE_PARM_DESC(minor, "Miscellaneous minor device number"); | 378 | MODULE_PARM_DESC(minor, "Miscellaneous minor device number"); |
| 379 | 379 | ||
| 380 | MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>"); | 380 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
| 381 | MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION); | 381 | MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION); |
| 382 | MODULE_VERSION(VERSION); | 382 | MODULE_VERSION(VERSION); |
| 383 | MODULE_LICENSE("GPL"); | 383 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index d9d1b65d206c..74031de517e6 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
| @@ -408,7 +408,6 @@ int register_cdrom(struct cdrom_device_info *cdi) | |||
| 408 | ENSURE(get_last_session, CDC_MULTI_SESSION); | 408 | ENSURE(get_last_session, CDC_MULTI_SESSION); |
| 409 | ENSURE(get_mcn, CDC_MCN); | 409 | ENSURE(get_mcn, CDC_MCN); |
| 410 | ENSURE(reset, CDC_RESET); | 410 | ENSURE(reset, CDC_RESET); |
| 411 | ENSURE(audio_ioctl, CDC_PLAY_AUDIO); | ||
| 412 | ENSURE(generic_packet, CDC_GENERIC_PACKET); | 411 | ENSURE(generic_packet, CDC_GENERIC_PACKET); |
| 413 | cdi->mc_flags = 0; | 412 | cdi->mc_flags = 0; |
| 414 | cdo->n_minors = 0; | 413 | cdo->n_minors = 0; |
| @@ -2506,8 +2505,6 @@ static int cdrom_ioctl_get_subchnl(struct cdrom_device_info *cdi, | |||
| 2506 | 2505 | ||
| 2507 | /* cdinfo(CD_DO_IOCTL,"entering CDROMSUBCHNL\n");*/ | 2506 | /* cdinfo(CD_DO_IOCTL,"entering CDROMSUBCHNL\n");*/ |
| 2508 | 2507 | ||
| 2509 | if (!CDROM_CAN(CDC_PLAY_AUDIO)) | ||
| 2510 | return -ENOSYS; | ||
| 2511 | if (copy_from_user(&q, argp, sizeof(q))) | 2508 | if (copy_from_user(&q, argp, sizeof(q))) |
| 2512 | return -EFAULT; | 2509 | return -EFAULT; |
| 2513 | 2510 | ||
| @@ -2538,8 +2535,6 @@ static int cdrom_ioctl_read_tochdr(struct cdrom_device_info *cdi, | |||
| 2538 | 2535 | ||
| 2539 | /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCHDR\n"); */ | 2536 | /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCHDR\n"); */ |
| 2540 | 2537 | ||
| 2541 | if (!CDROM_CAN(CDC_PLAY_AUDIO)) | ||
| 2542 | return -ENOSYS; | ||
| 2543 | if (copy_from_user(&header, argp, sizeof(header))) | 2538 | if (copy_from_user(&header, argp, sizeof(header))) |
| 2544 | return -EFAULT; | 2539 | return -EFAULT; |
| 2545 | 2540 | ||
| @@ -2562,8 +2557,6 @@ static int cdrom_ioctl_read_tocentry(struct cdrom_device_info *cdi, | |||
| 2562 | 2557 | ||
| 2563 | /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCENTRY\n"); */ | 2558 | /* cdinfo(CD_DO_IOCTL, "entering CDROMREADTOCENTRY\n"); */ |
| 2564 | 2559 | ||
| 2565 | if (!CDROM_CAN(CDC_PLAY_AUDIO)) | ||
| 2566 | return -ENOSYS; | ||
| 2567 | if (copy_from_user(&entry, argp, sizeof(entry))) | 2560 | if (copy_from_user(&entry, argp, sizeof(entry))) |
| 2568 | return -EFAULT; | 2561 | return -EFAULT; |
| 2569 | 2562 | ||
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 1e0455bd6df9..1231d95aa695 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
| @@ -471,6 +471,12 @@ cleanup_sense_final: | |||
| 471 | return err; | 471 | return err; |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | static int gdrom_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, | ||
| 475 | void *arg) | ||
| 476 | { | ||
| 477 | return -EINVAL; | ||
| 478 | } | ||
| 479 | |||
| 474 | static struct cdrom_device_ops gdrom_ops = { | 480 | static struct cdrom_device_ops gdrom_ops = { |
| 475 | .open = gdrom_open, | 481 | .open = gdrom_open, |
| 476 | .release = gdrom_release, | 482 | .release = gdrom_release, |
| @@ -478,6 +484,7 @@ static struct cdrom_device_ops gdrom_ops = { | |||
| 478 | .media_changed = gdrom_mediachanged, | 484 | .media_changed = gdrom_mediachanged, |
| 479 | .get_last_session = gdrom_get_last_session, | 485 | .get_last_session = gdrom_get_last_session, |
| 480 | .reset = gdrom_hardreset, | 486 | .reset = gdrom_hardreset, |
| 487 | .audio_ioctl = gdrom_audio_ioctl, | ||
| 481 | .capability = CDC_MULTI_SESSION | CDC_MEDIA_CHANGED | | 488 | .capability = CDC_MULTI_SESSION | CDC_MEDIA_CHANGED | |
| 482 | CDC_RESET | CDC_DRIVE_STATUS | CDC_CD_R, | 489 | CDC_RESET | CDC_DRIVE_STATUS | CDC_CD_R, |
| 483 | .n_minors = 1, | 490 | .n_minors = 1, |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index 9d0dfe6e0d63..031e0e1a1a3b 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
| @@ -550,12 +550,19 @@ return_complete: | |||
| 550 | } | 550 | } |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | static int viocd_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, | ||
| 554 | void *arg) | ||
| 555 | { | ||
| 556 | return -EINVAL; | ||
| 557 | } | ||
| 558 | |||
| 553 | static struct cdrom_device_ops viocd_dops = { | 559 | static struct cdrom_device_ops viocd_dops = { |
| 554 | .open = viocd_open, | 560 | .open = viocd_open, |
| 555 | .release = viocd_release, | 561 | .release = viocd_release, |
| 556 | .media_changed = viocd_media_changed, | 562 | .media_changed = viocd_media_changed, |
| 557 | .lock_door = viocd_lock_door, | 563 | .lock_door = viocd_lock_door, |
| 558 | .generic_packet = viocd_packet, | 564 | .generic_packet = viocd_packet, |
| 565 | .audio_ioctl = viocd_audio_ioctl, | ||
| 559 | .capability = CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_SELECT_SPEED | CDC_SELECT_DISC | CDC_MULTI_SESSION | CDC_MCN | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO | CDC_RESET | CDC_DRIVE_STATUS | CDC_GENERIC_PACKET | CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R | CDC_DVD_RAM | CDC_RAM | 566 | .capability = CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_SELECT_SPEED | CDC_SELECT_DISC | CDC_MULTI_SESSION | CDC_MCN | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO | CDC_RESET | CDC_DRIVE_STATUS | CDC_GENERIC_PACKET | CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R | CDC_DVD_RAM | CDC_RAM |
| 560 | }; | 567 | }; |
| 561 | 568 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index f52931e1c16e..8e8afb6141f9 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
| @@ -2695,15 +2695,13 @@ static __devinit void default_find_bmc(void) | |||
| 2695 | for (i = 0; ; i++) { | 2695 | for (i = 0; ; i++) { |
| 2696 | if (!ipmi_defaults[i].port) | 2696 | if (!ipmi_defaults[i].port) |
| 2697 | break; | 2697 | break; |
| 2698 | |||
| 2699 | info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
| 2700 | if (!info) | ||
| 2701 | return; | ||
| 2702 | |||
| 2703 | #ifdef CONFIG_PPC_MERGE | 2698 | #ifdef CONFIG_PPC_MERGE |
| 2704 | if (check_legacy_ioport(ipmi_defaults[i].port)) | 2699 | if (check_legacy_ioport(ipmi_defaults[i].port)) |
| 2705 | continue; | 2700 | continue; |
| 2706 | #endif | 2701 | #endif |
| 2702 | info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
| 2703 | if (!info) | ||
| 2704 | return; | ||
| 2707 | 2705 | ||
| 2708 | info->addr_source = NULL; | 2706 | info->addr_source = NULL; |
| 2709 | 2707 | ||
diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/char/pcmcia/ipwireless/tty.c index b1414507997c..3a23e7694d55 100644 --- a/drivers/char/pcmcia/ipwireless/tty.c +++ b/drivers/char/pcmcia/ipwireless/tty.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | #include <linux/tty_driver.h> | 29 | #include <linux/tty_driver.h> |
| 30 | #include <linux/tty_flip.h> | 30 | #include <linux/tty_flip.h> |
| 31 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
| 32 | #include <linux/version.h> | ||
| 33 | 32 | ||
| 34 | #include "tty.h" | 33 | #include "tty.h" |
| 35 | #include "network.h" | 34 | #include "network.h" |
diff --git a/drivers/char/random.c b/drivers/char/random.c index e0d0e371909c..7ce1ac4baa6d 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
| @@ -407,7 +407,7 @@ struct entropy_store { | |||
| 407 | /* read-write data: */ | 407 | /* read-write data: */ |
| 408 | spinlock_t lock; | 408 | spinlock_t lock; |
| 409 | unsigned add_ptr; | 409 | unsigned add_ptr; |
| 410 | int entropy_count; | 410 | int entropy_count; /* Must at no time exceed ->POOLBITS! */ |
| 411 | int input_rotate; | 411 | int input_rotate; |
| 412 | }; | 412 | }; |
| 413 | 413 | ||
| @@ -520,6 +520,7 @@ static void mix_pool_bytes(struct entropy_store *r, const void *in, int bytes) | |||
| 520 | static void credit_entropy_bits(struct entropy_store *r, int nbits) | 520 | static void credit_entropy_bits(struct entropy_store *r, int nbits) |
| 521 | { | 521 | { |
| 522 | unsigned long flags; | 522 | unsigned long flags; |
| 523 | int entropy_count; | ||
| 523 | 524 | ||
| 524 | if (!nbits) | 525 | if (!nbits) |
| 525 | return; | 526 | return; |
| @@ -527,20 +528,20 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits) | |||
| 527 | spin_lock_irqsave(&r->lock, flags); | 528 | spin_lock_irqsave(&r->lock, flags); |
| 528 | 529 | ||
| 529 | DEBUG_ENT("added %d entropy credits to %s\n", nbits, r->name); | 530 | DEBUG_ENT("added %d entropy credits to %s\n", nbits, r->name); |
| 530 | r->entropy_count += nbits; | 531 | entropy_count = r->entropy_count; |
| 531 | if (r->entropy_count < 0) { | 532 | entropy_count += nbits; |
| 533 | if (entropy_count < 0) { | ||
| 532 | DEBUG_ENT("negative entropy/overflow\n"); | 534 | DEBUG_ENT("negative entropy/overflow\n"); |
| 533 | r->entropy_count = 0; | 535 | entropy_count = 0; |
| 534 | } else if (r->entropy_count > r->poolinfo->POOLBITS) | 536 | } else if (entropy_count > r->poolinfo->POOLBITS) |
| 535 | r->entropy_count = r->poolinfo->POOLBITS; | 537 | entropy_count = r->poolinfo->POOLBITS; |
| 538 | r->entropy_count = entropy_count; | ||
| 536 | 539 | ||
| 537 | /* should we wake readers? */ | 540 | /* should we wake readers? */ |
| 538 | if (r == &input_pool && | 541 | if (r == &input_pool && entropy_count >= random_read_wakeup_thresh) { |
| 539 | r->entropy_count >= random_read_wakeup_thresh) { | ||
| 540 | wake_up_interruptible(&random_read_wait); | 542 | wake_up_interruptible(&random_read_wait); |
| 541 | kill_fasync(&fasync, SIGIO, POLL_IN); | 543 | kill_fasync(&fasync, SIGIO, POLL_IN); |
| 542 | } | 544 | } |
| 543 | |||
| 544 | spin_unlock_irqrestore(&r->lock, flags); | 545 | spin_unlock_irqrestore(&r->lock, flags); |
| 545 | } | 546 | } |
| 546 | 547 | ||
| @@ -1571,6 +1572,7 @@ u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport) | |||
| 1571 | 1572 | ||
| 1572 | return half_md4_transform(hash, keyptr->secret); | 1573 | return half_md4_transform(hash, keyptr->secret); |
| 1573 | } | 1574 | } |
| 1575 | EXPORT_SYMBOL_GPL(secure_ipv4_port_ephemeral); | ||
| 1574 | 1576 | ||
| 1575 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 1577 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 1576 | u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, | 1578 | u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 509c89ac5bd3..08911ed66494 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
| @@ -47,7 +47,6 @@ | |||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
| 50 | #include <linux/version.h> | ||
| 51 | #include <linux/errno.h> | 50 | #include <linux/errno.h> |
| 52 | #include <linux/signal.h> | 51 | #include <linux/signal.h> |
| 53 | #include <linux/sched.h> | 52 | #include <linux/sched.h> |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 0e6866fe0f96..e4dce8709541 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
| @@ -695,13 +695,23 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line) | |||
| 695 | { | 695 | { |
| 696 | struct tty_driver *p, *res = NULL; | 696 | struct tty_driver *p, *res = NULL; |
| 697 | int tty_line = 0; | 697 | int tty_line = 0; |
| 698 | int len; | ||
| 698 | char *str; | 699 | char *str; |
| 699 | 700 | ||
| 701 | for (str = name; *str; str++) | ||
| 702 | if ((*str >= '0' && *str <= '9') || *str == ',') | ||
| 703 | break; | ||
| 704 | if (!*str) | ||
| 705 | return NULL; | ||
| 706 | |||
| 707 | len = str - name; | ||
| 708 | tty_line = simple_strtoul(str, &str, 10); | ||
| 709 | |||
| 700 | mutex_lock(&tty_mutex); | 710 | mutex_lock(&tty_mutex); |
| 701 | /* Search through the tty devices to look for a match */ | 711 | /* Search through the tty devices to look for a match */ |
| 702 | list_for_each_entry(p, &tty_drivers, tty_drivers) { | 712 | list_for_each_entry(p, &tty_drivers, tty_drivers) { |
| 703 | str = name + strlen(p->name); | 713 | if (strncmp(name, p->name, len) != 0) |
| 704 | tty_line = simple_strtoul(str, &str, 10); | 714 | continue; |
| 705 | if (*str == ',') | 715 | if (*str == ',') |
| 706 | str++; | 716 | str++; |
| 707 | if (*str == '\0') | 717 | if (*str == '\0') |
| @@ -2496,45 +2506,26 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg) | |||
| 2496 | } | 2506 | } |
| 2497 | 2507 | ||
| 2498 | /** | 2508 | /** |
| 2499 | * tiocswinsz - implement window size set ioctl | 2509 | * tty_do_resize - resize event |
| 2500 | * @tty; tty | 2510 | * @tty: tty being resized |
| 2501 | * @arg: user buffer for result | 2511 | * @real_tty: real tty (not the same as tty if using a pty/tty pair) |
| 2502 | * | 2512 | * @rows: rows (character) |
| 2503 | * Copies the user idea of the window size to the kernel. Traditionally | 2513 | * @cols: cols (character) |
| 2504 | * this is just advisory information but for the Linux console it | ||
| 2505 | * actually has driver level meaning and triggers a VC resize. | ||
| 2506 | * | 2514 | * |
| 2507 | * Locking: | 2515 | * Update the termios variables and send the neccessary signals to |
| 2508 | * Called function use the console_sem is used to ensure we do | 2516 | * peform a terminal resize correctly |
| 2509 | * not try and resize the console twice at once. | ||
| 2510 | * The tty->termios_mutex is used to ensure we don't double | ||
| 2511 | * resize and get confused. Lock order - tty->termios_mutex before | ||
| 2512 | * console sem | ||
| 2513 | */ | 2517 | */ |
| 2514 | 2518 | ||
| 2515 | static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, | 2519 | int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, |
| 2516 | struct winsize __user *arg) | 2520 | struct winsize *ws) |
| 2517 | { | 2521 | { |
| 2518 | struct winsize tmp_ws; | ||
| 2519 | struct pid *pgrp, *rpgrp; | 2522 | struct pid *pgrp, *rpgrp; |
| 2520 | unsigned long flags; | 2523 | unsigned long flags; |
| 2521 | 2524 | ||
| 2522 | if (copy_from_user(&tmp_ws, arg, sizeof(*arg))) | 2525 | /* For a PTY we need to lock the tty side */ |
| 2523 | return -EFAULT; | 2526 | mutex_lock(&real_tty->termios_mutex); |
| 2524 | 2527 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) | |
| 2525 | mutex_lock(&tty->termios_mutex); | ||
| 2526 | if (!memcmp(&tmp_ws, &tty->winsize, sizeof(*arg))) | ||
| 2527 | goto done; | 2528 | goto done; |
| 2528 | |||
| 2529 | #ifdef CONFIG_VT | ||
| 2530 | if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) { | ||
| 2531 | if (vc_lock_resize(tty->driver_data, tmp_ws.ws_col, | ||
| 2532 | tmp_ws.ws_row)) { | ||
| 2533 | mutex_unlock(&tty->termios_mutex); | ||
| 2534 | return -ENXIO; | ||
| 2535 | } | ||
| 2536 | } | ||
| 2537 | #endif | ||
| 2538 | /* Get the PID values and reference them so we can | 2529 | /* Get the PID values and reference them so we can |
| 2539 | avoid holding the tty ctrl lock while sending signals */ | 2530 | avoid holding the tty ctrl lock while sending signals */ |
| 2540 | spin_lock_irqsave(&tty->ctrl_lock, flags); | 2531 | spin_lock_irqsave(&tty->ctrl_lock, flags); |
| @@ -2550,14 +2541,42 @@ static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, | |||
| 2550 | put_pid(pgrp); | 2541 | put_pid(pgrp); |
| 2551 | put_pid(rpgrp); | 2542 | put_pid(rpgrp); |
| 2552 | 2543 | ||
| 2553 | tty->winsize = tmp_ws; | 2544 | tty->winsize = *ws; |
| 2554 | real_tty->winsize = tmp_ws; | 2545 | real_tty->winsize = *ws; |
| 2555 | done: | 2546 | done: |
| 2556 | mutex_unlock(&tty->termios_mutex); | 2547 | mutex_unlock(&real_tty->termios_mutex); |
| 2557 | return 0; | 2548 | return 0; |
| 2558 | } | 2549 | } |
| 2559 | 2550 | ||
| 2560 | /** | 2551 | /** |
| 2552 | * tiocswinsz - implement window size set ioctl | ||
| 2553 | * @tty; tty | ||
| 2554 | * @arg: user buffer for result | ||
| 2555 | * | ||
| 2556 | * Copies the user idea of the window size to the kernel. Traditionally | ||
| 2557 | * this is just advisory information but for the Linux console it | ||
| 2558 | * actually has driver level meaning and triggers a VC resize. | ||
| 2559 | * | ||
| 2560 | * Locking: | ||
| 2561 | * Driver dependant. The default do_resize method takes the | ||
| 2562 | * tty termios mutex and ctrl_lock. The console takes its own lock | ||
| 2563 | * then calls into the default method. | ||
| 2564 | */ | ||
| 2565 | |||
| 2566 | static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty, | ||
| 2567 | struct winsize __user *arg) | ||
| 2568 | { | ||
| 2569 | struct winsize tmp_ws; | ||
| 2570 | if (copy_from_user(&tmp_ws, arg, sizeof(*arg))) | ||
| 2571 | return -EFAULT; | ||
| 2572 | |||
| 2573 | if (tty->ops->resize) | ||
| 2574 | return tty->ops->resize(tty, real_tty, &tmp_ws); | ||
| 2575 | else | ||
| 2576 | return tty_do_resize(tty, real_tty, &tmp_ws); | ||
| 2577 | } | ||
| 2578 | |||
| 2579 | /** | ||
| 2561 | * tioccons - allow admin to move logical console | 2580 | * tioccons - allow admin to move logical console |
| 2562 | * @file: the file to become console | 2581 | * @file: the file to become console |
| 2563 | * | 2582 | * |
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index ea9fc5d03b99..bf34e4597421 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
| @@ -937,12 +937,14 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | |||
| 937 | return 0; | 937 | return 0; |
| 938 | #endif | 938 | #endif |
| 939 | case TIOCGSOFTCAR: | 939 | case TIOCGSOFTCAR: |
| 940 | return put_user(C_CLOCAL(tty) ? 1 : 0, | 940 | /* FIXME: for correctness we may need to take the termios |
| 941 | lock here - review */ | ||
| 942 | return put_user(C_CLOCAL(real_tty) ? 1 : 0, | ||
| 941 | (int __user *)arg); | 943 | (int __user *)arg); |
| 942 | case TIOCSSOFTCAR: | 944 | case TIOCSSOFTCAR: |
| 943 | if (get_user(arg, (unsigned int __user *) arg)) | 945 | if (get_user(arg, (unsigned int __user *) arg)) |
| 944 | return -EFAULT; | 946 | return -EFAULT; |
| 945 | return tty_change_softcar(tty, arg); | 947 | return tty_change_softcar(real_tty, arg); |
| 946 | default: | 948 | default: |
| 947 | return -ENOIOCTLCMD; | 949 | return -ENOIOCTLCMD; |
| 948 | } | 950 | } |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 1bc00c9d860d..60359c360912 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
| @@ -803,7 +803,25 @@ static inline int resize_screen(struct vc_data *vc, int width, int height, | |||
| 803 | */ | 803 | */ |
| 804 | #define VC_RESIZE_MAXCOL (32767) | 804 | #define VC_RESIZE_MAXCOL (32767) |
| 805 | #define VC_RESIZE_MAXROW (32767) | 805 | #define VC_RESIZE_MAXROW (32767) |
| 806 | int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines) | 806 | |
| 807 | /** | ||
| 808 | * vc_do_resize - resizing method for the tty | ||
| 809 | * @tty: tty being resized | ||
| 810 | * @real_tty: real tty (different to tty if a pty/tty pair) | ||
| 811 | * @vc: virtual console private data | ||
| 812 | * @cols: columns | ||
| 813 | * @lines: lines | ||
| 814 | * | ||
| 815 | * Resize a virtual console, clipping according to the actual constraints. | ||
| 816 | * If the caller passes a tty structure then update the termios winsize | ||
| 817 | * information and perform any neccessary signal handling. | ||
| 818 | * | ||
| 819 | * Caller must hold the console semaphore. Takes the termios mutex and | ||
| 820 | * ctrl_lock of the tty IFF a tty is passed. | ||
| 821 | */ | ||
| 822 | |||
| 823 | static int vc_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | ||
| 824 | struct vc_data *vc, unsigned int cols, unsigned int lines) | ||
| 807 | { | 825 | { |
| 808 | unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err = 0; | 826 | unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err = 0; |
| 809 | unsigned int old_cols, old_rows, old_row_size, old_screen_size; | 827 | unsigned int old_cols, old_rows, old_row_size, old_screen_size; |
| @@ -907,24 +925,15 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines) | |||
| 907 | gotoxy(vc, vc->vc_x, vc->vc_y); | 925 | gotoxy(vc, vc->vc_x, vc->vc_y); |
| 908 | save_cur(vc); | 926 | save_cur(vc); |
| 909 | 927 | ||
| 910 | if (vc->vc_tty) { | 928 | if (tty) { |
| 911 | struct winsize ws, *cws = &vc->vc_tty->winsize; | 929 | /* Rewrite the requested winsize data with the actual |
| 912 | struct pid *pgrp = NULL; | 930 | resulting sizes */ |
| 913 | 931 | struct winsize ws; | |
| 914 | memset(&ws, 0, sizeof(ws)); | 932 | memset(&ws, 0, sizeof(ws)); |
| 915 | ws.ws_row = vc->vc_rows; | 933 | ws.ws_row = vc->vc_rows; |
| 916 | ws.ws_col = vc->vc_cols; | 934 | ws.ws_col = vc->vc_cols; |
| 917 | ws.ws_ypixel = vc->vc_scan_lines; | 935 | ws.ws_ypixel = vc->vc_scan_lines; |
| 918 | 936 | tty_do_resize(tty, real_tty, &ws); | |
| 919 | spin_lock_irq(&vc->vc_tty->ctrl_lock); | ||
| 920 | if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col)) | ||
| 921 | pgrp = get_pid(vc->vc_tty->pgrp); | ||
| 922 | spin_unlock_irq(&vc->vc_tty->ctrl_lock); | ||
| 923 | if (pgrp) { | ||
| 924 | kill_pgrp(vc->vc_tty->pgrp, SIGWINCH, 1); | ||
| 925 | put_pid(pgrp); | ||
| 926 | } | ||
| 927 | *cws = ws; | ||
| 928 | } | 937 | } |
| 929 | 938 | ||
| 930 | if (CON_IS_VISIBLE(vc)) | 939 | if (CON_IS_VISIBLE(vc)) |
| @@ -932,14 +941,47 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines) | |||
| 932 | return err; | 941 | return err; |
| 933 | } | 942 | } |
| 934 | 943 | ||
| 935 | int vc_lock_resize(struct vc_data *vc, unsigned int cols, unsigned int lines) | 944 | /** |
| 945 | * vc_resize - resize a VT | ||
| 946 | * @vc: virtual console | ||
| 947 | * @cols: columns | ||
| 948 | * @rows: rows | ||
| 949 | * | ||
| 950 | * Resize a virtual console as seen from the console end of things. We | ||
| 951 | * use the common vc_do_resize methods to update the structures. The | ||
| 952 | * caller must hold the console sem to protect console internals and | ||
| 953 | * vc->vc_tty | ||
| 954 | */ | ||
| 955 | |||
| 956 | int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows) | ||
| 957 | { | ||
| 958 | return vc_do_resize(vc->vc_tty, vc->vc_tty, vc, cols, rows); | ||
| 959 | } | ||
| 960 | |||
| 961 | /** | ||
| 962 | * vt_resize - resize a VT | ||
| 963 | * @tty: tty to resize | ||
| 964 | * @real_tty: tty if a pty/tty pair | ||
| 965 | * @ws: winsize attributes | ||
| 966 | * | ||
| 967 | * Resize a virtual terminal. This is called by the tty layer as we | ||
| 968 | * register our own handler for resizing. The mutual helper does all | ||
| 969 | * the actual work. | ||
| 970 | * | ||
| 971 | * Takes the console sem and the called methods then take the tty | ||
| 972 | * termios_mutex and the tty ctrl_lock in that order. | ||
| 973 | */ | ||
| 974 | |||
| 975 | int vt_resize(struct tty_struct *tty, struct tty_struct *real_tty, | ||
| 976 | struct winsize *ws) | ||
| 936 | { | 977 | { |
| 937 | int rc; | 978 | struct vc_data *vc = tty->driver_data; |
| 979 | int ret; | ||
| 938 | 980 | ||
| 939 | acquire_console_sem(); | 981 | acquire_console_sem(); |
| 940 | rc = vc_resize(vc, cols, lines); | 982 | ret = vc_do_resize(tty, real_tty, vc, ws->ws_col, ws->ws_row); |
| 941 | release_console_sem(); | 983 | release_console_sem(); |
| 942 | return rc; | 984 | return ret; |
| 943 | } | 985 | } |
| 944 | 986 | ||
| 945 | void vc_deallocate(unsigned int currcons) | 987 | void vc_deallocate(unsigned int currcons) |
| @@ -2907,6 +2949,7 @@ static const struct tty_operations con_ops = { | |||
| 2907 | .start = con_start, | 2949 | .start = con_start, |
| 2908 | .throttle = con_throttle, | 2950 | .throttle = con_throttle, |
| 2909 | .unthrottle = con_unthrottle, | 2951 | .unthrottle = con_unthrottle, |
| 2952 | .resize = vt_resize, | ||
| 2910 | }; | 2953 | }; |
| 2911 | 2954 | ||
| 2912 | int __init vty_init(void) | 2955 | int __init vty_init(void) |
| @@ -4061,7 +4104,6 @@ EXPORT_SYMBOL(default_blu); | |||
| 4061 | EXPORT_SYMBOL(update_region); | 4104 | EXPORT_SYMBOL(update_region); |
| 4062 | EXPORT_SYMBOL(redraw_screen); | 4105 | EXPORT_SYMBOL(redraw_screen); |
| 4063 | EXPORT_SYMBOL(vc_resize); | 4106 | EXPORT_SYMBOL(vc_resize); |
| 4064 | EXPORT_SYMBOL(vc_lock_resize); | ||
| 4065 | EXPORT_SYMBOL(fg_console); | 4107 | EXPORT_SYMBOL(fg_console); |
| 4066 | EXPORT_SYMBOL(console_blank_hook); | 4108 | EXPORT_SYMBOL(console_blank_hook); |
| 4067 | EXPORT_SYMBOL(console_blanked); | 4109 | EXPORT_SYMBOL(console_blanked); |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 3211afd9d57e..c904e9ad4a71 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
| @@ -947,14 +947,16 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
| 947 | get_user(cc, &vtsizes->v_cols)) | 947 | get_user(cc, &vtsizes->v_cols)) |
| 948 | ret = -EFAULT; | 948 | ret = -EFAULT; |
| 949 | else { | 949 | else { |
| 950 | acquire_console_sem(); | ||
| 950 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | 951 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
| 951 | vc = vc_cons[i].d; | 952 | vc = vc_cons[i].d; |
| 952 | 953 | ||
| 953 | if (vc) { | 954 | if (vc) { |
| 954 | vc->vc_resize_user = 1; | 955 | vc->vc_resize_user = 1; |
| 955 | vc_lock_resize(vc_cons[i].d, cc, ll); | 956 | vc_resize(vc_cons[i].d, cc, ll); |
| 956 | } | 957 | } |
| 957 | } | 958 | } |
| 959 | release_console_sem(); | ||
| 958 | } | 960 | } |
| 959 | break; | 961 | break; |
| 960 | } | 962 | } |
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.h b/drivers/char/xilinx_hwicap/buffer_icap.h index c5b1840906b2..8b0252bf06e2 100644 --- a/drivers/char/xilinx_hwicap/buffer_icap.h +++ b/drivers/char/xilinx_hwicap/buffer_icap.h | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
| 40 | #include <linux/cdev.h> | 40 | #include <linux/cdev.h> |
| 41 | #include <linux/version.h> | ||
| 42 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
| 43 | 42 | ||
| 44 | #include <asm/io.h> | 43 | #include <asm/io.h> |
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.h b/drivers/char/xilinx_hwicap/fifo_icap.h index ffabd3ba2bd8..62bda453c90b 100644 --- a/drivers/char/xilinx_hwicap/fifo_icap.h +++ b/drivers/char/xilinx_hwicap/fifo_icap.h | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
| 40 | #include <linux/cdev.h> | 40 | #include <linux/cdev.h> |
| 41 | #include <linux/version.h> | ||
| 42 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
| 43 | 42 | ||
| 44 | #include <asm/io.h> | 43 | #include <asm/io.h> |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 8bfee5fb7223..278c9857bcf5 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
| @@ -74,7 +74,6 @@ | |||
| 74 | * currently programmed in the FPGA. | 74 | * currently programmed in the FPGA. |
| 75 | */ | 75 | */ |
| 76 | 76 | ||
| 77 | #include <linux/version.h> | ||
| 78 | #include <linux/module.h> | 77 | #include <linux/module.h> |
| 79 | #include <linux/kernel.h> | 78 | #include <linux/kernel.h> |
| 80 | #include <linux/types.h> | 79 | #include <linux/types.h> |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h index 1f9c8b082dbe..24d0d9b938fb 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
| 40 | #include <linux/cdev.h> | 40 | #include <linux/cdev.h> |
| 41 | #include <linux/version.h> | ||
| 42 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
| 43 | 42 | ||
| 44 | #include <asm/io.h> | 43 | #include <asm/io.h> |
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index 5ca1d80de182..71d2ac4e3f46 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
| 22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
| 23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
| 24 | #include <linux/delay.h> | ||
| 24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
| 25 | 26 | ||
| 26 | /* | 27 | /* |
| @@ -151,13 +152,13 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE, | |||
| 151 | */ | 152 | */ |
| 152 | static int verify_pmtmr_rate(void) | 153 | static int verify_pmtmr_rate(void) |
| 153 | { | 154 | { |
| 154 | u32 value1, value2; | 155 | cycle_t value1, value2; |
| 155 | unsigned long count, delta; | 156 | unsigned long count, delta; |
| 156 | 157 | ||
| 157 | mach_prepare_counter(); | 158 | mach_prepare_counter(); |
| 158 | value1 = read_pmtmr(); | 159 | value1 = clocksource_acpi_pm.read(); |
| 159 | mach_countup(&count); | 160 | mach_countup(&count); |
| 160 | value2 = read_pmtmr(); | 161 | value2 = clocksource_acpi_pm.read(); |
| 161 | delta = (value2 - value1) & ACPI_PM_MASK; | 162 | delta = (value2 - value1) & ACPI_PM_MASK; |
| 162 | 163 | ||
| 163 | /* Check that the PMTMR delta is within 5% of what we expect */ | 164 | /* Check that the PMTMR delta is within 5% of what we expect */ |
| @@ -175,10 +176,15 @@ static int verify_pmtmr_rate(void) | |||
| 175 | #define verify_pmtmr_rate() (0) | 176 | #define verify_pmtmr_rate() (0) |
| 176 | #endif | 177 | #endif |
| 177 | 178 | ||
| 179 | /* Number of monotonicity checks to perform during initialization */ | ||
| 180 | #define ACPI_PM_MONOTONICITY_CHECKS 10 | ||
| 181 | /* Number of reads we try to get two different values */ | ||
| 182 | #define ACPI_PM_READ_CHECKS 10000 | ||
| 183 | |||
| 178 | static int __init init_acpi_pm_clocksource(void) | 184 | static int __init init_acpi_pm_clocksource(void) |
| 179 | { | 185 | { |
| 180 | u32 value1, value2; | 186 | cycle_t value1, value2; |
| 181 | unsigned int i; | 187 | unsigned int i, j = 0; |
| 182 | 188 | ||
| 183 | if (!pmtmr_ioport) | 189 | if (!pmtmr_ioport) |
| 184 | return -ENODEV; | 190 | return -ENODEV; |
| @@ -187,24 +193,29 @@ static int __init init_acpi_pm_clocksource(void) | |||
| 187 | clocksource_acpi_pm.shift); | 193 | clocksource_acpi_pm.shift); |
| 188 | 194 | ||
| 189 | /* "verify" this timing source: */ | 195 | /* "verify" this timing source: */ |
| 190 | value1 = read_pmtmr(); | 196 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { |
| 191 | for (i = 0; i < 10000; i++) { | 197 | udelay(100 * j); |
| 192 | value2 = read_pmtmr(); | 198 | value1 = clocksource_acpi_pm.read(); |
| 193 | if (value2 == value1) | 199 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { |
| 194 | continue; | 200 | value2 = clocksource_acpi_pm.read(); |
| 195 | if (value2 > value1) | 201 | if (value2 == value1) |
| 196 | goto pm_good; | 202 | continue; |
| 197 | if ((value2 < value1) && ((value2) < 0xFFF)) | 203 | if (value2 > value1) |
| 198 | goto pm_good; | 204 | break; |
| 199 | printk(KERN_INFO "PM-Timer had inconsistent results:" | 205 | if ((value2 < value1) && ((value2) < 0xFFF)) |
| 200 | " 0x%#x, 0x%#x - aborting.\n", value1, value2); | 206 | break; |
| 201 | return -EINVAL; | 207 | printk(KERN_INFO "PM-Timer had inconsistent results:" |
| 208 | " 0x%#llx, 0x%#llx - aborting.\n", | ||
| 209 | value1, value2); | ||
| 210 | return -EINVAL; | ||
| 211 | } | ||
| 212 | if (i == ACPI_PM_READ_CHECKS) { | ||
| 213 | printk(KERN_INFO "PM-Timer failed consistency check " | ||
| 214 | " (0x%#llx) - aborting.\n", value1); | ||
| 215 | return -ENODEV; | ||
| 216 | } | ||
| 202 | } | 217 | } |
| 203 | printk(KERN_INFO "PM-Timer had no reasonable result:" | ||
| 204 | " 0x%#x - aborting.\n", value1); | ||
| 205 | return -ENODEV; | ||
| 206 | 218 | ||
| 207 | pm_good: | ||
| 208 | if (verify_pmtmr_rate() != 0) | 219 | if (verify_pmtmr_rate() != 0) |
| 209 | return -ENODEV; | 220 | return -ENODEV; |
| 210 | 221 | ||
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index ba7b9a6b17a1..a4bec3f919aa 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c | |||
| @@ -67,10 +67,17 @@ static int ladder_select_state(struct cpuidle_device *dev) | |||
| 67 | struct ladder_device *ldev = &__get_cpu_var(ladder_devices); | 67 | struct ladder_device *ldev = &__get_cpu_var(ladder_devices); |
| 68 | struct ladder_device_state *last_state; | 68 | struct ladder_device_state *last_state; |
| 69 | int last_residency, last_idx = ldev->last_state_idx; | 69 | int last_residency, last_idx = ldev->last_state_idx; |
| 70 | int latency_req = pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY); | ||
| 70 | 71 | ||
| 71 | if (unlikely(!ldev)) | 72 | if (unlikely(!ldev)) |
| 72 | return 0; | 73 | return 0; |
| 73 | 74 | ||
| 75 | /* Special case when user has set very strict latency requirement */ | ||
| 76 | if (unlikely(latency_req == 0)) { | ||
| 77 | ladder_do_selection(ldev, last_idx, 0); | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | |||
| 74 | last_state = &ldev->states[last_idx]; | 81 | last_state = &ldev->states[last_idx]; |
| 75 | 82 | ||
| 76 | if (dev->states[last_idx].flags & CPUIDLE_FLAG_TIME_VALID) | 83 | if (dev->states[last_idx].flags & CPUIDLE_FLAG_TIME_VALID) |
| @@ -81,8 +88,7 @@ static int ladder_select_state(struct cpuidle_device *dev) | |||
| 81 | /* consider promotion */ | 88 | /* consider promotion */ |
| 82 | if (last_idx < dev->state_count - 1 && | 89 | if (last_idx < dev->state_count - 1 && |
| 83 | last_residency > last_state->threshold.promotion_time && | 90 | last_residency > last_state->threshold.promotion_time && |
| 84 | dev->states[last_idx + 1].exit_latency <= | 91 | dev->states[last_idx + 1].exit_latency <= latency_req) { |
| 85 | pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) { | ||
| 86 | last_state->stats.promotion_count++; | 92 | last_state->stats.promotion_count++; |
| 87 | last_state->stats.demotion_count = 0; | 93 | last_state->stats.demotion_count = 0; |
| 88 | if (last_state->stats.promotion_count >= last_state->threshold.promotion_count) { | 94 | if (last_state->stats.promotion_count >= last_state->threshold.promotion_count) { |
| @@ -92,7 +98,19 @@ static int ladder_select_state(struct cpuidle_device *dev) | |||
| 92 | } | 98 | } |
| 93 | 99 | ||
| 94 | /* consider demotion */ | 100 | /* consider demotion */ |
| 95 | if (last_idx > 0 && | 101 | if (last_idx > CPUIDLE_DRIVER_STATE_START && |
| 102 | dev->states[last_idx].exit_latency > latency_req) { | ||
| 103 | int i; | ||
| 104 | |||
| 105 | for (i = last_idx - 1; i > CPUIDLE_DRIVER_STATE_START; i--) { | ||
| 106 | if (dev->states[i].exit_latency <= latency_req) | ||
| 107 | break; | ||
| 108 | } | ||
| 109 | ladder_do_selection(ldev, last_idx, i); | ||
| 110 | return i; | ||
| 111 | } | ||
| 112 | |||
| 113 | if (last_idx > CPUIDLE_DRIVER_STATE_START && | ||
| 96 | last_residency < last_state->threshold.demotion_time) { | 114 | last_residency < last_state->threshold.demotion_time) { |
| 97 | last_state->stats.demotion_count++; | 115 | last_state->stats.demotion_count++; |
| 98 | last_state->stats.promotion_count = 0; | 116 | last_state->stats.promotion_count = 0; |
| @@ -117,7 +135,7 @@ static int ladder_enable_device(struct cpuidle_device *dev) | |||
| 117 | struct ladder_device_state *lstate; | 135 | struct ladder_device_state *lstate; |
| 118 | struct cpuidle_state *state; | 136 | struct cpuidle_state *state; |
| 119 | 137 | ||
| 120 | ldev->last_state_idx = 0; | 138 | ldev->last_state_idx = CPUIDLE_DRIVER_STATE_START; |
| 121 | 139 | ||
| 122 | for (i = 0; i < dev->state_count; i++) { | 140 | for (i = 0; i < dev->state_count; i++) { |
| 123 | state = &dev->states[i]; | 141 | state = &dev->states[i]; |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 78d77c5dc35c..8d7cf3f31450 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
| @@ -34,21 +34,28 @@ static DEFINE_PER_CPU(struct menu_device, menu_devices); | |||
| 34 | static int menu_select(struct cpuidle_device *dev) | 34 | static int menu_select(struct cpuidle_device *dev) |
| 35 | { | 35 | { |
| 36 | struct menu_device *data = &__get_cpu_var(menu_devices); | 36 | struct menu_device *data = &__get_cpu_var(menu_devices); |
| 37 | int latency_req = pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY); | ||
| 37 | int i; | 38 | int i; |
| 38 | 39 | ||
| 40 | /* Special case when user has set very strict latency requirement */ | ||
| 41 | if (unlikely(latency_req == 0)) { | ||
| 42 | data->last_state_idx = 0; | ||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 39 | /* determine the expected residency time */ | 46 | /* determine the expected residency time */ |
| 40 | data->expected_us = | 47 | data->expected_us = |
| 41 | (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000; | 48 | (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000; |
| 42 | 49 | ||
| 43 | /* find the deepest idle state that satisfies our constraints */ | 50 | /* find the deepest idle state that satisfies our constraints */ |
| 44 | for (i = 1; i < dev->state_count; i++) { | 51 | for (i = CPUIDLE_DRIVER_STATE_START + 1; i < dev->state_count; i++) { |
| 45 | struct cpuidle_state *s = &dev->states[i]; | 52 | struct cpuidle_state *s = &dev->states[i]; |
| 46 | 53 | ||
| 47 | if (s->target_residency > data->expected_us) | 54 | if (s->target_residency > data->expected_us) |
| 48 | break; | 55 | break; |
| 49 | if (s->target_residency > data->predicted_us) | 56 | if (s->target_residency > data->predicted_us) |
| 50 | break; | 57 | break; |
| 51 | if (s->exit_latency > pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) | 58 | if (s->exit_latency > latency_req) |
| 52 | break; | 59 | break; |
| 53 | } | 60 | } |
| 54 | 61 | ||
| @@ -67,9 +74,9 @@ static void menu_reflect(struct cpuidle_device *dev) | |||
| 67 | { | 74 | { |
| 68 | struct menu_device *data = &__get_cpu_var(menu_devices); | 75 | struct menu_device *data = &__get_cpu_var(menu_devices); |
| 69 | int last_idx = data->last_state_idx; | 76 | int last_idx = data->last_state_idx; |
| 70 | unsigned int measured_us = | 77 | unsigned int last_idle_us = cpuidle_get_last_residency(dev); |
| 71 | cpuidle_get_last_residency(dev) + data->elapsed_us; | ||
| 72 | struct cpuidle_state *target = &dev->states[last_idx]; | 78 | struct cpuidle_state *target = &dev->states[last_idx]; |
| 79 | unsigned int measured_us; | ||
| 73 | 80 | ||
| 74 | /* | 81 | /* |
| 75 | * Ugh, this idle state doesn't support residency measurements, so we | 82 | * Ugh, this idle state doesn't support residency measurements, so we |
| @@ -77,20 +84,27 @@ static void menu_reflect(struct cpuidle_device *dev) | |||
| 77 | * for one full standard timer tick. However, be aware that this | 84 | * for one full standard timer tick. However, be aware that this |
| 78 | * could potentially result in a suboptimal state transition. | 85 | * could potentially result in a suboptimal state transition. |
| 79 | */ | 86 | */ |
| 80 | if (!(target->flags & CPUIDLE_FLAG_TIME_VALID)) | 87 | if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID))) |
| 81 | measured_us = USEC_PER_SEC / HZ; | 88 | last_idle_us = USEC_PER_SEC / HZ; |
| 89 | |||
| 90 | /* | ||
| 91 | * measured_us and elapsed_us are the cumulative idle time, since the | ||
| 92 | * last time we were woken out of idle by an interrupt. | ||
| 93 | */ | ||
| 94 | if (data->elapsed_us <= data->elapsed_us + last_idle_us) | ||
| 95 | measured_us = data->elapsed_us + last_idle_us; | ||
| 96 | else | ||
| 97 | measured_us = -1; | ||
| 98 | |||
| 99 | /* Predict time until next break event */ | ||
| 100 | data->predicted_us = max(measured_us, data->last_measured_us); | ||
| 82 | 101 | ||
| 83 | /* Predict time remaining until next break event */ | 102 | if (last_idle_us + BREAK_FUZZ < |
| 84 | if (measured_us + BREAK_FUZZ < data->expected_us - target->exit_latency) { | 103 | data->expected_us - target->exit_latency) { |
| 85 | data->predicted_us = max(measured_us, data->last_measured_us); | ||
| 86 | data->last_measured_us = measured_us; | 104 | data->last_measured_us = measured_us; |
| 87 | data->elapsed_us = 0; | 105 | data->elapsed_us = 0; |
| 88 | } else { | 106 | } else { |
| 89 | if (data->elapsed_us < data->elapsed_us + measured_us) | 107 | data->elapsed_us = measured_us; |
| 90 | data->elapsed_us = measured_us; | ||
| 91 | else | ||
| 92 | data->elapsed_us = -1; | ||
| 93 | data->predicted_us = max(measured_us, data->last_measured_us); | ||
| 94 | } | 108 | } |
| 95 | } | 109 | } |
| 96 | 110 | ||
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index ee827a7f7c6a..b6ad3ac5916e 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
| @@ -1157,6 +1157,8 @@ static int aead_authenc_givencrypt( | |||
| 1157 | edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_MODE0_ENCRYPT; | 1157 | edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_MODE0_ENCRYPT; |
| 1158 | 1158 | ||
| 1159 | memcpy(req->giv, ctx->iv, crypto_aead_ivsize(authenc)); | 1159 | memcpy(req->giv, ctx->iv, crypto_aead_ivsize(authenc)); |
| 1160 | /* avoid consecutive packets going out with same IV */ | ||
| 1161 | *(__be64 *)req->giv ^= cpu_to_be64(req->seq); | ||
| 1160 | 1162 | ||
| 1161 | return ipsec_esp(edesc, areq, req->giv, req->seq, | 1163 | return ipsec_esp(edesc, areq, req->giv, req->seq, |
| 1162 | ipsec_esp_encrypt_done); | 1164 | ipsec_esp_encrypt_done); |
| @@ -1449,6 +1451,8 @@ static int talitos_probe(struct of_device *ofdev, | |||
| 1449 | 1451 | ||
| 1450 | priv->ofdev = ofdev; | 1452 | priv->ofdev = ofdev; |
| 1451 | 1453 | ||
| 1454 | INIT_LIST_HEAD(&priv->alg_list); | ||
| 1455 | |||
| 1452 | tasklet_init(&priv->done_task, talitos_done, (unsigned long)dev); | 1456 | tasklet_init(&priv->done_task, talitos_done, (unsigned long)dev); |
| 1453 | tasklet_init(&priv->error_task, talitos_error, (unsigned long)dev); | 1457 | tasklet_init(&priv->error_task, talitos_error, (unsigned long)dev); |
| 1454 | 1458 | ||
| @@ -1575,8 +1579,6 @@ static int talitos_probe(struct of_device *ofdev, | |||
| 1575 | } | 1579 | } |
| 1576 | 1580 | ||
| 1577 | /* register crypto algorithms the device supports */ | 1581 | /* register crypto algorithms the device supports */ |
| 1578 | INIT_LIST_HEAD(&priv->alg_list); | ||
| 1579 | |||
| 1580 | for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { | 1582 | for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { |
| 1581 | if (hw_supports(dev, driver_algs[i].desc_hdr_template)) { | 1583 | if (hw_supports(dev, driver_algs[i].desc_hdr_template)) { |
| 1582 | struct talitos_crypto_alg *t_alg; | 1584 | struct talitos_crypto_alg *t_alg; |
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 94df91771243..0778d99aea7c 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
| @@ -364,7 +364,7 @@ static void dw_dma_tasklet(unsigned long data) | |||
| 364 | int i; | 364 | int i; |
| 365 | 365 | ||
| 366 | status_block = dma_readl(dw, RAW.BLOCK); | 366 | status_block = dma_readl(dw, RAW.BLOCK); |
| 367 | status_xfer = dma_readl(dw, RAW.BLOCK); | 367 | status_xfer = dma_readl(dw, RAW.XFER); |
| 368 | status_err = dma_readl(dw, RAW.ERROR); | 368 | status_err = dma_readl(dw, RAW.ERROR); |
| 369 | 369 | ||
| 370 | dev_vdbg(dw->dma.dev, "tasklet: status_block=%x status_err=%x\n", | 370 | dev_vdbg(dw->dma.dev, "tasklet: status_block=%x status_err=%x\n", |
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index a4e4494663bf..0328da020a10 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
| 26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/memory.h> | 27 | #include <linux/memory.h> |
| 28 | #include <asm/plat-orion/mv_xor.h> | 28 | #include <plat/mv_xor.h> |
| 29 | #include "mv_xor.h" | 29 | #include "mv_xor.h" |
| 30 | 30 | ||
| 31 | static void mv_xor_issue_pending(struct dma_chan *chan); | 31 | static void mv_xor_issue_pending(struct dma_chan *chan); |
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h index b27b13c5eb5a..4b55ec607a88 100644 --- a/drivers/edac/edac_core.h +++ b/drivers/edac/edac_core.h | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
| 35 | #include <linux/sysdev.h> | 35 | #include <linux/sysdev.h> |
| 36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
| 37 | #include <linux/version.h> | ||
| 38 | 37 | ||
| 39 | #define EDAC_MC_LABEL_LEN 31 | 38 | #define EDAC_MC_LABEL_LEN 31 |
| 40 | #define EDAC_DEVICE_NAME_LEN 31 | 39 | #define EDAC_DEVICE_NAME_LEN 31 |
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig index fa6d6abefd4d..450902438208 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig | |||
| @@ -12,8 +12,8 @@ config FIREWIRE | |||
| 12 | This is the "Juju" FireWire stack, a new alternative implementation | 12 | This is the "Juju" FireWire stack, a new alternative implementation |
| 13 | designed for robustness and simplicity. You can build either this | 13 | designed for robustness and simplicity. You can build either this |
| 14 | stack, or the old stack (the ieee1394 driver, ohci1394 etc.) or both. | 14 | stack, or the old stack (the ieee1394 driver, ohci1394 etc.) or both. |
| 15 | Please read http://wiki.linux1394.org/JujuMigration before you | 15 | Please read http://ieee1394.wiki.kernel.org/index.php/Juju_Migration |
| 16 | enable the new stack. | 16 | before you enable the new stack. |
| 17 | 17 | ||
| 18 | To compile this driver as a module, say M here: the module will be | 18 | To compile this driver as a module, say M here: the module will be |
| 19 | called firewire-core. | 19 | called firewire-core. |
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c index 8024e3bfd877..b91ef63126ed 100644 --- a/drivers/firmware/iscsi_ibft.c +++ b/drivers/firmware/iscsi_ibft.c | |||
| @@ -669,8 +669,7 @@ static int __init ibft_register_kobjects(struct ibft_table_header *header, | |||
| 669 | 669 | ||
| 670 | control = (void *)header + sizeof(*header); | 670 | control = (void *)header + sizeof(*header); |
| 671 | end = (void *)control + control->hdr.length; | 671 | end = (void *)control + control->hdr.length; |
| 672 | eot_offset = (void *)header + header->length - | 672 | eot_offset = (void *)header + header->length - (void *)control; |
| 673 | (void *)control - sizeof(*header); | ||
| 674 | rc = ibft_verify_hdr("control", (struct ibft_hdr *)control, id_control, | 673 | rc = ibft_verify_hdr("control", (struct ibft_hdr *)control, id_control, |
| 675 | sizeof(*control)); | 674 | sizeof(*control)); |
| 676 | 675 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 089c015c01d1..53f0e5af1cc8 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
| @@ -400,27 +400,31 @@ static void drm_locked_tasklet_func(unsigned long data) | |||
| 400 | { | 400 | { |
| 401 | struct drm_device *dev = (struct drm_device *)data; | 401 | struct drm_device *dev = (struct drm_device *)data; |
| 402 | unsigned long irqflags; | 402 | unsigned long irqflags; |
| 403 | 403 | void (*tasklet_func)(struct drm_device *); | |
| 404 | |||
| 404 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | 405 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); |
| 406 | tasklet_func = dev->locked_tasklet_func; | ||
| 407 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
| 405 | 408 | ||
| 406 | if (!dev->locked_tasklet_func || | 409 | if (!tasklet_func || |
| 407 | !drm_lock_take(&dev->lock, | 410 | !drm_lock_take(&dev->lock, |
| 408 | DRM_KERNEL_CONTEXT)) { | 411 | DRM_KERNEL_CONTEXT)) { |
| 409 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
| 410 | return; | 412 | return; |
| 411 | } | 413 | } |
| 412 | 414 | ||
| 413 | dev->lock.lock_time = jiffies; | 415 | dev->lock.lock_time = jiffies; |
| 414 | atomic_inc(&dev->counts[_DRM_STAT_LOCKS]); | 416 | atomic_inc(&dev->counts[_DRM_STAT_LOCKS]); |
| 415 | 417 | ||
| 416 | dev->locked_tasklet_func(dev); | 418 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); |
| 419 | tasklet_func = dev->locked_tasklet_func; | ||
| 420 | dev->locked_tasklet_func = NULL; | ||
| 421 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
| 422 | |||
| 423 | if (tasklet_func != NULL) | ||
| 424 | tasklet_func(dev); | ||
| 417 | 425 | ||
| 418 | drm_lock_free(&dev->lock, | 426 | drm_lock_free(&dev->lock, |
| 419 | DRM_KERNEL_CONTEXT); | 427 | DRM_KERNEL_CONTEXT); |
| 420 | |||
| 421 | dev->locked_tasklet_func = NULL; | ||
| 422 | |||
| 423 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
| 424 | } | 428 | } |
| 425 | 429 | ||
| 426 | /** | 430 | /** |
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c index 0998723cde79..a4caf95485d7 100644 --- a/drivers/gpu/drm/drm_lock.c +++ b/drivers/gpu/drm/drm_lock.c | |||
| @@ -105,14 +105,19 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
| 105 | ret ? "interrupted" : "has lock"); | 105 | ret ? "interrupted" : "has lock"); |
| 106 | if (ret) return ret; | 106 | if (ret) return ret; |
| 107 | 107 | ||
| 108 | sigemptyset(&dev->sigmask); | 108 | /* don't set the block all signals on the master process for now |
| 109 | sigaddset(&dev->sigmask, SIGSTOP); | 109 | * really probably not the correct answer but lets us debug xkb |
| 110 | sigaddset(&dev->sigmask, SIGTSTP); | 110 | * xserver for now */ |
| 111 | sigaddset(&dev->sigmask, SIGTTIN); | 111 | if (!file_priv->master) { |
| 112 | sigaddset(&dev->sigmask, SIGTTOU); | 112 | sigemptyset(&dev->sigmask); |
| 113 | dev->sigdata.context = lock->context; | 113 | sigaddset(&dev->sigmask, SIGSTOP); |
| 114 | dev->sigdata.lock = dev->lock.hw_lock; | 114 | sigaddset(&dev->sigmask, SIGTSTP); |
| 115 | block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); | 115 | sigaddset(&dev->sigmask, SIGTTIN); |
| 116 | sigaddset(&dev->sigmask, SIGTTOU); | ||
| 117 | dev->sigdata.context = lock->context; | ||
| 118 | dev->sigdata.lock = dev->lock.hw_lock; | ||
| 119 | block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); | ||
| 120 | } | ||
| 116 | 121 | ||
| 117 | if (dev->driver->dma_ready && (lock->flags & _DRM_LOCK_READY)) | 122 | if (dev->driver->dma_ready && (lock->flags & _DRM_LOCK_READY)) |
| 118 | dev->driver->dma_ready(dev); | 123 | dev->driver->dma_ready(dev); |
| @@ -150,6 +155,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
| 150 | { | 155 | { |
| 151 | struct drm_lock *lock = data; | 156 | struct drm_lock *lock = data; |
| 152 | unsigned long irqflags; | 157 | unsigned long irqflags; |
| 158 | void (*tasklet_func)(struct drm_device *); | ||
| 153 | 159 | ||
| 154 | if (lock->context == DRM_KERNEL_CONTEXT) { | 160 | if (lock->context == DRM_KERNEL_CONTEXT) { |
| 155 | DRM_ERROR("Process %d using kernel context %d\n", | 161 | DRM_ERROR("Process %d using kernel context %d\n", |
| @@ -158,14 +164,11 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
| 158 | } | 164 | } |
| 159 | 165 | ||
| 160 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | 166 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); |
| 161 | 167 | tasklet_func = dev->locked_tasklet_func; | |
| 162 | if (dev->locked_tasklet_func) { | 168 | dev->locked_tasklet_func = NULL; |
| 163 | dev->locked_tasklet_func(dev); | ||
| 164 | |||
| 165 | dev->locked_tasklet_func = NULL; | ||
| 166 | } | ||
| 167 | |||
| 168 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | 169 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); |
| 170 | if (tasklet_func != NULL) | ||
| 171 | tasklet_func(dev); | ||
| 169 | 172 | ||
| 170 | atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]); | 173 | atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]); |
| 171 | 174 | ||
diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c index 702df45320f7..4b27d9abb7bc 100644 --- a/drivers/gpu/drm/radeon/r300_cmdbuf.c +++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c | |||
| @@ -77,6 +77,9 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, | |||
| 77 | return -EFAULT; | 77 | return -EFAULT; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | box.x2--; /* Hardware expects inclusive bottom-right corner */ | ||
| 81 | box.y2--; | ||
| 82 | |||
| 80 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) { | 83 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) { |
| 81 | box.x1 = (box.x1) & | 84 | box.x1 = (box.x1) & |
| 82 | R300_CLIPRECT_MASK; | 85 | R300_CLIPRECT_MASK; |
| @@ -95,8 +98,8 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, | |||
| 95 | R300_CLIPRECT_MASK; | 98 | R300_CLIPRECT_MASK; |
| 96 | box.y2 = (box.y2 + R300_CLIPRECT_OFFSET) & | 99 | box.y2 = (box.y2 + R300_CLIPRECT_OFFSET) & |
| 97 | R300_CLIPRECT_MASK; | 100 | R300_CLIPRECT_MASK; |
| 98 | |||
| 99 | } | 101 | } |
| 102 | |||
| 100 | OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) | | 103 | OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) | |
| 101 | (box.y1 << R300_CLIPRECT_Y_SHIFT)); | 104 | (box.y1 << R300_CLIPRECT_Y_SHIFT)); |
| 102 | OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) | | 105 | OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) | |
| @@ -136,6 +139,18 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, | |||
| 136 | ADVANCE_RING(); | 139 | ADVANCE_RING(); |
| 137 | } | 140 | } |
| 138 | 141 | ||
| 142 | /* flus cache and wait idle clean after cliprect change */ | ||
| 143 | BEGIN_RING(2); | ||
| 144 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | ||
| 145 | OUT_RING(R300_RB3D_DC_FLUSH); | ||
| 146 | ADVANCE_RING(); | ||
| 147 | BEGIN_RING(2); | ||
| 148 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
| 149 | OUT_RING(RADEON_WAIT_3D_IDLECLEAN); | ||
| 150 | ADVANCE_RING(); | ||
| 151 | /* set flush flag */ | ||
| 152 | dev_priv->track_flush |= RADEON_FLUSH_EMITED; | ||
| 153 | |||
| 139 | return 0; | 154 | return 0; |
| 140 | } | 155 | } |
| 141 | 156 | ||
| @@ -166,13 +181,13 @@ void r300_init_reg_flags(struct drm_device *dev) | |||
| 166 | ADD_RANGE(0x21DC, 1); | 181 | ADD_RANGE(0x21DC, 1); |
| 167 | ADD_RANGE(R300_VAP_UNKNOWN_221C, 1); | 182 | ADD_RANGE(R300_VAP_UNKNOWN_221C, 1); |
| 168 | ADD_RANGE(R300_VAP_CLIP_X_0, 4); | 183 | ADD_RANGE(R300_VAP_CLIP_X_0, 4); |
| 169 | ADD_RANGE(R300_VAP_PVS_WAITIDLE, 1); | 184 | ADD_RANGE(R300_VAP_PVS_STATE_FLUSH_REG, 1); |
| 170 | ADD_RANGE(R300_VAP_UNKNOWN_2288, 1); | 185 | ADD_RANGE(R300_VAP_UNKNOWN_2288, 1); |
| 171 | ADD_RANGE(R300_VAP_OUTPUT_VTX_FMT_0, 2); | 186 | ADD_RANGE(R300_VAP_OUTPUT_VTX_FMT_0, 2); |
| 172 | ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); | 187 | ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); |
| 173 | ADD_RANGE(R300_GB_ENABLE, 1); | 188 | ADD_RANGE(R300_GB_ENABLE, 1); |
| 174 | ADD_RANGE(R300_GB_MSPOS0, 5); | 189 | ADD_RANGE(R300_GB_MSPOS0, 5); |
| 175 | ADD_RANGE(R300_TX_CNTL, 1); | 190 | ADD_RANGE(R300_TX_INVALTAGS, 1); |
| 176 | ADD_RANGE(R300_TX_ENABLE, 1); | 191 | ADD_RANGE(R300_TX_ENABLE, 1); |
| 177 | ADD_RANGE(0x4200, 4); | 192 | ADD_RANGE(0x4200, 4); |
| 178 | ADD_RANGE(0x4214, 1); | 193 | ADD_RANGE(0x4214, 1); |
| @@ -388,15 +403,28 @@ static __inline__ int r300_emit_vpu(drm_radeon_private_t *dev_priv, | |||
| 388 | if (sz * 16 > cmdbuf->bufsz) | 403 | if (sz * 16 > cmdbuf->bufsz) |
| 389 | return -EINVAL; | 404 | return -EINVAL; |
| 390 | 405 | ||
| 391 | BEGIN_RING(5 + sz * 4); | 406 | /* VAP is very sensitive so we purge cache before we program it |
| 392 | /* Wait for VAP to come to senses.. */ | 407 | * and we also flush its state before & after */ |
| 393 | /* there is no need to emit it multiple times, (only once before VAP is programmed, | 408 | BEGIN_RING(6); |
| 394 | but this optimization is for later */ | 409 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); |
| 395 | OUT_RING_REG(R300_VAP_PVS_WAITIDLE, 0); | 410 | OUT_RING(R300_RB3D_DC_FLUSH); |
| 411 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
| 412 | OUT_RING(RADEON_WAIT_3D_IDLECLEAN); | ||
| 413 | OUT_RING(CP_PACKET0(R300_VAP_PVS_STATE_FLUSH_REG, 0)); | ||
| 414 | OUT_RING(0); | ||
| 415 | ADVANCE_RING(); | ||
| 416 | /* set flush flag */ | ||
| 417 | dev_priv->track_flush |= RADEON_FLUSH_EMITED; | ||
| 418 | |||
| 419 | BEGIN_RING(3 + sz * 4); | ||
| 396 | OUT_RING_REG(R300_VAP_PVS_UPLOAD_ADDRESS, addr); | 420 | OUT_RING_REG(R300_VAP_PVS_UPLOAD_ADDRESS, addr); |
| 397 | OUT_RING(CP_PACKET0_TABLE(R300_VAP_PVS_UPLOAD_DATA, sz * 4 - 1)); | 421 | OUT_RING(CP_PACKET0_TABLE(R300_VAP_PVS_UPLOAD_DATA, sz * 4 - 1)); |
| 398 | OUT_RING_TABLE((int *)cmdbuf->buf, sz * 4); | 422 | OUT_RING_TABLE((int *)cmdbuf->buf, sz * 4); |
| 423 | ADVANCE_RING(); | ||
| 399 | 424 | ||
| 425 | BEGIN_RING(2); | ||
| 426 | OUT_RING(CP_PACKET0(R300_VAP_PVS_STATE_FLUSH_REG, 0)); | ||
| 427 | OUT_RING(0); | ||
| 400 | ADVANCE_RING(); | 428 | ADVANCE_RING(); |
| 401 | 429 | ||
| 402 | cmdbuf->buf += sz * 16; | 430 | cmdbuf->buf += sz * 16; |
| @@ -424,6 +452,15 @@ static __inline__ int r300_emit_clear(drm_radeon_private_t *dev_priv, | |||
| 424 | OUT_RING_TABLE((int *)cmdbuf->buf, 8); | 452 | OUT_RING_TABLE((int *)cmdbuf->buf, 8); |
| 425 | ADVANCE_RING(); | 453 | ADVANCE_RING(); |
| 426 | 454 | ||
| 455 | BEGIN_RING(4); | ||
| 456 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | ||
| 457 | OUT_RING(R300_RB3D_DC_FLUSH); | ||
| 458 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
| 459 | OUT_RING(RADEON_WAIT_3D_IDLECLEAN); | ||
| 460 | ADVANCE_RING(); | ||
| 461 | /* set flush flag */ | ||
| 462 | dev_priv->track_flush |= RADEON_FLUSH_EMITED; | ||
| 463 | |||
| 427 | cmdbuf->buf += 8 * 4; | 464 | cmdbuf->buf += 8 * 4; |
| 428 | cmdbuf->bufsz -= 8 * 4; | 465 | cmdbuf->bufsz -= 8 * 4; |
| 429 | 466 | ||
| @@ -543,22 +580,23 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, | |||
| 543 | return 0; | 580 | return 0; |
| 544 | } | 581 | } |
| 545 | 582 | ||
| 546 | static __inline__ int r300_emit_indx_buffer(drm_radeon_private_t *dev_priv, | 583 | static __inline__ int r300_emit_draw_indx_2(drm_radeon_private_t *dev_priv, |
| 547 | drm_radeon_kcmd_buffer_t *cmdbuf) | 584 | drm_radeon_kcmd_buffer_t *cmdbuf) |
| 548 | { | 585 | { |
| 549 | u32 *cmd = (u32 *) cmdbuf->buf; | 586 | u32 *cmd; |
| 550 | int count, ret; | 587 | int count; |
| 588 | int expected_count; | ||
| 551 | RING_LOCALS; | 589 | RING_LOCALS; |
| 552 | 590 | ||
| 553 | count=(cmd[0]>>16) & 0x3fff; | 591 | cmd = (u32 *) cmdbuf->buf; |
| 592 | count = (cmd[0]>>16) & 0x3fff; | ||
| 593 | expected_count = cmd[1] >> 16; | ||
| 594 | if (!(cmd[1] & R300_VAP_VF_CNTL__INDEX_SIZE_32bit)) | ||
| 595 | expected_count = (expected_count+1)/2; | ||
| 554 | 596 | ||
| 555 | if ((cmd[1] & 0x8000ffff) != 0x80000810) { | 597 | if (count && count != expected_count) { |
| 556 | DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); | 598 | DRM_ERROR("3D_DRAW_INDX_2: packet size %i, expected %i\n", |
| 557 | return -EINVAL; | 599 | count, expected_count); |
| 558 | } | ||
| 559 | ret = !radeon_check_offset(dev_priv, cmd[2]); | ||
| 560 | if (ret) { | ||
| 561 | DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); | ||
| 562 | return -EINVAL; | 600 | return -EINVAL; |
| 563 | } | 601 | } |
| 564 | 602 | ||
| @@ -570,6 +608,50 @@ static __inline__ int r300_emit_indx_buffer(drm_radeon_private_t *dev_priv, | |||
| 570 | cmdbuf->buf += (count+2)*4; | 608 | cmdbuf->buf += (count+2)*4; |
| 571 | cmdbuf->bufsz -= (count+2)*4; | 609 | cmdbuf->bufsz -= (count+2)*4; |
| 572 | 610 | ||
| 611 | if (!count) { | ||
| 612 | drm_r300_cmd_header_t header; | ||
| 613 | |||
| 614 | if (cmdbuf->bufsz < 4*4 + sizeof(header)) { | ||
| 615 | DRM_ERROR("3D_DRAW_INDX_2: expect subsequent INDX_BUFFER, but stream is too short.\n"); | ||
| 616 | return -EINVAL; | ||
| 617 | } | ||
| 618 | |||
| 619 | header.u = *(unsigned int *)cmdbuf->buf; | ||
| 620 | |||
| 621 | cmdbuf->buf += sizeof(header); | ||
| 622 | cmdbuf->bufsz -= sizeof(header); | ||
| 623 | cmd = (u32 *) cmdbuf->buf; | ||
| 624 | |||
| 625 | if (header.header.cmd_type != R300_CMD_PACKET3 || | ||
| 626 | header.packet3.packet != R300_CMD_PACKET3_RAW || | ||
| 627 | cmd[0] != CP_PACKET3(RADEON_CP_INDX_BUFFER, 2)) { | ||
| 628 | DRM_ERROR("3D_DRAW_INDX_2: expect subsequent INDX_BUFFER.\n"); | ||
| 629 | return -EINVAL; | ||
| 630 | } | ||
| 631 | |||
| 632 | if ((cmd[1] & 0x8000ffff) != 0x80000810) { | ||
| 633 | DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); | ||
| 634 | return -EINVAL; | ||
| 635 | } | ||
| 636 | if (!radeon_check_offset(dev_priv, cmd[2])) { | ||
| 637 | DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); | ||
| 638 | return -EINVAL; | ||
| 639 | } | ||
| 640 | if (cmd[3] != expected_count) { | ||
| 641 | DRM_ERROR("INDX_BUFFER: buffer size %i, expected %i\n", | ||
| 642 | cmd[3], expected_count); | ||
| 643 | return -EINVAL; | ||
| 644 | } | ||
| 645 | |||
| 646 | BEGIN_RING(4); | ||
| 647 | OUT_RING(cmd[0]); | ||
| 648 | OUT_RING_TABLE((int *)(cmdbuf->buf + 4), 3); | ||
| 649 | ADVANCE_RING(); | ||
| 650 | |||
| 651 | cmdbuf->buf += 4*4; | ||
| 652 | cmdbuf->bufsz -= 4*4; | ||
| 653 | } | ||
| 654 | |||
| 573 | return 0; | 655 | return 0; |
| 574 | } | 656 | } |
| 575 | 657 | ||
| @@ -613,11 +695,22 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, | |||
| 613 | case RADEON_CNTL_BITBLT_MULTI: | 695 | case RADEON_CNTL_BITBLT_MULTI: |
| 614 | return r300_emit_bitblt_multi(dev_priv, cmdbuf); | 696 | return r300_emit_bitblt_multi(dev_priv, cmdbuf); |
| 615 | 697 | ||
| 616 | case RADEON_CP_INDX_BUFFER: /* DRAW_INDX_2 without INDX_BUFFER seems to lock up the gpu */ | 698 | case RADEON_CP_INDX_BUFFER: |
| 617 | return r300_emit_indx_buffer(dev_priv, cmdbuf); | 699 | DRM_ERROR("packet3 INDX_BUFFER without preceding 3D_DRAW_INDX_2 is illegal.\n"); |
| 618 | case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ | 700 | return -EINVAL; |
| 619 | case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */ | 701 | case RADEON_CP_3D_DRAW_IMMD_2: |
| 620 | case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */ | 702 | /* triggers drawing using in-packet vertex data */ |
| 703 | case RADEON_CP_3D_DRAW_VBUF_2: | ||
| 704 | /* triggers drawing of vertex buffers setup elsewhere */ | ||
| 705 | dev_priv->track_flush &= ~(RADEON_FLUSH_EMITED | | ||
| 706 | RADEON_PURGE_EMITED); | ||
| 707 | break; | ||
| 708 | case RADEON_CP_3D_DRAW_INDX_2: | ||
| 709 | /* triggers drawing using indices to vertex buffer */ | ||
| 710 | /* whenever we send vertex we clear flush & purge */ | ||
| 711 | dev_priv->track_flush &= ~(RADEON_FLUSH_EMITED | | ||
| 712 | RADEON_PURGE_EMITED); | ||
| 713 | return r300_emit_draw_indx_2(dev_priv, cmdbuf); | ||
| 621 | case RADEON_WAIT_FOR_IDLE: | 714 | case RADEON_WAIT_FOR_IDLE: |
| 622 | case RADEON_CP_NOP: | 715 | case RADEON_CP_NOP: |
| 623 | /* these packets are safe */ | 716 | /* these packets are safe */ |
| @@ -713,17 +806,53 @@ static __inline__ int r300_emit_packet3(drm_radeon_private_t *dev_priv, | |||
| 713 | */ | 806 | */ |
| 714 | static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv) | 807 | static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv) |
| 715 | { | 808 | { |
| 809 | uint32_t cache_z, cache_3d, cache_2d; | ||
| 716 | RING_LOCALS; | 810 | RING_LOCALS; |
| 717 | 811 | ||
| 718 | BEGIN_RING(6); | 812 | cache_z = R300_ZC_FLUSH; |
| 719 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | 813 | cache_2d = R300_RB2D_DC_FLUSH; |
| 720 | OUT_RING(R300_RB3D_DSTCACHE_UNKNOWN_0A); | 814 | cache_3d = R300_RB3D_DC_FLUSH; |
| 815 | if (!(dev_priv->track_flush & RADEON_PURGE_EMITED)) { | ||
| 816 | /* we can purge, primitive where draw since last purge */ | ||
| 817 | cache_z |= R300_ZC_FREE; | ||
| 818 | cache_2d |= R300_RB2D_DC_FREE; | ||
| 819 | cache_3d |= R300_RB3D_DC_FREE; | ||
| 820 | } | ||
| 821 | |||
| 822 | /* flush & purge zbuffer */ | ||
| 823 | BEGIN_RING(2); | ||
| 721 | OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); | 824 | OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); |
| 722 | OUT_RING(R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE| | 825 | OUT_RING(cache_z); |
| 723 | R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); | 826 | ADVANCE_RING(); |
| 724 | OUT_RING(CP_PACKET3(RADEON_CP_NOP, 0)); | 827 | /* flush & purge 3d */ |
| 725 | OUT_RING(0x0); | 828 | BEGIN_RING(2); |
| 829 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | ||
| 830 | OUT_RING(cache_3d); | ||
| 831 | ADVANCE_RING(); | ||
| 832 | /* flush & purge texture */ | ||
| 833 | BEGIN_RING(2); | ||
| 834 | OUT_RING(CP_PACKET0(R300_TX_INVALTAGS, 0)); | ||
| 835 | OUT_RING(0); | ||
| 836 | ADVANCE_RING(); | ||
| 837 | /* FIXME: is this one really needed ? */ | ||
| 838 | BEGIN_RING(2); | ||
| 839 | OUT_RING(CP_PACKET0(R300_RB3D_AARESOLVE_CTL, 0)); | ||
| 840 | OUT_RING(0); | ||
| 841 | ADVANCE_RING(); | ||
| 842 | BEGIN_RING(2); | ||
| 843 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
| 844 | OUT_RING(RADEON_WAIT_3D_IDLECLEAN); | ||
| 845 | ADVANCE_RING(); | ||
| 846 | /* flush & purge 2d through E2 as RB2D will trigger lockup */ | ||
| 847 | BEGIN_RING(4); | ||
| 848 | OUT_RING(CP_PACKET0(R300_DSTCACHE_CTLSTAT, 0)); | ||
| 849 | OUT_RING(cache_2d); | ||
| 850 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
| 851 | OUT_RING(RADEON_WAIT_2D_IDLECLEAN | | ||
| 852 | RADEON_WAIT_HOST_IDLECLEAN); | ||
| 726 | ADVANCE_RING(); | 853 | ADVANCE_RING(); |
| 854 | /* set flush & purge flags */ | ||
| 855 | dev_priv->track_flush |= RADEON_FLUSH_EMITED | RADEON_PURGE_EMITED; | ||
| 727 | } | 856 | } |
| 728 | 857 | ||
| 729 | /** | 858 | /** |
| @@ -905,8 +1034,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
| 905 | 1034 | ||
| 906 | DRM_DEBUG("\n"); | 1035 | DRM_DEBUG("\n"); |
| 907 | 1036 | ||
| 908 | /* See the comment above r300_emit_begin3d for why this call must be here, | 1037 | /* pacify */ |
| 909 | * and what the cleanup gotos are for. */ | ||
| 910 | r300_pacify(dev_priv); | 1038 | r300_pacify(dev_priv); |
| 911 | 1039 | ||
| 912 | if (cmdbuf->nbox <= R300_SIMULTANEOUS_CLIPRECTS) { | 1040 | if (cmdbuf->nbox <= R300_SIMULTANEOUS_CLIPRECTS) { |
diff --git a/drivers/gpu/drm/radeon/r300_reg.h b/drivers/gpu/drm/radeon/r300_reg.h index a6802f26afc4..ee6f811599a3 100644 --- a/drivers/gpu/drm/radeon/r300_reg.h +++ b/drivers/gpu/drm/radeon/r300_reg.h | |||
| @@ -317,7 +317,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
| 317 | * Therefore, I suspect writing zero to 0x2284 synchronizes the engine and | 317 | * Therefore, I suspect writing zero to 0x2284 synchronizes the engine and |
| 318 | * avoids bugs caused by still running shaders reading bad data from memory. | 318 | * avoids bugs caused by still running shaders reading bad data from memory. |
| 319 | */ | 319 | */ |
| 320 | #define R300_VAP_PVS_WAITIDLE 0x2284 /* GUESS */ | 320 | #define R300_VAP_PVS_STATE_FLUSH_REG 0x2284 |
| 321 | 321 | ||
| 322 | /* Absolutely no clue what this register is about. */ | 322 | /* Absolutely no clue what this register is about. */ |
| 323 | #define R300_VAP_UNKNOWN_2288 0x2288 | 323 | #define R300_VAP_UNKNOWN_2288 0x2288 |
| @@ -513,7 +513,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
| 513 | /* gap */ | 513 | /* gap */ |
| 514 | 514 | ||
| 515 | /* Zero to flush caches. */ | 515 | /* Zero to flush caches. */ |
| 516 | #define R300_TX_CNTL 0x4100 | 516 | #define R300_TX_INVALTAGS 0x4100 |
| 517 | #define R300_TX_FLUSH 0x0 | 517 | #define R300_TX_FLUSH 0x0 |
| 518 | 518 | ||
| 519 | /* The upper enable bits are guessed, based on fglrx reported limits. */ | 519 | /* The upper enable bits are guessed, based on fglrx reported limits. */ |
| @@ -1362,6 +1362,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
| 1362 | #define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */ | 1362 | #define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */ |
| 1363 | #define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */ | 1363 | #define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */ |
| 1364 | 1364 | ||
| 1365 | #define R300_RB3D_AARESOLVE_CTL 0x4E88 | ||
| 1365 | /* gap */ | 1366 | /* gap */ |
| 1366 | 1367 | ||
| 1367 | /* Guess by Vladimir. | 1368 | /* Guess by Vladimir. |
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c index f0de81a5689d..248ab4a7d39f 100644 --- a/drivers/gpu/drm/radeon/radeon_cp.c +++ b/drivers/gpu/drm/radeon/radeon_cp.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #define RADEON_FIFO_DEBUG 0 | 40 | #define RADEON_FIFO_DEBUG 0 |
| 41 | 41 | ||
| 42 | static int radeon_do_cleanup_cp(struct drm_device * dev); | 42 | static int radeon_do_cleanup_cp(struct drm_device * dev); |
| 43 | static void radeon_do_cp_start(drm_radeon_private_t * dev_priv); | ||
| 43 | 44 | ||
| 44 | static u32 R500_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | 45 | static u32 R500_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) |
| 45 | { | 46 | { |
| @@ -198,23 +199,8 @@ static int radeon_do_pixcache_flush(drm_radeon_private_t * dev_priv) | |||
| 198 | DRM_UDELAY(1); | 199 | DRM_UDELAY(1); |
| 199 | } | 200 | } |
| 200 | } else { | 201 | } else { |
| 201 | /* 3D */ | 202 | /* don't flush or purge cache here or lockup */ |
| 202 | tmp = RADEON_READ(R300_RB3D_DSTCACHE_CTLSTAT); | 203 | return 0; |
| 203 | tmp |= RADEON_RB3D_DC_FLUSH_ALL; | ||
| 204 | RADEON_WRITE(R300_RB3D_DSTCACHE_CTLSTAT, tmp); | ||
| 205 | |||
| 206 | /* 2D */ | ||
| 207 | tmp = RADEON_READ(R300_DSTCACHE_CTLSTAT); | ||
| 208 | tmp |= RADEON_RB3D_DC_FLUSH_ALL; | ||
| 209 | RADEON_WRITE(R300_DSTCACHE_CTLSTAT, tmp); | ||
| 210 | |||
| 211 | for (i = 0; i < dev_priv->usec_timeout; i++) { | ||
| 212 | if (!(RADEON_READ(R300_DSTCACHE_CTLSTAT) | ||
| 213 | & RADEON_RB3D_DC_BUSY)) { | ||
| 214 | return 0; | ||
| 215 | } | ||
| 216 | DRM_UDELAY(1); | ||
| 217 | } | ||
| 218 | } | 204 | } |
| 219 | 205 | ||
| 220 | #if RADEON_FIFO_DEBUG | 206 | #if RADEON_FIFO_DEBUG |
| @@ -237,6 +223,9 @@ static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries) | |||
| 237 | return 0; | 223 | return 0; |
| 238 | DRM_UDELAY(1); | 224 | DRM_UDELAY(1); |
| 239 | } | 225 | } |
| 226 | DRM_DEBUG("wait for fifo failed status : 0x%08X 0x%08X\n", | ||
| 227 | RADEON_READ(RADEON_RBBM_STATUS), | ||
| 228 | RADEON_READ(R300_VAP_CNTL_STATUS)); | ||
| 240 | 229 | ||
| 241 | #if RADEON_FIFO_DEBUG | 230 | #if RADEON_FIFO_DEBUG |
| 242 | DRM_ERROR("failed!\n"); | 231 | DRM_ERROR("failed!\n"); |
| @@ -263,6 +252,9 @@ static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv) | |||
| 263 | } | 252 | } |
| 264 | DRM_UDELAY(1); | 253 | DRM_UDELAY(1); |
| 265 | } | 254 | } |
| 255 | DRM_DEBUG("wait idle failed status : 0x%08X 0x%08X\n", | ||
| 256 | RADEON_READ(RADEON_RBBM_STATUS), | ||
| 257 | RADEON_READ(R300_VAP_CNTL_STATUS)); | ||
| 266 | 258 | ||
| 267 | #if RADEON_FIFO_DEBUG | 259 | #if RADEON_FIFO_DEBUG |
| 268 | DRM_ERROR("failed!\n"); | 260 | DRM_ERROR("failed!\n"); |
| @@ -443,14 +435,20 @@ static void radeon_do_cp_start(drm_radeon_private_t * dev_priv) | |||
| 443 | 435 | ||
| 444 | dev_priv->cp_running = 1; | 436 | dev_priv->cp_running = 1; |
| 445 | 437 | ||
| 446 | BEGIN_RING(6); | 438 | BEGIN_RING(8); |
| 447 | 439 | /* isync can only be written through cp on r5xx write it here */ | |
| 440 | OUT_RING(CP_PACKET0(RADEON_ISYNC_CNTL, 0)); | ||
| 441 | OUT_RING(RADEON_ISYNC_ANY2D_IDLE3D | | ||
| 442 | RADEON_ISYNC_ANY3D_IDLE2D | | ||
| 443 | RADEON_ISYNC_WAIT_IDLEGUI | | ||
| 444 | RADEON_ISYNC_CPSCRATCH_IDLEGUI); | ||
| 448 | RADEON_PURGE_CACHE(); | 445 | RADEON_PURGE_CACHE(); |
| 449 | RADEON_PURGE_ZCACHE(); | 446 | RADEON_PURGE_ZCACHE(); |
| 450 | RADEON_WAIT_UNTIL_IDLE(); | 447 | RADEON_WAIT_UNTIL_IDLE(); |
| 451 | |||
| 452 | ADVANCE_RING(); | 448 | ADVANCE_RING(); |
| 453 | COMMIT_RING(); | 449 | COMMIT_RING(); |
| 450 | |||
| 451 | dev_priv->track_flush |= RADEON_FLUSH_EMITED | RADEON_PURGE_EMITED; | ||
| 454 | } | 452 | } |
| 455 | 453 | ||
| 456 | /* Reset the Command Processor. This will not flush any pending | 454 | /* Reset the Command Processor. This will not flush any pending |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h index 3f0eca957aa7..099381693175 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.h +++ b/drivers/gpu/drm/radeon/radeon_drv.h | |||
| @@ -220,6 +220,9 @@ struct radeon_virt_surface { | |||
| 220 | struct drm_file *file_priv; | 220 | struct drm_file *file_priv; |
| 221 | }; | 221 | }; |
| 222 | 222 | ||
| 223 | #define RADEON_FLUSH_EMITED (1 < 0) | ||
| 224 | #define RADEON_PURGE_EMITED (1 < 1) | ||
| 225 | |||
| 223 | typedef struct drm_radeon_private { | 226 | typedef struct drm_radeon_private { |
| 224 | drm_radeon_ring_buffer_t ring; | 227 | drm_radeon_ring_buffer_t ring; |
| 225 | drm_radeon_sarea_t *sarea_priv; | 228 | drm_radeon_sarea_t *sarea_priv; |
| @@ -311,6 +314,7 @@ typedef struct drm_radeon_private { | |||
| 311 | unsigned long fb_aper_offset; | 314 | unsigned long fb_aper_offset; |
| 312 | 315 | ||
| 313 | int num_gb_pipes; | 316 | int num_gb_pipes; |
| 317 | int track_flush; | ||
| 314 | } drm_radeon_private_t; | 318 | } drm_radeon_private_t; |
| 315 | 319 | ||
| 316 | typedef struct drm_radeon_buf_priv { | 320 | typedef struct drm_radeon_buf_priv { |
| @@ -693,7 +697,6 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
| 693 | #define R300_ZB_ZCACHE_CTLSTAT 0x4f18 | 697 | #define R300_ZB_ZCACHE_CTLSTAT 0x4f18 |
| 694 | # define R300_ZC_FLUSH (1 << 0) | 698 | # define R300_ZC_FLUSH (1 << 0) |
| 695 | # define R300_ZC_FREE (1 << 1) | 699 | # define R300_ZC_FREE (1 << 1) |
| 696 | # define R300_ZC_FLUSH_ALL 0x3 | ||
| 697 | # define R300_ZC_BUSY (1 << 31) | 700 | # define R300_ZC_BUSY (1 << 31) |
| 698 | #define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c | 701 | #define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c |
| 699 | # define RADEON_RB3D_DC_FLUSH (3 << 0) | 702 | # define RADEON_RB3D_DC_FLUSH (3 << 0) |
| @@ -701,6 +704,8 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
| 701 | # define RADEON_RB3D_DC_FLUSH_ALL 0xf | 704 | # define RADEON_RB3D_DC_FLUSH_ALL 0xf |
| 702 | # define RADEON_RB3D_DC_BUSY (1 << 31) | 705 | # define RADEON_RB3D_DC_BUSY (1 << 31) |
| 703 | #define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c | 706 | #define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c |
| 707 | # define R300_RB3D_DC_FLUSH (2 << 0) | ||
| 708 | # define R300_RB3D_DC_FREE (2 << 2) | ||
| 704 | # define R300_RB3D_DC_FINISH (1 << 4) | 709 | # define R300_RB3D_DC_FINISH (1 << 4) |
| 705 | #define RADEON_RB3D_ZSTENCILCNTL 0x1c2c | 710 | #define RADEON_RB3D_ZSTENCILCNTL 0x1c2c |
| 706 | # define RADEON_Z_TEST_MASK (7 << 4) | 711 | # define RADEON_Z_TEST_MASK (7 << 4) |
| @@ -1246,17 +1251,17 @@ do { \ | |||
| 1246 | OUT_RING(RADEON_RB3D_DC_FLUSH); \ | 1251 | OUT_RING(RADEON_RB3D_DC_FLUSH); \ |
| 1247 | } else { \ | 1252 | } else { \ |
| 1248 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ | 1253 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ |
| 1249 | OUT_RING(RADEON_RB3D_DC_FLUSH); \ | 1254 | OUT_RING(R300_RB3D_DC_FLUSH); \ |
| 1250 | } \ | 1255 | } \ |
| 1251 | } while (0) | 1256 | } while (0) |
| 1252 | 1257 | ||
| 1253 | #define RADEON_PURGE_CACHE() do { \ | 1258 | #define RADEON_PURGE_CACHE() do { \ |
| 1254 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ | 1259 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ |
| 1255 | OUT_RING(CP_PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0)); \ | 1260 | OUT_RING(CP_PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0)); \ |
| 1256 | OUT_RING(RADEON_RB3D_DC_FLUSH_ALL); \ | 1261 | OUT_RING(RADEON_RB3D_DC_FLUSH | RADEON_RB3D_DC_FREE); \ |
| 1257 | } else { \ | 1262 | } else { \ |
| 1258 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ | 1263 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ |
| 1259 | OUT_RING(RADEON_RB3D_DC_FLUSH_ALL); \ | 1264 | OUT_RING(R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE); \ |
| 1260 | } \ | 1265 | } \ |
| 1261 | } while (0) | 1266 | } while (0) |
| 1262 | 1267 | ||
| @@ -1273,10 +1278,10 @@ do { \ | |||
| 1273 | #define RADEON_PURGE_ZCACHE() do { \ | 1278 | #define RADEON_PURGE_ZCACHE() do { \ |
| 1274 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ | 1279 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ |
| 1275 | OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \ | 1280 | OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \ |
| 1276 | OUT_RING(RADEON_RB3D_ZC_FLUSH_ALL); \ | 1281 | OUT_RING(RADEON_RB3D_ZC_FLUSH | RADEON_RB3D_ZC_FREE); \ |
| 1277 | } else { \ | 1282 | } else { \ |
| 1278 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ | 1283 | OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); \ |
| 1279 | OUT_RING(R300_ZC_FLUSH_ALL); \ | 1284 | OUT_RING(R300_ZC_FLUSH | R300_ZC_FREE); \ |
| 1280 | } \ | 1285 | } \ |
| 1281 | } while (0) | 1286 | } while (0) |
| 1282 | 1287 | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 61e78a4369b9..b15f88249639 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -654,12 +654,12 @@ static const struct hid_blacklist { | |||
| 654 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, | 654 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, |
| 655 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 655 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
| 656 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, | 656 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, |
| 657 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 657 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
| 658 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 658 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD | HID_QUIRK_IGNORE_MOUSE}, |
| 659 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS, HID_QUIRK_APPLE_HAS_FN }, | 659 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE}, |
| 660 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 660 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE}, |
| 661 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 661 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD | HID_QUIRK_IGNORE_MOUSE }, |
| 662 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, HID_QUIRK_APPLE_HAS_FN }, | 662 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
| 663 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 663 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
| 664 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 664 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
| 665 | 665 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index bf4ebfb86fa5..d402e8d813ce 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
| @@ -77,6 +77,22 @@ config SENSORS_AD7418 | |||
| 77 | This driver can also be built as a module. If so, the module | 77 | This driver can also be built as a module. If so, the module |
| 78 | will be called ad7418. | 78 | will be called ad7418. |
| 79 | 79 | ||
| 80 | config SENSORS_ADCXX | ||
| 81 | tristate "National Semiconductor ADCxxxSxxx" | ||
| 82 | depends on SPI_MASTER && EXPERIMENTAL | ||
| 83 | help | ||
| 84 | If you say yes here you get support for the National Semiconductor | ||
| 85 | ADC<bb><c>S<sss> chip family, where | ||
| 86 | * bb is the resolution in number of bits (8, 10, 12) | ||
| 87 | * c is the number of channels (1, 2, 4, 8) | ||
| 88 | * sss is the maximum conversion speed (021 for 200 kSPS, 051 for 500 | ||
| 89 | kSPS and 101 for 1 MSPS) | ||
| 90 | |||
| 91 | Examples : ADC081S101, ADC124S501, ... | ||
| 92 | |||
| 93 | This driver can also be built as a module. If so, the module | ||
| 94 | will be called adcxx. | ||
| 95 | |||
| 80 | config SENSORS_ADM1021 | 96 | config SENSORS_ADM1021 |
| 81 | tristate "Analog Devices ADM1021 and compatibles" | 97 | tristate "Analog Devices ADM1021 and compatibles" |
| 82 | depends on I2C | 98 | depends on I2C |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 7943e5cefb06..950134ab8426 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
| @@ -17,6 +17,7 @@ obj-$(CONFIG_SENSORS_ABITUGURU) += abituguru.o | |||
| 17 | obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o | 17 | obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o |
| 18 | obj-$(CONFIG_SENSORS_AD7414) += ad7414.o | 18 | obj-$(CONFIG_SENSORS_AD7414) += ad7414.o |
| 19 | obj-$(CONFIG_SENSORS_AD7418) += ad7418.o | 19 | obj-$(CONFIG_SENSORS_AD7418) += ad7418.o |
| 20 | obj-$(CONFIG_SENSORS_ADCXX) += adcxx.o | ||
| 20 | obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o | 21 | obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o |
| 21 | obj-$(CONFIG_SENSORS_ADM1025) += adm1025.o | 22 | obj-$(CONFIG_SENSORS_ADM1025) += adm1025.o |
| 22 | obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o | 23 | obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index f00f497b9ca9..d568c65c1370 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | /* | 1 | /* |
| 2 | abituguru3.c Copyright (c) 2006 Hans de Goede <j.w.r.degoede@hhs.nl> | 2 | abituguru3.c |
| 3 | |||
| 4 | Copyright (c) 2006-2008 Hans de Goede <j.w.r.degoede@hhs.nl> | ||
| 5 | Copyright (c) 2008 Alistair John Strachan <alistair@devzero.co.uk> | ||
| 3 | 6 | ||
| 4 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
| @@ -116,7 +119,7 @@ struct abituguru3_sensor_info { | |||
| 116 | 119 | ||
| 117 | struct abituguru3_motherboard_info { | 120 | struct abituguru3_motherboard_info { |
| 118 | u16 id; | 121 | u16 id; |
| 119 | const char *name; | 122 | const char *dmi_name; |
| 120 | /* + 1 -> end of sensors indicated by a sensor with name == NULL */ | 123 | /* + 1 -> end of sensors indicated by a sensor with name == NULL */ |
| 121 | struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS + 1]; | 124 | struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS + 1]; |
| 122 | }; | 125 | }; |
| @@ -161,7 +164,7 @@ struct abituguru3_data { | |||
| 161 | 164 | ||
| 162 | /* Constants */ | 165 | /* Constants */ |
| 163 | static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | 166 | static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { |
| 164 | { 0x000C, "unknown", { | 167 | { 0x000C, NULL /* Unknown, need DMI string */, { |
| 165 | { "CPU Core", 0, 0, 10, 1, 0 }, | 168 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 166 | { "DDR", 1, 0, 10, 1, 0 }, | 169 | { "DDR", 1, 0, 10, 1, 0 }, |
| 167 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 170 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -183,7 +186,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 183 | { "AUX1 Fan", 35, 2, 60, 1, 0 }, | 186 | { "AUX1 Fan", 35, 2, 60, 1, 0 }, |
| 184 | { NULL, 0, 0, 0, 0, 0 } } | 187 | { NULL, 0, 0, 0, 0, 0 } } |
| 185 | }, | 188 | }, |
| 186 | { 0x000D, "Abit AW8", { | 189 | { 0x000D, NULL /* Abit AW8, need DMI string */, { |
| 187 | { "CPU Core", 0, 0, 10, 1, 0 }, | 190 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 188 | { "DDR", 1, 0, 10, 1, 0 }, | 191 | { "DDR", 1, 0, 10, 1, 0 }, |
| 189 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 192 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -212,7 +215,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 212 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, | 215 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, |
| 213 | { NULL, 0, 0, 0, 0, 0 } } | 216 | { NULL, 0, 0, 0, 0, 0 } } |
| 214 | }, | 217 | }, |
| 215 | { 0x000E, "AL-8", { | 218 | { 0x000E, NULL /* AL-8, need DMI string */, { |
| 216 | { "CPU Core", 0, 0, 10, 1, 0 }, | 219 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 217 | { "DDR", 1, 0, 10, 1, 0 }, | 220 | { "DDR", 1, 0, 10, 1, 0 }, |
| 218 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 221 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -233,7 +236,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 233 | { "SYS Fan", 34, 2, 60, 1, 0 }, | 236 | { "SYS Fan", 34, 2, 60, 1, 0 }, |
| 234 | { NULL, 0, 0, 0, 0, 0 } } | 237 | { NULL, 0, 0, 0, 0, 0 } } |
| 235 | }, | 238 | }, |
| 236 | { 0x000F, "unknown", { | 239 | { 0x000F, NULL /* Unknown, need DMI string */, { |
| 237 | { "CPU Core", 0, 0, 10, 1, 0 }, | 240 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 238 | { "DDR", 1, 0, 10, 1, 0 }, | 241 | { "DDR", 1, 0, 10, 1, 0 }, |
| 239 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 242 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -254,7 +257,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 254 | { "SYS Fan", 34, 2, 60, 1, 0 }, | 257 | { "SYS Fan", 34, 2, 60, 1, 0 }, |
| 255 | { NULL, 0, 0, 0, 0, 0 } } | 258 | { NULL, 0, 0, 0, 0, 0 } } |
| 256 | }, | 259 | }, |
| 257 | { 0x0010, "Abit NI8 SLI GR", { | 260 | { 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, { |
| 258 | { "CPU Core", 0, 0, 10, 1, 0 }, | 261 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 259 | { "DDR", 1, 0, 10, 1, 0 }, | 262 | { "DDR", 1, 0, 10, 1, 0 }, |
| 260 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 263 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -276,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 276 | { "OTES1 Fan", 36, 2, 60, 1, 0 }, | 279 | { "OTES1 Fan", 36, 2, 60, 1, 0 }, |
| 277 | { NULL, 0, 0, 0, 0, 0 } } | 280 | { NULL, 0, 0, 0, 0, 0 } } |
| 278 | }, | 281 | }, |
| 279 | { 0x0011, "Abit AT8 32X", { | 282 | { 0x0011, NULL /* Abit AT8 32X, need DMI string */, { |
| 280 | { "CPU Core", 0, 0, 10, 1, 0 }, | 283 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 281 | { "DDR", 1, 0, 20, 1, 0 }, | 284 | { "DDR", 1, 0, 20, 1, 0 }, |
| 282 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 285 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -302,7 +305,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 302 | { "AUX2 Fan", 36, 2, 60, 1, 0 }, | 305 | { "AUX2 Fan", 36, 2, 60, 1, 0 }, |
| 303 | { NULL, 0, 0, 0, 0, 0 } } | 306 | { NULL, 0, 0, 0, 0, 0 } } |
| 304 | }, | 307 | }, |
| 305 | { 0x0012, "Abit AN8 32X", { | 308 | { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { |
| 306 | { "CPU Core", 0, 0, 10, 1, 0 }, | 309 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 307 | { "DDR", 1, 0, 20, 1, 0 }, | 310 | { "DDR", 1, 0, 20, 1, 0 }, |
| 308 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 311 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -324,7 +327,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 324 | { "AUX1 Fan", 36, 2, 60, 1, 0 }, | 327 | { "AUX1 Fan", 36, 2, 60, 1, 0 }, |
| 325 | { NULL, 0, 0, 0, 0, 0 } } | 328 | { NULL, 0, 0, 0, 0, 0 } } |
| 326 | }, | 329 | }, |
| 327 | { 0x0013, "Abit AW8D", { | 330 | { 0x0013, NULL /* Abit AW8D, need DMI string */, { |
| 328 | { "CPU Core", 0, 0, 10, 1, 0 }, | 331 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 329 | { "DDR", 1, 0, 10, 1, 0 }, | 332 | { "DDR", 1, 0, 10, 1, 0 }, |
| 330 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 333 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -353,7 +356,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 353 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, | 356 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, |
| 354 | { NULL, 0, 0, 0, 0, 0 } } | 357 | { NULL, 0, 0, 0, 0, 0 } } |
| 355 | }, | 358 | }, |
| 356 | { 0x0014, "Abit AB9 Pro", { | 359 | { 0x0014, NULL /* Abit AB9 Pro, need DMI string */, { |
| 357 | { "CPU Core", 0, 0, 10, 1, 0 }, | 360 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 358 | { "DDR", 1, 0, 10, 1, 0 }, | 361 | { "DDR", 1, 0, 10, 1, 0 }, |
| 359 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 362 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -374,7 +377,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 374 | { "SYS Fan", 34, 2, 60, 1, 0 }, | 377 | { "SYS Fan", 34, 2, 60, 1, 0 }, |
| 375 | { NULL, 0, 0, 0, 0, 0 } } | 378 | { NULL, 0, 0, 0, 0, 0 } } |
| 376 | }, | 379 | }, |
| 377 | { 0x0015, "unknown", { | 380 | { 0x0015, NULL /* Unknown, need DMI string */, { |
| 378 | { "CPU Core", 0, 0, 10, 1, 0 }, | 381 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 379 | { "DDR", 1, 0, 20, 1, 0 }, | 382 | { "DDR", 1, 0, 20, 1, 0 }, |
| 380 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 383 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -398,7 +401,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 398 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 401 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
| 399 | { NULL, 0, 0, 0, 0, 0 } } | 402 | { NULL, 0, 0, 0, 0, 0 } } |
| 400 | }, | 403 | }, |
| 401 | { 0x0016, "AW9D-MAX", { | 404 | { 0x0016, NULL /* AW9D-MAX, need DMI string */, { |
| 402 | { "CPU Core", 0, 0, 10, 1, 0 }, | 405 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 403 | { "DDR2", 1, 0, 20, 1, 0 }, | 406 | { "DDR2", 1, 0, 20, 1, 0 }, |
| 404 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 407 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
| @@ -426,7 +429,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 426 | { "OTES1 Fan", 38, 2, 60, 1, 0 }, | 429 | { "OTES1 Fan", 38, 2, 60, 1, 0 }, |
| 427 | { NULL, 0, 0, 0, 0, 0 } } | 430 | { NULL, 0, 0, 0, 0, 0 } } |
| 428 | }, | 431 | }, |
| 429 | { 0x0017, "unknown", { | 432 | { 0x0017, NULL /* Unknown, need DMI string */, { |
| 430 | { "CPU Core", 0, 0, 10, 1, 0 }, | 433 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 431 | { "DDR2", 1, 0, 20, 1, 0 }, | 434 | { "DDR2", 1, 0, 20, 1, 0 }, |
| 432 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 435 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
| @@ -451,7 +454,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 451 | { "AUX3 FAN", 37, 2, 60, 1, 0 }, | 454 | { "AUX3 FAN", 37, 2, 60, 1, 0 }, |
| 452 | { NULL, 0, 0, 0, 0, 0 } } | 455 | { NULL, 0, 0, 0, 0, 0 } } |
| 453 | }, | 456 | }, |
| 454 | { 0x0018, "unknown", { | 457 | { 0x0018, NULL /* Unknown, need DMI string */, { |
| 455 | { "CPU Core", 0, 0, 10, 1, 0 }, | 458 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 456 | { "DDR2", 1, 0, 20, 1, 0 }, | 459 | { "DDR2", 1, 0, 20, 1, 0 }, |
| 457 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 460 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
| @@ -478,7 +481,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 478 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 481 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
| 479 | { NULL, 0, 0, 0, 0, 0 } } | 482 | { NULL, 0, 0, 0, 0, 0 } } |
| 480 | }, | 483 | }, |
| 481 | { 0x0019, "unknown", { | 484 | { 0x0019, NULL /* Unknown, need DMI string */, { |
| 482 | { "CPU Core", 7, 0, 10, 1, 0 }, | 485 | { "CPU Core", 7, 0, 10, 1, 0 }, |
| 483 | { "DDR2", 13, 0, 20, 1, 0 }, | 486 | { "DDR2", 13, 0, 20, 1, 0 }, |
| 484 | { "DDR2 VTT", 14, 0, 10, 1, 0 }, | 487 | { "DDR2 VTT", 14, 0, 10, 1, 0 }, |
| @@ -505,7 +508,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 505 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, | 508 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, |
| 506 | { NULL, 0, 0, 0, 0, 0 } } | 509 | { NULL, 0, 0, 0, 0, 0 } } |
| 507 | }, | 510 | }, |
| 508 | { 0x001A, "Abit IP35 Pro", { | 511 | { 0x001A, "IP35 Pro(Intel P35-ICH9R)", { |
| 509 | { "CPU Core", 0, 0, 10, 1, 0 }, | 512 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 510 | { "DDR2", 1, 0, 20, 1, 0 }, | 513 | { "DDR2", 1, 0, 20, 1, 0 }, |
| 511 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 514 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
| @@ -533,7 +536,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 533 | { "AUX4 Fan", 37, 2, 60, 1, 0 }, | 536 | { "AUX4 Fan", 37, 2, 60, 1, 0 }, |
| 534 | { NULL, 0, 0, 0, 0, 0 } } | 537 | { NULL, 0, 0, 0, 0, 0 } } |
| 535 | }, | 538 | }, |
| 536 | { 0x001B, "unknown", { | 539 | { 0x001B, NULL /* Unknown, need DMI string */, { |
| 537 | { "CPU Core", 0, 0, 10, 1, 0 }, | 540 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 538 | { "DDR3", 1, 0, 20, 1, 0 }, | 541 | { "DDR3", 1, 0, 20, 1, 0 }, |
| 539 | { "DDR3 VTT", 2, 0, 10, 1, 0 }, | 542 | { "DDR3 VTT", 2, 0, 10, 1, 0 }, |
| @@ -560,7 +563,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 560 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 563 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
| 561 | { NULL, 0, 0, 0, 0, 0 } } | 564 | { NULL, 0, 0, 0, 0, 0 } } |
| 562 | }, | 565 | }, |
| 563 | { 0x001C, "unknown", { | 566 | { 0x001C, NULL /* Unknown, need DMI string */, { |
| 564 | { "CPU Core", 0, 0, 10, 1, 0 }, | 567 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 565 | { "DDR2", 1, 0, 20, 1, 0 }, | 568 | { "DDR2", 1, 0, 20, 1, 0 }, |
| 566 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 569 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
| @@ -935,9 +938,18 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) | |||
| 935 | goto abituguru3_probe_error; | 938 | goto abituguru3_probe_error; |
| 936 | } | 939 | } |
| 937 | data->sensors = abituguru3_motherboards[i].sensors; | 940 | data->sensors = abituguru3_motherboards[i].sensors; |
| 941 | |||
| 938 | printk(KERN_INFO ABIT_UGURU3_NAME ": found Abit uGuru3, motherboard " | 942 | printk(KERN_INFO ABIT_UGURU3_NAME ": found Abit uGuru3, motherboard " |
| 939 | "ID: %04X (%s)\n", (unsigned int)id, | 943 | "ID: %04X\n", (unsigned int)id); |
| 940 | abituguru3_motherboards[i].name); | 944 | |
| 945 | #ifdef CONFIG_DMI | ||
| 946 | if (!abituguru3_motherboards[i].dmi_name) { | ||
| 947 | printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was " | ||
| 948 | "not detected using DMI. Please send the output of " | ||
| 949 | "\"dmidecode\" to the abituguru3 maintainer" | ||
| 950 | "(see MAINTAINERS)\n"); | ||
| 951 | } | ||
| 952 | #endif | ||
| 941 | 953 | ||
| 942 | /* Fill the sysfs attr array */ | 954 | /* Fill the sysfs attr array */ |
| 943 | sysfs_attr_i = 0; | 955 | sysfs_attr_i = 0; |
| @@ -1109,6 +1121,46 @@ static struct platform_driver abituguru3_driver = { | |||
| 1109 | .resume = abituguru3_resume | 1121 | .resume = abituguru3_resume |
| 1110 | }; | 1122 | }; |
| 1111 | 1123 | ||
| 1124 | #ifdef CONFIG_DMI | ||
| 1125 | |||
| 1126 | static int __init abituguru3_dmi_detect(void) | ||
| 1127 | { | ||
| 1128 | const char *board_vendor, *board_name; | ||
| 1129 | int i, err = (force) ? 1 : -ENODEV; | ||
| 1130 | |||
| 1131 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | ||
| 1132 | if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/")) | ||
| 1133 | return err; | ||
| 1134 | |||
| 1135 | board_name = dmi_get_system_info(DMI_BOARD_NAME); | ||
| 1136 | if (!board_name) | ||
| 1137 | return err; | ||
| 1138 | |||
| 1139 | for (i = 0; abituguru3_motherboards[i].id; i++) { | ||
| 1140 | const char *dmi_name = abituguru3_motherboards[i].dmi_name; | ||
| 1141 | if (dmi_name && !strcmp(dmi_name, board_name)) | ||
| 1142 | break; | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | if (!abituguru3_motherboards[i].id) | ||
| 1146 | return 1; | ||
| 1147 | |||
| 1148 | return 0; | ||
| 1149 | } | ||
| 1150 | |||
| 1151 | #else /* !CONFIG_DMI */ | ||
| 1152 | |||
| 1153 | static inline int abituguru3_dmi_detect(void) | ||
| 1154 | { | ||
| 1155 | return -ENODEV; | ||
| 1156 | } | ||
| 1157 | |||
| 1158 | #endif /* CONFIG_DMI */ | ||
| 1159 | |||
| 1160 | /* FIXME: Manual detection should die eventually; we need to collect stable | ||
| 1161 | * DMI model names first before we can rely entirely on CONFIG_DMI. | ||
| 1162 | */ | ||
| 1163 | |||
| 1112 | static int __init abituguru3_detect(void) | 1164 | static int __init abituguru3_detect(void) |
| 1113 | { | 1165 | { |
| 1114 | /* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or | 1166 | /* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or |
| @@ -1119,7 +1171,7 @@ static int __init abituguru3_detect(void) | |||
| 1119 | if (((data_val == 0x00) || (data_val == 0x08)) && | 1171 | if (((data_val == 0x00) || (data_val == 0x08)) && |
| 1120 | ((cmd_val == 0xAC) || (cmd_val == 0x05) || | 1172 | ((cmd_val == 0xAC) || (cmd_val == 0x05) || |
| 1121 | (cmd_val == 0x55))) | 1173 | (cmd_val == 0x55))) |
| 1122 | return ABIT_UGURU3_BASE; | 1174 | return 0; |
| 1123 | 1175 | ||
| 1124 | ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = " | 1176 | ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = " |
| 1125 | "0x%02X\n", (unsigned int)data_val, (unsigned int)cmd_val); | 1177 | "0x%02X\n", (unsigned int)data_val, (unsigned int)cmd_val); |
| @@ -1127,7 +1179,7 @@ static int __init abituguru3_detect(void) | |||
| 1127 | if (force) { | 1179 | if (force) { |
| 1128 | printk(KERN_INFO ABIT_UGURU3_NAME ": Assuming Abit uGuru3 is " | 1180 | printk(KERN_INFO ABIT_UGURU3_NAME ": Assuming Abit uGuru3 is " |
| 1129 | "present because of \"force\" parameter\n"); | 1181 | "present because of \"force\" parameter\n"); |
| 1130 | return ABIT_UGURU3_BASE; | 1182 | return 0; |
| 1131 | } | 1183 | } |
| 1132 | 1184 | ||
| 1133 | /* No uGuru3 found */ | 1185 | /* No uGuru3 found */ |
| @@ -1138,27 +1190,29 @@ static struct platform_device *abituguru3_pdev; | |||
| 1138 | 1190 | ||
| 1139 | static int __init abituguru3_init(void) | 1191 | static int __init abituguru3_init(void) |
| 1140 | { | 1192 | { |
| 1141 | int address, err; | ||
| 1142 | struct resource res = { .flags = IORESOURCE_IO }; | 1193 | struct resource res = { .flags = IORESOURCE_IO }; |
| 1143 | 1194 | int err; | |
| 1144 | #ifdef CONFIG_DMI | 1195 | |
| 1145 | const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1196 | /* Attempt DMI detection first */ |
| 1146 | 1197 | err = abituguru3_dmi_detect(); | |
| 1147 | /* safety check, refuse to load on non Abit motherboards */ | 1198 | if (err < 0) |
| 1148 | if (!force && (!board_vendor || | 1199 | return err; |
| 1149 | strcmp(board_vendor, "http://www.abit.com.tw/"))) | 1200 | |
| 1150 | return -ENODEV; | 1201 | /* Fall back to manual detection if there was no exact |
| 1151 | #endif | 1202 | * board name match, or force was specified. |
| 1152 | 1203 | */ | |
| 1153 | address = abituguru3_detect(); | 1204 | if (err > 0) { |
| 1154 | if (address < 0) | 1205 | err = abituguru3_detect(); |
| 1155 | return address; | 1206 | if (err) |
| 1207 | return err; | ||
| 1208 | } | ||
| 1156 | 1209 | ||
| 1157 | err = platform_driver_register(&abituguru3_driver); | 1210 | err = platform_driver_register(&abituguru3_driver); |
| 1158 | if (err) | 1211 | if (err) |
| 1159 | goto exit; | 1212 | goto exit; |
| 1160 | 1213 | ||
| 1161 | abituguru3_pdev = platform_device_alloc(ABIT_UGURU3_NAME, address); | 1214 | abituguru3_pdev = platform_device_alloc(ABIT_UGURU3_NAME, |
| 1215 | ABIT_UGURU3_BASE); | ||
| 1162 | if (!abituguru3_pdev) { | 1216 | if (!abituguru3_pdev) { |
| 1163 | printk(KERN_ERR ABIT_UGURU3_NAME | 1217 | printk(KERN_ERR ABIT_UGURU3_NAME |
| 1164 | ": Device allocation failed\n"); | 1218 | ": Device allocation failed\n"); |
| @@ -1166,8 +1220,8 @@ static int __init abituguru3_init(void) | |||
| 1166 | goto exit_driver_unregister; | 1220 | goto exit_driver_unregister; |
| 1167 | } | 1221 | } |
| 1168 | 1222 | ||
| 1169 | res.start = address; | 1223 | res.start = ABIT_UGURU3_BASE; |
| 1170 | res.end = address + ABIT_UGURU3_REGION_LENGTH - 1; | 1224 | res.end = ABIT_UGURU3_BASE + ABIT_UGURU3_REGION_LENGTH - 1; |
| 1171 | res.name = ABIT_UGURU3_NAME; | 1225 | res.name = ABIT_UGURU3_NAME; |
| 1172 | 1226 | ||
| 1173 | err = platform_device_add_resources(abituguru3_pdev, &res, 1); | 1227 | err = platform_device_add_resources(abituguru3_pdev, &res, 1); |
diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c index ce8d94fbfd7e..bfda8c80ef24 100644 --- a/drivers/hwmon/ad7414.c +++ b/drivers/hwmon/ad7414.c | |||
| @@ -69,7 +69,7 @@ static inline int ad7414_write(struct i2c_client *client, u8 reg, u8 value) | |||
| 69 | return i2c_smbus_write_byte_data(client, reg, value); | 69 | return i2c_smbus_write_byte_data(client, reg, value); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | struct ad7414_data *ad7414_update_device(struct device *dev) | 72 | static struct ad7414_data *ad7414_update_device(struct device *dev) |
| 73 | { | 73 | { |
| 74 | struct i2c_client *client = to_i2c_client(dev); | 74 | struct i2c_client *client = to_i2c_client(dev); |
| 75 | struct ad7414_data *data = i2c_get_clientdata(client); | 75 | struct ad7414_data *data = i2c_get_clientdata(client); |
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c new file mode 100644 index 000000000000..242294db3db6 --- /dev/null +++ b/drivers/hwmon/adcxx.c | |||
| @@ -0,0 +1,329 @@ | |||
| 1 | /* | ||
| 2 | * adcxx.c | ||
| 3 | * | ||
| 4 | * The adcxx4s is an AD converter family from National Semiconductor (NS). | ||
| 5 | * | ||
| 6 | * Copyright (c) 2008 Marc Pignat <marc.pignat@hevs.ch> | ||
| 7 | * | ||
| 8 | * The adcxx4s communicates with a host processor via an SPI/Microwire Bus | ||
| 9 | * interface. This driver supports the whole family of devices with name | ||
| 10 | * ADC<bb><c>S<sss>, where | ||
| 11 | * * bb is the resolution in number of bits (8, 10, 12) | ||
| 12 | * * c is the number of channels (1, 2, 4, 8) | ||
| 13 | * * sss is the maximum conversion speed (021 for 200 kSPS, 051 for 500 kSPS | ||
| 14 | * and 101 for 1 MSPS) | ||
| 15 | * | ||
| 16 | * Complete datasheets are available at National's website here: | ||
| 17 | * http://www.national.com/ds/DC/ADC<bb><c>S<sss>.pdf | ||
| 18 | * | ||
| 19 | * Handling of 8, 10 and 12 bits converters are the same, the | ||
| 20 | * unavailable bits are 0 :) | ||
| 21 | * | ||
| 22 | * This program is free software; you can redistribute it and/or modify | ||
| 23 | * it under the terms of the GNU General Public License as published by | ||
| 24 | * the Free Software Foundation; either version 2 of the License, or | ||
| 25 | * (at your option) any later version. | ||
| 26 | * | ||
| 27 | * This program is distributed in the hope that it will be useful, | ||
| 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 30 | * GNU General Public License for more details. | ||
| 31 | * | ||
| 32 | * You should have received a copy of the GNU General Public License | ||
| 33 | * along with this program; if not, write to the Free Software | ||
| 34 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 35 | */ | ||
| 36 | |||
| 37 | #include <linux/init.h> | ||
| 38 | #include <linux/module.h> | ||
| 39 | #include <linux/kernel.h> | ||
| 40 | #include <linux/device.h> | ||
| 41 | #include <linux/err.h> | ||
| 42 | #include <linux/sysfs.h> | ||
| 43 | #include <linux/hwmon.h> | ||
| 44 | #include <linux/hwmon-sysfs.h> | ||
| 45 | #include <linux/mutex.h> | ||
| 46 | #include <linux/spi/spi.h> | ||
| 47 | |||
| 48 | #define DRVNAME "adcxx" | ||
| 49 | |||
| 50 | struct adcxx { | ||
| 51 | struct device *hwmon_dev; | ||
| 52 | struct mutex lock; | ||
| 53 | u32 channels; | ||
| 54 | u32 reference; /* in millivolts */ | ||
| 55 | }; | ||
| 56 | |||
| 57 | /* sysfs hook function */ | ||
| 58 | static ssize_t adcxx_read(struct device *dev, | ||
| 59 | struct device_attribute *devattr, char *buf) | ||
| 60 | { | ||
| 61 | struct spi_device *spi = to_spi_device(dev); | ||
| 62 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
| 63 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | ||
| 64 | u8 tx_buf[2] = { attr->index << 3 }; /* other bits are don't care */ | ||
| 65 | u8 rx_buf[2]; | ||
| 66 | int status; | ||
| 67 | int value; | ||
| 68 | |||
| 69 | if (mutex_lock_interruptible(&adc->lock)) | ||
| 70 | return -ERESTARTSYS; | ||
| 71 | |||
| 72 | status = spi_write_then_read(spi, tx_buf, sizeof(tx_buf), | ||
| 73 | rx_buf, sizeof(rx_buf)); | ||
| 74 | if (status < 0) { | ||
| 75 | dev_warn(dev, "spi_write_then_read failed with status %d\n", | ||
| 76 | status); | ||
| 77 | goto out; | ||
| 78 | } | ||
| 79 | |||
| 80 | value = (rx_buf[0] << 8) + rx_buf[1]; | ||
| 81 | dev_dbg(dev, "raw value = 0x%x\n", value); | ||
| 82 | |||
| 83 | value = value * adc->reference >> 12; | ||
| 84 | status = sprintf(buf, "%d\n", value); | ||
| 85 | out: | ||
| 86 | mutex_unlock(&adc->lock); | ||
| 87 | return status; | ||
| 88 | } | ||
| 89 | |||
| 90 | static ssize_t adcxx_show_min(struct device *dev, | ||
| 91 | struct device_attribute *devattr, char *buf) | ||
| 92 | { | ||
| 93 | /* The minimum reference is 0 for this chip family */ | ||
| 94 | return sprintf(buf, "0\n"); | ||
| 95 | } | ||
| 96 | |||
| 97 | static ssize_t adcxx_show_max(struct device *dev, | ||
| 98 | struct device_attribute *devattr, char *buf) | ||
| 99 | { | ||
| 100 | struct spi_device *spi = to_spi_device(dev); | ||
| 101 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | ||
| 102 | u32 reference; | ||
| 103 | |||
| 104 | if (mutex_lock_interruptible(&adc->lock)) | ||
| 105 | return -ERESTARTSYS; | ||
| 106 | |||
| 107 | reference = adc->reference; | ||
| 108 | |||
| 109 | mutex_unlock(&adc->lock); | ||
| 110 | |||
| 111 | return sprintf(buf, "%d\n", reference); | ||
| 112 | } | ||
| 113 | |||
| 114 | static ssize_t adcxx_set_max(struct device *dev, | ||
| 115 | struct device_attribute *devattr, const char *buf, size_t count) | ||
| 116 | { | ||
| 117 | struct spi_device *spi = to_spi_device(dev); | ||
| 118 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | ||
| 119 | unsigned long value; | ||
| 120 | |||
| 121 | if (strict_strtoul(buf, 10, &value)) | ||
| 122 | return -EINVAL; | ||
| 123 | |||
| 124 | if (mutex_lock_interruptible(&adc->lock)) | ||
| 125 | return -ERESTARTSYS; | ||
| 126 | |||
| 127 | adc->reference = value; | ||
| 128 | |||
| 129 | mutex_unlock(&adc->lock); | ||
| 130 | |||
| 131 | return count; | ||
| 132 | } | ||
| 133 | |||
| 134 | static ssize_t adcxx_show_name(struct device *dev, struct device_attribute | ||
| 135 | *devattr, char *buf) | ||
| 136 | { | ||
| 137 | struct spi_device *spi = to_spi_device(dev); | ||
| 138 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | ||
| 139 | |||
| 140 | return sprintf(buf, "adcxx%ds\n", adc->channels); | ||
| 141 | } | ||
| 142 | |||
| 143 | static struct sensor_device_attribute ad_input[] = { | ||
| 144 | SENSOR_ATTR(name, S_IRUGO, adcxx_show_name, NULL, 0), | ||
| 145 | SENSOR_ATTR(in_min, S_IRUGO, adcxx_show_min, NULL, 0), | ||
| 146 | SENSOR_ATTR(in_max, S_IWUSR | S_IRUGO, adcxx_show_max, | ||
| 147 | adcxx_set_max, 0), | ||
| 148 | SENSOR_ATTR(in0_input, S_IRUGO, adcxx_read, NULL, 0), | ||
| 149 | SENSOR_ATTR(in1_input, S_IRUGO, adcxx_read, NULL, 1), | ||
| 150 | SENSOR_ATTR(in2_input, S_IRUGO, adcxx_read, NULL, 2), | ||
| 151 | SENSOR_ATTR(in3_input, S_IRUGO, adcxx_read, NULL, 3), | ||
| 152 | SENSOR_ATTR(in4_input, S_IRUGO, adcxx_read, NULL, 4), | ||
| 153 | SENSOR_ATTR(in5_input, S_IRUGO, adcxx_read, NULL, 5), | ||
| 154 | SENSOR_ATTR(in6_input, S_IRUGO, adcxx_read, NULL, 6), | ||
| 155 | SENSOR_ATTR(in7_input, S_IRUGO, adcxx_read, NULL, 7), | ||
| 156 | }; | ||
| 157 | |||
| 158 | /*----------------------------------------------------------------------*/ | ||
| 159 | |||
| 160 | static int __devinit adcxx_probe(struct spi_device *spi, int channels) | ||
| 161 | { | ||
| 162 | struct adcxx *adc; | ||
| 163 | int status; | ||
| 164 | int i; | ||
| 165 | |||
| 166 | adc = kzalloc(sizeof *adc, GFP_KERNEL); | ||
| 167 | if (!adc) | ||
| 168 | return -ENOMEM; | ||
| 169 | |||
| 170 | /* set a default value for the reference */ | ||
| 171 | adc->reference = 3300; | ||
| 172 | adc->channels = channels; | ||
| 173 | mutex_init(&adc->lock); | ||
| 174 | |||
| 175 | mutex_lock(&adc->lock); | ||
| 176 | |||
| 177 | dev_set_drvdata(&spi->dev, adc); | ||
| 178 | |||
| 179 | for (i = 0; i < 3 + adc->channels; i++) { | ||
| 180 | status = device_create_file(&spi->dev, &ad_input[i].dev_attr); | ||
| 181 | if (status) { | ||
| 182 | dev_err(&spi->dev, "device_create_file failed.\n"); | ||
| 183 | goto out_err; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | adc->hwmon_dev = hwmon_device_register(&spi->dev); | ||
| 188 | if (IS_ERR(adc->hwmon_dev)) { | ||
| 189 | dev_err(&spi->dev, "hwmon_device_register failed.\n"); | ||
| 190 | status = PTR_ERR(adc->hwmon_dev); | ||
| 191 | goto out_err; | ||
| 192 | } | ||
| 193 | |||
| 194 | mutex_unlock(&adc->lock); | ||
| 195 | return 0; | ||
| 196 | |||
| 197 | out_err: | ||
| 198 | for (i--; i >= 0; i--) | ||
| 199 | device_remove_file(&spi->dev, &ad_input[i].dev_attr); | ||
| 200 | |||
| 201 | dev_set_drvdata(&spi->dev, NULL); | ||
| 202 | mutex_unlock(&adc->lock); | ||
| 203 | kfree(adc); | ||
| 204 | return status; | ||
| 205 | } | ||
| 206 | |||
| 207 | static int __devinit adcxx1s_probe(struct spi_device *spi) | ||
| 208 | { | ||
| 209 | return adcxx_probe(spi, 1); | ||
| 210 | } | ||
| 211 | |||
| 212 | static int __devinit adcxx2s_probe(struct spi_device *spi) | ||
| 213 | { | ||
| 214 | return adcxx_probe(spi, 2); | ||
| 215 | } | ||
| 216 | |||
| 217 | static int __devinit adcxx4s_probe(struct spi_device *spi) | ||
| 218 | { | ||
| 219 | return adcxx_probe(spi, 4); | ||
| 220 | } | ||
| 221 | |||
| 222 | static int __devinit adcxx8s_probe(struct spi_device *spi) | ||
| 223 | { | ||
| 224 | return adcxx_probe(spi, 8); | ||
| 225 | } | ||
| 226 | |||
| 227 | static int __devexit adcxx_remove(struct spi_device *spi) | ||
| 228 | { | ||
| 229 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | ||
| 230 | int i; | ||
| 231 | |||
| 232 | mutex_lock(&adc->lock); | ||
| 233 | hwmon_device_unregister(adc->hwmon_dev); | ||
| 234 | for (i = 0; i < 3 + adc->channels; i++) | ||
| 235 | device_remove_file(&spi->dev, &ad_input[i].dev_attr); | ||
| 236 | |||
| 237 | dev_set_drvdata(&spi->dev, NULL); | ||
| 238 | mutex_unlock(&adc->lock); | ||
| 239 | kfree(adc); | ||
| 240 | |||
| 241 | return 0; | ||
| 242 | } | ||
| 243 | |||
| 244 | static struct spi_driver adcxx1s_driver = { | ||
| 245 | .driver = { | ||
| 246 | .name = "adcxx1s", | ||
| 247 | .owner = THIS_MODULE, | ||
| 248 | }, | ||
| 249 | .probe = adcxx1s_probe, | ||
| 250 | .remove = __devexit_p(adcxx_remove), | ||
| 251 | }; | ||
| 252 | |||
| 253 | static struct spi_driver adcxx2s_driver = { | ||
| 254 | .driver = { | ||
| 255 | .name = "adcxx2s", | ||
| 256 | .owner = THIS_MODULE, | ||
| 257 | }, | ||
| 258 | .probe = adcxx2s_probe, | ||
| 259 | .remove = __devexit_p(adcxx_remove), | ||
| 260 | }; | ||
| 261 | |||
| 262 | static struct spi_driver adcxx4s_driver = { | ||
| 263 | .driver = { | ||
| 264 | .name = "adcxx4s", | ||
| 265 | .owner = THIS_MODULE, | ||
| 266 | }, | ||
| 267 | .probe = adcxx4s_probe, | ||
| 268 | .remove = __devexit_p(adcxx_remove), | ||
| 269 | }; | ||
| 270 | |||
| 271 | static struct spi_driver adcxx8s_driver = { | ||
| 272 | .driver = { | ||
| 273 | .name = "adcxx8s", | ||
| 274 | .owner = THIS_MODULE, | ||
| 275 | }, | ||
| 276 | .probe = adcxx8s_probe, | ||
| 277 | .remove = __devexit_p(adcxx_remove), | ||
| 278 | }; | ||
| 279 | |||
| 280 | static int __init init_adcxx(void) | ||
| 281 | { | ||
| 282 | int status; | ||
| 283 | status = spi_register_driver(&adcxx1s_driver); | ||
| 284 | if (status) | ||
| 285 | goto reg_1_failed; | ||
| 286 | |||
| 287 | status = spi_register_driver(&adcxx2s_driver); | ||
| 288 | if (status) | ||
| 289 | goto reg_2_failed; | ||
| 290 | |||
| 291 | status = spi_register_driver(&adcxx4s_driver); | ||
| 292 | if (status) | ||
| 293 | goto reg_4_failed; | ||
| 294 | |||
| 295 | status = spi_register_driver(&adcxx8s_driver); | ||
| 296 | if (status) | ||
| 297 | goto reg_8_failed; | ||
| 298 | |||
| 299 | return status; | ||
| 300 | |||
| 301 | reg_8_failed: | ||
| 302 | spi_unregister_driver(&adcxx4s_driver); | ||
| 303 | reg_4_failed: | ||
| 304 | spi_unregister_driver(&adcxx2s_driver); | ||
| 305 | reg_2_failed: | ||
| 306 | spi_unregister_driver(&adcxx1s_driver); | ||
| 307 | reg_1_failed: | ||
| 308 | return status; | ||
| 309 | } | ||
| 310 | |||
| 311 | static void __exit exit_adcxx(void) | ||
| 312 | { | ||
| 313 | spi_unregister_driver(&adcxx1s_driver); | ||
| 314 | spi_unregister_driver(&adcxx2s_driver); | ||
| 315 | spi_unregister_driver(&adcxx4s_driver); | ||
| 316 | spi_unregister_driver(&adcxx8s_driver); | ||
| 317 | } | ||
| 318 | |||
| 319 | module_init(init_adcxx); | ||
| 320 | module_exit(exit_adcxx); | ||
| 321 | |||
| 322 | MODULE_AUTHOR("Marc Pignat"); | ||
| 323 | MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver"); | ||
| 324 | MODULE_LICENSE("GPL"); | ||
| 325 | |||
| 326 | MODULE_ALIAS("adcxx1s"); | ||
| 327 | MODULE_ALIAS("adcxx2s"); | ||
| 328 | MODULE_ALIAS("adcxx4s"); | ||
| 329 | MODULE_ALIAS("adcxx8s"); | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index aacc0c4b809c..b06b8e090a27 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
| @@ -98,6 +98,12 @@ static const char* temperature_sensors_sets[][36] = { | |||
| 98 | "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", | 98 | "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", |
| 99 | "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", | 99 | "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", |
| 100 | "TM9S", "TN0H", "TS0C", NULL }, | 100 | "TM9S", "TN0H", "TS0C", NULL }, |
| 101 | /* Set 5: iMac */ | ||
| 102 | { "TC0D", "TA0P", "TG0P", "TG0D", "TG0H", "TH0P", "Tm0P", "TO0P", | ||
| 103 | "Tp0C", NULL }, | ||
| 104 | /* Set 6: Macbook3 set */ | ||
| 105 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TTF0", "TW0P", "Th0H", | ||
| 106 | "Th0S", "Th1H", NULL }, | ||
| 101 | }; | 107 | }; |
| 102 | 108 | ||
| 103 | /* List of keys used to read/write fan speeds */ | 109 | /* List of keys used to read/write fan speeds */ |
| @@ -1223,6 +1229,10 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { | |||
| 1223 | { .accelerometer = 0, .light = 0, .temperature_set = 3 }, | 1229 | { .accelerometer = 0, .light = 0, .temperature_set = 3 }, |
| 1224 | /* MacPro: temperature set 4 */ | 1230 | /* MacPro: temperature set 4 */ |
| 1225 | { .accelerometer = 0, .light = 0, .temperature_set = 4 }, | 1231 | { .accelerometer = 0, .light = 0, .temperature_set = 4 }, |
| 1232 | /* iMac: temperature set 5 */ | ||
| 1233 | { .accelerometer = 0, .light = 0, .temperature_set = 5 }, | ||
| 1234 | /* MacBook3: accelerometer and temperature set 6 */ | ||
| 1235 | { .accelerometer = 1, .light = 0, .temperature_set = 6 }, | ||
| 1226 | }; | 1236 | }; |
| 1227 | 1237 | ||
| 1228 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1238 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
| @@ -1232,10 +1242,14 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
| 1232 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1242 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
| 1233 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") }, | 1243 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") }, |
| 1234 | (void*)&applesmc_dmi_data[0]}, | 1244 | (void*)&applesmc_dmi_data[0]}, |
| 1235 | { applesmc_dmi_match, "Apple MacBook", { | 1245 | { applesmc_dmi_match, "Apple MacBook (v2)", { |
| 1236 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1246 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
| 1237 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") }, | 1247 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") }, |
| 1238 | (void*)&applesmc_dmi_data[1]}, | 1248 | (void*)&applesmc_dmi_data[1]}, |
| 1249 | { applesmc_dmi_match, "Apple MacBook (v3)", { | ||
| 1250 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | ||
| 1251 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook3") }, | ||
| 1252 | (void*)&applesmc_dmi_data[6]}, | ||
| 1239 | { applesmc_dmi_match, "Apple MacBook", { | 1253 | { applesmc_dmi_match, "Apple MacBook", { |
| 1240 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1254 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
| 1241 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, | 1255 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, |
| @@ -1248,6 +1262,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
| 1248 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1262 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
| 1249 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, | 1263 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, |
| 1250 | (void*)&applesmc_dmi_data[4]}, | 1264 | (void*)&applesmc_dmi_data[4]}, |
| 1265 | { applesmc_dmi_match, "Apple iMac", { | ||
| 1266 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | ||
| 1267 | DMI_MATCH(DMI_PRODUCT_NAME,"iMac") }, | ||
| 1268 | (void*)&applesmc_dmi_data[5]}, | ||
| 1251 | { .ident = NULL } | 1269 | { .ident = NULL } |
| 1252 | }; | 1270 | }; |
| 1253 | 1271 | ||
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index d191118ba0cb..d6b490d3e36f 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
| 33 | MODULE_DESCRIPTION("System voltages control via Attansic ATXP1"); | 33 | MODULE_DESCRIPTION("System voltages control via Attansic ATXP1"); |
| 34 | MODULE_VERSION("0.6.2"); | 34 | MODULE_VERSION("0.6.3"); |
| 35 | MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>"); | 35 | MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>"); |
| 36 | 36 | ||
| 37 | #define ATXP1_VID 0x00 | 37 | #define ATXP1_VID 0x00 |
| @@ -289,16 +289,16 @@ static int atxp1_detect(struct i2c_client *new_client, int kind, | |||
| 289 | if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) && | 289 | if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) && |
| 290 | (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) && | 290 | (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) && |
| 291 | (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) && | 291 | (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) && |
| 292 | (i2c_smbus_read_byte_data(new_client, 0xff) == 0) )) { | 292 | (i2c_smbus_read_byte_data(new_client, 0xff) == 0))) |
| 293 | return -ENODEV; | ||
| 293 | 294 | ||
| 294 | /* No vendor ID, now checking if registers 0x10,0x11 (non-existent) | 295 | /* No vendor ID, now checking if registers 0x10,0x11 (non-existent) |
| 295 | * showing the same as register 0x00 */ | 296 | * showing the same as register 0x00 */ |
| 296 | temp = i2c_smbus_read_byte_data(new_client, 0x00); | 297 | temp = i2c_smbus_read_byte_data(new_client, 0x00); |
| 297 | 298 | ||
| 298 | if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) && | 299 | if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) && |
| 299 | (i2c_smbus_read_byte_data(new_client, 0x11) == temp) )) | 300 | (i2c_smbus_read_byte_data(new_client, 0x11) == temp))) |
| 300 | return -ENODEV; | 301 | return -ENODEV; |
| 301 | } | ||
| 302 | 302 | ||
| 303 | /* Get VRM */ | 303 | /* Get VRM */ |
| 304 | temp = vid_which_vrm(); | 304 | temp = vid_which_vrm(); |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 70239acecc8e..93c17223b527 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -413,10 +413,11 @@ static int __init coretemp_init(void) | |||
| 413 | for_each_online_cpu(i) { | 413 | for_each_online_cpu(i) { |
| 414 | struct cpuinfo_x86 *c = &cpu_data(i); | 414 | struct cpuinfo_x86 *c = &cpu_data(i); |
| 415 | 415 | ||
| 416 | /* check if family 6, models 0xe, 0xf, 0x16, 0x17 */ | 416 | /* check if family 6, models 0xe, 0xf, 0x16, 0x17, 0x1A */ |
| 417 | if ((c->cpuid_level < 0) || (c->x86 != 0x6) || | 417 | if ((c->cpuid_level < 0) || (c->x86 != 0x6) || |
| 418 | !((c->x86_model == 0xe) || (c->x86_model == 0xf) || | 418 | !((c->x86_model == 0xe) || (c->x86_model == 0xf) || |
| 419 | (c->x86_model == 0x16) || (c->x86_model == 0x17))) { | 419 | (c->x86_model == 0x16) || (c->x86_model == 0x17) || |
| 420 | (c->x86_model == 0x1A))) { | ||
| 420 | 421 | ||
| 421 | /* supported CPU not found, but report the unknown | 422 | /* supported CPU not found, but report the unknown |
| 422 | family 6 CPU */ | 423 | family 6 CPU */ |
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index 7b0a32c4dcfb..c54eff92be4a 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
| @@ -37,13 +37,21 @@ | |||
| 37 | * For VRD 10.0 and up, "VRD x.y Design Guide", | 37 | * For VRD 10.0 and up, "VRD x.y Design Guide", |
| 38 | * available at http://developer.intel.com/. | 38 | * available at http://developer.intel.com/. |
| 39 | * | 39 | * |
| 40 | * AMD NPT 0Fh (Athlon64 & Opteron), AMD Publication 32559, | 40 | * AMD Athlon 64 and AMD Opteron Processors, AMD Publication 26094, |
| 41 | * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/26094.PDF | ||
| 42 | * Table 74. VID Code Voltages | ||
| 43 | * This corresponds to an arbitrary VRM code of 24 in the functions below. | ||
| 44 | * These CPU models (K8 revision <= E) have 5 VID pins. See also: | ||
| 45 | * Revision Guide for AMD Athlon 64 and AMD Opteron Processors, AMD Publication 25759, | ||
| 46 | * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25759.pdf | ||
| 47 | * | ||
| 48 | * AMD NPT Family 0Fh Processors, AMD Publication 32559, | ||
| 41 | * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf | 49 | * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf |
| 42 | * Table 71. VID Code Voltages | 50 | * Table 71. VID Code Voltages |
| 43 | * AMD Opteron processors don't follow the Intel specifications. | 51 | * This corresponds to an arbitrary VRM code of 25 in the functions below. |
| 44 | * I'm going to "make up" 2.4 as the spec number for the Opterons. | 52 | * These CPU models (K8 revision >= F) have 6 VID pins. See also: |
| 45 | * No good reason just a mnemonic for the 24x Opteron processor | 53 | * Revision Guide for AMD NPT Family 0Fh Processors, AMD Publication 33610, |
| 46 | * series. | 54 | * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/33610.pdf |
| 47 | * | 55 | * |
| 48 | * The 17 specification is in fact Intel Mobile Voltage Positioning - | 56 | * The 17 specification is in fact Intel Mobile Voltage Positioning - |
| 49 | * (IMVP-II). You can find more information in the datasheet of Max1718 | 57 | * (IMVP-II). You can find more information in the datasheet of Max1718 |
| @@ -95,7 +103,12 @@ int vid_from_reg(int val, u8 vrm) | |||
| 95 | return 0; | 103 | return 0; |
| 96 | return((1600000 - (val - 2) * 6250 + 500) / 1000); | 104 | return((1600000 - (val - 2) * 6250 + 500) / 1000); |
| 97 | 105 | ||
| 98 | case 24: /* AMD NPT 0Fh (Athlon64 & Opteron) */ | 106 | case 24: /* Athlon64 & Opteron */ |
| 107 | val &= 0x1f; | ||
| 108 | if (val == 0x1f) | ||
| 109 | return 0; | ||
| 110 | /* fall through */ | ||
| 111 | case 25: /* AMD NPT 0Fh */ | ||
| 99 | val &= 0x3f; | 112 | val &= 0x3f; |
| 100 | return (val < 32) ? 1550 - 25 * val | 113 | return (val < 32) ? 1550 - 25 * val |
| 101 | : 775 - (25 * (val - 31)) / 2; | 114 | : 775 - (25 * (val - 31)) / 2; |
| @@ -157,11 +170,16 @@ struct vrm_model { | |||
| 157 | 170 | ||
| 158 | #ifdef CONFIG_X86 | 171 | #ifdef CONFIG_X86 |
| 159 | 172 | ||
| 160 | /* the stepping parameter is highest acceptable stepping for current line */ | 173 | /* |
| 174 | * The stepping parameter is highest acceptable stepping for current line. | ||
| 175 | * The model match must be exact for 4-bit values. For model values 0x10 | ||
| 176 | * and above (extended model), all models below the parameter will match. | ||
| 177 | */ | ||
| 161 | 178 | ||
| 162 | static struct vrm_model vrm_models[] = { | 179 | static struct vrm_model vrm_models[] = { |
| 163 | {X86_VENDOR_AMD, 0x6, ANY, ANY, 90}, /* Athlon Duron etc */ | 180 | {X86_VENDOR_AMD, 0x6, ANY, ANY, 90}, /* Athlon Duron etc */ |
| 164 | {X86_VENDOR_AMD, 0xF, ANY, ANY, 24}, /* Athlon 64, Opteron and above VRM 24 */ | 181 | {X86_VENDOR_AMD, 0xF, 0x3F, ANY, 24}, /* Athlon 64, Opteron */ |
| 182 | {X86_VENDOR_AMD, 0xF, ANY, ANY, 25}, /* NPT family 0Fh */ | ||
| 165 | {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 13}, /* Pentium M (130 nm) */ | 183 | {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 13}, /* Pentium M (130 nm) */ |
| 166 | {X86_VENDOR_INTEL, 0x6, 0xB, ANY, 85}, /* Tualatin */ | 184 | {X86_VENDOR_INTEL, 0x6, 0xB, ANY, 85}, /* Tualatin */ |
| 167 | {X86_VENDOR_INTEL, 0x6, 0xD, ANY, 13}, /* Pentium M (90 nm) */ | 185 | {X86_VENDOR_INTEL, 0x6, 0xD, ANY, 13}, /* Pentium M (90 nm) */ |
| @@ -189,6 +207,8 @@ static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor) | |||
| 189 | if (vrm_models[i].vendor==vendor) | 207 | if (vrm_models[i].vendor==vendor) |
| 190 | if ((vrm_models[i].eff_family==eff_family) | 208 | if ((vrm_models[i].eff_family==eff_family) |
| 191 | && ((vrm_models[i].eff_model==eff_model) || | 209 | && ((vrm_models[i].eff_model==eff_model) || |
| 210 | (vrm_models[i].eff_model >= 0x10 && | ||
| 211 | eff_model <= vrm_models[i].eff_model) || | ||
| 192 | (vrm_models[i].eff_model==ANY)) && | 212 | (vrm_models[i].eff_model==ANY)) && |
| 193 | (eff_stepping <= vrm_models[i].eff_stepping)) | 213 | (eff_stepping <= vrm_models[i].eff_stepping)) |
| 194 | return vrm_models[i].vrm_type; | 214 | return vrm_models[i].vrm_type; |
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index f9e2ed621f7b..2ede9388096b 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c | |||
| @@ -81,6 +81,8 @@ static unsigned long amb_reg_temp(unsigned int amb) | |||
| 81 | #define MAX_AMBS_PER_CHANNEL 16 | 81 | #define MAX_AMBS_PER_CHANNEL 16 |
| 82 | #define MAX_AMBS (MAX_MEM_CHANNELS * \ | 82 | #define MAX_AMBS (MAX_MEM_CHANNELS * \ |
| 83 | MAX_AMBS_PER_CHANNEL) | 83 | MAX_AMBS_PER_CHANNEL) |
| 84 | #define CHANNEL_SHIFT 4 | ||
| 85 | #define DIMM_MASK 0xF | ||
| 84 | /* | 86 | /* |
| 85 | * Ugly hack: For some reason the highest bit is set if there | 87 | * Ugly hack: For some reason the highest bit is set if there |
| 86 | * are _any_ DIMMs in the channel. Attempting to read from | 88 | * are _any_ DIMMs in the channel. Attempting to read from |
| @@ -89,7 +91,7 @@ static unsigned long amb_reg_temp(unsigned int amb) | |||
| 89 | * might prevent us from seeing the 16th DIMM in the channel. | 91 | * might prevent us from seeing the 16th DIMM in the channel. |
| 90 | */ | 92 | */ |
| 91 | #define REAL_MAX_AMBS_PER_CHANNEL 15 | 93 | #define REAL_MAX_AMBS_PER_CHANNEL 15 |
| 92 | #define KNOBS_PER_AMB 5 | 94 | #define KNOBS_PER_AMB 6 |
| 93 | 95 | ||
| 94 | static unsigned long amb_num_from_reg(unsigned int byte_num, unsigned int bit) | 96 | static unsigned long amb_num_from_reg(unsigned int byte_num, unsigned int bit) |
| 95 | { | 97 | { |
| @@ -238,6 +240,16 @@ static ssize_t show_amb_temp(struct device *dev, | |||
| 238 | 500 * amb_read_byte(data, amb_reg_temp(attr->index))); | 240 | 500 * amb_read_byte(data, amb_reg_temp(attr->index))); |
| 239 | } | 241 | } |
| 240 | 242 | ||
| 243 | static ssize_t show_label(struct device *dev, | ||
| 244 | struct device_attribute *devattr, | ||
| 245 | char *buf) | ||
| 246 | { | ||
| 247 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
| 248 | |||
| 249 | return sprintf(buf, "Ch. %d DIMM %d\n", attr->index >> CHANNEL_SHIFT, | ||
| 250 | attr->index & DIMM_MASK); | ||
| 251 | } | ||
| 252 | |||
| 241 | static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | 253 | static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) |
| 242 | { | 254 | { |
| 243 | int i, j, k, d = 0; | 255 | int i, j, k, d = 0; |
| @@ -268,6 +280,20 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
| 268 | continue; | 280 | continue; |
| 269 | d++; | 281 | d++; |
| 270 | 282 | ||
| 283 | /* sysfs label */ | ||
| 284 | iattr = data->attrs + data->num_attrs; | ||
| 285 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | ||
| 286 | "temp%d_label", d); | ||
| 287 | iattr->s_attr.dev_attr.attr.name = iattr->name; | ||
| 288 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | ||
| 289 | iattr->s_attr.dev_attr.show = show_label; | ||
| 290 | iattr->s_attr.index = k; | ||
| 291 | res = device_create_file(&pdev->dev, | ||
| 292 | &iattr->s_attr.dev_attr); | ||
| 293 | if (res) | ||
| 294 | goto exit_remove; | ||
| 295 | data->num_attrs++; | ||
| 296 | |||
| 271 | /* Temperature sysfs knob */ | 297 | /* Temperature sysfs knob */ |
| 272 | iattr = data->attrs + data->num_attrs; | 298 | iattr = data->attrs + data->num_attrs; |
| 273 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, | 299 | snprintf(iattr->name, AMB_SYSFS_NAME_LEN, |
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c index c9416e657487..0f70dc204105 100644 --- a/drivers/hwmon/ibmaem.c +++ b/drivers/hwmon/ibmaem.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * A hwmon driver for the IBM Active Energy Manager temperature/power sensors | 2 | * A hwmon driver for the IBM System Director Active Energy Manager (AEM) |
| 3 | * and capping functionality. | 3 | * temperature/power/energy sensors and capping functionality. |
| 4 | * Copyright (C) 2008 IBM | 4 | * Copyright (C) 2008 IBM |
| 5 | * | 5 | * |
| 6 | * Author: Darrick J. Wong <djwong@us.ibm.com> | 6 | * Author: Darrick J. Wong <djwong@us.ibm.com> |
| @@ -463,12 +463,18 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, | |||
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | /* Update AEM energy registers */ | 465 | /* Update AEM energy registers */ |
| 466 | static void update_aem_energy_one(struct aem_data *data, int which) | ||
| 467 | { | ||
| 468 | aem_read_sensor(data, AEM_ENERGY_ELEMENT, which, | ||
| 469 | &data->energy[which], 8); | ||
| 470 | } | ||
| 471 | |||
| 466 | static void update_aem_energy(struct aem_data *data) | 472 | static void update_aem_energy(struct aem_data *data) |
| 467 | { | 473 | { |
| 468 | aem_read_sensor(data, AEM_ENERGY_ELEMENT, 0, &data->energy[0], 8); | 474 | update_aem_energy_one(data, 0); |
| 469 | if (data->ver_major < 2) | 475 | if (data->ver_major < 2) |
| 470 | return; | 476 | return; |
| 471 | aem_read_sensor(data, AEM_ENERGY_ELEMENT, 1, &data->energy[1], 8); | 477 | update_aem_energy_one(data, 1); |
| 472 | } | 478 | } |
| 473 | 479 | ||
| 474 | /* Update all AEM1 sensors */ | 480 | /* Update all AEM1 sensors */ |
| @@ -676,7 +682,8 @@ static int aem_find_aem2(struct aem_ipmi_data *data, | |||
| 676 | return -ETIMEDOUT; | 682 | return -ETIMEDOUT; |
| 677 | 683 | ||
| 678 | if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) || | 684 | if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) || |
| 679 | memcmp(&fi_resp->id, &system_x_id, sizeof(system_x_id))) | 685 | memcmp(&fi_resp->id, &system_x_id, sizeof(system_x_id)) || |
| 686 | fi_resp->num_instances <= instance_num) | ||
| 680 | return -ENOENT; | 687 | return -ENOENT; |
| 681 | 688 | ||
| 682 | return 0; | 689 | return 0; |
| @@ -849,7 +856,7 @@ static ssize_t aem_show_power(struct device *dev, | |||
| 849 | struct timespec b, a; | 856 | struct timespec b, a; |
| 850 | 857 | ||
| 851 | mutex_lock(&data->lock); | 858 | mutex_lock(&data->lock); |
| 852 | update_aem_energy(data); | 859 | update_aem_energy_one(data, attr->index); |
| 853 | getnstimeofday(&b); | 860 | getnstimeofday(&b); |
| 854 | before = data->energy[attr->index]; | 861 | before = data->energy[attr->index]; |
| 855 | 862 | ||
| @@ -861,7 +868,7 @@ static ssize_t aem_show_power(struct device *dev, | |||
| 861 | return 0; | 868 | return 0; |
| 862 | } | 869 | } |
| 863 | 870 | ||
| 864 | update_aem_energy(data); | 871 | update_aem_energy_one(data, attr->index); |
| 865 | getnstimeofday(&a); | 872 | getnstimeofday(&a); |
| 866 | after = data->energy[attr->index]; | 873 | after = data->energy[attr->index]; |
| 867 | mutex_unlock(&data->lock); | 874 | mutex_unlock(&data->lock); |
| @@ -880,7 +887,9 @@ static ssize_t aem_show_energy(struct device *dev, | |||
| 880 | { | 887 | { |
| 881 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 888 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
| 882 | struct aem_data *a = dev_get_drvdata(dev); | 889 | struct aem_data *a = dev_get_drvdata(dev); |
| 883 | a->update(a); | 890 | mutex_lock(&a->lock); |
| 891 | update_aem_energy_one(a, attr->index); | ||
| 892 | mutex_unlock(&a->lock); | ||
| 884 | 893 | ||
| 885 | return sprintf(buf, "%llu\n", | 894 | return sprintf(buf, "%llu\n", |
| 886 | (unsigned long long)a->energy[attr->index] * 1000); | 895 | (unsigned long long)a->energy[attr->index] * 1000); |
| @@ -1104,7 +1113,7 @@ static void __exit aem_exit(void) | |||
| 1104 | } | 1113 | } |
| 1105 | 1114 | ||
| 1106 | MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); | 1115 | MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); |
| 1107 | MODULE_DESCRIPTION("IBM Active Energy Manager power/temp sensor driver"); | 1116 | MODULE_DESCRIPTION("IBM AEM power/temp/energy sensor driver"); |
| 1108 | MODULE_LICENSE("GPL"); | 1117 | MODULE_LICENSE("GPL"); |
| 1109 | 1118 | ||
| 1110 | module_init(aem_init); | 1119 | module_init(aem_init); |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 30cdb0956779..f1133081cc42 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
| @@ -273,10 +273,10 @@ struct it87_data { | |||
| 273 | static inline int has_16bit_fans(const struct it87_data *data) | 273 | static inline int has_16bit_fans(const struct it87_data *data) |
| 274 | { | 274 | { |
| 275 | /* IT8705F Datasheet 0.4.1, 3h == Version G. | 275 | /* IT8705F Datasheet 0.4.1, 3h == Version G. |
| 276 | IT8712F Datasheet 0.9.1, section 8.3.5 indicates 7h == Version I. | 276 | IT8712F Datasheet 0.9.1, section 8.3.5 indicates 8h == Version J. |
| 277 | These are the first revisions with 16bit tachometer support. */ | 277 | These are the first revisions with 16bit tachometer support. */ |
| 278 | return (data->type == it87 && data->revision >= 0x03) | 278 | return (data->type == it87 && data->revision >= 0x03) |
| 279 | || (data->type == it8712 && data->revision >= 0x07) | 279 | || (data->type == it8712 && data->revision >= 0x08) |
| 280 | || data->type == it8716 | 280 | || data->type == it8716 |
| 281 | || data->type == it8718; | 281 | || data->type == it8718; |
| 282 | } | 282 | } |
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index daa7d121483b..de21142d106c 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c | |||
| @@ -1055,9 +1055,10 @@ static int w83791d_probe(struct i2c_client *client, | |||
| 1055 | { | 1055 | { |
| 1056 | struct w83791d_data *data; | 1056 | struct w83791d_data *data; |
| 1057 | struct device *dev = &client->dev; | 1057 | struct device *dev = &client->dev; |
| 1058 | int i, val1, err; | 1058 | int i, err; |
| 1059 | 1059 | ||
| 1060 | #ifdef DEBUG | 1060 | #ifdef DEBUG |
| 1061 | int val1; | ||
| 1061 | val1 = w83791d_read(client, W83791D_REG_DID_VID4); | 1062 | val1 = w83791d_read(client, W83791D_REG_DID_VID4); |
| 1062 | dev_dbg(dev, "Device ID version: %d.%d (0x%02x)\n", | 1063 | dev_dbg(dev, "Device ID version: %d.%d (0x%02x)\n", |
| 1063 | (val1 >> 5) & 0x07, (val1 >> 1) & 0x0f, val1); | 1064 | (val1 >> 5) & 0x07, (val1 >> 1) & 0x0f, val1); |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index c1adcdbf7979..9efb02137254 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/version.h> | ||
| 18 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
| 19 | #include <linux/err.h> | 18 | #include <linux/err.h> |
| 20 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 22f6d5c00d80..0e7b1c6724aa 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
| @@ -180,7 +180,7 @@ static const struct i2c_algorithm i2c_powermac_algorithm = { | |||
| 180 | }; | 180 | }; |
| 181 | 181 | ||
| 182 | 182 | ||
| 183 | static int i2c_powermac_remove(struct platform_device *dev) | 183 | static int __devexit i2c_powermac_remove(struct platform_device *dev) |
| 184 | { | 184 | { |
| 185 | struct i2c_adapter *adapter = platform_get_drvdata(dev); | 185 | struct i2c_adapter *adapter = platform_get_drvdata(dev); |
| 186 | struct pmac_i2c_bus *bus = i2c_get_adapdata(adapter); | 186 | struct pmac_i2c_bus *bus = i2c_get_adapdata(adapter); |
| @@ -200,7 +200,7 @@ static int i2c_powermac_remove(struct platform_device *dev) | |||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | 202 | ||
| 203 | static int __devexit i2c_powermac_probe(struct platform_device *dev) | 203 | static int __devinit i2c_powermac_probe(struct platform_device *dev) |
| 204 | { | 204 | { |
| 205 | struct pmac_i2c_bus *bus = dev->dev.platform_data; | 205 | struct pmac_i2c_bus *bus = dev->dev.platform_data; |
| 206 | struct device_node *parent = NULL; | 206 | struct device_node *parent = NULL; |
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 840e634fa31f..640cbb237328 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c | |||
| @@ -31,13 +31,84 @@ | |||
| 31 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
| 32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
| 33 | 33 | ||
| 34 | /* Transmit operation: */ | ||
| 35 | /* */ | ||
| 36 | /* 0 byte transmit */ | ||
| 37 | /* BUS: S A8 ACK P */ | ||
| 38 | /* IRQ: DTE WAIT */ | ||
| 39 | /* ICIC: */ | ||
| 40 | /* ICCR: 0x94 0x90 */ | ||
| 41 | /* ICDR: A8 */ | ||
| 42 | /* */ | ||
| 43 | /* 1 byte transmit */ | ||
| 44 | /* BUS: S A8 ACK D8(1) ACK P */ | ||
| 45 | /* IRQ: DTE WAIT WAIT */ | ||
| 46 | /* ICIC: -DTE */ | ||
| 47 | /* ICCR: 0x94 0x90 */ | ||
| 48 | /* ICDR: A8 D8(1) */ | ||
| 49 | /* */ | ||
| 50 | /* 2 byte transmit */ | ||
| 51 | /* BUS: S A8 ACK D8(1) ACK D8(2) ACK P */ | ||
| 52 | /* IRQ: DTE WAIT WAIT WAIT */ | ||
| 53 | /* ICIC: -DTE */ | ||
| 54 | /* ICCR: 0x94 0x90 */ | ||
| 55 | /* ICDR: A8 D8(1) D8(2) */ | ||
| 56 | /* */ | ||
| 57 | /* 3 bytes or more, +---------+ gets repeated */ | ||
| 58 | /* */ | ||
| 59 | /* */ | ||
| 60 | /* Receive operation: */ | ||
| 61 | /* */ | ||
| 62 | /* 0 byte receive - not supported since slave may hold SDA low */ | ||
| 63 | /* */ | ||
| 64 | /* 1 byte receive [TX] | [RX] */ | ||
| 65 | /* BUS: S A8 ACK | D8(1) ACK P */ | ||
| 66 | /* IRQ: DTE WAIT | WAIT DTE */ | ||
| 67 | /* ICIC: -DTE | +DTE */ | ||
| 68 | /* ICCR: 0x94 0x81 | 0xc0 */ | ||
| 69 | /* ICDR: A8 | D8(1) */ | ||
| 70 | /* */ | ||
| 71 | /* 2 byte receive [TX]| [RX] */ | ||
| 72 | /* BUS: S A8 ACK | D8(1) ACK D8(2) ACK P */ | ||
| 73 | /* IRQ: DTE WAIT | WAIT WAIT DTE */ | ||
| 74 | /* ICIC: -DTE | +DTE */ | ||
| 75 | /* ICCR: 0x94 0x81 | 0xc0 */ | ||
| 76 | /* ICDR: A8 | D8(1) D8(2) */ | ||
| 77 | /* */ | ||
| 78 | /* 3 byte receive [TX] | [RX] */ | ||
| 79 | /* BUS: S A8 ACK | D8(1) ACK D8(2) ACK D8(3) ACK P */ | ||
| 80 | /* IRQ: DTE WAIT | WAIT WAIT WAIT DTE */ | ||
| 81 | /* ICIC: -DTE | +DTE */ | ||
| 82 | /* ICCR: 0x94 0x81 | 0xc0 */ | ||
| 83 | /* ICDR: A8 | D8(1) D8(2) D8(3) */ | ||
| 84 | /* */ | ||
| 85 | /* 4 bytes or more, this part is repeated +---------+ */ | ||
| 86 | /* */ | ||
| 87 | /* */ | ||
| 88 | /* Interrupt order and BUSY flag */ | ||
| 89 | /* ___ _ */ | ||
| 90 | /* SDA ___\___XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAA___/ */ | ||
| 91 | /* SCL \_/1\_/2\_/3\_/4\_/5\_/6\_/7\_/8\___/9\_____/ */ | ||
| 92 | /* */ | ||
| 93 | /* S D7 D6 D5 D4 D3 D2 D1 D0 P */ | ||
| 94 | /* ___ */ | ||
| 95 | /* WAIT IRQ ________________________________/ \___________ */ | ||
| 96 | /* TACK IRQ ____________________________________/ \_______ */ | ||
| 97 | /* DTE IRQ __________________________________________/ \_ */ | ||
| 98 | /* AL IRQ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ | ||
| 99 | /* _______________________________________________ */ | ||
| 100 | /* BUSY __/ \_ */ | ||
| 101 | /* */ | ||
| 102 | |||
| 34 | enum sh_mobile_i2c_op { | 103 | enum sh_mobile_i2c_op { |
| 35 | OP_START = 0, | 104 | OP_START = 0, |
| 36 | OP_TX_ONLY, | 105 | OP_TX_FIRST, |
| 106 | OP_TX, | ||
| 37 | OP_TX_STOP, | 107 | OP_TX_STOP, |
| 38 | OP_TX_TO_RX, | 108 | OP_TX_TO_RX, |
| 39 | OP_RX_ONLY, | 109 | OP_RX, |
| 40 | OP_RX_STOP, | 110 | OP_RX_STOP, |
| 111 | OP_RX_STOP_DATA, | ||
| 41 | }; | 112 | }; |
| 42 | 113 | ||
| 43 | struct sh_mobile_i2c_data { | 114 | struct sh_mobile_i2c_data { |
| @@ -127,25 +198,34 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, | |||
| 127 | spin_lock_irqsave(&pd->lock, flags); | 198 | spin_lock_irqsave(&pd->lock, flags); |
| 128 | 199 | ||
| 129 | switch (op) { | 200 | switch (op) { |
| 130 | case OP_START: | 201 | case OP_START: /* issue start and trigger DTE interrupt */ |
| 131 | iowrite8(0x94, ICCR(pd)); | 202 | iowrite8(0x94, ICCR(pd)); |
| 132 | break; | 203 | break; |
| 133 | case OP_TX_ONLY: | 204 | case OP_TX_FIRST: /* disable DTE interrupt and write data */ |
| 205 | iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE, ICIC(pd)); | ||
| 134 | iowrite8(data, ICDR(pd)); | 206 | iowrite8(data, ICDR(pd)); |
| 135 | break; | 207 | break; |
| 136 | case OP_TX_STOP: | 208 | case OP_TX: /* write data */ |
| 137 | iowrite8(data, ICDR(pd)); | 209 | iowrite8(data, ICDR(pd)); |
| 138 | iowrite8(0x90, ICCR(pd)); | ||
| 139 | iowrite8(ICIC_ALE | ICIC_TACKE, ICIC(pd)); | ||
| 140 | break; | 210 | break; |
| 141 | case OP_TX_TO_RX: | 211 | case OP_TX_STOP: /* write data and issue a stop afterwards */ |
| 142 | iowrite8(data, ICDR(pd)); | 212 | iowrite8(data, ICDR(pd)); |
| 213 | iowrite8(0x90, ICCR(pd)); | ||
| 214 | break; | ||
| 215 | case OP_TX_TO_RX: /* select read mode */ | ||
| 143 | iowrite8(0x81, ICCR(pd)); | 216 | iowrite8(0x81, ICCR(pd)); |
| 144 | break; | 217 | break; |
| 145 | case OP_RX_ONLY: | 218 | case OP_RX: /* just read data */ |
| 146 | ret = ioread8(ICDR(pd)); | 219 | ret = ioread8(ICDR(pd)); |
| 147 | break; | 220 | break; |
| 148 | case OP_RX_STOP: | 221 | case OP_RX_STOP: /* enable DTE interrupt, issue stop */ |
| 222 | iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE, | ||
| 223 | ICIC(pd)); | ||
| 224 | iowrite8(0xc0, ICCR(pd)); | ||
| 225 | break; | ||
| 226 | case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */ | ||
| 227 | iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE, | ||
| 228 | ICIC(pd)); | ||
| 149 | ret = ioread8(ICDR(pd)); | 229 | ret = ioread8(ICDR(pd)); |
| 150 | iowrite8(0xc0, ICCR(pd)); | 230 | iowrite8(0xc0, ICCR(pd)); |
| 151 | break; | 231 | break; |
| @@ -157,58 +237,120 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, | |||
| 157 | return ret; | 237 | return ret; |
| 158 | } | 238 | } |
| 159 | 239 | ||
| 240 | static int sh_mobile_i2c_is_first_byte(struct sh_mobile_i2c_data *pd) | ||
| 241 | { | ||
| 242 | if (pd->pos == -1) | ||
| 243 | return 1; | ||
| 244 | |||
| 245 | return 0; | ||
| 246 | } | ||
| 247 | |||
| 248 | static int sh_mobile_i2c_is_last_byte(struct sh_mobile_i2c_data *pd) | ||
| 249 | { | ||
| 250 | if (pd->pos == (pd->msg->len - 1)) | ||
| 251 | return 1; | ||
| 252 | |||
| 253 | return 0; | ||
| 254 | } | ||
| 255 | |||
| 256 | static void sh_mobile_i2c_get_data(struct sh_mobile_i2c_data *pd, | ||
| 257 | unsigned char *buf) | ||
| 258 | { | ||
| 259 | switch (pd->pos) { | ||
| 260 | case -1: | ||
| 261 | *buf = (pd->msg->addr & 0x7f) << 1; | ||
| 262 | *buf |= (pd->msg->flags & I2C_M_RD) ? 1 : 0; | ||
| 263 | break; | ||
| 264 | default: | ||
| 265 | *buf = pd->msg->buf[pd->pos]; | ||
| 266 | } | ||
| 267 | } | ||
| 268 | |||
| 269 | static int sh_mobile_i2c_isr_tx(struct sh_mobile_i2c_data *pd) | ||
| 270 | { | ||
| 271 | unsigned char data; | ||
| 272 | |||
| 273 | if (pd->pos == pd->msg->len) | ||
| 274 | return 1; | ||
| 275 | |||
| 276 | sh_mobile_i2c_get_data(pd, &data); | ||
| 277 | |||
| 278 | if (sh_mobile_i2c_is_last_byte(pd)) | ||
| 279 | i2c_op(pd, OP_TX_STOP, data); | ||
| 280 | else if (sh_mobile_i2c_is_first_byte(pd)) | ||
| 281 | i2c_op(pd, OP_TX_FIRST, data); | ||
| 282 | else | ||
| 283 | i2c_op(pd, OP_TX, data); | ||
| 284 | |||
| 285 | pd->pos++; | ||
| 286 | return 0; | ||
| 287 | } | ||
| 288 | |||
| 289 | static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd) | ||
| 290 | { | ||
| 291 | unsigned char data; | ||
| 292 | int real_pos; | ||
| 293 | |||
| 294 | do { | ||
| 295 | if (pd->pos <= -1) { | ||
| 296 | sh_mobile_i2c_get_data(pd, &data); | ||
| 297 | |||
| 298 | if (sh_mobile_i2c_is_first_byte(pd)) | ||
| 299 | i2c_op(pd, OP_TX_FIRST, data); | ||
| 300 | else | ||
| 301 | i2c_op(pd, OP_TX, data); | ||
| 302 | break; | ||
| 303 | } | ||
| 304 | |||
| 305 | if (pd->pos == 0) { | ||
| 306 | i2c_op(pd, OP_TX_TO_RX, 0); | ||
| 307 | break; | ||
| 308 | } | ||
| 309 | |||
| 310 | real_pos = pd->pos - 2; | ||
| 311 | |||
| 312 | if (pd->pos == pd->msg->len) { | ||
| 313 | if (real_pos < 0) { | ||
| 314 | i2c_op(pd, OP_RX_STOP, 0); | ||
| 315 | break; | ||
| 316 | } | ||
| 317 | data = i2c_op(pd, OP_RX_STOP_DATA, 0); | ||
| 318 | } else | ||
| 319 | data = i2c_op(pd, OP_RX, 0); | ||
| 320 | |||
| 321 | pd->msg->buf[real_pos] = data; | ||
| 322 | } while (0); | ||
| 323 | |||
| 324 | pd->pos++; | ||
| 325 | return pd->pos == (pd->msg->len + 2); | ||
| 326 | } | ||
| 327 | |||
| 160 | static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id) | 328 | static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id) |
| 161 | { | 329 | { |
| 162 | struct platform_device *dev = dev_id; | 330 | struct platform_device *dev = dev_id; |
| 163 | struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev); | 331 | struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev); |
| 164 | struct i2c_msg *msg = pd->msg; | 332 | unsigned char sr; |
| 165 | unsigned char data, sr; | 333 | int wakeup; |
| 166 | int wakeup = 0; | ||
| 167 | 334 | ||
| 168 | sr = ioread8(ICSR(pd)); | 335 | sr = ioread8(ICSR(pd)); |
| 169 | pd->sr |= sr; | 336 | pd->sr |= sr; /* remember state */ |
| 170 | 337 | ||
| 171 | dev_dbg(pd->dev, "i2c_isr 0x%02x 0x%02x %s %d %d!\n", sr, pd->sr, | 338 | dev_dbg(pd->dev, "i2c_isr 0x%02x 0x%02x %s %d %d!\n", sr, pd->sr, |
| 172 | (msg->flags & I2C_M_RD) ? "read" : "write", | 339 | (pd->msg->flags & I2C_M_RD) ? "read" : "write", |
| 173 | pd->pos, msg->len); | 340 | pd->pos, pd->msg->len); |
| 174 | 341 | ||
| 175 | if (sr & (ICSR_AL | ICSR_TACK)) { | 342 | if (sr & (ICSR_AL | ICSR_TACK)) { |
| 176 | iowrite8(0, ICIC(pd)); /* disable interrupts */ | 343 | /* don't interrupt transaction - continue to issue stop */ |
| 177 | wakeup = 1; | 344 | iowrite8(sr & ~(ICSR_AL | ICSR_TACK), ICSR(pd)); |
| 178 | goto do_wakeup; | 345 | wakeup = 0; |
| 179 | } | 346 | } else if (pd->msg->flags & I2C_M_RD) |
| 347 | wakeup = sh_mobile_i2c_isr_rx(pd); | ||
| 348 | else | ||
| 349 | wakeup = sh_mobile_i2c_isr_tx(pd); | ||
| 180 | 350 | ||
| 181 | if (pd->pos == msg->len) { | 351 | if (sr & ICSR_WAIT) /* TODO: add delay here to support slow acks */ |
| 182 | i2c_op(pd, OP_RX_ONLY, 0); | 352 | iowrite8(sr & ~ICSR_WAIT, ICSR(pd)); |
| 183 | wakeup = 1; | ||
| 184 | goto do_wakeup; | ||
| 185 | } | ||
| 186 | 353 | ||
| 187 | if (pd->pos == -1) { | ||
| 188 | data = (msg->addr & 0x7f) << 1; | ||
| 189 | data |= (msg->flags & I2C_M_RD) ? 1 : 0; | ||
| 190 | } else | ||
| 191 | data = msg->buf[pd->pos]; | ||
| 192 | |||
| 193 | if ((pd->pos == -1) || !(msg->flags & I2C_M_RD)) { | ||
| 194 | if (msg->flags & I2C_M_RD) | ||
| 195 | i2c_op(pd, OP_TX_TO_RX, data); | ||
| 196 | else if (pd->pos == (msg->len - 1)) { | ||
| 197 | i2c_op(pd, OP_TX_STOP, data); | ||
| 198 | wakeup = 1; | ||
| 199 | } else | ||
| 200 | i2c_op(pd, OP_TX_ONLY, data); | ||
| 201 | } else { | ||
| 202 | if (pd->pos == (msg->len - 1)) | ||
| 203 | data = i2c_op(pd, OP_RX_STOP, 0); | ||
| 204 | else | ||
| 205 | data = i2c_op(pd, OP_RX_ONLY, 0); | ||
| 206 | |||
| 207 | msg->buf[pd->pos] = data; | ||
| 208 | } | ||
| 209 | pd->pos++; | ||
| 210 | |||
| 211 | do_wakeup: | ||
| 212 | if (wakeup) { | 354 | if (wakeup) { |
| 213 | pd->sr |= SW_DONE; | 355 | pd->sr |= SW_DONE; |
| 214 | wake_up(&pd->wait); | 356 | wake_up(&pd->wait); |
| @@ -219,6 +361,11 @@ static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id) | |||
| 219 | 361 | ||
| 220 | static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg) | 362 | static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg) |
| 221 | { | 363 | { |
| 364 | if (usr_msg->len == 0 && (usr_msg->flags & I2C_M_RD)) { | ||
| 365 | dev_err(pd->dev, "Unsupported zero length i2c read\n"); | ||
| 366 | return -EIO; | ||
| 367 | } | ||
| 368 | |||
| 222 | /* Initialize channel registers */ | 369 | /* Initialize channel registers */ |
| 223 | iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd)); | 370 | iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd)); |
| 224 | 371 | ||
| @@ -233,9 +380,8 @@ static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg) | |||
| 233 | pd->pos = -1; | 380 | pd->pos = -1; |
| 234 | pd->sr = 0; | 381 | pd->sr = 0; |
| 235 | 382 | ||
| 236 | /* Enable all interrupts except wait */ | 383 | /* Enable all interrupts to begin with */ |
| 237 | iowrite8(ioread8(ICIC(pd)) | ICIC_ALE | ICIC_TACKE | ICIC_DTEE, | 384 | iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE | ICIC_DTEE, ICIC(pd)); |
| 238 | ICIC(pd)); | ||
| 239 | return 0; | 385 | return 0; |
| 240 | } | 386 | } |
| 241 | 387 | ||
| @@ -268,25 +414,18 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, | |||
| 268 | if (!k) | 414 | if (!k) |
| 269 | dev_err(pd->dev, "Transfer request timed out\n"); | 415 | dev_err(pd->dev, "Transfer request timed out\n"); |
| 270 | 416 | ||
| 271 | retry_count = 10; | 417 | retry_count = 1000; |
| 272 | again: | 418 | again: |
| 273 | val = ioread8(ICSR(pd)); | 419 | val = ioread8(ICSR(pd)); |
| 274 | 420 | ||
| 275 | dev_dbg(pd->dev, "val 0x%02x pd->sr 0x%02x\n", val, pd->sr); | 421 | dev_dbg(pd->dev, "val 0x%02x pd->sr 0x%02x\n", val, pd->sr); |
| 276 | 422 | ||
| 277 | if ((val | pd->sr) & (ICSR_TACK | ICSR_AL)) { | ||
| 278 | err = -EIO; | ||
| 279 | break; | ||
| 280 | } | ||
| 281 | |||
| 282 | /* the interrupt handler may wake us up before the | 423 | /* the interrupt handler may wake us up before the |
| 283 | * transfer is finished, so poll the hardware | 424 | * transfer is finished, so poll the hardware |
| 284 | * until we're done. | 425 | * until we're done. |
| 285 | */ | 426 | */ |
| 286 | 427 | if (val & ICSR_BUSY) { | |
| 287 | if (!(!(val & ICSR_BUSY) && (val & ICSR_SCLM) && | 428 | udelay(10); |
| 288 | (val & ICSR_SDAM))) { | ||
| 289 | msleep(1); | ||
| 290 | if (retry_count--) | 429 | if (retry_count--) |
| 291 | goto again; | 430 | goto again; |
| 292 | 431 | ||
| @@ -294,6 +433,12 @@ again: | |||
| 294 | dev_err(pd->dev, "Polling timed out\n"); | 433 | dev_err(pd->dev, "Polling timed out\n"); |
| 295 | break; | 434 | break; |
| 296 | } | 435 | } |
| 436 | |||
| 437 | /* handle missing acknowledge and arbitration lost */ | ||
| 438 | if ((val | pd->sr) & (ICSR_TACK | ICSR_AL)) { | ||
| 439 | err = -EIO; | ||
| 440 | break; | ||
| 441 | } | ||
| 297 | } | 442 | } |
| 298 | 443 | ||
| 299 | deactivate_ch(pd); | 444 | deactivate_ch(pd); |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 550853f79ae8..b346a687ab59 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -108,6 +108,9 @@ static int i2c_device_probe(struct device *dev) | |||
| 108 | if (!driver->probe || !driver->id_table) | 108 | if (!driver->probe || !driver->id_table) |
| 109 | return -ENODEV; | 109 | return -ENODEV; |
| 110 | client->driver = driver; | 110 | client->driver = driver; |
| 111 | if (!device_can_wakeup(&client->dev)) | ||
| 112 | device_init_wakeup(&client->dev, | ||
| 113 | client->flags & I2C_CLIENT_WAKE); | ||
| 111 | dev_dbg(dev, "probe\n"); | 114 | dev_dbg(dev, "probe\n"); |
| 112 | 115 | ||
| 113 | status = driver->probe(client, i2c_match_id(driver->id_table, client)); | 116 | status = driver->probe(client, i2c_match_id(driver->id_table, client)); |
| @@ -262,9 +265,8 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | |||
| 262 | client->adapter = adap; | 265 | client->adapter = adap; |
| 263 | 266 | ||
| 264 | client->dev.platform_data = info->platform_data; | 267 | client->dev.platform_data = info->platform_data; |
| 265 | device_init_wakeup(&client->dev, info->flags & I2C_CLIENT_WAKE); | ||
| 266 | 268 | ||
| 267 | client->flags = info->flags & ~I2C_CLIENT_WAKE; | 269 | client->flags = info->flags; |
| 268 | client->addr = info->addr; | 270 | client->addr = info->addr; |
| 269 | client->irq = info->irq; | 271 | client->irq = info->irq; |
| 270 | 272 | ||
| @@ -1188,8 +1190,8 @@ int i2c_probe(struct i2c_adapter *adapter, | |||
| 1188 | && address_data->normal_i2c[0] == I2C_CLIENT_END) | 1190 | && address_data->normal_i2c[0] == I2C_CLIENT_END) |
| 1189 | return 0; | 1191 | return 0; |
| 1190 | 1192 | ||
| 1191 | dev_warn(&adapter->dev, "SMBus Quick command not supported, " | 1193 | dev_dbg(&adapter->dev, "SMBus Quick command not supported, " |
| 1192 | "can't probe for chips\n"); | 1194 | "can't probe for chips\n"); |
| 1193 | return -EOPNOTSUPP; | 1195 | return -EOPNOTSUPP; |
| 1194 | } | 1196 | } |
| 1195 | 1197 | ||
| @@ -1350,6 +1352,10 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) | |||
| 1350 | } | 1352 | } |
| 1351 | } | 1353 | } |
| 1352 | 1354 | ||
| 1355 | /* Stop here if the classes do not match */ | ||
| 1356 | if (!(adapter->class & driver->class)) | ||
| 1357 | goto exit_free; | ||
| 1358 | |||
| 1353 | /* Stop here if we can't use SMBUS_QUICK */ | 1359 | /* Stop here if we can't use SMBUS_QUICK */ |
| 1354 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { | 1360 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { |
| 1355 | if (address_data->probe[0] == I2C_CLIENT_END | 1361 | if (address_data->probe[0] == I2C_CLIENT_END |
| @@ -1362,10 +1368,6 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) | |||
| 1362 | goto exit_free; | 1368 | goto exit_free; |
| 1363 | } | 1369 | } |
| 1364 | 1370 | ||
| 1365 | /* Stop here if the classes do not match */ | ||
| 1366 | if (!(adapter->class & driver->class)) | ||
| 1367 | goto exit_free; | ||
| 1368 | |||
| 1369 | /* Probe entries are done second, and are not affected by ignore | 1371 | /* Probe entries are done second, and are not affected by ignore |
| 1370 | entries either */ | 1372 | entries either */ |
| 1371 | for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { | 1373 | for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index af4491fa7e34..307d976c9b69 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
| @@ -583,8 +583,10 @@ static int __init i2c_dev_init(void) | |||
| 583 | goto out; | 583 | goto out; |
| 584 | 584 | ||
| 585 | i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); | 585 | i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); |
| 586 | if (IS_ERR(i2c_dev_class)) | 586 | if (IS_ERR(i2c_dev_class)) { |
| 587 | res = PTR_ERR(i2c_dev_class); | ||
| 587 | goto out_unreg_chrdev; | 588 | goto out_unreg_chrdev; |
| 589 | } | ||
| 588 | 590 | ||
| 589 | res = i2c_add_driver(&i2cdev_driver); | 591 | res = i2c_add_driver(&i2cdev_driver); |
| 590 | if (res) | 592 | if (res) |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index a34758d29516..8e93a797c93d 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
| @@ -242,7 +242,7 @@ config BLK_DEV_IDEFLOPPY | |||
| 242 | module will be called ide-floppy. | 242 | module will be called ide-floppy. |
| 243 | 243 | ||
| 244 | config BLK_DEV_IDESCSI | 244 | config BLK_DEV_IDESCSI |
| 245 | tristate "SCSI emulation support" | 245 | tristate "SCSI emulation support (DEPRECATED)" |
| 246 | depends on SCSI | 246 | depends on SCSI |
| 247 | select IDE_ATAPI | 247 | select IDE_ATAPI |
| 248 | ---help--- | 248 | ---help--- |
| @@ -255,20 +255,6 @@ config BLK_DEV_IDESCSI | |||
| 255 | and will allow you to use a SCSI device driver instead of a native | 255 | and will allow you to use a SCSI device driver instead of a native |
| 256 | ATAPI driver. | 256 | ATAPI driver. |
| 257 | 257 | ||
| 258 | This is useful if you have an ATAPI device for which no native | ||
| 259 | driver has been written (for example, an ATAPI PD-CD drive); | ||
| 260 | you can then use this emulation together with an appropriate SCSI | ||
| 261 | device driver. In order to do this, say Y here and to "SCSI support" | ||
| 262 | and "SCSI generic support", below. You must then provide the kernel | ||
| 263 | command line "hdx=ide-scsi" (try "man bootparam" or see the | ||
| 264 | documentation of your boot loader (lilo or loadlin) about how to | ||
| 265 | pass options to the kernel at boot time) for devices if you want the | ||
| 266 | native EIDE sub-drivers to skip over the native support, so that | ||
| 267 | this SCSI emulation can be used instead. | ||
| 268 | |||
| 269 | Note that this option does NOT allow you to attach SCSI devices to a | ||
| 270 | box that doesn't have a SCSI host adapter installed. | ||
| 271 | |||
| 272 | If both this SCSI emulation and native ATAPI support are compiled | 258 | If both this SCSI emulation and native ATAPI support are compiled |
| 273 | into the kernel, the native support will be used. | 259 | into the kernel, the native support will be used. |
| 274 | 260 | ||
| @@ -306,6 +292,20 @@ config IDE_GENERIC | |||
| 306 | tristate "generic/default IDE chipset support" | 292 | tristate "generic/default IDE chipset support" |
| 307 | depends on ALPHA || X86 || IA64 || M32R || MIPS | 293 | depends on ALPHA || X86 || IA64 || M32R || MIPS |
| 308 | help | 294 | help |
| 295 | This is the generic IDE driver. This driver attaches to the | ||
| 296 | fixed legacy ports (e.g. on PCs 0x1f0/0x170, 0x1e8/0x168 and | ||
| 297 | so on). Please note that if this driver is built into the | ||
| 298 | kernel or loaded before other ATA (IDE or libata) drivers | ||
| 299 | and the controller is located at legacy ports, this driver | ||
| 300 | may grab those ports and thus can prevent the controller | ||
| 301 | specific driver from attaching. | ||
| 302 | |||
| 303 | Also, currently, IDE generic doesn't allow IRQ sharing | ||
| 304 | meaning that the IRQs it grabs won't be available to other | ||
| 305 | controllers sharing those IRQs which usually makes drivers | ||
| 306 | for those controllers fail. Generally, it's not a good idea | ||
| 307 | to load IDE generic driver on modern systems. | ||
| 308 | |||
| 309 | If unsure, say N. | 309 | If unsure, say N. |
| 310 | 310 | ||
| 311 | config BLK_DEV_PLATFORM | 311 | config BLK_DEV_PLATFORM |
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c index f788fa5a977b..4fd91dcf1dc2 100644 --- a/drivers/ide/arm/palm_bk3710.c +++ b/drivers/ide/arm/palm_bk3710.c | |||
| @@ -343,11 +343,10 @@ static struct ide_port_info __devinitdata palm_bk3710_port_info = { | |||
| 343 | .mwdma_mask = ATA_MWDMA2, | 343 | .mwdma_mask = ATA_MWDMA2, |
| 344 | }; | 344 | }; |
| 345 | 345 | ||
| 346 | static int __devinit palm_bk3710_probe(struct platform_device *pdev) | 346 | static int __init palm_bk3710_probe(struct platform_device *pdev) |
| 347 | { | 347 | { |
| 348 | struct clk *clk; | 348 | struct clk *clk; |
| 349 | struct resource *mem, *irq; | 349 | struct resource *mem, *irq; |
| 350 | struct ide_host *host; | ||
| 351 | unsigned long base, rate; | 350 | unsigned long base, rate; |
| 352 | int i, rc; | 351 | int i, rc; |
| 353 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 352 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
| @@ -390,6 +389,7 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev) | |||
| 390 | hw.io_ports_array[i] = base + IDE_PALM_ATA_PRI_REG_OFFSET + i; | 389 | hw.io_ports_array[i] = base + IDE_PALM_ATA_PRI_REG_OFFSET + i; |
| 391 | hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET; | 390 | hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET; |
| 392 | hw.irq = irq->start; | 391 | hw.irq = irq->start; |
| 392 | hw.dev = &pdev->dev; | ||
| 393 | hw.chipset = ide_palm3710; | 393 | hw.chipset = ide_palm3710; |
| 394 | 394 | ||
| 395 | palm_bk3710_port_info.udma_mask = rate < 100000000 ? ATA_UDMA4 : | 395 | palm_bk3710_port_info.udma_mask = rate < 100000000 ? ATA_UDMA4 : |
| @@ -413,13 +413,11 @@ static struct platform_driver platform_bk_driver = { | |||
| 413 | .name = "palm_bk3710", | 413 | .name = "palm_bk3710", |
| 414 | .owner = THIS_MODULE, | 414 | .owner = THIS_MODULE, |
| 415 | }, | 415 | }, |
| 416 | .probe = palm_bk3710_probe, | ||
| 417 | .remove = NULL, | ||
| 418 | }; | 416 | }; |
| 419 | 417 | ||
| 420 | static int __init palm_bk3710_init(void) | 418 | static int __init palm_bk3710_init(void) |
| 421 | { | 419 | { |
| 422 | return platform_driver_register(&platform_bk_driver); | 420 | return platform_driver_probe(&platform_bk_driver, palm_bk3710_probe); |
| 423 | } | 421 | } |
| 424 | 422 | ||
| 425 | module_init(palm_bk3710_init); | 423 | module_init(palm_bk3710_init); |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 89a112d513ad..49a8c589e346 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
| @@ -1272,9 +1272,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
| 1272 | */ | 1272 | */ |
| 1273 | static void msf_from_bcd(struct atapi_msf *msf) | 1273 | static void msf_from_bcd(struct atapi_msf *msf) |
| 1274 | { | 1274 | { |
| 1275 | msf->minute = BCD2BIN(msf->minute); | 1275 | msf->minute = bcd2bin(msf->minute); |
| 1276 | msf->second = BCD2BIN(msf->second); | 1276 | msf->second = bcd2bin(msf->second); |
| 1277 | msf->frame = BCD2BIN(msf->frame); | 1277 | msf->frame = bcd2bin(msf->frame); |
| 1278 | } | 1278 | } |
| 1279 | 1279 | ||
| 1280 | int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense) | 1280 | int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense) |
| @@ -1415,8 +1415,8 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
| 1415 | return stat; | 1415 | return stat; |
| 1416 | 1416 | ||
| 1417 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { | 1417 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { |
| 1418 | toc->hdr.first_track = BCD2BIN(toc->hdr.first_track); | 1418 | toc->hdr.first_track = bcd2bin(toc->hdr.first_track); |
| 1419 | toc->hdr.last_track = BCD2BIN(toc->hdr.last_track); | 1419 | toc->hdr.last_track = bcd2bin(toc->hdr.last_track); |
| 1420 | } | 1420 | } |
| 1421 | 1421 | ||
| 1422 | ntracks = toc->hdr.last_track - toc->hdr.first_track + 1; | 1422 | ntracks = toc->hdr.last_track - toc->hdr.first_track + 1; |
| @@ -1456,8 +1456,8 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
| 1456 | return stat; | 1456 | return stat; |
| 1457 | 1457 | ||
| 1458 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { | 1458 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { |
| 1459 | toc->hdr.first_track = (u8)BIN2BCD(CDROM_LEADOUT); | 1459 | toc->hdr.first_track = (u8)bin2bcd(CDROM_LEADOUT); |
| 1460 | toc->hdr.last_track = (u8)BIN2BCD(CDROM_LEADOUT); | 1460 | toc->hdr.last_track = (u8)bin2bcd(CDROM_LEADOUT); |
| 1461 | } else { | 1461 | } else { |
| 1462 | toc->hdr.first_track = CDROM_LEADOUT; | 1462 | toc->hdr.first_track = CDROM_LEADOUT; |
| 1463 | toc->hdr.last_track = CDROM_LEADOUT; | 1463 | toc->hdr.last_track = CDROM_LEADOUT; |
| @@ -1470,14 +1470,14 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
| 1470 | toc->hdr.toc_length = be16_to_cpu(toc->hdr.toc_length); | 1470 | toc->hdr.toc_length = be16_to_cpu(toc->hdr.toc_length); |
| 1471 | 1471 | ||
| 1472 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { | 1472 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) { |
| 1473 | toc->hdr.first_track = BCD2BIN(toc->hdr.first_track); | 1473 | toc->hdr.first_track = bcd2bin(toc->hdr.first_track); |
| 1474 | toc->hdr.last_track = BCD2BIN(toc->hdr.last_track); | 1474 | toc->hdr.last_track = bcd2bin(toc->hdr.last_track); |
| 1475 | } | 1475 | } |
| 1476 | 1476 | ||
| 1477 | for (i = 0; i <= ntracks; i++) { | 1477 | for (i = 0; i <= ntracks; i++) { |
| 1478 | if (drive->atapi_flags & IDE_AFLAG_TOCADDR_AS_BCD) { | 1478 | if (drive->atapi_flags & IDE_AFLAG_TOCADDR_AS_BCD) { |
| 1479 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) | 1479 | if (drive->atapi_flags & IDE_AFLAG_TOCTRACKS_AS_BCD) |
| 1480 | toc->ent[i].track = BCD2BIN(toc->ent[i].track); | 1480 | toc->ent[i].track = bcd2bin(toc->ent[i].track); |
| 1481 | msf_from_bcd(&toc->ent[i].addr.msf); | 1481 | msf_from_bcd(&toc->ent[i].addr.msf); |
| 1482 | } | 1482 | } |
| 1483 | toc->ent[i].addr.lba = msf_to_lba(toc->ent[i].addr.msf.minute, | 1483 | toc->ent[i].addr.lba = msf_to_lba(toc->ent[i].addr.msf.minute, |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 68b9cf0138b0..07ef88bd109b 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
| @@ -445,20 +445,6 @@ static void idedisk_check_hpa(ide_drive_t *drive) | |||
| 445 | } | 445 | } |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | /* | ||
| 449 | * Compute drive->capacity, the full capacity of the drive | ||
| 450 | * Called with drive->id != NULL. | ||
| 451 | * | ||
| 452 | * To compute capacity, this uses either of | ||
| 453 | * | ||
| 454 | * 1. CHS value set by user (whatever user sets will be trusted) | ||
| 455 | * 2. LBA value from target drive (require new ATA feature) | ||
| 456 | * 3. LBA value from system BIOS (new one is OK, old one may break) | ||
| 457 | * 4. CHS value from system BIOS (traditional style) | ||
| 458 | * | ||
| 459 | * in above order (i.e., if value of higher priority is available, | ||
| 460 | * reset will be ignored). | ||
| 461 | */ | ||
| 462 | static void init_idedisk_capacity(ide_drive_t *drive) | 448 | static void init_idedisk_capacity(ide_drive_t *drive) |
| 463 | { | 449 | { |
| 464 | struct hd_driveid *id = drive->id; | 450 | struct hd_driveid *id = drive->id; |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 1bce84b56630..3833189144ed 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -2338,7 +2338,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive) | |||
| 2338 | { | 2338 | { |
| 2339 | idetape_tape_t *tape = drive->driver_data; | 2339 | idetape_tape_t *tape = drive->driver_data; |
| 2340 | struct ide_atapi_pc pc; | 2340 | struct ide_atapi_pc pc; |
| 2341 | char fw_rev[6], vendor_id[10], product_id[18]; | 2341 | char fw_rev[4], vendor_id[8], product_id[16]; |
| 2342 | 2342 | ||
| 2343 | idetape_create_inquiry_cmd(&pc); | 2343 | idetape_create_inquiry_cmd(&pc); |
| 2344 | if (idetape_queue_pc_tail(drive, &pc)) { | 2344 | if (idetape_queue_pc_tail(drive, &pc)) { |
| @@ -2350,11 +2350,11 @@ static void idetape_get_inquiry_results(ide_drive_t *drive) | |||
| 2350 | memcpy(product_id, &pc.buf[16], 16); | 2350 | memcpy(product_id, &pc.buf[16], 16); |
| 2351 | memcpy(fw_rev, &pc.buf[32], 4); | 2351 | memcpy(fw_rev, &pc.buf[32], 4); |
| 2352 | 2352 | ||
| 2353 | ide_fixstring(vendor_id, 10, 0); | 2353 | ide_fixstring(vendor_id, 8, 0); |
| 2354 | ide_fixstring(product_id, 18, 0); | 2354 | ide_fixstring(product_id, 16, 0); |
| 2355 | ide_fixstring(fw_rev, 6, 0); | 2355 | ide_fixstring(fw_rev, 4, 0); |
| 2356 | 2356 | ||
| 2357 | printk(KERN_INFO "ide-tape: %s <-> %s: %s %s rev %s\n", | 2357 | printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n", |
| 2358 | drive->name, tape->name, vendor_id, product_id, fw_rev); | 2358 | drive->name, tape->name, vendor_id, product_id, fw_rev); |
| 2359 | } | 2359 | } |
| 2360 | 2360 | ||
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index badf79fc9e3a..39c9ee995857 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c | |||
| @@ -107,6 +107,7 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
| 107 | 107 | ||
| 108 | base = ioremap(offset, size); | 108 | base = ioremap(offset, size); |
| 109 | 109 | ||
| 110 | memset(&hw, 0, sizeof(hw)); | ||
| 110 | for (i = 0; i <= 7; i++) | 111 | for (i = 0; i <= 7; i++) |
| 111 | hw.io_ports_array[i] = | 112 | hw.io_ports_array[i] = |
| 112 | (unsigned long)(base + ((0x1f0 + i) << 5)); | 113 | (unsigned long)(base + ((0x1f0 + i) << 5)); |
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 40644b6f1c00..3187215e8f89 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
| @@ -307,7 +307,7 @@ static struct pci_driver driver = { | |||
| 307 | .name = "AEC62xx_IDE", | 307 | .name = "AEC62xx_IDE", |
| 308 | .id_table = aec62xx_pci_tbl, | 308 | .id_table = aec62xx_pci_tbl, |
| 309 | .probe = aec62xx_init_one, | 309 | .probe = aec62xx_init_one, |
| 310 | .remove = aec62xx_remove, | 310 | .remove = __devexit_p(aec62xx_remove), |
| 311 | }; | 311 | }; |
| 312 | 312 | ||
| 313 | static int __init aec62xx_ide_init(void) | 313 | static int __init aec62xx_ide_init(void) |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index bfae2f882f48..e6d8ee88d56d 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
| @@ -447,7 +447,7 @@ static struct pci_driver driver = { | |||
| 447 | .name = "Cypress_IDE", | 447 | .name = "Cypress_IDE", |
| 448 | .id_table = cy82c693_pci_tbl, | 448 | .id_table = cy82c693_pci_tbl, |
| 449 | .probe = cy82c693_init_one, | 449 | .probe = cy82c693_init_one, |
| 450 | .remove = cy82c693_remove, | 450 | .remove = __devexit_p(cy82c693_remove), |
| 451 | }; | 451 | }; |
| 452 | 452 | ||
| 453 | static int __init cy82c693_ide_init(void) | 453 | static int __init cy82c693_ide_init(void) |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 748793a413ab..c37ab1743819 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
| @@ -613,6 +613,14 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list) | |||
| 613 | return 0; | 613 | return 0; |
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | static struct hpt_info *hpt3xx_get_info(struct device *dev) | ||
| 617 | { | ||
| 618 | struct ide_host *host = dev_get_drvdata(dev); | ||
| 619 | struct hpt_info *info = (struct hpt_info *)host->host_priv; | ||
| 620 | |||
| 621 | return dev == host->dev[1] ? info + 1 : info; | ||
| 622 | } | ||
| 623 | |||
| 616 | /* | 624 | /* |
| 617 | * The Marvell bridge chips used on the HighPoint SATA cards do not seem | 625 | * The Marvell bridge chips used on the HighPoint SATA cards do not seem |
| 618 | * to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes... | 626 | * to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes... |
| @@ -621,9 +629,7 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list) | |||
| 621 | static u8 hpt3xx_udma_filter(ide_drive_t *drive) | 629 | static u8 hpt3xx_udma_filter(ide_drive_t *drive) |
| 622 | { | 630 | { |
| 623 | ide_hwif_t *hwif = HWIF(drive); | 631 | ide_hwif_t *hwif = HWIF(drive); |
| 624 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 632 | struct hpt_info *info = hpt3xx_get_info(hwif->dev); |
| 625 | struct ide_host *host = pci_get_drvdata(dev); | ||
| 626 | struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); | ||
| 627 | u8 mask = hwif->ultra_mask; | 633 | u8 mask = hwif->ultra_mask; |
| 628 | 634 | ||
| 629 | switch (info->chip_type) { | 635 | switch (info->chip_type) { |
| @@ -662,9 +668,7 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive) | |||
| 662 | static u8 hpt3xx_mdma_filter(ide_drive_t *drive) | 668 | static u8 hpt3xx_mdma_filter(ide_drive_t *drive) |
| 663 | { | 669 | { |
| 664 | ide_hwif_t *hwif = HWIF(drive); | 670 | ide_hwif_t *hwif = HWIF(drive); |
| 665 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 671 | struct hpt_info *info = hpt3xx_get_info(hwif->dev); |
| 666 | struct ide_host *host = pci_get_drvdata(dev); | ||
| 667 | struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); | ||
| 668 | 672 | ||
| 669 | switch (info->chip_type) { | 673 | switch (info->chip_type) { |
| 670 | case HPT372 : | 674 | case HPT372 : |
| @@ -700,8 +704,7 @@ static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) | |||
| 700 | { | 704 | { |
| 701 | ide_hwif_t *hwif = drive->hwif; | 705 | ide_hwif_t *hwif = drive->hwif; |
| 702 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 706 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
| 703 | struct ide_host *host = pci_get_drvdata(dev); | 707 | struct hpt_info *info = hpt3xx_get_info(hwif->dev); |
| 704 | struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); | ||
| 705 | struct hpt_timings *t = info->timings; | 708 | struct hpt_timings *t = info->timings; |
| 706 | u8 itr_addr = 0x40 + (drive->dn * 4); | 709 | u8 itr_addr = 0x40 + (drive->dn * 4); |
| 707 | u32 old_itr = 0; | 710 | u32 old_itr = 0; |
| @@ -744,8 +747,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | |||
| 744 | { | 747 | { |
| 745 | ide_hwif_t *hwif = HWIF(drive); | 748 | ide_hwif_t *hwif = HWIF(drive); |
| 746 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 749 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
| 747 | struct ide_host *host = pci_get_drvdata(dev); | 750 | struct hpt_info *info = hpt3xx_get_info(hwif->dev); |
| 748 | struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); | ||
| 749 | 751 | ||
| 750 | if (drive->quirk_list) { | 752 | if (drive->quirk_list) { |
| 751 | if (info->chip_type >= HPT370) { | 753 | if (info->chip_type >= HPT370) { |
| @@ -973,8 +975,7 @@ static int __devinit hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f | |||
| 973 | static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev) | 975 | static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev) |
| 974 | { | 976 | { |
| 975 | unsigned long io_base = pci_resource_start(dev, 4); | 977 | unsigned long io_base = pci_resource_start(dev, 4); |
| 976 | struct ide_host *host = pci_get_drvdata(dev); | 978 | struct hpt_info *info = hpt3xx_get_info(&dev->dev); |
| 977 | struct hpt_info *info = host->host_priv + (&dev->dev == host->dev[1]); | ||
| 978 | const char *name = DRV_NAME; | 979 | const char *name = DRV_NAME; |
| 979 | u8 pci_clk, dpll_clk = 0; /* PCI and DPLL clock in MHz */ | 980 | u8 pci_clk, dpll_clk = 0; /* PCI and DPLL clock in MHz */ |
| 980 | u8 chip_type; | 981 | u8 chip_type; |
| @@ -1217,8 +1218,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev) | |||
| 1217 | static u8 hpt3xx_cable_detect(ide_hwif_t *hwif) | 1218 | static u8 hpt3xx_cable_detect(ide_hwif_t *hwif) |
| 1218 | { | 1219 | { |
| 1219 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 1220 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
| 1220 | struct ide_host *host = pci_get_drvdata(dev); | 1221 | struct hpt_info *info = hpt3xx_get_info(hwif->dev); |
| 1221 | struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); | ||
| 1222 | u8 chip_type = info->chip_type; | 1222 | u8 chip_type = info->chip_type; |
| 1223 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; | 1223 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; |
| 1224 | 1224 | ||
| @@ -1262,8 +1262,7 @@ static u8 hpt3xx_cable_detect(ide_hwif_t *hwif) | |||
| 1262 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | 1262 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) |
| 1263 | { | 1263 | { |
| 1264 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 1264 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
| 1265 | struct ide_host *host = pci_get_drvdata(dev); | 1265 | struct hpt_info *info = hpt3xx_get_info(hwif->dev); |
| 1266 | struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]); | ||
| 1267 | int serialize = HPT_SERIALIZE_IO; | 1266 | int serialize = HPT_SERIALIZE_IO; |
| 1268 | u8 chip_type = info->chip_type; | 1267 | u8 chip_type = info->chip_type; |
| 1269 | u8 new_mcr, old_mcr = 0; | 1268 | u8 new_mcr, old_mcr = 0; |
| @@ -1620,7 +1619,7 @@ static struct pci_driver driver = { | |||
| 1620 | .name = "HPT366_IDE", | 1619 | .name = "HPT366_IDE", |
| 1621 | .id_table = hpt366_pci_tbl, | 1620 | .id_table = hpt366_pci_tbl, |
| 1622 | .probe = hpt366_init_one, | 1621 | .probe = hpt366_init_one, |
| 1623 | .remove = hpt366_remove, | 1622 | .remove = __devexit_p(hpt366_remove), |
| 1624 | }; | 1623 | }; |
| 1625 | 1624 | ||
| 1626 | static int __init hpt366_ide_init(void) | 1625 | static int __init hpt366_ide_init(void) |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index b6dc723de702..4a1508a707cc 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
| @@ -686,7 +686,7 @@ static struct pci_driver driver = { | |||
| 686 | .name = "ITE821x IDE", | 686 | .name = "ITE821x IDE", |
| 687 | .id_table = it821x_pci_tbl, | 687 | .id_table = it821x_pci_tbl, |
| 688 | .probe = it821x_init_one, | 688 | .probe = it821x_init_one, |
| 689 | .remove = it821x_remove, | 689 | .remove = __devexit_p(it821x_remove), |
| 690 | }; | 690 | }; |
| 691 | 691 | ||
| 692 | static int __init it821x_ide_init(void) | 692 | static int __init it821x_ide_init(void) |
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 0f609b72f470..d477da6b5858 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
| @@ -566,7 +566,7 @@ static struct pci_driver driver = { | |||
| 566 | .name = "Promise_IDE", | 566 | .name = "Promise_IDE", |
| 567 | .id_table = pdc202new_pci_tbl, | 567 | .id_table = pdc202new_pci_tbl, |
| 568 | .probe = pdc202new_init_one, | 568 | .probe = pdc202new_init_one, |
| 569 | .remove = pdc202new_remove, | 569 | .remove = __devexit_p(pdc202new_remove), |
| 570 | }; | 570 | }; |
| 571 | 571 | ||
| 572 | static int __init pdc202new_ide_init(void) | 572 | static int __init pdc202new_ide_init(void) |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 6cde48bba6f8..44cccd1e086a 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
| @@ -954,7 +954,7 @@ static struct pci_driver driver = { | |||
| 954 | .name = "SCC IDE", | 954 | .name = "SCC IDE", |
| 955 | .id_table = scc_pci_tbl, | 955 | .id_table = scc_pci_tbl, |
| 956 | .probe = scc_init_one, | 956 | .probe = scc_init_one, |
| 957 | .remove = scc_remove, | 957 | .remove = __devexit_p(scc_remove), |
| 958 | }; | 958 | }; |
| 959 | 959 | ||
| 960 | static int scc_ide_init(void) | 960 | static int scc_ide_init(void) |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 42eef19a18f1..681306c9d79b 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
| @@ -621,9 +621,9 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
| 621 | if (!request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE, | 621 | if (!request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE, |
| 622 | DRV_NAME)) { | 622 | DRV_NAME)) { |
| 623 | printk(KERN_ERR | 623 | printk(KERN_ERR |
| 624 | "%s : %s -- ERROR, Addresses " | 624 | "%s %s: -- ERROR, Addresses " |
| 625 | "0x%p to 0x%p ALREADY in use\n", | 625 | "0x%p to 0x%p ALREADY in use\n", |
| 626 | __func__, DRV_NAME, (void *) cmd_phys_base, | 626 | DRV_NAME, pci_name(dev), (void *)cmd_phys_base, |
| 627 | (void *) cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE); | 627 | (void *) cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE); |
| 628 | return -ENOMEM; | 628 | return -ENOMEM; |
| 629 | } | 629 | } |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 445ce6fbea33..db2b88a369ab 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
| @@ -832,7 +832,7 @@ static struct pci_driver driver = { | |||
| 832 | .name = "SiI_IDE", | 832 | .name = "SiI_IDE", |
| 833 | .id_table = siimage_pci_tbl, | 833 | .id_table = siimage_pci_tbl, |
| 834 | .probe = siimage_init_one, | 834 | .probe = siimage_init_one, |
| 835 | .remove = siimage_remove, | 835 | .remove = __devexit_p(siimage_remove), |
| 836 | }; | 836 | }; |
| 837 | 837 | ||
| 838 | static int __init siimage_ide_init(void) | 838 | static int __init siimage_ide_init(void) |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index e5a4b42b4e33..5efe21d6ef97 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
| @@ -610,7 +610,7 @@ static struct pci_driver driver = { | |||
| 610 | .name = "SIS_IDE", | 610 | .name = "SIS_IDE", |
| 611 | .id_table = sis5513_pci_tbl, | 611 | .id_table = sis5513_pci_tbl, |
| 612 | .probe = sis5513_init_one, | 612 | .probe = sis5513_init_one, |
| 613 | .remove = sis5513_remove, | 613 | .remove = __devexit_p(sis5513_remove), |
| 614 | }; | 614 | }; |
| 615 | 615 | ||
| 616 | static int __init sis5513_ide_init(void) | 616 | static int __init sis5513_ide_init(void) |
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 7fc88c375e5d..927277c54ec9 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c | |||
| @@ -249,7 +249,7 @@ static struct pci_driver driver = { | |||
| 249 | .name = "TC86C001", | 249 | .name = "TC86C001", |
| 250 | .id_table = tc86c001_pci_tbl, | 250 | .id_table = tc86c001_pci_tbl, |
| 251 | .probe = tc86c001_init_one, | 251 | .probe = tc86c001_init_one, |
| 252 | .remove = tc86c001_remove, | 252 | .remove = __devexit_p(tc86c001_remove), |
| 253 | }; | 253 | }; |
| 254 | 254 | ||
| 255 | static int __init tc86c001_ide_init(void) | 255 | static int __init tc86c001_ide_init(void) |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index a6b2cc83f293..94fb9ab3223f 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
| @@ -491,7 +491,7 @@ static struct pci_driver driver = { | |||
| 491 | .name = "VIA_IDE", | 491 | .name = "VIA_IDE", |
| 492 | .id_table = via_pci_tbl, | 492 | .id_table = via_pci_tbl, |
| 493 | .probe = via_init_one, | 493 | .probe = via_init_one, |
| 494 | .remove = via_remove, | 494 | .remove = __devexit_p(via_remove), |
| 495 | }; | 495 | }; |
| 496 | 496 | ||
| 497 | static int __init via_ide_init(void) | 497 | static int __init via_ide_init(void) |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 994a21e5a0aa..16240a789650 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
| @@ -844,7 +844,7 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr | |||
| 844 | ne->host = host; | 844 | ne->host = host; |
| 845 | ne->nodeid = nodeid; | 845 | ne->nodeid = nodeid; |
| 846 | ne->generation = generation; | 846 | ne->generation = generation; |
| 847 | ne->needs_probe = 1; | 847 | ne->needs_probe = true; |
| 848 | 848 | ||
| 849 | ne->guid = guid; | 849 | ne->guid = guid; |
| 850 | ne->guid_vendor_id = (guid >> 40) & 0xffffff; | 850 | ne->guid_vendor_id = (guid >> 40) & 0xffffff; |
| @@ -1144,7 +1144,7 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent | |||
| 1144 | struct csr1212_keyval *kv, *vendor_name_kv = NULL; | 1144 | struct csr1212_keyval *kv, *vendor_name_kv = NULL; |
| 1145 | u8 last_key_id = 0; | 1145 | u8 last_key_id = 0; |
| 1146 | 1146 | ||
| 1147 | ne->needs_probe = 0; | 1147 | ne->needs_probe = false; |
| 1148 | 1148 | ||
| 1149 | csr1212_for_each_dir_entry(ne->csr, kv, ne->csr->root_kv, dentry) { | 1149 | csr1212_for_each_dir_entry(ne->csr, kv, ne->csr->root_kv, dentry) { |
| 1150 | switch (kv->key.id) { | 1150 | switch (kv->key.id) { |
| @@ -1295,7 +1295,7 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr, | |||
| 1295 | nodemgr_update_bus_options(ne); | 1295 | nodemgr_update_bus_options(ne); |
| 1296 | 1296 | ||
| 1297 | /* Mark the node as new, so it gets re-probed */ | 1297 | /* Mark the node as new, so it gets re-probed */ |
| 1298 | ne->needs_probe = 1; | 1298 | ne->needs_probe = true; |
| 1299 | } else { | 1299 | } else { |
| 1300 | /* old cache is valid, so update its generation */ | 1300 | /* old cache is valid, so update its generation */ |
| 1301 | struct nodemgr_csr_info *ci = ne->csr->private; | 1301 | struct nodemgr_csr_info *ci = ne->csr->private; |
| @@ -1566,57 +1566,60 @@ static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int ge | |||
| 1566 | struct probe_param { | 1566 | struct probe_param { |
| 1567 | struct host_info *hi; | 1567 | struct host_info *hi; |
| 1568 | int generation; | 1568 | int generation; |
| 1569 | bool probe_now; | ||
| 1569 | }; | 1570 | }; |
| 1570 | 1571 | ||
| 1571 | static int __nodemgr_node_probe(struct device *dev, void *data) | 1572 | static int node_probe(struct device *dev, void *data) |
| 1572 | { | 1573 | { |
| 1573 | struct probe_param *param = (struct probe_param *)data; | 1574 | struct probe_param *p = data; |
| 1574 | struct node_entry *ne; | 1575 | struct node_entry *ne; |
| 1575 | 1576 | ||
| 1577 | if (p->generation != get_hpsb_generation(p->hi->host)) | ||
| 1578 | return -EAGAIN; | ||
| 1579 | |||
| 1576 | ne = container_of(dev, struct node_entry, node_dev); | 1580 | ne = container_of(dev, struct node_entry, node_dev); |
| 1577 | if (!ne->needs_probe) | 1581 | if (ne->needs_probe == p->probe_now) |
| 1578 | nodemgr_probe_ne(param->hi, ne, param->generation); | 1582 | nodemgr_probe_ne(p->hi, ne, p->generation); |
| 1579 | if (ne->needs_probe) | ||
| 1580 | nodemgr_probe_ne(param->hi, ne, param->generation); | ||
| 1581 | return 0; | 1583 | return 0; |
| 1582 | } | 1584 | } |
| 1583 | 1585 | ||
| 1584 | static void nodemgr_node_probe(struct host_info *hi, int generation) | 1586 | static void nodemgr_node_probe(struct host_info *hi, int generation) |
| 1585 | { | 1587 | { |
| 1586 | struct hpsb_host *host = hi->host; | 1588 | struct probe_param p; |
| 1587 | struct probe_param param; | ||
| 1588 | 1589 | ||
| 1589 | param.hi = hi; | 1590 | p.hi = hi; |
| 1590 | param.generation = generation; | 1591 | p.generation = generation; |
| 1591 | /* Do some processing of the nodes we've probed. This pulls them | 1592 | /* |
| 1593 | * Do some processing of the nodes we've probed. This pulls them | ||
| 1592 | * into the sysfs layer if needed, and can result in processing of | 1594 | * into the sysfs layer if needed, and can result in processing of |
| 1593 | * unit-directories, or just updating the node and it's | 1595 | * unit-directories, or just updating the node and it's |
| 1594 | * unit-directories. | 1596 | * unit-directories. |
| 1595 | * | 1597 | * |
| 1596 | * Run updates before probes. Usually, updates are time-critical | 1598 | * Run updates before probes. Usually, updates are time-critical |
| 1597 | * while probes are time-consuming. (Well, those probes need some | 1599 | * while probes are time-consuming. |
| 1598 | * improvement...) */ | ||
| 1599 | |||
| 1600 | class_for_each_device(&nodemgr_ne_class, NULL, ¶m, | ||
| 1601 | __nodemgr_node_probe); | ||
| 1602 | |||
| 1603 | /* If we had a bus reset while we were scanning the bus, it is | ||
| 1604 | * possible that we did not probe all nodes. In that case, we | ||
| 1605 | * skip the clean up for now, since we could remove nodes that | ||
| 1606 | * were still on the bus. Another bus scan is pending which will | ||
| 1607 | * do the clean up eventually. | ||
| 1608 | * | 1600 | * |
| 1601 | * Meanwhile, another bus reset may have happened. In this case we | ||
| 1602 | * skip everything here and let the next bus scan handle it. | ||
| 1603 | * Otherwise we may prematurely remove nodes which are still there. | ||
| 1604 | */ | ||
| 1605 | p.probe_now = false; | ||
| 1606 | if (class_for_each_device(&nodemgr_ne_class, NULL, &p, node_probe) != 0) | ||
| 1607 | return; | ||
| 1608 | |||
| 1609 | p.probe_now = true; | ||
| 1610 | if (class_for_each_device(&nodemgr_ne_class, NULL, &p, node_probe) != 0) | ||
| 1611 | return; | ||
| 1612 | /* | ||
| 1609 | * Now let's tell the bus to rescan our devices. This may seem | 1613 | * Now let's tell the bus to rescan our devices. This may seem |
| 1610 | * like overhead, but the driver-model core will only scan a | 1614 | * like overhead, but the driver-model core will only scan a |
| 1611 | * device for a driver when either the device is added, or when a | 1615 | * device for a driver when either the device is added, or when a |
| 1612 | * new driver is added. A bus reset is a good reason to rescan | 1616 | * new driver is added. A bus reset is a good reason to rescan |
| 1613 | * devices that were there before. For example, an sbp2 device | 1617 | * devices that were there before. For example, an sbp2 device |
| 1614 | * may become available for login, if the host that held it was | 1618 | * may become available for login, if the host that held it was |
| 1615 | * just removed. */ | 1619 | * just removed. |
| 1616 | 1620 | */ | |
| 1617 | if (generation == get_hpsb_generation(host)) | 1621 | if (bus_rescan_devices(&ieee1394_bus_type) != 0) |
| 1618 | if (bus_rescan_devices(&ieee1394_bus_type)) | 1622 | HPSB_DEBUG("bus_rescan_devices had an error"); |
| 1619 | HPSB_DEBUG("bus_rescan_devices had an error"); | ||
| 1620 | } | 1623 | } |
| 1621 | 1624 | ||
| 1622 | static int nodemgr_send_resume_packet(struct hpsb_host *host) | 1625 | static int nodemgr_send_resume_packet(struct hpsb_host *host) |
diff --git a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h index 919e92e2a955..6eb26465a84c 100644 --- a/drivers/ieee1394/nodemgr.h +++ b/drivers/ieee1394/nodemgr.h | |||
| @@ -97,7 +97,7 @@ struct node_entry { | |||
| 97 | struct hpsb_host *host; /* Host this node is attached to */ | 97 | struct hpsb_host *host; /* Host this node is attached to */ |
| 98 | nodeid_t nodeid; /* NodeID */ | 98 | nodeid_t nodeid; /* NodeID */ |
| 99 | struct bus_options busopt; /* Bus Options */ | 99 | struct bus_options busopt; /* Bus Options */ |
| 100 | int needs_probe; | 100 | bool needs_probe; |
| 101 | unsigned int generation; /* Synced with hpsb generation */ | 101 | unsigned int generation; /* Synced with hpsb generation */ |
| 102 | 102 | ||
| 103 | /* The following is read from the config rom */ | 103 | /* The following is read from the config rom */ |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 9cbf3154d243..1d6ad3435537 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
| @@ -731,15 +731,26 @@ static int sbp2_update(struct unit_directory *ud) | |||
| 731 | { | 731 | { |
| 732 | struct sbp2_lu *lu = ud->device.driver_data; | 732 | struct sbp2_lu *lu = ud->device.driver_data; |
| 733 | 733 | ||
| 734 | if (sbp2_reconnect_device(lu)) { | 734 | if (sbp2_reconnect_device(lu) != 0) { |
| 735 | /* Reconnect has failed. Perhaps we didn't reconnect fast | 735 | /* |
| 736 | * enough. Try a regular login, but first log out just in | 736 | * Reconnect failed. If another bus reset happened, |
| 737 | * case of any weirdness. */ | 737 | * let nodemgr proceed and call sbp2_update again later |
| 738 | * (or sbp2_remove if this node went away). | ||
| 739 | */ | ||
| 740 | if (!hpsb_node_entry_valid(lu->ne)) | ||
| 741 | return 0; | ||
| 742 | /* | ||
| 743 | * Or the target rejected the reconnect because we weren't | ||
| 744 | * fast enough. Try a regular login, but first log out | ||
| 745 | * just in case of any weirdness. | ||
| 746 | */ | ||
| 738 | sbp2_logout_device(lu); | 747 | sbp2_logout_device(lu); |
| 739 | 748 | ||
| 740 | if (sbp2_login_device(lu)) { | 749 | if (sbp2_login_device(lu) != 0) { |
| 741 | /* Login failed too, just fail, and the backend | 750 | if (!hpsb_node_entry_valid(lu->ne)) |
| 742 | * will call our sbp2_remove for us */ | 751 | return 0; |
| 752 | |||
| 753 | /* Maybe another initiator won the login. */ | ||
| 743 | SBP2_ERR("Failed to reconnect to sbp2 device!"); | 754 | SBP2_ERR("Failed to reconnect to sbp2 device!"); |
| 744 | return -EBUSY; | 755 | return -EBUSY; |
| 745 | } | 756 | } |
diff --git a/drivers/infiniband/hw/ehca/ehca_tools.h b/drivers/infiniband/hw/ehca/ehca_tools.h index ec950bf8c479..21f7d06f14ad 100644 --- a/drivers/infiniband/hw/ehca/ehca_tools.h +++ b/drivers/infiniband/hw/ehca/ehca_tools.h | |||
| @@ -54,7 +54,6 @@ | |||
| 54 | #include <linux/module.h> | 54 | #include <linux/module.h> |
| 55 | #include <linux/moduleparam.h> | 55 | #include <linux/moduleparam.h> |
| 56 | #include <linux/vmalloc.h> | 56 | #include <linux/vmalloc.h> |
| 57 | #include <linux/version.h> | ||
| 58 | #include <linux/notifier.h> | 57 | #include <linux/notifier.h> |
| 59 | #include <linux/cpu.h> | 58 | #include <linux/cpu.h> |
| 60 | #include <linux/device.h> | 59 | #include <linux/device.h> |
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index 23faba9d21eb..8bb5170b4e41 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | * SOFTWARE. | 31 | * SOFTWARE. |
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #include <linux/version.h> | ||
| 35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
| 36 | #include <linux/fs.h> | 35 | #include <linux/fs.h> |
| 37 | #include <linux/mount.h> | 36 | #include <linux/mount.h> |
diff --git a/drivers/infiniband/hw/ipath/ipath_iba7220.c b/drivers/infiniband/hw/ipath/ipath_iba7220.c index d90f5e9a54fa..9839e20119bc 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba7220.c +++ b/drivers/infiniband/hw/ipath/ipath_iba7220.c | |||
| @@ -1720,7 +1720,7 @@ static void ipath_7220_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr, | |||
| 1720 | "not 2KB aligned!\n", pa); | 1720 | "not 2KB aligned!\n", pa); |
| 1721 | return; | 1721 | return; |
| 1722 | } | 1722 | } |
| 1723 | if (pa >= (1UL << IBA7220_TID_SZ_SHIFT)) { | 1723 | if (chippa >= (1UL << IBA7220_TID_SZ_SHIFT)) { |
| 1724 | ipath_dev_err(dd, | 1724 | ipath_dev_err(dd, |
| 1725 | "BUG: Physical page address 0x%lx " | 1725 | "BUG: Physical page address 0x%lx " |
| 1726 | "larger than supported\n", pa); | 1726 | "larger than supported\n", pa); |
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c index 36aa242c487c..729446f56aab 100644 --- a/drivers/infiniband/hw/ipath/ipath_ud.c +++ b/drivers/infiniband/hw/ipath/ipath_ud.c | |||
| @@ -267,6 +267,7 @@ int ipath_make_ud_req(struct ipath_qp *qp) | |||
| 267 | u16 lrh0; | 267 | u16 lrh0; |
| 268 | u16 lid; | 268 | u16 lid; |
| 269 | int ret = 0; | 269 | int ret = 0; |
| 270 | int next_cur; | ||
| 270 | 271 | ||
| 271 | spin_lock_irqsave(&qp->s_lock, flags); | 272 | spin_lock_irqsave(&qp->s_lock, flags); |
| 272 | 273 | ||
| @@ -290,8 +291,9 @@ int ipath_make_ud_req(struct ipath_qp *qp) | |||
| 290 | goto bail; | 291 | goto bail; |
| 291 | 292 | ||
| 292 | wqe = get_swqe_ptr(qp, qp->s_cur); | 293 | wqe = get_swqe_ptr(qp, qp->s_cur); |
| 293 | if (++qp->s_cur >= qp->s_size) | 294 | next_cur = qp->s_cur + 1; |
| 294 | qp->s_cur = 0; | 295 | if (next_cur >= qp->s_size) |
| 296 | next_cur = 0; | ||
| 295 | 297 | ||
| 296 | /* Construct the header. */ | 298 | /* Construct the header. */ |
| 297 | ah_attr = &to_iah(wqe->wr.wr.ud.ah)->attr; | 299 | ah_attr = &to_iah(wqe->wr.wr.ud.ah)->attr; |
| @@ -315,6 +317,7 @@ int ipath_make_ud_req(struct ipath_qp *qp) | |||
| 315 | qp->s_flags |= IPATH_S_WAIT_DMA; | 317 | qp->s_flags |= IPATH_S_WAIT_DMA; |
| 316 | goto bail; | 318 | goto bail; |
| 317 | } | 319 | } |
| 320 | qp->s_cur = next_cur; | ||
| 318 | spin_unlock_irqrestore(&qp->s_lock, flags); | 321 | spin_unlock_irqrestore(&qp->s_lock, flags); |
| 319 | ipath_ud_loopback(qp, wqe); | 322 | ipath_ud_loopback(qp, wqe); |
| 320 | spin_lock_irqsave(&qp->s_lock, flags); | 323 | spin_lock_irqsave(&qp->s_lock, flags); |
| @@ -323,6 +326,7 @@ int ipath_make_ud_req(struct ipath_qp *qp) | |||
| 323 | } | 326 | } |
| 324 | } | 327 | } |
| 325 | 328 | ||
| 329 | qp->s_cur = next_cur; | ||
| 326 | extra_bytes = -wqe->length & 3; | 330 | extra_bytes = -wqe->length & 3; |
| 327 | nwords = (wqe->length + extra_bytes) >> 2; | 331 | nwords = (wqe->length + extra_bytes) >> 2; |
| 328 | 332 | ||
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index a4cdb465cd1d..87f5c5a87b98 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c | |||
| @@ -204,6 +204,8 @@ struct ib_mr *mlx4_ib_alloc_fast_reg_mr(struct ib_pd *pd, | |||
| 204 | if (err) | 204 | if (err) |
| 205 | goto err_mr; | 205 | goto err_mr; |
| 206 | 206 | ||
| 207 | mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; | ||
| 208 | |||
| 207 | return &mr->ibmr; | 209 | return &mr->ibmr; |
| 208 | 210 | ||
| 209 | err_mr: | 211 | err_mr: |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index f29dbb767e87..9559248f265b 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
| @@ -1342,6 +1342,12 @@ static __be32 convert_access(int acc) | |||
| 1342 | static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr) | 1342 | static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr) |
| 1343 | { | 1343 | { |
| 1344 | struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(wr->wr.fast_reg.page_list); | 1344 | struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(wr->wr.fast_reg.page_list); |
| 1345 | int i; | ||
| 1346 | |||
| 1347 | for (i = 0; i < wr->wr.fast_reg.page_list_len; ++i) | ||
| 1348 | wr->wr.fast_reg.page_list->page_list[i] = | ||
| 1349 | cpu_to_be64(wr->wr.fast_reg.page_list->page_list[i] | | ||
| 1350 | MLX4_MTT_FLAG_PRESENT); | ||
| 1345 | 1351 | ||
| 1346 | fseg->flags = convert_access(wr->wr.fast_reg.access_flags); | 1352 | fseg->flags = convert_access(wr->wr.fast_reg.access_flags); |
| 1347 | fseg->mem_key = cpu_to_be32(wr->wr.fast_reg.rkey); | 1353 | fseg->mem_key = cpu_to_be32(wr->wr.fast_reg.rkey); |
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h index 39bd897b40c6..8eb7ae96974d 100644 --- a/drivers/infiniband/hw/nes/nes.h +++ b/drivers/infiniband/hw/nes/nes.h | |||
| @@ -43,7 +43,6 @@ | |||
| 43 | #include <linux/dma-mapping.h> | 43 | #include <linux/dma-mapping.h> |
| 44 | #include <linux/workqueue.h> | 44 | #include <linux/workqueue.h> |
| 45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
| 46 | #include <linux/version.h> | ||
| 47 | #include <asm/io.h> | 46 | #include <asm/io.h> |
| 48 | #include <linux/crc32c.h> | 47 | #include <linux/crc32c.h> |
| 49 | 48 | ||
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 9f0b964b2c99..499d3cf83e1f 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
| @@ -1956,13 +1956,6 @@ static int mini_cm_reject(struct nes_cm_core *cm_core, | |||
| 1956 | return ret; | 1956 | return ret; |
| 1957 | cleanup_retrans_entry(cm_node); | 1957 | cleanup_retrans_entry(cm_node); |
| 1958 | cm_node->state = NES_CM_STATE_CLOSED; | 1958 | cm_node->state = NES_CM_STATE_CLOSED; |
| 1959 | ret = send_fin(cm_node, NULL); | ||
| 1960 | |||
| 1961 | if (cm_node->accept_pend) { | ||
| 1962 | BUG_ON(!cm_node->listener); | ||
| 1963 | atomic_dec(&cm_node->listener->pend_accepts_cnt); | ||
| 1964 | BUG_ON(atomic_read(&cm_node->listener->pend_accepts_cnt) < 0); | ||
| 1965 | } | ||
| 1966 | 1959 | ||
| 1967 | ret = send_reset(cm_node, NULL); | 1960 | ret = send_reset(cm_node, NULL); |
| 1968 | return ret; | 1961 | return ret; |
| @@ -2383,6 +2376,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp) | |||
| 2383 | atomic_inc(&cm_disconnects); | 2376 | atomic_inc(&cm_disconnects); |
| 2384 | cm_event.event = IW_CM_EVENT_DISCONNECT; | 2377 | cm_event.event = IW_CM_EVENT_DISCONNECT; |
| 2385 | if (last_ae == NES_AEQE_AEID_LLP_CONNECTION_RESET) { | 2378 | if (last_ae == NES_AEQE_AEID_LLP_CONNECTION_RESET) { |
| 2379 | issued_disconnect_reset = 1; | ||
| 2386 | cm_event.status = IW_CM_EVENT_STATUS_RESET; | 2380 | cm_event.status = IW_CM_EVENT_STATUS_RESET; |
| 2387 | nes_debug(NES_DBG_CM, "Generating a CM " | 2381 | nes_debug(NES_DBG_CM, "Generating a CM " |
| 2388 | "Disconnect Event (status reset) for " | 2382 | "Disconnect Event (status reset) for " |
| @@ -2508,7 +2502,6 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt) | |||
| 2508 | nes_debug(NES_DBG_CM, "Call close API\n"); | 2502 | nes_debug(NES_DBG_CM, "Call close API\n"); |
| 2509 | 2503 | ||
| 2510 | g_cm_core->api->close(g_cm_core, nesqp->cm_node); | 2504 | g_cm_core->api->close(g_cm_core, nesqp->cm_node); |
| 2511 | nesqp->cm_node = NULL; | ||
| 2512 | } | 2505 | } |
| 2513 | 2506 | ||
| 2514 | return ret; | 2507 | return ret; |
| @@ -2837,6 +2830,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
| 2837 | cm_node->apbvt_set = 1; | 2830 | cm_node->apbvt_set = 1; |
| 2838 | nesqp->cm_node = cm_node; | 2831 | nesqp->cm_node = cm_node; |
| 2839 | cm_node->nesqp = nesqp; | 2832 | cm_node->nesqp = nesqp; |
| 2833 | nes_add_ref(&nesqp->ibqp); | ||
| 2840 | 2834 | ||
| 2841 | return 0; | 2835 | return 0; |
| 2842 | } | 2836 | } |
| @@ -3167,7 +3161,6 @@ static void cm_event_connect_error(struct nes_cm_event *event) | |||
| 3167 | if (ret) | 3161 | if (ret) |
| 3168 | printk(KERN_ERR "%s[%u] OFA CM event_handler returned, " | 3162 | printk(KERN_ERR "%s[%u] OFA CM event_handler returned, " |
| 3169 | "ret=%d\n", __func__, __LINE__, ret); | 3163 | "ret=%d\n", __func__, __LINE__, ret); |
| 3170 | nes_rem_ref(&nesqp->ibqp); | ||
| 3171 | cm_id->rem_ref(cm_id); | 3164 | cm_id->rem_ref(cm_id); |
| 3172 | 3165 | ||
| 3173 | rem_ref_cm_node(event->cm_node->cm_core, event->cm_node); | 3166 | rem_ref_cm_node(event->cm_node->cm_core, event->cm_node); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index b0ffc9abe8c0..05eb41b8ab63 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
| @@ -293,6 +293,7 @@ struct ipoib_dev_priv { | |||
| 293 | 293 | ||
| 294 | struct delayed_work pkey_poll_task; | 294 | struct delayed_work pkey_poll_task; |
| 295 | struct delayed_work mcast_task; | 295 | struct delayed_work mcast_task; |
| 296 | struct work_struct carrier_on_task; | ||
| 296 | struct work_struct flush_light; | 297 | struct work_struct flush_light; |
| 297 | struct work_struct flush_normal; | 298 | struct work_struct flush_normal; |
| 298 | struct work_struct flush_heavy; | 299 | struct work_struct flush_heavy; |
| @@ -464,6 +465,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port); | |||
| 464 | void ipoib_dev_cleanup(struct net_device *dev); | 465 | void ipoib_dev_cleanup(struct net_device *dev); |
| 465 | 466 | ||
| 466 | void ipoib_mcast_join_task(struct work_struct *work); | 467 | void ipoib_mcast_join_task(struct work_struct *work); |
| 468 | void ipoib_mcast_carrier_on_task(struct work_struct *work); | ||
| 467 | void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb); | 469 | void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb); |
| 468 | 470 | ||
| 469 | void ipoib_mcast_restart_task(struct work_struct *work); | 471 | void ipoib_mcast_restart_task(struct work_struct *work); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index f51201b17bfd..e9ca3cb57d52 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
| @@ -156,14 +156,8 @@ static int ipoib_stop(struct net_device *dev) | |||
| 156 | 156 | ||
| 157 | netif_stop_queue(dev); | 157 | netif_stop_queue(dev); |
| 158 | 158 | ||
| 159 | /* | 159 | ipoib_ib_dev_down(dev, 0); |
| 160 | * Now flush workqueue to make sure a scheduled task doesn't | 160 | ipoib_ib_dev_stop(dev, 0); |
| 161 | * bring our internal state back up. | ||
| 162 | */ | ||
| 163 | flush_workqueue(ipoib_workqueue); | ||
| 164 | |||
| 165 | ipoib_ib_dev_down(dev, 1); | ||
| 166 | ipoib_ib_dev_stop(dev, 1); | ||
| 167 | 161 | ||
| 168 | if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { | 162 | if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { |
| 169 | struct ipoib_dev_priv *cpriv; | 163 | struct ipoib_dev_priv *cpriv; |
| @@ -410,7 +404,7 @@ static void path_rec_completion(int status, | |||
| 410 | struct net_device *dev = path->dev; | 404 | struct net_device *dev = path->dev; |
| 411 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 405 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 412 | struct ipoib_ah *ah = NULL; | 406 | struct ipoib_ah *ah = NULL; |
| 413 | struct ipoib_ah *old_ah; | 407 | struct ipoib_ah *old_ah = NULL; |
| 414 | struct ipoib_neigh *neigh, *tn; | 408 | struct ipoib_neigh *neigh, *tn; |
| 415 | struct sk_buff_head skqueue; | 409 | struct sk_buff_head skqueue; |
| 416 | struct sk_buff *skb; | 410 | struct sk_buff *skb; |
| @@ -434,12 +428,12 @@ static void path_rec_completion(int status, | |||
| 434 | 428 | ||
| 435 | spin_lock_irqsave(&priv->lock, flags); | 429 | spin_lock_irqsave(&priv->lock, flags); |
| 436 | 430 | ||
| 437 | old_ah = path->ah; | ||
| 438 | path->ah = ah; | ||
| 439 | |||
| 440 | if (ah) { | 431 | if (ah) { |
| 441 | path->pathrec = *pathrec; | 432 | path->pathrec = *pathrec; |
| 442 | 433 | ||
| 434 | old_ah = path->ah; | ||
| 435 | path->ah = ah; | ||
| 436 | |||
| 443 | ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n", | 437 | ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n", |
| 444 | ah, be16_to_cpu(pathrec->dlid), pathrec->sl); | 438 | ah, be16_to_cpu(pathrec->dlid), pathrec->sl); |
| 445 | 439 | ||
| @@ -1081,6 +1075,7 @@ static void ipoib_setup(struct net_device *dev) | |||
| 1081 | 1075 | ||
| 1082 | INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll); | 1076 | INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll); |
| 1083 | INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task); | 1077 | INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task); |
| 1078 | INIT_WORK(&priv->carrier_on_task, ipoib_mcast_carrier_on_task); | ||
| 1084 | INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light); | 1079 | INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light); |
| 1085 | INIT_WORK(&priv->flush_normal, ipoib_ib_dev_flush_normal); | 1080 | INIT_WORK(&priv->flush_normal, ipoib_ib_dev_flush_normal); |
| 1086 | INIT_WORK(&priv->flush_heavy, ipoib_ib_dev_flush_heavy); | 1081 | INIT_WORK(&priv->flush_heavy, ipoib_ib_dev_flush_heavy); |
| @@ -1314,7 +1309,7 @@ sysfs_failed: | |||
| 1314 | 1309 | ||
| 1315 | register_failed: | 1310 | register_failed: |
| 1316 | ib_unregister_event_handler(&priv->event_handler); | 1311 | ib_unregister_event_handler(&priv->event_handler); |
| 1317 | flush_scheduled_work(); | 1312 | flush_workqueue(ipoib_workqueue); |
| 1318 | 1313 | ||
| 1319 | event_failed: | 1314 | event_failed: |
| 1320 | ipoib_dev_cleanup(priv->dev); | 1315 | ipoib_dev_cleanup(priv->dev); |
| @@ -1373,7 +1368,12 @@ static void ipoib_remove_one(struct ib_device *device) | |||
| 1373 | 1368 | ||
| 1374 | list_for_each_entry_safe(priv, tmp, dev_list, list) { | 1369 | list_for_each_entry_safe(priv, tmp, dev_list, list) { |
| 1375 | ib_unregister_event_handler(&priv->event_handler); | 1370 | ib_unregister_event_handler(&priv->event_handler); |
| 1376 | flush_scheduled_work(); | 1371 | |
| 1372 | rtnl_lock(); | ||
| 1373 | dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP); | ||
| 1374 | rtnl_unlock(); | ||
| 1375 | |||
| 1376 | flush_workqueue(ipoib_workqueue); | ||
| 1377 | 1377 | ||
| 1378 | unregister_netdev(priv->dev); | 1378 | unregister_netdev(priv->dev); |
| 1379 | ipoib_dev_cleanup(priv->dev); | 1379 | ipoib_dev_cleanup(priv->dev); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 8950e9546f4e..aae28620a6e5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
| @@ -366,6 +366,21 @@ static int ipoib_mcast_sendonly_join(struct ipoib_mcast *mcast) | |||
| 366 | return ret; | 366 | return ret; |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | void ipoib_mcast_carrier_on_task(struct work_struct *work) | ||
| 370 | { | ||
| 371 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, | ||
| 372 | carrier_on_task); | ||
| 373 | |||
| 374 | /* | ||
| 375 | * Take rtnl_lock to avoid racing with ipoib_stop() and | ||
| 376 | * turning the carrier back on while a device is being | ||
| 377 | * removed. | ||
| 378 | */ | ||
| 379 | rtnl_lock(); | ||
| 380 | netif_carrier_on(priv->dev); | ||
| 381 | rtnl_unlock(); | ||
| 382 | } | ||
| 383 | |||
| 369 | static int ipoib_mcast_join_complete(int status, | 384 | static int ipoib_mcast_join_complete(int status, |
| 370 | struct ib_sa_multicast *multicast) | 385 | struct ib_sa_multicast *multicast) |
| 371 | { | 386 | { |
| @@ -392,8 +407,12 @@ static int ipoib_mcast_join_complete(int status, | |||
| 392 | &priv->mcast_task, 0); | 407 | &priv->mcast_task, 0); |
| 393 | mutex_unlock(&mcast_mutex); | 408 | mutex_unlock(&mcast_mutex); |
| 394 | 409 | ||
| 410 | /* | ||
| 411 | * Defer carrier on work to ipoib_workqueue to avoid a | ||
| 412 | * deadlock on rtnl_lock here. | ||
| 413 | */ | ||
| 395 | if (mcast == priv->broadcast) | 414 | if (mcast == priv->broadcast) |
| 396 | netif_carrier_on(dev); | 415 | queue_work(ipoib_workqueue, &priv->carrier_on_task); |
| 397 | 416 | ||
| 398 | return 0; | 417 | return 0; |
| 399 | } | 418 | } |
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 63462ecca147..26ff6214a81f 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
| 34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
| 35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
| 36 | #include <linux/version.h> | ||
| 37 | 36 | ||
| 38 | #include "iscsi_iser.h" | 37 | #include "iscsi_iser.h" |
| 39 | 38 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 2d65411f6763..3524bef62be6 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
| @@ -647,6 +647,47 @@ static int str_to_user(const char *str, unsigned int maxlen, void __user *p) | |||
| 647 | return copy_to_user(p, str, len) ? -EFAULT : len; | 647 | return copy_to_user(p, str, len) ? -EFAULT : len; |
| 648 | } | 648 | } |
| 649 | 649 | ||
| 650 | #define OLD_KEY_MAX 0x1ff | ||
| 651 | static int handle_eviocgbit(struct input_dev *dev, unsigned int cmd, void __user *p, int compat_mode) | ||
| 652 | { | ||
| 653 | static unsigned long keymax_warn_time; | ||
| 654 | unsigned long *bits; | ||
| 655 | int len; | ||
| 656 | |||
| 657 | switch (_IOC_NR(cmd) & EV_MAX) { | ||
| 658 | |||
| 659 | case 0: bits = dev->evbit; len = EV_MAX; break; | ||
| 660 | case EV_KEY: bits = dev->keybit; len = KEY_MAX; break; | ||
| 661 | case EV_REL: bits = dev->relbit; len = REL_MAX; break; | ||
| 662 | case EV_ABS: bits = dev->absbit; len = ABS_MAX; break; | ||
| 663 | case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break; | ||
| 664 | case EV_LED: bits = dev->ledbit; len = LED_MAX; break; | ||
| 665 | case EV_SND: bits = dev->sndbit; len = SND_MAX; break; | ||
| 666 | case EV_FF: bits = dev->ffbit; len = FF_MAX; break; | ||
| 667 | case EV_SW: bits = dev->swbit; len = SW_MAX; break; | ||
| 668 | default: return -EINVAL; | ||
| 669 | } | ||
| 670 | |||
| 671 | /* | ||
| 672 | * Work around bugs in userspace programs that like to do | ||
| 673 | * EVIOCGBIT(EV_KEY, KEY_MAX) and not realize that 'len' | ||
| 674 | * should be in bytes, not in bits. | ||
| 675 | */ | ||
| 676 | if ((_IOC_NR(cmd) & EV_MAX) == EV_KEY && _IOC_SIZE(cmd) == OLD_KEY_MAX) { | ||
| 677 | len = OLD_KEY_MAX; | ||
| 678 | if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000)) | ||
| 679 | printk(KERN_WARNING | ||
| 680 | "evdev.c(EVIOCGBIT): Suspicious buffer size %u, " | ||
| 681 | "limiting output to %zu bytes. See " | ||
| 682 | "http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n", | ||
| 683 | OLD_KEY_MAX, | ||
| 684 | BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long)); | ||
| 685 | } | ||
| 686 | |||
| 687 | return bits_to_user(bits, len, _IOC_SIZE(cmd), p, compat_mode); | ||
| 688 | } | ||
| 689 | #undef OLD_KEY_MAX | ||
| 690 | |||
| 650 | static long evdev_do_ioctl(struct file *file, unsigned int cmd, | 691 | static long evdev_do_ioctl(struct file *file, unsigned int cmd, |
| 651 | void __user *p, int compat_mode) | 692 | void __user *p, int compat_mode) |
| 652 | { | 693 | { |
| @@ -733,26 +774,8 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
| 733 | 774 | ||
| 734 | if (_IOC_DIR(cmd) == _IOC_READ) { | 775 | if (_IOC_DIR(cmd) == _IOC_READ) { |
| 735 | 776 | ||
| 736 | if ((_IOC_NR(cmd) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0, 0))) { | 777 | if ((_IOC_NR(cmd) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0, 0))) |
| 737 | 778 | return handle_eviocgbit(dev, cmd, p, compat_mode); | |
| 738 | unsigned long *bits; | ||
| 739 | int len; | ||
| 740 | |||
| 741 | switch (_IOC_NR(cmd) & EV_MAX) { | ||
| 742 | |||
| 743 | case 0: bits = dev->evbit; len = EV_MAX; break; | ||
| 744 | case EV_KEY: bits = dev->keybit; len = KEY_MAX; break; | ||
| 745 | case EV_REL: bits = dev->relbit; len = REL_MAX; break; | ||
| 746 | case EV_ABS: bits = dev->absbit; len = ABS_MAX; break; | ||
| 747 | case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break; | ||
| 748 | case EV_LED: bits = dev->ledbit; len = LED_MAX; break; | ||
| 749 | case EV_SND: bits = dev->sndbit; len = SND_MAX; break; | ||
| 750 | case EV_FF: bits = dev->ffbit; len = FF_MAX; break; | ||
| 751 | case EV_SW: bits = dev->swbit; len = SW_MAX; break; | ||
| 752 | default: return -EINVAL; | ||
| 753 | } | ||
| 754 | return bits_to_user(bits, len, _IOC_SIZE(cmd), p, compat_mode); | ||
| 755 | } | ||
| 756 | 779 | ||
| 757 | if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0))) | 780 | if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0))) |
| 758 | return bits_to_user(dev->key, KEY_MAX, _IOC_SIZE(cmd), | 781 | return bits_to_user(dev->key, KEY_MAX, _IOC_SIZE(cmd), |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 87d3e7eabffd..6791be81eb29 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
| @@ -127,6 +127,7 @@ static const struct xpad_device { | |||
| 127 | { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 127 | { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, |
| 128 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 128 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
| 129 | { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 129 | { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, |
| 130 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | ||
| 130 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 131 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, |
| 131 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 132 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", MAP_DPAD_TO_AXES, XTYPE_XBOX }, |
| 132 | { 0x0e4c, 0x1097, "Radica Gamester Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 133 | { 0x0e4c, 0x1097, "Radica Gamester Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, |
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c index 54ed8e2e1c02..e348cfccc17a 100644 --- a/drivers/input/keyboard/bf54x-keys.c +++ b/drivers/input/keyboard/bf54x-keys.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
| 32 | #include <linux/version.h> | ||
| 33 | 32 | ||
| 34 | #include <linux/init.h> | 33 | #include <linux/init.h> |
| 35 | #include <linux/fs.h> | 34 | #include <linux/fs.h> |
| @@ -44,7 +43,7 @@ | |||
| 44 | #include <linux/input.h> | 43 | #include <linux/input.h> |
| 45 | 44 | ||
| 46 | #include <asm/portmux.h> | 45 | #include <asm/portmux.h> |
| 47 | #include <asm/mach/bf54x_keys.h> | 46 | #include <mach/bf54x_keys.h> |
| 48 | 47 | ||
| 49 | #define DRV_NAME "bf54x-keys" | 48 | #define DRV_NAME "bf54x-keys" |
| 50 | #define TIME_SCALE 100 /* 100 ns */ | 49 | #define TIME_SCALE 100 /* 100 ns */ |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index be58730e636a..ec96b369dd7a 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| 12 | #include <linux/version.h> | ||
| 13 | 12 | ||
| 14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 15 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
| @@ -118,6 +117,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
| 118 | unsigned int type = button->type ?: EV_KEY; | 117 | unsigned int type = button->type ?: EV_KEY; |
| 119 | 118 | ||
| 120 | bdata->input = input; | 119 | bdata->input = input; |
| 120 | bdata->button = button; | ||
| 121 | setup_timer(&bdata->timer, | 121 | setup_timer(&bdata->timer, |
| 122 | gpio_check_button, (unsigned long)bdata); | 122 | gpio_check_button, (unsigned long)bdata); |
| 123 | 123 | ||
| @@ -256,7 +256,7 @@ static int gpio_keys_resume(struct platform_device *pdev) | |||
| 256 | #define gpio_keys_resume NULL | 256 | #define gpio_keys_resume NULL |
| 257 | #endif | 257 | #endif |
| 258 | 258 | ||
| 259 | struct platform_driver gpio_keys_device_driver = { | 259 | static struct platform_driver gpio_keys_device_driver = { |
| 260 | .probe = gpio_keys_probe, | 260 | .probe = gpio_keys_probe, |
| 261 | .remove = __devexit_p(gpio_keys_remove), | 261 | .remove = __devexit_p(gpio_keys_remove), |
| 262 | .suspend = gpio_keys_suspend, | 262 | .suspend = gpio_keys_suspend, |
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c index 6a1f48b76e32..2adf9cb265da 100644 --- a/drivers/input/misc/cobalt_btns.c +++ b/drivers/input/misc/cobalt_btns.c | |||
| @@ -148,6 +148,9 @@ static int __devexit cobalt_buttons_remove(struct platform_device *pdev) | |||
| 148 | return 0; | 148 | return 0; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); | ||
| 152 | MODULE_DESCRIPTION("Cobalt button interface driver"); | ||
| 153 | MODULE_LICENSE("GPL"); | ||
| 151 | /* work with hotplug and coldplug */ | 154 | /* work with hotplug and coldplug */ |
| 152 | MODULE_ALIAS("platform:Cobalt buttons"); | 155 | MODULE_ALIAS("platform:Cobalt buttons"); |
| 153 | 156 | ||
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 7bbea097cda2..f996546fc443 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
| @@ -130,6 +130,29 @@ config MOUSE_APPLETOUCH | |||
| 130 | To compile this driver as a module, choose M here: the | 130 | To compile this driver as a module, choose M here: the |
| 131 | module will be called appletouch. | 131 | module will be called appletouch. |
| 132 | 132 | ||
| 133 | config MOUSE_BCM5974 | ||
| 134 | tristate "Apple USB BCM5974 Multitouch trackpad support" | ||
| 135 | depends on USB_ARCH_HAS_HCD | ||
| 136 | select USB | ||
| 137 | help | ||
| 138 | Say Y here if you have an Apple USB BCM5974 Multitouch | ||
| 139 | trackpad. | ||
| 140 | |||
| 141 | The BCM5974 is the multitouch trackpad found in the Macbook | ||
| 142 | Air (JAN2008) and Macbook Pro Penryn (FEB2008) laptops. | ||
| 143 | |||
| 144 | It is also found in the IPhone (2007) and Ipod Touch (2008). | ||
| 145 | |||
| 146 | This driver provides multitouch functionality together with | ||
| 147 | the synaptics X11 driver. | ||
| 148 | |||
| 149 | The interface is currently identical to the appletouch interface, | ||
| 150 | for further information, see | ||
| 151 | <file:Documentation/input/appletouch.txt>. | ||
| 152 | |||
| 153 | To compile this driver as a module, choose M here: the | ||
| 154 | module will be called bcm5974. | ||
| 155 | |||
| 133 | config MOUSE_INPORT | 156 | config MOUSE_INPORT |
| 134 | tristate "InPort/MS/ATIXL busmouse" | 157 | tristate "InPort/MS/ATIXL busmouse" |
| 135 | depends on ISA | 158 | depends on ISA |
diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile index 9e6e36330820..d4d202516090 100644 --- a/drivers/input/mouse/Makefile +++ b/drivers/input/mouse/Makefile | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o | 7 | obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o |
| 8 | obj-$(CONFIG_MOUSE_APPLETOUCH) += appletouch.o | 8 | obj-$(CONFIG_MOUSE_APPLETOUCH) += appletouch.o |
| 9 | obj-$(CONFIG_MOUSE_BCM5974) += bcm5974.o | ||
| 9 | obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o | 10 | obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o |
| 10 | obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o | 11 | obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o |
| 11 | obj-$(CONFIG_MOUSE_INPORT) += inport.o | 12 | obj-$(CONFIG_MOUSE_INPORT) += inport.o |
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c new file mode 100644 index 000000000000..2998a6ac9ae4 --- /dev/null +++ b/drivers/input/mouse/bcm5974.c | |||
| @@ -0,0 +1,726 @@ | |||
| 1 | /* | ||
| 2 | * Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se) | ||
| 5 | * | ||
| 6 | * The USB initialization and package decoding was made by | ||
| 7 | * Scott Shawcroft as part of the touchd user-space driver project: | ||
| 8 | * Copyright (C) 2008 Scott Shawcroft (scott.shawcroft@gmail.com) | ||
| 9 | * | ||
| 10 | * The BCM5974 driver is based on the appletouch driver: | ||
| 11 | * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com) | ||
| 12 | * Copyright (C) 2005 Johannes Berg (johannes@sipsolutions.net) | ||
| 13 | * Copyright (C) 2005 Stelian Pop (stelian@popies.net) | ||
| 14 | * Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de) | ||
| 15 | * Copyright (C) 2005 Peter Osterlund (petero2@telia.com) | ||
| 16 | * Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch) | ||
| 17 | * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch) | ||
| 18 | * | ||
| 19 | * This program is free software; you can redistribute it and/or modify | ||
| 20 | * it under the terms of the GNU General Public License as published by | ||
| 21 | * the Free Software Foundation; either version 2 of the License, or | ||
| 22 | * (at your option) any later version. | ||
| 23 | * | ||
| 24 | * This program is distributed in the hope that it will be useful, | ||
| 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 27 | * GNU General Public License for more details. | ||
| 28 | * | ||
| 29 | * You should have received a copy of the GNU General Public License | ||
| 30 | * along with this program; if not, write to the Free Software | ||
| 31 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 32 | * | ||
| 33 | */ | ||
| 34 | |||
| 35 | #include <linux/kernel.h> | ||
| 36 | #include <linux/errno.h> | ||
| 37 | #include <linux/init.h> | ||
| 38 | #include <linux/slab.h> | ||
| 39 | #include <linux/module.h> | ||
| 40 | #include <linux/usb/input.h> | ||
| 41 | #include <linux/hid.h> | ||
| 42 | #include <linux/mutex.h> | ||
| 43 | |||
| 44 | #define USB_VENDOR_ID_APPLE 0x05ac | ||
| 45 | |||
| 46 | /* MacbookAir, aka wellspring */ | ||
| 47 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ANSI 0x0223 | ||
| 48 | #define USB_DEVICE_ID_APPLE_WELLSPRING_ISO 0x0224 | ||
| 49 | #define USB_DEVICE_ID_APPLE_WELLSPRING_JIS 0x0225 | ||
| 50 | /* MacbookProPenryn, aka wellspring2 */ | ||
| 51 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 | ||
| 52 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 | ||
| 53 | #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 | ||
| 54 | |||
| 55 | #define BCM5974_DEVICE(prod) { \ | ||
| 56 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | ||
| 57 | USB_DEVICE_ID_MATCH_INT_CLASS | \ | ||
| 58 | USB_DEVICE_ID_MATCH_INT_PROTOCOL), \ | ||
| 59 | .idVendor = USB_VENDOR_ID_APPLE, \ | ||
| 60 | .idProduct = (prod), \ | ||
| 61 | .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ | ||
| 62 | .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE \ | ||
| 63 | } | ||
| 64 | |||
| 65 | /* table of devices that work with this driver */ | ||
| 66 | static const struct usb_device_id bcm5974_table[] = { | ||
| 67 | /* MacbookAir1.1 */ | ||
| 68 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), | ||
| 69 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING_ISO), | ||
| 70 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING_JIS), | ||
| 71 | /* MacbookProPenryn */ | ||
| 72 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), | ||
| 73 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), | ||
| 74 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), | ||
| 75 | /* Terminating entry */ | ||
| 76 | {} | ||
| 77 | }; | ||
| 78 | MODULE_DEVICE_TABLE(usb, bcm5974_table); | ||
| 79 | |||
| 80 | MODULE_AUTHOR("Henrik Rydberg"); | ||
| 81 | MODULE_DESCRIPTION("Apple USB BCM5974 multitouch driver"); | ||
| 82 | MODULE_LICENSE("GPL"); | ||
| 83 | |||
| 84 | #define dprintk(level, format, a...)\ | ||
| 85 | { if (debug >= level) printk(KERN_DEBUG format, ##a); } | ||
| 86 | |||
| 87 | static int debug = 1; | ||
| 88 | module_param(debug, int, 0644); | ||
| 89 | MODULE_PARM_DESC(debug, "Activate debugging output"); | ||
| 90 | |||
| 91 | /* button data structure */ | ||
| 92 | struct bt_data { | ||
| 93 | u8 unknown1; /* constant */ | ||
| 94 | u8 button; /* left button */ | ||
| 95 | u8 rel_x; /* relative x coordinate */ | ||
| 96 | u8 rel_y; /* relative y coordinate */ | ||
| 97 | }; | ||
| 98 | |||
| 99 | /* trackpad header structure */ | ||
| 100 | struct tp_header { | ||
| 101 | u8 unknown1[16]; /* constants, timers, etc */ | ||
| 102 | u8 fingers; /* number of fingers on trackpad */ | ||
| 103 | u8 unknown2[9]; /* constants, timers, etc */ | ||
| 104 | }; | ||
| 105 | |||
| 106 | /* trackpad finger structure */ | ||
| 107 | struct tp_finger { | ||
| 108 | __le16 origin; /* zero when switching track finger */ | ||
| 109 | __le16 abs_x; /* absolute x coodinate */ | ||
| 110 | __le16 abs_y; /* absolute y coodinate */ | ||
| 111 | __le16 rel_x; /* relative x coodinate */ | ||
| 112 | __le16 rel_y; /* relative y coodinate */ | ||
| 113 | __le16 size_major; /* finger size, major axis? */ | ||
| 114 | __le16 size_minor; /* finger size, minor axis? */ | ||
| 115 | __le16 orientation; /* 16384 when point, else 15 bit angle */ | ||
| 116 | __le16 force_major; /* trackpad force, major axis? */ | ||
| 117 | __le16 force_minor; /* trackpad force, minor axis? */ | ||
| 118 | __le16 unused[3]; /* zeros */ | ||
| 119 | __le16 multi; /* one finger: varies, more fingers: constant */ | ||
| 120 | }; | ||
| 121 | |||
| 122 | /* trackpad data structure, empirically at least ten fingers */ | ||
| 123 | struct tp_data { | ||
| 124 | struct tp_header header; | ||
| 125 | struct tp_finger finger[16]; | ||
| 126 | }; | ||
| 127 | |||
| 128 | /* device-specific parameters */ | ||
| 129 | struct bcm5974_param { | ||
| 130 | int dim; /* logical dimension */ | ||
| 131 | int fuzz; /* logical noise value */ | ||
| 132 | int devmin; /* device minimum reading */ | ||
| 133 | int devmax; /* device maximum reading */ | ||
| 134 | }; | ||
| 135 | |||
| 136 | /* device-specific configuration */ | ||
| 137 | struct bcm5974_config { | ||
| 138 | int ansi, iso, jis; /* the product id of this device */ | ||
| 139 | int bt_ep; /* the endpoint of the button interface */ | ||
| 140 | int bt_datalen; /* data length of the button interface */ | ||
| 141 | int tp_ep; /* the endpoint of the trackpad interface */ | ||
| 142 | int tp_datalen; /* data length of the trackpad interface */ | ||
| 143 | struct bcm5974_param p; /* finger pressure limits */ | ||
| 144 | struct bcm5974_param w; /* finger width limits */ | ||
| 145 | struct bcm5974_param x; /* horizontal limits */ | ||
| 146 | struct bcm5974_param y; /* vertical limits */ | ||
| 147 | }; | ||
| 148 | |||
| 149 | /* logical device structure */ | ||
| 150 | struct bcm5974 { | ||
| 151 | char phys[64]; | ||
| 152 | struct usb_device *udev; /* usb device */ | ||
| 153 | struct usb_interface *intf; /* our interface */ | ||
| 154 | struct input_dev *input; /* input dev */ | ||
| 155 | struct bcm5974_config cfg; /* device configuration */ | ||
| 156 | struct mutex pm_mutex; /* serialize access to open/suspend */ | ||
| 157 | int opened; /* 1: opened, 0: closed */ | ||
| 158 | struct urb *bt_urb; /* button usb request block */ | ||
| 159 | struct bt_data *bt_data; /* button transferred data */ | ||
| 160 | struct urb *tp_urb; /* trackpad usb request block */ | ||
| 161 | struct tp_data *tp_data; /* trackpad transferred data */ | ||
| 162 | int fingers; /* number of fingers on trackpad */ | ||
| 163 | }; | ||
| 164 | |||
| 165 | /* logical dimensions */ | ||
| 166 | #define DIM_PRESSURE 256 /* maximum finger pressure */ | ||
| 167 | #define DIM_WIDTH 16 /* maximum finger width */ | ||
| 168 | #define DIM_X 1280 /* maximum trackpad x value */ | ||
| 169 | #define DIM_Y 800 /* maximum trackpad y value */ | ||
| 170 | |||
| 171 | /* logical signal quality */ | ||
| 172 | #define SN_PRESSURE 45 /* pressure signal-to-noise ratio */ | ||
| 173 | #define SN_WIDTH 100 /* width signal-to-noise ratio */ | ||
| 174 | #define SN_COORD 250 /* coordinate signal-to-noise ratio */ | ||
| 175 | |||
| 176 | /* pressure thresholds */ | ||
| 177 | #define PRESSURE_LOW (2 * DIM_PRESSURE / SN_PRESSURE) | ||
| 178 | #define PRESSURE_HIGH (3 * PRESSURE_LOW) | ||
| 179 | |||
| 180 | /* device constants */ | ||
| 181 | static const struct bcm5974_config bcm5974_config_table[] = { | ||
| 182 | { | ||
| 183 | USB_DEVICE_ID_APPLE_WELLSPRING_ANSI, | ||
| 184 | USB_DEVICE_ID_APPLE_WELLSPRING_ISO, | ||
| 185 | USB_DEVICE_ID_APPLE_WELLSPRING_JIS, | ||
| 186 | 0x84, sizeof(struct bt_data), | ||
| 187 | 0x81, sizeof(struct tp_data), | ||
| 188 | { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 }, | ||
| 189 | { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, | ||
| 190 | { DIM_X, DIM_X / SN_COORD, -4824, 5342 }, | ||
| 191 | { DIM_Y, DIM_Y / SN_COORD, -172, 5820 } | ||
| 192 | }, | ||
| 193 | { | ||
| 194 | USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI, | ||
| 195 | USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, | ||
| 196 | USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, | ||
| 197 | 0x84, sizeof(struct bt_data), | ||
| 198 | 0x81, sizeof(struct tp_data), | ||
| 199 | { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 }, | ||
| 200 | { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, | ||
| 201 | { DIM_X, DIM_X / SN_COORD, -4824, 4824 }, | ||
| 202 | { DIM_Y, DIM_Y / SN_COORD, -172, 4290 } | ||
| 203 | }, | ||
| 204 | {} | ||
| 205 | }; | ||
| 206 | |||
| 207 | /* return the device-specific configuration by device */ | ||
| 208 | static const struct bcm5974_config *bcm5974_get_config(struct usb_device *udev) | ||
| 209 | { | ||
| 210 | u16 id = le16_to_cpu(udev->descriptor.idProduct); | ||
| 211 | const struct bcm5974_config *cfg; | ||
| 212 | |||
| 213 | for (cfg = bcm5974_config_table; cfg->ansi; ++cfg) | ||
| 214 | if (cfg->ansi == id || cfg->iso == id || cfg->jis == id) | ||
| 215 | return cfg; | ||
| 216 | |||
| 217 | return bcm5974_config_table; | ||
| 218 | } | ||
| 219 | |||
| 220 | /* convert 16-bit little endian to signed integer */ | ||
| 221 | static inline int raw2int(__le16 x) | ||
| 222 | { | ||
| 223 | return (signed short)le16_to_cpu(x); | ||
| 224 | } | ||
| 225 | |||
| 226 | /* scale device data to logical dimensions (asserts devmin < devmax) */ | ||
| 227 | static inline int int2scale(const struct bcm5974_param *p, int x) | ||
| 228 | { | ||
| 229 | return x * p->dim / (p->devmax - p->devmin); | ||
| 230 | } | ||
| 231 | |||
| 232 | /* all logical value ranges are [0,dim). */ | ||
| 233 | static inline int int2bound(const struct bcm5974_param *p, int x) | ||
| 234 | { | ||
| 235 | int s = int2scale(p, x); | ||
| 236 | |||
| 237 | return clamp_val(s, 0, p->dim - 1); | ||
| 238 | } | ||
| 239 | |||
| 240 | /* setup which logical events to report */ | ||
| 241 | static void setup_events_to_report(struct input_dev *input_dev, | ||
| 242 | const struct bcm5974_config *cfg) | ||
| 243 | { | ||
| 244 | __set_bit(EV_ABS, input_dev->evbit); | ||
| 245 | |||
| 246 | input_set_abs_params(input_dev, ABS_PRESSURE, | ||
| 247 | 0, cfg->p.dim, cfg->p.fuzz, 0); | ||
| 248 | input_set_abs_params(input_dev, ABS_TOOL_WIDTH, | ||
| 249 | 0, cfg->w.dim, cfg->w.fuzz, 0); | ||
| 250 | input_set_abs_params(input_dev, ABS_X, | ||
| 251 | 0, cfg->x.dim, cfg->x.fuzz, 0); | ||
| 252 | input_set_abs_params(input_dev, ABS_Y, | ||
| 253 | 0, cfg->y.dim, cfg->y.fuzz, 0); | ||
| 254 | |||
| 255 | __set_bit(EV_KEY, input_dev->evbit); | ||
| 256 | __set_bit(BTN_TOUCH, input_dev->keybit); | ||
| 257 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | ||
| 258 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | ||
| 259 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | ||
| 260 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
| 261 | } | ||
| 262 | |||
| 263 | /* report button data as logical button state */ | ||
| 264 | static int report_bt_state(struct bcm5974 *dev, int size) | ||
| 265 | { | ||
| 266 | if (size != sizeof(struct bt_data)) | ||
| 267 | return -EIO; | ||
| 268 | |||
| 269 | input_report_key(dev->input, BTN_LEFT, dev->bt_data->button); | ||
| 270 | input_sync(dev->input); | ||
| 271 | |||
| 272 | return 0; | ||
| 273 | } | ||
| 274 | |||
| 275 | /* report trackpad data as logical trackpad state */ | ||
| 276 | static int report_tp_state(struct bcm5974 *dev, int size) | ||
| 277 | { | ||
| 278 | const struct bcm5974_config *c = &dev->cfg; | ||
| 279 | const struct tp_finger *f = dev->tp_data->finger; | ||
| 280 | struct input_dev *input = dev->input; | ||
| 281 | const int fingers = (size - 26) / 28; | ||
| 282 | int raw_p, raw_w, raw_x, raw_y; | ||
| 283 | int ptest = 0, origin = 0, nmin = 0, nmax = 0; | ||
| 284 | int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; | ||
| 285 | |||
| 286 | if (size < 26 || (size - 26) % 28 != 0) | ||
| 287 | return -EIO; | ||
| 288 | |||
| 289 | /* always track the first finger; when detached, start over */ | ||
| 290 | if (fingers) { | ||
| 291 | raw_p = raw2int(f->force_major); | ||
| 292 | raw_w = raw2int(f->size_major); | ||
| 293 | raw_x = raw2int(f->abs_x); | ||
| 294 | raw_y = raw2int(f->abs_y); | ||
| 295 | |||
| 296 | dprintk(9, | ||
| 297 | "bcm5974: raw: p: %+05d w: %+05d x: %+05d y: %+05d\n", | ||
| 298 | raw_p, raw_w, raw_x, raw_y); | ||
| 299 | |||
| 300 | ptest = int2bound(&c->p, raw_p); | ||
| 301 | origin = raw2int(f->origin); | ||
| 302 | } | ||
| 303 | |||
| 304 | /* while tracking finger still valid, count all fingers */ | ||
| 305 | if (ptest > PRESSURE_LOW && origin) { | ||
| 306 | abs_p = ptest; | ||
| 307 | abs_w = int2bound(&c->w, raw_w); | ||
| 308 | abs_x = int2bound(&c->x, raw_x - c->x.devmin); | ||
| 309 | abs_y = int2bound(&c->y, c->y.devmax - raw_y); | ||
| 310 | for (; f != dev->tp_data->finger + fingers; f++) { | ||
| 311 | ptest = int2bound(&c->p, raw2int(f->force_major)); | ||
| 312 | if (ptest > PRESSURE_LOW) | ||
| 313 | nmax++; | ||
| 314 | if (ptest > PRESSURE_HIGH) | ||
| 315 | nmin++; | ||
| 316 | } | ||
| 317 | } | ||
| 318 | |||
| 319 | if (dev->fingers < nmin) | ||
| 320 | dev->fingers = nmin; | ||
| 321 | if (dev->fingers > nmax) | ||
| 322 | dev->fingers = nmax; | ||
| 323 | |||
| 324 | input_report_key(input, BTN_TOUCH, dev->fingers > 0); | ||
| 325 | input_report_key(input, BTN_TOOL_FINGER, dev->fingers == 1); | ||
| 326 | input_report_key(input, BTN_TOOL_DOUBLETAP, dev->fingers == 2); | ||
| 327 | input_report_key(input, BTN_TOOL_TRIPLETAP, dev->fingers > 2); | ||
| 328 | |||
| 329 | input_report_abs(input, ABS_PRESSURE, abs_p); | ||
| 330 | input_report_abs(input, ABS_TOOL_WIDTH, abs_w); | ||
| 331 | |||
| 332 | if (abs_p) { | ||
| 333 | input_report_abs(input, ABS_X, abs_x); | ||
| 334 | input_report_abs(input, ABS_Y, abs_y); | ||
| 335 | |||
| 336 | dprintk(8, | ||
| 337 | "bcm5974: abs: p: %+05d w: %+05d x: %+05d y: %+05d " | ||
| 338 | "nmin: %d nmax: %d n: %d\n", | ||
| 339 | abs_p, abs_w, abs_x, abs_y, nmin, nmax, dev->fingers); | ||
| 340 | |||
| 341 | } | ||
| 342 | |||
| 343 | input_sync(input); | ||
| 344 | |||
| 345 | return 0; | ||
| 346 | } | ||
| 347 | |||
| 348 | /* Wellspring initialization constants */ | ||
| 349 | #define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1 | ||
| 350 | #define BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID 9 | ||
| 351 | #define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300 | ||
| 352 | #define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0 | ||
| 353 | #define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01 | ||
| 354 | #define BCM5974_WELLSPRING_MODE_NORMAL_VALUE 0x08 | ||
| 355 | |||
| 356 | static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | ||
| 357 | { | ||
| 358 | char *data = kmalloc(8, GFP_KERNEL); | ||
| 359 | int retval = 0, size; | ||
| 360 | |||
| 361 | if (!data) { | ||
| 362 | err("bcm5974: out of memory"); | ||
| 363 | retval = -ENOMEM; | ||
| 364 | goto out; | ||
| 365 | } | ||
| 366 | |||
| 367 | /* read configuration */ | ||
| 368 | size = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), | ||
| 369 | BCM5974_WELLSPRING_MODE_READ_REQUEST_ID, | ||
| 370 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 371 | BCM5974_WELLSPRING_MODE_REQUEST_VALUE, | ||
| 372 | BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); | ||
| 373 | |||
| 374 | if (size != 8) { | ||
| 375 | err("bcm5974: could not read from device"); | ||
| 376 | retval = -EIO; | ||
| 377 | goto out; | ||
| 378 | } | ||
| 379 | |||
| 380 | /* apply the mode switch */ | ||
| 381 | data[0] = on ? | ||
| 382 | BCM5974_WELLSPRING_MODE_VENDOR_VALUE : | ||
| 383 | BCM5974_WELLSPRING_MODE_NORMAL_VALUE; | ||
| 384 | |||
| 385 | /* write configuration */ | ||
| 386 | size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), | ||
| 387 | BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID, | ||
| 388 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 389 | BCM5974_WELLSPRING_MODE_REQUEST_VALUE, | ||
| 390 | BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); | ||
| 391 | |||
| 392 | if (size != 8) { | ||
| 393 | err("bcm5974: could not write to device"); | ||
| 394 | retval = -EIO; | ||
| 395 | goto out; | ||
| 396 | } | ||
| 397 | |||
| 398 | dprintk(2, "bcm5974: switched to %s mode.\n", | ||
| 399 | on ? "wellspring" : "normal"); | ||
| 400 | |||
| 401 | out: | ||
| 402 | kfree(data); | ||
| 403 | return retval; | ||
| 404 | } | ||
| 405 | |||
| 406 | static void bcm5974_irq_button(struct urb *urb) | ||
| 407 | { | ||
| 408 | struct bcm5974 *dev = urb->context; | ||
| 409 | int error; | ||
| 410 | |||
| 411 | switch (urb->status) { | ||
| 412 | case 0: | ||
| 413 | break; | ||
| 414 | case -EOVERFLOW: | ||
| 415 | case -ECONNRESET: | ||
| 416 | case -ENOENT: | ||
| 417 | case -ESHUTDOWN: | ||
| 418 | dbg("bcm5974: button urb shutting down: %d", urb->status); | ||
| 419 | return; | ||
| 420 | default: | ||
| 421 | dbg("bcm5974: button urb status: %d", urb->status); | ||
| 422 | goto exit; | ||
| 423 | } | ||
| 424 | |||
| 425 | if (report_bt_state(dev, dev->bt_urb->actual_length)) | ||
| 426 | dprintk(1, "bcm5974: bad button package, length: %d\n", | ||
| 427 | dev->bt_urb->actual_length); | ||
| 428 | |||
| 429 | exit: | ||
| 430 | error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); | ||
| 431 | if (error) | ||
| 432 | err("bcm5974: button urb failed: %d", error); | ||
| 433 | } | ||
| 434 | |||
| 435 | static void bcm5974_irq_trackpad(struct urb *urb) | ||
| 436 | { | ||
| 437 | struct bcm5974 *dev = urb->context; | ||
| 438 | int error; | ||
| 439 | |||
| 440 | switch (urb->status) { | ||
| 441 | case 0: | ||
| 442 | break; | ||
| 443 | case -EOVERFLOW: | ||
| 444 | case -ECONNRESET: | ||
| 445 | case -ENOENT: | ||
| 446 | case -ESHUTDOWN: | ||
| 447 | dbg("bcm5974: trackpad urb shutting down: %d", urb->status); | ||
| 448 | return; | ||
| 449 | default: | ||
| 450 | dbg("bcm5974: trackpad urb status: %d", urb->status); | ||
| 451 | goto exit; | ||
| 452 | } | ||
| 453 | |||
| 454 | /* control response ignored */ | ||
| 455 | if (dev->tp_urb->actual_length == 2) | ||
| 456 | goto exit; | ||
| 457 | |||
| 458 | if (report_tp_state(dev, dev->tp_urb->actual_length)) | ||
| 459 | dprintk(1, "bcm5974: bad trackpad package, length: %d\n", | ||
| 460 | dev->tp_urb->actual_length); | ||
| 461 | |||
| 462 | exit: | ||
| 463 | error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); | ||
| 464 | if (error) | ||
| 465 | err("bcm5974: trackpad urb failed: %d", error); | ||
| 466 | } | ||
| 467 | |||
| 468 | /* | ||
| 469 | * The Wellspring trackpad, like many recent Apple trackpads, share | ||
| 470 | * the usb device with the keyboard. Since keyboards are usually | ||
| 471 | * handled by the HID system, the device ends up being handled by two | ||
| 472 | * modules. Setting up the device therefore becomes slightly | ||
| 473 | * complicated. To enable multitouch features, a mode switch is | ||
| 474 | * required, which is usually applied via the control interface of the | ||
| 475 | * device. It can be argued where this switch should take place. In | ||
| 476 | * some drivers, like appletouch, the switch is made during | ||
| 477 | * probe. However, the hid module may also alter the state of the | ||
| 478 | * device, resulting in trackpad malfunction under certain | ||
| 479 | * circumstances. To get around this problem, there is at least one | ||
| 480 | * example that utilizes the USB_QUIRK_RESET_RESUME quirk in order to | ||
| 481 | * recieve a reset_resume request rather than the normal resume. | ||
| 482 | * Since the implementation of reset_resume is equal to mode switch | ||
| 483 | * plus start_traffic, it seems easier to always do the switch when | ||
| 484 | * starting traffic on the device. | ||
| 485 | */ | ||
| 486 | static int bcm5974_start_traffic(struct bcm5974 *dev) | ||
| 487 | { | ||
| 488 | if (bcm5974_wellspring_mode(dev, true)) { | ||
| 489 | dprintk(1, "bcm5974: mode switch failed\n"); | ||
| 490 | goto error; | ||
| 491 | } | ||
| 492 | |||
| 493 | if (usb_submit_urb(dev->bt_urb, GFP_KERNEL)) | ||
| 494 | goto error; | ||
| 495 | |||
| 496 | if (usb_submit_urb(dev->tp_urb, GFP_KERNEL)) | ||
| 497 | goto err_kill_bt; | ||
| 498 | |||
| 499 | return 0; | ||
| 500 | |||
| 501 | err_kill_bt: | ||
| 502 | usb_kill_urb(dev->bt_urb); | ||
| 503 | error: | ||
| 504 | return -EIO; | ||
| 505 | } | ||
| 506 | |||
| 507 | static void bcm5974_pause_traffic(struct bcm5974 *dev) | ||
| 508 | { | ||
| 509 | usb_kill_urb(dev->tp_urb); | ||
| 510 | usb_kill_urb(dev->bt_urb); | ||
| 511 | bcm5974_wellspring_mode(dev, false); | ||
| 512 | } | ||
| 513 | |||
| 514 | /* | ||
| 515 | * The code below implements open/close and manual suspend/resume. | ||
| 516 | * All functions may be called in random order. | ||
| 517 | * | ||
| 518 | * Opening a suspended device fails with EACCES - permission denied. | ||
| 519 | * | ||
| 520 | * Failing a resume leaves the device resumed but closed. | ||
| 521 | */ | ||
| 522 | static int bcm5974_open(struct input_dev *input) | ||
| 523 | { | ||
| 524 | struct bcm5974 *dev = input_get_drvdata(input); | ||
| 525 | int error; | ||
| 526 | |||
| 527 | error = usb_autopm_get_interface(dev->intf); | ||
| 528 | if (error) | ||
| 529 | return error; | ||
| 530 | |||
| 531 | mutex_lock(&dev->pm_mutex); | ||
| 532 | |||
| 533 | error = bcm5974_start_traffic(dev); | ||
| 534 | if (!error) | ||
| 535 | dev->opened = 1; | ||
| 536 | |||
| 537 | mutex_unlock(&dev->pm_mutex); | ||
| 538 | |||
| 539 | if (error) | ||
| 540 | usb_autopm_put_interface(dev->intf); | ||
| 541 | |||
| 542 | return error; | ||
| 543 | } | ||
| 544 | |||
| 545 | static void bcm5974_close(struct input_dev *input) | ||
| 546 | { | ||
| 547 | struct bcm5974 *dev = input_get_drvdata(input); | ||
| 548 | |||
| 549 | mutex_lock(&dev->pm_mutex); | ||
| 550 | |||
| 551 | bcm5974_pause_traffic(dev); | ||
| 552 | dev->opened = 0; | ||
| 553 | |||
| 554 | mutex_unlock(&dev->pm_mutex); | ||
| 555 | |||
| 556 | usb_autopm_put_interface(dev->intf); | ||
| 557 | } | ||
| 558 | |||
| 559 | static int bcm5974_suspend(struct usb_interface *iface, pm_message_t message) | ||
| 560 | { | ||
| 561 | struct bcm5974 *dev = usb_get_intfdata(iface); | ||
| 562 | |||
| 563 | mutex_lock(&dev->pm_mutex); | ||
| 564 | |||
| 565 | if (dev->opened) | ||
| 566 | bcm5974_pause_traffic(dev); | ||
| 567 | |||
| 568 | mutex_unlock(&dev->pm_mutex); | ||
| 569 | |||
| 570 | return 0; | ||
| 571 | } | ||
| 572 | |||
| 573 | static int bcm5974_resume(struct usb_interface *iface) | ||
| 574 | { | ||
| 575 | struct bcm5974 *dev = usb_get_intfdata(iface); | ||
| 576 | int error = 0; | ||
| 577 | |||
| 578 | mutex_lock(&dev->pm_mutex); | ||
| 579 | |||
| 580 | if (dev->opened) | ||
| 581 | error = bcm5974_start_traffic(dev); | ||
| 582 | |||
| 583 | mutex_unlock(&dev->pm_mutex); | ||
| 584 | |||
| 585 | return error; | ||
| 586 | } | ||
| 587 | |||
| 588 | static int bcm5974_probe(struct usb_interface *iface, | ||
| 589 | const struct usb_device_id *id) | ||
| 590 | { | ||
| 591 | struct usb_device *udev = interface_to_usbdev(iface); | ||
| 592 | const struct bcm5974_config *cfg; | ||
| 593 | struct bcm5974 *dev; | ||
| 594 | struct input_dev *input_dev; | ||
| 595 | int error = -ENOMEM; | ||
| 596 | |||
| 597 | /* find the product index */ | ||
| 598 | cfg = bcm5974_get_config(udev); | ||
| 599 | |||
| 600 | /* allocate memory for our device state and initialize it */ | ||
| 601 | dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL); | ||
| 602 | input_dev = input_allocate_device(); | ||
| 603 | if (!dev || !input_dev) { | ||
| 604 | err("bcm5974: out of memory"); | ||
| 605 | goto err_free_devs; | ||
| 606 | } | ||
| 607 | |||
| 608 | dev->udev = udev; | ||
| 609 | dev->intf = iface; | ||
| 610 | dev->input = input_dev; | ||
| 611 | dev->cfg = *cfg; | ||
| 612 | mutex_init(&dev->pm_mutex); | ||
| 613 | |||
| 614 | /* setup urbs */ | ||
| 615 | dev->bt_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
| 616 | if (!dev->bt_urb) | ||
| 617 | goto err_free_devs; | ||
| 618 | |||
| 619 | dev->tp_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
| 620 | if (!dev->tp_urb) | ||
| 621 | goto err_free_bt_urb; | ||
| 622 | |||
| 623 | dev->bt_data = usb_buffer_alloc(dev->udev, | ||
| 624 | dev->cfg.bt_datalen, GFP_KERNEL, | ||
| 625 | &dev->bt_urb->transfer_dma); | ||
| 626 | if (!dev->bt_data) | ||
| 627 | goto err_free_urb; | ||
| 628 | |||
| 629 | dev->tp_data = usb_buffer_alloc(dev->udev, | ||
| 630 | dev->cfg.tp_datalen, GFP_KERNEL, | ||
| 631 | &dev->tp_urb->transfer_dma); | ||
| 632 | if (!dev->tp_data) | ||
| 633 | goto err_free_bt_buffer; | ||
| 634 | |||
| 635 | usb_fill_int_urb(dev->bt_urb, udev, | ||
| 636 | usb_rcvintpipe(udev, cfg->bt_ep), | ||
| 637 | dev->bt_data, dev->cfg.bt_datalen, | ||
| 638 | bcm5974_irq_button, dev, 1); | ||
| 639 | |||
| 640 | usb_fill_int_urb(dev->tp_urb, udev, | ||
| 641 | usb_rcvintpipe(udev, cfg->tp_ep), | ||
| 642 | dev->tp_data, dev->cfg.tp_datalen, | ||
| 643 | bcm5974_irq_trackpad, dev, 1); | ||
| 644 | |||
| 645 | /* create bcm5974 device */ | ||
| 646 | usb_make_path(udev, dev->phys, sizeof(dev->phys)); | ||
| 647 | strlcat(dev->phys, "/input0", sizeof(dev->phys)); | ||
| 648 | |||
| 649 | input_dev->name = "bcm5974"; | ||
| 650 | input_dev->phys = dev->phys; | ||
| 651 | usb_to_input_id(dev->udev, &input_dev->id); | ||
| 652 | input_dev->dev.parent = &iface->dev; | ||
| 653 | |||
| 654 | input_set_drvdata(input_dev, dev); | ||
| 655 | |||
| 656 | input_dev->open = bcm5974_open; | ||
| 657 | input_dev->close = bcm5974_close; | ||
| 658 | |||
| 659 | setup_events_to_report(input_dev, cfg); | ||
| 660 | |||
| 661 | error = input_register_device(dev->input); | ||
| 662 | if (error) | ||
| 663 | goto err_free_buffer; | ||
| 664 | |||
| 665 | /* save our data pointer in this interface device */ | ||
| 666 | usb_set_intfdata(iface, dev); | ||
| 667 | |||
| 668 | return 0; | ||
| 669 | |||
| 670 | err_free_buffer: | ||
| 671 | usb_buffer_free(dev->udev, dev->cfg.tp_datalen, | ||
| 672 | dev->tp_data, dev->tp_urb->transfer_dma); | ||
| 673 | err_free_bt_buffer: | ||
| 674 | usb_buffer_free(dev->udev, dev->cfg.bt_datalen, | ||
| 675 | dev->bt_data, dev->bt_urb->transfer_dma); | ||
| 676 | err_free_urb: | ||
| 677 | usb_free_urb(dev->tp_urb); | ||
| 678 | err_free_bt_urb: | ||
| 679 | usb_free_urb(dev->bt_urb); | ||
| 680 | err_free_devs: | ||
| 681 | usb_set_intfdata(iface, NULL); | ||
| 682 | input_free_device(input_dev); | ||
| 683 | kfree(dev); | ||
| 684 | return error; | ||
| 685 | } | ||
| 686 | |||
| 687 | static void bcm5974_disconnect(struct usb_interface *iface) | ||
| 688 | { | ||
| 689 | struct bcm5974 *dev = usb_get_intfdata(iface); | ||
| 690 | |||
| 691 | usb_set_intfdata(iface, NULL); | ||
| 692 | |||
| 693 | input_unregister_device(dev->input); | ||
| 694 | usb_buffer_free(dev->udev, dev->cfg.tp_datalen, | ||
| 695 | dev->tp_data, dev->tp_urb->transfer_dma); | ||
| 696 | usb_buffer_free(dev->udev, dev->cfg.bt_datalen, | ||
| 697 | dev->bt_data, dev->bt_urb->transfer_dma); | ||
| 698 | usb_free_urb(dev->tp_urb); | ||
| 699 | usb_free_urb(dev->bt_urb); | ||
| 700 | kfree(dev); | ||
| 701 | } | ||
| 702 | |||
| 703 | static struct usb_driver bcm5974_driver = { | ||
| 704 | .name = "bcm5974", | ||
| 705 | .probe = bcm5974_probe, | ||
| 706 | .disconnect = bcm5974_disconnect, | ||
| 707 | .suspend = bcm5974_suspend, | ||
| 708 | .resume = bcm5974_resume, | ||
| 709 | .reset_resume = bcm5974_resume, | ||
| 710 | .id_table = bcm5974_table, | ||
| 711 | .supports_autosuspend = 1, | ||
| 712 | }; | ||
| 713 | |||
| 714 | static int __init bcm5974_init(void) | ||
| 715 | { | ||
| 716 | return usb_register(&bcm5974_driver); | ||
| 717 | } | ||
| 718 | |||
| 719 | static void __exit bcm5974_exit(void) | ||
| 720 | { | ||
| 721 | usb_deregister(&bcm5974_driver); | ||
| 722 | } | ||
| 723 | |||
| 724 | module_init(bcm5974_init); | ||
| 725 | module_exit(bcm5974_exit); | ||
| 726 | |||
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index 339290184871..72cf5e33790e 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
| 12 | #include <linux/version.h> | ||
| 13 | #include <linux/module.h> | 12 | #include <linux/module.h> |
| 14 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
| 15 | #include <linux/input-polldev.h> | 14 | #include <linux/input-polldev.h> |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index fe732a574ec2..5aafe24984c5 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
| @@ -305,7 +305,7 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { | |||
| 305 | .ident = "Lenovo 3000 n100", | 305 | .ident = "Lenovo 3000 n100", |
| 306 | .matches = { | 306 | .matches = { |
| 307 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | 307 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
| 308 | DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"), | 308 | DMI_MATCH(DMI_PRODUCT_NAME, "076804U"), |
| 309 | }, | 309 | }, |
| 310 | }, | 310 | }, |
| 311 | { | 311 | { |
| @@ -394,6 +394,13 @@ static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = { | |||
| 394 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"), | 394 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"), |
| 395 | }, | 395 | }, |
| 396 | }, | 396 | }, |
| 397 | { | ||
| 398 | .ident = "Acer TravelMate 4280", | ||
| 399 | .matches = { | ||
| 400 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
| 401 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"), | ||
| 402 | }, | ||
| 403 | }, | ||
| 397 | { } | 404 | { } |
| 398 | }; | 405 | }; |
| 399 | 406 | ||
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index 0ed044d5e685..765007899d9a 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c | |||
| @@ -269,8 +269,8 @@ static int xps2_setup(struct device *dev, struct resource *regs_res, | |||
| 269 | * we have the PS2 in a good state */ | 269 | * we have the PS2 in a good state */ |
| 270 | out_be32(drvdata->base_address + XPS2_SRST_OFFSET, XPS2_SRST_RESET); | 270 | out_be32(drvdata->base_address + XPS2_SRST_OFFSET, XPS2_SRST_RESET); |
| 271 | 271 | ||
| 272 | dev_info(dev, "Xilinx PS2 at 0x%08X mapped to 0x%08X, irq=%d\n", | 272 | dev_info(dev, "Xilinx PS2 at 0x%08X mapped to 0x%p, irq=%d\n", |
| 273 | drvdata->phys_addr, (u32)drvdata->base_address, drvdata->irq); | 273 | drvdata->phys_addr, drvdata->base_address, drvdata->irq); |
| 274 | 274 | ||
| 275 | serio = &drvdata->serio; | 275 | serio = &drvdata->serio; |
| 276 | serio->id.type = SERIO_8042; | 276 | serio->id.type = SERIO_8042; |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index b9b7a98bc5a5..7df0228e836e 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
| @@ -64,7 +64,6 @@ Scott Hill shill@gtcocalcomp.com | |||
| 64 | #include <asm/byteorder.h> | 64 | #include <asm/byteorder.h> |
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | #include <linux/version.h> | ||
| 68 | #include <linux/usb/input.h> | 67 | #include <linux/usb/input.h> |
| 69 | 68 | ||
| 70 | /* Version with a Major number of 2 is for kernel inclusion only. */ | 69 | /* Version with a Major number of 2 is for kernel inclusion only. */ |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 6e60a97a234c..25287e80e236 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -249,29 +249,26 @@ config TOUCHSCREEN_WM97XX | |||
| 249 | config TOUCHSCREEN_WM9705 | 249 | config TOUCHSCREEN_WM9705 |
| 250 | bool "WM9705 Touchscreen interface support" | 250 | bool "WM9705 Touchscreen interface support" |
| 251 | depends on TOUCHSCREEN_WM97XX | 251 | depends on TOUCHSCREEN_WM97XX |
| 252 | default y | ||
| 252 | help | 253 | help |
| 253 | Say Y here if you have a Wolfson Microelectronics WM9705 | 254 | Say Y here to enable support for the Wolfson Microelectronics |
| 254 | touchscreen controller connected to your system. | 255 | WM9705 touchscreen controller. |
| 255 | |||
| 256 | If unsure, say N. | ||
| 257 | 256 | ||
| 258 | config TOUCHSCREEN_WM9712 | 257 | config TOUCHSCREEN_WM9712 |
| 259 | bool "WM9712 Touchscreen interface support" | 258 | bool "WM9712 Touchscreen interface support" |
| 260 | depends on TOUCHSCREEN_WM97XX | 259 | depends on TOUCHSCREEN_WM97XX |
| 260 | default y | ||
| 261 | help | 261 | help |
| 262 | Say Y here if you have a Wolfson Microelectronics WM9712 | 262 | Say Y here to enable support for the Wolfson Microelectronics |
| 263 | touchscreen controller connected to your system. | 263 | WM9712 touchscreen controller. |
| 264 | |||
| 265 | If unsure, say N. | ||
| 266 | 264 | ||
| 267 | config TOUCHSCREEN_WM9713 | 265 | config TOUCHSCREEN_WM9713 |
| 268 | bool "WM9713 Touchscreen interface support" | 266 | bool "WM9713 Touchscreen interface support" |
| 269 | depends on TOUCHSCREEN_WM97XX | 267 | depends on TOUCHSCREEN_WM97XX |
| 268 | default y | ||
| 270 | help | 269 | help |
| 271 | Say Y here if you have a Wolfson Microelectronics WM9713 touchscreen | 270 | Say Y here to enable support for the Wolfson Microelectronics |
| 272 | controller connected to your system. | 271 | WM9713 touchscreen controller. |
| 273 | |||
| 274 | If unsure, say N. | ||
| 275 | 272 | ||
| 276 | config TOUCHSCREEN_WM97XX_MAINSTONE | 273 | config TOUCHSCREEN_WM97XX_MAINSTONE |
| 277 | tristate "WM97xx Mainstone accelerated touch" | 274 | tristate "WM97xx Mainstone accelerated touch" |
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c index bf44f9d68342..c8b7e8a45c4d 100644 --- a/drivers/input/touchscreen/jornada720_ts.c +++ b/drivers/input/touchscreen/jornada720_ts.c | |||
| @@ -119,8 +119,8 @@ static int __devinit jornada720_ts_probe(struct platform_device *pdev) | |||
| 119 | input_dev->id.bustype = BUS_HOST; | 119 | input_dev->id.bustype = BUS_HOST; |
| 120 | input_dev->dev.parent = &pdev->dev; | 120 | input_dev->dev.parent = &pdev->dev; |
| 121 | 121 | ||
| 122 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 122 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 123 | input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); | 123 | input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); |
| 124 | input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0); | 124 | input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0); |
| 125 | input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0); | 125 | input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0); |
| 126 | 126 | ||
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c index 283f93a0cee2..37a555f37306 100644 --- a/drivers/input/touchscreen/mainstone-wm97xx.c +++ b/drivers/input/touchscreen/mainstone-wm97xx.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
| 28 | #include <linux/version.h> | ||
| 29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
| 30 | #include <linux/init.h> | 29 | #include <linux/init.h> |
| 31 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c index c1cd99d58981..504ca11749a1 100644 --- a/drivers/input/touchscreen/migor_ts.c +++ b/drivers/input/touchscreen/migor_ts.c | |||
| @@ -173,7 +173,7 @@ static int migor_ts_probe(struct i2c_client *client, | |||
| 173 | input_set_abs_params(input, ABS_X, 95, 955, 0, 0); | 173 | input_set_abs_params(input, ABS_X, 95, 955, 0, 0); |
| 174 | input_set_abs_params(input, ABS_Y, 85, 935, 0, 0); | 174 | input_set_abs_params(input, ABS_Y, 85, 935, 0, 0); |
| 175 | 175 | ||
| 176 | input->name = client->driver_name; | 176 | input->name = client->name; |
| 177 | input->id.bustype = BUS_I2C; | 177 | input->id.bustype = BUS_I2C; |
| 178 | input->dev.parent = &client->dev; | 178 | input->dev.parent = &client->dev; |
| 179 | 179 | ||
| @@ -192,7 +192,7 @@ static int migor_ts_probe(struct i2c_client *client, | |||
| 192 | goto err1; | 192 | goto err1; |
| 193 | 193 | ||
| 194 | error = request_irq(priv->irq, migor_ts_isr, IRQF_TRIGGER_LOW, | 194 | error = request_irq(priv->irq, migor_ts_isr, IRQF_TRIGGER_LOW, |
| 195 | client->driver_name, priv); | 195 | client->name, priv); |
| 196 | if (error) { | 196 | if (error) { |
| 197 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | 197 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); |
| 198 | goto err2; | 198 | goto err2; |
| @@ -224,12 +224,19 @@ static int migor_ts_remove(struct i2c_client *client) | |||
| 224 | return 0; | 224 | return 0; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static const struct i2c_device_id migor_ts_id[] = { | ||
| 228 | { "migor_ts", 0 }, | ||
| 229 | { } | ||
| 230 | }; | ||
| 231 | MODULE_DEVICE_TABLE(i2c, migor_ts); | ||
| 232 | |||
| 227 | static struct i2c_driver migor_ts_driver = { | 233 | static struct i2c_driver migor_ts_driver = { |
| 228 | .driver = { | 234 | .driver = { |
| 229 | .name = "migor_ts", | 235 | .name = "migor_ts", |
| 230 | }, | 236 | }, |
| 231 | .probe = migor_ts_probe, | 237 | .probe = migor_ts_probe, |
| 232 | .remove = migor_ts_remove, | 238 | .remove = migor_ts_remove, |
| 239 | .id_table = migor_ts_id, | ||
| 233 | }; | 240 | }; |
| 234 | 241 | ||
| 235 | static int __init migor_ts_init(void) | 242 | static int __init migor_ts_init(void) |
diff --git a/drivers/input/touchscreen/wm9705.c b/drivers/input/touchscreen/wm9705.c index 978e1a13ffc7..372efbc694ff 100644 --- a/drivers/input/touchscreen/wm9705.c +++ b/drivers/input/touchscreen/wm9705.c | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | 17 | ||
| 18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
| 20 | #include <linux/version.h> | ||
| 21 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 22 | #include <linux/input.h> | 21 | #include <linux/input.h> |
| 23 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c index 4c5d85a249ae..c8bb1e7335fc 100644 --- a/drivers/input/touchscreen/wm9712.c +++ b/drivers/input/touchscreen/wm9712.c | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | 17 | ||
| 18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
| 20 | #include <linux/version.h> | ||
| 21 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 22 | #include <linux/input.h> | 21 | #include <linux/input.h> |
| 23 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c index 838458792ea0..781ee83547e6 100644 --- a/drivers/input/touchscreen/wm9713.c +++ b/drivers/input/touchscreen/wm9713.c | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | 17 | ||
| 18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
| 20 | #include <linux/version.h> | ||
| 21 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 22 | #include <linux/input.h> | 21 | #include <linux/input.h> |
| 23 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index cdc24ad314e0..d589ab0e3adc 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | 37 | ||
| 38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
| 39 | #include <linux/moduleparam.h> | 39 | #include <linux/moduleparam.h> |
| 40 | #include <linux/version.h> | ||
| 41 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
| 42 | #include <linux/init.h> | 41 | #include <linux/init.h> |
| 43 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
diff --git a/drivers/leds/leds-fsg.c b/drivers/leds/leds-fsg.c index be0e12144b8b..34935155c1c0 100644 --- a/drivers/leds/leds-fsg.c +++ b/drivers/leds/leds-fsg.c | |||
| @@ -161,6 +161,16 @@ static int fsg_led_probe(struct platform_device *pdev) | |||
| 161 | { | 161 | { |
| 162 | int ret; | 162 | int ret; |
| 163 | 163 | ||
| 164 | /* Map the LED chip select address space */ | ||
| 165 | latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); | ||
| 166 | if (!latch_address) { | ||
| 167 | ret = -ENOMEM; | ||
| 168 | goto failremap; | ||
| 169 | } | ||
| 170 | |||
| 171 | latch_value = 0xffff; | ||
| 172 | *latch_address = latch_value; | ||
| 173 | |||
| 164 | ret = led_classdev_register(&pdev->dev, &fsg_wlan_led); | 174 | ret = led_classdev_register(&pdev->dev, &fsg_wlan_led); |
| 165 | if (ret < 0) | 175 | if (ret < 0) |
| 166 | goto failwlan; | 176 | goto failwlan; |
| @@ -185,20 +195,8 @@ static int fsg_led_probe(struct platform_device *pdev) | |||
| 185 | if (ret < 0) | 195 | if (ret < 0) |
| 186 | goto failring; | 196 | goto failring; |
| 187 | 197 | ||
| 188 | /* Map the LED chip select address space */ | ||
| 189 | latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); | ||
| 190 | if (!latch_address) { | ||
| 191 | ret = -ENOMEM; | ||
| 192 | goto failremap; | ||
| 193 | } | ||
| 194 | |||
| 195 | latch_value = 0xffff; | ||
| 196 | *latch_address = latch_value; | ||
| 197 | |||
| 198 | return ret; | 198 | return ret; |
| 199 | 199 | ||
| 200 | failremap: | ||
| 201 | led_classdev_unregister(&fsg_ring_led); | ||
| 202 | failring: | 200 | failring: |
| 203 | led_classdev_unregister(&fsg_sync_led); | 201 | led_classdev_unregister(&fsg_sync_led); |
| 204 | failsync: | 202 | failsync: |
| @@ -210,14 +208,14 @@ static int fsg_led_probe(struct platform_device *pdev) | |||
| 210 | failwan: | 208 | failwan: |
| 211 | led_classdev_unregister(&fsg_wlan_led); | 209 | led_classdev_unregister(&fsg_wlan_led); |
| 212 | failwlan: | 210 | failwlan: |
| 211 | iounmap(latch_address); | ||
| 212 | failremap: | ||
| 213 | 213 | ||
| 214 | return ret; | 214 | return ret; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | static int fsg_led_remove(struct platform_device *pdev) | 217 | static int fsg_led_remove(struct platform_device *pdev) |
| 218 | { | 218 | { |
| 219 | iounmap(latch_address); | ||
| 220 | |||
| 221 | led_classdev_unregister(&fsg_wlan_led); | 219 | led_classdev_unregister(&fsg_wlan_led); |
| 222 | led_classdev_unregister(&fsg_wan_led); | 220 | led_classdev_unregister(&fsg_wan_led); |
| 223 | led_classdev_unregister(&fsg_sata_led); | 221 | led_classdev_unregister(&fsg_sata_led); |
| @@ -225,6 +223,8 @@ static int fsg_led_remove(struct platform_device *pdev) | |||
| 225 | led_classdev_unregister(&fsg_sync_led); | 223 | led_classdev_unregister(&fsg_sync_led); |
| 226 | led_classdev_unregister(&fsg_ring_led); | 224 | led_classdev_unregister(&fsg_ring_led); |
| 227 | 225 | ||
| 226 | iounmap(latch_address); | ||
| 227 | |||
| 228 | return 0; | 228 | return 0; |
| 229 | } | 229 | } |
| 230 | 230 | ||
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c index 146c06972863..f508729123b5 100644 --- a/drivers/leds/leds-pca955x.c +++ b/drivers/leds/leds-pca955x.c | |||
| @@ -248,11 +248,10 @@ static int __devinit pca955x_probe(struct i2c_client *client, | |||
| 248 | const struct i2c_device_id *id) | 248 | const struct i2c_device_id *id) |
| 249 | { | 249 | { |
| 250 | struct pca955x_led *pca955x; | 250 | struct pca955x_led *pca955x; |
| 251 | int i; | ||
| 252 | int err = -ENODEV; | ||
| 253 | struct pca955x_chipdef *chip; | 251 | struct pca955x_chipdef *chip; |
| 254 | struct i2c_adapter *adapter; | 252 | struct i2c_adapter *adapter; |
| 255 | struct led_platform_data *pdata; | 253 | struct led_platform_data *pdata; |
| 254 | int i, err; | ||
| 256 | 255 | ||
| 257 | chip = &pca955x_chipdefs[id->driver_data]; | 256 | chip = &pca955x_chipdefs[id->driver_data]; |
| 258 | adapter = to_i2c_adapter(client->dev.parent); | 257 | adapter = to_i2c_adapter(client->dev.parent); |
| @@ -282,43 +281,41 @@ static int __devinit pca955x_probe(struct i2c_client *client, | |||
| 282 | } | 281 | } |
| 283 | } | 282 | } |
| 284 | 283 | ||
| 284 | pca955x = kzalloc(sizeof(*pca955x) * chip->bits, GFP_KERNEL); | ||
| 285 | if (!pca955x) | ||
| 286 | return -ENOMEM; | ||
| 287 | |||
| 288 | i2c_set_clientdata(client, pca955x); | ||
| 289 | |||
| 285 | for (i = 0; i < chip->bits; i++) { | 290 | for (i = 0; i < chip->bits; i++) { |
| 286 | pca955x = kzalloc(sizeof(struct pca955x_led), GFP_KERNEL); | 291 | pca955x[i].chipdef = chip; |
| 287 | if (!pca955x) { | 292 | pca955x[i].client = client; |
| 288 | err = -ENOMEM; | 293 | pca955x[i].led_num = i; |
| 289 | goto exit; | ||
| 290 | } | ||
| 291 | 294 | ||
| 292 | pca955x->chipdef = chip; | ||
| 293 | pca955x->client = client; | ||
| 294 | pca955x->led_num = i; | ||
| 295 | /* Platform data can specify LED names and default triggers */ | 295 | /* Platform data can specify LED names and default triggers */ |
| 296 | if (pdata) { | 296 | if (pdata) { |
| 297 | if (pdata->leds[i].name) | 297 | if (pdata->leds[i].name) |
| 298 | snprintf(pca955x->name, 32, "pca955x:%s", | 298 | snprintf(pca955x[i].name, |
| 299 | pdata->leds[i].name); | 299 | sizeof(pca955x[i].name), "pca955x:%s", |
| 300 | pdata->leds[i].name); | ||
| 300 | if (pdata->leds[i].default_trigger) | 301 | if (pdata->leds[i].default_trigger) |
| 301 | pca955x->led_cdev.default_trigger = | 302 | pca955x[i].led_cdev.default_trigger = |
| 302 | pdata->leds[i].default_trigger; | 303 | pdata->leds[i].default_trigger; |
| 303 | } else { | 304 | } else { |
| 304 | snprintf(pca955x->name, 32, "pca955x:%d", i); | 305 | snprintf(pca955x[i].name, sizeof(pca955x[i].name), |
| 306 | "pca955x:%d", i); | ||
| 305 | } | 307 | } |
| 306 | spin_lock_init(&pca955x->lock); | ||
| 307 | 308 | ||
| 308 | pca955x->led_cdev.name = pca955x->name; | 309 | spin_lock_init(&pca955x[i].lock); |
| 309 | pca955x->led_cdev.brightness_set = | ||
| 310 | pca955x_led_set; | ||
| 311 | 310 | ||
| 312 | /* | 311 | pca955x[i].led_cdev.name = pca955x[i].name; |
| 313 | * Client data is a pointer to the _first_ pca955x_led | 312 | pca955x[i].led_cdev.brightness_set = pca955x_led_set; |
| 314 | * struct | ||
| 315 | */ | ||
| 316 | if (i == 0) | ||
| 317 | i2c_set_clientdata(client, pca955x); | ||
| 318 | 313 | ||
| 319 | INIT_WORK(&(pca955x->work), pca955x_led_work); | 314 | INIT_WORK(&pca955x[i].work, pca955x_led_work); |
| 320 | 315 | ||
| 321 | led_classdev_register(&client->dev, &(pca955x->led_cdev)); | 316 | err = led_classdev_register(&client->dev, &pca955x[i].led_cdev); |
| 317 | if (err < 0) | ||
| 318 | goto exit; | ||
| 322 | } | 319 | } |
| 323 | 320 | ||
| 324 | /* Turn off LEDs */ | 321 | /* Turn off LEDs */ |
| @@ -336,23 +333,32 @@ static int __devinit pca955x_probe(struct i2c_client *client, | |||
| 336 | pca955x_write_psc(client, 1, 0); | 333 | pca955x_write_psc(client, 1, 0); |
| 337 | 334 | ||
| 338 | return 0; | 335 | return 0; |
| 336 | |||
| 339 | exit: | 337 | exit: |
| 338 | while (i--) { | ||
| 339 | led_classdev_unregister(&pca955x[i].led_cdev); | ||
| 340 | cancel_work_sync(&pca955x[i].work); | ||
| 341 | } | ||
| 342 | |||
| 343 | kfree(pca955x); | ||
| 344 | i2c_set_clientdata(client, NULL); | ||
| 345 | |||
| 340 | return err; | 346 | return err; |
| 341 | } | 347 | } |
| 342 | 348 | ||
| 343 | static int __devexit pca955x_remove(struct i2c_client *client) | 349 | static int __devexit pca955x_remove(struct i2c_client *client) |
| 344 | { | 350 | { |
| 345 | struct pca955x_led *pca955x = i2c_get_clientdata(client); | 351 | struct pca955x_led *pca955x = i2c_get_clientdata(client); |
| 346 | int leds = pca955x->chipdef->bits; | ||
| 347 | int i; | 352 | int i; |
| 348 | 353 | ||
| 349 | for (i = 0; i < leds; i++) { | 354 | for (i = 0; i < pca955x->chipdef->bits; i++) { |
| 350 | led_classdev_unregister(&(pca955x->led_cdev)); | 355 | led_classdev_unregister(&pca955x[i].led_cdev); |
| 351 | cancel_work_sync(&(pca955x->work)); | 356 | cancel_work_sync(&pca955x[i].work); |
| 352 | kfree(pca955x); | ||
| 353 | pca955x = pca955x + 1; | ||
| 354 | } | 357 | } |
| 355 | 358 | ||
| 359 | kfree(pca955x); | ||
| 360 | i2c_set_clientdata(client, NULL); | ||
| 361 | |||
| 356 | return 0; | 362 | return 0; |
| 357 | } | 363 | } |
| 358 | 364 | ||
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 37344aaee22f..a661bbdae3d6 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
| @@ -98,6 +98,10 @@ static u32 lg_get_features(struct virtio_device *vdev) | |||
| 98 | return features; | 98 | return features; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | /* The virtio core takes the features the Host offers, and copies the | ||
| 102 | * ones supported by the driver into the vdev->features array. Once | ||
| 103 | * that's all sorted out, this routine is called so we can tell the | ||
| 104 | * Host which features we understand and accept. */ | ||
| 101 | static void lg_finalize_features(struct virtio_device *vdev) | 105 | static void lg_finalize_features(struct virtio_device *vdev) |
| 102 | { | 106 | { |
| 103 | unsigned int i, bits; | 107 | unsigned int i, bits; |
| @@ -108,6 +112,10 @@ static void lg_finalize_features(struct virtio_device *vdev) | |||
| 108 | /* Give virtio_ring a chance to accept features. */ | 112 | /* Give virtio_ring a chance to accept features. */ |
| 109 | vring_transport_features(vdev); | 113 | vring_transport_features(vdev); |
| 110 | 114 | ||
| 115 | /* The vdev->feature array is a Linux bitmask: this isn't the | ||
| 116 | * same as a the simple array of bits used by lguest devices | ||
| 117 | * for features. So we do this slow, manual conversion which is | ||
| 118 | * completely general. */ | ||
| 111 | memset(out_features, 0, desc->feature_len); | 119 | memset(out_features, 0, desc->feature_len); |
| 112 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; | 120 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; |
| 113 | for (i = 0; i < bits; i++) { | 121 | for (i = 0; i < bits; i++) { |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 7e65bad522cb..ac89a5deaca2 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
| @@ -238,15 +238,47 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde | |||
| 238 | 238 | ||
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | static mdk_rdev_t *next_active_rdev(mdk_rdev_t *rdev, mddev_t *mddev) | ||
| 242 | { | ||
| 243 | /* Iterate the disks of an mddev, using rcu to protect access to the | ||
| 244 | * linked list, and raising the refcount of devices we return to ensure | ||
| 245 | * they don't disappear while in use. | ||
| 246 | * As devices are only added or removed when raid_disk is < 0 and | ||
| 247 | * nr_pending is 0 and In_sync is clear, the entries we return will | ||
| 248 | * still be in the same position on the list when we re-enter | ||
| 249 | * list_for_each_continue_rcu. | ||
| 250 | */ | ||
| 251 | struct list_head *pos; | ||
| 252 | rcu_read_lock(); | ||
| 253 | if (rdev == NULL) | ||
| 254 | /* start at the beginning */ | ||
| 255 | pos = &mddev->disks; | ||
| 256 | else { | ||
| 257 | /* release the previous rdev and start from there. */ | ||
| 258 | rdev_dec_pending(rdev, mddev); | ||
| 259 | pos = &rdev->same_set; | ||
| 260 | } | ||
| 261 | list_for_each_continue_rcu(pos, &mddev->disks) { | ||
| 262 | rdev = list_entry(pos, mdk_rdev_t, same_set); | ||
| 263 | if (rdev->raid_disk >= 0 && | ||
| 264 | test_bit(In_sync, &rdev->flags) && | ||
| 265 | !test_bit(Faulty, &rdev->flags)) { | ||
| 266 | /* this is a usable devices */ | ||
| 267 | atomic_inc(&rdev->nr_pending); | ||
| 268 | rcu_read_unlock(); | ||
| 269 | return rdev; | ||
| 270 | } | ||
| 271 | } | ||
| 272 | rcu_read_unlock(); | ||
| 273 | return NULL; | ||
| 274 | } | ||
| 275 | |||
| 241 | static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) | 276 | static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) |
| 242 | { | 277 | { |
| 243 | mdk_rdev_t *rdev; | 278 | mdk_rdev_t *rdev = NULL; |
| 244 | mddev_t *mddev = bitmap->mddev; | 279 | mddev_t *mddev = bitmap->mddev; |
| 245 | 280 | ||
| 246 | rcu_read_lock(); | 281 | while ((rdev = next_active_rdev(rdev, mddev)) != NULL) { |
| 247 | rdev_for_each_rcu(rdev, mddev) | ||
| 248 | if (test_bit(In_sync, &rdev->flags) | ||
| 249 | && !test_bit(Faulty, &rdev->flags)) { | ||
| 250 | int size = PAGE_SIZE; | 282 | int size = PAGE_SIZE; |
| 251 | if (page->index == bitmap->file_pages-1) | 283 | if (page->index == bitmap->file_pages-1) |
| 252 | size = roundup(bitmap->last_page_size, | 284 | size = roundup(bitmap->last_page_size, |
| @@ -281,8 +313,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) | |||
| 281 | + page->index * (PAGE_SIZE/512), | 313 | + page->index * (PAGE_SIZE/512), |
| 282 | size, | 314 | size, |
| 283 | page); | 315 | page); |
| 284 | } | 316 | } |
| 285 | rcu_read_unlock(); | ||
| 286 | 317 | ||
| 287 | if (wait) | 318 | if (wait) |
| 288 | md_super_wait(mddev); | 319 | md_super_wait(mddev); |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 71dd65aa31b6..c2fcf28b4c70 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
| @@ -63,6 +63,7 @@ struct multipath { | |||
| 63 | 63 | ||
| 64 | const char *hw_handler_name; | 64 | const char *hw_handler_name; |
| 65 | struct work_struct activate_path; | 65 | struct work_struct activate_path; |
| 66 | struct pgpath *pgpath_to_activate; | ||
| 66 | unsigned nr_priority_groups; | 67 | unsigned nr_priority_groups; |
| 67 | struct list_head priority_groups; | 68 | struct list_head priority_groups; |
| 68 | unsigned pg_init_required; /* pg_init needs calling? */ | 69 | unsigned pg_init_required; /* pg_init needs calling? */ |
| @@ -146,6 +147,7 @@ static struct priority_group *alloc_priority_group(void) | |||
| 146 | 147 | ||
| 147 | static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti) | 148 | static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti) |
| 148 | { | 149 | { |
| 150 | unsigned long flags; | ||
| 149 | struct pgpath *pgpath, *tmp; | 151 | struct pgpath *pgpath, *tmp; |
| 150 | struct multipath *m = ti->private; | 152 | struct multipath *m = ti->private; |
| 151 | 153 | ||
| @@ -154,6 +156,10 @@ static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti) | |||
| 154 | if (m->hw_handler_name) | 156 | if (m->hw_handler_name) |
| 155 | scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev)); | 157 | scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev)); |
| 156 | dm_put_device(ti, pgpath->path.dev); | 158 | dm_put_device(ti, pgpath->path.dev); |
| 159 | spin_lock_irqsave(&m->lock, flags); | ||
| 160 | if (m->pgpath_to_activate == pgpath) | ||
| 161 | m->pgpath_to_activate = NULL; | ||
| 162 | spin_unlock_irqrestore(&m->lock, flags); | ||
| 157 | free_pgpath(pgpath); | 163 | free_pgpath(pgpath); |
| 158 | } | 164 | } |
| 159 | } | 165 | } |
| @@ -421,6 +427,7 @@ static void process_queued_ios(struct work_struct *work) | |||
| 421 | __choose_pgpath(m); | 427 | __choose_pgpath(m); |
| 422 | 428 | ||
| 423 | pgpath = m->current_pgpath; | 429 | pgpath = m->current_pgpath; |
| 430 | m->pgpath_to_activate = m->current_pgpath; | ||
| 424 | 431 | ||
| 425 | if ((pgpath && !m->queue_io) || | 432 | if ((pgpath && !m->queue_io) || |
| 426 | (!pgpath && !m->queue_if_no_path)) | 433 | (!pgpath && !m->queue_if_no_path)) |
| @@ -1093,8 +1100,15 @@ static void activate_path(struct work_struct *work) | |||
| 1093 | int ret; | 1100 | int ret; |
| 1094 | struct multipath *m = | 1101 | struct multipath *m = |
| 1095 | container_of(work, struct multipath, activate_path); | 1102 | container_of(work, struct multipath, activate_path); |
| 1096 | struct dm_path *path = &m->current_pgpath->path; | 1103 | struct dm_path *path; |
| 1104 | unsigned long flags; | ||
| 1097 | 1105 | ||
| 1106 | spin_lock_irqsave(&m->lock, flags); | ||
| 1107 | path = &m->pgpath_to_activate->path; | ||
| 1108 | m->pgpath_to_activate = NULL; | ||
| 1109 | spin_unlock_irqrestore(&m->lock, flags); | ||
| 1110 | if (!path) | ||
| 1111 | return; | ||
| 1098 | ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev)); | 1112 | ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev)); |
| 1099 | pg_init_done(path, ret); | 1113 | pg_init_done(path, ret); |
| 1100 | } | 1114 | } |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index bca448e11878..ace998ce59f6 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -837,12 +837,14 @@ static int dm_merge_bvec(struct request_queue *q, | |||
| 837 | struct dm_table *map = dm_get_table(md); | 837 | struct dm_table *map = dm_get_table(md); |
| 838 | struct dm_target *ti; | 838 | struct dm_target *ti; |
| 839 | sector_t max_sectors; | 839 | sector_t max_sectors; |
| 840 | int max_size; | 840 | int max_size = 0; |
| 841 | 841 | ||
| 842 | if (unlikely(!map)) | 842 | if (unlikely(!map)) |
| 843 | return 0; | 843 | goto out; |
| 844 | 844 | ||
| 845 | ti = dm_table_find_target(map, bvm->bi_sector); | 845 | ti = dm_table_find_target(map, bvm->bi_sector); |
| 846 | if (!dm_target_is_valid(ti)) | ||
| 847 | goto out_table; | ||
| 846 | 848 | ||
| 847 | /* | 849 | /* |
| 848 | * Find maximum amount of I/O that won't need splitting | 850 | * Find maximum amount of I/O that won't need splitting |
| @@ -861,14 +863,16 @@ static int dm_merge_bvec(struct request_queue *q, | |||
| 861 | if (max_size && ti->type->merge) | 863 | if (max_size && ti->type->merge) |
| 862 | max_size = ti->type->merge(ti, bvm, biovec, max_size); | 864 | max_size = ti->type->merge(ti, bvm, biovec, max_size); |
| 863 | 865 | ||
| 866 | out_table: | ||
| 867 | dm_table_put(map); | ||
| 868 | |||
| 869 | out: | ||
| 864 | /* | 870 | /* |
| 865 | * Always allow an entire first page | 871 | * Always allow an entire first page |
| 866 | */ | 872 | */ |
| 867 | if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT)) | 873 | if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT)) |
| 868 | max_size = biovec->bv_len; | 874 | max_size = biovec->bv_len; |
| 869 | 875 | ||
| 870 | dm_table_put(map); | ||
| 871 | |||
| 872 | return max_size; | 876 | return max_size; |
| 873 | } | 877 | } |
| 874 | 878 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index c7aae66c6f9b..deeac4b44173 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -2393,6 +2393,8 @@ static void analyze_sbs(mddev_t * mddev) | |||
| 2393 | 2393 | ||
| 2394 | } | 2394 | } |
| 2395 | 2395 | ||
| 2396 | static void md_safemode_timeout(unsigned long data); | ||
| 2397 | |||
| 2396 | static ssize_t | 2398 | static ssize_t |
| 2397 | safe_delay_show(mddev_t *mddev, char *page) | 2399 | safe_delay_show(mddev_t *mddev, char *page) |
| 2398 | { | 2400 | { |
| @@ -2432,9 +2434,12 @@ safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len) | |||
| 2432 | if (msec == 0) | 2434 | if (msec == 0) |
| 2433 | mddev->safemode_delay = 0; | 2435 | mddev->safemode_delay = 0; |
| 2434 | else { | 2436 | else { |
| 2437 | unsigned long old_delay = mddev->safemode_delay; | ||
| 2435 | mddev->safemode_delay = (msec*HZ)/1000; | 2438 | mddev->safemode_delay = (msec*HZ)/1000; |
| 2436 | if (mddev->safemode_delay == 0) | 2439 | if (mddev->safemode_delay == 0) |
| 2437 | mddev->safemode_delay = 1; | 2440 | mddev->safemode_delay = 1; |
| 2441 | if (mddev->safemode_delay < old_delay) | ||
| 2442 | md_safemode_timeout((unsigned long)mddev); | ||
| 2438 | } | 2443 | } |
| 2439 | return len; | 2444 | return len; |
| 2440 | } | 2445 | } |
| @@ -3836,8 +3841,6 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
| 3836 | 3841 | ||
| 3837 | del_timer_sync(&mddev->safemode_timer); | 3842 | del_timer_sync(&mddev->safemode_timer); |
| 3838 | 3843 | ||
| 3839 | invalidate_partition(disk, 0); | ||
| 3840 | |||
| 3841 | switch(mode) { | 3844 | switch(mode) { |
| 3842 | case 1: /* readonly */ | 3845 | case 1: /* readonly */ |
| 3843 | err = -ENXIO; | 3846 | err = -ENXIO; |
| @@ -4634,6 +4637,11 @@ static int update_size(mddev_t *mddev, sector_t num_sectors) | |||
| 4634 | */ | 4637 | */ |
| 4635 | if (mddev->sync_thread) | 4638 | if (mddev->sync_thread) |
| 4636 | return -EBUSY; | 4639 | return -EBUSY; |
| 4640 | if (mddev->bitmap) | ||
| 4641 | /* Sorry, cannot grow a bitmap yet, just remove it, | ||
| 4642 | * grow, and re-add. | ||
| 4643 | */ | ||
| 4644 | return -EBUSY; | ||
| 4637 | rdev_for_each(rdev, tmp, mddev) { | 4645 | rdev_for_each(rdev, tmp, mddev) { |
| 4638 | sector_t avail; | 4646 | sector_t avail; |
| 4639 | avail = rdev->size * 2; | 4647 | avail = rdev->size * 2; |
| @@ -5753,7 +5761,11 @@ void md_do_sync(mddev_t *mddev) | |||
| 5753 | * time 'round when curr_resync == 2 | 5761 | * time 'round when curr_resync == 2 |
| 5754 | */ | 5762 | */ |
| 5755 | continue; | 5763 | continue; |
| 5756 | prepare_to_wait(&resync_wait, &wq, TASK_UNINTERRUPTIBLE); | 5764 | /* We need to wait 'interruptible' so as not to |
| 5765 | * contribute to the load average, and not to | ||
| 5766 | * be caught by 'softlockup' | ||
| 5767 | */ | ||
| 5768 | prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE); | ||
| 5757 | if (!kthread_should_stop() && | 5769 | if (!kthread_should_stop() && |
| 5758 | mddev2->curr_resync >= mddev->curr_resync) { | 5770 | mddev2->curr_resync >= mddev->curr_resync) { |
| 5759 | printk(KERN_INFO "md: delaying %s of %s" | 5771 | printk(KERN_INFO "md: delaying %s of %s" |
| @@ -5761,6 +5773,8 @@ void md_do_sync(mddev_t *mddev) | |||
| 5761 | " share one or more physical units)\n", | 5773 | " share one or more physical units)\n", |
| 5762 | desc, mdname(mddev), mdname(mddev2)); | 5774 | desc, mdname(mddev), mdname(mddev2)); |
| 5763 | mddev_put(mddev2); | 5775 | mddev_put(mddev2); |
| 5776 | if (signal_pending(current)) | ||
| 5777 | flush_signals(current); | ||
| 5764 | schedule(); | 5778 | schedule(); |
| 5765 | finish_wait(&resync_wait, &wq); | 5779 | finish_wait(&resync_wait, &wq); |
| 5766 | goto try_again; | 5780 | goto try_again; |
| @@ -5993,7 +6007,7 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
| 5993 | } | 6007 | } |
| 5994 | } | 6008 | } |
| 5995 | 6009 | ||
| 5996 | if (mddev->degraded) { | 6010 | if (mddev->degraded && ! mddev->ro) { |
| 5997 | rdev_for_each(rdev, rtmp, mddev) { | 6011 | rdev_for_each(rdev, rtmp, mddev) { |
| 5998 | if (rdev->raid_disk >= 0 && | 6012 | if (rdev->raid_disk >= 0 && |
| 5999 | !test_bit(In_sync, &rdev->flags) && | 6013 | !test_bit(In_sync, &rdev->flags) && |
| @@ -6067,6 +6081,8 @@ void md_check_recovery(mddev_t *mddev) | |||
| 6067 | flush_signals(current); | 6081 | flush_signals(current); |
| 6068 | } | 6082 | } |
| 6069 | 6083 | ||
| 6084 | if (mddev->ro && !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) | ||
| 6085 | return; | ||
| 6070 | if ( ! ( | 6086 | if ( ! ( |
| 6071 | (mddev->flags && !mddev->external) || | 6087 | (mddev->flags && !mddev->external) || |
| 6072 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || | 6088 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || |
| @@ -6080,6 +6096,15 @@ void md_check_recovery(mddev_t *mddev) | |||
| 6080 | if (mddev_trylock(mddev)) { | 6096 | if (mddev_trylock(mddev)) { |
| 6081 | int spares = 0; | 6097 | int spares = 0; |
| 6082 | 6098 | ||
| 6099 | if (mddev->ro) { | ||
| 6100 | /* Only thing we do on a ro array is remove | ||
| 6101 | * failed devices. | ||
| 6102 | */ | ||
| 6103 | remove_and_add_spares(mddev); | ||
| 6104 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
| 6105 | goto unlock; | ||
| 6106 | } | ||
| 6107 | |||
| 6083 | if (!mddev->external) { | 6108 | if (!mddev->external) { |
| 6084 | int did_change = 0; | 6109 | int did_change = 0; |
| 6085 | spin_lock_irq(&mddev->write_lock); | 6110 | spin_lock_irq(&mddev->write_lock); |
| @@ -6117,7 +6142,8 @@ void md_check_recovery(mddev_t *mddev) | |||
| 6117 | /* resync has finished, collect result */ | 6142 | /* resync has finished, collect result */ |
| 6118 | md_unregister_thread(mddev->sync_thread); | 6143 | md_unregister_thread(mddev->sync_thread); |
| 6119 | mddev->sync_thread = NULL; | 6144 | mddev->sync_thread = NULL; |
| 6120 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | 6145 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) && |
| 6146 | !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { | ||
| 6121 | /* success...*/ | 6147 | /* success...*/ |
| 6122 | /* activate any spares */ | 6148 | /* activate any spares */ |
| 6123 | if (mddev->pers->spare_active(mddev)) | 6149 | if (mddev->pers->spare_active(mddev)) |
| @@ -6169,6 +6195,7 @@ void md_check_recovery(mddev_t *mddev) | |||
| 6169 | } else if ((spares = remove_and_add_spares(mddev))) { | 6195 | } else if ((spares = remove_and_add_spares(mddev))) { |
| 6170 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 6196 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
| 6171 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); | 6197 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); |
| 6198 | clear_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); | ||
| 6172 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); | 6199 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); |
| 6173 | } else if (mddev->recovery_cp < MaxSector) { | 6200 | } else if (mddev->recovery_cp < MaxSector) { |
| 6174 | set_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 6201 | set_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
| @@ -6232,7 +6259,11 @@ static int md_notify_reboot(struct notifier_block *this, | |||
| 6232 | 6259 | ||
| 6233 | for_each_mddev(mddev, tmp) | 6260 | for_each_mddev(mddev, tmp) |
| 6234 | if (mddev_trylock(mddev)) { | 6261 | if (mddev_trylock(mddev)) { |
| 6235 | do_md_stop (mddev, 1, 0); | 6262 | /* Force a switch to readonly even array |
| 6263 | * appears to still be in use. Hence | ||
| 6264 | * the '100'. | ||
| 6265 | */ | ||
| 6266 | do_md_stop (mddev, 1, 100); | ||
| 6236 | mddev_unlock(mddev); | 6267 | mddev_unlock(mddev); |
| 6237 | } | 6268 | } |
| 6238 | /* | 6269 | /* |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index d41bebb6da0f..e34cd0e62473 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
| @@ -76,11 +76,13 @@ static void r10bio_pool_free(void *r10_bio, void *data) | |||
| 76 | kfree(r10_bio); | 76 | kfree(r10_bio); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /* Maximum size of each resync request */ | ||
| 79 | #define RESYNC_BLOCK_SIZE (64*1024) | 80 | #define RESYNC_BLOCK_SIZE (64*1024) |
| 80 | //#define RESYNC_BLOCK_SIZE PAGE_SIZE | ||
| 81 | #define RESYNC_SECTORS (RESYNC_BLOCK_SIZE >> 9) | ||
| 82 | #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) | 81 | #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) |
| 83 | #define RESYNC_WINDOW (2048*1024) | 82 | /* amount of memory to reserve for resync requests */ |
| 83 | #define RESYNC_WINDOW (1024*1024) | ||
| 84 | /* maximum number of concurrent requests, memory permitting */ | ||
| 85 | #define RESYNC_DEPTH (32*1024*1024/RESYNC_BLOCK_SIZE) | ||
| 84 | 86 | ||
| 85 | /* | 87 | /* |
| 86 | * When performing a resync, we need to read and compare, so | 88 | * When performing a resync, we need to read and compare, so |
| @@ -690,7 +692,6 @@ static int flush_pending_writes(conf_t *conf) | |||
| 690 | * there is no normal IO happeing. It must arrange to call | 692 | * there is no normal IO happeing. It must arrange to call |
| 691 | * lower_barrier when the particular background IO completes. | 693 | * lower_barrier when the particular background IO completes. |
| 692 | */ | 694 | */ |
| 693 | #define RESYNC_DEPTH 32 | ||
| 694 | 695 | ||
| 695 | static void raise_barrier(conf_t *conf, int force) | 696 | static void raise_barrier(conf_t *conf, int force) |
| 696 | { | 697 | { |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 40e939675657..224de022e7c5 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -2568,10 +2568,10 @@ static bool handle_stripe5(struct stripe_head *sh) | |||
| 2568 | if (dev->written) | 2568 | if (dev->written) |
| 2569 | s.written++; | 2569 | s.written++; |
| 2570 | rdev = rcu_dereference(conf->disks[i].rdev); | 2570 | rdev = rcu_dereference(conf->disks[i].rdev); |
| 2571 | if (rdev && unlikely(test_bit(Blocked, &rdev->flags))) { | 2571 | if (blocked_rdev == NULL && |
| 2572 | rdev && unlikely(test_bit(Blocked, &rdev->flags))) { | ||
| 2572 | blocked_rdev = rdev; | 2573 | blocked_rdev = rdev; |
| 2573 | atomic_inc(&rdev->nr_pending); | 2574 | atomic_inc(&rdev->nr_pending); |
| 2574 | break; | ||
| 2575 | } | 2575 | } |
| 2576 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { | 2576 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { |
| 2577 | /* The ReadError flag will just be confusing now */ | 2577 | /* The ReadError flag will just be confusing now */ |
| @@ -2588,8 +2588,14 @@ static bool handle_stripe5(struct stripe_head *sh) | |||
| 2588 | rcu_read_unlock(); | 2588 | rcu_read_unlock(); |
| 2589 | 2589 | ||
| 2590 | if (unlikely(blocked_rdev)) { | 2590 | if (unlikely(blocked_rdev)) { |
| 2591 | set_bit(STRIPE_HANDLE, &sh->state); | 2591 | if (s.syncing || s.expanding || s.expanded || |
| 2592 | goto unlock; | 2592 | s.to_write || s.written) { |
| 2593 | set_bit(STRIPE_HANDLE, &sh->state); | ||
| 2594 | goto unlock; | ||
| 2595 | } | ||
| 2596 | /* There is nothing for the blocked_rdev to block */ | ||
| 2597 | rdev_dec_pending(blocked_rdev, conf->mddev); | ||
| 2598 | blocked_rdev = NULL; | ||
| 2593 | } | 2599 | } |
| 2594 | 2600 | ||
| 2595 | if (s.to_fill && !test_bit(STRIPE_BIOFILL_RUN, &sh->state)) { | 2601 | if (s.to_fill && !test_bit(STRIPE_BIOFILL_RUN, &sh->state)) { |
| @@ -2832,10 +2838,10 @@ static bool handle_stripe6(struct stripe_head *sh, struct page *tmp_page) | |||
| 2832 | if (dev->written) | 2838 | if (dev->written) |
| 2833 | s.written++; | 2839 | s.written++; |
| 2834 | rdev = rcu_dereference(conf->disks[i].rdev); | 2840 | rdev = rcu_dereference(conf->disks[i].rdev); |
| 2835 | if (rdev && unlikely(test_bit(Blocked, &rdev->flags))) { | 2841 | if (blocked_rdev == NULL && |
| 2842 | rdev && unlikely(test_bit(Blocked, &rdev->flags))) { | ||
| 2836 | blocked_rdev = rdev; | 2843 | blocked_rdev = rdev; |
| 2837 | atomic_inc(&rdev->nr_pending); | 2844 | atomic_inc(&rdev->nr_pending); |
| 2838 | break; | ||
| 2839 | } | 2845 | } |
| 2840 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { | 2846 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { |
| 2841 | /* The ReadError flag will just be confusing now */ | 2847 | /* The ReadError flag will just be confusing now */ |
| @@ -2853,9 +2859,16 @@ static bool handle_stripe6(struct stripe_head *sh, struct page *tmp_page) | |||
| 2853 | rcu_read_unlock(); | 2859 | rcu_read_unlock(); |
| 2854 | 2860 | ||
| 2855 | if (unlikely(blocked_rdev)) { | 2861 | if (unlikely(blocked_rdev)) { |
| 2856 | set_bit(STRIPE_HANDLE, &sh->state); | 2862 | if (s.syncing || s.expanding || s.expanded || |
| 2857 | goto unlock; | 2863 | s.to_write || s.written) { |
| 2864 | set_bit(STRIPE_HANDLE, &sh->state); | ||
| 2865 | goto unlock; | ||
| 2866 | } | ||
| 2867 | /* There is nothing for the blocked_rdev to block */ | ||
| 2868 | rdev_dec_pending(blocked_rdev, conf->mddev); | ||
| 2869 | blocked_rdev = NULL; | ||
| 2858 | } | 2870 | } |
| 2871 | |||
| 2859 | pr_debug("locked=%d uptodate=%d to_read=%d" | 2872 | pr_debug("locked=%d uptodate=%d to_read=%d" |
| 2860 | " to_write=%d failed=%d failed_num=%d,%d\n", | 2873 | " to_write=%d failed=%d failed_num=%d,%d\n", |
| 2861 | s.locked, s.uptodate, s.to_read, s.to_write, s.failed, | 2874 | s.locked, s.uptodate, s.to_read, s.to_write, s.failed, |
| @@ -4446,6 +4459,9 @@ static int raid5_check_reshape(mddev_t *mddev) | |||
| 4446 | return -EINVAL; /* Cannot shrink array or change level yet */ | 4459 | return -EINVAL; /* Cannot shrink array or change level yet */ |
| 4447 | if (mddev->delta_disks == 0) | 4460 | if (mddev->delta_disks == 0) |
| 4448 | return 0; /* nothing to do */ | 4461 | return 0; /* nothing to do */ |
| 4462 | if (mddev->bitmap) | ||
| 4463 | /* Cannot grow a bitmap yet */ | ||
| 4464 | return -EBUSY; | ||
| 4449 | 4465 | ||
| 4450 | /* Can only proceed if there are plenty of stripe_heads. | 4466 | /* Can only proceed if there are plenty of stripe_heads. |
| 4451 | * We need a minimum of one full stripe,, and for sensible progress | 4467 | * We need a minimum of one full stripe,, and for sensible progress |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index e8bc7abf2409..99be9e5c85f7 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
| @@ -1068,7 +1068,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int | |||
| 1068 | { | 1068 | { |
| 1069 | v4l2_std_id *id = arg; | 1069 | v4l2_std_id *id = arg; |
| 1070 | int found = 0; | 1070 | int found = 0; |
| 1071 | int i, err; | 1071 | int i; |
| 1072 | 1072 | ||
| 1073 | DEB_EE(("VIDIOC_S_STD\n")); | 1073 | DEB_EE(("VIDIOC_S_STD\n")); |
| 1074 | 1074 | ||
| @@ -1116,7 +1116,6 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int | |||
| 1116 | case VIDIOC_OVERLAY: | 1116 | case VIDIOC_OVERLAY: |
| 1117 | { | 1117 | { |
| 1118 | int on = *(int *)arg; | 1118 | int on = *(int *)arg; |
| 1119 | int err = 0; | ||
| 1120 | 1119 | ||
| 1121 | DEB_D(("VIDIOC_OVERLAY on:%d\n",on)); | 1120 | DEB_D(("VIDIOC_OVERLAY on:%d\n",on)); |
| 1122 | if (on != 0) { | 1121 | if (on != 0) { |
| @@ -1192,7 +1191,6 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int | |||
| 1192 | case VIDIOCGMBUF: | 1191 | case VIDIOCGMBUF: |
| 1193 | { | 1192 | { |
| 1194 | struct video_mbuf *mbuf = arg; | 1193 | struct video_mbuf *mbuf = arg; |
| 1195 | struct videobuf_queue *q; | ||
| 1196 | int i; | 1194 | int i; |
| 1197 | 1195 | ||
| 1198 | /* fixme: number of capture buffers and sizes for v4l apps */ | 1196 | /* fixme: number of capture buffers and sizes for v4l apps */ |
diff --git a/drivers/media/common/tuners/mt2131.c b/drivers/media/common/tuners/mt2131.c index e254bcfc2efb..e8d3c48f8605 100644 --- a/drivers/media/common/tuners/mt2131.c +++ b/drivers/media/common/tuners/mt2131.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for Microtune MT2131 "QAM/8VSB single chip tuner" | 2 | * Driver for Microtune MT2131 "QAM/8VSB single chip tuner" |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/common/tuners/mt2131.h b/drivers/media/common/tuners/mt2131.h index cd8376f6f7b4..6632de640df0 100644 --- a/drivers/media/common/tuners/mt2131.h +++ b/drivers/media/common/tuners/mt2131.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for Microtune MT2131 "QAM/8VSB single chip tuner" | 2 | * Driver for Microtune MT2131 "QAM/8VSB single chip tuner" |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/common/tuners/mt2131_priv.h b/drivers/media/common/tuners/mt2131_priv.h index e930759c2c00..4e05a67e88c1 100644 --- a/drivers/media/common/tuners/mt2131_priv.h +++ b/drivers/media/common/tuners/mt2131_priv.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for Microtune MT2131 "QAM/8VSB single chip tuner" | 2 | * Driver for Microtune MT2131 "QAM/8VSB single chip tuner" |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/common/tuners/mxl5005s.c b/drivers/media/common/tuners/mxl5005s.c index 0dc2bef9f6a3..227642b044ae 100644 --- a/drivers/media/common/tuners/mxl5005s.c +++ b/drivers/media/common/tuners/mxl5005s.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | MaxLinear MXL5005S VSB/QAM/DVBT tuner driver | 2 | MaxLinear MXL5005S VSB/QAM/DVBT tuner driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2008 MaxLinear | 4 | Copyright (C) 2008 MaxLinear |
| 5 | Copyright (C) 2006 Steven Toth <stoth@hauppauge.com> | 5 | Copyright (C) 2006 Steven Toth <stoth@linuxtv.org> |
| 6 | Functions: | 6 | Functions: |
| 7 | mxl5005s_reset() | 7 | mxl5005s_reset() |
| 8 | mxl5005s_writereg() | 8 | mxl5005s_writereg() |
| @@ -3837,7 +3837,7 @@ static u16 MXL_Hystersis_Test(struct dvb_frontend *fe, int Hystersis) | |||
| 3837 | /* ---------------------------------------------------------------- | 3837 | /* ---------------------------------------------------------------- |
| 3838 | * Begin: Everything after here is new code to adapt the | 3838 | * Begin: Everything after here is new code to adapt the |
| 3839 | * proprietary Realtek driver into a Linux API tuner. | 3839 | * proprietary Realtek driver into a Linux API tuner. |
| 3840 | * Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 3840 | * Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
| 3841 | */ | 3841 | */ |
| 3842 | static int mxl5005s_reset(struct dvb_frontend *fe) | 3842 | static int mxl5005s_reset(struct dvb_frontend *fe) |
| 3843 | { | 3843 | { |
diff --git a/drivers/media/common/tuners/mxl5005s.h b/drivers/media/common/tuners/mxl5005s.h index 396db150bf0c..7ac6815b30aa 100644 --- a/drivers/media/common/tuners/mxl5005s.h +++ b/drivers/media/common/tuners/mxl5005s.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | MaxLinear MXL5005S VSB/QAM/DVBT tuner driver | 2 | MaxLinear MXL5005S VSB/QAM/DVBT tuner driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2008 MaxLinear | 4 | Copyright (C) 2008 MaxLinear |
| 5 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 5 | Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
| 6 | 6 | ||
| 7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c index 597e47f5d69c..aa773a658a2a 100644 --- a/drivers/media/common/tuners/tuner-simple.c +++ b/drivers/media/common/tuners/tuner-simple.c | |||
| @@ -253,7 +253,7 @@ static struct tuner_params *simple_tuner_params(struct dvb_frontend *fe, | |||
| 253 | 253 | ||
| 254 | static int simple_config_lookup(struct dvb_frontend *fe, | 254 | static int simple_config_lookup(struct dvb_frontend *fe, |
| 255 | struct tuner_params *t_params, | 255 | struct tuner_params *t_params, |
| 256 | int *frequency, u8 *config, u8 *cb) | 256 | unsigned *frequency, u8 *config, u8 *cb) |
| 257 | { | 257 | { |
| 258 | struct tuner_simple_priv *priv = fe->tuner_priv; | 258 | struct tuner_simple_priv *priv = fe->tuner_priv; |
| 259 | int i; | 259 | int i; |
| @@ -587,45 +587,45 @@ static int simple_set_tv_freq(struct dvb_frontend *fe, | |||
| 587 | priv->last_div = div; | 587 | priv->last_div = div; |
| 588 | if (t_params->has_tda9887) { | 588 | if (t_params->has_tda9887) { |
| 589 | struct v4l2_priv_tun_config tda9887_cfg; | 589 | struct v4l2_priv_tun_config tda9887_cfg; |
| 590 | int config = 0; | 590 | int tda_config = 0; |
| 591 | int is_secam_l = (params->std & (V4L2_STD_SECAM_L | | 591 | int is_secam_l = (params->std & (V4L2_STD_SECAM_L | |
| 592 | V4L2_STD_SECAM_LC)) && | 592 | V4L2_STD_SECAM_LC)) && |
| 593 | !(params->std & ~(V4L2_STD_SECAM_L | | 593 | !(params->std & ~(V4L2_STD_SECAM_L | |
| 594 | V4L2_STD_SECAM_LC)); | 594 | V4L2_STD_SECAM_LC)); |
| 595 | 595 | ||
| 596 | tda9887_cfg.tuner = TUNER_TDA9887; | 596 | tda9887_cfg.tuner = TUNER_TDA9887; |
| 597 | tda9887_cfg.priv = &config; | 597 | tda9887_cfg.priv = &tda_config; |
| 598 | 598 | ||
| 599 | if (params->std == V4L2_STD_SECAM_LC) { | 599 | if (params->std == V4L2_STD_SECAM_LC) { |
| 600 | if (t_params->port1_active ^ t_params->port1_invert_for_secam_lc) | 600 | if (t_params->port1_active ^ t_params->port1_invert_for_secam_lc) |
| 601 | config |= TDA9887_PORT1_ACTIVE; | 601 | tda_config |= TDA9887_PORT1_ACTIVE; |
| 602 | if (t_params->port2_active ^ t_params->port2_invert_for_secam_lc) | 602 | if (t_params->port2_active ^ t_params->port2_invert_for_secam_lc) |
| 603 | config |= TDA9887_PORT2_ACTIVE; | 603 | tda_config |= TDA9887_PORT2_ACTIVE; |
| 604 | } else { | 604 | } else { |
| 605 | if (t_params->port1_active) | 605 | if (t_params->port1_active) |
| 606 | config |= TDA9887_PORT1_ACTIVE; | 606 | tda_config |= TDA9887_PORT1_ACTIVE; |
| 607 | if (t_params->port2_active) | 607 | if (t_params->port2_active) |
| 608 | config |= TDA9887_PORT2_ACTIVE; | 608 | tda_config |= TDA9887_PORT2_ACTIVE; |
| 609 | } | 609 | } |
| 610 | if (t_params->intercarrier_mode) | 610 | if (t_params->intercarrier_mode) |
| 611 | config |= TDA9887_INTERCARRIER; | 611 | tda_config |= TDA9887_INTERCARRIER; |
| 612 | if (is_secam_l) { | 612 | if (is_secam_l) { |
| 613 | if (i == 0 && t_params->default_top_secam_low) | 613 | if (i == 0 && t_params->default_top_secam_low) |
| 614 | config |= TDA9887_TOP(t_params->default_top_secam_low); | 614 | tda_config |= TDA9887_TOP(t_params->default_top_secam_low); |
| 615 | else if (i == 1 && t_params->default_top_secam_mid) | 615 | else if (i == 1 && t_params->default_top_secam_mid) |
| 616 | config |= TDA9887_TOP(t_params->default_top_secam_mid); | 616 | tda_config |= TDA9887_TOP(t_params->default_top_secam_mid); |
| 617 | else if (t_params->default_top_secam_high) | 617 | else if (t_params->default_top_secam_high) |
| 618 | config |= TDA9887_TOP(t_params->default_top_secam_high); | 618 | tda_config |= TDA9887_TOP(t_params->default_top_secam_high); |
| 619 | } else { | 619 | } else { |
| 620 | if (i == 0 && t_params->default_top_low) | 620 | if (i == 0 && t_params->default_top_low) |
| 621 | config |= TDA9887_TOP(t_params->default_top_low); | 621 | tda_config |= TDA9887_TOP(t_params->default_top_low); |
| 622 | else if (i == 1 && t_params->default_top_mid) | 622 | else if (i == 1 && t_params->default_top_mid) |
| 623 | config |= TDA9887_TOP(t_params->default_top_mid); | 623 | tda_config |= TDA9887_TOP(t_params->default_top_mid); |
| 624 | else if (t_params->default_top_high) | 624 | else if (t_params->default_top_high) |
| 625 | config |= TDA9887_TOP(t_params->default_top_high); | 625 | tda_config |= TDA9887_TOP(t_params->default_top_high); |
| 626 | } | 626 | } |
| 627 | if (t_params->default_pll_gating_18) | 627 | if (t_params->default_pll_gating_18) |
| 628 | config |= TDA9887_GATING_18; | 628 | tda_config |= TDA9887_GATING_18; |
| 629 | i2c_clients_command(priv->i2c_props.adap, TUNER_SET_CONFIG, | 629 | i2c_clients_command(priv->i2c_props.adap, TUNER_SET_CONFIG, |
| 630 | &tda9887_cfg); | 630 | &tda9887_cfg); |
| 631 | } | 631 | } |
| @@ -813,7 +813,8 @@ static u32 simple_dvb_configure(struct dvb_frontend *fe, u8 *buf, | |||
| 813 | static struct tuner_params *t_params; | 813 | static struct tuner_params *t_params; |
| 814 | u8 config, cb; | 814 | u8 config, cb; |
| 815 | u32 div; | 815 | u32 div; |
| 816 | int ret, frequency = params->frequency / 62500; | 816 | int ret; |
| 817 | unsigned frequency = params->frequency / 62500; | ||
| 817 | 818 | ||
| 818 | t_params = simple_tuner_params(fe, TUNER_PARAM_TYPE_DIGITAL); | 819 | t_params = simple_tuner_params(fe, TUNER_PARAM_TYPE_DIGITAL); |
| 819 | ret = simple_config_lookup(fe, t_params, &frequency, &config, &cb); | 820 | ret = simple_config_lookup(fe, t_params, &frequency, &config, &cb); |
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 5f99de0ad612..dcddfa803a75 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver for Xceive XC5000 "QAM/8VSB single chip tuner" | 2 | * Driver for Xceive XC5000 "QAM/8VSB single chip tuner" |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2007 Xceive Corporation | 4 | * Copyright (c) 2007 Xceive Corporation |
| 5 | * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com> | 5 | * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org> |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h index c910715addc9..5389f740945a 100644 --- a/drivers/media/common/tuners/xc5000.h +++ b/drivers/media/common/tuners/xc5000.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for Xceive XC5000 "QAM/8VSB single chip tuner" | 2 | * Driver for Xceive XC5000 "QAM/8VSB single chip tuner" |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/common/tuners/xc5000_priv.h b/drivers/media/common/tuners/xc5000_priv.h index a72a9887fe7f..b2a0074c99c9 100644 --- a/drivers/media/common/tuners/xc5000_priv.h +++ b/drivers/media/common/tuners/xc5000_priv.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for Xceive XC5000 "QAM/8VSB single chip tuner" | 2 | * Driver for Xceive XC5000 "QAM/8VSB single chip tuner" |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index f9d087669d5d..4eed783f4bce 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
| @@ -137,7 +137,8 @@ static int flexcop_send_diseqc_msg(struct dvb_frontend* fe, int len, u8 *msg, un | |||
| 137 | flexcop_diseqc_send_byte(fe, 0xff); | 137 | flexcop_diseqc_send_byte(fe, 0xff); |
| 138 | else { | 138 | else { |
| 139 | flexcop_set_tone(fe, SEC_TONE_ON); | 139 | flexcop_set_tone(fe, SEC_TONE_ON); |
| 140 | udelay(12500); | 140 | mdelay(12); |
| 141 | udelay(500); | ||
| 141 | flexcop_set_tone(fe, SEC_TONE_OFF); | 142 | flexcop_set_tone(fe, SEC_TONE_OFF); |
| 142 | } | 143 | } |
| 143 | msleep(20); | 144 | msleep(20); |
diff --git a/drivers/media/dvb/b2c2/flexcop-i2c.c b/drivers/media/dvb/b2c2/flexcop-i2c.c index 55973eaf3711..43a112ec6d44 100644 --- a/drivers/media/dvb/b2c2/flexcop-i2c.c +++ b/drivers/media/dvb/b2c2/flexcop-i2c.c | |||
| @@ -221,12 +221,12 @@ int flexcop_i2c_init(struct flexcop_device *fc) | |||
| 221 | fc->fc_i2c_adap[1].port = FC_I2C_PORT_EEPROM; | 221 | fc->fc_i2c_adap[1].port = FC_I2C_PORT_EEPROM; |
| 222 | fc->fc_i2c_adap[2].port = FC_I2C_PORT_TUNER; | 222 | fc->fc_i2c_adap[2].port = FC_I2C_PORT_TUNER; |
| 223 | 223 | ||
| 224 | strncpy(fc->fc_i2c_adap[0].i2c_adap.name, | 224 | strlcpy(fc->fc_i2c_adap[0].i2c_adap.name, "B2C2 FlexCop I2C to demod", |
| 225 | "B2C2 FlexCop I2C to demod", I2C_NAME_SIZE); | 225 | sizeof(fc->fc_i2c_adap[0].i2c_adap.name)); |
| 226 | strncpy(fc->fc_i2c_adap[1].i2c_adap.name, | 226 | strlcpy(fc->fc_i2c_adap[1].i2c_adap.name, "B2C2 FlexCop I2C to eeprom", |
| 227 | "B2C2 FlexCop I2C to eeprom", I2C_NAME_SIZE); | 227 | sizeof(fc->fc_i2c_adap[1].i2c_adap.name)); |
| 228 | strncpy(fc->fc_i2c_adap[2].i2c_adap.name, | 228 | strlcpy(fc->fc_i2c_adap[2].i2c_adap.name, "B2C2 FlexCop I2C to tuner", |
| 229 | "B2C2 FlexCop I2C to tuner", I2C_NAME_SIZE); | 229 | sizeof(fc->fc_i2c_adap[2].i2c_adap.name)); |
| 230 | 230 | ||
| 231 | i2c_set_adapdata(&fc->fc_i2c_adap[0].i2c_adap, &fc->fc_i2c_adap[0]); | 231 | i2c_set_adapdata(&fc->fc_i2c_adap[0].i2c_adap, &fc->fc_i2c_adap[0]); |
| 232 | i2c_set_adapdata(&fc->fc_i2c_adap[1].i2c_adap, &fc->fc_i2c_adap[1]); | 232 | i2c_set_adapdata(&fc->fc_i2c_adap[1].i2c_adap, &fc->fc_i2c_adap[1]); |
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index a7637562e742..aa3db57d32d9 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c | |||
| @@ -1244,7 +1244,7 @@ static int dst_command(struct dst_state *state, u8 *data, u8 len) | |||
| 1244 | goto error; | 1244 | goto error; |
| 1245 | } | 1245 | } |
| 1246 | if (state->type_flags & DST_TYPE_HAS_FW_1) | 1246 | if (state->type_flags & DST_TYPE_HAS_FW_1) |
| 1247 | udelay(3000); | 1247 | mdelay(3); |
| 1248 | if (read_dst(state, &reply, GET_ACK)) { | 1248 | if (read_dst(state, &reply, GET_ACK)) { |
| 1249 | dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. "); | 1249 | dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. "); |
| 1250 | if ((dst_error_recovery(state)) < 0) { | 1250 | if ((dst_error_recovery(state)) < 0) { |
| @@ -1260,7 +1260,7 @@ static int dst_command(struct dst_state *state, u8 *data, u8 len) | |||
| 1260 | if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3)) | 1260 | if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3)) |
| 1261 | goto error; | 1261 | goto error; |
| 1262 | if (state->type_flags & DST_TYPE_HAS_FW_1) | 1262 | if (state->type_flags & DST_TYPE_HAS_FW_1) |
| 1263 | udelay(3000); | 1263 | mdelay(3); |
| 1264 | else | 1264 | else |
| 1265 | udelay(2000); | 1265 | udelay(2000); |
| 1266 | if (!dst_wait_dst_ready(state, NO_DELAY)) | 1266 | if (!dst_wait_dst_ready(state, NO_DELAY)) |
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index 1cf9fcb6f514..069d847ba887 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
| @@ -641,7 +641,6 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) | |||
| 641 | struct timespec timeout = { 0 }; | 641 | struct timespec timeout = { 0 }; |
| 642 | struct dmx_pes_filter_params *para = &filter->params.pes; | 642 | struct dmx_pes_filter_params *para = &filter->params.pes; |
| 643 | dmx_output_t otype; | 643 | dmx_output_t otype; |
| 644 | int ret; | ||
| 645 | int ts_type; | 644 | int ts_type; |
| 646 | enum dmx_ts_pes ts_pes; | 645 | enum dmx_ts_pes ts_pes; |
| 647 | struct dmx_ts_feed **tsfeed = &filter->feed.ts; | 646 | struct dmx_ts_feed **tsfeed = &filter->feed.ts; |
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 8e5dd7b1f034..98ee16773ff2 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | |||
| @@ -1032,7 +1032,7 @@ static int dvb_ca_en50221_thread(void *data) | |||
| 1032 | /* we need this extra check for annoying interfaces like the budget-av */ | 1032 | /* we need this extra check for annoying interfaces like the budget-av */ |
| 1033 | if ((!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) && | 1033 | if ((!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) && |
| 1034 | (ca->pub->poll_slot_status)) { | 1034 | (ca->pub->poll_slot_status)) { |
| 1035 | int status = ca->pub->poll_slot_status(ca->pub, slot, 0); | 1035 | status = ca->pub->poll_slot_status(ca->pub, slot, 0); |
| 1036 | if (!(status & DVB_CA_EN50221_POLL_CAM_PRESENT)) { | 1036 | if (!(status & DVB_CA_EN50221_POLL_CAM_PRESENT)) { |
| 1037 | ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; | 1037 | ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; |
| 1038 | dvb_ca_en50221_thread_update_delay(ca); | 1038 | dvb_ca_en50221_thread_update_delay(ca); |
| @@ -1089,7 +1089,7 @@ static int dvb_ca_en50221_thread(void *data) | |||
| 1089 | /* we need this extra check for annoying interfaces like the budget-av */ | 1089 | /* we need this extra check for annoying interfaces like the budget-av */ |
| 1090 | if ((!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) && | 1090 | if ((!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) && |
| 1091 | (ca->pub->poll_slot_status)) { | 1091 | (ca->pub->poll_slot_status)) { |
| 1092 | int status = ca->pub->poll_slot_status(ca->pub, slot, 0); | 1092 | status = ca->pub->poll_slot_status(ca->pub, slot, 0); |
| 1093 | if (!(status & DVB_CA_EN50221_POLL_CAM_PRESENT)) { | 1093 | if (!(status & DVB_CA_EN50221_POLL_CAM_PRESENT)) { |
| 1094 | ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; | 1094 | ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; |
| 1095 | dvb_ca_en50221_thread_update_delay(ca); | 1095 | dvb_ca_en50221_thread_update_delay(ca); |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 8cbdb218952f..3526e3ee9487 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
| @@ -889,13 +889,13 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
| 889 | * initialization, so parg is 8 bits and does not | 889 | * initialization, so parg is 8 bits and does not |
| 890 | * include the initialization or start bit | 890 | * include the initialization or start bit |
| 891 | */ | 891 | */ |
| 892 | unsigned long cmd = ((unsigned long) parg) << 1; | 892 | unsigned long swcmd = ((unsigned long) parg) << 1; |
| 893 | struct timeval nexttime; | 893 | struct timeval nexttime; |
| 894 | struct timeval tv[10]; | 894 | struct timeval tv[10]; |
| 895 | int i; | 895 | int i; |
| 896 | u8 last = 1; | 896 | u8 last = 1; |
| 897 | if (dvb_frontend_debug) | 897 | if (dvb_frontend_debug) |
| 898 | printk("%s switch command: 0x%04lx\n", __func__, cmd); | 898 | printk("%s switch command: 0x%04lx\n", __func__, swcmd); |
| 899 | do_gettimeofday(&nexttime); | 899 | do_gettimeofday(&nexttime); |
| 900 | if (dvb_frontend_debug) | 900 | if (dvb_frontend_debug) |
| 901 | memcpy(&tv[0], &nexttime, sizeof(struct timeval)); | 901 | memcpy(&tv[0], &nexttime, sizeof(struct timeval)); |
| @@ -908,12 +908,12 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
| 908 | for (i = 0; i < 9; i++) { | 908 | for (i = 0; i < 9; i++) { |
| 909 | if (dvb_frontend_debug) | 909 | if (dvb_frontend_debug) |
| 910 | do_gettimeofday(&tv[i + 1]); | 910 | do_gettimeofday(&tv[i + 1]); |
| 911 | if ((cmd & 0x01) != last) { | 911 | if ((swcmd & 0x01) != last) { |
| 912 | /* set voltage to (last ? 13V : 18V) */ | 912 | /* set voltage to (last ? 13V : 18V) */ |
| 913 | fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); | 913 | fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); |
| 914 | last = (last) ? 0 : 1; | 914 | last = (last) ? 0 : 1; |
| 915 | } | 915 | } |
| 916 | cmd = cmd >> 1; | 916 | swcmd = swcmd >> 1; |
| 917 | if (i != 8) | 917 | if (i != 8) |
| 918 | dvb_frontend_sleep_until(&nexttime, 8000); | 918 | dvb_frontend_sleep_until(&nexttime, 8000); |
| 919 | } | 919 | } |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index aaa0b6f0b521..563400277a42 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
| @@ -210,7 +210,7 @@ static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
| 210 | if (d->state == DVB_USB_STATE_INIT && | 210 | if (d->state == DVB_USB_STATE_INIT && |
| 211 | usb_set_interface(d->udev, 0, 0) < 0) | 211 | usb_set_interface(d->udev, 0, 0) < 0) |
| 212 | err("set interface failed"); | 212 | err("set interface failed"); |
| 213 | do; while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) && | 213 | do {} while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) && |
| 214 | !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) && | 214 | !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) && |
| 215 | !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0); | 215 | !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0); |
| 216 | if (!ret) { | 216 | if (!ret) { |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 3dd20bfbed32..6c0e5c5f4362 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
| @@ -1117,7 +1117,8 @@ struct usb_device_id dib0700_usb_id_table[] = { | |||
| 1117 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) }, | 1117 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) }, |
| 1118 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) }, | 1118 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) }, |
| 1119 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) }, | 1119 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) }, |
| 1120 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) }, | 1120 | /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) }, |
| 1121 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) }, | ||
| 1121 | { 0 } /* Terminating entry */ | 1122 | { 0 } /* Terminating entry */ |
| 1122 | }; | 1123 | }; |
| 1123 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); | 1124 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); |
| @@ -1373,7 +1374,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 1373 | } | 1374 | } |
| 1374 | }, | 1375 | }, |
| 1375 | 1376 | ||
| 1376 | .num_device_descs = 3, | 1377 | .num_device_descs = 4, |
| 1377 | .devices = { | 1378 | .devices = { |
| 1378 | { "DiBcom STK7070PD reference design", | 1379 | { "DiBcom STK7070PD reference design", |
| 1379 | { &dib0700_usb_id_table[17], NULL }, | 1380 | { &dib0700_usb_id_table[17], NULL }, |
| @@ -1386,6 +1387,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 1386 | { "Hauppauge Nova-TD Stick (52009)", | 1387 | { "Hauppauge Nova-TD Stick (52009)", |
| 1387 | { &dib0700_usb_id_table[35], NULL }, | 1388 | { &dib0700_usb_id_table[35], NULL }, |
| 1388 | { NULL }, | 1389 | { NULL }, |
| 1390 | }, | ||
| 1391 | { "Hauppauge Nova-TD-500 (84xxx)", | ||
| 1392 | { &dib0700_usb_id_table[36], NULL }, | ||
| 1393 | { NULL }, | ||
| 1389 | } | 1394 | } |
| 1390 | } | 1395 | } |
| 1391 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 1396 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 029b437caf9a..03dfb9f2fe30 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
| @@ -129,6 +129,7 @@ | |||
| 129 | #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 | 129 | #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 |
| 130 | #define USB_PID_HAUPPAUGE_NOVA_T_500 0x9941 | 130 | #define USB_PID_HAUPPAUGE_NOVA_T_500 0x9941 |
| 131 | #define USB_PID_HAUPPAUGE_NOVA_T_500_2 0x9950 | 131 | #define USB_PID_HAUPPAUGE_NOVA_T_500_2 0x9950 |
| 132 | #define USB_PID_HAUPPAUGE_NOVA_T_500_3 0x8400 | ||
| 132 | #define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x7050 | 133 | #define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x7050 |
| 133 | #define USB_PID_HAUPPAUGE_NOVA_T_STICK_2 0x7060 | 134 | #define USB_PID_HAUPPAUGE_NOVA_T_STICK_2 0x7060 |
| 134 | #define USB_PID_HAUPPAUGE_NOVA_T_STICK_3 0x7070 | 135 | #define USB_PID_HAUPPAUGE_NOVA_T_STICK_3 0x7070 |
diff --git a/drivers/media/dvb/frontends/au8522.c b/drivers/media/dvb/frontends/au8522.c index f7b71657f0f6..0b82cc2a1e16 100644 --- a/drivers/media/dvb/frontends/au8522.c +++ b/drivers/media/dvb/frontends/au8522.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Auvitek AU8522 QAM/8VSB demodulator driver | 2 | Auvitek AU8522 QAM/8VSB demodulator driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| @@ -304,6 +304,43 @@ static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse, | |||
| 304 | return ret; | 304 | return ret; |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | static int au8522_set_if(struct dvb_frontend *fe, enum au8522_if_freq if_freq) | ||
| 308 | { | ||
| 309 | struct au8522_state *state = fe->demodulator_priv; | ||
| 310 | u8 r0b5, r0b6, r0b7; | ||
| 311 | char *ifmhz; | ||
| 312 | |||
| 313 | switch (if_freq) { | ||
| 314 | case AU8522_IF_3_25MHZ: | ||
| 315 | ifmhz = "3.25"; | ||
| 316 | r0b5 = 0x00; | ||
| 317 | r0b6 = 0x3d; | ||
| 318 | r0b7 = 0xa0; | ||
| 319 | break; | ||
| 320 | case AU8522_IF_4MHZ: | ||
| 321 | ifmhz = "4.00"; | ||
| 322 | r0b5 = 0x00; | ||
| 323 | r0b6 = 0x4b; | ||
| 324 | r0b7 = 0xd9; | ||
| 325 | break; | ||
| 326 | case AU8522_IF_6MHZ: | ||
| 327 | ifmhz = "6.00"; | ||
| 328 | r0b5 = 0xfb; | ||
| 329 | r0b6 = 0x8e; | ||
| 330 | r0b7 = 0x39; | ||
| 331 | break; | ||
| 332 | default: | ||
| 333 | dprintk("%s() IF Frequency not supported\n", __func__); | ||
| 334 | return -EINVAL; | ||
| 335 | } | ||
| 336 | dprintk("%s() %s MHz\n", __func__, ifmhz); | ||
| 337 | au8522_writereg(state, 0x80b5, r0b5); | ||
| 338 | au8522_writereg(state, 0x80b6, r0b6); | ||
| 339 | au8522_writereg(state, 0x80b7, r0b7); | ||
| 340 | |||
| 341 | return 0; | ||
| 342 | } | ||
| 343 | |||
| 307 | /* VSB Modulation table */ | 344 | /* VSB Modulation table */ |
| 308 | static struct { | 345 | static struct { |
| 309 | u16 reg; | 346 | u16 reg; |
| @@ -334,9 +371,6 @@ static struct { | |||
| 334 | { 0x80af, 0x66 }, | 371 | { 0x80af, 0x66 }, |
| 335 | { 0x821b, 0xcc }, | 372 | { 0x821b, 0xcc }, |
| 336 | { 0x821d, 0x80 }, | 373 | { 0x821d, 0x80 }, |
| 337 | { 0x80b5, 0xfb }, | ||
| 338 | { 0x80b6, 0x8e }, | ||
| 339 | { 0x80b7, 0x39 }, | ||
| 340 | { 0x80a4, 0xe8 }, | 374 | { 0x80a4, 0xe8 }, |
| 341 | { 0x8231, 0x13 }, | 375 | { 0x8231, 0x13 }, |
| 342 | }; | 376 | }; |
| @@ -350,9 +384,6 @@ static struct { | |||
| 350 | { 0x80a4, 0x00 }, | 384 | { 0x80a4, 0x00 }, |
| 351 | { 0x8081, 0xc4 }, | 385 | { 0x8081, 0xc4 }, |
| 352 | { 0x80a5, 0x40 }, | 386 | { 0x80a5, 0x40 }, |
| 353 | { 0x80b5, 0xfb }, | ||
| 354 | { 0x80b6, 0x8e }, | ||
| 355 | { 0x80b7, 0x39 }, | ||
| 356 | { 0x80aa, 0x77 }, | 387 | { 0x80aa, 0x77 }, |
| 357 | { 0x80ad, 0x77 }, | 388 | { 0x80ad, 0x77 }, |
| 358 | { 0x80a6, 0x67 }, | 389 | { 0x80a6, 0x67 }, |
| @@ -438,6 +469,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe, | |||
| 438 | au8522_writereg(state, | 469 | au8522_writereg(state, |
| 439 | VSB_mod_tab[i].reg, | 470 | VSB_mod_tab[i].reg, |
| 440 | VSB_mod_tab[i].data); | 471 | VSB_mod_tab[i].data); |
| 472 | au8522_set_if(fe, state->config->vsb_if); | ||
| 441 | break; | 473 | break; |
| 442 | case QAM_64: | 474 | case QAM_64: |
| 443 | case QAM_256: | 475 | case QAM_256: |
| @@ -446,6 +478,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe, | |||
| 446 | au8522_writereg(state, | 478 | au8522_writereg(state, |
| 447 | QAM_mod_tab[i].reg, | 479 | QAM_mod_tab[i].reg, |
| 448 | QAM_mod_tab[i].data); | 480 | QAM_mod_tab[i].data); |
| 481 | au8522_set_if(fe, state->config->qam_if); | ||
| 449 | break; | 482 | break; |
| 450 | default: | 483 | default: |
| 451 | dprintk("%s() Invalid modulation\n", __func__); | 484 | dprintk("%s() Invalid modulation\n", __func__); |
diff --git a/drivers/media/dvb/frontends/au8522.h b/drivers/media/dvb/frontends/au8522.h index d7affa3cdb27..595915ade8c3 100644 --- a/drivers/media/dvb/frontends/au8522.h +++ b/drivers/media/dvb/frontends/au8522.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Auvitek AU8522 QAM/8VSB demodulator driver | 2 | Auvitek AU8522 QAM/8VSB demodulator driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| @@ -24,6 +24,12 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/dvb/frontend.h> | 25 | #include <linux/dvb/frontend.h> |
| 26 | 26 | ||
| 27 | enum au8522_if_freq { | ||
| 28 | AU8522_IF_6MHZ = 0, | ||
| 29 | AU8522_IF_4MHZ, | ||
| 30 | AU8522_IF_3_25MHZ, | ||
| 31 | }; | ||
| 32 | |||
| 27 | struct au8522_config { | 33 | struct au8522_config { |
| 28 | /* the demodulator's i2c address */ | 34 | /* the demodulator's i2c address */ |
| 29 | u8 demod_address; | 35 | u8 demod_address; |
| @@ -32,6 +38,9 @@ struct au8522_config { | |||
| 32 | #define AU8522_TUNERLOCKING 0 | 38 | #define AU8522_TUNERLOCKING 0 |
| 33 | #define AU8522_DEMODLOCKING 1 | 39 | #define AU8522_DEMODLOCKING 1 |
| 34 | u8 status_mode; | 40 | u8 status_mode; |
| 41 | |||
| 42 | enum au8522_if_freq vsb_if; | ||
| 43 | enum au8522_if_freq qam_if; | ||
| 35 | }; | 44 | }; |
| 36 | 45 | ||
| 37 | #if defined(CONFIG_DVB_AU8522) || \ | 46 | #if defined(CONFIG_DVB_AU8522) || \ |
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c index cc1db4e371c3..9430e03dba6c 100644 --- a/drivers/media/dvb/frontends/cx22702.c +++ b/drivers/media/dvb/frontends/cx22702.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | Copyright (C) 2001-2002 Convergence Integrated Media GmbH | 7 | Copyright (C) 2001-2002 Convergence Integrated Media GmbH |
| 8 | Holger Waechtler <holger@convergence.de> | 8 | Holger Waechtler <holger@convergence.de> |
| 9 | 9 | ||
| 10 | Copyright (C) 2004 Steven Toth <stoth@hauppauge.com> | 10 | Copyright (C) 2004 Steven Toth <stoth@linuxtv.org> |
| 11 | 11 | ||
| 12 | This program is free software; you can redistribute it and/or modify | 12 | This program is free software; you can redistribute it and/or modify |
| 13 | it under the terms of the GNU General Public License as published by | 13 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/dvb/frontends/cx22702.h b/drivers/media/dvb/frontends/cx22702.h index 8af766a31552..b1e465c6c2ce 100644 --- a/drivers/media/dvb/frontends/cx22702.h +++ b/drivers/media/dvb/frontends/cx22702.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | Copyright (C) 2001-2002 Convergence Integrated Media GmbH | 7 | Copyright (C) 2001-2002 Convergence Integrated Media GmbH |
| 8 | Holger Waechtler <holger@convergence.de> | 8 | Holger Waechtler <holger@convergence.de> |
| 9 | 9 | ||
| 10 | Copyright (C) 2004 Steven Toth <stoth@hauppauge.com> | 10 | Copyright (C) 2004 Steven Toth <stoth@linuxtv.org> |
| 11 | 11 | ||
| 12 | This program is free software; you can redistribute it and/or modify | 12 | This program is free software; you can redistribute it and/or modify |
| 13 | it under the terms of the GNU General Public License as published by | 13 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c index 7f68d78c6558..7156157cb34b 100644 --- a/drivers/media/dvb/frontends/cx24123.c +++ b/drivers/media/dvb/frontends/cx24123.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Conexant cx24123/cx24109 - DVB QPSK Satellite demod/tuner driver | 2 | * Conexant cx24123/cx24109 - DVB QPSK Satellite demod/tuner driver |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2005 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (C) 2005 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * Support for KWorld DVB-S 100 by Vadim Catana <skystar@moldova.cc> | 6 | * Support for KWorld DVB-S 100 by Vadim Catana <skystar@moldova.cc> |
| 7 | * | 7 | * |
| @@ -1072,8 +1072,8 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, | |||
| 1072 | if (config->dont_use_pll) | 1072 | if (config->dont_use_pll) |
| 1073 | cx24123_repeater_mode(state, 1, 0); | 1073 | cx24123_repeater_mode(state, 1, 0); |
| 1074 | 1074 | ||
| 1075 | strncpy(state->tuner_i2c_adapter.name, | 1075 | strlcpy(state->tuner_i2c_adapter.name, "CX24123 tuner I2C bus", |
| 1076 | "CX24123 tuner I2C bus", I2C_NAME_SIZE); | 1076 | sizeof(state->tuner_i2c_adapter.name)); |
| 1077 | state->tuner_i2c_adapter.class = I2C_CLASS_TV_DIGITAL, | 1077 | state->tuner_i2c_adapter.class = I2C_CLASS_TV_DIGITAL, |
| 1078 | state->tuner_i2c_adapter.algo = &cx24123_tuner_i2c_algo; | 1078 | state->tuner_i2c_adapter.algo = &cx24123_tuner_i2c_algo; |
| 1079 | state->tuner_i2c_adapter.algo_data = NULL; | 1079 | state->tuner_i2c_adapter.algo_data = NULL; |
diff --git a/drivers/media/dvb/frontends/cx24123.h b/drivers/media/dvb/frontends/cx24123.h index 81ebc3d2f19f..cc6b411d6d20 100644 --- a/drivers/media/dvb/frontends/cx24123.h +++ b/drivers/media/dvb/frontends/cx24123.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Conexant cx24123/cx24109 - DVB QPSK Satellite demod/tuner driver | 2 | Conexant cx24123/cx24109 - DVB QPSK Satellite demod/tuner driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2005 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2005 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c index 5ddb2dca305c..7500a1c53e68 100644 --- a/drivers/media/dvb/frontends/s5h1409.c +++ b/drivers/media/dvb/frontends/s5h1409.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Samsung S5H1409 VSB/QAM demodulator driver | 2 | Samsung S5H1409 VSB/QAM demodulator driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2006 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| @@ -404,6 +404,7 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe, | |||
| 404 | break; | 404 | break; |
| 405 | case QAM_64: | 405 | case QAM_64: |
| 406 | case QAM_256: | 406 | case QAM_256: |
| 407 | case QAM_AUTO: | ||
| 407 | dprintk("%s() QAM_AUTO (64/256)\n", __func__); | 408 | dprintk("%s() QAM_AUTO (64/256)\n", __func__); |
| 408 | if (state->if_freq != S5H1409_QAM_IF_FREQ) | 409 | if (state->if_freq != S5H1409_QAM_IF_FREQ) |
| 409 | s5h1409_set_if_freq(fe, S5H1409_QAM_IF_FREQ); | 410 | s5h1409_set_if_freq(fe, S5H1409_QAM_IF_FREQ); |
diff --git a/drivers/media/dvb/frontends/s5h1409.h b/drivers/media/dvb/frontends/s5h1409.h index 59f4335964c6..d1a1d2eb8e11 100644 --- a/drivers/media/dvb/frontends/s5h1409.h +++ b/drivers/media/dvb/frontends/s5h1409.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Samsung S5H1409 VSB/QAM demodulator driver | 2 | Samsung S5H1409 VSB/QAM demodulator driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2006 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index cff360ce1ba3..2da1a3763de9 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Samsung S5H1411 VSB/QAM demodulator driver | 2 | Samsung S5H1411 VSB/QAM demodulator driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| @@ -488,6 +488,7 @@ static int s5h1411_enable_modulation(struct dvb_frontend *fe, | |||
| 488 | break; | 488 | break; |
| 489 | case QAM_64: | 489 | case QAM_64: |
| 490 | case QAM_256: | 490 | case QAM_256: |
| 491 | case QAM_AUTO: | ||
| 491 | dprintk("%s() QAM_AUTO (64/256)\n", __func__); | 492 | dprintk("%s() QAM_AUTO (64/256)\n", __func__); |
| 492 | s5h1411_set_if_freq(fe, state->config->qam_if); | 493 | s5h1411_set_if_freq(fe, state->config->qam_if); |
| 493 | s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x00, 0x0171); | 494 | s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x00, 0x0171); |
diff --git a/drivers/media/dvb/frontends/s5h1411.h b/drivers/media/dvb/frontends/s5h1411.h index 1855f64ed4d8..7d542bc00c48 100644 --- a/drivers/media/dvb/frontends/s5h1411.h +++ b/drivers/media/dvb/frontends/s5h1411.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Samsung S5H1411 VSB/QAM demodulator driver | 2 | Samsung S5H1411 VSB/QAM demodulator driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c index 720ed9ff7c5f..747d3fa2e5e5 100644 --- a/drivers/media/dvb/frontends/s5h1420.c +++ b/drivers/media/dvb/frontends/s5h1420.c | |||
| @@ -915,7 +915,8 @@ struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config, | |||
| 915 | state->frontend.demodulator_priv = state; | 915 | state->frontend.demodulator_priv = state; |
| 916 | 916 | ||
| 917 | /* create tuner i2c adapter */ | 917 | /* create tuner i2c adapter */ |
| 918 | strncpy(state->tuner_i2c_adapter.name, "S5H1420-PN1010 tuner I2C bus", I2C_NAME_SIZE); | 918 | strlcpy(state->tuner_i2c_adapter.name, "S5H1420-PN1010 tuner I2C bus", |
| 919 | sizeof(state->tuner_i2c_adapter.name)); | ||
| 919 | state->tuner_i2c_adapter.class = I2C_CLASS_TV_DIGITAL, | 920 | state->tuner_i2c_adapter.class = I2C_CLASS_TV_DIGITAL, |
| 920 | state->tuner_i2c_adapter.algo = &s5h1420_tuner_i2c_algo; | 921 | state->tuner_i2c_adapter.algo = &s5h1420_tuner_i2c_algo; |
| 921 | state->tuner_i2c_adapter.algo_data = NULL; | 922 | state->tuner_i2c_adapter.algo_data = NULL; |
diff --git a/drivers/media/dvb/frontends/tda10048.c b/drivers/media/dvb/frontends/tda10048.c index 0ab8d86b3ae3..04e7f1cc1403 100644 --- a/drivers/media/dvb/frontends/tda10048.c +++ b/drivers/media/dvb/frontends/tda10048.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | NXP TDA10048HN DVB OFDM demodulator driver | 2 | NXP TDA10048HN DVB OFDM demodulator driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| @@ -303,7 +303,7 @@ static int tda10048_firmware_upload(struct dvb_frontend *fe) | |||
| 303 | 303 | ||
| 304 | if (fw->size != TDA10048_DEFAULT_FIRMWARE_SIZE) { | 304 | if (fw->size != TDA10048_DEFAULT_FIRMWARE_SIZE) { |
| 305 | printk(KERN_ERR "%s: firmware incorrect size\n", __func__); | 305 | printk(KERN_ERR "%s: firmware incorrect size\n", __func__); |
| 306 | return -EIO; | 306 | ret = -EIO; |
| 307 | } else { | 307 | } else { |
| 308 | printk(KERN_INFO "%s: firmware uploading\n", __func__); | 308 | printk(KERN_INFO "%s: firmware uploading\n", __func__); |
| 309 | 309 | ||
diff --git a/drivers/media/dvb/frontends/tda10048.h b/drivers/media/dvb/frontends/tda10048.h index 2b5c78e62c86..0457b24601fa 100644 --- a/drivers/media/dvb/frontends/tda10048.h +++ b/drivers/media/dvb/frontends/tda10048.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | NXP TDA10048HN DVB OFDM demodulator driver | 2 | NXP TDA10048HN DVB OFDM demodulator driver |
| 3 | 3 | ||
| 4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index e7a8ac0c4049..cc5efb643f33 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Copyright (c) 2008 Michael Krufky <mkrufky@linuxtv.org> | 4 | * Copyright (c) 2008 Michael Krufky <mkrufky@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 3 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation; | 8 | * published by the Free Software Foundation; |
| 9 | * | 9 | * |
| 10 | * Software distributed under the License is distributed on an "AS IS" | 10 | * Software distributed under the License is distributed on an "AS IS" |
diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h index 83b39bc203fe..c8f3da6f9bc1 100644 --- a/drivers/media/dvb/siano/sms-cards.h +++ b/drivers/media/dvb/siano/sms-cards.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Copyright (c) 2008 Michael Krufky <mkrufky@linuxtv.org> | 4 | * Copyright (c) 2008 Michael Krufky <mkrufky@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 3 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation; | 8 | * published by the Free Software Foundation; |
| 9 | * | 9 | * |
| 10 | * Software distributed under the License is distributed on an "AS IS" | 10 | * Software distributed under the License is distributed on an "AS IS" |
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index c5f45fed69dc..6576fbb40fc6 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. | 8 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 3 as | 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation; | 12 | * published by the Free Software Foundation; |
| 13 | * | 13 | * |
| 14 | * Software distributed under the License is distributed on an "AS IS" | 14 | * Software distributed under the License is distributed on an "AS IS" |
diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index c1f8f1dccb11..8d973f726fb8 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. | 6 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 3 as | 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation; | 10 | * published by the Free Software Foundation; |
| 11 | * | 11 | * |
| 12 | * Software distributed under the License is distributed on an "AS IS" | 12 | * Software distributed under the License is distributed on an "AS IS" |
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 229274a14110..8d490e133f35 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. | 6 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 3 as | 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation; | 10 | * published by the Free Software Foundation; |
| 11 | * | 11 | * |
| 12 | * Software distributed under the License is distributed on an "AS IS" | 12 | * Software distributed under the License is distributed on an "AS IS" |
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index c10b1849c6a3..87a3c24454b9 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. | 6 | * Copyright (c), 2005-2008 Siano Mobile Silicon, Inc. |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 3 as | 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation; | 10 | * published by the Free Software Foundation; |
| 11 | * | 11 | * |
| 12 | * Software distributed under the License is distributed on an "AS IS" | 12 | * Software distributed under the License is distributed on an "AS IS" |
diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c index 39bd0a20f53a..aa5ed4ef19f2 100644 --- a/drivers/media/dvb/ttpci/budget-patch.c +++ b/drivers/media/dvb/ttpci/budget-patch.c | |||
| @@ -116,7 +116,8 @@ static int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, unsigned long | |||
| 116 | DiseqcSendByte(budget, 0xff); | 116 | DiseqcSendByte(budget, 0xff); |
| 117 | else { | 117 | else { |
| 118 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); | 118 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); |
| 119 | udelay(12500); | 119 | mdelay(12); |
| 120 | udelay(500); | ||
| 120 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); | 121 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); |
| 121 | } | 122 | } |
| 122 | msleep(20); | 123 | msleep(20); |
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 2293d80c6e51..f0068996ac07 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
| @@ -108,7 +108,8 @@ static int SendDiSEqCMsg (struct budget *budget, int len, u8 *msg, unsigned long | |||
| 108 | DiseqcSendByte(budget, 0xff); | 108 | DiseqcSendByte(budget, 0xff); |
| 109 | else { | 109 | else { |
| 110 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); | 110 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); |
| 111 | udelay(12500); | 111 | mdelay(12); |
| 112 | udelay(500); | ||
| 112 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); | 113 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); |
| 113 | } | 114 | } |
| 114 | msleep(20); | 115 | msleep(20); |
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile index a30159f6fa42..7ca71ab96b43 100644 --- a/drivers/media/radio/Makefile +++ b/drivers/media/radio/Makefile | |||
| @@ -2,8 +2,6 @@ | |||
| 2 | # Makefile for the kernel character device drivers. | 2 | # Makefile for the kernel character device drivers. |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | miropcm20-objs := miropcm20-rds-core.o miropcm20-radio.o | ||
| 6 | |||
| 7 | obj-$(CONFIG_RADIO_AZTECH) += radio-aztech.o | 5 | obj-$(CONFIG_RADIO_AZTECH) += radio-aztech.o |
| 8 | obj-$(CONFIG_RADIO_RTRACK2) += radio-rtrack2.o | 6 | obj-$(CONFIG_RADIO_RTRACK2) += radio-rtrack2.o |
| 9 | obj-$(CONFIG_RADIO_SF16FMI) += radio-sf16fmi.o | 7 | obj-$(CONFIG_RADIO_SF16FMI) += radio-sf16fmi.o |
| @@ -14,8 +12,6 @@ obj-$(CONFIG_RADIO_TERRATEC) += radio-terratec.o | |||
| 14 | obj-$(CONFIG_RADIO_MAXIRADIO) += radio-maxiradio.o | 12 | obj-$(CONFIG_RADIO_MAXIRADIO) += radio-maxiradio.o |
| 15 | obj-$(CONFIG_RADIO_RTRACK) += radio-aimslab.o | 13 | obj-$(CONFIG_RADIO_RTRACK) += radio-aimslab.o |
| 16 | obj-$(CONFIG_RADIO_ZOLTRIX) += radio-zoltrix.o | 14 | obj-$(CONFIG_RADIO_ZOLTRIX) += radio-zoltrix.o |
| 17 | obj-$(CONFIG_RADIO_MIROPCM20) += miropcm20.o | ||
| 18 | obj-$(CONFIG_RADIO_MIROPCM20_RDS) += miropcm20-rds.o | ||
| 19 | obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o | 15 | obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o |
| 20 | obj-$(CONFIG_RADIO_GEMTEK_PCI) += radio-gemtek-pci.o | 16 | obj-$(CONFIG_RADIO_GEMTEK_PCI) += radio-gemtek-pci.o |
| 21 | obj-$(CONFIG_RADIO_TRUST) += radio-trust.o | 17 | obj-$(CONFIG_RADIO_TRUST) += radio-trust.o |
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 1ed88f3abe61..70c65a745923 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c | |||
| @@ -493,7 +493,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, | |||
| 493 | radio->usbdev = interface_to_usbdev(intf); | 493 | radio->usbdev = interface_to_usbdev(intf); |
| 494 | radio->curfreq = FREQ_MIN*FREQ_MUL; | 494 | radio->curfreq = FREQ_MIN*FREQ_MUL; |
| 495 | video_set_drvdata(radio->videodev, radio); | 495 | video_set_drvdata(radio->videodev, radio); |
| 496 | if (video_register_device(radio->videodev, VFL_TYPE_RADIO,radio_nr)) { | 496 | if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 497 | warn("Could not register video device"); | 497 | warn("Could not register video device"); |
| 498 | video_device_release(radio->videodev); | 498 | video_device_release(radio->videodev); |
| 499 | kfree(radio->transfer_buffer); | 499 | kfree(radio->transfer_buffer); |
diff --git a/drivers/media/radio/miropcm20-radio.c b/drivers/media/radio/miropcm20-radio.c deleted file mode 100644 index 7fd7ee2d32c1..000000000000 --- a/drivers/media/radio/miropcm20-radio.c +++ /dev/null | |||
| @@ -1,266 +0,0 @@ | |||
| 1 | /* Miro PCM20 radio driver for Linux radio support | ||
| 2 | * (c) 1998 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl> | ||
| 3 | * Thanks to Norberto Pellici for the ACI device interface specification | ||
| 4 | * The API part is based on the radiotrack driver by M. Kirkwood | ||
| 5 | * This driver relies on the aci mixer (drivers/sound/aci.c) | ||
| 6 | * Look there for further info... | ||
| 7 | */ | ||
| 8 | |||
| 9 | /* Revision history: | ||
| 10 | * | ||
| 11 | * 1998 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl> | ||
| 12 | * 2000-09-05 Robert Siemer <Robert.Siemer@gmx.de> | ||
| 13 | * removed unfinished volume control (maybe adding it later again) | ||
| 14 | * use OSS-mixer; added stereo control | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* What ever you think about the ACI, version 0x07 is not very well! | ||
| 18 | * I can't get frequency, 'tuner status', 'tuner flags' or mute/mono | ||
| 19 | * conditions... Robert | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <linux/module.h> | ||
| 23 | #include <linux/init.h> | ||
| 24 | #include <linux/videodev.h> | ||
| 25 | #include <media/v4l2-common.h> | ||
| 26 | #include <media/v4l2-ioctl.h> | ||
| 27 | #include "oss/aci.h" | ||
| 28 | #include "miropcm20-rds-core.h" | ||
| 29 | |||
| 30 | static int radio_nr = -1; | ||
| 31 | module_param(radio_nr, int, 0); | ||
| 32 | |||
| 33 | struct pcm20_device { | ||
| 34 | unsigned long freq; | ||
| 35 | int muted; | ||
| 36 | int stereo; | ||
| 37 | }; | ||
| 38 | |||
| 39 | |||
| 40 | static int pcm20_mute(struct pcm20_device *dev, unsigned char mute) | ||
| 41 | { | ||
| 42 | dev->muted = mute; | ||
| 43 | return aci_write_cmd(ACI_SET_TUNERMUTE, mute); | ||
| 44 | } | ||
| 45 | |||
| 46 | static int pcm20_stereo(struct pcm20_device *dev, unsigned char stereo) | ||
| 47 | { | ||
| 48 | dev->stereo = stereo; | ||
| 49 | return aci_write_cmd(ACI_SET_TUNERMONO, !stereo); | ||
| 50 | } | ||
| 51 | |||
| 52 | static int pcm20_setfreq(struct pcm20_device *dev, unsigned long freq) | ||
| 53 | { | ||
| 54 | unsigned char freql; | ||
| 55 | unsigned char freqh; | ||
| 56 | |||
| 57 | dev->freq=freq; | ||
| 58 | |||
| 59 | freq /= 160; | ||
| 60 | if (!(aci_version==0x07 || aci_version>=0xb0)) | ||
| 61 | freq /= 10; /* I don't know exactly which version | ||
| 62 | * needs this hack */ | ||
| 63 | freql = freq & 0xff; | ||
| 64 | freqh = freq >> 8; | ||
| 65 | |||
| 66 | aci_rds_cmd(RDS_RESET, NULL, 0); | ||
| 67 | pcm20_stereo(dev, 1); | ||
| 68 | |||
| 69 | return aci_rw_cmd(ACI_WRITE_TUNE, freql, freqh); | ||
| 70 | } | ||
| 71 | |||
| 72 | static int pcm20_getflags(struct pcm20_device *dev, __u32 *flags, __u16 *signal) | ||
| 73 | { | ||
| 74 | /* okay, check for signal, stereo and rds here... */ | ||
| 75 | int i; | ||
| 76 | unsigned char buf; | ||
| 77 | |||
| 78 | if ((i=aci_rw_cmd(ACI_READ_TUNERSTATION, -1, -1))<0) | ||
| 79 | return i; | ||
| 80 | pr_debug("check_sig: 0x%x\n", i); | ||
| 81 | if (i & 0x80) { | ||
| 82 | /* no signal from tuner */ | ||
| 83 | *flags=0; | ||
| 84 | *signal=0; | ||
| 85 | return 0; | ||
| 86 | } else | ||
| 87 | *signal=0xffff; | ||
| 88 | |||
| 89 | if ((i=aci_rw_cmd(ACI_READ_TUNERSTEREO, -1, -1))<0) | ||
| 90 | return i; | ||
| 91 | if (i & 0x40) { | ||
| 92 | *flags=0; | ||
| 93 | } else { | ||
| 94 | /* stereo */ | ||
| 95 | *flags=VIDEO_TUNER_STEREO_ON; | ||
| 96 | /* I can't see stereo, when forced to mono */ | ||
| 97 | dev->stereo=1; | ||
| 98 | } | ||
| 99 | |||
| 100 | if ((i=aci_rds_cmd(RDS_STATUS, &buf, 1))<0) | ||
| 101 | return i; | ||
| 102 | if (buf & 1) | ||
| 103 | /* RDS available */ | ||
| 104 | *flags|=VIDEO_TUNER_RDS_ON; | ||
| 105 | else | ||
| 106 | return 0; | ||
| 107 | |||
| 108 | if ((i=aci_rds_cmd(RDS_RXVALUE, &buf, 1))<0) | ||
| 109 | return i; | ||
| 110 | pr_debug("rds-signal: %d\n", buf); | ||
| 111 | if (buf > 15) { | ||
| 112 | printk("miropcm20-radio: RX strengths unexpected high...\n"); | ||
| 113 | buf=15; | ||
| 114 | } | ||
| 115 | /* refine signal */ | ||
| 116 | if ((*signal=SCALE(15, 0xffff, buf))==0) | ||
| 117 | *signal = 1; | ||
| 118 | |||
| 119 | return 0; | ||
| 120 | } | ||
| 121 | |||
| 122 | static int pcm20_do_ioctl(struct inode *inode, struct file *file, | ||
| 123 | unsigned int cmd, void *arg) | ||
| 124 | { | ||
| 125 | struct video_device *dev = video_devdata(file); | ||
| 126 | struct pcm20_device *pcm20 = dev->priv; | ||
| 127 | int i; | ||
| 128 | |||
| 129 | switch(cmd) | ||
| 130 | { | ||
| 131 | case VIDIOCGCAP: | ||
| 132 | { | ||
| 133 | struct video_capability *v = arg; | ||
| 134 | memset(v,0,sizeof(*v)); | ||
| 135 | v->type=VID_TYPE_TUNER; | ||
| 136 | strcpy(v->name, "Miro PCM20"); | ||
| 137 | v->channels=1; | ||
| 138 | v->audios=1; | ||
| 139 | return 0; | ||
| 140 | } | ||
| 141 | case VIDIOCGTUNER: | ||
| 142 | { | ||
| 143 | struct video_tuner *v = arg; | ||
| 144 | if(v->tuner) /* Only 1 tuner */ | ||
| 145 | return -EINVAL; | ||
| 146 | v->rangelow=87*16000; | ||
| 147 | v->rangehigh=108*16000; | ||
| 148 | pcm20_getflags(pcm20, &v->flags, &v->signal); | ||
| 149 | v->flags|=VIDEO_TUNER_LOW; | ||
| 150 | v->mode=VIDEO_MODE_AUTO; | ||
| 151 | strcpy(v->name, "FM"); | ||
| 152 | return 0; | ||
| 153 | } | ||
| 154 | case VIDIOCSTUNER: | ||
| 155 | { | ||
| 156 | struct video_tuner *v = arg; | ||
| 157 | if(v->tuner!=0) | ||
| 158 | return -EINVAL; | ||
| 159 | /* Only 1 tuner so no setting needed ! */ | ||
| 160 | return 0; | ||
| 161 | } | ||
| 162 | case VIDIOCGFREQ: | ||
| 163 | { | ||
| 164 | unsigned long *freq = arg; | ||
| 165 | *freq = pcm20->freq; | ||
| 166 | return 0; | ||
| 167 | } | ||
| 168 | case VIDIOCSFREQ: | ||
| 169 | { | ||
| 170 | unsigned long *freq = arg; | ||
| 171 | pcm20->freq = *freq; | ||
| 172 | i=pcm20_setfreq(pcm20, pcm20->freq); | ||
| 173 | pr_debug("First view (setfreq): 0x%x\n", i); | ||
| 174 | return i; | ||
| 175 | } | ||
| 176 | case VIDIOCGAUDIO: | ||
| 177 | { | ||
| 178 | struct video_audio *v = arg; | ||
| 179 | memset(v,0, sizeof(*v)); | ||
| 180 | v->flags=VIDEO_AUDIO_MUTABLE; | ||
| 181 | if (pcm20->muted) | ||
| 182 | v->flags|=VIDEO_AUDIO_MUTE; | ||
| 183 | v->mode=VIDEO_SOUND_STEREO; | ||
| 184 | if (pcm20->stereo) | ||
| 185 | v->mode|=VIDEO_SOUND_MONO; | ||
| 186 | /* v->step=2048; */ | ||
| 187 | strcpy(v->name, "Radio"); | ||
| 188 | return 0; | ||
| 189 | } | ||
| 190 | case VIDIOCSAUDIO: | ||
| 191 | { | ||
| 192 | struct video_audio *v = arg; | ||
| 193 | if(v->audio) | ||
| 194 | return -EINVAL; | ||
| 195 | |||
| 196 | pcm20_mute(pcm20, !!(v->flags&VIDEO_AUDIO_MUTE)); | ||
| 197 | if(v->flags&VIDEO_SOUND_MONO) | ||
| 198 | pcm20_stereo(pcm20, 0); | ||
| 199 | if(v->flags&VIDEO_SOUND_STEREO) | ||
| 200 | pcm20_stereo(pcm20, 1); | ||
| 201 | |||
| 202 | return 0; | ||
| 203 | } | ||
| 204 | default: | ||
| 205 | return -ENOIOCTLCMD; | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 209 | static int pcm20_ioctl(struct inode *inode, struct file *file, | ||
| 210 | unsigned int cmd, unsigned long arg) | ||
| 211 | { | ||
| 212 | return video_usercopy(inode, file, cmd, arg, pcm20_do_ioctl); | ||
| 213 | } | ||
| 214 | |||
| 215 | static struct pcm20_device pcm20_unit = { | ||
| 216 | .freq = 87*16000, | ||
| 217 | .muted = 1, | ||
| 218 | }; | ||
| 219 | |||
| 220 | static const struct file_operations pcm20_fops = { | ||
| 221 | .owner = THIS_MODULE, | ||
| 222 | .open = video_exclusive_open, | ||
| 223 | .release = video_exclusive_release, | ||
| 224 | .ioctl = pcm20_ioctl, | ||
| 225 | #ifdef CONFIG_COMPAT | ||
| 226 | .compat_ioctl = v4l_compat_ioctl32, | ||
| 227 | #endif | ||
| 228 | .llseek = no_llseek, | ||
| 229 | }; | ||
| 230 | |||
| 231 | static struct video_device pcm20_radio = { | ||
| 232 | .name = "Miro PCM 20 radio", | ||
| 233 | .fops = &pcm20_fops, | ||
| 234 | .priv = &pcm20_unit | ||
| 235 | }; | ||
| 236 | |||
| 237 | static int __init pcm20_init(void) | ||
| 238 | { | ||
| 239 | if(video_register_device(&pcm20_radio, VFL_TYPE_RADIO, radio_nr)==-1) | ||
| 240 | goto video_register_device; | ||
| 241 | |||
| 242 | if(attach_aci_rds()<0) | ||
| 243 | goto attach_aci_rds; | ||
| 244 | |||
| 245 | printk(KERN_INFO "Miro PCM20 radio card driver.\n"); | ||
| 246 | |||
| 247 | return 0; | ||
| 248 | |||
| 249 | attach_aci_rds: | ||
| 250 | video_unregister_device(&pcm20_radio); | ||
| 251 | video_register_device: | ||
| 252 | return -EINVAL; | ||
| 253 | } | ||
| 254 | |||
| 255 | MODULE_AUTHOR("Ruurd Reitsma"); | ||
| 256 | MODULE_DESCRIPTION("A driver for the Miro PCM20 radio card."); | ||
| 257 | MODULE_LICENSE("GPL"); | ||
| 258 | |||
| 259 | static void __exit pcm20_cleanup(void) | ||
| 260 | { | ||
| 261 | unload_aci_rds(); | ||
| 262 | video_unregister_device(&pcm20_radio); | ||
| 263 | } | ||
| 264 | |||
| 265 | module_init(pcm20_init); | ||
| 266 | module_exit(pcm20_cleanup); | ||
diff --git a/drivers/media/radio/miropcm20-rds-core.c b/drivers/media/radio/miropcm20-rds-core.c deleted file mode 100644 index 9428d8b2642c..000000000000 --- a/drivers/media/radio/miropcm20-rds-core.c +++ /dev/null | |||
| @@ -1,211 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Many thanks to Fred Seidel <seidel@metabox.de>, the | ||
| 3 | * designer of the RDS decoder hardware. With his help | ||
| 4 | * I was able to code this driver. | ||
| 5 | * Thanks also to Norberto Pellicci, Dominic Mounteney | ||
| 6 | * <DMounteney@pinnaclesys.com> and www.teleauskunft.de | ||
| 7 | * for good hints on finding Fred. It was somewhat hard | ||
| 8 | * to locate him here in Germany... [: | ||
| 9 | * | ||
| 10 | * Revision history: | ||
| 11 | * | ||
| 12 | * 2000-08-09 Robert Siemer <Robert.Siemer@gmx.de> | ||
| 13 | * RDS support for MiroSound PCM20 radio | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/module.h> | ||
| 17 | #include <linux/errno.h> | ||
| 18 | #include <linux/string.h> | ||
| 19 | #include <linux/init.h> | ||
| 20 | #include <linux/slab.h> | ||
| 21 | #include <linux/mutex.h> | ||
| 22 | |||
| 23 | #include <asm/io.h> | ||
| 24 | #include "oss/aci.h" | ||
| 25 | #include "miropcm20-rds-core.h" | ||
| 26 | |||
| 27 | #define DEBUG 0 | ||
| 28 | |||
| 29 | static struct mutex aci_rds_mutex; | ||
| 30 | |||
| 31 | #define RDS_DATASHIFT 2 /* Bit 2 */ | ||
| 32 | #define RDS_DATAMASK (1 << RDS_DATASHIFT) | ||
| 33 | #define RDS_BUSYMASK 0x10 /* Bit 4 */ | ||
| 34 | #define RDS_CLOCKMASK 0x08 /* Bit 3 */ | ||
| 35 | |||
| 36 | #define RDS_DATA(x) (((x) >> RDS_DATASHIFT) & 1) | ||
| 37 | |||
| 38 | |||
| 39 | #if DEBUG | ||
| 40 | static void print_matrix(char array[], unsigned int length) | ||
| 41 | { | ||
| 42 | int i, j; | ||
| 43 | |||
| 44 | for (i=0; i<length; i++) { | ||
| 45 | printk(KERN_DEBUG "aci-rds: "); | ||
| 46 | for (j=7; j>=0; j--) { | ||
| 47 | printk("%d", (array[i] >> j) & 0x1); | ||
| 48 | } | ||
| 49 | if (i%8 == 0) | ||
| 50 | printk(" byte-border\n"); | ||
| 51 | else | ||
| 52 | printk("\n"); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | #endif /* DEBUG */ | ||
| 56 | |||
| 57 | static int byte2trans(unsigned char byte, unsigned char sendbuffer[], int size) | ||
| 58 | { | ||
| 59 | int i; | ||
| 60 | |||
| 61 | if (size != 8) | ||
| 62 | return -1; | ||
| 63 | for (i = 7; i >= 0; i--) | ||
| 64 | sendbuffer[7-i] = (byte & (1 << i)) ? RDS_DATAMASK : 0; | ||
| 65 | sendbuffer[0] |= RDS_CLOCKMASK; | ||
| 66 | |||
| 67 | return 0; | ||
| 68 | } | ||
| 69 | |||
| 70 | static int rds_waitread(void) | ||
| 71 | { | ||
| 72 | unsigned char byte; | ||
| 73 | int i=2000; | ||
| 74 | |||
| 75 | do { | ||
| 76 | byte=inb(RDS_REGISTER); | ||
| 77 | i--; | ||
| 78 | } | ||
| 79 | while ((byte & RDS_BUSYMASK) && i); | ||
| 80 | |||
| 81 | if (i) { | ||
| 82 | #if DEBUG | ||
| 83 | printk(KERN_DEBUG "rds_waitread()"); | ||
| 84 | print_matrix(&byte, 1); | ||
| 85 | #endif | ||
| 86 | return (byte); | ||
| 87 | } else { | ||
| 88 | printk(KERN_WARNING "aci-rds: rds_waitread() timeout...\n"); | ||
| 89 | return -1; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | /* don't use any ..._nowait() function if you are not sure what you do... */ | ||
| 94 | |||
| 95 | static inline void rds_rawwrite_nowait(unsigned char byte) | ||
| 96 | { | ||
| 97 | #if DEBUG | ||
| 98 | printk(KERN_DEBUG "rds_rawwrite()"); | ||
| 99 | print_matrix(&byte, 1); | ||
| 100 | #endif | ||
| 101 | outb(byte, RDS_REGISTER); | ||
| 102 | } | ||
| 103 | |||
| 104 | static int rds_rawwrite(unsigned char byte) | ||
| 105 | { | ||
| 106 | if (rds_waitread() >= 0) { | ||
| 107 | rds_rawwrite_nowait(byte); | ||
| 108 | return 0; | ||
| 109 | } else | ||
| 110 | return -1; | ||
| 111 | } | ||
| 112 | |||
| 113 | static int rds_write(unsigned char cmd) | ||
| 114 | { | ||
| 115 | unsigned char sendbuffer[8]; | ||
| 116 | int i; | ||
| 117 | |||
| 118 | if (byte2trans(cmd, sendbuffer, 8) != 0){ | ||
| 119 | return -1; | ||
| 120 | } else { | ||
| 121 | for (i=0; i<8; i++) { | ||
| 122 | rds_rawwrite(sendbuffer[i]); | ||
| 123 | } | ||
| 124 | } | ||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
| 128 | static int rds_readcycle_nowait(void) | ||
| 129 | { | ||
| 130 | rds_rawwrite_nowait(0); | ||
| 131 | return rds_waitread(); | ||
| 132 | } | ||
| 133 | |||
| 134 | static int rds_readcycle(void) | ||
| 135 | { | ||
| 136 | if (rds_rawwrite(0) < 0) | ||
| 137 | return -1; | ||
| 138 | return rds_waitread(); | ||
| 139 | } | ||
| 140 | |||
| 141 | static int rds_read(unsigned char databuffer[], int datasize) | ||
| 142 | { | ||
| 143 | #define READSIZE (8*datasize) | ||
| 144 | |||
| 145 | int i,j; | ||
| 146 | |||
| 147 | if (datasize < 1) /* nothing to read */ | ||
| 148 | return 0; | ||
| 149 | |||
| 150 | /* to be able to use rds_readcycle_nowait() | ||
| 151 | I have to waitread() here */ | ||
| 152 | if (rds_waitread() < 0) | ||
| 153 | return -1; | ||
| 154 | |||
| 155 | memset(databuffer, 0, datasize); | ||
| 156 | |||
| 157 | for (i=0; i< READSIZE; i++) | ||
| 158 | if((j=rds_readcycle_nowait()) < 0) { | ||
| 159 | return -1; | ||
| 160 | } else { | ||
| 161 | databuffer[i/8]|=(RDS_DATA(j) << (7-(i%8))); | ||
| 162 | } | ||
| 163 | |||
| 164 | return 0; | ||
| 165 | } | ||
| 166 | |||
| 167 | static int rds_ack(void) | ||
| 168 | { | ||
| 169 | int i=rds_readcycle(); | ||
| 170 | |||
| 171 | if (i < 0) | ||
| 172 | return -1; | ||
| 173 | if (i & RDS_DATAMASK) { | ||
| 174 | return 0; /* ACK */ | ||
| 175 | } else { | ||
| 176 | printk(KERN_DEBUG "aci-rds: NACK\n"); | ||
| 177 | return 1; /* NACK */ | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | int aci_rds_cmd(unsigned char cmd, unsigned char databuffer[], int datasize) | ||
| 182 | { | ||
| 183 | int ret; | ||
| 184 | |||
| 185 | if (mutex_lock_interruptible(&aci_rds_mutex)) | ||
| 186 | return -EINTR; | ||
| 187 | |||
| 188 | rds_write(cmd); | ||
| 189 | |||
| 190 | /* RDS_RESET doesn't need further processing */ | ||
| 191 | if (cmd!=RDS_RESET && (rds_ack() || rds_read(databuffer, datasize))) | ||
| 192 | ret = -1; | ||
| 193 | else | ||
| 194 | ret = 0; | ||
| 195 | |||
| 196 | mutex_unlock(&aci_rds_mutex); | ||
| 197 | |||
| 198 | return ret; | ||
| 199 | } | ||
| 200 | EXPORT_SYMBOL(aci_rds_cmd); | ||
| 201 | |||
| 202 | int __init attach_aci_rds(void) | ||
| 203 | { | ||
| 204 | mutex_init(&aci_rds_mutex); | ||
| 205 | return 0; | ||
| 206 | } | ||
| 207 | |||
| 208 | void __exit unload_aci_rds(void) | ||
| 209 | { | ||
| 210 | } | ||
| 211 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/radio/miropcm20-rds-core.h b/drivers/media/radio/miropcm20-rds-core.h deleted file mode 100644 index aeb5761f0469..000000000000 --- a/drivers/media/radio/miropcm20-rds-core.h +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | #ifndef _MIROPCM20_RDS_CORE_H_ | ||
| 2 | #define _MIROPCM20_RDS_CORE_H_ | ||
| 3 | |||
| 4 | extern int aci_rds_cmd(unsigned char cmd, unsigned char databuffer[], int datasize); | ||
| 5 | |||
| 6 | #define RDS_STATUS 0x01 | ||
| 7 | #define RDS_STATIONNAME 0x02 | ||
| 8 | #define RDS_TEXT 0x03 | ||
| 9 | #define RDS_ALTFREQ 0x04 | ||
| 10 | #define RDS_TIMEDATE 0x05 | ||
| 11 | #define RDS_PI_CODE 0x06 | ||
| 12 | #define RDS_PTYTATP 0x07 | ||
| 13 | #define RDS_RESET 0x08 | ||
| 14 | #define RDS_RXVALUE 0x09 | ||
| 15 | |||
| 16 | extern void __exit unload_aci_rds(void); | ||
| 17 | extern int __init attach_aci_rds(void); | ||
| 18 | |||
| 19 | #endif /* _MIROPCM20_RDS_CORE_H_ */ | ||
diff --git a/drivers/media/radio/miropcm20-rds.c b/drivers/media/radio/miropcm20-rds.c deleted file mode 100644 index 3e840f74d45c..000000000000 --- a/drivers/media/radio/miropcm20-rds.c +++ /dev/null | |||
| @@ -1,136 +0,0 @@ | |||
| 1 | /* MiroSOUND PCM20 radio rds interface driver | ||
| 2 | * (c) 2001 Robert Siemer <Robert.Siemer@gmx.de> | ||
| 3 | * Thanks to Fred Seidel. See miropcm20-rds-core.c for further information. | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* Revision history: | ||
| 7 | * | ||
| 8 | * 2001-04-18 Robert Siemer <Robert.Siemer@gmx.de> | ||
| 9 | * separate file for user interface driver | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/module.h> | ||
| 13 | #include <linux/init.h> | ||
| 14 | #include <linux/slab.h> | ||
| 15 | #include <linux/smp_lock.h> | ||
| 16 | #include <linux/fs.h> | ||
| 17 | #include <linux/miscdevice.h> | ||
| 18 | #include <linux/delay.h> | ||
| 19 | #include <asm/uaccess.h> | ||
| 20 | #include "miropcm20-rds-core.h" | ||
| 21 | |||
| 22 | static char * text_buffer; | ||
| 23 | static int rds_users; | ||
| 24 | |||
| 25 | |||
| 26 | static int rds_f_open(struct inode *in, struct file *fi) | ||
| 27 | { | ||
| 28 | if (rds_users) | ||
| 29 | return -EBUSY; | ||
| 30 | |||
| 31 | lock_kernel(); | ||
| 32 | rds_users++; | ||
| 33 | if ((text_buffer=kmalloc(66, GFP_KERNEL)) == 0) { | ||
| 34 | rds_users--; | ||
| 35 | printk(KERN_NOTICE "aci-rds: Out of memory by open()...\n"); | ||
| 36 | unlock_kernel(); | ||
| 37 | return -ENOMEM; | ||
| 38 | } | ||
| 39 | |||
| 40 | unlock_kernel(); | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | static int rds_f_release(struct inode *in, struct file *fi) | ||
| 45 | { | ||
| 46 | kfree(text_buffer); | ||
| 47 | |||
| 48 | rds_users--; | ||
| 49 | return 0; | ||
| 50 | } | ||
| 51 | |||
| 52 | static void print_matrix(char *ch, char out[]) | ||
| 53 | { | ||
| 54 | int j; | ||
| 55 | |||
| 56 | for (j=7; j>=0; j--) { | ||
| 57 | out[7-j] = ((*ch >> j) & 0x1) + '0'; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | static ssize_t rds_f_read(struct file *file, char __user *buffer, size_t length, loff_t *offset) | ||
| 62 | { | ||
| 63 | // i = sprintf(text_buffer, "length: %d, offset: %d\n", length, *offset); | ||
| 64 | |||
| 65 | char c; | ||
| 66 | char bits[8]; | ||
| 67 | |||
| 68 | msleep(2000); | ||
| 69 | aci_rds_cmd(RDS_STATUS, &c, 1); | ||
| 70 | print_matrix(&c, bits); | ||
| 71 | if (copy_to_user(buffer, bits, 8)) | ||
| 72 | return -EFAULT; | ||
| 73 | |||
| 74 | /* if ((c >> 3) & 1) { | ||
| 75 | aci_rds_cmd(RDS_STATIONNAME, text_buffer+1, 8); | ||
| 76 | text_buffer[0] = ' ' ; | ||
| 77 | text_buffer[9] = '\n'; | ||
| 78 | return copy_to_user(buffer+8, text_buffer, 10) ? -EFAULT: 18; | ||
| 79 | } | ||
| 80 | */ | ||
| 81 | /* if ((c >> 6) & 1) { | ||
| 82 | aci_rds_cmd(RDS_PTYTATP, &c, 1); | ||
| 83 | if ( c & 1) | ||
| 84 | sprintf(text_buffer, " M"); | ||
| 85 | else | ||
| 86 | sprintf(text_buffer, " S"); | ||
| 87 | if ((c >> 1) & 1) | ||
| 88 | sprintf(text_buffer+2, " TA"); | ||
| 89 | else | ||
| 90 | sprintf(text_buffer+2, " --"); | ||
| 91 | if ((c >> 7) & 1) | ||
| 92 | sprintf(text_buffer+5, " TP"); | ||
| 93 | else | ||
| 94 | sprintf(text_buffer+5, " --"); | ||
| 95 | sprintf(text_buffer+8, " %2d\n", (c >> 2) & 0x1f); | ||
| 96 | return copy_to_user(buffer+8, text_buffer, 12) ? -EFAULT: 20; | ||
| 97 | } | ||
| 98 | */ | ||
| 99 | |||
| 100 | if ((c >> 4) & 1) { | ||
| 101 | aci_rds_cmd(RDS_TEXT, text_buffer, 65); | ||
| 102 | text_buffer[0] = ' ' ; | ||
| 103 | text_buffer[65] = '\n'; | ||
| 104 | return copy_to_user(buffer+8, text_buffer,66) ? -EFAULT : 66+8; | ||
| 105 | } else { | ||
| 106 | put_user('\n', buffer+8); | ||
| 107 | return 9; | ||
| 108 | } | ||
| 109 | } | ||
| 110 | |||
| 111 | static const struct file_operations rds_fops = { | ||
| 112 | .owner = THIS_MODULE, | ||
| 113 | .read = rds_f_read, | ||
| 114 | .open = rds_f_open, | ||
| 115 | .release = rds_f_release | ||
| 116 | }; | ||
| 117 | |||
| 118 | static struct miscdevice rds_miscdev = { | ||
| 119 | .minor = MISC_DYNAMIC_MINOR, | ||
| 120 | .name = "radiotext", | ||
| 121 | .fops = &rds_fops, | ||
| 122 | }; | ||
| 123 | |||
| 124 | static int __init miropcm20_rds_init(void) | ||
| 125 | { | ||
| 126 | return misc_register(&rds_miscdev); | ||
| 127 | } | ||
| 128 | |||
| 129 | static void __exit miropcm20_rds_cleanup(void) | ||
| 130 | { | ||
| 131 | misc_deregister(&rds_miscdev); | ||
| 132 | } | ||
| 133 | |||
| 134 | module_init(miropcm20_rds_init); | ||
| 135 | module_exit(miropcm20_rds_cleanup); | ||
| 136 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index eba9209b3024..1f064f4b32df 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
| @@ -426,8 +426,7 @@ static int __init rtrack_init(void) | |||
| 426 | 426 | ||
| 427 | rtrack_radio.priv=&rtrack_unit; | 427 | rtrack_radio.priv=&rtrack_unit; |
| 428 | 428 | ||
| 429 | if(video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr)==-1) | 429 | if (video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 430 | { | ||
| 431 | release_region(io, 2); | 430 | release_region(io, 2); |
| 432 | return -EINVAL; | 431 | return -EINVAL; |
| 433 | } | 432 | } |
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index 3fe5504428c5..628c689e3ffe 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c | |||
| @@ -394,8 +394,7 @@ static int __init aztech_init(void) | |||
| 394 | mutex_init(&lock); | 394 | mutex_init(&lock); |
| 395 | aztech_radio.priv=&aztech_unit; | 395 | aztech_radio.priv=&aztech_unit; |
| 396 | 396 | ||
| 397 | if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1) | 397 | if (video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 398 | { | ||
| 399 | release_region(io,2); | 398 | release_region(io,2); |
| 400 | return -EINVAL; | 399 | return -EINVAL; |
| 401 | } | 400 | } |
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index 6166e726ed72..04c3698d32e4 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c | |||
| @@ -682,7 +682,7 @@ static int __init cadet_init(void) | |||
| 682 | } | 682 | } |
| 683 | if (!request_region(io,2,"cadet")) | 683 | if (!request_region(io,2,"cadet")) |
| 684 | goto fail; | 684 | goto fail; |
| 685 | if(video_register_device(&cadet_radio,VFL_TYPE_RADIO,radio_nr)==-1) { | 685 | if (video_register_device(&cadet_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 686 | release_region(io,2); | 686 | release_region(io,2); |
| 687 | goto fail; | 687 | goto fail; |
| 688 | } | 688 | } |
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 36e754e3ffb2..5cd7f032298d 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
| @@ -425,7 +425,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci | |||
| 425 | } | 425 | } |
| 426 | *devradio = vdev_template; | 426 | *devradio = vdev_template; |
| 427 | 427 | ||
| 428 | if ( video_register_device( devradio, VFL_TYPE_RADIO , nr_radio) == -1 ) { | 428 | if (video_register_device(devradio, VFL_TYPE_RADIO, nr_radio) < 0) { |
| 429 | kfree( devradio ); | 429 | kfree( devradio ); |
| 430 | goto err_video; | 430 | goto err_video; |
| 431 | } | 431 | } |
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 2b1a6221de6d..0a0f956bb308 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c | |||
| @@ -612,8 +612,7 @@ static int __init gemtek_init(void) | |||
| 612 | 612 | ||
| 613 | gemtek_radio.priv = &gemtek_unit; | 613 | gemtek_radio.priv = &gemtek_unit; |
| 614 | 614 | ||
| 615 | if (video_register_device(&gemtek_radio, VFL_TYPE_RADIO, | 615 | if (video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 616 | radio_nr) == -1) { | ||
| 617 | release_region(io, 1); | 616 | release_region(io, 1); |
| 618 | return -EBUSY; | 617 | return -EBUSY; |
| 619 | } | 618 | } |
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index 0ada1c697e8a..9ef0a763eeb7 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
| @@ -409,8 +409,7 @@ static int __devinit maestro_probe(struct pci_dev *pdev, | |||
| 409 | video_set_drvdata(maestro_radio_inst, radio_unit); | 409 | video_set_drvdata(maestro_radio_inst, radio_unit); |
| 410 | pci_set_drvdata(pdev, maestro_radio_inst); | 410 | pci_set_drvdata(pdev, maestro_radio_inst); |
| 411 | 411 | ||
| 412 | retval = video_register_device(maestro_radio_inst, VFL_TYPE_RADIO, | 412 | retval = video_register_device(maestro_radio_inst, VFL_TYPE_RADIO, radio_nr); |
| 413 | radio_nr); | ||
| 414 | if (retval) { | 413 | if (retval) { |
| 415 | printk(KERN_ERR "can't register video device!\n"); | 414 | printk(KERN_ERR "can't register video device!\n"); |
| 416 | goto errfr1; | 415 | goto errfr1; |
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 43c75497dc49..0cc6fcb041fd 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
| @@ -156,28 +156,28 @@ static void set_freq(__u16 io, __u32 freq) | |||
| 156 | { | 156 | { |
| 157 | unsigned long int si; | 157 | unsigned long int si; |
| 158 | int bl; | 158 | int bl; |
| 159 | int data = FREQ2BITS(freq); | 159 | int val = FREQ2BITS(freq); |
| 160 | 160 | ||
| 161 | /* TEA5757 shift register bits (see pdf) */ | 161 | /* TEA5757 shift register bits (see pdf) */ |
| 162 | 162 | ||
| 163 | outbit(0,io); // 24 search | 163 | outbit(0, io); /* 24 search */ |
| 164 | outbit(1,io); // 23 search up/down | 164 | outbit(1, io); /* 23 search up/down */ |
| 165 | 165 | ||
| 166 | outbit(0,io); // 22 stereo/mono | 166 | outbit(0, io); /* 22 stereo/mono */ |
| 167 | 167 | ||
| 168 | outbit(0,io); // 21 band | 168 | outbit(0, io); /* 21 band */ |
| 169 | outbit(0,io); // 20 band (only 00=FM works I think) | 169 | outbit(0, io); /* 20 band (only 00=FM works I think) */ |
| 170 | 170 | ||
| 171 | outbit(0,io); // 19 port ? | 171 | outbit(0, io); /* 19 port ? */ |
| 172 | outbit(0,io); // 18 port ? | 172 | outbit(0, io); /* 18 port ? */ |
| 173 | 173 | ||
| 174 | outbit(0,io); // 17 search level | 174 | outbit(0, io); /* 17 search level */ |
| 175 | outbit(0,io); // 16 search level | 175 | outbit(0, io); /* 16 search level */ |
| 176 | 176 | ||
| 177 | si = 0x8000; | 177 | si = 0x8000; |
| 178 | for (bl = 1; bl <= 16 ; bl++) { | 178 | for (bl = 1; bl <= 16; bl++) { |
| 179 | outbit(data & si,io); | 179 | outbit(val & si, io); |
| 180 | si >>=1; | 180 | si >>= 1; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | dprintk(1, "Radio freq set to %d.%02d MHz\n", | 183 | dprintk(1, "Radio freq set to %d.%02d MHz\n", |
| @@ -410,7 +410,7 @@ static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_d | |||
| 410 | mutex_init(&radio_unit.lock); | 410 | mutex_init(&radio_unit.lock); |
| 411 | maxiradio_radio.priv = &radio_unit; | 411 | maxiradio_radio.priv = &radio_unit; |
| 412 | 412 | ||
| 413 | if (video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr)==-1) { | 413 | if (video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 414 | printk("radio-maxiradio: can't register device!"); | 414 | printk("radio-maxiradio: can't register device!"); |
| 415 | goto err_out_free_region; | 415 | goto err_out_free_region; |
| 416 | } | 416 | } |
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index e2dde0807268..6d820e2481e7 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c | |||
| @@ -332,8 +332,7 @@ static int __init rtrack2_init(void) | |||
| 332 | rtrack2_radio.priv=&rtrack2_unit; | 332 | rtrack2_radio.priv=&rtrack2_unit; |
| 333 | 333 | ||
| 334 | spin_lock_init(&lock); | 334 | spin_lock_init(&lock); |
| 335 | if(video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr)==-1) | 335 | if (video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 336 | { | ||
| 337 | release_region(io, 4); | 336 | release_region(io, 4); |
| 338 | return -EINVAL; | 337 | return -EINVAL; |
| 339 | } | 338 | } |
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index bb5d92f104af..0d478f54a907 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
| @@ -377,7 +377,7 @@ static int __init fmi_init(void) | |||
| 377 | 377 | ||
| 378 | mutex_init(&lock); | 378 | mutex_init(&lock); |
| 379 | 379 | ||
| 380 | if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) == -1) { | 380 | if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 381 | release_region(io, 2); | 381 | release_region(io, 2); |
| 382 | return -EINVAL; | 382 | return -EINVAL; |
| 383 | } | 383 | } |
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index a4984ff87c9c..16c7ef20265c 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
| @@ -1694,8 +1694,8 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, | |||
| 1694 | INIT_DELAYED_WORK(&radio->work, si470x_work); | 1694 | INIT_DELAYED_WORK(&radio->work, si470x_work); |
| 1695 | 1695 | ||
| 1696 | /* register video device */ | 1696 | /* register video device */ |
| 1697 | if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr)) { | 1697 | retval = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); |
| 1698 | retval = -EIO; | 1698 | if (retval) { |
| 1699 | printk(KERN_WARNING DRIVER_NAME | 1699 | printk(KERN_WARNING DRIVER_NAME |
| 1700 | ": Could not register video device\n"); | 1700 | ": Could not register video device\n"); |
| 1701 | goto err_all; | 1701 | goto err_all; |
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index cefa44fc5aed..0876fecc5f27 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c | |||
| @@ -405,8 +405,7 @@ static int __init terratec_init(void) | |||
| 405 | 405 | ||
| 406 | spin_lock_init(&lock); | 406 | spin_lock_init(&lock); |
| 407 | 407 | ||
| 408 | if(video_register_device(&terratec_radio, VFL_TYPE_RADIO, radio_nr)==-1) | 408 | if (video_register_device(&terratec_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 409 | { | ||
| 410 | release_region(io,2); | 409 | release_region(io,2); |
| 411 | return -EINVAL; | 410 | return -EINVAL; |
| 412 | } | 411 | } |
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c index d70172d23edb..193161956253 100644 --- a/drivers/media/radio/radio-trust.c +++ b/drivers/media/radio/radio-trust.c | |||
| @@ -378,8 +378,7 @@ static int __init trust_init(void) | |||
| 378 | printk(KERN_ERR "trust: port 0x%x already in use\n", io); | 378 | printk(KERN_ERR "trust: port 0x%x already in use\n", io); |
| 379 | return -EBUSY; | 379 | return -EBUSY; |
| 380 | } | 380 | } |
| 381 | if(video_register_device(&trust_radio, VFL_TYPE_RADIO, radio_nr)==-1) | 381 | if (video_register_device(&trust_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 382 | { | ||
| 383 | release_region(io, 2); | 382 | release_region(io, 2); |
| 384 | return -EINVAL; | 383 | return -EINVAL; |
| 385 | } | 384 | } |
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index 9f17a332fa11..51d57ed3b3e1 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c | |||
| @@ -446,8 +446,7 @@ static int __init zoltrix_init(void) | |||
| 446 | return -EBUSY; | 446 | return -EBUSY; |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | if (video_register_device(&zoltrix_radio, VFL_TYPE_RADIO, radio_nr) == -1) | 449 | if (video_register_device(&zoltrix_radio, VFL_TYPE_RADIO, radio_nr) < 0) { |
| 450 | { | ||
| 451 | release_region(io, 2); | 450 | release_region(io, 2); |
| 452 | return -EINVAL; | 451 | return -EINVAL; |
| 453 | } | 452 | } |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index ecbfa1b39b70..3e9e0dcd217e 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
| @@ -968,7 +968,7 @@ config VIDEO_PXA27x | |||
| 968 | 968 | ||
| 969 | config VIDEO_SH_MOBILE_CEU | 969 | config VIDEO_SH_MOBILE_CEU |
| 970 | tristate "SuperH Mobile CEU Interface driver" | 970 | tristate "SuperH Mobile CEU Interface driver" |
| 971 | depends on VIDEO_DEV | 971 | depends on VIDEO_DEV && HAS_DMA |
| 972 | select SOC_CAMERA | 972 | select SOC_CAMERA |
| 973 | select VIDEOBUF_DMA_CONTIG | 973 | select VIDEOBUF_DMA_CONTIG |
| 974 | ---help--- | 974 | ---help--- |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index bbc6f8b82297..ef7c8d3ffb18 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
| @@ -20,6 +20,8 @@ ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) | |||
| 20 | obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o | 20 | obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o |
| 21 | endif | 21 | endif |
| 22 | 22 | ||
| 23 | obj-$(CONFIG_VIDEO_TUNER) += tuner.o | ||
| 24 | |||
| 23 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ | 25 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ |
| 24 | obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o | 26 | obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o |
| 25 | obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o | 27 | obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o |
| @@ -85,8 +87,6 @@ obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o | |||
| 85 | obj-$(CONFIG_VIDEO_DPC) += dpc7146.o | 87 | obj-$(CONFIG_VIDEO_DPC) += dpc7146.o |
| 86 | obj-$(CONFIG_TUNER_3036) += tuner-3036.o | 88 | obj-$(CONFIG_TUNER_3036) += tuner-3036.o |
| 87 | 89 | ||
| 88 | obj-$(CONFIG_VIDEO_TUNER) += tuner.o | ||
| 89 | |||
| 90 | obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o | 90 | obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o |
| 91 | obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o | 91 | obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o |
| 92 | obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o | 92 | obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o |
diff --git a/drivers/media/video/au0828/Kconfig b/drivers/media/video/au0828/Kconfig index ed9a50f189fc..018f72b8e3e2 100644 --- a/drivers/media/video/au0828/Kconfig +++ b/drivers/media/video/au0828/Kconfig | |||
| @@ -7,6 +7,7 @@ config VIDEO_AU0828 | |||
| 7 | select DVB_AU8522 if !DVB_FE_CUSTOMIZE | 7 | select DVB_AU8522 if !DVB_FE_CUSTOMIZE |
| 8 | select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMIZE | 8 | select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMIZE |
| 9 | select MEDIA_TUNER_MXL5007T if !DVB_FE_CUSTOMIZE | 9 | select MEDIA_TUNER_MXL5007T if !DVB_FE_CUSTOMIZE |
| 10 | select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMIZE | ||
| 10 | ---help--- | 11 | ---help--- |
| 11 | This is a video4linux driver for Auvitek's USB device. | 12 | This is a video4linux driver for Auvitek's USB device. |
| 12 | 13 | ||
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index 443e59009762..ed48908a9034 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Auvitek USB bridge | 2 | * Driver for the Auvitek USB bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -38,6 +38,9 @@ struct au0828_board au0828_boards[] = { | |||
| 38 | [AU0828_BOARD_DVICO_FUSIONHDTV7] = { | 38 | [AU0828_BOARD_DVICO_FUSIONHDTV7] = { |
| 39 | .name = "DViCO FusionHDTV USB", | 39 | .name = "DViCO FusionHDTV USB", |
| 40 | }, | 40 | }, |
| 41 | [AU0828_BOARD_HAUPPAUGE_WOODBURY] = { | ||
| 42 | .name = "Hauppauge Woodbury", | ||
| 43 | }, | ||
| 41 | }; | 44 | }; |
| 42 | 45 | ||
| 43 | /* Tuner callback function for au0828 boards. Currently only needed | 46 | /* Tuner callback function for au0828 boards. Currently only needed |
| @@ -115,6 +118,7 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
| 115 | case AU0828_BOARD_HAUPPAUGE_HVR850: | 118 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
| 116 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: | 119 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: |
| 117 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: | 120 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: |
| 121 | case AU0828_BOARD_HAUPPAUGE_WOODBURY: | ||
| 118 | if (dev->i2c_rc == 0) | 122 | if (dev->i2c_rc == 0) |
| 119 | hauppauge_eeprom(dev, eeprom+0xa0); | 123 | hauppauge_eeprom(dev, eeprom+0xa0); |
| 120 | break; | 124 | break; |
| @@ -134,6 +138,7 @@ void au0828_gpio_setup(struct au0828_dev *dev) | |||
| 134 | case AU0828_BOARD_HAUPPAUGE_HVR850: | 138 | case AU0828_BOARD_HAUPPAUGE_HVR850: |
| 135 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: | 139 | case AU0828_BOARD_HAUPPAUGE_HVR950Q: |
| 136 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: | 140 | case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL: |
| 141 | case AU0828_BOARD_HAUPPAUGE_WOODBURY: | ||
| 137 | /* GPIO's | 142 | /* GPIO's |
| 138 | * 4 - CS5340 | 143 | * 4 - CS5340 |
| 139 | * 5 - AU8522 Demodulator | 144 | * 5 - AU8522 Demodulator |
| @@ -205,6 +210,8 @@ struct usb_device_id au0828_usb_id_table [] = { | |||
| 205 | .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL }, | 210 | .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL }, |
| 206 | { USB_DEVICE(0x2040, 0x7281), | 211 | { USB_DEVICE(0x2040, 0x7281), |
| 207 | .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL }, | 212 | .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL }, |
| 213 | { USB_DEVICE(0x2040, 0x8200), | ||
| 214 | .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY }, | ||
| 208 | { }, | 215 | { }, |
| 209 | }; | 216 | }; |
| 210 | 217 | ||
diff --git a/drivers/media/video/au0828/au0828-cards.h b/drivers/media/video/au0828/au0828-cards.h index c37f5fd0fa80..48a1882c2b6b 100644 --- a/drivers/media/video/au0828/au0828-cards.h +++ b/drivers/media/video/au0828/au0828-cards.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Auvitek USB bridge | 2 | * Driver for the Auvitek USB bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -24,3 +24,4 @@ | |||
| 24 | #define AU0828_BOARD_HAUPPAUGE_HVR850 2 | 24 | #define AU0828_BOARD_HAUPPAUGE_HVR850 2 |
| 25 | #define AU0828_BOARD_DVICO_FUSIONHDTV7 3 | 25 | #define AU0828_BOARD_DVICO_FUSIONHDTV7 3 |
| 26 | #define AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL 4 | 26 | #define AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL 4 |
| 27 | #define AU0828_BOARD_HAUPPAUGE_WOODBURY 5 | ||
diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c index 54bfc0f05295..d856de9f742f 100644 --- a/drivers/media/video/au0828/au0828-core.c +++ b/drivers/media/video/au0828/au0828-core.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Auvitek USB bridge | 2 | * Driver for the Auvitek USB bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -252,5 +252,5 @@ module_init(au0828_init); | |||
| 252 | module_exit(au0828_exit); | 252 | module_exit(au0828_exit); |
| 253 | 253 | ||
| 254 | MODULE_DESCRIPTION("Driver for Auvitek AU0828 based products"); | 254 | MODULE_DESCRIPTION("Driver for Auvitek AU0828 based products"); |
| 255 | MODULE_AUTHOR("Steven Toth <stoth@hauppauge.com>"); | 255 | MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>"); |
| 256 | MODULE_LICENSE("GPL"); | 256 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/video/au0828/au0828-dvb.c b/drivers/media/video/au0828/au0828-dvb.c index 584a83a94a2a..ba94be7e0ac1 100644 --- a/drivers/media/video/au0828/au0828-dvb.c +++ b/drivers/media/video/au0828/au0828-dvb.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Auvitek USB bridge | 2 | * Driver for the Auvitek USB bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -29,6 +29,7 @@ | |||
| 29 | #include "au8522.h" | 29 | #include "au8522.h" |
| 30 | #include "xc5000.h" | 30 | #include "xc5000.h" |
| 31 | #include "mxl5007t.h" | 31 | #include "mxl5007t.h" |
| 32 | #include "tda18271.h" | ||
| 32 | 33 | ||
| 33 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 34 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 34 | 35 | ||
| @@ -38,6 +39,15 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
| 38 | static struct au8522_config hauppauge_hvr950q_config = { | 39 | static struct au8522_config hauppauge_hvr950q_config = { |
| 39 | .demod_address = 0x8e >> 1, | 40 | .demod_address = 0x8e >> 1, |
| 40 | .status_mode = AU8522_DEMODLOCKING, | 41 | .status_mode = AU8522_DEMODLOCKING, |
| 42 | .qam_if = AU8522_IF_6MHZ, | ||
| 43 | .vsb_if = AU8522_IF_6MHZ, | ||
| 44 | }; | ||
| 45 | |||
| 46 | static struct au8522_config hauppauge_woodbury_config = { | ||
| 47 | .demod_address = 0x8e >> 1, | ||
| 48 | .status_mode = AU8522_DEMODLOCKING, | ||
| 49 | .qam_if = AU8522_IF_4MHZ, | ||
| 50 | .vsb_if = AU8522_IF_3_25MHZ, | ||
| 41 | }; | 51 | }; |
| 42 | 52 | ||
| 43 | static struct xc5000_config hauppauge_hvr950q_tunerconfig = { | 53 | static struct xc5000_config hauppauge_hvr950q_tunerconfig = { |
| @@ -51,6 +61,10 @@ static struct mxl5007t_config mxl5007t_hvr950q_config = { | |||
| 51 | .if_freq_hz = MxL_IF_6_MHZ, | 61 | .if_freq_hz = MxL_IF_6_MHZ, |
| 52 | }; | 62 | }; |
| 53 | 63 | ||
| 64 | static struct tda18271_config hauppauge_woodbury_tunerconfig = { | ||
| 65 | .gate = TDA18271_GATE_DIGITAL, | ||
| 66 | }; | ||
| 67 | |||
| 54 | /*-------------------------------------------------------------------*/ | 68 | /*-------------------------------------------------------------------*/ |
| 55 | static void urb_completion(struct urb *purb) | 69 | static void urb_completion(struct urb *purb) |
| 56 | { | 70 | { |
| @@ -357,6 +371,15 @@ int au0828_dvb_register(struct au0828_dev *dev) | |||
| 357 | &dev->i2c_adap, 0x60, | 371 | &dev->i2c_adap, 0x60, |
| 358 | &mxl5007t_hvr950q_config); | 372 | &mxl5007t_hvr950q_config); |
| 359 | break; | 373 | break; |
| 374 | case AU0828_BOARD_HAUPPAUGE_WOODBURY: | ||
| 375 | dvb->frontend = dvb_attach(au8522_attach, | ||
| 376 | &hauppauge_woodbury_config, | ||
| 377 | &dev->i2c_adap); | ||
| 378 | if (dvb->frontend != NULL) | ||
| 379 | dvb_attach(tda18271_attach, dvb->frontend, | ||
| 380 | 0x60, &dev->i2c_adap, | ||
| 381 | &hauppauge_woodbury_tunerconfig); | ||
| 382 | break; | ||
| 360 | default: | 383 | default: |
| 361 | printk(KERN_WARNING "The frontend of your DVB/ATSC card " | 384 | printk(KERN_WARNING "The frontend of your DVB/ATSC card " |
| 362 | "isn't supported yet\n"); | 385 | "isn't supported yet\n"); |
diff --git a/drivers/media/video/au0828/au0828-i2c.c b/drivers/media/video/au0828/au0828-i2c.c index 741a4937b050..d618fbaade1b 100644 --- a/drivers/media/video/au0828/au0828-i2c.c +++ b/drivers/media/video/au0828/au0828-i2c.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Auvitek AU0828 USB bridge | 2 | * Driver for the Auvitek AU0828 USB bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/au0828/au0828-reg.h b/drivers/media/video/au0828/au0828-reg.h index 39827550891c..1e87fa0c6842 100644 --- a/drivers/media/video/au0828/au0828-reg.h +++ b/drivers/media/video/au0828/au0828-reg.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Auvitek USB bridge | 2 | * Driver for the Auvitek USB bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h index 7beb571798e5..4f10ff300135 100644 --- a/drivers/media/video/au0828/au0828.h +++ b/drivers/media/video/au0828/au0828.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Auvitek AU0828 USB bridge | 2 | * Driver for the Auvitek AU0828 USB bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 1c56ae92ce74..6081edc362df 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
| @@ -3144,8 +3144,9 @@ static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256]) | |||
| 3144 | 3144 | ||
| 3145 | static void flyvideo_gpio(struct bttv *btv) | 3145 | static void flyvideo_gpio(struct bttv *btv) |
| 3146 | { | 3146 | { |
| 3147 | int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821; | 3147 | int gpio, has_remote, has_radio, is_capture_only; |
| 3148 | int tuner=UNSET,ttype; | 3148 | int is_lr90, has_tda9820_tda9821; |
| 3149 | int tuner_type = UNSET, ttype; | ||
| 3149 | 3150 | ||
| 3150 | gpio_inout(0xffffff, 0); | 3151 | gpio_inout(0xffffff, 0); |
| 3151 | udelay(8); /* without this we would see the 0x1800 mask */ | 3152 | udelay(8); /* without this we would see the 0x1800 mask */ |
| @@ -3163,20 +3164,26 @@ static void flyvideo_gpio(struct bttv *btv) | |||
| 3163 | * xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered | 3164 | * xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered |
| 3164 | * Note: Some bits are Audio_Mask ! | 3165 | * Note: Some bits are Audio_Mask ! |
| 3165 | */ | 3166 | */ |
| 3166 | ttype=(gpio&0x0f0000)>>16; | 3167 | ttype = (gpio & 0x0f0000) >> 16; |
| 3167 | switch(ttype) { | 3168 | switch (ttype) { |
| 3168 | case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */ | 3169 | case 0x0: |
| 3170 | tuner_type = 2; /* NTSC, e.g. TPI8NSR11P */ | ||
| 3169 | break; | 3171 | break; |
| 3170 | case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */ | 3172 | case 0x2: |
| 3173 | tuner_type = 39; /* LG NTSC (newer TAPC series) TAPC-H701P */ | ||
| 3171 | break; | 3174 | break; |
| 3172 | case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */ | 3175 | case 0x4: |
| 3176 | tuner_type = 5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */ | ||
| 3173 | break; | 3177 | break; |
| 3174 | case 0x6: tuner=37;/* LG PAL (newer TAPC series) TAPC-G702P */ | 3178 | case 0x6: |
| 3179 | tuner_type = 37; /* LG PAL (newer TAPC series) TAPC-G702P */ | ||
| 3175 | break; | 3180 | break; |
| 3176 | case 0xC: tuner=3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */ | 3181 | case 0xC: |
| 3182 | tuner_type = 3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */ | ||
| 3177 | break; | 3183 | break; |
| 3178 | default: | 3184 | default: |
| 3179 | printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr); | 3185 | printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr); |
| 3186 | break; | ||
| 3180 | } | 3187 | } |
| 3181 | 3188 | ||
| 3182 | has_remote = gpio & 0x800000; | 3189 | has_remote = gpio & 0x800000; |
| @@ -3189,23 +3196,26 @@ static void flyvideo_gpio(struct bttv *btv) | |||
| 3189 | /* | 3196 | /* |
| 3190 | * gpio & 0x001000 output bit for audio routing */ | 3197 | * gpio & 0x001000 output bit for audio routing */ |
| 3191 | 3198 | ||
| 3192 | if(is_capture_only) | 3199 | if (is_capture_only) |
| 3193 | tuner = TUNER_ABSENT; /* No tuner present */ | 3200 | tuner_type = TUNER_ABSENT; /* No tuner present */ |
| 3194 | 3201 | ||
| 3195 | printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n", | 3202 | printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n", |
| 3196 | btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio); | 3203 | btv->c.nr, has_radio ? "yes" : "no ", |
| 3204 | has_remote ? "yes" : "no ", tuner_type, gpio); | ||
| 3197 | printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n", | 3205 | printk(KERN_INFO "bttv%d: FlyVideo LR90=%s tda9821/tda9820=%s capture_only=%s\n", |
| 3198 | btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ", | 3206 | btv->c.nr, is_lr90 ? "yes" : "no ", |
| 3199 | is_capture_only?"yes":"no "); | 3207 | has_tda9820_tda9821 ? "yes" : "no ", |
| 3208 | is_capture_only ? "yes" : "no "); | ||
| 3200 | 3209 | ||
| 3201 | if (tuner != UNSET) /* only set if known tuner autodetected, else let insmod option through */ | 3210 | if (tuner_type != UNSET) /* only set if known tuner autodetected, else let insmod option through */ |
| 3202 | btv->tuner_type = tuner; | 3211 | btv->tuner_type = tuner_type; |
| 3203 | btv->has_radio = has_radio; | 3212 | btv->has_radio = has_radio; |
| 3204 | 3213 | ||
| 3205 | /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80 | 3214 | /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80 |
| 3206 | * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00 | 3215 | * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00 |
| 3207 | * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */ | 3216 | * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */ |
| 3208 | if(has_tda9820_tda9821) btv->audio_mode_gpio = lt9415_audio; | 3217 | if (has_tda9820_tda9821) |
| 3218 | btv->audio_mode_gpio = lt9415_audio; | ||
| 3209 | /* todo: if(has_tda9874) btv->audio_mode_gpio = fv2000s_audio; */ | 3219 | /* todo: if(has_tda9874) btv->audio_mode_gpio = fv2000s_audio; */ |
| 3210 | } | 3220 | } |
| 3211 | 3221 | ||
| @@ -3962,7 +3972,7 @@ static int tuner_1_table[] = { | |||
| 3962 | 3972 | ||
| 3963 | static void __devinit avermedia_eeprom(struct bttv *btv) | 3973 | static void __devinit avermedia_eeprom(struct bttv *btv) |
| 3964 | { | 3974 | { |
| 3965 | int tuner_make,tuner_tv_fm,tuner_format,tuner=0; | 3975 | int tuner_make, tuner_tv_fm, tuner_format, tuner_type = 0; |
| 3966 | 3976 | ||
| 3967 | tuner_make = (eeprom_data[0x41] & 0x7); | 3977 | tuner_make = (eeprom_data[0x41] & 0x7); |
| 3968 | tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3; | 3978 | tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3; |
| @@ -3970,24 +3980,24 @@ static void __devinit avermedia_eeprom(struct bttv *btv) | |||
| 3970 | btv->has_remote = (eeprom_data[0x42] & 0x01); | 3980 | btv->has_remote = (eeprom_data[0x42] & 0x01); |
| 3971 | 3981 | ||
| 3972 | if (tuner_make == 0 || tuner_make == 2) | 3982 | if (tuner_make == 0 || tuner_make == 2) |
| 3973 | if(tuner_format <=0x0a) | 3983 | if (tuner_format <= 0x0a) |
| 3974 | tuner = tuner_0_table[tuner_format]; | 3984 | tuner_type = tuner_0_table[tuner_format]; |
| 3975 | if (tuner_make == 1) | 3985 | if (tuner_make == 1) |
| 3976 | if(tuner_format <=9) | 3986 | if (tuner_format <= 9) |
| 3977 | tuner = tuner_1_table[tuner_format]; | 3987 | tuner_type = tuner_1_table[tuner_format]; |
| 3978 | 3988 | ||
| 3979 | if (tuner_make == 4) | 3989 | if (tuner_make == 4) |
| 3980 | if(tuner_format == 0x09) | 3990 | if (tuner_format == 0x09) |
| 3981 | tuner = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */ | 3991 | tuner_type = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */ |
| 3982 | 3992 | ||
| 3983 | printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=", | 3993 | printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=", |
| 3984 | btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]); | 3994 | btv->c.nr, eeprom_data[0x41], eeprom_data[0x42]); |
| 3985 | if(tuner) { | 3995 | if (tuner_type) { |
| 3986 | btv->tuner_type=tuner; | 3996 | btv->tuner_type = tuner_type; |
| 3987 | printk("%d",tuner); | 3997 | printk(KERN_CONT "%d", tuner_type); |
| 3988 | } else | 3998 | } else |
| 3989 | printk("Unknown type"); | 3999 | printk(KERN_CONT "Unknown type"); |
| 3990 | printk(" radio:%s remote control:%s\n", | 4000 | printk(KERN_CONT " radio:%s remote control:%s\n", |
| 3991 | tuner_tv_fm ? "yes" : "no", | 4001 | tuner_tv_fm ? "yes" : "no", |
| 3992 | btv->has_remote ? "yes" : "no"); | 4002 | btv->has_remote ? "yes" : "no"); |
| 3993 | } | 4003 | } |
| @@ -4029,7 +4039,8 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin) | |||
| 4029 | 4039 | ||
| 4030 | gpio_inout(mask,mask); | 4040 | gpio_inout(mask,mask); |
| 4031 | gpio_bits(mask,0); | 4041 | gpio_bits(mask,0); |
| 4032 | udelay(2500); | 4042 | mdelay(2); |
| 4043 | udelay(500); | ||
| 4033 | gpio_bits(mask,mask); | 4044 | gpio_bits(mask,mask); |
| 4034 | 4045 | ||
| 4035 | if (bttv_gpio) | 4046 | if (bttv_gpio) |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 85bf31ab8789..6ae4cc860efe 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
| @@ -96,7 +96,6 @@ static unsigned int irq_iswitch; | |||
| 96 | static unsigned int uv_ratio = 50; | 96 | static unsigned int uv_ratio = 50; |
| 97 | static unsigned int full_luma_range; | 97 | static unsigned int full_luma_range; |
| 98 | static unsigned int coring; | 98 | static unsigned int coring; |
| 99 | extern int no_overlay; | ||
| 100 | 99 | ||
| 101 | /* API features (turn on/off stuff for testing) */ | 100 | /* API features (turn on/off stuff for testing) */ |
| 102 | static unsigned int v4l2 = 1; | 101 | static unsigned int v4l2 = 1; |
diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c index 649682aac1ac..5b1b8e4c78ba 100644 --- a/drivers/media/video/bt8xx/bttv-risc.c +++ b/drivers/media/video/bt8xx/bttv-risc.c | |||
| @@ -244,7 +244,8 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc, | |||
| 244 | const struct bttv_format *fmt, struct bttv_overlay *ov, | 244 | const struct bttv_format *fmt, struct bttv_overlay *ov, |
| 245 | int skip_even, int skip_odd) | 245 | int skip_even, int skip_odd) |
| 246 | { | 246 | { |
| 247 | int dwords,rc,line,maxy,start,end,skip,nskips; | 247 | int dwords, rc, line, maxy, start, end; |
| 248 | unsigned skip, nskips; | ||
| 248 | struct btcx_skiplist *skips; | 249 | struct btcx_skiplist *skips; |
| 249 | __le32 *rp; | 250 | __le32 *rp; |
| 250 | u32 ri,ra; | 251 | u32 ri,ra; |
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 08ef54a22c9e..b4d940b2e447 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h | |||
| @@ -267,6 +267,11 @@ int bttv_sub_add_device(struct bttv_core *core, char *name); | |||
| 267 | int bttv_sub_del_devices(struct bttv_core *core); | 267 | int bttv_sub_del_devices(struct bttv_core *core); |
| 268 | 268 | ||
| 269 | /* ---------------------------------------------------------- */ | 269 | /* ---------------------------------------------------------- */ |
| 270 | /* bttv-cards.c */ | ||
| 271 | |||
| 272 | extern int no_overlay; | ||
| 273 | |||
| 274 | /* ---------------------------------------------------------- */ | ||
| 270 | /* bttv-driver.c */ | 275 | /* bttv-driver.c */ |
| 271 | 276 | ||
| 272 | /* insmod options */ | 277 | /* insmod options */ |
diff --git a/drivers/media/video/btcx-risc.c b/drivers/media/video/btcx-risc.c index f42701f82e7f..3324ab38f58c 100644 --- a/drivers/media/video/btcx-risc.c +++ b/drivers/media/video/btcx-risc.c | |||
| @@ -184,12 +184,12 @@ btcx_sort_clips(struct v4l2_clip *clips, unsigned int nclips) | |||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | void | 186 | void |
| 187 | btcx_calc_skips(int line, int width, unsigned int *maxy, | 187 | btcx_calc_skips(int line, int width, int *maxy, |
| 188 | struct btcx_skiplist *skips, unsigned int *nskips, | 188 | struct btcx_skiplist *skips, unsigned int *nskips, |
| 189 | const struct v4l2_clip *clips, unsigned int nclips) | 189 | const struct v4l2_clip *clips, unsigned int nclips) |
| 190 | { | 190 | { |
| 191 | unsigned int clip,skip; | 191 | unsigned int clip,skip; |
| 192 | int end,maxline; | 192 | int end, maxline; |
| 193 | 193 | ||
| 194 | skip=0; | 194 | skip=0; |
| 195 | maxline = 9999; | 195 | maxline = 9999; |
diff --git a/drivers/media/video/btcx-risc.h b/drivers/media/video/btcx-risc.h index 861bc8112824..f8bc6e8e7b51 100644 --- a/drivers/media/video/btcx-risc.h +++ b/drivers/media/video/btcx-risc.h | |||
| @@ -23,7 +23,7 @@ int btcx_screen_clips(int swidth, int sheight, struct v4l2_rect *win, | |||
| 23 | int btcx_align(struct v4l2_rect *win, struct v4l2_clip *clips, | 23 | int btcx_align(struct v4l2_rect *win, struct v4l2_clip *clips, |
| 24 | unsigned int n, int mask); | 24 | unsigned int n, int mask); |
| 25 | void btcx_sort_clips(struct v4l2_clip *clips, unsigned int nclips); | 25 | void btcx_sort_clips(struct v4l2_clip *clips, unsigned int nclips); |
| 26 | void btcx_calc_skips(int line, int width, unsigned int *maxy, | 26 | void btcx_calc_skips(int line, int width, int *maxy, |
| 27 | struct btcx_skiplist *skips, unsigned int *nskips, | 27 | struct btcx_skiplist *skips, unsigned int *nskips, |
| 28 | const struct v4l2_clip *clips, unsigned int nclips); | 28 | const struct v4l2_clip *clips, unsigned int nclips); |
| 29 | 29 | ||
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index d3b3268bace8..6e39e253ce53 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
| @@ -946,8 +946,7 @@ static int init_bwqcam(struct parport *port) | |||
| 946 | 946 | ||
| 947 | printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name); | 947 | printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name); |
| 948 | 948 | ||
| 949 | if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) | 949 | if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { |
| 950 | { | ||
| 951 | parport_unregister_device(qcam->pdev); | 950 | parport_unregister_device(qcam->pdev); |
| 952 | kfree(qcam); | 951 | kfree(qcam); |
| 953 | return -ENODEV; | 952 | return -ENODEV; |
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index fe9379b282d3..7f6c6b4bec10 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c | |||
| @@ -787,8 +787,7 @@ static int init_cqcam(struct parport *port) | |||
| 787 | 787 | ||
| 788 | parport_release(qcam->pdev); | 788 | parport_release(qcam->pdev); |
| 789 | 789 | ||
| 790 | if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) | 790 | if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { |
| 791 | { | ||
| 792 | printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", | 791 | printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", |
| 793 | qcam->pport->name); | 792 | qcam->pport->name); |
| 794 | parport_unregister_device(qcam->pdev); | 793 | parport_unregister_device(qcam->pdev); |
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index dc8cc6115e2f..a661800b0e69 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c | |||
| @@ -3955,7 +3955,7 @@ struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowleve | |||
| 3955 | camera->lowlevel_data = lowlevel; | 3955 | camera->lowlevel_data = lowlevel; |
| 3956 | 3956 | ||
| 3957 | /* register v4l device */ | 3957 | /* register v4l device */ |
| 3958 | if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 3958 | if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { |
| 3959 | kfree(camera); | 3959 | kfree(camera); |
| 3960 | printk(KERN_DEBUG "video_register_device failed\n"); | 3960 | printk(KERN_DEBUG "video_register_device failed\n"); |
| 3961 | return NULL; | 3961 | return NULL; |
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 515c8b57a60d..eb9f15cd4c45 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c | |||
| @@ -1024,7 +1024,6 @@ static int ioctl_queryctrl(void *arg,struct camera_data *cam) | |||
| 1024 | if(cam->params.pnp_id.device_type == DEVICE_STV_672 && | 1024 | if(cam->params.pnp_id.device_type == DEVICE_STV_672 && |
| 1025 | cam->params.version.sensor_flags==CPIA2_VP_SENSOR_FLAGS_500){ | 1025 | cam->params.version.sensor_flags==CPIA2_VP_SENSOR_FLAGS_500){ |
| 1026 | // Maximum 15fps | 1026 | // Maximum 15fps |
| 1027 | int i; | ||
| 1028 | for(i=0; i<c->maximum; ++i) { | 1027 | for(i=0; i<c->maximum; ++i) { |
| 1029 | if(framerate_controls[i].value == | 1028 | if(framerate_controls[i].value == |
| 1030 | CPIA2_VP_FRAMERATE_15) { | 1029 | CPIA2_VP_FRAMERATE_15) { |
| @@ -1959,8 +1958,7 @@ int cpia2_register_camera(struct camera_data *cam) | |||
| 1959 | reset_camera_struct_v4l(cam); | 1958 | reset_camera_struct_v4l(cam); |
| 1960 | 1959 | ||
| 1961 | /* register v4l device */ | 1960 | /* register v4l device */ |
| 1962 | if (video_register_device | 1961 | if (video_register_device(cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { |
| 1963 | (cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | ||
| 1964 | ERR("video_register_device failed\n"); | 1962 | ERR("video_register_device failed\n"); |
| 1965 | video_device_release(cam->vdev); | 1963 | video_device_release(cam->vdev); |
| 1966 | return -ENODEV; | 1964 | return -ENODEV; |
diff --git a/drivers/media/video/cx18/cx18-av-firmware.c b/drivers/media/video/cx18/cx18-av-firmware.c index 834b9248242e..e996a4e3123a 100644 --- a/drivers/media/video/cx18/cx18-av-firmware.c +++ b/drivers/media/video/cx18/cx18-av-firmware.c | |||
| @@ -32,7 +32,7 @@ int cx18_av_loadfw(struct cx18 *cx) | |||
| 32 | u32 v; | 32 | u32 v; |
| 33 | const u8 *ptr; | 33 | const u8 *ptr; |
| 34 | int i; | 34 | int i; |
| 35 | int retries = 0; | 35 | int retries1 = 0; |
| 36 | 36 | ||
| 37 | if (request_firmware(&fw, FWFILE, &cx->dev->dev) != 0) { | 37 | if (request_firmware(&fw, FWFILE, &cx->dev->dev) != 0) { |
| 38 | CX18_ERR("unable to open firmware %s\n", FWFILE); | 38 | CX18_ERR("unable to open firmware %s\n", FWFILE); |
| @@ -41,7 +41,7 @@ int cx18_av_loadfw(struct cx18 *cx) | |||
| 41 | 41 | ||
| 42 | /* The firmware load often has byte errors, so allow for several | 42 | /* The firmware load often has byte errors, so allow for several |
| 43 | retries, both at byte level and at the firmware load level. */ | 43 | retries, both at byte level and at the firmware load level. */ |
| 44 | while (retries < 5) { | 44 | while (retries1 < 5) { |
| 45 | cx18_av_write4(cx, CXADEC_CHIP_CTRL, 0x00010000); | 45 | cx18_av_write4(cx, CXADEC_CHIP_CTRL, 0x00010000); |
| 46 | cx18_av_write(cx, CXADEC_STD_DET_CTL, 0xf6); | 46 | cx18_av_write(cx, CXADEC_STD_DET_CTL, 0xf6); |
| 47 | 47 | ||
| @@ -57,9 +57,9 @@ int cx18_av_loadfw(struct cx18 *cx) | |||
| 57 | for (i = 0; i < size; i++) { | 57 | for (i = 0; i < size; i++) { |
| 58 | u32 dl_control = 0x0F000000 | i | ((u32)ptr[i] << 16); | 58 | u32 dl_control = 0x0F000000 | i | ((u32)ptr[i] << 16); |
| 59 | u32 value = 0; | 59 | u32 value = 0; |
| 60 | int retries; | 60 | int retries2; |
| 61 | 61 | ||
| 62 | for (retries = 0; retries < 5; retries++) { | 62 | for (retries2 = 0; retries2 < 5; retries2++) { |
| 63 | cx18_av_write4(cx, CXADEC_DL_CTL, dl_control); | 63 | cx18_av_write4(cx, CXADEC_DL_CTL, dl_control); |
| 64 | udelay(10); | 64 | udelay(10); |
| 65 | value = cx18_av_read4(cx, CXADEC_DL_CTL); | 65 | value = cx18_av_read4(cx, CXADEC_DL_CTL); |
| @@ -69,18 +69,18 @@ int cx18_av_loadfw(struct cx18 *cx) | |||
| 69 | the address. We can only write the lower | 69 | the address. We can only write the lower |
| 70 | address byte of the address. */ | 70 | address byte of the address. */ |
| 71 | if ((value & 0x3F00) != (dl_control & 0x3F00)) { | 71 | if ((value & 0x3F00) != (dl_control & 0x3F00)) { |
| 72 | retries = 5; | 72 | retries2 = 5; |
| 73 | break; | 73 | break; |
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | if (retries >= 5) | 76 | if (retries2 >= 5) |
| 77 | break; | 77 | break; |
| 78 | } | 78 | } |
| 79 | if (i == size) | 79 | if (i == size) |
| 80 | break; | 80 | break; |
| 81 | retries++; | 81 | retries1++; |
| 82 | } | 82 | } |
| 83 | if (retries >= 5) { | 83 | if (retries1 >= 5) { |
| 84 | CX18_ERR("unable to load firmware %s\n", FWFILE); | 84 | CX18_ERR("unable to load firmware %s\n", FWFILE); |
| 85 | release_firmware(fw); | 85 | release_firmware(fw); |
| 86 | return -EIO; | 86 | return -EIO; |
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 22434aadde31..bd18afebbf86 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
| @@ -74,9 +74,9 @@ static int radio[CX18_MAX_CARDS] = { -1, -1, -1, -1, -1, -1, -1, -1, | |||
| 74 | -1, -1, -1, -1, -1, -1, -1, -1, | 74 | -1, -1, -1, -1, -1, -1, -1, -1, |
| 75 | -1, -1, -1, -1, -1, -1, -1, -1 }; | 75 | -1, -1, -1, -1, -1, -1, -1, -1 }; |
| 76 | 76 | ||
| 77 | static int cardtype_c = 1; | 77 | static unsigned cardtype_c = 1; |
| 78 | static int tuner_c = 1; | 78 | static unsigned tuner_c = 1; |
| 79 | static int radio_c = 1; | 79 | static unsigned radio_c = 1; |
| 80 | static char pal[] = "--"; | 80 | static char pal[] = "--"; |
| 81 | static char secam[] = "--"; | 81 | static char secam[] = "--"; |
| 82 | static char ntsc[] = "-"; | 82 | static char ntsc[] = "-"; |
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c index cae38985b131..1e420a804fc9 100644 --- a/drivers/media/video/cx18/cx18-dvb.c +++ b/drivers/media/video/cx18/cx18-dvb.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * cx18 functions for DVB support | 2 | * cx18 functions for DVB support |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx18/cx18-dvb.h b/drivers/media/video/cx18/cx18-dvb.h index d6a6ccda79a9..bf8d8f6f5455 100644 --- a/drivers/media/video/cx18/cx18-dvb.h +++ b/drivers/media/video/cx18/cx18-dvb.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * cx18 functions for DVB support | 2 | * cx18 functions for DVB support |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2008 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx18/cx18-irq.c b/drivers/media/video/cx18/cx18-irq.c index 25114a5cbd57..ab218315c84b 100644 --- a/drivers/media/video/cx18/cx18-irq.c +++ b/drivers/media/video/cx18/cx18-irq.c | |||
| @@ -61,7 +61,7 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) | |||
| 61 | CX18_WARN("Ack struct = %d for %s\n", | 61 | CX18_WARN("Ack struct = %d for %s\n", |
| 62 | mb->args[2], s->name); | 62 | mb->args[2], s->name); |
| 63 | id = read_enc(off); | 63 | id = read_enc(off); |
| 64 | buf = cx18_queue_find_buf(s, id, read_enc(off + 4)); | 64 | buf = cx18_queue_get_buf_irq(s, id, read_enc(off + 4)); |
| 65 | CX18_DEBUG_HI_DMA("DMA DONE for %s (buffer %d)\n", s->name, id); | 65 | CX18_DEBUG_HI_DMA("DMA DONE for %s (buffer %d)\n", s->name, id); |
| 66 | if (buf) { | 66 | if (buf) { |
| 67 | cx18_buf_sync_for_cpu(s, buf); | 67 | cx18_buf_sync_for_cpu(s, buf); |
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c index 6990b77c6200..dbe792ac3001 100644 --- a/drivers/media/video/cx18/cx18-queue.c +++ b/drivers/media/video/cx18/cx18-queue.c | |||
| @@ -78,12 +78,13 @@ struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q) | |||
| 78 | return buf; | 78 | return buf; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, | 81 | struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id, |
| 82 | u32 bytesused) | 82 | u32 bytesused) |
| 83 | { | 83 | { |
| 84 | struct cx18 *cx = s->cx; | 84 | struct cx18 *cx = s->cx; |
| 85 | struct list_head *p; | 85 | struct list_head *p; |
| 86 | 86 | ||
| 87 | spin_lock(&s->qlock); | ||
| 87 | list_for_each(p, &s->q_free.list) { | 88 | list_for_each(p, &s->q_free.list) { |
| 88 | struct cx18_buffer *buf = | 89 | struct cx18_buffer *buf = |
| 89 | list_entry(p, struct cx18_buffer, list); | 90 | list_entry(p, struct cx18_buffer, list); |
| @@ -92,114 +93,48 @@ struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, | |||
| 92 | continue; | 93 | continue; |
| 93 | buf->bytesused = bytesused; | 94 | buf->bytesused = bytesused; |
| 94 | /* the transport buffers are handled differently, | 95 | /* the transport buffers are handled differently, |
| 95 | so there is no need to move them to the full queue */ | 96 | they are not moved to the full queue */ |
| 96 | if (s->type == CX18_ENC_STREAM_TYPE_TS) | 97 | if (s->type != CX18_ENC_STREAM_TYPE_TS) { |
| 97 | return buf; | 98 | s->q_free.buffers--; |
| 98 | s->q_free.buffers--; | 99 | s->q_free.length -= s->buf_size; |
| 99 | s->q_free.length -= s->buf_size; | 100 | s->q_full.buffers++; |
| 100 | s->q_full.buffers++; | 101 | s->q_full.length += s->buf_size; |
| 101 | s->q_full.length += s->buf_size; | 102 | s->q_full.bytesused += buf->bytesused; |
| 102 | s->q_full.bytesused += buf->bytesused; | 103 | list_move_tail(&buf->list, &s->q_full.list); |
| 103 | list_move_tail(&buf->list, &s->q_full.list); | 104 | } |
| 105 | spin_unlock(&s->qlock); | ||
| 104 | return buf; | 106 | return buf; |
| 105 | } | 107 | } |
| 108 | spin_unlock(&s->qlock); | ||
| 106 | CX18_ERR("Cannot find buffer %d for stream %s\n", id, s->name); | 109 | CX18_ERR("Cannot find buffer %d for stream %s\n", id, s->name); |
| 107 | return NULL; | 110 | return NULL; |
| 108 | } | 111 | } |
| 109 | 112 | ||
| 110 | static void cx18_queue_move_buf(struct cx18_stream *s, struct cx18_queue *from, | 113 | /* Move all buffers of a queue to q_free, while flushing the buffers */ |
| 111 | struct cx18_queue *to, int clear, int full) | 114 | static void cx18_queue_flush(struct cx18_stream *s, struct cx18_queue *q) |
| 112 | { | ||
| 113 | struct cx18_buffer *buf = | ||
| 114 | list_entry(from->list.next, struct cx18_buffer, list); | ||
| 115 | |||
| 116 | list_move_tail(from->list.next, &to->list); | ||
| 117 | from->buffers--; | ||
| 118 | from->length -= s->buf_size; | ||
| 119 | from->bytesused -= buf->bytesused - buf->readpos; | ||
| 120 | /* special handling for q_free */ | ||
| 121 | if (clear) | ||
| 122 | buf->bytesused = buf->readpos = buf->b_flags = 0; | ||
| 123 | else if (full) { | ||
| 124 | /* special handling for stolen buffers, assume | ||
| 125 | all bytes are used. */ | ||
| 126 | buf->bytesused = s->buf_size; | ||
| 127 | buf->readpos = buf->b_flags = 0; | ||
| 128 | } | ||
| 129 | to->buffers++; | ||
| 130 | to->length += s->buf_size; | ||
| 131 | to->bytesused += buf->bytesused - buf->readpos; | ||
| 132 | } | ||
| 133 | |||
| 134 | /* Move 'needed_bytes' worth of buffers from queue 'from' into queue 'to'. | ||
| 135 | If 'needed_bytes' == 0, then move all buffers from 'from' into 'to'. | ||
| 136 | If 'steal' != NULL, then buffers may also taken from that queue if | ||
| 137 | needed. | ||
| 138 | |||
| 139 | The buffer is automatically cleared if it goes to the free queue. It is | ||
| 140 | also cleared if buffers need to be taken from the 'steal' queue and | ||
| 141 | the 'from' queue is the free queue. | ||
| 142 | |||
| 143 | When 'from' is q_free, then needed_bytes is compared to the total | ||
| 144 | available buffer length, otherwise needed_bytes is compared to the | ||
| 145 | bytesused value. For the 'steal' queue the total available buffer | ||
| 146 | length is always used. | ||
| 147 | |||
| 148 | -ENOMEM is returned if the buffers could not be obtained, 0 if all | ||
| 149 | buffers where obtained from the 'from' list and if non-zero then | ||
| 150 | the number of stolen buffers is returned. */ | ||
| 151 | static int cx18_queue_move(struct cx18_stream *s, struct cx18_queue *from, | ||
| 152 | struct cx18_queue *steal, struct cx18_queue *to, | ||
| 153 | int needed_bytes) | ||
| 154 | { | 115 | { |
| 155 | unsigned long flags; | 116 | unsigned long flags; |
| 156 | int rc = 0; | 117 | struct cx18_buffer *buf; |
| 157 | int from_free = from == &s->q_free; | ||
| 158 | int to_free = to == &s->q_free; | ||
| 159 | int bytes_available; | ||
| 160 | |||
| 161 | spin_lock_irqsave(&s->qlock, flags); | ||
| 162 | if (needed_bytes == 0) { | ||
| 163 | from_free = 1; | ||
| 164 | needed_bytes = from->length; | ||
| 165 | } | ||
| 166 | |||
| 167 | bytes_available = from_free ? from->length : from->bytesused; | ||
| 168 | bytes_available += steal ? steal->length : 0; | ||
| 169 | 118 | ||
| 170 | if (bytes_available < needed_bytes) { | 119 | if (q == &s->q_free) |
| 171 | spin_unlock_irqrestore(&s->qlock, flags); | 120 | return; |
| 172 | return -ENOMEM; | ||
| 173 | } | ||
| 174 | if (from_free) { | ||
| 175 | u32 old_length = to->length; | ||
| 176 | 121 | ||
| 177 | while (to->length - old_length < needed_bytes) { | 122 | spin_lock_irqsave(&s->qlock, flags); |
| 178 | if (list_empty(&from->list)) | 123 | while (!list_empty(&q->list)) { |
| 179 | from = steal; | 124 | buf = list_entry(q->list.next, struct cx18_buffer, list); |
| 180 | if (from == steal) | 125 | list_move_tail(q->list.next, &s->q_free.list); |
| 181 | rc++; /* keep track of 'stolen' buffers */ | 126 | buf->bytesused = buf->readpos = buf->b_flags = 0; |
| 182 | cx18_queue_move_buf(s, from, to, 1, 0); | 127 | s->q_free.buffers++; |
| 183 | } | 128 | s->q_free.length += s->buf_size; |
| 184 | } else { | ||
| 185 | u32 old_bytesused = to->bytesused; | ||
| 186 | |||
| 187 | while (to->bytesused - old_bytesused < needed_bytes) { | ||
| 188 | if (list_empty(&from->list)) | ||
| 189 | from = steal; | ||
| 190 | if (from == steal) | ||
| 191 | rc++; /* keep track of 'stolen' buffers */ | ||
| 192 | cx18_queue_move_buf(s, from, to, to_free, rc); | ||
| 193 | } | ||
| 194 | } | 129 | } |
| 130 | cx18_queue_init(q); | ||
| 195 | spin_unlock_irqrestore(&s->qlock, flags); | 131 | spin_unlock_irqrestore(&s->qlock, flags); |
| 196 | return rc; | ||
| 197 | } | 132 | } |
| 198 | 133 | ||
| 199 | void cx18_flush_queues(struct cx18_stream *s) | 134 | void cx18_flush_queues(struct cx18_stream *s) |
| 200 | { | 135 | { |
| 201 | cx18_queue_move(s, &s->q_io, NULL, &s->q_free, 0); | 136 | cx18_queue_flush(s, &s->q_io); |
| 202 | cx18_queue_move(s, &s->q_full, NULL, &s->q_free, 0); | 137 | cx18_queue_flush(s, &s->q_full); |
| 203 | } | 138 | } |
| 204 | 139 | ||
| 205 | int cx18_stream_alloc(struct cx18_stream *s) | 140 | int cx18_stream_alloc(struct cx18_stream *s) |
| @@ -214,10 +149,10 @@ int cx18_stream_alloc(struct cx18_stream *s) | |||
| 214 | s->name, s->buffers, s->buf_size, | 149 | s->name, s->buffers, s->buf_size, |
| 215 | s->buffers * s->buf_size / 1024); | 150 | s->buffers * s->buf_size / 1024); |
| 216 | 151 | ||
| 217 | if (((char *)&cx->scb->cpu_mdl[cx->mdl_offset + s->buffers] - | 152 | if (((char __iomem *)&cx->scb->cpu_mdl[cx->mdl_offset + s->buffers] - |
| 218 | (char *)cx->scb) > SCB_RESERVED_SIZE) { | 153 | (char __iomem *)cx->scb) > SCB_RESERVED_SIZE) { |
| 219 | unsigned bufsz = (((char *)cx->scb) + SCB_RESERVED_SIZE - | 154 | unsigned bufsz = (((char __iomem *)cx->scb) + SCB_RESERVED_SIZE - |
| 220 | ((char *)cx->scb->cpu_mdl)); | 155 | ((char __iomem *)cx->scb->cpu_mdl)); |
| 221 | 156 | ||
| 222 | CX18_ERR("Too many buffers, cannot fit in SCB area\n"); | 157 | CX18_ERR("Too many buffers, cannot fit in SCB area\n"); |
| 223 | CX18_ERR("Max buffers = %zd\n", | 158 | CX18_ERR("Max buffers = %zd\n", |
diff --git a/drivers/media/video/cx18/cx18-queue.h b/drivers/media/video/cx18/cx18-queue.h index 91423b9863a4..7f93bb13c09f 100644 --- a/drivers/media/video/cx18/cx18-queue.h +++ b/drivers/media/video/cx18/cx18-queue.h | |||
| @@ -46,7 +46,7 @@ void cx18_queue_init(struct cx18_queue *q); | |||
| 46 | void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, | 46 | void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, |
| 47 | struct cx18_queue *q); | 47 | struct cx18_queue *q); |
| 48 | struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); | 48 | struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); |
| 49 | struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, | 49 | struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id, |
| 50 | u32 bytesused); | 50 | u32 bytesused); |
| 51 | void cx18_flush_queues(struct cx18_stream *s); | 51 | void cx18_flush_queues(struct cx18_stream *s); |
| 52 | 52 | ||
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index 8118091568fc..7b0e8c01692e 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * | 4 | * |
| 5 | * (c) 2004 Jelle Foks <jelle@foks.8m.com> | 5 | * (c) 2004 Jelle Foks <jelle@foks.8m.com> |
| 6 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> | 6 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> |
| 7 | * (c) 2008 Steven Toth <stoth@hauppauge.com> | 7 | * (c) 2008 Steven Toth <stoth@linuxtv.org> |
| 8 | * - CX23885/7/8 support | 8 | * - CX23885/7/8 support |
| 9 | * | 9 | * |
| 10 | * Includes parts from the ivtv driver( http://ivtv.sourceforge.net/), | 10 | * Includes parts from the ivtv driver( http://ivtv.sourceforge.net/), |
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index a19de850955d..c36d3f632104 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index 6286a9cf957e..25fb09938744 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -33,7 +33,7 @@ | |||
| 33 | #include "cx23885.h" | 33 | #include "cx23885.h" |
| 34 | 34 | ||
| 35 | MODULE_DESCRIPTION("Driver for cx23885 based TV cards"); | 35 | MODULE_DESCRIPTION("Driver for cx23885 based TV cards"); |
| 36 | MODULE_AUTHOR("Steven Toth <stoth@hauppauge.com>"); | 36 | MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>"); |
| 37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
| 38 | 38 | ||
| 39 | static unsigned int debug; | 39 | static unsigned int debug; |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 0a2e6558cd66..291b9d008da8 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c index c6bb0a05bc1c..f98e476e9617 100644 --- a/drivers/media/video/cx23885/cx23885-i2c.c +++ b/drivers/media/video/cx23885/cx23885-i2c.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx23885/cx23885-reg.h b/drivers/media/video/cx23885/cx23885-reg.h index bdd11bc513ad..20b68a236260 100644 --- a/drivers/media/video/cx23885/cx23885-reg.h +++ b/drivers/media/video/cx23885/cx23885-reg.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx23885/cx23885-vbi.c b/drivers/media/video/cx23885/cx23885-vbi.c index e36e3fcae2fb..35e61cd112fc 100644 --- a/drivers/media/video/cx23885/cx23885-vbi.c +++ b/drivers/media/video/cx23885/cx23885-vbi.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index ad2235dab5b1..6047c78d84bf 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -41,7 +41,7 @@ | |||
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | MODULE_DESCRIPTION("v4l2 driver module for cx23885 based TV cards"); | 43 | MODULE_DESCRIPTION("v4l2 driver module for cx23885 based TV cards"); |
| 44 | MODULE_AUTHOR("Steven Toth <stoth@hauppauge.com>"); | 44 | MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>"); |
| 45 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
| 46 | 46 | ||
| 47 | /* ------------------------------------------------------------------ */ | 47 | /* ------------------------------------------------------------------ */ |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index 00dfdc89d641..e23d97c071e0 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 209d3bcb5dbb..4da8cd74f00e 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | * NTSC sliced VBI support by Christopher Neufeld <television@cneufeld.ca> | 13 | * NTSC sliced VBI support by Christopher Neufeld <television@cneufeld.ca> |
| 14 | * with additional fixes by Hans Verkuil <hverkuil@xs4all.nl>. | 14 | * with additional fixes by Hans Verkuil <hverkuil@xs4all.nl>. |
| 15 | * | 15 | * |
| 16 | * CX23885 support by Steven Toth <stoth@hauppauge.com>. | 16 | * CX23885 support by Steven Toth <stoth@linuxtv.org>. |
| 17 | * | 17 | * |
| 18 | * This program is free software; you can redistribute it and/or | 18 | * This program is free software; you can redistribute it and/or |
| 19 | * modify it under the terms of the GNU General Public License | 19 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/video/dabusb.c b/drivers/media/video/dabusb.c index 48f4b92a8f8b..79faedf58521 100644 --- a/drivers/media/video/dabusb.c +++ b/drivers/media/video/dabusb.c | |||
| @@ -403,6 +403,7 @@ static int dabusb_fpga_download (pdabusb_t s, const char *fname) | |||
| 403 | ret = request_firmware(&fw, "dabusb/bitstream.bin", &s->usbdev->dev); | 403 | ret = request_firmware(&fw, "dabusb/bitstream.bin", &s->usbdev->dev); |
| 404 | if (ret) { | 404 | if (ret) { |
| 405 | err("Failed to load \"dabusb/bitstream.bin\": %d\n", ret); | 405 | err("Failed to load \"dabusb/bitstream.bin\": %d\n", ret); |
| 406 | kfree(b); | ||
| 406 | return ret; | 407 | return ret; |
| 407 | } | 408 | } |
| 408 | 409 | ||
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index 2d170d101c21..8db2a05bf9c5 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
| @@ -2588,6 +2588,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
| 2588 | cam->v4ldev->fops = &et61x251_fops; | 2588 | cam->v4ldev->fops = &et61x251_fops; |
| 2589 | cam->v4ldev->minor = video_nr[dev_nr]; | 2589 | cam->v4ldev->minor = video_nr[dev_nr]; |
| 2590 | cam->v4ldev->release = video_device_release; | 2590 | cam->v4ldev->release = video_device_release; |
| 2591 | cam->v4ldev->parent = &udev->dev; | ||
| 2591 | video_set_drvdata(cam->v4ldev, cam); | 2592 | video_set_drvdata(cam->v4ldev, cam); |
| 2592 | 2593 | ||
| 2593 | init_completion(&cam->probe); | 2594 | init_completion(&cam->probe); |
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index cd3a3f5829b2..4d9f4cc255a9 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c | |||
| @@ -124,7 +124,7 @@ static void reg_r(struct gspca_dev *gspca_dev, | |||
| 124 | struct usb_device *dev = gspca_dev->dev; | 124 | struct usb_device *dev = gspca_dev->dev; |
| 125 | 125 | ||
| 126 | #ifdef GSPCA_DEBUG | 126 | #ifdef GSPCA_DEBUG |
| 127 | if (len > sizeof gspca_dev->usb_buf) { | 127 | if (len > USB_BUF_SZ) { |
| 128 | err("reg_r: buffer overflow"); | 128 | err("reg_r: buffer overflow"); |
| 129 | return; | 129 | return; |
| 130 | } | 130 | } |
| @@ -164,7 +164,7 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
| 164 | struct usb_device *dev = gspca_dev->dev; | 164 | struct usb_device *dev = gspca_dev->dev; |
| 165 | 165 | ||
| 166 | #ifdef GSPCA_DEBUG | 166 | #ifdef GSPCA_DEBUG |
| 167 | if (len > sizeof gspca_dev->usb_buf) { | 167 | if (len > USB_BUF_SZ) { |
| 168 | err("reg_w: buffer overflow"); | 168 | err("reg_w: buffer overflow"); |
| 169 | return; | 169 | return; |
| 170 | } | 170 | } |
| @@ -731,13 +731,13 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) | |||
| 731 | reg_w_val(gspca_dev, 0x0000, 0x00); | 731 | reg_w_val(gspca_dev, 0x0000, 0x00); |
| 732 | /* wait for completion */ | 732 | /* wait for completion */ |
| 733 | retry = 50; | 733 | retry = 50; |
| 734 | while (retry--) { | 734 | do { |
| 735 | reg_r(gspca_dev, 0x0002, 1); | 735 | reg_r(gspca_dev, 0x0002, 1); |
| 736 | /* 0x07 until 0x00 */ | 736 | /* 0x07 until 0x00 */ |
| 737 | if (gspca_dev->usb_buf[0] == 0x00) | 737 | if (gspca_dev->usb_buf[0] == 0x00) |
| 738 | break; | 738 | break; |
| 739 | reg_w_val(gspca_dev, 0x0053, 0x00); | 739 | reg_w_val(gspca_dev, 0x0053, 0x00); |
| 740 | } | 740 | } while (--retry); |
| 741 | if (retry == 0) | 741 | if (retry == 0) |
| 742 | PDEBUG(D_ERR, "Damned Errors sending jpeg Table"); | 742 | PDEBUG(D_ERR, "Damned Errors sending jpeg Table"); |
| 743 | /* send the qtable now */ | 743 | /* send the qtable now */ |
| @@ -826,8 +826,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 826 | return 0; | 826 | return 0; |
| 827 | } | 827 | } |
| 828 | 828 | ||
| 829 | /* this function is called at open time */ | 829 | /* this function is called at probe and resume time */ |
| 830 | static int sd_open(struct gspca_dev *gspca_dev) | 830 | static int sd_init(struct gspca_dev *gspca_dev) |
| 831 | { | 831 | { |
| 832 | cx11646_init1(gspca_dev); | 832 | cx11646_init1(gspca_dev); |
| 833 | cx11646_initsize(gspca_dev); | 833 | cx11646_initsize(gspca_dev); |
| @@ -845,10 +845,6 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 845 | cx11646_jpeg(gspca_dev); | 845 | cx11646_jpeg(gspca_dev); |
| 846 | } | 846 | } |
| 847 | 847 | ||
| 848 | static void sd_stopN(struct gspca_dev *gspca_dev) | ||
| 849 | { | ||
| 850 | } | ||
| 851 | |||
| 852 | static void sd_stop0(struct gspca_dev *gspca_dev) | 848 | static void sd_stop0(struct gspca_dev *gspca_dev) |
| 853 | { | 849 | { |
| 854 | int retry = 50; | 850 | int retry = 50; |
| @@ -871,10 +867,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev) | |||
| 871 | reg_w_val(gspca_dev, 0x00fc, 0xe0); | 867 | reg_w_val(gspca_dev, 0x00fc, 0xe0); |
| 872 | } | 868 | } |
| 873 | 869 | ||
| 874 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 875 | { | ||
| 876 | } | ||
| 877 | |||
| 878 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 870 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 879 | struct gspca_frame *frame, /* target */ | 871 | struct gspca_frame *frame, /* target */ |
| 880 | __u8 *data, /* isoc packet */ | 872 | __u8 *data, /* isoc packet */ |
| @@ -998,11 +990,9 @@ static struct sd_desc sd_desc = { | |||
| 998 | .ctrls = sd_ctrls, | 990 | .ctrls = sd_ctrls, |
| 999 | .nctrls = ARRAY_SIZE(sd_ctrls), | 991 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 1000 | .config = sd_config, | 992 | .config = sd_config, |
| 1001 | .open = sd_open, | 993 | .init = sd_init, |
| 1002 | .start = sd_start, | 994 | .start = sd_start, |
| 1003 | .stopN = sd_stopN, | ||
| 1004 | .stop0 = sd_stop0, | 995 | .stop0 = sd_stop0, |
| 1005 | .close = sd_close, | ||
| 1006 | .pkt_scan = sd_pkt_scan, | 996 | .pkt_scan = sd_pkt_scan, |
| 1007 | }; | 997 | }; |
| 1008 | 998 | ||
| @@ -1026,6 +1016,10 @@ static struct usb_driver sd_driver = { | |||
| 1026 | .id_table = device_table, | 1016 | .id_table = device_table, |
| 1027 | .probe = sd_probe, | 1017 | .probe = sd_probe, |
| 1028 | .disconnect = gspca_disconnect, | 1018 | .disconnect = gspca_disconnect, |
| 1019 | #ifdef CONFIG_PM | ||
| 1020 | .suspend = gspca_suspend, | ||
| 1021 | .resume = gspca_resume, | ||
| 1022 | #endif | ||
| 1029 | }; | 1023 | }; |
| 1030 | 1024 | ||
| 1031 | /* -- module insert / remove -- */ | 1025 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c index 1dbe92d01e6a..4ff0e386914b 100644 --- a/drivers/media/video/gspca/etoms.c +++ b/drivers/media/video/gspca/etoms.c | |||
| @@ -81,6 +81,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 81 | .set = sd_setcontrast, | 81 | .set = sd_setcontrast, |
| 82 | .get = sd_getcontrast, | 82 | .get = sd_getcontrast, |
| 83 | }, | 83 | }, |
| 84 | #define COLOR_IDX 2 | ||
| 84 | { | 85 | { |
| 85 | { | 86 | { |
| 86 | .id = V4L2_CID_SATURATION, | 87 | .id = V4L2_CID_SATURATION, |
| @@ -234,7 +235,7 @@ static void reg_r(struct gspca_dev *gspca_dev, | |||
| 234 | struct usb_device *dev = gspca_dev->dev; | 235 | struct usb_device *dev = gspca_dev->dev; |
| 235 | 236 | ||
| 236 | #ifdef GSPCA_DEBUG | 237 | #ifdef GSPCA_DEBUG |
| 237 | if (len > sizeof gspca_dev->usb_buf) { | 238 | if (len > USB_BUF_SZ) { |
| 238 | err("reg_r: buffer overflow"); | 239 | err("reg_r: buffer overflow"); |
| 239 | return; | 240 | return; |
| 240 | } | 241 | } |
| @@ -272,7 +273,7 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
| 272 | struct usb_device *dev = gspca_dev->dev; | 273 | struct usb_device *dev = gspca_dev->dev; |
| 273 | 274 | ||
| 274 | #ifdef GSPCA_DEBUG | 275 | #ifdef GSPCA_DEBUG |
| 275 | if (len > sizeof gspca_dev->usb_buf) { | 276 | if (len > USB_BUF_SZ) { |
| 276 | err("reg_w: buffer overflow"); | 277 | err("reg_w: buffer overflow"); |
| 277 | return; | 278 | return; |
| 278 | } | 279 | } |
| @@ -665,6 +666,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 665 | } else { | 666 | } else { |
| 666 | cam->cam_mode = vga_mode; | 667 | cam->cam_mode = vga_mode; |
| 667 | cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; | 668 | cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; |
| 669 | gspca_dev->ctrl_dis = (1 << COLOR_IDX); | ||
| 668 | } | 670 | } |
| 669 | sd->brightness = BRIGHTNESS_DEF; | 671 | sd->brightness = BRIGHTNESS_DEF; |
| 670 | sd->contrast = CONTRAST_DEF; | 672 | sd->contrast = CONTRAST_DEF; |
| @@ -674,8 +676,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 674 | return 0; | 676 | return 0; |
| 675 | } | 677 | } |
| 676 | 678 | ||
| 677 | /* this function is called at open time */ | 679 | /* this function is called at probe and resume time */ |
| 678 | static int sd_open(struct gspca_dev *gspca_dev) | 680 | static int sd_init(struct gspca_dev *gspca_dev) |
| 679 | { | 681 | { |
| 680 | struct sd *sd = (struct sd *) gspca_dev; | 682 | struct sd *sd = (struct sd *) gspca_dev; |
| 681 | 683 | ||
| @@ -709,14 +711,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 709 | et_video(gspca_dev, 0); /* video off */ | 711 | et_video(gspca_dev, 0); /* video off */ |
| 710 | } | 712 | } |
| 711 | 713 | ||
| 712 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 713 | { | ||
| 714 | } | ||
| 715 | |||
| 716 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 717 | { | ||
| 718 | } | ||
| 719 | |||
| 720 | static __u8 Et_getgainG(struct gspca_dev *gspca_dev) | 714 | static __u8 Et_getgainG(struct gspca_dev *gspca_dev) |
| 721 | { | 715 | { |
| 722 | struct sd *sd = (struct sd *) gspca_dev; | 716 | struct sd *sd = (struct sd *) gspca_dev; |
| @@ -893,21 +887,19 @@ static struct sd_desc sd_desc = { | |||
| 893 | .ctrls = sd_ctrls, | 887 | .ctrls = sd_ctrls, |
| 894 | .nctrls = ARRAY_SIZE(sd_ctrls), | 888 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 895 | .config = sd_config, | 889 | .config = sd_config, |
| 896 | .open = sd_open, | 890 | .init = sd_init, |
| 897 | .start = sd_start, | 891 | .start = sd_start, |
| 898 | .stopN = sd_stopN, | 892 | .stopN = sd_stopN, |
| 899 | .stop0 = sd_stop0, | ||
| 900 | .close = sd_close, | ||
| 901 | .pkt_scan = sd_pkt_scan, | 893 | .pkt_scan = sd_pkt_scan, |
| 902 | .dq_callback = do_autogain, | 894 | .dq_callback = do_autogain, |
| 903 | }; | 895 | }; |
| 904 | 896 | ||
| 905 | /* -- module initialisation -- */ | 897 | /* -- module initialisation -- */ |
| 906 | static __devinitdata struct usb_device_id device_table[] = { | 898 | static __devinitdata struct usb_device_id device_table[] = { |
| 907 | #ifndef CONFIG_USB_ET61X251 | ||
| 908 | {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106}, | 899 | {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106}, |
| 909 | #endif | 900 | #if !defined CONFIG_USB_ET61X251 && !defined CONFIG_USB_ET61X251_MODULE |
| 910 | {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX}, | 901 | {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX}, |
| 902 | #endif | ||
| 911 | {} | 903 | {} |
| 912 | }; | 904 | }; |
| 913 | 905 | ||
| @@ -926,6 +918,10 @@ static struct usb_driver sd_driver = { | |||
| 926 | .id_table = device_table, | 918 | .id_table = device_table, |
| 927 | .probe = sd_probe, | 919 | .probe = sd_probe, |
| 928 | .disconnect = gspca_disconnect, | 920 | .disconnect = gspca_disconnect, |
| 921 | #ifdef CONFIG_PM | ||
| 922 | .suspend = gspca_suspend, | ||
| 923 | .resume = gspca_resume, | ||
| 924 | #endif | ||
| 929 | }; | 925 | }; |
| 930 | 926 | ||
| 931 | /* -- module insert / remove -- */ | 927 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 15d302b28b79..7be69284da03 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
| @@ -114,7 +114,10 @@ static void fill_frame(struct gspca_dev *gspca_dev, | |||
| 114 | cam_pkt_op pkt_scan; | 114 | cam_pkt_op pkt_scan; |
| 115 | 115 | ||
| 116 | if (urb->status != 0) { | 116 | if (urb->status != 0) { |
| 117 | PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status); | 117 | #ifdef CONFIG_PM |
| 118 | if (!gspca_dev->frozen) | ||
| 119 | #endif | ||
| 120 | PDEBUG(D_ERR|D_PACK, "urb status: %d", urb->status); | ||
| 118 | return; /* disconnection ? */ | 121 | return; /* disconnection ? */ |
| 119 | } | 122 | } |
| 120 | pkt_scan = gspca_dev->sd_desc->pkt_scan; | 123 | pkt_scan = gspca_dev->sd_desc->pkt_scan; |
| @@ -555,10 +558,12 @@ static void gspca_stream_off(struct gspca_dev *gspca_dev) | |||
| 555 | gspca_dev->streaming = 0; | 558 | gspca_dev->streaming = 0; |
| 556 | atomic_set(&gspca_dev->nevent, 0); | 559 | atomic_set(&gspca_dev->nevent, 0); |
| 557 | if (gspca_dev->present) { | 560 | if (gspca_dev->present) { |
| 558 | gspca_dev->sd_desc->stopN(gspca_dev); | 561 | if (gspca_dev->sd_desc->stopN) |
| 562 | gspca_dev->sd_desc->stopN(gspca_dev); | ||
| 559 | destroy_urbs(gspca_dev); | 563 | destroy_urbs(gspca_dev); |
| 560 | gspca_set_alt0(gspca_dev); | 564 | gspca_set_alt0(gspca_dev); |
| 561 | gspca_dev->sd_desc->stop0(gspca_dev); | 565 | if (gspca_dev->sd_desc->stop0) |
| 566 | gspca_dev->sd_desc->stop0(gspca_dev); | ||
| 562 | PDEBUG(D_STREAM, "stream off OK"); | 567 | PDEBUG(D_STREAM, "stream off OK"); |
| 563 | } | 568 | } |
| 564 | } | 569 | } |
| @@ -767,19 +772,7 @@ static int dev_open(struct inode *inode, struct file *file) | |||
| 767 | goto out; | 772 | goto out; |
| 768 | } | 773 | } |
| 769 | 774 | ||
| 770 | /* if not done yet, initialize the sensor */ | 775 | if (gspca_dev->users > 4) { /* (arbitrary value) */ |
| 771 | if (gspca_dev->users == 0) { | ||
| 772 | if (mutex_lock_interruptible(&gspca_dev->usb_lock)) { | ||
| 773 | ret = -ERESTARTSYS; | ||
| 774 | goto out; | ||
| 775 | } | ||
| 776 | ret = gspca_dev->sd_desc->open(gspca_dev); | ||
| 777 | mutex_unlock(&gspca_dev->usb_lock); | ||
| 778 | if (ret != 0) { | ||
| 779 | PDEBUG(D_ERR|D_CONF, "init device failed %d", ret); | ||
| 780 | goto out; | ||
| 781 | } | ||
| 782 | } else if (gspca_dev->users > 4) { /* (arbitrary value) */ | ||
| 783 | ret = -EBUSY; | 776 | ret = -EBUSY; |
| 784 | goto out; | 777 | goto out; |
| 785 | } | 778 | } |
| @@ -792,6 +785,7 @@ static int dev_open(struct inode *inode, struct file *file) | |||
| 792 | else | 785 | else |
| 793 | gspca_dev->vdev.debug &= ~3; | 786 | gspca_dev->vdev.debug &= ~3; |
| 794 | #endif | 787 | #endif |
| 788 | ret = 0; | ||
| 795 | out: | 789 | out: |
| 796 | mutex_unlock(&gspca_dev->queue_lock); | 790 | mutex_unlock(&gspca_dev->queue_lock); |
| 797 | if (ret != 0) | 791 | if (ret != 0) |
| @@ -812,11 +806,11 @@ static int dev_close(struct inode *inode, struct file *file) | |||
| 812 | 806 | ||
| 813 | /* if the file did the capture, free the streaming resources */ | 807 | /* if the file did the capture, free the streaming resources */ |
| 814 | if (gspca_dev->capt_file == file) { | 808 | if (gspca_dev->capt_file == file) { |
| 815 | mutex_lock(&gspca_dev->usb_lock); | 809 | if (gspca_dev->streaming) { |
| 816 | if (gspca_dev->streaming) | 810 | mutex_lock(&gspca_dev->usb_lock); |
| 817 | gspca_stream_off(gspca_dev); | 811 | gspca_stream_off(gspca_dev); |
| 818 | gspca_dev->sd_desc->close(gspca_dev); | 812 | mutex_unlock(&gspca_dev->usb_lock); |
| 819 | mutex_unlock(&gspca_dev->usb_lock); | 813 | } |
| 820 | frame_free(gspca_dev); | 814 | frame_free(gspca_dev); |
| 821 | gspca_dev->capt_file = NULL; | 815 | gspca_dev->capt_file = NULL; |
| 822 | gspca_dev->memory = GSPCA_MEMORY_NO; | 816 | gspca_dev->memory = GSPCA_MEMORY_NO; |
| @@ -853,42 +847,44 @@ static int vidioc_querycap(struct file *file, void *priv, | |||
| 853 | return 0; | 847 | return 0; |
| 854 | } | 848 | } |
| 855 | 849 | ||
| 856 | /* the use of V4L2_CTRL_FLAG_NEXT_CTRL asks for the controls to be sorted */ | ||
| 857 | static int vidioc_queryctrl(struct file *file, void *priv, | 850 | static int vidioc_queryctrl(struct file *file, void *priv, |
| 858 | struct v4l2_queryctrl *q_ctrl) | 851 | struct v4l2_queryctrl *q_ctrl) |
| 859 | { | 852 | { |
| 860 | struct gspca_dev *gspca_dev = priv; | 853 | struct gspca_dev *gspca_dev = priv; |
| 861 | int i; | 854 | int i, ix; |
| 862 | u32 id; | 855 | u32 id; |
| 863 | 856 | ||
| 857 | ix = -1; | ||
| 864 | id = q_ctrl->id; | 858 | id = q_ctrl->id; |
| 865 | if (id & V4L2_CTRL_FLAG_NEXT_CTRL) { | 859 | if (id & V4L2_CTRL_FLAG_NEXT_CTRL) { |
| 866 | id &= V4L2_CTRL_ID_MASK; | 860 | id &= V4L2_CTRL_ID_MASK; |
| 867 | id++; | 861 | id++; |
| 868 | for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) { | 862 | for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) { |
| 869 | if (id >= gspca_dev->sd_desc->ctrls[i].qctrl.id) { | 863 | if (gspca_dev->sd_desc->ctrls[i].qctrl.id < id) |
| 870 | memcpy(q_ctrl, | 864 | continue; |
| 871 | &gspca_dev->sd_desc->ctrls[i].qctrl, | 865 | if (ix < 0) { |
| 872 | sizeof *q_ctrl); | 866 | ix = i; |
| 873 | return 0; | 867 | continue; |
| 874 | } | 868 | } |
| 869 | if (gspca_dev->sd_desc->ctrls[i].qctrl.id | ||
| 870 | > gspca_dev->sd_desc->ctrls[ix].qctrl.id) | ||
| 871 | continue; | ||
| 872 | ix = i; | ||
| 875 | } | 873 | } |
| 876 | return -EINVAL; | ||
| 877 | } | 874 | } |
| 878 | for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) { | 875 | for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) { |
| 879 | if (id == gspca_dev->sd_desc->ctrls[i].qctrl.id) { | 876 | if (id == gspca_dev->sd_desc->ctrls[i].qctrl.id) { |
| 880 | memcpy(q_ctrl, | 877 | ix = i; |
| 881 | &gspca_dev->sd_desc->ctrls[i].qctrl, | 878 | break; |
| 882 | sizeof *q_ctrl); | ||
| 883 | return 0; | ||
| 884 | } | 879 | } |
| 885 | } | 880 | } |
| 886 | if (id >= V4L2_CID_BASE | 881 | if (ix < 0) |
| 887 | && id <= V4L2_CID_LASTP1) { | 882 | return -EINVAL; |
| 883 | memcpy(q_ctrl, &gspca_dev->sd_desc->ctrls[ix].qctrl, | ||
| 884 | sizeof *q_ctrl); | ||
| 885 | if (gspca_dev->ctrl_dis & (1 << ix)) | ||
| 888 | q_ctrl->flags |= V4L2_CTRL_FLAG_DISABLED; | 886 | q_ctrl->flags |= V4L2_CTRL_FLAG_DISABLED; |
| 889 | return 0; | 887 | return 0; |
| 890 | } | ||
| 891 | return -EINVAL; | ||
| 892 | } | 888 | } |
| 893 | 889 | ||
| 894 | static int vidioc_s_ctrl(struct file *file, void *priv, | 890 | static int vidioc_s_ctrl(struct file *file, void *priv, |
| @@ -903,6 +899,8 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
| 903 | i++, ctrls++) { | 899 | i++, ctrls++) { |
| 904 | if (ctrl->id != ctrls->qctrl.id) | 900 | if (ctrl->id != ctrls->qctrl.id) |
| 905 | continue; | 901 | continue; |
| 902 | if (gspca_dev->ctrl_dis & (1 << i)) | ||
| 903 | return -EINVAL; | ||
| 906 | if (ctrl->value < ctrls->qctrl.minimum | 904 | if (ctrl->value < ctrls->qctrl.minimum |
| 907 | || ctrl->value > ctrls->qctrl.maximum) | 905 | || ctrl->value > ctrls->qctrl.maximum) |
| 908 | return -ERANGE; | 906 | return -ERANGE; |
| @@ -929,6 +927,8 @@ static int vidioc_g_ctrl(struct file *file, void *priv, | |||
| 929 | i++, ctrls++) { | 927 | i++, ctrls++) { |
| 930 | if (ctrl->id != ctrls->qctrl.id) | 928 | if (ctrl->id != ctrls->qctrl.id) |
| 931 | continue; | 929 | continue; |
| 930 | if (gspca_dev->ctrl_dis & (1 << i)) | ||
| 931 | return -EINVAL; | ||
| 932 | if (mutex_lock_interruptible(&gspca_dev->usb_lock)) | 932 | if (mutex_lock_interruptible(&gspca_dev->usb_lock)) |
| 933 | return -ERESTARTSYS; | 933 | return -ERESTARTSYS; |
| 934 | ret = ctrls->get(gspca_dev, &ctrl->value); | 934 | ret = ctrls->get(gspca_dev, &ctrl->value); |
| @@ -1403,7 +1403,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, | |||
| 1403 | i = ret; /* frame index */ | 1403 | i = ret; /* frame index */ |
| 1404 | frame = &gspca_dev->frame[i]; | 1404 | frame = &gspca_dev->frame[i]; |
| 1405 | if (gspca_dev->memory == V4L2_MEMORY_USERPTR) { | 1405 | if (gspca_dev->memory == V4L2_MEMORY_USERPTR) { |
| 1406 | if (copy_to_user((__u8 *) frame->v4l2_buf.m.userptr, | 1406 | if (copy_to_user((__u8 __user *) frame->v4l2_buf.m.userptr, |
| 1407 | frame->data, | 1407 | frame->data, |
| 1408 | frame->v4l2_buf.bytesused)) { | 1408 | frame->v4l2_buf.bytesused)) { |
| 1409 | PDEBUG(D_ERR|D_STREAM, | 1409 | PDEBUG(D_ERR|D_STREAM, |
| @@ -1731,6 +1731,12 @@ int gspca_dev_probe(struct usb_interface *intf, | |||
| 1731 | err("couldn't kzalloc gspca struct"); | 1731 | err("couldn't kzalloc gspca struct"); |
| 1732 | return -EIO; | 1732 | return -EIO; |
| 1733 | } | 1733 | } |
| 1734 | gspca_dev->usb_buf = kmalloc(USB_BUF_SZ, GFP_KERNEL); | ||
| 1735 | if (!gspca_dev->usb_buf) { | ||
| 1736 | err("out of memory"); | ||
| 1737 | ret = -EIO; | ||
| 1738 | goto out; | ||
| 1739 | } | ||
| 1734 | gspca_dev->dev = dev; | 1740 | gspca_dev->dev = dev; |
| 1735 | gspca_dev->iface = interface->bInterfaceNumber; | 1741 | gspca_dev->iface = interface->bInterfaceNumber; |
| 1736 | gspca_dev->nbalt = intf->num_altsetting; | 1742 | gspca_dev->nbalt = intf->num_altsetting; |
| @@ -1738,10 +1744,13 @@ int gspca_dev_probe(struct usb_interface *intf, | |||
| 1738 | /* gspca_dev->users = 0; (done by kzalloc) */ | 1744 | /* gspca_dev->users = 0; (done by kzalloc) */ |
| 1739 | gspca_dev->nbufread = 2; | 1745 | gspca_dev->nbufread = 2; |
| 1740 | 1746 | ||
| 1741 | /* configure the subdriver */ | 1747 | /* configure the subdriver and initialize the USB device */ |
| 1742 | ret = gspca_dev->sd_desc->config(gspca_dev, id); | 1748 | ret = gspca_dev->sd_desc->config(gspca_dev, id); |
| 1743 | if (ret < 0) | 1749 | if (ret < 0) |
| 1744 | goto out; | 1750 | goto out; |
| 1751 | ret = gspca_dev->sd_desc->init(gspca_dev); | ||
| 1752 | if (ret < 0) | ||
| 1753 | goto out; | ||
| 1745 | ret = gspca_set_alt0(gspca_dev); | 1754 | ret = gspca_set_alt0(gspca_dev); |
| 1746 | if (ret < 0) | 1755 | if (ret < 0) |
| 1747 | goto out; | 1756 | goto out; |
| @@ -1771,6 +1780,7 @@ int gspca_dev_probe(struct usb_interface *intf, | |||
| 1771 | PDEBUG(D_PROBE, "probe ok"); | 1780 | PDEBUG(D_PROBE, "probe ok"); |
| 1772 | return 0; | 1781 | return 0; |
| 1773 | out: | 1782 | out: |
| 1783 | kfree(gspca_dev->usb_buf); | ||
| 1774 | kfree(gspca_dev); | 1784 | kfree(gspca_dev); |
| 1775 | return ret; | 1785 | return ret; |
| 1776 | } | 1786 | } |
| @@ -1803,11 +1813,42 @@ void gspca_disconnect(struct usb_interface *intf) | |||
| 1803 | /* We don't want people trying to open up the device */ | 1813 | /* We don't want people trying to open up the device */ |
| 1804 | video_unregister_device(&gspca_dev->vdev); | 1814 | video_unregister_device(&gspca_dev->vdev); |
| 1805 | /* Free the memory */ | 1815 | /* Free the memory */ |
| 1816 | kfree(gspca_dev->usb_buf); | ||
| 1806 | kfree(gspca_dev); | 1817 | kfree(gspca_dev); |
| 1807 | PDEBUG(D_PROBE, "disconnect complete"); | 1818 | PDEBUG(D_PROBE, "disconnect complete"); |
| 1808 | } | 1819 | } |
| 1809 | EXPORT_SYMBOL(gspca_disconnect); | 1820 | EXPORT_SYMBOL(gspca_disconnect); |
| 1810 | 1821 | ||
| 1822 | #ifdef CONFIG_PM | ||
| 1823 | int gspca_suspend(struct usb_interface *intf, pm_message_t message) | ||
| 1824 | { | ||
| 1825 | struct gspca_dev *gspca_dev = usb_get_intfdata(intf); | ||
| 1826 | |||
| 1827 | if (!gspca_dev->streaming) | ||
| 1828 | return 0; | ||
| 1829 | gspca_dev->frozen = 1; /* avoid urb error messages */ | ||
| 1830 | if (gspca_dev->sd_desc->stopN) | ||
| 1831 | gspca_dev->sd_desc->stopN(gspca_dev); | ||
| 1832 | destroy_urbs(gspca_dev); | ||
| 1833 | gspca_set_alt0(gspca_dev); | ||
| 1834 | if (gspca_dev->sd_desc->stop0) | ||
| 1835 | gspca_dev->sd_desc->stop0(gspca_dev); | ||
| 1836 | return 0; | ||
| 1837 | } | ||
| 1838 | EXPORT_SYMBOL(gspca_suspend); | ||
| 1839 | |||
| 1840 | int gspca_resume(struct usb_interface *intf) | ||
| 1841 | { | ||
| 1842 | struct gspca_dev *gspca_dev = usb_get_intfdata(intf); | ||
| 1843 | |||
| 1844 | gspca_dev->frozen = 0; | ||
| 1845 | gspca_dev->sd_desc->init(gspca_dev); | ||
| 1846 | if (gspca_dev->streaming) | ||
| 1847 | return gspca_init_transfer(gspca_dev); | ||
| 1848 | return 0; | ||
| 1849 | } | ||
| 1850 | EXPORT_SYMBOL(gspca_resume); | ||
| 1851 | #endif | ||
| 1811 | /* -- cam driver utility functions -- */ | 1852 | /* -- cam driver utility functions -- */ |
| 1812 | 1853 | ||
| 1813 | /* auto gain and exposure algorithm based on the knee algorithm described here: | 1854 | /* auto gain and exposure algorithm based on the knee algorithm described here: |
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h index 67e448940eaa..c17625cff9ba 100644 --- a/drivers/media/video/gspca/gspca.h +++ b/drivers/media/video/gspca/gspca.h | |||
| @@ -56,7 +56,6 @@ extern int gspca_debug; | |||
| 56 | 56 | ||
| 57 | /* device information - set at probe time */ | 57 | /* device information - set at probe time */ |
| 58 | struct cam { | 58 | struct cam { |
| 59 | char *dev_name; | ||
| 60 | struct v4l2_pix_format *cam_mode; /* size nmodes */ | 59 | struct v4l2_pix_format *cam_mode; /* size nmodes */ |
| 61 | char nmodes; | 60 | char nmodes; |
| 62 | __u8 epaddr; | 61 | __u8 epaddr; |
| @@ -91,15 +90,14 @@ struct sd_desc { | |||
| 91 | /* controls */ | 90 | /* controls */ |
| 92 | const struct ctrl *ctrls; | 91 | const struct ctrl *ctrls; |
| 93 | int nctrls; | 92 | int nctrls; |
| 94 | /* operations */ | 93 | /* mandatory operations */ |
| 95 | cam_cf_op config; /* called on probe */ | 94 | cam_cf_op config; /* called on probe */ |
| 96 | cam_op open; /* called on open */ | 95 | cam_op init; /* called on probe and resume */ |
| 97 | cam_v_op start; /* called on stream on */ | 96 | cam_v_op start; /* called on stream on */ |
| 98 | cam_v_op stopN; /* called on stream off - main alt */ | ||
| 99 | cam_v_op stop0; /* called on stream off - alt 0 */ | ||
| 100 | cam_v_op close; /* called on close */ | ||
| 101 | cam_pkt_op pkt_scan; | 97 | cam_pkt_op pkt_scan; |
| 102 | /* optional operations */ | 98 | /* optional operations */ |
| 99 | cam_v_op stopN; /* called on stream off - main alt */ | ||
| 100 | cam_v_op stop0; /* called on stream off - alt 0 */ | ||
| 103 | cam_v_op dq_callback; /* called when a frame has been dequeued */ | 101 | cam_v_op dq_callback; /* called when a frame has been dequeued */ |
| 104 | cam_jpg_op get_jcomp; | 102 | cam_jpg_op get_jcomp; |
| 105 | cam_jpg_op set_jcomp; | 103 | cam_jpg_op set_jcomp; |
| @@ -127,8 +125,10 @@ struct gspca_dev { | |||
| 127 | 125 | ||
| 128 | struct cam cam; /* device information */ | 126 | struct cam cam; /* device information */ |
| 129 | const struct sd_desc *sd_desc; /* subdriver description */ | 127 | const struct sd_desc *sd_desc; /* subdriver description */ |
| 128 | unsigned ctrl_dis; /* disabled controls (bit map) */ | ||
| 130 | 129 | ||
| 131 | __u8 usb_buf[8]; /* buffer for USB exchanges */ | 130 | #define USB_BUF_SZ 64 |
| 131 | __u8 *usb_buf; /* buffer for USB exchanges */ | ||
| 132 | struct urb *urb[MAX_NURBS]; | 132 | struct urb *urb[MAX_NURBS]; |
| 133 | 133 | ||
| 134 | __u8 *frbuf; /* buffer for nframes */ | 134 | __u8 *frbuf; /* buffer for nframes */ |
| @@ -155,6 +155,9 @@ struct gspca_dev { | |||
| 155 | struct mutex queue_lock; /* ISOC queue protection */ | 155 | struct mutex queue_lock; /* ISOC queue protection */ |
| 156 | __u32 sequence; /* frame sequence number */ | 156 | __u32 sequence; /* frame sequence number */ |
| 157 | char streaming; | 157 | char streaming; |
| 158 | #ifdef CONFIG_PM | ||
| 159 | char frozen; /* suspend - resume */ | ||
| 160 | #endif | ||
| 158 | char users; /* number of opens */ | 161 | char users; /* number of opens */ |
| 159 | char present; /* device connected */ | 162 | char present; /* device connected */ |
| 160 | char nbufread; /* number of buffers for read() */ | 163 | char nbufread; /* number of buffers for read() */ |
| @@ -174,6 +177,10 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, | |||
| 174 | struct gspca_frame *frame, | 177 | struct gspca_frame *frame, |
| 175 | const __u8 *data, | 178 | const __u8 *data, |
| 176 | int len); | 179 | int len); |
| 180 | #ifdef CONFIG_PM | ||
| 181 | int gspca_suspend(struct usb_interface *intf, pm_message_t message); | ||
| 182 | int gspca_resume(struct usb_interface *intf); | ||
| 183 | #endif | ||
| 177 | int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum, | 184 | int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum, |
| 178 | int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee); | 185 | int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee); |
| 179 | #endif /* GSPCAV2_H */ | 186 | #endif /* GSPCAV2_H */ |
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c index 21c4ee56a10a..4d5db47ba8cb 100644 --- a/drivers/media/video/gspca/mars.c +++ b/drivers/media/video/gspca/mars.c | |||
| @@ -100,22 +100,6 @@ static int reg_w(struct gspca_dev *gspca_dev, | |||
| 100 | return rc; | 100 | return rc; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | static int reg_w_buf(struct gspca_dev *gspca_dev, | ||
| 104 | __u16 index, __u8 *buf, int len) | ||
| 105 | { | ||
| 106 | int rc; | ||
| 107 | |||
| 108 | rc = usb_control_msg(gspca_dev->dev, | ||
| 109 | usb_sndbulkpipe(gspca_dev->dev, 4), | ||
| 110 | 0x12, | ||
| 111 | 0xc8, /* ?? */ | ||
| 112 | 0, /* value */ | ||
| 113 | index, buf, len, 500); | ||
| 114 | if (rc < 0) | ||
| 115 | PDEBUG(D_ERR, "reg write [%02x] error %d", index, rc); | ||
| 116 | return rc; | ||
| 117 | } | ||
| 118 | |||
| 119 | static void bulk_w(struct gspca_dev *gspca_dev, | 103 | static void bulk_w(struct gspca_dev *gspca_dev, |
| 120 | __u16 *pch, | 104 | __u16 *pch, |
| 121 | __u16 Address) | 105 | __u16 Address) |
| @@ -144,8 +128,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 144 | return 0; | 128 | return 0; |
| 145 | } | 129 | } |
| 146 | 130 | ||
| 147 | /* this function is called at open time */ | 131 | /* this function is called at probe and resume time */ |
| 148 | static int sd_open(struct gspca_dev *gspca_dev) | 132 | static int sd_init(struct gspca_dev *gspca_dev) |
| 149 | { | 133 | { |
| 150 | return 0; | 134 | return 0; |
| 151 | } | 135 | } |
| @@ -175,7 +159,6 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 175 | /* | 159 | /* |
| 176 | Initialize the MR97113 chip register | 160 | Initialize the MR97113 chip register |
| 177 | */ | 161 | */ |
| 178 | data = kmalloc(16, GFP_KERNEL); | ||
| 179 | data[0] = 0x00; /* address */ | 162 | data[0] = 0x00; /* address */ |
| 180 | data[1] = 0x0c | 0x01; /* reg 0 */ | 163 | data[1] = 0x0c | 0x01; /* reg 0 */ |
| 181 | data[2] = 0x01; /* reg 1 */ | 164 | data[2] = 0x01; /* reg 1 */ |
| @@ -195,12 +178,10 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 195 | data[10] = 0x5d; /* reg 9, I2C device address | 178 | data[10] = 0x5d; /* reg 9, I2C device address |
| 196 | * [for PAS5101 (0x40)] [for MI (0x5d)] */ | 179 | * [for PAS5101 (0x40)] [for MI (0x5d)] */ |
| 197 | 180 | ||
| 198 | err_code = reg_w_buf(gspca_dev, data[0], data, 11); | 181 | err_code = reg_w(gspca_dev, data[0], 11); |
| 199 | kfree(data); | ||
| 200 | if (err_code < 0) | 182 | if (err_code < 0) |
| 201 | return; | 183 | return; |
| 202 | 184 | ||
| 203 | data = gspca_dev->usb_buf; | ||
| 204 | data[0] = 0x23; /* address */ | 185 | data[0] = 0x23; /* address */ |
| 205 | data[1] = 0x09; /* reg 35, append frame header */ | 186 | data[1] = 0x09; /* reg 35, append frame header */ |
| 206 | 187 | ||
| @@ -358,14 +339,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 358 | PDEBUG(D_ERR, "Camera Stop failed"); | 339 | PDEBUG(D_ERR, "Camera Stop failed"); |
| 359 | } | 340 | } |
| 360 | 341 | ||
| 361 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 362 | { | ||
| 363 | } | ||
| 364 | |||
| 365 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 366 | { | ||
| 367 | } | ||
| 368 | |||
| 369 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 342 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 370 | struct gspca_frame *frame, /* target */ | 343 | struct gspca_frame *frame, /* target */ |
| 371 | __u8 *data, /* isoc packet */ | 344 | __u8 *data, /* isoc packet */ |
| @@ -411,11 +384,9 @@ static const struct sd_desc sd_desc = { | |||
| 411 | .ctrls = sd_ctrls, | 384 | .ctrls = sd_ctrls, |
| 412 | .nctrls = ARRAY_SIZE(sd_ctrls), | 385 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 413 | .config = sd_config, | 386 | .config = sd_config, |
| 414 | .open = sd_open, | 387 | .init = sd_init, |
| 415 | .start = sd_start, | 388 | .start = sd_start, |
| 416 | .stopN = sd_stopN, | 389 | .stopN = sd_stopN, |
| 417 | .stop0 = sd_stop0, | ||
| 418 | .close = sd_close, | ||
| 419 | .pkt_scan = sd_pkt_scan, | 390 | .pkt_scan = sd_pkt_scan, |
| 420 | }; | 391 | }; |
| 421 | 392 | ||
| @@ -439,6 +410,10 @@ static struct usb_driver sd_driver = { | |||
| 439 | .id_table = device_table, | 410 | .id_table = device_table, |
| 440 | .probe = sd_probe, | 411 | .probe = sd_probe, |
| 441 | .disconnect = gspca_disconnect, | 412 | .disconnect = gspca_disconnect, |
| 413 | #ifdef CONFIG_PM | ||
| 414 | .suspend = gspca_suspend, | ||
| 415 | .resume = gspca_resume, | ||
| 416 | #endif | ||
| 442 | }; | 417 | }; |
| 443 | 418 | ||
| 444 | /* -- module insert / remove -- */ | 419 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index b4f00ec0885c..4df4eec9f7e7 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c | |||
| @@ -63,11 +63,10 @@ struct sd { | |||
| 63 | #define SEN_OV6630 2 | 63 | #define SEN_OV6630 2 |
| 64 | #define SEN_OV7610 3 | 64 | #define SEN_OV7610 3 |
| 65 | #define SEN_OV7620 4 | 65 | #define SEN_OV7620 4 |
| 66 | #define SEN_OV7630 5 | 66 | #define SEN_OV7640 5 |
| 67 | #define SEN_OV7640 6 | 67 | #define SEN_OV7670 6 |
| 68 | #define SEN_OV7670 7 | 68 | #define SEN_OV76BE 7 |
| 69 | #define SEN_OV76BE 8 | 69 | #define SEN_OV8610 8 |
| 70 | #define SEN_OV8610 9 | ||
| 71 | 70 | ||
| 72 | }; | 71 | }; |
| 73 | 72 | ||
| @@ -127,6 +126,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 127 | .get = sd_getcolors, | 126 | .get = sd_getcolors, |
| 128 | }, | 127 | }, |
| 129 | /* next controls work with ov7670 only */ | 128 | /* next controls work with ov7670 only */ |
| 129 | #define HFLIP_IDX 3 | ||
| 130 | { | 130 | { |
| 131 | { | 131 | { |
| 132 | .id = V4L2_CID_HFLIP, | 132 | .id = V4L2_CID_HFLIP, |
| @@ -141,6 +141,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 141 | .set = sd_sethflip, | 141 | .set = sd_sethflip, |
| 142 | .get = sd_gethflip, | 142 | .get = sd_gethflip, |
| 143 | }, | 143 | }, |
| 144 | #define VFLIP_IDX 4 | ||
| 144 | { | 145 | { |
| 145 | { | 146 | { |
| 146 | .id = V4L2_CID_VFLIP, | 147 | .id = V4L2_CID_VFLIP, |
| @@ -293,6 +294,541 @@ static struct v4l2_pix_format sif_mode[] = { | |||
| 293 | #define OV7670_REG_HAECC7 0xaa /* Hist AEC/AGC control 7 */ | 294 | #define OV7670_REG_HAECC7 0xaa /* Hist AEC/AGC control 7 */ |
| 294 | #define OV7670_REG_BD60MAX 0xab /* 60hz banding step limit */ | 295 | #define OV7670_REG_BD60MAX 0xab /* 60hz banding step limit */ |
| 295 | 296 | ||
| 297 | struct ov_regvals { | ||
| 298 | __u8 reg; | ||
| 299 | __u8 val; | ||
| 300 | }; | ||
| 301 | struct ov_i2c_regvals { | ||
| 302 | __u8 reg; | ||
| 303 | __u8 val; | ||
| 304 | }; | ||
| 305 | |||
| 306 | static const struct ov_i2c_regvals norm_6x20[] = { | ||
| 307 | { 0x12, 0x80 }, /* reset */ | ||
| 308 | { 0x11, 0x01 }, | ||
| 309 | { 0x03, 0x60 }, | ||
| 310 | { 0x05, 0x7f }, /* For when autoadjust is off */ | ||
| 311 | { 0x07, 0xa8 }, | ||
| 312 | /* The ratio of 0x0c and 0x0d controls the white point */ | ||
| 313 | { 0x0c, 0x24 }, | ||
| 314 | { 0x0d, 0x24 }, | ||
| 315 | { 0x0f, 0x15 }, /* COMS */ | ||
| 316 | { 0x10, 0x75 }, /* AEC Exposure time */ | ||
| 317 | { 0x12, 0x24 }, /* Enable AGC */ | ||
| 318 | { 0x14, 0x04 }, | ||
| 319 | /* 0x16: 0x06 helps frame stability with moving objects */ | ||
| 320 | { 0x16, 0x06 }, | ||
| 321 | /* { 0x20, 0x30 }, * Aperture correction enable */ | ||
| 322 | { 0x26, 0xb2 }, /* BLC enable */ | ||
| 323 | /* 0x28: 0x05 Selects RGB format if RGB on */ | ||
| 324 | { 0x28, 0x05 }, | ||
| 325 | { 0x2a, 0x04 }, /* Disable framerate adjust */ | ||
| 326 | /* { 0x2b, 0xac }, * Framerate; Set 2a[7] first */ | ||
| 327 | { 0x2d, 0x99 }, | ||
| 328 | { 0x33, 0xa0 }, /* Color Processing Parameter */ | ||
| 329 | { 0x34, 0xd2 }, /* Max A/D range */ | ||
| 330 | { 0x38, 0x8b }, | ||
| 331 | { 0x39, 0x40 }, | ||
| 332 | |||
| 333 | { 0x3c, 0x39 }, /* Enable AEC mode changing */ | ||
| 334 | { 0x3c, 0x3c }, /* Change AEC mode */ | ||
| 335 | { 0x3c, 0x24 }, /* Disable AEC mode changing */ | ||
| 336 | |||
| 337 | { 0x3d, 0x80 }, | ||
| 338 | /* These next two registers (0x4a, 0x4b) are undocumented. | ||
| 339 | * They control the color balance */ | ||
| 340 | { 0x4a, 0x80 }, | ||
| 341 | { 0x4b, 0x80 }, | ||
| 342 | { 0x4d, 0xd2 }, /* This reduces noise a bit */ | ||
| 343 | { 0x4e, 0xc1 }, | ||
| 344 | { 0x4f, 0x04 }, | ||
| 345 | /* Do 50-53 have any effect? */ | ||
| 346 | /* Toggle 0x12[2] off and on here? */ | ||
| 347 | }; | ||
| 348 | |||
| 349 | static const struct ov_i2c_regvals norm_6x30[] = { | ||
| 350 | { 0x12, 0x80 }, /* Reset */ | ||
| 351 | { 0x00, 0x1f }, /* Gain */ | ||
| 352 | { 0x01, 0x99 }, /* Blue gain */ | ||
| 353 | { 0x02, 0x7c }, /* Red gain */ | ||
| 354 | { 0x03, 0xc0 }, /* Saturation */ | ||
| 355 | { 0x05, 0x0a }, /* Contrast */ | ||
| 356 | { 0x06, 0x95 }, /* Brightness */ | ||
| 357 | { 0x07, 0x2d }, /* Sharpness */ | ||
| 358 | { 0x0c, 0x20 }, | ||
| 359 | { 0x0d, 0x20 }, | ||
| 360 | { 0x0e, 0x20 }, | ||
| 361 | { 0x0f, 0x05 }, | ||
| 362 | { 0x10, 0x9a }, | ||
| 363 | { 0x11, 0x00 }, /* Pixel clock = fastest */ | ||
| 364 | { 0x12, 0x24 }, /* Enable AGC and AWB */ | ||
| 365 | { 0x13, 0x21 }, | ||
| 366 | { 0x14, 0x80 }, | ||
| 367 | { 0x15, 0x01 }, | ||
| 368 | { 0x16, 0x03 }, | ||
| 369 | { 0x17, 0x38 }, | ||
| 370 | { 0x18, 0xea }, | ||
| 371 | { 0x19, 0x04 }, | ||
| 372 | { 0x1a, 0x93 }, | ||
| 373 | { 0x1b, 0x00 }, | ||
| 374 | { 0x1e, 0xc4 }, | ||
| 375 | { 0x1f, 0x04 }, | ||
| 376 | { 0x20, 0x20 }, | ||
| 377 | { 0x21, 0x10 }, | ||
| 378 | { 0x22, 0x88 }, | ||
| 379 | { 0x23, 0xc0 }, /* Crystal circuit power level */ | ||
| 380 | { 0x25, 0x9a }, /* Increase AEC black ratio */ | ||
| 381 | { 0x26, 0xb2 }, /* BLC enable */ | ||
| 382 | { 0x27, 0xa2 }, | ||
| 383 | { 0x28, 0x00 }, | ||
| 384 | { 0x29, 0x00 }, | ||
| 385 | { 0x2a, 0x84 }, /* 60 Hz power */ | ||
| 386 | { 0x2b, 0xa8 }, /* 60 Hz power */ | ||
| 387 | { 0x2c, 0xa0 }, | ||
| 388 | { 0x2d, 0x95 }, /* Enable auto-brightness */ | ||
| 389 | { 0x2e, 0x88 }, | ||
| 390 | { 0x33, 0x26 }, | ||
| 391 | { 0x34, 0x03 }, | ||
| 392 | { 0x36, 0x8f }, | ||
| 393 | { 0x37, 0x80 }, | ||
| 394 | { 0x38, 0x83 }, | ||
| 395 | { 0x39, 0x80 }, | ||
| 396 | { 0x3a, 0x0f }, | ||
| 397 | { 0x3b, 0x3c }, | ||
| 398 | { 0x3c, 0x1a }, | ||
| 399 | { 0x3d, 0x80 }, | ||
| 400 | { 0x3e, 0x80 }, | ||
| 401 | { 0x3f, 0x0e }, | ||
| 402 | { 0x40, 0x00 }, /* White bal */ | ||
| 403 | { 0x41, 0x00 }, /* White bal */ | ||
| 404 | { 0x42, 0x80 }, | ||
| 405 | { 0x43, 0x3f }, /* White bal */ | ||
| 406 | { 0x44, 0x80 }, | ||
| 407 | { 0x45, 0x20 }, | ||
| 408 | { 0x46, 0x20 }, | ||
| 409 | { 0x47, 0x80 }, | ||
| 410 | { 0x48, 0x7f }, | ||
| 411 | { 0x49, 0x00 }, | ||
| 412 | { 0x4a, 0x00 }, | ||
| 413 | { 0x4b, 0x80 }, | ||
| 414 | { 0x4c, 0xd0 }, | ||
| 415 | { 0x4d, 0x10 }, /* U = 0.563u, V = 0.714v */ | ||
| 416 | { 0x4e, 0x40 }, | ||
| 417 | { 0x4f, 0x07 }, /* UV avg., col. killer: max */ | ||
| 418 | { 0x50, 0xff }, | ||
| 419 | { 0x54, 0x23 }, /* Max AGC gain: 18dB */ | ||
| 420 | { 0x55, 0xff }, | ||
| 421 | { 0x56, 0x12 }, | ||
| 422 | { 0x57, 0x81 }, | ||
| 423 | { 0x58, 0x75 }, | ||
| 424 | { 0x59, 0x01 }, /* AGC dark current comp.: +1 */ | ||
| 425 | { 0x5a, 0x2c }, | ||
| 426 | { 0x5b, 0x0f }, /* AWB chrominance levels */ | ||
| 427 | { 0x5c, 0x10 }, | ||
| 428 | { 0x3d, 0x80 }, | ||
| 429 | { 0x27, 0xa6 }, | ||
| 430 | { 0x12, 0x20 }, /* Toggle AWB */ | ||
| 431 | { 0x12, 0x24 }, | ||
| 432 | }; | ||
| 433 | |||
| 434 | /* Lawrence Glaister <lg@jfm.bc.ca> reports: | ||
| 435 | * | ||
| 436 | * Register 0x0f in the 7610 has the following effects: | ||
| 437 | * | ||
| 438 | * 0x85 (AEC method 1): Best overall, good contrast range | ||
| 439 | * 0x45 (AEC method 2): Very overexposed | ||
| 440 | * 0xa5 (spec sheet default): Ok, but the black level is | ||
| 441 | * shifted resulting in loss of contrast | ||
| 442 | * 0x05 (old driver setting): very overexposed, too much | ||
| 443 | * contrast | ||
| 444 | */ | ||
| 445 | static const struct ov_i2c_regvals norm_7610[] = { | ||
| 446 | { 0x10, 0xff }, | ||
| 447 | { 0x16, 0x06 }, | ||
| 448 | { 0x28, 0x24 }, | ||
| 449 | { 0x2b, 0xac }, | ||
| 450 | { 0x12, 0x00 }, | ||
| 451 | { 0x38, 0x81 }, | ||
| 452 | { 0x28, 0x24 }, /* 0c */ | ||
| 453 | { 0x0f, 0x85 }, /* lg's setting */ | ||
| 454 | { 0x15, 0x01 }, | ||
| 455 | { 0x20, 0x1c }, | ||
| 456 | { 0x23, 0x2a }, | ||
| 457 | { 0x24, 0x10 }, | ||
| 458 | { 0x25, 0x8a }, | ||
| 459 | { 0x26, 0xa2 }, | ||
| 460 | { 0x27, 0xc2 }, | ||
| 461 | { 0x2a, 0x04 }, | ||
| 462 | { 0x2c, 0xfe }, | ||
| 463 | { 0x2d, 0x93 }, | ||
| 464 | { 0x30, 0x71 }, | ||
| 465 | { 0x31, 0x60 }, | ||
| 466 | { 0x32, 0x26 }, | ||
| 467 | { 0x33, 0x20 }, | ||
| 468 | { 0x34, 0x48 }, | ||
| 469 | { 0x12, 0x24 }, | ||
| 470 | { 0x11, 0x01 }, | ||
| 471 | { 0x0c, 0x24 }, | ||
| 472 | { 0x0d, 0x24 }, | ||
| 473 | }; | ||
| 474 | |||
| 475 | static const struct ov_i2c_regvals norm_7620[] = { | ||
| 476 | { 0x00, 0x00 }, /* gain */ | ||
| 477 | { 0x01, 0x80 }, /* blue gain */ | ||
| 478 | { 0x02, 0x80 }, /* red gain */ | ||
| 479 | { 0x03, 0xc0 }, /* OV7670_REG_VREF */ | ||
| 480 | { 0x06, 0x60 }, | ||
| 481 | { 0x07, 0x00 }, | ||
| 482 | { 0x0c, 0x24 }, | ||
| 483 | { 0x0c, 0x24 }, | ||
| 484 | { 0x0d, 0x24 }, | ||
| 485 | { 0x11, 0x01 }, | ||
| 486 | { 0x12, 0x24 }, | ||
| 487 | { 0x13, 0x01 }, | ||
| 488 | { 0x14, 0x84 }, | ||
| 489 | { 0x15, 0x01 }, | ||
| 490 | { 0x16, 0x03 }, | ||
| 491 | { 0x17, 0x2f }, | ||
| 492 | { 0x18, 0xcf }, | ||
| 493 | { 0x19, 0x06 }, | ||
| 494 | { 0x1a, 0xf5 }, | ||
| 495 | { 0x1b, 0x00 }, | ||
| 496 | { 0x20, 0x18 }, | ||
| 497 | { 0x21, 0x80 }, | ||
| 498 | { 0x22, 0x80 }, | ||
| 499 | { 0x23, 0x00 }, | ||
| 500 | { 0x26, 0xa2 }, | ||
| 501 | { 0x27, 0xea }, | ||
| 502 | { 0x28, 0x20 }, | ||
| 503 | { 0x29, 0x00 }, | ||
| 504 | { 0x2a, 0x10 }, | ||
| 505 | { 0x2b, 0x00 }, | ||
| 506 | { 0x2c, 0x88 }, | ||
| 507 | { 0x2d, 0x91 }, | ||
| 508 | { 0x2e, 0x80 }, | ||
| 509 | { 0x2f, 0x44 }, | ||
| 510 | { 0x60, 0x27 }, | ||
| 511 | { 0x61, 0x02 }, | ||
| 512 | { 0x62, 0x5f }, | ||
| 513 | { 0x63, 0xd5 }, | ||
| 514 | { 0x64, 0x57 }, | ||
| 515 | { 0x65, 0x83 }, | ||
| 516 | { 0x66, 0x55 }, | ||
| 517 | { 0x67, 0x92 }, | ||
| 518 | { 0x68, 0xcf }, | ||
| 519 | { 0x69, 0x76 }, | ||
| 520 | { 0x6a, 0x22 }, | ||
| 521 | { 0x6b, 0x00 }, | ||
| 522 | { 0x6c, 0x02 }, | ||
| 523 | { 0x6d, 0x44 }, | ||
| 524 | { 0x6e, 0x80 }, | ||
| 525 | { 0x6f, 0x1d }, | ||
| 526 | { 0x70, 0x8b }, | ||
| 527 | { 0x71, 0x00 }, | ||
| 528 | { 0x72, 0x14 }, | ||
| 529 | { 0x73, 0x54 }, | ||
| 530 | { 0x74, 0x00 }, | ||
| 531 | { 0x75, 0x8e }, | ||
| 532 | { 0x76, 0x00 }, | ||
| 533 | { 0x77, 0xff }, | ||
| 534 | { 0x78, 0x80 }, | ||
| 535 | { 0x79, 0x80 }, | ||
| 536 | { 0x7a, 0x80 }, | ||
| 537 | { 0x7b, 0xe2 }, | ||
| 538 | { 0x7c, 0x00 }, | ||
| 539 | }; | ||
| 540 | |||
| 541 | /* 7640 and 7648. The defaults should be OK for most registers. */ | ||
| 542 | static const struct ov_i2c_regvals norm_7640[] = { | ||
| 543 | { 0x12, 0x80 }, | ||
| 544 | { 0x12, 0x14 }, | ||
| 545 | }; | ||
| 546 | |||
| 547 | /* 7670. Defaults taken from OmniVision provided data, | ||
| 548 | * as provided by Jonathan Corbet of OLPC */ | ||
| 549 | static const struct ov_i2c_regvals norm_7670[] = { | ||
| 550 | { OV7670_REG_COM7, OV7670_COM7_RESET }, | ||
| 551 | { OV7670_REG_TSLB, 0x04 }, /* OV */ | ||
| 552 | { OV7670_REG_COM7, OV7670_COM7_FMT_VGA }, /* VGA */ | ||
| 553 | { OV7670_REG_CLKRC, 0x01 }, | ||
| 554 | /* | ||
| 555 | * Set the hardware window. These values from OV don't entirely | ||
| 556 | * make sense - hstop is less than hstart. But they work... | ||
| 557 | */ | ||
| 558 | { OV7670_REG_HSTART, 0x13 }, | ||
| 559 | { OV7670_REG_HSTOP, 0x01 }, | ||
| 560 | { OV7670_REG_HREF, 0xb6 }, | ||
| 561 | { OV7670_REG_VSTART, 0x02 }, | ||
| 562 | { OV7670_REG_VSTOP, 0x7a }, | ||
| 563 | { OV7670_REG_VREF, 0x0a }, | ||
| 564 | |||
| 565 | { OV7670_REG_COM3, 0 }, | ||
| 566 | { OV7670_REG_COM14, 0 }, | ||
| 567 | /* Mystery scaling numbers */ | ||
| 568 | { 0x70, 0x3a }, | ||
| 569 | { 0x71, 0x35 }, | ||
| 570 | { 0x72, 0x11 }, | ||
| 571 | { 0x73, 0xf0 }, | ||
| 572 | { 0xa2, 0x02 }, | ||
| 573 | /* { OV7670_REG_COM10, 0x0 }, */ | ||
| 574 | |||
| 575 | /* Gamma curve values */ | ||
| 576 | { 0x7a, 0x20 }, | ||
| 577 | { 0x7b, 0x10 }, | ||
| 578 | { 0x7c, 0x1e }, | ||
| 579 | { 0x7d, 0x35 }, | ||
| 580 | { 0x7e, 0x5a }, | ||
| 581 | { 0x7f, 0x69 }, | ||
| 582 | { 0x80, 0x76 }, | ||
| 583 | { 0x81, 0x80 }, | ||
| 584 | { 0x82, 0x88 }, | ||
| 585 | { 0x83, 0x8f }, | ||
| 586 | { 0x84, 0x96 }, | ||
| 587 | { 0x85, 0xa3 }, | ||
| 588 | { 0x86, 0xaf }, | ||
| 589 | { 0x87, 0xc4 }, | ||
| 590 | { 0x88, 0xd7 }, | ||
| 591 | { 0x89, 0xe8 }, | ||
| 592 | |||
| 593 | /* AGC and AEC parameters. Note we start by disabling those features, | ||
| 594 | then turn them only after tweaking the values. */ | ||
| 595 | { OV7670_REG_COM8, OV7670_COM8_FASTAEC | ||
| 596 | | OV7670_COM8_AECSTEP | ||
| 597 | | OV7670_COM8_BFILT }, | ||
| 598 | { OV7670_REG_GAIN, 0 }, | ||
| 599 | { OV7670_REG_AECH, 0 }, | ||
| 600 | { OV7670_REG_COM4, 0x40 }, /* magic reserved bit */ | ||
| 601 | { OV7670_REG_COM9, 0x18 }, /* 4x gain + magic rsvd bit */ | ||
| 602 | { OV7670_REG_BD50MAX, 0x05 }, | ||
| 603 | { OV7670_REG_BD60MAX, 0x07 }, | ||
| 604 | { OV7670_REG_AEW, 0x95 }, | ||
| 605 | { OV7670_REG_AEB, 0x33 }, | ||
| 606 | { OV7670_REG_VPT, 0xe3 }, | ||
| 607 | { OV7670_REG_HAECC1, 0x78 }, | ||
| 608 | { OV7670_REG_HAECC2, 0x68 }, | ||
| 609 | { 0xa1, 0x03 }, /* magic */ | ||
| 610 | { OV7670_REG_HAECC3, 0xd8 }, | ||
| 611 | { OV7670_REG_HAECC4, 0xd8 }, | ||
| 612 | { OV7670_REG_HAECC5, 0xf0 }, | ||
| 613 | { OV7670_REG_HAECC6, 0x90 }, | ||
| 614 | { OV7670_REG_HAECC7, 0x94 }, | ||
| 615 | { OV7670_REG_COM8, OV7670_COM8_FASTAEC | ||
| 616 | | OV7670_COM8_AECSTEP | ||
| 617 | | OV7670_COM8_BFILT | ||
| 618 | | OV7670_COM8_AGC | ||
| 619 | | OV7670_COM8_AEC }, | ||
| 620 | |||
| 621 | /* Almost all of these are magic "reserved" values. */ | ||
| 622 | { OV7670_REG_COM5, 0x61 }, | ||
| 623 | { OV7670_REG_COM6, 0x4b }, | ||
| 624 | { 0x16, 0x02 }, | ||
| 625 | { OV7670_REG_MVFP, 0x07 }, | ||
| 626 | { 0x21, 0x02 }, | ||
| 627 | { 0x22, 0x91 }, | ||
| 628 | { 0x29, 0x07 }, | ||
| 629 | { 0x33, 0x0b }, | ||
| 630 | { 0x35, 0x0b }, | ||
| 631 | { 0x37, 0x1d }, | ||
| 632 | { 0x38, 0x71 }, | ||
| 633 | { 0x39, 0x2a }, | ||
| 634 | { OV7670_REG_COM12, 0x78 }, | ||
| 635 | { 0x4d, 0x40 }, | ||
| 636 | { 0x4e, 0x20 }, | ||
| 637 | { OV7670_REG_GFIX, 0 }, | ||
| 638 | { 0x6b, 0x4a }, | ||
| 639 | { 0x74, 0x10 }, | ||
| 640 | { 0x8d, 0x4f }, | ||
| 641 | { 0x8e, 0 }, | ||
| 642 | { 0x8f, 0 }, | ||
| 643 | { 0x90, 0 }, | ||
| 644 | { 0x91, 0 }, | ||
| 645 | { 0x96, 0 }, | ||
| 646 | { 0x9a, 0 }, | ||
| 647 | { 0xb0, 0x84 }, | ||
| 648 | { 0xb1, 0x0c }, | ||
| 649 | { 0xb2, 0x0e }, | ||
| 650 | { 0xb3, 0x82 }, | ||
| 651 | { 0xb8, 0x0a }, | ||
| 652 | |||
| 653 | /* More reserved magic, some of which tweaks white balance */ | ||
| 654 | { 0x43, 0x0a }, | ||
| 655 | { 0x44, 0xf0 }, | ||
| 656 | { 0x45, 0x34 }, | ||
| 657 | { 0x46, 0x58 }, | ||
| 658 | { 0x47, 0x28 }, | ||
| 659 | { 0x48, 0x3a }, | ||
| 660 | { 0x59, 0x88 }, | ||
| 661 | { 0x5a, 0x88 }, | ||
| 662 | { 0x5b, 0x44 }, | ||
| 663 | { 0x5c, 0x67 }, | ||
| 664 | { 0x5d, 0x49 }, | ||
| 665 | { 0x5e, 0x0e }, | ||
| 666 | { 0x6c, 0x0a }, | ||
| 667 | { 0x6d, 0x55 }, | ||
| 668 | { 0x6e, 0x11 }, | ||
| 669 | { 0x6f, 0x9f }, | ||
| 670 | /* "9e for advance AWB" */ | ||
| 671 | { 0x6a, 0x40 }, | ||
| 672 | { OV7670_REG_BLUE, 0x40 }, | ||
| 673 | { OV7670_REG_RED, 0x60 }, | ||
| 674 | { OV7670_REG_COM8, OV7670_COM8_FASTAEC | ||
| 675 | | OV7670_COM8_AECSTEP | ||
| 676 | | OV7670_COM8_BFILT | ||
| 677 | | OV7670_COM8_AGC | ||
| 678 | | OV7670_COM8_AEC | ||
| 679 | | OV7670_COM8_AWB }, | ||
| 680 | |||
| 681 | /* Matrix coefficients */ | ||
| 682 | { 0x4f, 0x80 }, | ||
| 683 | { 0x50, 0x80 }, | ||
| 684 | { 0x51, 0 }, | ||
| 685 | { 0x52, 0x22 }, | ||
| 686 | { 0x53, 0x5e }, | ||
| 687 | { 0x54, 0x80 }, | ||
| 688 | { 0x58, 0x9e }, | ||
| 689 | |||
| 690 | { OV7670_REG_COM16, OV7670_COM16_AWBGAIN }, | ||
| 691 | { OV7670_REG_EDGE, 0 }, | ||
| 692 | { 0x75, 0x05 }, | ||
| 693 | { 0x76, 0xe1 }, | ||
| 694 | { 0x4c, 0 }, | ||
| 695 | { 0x77, 0x01 }, | ||
| 696 | { OV7670_REG_COM13, OV7670_COM13_GAMMA | ||
| 697 | | OV7670_COM13_UVSAT | ||
| 698 | | 2}, /* was 3 */ | ||
| 699 | { 0x4b, 0x09 }, | ||
| 700 | { 0xc9, 0x60 }, | ||
| 701 | { OV7670_REG_COM16, 0x38 }, | ||
| 702 | { 0x56, 0x40 }, | ||
| 703 | |||
| 704 | { 0x34, 0x11 }, | ||
| 705 | { OV7670_REG_COM11, OV7670_COM11_EXP|OV7670_COM11_HZAUTO }, | ||
| 706 | { 0xa4, 0x88 }, | ||
| 707 | { 0x96, 0 }, | ||
| 708 | { 0x97, 0x30 }, | ||
| 709 | { 0x98, 0x20 }, | ||
| 710 | { 0x99, 0x30 }, | ||
| 711 | { 0x9a, 0x84 }, | ||
| 712 | { 0x9b, 0x29 }, | ||
| 713 | { 0x9c, 0x03 }, | ||
| 714 | { 0x9d, 0x4c }, | ||
| 715 | { 0x9e, 0x3f }, | ||
| 716 | { 0x78, 0x04 }, | ||
| 717 | |||
| 718 | /* Extra-weird stuff. Some sort of multiplexor register */ | ||
| 719 | { 0x79, 0x01 }, | ||
| 720 | { 0xc8, 0xf0 }, | ||
| 721 | { 0x79, 0x0f }, | ||
| 722 | { 0xc8, 0x00 }, | ||
| 723 | { 0x79, 0x10 }, | ||
| 724 | { 0xc8, 0x7e }, | ||
| 725 | { 0x79, 0x0a }, | ||
| 726 | { 0xc8, 0x80 }, | ||
| 727 | { 0x79, 0x0b }, | ||
| 728 | { 0xc8, 0x01 }, | ||
| 729 | { 0x79, 0x0c }, | ||
| 730 | { 0xc8, 0x0f }, | ||
| 731 | { 0x79, 0x0d }, | ||
| 732 | { 0xc8, 0x20 }, | ||
| 733 | { 0x79, 0x09 }, | ||
| 734 | { 0xc8, 0x80 }, | ||
| 735 | { 0x79, 0x02 }, | ||
| 736 | { 0xc8, 0xc0 }, | ||
| 737 | { 0x79, 0x03 }, | ||
| 738 | { 0xc8, 0x40 }, | ||
| 739 | { 0x79, 0x05 }, | ||
| 740 | { 0xc8, 0x30 }, | ||
| 741 | { 0x79, 0x26 }, | ||
| 742 | }; | ||
| 743 | |||
| 744 | static const struct ov_i2c_regvals norm_8610[] = { | ||
| 745 | { 0x12, 0x80 }, | ||
| 746 | { 0x00, 0x00 }, | ||
| 747 | { 0x01, 0x80 }, | ||
| 748 | { 0x02, 0x80 }, | ||
| 749 | { 0x03, 0xc0 }, | ||
| 750 | { 0x04, 0x30 }, | ||
| 751 | { 0x05, 0x30 }, /* was 0x10, new from windrv 090403 */ | ||
| 752 | { 0x06, 0x70 }, /* was 0x80, new from windrv 090403 */ | ||
| 753 | { 0x0a, 0x86 }, | ||
| 754 | { 0x0b, 0xb0 }, | ||
| 755 | { 0x0c, 0x20 }, | ||
| 756 | { 0x0d, 0x20 }, | ||
| 757 | { 0x11, 0x01 }, | ||
| 758 | { 0x12, 0x25 }, | ||
| 759 | { 0x13, 0x01 }, | ||
| 760 | { 0x14, 0x04 }, | ||
| 761 | { 0x15, 0x01 }, /* Lin and Win think different about UV order */ | ||
| 762 | { 0x16, 0x03 }, | ||
| 763 | { 0x17, 0x38 }, /* was 0x2f, new from windrv 090403 */ | ||
| 764 | { 0x18, 0xea }, /* was 0xcf, new from windrv 090403 */ | ||
| 765 | { 0x19, 0x02 }, /* was 0x06, new from windrv 090403 */ | ||
| 766 | { 0x1a, 0xf5 }, | ||
| 767 | { 0x1b, 0x00 }, | ||
| 768 | { 0x20, 0xd0 }, /* was 0x90, new from windrv 090403 */ | ||
| 769 | { 0x23, 0xc0 }, /* was 0x00, new from windrv 090403 */ | ||
| 770 | { 0x24, 0x30 }, /* was 0x1d, new from windrv 090403 */ | ||
| 771 | { 0x25, 0x50 }, /* was 0x57, new from windrv 090403 */ | ||
| 772 | { 0x26, 0xa2 }, | ||
| 773 | { 0x27, 0xea }, | ||
| 774 | { 0x28, 0x00 }, | ||
| 775 | { 0x29, 0x00 }, | ||
| 776 | { 0x2a, 0x80 }, | ||
| 777 | { 0x2b, 0xc8 }, /* was 0xcc, new from windrv 090403 */ | ||
| 778 | { 0x2c, 0xac }, | ||
| 779 | { 0x2d, 0x45 }, /* was 0xd5, new from windrv 090403 */ | ||
| 780 | { 0x2e, 0x80 }, | ||
| 781 | { 0x2f, 0x14 }, /* was 0x01, new from windrv 090403 */ | ||
| 782 | { 0x4c, 0x00 }, | ||
| 783 | { 0x4d, 0x30 }, /* was 0x10, new from windrv 090403 */ | ||
| 784 | { 0x60, 0x02 }, /* was 0x01, new from windrv 090403 */ | ||
| 785 | { 0x61, 0x00 }, /* was 0x09, new from windrv 090403 */ | ||
| 786 | { 0x62, 0x5f }, /* was 0xd7, new from windrv 090403 */ | ||
| 787 | { 0x63, 0xff }, | ||
| 788 | { 0x64, 0x53 }, /* new windrv 090403 says 0x57, | ||
| 789 | * maybe thats wrong */ | ||
| 790 | { 0x65, 0x00 }, | ||
| 791 | { 0x66, 0x55 }, | ||
| 792 | { 0x67, 0xb0 }, | ||
| 793 | { 0x68, 0xc0 }, /* was 0xaf, new from windrv 090403 */ | ||
| 794 | { 0x69, 0x02 }, | ||
| 795 | { 0x6a, 0x22 }, | ||
| 796 | { 0x6b, 0x00 }, | ||
| 797 | { 0x6c, 0x99 }, /* was 0x80, old windrv says 0x00, but | ||
| 798 | * deleting bit7 colors the first images red */ | ||
| 799 | { 0x6d, 0x11 }, /* was 0x00, new from windrv 090403 */ | ||
| 800 | { 0x6e, 0x11 }, /* was 0x00, new from windrv 090403 */ | ||
| 801 | { 0x6f, 0x01 }, | ||
| 802 | { 0x70, 0x8b }, | ||
| 803 | { 0x71, 0x00 }, | ||
| 804 | { 0x72, 0x14 }, | ||
| 805 | { 0x73, 0x54 }, | ||
| 806 | { 0x74, 0x00 },/* 0x60? - was 0x00, new from windrv 090403 */ | ||
| 807 | { 0x75, 0x0e }, | ||
| 808 | { 0x76, 0x02 }, /* was 0x02, new from windrv 090403 */ | ||
| 809 | { 0x77, 0xff }, | ||
| 810 | { 0x78, 0x80 }, | ||
| 811 | { 0x79, 0x80 }, | ||
| 812 | { 0x7a, 0x80 }, | ||
| 813 | { 0x7b, 0x10 }, /* was 0x13, new from windrv 090403 */ | ||
| 814 | { 0x7c, 0x00 }, | ||
| 815 | { 0x7d, 0x08 }, /* was 0x09, new from windrv 090403 */ | ||
| 816 | { 0x7e, 0x08 }, /* was 0xc0, new from windrv 090403 */ | ||
| 817 | { 0x7f, 0xfb }, | ||
| 818 | { 0x80, 0x28 }, | ||
| 819 | { 0x81, 0x00 }, | ||
| 820 | { 0x82, 0x23 }, | ||
| 821 | { 0x83, 0x0b }, | ||
| 822 | { 0x84, 0x00 }, | ||
| 823 | { 0x85, 0x62 }, /* was 0x61, new from windrv 090403 */ | ||
| 824 | { 0x86, 0xc9 }, | ||
| 825 | { 0x87, 0x00 }, | ||
| 826 | { 0x88, 0x00 }, | ||
| 827 | { 0x89, 0x01 }, | ||
| 828 | { 0x12, 0x20 }, | ||
| 829 | { 0x12, 0x25 }, /* was 0x24, new from windrv 090403 */ | ||
| 830 | }; | ||
| 831 | |||
| 296 | static unsigned char ov7670_abs_to_sm(unsigned char v) | 832 | static unsigned char ov7670_abs_to_sm(unsigned char v) |
| 297 | { | 833 | { |
| 298 | if (v > 127) | 834 | if (v > 127) |
| @@ -537,18 +1073,10 @@ static int ov51x_set_slave_ids(struct sd *sd, | |||
| 537 | rc = reg_w(sd, R51x_I2C_W_SID, slave); | 1073 | rc = reg_w(sd, R51x_I2C_W_SID, slave); |
| 538 | if (rc < 0) | 1074 | if (rc < 0) |
| 539 | return rc; | 1075 | return rc; |
| 1076 | sd->primary_i2c_slave = slave; | ||
| 540 | return reg_w(sd, R51x_I2C_R_SID, slave + 1); | 1077 | return reg_w(sd, R51x_I2C_R_SID, slave + 1); |
| 541 | } | 1078 | } |
| 542 | 1079 | ||
| 543 | struct ov_regvals { | ||
| 544 | __u8 reg; | ||
| 545 | __u8 val; | ||
| 546 | }; | ||
| 547 | struct ov_i2c_regvals { | ||
| 548 | __u8 reg; | ||
| 549 | __u8 val; | ||
| 550 | }; | ||
| 551 | |||
| 552 | static int write_regvals(struct sd *sd, | 1080 | static int write_regvals(struct sd *sd, |
| 553 | const struct ov_regvals *regvals, | 1081 | const struct ov_regvals *regvals, |
| 554 | int n) | 1082 | int n) |
| @@ -591,101 +1119,9 @@ static int write_i2c_regvals(struct sd *sd, | |||
| 591 | static int ov8xx0_configure(struct sd *sd) | 1119 | static int ov8xx0_configure(struct sd *sd) |
| 592 | { | 1120 | { |
| 593 | int rc; | 1121 | int rc; |
| 594 | static const struct ov_i2c_regvals norm_8610[] = { | ||
| 595 | { 0x12, 0x80 }, | ||
| 596 | { 0x00, 0x00 }, | ||
| 597 | { 0x01, 0x80 }, | ||
| 598 | { 0x02, 0x80 }, | ||
| 599 | { 0x03, 0xc0 }, | ||
| 600 | { 0x04, 0x30 }, | ||
| 601 | { 0x05, 0x30 }, /* was 0x10, new from windrv 090403 */ | ||
| 602 | { 0x06, 0x70 }, /* was 0x80, new from windrv 090403 */ | ||
| 603 | { 0x0a, 0x86 }, | ||
| 604 | { 0x0b, 0xb0 }, | ||
| 605 | { 0x0c, 0x20 }, | ||
| 606 | { 0x0d, 0x20 }, | ||
| 607 | { 0x11, 0x01 }, | ||
| 608 | { 0x12, 0x25 }, | ||
| 609 | { 0x13, 0x01 }, | ||
| 610 | { 0x14, 0x04 }, | ||
| 611 | { 0x15, 0x01 }, /* Lin and Win think different about UV order */ | ||
| 612 | { 0x16, 0x03 }, | ||
| 613 | { 0x17, 0x38 }, /* was 0x2f, new from windrv 090403 */ | ||
| 614 | { 0x18, 0xea }, /* was 0xcf, new from windrv 090403 */ | ||
| 615 | { 0x19, 0x02 }, /* was 0x06, new from windrv 090403 */ | ||
| 616 | { 0x1a, 0xf5 }, | ||
| 617 | { 0x1b, 0x00 }, | ||
| 618 | { 0x20, 0xd0 }, /* was 0x90, new from windrv 090403 */ | ||
| 619 | { 0x23, 0xc0 }, /* was 0x00, new from windrv 090403 */ | ||
| 620 | { 0x24, 0x30 }, /* was 0x1d, new from windrv 090403 */ | ||
| 621 | { 0x25, 0x50 }, /* was 0x57, new from windrv 090403 */ | ||
| 622 | { 0x26, 0xa2 }, | ||
| 623 | { 0x27, 0xea }, | ||
| 624 | { 0x28, 0x00 }, | ||
| 625 | { 0x29, 0x00 }, | ||
| 626 | { 0x2a, 0x80 }, | ||
| 627 | { 0x2b, 0xc8 }, /* was 0xcc, new from windrv 090403 */ | ||
| 628 | { 0x2c, 0xac }, | ||
| 629 | { 0x2d, 0x45 }, /* was 0xd5, new from windrv 090403 */ | ||
| 630 | { 0x2e, 0x80 }, | ||
| 631 | { 0x2f, 0x14 }, /* was 0x01, new from windrv 090403 */ | ||
| 632 | { 0x4c, 0x00 }, | ||
| 633 | { 0x4d, 0x30 }, /* was 0x10, new from windrv 090403 */ | ||
| 634 | { 0x60, 0x02 }, /* was 0x01, new from windrv 090403 */ | ||
| 635 | { 0x61, 0x00 }, /* was 0x09, new from windrv 090403 */ | ||
| 636 | { 0x62, 0x5f }, /* was 0xd7, new from windrv 090403 */ | ||
| 637 | { 0x63, 0xff }, | ||
| 638 | { 0x64, 0x53 }, /* new windrv 090403 says 0x57, | ||
| 639 | * maybe thats wrong */ | ||
| 640 | { 0x65, 0x00 }, | ||
| 641 | { 0x66, 0x55 }, | ||
| 642 | { 0x67, 0xb0 }, | ||
| 643 | { 0x68, 0xc0 }, /* was 0xaf, new from windrv 090403 */ | ||
| 644 | { 0x69, 0x02 }, | ||
| 645 | { 0x6a, 0x22 }, | ||
| 646 | { 0x6b, 0x00 }, | ||
| 647 | { 0x6c, 0x99 }, /* was 0x80, old windrv says 0x00, but | ||
| 648 | deleting bit7 colors the first images red */ | ||
| 649 | { 0x6d, 0x11 }, /* was 0x00, new from windrv 090403 */ | ||
| 650 | { 0x6e, 0x11 }, /* was 0x00, new from windrv 090403 */ | ||
| 651 | { 0x6f, 0x01 }, | ||
| 652 | { 0x70, 0x8b }, | ||
| 653 | { 0x71, 0x00 }, | ||
| 654 | { 0x72, 0x14 }, | ||
| 655 | { 0x73, 0x54 }, | ||
| 656 | { 0x74, 0x00 },/* 0x60? - was 0x00, new from windrv 090403 */ | ||
| 657 | { 0x75, 0x0e }, | ||
| 658 | { 0x76, 0x02 }, /* was 0x02, new from windrv 090403 */ | ||
| 659 | { 0x77, 0xff }, | ||
| 660 | { 0x78, 0x80 }, | ||
| 661 | { 0x79, 0x80 }, | ||
| 662 | { 0x7a, 0x80 }, | ||
| 663 | { 0x7b, 0x10 }, /* was 0x13, new from windrv 090403 */ | ||
| 664 | { 0x7c, 0x00 }, | ||
| 665 | { 0x7d, 0x08 }, /* was 0x09, new from windrv 090403 */ | ||
| 666 | { 0x7e, 0x08 }, /* was 0xc0, new from windrv 090403 */ | ||
| 667 | { 0x7f, 0xfb }, | ||
| 668 | { 0x80, 0x28 }, | ||
| 669 | { 0x81, 0x00 }, | ||
| 670 | { 0x82, 0x23 }, | ||
| 671 | { 0x83, 0x0b }, | ||
| 672 | { 0x84, 0x00 }, | ||
| 673 | { 0x85, 0x62 }, /* was 0x61, new from windrv 090403 */ | ||
| 674 | { 0x86, 0xc9 }, | ||
| 675 | { 0x87, 0x00 }, | ||
| 676 | { 0x88, 0x00 }, | ||
| 677 | { 0x89, 0x01 }, | ||
| 678 | { 0x12, 0x20 }, | ||
| 679 | { 0x12, 0x25 }, /* was 0x24, new from windrv 090403 */ | ||
| 680 | }; | ||
| 681 | 1122 | ||
| 682 | PDEBUG(D_PROBE, "starting ov8xx0 configuration"); | 1123 | PDEBUG(D_PROBE, "starting ov8xx0 configuration"); |
| 683 | 1124 | ||
| 684 | if (init_ov_sensor(sd) < 0) | ||
| 685 | PDEBUG(D_ERR|D_PROBE, "Failed to read sensor ID"); | ||
| 686 | else | ||
| 687 | PDEBUG(D_PROBE, "OV86x0 initialized"); | ||
| 688 | |||
| 689 | /* Detect sensor (sub)type */ | 1125 | /* Detect sensor (sub)type */ |
| 690 | rc = i2c_r(sd, OV7610_REG_COM_I); | 1126 | rc = i2c_r(sd, OV7610_REG_COM_I); |
| 691 | if (rc < 0) { | 1127 | if (rc < 0) { |
| @@ -698,9 +1134,6 @@ static int ov8xx0_configure(struct sd *sd) | |||
| 698 | PDEBUG(D_ERR, "Unknown image sensor version: %d", rc & 3); | 1134 | PDEBUG(D_ERR, "Unknown image sensor version: %d", rc & 3); |
| 699 | return -1; | 1135 | return -1; |
| 700 | } | 1136 | } |
| 701 | PDEBUG(D_PROBE, "Writing 8610 registers"); | ||
| 702 | if (write_i2c_regvals(sd, norm_8610, ARRAY_SIZE(norm_8610))) | ||
| 703 | return -1; | ||
| 704 | 1137 | ||
| 705 | /* Set sensor-specific vars */ | 1138 | /* Set sensor-specific vars */ |
| 706 | /* sd->sif = 0; already done */ | 1139 | /* sd->sif = 0; already done */ |
| @@ -714,252 +1147,6 @@ static int ov7xx0_configure(struct sd *sd) | |||
| 714 | { | 1147 | { |
| 715 | int rc, high, low; | 1148 | int rc, high, low; |
| 716 | 1149 | ||
| 717 | /* Lawrence Glaister <lg@jfm.bc.ca> reports: | ||
| 718 | * | ||
| 719 | * Register 0x0f in the 7610 has the following effects: | ||
| 720 | * | ||
| 721 | * 0x85 (AEC method 1): Best overall, good contrast range | ||
| 722 | * 0x45 (AEC method 2): Very overexposed | ||
| 723 | * 0xa5 (spec sheet default): Ok, but the black level is | ||
| 724 | * shifted resulting in loss of contrast | ||
| 725 | * 0x05 (old driver setting): very overexposed, too much | ||
| 726 | * contrast | ||
| 727 | */ | ||
| 728 | static const struct ov_i2c_regvals norm_7610[] = { | ||
| 729 | { 0x10, 0xff }, | ||
| 730 | { 0x16, 0x06 }, | ||
| 731 | { 0x28, 0x24 }, | ||
| 732 | { 0x2b, 0xac }, | ||
| 733 | { 0x12, 0x00 }, | ||
| 734 | { 0x38, 0x81 }, | ||
| 735 | { 0x28, 0x24 }, /* 0c */ | ||
| 736 | { 0x0f, 0x85 }, /* lg's setting */ | ||
| 737 | { 0x15, 0x01 }, | ||
| 738 | { 0x20, 0x1c }, | ||
| 739 | { 0x23, 0x2a }, | ||
| 740 | { 0x24, 0x10 }, | ||
| 741 | { 0x25, 0x8a }, | ||
| 742 | { 0x26, 0xa2 }, | ||
| 743 | { 0x27, 0xc2 }, | ||
| 744 | { 0x2a, 0x04 }, | ||
| 745 | { 0x2c, 0xfe }, | ||
| 746 | { 0x2d, 0x93 }, | ||
| 747 | { 0x30, 0x71 }, | ||
| 748 | { 0x31, 0x60 }, | ||
| 749 | { 0x32, 0x26 }, | ||
| 750 | { 0x33, 0x20 }, | ||
| 751 | { 0x34, 0x48 }, | ||
| 752 | { 0x12, 0x24 }, | ||
| 753 | { 0x11, 0x01 }, | ||
| 754 | { 0x0c, 0x24 }, | ||
| 755 | { 0x0d, 0x24 }, | ||
| 756 | }; | ||
| 757 | |||
| 758 | static const struct ov_i2c_regvals norm_7620[] = { | ||
| 759 | { 0x00, 0x00 }, /* gain */ | ||
| 760 | { 0x01, 0x80 }, /* blue gain */ | ||
| 761 | { 0x02, 0x80 }, /* red gain */ | ||
| 762 | { 0x03, 0xc0 }, /* OV7670_REG_VREF */ | ||
| 763 | { 0x06, 0x60 }, | ||
| 764 | { 0x07, 0x00 }, | ||
| 765 | { 0x0c, 0x24 }, | ||
| 766 | { 0x0c, 0x24 }, | ||
| 767 | { 0x0d, 0x24 }, | ||
| 768 | { 0x11, 0x01 }, | ||
| 769 | { 0x12, 0x24 }, | ||
| 770 | { 0x13, 0x01 }, | ||
| 771 | { 0x14, 0x84 }, | ||
| 772 | { 0x15, 0x01 }, | ||
| 773 | { 0x16, 0x03 }, | ||
| 774 | { 0x17, 0x2f }, | ||
| 775 | { 0x18, 0xcf }, | ||
| 776 | { 0x19, 0x06 }, | ||
| 777 | { 0x1a, 0xf5 }, | ||
| 778 | { 0x1b, 0x00 }, | ||
| 779 | { 0x20, 0x18 }, | ||
| 780 | { 0x21, 0x80 }, | ||
| 781 | { 0x22, 0x80 }, | ||
| 782 | { 0x23, 0x00 }, | ||
| 783 | { 0x26, 0xa2 }, | ||
| 784 | { 0x27, 0xea }, | ||
| 785 | { 0x28, 0x20 }, | ||
| 786 | { 0x29, 0x00 }, | ||
| 787 | { 0x2a, 0x10 }, | ||
| 788 | { 0x2b, 0x00 }, | ||
| 789 | { 0x2c, 0x88 }, | ||
| 790 | { 0x2d, 0x91 }, | ||
| 791 | { 0x2e, 0x80 }, | ||
| 792 | { 0x2f, 0x44 }, | ||
| 793 | { 0x60, 0x27 }, | ||
| 794 | { 0x61, 0x02 }, | ||
| 795 | { 0x62, 0x5f }, | ||
| 796 | { 0x63, 0xd5 }, | ||
| 797 | { 0x64, 0x57 }, | ||
| 798 | { 0x65, 0x83 }, | ||
| 799 | { 0x66, 0x55 }, | ||
| 800 | { 0x67, 0x92 }, | ||
| 801 | { 0x68, 0xcf }, | ||
| 802 | { 0x69, 0x76 }, | ||
| 803 | { 0x6a, 0x22 }, | ||
| 804 | { 0x6b, 0x00 }, | ||
| 805 | { 0x6c, 0x02 }, | ||
| 806 | { 0x6d, 0x44 }, | ||
| 807 | { 0x6e, 0x80 }, | ||
| 808 | { 0x6f, 0x1d }, | ||
| 809 | { 0x70, 0x8b }, | ||
| 810 | { 0x71, 0x00 }, | ||
| 811 | { 0x72, 0x14 }, | ||
| 812 | { 0x73, 0x54 }, | ||
| 813 | { 0x74, 0x00 }, | ||
| 814 | { 0x75, 0x8e }, | ||
| 815 | { 0x76, 0x00 }, | ||
| 816 | { 0x77, 0xff }, | ||
| 817 | { 0x78, 0x80 }, | ||
| 818 | { 0x79, 0x80 }, | ||
| 819 | { 0x7a, 0x80 }, | ||
| 820 | { 0x7b, 0xe2 }, | ||
| 821 | { 0x7c, 0x00 }, | ||
| 822 | }; | ||
| 823 | |||
| 824 | /* 7640 and 7648. The defaults should be OK for most registers. */ | ||
| 825 | static const struct ov_i2c_regvals norm_7640[] = { | ||
| 826 | { 0x12, 0x80 }, | ||
| 827 | { 0x12, 0x14 }, | ||
| 828 | }; | ||
| 829 | |||
| 830 | /* 7670. Defaults taken from OmniVision provided data, | ||
| 831 | * as provided by Jonathan Corbet of OLPC */ | ||
| 832 | static const struct ov_i2c_regvals norm_7670[] = { | ||
| 833 | { OV7670_REG_COM7, OV7670_COM7_RESET }, | ||
| 834 | { OV7670_REG_TSLB, 0x04 }, /* OV */ | ||
| 835 | { OV7670_REG_COM7, OV7670_COM7_FMT_VGA }, /* VGA */ | ||
| 836 | { OV7670_REG_CLKRC, 0x01 }, | ||
| 837 | /* | ||
| 838 | * Set the hardware window. These values from OV don't entirely | ||
| 839 | * make sense - hstop is less than hstart. But they work... | ||
| 840 | */ | ||
| 841 | { OV7670_REG_HSTART, 0x13 }, { OV7670_REG_HSTOP, 0x01 }, | ||
| 842 | { OV7670_REG_HREF, 0xb6 }, { OV7670_REG_VSTART, 0x02 }, | ||
| 843 | { OV7670_REG_VSTOP, 0x7a }, { OV7670_REG_VREF, 0x0a }, | ||
| 844 | |||
| 845 | { OV7670_REG_COM3, 0 }, { OV7670_REG_COM14, 0 }, | ||
| 846 | /* Mystery scaling numbers */ | ||
| 847 | { 0x70, 0x3a }, { 0x71, 0x35 }, | ||
| 848 | { 0x72, 0x11 }, { 0x73, 0xf0 }, | ||
| 849 | { 0xa2, 0x02 }, | ||
| 850 | /* { OV7670_REG_COM10, 0x0 }, */ | ||
| 851 | |||
| 852 | /* Gamma curve values */ | ||
| 853 | { 0x7a, 0x20 }, | ||
| 854 | { 0x7b, 0x10 }, | ||
| 855 | { 0x7c, 0x1e }, | ||
| 856 | { 0x7d, 0x35 }, | ||
| 857 | { 0x7e, 0x5a }, { 0x7f, 0x69 }, | ||
| 858 | { 0x80, 0x76 }, { 0x81, 0x80 }, | ||
| 859 | { 0x82, 0x88 }, { 0x83, 0x8f }, | ||
| 860 | { 0x84, 0x96 }, { 0x85, 0xa3 }, | ||
| 861 | { 0x86, 0xaf }, { 0x87, 0xc4 }, | ||
| 862 | { 0x88, 0xd7 }, { 0x89, 0xe8 }, | ||
| 863 | |||
| 864 | /* AGC and AEC parameters. Note we start by disabling those features, | ||
| 865 | then turn them only after tweaking the values. */ | ||
| 866 | { OV7670_REG_COM8, OV7670_COM8_FASTAEC | ||
| 867 | | OV7670_COM8_AECSTEP | ||
| 868 | | OV7670_COM8_BFILT }, | ||
| 869 | { OV7670_REG_GAIN, 0 }, { OV7670_REG_AECH, 0 }, | ||
| 870 | { OV7670_REG_COM4, 0x40 }, /* magic reserved bit */ | ||
| 871 | { OV7670_REG_COM9, 0x18 }, /* 4x gain + magic rsvd bit */ | ||
| 872 | { OV7670_REG_BD50MAX, 0x05 }, { OV7670_REG_BD60MAX, 0x07 }, | ||
| 873 | { OV7670_REG_AEW, 0x95 }, { OV7670_REG_AEB, 0x33 }, | ||
| 874 | { OV7670_REG_VPT, 0xe3 }, { OV7670_REG_HAECC1, 0x78 }, | ||
| 875 | { OV7670_REG_HAECC2, 0x68 }, | ||
| 876 | { 0xa1, 0x03 }, /* magic */ | ||
| 877 | { OV7670_REG_HAECC3, 0xd8 }, { OV7670_REG_HAECC4, 0xd8 }, | ||
| 878 | { OV7670_REG_HAECC5, 0xf0 }, { OV7670_REG_HAECC6, 0x90 }, | ||
| 879 | { OV7670_REG_HAECC7, 0x94 }, | ||
| 880 | { OV7670_REG_COM8, OV7670_COM8_FASTAEC | ||
| 881 | | OV7670_COM8_AECSTEP | ||
| 882 | | OV7670_COM8_BFILT | ||
| 883 | | OV7670_COM8_AGC | ||
| 884 | | OV7670_COM8_AEC }, | ||
| 885 | |||
| 886 | /* Almost all of these are magic "reserved" values. */ | ||
| 887 | { OV7670_REG_COM5, 0x61 }, { OV7670_REG_COM6, 0x4b }, | ||
| 888 | { 0x16, 0x02 }, | ||
| 889 | { OV7670_REG_MVFP, 0x07 }, | ||
| 890 | { 0x21, 0x02 }, { 0x22, 0x91 }, | ||
| 891 | { 0x29, 0x07 }, { 0x33, 0x0b }, | ||
| 892 | { 0x35, 0x0b }, { 0x37, 0x1d }, | ||
| 893 | { 0x38, 0x71 }, { 0x39, 0x2a }, | ||
| 894 | { OV7670_REG_COM12, 0x78 }, { 0x4d, 0x40 }, | ||
| 895 | { 0x4e, 0x20 }, { OV7670_REG_GFIX, 0 }, | ||
| 896 | { 0x6b, 0x4a }, { 0x74, 0x10 }, | ||
| 897 | { 0x8d, 0x4f }, { 0x8e, 0 }, | ||
| 898 | { 0x8f, 0 }, { 0x90, 0 }, | ||
| 899 | { 0x91, 0 }, { 0x96, 0 }, | ||
| 900 | { 0x9a, 0 }, { 0xb0, 0x84 }, | ||
| 901 | { 0xb1, 0x0c }, { 0xb2, 0x0e }, | ||
| 902 | { 0xb3, 0x82 }, { 0xb8, 0x0a }, | ||
| 903 | |||
| 904 | /* More reserved magic, some of which tweaks white balance */ | ||
| 905 | { 0x43, 0x0a }, { 0x44, 0xf0 }, | ||
| 906 | { 0x45, 0x34 }, { 0x46, 0x58 }, | ||
| 907 | { 0x47, 0x28 }, { 0x48, 0x3a }, | ||
| 908 | { 0x59, 0x88 }, { 0x5a, 0x88 }, | ||
| 909 | { 0x5b, 0x44 }, { 0x5c, 0x67 }, | ||
| 910 | { 0x5d, 0x49 }, { 0x5e, 0x0e }, | ||
| 911 | { 0x6c, 0x0a }, { 0x6d, 0x55 }, | ||
| 912 | { 0x6e, 0x11 }, { 0x6f, 0x9f }, | ||
| 913 | /* "9e for advance AWB" */ | ||
| 914 | { 0x6a, 0x40 }, { OV7670_REG_BLUE, 0x40 }, | ||
| 915 | { OV7670_REG_RED, 0x60 }, | ||
| 916 | { OV7670_REG_COM8, OV7670_COM8_FASTAEC | ||
| 917 | | OV7670_COM8_AECSTEP | ||
| 918 | | OV7670_COM8_BFILT | ||
| 919 | | OV7670_COM8_AGC | ||
| 920 | | OV7670_COM8_AEC | ||
| 921 | | OV7670_COM8_AWB }, | ||
| 922 | |||
| 923 | /* Matrix coefficients */ | ||
| 924 | { 0x4f, 0x80 }, { 0x50, 0x80 }, | ||
| 925 | { 0x51, 0 }, { 0x52, 0x22 }, | ||
| 926 | { 0x53, 0x5e }, { 0x54, 0x80 }, | ||
| 927 | { 0x58, 0x9e }, | ||
| 928 | |||
| 929 | { OV7670_REG_COM16, OV7670_COM16_AWBGAIN }, | ||
| 930 | { OV7670_REG_EDGE, 0 }, | ||
| 931 | { 0x75, 0x05 }, { 0x76, 0xe1 }, | ||
| 932 | { 0x4c, 0 }, { 0x77, 0x01 }, | ||
| 933 | { OV7670_REG_COM13, OV7670_COM13_GAMMA | ||
| 934 | | OV7670_COM13_UVSAT | ||
| 935 | | 2}, /* was 3 */ | ||
| 936 | { 0x4b, 0x09 }, | ||
| 937 | { 0xc9, 0x60 }, { OV7670_REG_COM16, 0x38 }, | ||
| 938 | { 0x56, 0x40 }, | ||
| 939 | |||
| 940 | { 0x34, 0x11 }, | ||
| 941 | { OV7670_REG_COM11, OV7670_COM11_EXP|OV7670_COM11_HZAUTO }, | ||
| 942 | { 0xa4, 0x88 }, { 0x96, 0 }, | ||
| 943 | { 0x97, 0x30 }, { 0x98, 0x20 }, | ||
| 944 | { 0x99, 0x30 }, { 0x9a, 0x84 }, | ||
| 945 | { 0x9b, 0x29 }, { 0x9c, 0x03 }, | ||
| 946 | { 0x9d, 0x4c }, { 0x9e, 0x3f }, | ||
| 947 | { 0x78, 0x04 }, | ||
| 948 | |||
| 949 | /* Extra-weird stuff. Some sort of multiplexor register */ | ||
| 950 | { 0x79, 0x01 }, { 0xc8, 0xf0 }, | ||
| 951 | { 0x79, 0x0f }, { 0xc8, 0x00 }, | ||
| 952 | { 0x79, 0x10 }, { 0xc8, 0x7e }, | ||
| 953 | { 0x79, 0x0a }, { 0xc8, 0x80 }, | ||
| 954 | { 0x79, 0x0b }, { 0xc8, 0x01 }, | ||
| 955 | { 0x79, 0x0c }, { 0xc8, 0x0f }, | ||
| 956 | { 0x79, 0x0d }, { 0xc8, 0x20 }, | ||
| 957 | { 0x79, 0x09 }, { 0xc8, 0x80 }, | ||
| 958 | { 0x79, 0x02 }, { 0xc8, 0xc0 }, | ||
| 959 | { 0x79, 0x03 }, { 0xc8, 0x40 }, | ||
| 960 | { 0x79, 0x05 }, { 0xc8, 0x30 }, | ||
| 961 | { 0x79, 0x26 }, | ||
| 962 | }; | ||
| 963 | 1150 | ||
| 964 | PDEBUG(D_PROBE, "starting OV7xx0 configuration"); | 1151 | PDEBUG(D_PROBE, "starting OV7xx0 configuration"); |
| 965 | 1152 | ||
| @@ -1011,8 +1198,9 @@ static int ov7xx0_configure(struct sd *sd) | |||
| 1011 | switch (low) { | 1198 | switch (low) { |
| 1012 | case 0x30: | 1199 | case 0x30: |
| 1013 | PDEBUG(D_PROBE, "Sensor is an OV7630/OV7635"); | 1200 | PDEBUG(D_PROBE, "Sensor is an OV7630/OV7635"); |
| 1014 | sd->sensor = SEN_OV7630; | 1201 | PDEBUG(D_ERR, |
| 1015 | break; | 1202 | "7630 is not supported by this driver"); |
| 1203 | return -1; | ||
| 1016 | case 0x40: | 1204 | case 0x40: |
| 1017 | PDEBUG(D_PROBE, "Sensor is an OV7645"); | 1205 | PDEBUG(D_PROBE, "Sensor is an OV7645"); |
| 1018 | sd->sensor = SEN_OV7640; /* FIXME */ | 1206 | sd->sensor = SEN_OV7640; /* FIXME */ |
| @@ -1038,32 +1226,6 @@ static int ov7xx0_configure(struct sd *sd) | |||
| 1038 | return -1; | 1226 | return -1; |
| 1039 | } | 1227 | } |
| 1040 | 1228 | ||
| 1041 | switch (sd->sensor) { | ||
| 1042 | case SEN_OV7620: | ||
| 1043 | PDEBUG(D_PROBE, "Writing 7620 registers"); | ||
| 1044 | if (write_i2c_regvals(sd, norm_7620, ARRAY_SIZE(norm_7620))) | ||
| 1045 | return -1; | ||
| 1046 | break; | ||
| 1047 | case SEN_OV7630: | ||
| 1048 | PDEBUG(D_ERR, "7630 is not supported by this driver version"); | ||
| 1049 | return -1; | ||
| 1050 | case SEN_OV7640: | ||
| 1051 | PDEBUG(D_PROBE, "Writing 7640 registers"); | ||
| 1052 | if (write_i2c_regvals(sd, norm_7640, ARRAY_SIZE(norm_7640))) | ||
| 1053 | return -1; | ||
| 1054 | break; | ||
| 1055 | case SEN_OV7670: | ||
| 1056 | PDEBUG(D_PROBE, "Writing 7670 registers"); | ||
| 1057 | if (write_i2c_regvals(sd, norm_7670, ARRAY_SIZE(norm_7670))) | ||
| 1058 | return -1; | ||
| 1059 | break; | ||
| 1060 | default: | ||
| 1061 | PDEBUG(D_PROBE, "Writing 7610 registers"); | ||
| 1062 | if (write_i2c_regvals(sd, norm_7610, ARRAY_SIZE(norm_7610))) | ||
| 1063 | return -1; | ||
| 1064 | break; | ||
| 1065 | } | ||
| 1066 | |||
| 1067 | /* Set sensor-specific vars */ | 1229 | /* Set sensor-specific vars */ |
| 1068 | /* sd->sif = 0; already done */ | 1230 | /* sd->sif = 0; already done */ |
| 1069 | return 0; | 1231 | return 0; |
| @@ -1073,141 +1235,7 @@ static int ov7xx0_configure(struct sd *sd) | |||
| 1073 | static int ov6xx0_configure(struct sd *sd) | 1235 | static int ov6xx0_configure(struct sd *sd) |
| 1074 | { | 1236 | { |
| 1075 | int rc; | 1237 | int rc; |
| 1076 | static const struct ov_i2c_regvals norm_6x20[] = { | 1238 | PDEBUG(D_PROBE, "starting OV6xx0 configuration"); |
| 1077 | { 0x12, 0x80 }, /* reset */ | ||
| 1078 | { 0x11, 0x01 }, | ||
| 1079 | { 0x03, 0x60 }, | ||
| 1080 | { 0x05, 0x7f }, /* For when autoadjust is off */ | ||
| 1081 | { 0x07, 0xa8 }, | ||
| 1082 | /* The ratio of 0x0c and 0x0d controls the white point */ | ||
| 1083 | { 0x0c, 0x24 }, | ||
| 1084 | { 0x0d, 0x24 }, | ||
| 1085 | { 0x0f, 0x15 }, /* COMS */ | ||
| 1086 | { 0x10, 0x75 }, /* AEC Exposure time */ | ||
| 1087 | { 0x12, 0x24 }, /* Enable AGC */ | ||
| 1088 | { 0x14, 0x04 }, | ||
| 1089 | /* 0x16: 0x06 helps frame stability with moving objects */ | ||
| 1090 | { 0x16, 0x06 }, | ||
| 1091 | /* { 0x20, 0x30 }, * Aperture correction enable */ | ||
| 1092 | { 0x26, 0xb2 }, /* BLC enable */ | ||
| 1093 | /* 0x28: 0x05 Selects RGB format if RGB on */ | ||
| 1094 | { 0x28, 0x05 }, | ||
| 1095 | { 0x2a, 0x04 }, /* Disable framerate adjust */ | ||
| 1096 | /* { 0x2b, 0xac }, * Framerate; Set 2a[7] first */ | ||
| 1097 | { 0x2d, 0x99 }, | ||
| 1098 | { 0x33, 0xa0 }, /* Color Processing Parameter */ | ||
| 1099 | { 0x34, 0xd2 }, /* Max A/D range */ | ||
| 1100 | { 0x38, 0x8b }, | ||
| 1101 | { 0x39, 0x40 }, | ||
| 1102 | |||
| 1103 | { 0x3c, 0x39 }, /* Enable AEC mode changing */ | ||
| 1104 | { 0x3c, 0x3c }, /* Change AEC mode */ | ||
| 1105 | { 0x3c, 0x24 }, /* Disable AEC mode changing */ | ||
| 1106 | |||
| 1107 | { 0x3d, 0x80 }, | ||
| 1108 | /* These next two registers (0x4a, 0x4b) are undocumented. | ||
| 1109 | * They control the color balance */ | ||
| 1110 | { 0x4a, 0x80 }, | ||
| 1111 | { 0x4b, 0x80 }, | ||
| 1112 | { 0x4d, 0xd2 }, /* This reduces noise a bit */ | ||
| 1113 | { 0x4e, 0xc1 }, | ||
| 1114 | { 0x4f, 0x04 }, | ||
| 1115 | /* Do 50-53 have any effect? */ | ||
| 1116 | /* Toggle 0x12[2] off and on here? */ | ||
| 1117 | }; | ||
| 1118 | |||
| 1119 | static const struct ov_i2c_regvals norm_6x30[] = { | ||
| 1120 | { 0x12, 0x80 }, /* Reset */ | ||
| 1121 | { 0x00, 0x1f }, /* Gain */ | ||
| 1122 | { 0x01, 0x99 }, /* Blue gain */ | ||
| 1123 | { 0x02, 0x7c }, /* Red gain */ | ||
| 1124 | { 0x03, 0xc0 }, /* Saturation */ | ||
| 1125 | { 0x05, 0x0a }, /* Contrast */ | ||
| 1126 | { 0x06, 0x95 }, /* Brightness */ | ||
| 1127 | { 0x07, 0x2d }, /* Sharpness */ | ||
| 1128 | { 0x0c, 0x20 }, | ||
| 1129 | { 0x0d, 0x20 }, | ||
| 1130 | { 0x0e, 0x20 }, | ||
| 1131 | { 0x0f, 0x05 }, | ||
| 1132 | { 0x10, 0x9a }, | ||
| 1133 | { 0x11, 0x00 }, /* Pixel clock = fastest */ | ||
| 1134 | { 0x12, 0x24 }, /* Enable AGC and AWB */ | ||
| 1135 | { 0x13, 0x21 }, | ||
| 1136 | { 0x14, 0x80 }, | ||
| 1137 | { 0x15, 0x01 }, | ||
| 1138 | { 0x16, 0x03 }, | ||
| 1139 | { 0x17, 0x38 }, | ||
| 1140 | { 0x18, 0xea }, | ||
| 1141 | { 0x19, 0x04 }, | ||
| 1142 | { 0x1a, 0x93 }, | ||
| 1143 | { 0x1b, 0x00 }, | ||
| 1144 | { 0x1e, 0xc4 }, | ||
| 1145 | { 0x1f, 0x04 }, | ||
| 1146 | { 0x20, 0x20 }, | ||
| 1147 | { 0x21, 0x10 }, | ||
| 1148 | { 0x22, 0x88 }, | ||
| 1149 | { 0x23, 0xc0 }, /* Crystal circuit power level */ | ||
| 1150 | { 0x25, 0x9a }, /* Increase AEC black ratio */ | ||
| 1151 | { 0x26, 0xb2 }, /* BLC enable */ | ||
| 1152 | { 0x27, 0xa2 }, | ||
| 1153 | { 0x28, 0x00 }, | ||
| 1154 | { 0x29, 0x00 }, | ||
| 1155 | { 0x2a, 0x84 }, /* 60 Hz power */ | ||
| 1156 | { 0x2b, 0xa8 }, /* 60 Hz power */ | ||
| 1157 | { 0x2c, 0xa0 }, | ||
| 1158 | { 0x2d, 0x95 }, /* Enable auto-brightness */ | ||
| 1159 | { 0x2e, 0x88 }, | ||
| 1160 | { 0x33, 0x26 }, | ||
| 1161 | { 0x34, 0x03 }, | ||
| 1162 | { 0x36, 0x8f }, | ||
| 1163 | { 0x37, 0x80 }, | ||
| 1164 | { 0x38, 0x83 }, | ||
| 1165 | { 0x39, 0x80 }, | ||
| 1166 | { 0x3a, 0x0f }, | ||
| 1167 | { 0x3b, 0x3c }, | ||
| 1168 | { 0x3c, 0x1a }, | ||
| 1169 | { 0x3d, 0x80 }, | ||
| 1170 | { 0x3e, 0x80 }, | ||
| 1171 | { 0x3f, 0x0e }, | ||
| 1172 | { 0x40, 0x00 }, /* White bal */ | ||
| 1173 | { 0x41, 0x00 }, /* White bal */ | ||
| 1174 | { 0x42, 0x80 }, | ||
| 1175 | { 0x43, 0x3f }, /* White bal */ | ||
| 1176 | { 0x44, 0x80 }, | ||
| 1177 | { 0x45, 0x20 }, | ||
| 1178 | { 0x46, 0x20 }, | ||
| 1179 | { 0x47, 0x80 }, | ||
| 1180 | { 0x48, 0x7f }, | ||
| 1181 | { 0x49, 0x00 }, | ||
| 1182 | { 0x4a, 0x00 }, | ||
| 1183 | { 0x4b, 0x80 }, | ||
| 1184 | { 0x4c, 0xd0 }, | ||
| 1185 | { 0x4d, 0x10 }, /* U = 0.563u, V = 0.714v */ | ||
| 1186 | { 0x4e, 0x40 }, | ||
| 1187 | { 0x4f, 0x07 }, /* UV avg., col. killer: max */ | ||
| 1188 | { 0x50, 0xff }, | ||
| 1189 | { 0x54, 0x23 }, /* Max AGC gain: 18dB */ | ||
| 1190 | { 0x55, 0xff }, | ||
| 1191 | { 0x56, 0x12 }, | ||
| 1192 | { 0x57, 0x81 }, | ||
| 1193 | { 0x58, 0x75 }, | ||
| 1194 | { 0x59, 0x01 }, /* AGC dark current comp.: +1 */ | ||
| 1195 | { 0x5a, 0x2c }, | ||
| 1196 | { 0x5b, 0x0f }, /* AWB chrominance levels */ | ||
| 1197 | { 0x5c, 0x10 }, | ||
| 1198 | { 0x3d, 0x80 }, | ||
| 1199 | { 0x27, 0xa6 }, | ||
| 1200 | { 0x12, 0x20 }, /* Toggle AWB */ | ||
| 1201 | { 0x12, 0x24 }, | ||
| 1202 | }; | ||
| 1203 | |||
| 1204 | PDEBUG(D_PROBE, "starting sensor configuration"); | ||
| 1205 | |||
| 1206 | if (init_ov_sensor(sd) < 0) { | ||
| 1207 | PDEBUG(D_ERR, "Failed to read sensor ID."); | ||
| 1208 | return -1; | ||
| 1209 | } | ||
| 1210 | PDEBUG(D_PROBE, "OV6xx0 sensor detected"); | ||
| 1211 | 1239 | ||
| 1212 | /* Detect sensor (sub)type */ | 1240 | /* Detect sensor (sub)type */ |
| 1213 | rc = i2c_r(sd, OV7610_REG_COM_I); | 1241 | rc = i2c_r(sd, OV7610_REG_COM_I); |
| @@ -1251,15 +1279,6 @@ static int ov6xx0_configure(struct sd *sd) | |||
| 1251 | /* Set sensor-specific vars */ | 1279 | /* Set sensor-specific vars */ |
| 1252 | sd->sif = 1; | 1280 | sd->sif = 1; |
| 1253 | 1281 | ||
| 1254 | if (sd->sensor == SEN_OV6620) { | ||
| 1255 | PDEBUG(D_PROBE, "Writing 6x20 registers"); | ||
| 1256 | if (write_i2c_regvals(sd, norm_6x20, ARRAY_SIZE(norm_6x20))) | ||
| 1257 | return -1; | ||
| 1258 | } else { | ||
| 1259 | PDEBUG(D_PROBE, "Writing 6x30 registers"); | ||
| 1260 | if (write_i2c_regvals(sd, norm_6x30, ARRAY_SIZE(norm_6x30))) | ||
| 1261 | return -1; | ||
| 1262 | } | ||
| 1263 | return 0; | 1282 | return 0; |
| 1264 | } | 1283 | } |
| 1265 | 1284 | ||
| @@ -1298,22 +1317,31 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 1298 | ov51x_led_control(sd, 0); /* turn LED off */ | 1317 | ov51x_led_control(sd, 0); /* turn LED off */ |
| 1299 | 1318 | ||
| 1300 | /* Test for 76xx */ | 1319 | /* Test for 76xx */ |
| 1301 | sd->primary_i2c_slave = OV7xx0_SID; | ||
| 1302 | if (ov51x_set_slave_ids(sd, OV7xx0_SID) < 0) | 1320 | if (ov51x_set_slave_ids(sd, OV7xx0_SID) < 0) |
| 1303 | goto error; | 1321 | goto error; |
| 1304 | 1322 | ||
| 1305 | /* The OV519 must be more aggressive about sensor detection since | 1323 | /* The OV519 must be more aggressive about sensor detection since |
| 1306 | * I2C write will never fail if the sensor is not present. We have | 1324 | * I2C write will never fail if the sensor is not present. We have |
| 1307 | * to try to initialize the sensor to detect its presence */ | 1325 | * to try to initialize the sensor to detect its presence */ |
| 1308 | if (init_ov_sensor(sd) < 0) { | 1326 | if (init_ov_sensor(sd) >= 0) { |
| 1327 | if (ov7xx0_configure(sd) < 0) { | ||
| 1328 | PDEBUG(D_ERR, "Failed to configure OV7xx0"); | ||
| 1329 | goto error; | ||
| 1330 | } | ||
| 1331 | } else { | ||
| 1332 | |||
| 1309 | /* Test for 6xx0 */ | 1333 | /* Test for 6xx0 */ |
| 1310 | sd->primary_i2c_slave = OV6xx0_SID; | ||
| 1311 | if (ov51x_set_slave_ids(sd, OV6xx0_SID) < 0) | 1334 | if (ov51x_set_slave_ids(sd, OV6xx0_SID) < 0) |
| 1312 | goto error; | 1335 | goto error; |
| 1313 | 1336 | ||
| 1314 | if (init_ov_sensor(sd) < 0) { | 1337 | if (init_ov_sensor(sd) >= 0) { |
| 1338 | if (ov6xx0_configure(sd) < 0) { | ||
| 1339 | PDEBUG(D_ERR, "Failed to configure OV6xx0"); | ||
| 1340 | goto error; | ||
| 1341 | } | ||
| 1342 | } else { | ||
| 1343 | |||
| 1315 | /* Test for 8xx0 */ | 1344 | /* Test for 8xx0 */ |
| 1316 | sd->primary_i2c_slave = OV8xx0_SID; | ||
| 1317 | if (ov51x_set_slave_ids(sd, OV8xx0_SID) < 0) | 1345 | if (ov51x_set_slave_ids(sd, OV8xx0_SID) < 0) |
| 1318 | goto error; | 1346 | goto error; |
| 1319 | 1347 | ||
| @@ -1321,24 +1349,13 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 1321 | PDEBUG(D_ERR, | 1349 | PDEBUG(D_ERR, |
| 1322 | "Can't determine sensor slave IDs"); | 1350 | "Can't determine sensor slave IDs"); |
| 1323 | goto error; | 1351 | goto error; |
| 1324 | } else { | ||
| 1325 | if (ov8xx0_configure(sd) < 0) { | ||
| 1326 | PDEBUG(D_ERR, | ||
| 1327 | "Failed to configure OV8xx0 sensor"); | ||
| 1328 | goto error; | ||
| 1329 | } | ||
| 1330 | } | 1352 | } |
| 1331 | } else { | 1353 | if (ov8xx0_configure(sd) < 0) { |
| 1332 | if (ov6xx0_configure(sd) < 0) { | 1354 | PDEBUG(D_ERR, |
| 1333 | PDEBUG(D_ERR, "Failed to configure OV6xx0"); | 1355 | "Failed to configure OV8xx0 sensor"); |
| 1334 | goto error; | 1356 | goto error; |
| 1335 | } | 1357 | } |
| 1336 | } | 1358 | } |
| 1337 | } else { | ||
| 1338 | if (ov7xx0_configure(sd) < 0) { | ||
| 1339 | PDEBUG(D_ERR, "Failed to configure OV7xx0"); | ||
| 1340 | goto error; | ||
| 1341 | } | ||
| 1342 | } | 1359 | } |
| 1343 | 1360 | ||
| 1344 | cam = &gspca_dev->cam; | 1361 | cam = &gspca_dev->cam; |
| @@ -1355,15 +1372,53 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 1355 | sd->colors = COLOR_DEF; | 1372 | sd->colors = COLOR_DEF; |
| 1356 | sd->hflip = HFLIP_DEF; | 1373 | sd->hflip = HFLIP_DEF; |
| 1357 | sd->vflip = VFLIP_DEF; | 1374 | sd->vflip = VFLIP_DEF; |
| 1375 | if (sd->sensor != SEN_OV7670) | ||
| 1376 | gspca_dev->ctrl_dis = (1 << HFLIP_IDX) | ||
| 1377 | | (1 << VFLIP_IDX); | ||
| 1358 | return 0; | 1378 | return 0; |
| 1359 | error: | 1379 | error: |
| 1360 | PDEBUG(D_ERR, "OV519 Config failed"); | 1380 | PDEBUG(D_ERR, "OV519 Config failed"); |
| 1361 | return -EBUSY; | 1381 | return -EBUSY; |
| 1362 | } | 1382 | } |
| 1363 | 1383 | ||
| 1364 | /* this function is called at open time */ | 1384 | /* this function is called at probe and resume time */ |
| 1365 | static int sd_open(struct gspca_dev *gspca_dev) | 1385 | static int sd_init(struct gspca_dev *gspca_dev) |
| 1366 | { | 1386 | { |
| 1387 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1388 | |||
| 1389 | /* initialize the sensor */ | ||
| 1390 | switch (sd->sensor) { | ||
| 1391 | case SEN_OV6620: | ||
| 1392 | if (write_i2c_regvals(sd, norm_6x20, ARRAY_SIZE(norm_6x20))) | ||
| 1393 | return -EIO; | ||
| 1394 | break; | ||
| 1395 | case SEN_OV6630: | ||
| 1396 | if (write_i2c_regvals(sd, norm_6x30, ARRAY_SIZE(norm_6x30))) | ||
| 1397 | return -EIO; | ||
| 1398 | break; | ||
| 1399 | default: | ||
| 1400 | /* case SEN_OV7610: */ | ||
| 1401 | /* case SEN_OV76BE: */ | ||
| 1402 | if (write_i2c_regvals(sd, norm_7610, ARRAY_SIZE(norm_7610))) | ||
| 1403 | return -EIO; | ||
| 1404 | break; | ||
| 1405 | case SEN_OV7620: | ||
| 1406 | if (write_i2c_regvals(sd, norm_7620, ARRAY_SIZE(norm_7620))) | ||
| 1407 | return -EIO; | ||
| 1408 | break; | ||
| 1409 | case SEN_OV7640: | ||
| 1410 | if (write_i2c_regvals(sd, norm_7640, ARRAY_SIZE(norm_7640))) | ||
| 1411 | return -EIO; | ||
| 1412 | break; | ||
| 1413 | case SEN_OV7670: | ||
| 1414 | if (write_i2c_regvals(sd, norm_7670, ARRAY_SIZE(norm_7670))) | ||
| 1415 | return -EIO; | ||
| 1416 | break; | ||
| 1417 | case SEN_OV8610: | ||
| 1418 | if (write_i2c_regvals(sd, norm_8610, ARRAY_SIZE(norm_8610))) | ||
| 1419 | return -EIO; | ||
| 1420 | break; | ||
| 1421 | } | ||
| 1367 | return 0; | 1422 | return 0; |
| 1368 | } | 1423 | } |
| 1369 | 1424 | ||
| @@ -1827,14 +1882,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 1827 | ov51x_led_control((struct sd *) gspca_dev, 0); | 1882 | ov51x_led_control((struct sd *) gspca_dev, 0); |
| 1828 | } | 1883 | } |
| 1829 | 1884 | ||
| 1830 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 1831 | { | ||
| 1832 | } | ||
| 1833 | |||
| 1834 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 1835 | { | ||
| 1836 | } | ||
| 1837 | |||
| 1838 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 1885 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 1839 | struct gspca_frame *frame, /* target */ | 1886 | struct gspca_frame *frame, /* target */ |
| 1840 | __u8 *data, /* isoc packet */ | 1887 | __u8 *data, /* isoc packet */ |
| @@ -2091,11 +2138,9 @@ static const struct sd_desc sd_desc = { | |||
| 2091 | .ctrls = sd_ctrls, | 2138 | .ctrls = sd_ctrls, |
| 2092 | .nctrls = ARRAY_SIZE(sd_ctrls), | 2139 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 2093 | .config = sd_config, | 2140 | .config = sd_config, |
| 2094 | .open = sd_open, | 2141 | .init = sd_init, |
| 2095 | .start = sd_start, | 2142 | .start = sd_start, |
| 2096 | .stopN = sd_stopN, | 2143 | .stopN = sd_stopN, |
| 2097 | .stop0 = sd_stop0, | ||
| 2098 | .close = sd_close, | ||
| 2099 | .pkt_scan = sd_pkt_scan, | 2144 | .pkt_scan = sd_pkt_scan, |
| 2100 | }; | 2145 | }; |
| 2101 | 2146 | ||
| @@ -2132,6 +2177,10 @@ static struct usb_driver sd_driver = { | |||
| 2132 | .id_table = device_table, | 2177 | .id_table = device_table, |
| 2133 | .probe = sd_probe, | 2178 | .probe = sd_probe, |
| 2134 | .disconnect = gspca_disconnect, | 2179 | .disconnect = gspca_disconnect, |
| 2180 | #ifdef CONFIG_PM | ||
| 2181 | .suspend = gspca_suspend, | ||
| 2182 | .resume = gspca_resume, | ||
| 2183 | #endif | ||
| 2135 | }; | 2184 | }; |
| 2136 | 2185 | ||
| 2137 | /* -- module insert / remove -- */ | 2186 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c index 7ef18d578811..83b5f740c947 100644 --- a/drivers/media/video/gspca/pac207.c +++ b/drivers/media/video/gspca/pac207.c | |||
| @@ -56,12 +56,6 @@ MODULE_LICENSE("GPL"); | |||
| 56 | #define PAC207_GAIN_KNEE 20 | 56 | #define PAC207_GAIN_KNEE 20 |
| 57 | 57 | ||
| 58 | #define PAC207_AUTOGAIN_DEADZONE 30 | 58 | #define PAC207_AUTOGAIN_DEADZONE 30 |
| 59 | /* We calculating the autogain at the end of the transfer of a frame, at this | ||
| 60 | moment a frame with the old settings is being transmitted, and a frame is | ||
| 61 | being captured with the old settings. So if we adjust the autogain we must | ||
| 62 | ignore atleast the 2 next frames for the new settings to come into effect | ||
| 63 | before doing any other adjustments */ | ||
| 64 | #define PAC207_AUTOGAIN_IGNORE_FRAMES 3 | ||
| 65 | 59 | ||
| 66 | /* specific webcam descriptor */ | 60 | /* specific webcam descriptor */ |
| 67 | struct sd { | 61 | struct sd { |
| @@ -131,7 +125,8 @@ static struct ctrl sd_ctrls[] = { | |||
| 131 | .minimum = 0, | 125 | .minimum = 0, |
| 132 | .maximum = 1, | 126 | .maximum = 1, |
| 133 | .step = 1, | 127 | .step = 1, |
| 134 | .default_value = 1, | 128 | #define AUTOGAIN_DEF 1 |
| 129 | .default_value = AUTOGAIN_DEF, | ||
| 135 | .flags = 0, | 130 | .flags = 0, |
| 136 | }, | 131 | }, |
| 137 | .set = sd_setautogain, | 132 | .set = sd_setautogain, |
| @@ -181,9 +176,6 @@ static const __u8 pac207_sensor_init[][8] = { | |||
| 181 | /* 48 reg_72 Rate Control end BalSize_4a =0x36 */ | 176 | /* 48 reg_72 Rate Control end BalSize_4a =0x36 */ |
| 182 | static const __u8 PacReg72[] = { 0x00, 0x00, 0x36, 0x00 }; | 177 | static const __u8 PacReg72[] = { 0x00, 0x00, 0x36, 0x00 }; |
| 183 | 178 | ||
| 184 | static const unsigned char pac207_sof_marker[5] = | ||
| 185 | { 0xff, 0xff, 0x00, 0xff, 0x96 }; | ||
| 186 | |||
| 187 | static int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index, | 179 | static int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index, |
| 188 | const u8 *buffer, u16 length) | 180 | const u8 *buffer, u16 length) |
| 189 | { | 181 | { |
| @@ -259,35 +251,32 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 259 | return -ENODEV; | 251 | return -ENODEV; |
| 260 | } | 252 | } |
| 261 | 253 | ||
| 262 | pac207_write_reg(gspca_dev, 0x41, 0x00); | ||
| 263 | /* Bit_0=Image Format, | ||
| 264 | * Bit_1=LED, | ||
| 265 | * Bit_2=Compression test mode enable */ | ||
| 266 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ | ||
| 267 | pac207_write_reg(gspca_dev, 0x11, 0x30); /* Analog Bias */ | ||
| 268 | |||
| 269 | PDEBUG(D_PROBE, | 254 | PDEBUG(D_PROBE, |
| 270 | "Pixart PAC207BCA Image Processor and Control Chip detected" | 255 | "Pixart PAC207BCA Image Processor and Control Chip detected" |
| 271 | " (vid/pid 0x%04X:0x%04X)", id->idVendor, id->idProduct); | 256 | " (vid/pid 0x%04X:0x%04X)", id->idVendor, id->idProduct); |
| 272 | 257 | ||
| 273 | cam = &gspca_dev->cam; | 258 | cam = &gspca_dev->cam; |
| 274 | cam->dev_name = (char *) id->driver_info; | ||
| 275 | cam->epaddr = 0x05; | 259 | cam->epaddr = 0x05; |
| 276 | cam->cam_mode = sif_mode; | 260 | cam->cam_mode = sif_mode; |
| 277 | cam->nmodes = ARRAY_SIZE(sif_mode); | 261 | cam->nmodes = ARRAY_SIZE(sif_mode); |
| 278 | sd->brightness = PAC207_BRIGHTNESS_DEFAULT; | 262 | sd->brightness = PAC207_BRIGHTNESS_DEFAULT; |
| 279 | sd->exposure = PAC207_EXPOSURE_DEFAULT; | 263 | sd->exposure = PAC207_EXPOSURE_DEFAULT; |
| 280 | sd->gain = PAC207_GAIN_DEFAULT; | 264 | sd->gain = PAC207_GAIN_DEFAULT; |
| 265 | sd->autogain = AUTOGAIN_DEF; | ||
| 281 | 266 | ||
| 282 | return 0; | 267 | return 0; |
| 283 | } | 268 | } |
| 284 | 269 | ||
| 285 | /* this function is called at open time */ | 270 | /* this function is called at probe and resume time */ |
| 286 | static int sd_open(struct gspca_dev *gspca_dev) | 271 | static int sd_init(struct gspca_dev *gspca_dev) |
| 287 | { | 272 | { |
| 288 | struct sd *sd = (struct sd *) gspca_dev; | 273 | pac207_write_reg(gspca_dev, 0x41, 0x00); |
| 274 | /* Bit_0=Image Format, | ||
| 275 | * Bit_1=LED, | ||
| 276 | * Bit_2=Compression test mode enable */ | ||
| 277 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ | ||
| 278 | pac207_write_reg(gspca_dev, 0x11, 0x30); /* Analog Bias */ | ||
| 289 | 279 | ||
| 290 | sd->autogain = 1; | ||
| 291 | return 0; | 280 | return 0; |
| 292 | } | 281 | } |
| 293 | 282 | ||
| @@ -343,14 +332,8 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 343 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ | 332 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ |
| 344 | } | 333 | } |
| 345 | 334 | ||
| 346 | static void sd_stop0(struct gspca_dev *gspca_dev) | 335 | /* Include pac common sof detection functions */ |
| 347 | { | 336 | #include "pac_common.h" |
| 348 | } | ||
| 349 | |||
| 350 | /* this function is called at close time */ | ||
| 351 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 352 | { | ||
| 353 | } | ||
| 354 | 337 | ||
| 355 | static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) | 338 | static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) |
| 356 | { | 339 | { |
| @@ -365,33 +348,7 @@ static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) | |||
| 365 | else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum, | 348 | else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum, |
| 366 | 100 + sd->brightness / 2, PAC207_AUTOGAIN_DEADZONE, | 349 | 100 + sd->brightness / 2, PAC207_AUTOGAIN_DEADZONE, |
| 367 | PAC207_GAIN_KNEE, PAC207_EXPOSURE_KNEE)) | 350 | PAC207_GAIN_KNEE, PAC207_EXPOSURE_KNEE)) |
| 368 | sd->autogain_ignore_frames = PAC207_AUTOGAIN_IGNORE_FRAMES; | 351 | sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; |
| 369 | } | ||
| 370 | |||
| 371 | static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev, | ||
| 372 | unsigned char *m, int len) | ||
| 373 | { | ||
| 374 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 375 | int i; | ||
| 376 | |||
| 377 | /* Search for the SOF marker (fixed part) in the header */ | ||
| 378 | for (i = 0; i < len; i++) { | ||
| 379 | if (m[i] == pac207_sof_marker[sd->sof_read]) { | ||
| 380 | sd->sof_read++; | ||
| 381 | if (sd->sof_read == sizeof(pac207_sof_marker)) { | ||
| 382 | PDEBUG(D_STREAM, | ||
| 383 | "SOF found, bytes to analyze: %u." | ||
| 384 | " Frame starts at byte #%u", | ||
| 385 | len, i + 1); | ||
| 386 | sd->sof_read = 0; | ||
| 387 | return m + i + 1; | ||
| 388 | } | ||
| 389 | } else { | ||
| 390 | sd->sof_read = 0; | ||
| 391 | } | ||
| 392 | } | ||
| 393 | |||
| 394 | return NULL; | ||
| 395 | } | 352 | } |
| 396 | 353 | ||
| 397 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 354 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| @@ -402,14 +359,14 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 402 | struct sd *sd = (struct sd *) gspca_dev; | 359 | struct sd *sd = (struct sd *) gspca_dev; |
| 403 | unsigned char *sof; | 360 | unsigned char *sof; |
| 404 | 361 | ||
| 405 | sof = pac207_find_sof(gspca_dev, data, len); | 362 | sof = pac_find_sof(gspca_dev, data, len); |
| 406 | if (sof) { | 363 | if (sof) { |
| 407 | int n; | 364 | int n; |
| 408 | 365 | ||
| 409 | /* finish decoding current frame */ | 366 | /* finish decoding current frame */ |
| 410 | n = sof - data; | 367 | n = sof - data; |
| 411 | if (n > sizeof pac207_sof_marker) | 368 | if (n > sizeof pac_sof_marker) |
| 412 | n -= sizeof pac207_sof_marker; | 369 | n -= sizeof pac_sof_marker; |
| 413 | else | 370 | else |
| 414 | n = 0; | 371 | n = 0; |
| 415 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, | 372 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, |
| @@ -537,7 +494,7 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) | |||
| 537 | sd->gain = PAC207_GAIN_DEFAULT; | 494 | sd->gain = PAC207_GAIN_DEFAULT; |
| 538 | if (gspca_dev->streaming) { | 495 | if (gspca_dev->streaming) { |
| 539 | sd->autogain_ignore_frames = | 496 | sd->autogain_ignore_frames = |
| 540 | PAC207_AUTOGAIN_IGNORE_FRAMES; | 497 | PAC_AUTOGAIN_IGNORE_FRAMES; |
| 541 | setexposure(gspca_dev); | 498 | setexposure(gspca_dev); |
| 542 | setgain(gspca_dev); | 499 | setgain(gspca_dev); |
| 543 | } | 500 | } |
| @@ -560,11 +517,9 @@ static const struct sd_desc sd_desc = { | |||
| 560 | .ctrls = sd_ctrls, | 517 | .ctrls = sd_ctrls, |
| 561 | .nctrls = ARRAY_SIZE(sd_ctrls), | 518 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 562 | .config = sd_config, | 519 | .config = sd_config, |
| 563 | .open = sd_open, | 520 | .init = sd_init, |
| 564 | .start = sd_start, | 521 | .start = sd_start, |
| 565 | .stopN = sd_stopN, | 522 | .stopN = sd_stopN, |
| 566 | .stop0 = sd_stop0, | ||
| 567 | .close = sd_close, | ||
| 568 | .dq_callback = pac207_do_auto_gain, | 523 | .dq_callback = pac207_do_auto_gain, |
| 569 | .pkt_scan = sd_pkt_scan, | 524 | .pkt_scan = sd_pkt_scan, |
| 570 | }; | 525 | }; |
| @@ -597,6 +552,10 @@ static struct usb_driver sd_driver = { | |||
| 597 | .id_table = device_table, | 552 | .id_table = device_table, |
| 598 | .probe = sd_probe, | 553 | .probe = sd_probe, |
| 599 | .disconnect = gspca_disconnect, | 554 | .disconnect = gspca_disconnect, |
| 555 | #ifdef CONFIG_PM | ||
| 556 | .suspend = gspca_suspend, | ||
| 557 | .resume = gspca_resume, | ||
| 558 | #endif | ||
| 600 | }; | 559 | }; |
| 601 | 560 | ||
| 602 | /* -- module insert / remove -- */ | 561 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index 815bea6edc44..d4be51843286 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c | |||
| @@ -19,6 +19,36 @@ | |||
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | /* Some documentation about various registers as determined by trial and error. | ||
| 23 | When the register addresses differ between the 7202 and the 7311 the 2 | ||
| 24 | different addresses are written as 7302addr/7311addr, when one of the 2 | ||
| 25 | addresses is a - sign that register description is not valid for the | ||
| 26 | matching IC. | ||
| 27 | |||
| 28 | Register page 1: | ||
| 29 | |||
| 30 | Address Description | ||
| 31 | -/0x08 Unknown compressor related, must always be 8 except when not | ||
| 32 | in 640x480 resolution and page 4 reg 2 <= 3 then set it to 9 ! | ||
| 33 | -/0x1b Auto white balance related, bit 0 is AWB enable (inverted) | ||
| 34 | bits 345 seem to toggle per color gains on/off (inverted) | ||
| 35 | 0x78 Global control, bit 6 controls the LED (inverted) | ||
| 36 | -/0x80 JPEG compression ratio ? Best not touched | ||
| 37 | |||
| 38 | Register page 3/4: | ||
| 39 | |||
| 40 | Address Description | ||
| 41 | 0x02 Clock divider 2-63, fps =~ 60 / val. Must be a multiple of 3 on | ||
| 42 | the 7302, so one of 3, 6, 9, ..., except when between 6 and 12? | ||
| 43 | -/0x0f Master gain 1-245, low value = high gain | ||
| 44 | 0x10/- Master gain 0-31 | ||
| 45 | -/0x10 Another gain 0-15, limited influence (1-2x gain I guess) | ||
| 46 | 0x21 Bitfield: 0-1 unused, 2-3 vflip/hflip, 4-5 unknown, 6-7 unused | ||
| 47 | -/0x27 Seems to toggle various gains on / off, Setting bit 7 seems to | ||
| 48 | completely disable the analog amplification block. Set to 0x68 | ||
| 49 | for max gain, 0x14 for minimal gain. | ||
| 50 | */ | ||
| 51 | |||
| 22 | #define MODULE_NAME "pac7311" | 52 | #define MODULE_NAME "pac7311" |
| 23 | 53 | ||
| 24 | #include "gspca.h" | 54 | #include "gspca.h" |
| @@ -31,18 +61,23 @@ MODULE_LICENSE("GPL"); | |||
| 31 | struct sd { | 61 | struct sd { |
| 32 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 62 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
| 33 | 63 | ||
| 34 | int lum_sum; | ||
| 35 | atomic_t avg_lum; | ||
| 36 | atomic_t do_gain; | ||
| 37 | |||
| 38 | unsigned char brightness; | 64 | unsigned char brightness; |
| 39 | unsigned char contrast; | 65 | unsigned char contrast; |
| 40 | unsigned char colors; | 66 | unsigned char colors; |
| 67 | unsigned char gain; | ||
| 68 | unsigned char exposure; | ||
| 41 | unsigned char autogain; | 69 | unsigned char autogain; |
| 70 | __u8 hflip; | ||
| 71 | __u8 vflip; | ||
| 72 | |||
| 73 | __u8 sensor; | ||
| 74 | #define SENSOR_PAC7302 0 | ||
| 75 | #define SENSOR_PAC7311 1 | ||
| 42 | 76 | ||
| 43 | char ffseq; | 77 | u8 sof_read; |
| 44 | signed char ag_cnt; | 78 | u8 autogain_ignore_frames; |
| 45 | #define AG_CNT_START 13 | 79 | |
| 80 | atomic_t avg_lum; | ||
| 46 | }; | 81 | }; |
| 47 | 82 | ||
| 48 | /* V4L2 controls supported by the driver */ | 83 | /* V4L2 controls supported by the driver */ |
| @@ -54,8 +89,18 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val); | |||
| 54 | static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); | 89 | static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); |
| 55 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); | 90 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); |
| 56 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); | 91 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); |
| 92 | static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val); | ||
| 93 | static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val); | ||
| 94 | static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); | ||
| 95 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); | ||
| 96 | static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val); | ||
| 97 | static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); | ||
| 98 | static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); | ||
| 99 | static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); | ||
| 57 | 100 | ||
| 58 | static struct ctrl sd_ctrls[] = { | 101 | static struct ctrl sd_ctrls[] = { |
| 102 | /* This control is pac7302 only */ | ||
| 103 | #define BRIGHTNESS_IDX 0 | ||
| 59 | { | 104 | { |
| 60 | { | 105 | { |
| 61 | .id = V4L2_CID_BRIGHTNESS, | 106 | .id = V4L2_CID_BRIGHTNESS, |
| @@ -71,13 +116,15 @@ static struct ctrl sd_ctrls[] = { | |||
| 71 | .set = sd_setbrightness, | 116 | .set = sd_setbrightness, |
| 72 | .get = sd_getbrightness, | 117 | .get = sd_getbrightness, |
| 73 | }, | 118 | }, |
| 119 | /* This control is for both the 7302 and the 7311 */ | ||
| 74 | { | 120 | { |
| 75 | { | 121 | { |
| 76 | .id = V4L2_CID_CONTRAST, | 122 | .id = V4L2_CID_CONTRAST, |
| 77 | .type = V4L2_CTRL_TYPE_INTEGER, | 123 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 78 | .name = "Contrast", | 124 | .name = "Contrast", |
| 79 | .minimum = 0, | 125 | .minimum = 0, |
| 80 | .maximum = 255, | 126 | #define CONTRAST_MAX 255 |
| 127 | .maximum = CONTRAST_MAX, | ||
| 81 | .step = 1, | 128 | .step = 1, |
| 82 | #define CONTRAST_DEF 127 | 129 | #define CONTRAST_DEF 127 |
| 83 | .default_value = CONTRAST_DEF, | 130 | .default_value = CONTRAST_DEF, |
| @@ -85,13 +132,16 @@ static struct ctrl sd_ctrls[] = { | |||
| 85 | .set = sd_setcontrast, | 132 | .set = sd_setcontrast, |
| 86 | .get = sd_getcontrast, | 133 | .get = sd_getcontrast, |
| 87 | }, | 134 | }, |
| 135 | /* This control is pac7302 only */ | ||
| 136 | #define SATURATION_IDX 2 | ||
| 88 | { | 137 | { |
| 89 | { | 138 | { |
| 90 | .id = V4L2_CID_SATURATION, | 139 | .id = V4L2_CID_SATURATION, |
| 91 | .type = V4L2_CTRL_TYPE_INTEGER, | 140 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 92 | .name = "Color", | 141 | .name = "Saturation", |
| 93 | .minimum = 0, | 142 | .minimum = 0, |
| 94 | .maximum = 255, | 143 | #define COLOR_MAX 255 |
| 144 | .maximum = COLOR_MAX, | ||
| 95 | .step = 1, | 145 | .step = 1, |
| 96 | #define COLOR_DEF 127 | 146 | #define COLOR_DEF 127 |
| 97 | .default_value = COLOR_DEF, | 147 | .default_value = COLOR_DEF, |
| @@ -99,6 +149,39 @@ static struct ctrl sd_ctrls[] = { | |||
| 99 | .set = sd_setcolors, | 149 | .set = sd_setcolors, |
| 100 | .get = sd_getcolors, | 150 | .get = sd_getcolors, |
| 101 | }, | 151 | }, |
| 152 | /* All controls below are for both the 7302 and the 7311 */ | ||
| 153 | { | ||
| 154 | { | ||
| 155 | .id = V4L2_CID_GAIN, | ||
| 156 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 157 | .name = "Gain", | ||
| 158 | .minimum = 0, | ||
| 159 | #define GAIN_MAX 255 | ||
| 160 | .maximum = GAIN_MAX, | ||
| 161 | .step = 1, | ||
| 162 | #define GAIN_DEF 127 | ||
| 163 | #define GAIN_KNEE 255 /* Gain seems to cause little noise on the pac73xx */ | ||
| 164 | .default_value = GAIN_DEF, | ||
| 165 | }, | ||
| 166 | .set = sd_setgain, | ||
| 167 | .get = sd_getgain, | ||
| 168 | }, | ||
| 169 | { | ||
| 170 | { | ||
| 171 | .id = V4L2_CID_EXPOSURE, | ||
| 172 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 173 | .name = "Exposure", | ||
| 174 | .minimum = 0, | ||
| 175 | #define EXPOSURE_MAX 255 | ||
| 176 | .maximum = EXPOSURE_MAX, | ||
| 177 | .step = 1, | ||
| 178 | #define EXPOSURE_DEF 16 /* 32 ms / 30 fps */ | ||
| 179 | #define EXPOSURE_KNEE 50 /* 100 ms / 10 fps */ | ||
| 180 | .default_value = EXPOSURE_DEF, | ||
| 181 | }, | ||
| 182 | .set = sd_setexposure, | ||
| 183 | .get = sd_getexposure, | ||
| 184 | }, | ||
| 102 | { | 185 | { |
| 103 | { | 186 | { |
| 104 | .id = V4L2_CID_AUTOGAIN, | 187 | .id = V4L2_CID_AUTOGAIN, |
| @@ -113,101 +196,207 @@ static struct ctrl sd_ctrls[] = { | |||
| 113 | .set = sd_setautogain, | 196 | .set = sd_setautogain, |
| 114 | .get = sd_getautogain, | 197 | .get = sd_getautogain, |
| 115 | }, | 198 | }, |
| 199 | { | ||
| 200 | { | ||
| 201 | .id = V4L2_CID_HFLIP, | ||
| 202 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
| 203 | .name = "Mirror", | ||
| 204 | .minimum = 0, | ||
| 205 | .maximum = 1, | ||
| 206 | .step = 1, | ||
| 207 | #define HFLIP_DEF 0 | ||
| 208 | .default_value = HFLIP_DEF, | ||
| 209 | }, | ||
| 210 | .set = sd_sethflip, | ||
| 211 | .get = sd_gethflip, | ||
| 212 | }, | ||
| 213 | { | ||
| 214 | { | ||
| 215 | .id = V4L2_CID_VFLIP, | ||
| 216 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
| 217 | .name = "Vflip", | ||
| 218 | .minimum = 0, | ||
| 219 | .maximum = 1, | ||
| 220 | .step = 1, | ||
| 221 | #define VFLIP_DEF 0 | ||
| 222 | .default_value = VFLIP_DEF, | ||
| 223 | }, | ||
| 224 | .set = sd_setvflip, | ||
| 225 | .get = sd_getvflip, | ||
| 226 | }, | ||
| 116 | }; | 227 | }; |
| 117 | 228 | ||
| 118 | static struct v4l2_pix_format vga_mode[] = { | 229 | static struct v4l2_pix_format vga_mode[] = { |
| 119 | {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | 230 | {160, 120, V4L2_PIX_FMT_PJPG, V4L2_FIELD_NONE, |
| 120 | .bytesperline = 160, | 231 | .bytesperline = 160, |
| 121 | .sizeimage = 160 * 120 * 3 / 8 + 590, | 232 | .sizeimage = 160 * 120 * 3 / 8 + 590, |
| 122 | .colorspace = V4L2_COLORSPACE_JPEG, | 233 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 123 | .priv = 2}, | 234 | .priv = 2}, |
| 124 | {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | 235 | {320, 240, V4L2_PIX_FMT_PJPG, V4L2_FIELD_NONE, |
| 125 | .bytesperline = 320, | 236 | .bytesperline = 320, |
| 126 | .sizeimage = 320 * 240 * 3 / 8 + 590, | 237 | .sizeimage = 320 * 240 * 3 / 8 + 590, |
| 127 | .colorspace = V4L2_COLORSPACE_JPEG, | 238 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 128 | .priv = 1}, | 239 | .priv = 1}, |
| 129 | {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | 240 | {640, 480, V4L2_PIX_FMT_PJPG, V4L2_FIELD_NONE, |
| 130 | .bytesperline = 640, | 241 | .bytesperline = 640, |
| 131 | .sizeimage = 640 * 480 * 3 / 8 + 590, | 242 | .sizeimage = 640 * 480 * 3 / 8 + 590, |
| 132 | .colorspace = V4L2_COLORSPACE_JPEG, | 243 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 133 | .priv = 0}, | 244 | .priv = 0}, |
| 134 | }; | 245 | }; |
| 135 | 246 | ||
| 136 | #define PAC7311_JPEG_HEADER_SIZE (sizeof pac7311_jpeg_header) /* (594) */ | 247 | /* pac 7302 */ |
| 137 | 248 | static const __u8 init_7302[] = { | |
| 138 | static const __u8 pac7311_jpeg_header[] = { | 249 | /* index,value */ |
| 139 | 0xff, 0xd8, | 250 | 0xff, 0x01, /* page 1 */ |
| 140 | 0xff, 0xe0, 0x00, 0x03, 0x20, | 251 | 0x78, 0x00, /* deactivate */ |
| 141 | 0xff, 0xc0, 0x00, 0x11, 0x08, | 252 | 0xff, 0x01, |
| 142 | 0x01, 0xe0, /* 12: height */ | 253 | 0x78, 0x40, /* led off */ |
| 143 | 0x02, 0x80, /* 14: width */ | 254 | }; |
| 144 | 0x03, /* 16 */ | 255 | static const __u8 start_7302[] = { |
| 145 | 0x01, 0x21, 0x00, | 256 | /* index, len, [value]* */ |
| 146 | 0x02, 0x11, 0x01, | 257 | 0xff, 1, 0x00, /* page 0 */ |
| 147 | 0x03, 0x11, 0x01, | 258 | 0x00, 12, 0x01, 0x40, 0x40, 0x40, 0x01, 0xe0, 0x02, 0x80, |
| 148 | 0xff, 0xdb, 0x00, 0x84, | 259 | 0x00, 0x00, 0x00, 0x00, |
| 149 | 0x00, 0x10, 0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e, 0x0d, | 260 | 0x0d, 24, 0x03, 0x01, 0x00, 0xb5, 0x07, 0xcb, 0x00, 0x00, |
| 150 | 0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28, 0x1a, 0x18, 0x16, | 261 | 0x07, 0xc8, 0x00, 0xea, 0x07, 0xcf, 0x07, 0xf7, |
| 151 | 0x16, 0x18, 0x31, 0x23, 0x25, 0x1d, 0x28, 0x3a, 0x33, 0x3d, | 262 | 0x07, 0x7e, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x11, |
| 152 | 0x3c, 0x39, 0x33, 0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, | 263 | 0x26, 2, 0xaa, 0xaa, |
| 153 | 0x44, 0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57, 0x5f, | 264 | 0x2e, 1, 0x31, |
| 154 | 0x62, 0x67, 0x68, 0x67, 0x3e, 0x4d, 0x71, 0x79, 0x70, 0x64, | 265 | 0x38, 1, 0x01, |
| 155 | 0x78, 0x5c, 0x65, 0x67, 0x63, 0x01, 0x11, 0x12, 0x12, 0x18, | 266 | 0x3a, 3, 0x14, 0xff, 0x5a, |
| 156 | 0x15, 0x18, 0x2f, 0x1a, 0x1a, 0x2f, 0x63, 0x42, 0x38, 0x42, | 267 | 0x43, 11, 0x00, 0x0a, 0x18, 0x11, 0x01, 0x2c, 0x88, 0x11, |
| 157 | 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, | 268 | 0x00, 0x54, 0x11, |
| 158 | 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, | 269 | 0x55, 1, 0x00, |
| 159 | 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, | 270 | 0x62, 4, 0x10, 0x1e, 0x1e, 0x18, |
| 160 | 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, | 271 | 0x6b, 1, 0x00, |
| 161 | 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, | 272 | 0x6e, 3, 0x08, 0x06, 0x00, |
| 162 | 0xff, 0xc4, 0x01, 0xa2, 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, | 273 | 0x72, 3, 0x00, 0xff, 0x00, |
| 163 | 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 274 | 0x7d, 23, 0x01, 0x01, 0x58, 0x46, 0x50, 0x3c, 0x50, 0x3c, |
| 164 | 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, | 275 | 0x54, 0x46, 0x54, 0x56, 0x52, 0x50, 0x52, 0x50, |
| 165 | 0x09, 0x0a, 0x0b, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, | 276 | 0x56, 0x64, 0xa4, 0x00, 0xda, 0x00, 0x00, |
| 166 | 0x04, 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d, | 277 | 0xa2, 10, 0x22, 0x2c, 0x3c, 0x54, 0x69, 0x7c, 0x9c, 0xb9, |
| 167 | 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, | 278 | 0xd2, 0xeb, |
| 168 | 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, | 279 | 0xaf, 1, 0x02, |
| 169 | 0x81, 0x91, 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, | 280 | 0xb5, 2, 0x08, 0x08, |
| 170 | 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, | 281 | 0xb8, 2, 0x08, 0x88, |
| 171 | 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, | 282 | 0xc4, 4, 0xae, 0x01, 0x04, 0x01, |
| 172 | 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, | 283 | 0xcc, 1, 0x00, |
| 173 | 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, | 284 | 0xd1, 11, 0x01, 0x30, 0x49, 0x5e, 0x6f, 0x7f, 0x8e, 0xa9, |
| 174 | 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, | 285 | 0xc1, 0xd7, 0xec, |
| 175 | 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x83, | 286 | 0xdc, 1, 0x01, |
| 176 | 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, | 287 | 0xff, 1, 0x01, /* page 1 */ |
| 177 | 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, | 288 | 0x12, 3, 0x02, 0x00, 0x01, |
| 178 | 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, | 289 | 0x3e, 2, 0x00, 0x00, |
| 179 | 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | 290 | 0x76, 5, 0x01, 0x20, 0x40, 0x00, 0xf2, |
| 180 | 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, | 291 | 0x7c, 1, 0x00, |
| 181 | 0xd9, 0xda, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, | 292 | 0x7f, 10, 0x4b, 0x0f, 0x01, 0x2c, 0x02, 0x58, 0x03, 0x20, |
| 182 | 0xe9, 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, | 293 | 0x02, 0x00, |
| 183 | 0xf9, 0xfa, 0x01, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, | 294 | 0x96, 5, 0x01, 0x10, 0x04, 0x01, 0x04, |
| 184 | 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 295 | 0xc8, 14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, |
| 185 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, | 296 | 0x07, 0x00, 0x01, 0x07, 0x04, 0x01, |
| 186 | 0x0b, 0x11, 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04, | 297 | 0xd8, 1, 0x01, |
| 187 | 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, 0x01, | 298 | 0xdb, 2, 0x00, 0x01, |
| 188 | 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, | 299 | 0xde, 7, 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x00, |
| 189 | 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, | 300 | 0xe6, 4, 0x00, 0x00, 0x00, 0x01, |
| 190 | 0x42, 0x91, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, | 301 | 0xeb, 1, 0x00, |
| 191 | 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, | 302 | 0xff, 1, 0x02, /* page 2 */ |
| 192 | 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, 0x27, 0x28, 0x29, 0x2a, | 303 | 0x22, 1, 0x00, |
| 193 | 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, | 304 | 0xff, 1, 0x03, /* page 3 */ |
| 194 | 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | 305 | 0x00, 255, /* load the page 3 */ |
| 195 | 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, | 306 | 0x11, 1, 0x01, |
| 196 | 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x82, 0x83, | 307 | 0xff, 1, 0x02, /* page 2 */ |
| 197 | 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, | 308 | 0x13, 1, 0x00, |
| 198 | 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, | 309 | 0x22, 4, 0x1f, 0xa4, 0xf0, 0x96, |
| 199 | 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, | 310 | 0x27, 2, 0x14, 0x0c, |
| 200 | 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | 311 | 0x2a, 5, 0xc8, 0x00, 0x18, 0x12, 0x22, |
| 201 | 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, | 312 | 0x64, 8, 0x00, 0x00, 0xf0, 0x01, 0x14, 0x44, 0x44, 0x44, |
| 202 | 0xd9, 0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, | 313 | 0x6e, 1, 0x08, |
| 203 | 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, | 314 | 0xff, 1, 0x01, /* page 1 */ |
| 204 | 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, | 315 | 0x78, 1, 0x00, |
| 205 | 0x11, 0x00, 0x3f, 0x00 | 316 | 0, 0 /* end of sequence */ |
| 317 | }; | ||
| 318 | |||
| 319 | /* page 3 - the value 0xaa says skip the index - see reg_w_page() */ | ||
| 320 | static const __u8 page3_7302[] = { | ||
| 321 | 0x90, 0x40, 0x03, 0x50, 0xc2, 0x01, 0x14, 0x16, | ||
| 322 | 0x14, 0x12, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, | ||
| 323 | 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 324 | 0x00, 0x00, 0x00, 0x47, 0x01, 0xb3, 0x01, 0x00, | ||
| 325 | 0x00, 0x08, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x21, | ||
| 326 | 0x00, 0x00, 0x00, 0x54, 0xf4, 0x02, 0x52, 0x54, | ||
| 327 | 0xa4, 0xb8, 0xe0, 0x2a, 0xf6, 0x00, 0x00, 0x00, | ||
| 328 | 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 329 | 0x00, 0xfc, 0x00, 0xf2, 0x1f, 0x04, 0x00, 0x00, | ||
| 330 | 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x10, 0x00, 0x00, | ||
| 331 | 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 332 | 0x00, 0x40, 0xff, 0x03, 0x19, 0x00, 0x00, 0x00, | ||
| 333 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 334 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xc8, 0xc8, | ||
| 335 | 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, | ||
| 336 | 0x08, 0x10, 0x24, 0x40, 0x00, 0x00, 0x00, 0x00, | ||
| 337 | 0x01, 0x00, 0x02, 0x47, 0x00, 0x00, 0x00, 0x00, | ||
| 338 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 339 | 0x00, 0x02, 0xfa, 0x00, 0x64, 0x5a, 0x28, 0x00, | ||
| 340 | 0x00 | ||
| 341 | }; | ||
| 342 | |||
| 343 | /* pac 7311 */ | ||
| 344 | static const __u8 init_7311[] = { | ||
| 345 | 0x78, 0x40, /* Bit_0=start stream, Bit_6=LED */ | ||
| 346 | 0x78, 0x40, /* Bit_0=start stream, Bit_6=LED */ | ||
| 347 | 0x78, 0x44, /* Bit_0=start stream, Bit_6=LED */ | ||
| 348 | 0xff, 0x04, | ||
| 349 | 0x27, 0x80, | ||
| 350 | 0x28, 0xca, | ||
| 351 | 0x29, 0x53, | ||
| 352 | 0x2a, 0x0e, | ||
| 353 | 0xff, 0x01, | ||
| 354 | 0x3e, 0x20, | ||
| 355 | }; | ||
| 356 | |||
| 357 | static const __u8 start_7311[] = { | ||
| 358 | /* index, len, [value]* */ | ||
| 359 | 0xff, 1, 0x01, /* page 1 */ | ||
| 360 | 0x02, 43, 0x48, 0x0a, 0x40, 0x08, 0x00, 0x00, 0x08, 0x00, | ||
| 361 | 0x06, 0xff, 0x11, 0xff, 0x5a, 0x30, 0x90, 0x4c, | ||
| 362 | 0x00, 0x07, 0x00, 0x0a, 0x10, 0x00, 0xa0, 0x10, | ||
| 363 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00, | ||
| 364 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 365 | 0x00, 0x00, 0x00, | ||
| 366 | 0x3e, 42, 0x00, 0x00, 0x78, 0x52, 0x4a, 0x52, 0x78, 0x6e, | ||
| 367 | 0x48, 0x46, 0x48, 0x6e, 0x5f, 0x49, 0x42, 0x49, | ||
| 368 | 0x5f, 0x5f, 0x49, 0x42, 0x49, 0x5f, 0x6e, 0x48, | ||
| 369 | 0x46, 0x48, 0x6e, 0x78, 0x52, 0x4a, 0x52, 0x78, | ||
| 370 | 0x00, 0x00, 0x09, 0x1b, 0x34, 0x49, 0x5c, 0x9b, | ||
| 371 | 0xd0, 0xff, | ||
| 372 | 0x78, 6, 0x44, 0x00, 0xf2, 0x01, 0x01, 0x80, | ||
| 373 | 0x7f, 18, 0x2a, 0x1c, 0x00, 0xc8, 0x02, 0x58, 0x03, 0x84, | ||
| 374 | 0x12, 0x00, 0x1a, 0x04, 0x08, 0x0c, 0x10, 0x14, | ||
| 375 | 0x18, 0x20, | ||
| 376 | 0x96, 3, 0x01, 0x08, 0x04, | ||
| 377 | 0xa0, 4, 0x44, 0x44, 0x44, 0x04, | ||
| 378 | 0xf0, 13, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x20, 0x00, | ||
| 379 | 0x3f, 0x00, 0x0a, 0x01, 0x00, | ||
| 380 | 0xff, 1, 0x04, /* page 4 */ | ||
| 381 | 0x00, 254, /* load the page 4 */ | ||
| 382 | 0x11, 1, 0x01, | ||
| 383 | 0, 0 /* end of sequence */ | ||
| 384 | }; | ||
| 385 | |||
| 386 | /* page 4 - the value 0xaa says skip the index - see reg_w_page() */ | ||
| 387 | static const __u8 page4_7311[] = { | ||
| 388 | 0xaa, 0xaa, 0x04, 0x54, 0x07, 0x2b, 0x09, 0x0f, | ||
| 389 | 0x09, 0x00, 0xaa, 0xaa, 0x07, 0x00, 0x00, 0x62, | ||
| 390 | 0x08, 0xaa, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 391 | 0x00, 0x00, 0x00, 0x03, 0xa0, 0x01, 0xf4, 0xaa, | ||
| 392 | 0xaa, 0x00, 0x08, 0xaa, 0x03, 0xaa, 0x00, 0x68, | ||
| 393 | 0xca, 0x10, 0x06, 0x78, 0x00, 0x00, 0x00, 0x00, | ||
| 394 | 0x23, 0x28, 0x04, 0x11, 0x00, 0x00 | ||
| 206 | }; | 395 | }; |
| 207 | 396 | ||
| 208 | static void reg_w_buf(struct gspca_dev *gspca_dev, | 397 | static void reg_w_buf(struct gspca_dev *gspca_dev, |
| 209 | __u16 index, | 398 | __u8 index, |
| 210 | const char *buffer, __u16 len) | 399 | const char *buffer, int len) |
| 211 | { | 400 | { |
| 212 | memcpy(gspca_dev->usb_buf, buffer, len); | 401 | memcpy(gspca_dev->usb_buf, buffer, len); |
| 213 | usb_control_msg(gspca_dev->dev, | 402 | usb_control_msg(gspca_dev->dev, |
| @@ -219,21 +408,9 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, | |||
| 219 | 500); | 408 | 500); |
| 220 | } | 409 | } |
| 221 | 410 | ||
| 222 | static __u8 reg_r(struct gspca_dev *gspca_dev, | ||
| 223 | __u16 index) | ||
| 224 | { | ||
| 225 | usb_control_msg(gspca_dev->dev, | ||
| 226 | usb_rcvctrlpipe(gspca_dev->dev, 0), | ||
| 227 | 0, /* request */ | ||
| 228 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
| 229 | 0, /* value */ | ||
| 230 | index, gspca_dev->usb_buf, 1, | ||
| 231 | 500); | ||
| 232 | return gspca_dev->usb_buf[0]; | ||
| 233 | } | ||
| 234 | 411 | ||
| 235 | static void reg_w(struct gspca_dev *gspca_dev, | 412 | static void reg_w(struct gspca_dev *gspca_dev, |
| 236 | __u16 index, | 413 | __u8 index, |
| 237 | __u8 value) | 414 | __u8 value) |
| 238 | { | 415 | { |
| 239 | gspca_dev->usb_buf[0] = value; | 416 | gspca_dev->usb_buf[0] = value; |
| @@ -241,10 +418,78 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
| 241 | usb_sndctrlpipe(gspca_dev->dev, 0), | 418 | usb_sndctrlpipe(gspca_dev->dev, 0), |
| 242 | 0, /* request */ | 419 | 0, /* request */ |
| 243 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 420 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 244 | value, index, gspca_dev->usb_buf, 1, | 421 | 0, index, gspca_dev->usb_buf, 1, |
| 245 | 500); | 422 | 500); |
| 246 | } | 423 | } |
| 247 | 424 | ||
| 425 | static void reg_w_seq(struct gspca_dev *gspca_dev, | ||
| 426 | const __u8 *seq, int len) | ||
| 427 | { | ||
| 428 | while (--len >= 0) { | ||
| 429 | reg_w(gspca_dev, seq[0], seq[1]); | ||
| 430 | seq += 2; | ||
| 431 | } | ||
| 432 | } | ||
| 433 | |||
| 434 | /* load the beginning of a page */ | ||
| 435 | static void reg_w_page(struct gspca_dev *gspca_dev, | ||
| 436 | const __u8 *page, int len) | ||
| 437 | { | ||
| 438 | int index; | ||
| 439 | |||
| 440 | for (index = 0; index < len; index++) { | ||
| 441 | if (page[index] == 0xaa) /* skip this index */ | ||
| 442 | continue; | ||
| 443 | gspca_dev->usb_buf[0] = page[index]; | ||
| 444 | usb_control_msg(gspca_dev->dev, | ||
| 445 | usb_sndctrlpipe(gspca_dev->dev, 0), | ||
| 446 | 0, /* request */ | ||
| 447 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
| 448 | 0, index, gspca_dev->usb_buf, 1, | ||
| 449 | 500); | ||
| 450 | } | ||
| 451 | } | ||
| 452 | |||
| 453 | /* output a variable sequence */ | ||
| 454 | static void reg_w_var(struct gspca_dev *gspca_dev, | ||
| 455 | const __u8 *seq) | ||
| 456 | { | ||
| 457 | int index, len; | ||
| 458 | |||
| 459 | for (;;) { | ||
| 460 | index = *seq++; | ||
| 461 | len = *seq++; | ||
| 462 | switch (len) { | ||
| 463 | case 0: | ||
| 464 | return; | ||
| 465 | case 254: | ||
| 466 | reg_w_page(gspca_dev, page4_7311, sizeof page4_7311); | ||
| 467 | break; | ||
| 468 | case 255: | ||
| 469 | reg_w_page(gspca_dev, page3_7302, sizeof page3_7302); | ||
| 470 | break; | ||
| 471 | default: | ||
| 472 | if (len > 64) { | ||
| 473 | PDEBUG(D_ERR|D_STREAM, | ||
| 474 | "Incorrect variable sequence"); | ||
| 475 | return; | ||
| 476 | } | ||
| 477 | while (len > 0) { | ||
| 478 | if (len < 8) { | ||
| 479 | reg_w_buf(gspca_dev, index, seq, len); | ||
| 480 | seq += len; | ||
| 481 | break; | ||
| 482 | } | ||
| 483 | reg_w_buf(gspca_dev, index, seq, 8); | ||
| 484 | seq += 8; | ||
| 485 | index += 8; | ||
| 486 | len -= 8; | ||
| 487 | } | ||
| 488 | } | ||
| 489 | } | ||
| 490 | /* not reached */ | ||
| 491 | } | ||
| 492 | |||
| 248 | /* this function is called at probe time */ | 493 | /* this function is called at probe time */ |
| 249 | static int sd_config(struct gspca_dev *gspca_dev, | 494 | static int sd_config(struct gspca_dev *gspca_dev, |
| 250 | const struct usb_device_id *id) | 495 | const struct usb_device_id *id) |
| @@ -252,203 +497,245 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 252 | struct sd *sd = (struct sd *) gspca_dev; | 497 | struct sd *sd = (struct sd *) gspca_dev; |
| 253 | struct cam *cam; | 498 | struct cam *cam; |
| 254 | 499 | ||
| 255 | PDEBUG(D_CONF, "Find Sensor PAC7311"); | ||
| 256 | reg_w(gspca_dev, 0x78, 0x40); /* Bit_0=start stream, Bit_7=LED */ | ||
| 257 | reg_w(gspca_dev, 0x78, 0x40); /* Bit_0=start stream, Bit_7=LED */ | ||
| 258 | reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ | ||
| 259 | reg_w(gspca_dev, 0xff, 0x04); | ||
| 260 | reg_w(gspca_dev, 0x27, 0x80); | ||
| 261 | reg_w(gspca_dev, 0x28, 0xca); | ||
| 262 | reg_w(gspca_dev, 0x29, 0x53); | ||
| 263 | reg_w(gspca_dev, 0x2a, 0x0e); | ||
| 264 | reg_w(gspca_dev, 0xff, 0x01); | ||
| 265 | reg_w(gspca_dev, 0x3e, 0x20); | ||
| 266 | |||
| 267 | cam = &gspca_dev->cam; | 500 | cam = &gspca_dev->cam; |
| 268 | cam->epaddr = 0x05; | 501 | cam->epaddr = 0x05; |
| 269 | cam->cam_mode = vga_mode; | 502 | |
| 270 | cam->nmodes = ARRAY_SIZE(vga_mode); | 503 | sd->sensor = id->driver_info; |
| 504 | if (sd->sensor == SENSOR_PAC7302) { | ||
| 505 | PDEBUG(D_CONF, "Find Sensor PAC7302"); | ||
| 506 | cam->cam_mode = &vga_mode[2]; /* only 640x480 */ | ||
| 507 | cam->nmodes = 1; | ||
| 508 | } else { | ||
| 509 | PDEBUG(D_CONF, "Find Sensor PAC7311"); | ||
| 510 | cam->cam_mode = vga_mode; | ||
| 511 | cam->nmodes = ARRAY_SIZE(vga_mode); | ||
| 512 | gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX) | ||
| 513 | | (1 << SATURATION_IDX); | ||
| 514 | } | ||
| 271 | 515 | ||
| 272 | sd->brightness = BRIGHTNESS_DEF; | 516 | sd->brightness = BRIGHTNESS_DEF; |
| 273 | sd->contrast = CONTRAST_DEF; | 517 | sd->contrast = CONTRAST_DEF; |
| 274 | sd->colors = COLOR_DEF; | 518 | sd->colors = COLOR_DEF; |
| 519 | sd->gain = GAIN_DEF; | ||
| 520 | sd->exposure = EXPOSURE_DEF; | ||
| 275 | sd->autogain = AUTOGAIN_DEF; | 521 | sd->autogain = AUTOGAIN_DEF; |
| 276 | sd->ag_cnt = -1; | 522 | sd->hflip = HFLIP_DEF; |
| 523 | sd->vflip = VFLIP_DEF; | ||
| 277 | return 0; | 524 | return 0; |
| 278 | } | 525 | } |
| 279 | 526 | ||
| 280 | static void setbrightness(struct gspca_dev *gspca_dev) | 527 | /* This function is used by pac7302 only */ |
| 528 | static void setbrightcont(struct gspca_dev *gspca_dev) | ||
| 529 | { | ||
| 530 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 531 | int i, v; | ||
| 532 | static const __u8 max[10] = | ||
| 533 | {0x29, 0x33, 0x42, 0x5a, 0x6e, 0x80, 0x9f, 0xbb, | ||
| 534 | 0xd4, 0xec}; | ||
| 535 | static const __u8 delta[10] = | ||
| 536 | {0x35, 0x33, 0x33, 0x2f, 0x2a, 0x25, 0x1e, 0x17, | ||
| 537 | 0x11, 0x0b}; | ||
| 538 | |||
| 539 | reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ | ||
| 540 | for (i = 0; i < 10; i++) { | ||
| 541 | v = max[i]; | ||
| 542 | v += (sd->brightness - BRIGHTNESS_MAX) | ||
| 543 | * 150 / BRIGHTNESS_MAX; /* 200 ? */ | ||
| 544 | v -= delta[i] * sd->contrast / CONTRAST_MAX; | ||
| 545 | if (v < 0) | ||
| 546 | v = 0; | ||
| 547 | else if (v > 0xff) | ||
| 548 | v = 0xff; | ||
| 549 | reg_w(gspca_dev, 0xa2 + i, v); | ||
| 550 | } | ||
| 551 | reg_w(gspca_dev, 0xdc, 0x01); | ||
| 552 | } | ||
| 553 | |||
| 554 | /* This function is used by pac7311 only */ | ||
| 555 | static void setcontrast(struct gspca_dev *gspca_dev) | ||
| 281 | { | 556 | { |
| 282 | struct sd *sd = (struct sd *) gspca_dev; | 557 | struct sd *sd = (struct sd *) gspca_dev; |
| 283 | int brightness; | ||
| 284 | 558 | ||
| 285 | /*jfm: inverted?*/ | ||
| 286 | brightness = BRIGHTNESS_MAX - sd->brightness; | ||
| 287 | reg_w(gspca_dev, 0xff, 0x04); | 559 | reg_w(gspca_dev, 0xff, 0x04); |
| 288 | /* reg_w(gspca_dev, 0x0e, 0x00); */ | 560 | reg_w(gspca_dev, 0x10, sd->contrast >> 4); |
| 289 | reg_w(gspca_dev, 0x0f, brightness); | ||
| 290 | /* load registers to sensor (Bit 0, auto clear) */ | 561 | /* load registers to sensor (Bit 0, auto clear) */ |
| 291 | reg_w(gspca_dev, 0x11, 0x01); | 562 | reg_w(gspca_dev, 0x11, 0x01); |
| 292 | PDEBUG(D_CONF|D_STREAM, "brightness: %i", brightness); | ||
| 293 | } | 563 | } |
| 294 | 564 | ||
| 295 | static void setcontrast(struct gspca_dev *gspca_dev) | 565 | /* This function is used by pac7302 only */ |
| 566 | static void setcolors(struct gspca_dev *gspca_dev) | ||
| 296 | { | 567 | { |
| 297 | struct sd *sd = (struct sd *) gspca_dev; | 568 | struct sd *sd = (struct sd *) gspca_dev; |
| 569 | int i, v; | ||
| 570 | static const int a[9] = | ||
| 571 | {217, -212, 0, -101, 170, -67, -38, -315, 355}; | ||
| 572 | static const int b[9] = | ||
| 573 | {19, 106, 0, 19, 106, 1, 19, 106, 1}; | ||
| 298 | 574 | ||
| 299 | reg_w(gspca_dev, 0xff, 0x01); | 575 | reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ |
| 300 | reg_w(gspca_dev, 0x80, sd->contrast); | ||
| 301 | /* load registers to sensor (Bit 0, auto clear) */ | ||
| 302 | reg_w(gspca_dev, 0x11, 0x01); | 576 | reg_w(gspca_dev, 0x11, 0x01); |
| 303 | PDEBUG(D_CONF|D_STREAM, "contrast: %i", sd->contrast); | 577 | reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ |
| 578 | reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ | ||
| 579 | for (i = 0; i < 9; i++) { | ||
| 580 | v = a[i] * sd->colors / COLOR_MAX + b[i]; | ||
| 581 | reg_w(gspca_dev, 0x0f + 2 * i, (v >> 8) & 0x07); | ||
| 582 | reg_w(gspca_dev, 0x0f + 2 * i + 1, v); | ||
| 583 | } | ||
| 584 | reg_w(gspca_dev, 0xdc, 0x01); | ||
| 585 | PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors); | ||
| 304 | } | 586 | } |
| 305 | 587 | ||
| 306 | static void setcolors(struct gspca_dev *gspca_dev) | 588 | static void setgain(struct gspca_dev *gspca_dev) |
| 307 | { | 589 | { |
| 308 | struct sd *sd = (struct sd *) gspca_dev; | 590 | struct sd *sd = (struct sd *) gspca_dev; |
| 309 | 591 | ||
| 310 | reg_w(gspca_dev, 0xff, 0x01); | 592 | if (sd->sensor == SENSOR_PAC7302) { |
| 311 | reg_w(gspca_dev, 0x10, sd->colors); | 593 | reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ |
| 594 | reg_w(gspca_dev, 0x10, sd->gain >> 3); | ||
| 595 | } else { | ||
| 596 | int gain = GAIN_MAX - sd->gain; | ||
| 597 | if (gain < 1) | ||
| 598 | gain = 1; | ||
| 599 | else if (gain > 245) | ||
| 600 | gain = 245; | ||
| 601 | reg_w(gspca_dev, 0xff, 0x04); /* page 4 */ | ||
| 602 | reg_w(gspca_dev, 0x0e, 0x00); | ||
| 603 | reg_w(gspca_dev, 0x0f, gain); | ||
| 604 | } | ||
| 312 | /* load registers to sensor (Bit 0, auto clear) */ | 605 | /* load registers to sensor (Bit 0, auto clear) */ |
| 313 | reg_w(gspca_dev, 0x11, 0x01); | 606 | reg_w(gspca_dev, 0x11, 0x01); |
| 314 | PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors); | ||
| 315 | } | 607 | } |
| 316 | 608 | ||
| 317 | static void setautogain(struct gspca_dev *gspca_dev) | 609 | static void setexposure(struct gspca_dev *gspca_dev) |
| 318 | { | 610 | { |
| 319 | struct sd *sd = (struct sd *) gspca_dev; | 611 | struct sd *sd = (struct sd *) gspca_dev; |
| 612 | __u8 reg; | ||
| 613 | |||
| 614 | /* register 2 of frame 3/4 contains the clock divider configuring the | ||
| 615 | no fps according to the formula: 60 / reg. sd->exposure is the | ||
| 616 | desired exposure time in ms. */ | ||
| 617 | reg = 120 * sd->exposure / 1000; | ||
| 618 | if (reg < 2) | ||
| 619 | reg = 2; | ||
| 620 | else if (reg > 63) | ||
| 621 | reg = 63; | ||
| 622 | |||
| 623 | if (sd->sensor == SENSOR_PAC7302) { | ||
| 624 | /* On the pac7302 reg2 MUST be a multiple of 3, so round it to | ||
| 625 | the nearest multiple of 3, except when between 6 and 12? */ | ||
| 626 | if (reg < 6 || reg > 12) | ||
| 627 | reg = ((reg + 1) / 3) * 3; | ||
| 628 | reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ | ||
| 629 | reg_w(gspca_dev, 0x02, reg); | ||
| 630 | } else { | ||
| 631 | reg_w(gspca_dev, 0xff, 0x04); /* page 4 */ | ||
| 632 | reg_w(gspca_dev, 0x02, reg); | ||
| 633 | /* Page 1 register 8 must always be 0x08 except when not in | ||
| 634 | 640x480 mode and Page3/4 reg 2 <= 3 then it must be 9 */ | ||
| 635 | reg_w(gspca_dev, 0xff, 0x01); | ||
| 636 | if (gspca_dev->cam.cam_mode[(int)gspca_dev->curr_mode].priv && | ||
| 637 | reg <= 3) | ||
| 638 | reg_w(gspca_dev, 0x08, 0x09); | ||
| 639 | else | ||
| 640 | reg_w(gspca_dev, 0x08, 0x08); | ||
| 641 | } | ||
| 642 | /* load registers to sensor (Bit 0, auto clear) */ | ||
| 643 | reg_w(gspca_dev, 0x11, 0x01); | ||
| 644 | } | ||
| 320 | 645 | ||
| 321 | if (sd->autogain) { | 646 | static void sethvflip(struct gspca_dev *gspca_dev) |
| 322 | sd->lum_sum = 0; | 647 | { |
| 323 | sd->ag_cnt = AG_CNT_START; | 648 | struct sd *sd = (struct sd *) gspca_dev; |
| 649 | __u8 data; | ||
| 650 | |||
| 651 | if (sd->sensor == SENSOR_PAC7302) { | ||
| 652 | reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ | ||
| 653 | data = (sd->hflip ? 0x08 : 0x00) | ||
| 654 | | (sd->vflip ? 0x04 : 0x00); | ||
| 324 | } else { | 655 | } else { |
| 325 | sd->ag_cnt = -1; | 656 | reg_w(gspca_dev, 0xff, 0x04); /* page 4 */ |
| 657 | data = (sd->hflip ? 0x04 : 0x00) | ||
| 658 | | (sd->vflip ? 0x08 : 0x00); | ||
| 326 | } | 659 | } |
| 660 | reg_w(gspca_dev, 0x21, data); | ||
| 661 | /* load registers to sensor (Bit 0, auto clear) */ | ||
| 662 | reg_w(gspca_dev, 0x11, 0x01); | ||
| 327 | } | 663 | } |
| 328 | 664 | ||
| 329 | /* this function is called at open time */ | 665 | /* this function is called at probe and resume time */ |
| 330 | static int sd_open(struct gspca_dev *gspca_dev) | 666 | static int sd_init(struct gspca_dev *gspca_dev) |
| 331 | { | 667 | { |
| 332 | reg_w(gspca_dev, 0x78, 0x00); /* Turn on LED */ | 668 | struct sd *sd = (struct sd *) gspca_dev; |
| 669 | |||
| 670 | if (sd->sensor == SENSOR_PAC7302) | ||
| 671 | reg_w_seq(gspca_dev, init_7302, sizeof init_7302); | ||
| 672 | else | ||
| 673 | reg_w_seq(gspca_dev, init_7311, sizeof init_7311); | ||
| 674 | |||
| 333 | return 0; | 675 | return 0; |
| 334 | } | 676 | } |
| 335 | 677 | ||
| 336 | static void sd_start(struct gspca_dev *gspca_dev) | 678 | static void sd_start(struct gspca_dev *gspca_dev) |
| 337 | { | 679 | { |
| 338 | reg_w(gspca_dev, 0xff, 0x01); | 680 | struct sd *sd = (struct sd *) gspca_dev; |
| 339 | reg_w_buf(gspca_dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8); | ||
| 340 | reg_w_buf(gspca_dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8); | ||
| 341 | reg_w_buf(gspca_dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8); | ||
| 342 | reg_w_buf(gspca_dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8); | ||
| 343 | reg_w_buf(gspca_dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8); | ||
| 344 | reg_w_buf(gspca_dev, 0x002a, "\x00\x00\x00", 3); | ||
| 345 | reg_w_buf(gspca_dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8); | ||
| 346 | reg_w_buf(gspca_dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8); | ||
| 347 | reg_w_buf(gspca_dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8); | ||
| 348 | reg_w_buf(gspca_dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8); | ||
| 349 | reg_w_buf(gspca_dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8); | ||
| 350 | reg_w_buf(gspca_dev, 0x0066, "\xd0\xff", 2); | ||
| 351 | reg_w_buf(gspca_dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6); | ||
| 352 | reg_w_buf(gspca_dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8); | ||
| 353 | reg_w_buf(gspca_dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8); | ||
| 354 | reg_w_buf(gspca_dev, 0x008f, "\x18\x20", 2); | ||
| 355 | reg_w_buf(gspca_dev, 0x0096, "\x01\x08\x04", 3); | ||
| 356 | reg_w_buf(gspca_dev, 0x00a0, "\x44\x44\x44\x04", 4); | ||
| 357 | reg_w_buf(gspca_dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8); | ||
| 358 | reg_w_buf(gspca_dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5); | ||
| 359 | 681 | ||
| 360 | reg_w(gspca_dev, 0xff, 0x04); | 682 | sd->sof_read = 0; |
| 361 | reg_w(gspca_dev, 0x02, 0x04); | 683 | |
| 362 | reg_w(gspca_dev, 0x03, 0x54); | 684 | if (sd->sensor == SENSOR_PAC7302) { |
| 363 | reg_w(gspca_dev, 0x04, 0x07); | 685 | reg_w_var(gspca_dev, start_7302); |
| 364 | reg_w(gspca_dev, 0x05, 0x2b); | 686 | setbrightcont(gspca_dev); |
| 365 | reg_w(gspca_dev, 0x06, 0x09); | 687 | setcolors(gspca_dev); |
| 366 | reg_w(gspca_dev, 0x07, 0x0f); | 688 | } else { |
| 367 | reg_w(gspca_dev, 0x08, 0x09); | 689 | reg_w_var(gspca_dev, start_7311); |
| 368 | reg_w(gspca_dev, 0x09, 0x00); | 690 | setcontrast(gspca_dev); |
| 369 | reg_w(gspca_dev, 0x0c, 0x07); | 691 | } |
| 370 | reg_w(gspca_dev, 0x0d, 0x00); | 692 | setgain(gspca_dev); |
| 371 | reg_w(gspca_dev, 0x0e, 0x00); | 693 | setexposure(gspca_dev); |
| 372 | reg_w(gspca_dev, 0x0f, 0x62); | 694 | sethvflip(gspca_dev); |
| 373 | reg_w(gspca_dev, 0x10, 0x08); | ||
| 374 | reg_w(gspca_dev, 0x12, 0x07); | ||
| 375 | reg_w(gspca_dev, 0x13, 0x00); | ||
| 376 | reg_w(gspca_dev, 0x14, 0x00); | ||
| 377 | reg_w(gspca_dev, 0x15, 0x00); | ||
| 378 | reg_w(gspca_dev, 0x16, 0x00); | ||
| 379 | reg_w(gspca_dev, 0x17, 0x00); | ||
| 380 | reg_w(gspca_dev, 0x18, 0x00); | ||
| 381 | reg_w(gspca_dev, 0x19, 0x00); | ||
| 382 | reg_w(gspca_dev, 0x1a, 0x00); | ||
| 383 | reg_w(gspca_dev, 0x1b, 0x03); | ||
| 384 | reg_w(gspca_dev, 0x1c, 0xa0); | ||
| 385 | reg_w(gspca_dev, 0x1d, 0x01); | ||
| 386 | reg_w(gspca_dev, 0x1e, 0xf4); | ||
| 387 | reg_w(gspca_dev, 0x21, 0x00); | ||
| 388 | reg_w(gspca_dev, 0x22, 0x08); | ||
| 389 | reg_w(gspca_dev, 0x24, 0x03); | ||
| 390 | reg_w(gspca_dev, 0x26, 0x00); | ||
| 391 | reg_w(gspca_dev, 0x27, 0x01); | ||
| 392 | reg_w(gspca_dev, 0x28, 0xca); | ||
| 393 | reg_w(gspca_dev, 0x29, 0x10); | ||
| 394 | reg_w(gspca_dev, 0x2a, 0x06); | ||
| 395 | reg_w(gspca_dev, 0x2b, 0x78); | ||
| 396 | reg_w(gspca_dev, 0x2c, 0x00); | ||
| 397 | reg_w(gspca_dev, 0x2d, 0x00); | ||
| 398 | reg_w(gspca_dev, 0x2e, 0x00); | ||
| 399 | reg_w(gspca_dev, 0x2f, 0x00); | ||
| 400 | reg_w(gspca_dev, 0x30, 0x23); | ||
| 401 | reg_w(gspca_dev, 0x31, 0x28); | ||
| 402 | reg_w(gspca_dev, 0x32, 0x04); | ||
| 403 | reg_w(gspca_dev, 0x33, 0x11); | ||
| 404 | reg_w(gspca_dev, 0x34, 0x00); | ||
| 405 | reg_w(gspca_dev, 0x35, 0x00); | ||
| 406 | reg_w(gspca_dev, 0x11, 0x01); | ||
| 407 | setcontrast(gspca_dev); | ||
| 408 | setbrightness(gspca_dev); | ||
| 409 | setcolors(gspca_dev); | ||
| 410 | setautogain(gspca_dev); | ||
| 411 | 695 | ||
| 412 | /* set correct resolution */ | 696 | /* set correct resolution */ |
| 413 | switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { | 697 | switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { |
| 414 | case 2: /* 160x120 */ | 698 | case 2: /* 160x120 pac7311 */ |
| 415 | reg_w(gspca_dev, 0xff, 0x04); | ||
| 416 | reg_w(gspca_dev, 0x02, 0x03); | ||
| 417 | reg_w(gspca_dev, 0xff, 0x01); | 699 | reg_w(gspca_dev, 0xff, 0x01); |
| 418 | reg_w(gspca_dev, 0x08, 0x09); | ||
| 419 | reg_w(gspca_dev, 0x17, 0x20); | 700 | reg_w(gspca_dev, 0x17, 0x20); |
| 420 | reg_w(gspca_dev, 0x1b, 0x00); | ||
| 421 | /* reg_w(gspca_dev, 0x80, 0x69); */ | ||
| 422 | reg_w(gspca_dev, 0x87, 0x10); | 701 | reg_w(gspca_dev, 0x87, 0x10); |
| 423 | break; | 702 | break; |
| 424 | case 1: /* 320x240 */ | 703 | case 1: /* 320x240 pac7311 */ |
| 425 | reg_w(gspca_dev, 0xff, 0x04); | ||
| 426 | reg_w(gspca_dev, 0x02, 0x03); | ||
| 427 | reg_w(gspca_dev, 0xff, 0x01); | 704 | reg_w(gspca_dev, 0xff, 0x01); |
| 428 | reg_w(gspca_dev, 0x08, 0x09); | ||
| 429 | reg_w(gspca_dev, 0x17, 0x30); | 705 | reg_w(gspca_dev, 0x17, 0x30); |
| 430 | /* reg_w(gspca_dev, 0x80, 0x3f); */ | ||
| 431 | reg_w(gspca_dev, 0x87, 0x11); | 706 | reg_w(gspca_dev, 0x87, 0x11); |
| 432 | break; | 707 | break; |
| 433 | case 0: /* 640x480 */ | 708 | case 0: /* 640x480 */ |
| 434 | reg_w(gspca_dev, 0xff, 0x04); | 709 | if (sd->sensor == SENSOR_PAC7302) |
| 435 | reg_w(gspca_dev, 0x02, 0x03); | 710 | break; |
| 436 | reg_w(gspca_dev, 0xff, 0x01); | 711 | reg_w(gspca_dev, 0xff, 0x01); |
| 437 | reg_w(gspca_dev, 0x08, 0x08); | ||
| 438 | reg_w(gspca_dev, 0x17, 0x00); | 712 | reg_w(gspca_dev, 0x17, 0x00); |
| 439 | /* reg_w(gspca_dev, 0x80, 0x1c); */ | ||
| 440 | reg_w(gspca_dev, 0x87, 0x12); | 713 | reg_w(gspca_dev, 0x87, 0x12); |
| 441 | break; | 714 | break; |
| 442 | } | 715 | } |
| 443 | 716 | ||
| 717 | sd->sof_read = 0; | ||
| 718 | sd->autogain_ignore_frames = 0; | ||
| 719 | atomic_set(&sd->avg_lum, -1); | ||
| 720 | |||
| 444 | /* start stream */ | 721 | /* start stream */ |
| 445 | reg_w(gspca_dev, 0xff, 0x01); | 722 | reg_w(gspca_dev, 0xff, 0x01); |
| 446 | reg_w(gspca_dev, 0x78, 0x04); | 723 | if (sd->sensor == SENSOR_PAC7302) |
| 447 | reg_w(gspca_dev, 0x78, 0x05); | 724 | reg_w(gspca_dev, 0x78, 0x01); |
| 725 | else | ||
| 726 | reg_w(gspca_dev, 0x78, 0x05); | ||
| 448 | } | 727 | } |
| 449 | 728 | ||
| 450 | static void sd_stopN(struct gspca_dev *gspca_dev) | 729 | static void sd_stopN(struct gspca_dev *gspca_dev) |
| 451 | { | 730 | { |
| 731 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 732 | |||
| 733 | if (sd->sensor == SENSOR_PAC7302) { | ||
| 734 | reg_w(gspca_dev, 0xff, 0x01); | ||
| 735 | reg_w(gspca_dev, 0x78, 0x00); | ||
| 736 | reg_w(gspca_dev, 0x78, 0x00); | ||
| 737 | return; | ||
| 738 | } | ||
| 452 | reg_w(gspca_dev, 0xff, 0x04); | 739 | reg_w(gspca_dev, 0xff, 0x04); |
| 453 | reg_w(gspca_dev, 0x27, 0x80); | 740 | reg_w(gspca_dev, 0x27, 0x80); |
| 454 | reg_w(gspca_dev, 0x28, 0xca); | 741 | reg_w(gspca_dev, 0x28, 0xca); |
| @@ -456,187 +743,147 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 456 | reg_w(gspca_dev, 0x2a, 0x0e); | 743 | reg_w(gspca_dev, 0x2a, 0x0e); |
| 457 | reg_w(gspca_dev, 0xff, 0x01); | 744 | reg_w(gspca_dev, 0xff, 0x01); |
| 458 | reg_w(gspca_dev, 0x3e, 0x20); | 745 | reg_w(gspca_dev, 0x3e, 0x20); |
| 459 | reg_w(gspca_dev, 0x78, 0x04); /* Bit_0=start stream, Bit_7=LED */ | 746 | reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */ |
| 460 | reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ | 747 | reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */ |
| 461 | reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ | 748 | reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */ |
| 462 | } | 749 | } |
| 463 | 750 | ||
| 464 | static void sd_stop0(struct gspca_dev *gspca_dev) | 751 | static void sd_stop0(struct gspca_dev *gspca_dev) |
| 465 | { | 752 | { |
| 466 | } | 753 | struct sd *sd = (struct sd *) gspca_dev; |
| 467 | 754 | ||
| 468 | /* this function is called at close time */ | 755 | if (sd->sensor == SENSOR_PAC7302) { |
| 469 | static void sd_close(struct gspca_dev *gspca_dev) | 756 | reg_w(gspca_dev, 0xff, 0x01); |
| 470 | { | 757 | reg_w(gspca_dev, 0x78, 0x40); |
| 471 | reg_w(gspca_dev, 0xff, 0x04); | 758 | } |
| 472 | reg_w(gspca_dev, 0x27, 0x80); | ||
| 473 | reg_w(gspca_dev, 0x28, 0xca); | ||
| 474 | reg_w(gspca_dev, 0x29, 0x53); | ||
| 475 | reg_w(gspca_dev, 0x2a, 0x0e); | ||
| 476 | reg_w(gspca_dev, 0xff, 0x01); | ||
| 477 | reg_w(gspca_dev, 0x3e, 0x20); | ||
| 478 | reg_w(gspca_dev, 0x78, 0x04); /* Bit_0=start stream, Bit_7=LED */ | ||
| 479 | reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ | ||
| 480 | reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ | ||
| 481 | } | 759 | } |
| 482 | 760 | ||
| 761 | /* Include pac common sof detection functions */ | ||
| 762 | #include "pac_common.h" | ||
| 763 | |||
| 483 | static void do_autogain(struct gspca_dev *gspca_dev) | 764 | static void do_autogain(struct gspca_dev *gspca_dev) |
| 484 | { | 765 | { |
| 485 | struct sd *sd = (struct sd *) gspca_dev; | 766 | struct sd *sd = (struct sd *) gspca_dev; |
| 486 | int luma; | 767 | int avg_lum = atomic_read(&sd->avg_lum); |
| 487 | int luma_mean = 128; | 768 | int desired_lum, deadzone; |
| 488 | int luma_delta = 20; | ||
| 489 | __u8 spring = 5; | ||
| 490 | int Gbright; | ||
| 491 | 769 | ||
| 492 | if (!atomic_read(&sd->do_gain)) | 770 | if (avg_lum == -1) |
| 493 | return; | 771 | return; |
| 494 | atomic_set(&sd->do_gain, 0); | 772 | |
| 495 | 773 | if (sd->sensor == SENSOR_PAC7302) { | |
| 496 | luma = atomic_read(&sd->avg_lum); | 774 | desired_lum = 270 + sd->brightness * 4; |
| 497 | Gbright = reg_r(gspca_dev, 0x02); | 775 | /* Hack hack, with the 7202 the first exposure step is |
| 498 | PDEBUG(D_FRAM, "luma mean %d", luma); | 776 | pretty large, so if we're about to make the first |
| 499 | if (luma < luma_mean - luma_delta || | 777 | exposure increase make the deadzone large to avoid |
| 500 | luma > luma_mean + luma_delta) { | 778 | oscilating */ |
| 501 | Gbright += (luma_mean - luma) >> spring; | 779 | if (desired_lum > avg_lum && sd->gain == GAIN_DEF && |
| 502 | if (Gbright > 0x1a) | 780 | sd->exposure > EXPOSURE_DEF && |
| 503 | Gbright = 0x1a; | 781 | sd->exposure < 42) |
| 504 | else if (Gbright < 4) | 782 | deadzone = 90; |
| 505 | Gbright = 4; | 783 | else |
| 506 | PDEBUG(D_FRAM, "gbright %d", Gbright); | 784 | deadzone = 30; |
| 507 | reg_w(gspca_dev, 0xff, 0x04); | 785 | } else { |
| 508 | reg_w(gspca_dev, 0x0f, Gbright); | 786 | desired_lum = 200; |
| 509 | /* load registers to sensor (Bit 0, auto clear) */ | 787 | deadzone = 20; |
| 510 | reg_w(gspca_dev, 0x11, 0x01); | ||
| 511 | } | 788 | } |
| 789 | |||
| 790 | if (sd->autogain_ignore_frames > 0) | ||
| 791 | sd->autogain_ignore_frames--; | ||
| 792 | else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum, desired_lum, | ||
| 793 | deadzone, GAIN_KNEE, EXPOSURE_KNEE)) | ||
| 794 | sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; | ||
| 512 | } | 795 | } |
| 513 | 796 | ||
| 797 | static const unsigned char pac7311_jpeg_header1[] = { | ||
| 798 | 0xff, 0xd8, 0xff, 0xc0, 0x00, 0x11, 0x08 | ||
| 799 | }; | ||
| 800 | |||
| 801 | static const unsigned char pac7311_jpeg_header2[] = { | ||
| 802 | 0x03, 0x01, 0x21, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xda, | ||
| 803 | 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00 | ||
| 804 | }; | ||
| 805 | |||
| 806 | /* this function is run at interrupt level */ | ||
| 514 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 807 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 515 | struct gspca_frame *frame, /* target */ | 808 | struct gspca_frame *frame, /* target */ |
| 516 | __u8 *data, /* isoc packet */ | 809 | __u8 *data, /* isoc packet */ |
| 517 | int len) /* iso packet length */ | 810 | int len) /* iso packet length */ |
| 518 | { | 811 | { |
| 519 | struct sd *sd = (struct sd *) gspca_dev; | 812 | struct sd *sd = (struct sd *) gspca_dev; |
| 520 | unsigned char tmpbuf[4]; | 813 | unsigned char *sof; |
| 521 | int i, p, ffseq; | 814 | |
| 522 | 815 | sof = pac_find_sof(gspca_dev, data, len); | |
| 523 | /* if (len < 5) { */ | 816 | if (sof) { |
| 524 | if (len < 6) { | 817 | unsigned char tmpbuf[4]; |
| 525 | /* gspca_dev->last_packet_type = DISCARD_PACKET; */ | 818 | int n, lum_offset, footer_length; |
| 526 | return; | 819 | |
| 527 | } | 820 | if (sd->sensor == SENSOR_PAC7302) { |
| 528 | 821 | /* 6 bytes after the FF D9 EOF marker a number of lumination | |
| 529 | ffseq = sd->ffseq; | 822 | bytes are send corresponding to different parts of the |
| 530 | 823 | image, the 14th and 15th byte after the EOF seem to | |
| 531 | for (p = 0; p < len - 6; p++) { | 824 | correspond to the center of the image */ |
| 532 | if ((data[0 + p] == 0xff) | 825 | lum_offset = 61 + sizeof pac_sof_marker; |
| 533 | && (data[1 + p] == 0xff) | 826 | footer_length = 74; |
| 534 | && (data[2 + p] == 0x00) | 827 | } else { |
| 535 | && (data[3 + p] == 0xff) | 828 | lum_offset = 24 + sizeof pac_sof_marker; |
| 536 | && (data[4 + p] == 0x96)) { | 829 | footer_length = 26; |
| 537 | 830 | } | |
| 538 | /* start of frame */ | ||
| 539 | if (sd->ag_cnt >= 0 && p > 28) { | ||
| 540 | sd->lum_sum += data[p - 23]; | ||
| 541 | if (--sd->ag_cnt < 0) { | ||
| 542 | sd->ag_cnt = AG_CNT_START; | ||
| 543 | atomic_set(&sd->avg_lum, | ||
| 544 | sd->lum_sum / AG_CNT_START); | ||
| 545 | sd->lum_sum = 0; | ||
| 546 | atomic_set(&sd->do_gain, 1); | ||
| 547 | } | ||
| 548 | } | ||
| 549 | 831 | ||
| 550 | /* copy the end of data to the current frame */ | 832 | /* Finish decoding current frame */ |
| 833 | n = (sof - data) - (footer_length + sizeof pac_sof_marker); | ||
| 834 | if (n < 0) { | ||
| 835 | frame->data_end += n; | ||
| 836 | n = 0; | ||
| 837 | } | ||
| 838 | frame = gspca_frame_add(gspca_dev, INTER_PACKET, frame, | ||
| 839 | data, n); | ||
| 840 | if (gspca_dev->last_packet_type != DISCARD_PACKET && | ||
| 841 | frame->data_end[-2] == 0xff && | ||
| 842 | frame->data_end[-1] == 0xd9) | ||
| 551 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, | 843 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, |
| 552 | data, p); | 844 | NULL, 0); |
| 553 | 845 | ||
| 554 | /* put the JPEG header in the new frame */ | 846 | n = sof - data; |
| 555 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, | 847 | len -= n; |
| 556 | (unsigned char *) pac7311_jpeg_header, | 848 | data = sof; |
| 557 | 12); | 849 | |
| 850 | /* Get average lumination */ | ||
| 851 | if (gspca_dev->last_packet_type == LAST_PACKET && | ||
| 852 | n >= lum_offset) | ||
| 853 | atomic_set(&sd->avg_lum, data[-lum_offset] + | ||
| 854 | data[-lum_offset + 1]); | ||
| 855 | else | ||
| 856 | atomic_set(&sd->avg_lum, -1); | ||
| 857 | |||
| 858 | /* Start the new frame with the jpeg header */ | ||
| 859 | gspca_frame_add(gspca_dev, FIRST_PACKET, frame, | ||
| 860 | pac7311_jpeg_header1, sizeof(pac7311_jpeg_header1)); | ||
| 861 | if (sd->sensor == SENSOR_PAC7302) { | ||
| 862 | /* The PAC7302 has the image rotated 90 degrees */ | ||
| 863 | tmpbuf[0] = gspca_dev->width >> 8; | ||
| 864 | tmpbuf[1] = gspca_dev->width & 0xff; | ||
| 865 | tmpbuf[2] = gspca_dev->height >> 8; | ||
| 866 | tmpbuf[3] = gspca_dev->height & 0xff; | ||
| 867 | } else { | ||
| 558 | tmpbuf[0] = gspca_dev->height >> 8; | 868 | tmpbuf[0] = gspca_dev->height >> 8; |
| 559 | tmpbuf[1] = gspca_dev->height & 0xff; | 869 | tmpbuf[1] = gspca_dev->height & 0xff; |
| 560 | tmpbuf[2] = gspca_dev->width >> 8; | 870 | tmpbuf[2] = gspca_dev->width >> 8; |
| 561 | tmpbuf[3] = gspca_dev->width & 0xff; | 871 | tmpbuf[3] = gspca_dev->width & 0xff; |
| 562 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, | ||
| 563 | tmpbuf, 4); | ||
| 564 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, | ||
| 565 | (unsigned char *) &pac7311_jpeg_header[16], | ||
| 566 | PAC7311_JPEG_HEADER_SIZE - 16); | ||
| 567 | |||
| 568 | data += p + 7; | ||
| 569 | len -= p + 7; | ||
| 570 | ffseq = 0; | ||
| 571 | break; | ||
| 572 | } | 872 | } |
| 873 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, tmpbuf, 4); | ||
| 874 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, | ||
| 875 | pac7311_jpeg_header2, sizeof(pac7311_jpeg_header2)); | ||
| 573 | } | 876 | } |
| 574 | |||
| 575 | /* remove the 'ff ff ff xx' sequences */ | ||
| 576 | switch (ffseq) { | ||
| 577 | case 3: | ||
| 578 | data += 1; | ||
| 579 | len -= 1; | ||
| 580 | break; | ||
| 581 | case 2: | ||
| 582 | if (data[0] == 0xff) { | ||
| 583 | data += 2; | ||
| 584 | len -= 2; | ||
| 585 | frame->data_end -= 2; | ||
| 586 | } | ||
| 587 | break; | ||
| 588 | case 1: | ||
| 589 | if (data[0] == 0xff | ||
| 590 | && data[1] == 0xff) { | ||
| 591 | data += 3; | ||
| 592 | len -= 3; | ||
| 593 | frame->data_end -= 1; | ||
| 594 | } | ||
| 595 | break; | ||
| 596 | } | ||
| 597 | for (i = 0; i < len - 4; i++) { | ||
| 598 | if (data[i] == 0xff | ||
| 599 | && data[i + 1] == 0xff | ||
| 600 | && data[i + 2] == 0xff) { | ||
| 601 | memmove(&data[i], &data[i + 4], len - i - 4); | ||
| 602 | len -= 4; | ||
| 603 | } | ||
| 604 | } | ||
| 605 | ffseq = 0; | ||
| 606 | if (data[len - 4] == 0xff) { | ||
| 607 | if (data[len - 3] == 0xff | ||
| 608 | && data[len - 2] == 0xff) { | ||
| 609 | len -= 4; | ||
| 610 | } | ||
| 611 | } else if (data[len - 3] == 0xff) { | ||
| 612 | if (data[len - 2] == 0xff | ||
| 613 | && data[len - 1] == 0xff) | ||
| 614 | ffseq = 3; | ||
| 615 | } else if (data[len - 2] == 0xff) { | ||
| 616 | if (data[len - 1] == 0xff) | ||
| 617 | ffseq = 2; | ||
| 618 | } else if (data[len - 1] == 0xff) | ||
| 619 | ffseq = 1; | ||
| 620 | sd->ffseq = ffseq; | ||
| 621 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); | 877 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); |
| 622 | } | 878 | } |
| 623 | 879 | ||
| 624 | static void getbrightness(struct gspca_dev *gspca_dev) | ||
| 625 | { | ||
| 626 | /* sd->brightness = reg_r(gspca_dev, 0x08); | ||
| 627 | return sd->brightness; */ | ||
| 628 | /* PDEBUG(D_CONF, "Called pac7311_getbrightness: Not implemented yet"); */ | ||
| 629 | } | ||
| 630 | |||
| 631 | |||
| 632 | |||
| 633 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | 880 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) |
| 634 | { | 881 | { |
| 635 | struct sd *sd = (struct sd *) gspca_dev; | 882 | struct sd *sd = (struct sd *) gspca_dev; |
| 636 | 883 | ||
| 637 | sd->brightness = val; | 884 | sd->brightness = val; |
| 638 | if (gspca_dev->streaming) | 885 | if (gspca_dev->streaming) |
| 639 | setbrightness(gspca_dev); | 886 | setbrightcont(gspca_dev); |
| 640 | return 0; | 887 | return 0; |
| 641 | } | 888 | } |
| 642 | 889 | ||
| @@ -644,7 +891,6 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) | |||
| 644 | { | 891 | { |
| 645 | struct sd *sd = (struct sd *) gspca_dev; | 892 | struct sd *sd = (struct sd *) gspca_dev; |
| 646 | 893 | ||
| 647 | getbrightness(gspca_dev); | ||
| 648 | *val = sd->brightness; | 894 | *val = sd->brightness; |
| 649 | return 0; | 895 | return 0; |
| 650 | } | 896 | } |
| @@ -654,8 +900,12 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) | |||
| 654 | struct sd *sd = (struct sd *) gspca_dev; | 900 | struct sd *sd = (struct sd *) gspca_dev; |
| 655 | 901 | ||
| 656 | sd->contrast = val; | 902 | sd->contrast = val; |
| 657 | if (gspca_dev->streaming) | 903 | if (gspca_dev->streaming) { |
| 658 | setcontrast(gspca_dev); | 904 | if (sd->sensor == SENSOR_PAC7302) |
| 905 | setbrightcont(gspca_dev); | ||
| 906 | else | ||
| 907 | setcontrast(gspca_dev); | ||
| 908 | } | ||
| 659 | return 0; | 909 | return 0; |
| 660 | } | 910 | } |
| 661 | 911 | ||
| @@ -663,7 +913,6 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) | |||
| 663 | { | 913 | { |
| 664 | struct sd *sd = (struct sd *) gspca_dev; | 914 | struct sd *sd = (struct sd *) gspca_dev; |
| 665 | 915 | ||
| 666 | /* getcontrast(gspca_dev); */ | ||
| 667 | *val = sd->contrast; | 916 | *val = sd->contrast; |
| 668 | return 0; | 917 | return 0; |
| 669 | } | 918 | } |
| @@ -682,18 +931,66 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) | |||
| 682 | { | 931 | { |
| 683 | struct sd *sd = (struct sd *) gspca_dev; | 932 | struct sd *sd = (struct sd *) gspca_dev; |
| 684 | 933 | ||
| 685 | /* getcolors(gspca_dev); */ | ||
| 686 | *val = sd->colors; | 934 | *val = sd->colors; |
| 687 | return 0; | 935 | return 0; |
| 688 | } | 936 | } |
| 689 | 937 | ||
| 938 | static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val) | ||
| 939 | { | ||
| 940 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 941 | |||
| 942 | sd->gain = val; | ||
| 943 | if (gspca_dev->streaming) | ||
| 944 | setgain(gspca_dev); | ||
| 945 | return 0; | ||
| 946 | } | ||
| 947 | |||
| 948 | static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val) | ||
| 949 | { | ||
| 950 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 951 | |||
| 952 | *val = sd->gain; | ||
| 953 | return 0; | ||
| 954 | } | ||
| 955 | |||
| 956 | static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val) | ||
| 957 | { | ||
| 958 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 959 | |||
| 960 | sd->exposure = val; | ||
| 961 | if (gspca_dev->streaming) | ||
| 962 | setexposure(gspca_dev); | ||
| 963 | return 0; | ||
| 964 | } | ||
| 965 | |||
| 966 | static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val) | ||
| 967 | { | ||
| 968 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 969 | |||
| 970 | *val = sd->exposure; | ||
| 971 | return 0; | ||
| 972 | } | ||
| 973 | |||
| 690 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) | 974 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) |
| 691 | { | 975 | { |
| 692 | struct sd *sd = (struct sd *) gspca_dev; | 976 | struct sd *sd = (struct sd *) gspca_dev; |
| 693 | 977 | ||
| 694 | sd->autogain = val; | 978 | sd->autogain = val; |
| 695 | if (gspca_dev->streaming) | 979 | /* when switching to autogain set defaults to make sure |
| 696 | setautogain(gspca_dev); | 980 | we are on a valid point of the autogain gain / |
| 981 | exposure knee graph, and give this change time to | ||
| 982 | take effect before doing autogain. */ | ||
| 983 | if (sd->autogain) { | ||
| 984 | sd->exposure = EXPOSURE_DEF; | ||
| 985 | sd->gain = GAIN_DEF; | ||
| 986 | if (gspca_dev->streaming) { | ||
| 987 | sd->autogain_ignore_frames = | ||
| 988 | PAC_AUTOGAIN_IGNORE_FRAMES; | ||
| 989 | setexposure(gspca_dev); | ||
| 990 | setgain(gspca_dev); | ||
| 991 | } | ||
| 992 | } | ||
| 993 | |||
| 697 | return 0; | 994 | return 0; |
| 698 | } | 995 | } |
| 699 | 996 | ||
| @@ -705,30 +1002,67 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) | |||
| 705 | return 0; | 1002 | return 0; |
| 706 | } | 1003 | } |
| 707 | 1004 | ||
| 1005 | static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val) | ||
| 1006 | { | ||
| 1007 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1008 | |||
| 1009 | sd->hflip = val; | ||
| 1010 | if (gspca_dev->streaming) | ||
| 1011 | sethvflip(gspca_dev); | ||
| 1012 | return 0; | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val) | ||
| 1016 | { | ||
| 1017 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1018 | |||
| 1019 | *val = sd->hflip; | ||
| 1020 | return 0; | ||
| 1021 | } | ||
| 1022 | |||
| 1023 | static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val) | ||
| 1024 | { | ||
| 1025 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1026 | |||
| 1027 | sd->vflip = val; | ||
| 1028 | if (gspca_dev->streaming) | ||
| 1029 | sethvflip(gspca_dev); | ||
| 1030 | return 0; | ||
| 1031 | } | ||
| 1032 | |||
| 1033 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) | ||
| 1034 | { | ||
| 1035 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1036 | |||
| 1037 | *val = sd->vflip; | ||
| 1038 | return 0; | ||
| 1039 | } | ||
| 1040 | |||
| 708 | /* sub-driver description */ | 1041 | /* sub-driver description */ |
| 709 | static struct sd_desc sd_desc = { | 1042 | static struct sd_desc sd_desc = { |
| 710 | .name = MODULE_NAME, | 1043 | .name = MODULE_NAME, |
| 711 | .ctrls = sd_ctrls, | 1044 | .ctrls = sd_ctrls, |
| 712 | .nctrls = ARRAY_SIZE(sd_ctrls), | 1045 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 713 | .config = sd_config, | 1046 | .config = sd_config, |
| 714 | .open = sd_open, | 1047 | .init = sd_init, |
| 715 | .start = sd_start, | 1048 | .start = sd_start, |
| 716 | .stopN = sd_stopN, | 1049 | .stopN = sd_stopN, |
| 717 | .stop0 = sd_stop0, | 1050 | .stop0 = sd_stop0, |
| 718 | .close = sd_close, | ||
| 719 | .pkt_scan = sd_pkt_scan, | 1051 | .pkt_scan = sd_pkt_scan, |
| 720 | .dq_callback = do_autogain, | 1052 | .dq_callback = do_autogain, |
| 721 | }; | 1053 | }; |
| 722 | 1054 | ||
| 723 | /* -- module initialisation -- */ | 1055 | /* -- module initialisation -- */ |
| 724 | static __devinitdata struct usb_device_id device_table[] = { | 1056 | static __devinitdata struct usb_device_id device_table[] = { |
| 725 | {USB_DEVICE(0x093a, 0x2600)}, | 1057 | {USB_DEVICE(0x093a, 0x2600), .driver_info = SENSOR_PAC7311}, |
| 726 | {USB_DEVICE(0x093a, 0x2601)}, | 1058 | {USB_DEVICE(0x093a, 0x2601), .driver_info = SENSOR_PAC7311}, |
| 727 | {USB_DEVICE(0x093a, 0x2603)}, | 1059 | {USB_DEVICE(0x093a, 0x2603), .driver_info = SENSOR_PAC7311}, |
| 728 | {USB_DEVICE(0x093a, 0x2608)}, | 1060 | {USB_DEVICE(0x093a, 0x2608), .driver_info = SENSOR_PAC7311}, |
| 729 | {USB_DEVICE(0x093a, 0x260e)}, | 1061 | {USB_DEVICE(0x093a, 0x260e), .driver_info = SENSOR_PAC7311}, |
| 730 | {USB_DEVICE(0x093a, 0x260f)}, | 1062 | {USB_DEVICE(0x093a, 0x260f), .driver_info = SENSOR_PAC7311}, |
| 731 | {USB_DEVICE(0x093a, 0x2621)}, | 1063 | {USB_DEVICE(0x093a, 0x2621), .driver_info = SENSOR_PAC7302}, |
| 1064 | {USB_DEVICE(0x093a, 0x2624), .driver_info = SENSOR_PAC7302}, | ||
| 1065 | {USB_DEVICE(0x093a, 0x2626), .driver_info = SENSOR_PAC7302}, | ||
| 732 | {} | 1066 | {} |
| 733 | }; | 1067 | }; |
| 734 | MODULE_DEVICE_TABLE(usb, device_table); | 1068 | MODULE_DEVICE_TABLE(usb, device_table); |
| @@ -746,6 +1080,10 @@ static struct usb_driver sd_driver = { | |||
| 746 | .id_table = device_table, | 1080 | .id_table = device_table, |
| 747 | .probe = sd_probe, | 1081 | .probe = sd_probe, |
| 748 | .disconnect = gspca_disconnect, | 1082 | .disconnect = gspca_disconnect, |
| 1083 | #ifdef CONFIG_PM | ||
| 1084 | .suspend = gspca_suspend, | ||
| 1085 | .resume = gspca_resume, | ||
| 1086 | #endif | ||
| 749 | }; | 1087 | }; |
| 750 | 1088 | ||
| 751 | /* -- module insert / remove -- */ | 1089 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/pac_common.h b/drivers/media/video/gspca/pac_common.h new file mode 100644 index 000000000000..34d4b1494cd5 --- /dev/null +++ b/drivers/media/video/gspca/pac_common.h | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* | ||
| 2 | * Pixart PAC207BCA / PAC73xx common functions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Hans de Goede <j.w.r.degoede@hhs.nl> | ||
| 5 | * Copyright (C) 2005 Thomas Kaiser thomas@kaiser-linux.li | ||
| 6 | * Copyleft (C) 2005 Michel Xhaard mxhaard@magic.fr | ||
| 7 | * | ||
| 8 | * V4L2 by Jean-Francois Moine <http://moinejf.free.fr> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | * GNU General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License | ||
| 21 | * along with this program; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | |||
| 26 | /* We calculate the autogain at the end of the transfer of a frame, at this | ||
| 27 | moment a frame with the old settings is being transmitted, and a frame is | ||
| 28 | being captured with the old settings. So if we adjust the autogain we must | ||
| 29 | ignore atleast the 2 next frames for the new settings to come into effect | ||
| 30 | before doing any other adjustments */ | ||
| 31 | #define PAC_AUTOGAIN_IGNORE_FRAMES 3 | ||
| 32 | |||
| 33 | static const unsigned char pac_sof_marker[5] = | ||
| 34 | { 0xff, 0xff, 0x00, 0xff, 0x96 }; | ||
| 35 | |||
| 36 | static unsigned char *pac_find_sof(struct gspca_dev *gspca_dev, | ||
| 37 | unsigned char *m, int len) | ||
| 38 | { | ||
| 39 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 40 | int i; | ||
| 41 | |||
| 42 | /* Search for the SOF marker (fixed part) in the header */ | ||
| 43 | for (i = 0; i < len; i++) { | ||
| 44 | if (m[i] == pac_sof_marker[sd->sof_read]) { | ||
| 45 | sd->sof_read++; | ||
| 46 | if (sd->sof_read == sizeof(pac_sof_marker)) { | ||
| 47 | PDEBUG(D_FRAM, | ||
| 48 | "SOF found, bytes to analyze: %u." | ||
| 49 | " Frame starts at byte #%u", | ||
| 50 | len, i + 1); | ||
| 51 | sd->sof_read = 0; | ||
| 52 | return m + i + 1; | ||
| 53 | } | ||
| 54 | } else { | ||
| 55 | sd->sof_read = 0; | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | return NULL; | ||
| 60 | } | ||
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index 11210c71f66c..5dd78c6766ea 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c | |||
| @@ -20,6 +20,26 @@ | |||
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | /* Some documentation on known sonixb registers: | ||
| 24 | |||
| 25 | Reg Use | ||
| 26 | 0x10 high nibble red gain low nibble blue gain | ||
| 27 | 0x11 low nibble green gain | ||
| 28 | 0x12 hstart | ||
| 29 | 0x13 vstart | ||
| 30 | 0x15 hsize (hsize = register-value * 16) | ||
| 31 | 0x16 vsize (vsize = register-value * 16) | ||
| 32 | 0x17 bit 0 toggle compression quality (according to sn9c102 driver) | ||
| 33 | 0x18 bit 7 enables compression, bit 4-5 set image down scaling: | ||
| 34 | 00 scale 1, 01 scale 1/2, 10, scale 1/4 | ||
| 35 | 0x19 high-nibble is sensor clock divider, changes exposure on sensors which | ||
| 36 | use a clock generated by the bridge. Some sensors have their own clock. | ||
| 37 | 0x1c auto_exposure area (for avg_lum) startx (startx = register-value * 32) | ||
| 38 | 0x1d auto_exposure area (for avg_lum) starty (starty = register-value * 32) | ||
| 39 | 0x1e auto_exposure area (for avg_lum) stopx (hsize = (0x1e - 0x1c) * 32) | ||
| 40 | 0x1f auto_exposure area (for avg_lum) stopy (vsize = (0x1f - 0x1d) * 32) | ||
| 41 | */ | ||
| 42 | |||
| 23 | #define MODULE_NAME "sonixb" | 43 | #define MODULE_NAME "sonixb" |
| 24 | 44 | ||
| 25 | #include "gspca.h" | 45 | #include "gspca.h" |
| @@ -31,10 +51,8 @@ MODULE_LICENSE("GPL"); | |||
| 31 | /* specific webcam descriptor */ | 51 | /* specific webcam descriptor */ |
| 32 | struct sd { | 52 | struct sd { |
| 33 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 53 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
| 34 | |||
| 35 | struct sd_desc sd_desc; /* our nctrls differ dependend upon the | ||
| 36 | sensor, so we use a per cam copy */ | ||
| 37 | atomic_t avg_lum; | 54 | atomic_t avg_lum; |
| 55 | int prev_avg_lum; | ||
| 38 | 56 | ||
| 39 | unsigned char gain; | 57 | unsigned char gain; |
| 40 | unsigned char exposure; | 58 | unsigned char exposure; |
| @@ -44,8 +62,12 @@ struct sd { | |||
| 44 | unsigned char frames_to_drop; | 62 | unsigned char frames_to_drop; |
| 45 | unsigned char freq; /* light freq filter setting */ | 63 | unsigned char freq; /* light freq filter setting */ |
| 46 | 64 | ||
| 47 | unsigned char fr_h_sz; /* size of frame header */ | 65 | __u8 bridge; /* Type of bridge */ |
| 48 | char sensor; /* Type of image sensor chip */ | 66 | #define BRIDGE_101 0 |
| 67 | #define BRIDGE_102 0 /* We make no difference between 101 and 102 */ | ||
| 68 | #define BRIDGE_103 1 | ||
| 69 | |||
| 70 | __u8 sensor; /* Type of image sensor chip */ | ||
| 49 | #define SENSOR_HV7131R 0 | 71 | #define SENSOR_HV7131R 0 |
| 50 | #define SENSOR_OV6650 1 | 72 | #define SENSOR_OV6650 1 |
| 51 | #define SENSOR_OV7630 2 | 73 | #define SENSOR_OV7630 2 |
| @@ -53,16 +75,35 @@ struct sd { | |||
| 53 | #define SENSOR_PAS202 4 | 75 | #define SENSOR_PAS202 4 |
| 54 | #define SENSOR_TAS5110 5 | 76 | #define SENSOR_TAS5110 5 |
| 55 | #define SENSOR_TAS5130CXX 6 | 77 | #define SENSOR_TAS5130CXX 6 |
| 56 | char sensor_has_gain; | ||
| 57 | __u8 sensor_addr; | ||
| 58 | __u8 reg11; | 78 | __u8 reg11; |
| 59 | }; | 79 | }; |
| 60 | 80 | ||
| 61 | /* flags used in the device id table */ | 81 | typedef const __u8 sensor_init_t[8]; |
| 82 | |||
| 83 | struct sensor_data { | ||
| 84 | const __u8 *bridge_init[2]; | ||
| 85 | int bridge_init_size[2]; | ||
| 86 | sensor_init_t *sensor_init; | ||
| 87 | int sensor_init_size; | ||
| 88 | sensor_init_t *sensor_bridge_init[2]; | ||
| 89 | int sensor_bridge_init_size[2]; | ||
| 90 | int flags; | ||
| 91 | unsigned ctrl_dis; | ||
| 92 | __u8 sensor_addr; | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* sensor_data flags */ | ||
| 62 | #define F_GAIN 0x01 /* has gain */ | 96 | #define F_GAIN 0x01 /* has gain */ |
| 63 | #define F_AUTO 0x02 /* has autogain */ | 97 | #define F_SIF 0x02 /* sif or vga */ |
| 64 | #define F_SIF 0x04 /* sif or vga */ | 98 | |
| 65 | #define F_H18 0x08 /* long (18 b) or short (12 b) frame header */ | 99 | /* priv field of struct v4l2_pix_format flags (do not use low nibble!) */ |
| 100 | #define MODE_RAW 0x10 /* raw bayer mode */ | ||
| 101 | #define MODE_REDUCED_SIF 0x20 /* vga mode (320x240 / 160x120) on sif cam */ | ||
| 102 | |||
| 103 | /* ctrl_dis helper macros */ | ||
| 104 | #define NO_EXPO ((1 << EXPOSURE_IDX) | (1 << AUTOGAIN_IDX)) | ||
| 105 | #define NO_FREQ (1 << FREQ_IDX) | ||
| 106 | #define NO_BRIGHTNESS (1 << BRIGHTNESS_IDX) | ||
| 66 | 107 | ||
| 67 | #define COMP2 0x8f | 108 | #define COMP2 0x8f |
| 68 | #define COMP 0xc7 /* 0x87 //0x07 */ | 109 | #define COMP 0xc7 /* 0x87 //0x07 */ |
| @@ -73,6 +114,18 @@ struct sd { | |||
| 73 | 114 | ||
| 74 | #define SYS_CLK 0x04 | 115 | #define SYS_CLK 0x04 |
| 75 | 116 | ||
| 117 | #define SENS(bridge_1, bridge_3, sensor, sensor_1, \ | ||
| 118 | sensor_3, _flags, _ctrl_dis, _sensor_addr) \ | ||
| 119 | { \ | ||
| 120 | .bridge_init = { bridge_1, bridge_3 }, \ | ||
| 121 | .bridge_init_size = { sizeof(bridge_1), sizeof(bridge_3) }, \ | ||
| 122 | .sensor_init = sensor, \ | ||
| 123 | .sensor_init_size = sizeof(sensor), \ | ||
| 124 | .sensor_bridge_init = { sensor_1, sensor_3,}, \ | ||
| 125 | .sensor_bridge_init_size = { sizeof(sensor_1), sizeof(sensor_3)}, \ | ||
| 126 | .flags = _flags, .ctrl_dis = _ctrl_dis, .sensor_addr = _sensor_addr \ | ||
| 127 | } | ||
| 128 | |||
| 76 | /* We calculate the autogain at the end of the transfer of a frame, at this | 129 | /* We calculate the autogain at the end of the transfer of a frame, at this |
| 77 | moment a frame with the old settings is being transmitted, and a frame is | 130 | moment a frame with the old settings is being transmitted, and a frame is |
| 78 | being captured with the old settings. So if we adjust the autogain we must | 131 | being captured with the old settings. So if we adjust the autogain we must |
| @@ -95,6 +148,7 @@ static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); | |||
| 95 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); | 148 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); |
| 96 | 149 | ||
| 97 | static struct ctrl sd_ctrls[] = { | 150 | static struct ctrl sd_ctrls[] = { |
| 151 | #define BRIGHTNESS_IDX 0 | ||
| 98 | { | 152 | { |
| 99 | { | 153 | { |
| 100 | .id = V4L2_CID_BRIGHTNESS, | 154 | .id = V4L2_CID_BRIGHTNESS, |
| @@ -109,6 +163,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 109 | .set = sd_setbrightness, | 163 | .set = sd_setbrightness, |
| 110 | .get = sd_getbrightness, | 164 | .get = sd_getbrightness, |
| 111 | }, | 165 | }, |
| 166 | #define GAIN_IDX 1 | ||
| 112 | { | 167 | { |
| 113 | { | 168 | { |
| 114 | .id = V4L2_CID_GAIN, | 169 | .id = V4L2_CID_GAIN, |
| @@ -124,6 +179,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 124 | .set = sd_setgain, | 179 | .set = sd_setgain, |
| 125 | .get = sd_getgain, | 180 | .get = sd_getgain, |
| 126 | }, | 181 | }, |
| 182 | #define EXPOSURE_IDX 2 | ||
| 127 | { | 183 | { |
| 128 | { | 184 | { |
| 129 | .id = V4L2_CID_EXPOSURE, | 185 | .id = V4L2_CID_EXPOSURE, |
| @@ -140,6 +196,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 140 | .set = sd_setexposure, | 196 | .set = sd_setexposure, |
| 141 | .get = sd_getexposure, | 197 | .get = sd_getexposure, |
| 142 | }, | 198 | }, |
| 199 | #define AUTOGAIN_IDX 3 | ||
| 143 | { | 200 | { |
| 144 | { | 201 | { |
| 145 | .id = V4L2_CID_AUTOGAIN, | 202 | .id = V4L2_CID_AUTOGAIN, |
| @@ -155,6 +212,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 155 | .set = sd_setautogain, | 212 | .set = sd_setautogain, |
| 156 | .get = sd_getautogain, | 213 | .get = sd_getautogain, |
| 157 | }, | 214 | }, |
| 215 | #define FREQ_IDX 4 | ||
| 158 | { | 216 | { |
| 159 | { | 217 | { |
| 160 | .id = V4L2_CID_POWER_LINE_FREQUENCY, | 218 | .id = V4L2_CID_POWER_LINE_FREQUENCY, |
| @@ -172,31 +230,56 @@ static struct ctrl sd_ctrls[] = { | |||
| 172 | }; | 230 | }; |
| 173 | 231 | ||
| 174 | static struct v4l2_pix_format vga_mode[] = { | 232 | static struct v4l2_pix_format vga_mode[] = { |
| 233 | {160, 120, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, | ||
| 234 | .bytesperline = 160, | ||
| 235 | .sizeimage = 160 * 120 * 5 / 4, | ||
| 236 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 237 | .priv = 2 | MODE_RAW}, | ||
| 175 | {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, | 238 | {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, |
| 176 | .bytesperline = 160, | 239 | .bytesperline = 160, |
| 177 | .sizeimage = 160 * 120, | 240 | .sizeimage = 160 * 120 * 5 / 4, |
| 178 | .colorspace = V4L2_COLORSPACE_SRGB, | 241 | .colorspace = V4L2_COLORSPACE_SRGB, |
| 179 | .priv = 2}, | 242 | .priv = 2}, |
| 180 | {320, 240, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, | 243 | {320, 240, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, |
| 181 | .bytesperline = 320, | 244 | .bytesperline = 320, |
| 182 | .sizeimage = 320 * 240, | 245 | .sizeimage = 320 * 240 * 5 / 4, |
| 183 | .colorspace = V4L2_COLORSPACE_SRGB, | 246 | .colorspace = V4L2_COLORSPACE_SRGB, |
| 184 | .priv = 1}, | 247 | .priv = 1}, |
| 185 | {640, 480, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, | 248 | {640, 480, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, |
| 186 | .bytesperline = 640, | 249 | .bytesperline = 640, |
| 187 | .sizeimage = 640 * 480, | 250 | .sizeimage = 640 * 480 * 5 / 4, |
| 188 | .colorspace = V4L2_COLORSPACE_SRGB, | 251 | .colorspace = V4L2_COLORSPACE_SRGB, |
| 189 | .priv = 0}, | 252 | .priv = 0}, |
| 190 | }; | 253 | }; |
| 191 | static struct v4l2_pix_format sif_mode[] = { | 254 | static struct v4l2_pix_format sif_mode[] = { |
| 255 | {160, 120, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, | ||
| 256 | .bytesperline = 160, | ||
| 257 | .sizeimage = 160 * 120, | ||
| 258 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 259 | .priv = 1 | MODE_RAW | MODE_REDUCED_SIF}, | ||
| 260 | {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, | ||
| 261 | .bytesperline = 160, | ||
| 262 | .sizeimage = 160 * 120 * 5 / 4, | ||
| 263 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 264 | .priv = 1 | MODE_REDUCED_SIF}, | ||
| 265 | {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, | ||
| 266 | .bytesperline = 176, | ||
| 267 | .sizeimage = 176 * 144 * 5 / 4, | ||
| 268 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 269 | .priv = 1 | MODE_RAW}, | ||
| 192 | {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, | 270 | {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, |
| 193 | .bytesperline = 176, | 271 | .bytesperline = 176, |
| 194 | .sizeimage = 176 * 144, | 272 | .sizeimage = 176 * 144 * 5 / 4, |
| 195 | .colorspace = V4L2_COLORSPACE_SRGB, | 273 | .colorspace = V4L2_COLORSPACE_SRGB, |
| 196 | .priv = 1}, | 274 | .priv = 1}, |
| 275 | {320, 240, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, | ||
| 276 | .bytesperline = 320, | ||
| 277 | .sizeimage = 320 * 240 * 5 / 4, | ||
| 278 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 279 | .priv = 0 | MODE_REDUCED_SIF}, | ||
| 197 | {352, 288, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, | 280 | {352, 288, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, |
| 198 | .bytesperline = 352, | 281 | .bytesperline = 352, |
| 199 | .sizeimage = 352 * 288, | 282 | .sizeimage = 352 * 288 * 5 / 4, |
| 200 | .colorspace = V4L2_COLORSPACE_SRGB, | 283 | .colorspace = V4L2_COLORSPACE_SRGB, |
| 201 | .priv = 0}, | 284 | .priv = 0}, |
| 202 | }; | 285 | }; |
| @@ -204,7 +287,7 @@ static struct v4l2_pix_format sif_mode[] = { | |||
| 204 | static const __u8 initHv7131[] = { | 287 | static const __u8 initHv7131[] = { |
| 205 | 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, | 288 | 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, |
| 206 | 0x00, 0x00, | 289 | 0x00, 0x00, |
| 207 | 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, /* shift from 0x02 0x01 0x00 */ | 290 | 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, |
| 208 | 0x28, 0x1e, 0x60, 0x8a, 0x20, | 291 | 0x28, 0x1e, 0x60, 0x8a, 0x20, |
| 209 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c | 292 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c |
| 210 | }; | 293 | }; |
| @@ -218,8 +301,8 @@ static const __u8 hv7131_sensor_init[][8] = { | |||
| 218 | static const __u8 initOv6650[] = { | 301 | static const __u8 initOv6650[] = { |
| 219 | 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, | 302 | 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, |
| 220 | 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 303 | 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 221 | 0x00, 0x02, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x0b, | 304 | 0x00, 0x01, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x8b, |
| 222 | 0x10, 0x1d, 0x10, 0x00, 0x06, 0x1f, 0x00 | 305 | 0x10, 0x1d, 0x10, 0x02, 0x02, 0x09, 0x07 |
| 223 | }; | 306 | }; |
| 224 | static const __u8 ov6650_sensor_init[][8] = | 307 | static const __u8 ov6650_sensor_init[][8] = |
| 225 | { | 308 | { |
| @@ -257,15 +340,15 @@ static const __u8 ov6650_sensor_init[][8] = | |||
| 257 | static const __u8 initOv7630[] = { | 340 | static const __u8 initOv7630[] = { |
| 258 | 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* r01 .. r08 */ | 341 | 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* r01 .. r08 */ |
| 259 | 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */ | 342 | 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */ |
| 260 | 0x00, 0x02, 0x01, 0x0a, /* r11 .. r14 */ | 343 | 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */ |
| 261 | 0x28, 0x1e, /* H & V sizes r15 .. r16 */ | 344 | 0x28, 0x1e, /* H & V sizes r15 .. r16 */ |
| 262 | 0x68, COMP1, MCK_INIT1, /* r17 .. r19 */ | 345 | 0x68, COMP2, MCK_INIT1, /* r17 .. r19 */ |
| 263 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c /* r1a .. r1f */ | 346 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c /* r1a .. r1f */ |
| 264 | }; | 347 | }; |
| 265 | static const __u8 initOv7630_3[] = { | 348 | static const __u8 initOv7630_3[] = { |
| 266 | 0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */ | 349 | 0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */ |
| 267 | 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, /* r09 .. r10 */ | 350 | 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, /* r09 .. r10 */ |
| 268 | 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */ | 351 | 0x00, 0x02, 0x01, 0x0a, /* r11 .. r14 */ |
| 269 | 0x28, 0x1e, /* H & V sizes r15 .. r16 */ | 352 | 0x28, 0x1e, /* H & V sizes r15 .. r16 */ |
| 270 | 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */ | 353 | 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */ |
| 271 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c, 0x00, /* r1a .. r20 */ | 354 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c, 0x00, /* r1a .. r20 */ |
| @@ -294,47 +377,65 @@ static const __u8 ov7630_sensor_init[][8] = { | |||
| 294 | {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10}, | 377 | {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10}, |
| 295 | }; | 378 | }; |
| 296 | 379 | ||
| 380 | static const __u8 ov7630_sensor_init_3[][8] = { | ||
| 381 | {0xa0, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10}, | ||
| 382 | }; | ||
| 383 | |||
| 297 | static const __u8 initPas106[] = { | 384 | static const __u8 initPas106[] = { |
| 298 | 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00, | 385 | 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00, |
| 299 | 0x00, 0x00, | 386 | 0x00, 0x00, |
| 300 | 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, | 387 | 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, |
| 301 | 0x16, 0x12, 0x28, COMP1, MCK_INIT1, | 388 | 0x16, 0x12, 0x24, COMP1, MCK_INIT1, |
| 302 | 0x18, 0x10, 0x04, 0x03, 0x11, 0x0c | 389 | 0x18, 0x10, 0x02, 0x02, 0x09, 0x07 |
| 303 | }; | 390 | }; |
| 304 | /* compression 0x86 mckinit1 0x2b */ | 391 | /* compression 0x86 mckinit1 0x2b */ |
| 305 | static const __u8 pas106_data[][2] = { | 392 | static const __u8 pas106_sensor_init[][8] = { |
| 306 | {0x02, 0x04}, /* Pixel Clock Divider 6 */ | 393 | /* Pixel Clock Divider 6 */ |
| 307 | {0x03, 0x13}, /* Frame Time MSB */ | 394 | { 0xa1, 0x40, 0x02, 0x04, 0x00, 0x00, 0x00, 0x14 }, |
| 308 | /* {0x03, 0x12}, * Frame Time MSB */ | 395 | /* Frame Time MSB (also seen as 0x12) */ |
| 309 | {0x04, 0x06}, /* Frame Time LSB */ | 396 | { 0xa1, 0x40, 0x03, 0x13, 0x00, 0x00, 0x00, 0x14 }, |
| 310 | /* {0x04, 0x05}, * Frame Time LSB */ | 397 | /* Frame Time LSB (also seen as 0x05) */ |
| 311 | {0x05, 0x65}, /* Shutter Time Line Offset */ | 398 | { 0xa1, 0x40, 0x04, 0x06, 0x00, 0x00, 0x00, 0x14 }, |
| 312 | /* {0x05, 0x6d}, * Shutter Time Line Offset */ | 399 | /* Shutter Time Line Offset (also seen as 0x6d) */ |
| 313 | /* {0x06, 0xb1}, * Shutter Time Pixel Offset */ | 400 | { 0xa1, 0x40, 0x05, 0x65, 0x00, 0x00, 0x00, 0x14 }, |
| 314 | {0x06, 0xcd}, /* Shutter Time Pixel Offset */ | 401 | /* Shutter Time Pixel Offset (also seen as 0xb1) */ |
| 315 | {0x07, 0xc1}, /* Black Level Subtract Sign */ | 402 | { 0xa1, 0x40, 0x06, 0xcd, 0x00, 0x00, 0x00, 0x14 }, |
| 316 | /* {0x07, 0x00}, * Black Level Subtract Sign */ | 403 | /* Black Level Subtract Sign (also seen 0x00) */ |
| 317 | {0x08, 0x06}, /* Black Level Subtract Level */ | 404 | { 0xa1, 0x40, 0x07, 0xc1, 0x00, 0x00, 0x00, 0x14 }, |
| 318 | {0x08, 0x06}, /* Black Level Subtract Level */ | 405 | /* Black Level Subtract Level (also seen 0x01) */ |
| 319 | /* {0x08, 0x01}, * Black Level Subtract Level */ | 406 | { 0xa1, 0x40, 0x08, 0x06, 0x00, 0x00, 0x00, 0x14 }, |
| 320 | {0x09, 0x05}, /* Color Gain B Pixel 5 a */ | 407 | { 0xa1, 0x40, 0x08, 0x06, 0x00, 0x00, 0x00, 0x14 }, |
| 321 | {0x0a, 0x04}, /* Color Gain G1 Pixel 1 5 */ | 408 | /* Color Gain B Pixel 5 a */ |
| 322 | {0x0b, 0x04}, /* Color Gain G2 Pixel 1 0 5 */ | 409 | { 0xa1, 0x40, 0x09, 0x05, 0x00, 0x00, 0x00, 0x14 }, |
| 323 | {0x0c, 0x05}, /* Color Gain R Pixel 3 1 */ | 410 | /* Color Gain G1 Pixel 1 5 */ |
| 324 | {0x0d, 0x00}, /* Color GainH Pixel */ | 411 | { 0xa1, 0x40, 0x0a, 0x04, 0x00, 0x00, 0x00, 0x14 }, |
| 325 | {0x0e, 0x0e}, /* Global Gain */ | 412 | /* Color Gain G2 Pixel 1 0 5 */ |
| 326 | {0x0f, 0x00}, /* Contrast */ | 413 | { 0xa1, 0x40, 0x0b, 0x04, 0x00, 0x00, 0x00, 0x14 }, |
| 327 | {0x10, 0x06}, /* H&V synchro polarity */ | 414 | /* Color Gain R Pixel 3 1 */ |
| 328 | {0x11, 0x06}, /* ?default */ | 415 | { 0xa1, 0x40, 0x0c, 0x05, 0x00, 0x00, 0x00, 0x14 }, |
| 329 | {0x12, 0x06}, /* DAC scale */ | 416 | /* Color GainH Pixel */ |
| 330 | {0x14, 0x02}, /* ?default */ | 417 | { 0xa1, 0x40, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x14 }, |
| 331 | {0x13, 0x01}, /* Validate Settings */ | 418 | /* Global Gain */ |
| 419 | { 0xa1, 0x40, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x14 }, | ||
| 420 | /* Contrast */ | ||
| 421 | { 0xa1, 0x40, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x14 }, | ||
| 422 | /* H&V synchro polarity */ | ||
| 423 | { 0xa1, 0x40, 0x10, 0x06, 0x00, 0x00, 0x00, 0x14 }, | ||
| 424 | /* ?default */ | ||
| 425 | { 0xa1, 0x40, 0x11, 0x06, 0x00, 0x00, 0x00, 0x14 }, | ||
| 426 | /* DAC scale */ | ||
| 427 | { 0xa1, 0x40, 0x12, 0x06, 0x00, 0x00, 0x00, 0x14 }, | ||
| 428 | /* ?default */ | ||
| 429 | { 0xa1, 0x40, 0x14, 0x02, 0x00, 0x00, 0x00, 0x14 }, | ||
| 430 | /* Validate Settings */ | ||
| 431 | { 0xa1, 0x40, 0x13, 0x01, 0x00, 0x00, 0x00, 0x14 }, | ||
| 332 | }; | 432 | }; |
| 433 | |||
| 333 | static const __u8 initPas202[] = { | 434 | static const __u8 initPas202[] = { |
| 334 | 0x44, 0x44, 0x21, 0x30, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, | 435 | 0x44, 0x44, 0x21, 0x30, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, |
| 335 | 0x00, 0x00, | 436 | 0x00, 0x00, |
| 336 | 0x00, 0x00, 0x00, 0x07, 0x03, 0x0a, /* 6 */ | 437 | 0x00, 0x00, 0x00, 0x06, 0x03, 0x0a, |
| 337 | 0x28, 0x1e, 0x28, 0x89, 0x30, | 438 | 0x28, 0x1e, 0x28, 0x89, 0x20, |
| 338 | 0x00, 0x00, 0x02, 0x03, 0x0f, 0x0c | 439 | 0x00, 0x00, 0x02, 0x03, 0x0f, 0x0c |
| 339 | }; | 440 | }; |
| 340 | static const __u8 pas202_sensor_init[][8] = { | 441 | static const __u8 pas202_sensor_init[][8] = { |
| @@ -364,7 +465,7 @@ static const __u8 pas202_sensor_init[][8] = { | |||
| 364 | static const __u8 initTas5110[] = { | 465 | static const __u8 initTas5110[] = { |
| 365 | 0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00, | 466 | 0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00, |
| 366 | 0x00, 0x00, | 467 | 0x00, 0x00, |
| 367 | 0x00, 0x01, 0x00, 0x46, 0x09, 0x0a, /* shift from 0x45 0x09 0x0a */ | 468 | 0x00, 0x01, 0x00, 0x45, 0x09, 0x0a, |
| 368 | 0x16, 0x12, 0x60, 0x86, 0x2b, | 469 | 0x16, 0x12, 0x60, 0x86, 0x2b, |
| 369 | 0x14, 0x0a, 0x02, 0x02, 0x09, 0x07 | 470 | 0x14, 0x0a, 0x02, 0x02, 0x09, 0x07 |
| 370 | }; | 471 | }; |
| @@ -377,7 +478,7 @@ static const __u8 tas5110_sensor_init[][8] = { | |||
| 377 | static const __u8 initTas5130[] = { | 478 | static const __u8 initTas5130[] = { |
| 378 | 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00, | 479 | 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00, |
| 379 | 0x00, 0x00, | 480 | 0x00, 0x00, |
| 380 | 0x00, 0x01, 0x00, 0x69, 0x0c, 0x0a, | 481 | 0x00, 0x01, 0x00, 0x68, 0x0c, 0x0a, |
| 381 | 0x28, 0x1e, 0x60, COMP, MCK_INIT, | 482 | 0x28, 0x1e, 0x60, COMP, MCK_INIT, |
| 382 | 0x18, 0x10, 0x04, 0x03, 0x11, 0x0c | 483 | 0x18, 0x10, 0x04, 0x03, 0x11, 0x0c |
| 383 | }; | 484 | }; |
| @@ -389,6 +490,21 @@ static const __u8 tas5130_sensor_init[][8] = { | |||
| 389 | {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}, | 490 | {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}, |
| 390 | }; | 491 | }; |
| 391 | 492 | ||
| 493 | struct sensor_data sensor_data[] = { | ||
| 494 | SENS(initHv7131, NULL, hv7131_sensor_init, NULL, NULL, 0, NO_EXPO|NO_FREQ, 0), | ||
| 495 | SENS(initOv6650, NULL, ov6650_sensor_init, NULL, NULL, F_GAIN|F_SIF, 0, 0x60), | ||
| 496 | SENS(initOv7630, initOv7630_3, ov7630_sensor_init, NULL, ov7630_sensor_init_3, | ||
| 497 | F_GAIN, 0, 0x21), | ||
| 498 | SENS(initPas106, NULL, pas106_sensor_init, NULL, NULL, F_SIF, NO_EXPO|NO_FREQ, | ||
| 499 | 0), | ||
| 500 | SENS(initPas202, initPas202, pas202_sensor_init, NULL, NULL, 0, | ||
| 501 | NO_EXPO|NO_FREQ, 0), | ||
| 502 | SENS(initTas5110, NULL, tas5110_sensor_init, NULL, NULL, F_GAIN|F_SIF, | ||
| 503 | NO_BRIGHTNESS|NO_FREQ, 0), | ||
| 504 | SENS(initTas5130, NULL, tas5130_sensor_init, NULL, NULL, 0, NO_EXPO|NO_FREQ, | ||
| 505 | 0), | ||
| 506 | }; | ||
| 507 | |||
| 392 | /* get one byte in gspca_dev->usb_buf */ | 508 | /* get one byte in gspca_dev->usb_buf */ |
| 393 | static void reg_r(struct gspca_dev *gspca_dev, | 509 | static void reg_r(struct gspca_dev *gspca_dev, |
| 394 | __u16 value) | 510 | __u16 value) |
| @@ -409,7 +525,7 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
| 409 | int len) | 525 | int len) |
| 410 | { | 526 | { |
| 411 | #ifdef GSPCA_DEBUG | 527 | #ifdef GSPCA_DEBUG |
| 412 | if (len > sizeof gspca_dev->usb_buf) { | 528 | if (len > USB_BUF_SZ) { |
| 413 | PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); | 529 | PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); |
| 414 | return; | 530 | return; |
| 415 | } | 531 | } |
| @@ -425,26 +541,6 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
| 425 | 500); | 541 | 500); |
| 426 | } | 542 | } |
| 427 | 543 | ||
| 428 | static void reg_w_big(struct gspca_dev *gspca_dev, | ||
| 429 | __u16 value, | ||
| 430 | const __u8 *buffer, | ||
| 431 | int len) | ||
| 432 | { | ||
| 433 | __u8 *tmpbuf; | ||
| 434 | |||
| 435 | tmpbuf = kmalloc(len, GFP_KERNEL); | ||
| 436 | memcpy(tmpbuf, buffer, len); | ||
| 437 | usb_control_msg(gspca_dev->dev, | ||
| 438 | usb_sndctrlpipe(gspca_dev->dev, 0), | ||
| 439 | 0x08, /* request */ | ||
| 440 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | ||
| 441 | value, | ||
| 442 | 0, /* index */ | ||
| 443 | tmpbuf, len, | ||
| 444 | 500); | ||
| 445 | kfree(tmpbuf); | ||
| 446 | } | ||
| 447 | |||
| 448 | static int i2c_w(struct gspca_dev *gspca_dev, const __u8 *buffer) | 544 | static int i2c_w(struct gspca_dev *gspca_dev, const __u8 *buffer) |
| 449 | { | 545 | { |
| 450 | int retry = 60; | 546 | int retry = 60; |
| @@ -487,7 +583,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
| 487 | {0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}; | 583 | {0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}; |
| 488 | 584 | ||
| 489 | /* change reg 0x06 */ | 585 | /* change reg 0x06 */ |
| 490 | i2cOV[1] = sd->sensor_addr; | 586 | i2cOV[1] = sensor_data[sd->sensor].sensor_addr; |
| 491 | i2cOV[3] = sd->brightness; | 587 | i2cOV[3] = sd->brightness; |
| 492 | if (i2c_w(gspca_dev, i2cOV) < 0) | 588 | if (i2c_w(gspca_dev, i2cOV) < 0) |
| 493 | goto err; | 589 | goto err; |
| @@ -545,9 +641,6 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
| 545 | goto err; | 641 | goto err; |
| 546 | break; | 642 | break; |
| 547 | } | 643 | } |
| 548 | case SENSOR_TAS5110: | ||
| 549 | /* FIXME figure out howto control brightness on TAS5110 */ | ||
| 550 | break; | ||
| 551 | } | 644 | } |
| 552 | return; | 645 | return; |
| 553 | err: | 646 | err: |
| @@ -577,7 +670,7 @@ static void setsensorgain(struct gspca_dev *gspca_dev) | |||
| 577 | case SENSOR_OV7630: { | 670 | case SENSOR_OV7630: { |
| 578 | __u8 i2c[] = {0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}; | 671 | __u8 i2c[] = {0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}; |
| 579 | 672 | ||
| 580 | i2c[1] = sd->sensor_addr; | 673 | i2c[1] = sensor_data[sd->sensor].sensor_addr; |
| 581 | i2c[3] = gain >> 2; | 674 | i2c[3] = gain >> 2; |
| 582 | if (i2c_w(gspca_dev, i2c) < 0) | 675 | if (i2c_w(gspca_dev, i2c) < 0) |
| 583 | goto err; | 676 | goto err; |
| @@ -604,7 +697,7 @@ static void setgain(struct gspca_dev *gspca_dev) | |||
| 604 | rgb_value = gain; | 697 | rgb_value = gain; |
| 605 | reg_w(gspca_dev, 0x11, &rgb_value, 1); | 698 | reg_w(gspca_dev, 0x11, &rgb_value, 1); |
| 606 | 699 | ||
| 607 | if (sd->sensor_has_gain) | 700 | if (sensor_data[sd->sensor].flags & F_GAIN) |
| 608 | setsensorgain(gspca_dev); | 701 | setsensorgain(gspca_dev); |
| 609 | } | 702 | } |
| 610 | 703 | ||
| @@ -665,6 +758,11 @@ static void setexposure(struct gspca_dev *gspca_dev) | |||
| 665 | else if (reg11 > 16) | 758 | else if (reg11 > 16) |
| 666 | reg11 = 16; | 759 | reg11 = 16; |
| 667 | 760 | ||
| 761 | /* In 640x480, if the reg11 has less than 3, the image is | ||
| 762 | unstable (not enough bandwidth). */ | ||
| 763 | if (gspca_dev->width == 640 && reg11 < 3) | ||
| 764 | reg11 = 3; | ||
| 765 | |||
| 668 | /* frame exposure time in ms = 1000 * reg11 / 30 -> | 766 | /* frame exposure time in ms = 1000 * reg11 / 30 -> |
| 669 | reg10 = sd->exposure * 2 * reg10_max / (1000 * reg11 / 30) */ | 767 | reg10 = sd->exposure * 2 * reg10_max / (1000 * reg11 / 30) */ |
| 670 | reg10 = (sd->exposure * 60 * reg10_max) / (1000 * reg11); | 768 | reg10 = (sd->exposure * 60 * reg10_max) / (1000 * reg11); |
| @@ -678,13 +776,8 @@ static void setexposure(struct gspca_dev *gspca_dev) | |||
| 678 | else if (reg10 > reg10_max) | 776 | else if (reg10 > reg10_max) |
| 679 | reg10 = reg10_max; | 777 | reg10 = reg10_max; |
| 680 | 778 | ||
| 681 | /* In 640x480, if the reg11 has less than 3, the image is | ||
| 682 | unstable (not enough bandwidth). */ | ||
| 683 | if (gspca_dev->width == 640 && reg11 < 3) | ||
| 684 | reg11 = 3; | ||
| 685 | |||
| 686 | /* Write reg 10 and reg11 low nibble */ | 779 | /* Write reg 10 and reg11 low nibble */ |
| 687 | i2c[1] = sd->sensor_addr; | 780 | i2c[1] = sensor_data[sd->sensor].sensor_addr; |
| 688 | i2c[3] = reg10; | 781 | i2c[3] = reg10; |
| 689 | i2c[4] |= reg11 - 1; | 782 | i2c[4] |= reg11 - 1; |
| 690 | 783 | ||
| @@ -724,7 +817,7 @@ static void setfreq(struct gspca_dev *gspca_dev) | |||
| 724 | ? 0x4f : 0x8a; | 817 | ? 0x4f : 0x8a; |
| 725 | break; | 818 | break; |
| 726 | } | 819 | } |
| 727 | i2c[1] = sd->sensor_addr; | 820 | i2c[1] = sensor_data[sd->sensor].sensor_addr; |
| 728 | if (i2c_w(gspca_dev, i2c) < 0) | 821 | if (i2c_w(gspca_dev, i2c) < 0) |
| 729 | PDEBUG(D_ERR, "i2c error setfreq"); | 822 | PDEBUG(D_ERR, "i2c error setfreq"); |
| 730 | break; | 823 | break; |
| @@ -757,30 +850,19 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 757 | { | 850 | { |
| 758 | struct sd *sd = (struct sd *) gspca_dev; | 851 | struct sd *sd = (struct sd *) gspca_dev; |
| 759 | struct cam *cam; | 852 | struct cam *cam; |
| 760 | int sif = 0; | ||
| 761 | 853 | ||
| 762 | /* nctrls depends upon the sensor, so we use a per cam copy */ | 854 | reg_r(gspca_dev, 0x00); |
| 763 | memcpy(&sd->sd_desc, gspca_dev->sd_desc, sizeof(struct sd_desc)); | 855 | if (gspca_dev->usb_buf[0] != 0x10) |
| 764 | gspca_dev->sd_desc = &sd->sd_desc; | 856 | return -ENODEV; |
| 765 | 857 | ||
| 766 | /* copy the webcam info from the device id */ | 858 | /* copy the webcam info from the device id */ |
| 767 | sd->sensor = (id->driver_info >> 24) & 0xff; | 859 | sd->sensor = id->driver_info >> 8; |
| 768 | if (id->driver_info & (F_GAIN << 16)) | 860 | sd->bridge = id->driver_info & 0xff; |
| 769 | sd->sensor_has_gain = 1; | 861 | gspca_dev->ctrl_dis = sensor_data[sd->sensor].ctrl_dis; |
| 770 | if (id->driver_info & (F_AUTO << 16)) | ||
| 771 | sd->sd_desc.dq_callback = do_autogain; | ||
| 772 | if (id->driver_info & (F_SIF << 16)) | ||
| 773 | sif = 1; | ||
| 774 | if (id->driver_info & (F_H18 << 16)) | ||
| 775 | sd->fr_h_sz = 18; /* size of frame header */ | ||
| 776 | else | ||
| 777 | sd->fr_h_sz = 12; | ||
| 778 | sd->sd_desc.nctrls = (id->driver_info >> 8) & 0xff; | ||
| 779 | sd->sensor_addr = id->driver_info & 0xff; | ||
| 780 | 862 | ||
| 781 | cam = &gspca_dev->cam; | 863 | cam = &gspca_dev->cam; |
| 782 | cam->epaddr = 0x01; | 864 | cam->epaddr = 0x01; |
| 783 | if (!sif) { | 865 | if (!(sensor_data[sd->sensor].flags & F_SIF)) { |
| 784 | cam->cam_mode = vga_mode; | 866 | cam->cam_mode = vga_mode; |
| 785 | cam->nmodes = ARRAY_SIZE(vga_mode); | 867 | cam->nmodes = ARRAY_SIZE(vga_mode); |
| 786 | } else { | 868 | } else { |
| @@ -790,157 +872,98 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 790 | sd->brightness = BRIGHTNESS_DEF; | 872 | sd->brightness = BRIGHTNESS_DEF; |
| 791 | sd->gain = GAIN_DEF; | 873 | sd->gain = GAIN_DEF; |
| 792 | sd->exposure = EXPOSURE_DEF; | 874 | sd->exposure = EXPOSURE_DEF; |
| 793 | sd->autogain = AUTOGAIN_DEF; | 875 | if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX)) |
| 876 | sd->autogain = 0; /* Disable do_autogain callback */ | ||
| 877 | else | ||
| 878 | sd->autogain = AUTOGAIN_DEF; | ||
| 794 | sd->freq = FREQ_DEF; | 879 | sd->freq = FREQ_DEF; |
| 795 | 880 | ||
| 796 | return 0; | 881 | return 0; |
| 797 | } | 882 | } |
| 798 | 883 | ||
| 799 | /* this function is called at open time */ | 884 | /* this function is called at probe and resume time */ |
| 800 | static int sd_open(struct gspca_dev *gspca_dev) | 885 | static int sd_init(struct gspca_dev *gspca_dev) |
| 801 | { | 886 | { |
| 802 | reg_r(gspca_dev, 0x00); | 887 | const __u8 stop = 0x09; /* Disable stream turn of LED */ |
| 803 | if (gspca_dev->usb_buf[0] != 0x10) | ||
| 804 | return -ENODEV; | ||
| 805 | return 0; | ||
| 806 | } | ||
| 807 | 888 | ||
| 808 | static void pas106_i2cinit(struct gspca_dev *gspca_dev) | 889 | reg_w(gspca_dev, 0x01, &stop, 1); |
| 809 | { | 890 | |
| 810 | int i; | 891 | return 0; |
| 811 | const __u8 *data; | ||
| 812 | __u8 i2c1[] = { 0xa1, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14 }; | ||
| 813 | |||
| 814 | i = ARRAY_SIZE(pas106_data); | ||
| 815 | data = pas106_data[0]; | ||
| 816 | while (--i >= 0) { | ||
| 817 | memcpy(&i2c1[2], data, 2); | ||
| 818 | /* copy 2 bytes from the template */ | ||
| 819 | if (i2c_w(gspca_dev, i2c1) < 0) | ||
| 820 | PDEBUG(D_ERR, "i2c error pas106"); | ||
| 821 | data += 2; | ||
| 822 | } | ||
| 823 | } | 892 | } |
| 824 | 893 | ||
| 825 | /* -- start the camera -- */ | 894 | /* -- start the camera -- */ |
| 826 | static void sd_start(struct gspca_dev *gspca_dev) | 895 | static void sd_start(struct gspca_dev *gspca_dev) |
| 827 | { | 896 | { |
| 828 | struct sd *sd = (struct sd *) gspca_dev; | 897 | struct sd *sd = (struct sd *) gspca_dev; |
| 829 | int mode, l = 0x1f; | 898 | struct cam *cam = &gspca_dev->cam; |
| 899 | int mode, l; | ||
| 830 | const __u8 *sn9c10x; | 900 | const __u8 *sn9c10x; |
| 831 | __u8 reg17_19[3]; | 901 | __u8 reg12_19[8]; |
| 832 | 902 | ||
| 833 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; | 903 | mode = cam->cam_mode[gspca_dev->curr_mode].priv & 0x07; |
| 904 | sn9c10x = sensor_data[sd->sensor].bridge_init[sd->bridge]; | ||
| 905 | l = sensor_data[sd->sensor].bridge_init_size[sd->bridge]; | ||
| 906 | memcpy(reg12_19, &sn9c10x[0x12 - 1], 8); | ||
| 907 | reg12_19[6] = sn9c10x[0x18 - 1] | (mode << 4); | ||
| 908 | /* Special cases where reg 17 and or 19 value depends on mode */ | ||
| 834 | switch (sd->sensor) { | 909 | switch (sd->sensor) { |
| 835 | case SENSOR_HV7131R: | ||
| 836 | sn9c10x = initHv7131; | ||
| 837 | reg17_19[0] = 0x60; | ||
| 838 | reg17_19[1] = (mode << 4) | 0x8a; | ||
| 839 | reg17_19[2] = 0x20; | ||
| 840 | break; | ||
| 841 | case SENSOR_OV6650: | ||
| 842 | sn9c10x = initOv6650; | ||
| 843 | reg17_19[0] = 0x68; | ||
| 844 | reg17_19[1] = (mode << 4) | 0x8b; | ||
| 845 | reg17_19[2] = 0x20; | ||
| 846 | break; | ||
| 847 | case SENSOR_OV7630: | ||
| 848 | if (sd->fr_h_sz == 18) { /* SN9C103 */ | ||
| 849 | sn9c10x = initOv7630_3; | ||
| 850 | l = sizeof initOv7630_3; | ||
| 851 | } else | ||
| 852 | sn9c10x = initOv7630; | ||
| 853 | reg17_19[0] = 0x68; | ||
| 854 | reg17_19[1] = (mode << 4) | COMP2; | ||
| 855 | reg17_19[2] = MCK_INIT1; | ||
| 856 | break; | ||
| 857 | case SENSOR_PAS106: | ||
| 858 | sn9c10x = initPas106; | ||
| 859 | reg17_19[0] = 0x24; /* 0x28 */ | ||
| 860 | reg17_19[1] = (mode << 4) | COMP1; | ||
| 861 | reg17_19[2] = MCK_INIT1; | ||
| 862 | break; | ||
| 863 | case SENSOR_PAS202: | 910 | case SENSOR_PAS202: |
| 864 | sn9c10x = initPas202; | 911 | reg12_19[5] = mode ? 0x24 : 0x20; |
| 865 | reg17_19[0] = mode ? 0x24 : 0x20; | ||
| 866 | reg17_19[1] = (mode << 4) | 0x89; | ||
| 867 | reg17_19[2] = 0x20; | ||
| 868 | break; | 912 | break; |
| 869 | case SENSOR_TAS5110: | 913 | case SENSOR_TAS5130CXX: |
| 870 | sn9c10x = initTas5110; | 914 | /* probably not mode specific at all most likely the upper |
| 871 | reg17_19[0] = 0x60; | 915 | nibble of 0x19 is exposure (clock divider) just as with |
| 872 | reg17_19[1] = (mode << 4) | 0x86; | 916 | the tas5110, we need someone to test this. */ |
| 873 | reg17_19[2] = 0x2b; /* 0xf3; */ | 917 | reg12_19[7] = mode ? 0x23 : 0x43; |
| 874 | break; | ||
| 875 | default: | ||
| 876 | /* case SENSOR_TAS5130CXX: */ | ||
| 877 | sn9c10x = initTas5130; | ||
| 878 | reg17_19[0] = 0x60; | ||
| 879 | reg17_19[1] = (mode << 4) | COMP; | ||
| 880 | reg17_19[2] = mode ? 0x23 : 0x43; | ||
| 881 | break; | 918 | break; |
| 882 | } | 919 | } |
| 920 | /* Disable compression when the raw bayer format has been selected */ | ||
| 921 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) | ||
| 922 | reg12_19[6] &= ~0x80; | ||
| 923 | |||
| 924 | /* Vga mode emulation on SIF sensor? */ | ||
| 925 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_REDUCED_SIF) { | ||
| 926 | reg12_19[0] += 16; /* 0x12: hstart adjust */ | ||
| 927 | reg12_19[1] += 24; /* 0x13: vstart adjust */ | ||
| 928 | reg12_19[3] = 320 / 16; /* 0x15: hsize */ | ||
| 929 | reg12_19[4] = 240 / 16; /* 0x16: vsize */ | ||
| 930 | } | ||
| 883 | 931 | ||
| 884 | /* reg 0x01 bit 2 video transfert on */ | 932 | /* reg 0x01 bit 2 video transfert on */ |
| 885 | reg_w(gspca_dev, 0x01, &sn9c10x[0x01 - 1], 1); | 933 | reg_w(gspca_dev, 0x01, &sn9c10x[0x01 - 1], 1); |
| 886 | /* reg 0x17 SensorClk enable inv Clk 0x60 */ | 934 | /* reg 0x17 SensorClk enable inv Clk 0x60 */ |
| 887 | reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1); | 935 | reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1); |
| 888 | /* Set the registers from the template */ | 936 | /* Set the registers from the template */ |
| 889 | reg_w_big(gspca_dev, 0x01, sn9c10x, l); | 937 | reg_w(gspca_dev, 0x01, sn9c10x, l); |
| 890 | switch (sd->sensor) { | 938 | |
| 891 | case SENSOR_HV7131R: | 939 | /* Init the sensor */ |
| 892 | i2c_w_vector(gspca_dev, hv7131_sensor_init, | 940 | i2c_w_vector(gspca_dev, sensor_data[sd->sensor].sensor_init, |
| 893 | sizeof hv7131_sensor_init); | 941 | sensor_data[sd->sensor].sensor_init_size); |
| 894 | break; | 942 | if (sensor_data[sd->sensor].sensor_bridge_init[sd->bridge]) |
| 895 | case SENSOR_OV6650: | 943 | i2c_w_vector(gspca_dev, |
| 896 | i2c_w_vector(gspca_dev, ov6650_sensor_init, | 944 | sensor_data[sd->sensor].sensor_bridge_init[sd->bridge], |
| 897 | sizeof ov6650_sensor_init); | 945 | sensor_data[sd->sensor].sensor_bridge_init_size[ |
| 898 | break; | 946 | sd->bridge]); |
| 899 | case SENSOR_OV7630: | 947 | |
| 900 | i2c_w_vector(gspca_dev, ov7630_sensor_init, | ||
| 901 | sizeof ov7630_sensor_init); | ||
| 902 | if (sd->fr_h_sz == 18) { /* SN9C103 */ | ||
| 903 | const __u8 i2c[] = { 0xa0, 0x21, 0x13, 0x80, 0x00, | ||
| 904 | 0x00, 0x00, 0x10 }; | ||
| 905 | i2c_w(gspca_dev, i2c); | ||
| 906 | } | ||
| 907 | break; | ||
| 908 | case SENSOR_PAS106: | ||
| 909 | pas106_i2cinit(gspca_dev); | ||
| 910 | break; | ||
| 911 | case SENSOR_PAS202: | ||
| 912 | i2c_w_vector(gspca_dev, pas202_sensor_init, | ||
| 913 | sizeof pas202_sensor_init); | ||
| 914 | break; | ||
| 915 | case SENSOR_TAS5110: | ||
| 916 | i2c_w_vector(gspca_dev, tas5110_sensor_init, | ||
| 917 | sizeof tas5110_sensor_init); | ||
| 918 | break; | ||
| 919 | default: | ||
| 920 | /* case SENSOR_TAS5130CXX: */ | ||
| 921 | i2c_w_vector(gspca_dev, tas5130_sensor_init, | ||
| 922 | sizeof tas5130_sensor_init); | ||
| 923 | break; | ||
| 924 | } | ||
| 925 | /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */ | 948 | /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */ |
| 926 | reg_w(gspca_dev, 0x15, &sn9c10x[0x15 - 1], 2); | 949 | reg_w(gspca_dev, 0x15, ®12_19[3], 2); |
| 927 | /* compression register */ | 950 | /* compression register */ |
| 928 | reg_w(gspca_dev, 0x18, ®17_19[1], 1); | 951 | reg_w(gspca_dev, 0x18, ®12_19[6], 1); |
| 929 | /* H_start */ | 952 | /* H_start */ |
| 930 | reg_w(gspca_dev, 0x12, &sn9c10x[0x12 - 1], 1); | 953 | reg_w(gspca_dev, 0x12, ®12_19[0], 1); |
| 931 | /* V_START */ | 954 | /* V_START */ |
| 932 | reg_w(gspca_dev, 0x13, &sn9c10x[0x13 - 1], 1); | 955 | reg_w(gspca_dev, 0x13, ®12_19[1], 1); |
| 933 | /* reset 0x17 SensorClk enable inv Clk 0x60 */ | 956 | /* reset 0x17 SensorClk enable inv Clk 0x60 */ |
| 934 | /*fixme: ov7630 [17]=68 8f (+20 if 102)*/ | 957 | /*fixme: ov7630 [17]=68 8f (+20 if 102)*/ |
| 935 | reg_w(gspca_dev, 0x17, ®17_19[0], 1); | 958 | reg_w(gspca_dev, 0x17, ®12_19[5], 1); |
| 936 | /*MCKSIZE ->3 */ /*fixme: not ov7630*/ | 959 | /*MCKSIZE ->3 */ /*fixme: not ov7630*/ |
| 937 | reg_w(gspca_dev, 0x19, ®17_19[2], 1); | 960 | reg_w(gspca_dev, 0x19, ®12_19[7], 1); |
| 938 | /* AE_STRX AE_STRY AE_ENDX AE_ENDY */ | 961 | /* AE_STRX AE_STRY AE_ENDX AE_ENDY */ |
| 939 | reg_w(gspca_dev, 0x1c, &sn9c10x[0x1c - 1], 4); | 962 | reg_w(gspca_dev, 0x1c, &sn9c10x[0x1c - 1], 4); |
| 940 | /* Enable video transfert */ | 963 | /* Enable video transfert */ |
| 941 | reg_w(gspca_dev, 0x01, &sn9c10x[0], 1); | 964 | reg_w(gspca_dev, 0x01, &sn9c10x[0], 1); |
| 942 | /* Compression */ | 965 | /* Compression */ |
| 943 | reg_w(gspca_dev, 0x18, ®17_19[1], 2); | 966 | reg_w(gspca_dev, 0x18, ®12_19[6], 2); |
| 944 | msleep(20); | 967 | msleep(20); |
| 945 | 968 | ||
| 946 | sd->reg11 = -1; | 969 | sd->reg11 = -1; |
| @@ -957,18 +980,7 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 957 | 980 | ||
| 958 | static void sd_stopN(struct gspca_dev *gspca_dev) | 981 | static void sd_stopN(struct gspca_dev *gspca_dev) |
| 959 | { | 982 | { |
| 960 | __u8 ByteSend; | 983 | sd_init(gspca_dev); |
| 961 | |||
| 962 | ByteSend = 0x09; /* 0X00 */ | ||
| 963 | reg_w(gspca_dev, 0x01, &ByteSend, 1); | ||
| 964 | } | ||
| 965 | |||
| 966 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 967 | { | ||
| 968 | } | ||
| 969 | |||
| 970 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 971 | { | ||
| 972 | } | 984 | } |
| 973 | 985 | ||
| 974 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 986 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| @@ -978,6 +990,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 978 | { | 990 | { |
| 979 | int i; | 991 | int i; |
| 980 | struct sd *sd = (struct sd *) gspca_dev; | 992 | struct sd *sd = (struct sd *) gspca_dev; |
| 993 | struct cam *cam = &gspca_dev->cam; | ||
| 981 | 994 | ||
| 982 | /* frames start with: | 995 | /* frames start with: |
| 983 | * ff ff 00 c4 c4 96 synchro | 996 | * ff ff 00 c4 c4 96 synchro |
| @@ -998,20 +1011,31 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 998 | && data[5 + i] == 0x96) { /* start of frame */ | 1011 | && data[5 + i] == 0x96) { /* start of frame */ |
| 999 | int lum = -1; | 1012 | int lum = -1; |
| 1000 | int pkt_type = LAST_PACKET; | 1013 | int pkt_type = LAST_PACKET; |
| 1014 | int fr_h_sz = (sd->bridge == BRIDGE_103) ? | ||
| 1015 | 18 : 12; | ||
| 1001 | 1016 | ||
| 1002 | if (len - i < sd->fr_h_sz) { | 1017 | if (len - i < fr_h_sz) { |
| 1003 | PDEBUG(D_STREAM, "packet too short to" | 1018 | PDEBUG(D_STREAM, "packet too short to" |
| 1004 | " get avg brightness"); | 1019 | " get avg brightness"); |
| 1005 | } else if (sd->fr_h_sz == 12) { | 1020 | } else if (sd->bridge == BRIDGE_103) { |
| 1006 | lum = data[i + 8] + (data[i + 9] << 8); | ||
| 1007 | } else { | ||
| 1008 | lum = data[i + 9] + | 1021 | lum = data[i + 9] + |
| 1009 | (data[i + 10] << 8); | 1022 | (data[i + 10] << 8); |
| 1023 | } else { | ||
| 1024 | lum = data[i + 8] + (data[i + 9] << 8); | ||
| 1010 | } | 1025 | } |
| 1011 | if (lum == 0) { | 1026 | /* When exposure changes midway a frame we |
| 1027 | get a lum of 0 in this case drop 2 frames | ||
| 1028 | as the frames directly after an exposure | ||
| 1029 | change have an unstable image. Sometimes lum | ||
| 1030 | *really* is 0 (cam used in low light with | ||
| 1031 | low exposure setting), so do not drop frames | ||
| 1032 | if the previous lum was 0 too. */ | ||
| 1033 | if (lum == 0 && sd->prev_avg_lum != 0) { | ||
| 1012 | lum = -1; | 1034 | lum = -1; |
| 1013 | sd->frames_to_drop = 2; | 1035 | sd->frames_to_drop = 2; |
| 1014 | } | 1036 | sd->prev_avg_lum = 0; |
| 1037 | } else | ||
| 1038 | sd->prev_avg_lum = lum; | ||
| 1015 | atomic_set(&sd->avg_lum, lum); | 1039 | atomic_set(&sd->avg_lum, lum); |
| 1016 | 1040 | ||
| 1017 | if (sd->frames_to_drop) { | 1041 | if (sd->frames_to_drop) { |
| @@ -1021,14 +1045,25 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 1021 | 1045 | ||
| 1022 | frame = gspca_frame_add(gspca_dev, pkt_type, | 1046 | frame = gspca_frame_add(gspca_dev, pkt_type, |
| 1023 | frame, data, 0); | 1047 | frame, data, 0); |
| 1024 | data += i + sd->fr_h_sz; | 1048 | data += i + fr_h_sz; |
| 1025 | len -= i + sd->fr_h_sz; | 1049 | len -= i + fr_h_sz; |
| 1026 | gspca_frame_add(gspca_dev, FIRST_PACKET, | 1050 | gspca_frame_add(gspca_dev, FIRST_PACKET, |
| 1027 | frame, data, len); | 1051 | frame, data, len); |
| 1028 | return; | 1052 | return; |
| 1029 | } | 1053 | } |
| 1030 | } | 1054 | } |
| 1031 | } | 1055 | } |
| 1056 | |||
| 1057 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) { | ||
| 1058 | /* In raw mode we sometimes get some garbage after the frame | ||
| 1059 | ignore this */ | ||
| 1060 | int used = frame->data_end - frame->data; | ||
| 1061 | int size = cam->cam_mode[gspca_dev->curr_mode].sizeimage; | ||
| 1062 | |||
| 1063 | if (used + len > size) | ||
| 1064 | len = size - used; | ||
| 1065 | } | ||
| 1066 | |||
| 1032 | gspca_frame_add(gspca_dev, INTER_PACKET, | 1067 | gspca_frame_add(gspca_dev, INTER_PACKET, |
| 1033 | frame, data, len); | 1068 | frame, data, len); |
| 1034 | } | 1069 | } |
| @@ -1162,58 +1197,45 @@ static const struct sd_desc sd_desc = { | |||
| 1162 | .ctrls = sd_ctrls, | 1197 | .ctrls = sd_ctrls, |
| 1163 | .nctrls = ARRAY_SIZE(sd_ctrls), | 1198 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 1164 | .config = sd_config, | 1199 | .config = sd_config, |
| 1165 | .open = sd_open, | 1200 | .init = sd_init, |
| 1166 | .start = sd_start, | 1201 | .start = sd_start, |
| 1167 | .stopN = sd_stopN, | 1202 | .stopN = sd_stopN, |
| 1168 | .stop0 = sd_stop0, | ||
| 1169 | .close = sd_close, | ||
| 1170 | .pkt_scan = sd_pkt_scan, | 1203 | .pkt_scan = sd_pkt_scan, |
| 1171 | .querymenu = sd_querymenu, | 1204 | .querymenu = sd_querymenu, |
| 1205 | .dq_callback = do_autogain, | ||
| 1172 | }; | 1206 | }; |
| 1173 | 1207 | ||
| 1174 | /* -- module initialisation -- */ | 1208 | /* -- module initialisation -- */ |
| 1175 | #define SFCI(sensor, flags, nctrls, i2c_addr) \ | 1209 | #define SB(sensor, bridge) \ |
| 1176 | .driver_info = (SENSOR_ ## sensor << 24) \ | 1210 | .driver_info = (SENSOR_ ## sensor << 8) | BRIDGE_ ## bridge |
| 1177 | | ((flags) << 16) \ | 1211 | |
| 1178 | | ((nctrls) << 8) \ | 1212 | |
| 1179 | | (i2c_addr) | ||
| 1180 | static __devinitdata struct usb_device_id device_table[] = { | 1213 | static __devinitdata struct usb_device_id device_table[] = { |
| 1181 | #ifndef CONFIG_USB_SN9C102 | 1214 | {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110, 102)}, /* TAS5110C1B */ |
| 1182 | {USB_DEVICE(0x0c45, 0x6001), /* SN9C102 */ | 1215 | {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110, 101)}, /* TAS5110C1B */ |
| 1183 | SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)}, | 1216 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
| 1184 | {USB_DEVICE(0x0c45, 0x6005), /* SN9C101 */ | 1217 | {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110, 101)}, /* TAS5110D */ |
| 1185 | SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)}, | 1218 | {USB_DEVICE(0x0c45, 0x6009), SB(PAS106, 101)}, |
| 1186 | {USB_DEVICE(0x0c45, 0x6007), /* SN9C101 */ | 1219 | {USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)}, |
| 1187 | SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)}, | ||
| 1188 | {USB_DEVICE(0x0c45, 0x6009), /* SN9C101 */ | ||
| 1189 | SFCI(PAS106, F_SIF, 2, 0)}, | ||
| 1190 | {USB_DEVICE(0x0c45, 0x600d), /* SN9C101 */ | ||
| 1191 | SFCI(PAS106, F_SIF, 2, 0)}, | ||
| 1192 | #endif | 1220 | #endif |
| 1193 | {USB_DEVICE(0x0c45, 0x6011), /* SN9C101 - SN9C101G */ | 1221 | {USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)}, |
| 1194 | SFCI(OV6650, F_GAIN|F_AUTO|F_SIF, 5, 0x60)}, | 1222 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
| 1195 | #ifndef CONFIG_USB_SN9C102 | 1223 | {USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)}, |
| 1196 | {USB_DEVICE(0x0c45, 0x6019), /* SN9C101 */ | 1224 | {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)}, |
| 1197 | SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)}, | 1225 | {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)}, |
| 1198 | {USB_DEVICE(0x0c45, 0x6024), /* SN9C102 */ | 1226 | {USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)}, |
| 1199 | SFCI(TAS5130CXX, 0, 2, 0)}, | 1227 | {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)}, |
| 1200 | {USB_DEVICE(0x0c45, 0x6025), /* SN9C102 */ | 1228 | {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)}, |
| 1201 | SFCI(TAS5130CXX, 0, 2, 0)}, | ||
| 1202 | {USB_DEVICE(0x0c45, 0x6028), /* SN9C102 */ | ||
| 1203 | SFCI(PAS202, 0, 2, 0)}, | ||
| 1204 | {USB_DEVICE(0x0c45, 0x6029), /* SN9C101 */ | ||
| 1205 | SFCI(PAS106, F_SIF, 2, 0)}, | ||
| 1206 | {USB_DEVICE(0x0c45, 0x602c), /* SN9C102 */ | ||
| 1207 | SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)}, | ||
| 1208 | {USB_DEVICE(0x0c45, 0x602d), /* SN9C102 */ | ||
| 1209 | SFCI(HV7131R, 0, 2, 0)}, | ||
| 1210 | {USB_DEVICE(0x0c45, 0x602e), /* SN9C102 */ | ||
| 1211 | SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)}, | ||
| 1212 | {USB_DEVICE(0x0c45, 0x60af), /* SN9C103 */ | ||
| 1213 | SFCI(PAS202, F_H18, 2, 0)}, | ||
| 1214 | {USB_DEVICE(0x0c45, 0x60b0), /* SN9C103 */ | ||
| 1215 | SFCI(OV7630, F_GAIN|F_AUTO|F_H18, 5, 0x21)}, | ||
| 1216 | #endif | 1229 | #endif |
| 1230 | {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)}, | ||
| 1231 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | ||
| 1232 | {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)}, | ||
| 1233 | #endif | ||
| 1234 | {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)}, | ||
| 1235 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | ||
| 1236 | {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)}, | ||
| 1237 | #endif | ||
| 1238 | {USB_DEVICE(0x0c45, 0x60b0), SB(OV7630, 103)}, | ||
| 1217 | {} | 1239 | {} |
| 1218 | }; | 1240 | }; |
| 1219 | MODULE_DEVICE_TABLE(usb, device_table); | 1241 | MODULE_DEVICE_TABLE(usb, device_table); |
| @@ -1231,6 +1253,10 @@ static struct usb_driver sd_driver = { | |||
| 1231 | .id_table = device_table, | 1253 | .id_table = device_table, |
| 1232 | .probe = sd_probe, | 1254 | .probe = sd_probe, |
| 1233 | .disconnect = gspca_disconnect, | 1255 | .disconnect = gspca_disconnect, |
| 1256 | #ifdef CONFIG_PM | ||
| 1257 | .suspend = gspca_suspend, | ||
| 1258 | .resume = gspca_resume, | ||
| 1259 | #endif | ||
| 1234 | }; | 1260 | }; |
| 1235 | 1261 | ||
| 1236 | /* -- module insert / remove -- */ | 1262 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 245a30ec5fb1..d75b1d20b318 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
| @@ -54,8 +54,10 @@ struct sd { | |||
| 54 | #define SENSOR_HV7131R 0 | 54 | #define SENSOR_HV7131R 0 |
| 55 | #define SENSOR_MI0360 1 | 55 | #define SENSOR_MI0360 1 |
| 56 | #define SENSOR_MO4000 2 | 56 | #define SENSOR_MO4000 2 |
| 57 | #define SENSOR_OV7648 3 | 57 | #define SENSOR_OM6802 3 |
| 58 | #define SENSOR_OV7660 4 | 58 | #define SENSOR_OV7630 4 |
| 59 | #define SENSOR_OV7648 5 | ||
| 60 | #define SENSOR_OV7660 6 | ||
| 59 | unsigned char i2c_base; | 61 | unsigned char i2c_base; |
| 60 | }; | 62 | }; |
| 61 | 63 | ||
| @@ -76,7 +78,8 @@ static struct ctrl sd_ctrls[] = { | |||
| 76 | .type = V4L2_CTRL_TYPE_INTEGER, | 78 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 77 | .name = "Brightness", | 79 | .name = "Brightness", |
| 78 | .minimum = 0, | 80 | .minimum = 0, |
| 79 | .maximum = 0xffff, | 81 | #define BRIGHTNESS_MAX 0xffff |
| 82 | .maximum = BRIGHTNESS_MAX, | ||
| 80 | .step = 1, | 83 | .step = 1, |
| 81 | #define BRIGHTNESS_DEF 0x7fff | 84 | #define BRIGHTNESS_DEF 0x7fff |
| 82 | .default_value = BRIGHTNESS_DEF, | 85 | .default_value = BRIGHTNESS_DEF, |
| @@ -90,7 +93,8 @@ static struct ctrl sd_ctrls[] = { | |||
| 90 | .type = V4L2_CTRL_TYPE_INTEGER, | 93 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 91 | .name = "Contrast", | 94 | .name = "Contrast", |
| 92 | .minimum = 0, | 95 | .minimum = 0, |
| 93 | .maximum = 127, | 96 | #define CONTRAST_MAX 127 |
| 97 | .maximum = CONTRAST_MAX, | ||
| 94 | .step = 1, | 98 | .step = 1, |
| 95 | #define CONTRAST_DEF 63 | 99 | #define CONTRAST_DEF 63 |
| 96 | .default_value = CONTRAST_DEF, | 100 | .default_value = CONTRAST_DEF, |
| @@ -104,14 +108,15 @@ static struct ctrl sd_ctrls[] = { | |||
| 104 | .type = V4L2_CTRL_TYPE_INTEGER, | 108 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 105 | .name = "Color", | 109 | .name = "Color", |
| 106 | .minimum = 0, | 110 | .minimum = 0, |
| 107 | .maximum = 255, | 111 | .maximum = 64, |
| 108 | .step = 1, | 112 | .step = 1, |
| 109 | #define COLOR_DEF 127 | 113 | #define COLOR_DEF 32 |
| 110 | .default_value = COLOR_DEF, | 114 | .default_value = COLOR_DEF, |
| 111 | }, | 115 | }, |
| 112 | .set = sd_setcolors, | 116 | .set = sd_setcolors, |
| 113 | .get = sd_getcolors, | 117 | .get = sd_getcolors, |
| 114 | }, | 118 | }, |
| 119 | #define AUTOGAIN_IDX 3 | ||
| 115 | { | 120 | { |
| 116 | { | 121 | { |
| 117 | .id = V4L2_CID_AUTOGAIN, | 122 | .id = V4L2_CID_AUTOGAIN, |
| @@ -131,7 +136,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 131 | static struct v4l2_pix_format vga_mode[] = { | 136 | static struct v4l2_pix_format vga_mode[] = { |
| 132 | {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | 137 | {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
| 133 | .bytesperline = 160, | 138 | .bytesperline = 160, |
| 134 | .sizeimage = 160 * 120 * 3 / 8 + 590, | 139 | .sizeimage = 160 * 120 * 4 / 8 + 590, |
| 135 | .colorspace = V4L2_COLORSPACE_JPEG, | 140 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 136 | .priv = 2}, | 141 | .priv = 2}, |
| 137 | {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | 142 | {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
| @@ -180,6 +185,31 @@ static const __u8 sn_mo4000[] = { | |||
| 180 | 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 185 | 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
| 181 | }; | 186 | }; |
| 182 | 187 | ||
| 188 | static const __u8 sn_om6802[] = { | ||
| 189 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | ||
| 190 | 0x00, 0x23, 0x72, 0x00, 0x1a, 0x34, 0x27, 0x20, | ||
| 191 | /* reg8 reg9 rega regb regc regd rege regf */ | ||
| 192 | 0x80, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 193 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | ||
| 194 | 0x03, 0x00, 0x51, 0x01, 0x00, 0x28, 0x1e, 0x40, | ||
| 195 | /* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */ | ||
| 196 | 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 197 | 0x08, 0x22, 0x44, 0x63, 0x7d, 0x92, 0xa3, 0xaf, | ||
| 198 | 0xbc, 0xc4, 0xcd, 0xd5, 0xdc, 0xe1, 0xe8, 0xef, | ||
| 199 | 0xf7 | ||
| 200 | }; | ||
| 201 | |||
| 202 | static const __u8 sn_ov7630[] = { | ||
| 203 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | ||
| 204 | 0x00, 0x21, 0x40, 0x00, 0x1a, 0x20, 0x1f, 0x20, | ||
| 205 | /* reg8 reg9 rega regb regc regd rege regf */ | ||
| 206 | 0xa1, 0x21, 0x76, 0x21, 0x00, 0x00, 0x00, 0x10, | ||
| 207 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | ||
| 208 | 0x03, 0x00, 0x04, 0x01, 0x0a, 0x28, 0x1e, 0xc2, | ||
| 209 | /* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */ | ||
| 210 | 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
| 211 | }; | ||
| 212 | |||
| 183 | static const __u8 sn_ov7648[] = { | 213 | static const __u8 sn_ov7648[] = { |
| 184 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | 214 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
| 185 | 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, | 215 | 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, |
| @@ -207,31 +237,22 @@ static const __u8 *sn_tb[] = { | |||
| 207 | sn_hv7131, | 237 | sn_hv7131, |
| 208 | sn_mi0360, | 238 | sn_mi0360, |
| 209 | sn_mo4000, | 239 | sn_mo4000, |
| 240 | sn_om6802, | ||
| 241 | sn_ov7630, | ||
| 210 | sn_ov7648, | 242 | sn_ov7648, |
| 211 | sn_ov7660 | 243 | sn_ov7660 |
| 212 | }; | 244 | }; |
| 213 | 245 | ||
| 214 | static const __u8 regsn20[] = { | 246 | static const __u8 gamma_def[] = { |
| 215 | 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, | 247 | 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, |
| 216 | 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff | 248 | 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff |
| 217 | }; | 249 | }; |
| 218 | static const __u8 regsn20_sn9c325[] = { | ||
| 219 | 0x0a, 0x3a, 0x56, 0x6c, 0x7e, 0x8d, 0x9a, 0xa4, | ||
| 220 | 0xaf, 0xbb, 0xc5, 0xcd, 0xd5, 0xde, 0xe8, 0xed, 0xf5 | ||
| 221 | }; | ||
| 222 | 250 | ||
| 223 | static const __u8 reg84[] = { | 251 | static const __u8 reg84[] = { |
| 224 | 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe5, 0x0f, | 252 | 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe5, 0x0f, |
| 225 | 0xe4, 0x0f, 0x38, 0x00, 0x3e, 0x00, 0xc3, 0x0f, | 253 | 0xe4, 0x0f, 0x38, 0x00, 0x3e, 0x00, 0xc3, 0x0f, |
| 226 | /* 0x00, 0x00, 0x00, 0x00, 0x00 */ | 254 | 0xf7, 0x0f, 0x00, 0x00, 0x00 |
| 227 | 0xf7, 0x0f, 0x0a, 0x00, 0x00 | ||
| 228 | }; | ||
| 229 | static const __u8 reg84_sn9c325[] = { | ||
| 230 | 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe4, 0x0f, | ||
| 231 | 0xd3, 0x0f, 0x4b, 0x00, 0x48, 0x00, 0xc0, 0x0f, | ||
| 232 | 0xf8, 0x0f, 0x00, 0x00, 0x00 | ||
| 233 | }; | 255 | }; |
| 234 | |||
| 235 | static const __u8 hv7131r_sensor_init[][8] = { | 256 | static const __u8 hv7131r_sensor_init[][8] = { |
| 236 | {0xC1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, | 257 | {0xC1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, |
| 237 | {0xB1, 0x11, 0x34, 0x17, 0x7F, 0x00, 0x00, 0x10}, | 258 | {0xB1, 0x11, 0x34, 0x17, 0x7F, 0x00, 0x00, 0x10}, |
| @@ -340,6 +361,92 @@ static const __u8 mo4000_sensor_init[][8] = { | |||
| 340 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, | 361 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, |
| 341 | {} | 362 | {} |
| 342 | }; | 363 | }; |
| 364 | static __u8 om6802_sensor_init[][8] = { | ||
| 365 | {0xa0, 0x34, 0x90, 0x05, 0x00, 0x00, 0x00, 0x10}, | ||
| 366 | {0xa0, 0x34, 0x49, 0x85, 0x00, 0x00, 0x00, 0x10}, | ||
| 367 | {0xa0, 0x34, 0x5a, 0xc0, 0x00, 0x00, 0x00, 0x10}, | ||
| 368 | {0xa0, 0x34, 0xdd, 0x18, 0x00, 0x00, 0x00, 0x10}, | ||
| 369 | /* {0xa0, 0x34, 0xfb, 0x11, 0x00, 0x00, 0x00, 0x10}, */ | ||
| 370 | {0xa0, 0x34, 0xf0, 0x04, 0x00, 0x00, 0x00, 0x10}, | ||
| 371 | /* white balance & auto-exposure */ | ||
| 372 | /* {0xa0, 0x34, 0xf1, 0x02, 0x00, 0x00, 0x00, 0x10}, | ||
| 373 | * set color mode */ | ||
| 374 | /* {0xa0, 0x34, 0xfe, 0x5b, 0x00, 0x00, 0x00, 0x10}, | ||
| 375 | * max AGC value in AE */ | ||
| 376 | /* {0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 377 | * preset AGC */ | ||
| 378 | /* {0xa0, 0x34, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 379 | * preset brightness */ | ||
| 380 | /* {0xa0, 0x34, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 381 | * preset contrast */ | ||
| 382 | /* {0xa0, 0x34, 0xe8, 0x31, 0x00, 0x00, 0x00, 0x10}, | ||
| 383 | * preset gamma */ | ||
| 384 | {0xa0, 0x34, 0xe9, 0x0f, 0x00, 0x00, 0x00, 0x10}, | ||
| 385 | /* luminance mode (0x4f = AE) */ | ||
| 386 | {0xa0, 0x34, 0xe4, 0xff, 0x00, 0x00, 0x00, 0x10}, | ||
| 387 | /* preset shutter */ | ||
| 388 | /* {0xa0, 0x34, 0xef, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 389 | * auto frame rate */ | ||
| 390 | /* {0xa0, 0x34, 0xfb, 0xee, 0x00, 0x00, 0x00, 0x10}, */ | ||
| 391 | |||
| 392 | /* {0xa0, 0x34, 0x71, 0x84, 0x00, 0x00, 0x00, 0x10}, */ | ||
| 393 | /* {0xa0, 0x34, 0x72, 0x05, 0x00, 0x00, 0x00, 0x10}, */ | ||
| 394 | /* {0xa0, 0x34, 0x68, 0x80, 0x00, 0x00, 0x00, 0x10}, */ | ||
| 395 | /* {0xa0, 0x34, 0x69, 0x01, 0x00, 0x00, 0x00, 0x10}, */ | ||
| 396 | {} | ||
| 397 | }; | ||
| 398 | static const __u8 ov7630_sensor_init[][8] = { | ||
| 399 | {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10}, | ||
| 400 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, | ||
| 401 | /* win: delay 20ms */ | ||
| 402 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | ||
| 403 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, | ||
| 404 | /* win: delay 20ms */ | ||
| 405 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | ||
| 406 | /* win: i2c_r from 00 to 80 */ | ||
| 407 | {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10}, | ||
| 408 | {0xb1, 0x21, 0x0c, 0x20, 0x20, 0x00, 0x00, 0x10}, | ||
| 409 | {0xd1, 0x21, 0x11, 0x00, 0x48, 0xc0, 0x00, 0x10}, | ||
| 410 | {0xb1, 0x21, 0x15, 0x80, 0x03, 0x00, 0x00, 0x10}, | ||
| 411 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, | ||
| 412 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, | ||
| 413 | {0xd1, 0x21, 0x1f, 0x00, 0x80, 0x80, 0x80, 0x10}, | ||
| 414 | {0xd1, 0x21, 0x23, 0xde, 0x10, 0x8a, 0xa0, 0x10}, | ||
| 415 | {0xc1, 0x21, 0x27, 0xca, 0xa2, 0x74, 0x00, 0x10}, | ||
| 416 | {0xd1, 0x21, 0x2a, 0x88, 0x00, 0x88, 0x01, 0x10}, | ||
| 417 | {0xc1, 0x21, 0x2e, 0x80, 0x00, 0x18, 0x00, 0x10}, | ||
| 418 | {0xa1, 0x21, 0x21, 0x08, 0x00, 0x00, 0x00, 0x10}, | ||
| 419 | {0xa1, 0x21, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 420 | {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 421 | {0xb1, 0x21, 0x32, 0xc2, 0x08, 0x00, 0x00, 0x10}, | ||
| 422 | {0xb1, 0x21, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 423 | {0xd1, 0x21, 0x60, 0x05, 0x40, 0x12, 0x57, 0x10}, | ||
| 424 | {0xa1, 0x21, 0x64, 0x73, 0x00, 0x00, 0x00, 0x10}, | ||
| 425 | {0xd1, 0x21, 0x65, 0x00, 0x55, 0x01, 0xac, 0x10}, | ||
| 426 | {0xa1, 0x21, 0x69, 0x38, 0x00, 0x00, 0x00, 0x10}, | ||
| 427 | {0xd1, 0x21, 0x6f, 0x1f, 0x01, 0x00, 0x10, 0x10}, | ||
| 428 | {0xd1, 0x21, 0x73, 0x50, 0x20, 0x02, 0x01, 0x10}, | ||
| 429 | {0xd1, 0x21, 0x77, 0xf3, 0x90, 0x98, 0x98, 0x10}, | ||
| 430 | {0xc1, 0x21, 0x7b, 0x00, 0x4c, 0xf7, 0x00, 0x10}, | ||
| 431 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, | ||
| 432 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, | ||
| 433 | /* */ | ||
| 434 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | ||
| 435 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | ||
| 436 | /*fixme: + 0x12, 0x04*/ | ||
| 437 | {0xa1, 0x21, 0x75, 0x82, 0x00, 0x00, 0x00, 0x10}, | ||
| 438 | {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, | ||
| 439 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 440 | {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10}, | ||
| 441 | /* */ | ||
| 442 | {0xa1, 0x21, 0x11, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
| 443 | {0xa1, 0x21, 0x2a, 0x88, 0x00, 0x00, 0x00, 0x10}, | ||
| 444 | {0xa1, 0x21, 0x2b, 0x34, 0x00, 0x00, 0x00, 0x10}, | ||
| 445 | /* */ | ||
| 446 | {0xa1, 0x21, 0x10, 0x83, 0x00, 0x00, 0x00, 0x10}, | ||
| 447 | /* {0xb1, 0x21, 0x01, 0x88, 0x70, 0x00, 0x00, 0x10}, */ | ||
| 448 | {} | ||
| 449 | }; | ||
| 343 | static const __u8 ov7660_sensor_init[][8] = { | 450 | static const __u8 ov7660_sensor_init[][8] = { |
| 344 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ | 451 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ |
| 345 | /* (delay 20ms) */ | 452 | /* (delay 20ms) */ |
| @@ -506,10 +613,16 @@ static const __u8 qtable4[] = { | |||
| 506 | 0x29, 0x29, 0x29, 0x29 | 613 | 0x29, 0x29, 0x29, 0x29 |
| 507 | }; | 614 | }; |
| 508 | 615 | ||
| 509 | /* read <len> bytes (len < sizeof gspca_dev->usb_buf) to gspca_dev->usb_buf */ | 616 | /* read <len> bytes to gspca_dev->usb_buf */ |
| 510 | static void reg_r(struct gspca_dev *gspca_dev, | 617 | static void reg_r(struct gspca_dev *gspca_dev, |
| 511 | __u16 value, int len) | 618 | __u16 value, int len) |
| 512 | { | 619 | { |
| 620 | #ifdef GSPCA_DEBUG | ||
| 621 | if (len > USB_BUF_SZ) { | ||
| 622 | err("reg_r: buffer overflow"); | ||
| 623 | return; | ||
| 624 | } | ||
| 625 | #endif | ||
| 513 | usb_control_msg(gspca_dev->dev, | 626 | usb_control_msg(gspca_dev->dev, |
| 514 | usb_rcvctrlpipe(gspca_dev->dev, 0), | 627 | usb_rcvctrlpipe(gspca_dev->dev, 0), |
| 515 | 0, | 628 | 0, |
| @@ -542,29 +655,20 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
| 542 | { | 655 | { |
| 543 | PDEBUG(D_USBO, "reg_w [%02x] = %02x %02x ..", | 656 | PDEBUG(D_USBO, "reg_w [%02x] = %02x %02x ..", |
| 544 | value, buffer[0], buffer[1]); | 657 | value, buffer[0], buffer[1]); |
| 545 | if (len <= sizeof gspca_dev->usb_buf) { | 658 | #ifdef GSPCA_DEBUG |
| 546 | memcpy(gspca_dev->usb_buf, buffer, len); | 659 | if (len > USB_BUF_SZ) { |
| 547 | usb_control_msg(gspca_dev->dev, | 660 | err("reg_w: buffer overflow"); |
| 548 | usb_sndctrlpipe(gspca_dev->dev, 0), | 661 | return; |
| 549 | 0x08, | ||
| 550 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | ||
| 551 | value, 0, | ||
| 552 | gspca_dev->usb_buf, len, | ||
| 553 | 500); | ||
| 554 | } else { | ||
| 555 | __u8 *tmpbuf; | ||
| 556 | |||
| 557 | tmpbuf = kmalloc(len, GFP_KERNEL); | ||
| 558 | memcpy(tmpbuf, buffer, len); | ||
| 559 | usb_control_msg(gspca_dev->dev, | ||
| 560 | usb_sndctrlpipe(gspca_dev->dev, 0), | ||
| 561 | 0x08, | ||
| 562 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | ||
| 563 | value, 0, | ||
| 564 | tmpbuf, len, | ||
| 565 | 500); | ||
| 566 | kfree(tmpbuf); | ||
| 567 | } | 662 | } |
| 663 | #endif | ||
| 664 | memcpy(gspca_dev->usb_buf, buffer, len); | ||
| 665 | usb_control_msg(gspca_dev->dev, | ||
| 666 | usb_sndctrlpipe(gspca_dev->dev, 0), | ||
| 667 | 0x08, | ||
| 668 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | ||
| 669 | value, 0, | ||
| 670 | gspca_dev->usb_buf, len, | ||
| 671 | 500); | ||
| 568 | } | 672 | } |
| 569 | 673 | ||
| 570 | /* I2C write 1 byte */ | 674 | /* I2C write 1 byte */ |
| @@ -665,7 +769,7 @@ static int configure_gpio(struct gspca_dev *gspca_dev, | |||
| 665 | static const __u8 regd4[] = {0x60, 0x00, 0x00}; | 769 | static const __u8 regd4[] = {0x60, 0x00, 0x00}; |
| 666 | 770 | ||
| 667 | reg_w1(gspca_dev, 0xf1, 0x00); | 771 | reg_w1(gspca_dev, 0xf1, 0x00); |
| 668 | reg_w1(gspca_dev, 0x01, 0x00); /*jfm was sn9c1xx[1] in v1*/ | 772 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); |
| 669 | 773 | ||
| 670 | /* configure gpio */ | 774 | /* configure gpio */ |
| 671 | reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2); | 775 | reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2); |
| @@ -685,21 +789,41 @@ static int configure_gpio(struct gspca_dev *gspca_dev, | |||
| 685 | 789 | ||
| 686 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); | 790 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); |
| 687 | 791 | ||
| 688 | switch (sd->bridge) { | 792 | switch (sd->sensor) { |
| 689 | case BRIDGE_SN9C325: | 793 | case SENSOR_OM6802: |
| 794 | reg_w1(gspca_dev, 0x02, 0x71); | ||
| 795 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 796 | reg_w1(gspca_dev, 0x17, 0x64); | ||
| 797 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 798 | break; | ||
| 799 | /*jfm: from win trace */ | ||
| 800 | case SENSOR_OV7630: | ||
| 801 | reg_w1(gspca_dev, 0x01, 0x61); | ||
| 802 | reg_w1(gspca_dev, 0x17, 0xe2); | ||
| 803 | reg_w1(gspca_dev, 0x01, 0x60); | ||
| 804 | reg_w1(gspca_dev, 0x01, 0x40); | ||
| 805 | break; | ||
| 806 | case SENSOR_OV7648: | ||
| 690 | reg_w1(gspca_dev, 0x01, 0x43); | 807 | reg_w1(gspca_dev, 0x01, 0x43); |
| 691 | reg_w1(gspca_dev, 0x17, 0xae); | 808 | reg_w1(gspca_dev, 0x17, 0xae); |
| 692 | reg_w1(gspca_dev, 0x01, 0x42); | 809 | reg_w1(gspca_dev, 0x01, 0x42); |
| 693 | break; | 810 | break; |
| 811 | /*jfm: from win trace */ | ||
| 812 | case SENSOR_OV7660: | ||
| 813 | reg_w1(gspca_dev, 0x01, 0x61); | ||
| 814 | reg_w1(gspca_dev, 0x17, 0x20); | ||
| 815 | reg_w1(gspca_dev, 0x01, 0x60); | ||
| 816 | reg_w1(gspca_dev, 0x01, 0x40); | ||
| 817 | break; | ||
| 694 | default: | 818 | default: |
| 695 | reg_w1(gspca_dev, 0x01, 0x43); | 819 | reg_w1(gspca_dev, 0x01, 0x43); |
| 696 | reg_w1(gspca_dev, 0x17, 0x61); | 820 | reg_w1(gspca_dev, 0x17, 0x61); |
| 697 | reg_w1(gspca_dev, 0x01, 0x42); | 821 | reg_w1(gspca_dev, 0x01, 0x42); |
| 698 | } | 822 | if (sd->sensor == SENSOR_HV7131R) { |
| 699 | 823 | if (probesensor(gspca_dev) < 0) | |
| 700 | if (sd->sensor == SENSOR_HV7131R) { | 824 | return -ENODEV; |
| 701 | if (probesensor(gspca_dev) < 0) | 825 | } |
| 702 | return -ENODEV; | 826 | break; |
| 703 | } | 827 | } |
| 704 | return 0; | 828 | return 0; |
| 705 | } | 829 | } |
| @@ -737,6 +861,40 @@ static void mo4000_InitSensor(struct gspca_dev *gspca_dev) | |||
| 737 | } | 861 | } |
| 738 | } | 862 | } |
| 739 | 863 | ||
| 864 | static void om6802_InitSensor(struct gspca_dev *gspca_dev) | ||
| 865 | { | ||
| 866 | int i = 0; | ||
| 867 | |||
| 868 | while (om6802_sensor_init[i][0]) { | ||
| 869 | i2c_w8(gspca_dev, om6802_sensor_init[i]); | ||
| 870 | i++; | ||
| 871 | } | ||
| 872 | } | ||
| 873 | |||
| 874 | static void ov7630_InitSensor(struct gspca_dev *gspca_dev) | ||
| 875 | { | ||
| 876 | int i = 0; | ||
| 877 | |||
| 878 | i2c_w8(gspca_dev, ov7630_sensor_init[i]); /* 76 01 */ | ||
| 879 | i++; | ||
| 880 | i2c_w8(gspca_dev, ov7630_sensor_init[i]); /* 12 c8 (RGB+SRST) */ | ||
| 881 | i++; | ||
| 882 | msleep(20); | ||
| 883 | i2c_w8(gspca_dev, ov7630_sensor_init[i]); /* 12 48 */ | ||
| 884 | i++; | ||
| 885 | i2c_w8(gspca_dev, ov7630_sensor_init[i]); /* 12 c8 */ | ||
| 886 | i++; | ||
| 887 | msleep(20); | ||
| 888 | i2c_w8(gspca_dev, ov7630_sensor_init[i]); /* 12 48 */ | ||
| 889 | i++; | ||
| 890 | /*jfm:win i2c_r from 00 to 80*/ | ||
| 891 | |||
| 892 | while (ov7630_sensor_init[i][0]) { | ||
| 893 | i2c_w8(gspca_dev, ov7630_sensor_init[i]); | ||
| 894 | i++; | ||
| 895 | } | ||
| 896 | } | ||
| 897 | |||
| 740 | static void ov7648_InitSensor(struct gspca_dev *gspca_dev) | 898 | static void ov7648_InitSensor(struct gspca_dev *gspca_dev) |
| 741 | { | 899 | { |
| 742 | int i = 0; | 900 | int i = 0; |
| @@ -783,11 +941,19 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 783 | sd->autogain = AUTOGAIN_DEF; | 941 | sd->autogain = AUTOGAIN_DEF; |
| 784 | sd->ag_cnt = -1; | 942 | sd->ag_cnt = -1; |
| 785 | 943 | ||
| 944 | switch (sd->sensor) { | ||
| 945 | case SENSOR_OV7630: | ||
| 946 | case SENSOR_OV7648: | ||
| 947 | case SENSOR_OV7660: | ||
| 948 | gspca_dev->ctrl_dis = (1 << AUTOGAIN_IDX); | ||
| 949 | break; | ||
| 950 | } | ||
| 951 | |||
| 786 | return 0; | 952 | return 0; |
| 787 | } | 953 | } |
| 788 | 954 | ||
| 789 | /* this function is called at open time */ | 955 | /* this function is called at probe and resume time */ |
| 790 | static int sd_open(struct gspca_dev *gspca_dev) | 956 | static int sd_init(struct gspca_dev *gspca_dev) |
| 791 | { | 957 | { |
| 792 | struct sd *sd = (struct sd *) gspca_dev; | 958 | struct sd *sd = (struct sd *) gspca_dev; |
| 793 | /* const __u8 *sn9c1xx; */ | 959 | /* const __u8 *sn9c1xx; */ |
| @@ -891,16 +1057,53 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev, | |||
| 891 | | ((expoMo10[3] & 0x30) >> 4)); | 1057 | | ((expoMo10[3] & 0x30) >> 4)); |
| 892 | break; | 1058 | break; |
| 893 | } | 1059 | } |
| 1060 | case SENSOR_OM6802: { | ||
| 1061 | __u8 gainOm[] = | ||
| 1062 | { 0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10 }; | ||
| 1063 | |||
| 1064 | if (expo > 0x03ff) | ||
| 1065 | expo = 0x03ff; | ||
| 1066 | if (expo < 0x0001) | ||
| 1067 | expo = 0x0001; | ||
| 1068 | gainOm[3] = expo >> 2; | ||
| 1069 | i2c_w8(gspca_dev, gainOm); | ||
| 1070 | reg_w1(gspca_dev, 0x96, (expo >> 5) & 0x1f); | ||
| 1071 | PDEBUG(D_CONF, "set exposure %d", gainOm[3]); | ||
| 1072 | break; | ||
| 1073 | } | ||
| 894 | } | 1074 | } |
| 895 | return expo; | 1075 | return expo; |
| 896 | } | 1076 | } |
| 897 | 1077 | ||
| 1078 | /* this function is used for sensors o76xx only */ | ||
| 1079 | static void setbrightcont(struct gspca_dev *gspca_dev) | ||
| 1080 | { | ||
| 1081 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1082 | unsigned val; | ||
| 1083 | __u8 reg84_full[0x15]; | ||
| 1084 | |||
| 1085 | memset(reg84_full, 0, sizeof reg84_full); | ||
| 1086 | val = sd->contrast * 0x20 / CONTRAST_MAX + 0x10; /* 10..30 */ | ||
| 1087 | reg84_full[2] = val; | ||
| 1088 | reg84_full[0] = (val + 1) / 2; | ||
| 1089 | reg84_full[4] = (val + 1) / 5; | ||
| 1090 | if (val > BRIGHTNESS_DEF) | ||
| 1091 | val = (sd->brightness - BRIGHTNESS_DEF) * 0x20 | ||
| 1092 | / BRIGHTNESS_MAX; | ||
| 1093 | else | ||
| 1094 | val = 0; | ||
| 1095 | reg84_full[0x12] = val; /* 00..1f */ | ||
| 1096 | reg_w(gspca_dev, 0x84, reg84_full, sizeof reg84_full); | ||
| 1097 | } | ||
| 1098 | |||
| 1099 | /* sensor != ov76xx */ | ||
| 898 | static void setbrightness(struct gspca_dev *gspca_dev) | 1100 | static void setbrightness(struct gspca_dev *gspca_dev) |
| 899 | { | 1101 | { |
| 900 | struct sd *sd = (struct sd *) gspca_dev; | 1102 | struct sd *sd = (struct sd *) gspca_dev; |
| 901 | unsigned int expo; | 1103 | unsigned int expo; |
| 902 | __u8 k2; | 1104 | __u8 k2; |
| 903 | 1105 | ||
| 1106 | k2 = sd->brightness >> 10; | ||
| 904 | switch (sd->sensor) { | 1107 | switch (sd->sensor) { |
| 905 | case SENSOR_HV7131R: | 1108 | case SENSOR_HV7131R: |
| 906 | expo = sd->brightness << 4; | 1109 | expo = sd->brightness << 4; |
| @@ -915,12 +1118,17 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
| 915 | expo = sd->brightness >> 4; | 1118 | expo = sd->brightness >> 4; |
| 916 | sd->exposure = setexposure(gspca_dev, expo); | 1119 | sd->exposure = setexposure(gspca_dev, expo); |
| 917 | break; | 1120 | break; |
| 1121 | case SENSOR_OM6802: | ||
| 1122 | expo = sd->brightness >> 6; | ||
| 1123 | sd->exposure = setexposure(gspca_dev, expo); | ||
| 1124 | k2 = sd->brightness >> 11; | ||
| 1125 | break; | ||
| 918 | } | 1126 | } |
| 919 | 1127 | ||
| 920 | k2 = sd->brightness >> 10; | ||
| 921 | reg_w1(gspca_dev, 0x96, k2); | 1128 | reg_w1(gspca_dev, 0x96, k2); |
| 922 | } | 1129 | } |
| 923 | 1130 | ||
| 1131 | /* sensor != ov76xx */ | ||
| 924 | static void setcontrast(struct gspca_dev *gspca_dev) | 1132 | static void setcontrast(struct gspca_dev *gspca_dev) |
| 925 | { | 1133 | { |
| 926 | struct sd *sd = (struct sd *) gspca_dev; | 1134 | struct sd *sd = (struct sd *) gspca_dev; |
| @@ -937,31 +1145,30 @@ static void setcontrast(struct gspca_dev *gspca_dev) | |||
| 937 | static void setcolors(struct gspca_dev *gspca_dev) | 1145 | static void setcolors(struct gspca_dev *gspca_dev) |
| 938 | { | 1146 | { |
| 939 | struct sd *sd = (struct sd *) gspca_dev; | 1147 | struct sd *sd = (struct sd *) gspca_dev; |
| 940 | __u8 data; | 1148 | __u8 blue, red; |
| 941 | int colour; | ||
| 942 | 1149 | ||
| 943 | colour = sd->colors - 128; | 1150 | if (sd->colors >= 32) { |
| 944 | if (colour > 0) | 1151 | red = 32 + (sd->colors - 32) / 2; |
| 945 | data = (colour + 32) & 0x7f; /* blue */ | 1152 | blue = 64 - sd->colors; |
| 946 | else | 1153 | } else { |
| 947 | data = (-colour + 32) & 0x7f; /* red */ | 1154 | red = sd->colors; |
| 948 | reg_w1(gspca_dev, 0x05, data); | 1155 | blue = 32 + (32 - sd->colors) / 2; |
| 1156 | } | ||
| 1157 | reg_w1(gspca_dev, 0x05, red); | ||
| 1158 | /* reg_w1(gspca_dev, 0x07, 32); */ | ||
| 1159 | reg_w1(gspca_dev, 0x06, blue); | ||
| 949 | } | 1160 | } |
| 950 | 1161 | ||
| 951 | static void setautogain(struct gspca_dev *gspca_dev) | 1162 | static void setautogain(struct gspca_dev *gspca_dev) |
| 952 | { | 1163 | { |
| 953 | struct sd *sd = (struct sd *) gspca_dev; | 1164 | struct sd *sd = (struct sd *) gspca_dev; |
| 954 | 1165 | ||
| 955 | switch (sd->sensor) { | 1166 | if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX)) |
| 956 | case SENSOR_HV7131R: | 1167 | return; |
| 957 | case SENSOR_MO4000: | 1168 | if (sd->autogain) |
| 958 | case SENSOR_MI0360: | 1169 | sd->ag_cnt = AG_CNT_START; |
| 959 | if (sd->autogain) | 1170 | else |
| 960 | sd->ag_cnt = AG_CNT_START; | 1171 | sd->ag_cnt = -1; |
| 961 | else | ||
| 962 | sd->ag_cnt = -1; | ||
| 963 | break; | ||
| 964 | } | ||
| 965 | } | 1172 | } |
| 966 | 1173 | ||
| 967 | /* -- start the camera -- */ | 1174 | /* -- start the camera -- */ |
| @@ -975,13 +1182,12 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 975 | static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; | 1182 | static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; |
| 976 | static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; | 1183 | static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; |
| 977 | static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ | 1184 | static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ |
| 978 | static const __u8 CE_sn9c325[] = | 1185 | static const __u8 CE_ov76xx[] = |
| 979 | { 0x32, 0xdd, 0x32, 0xdd }; /* OV7648 - SN9C325 */ | 1186 | { 0x32, 0xdd, 0x32, 0xdd }; /* OV7630/48 */ |
| 980 | 1187 | ||
| 981 | sn9c1xx = sn_tb[(int) sd->sensor]; | 1188 | sn9c1xx = sn_tb[(int) sd->sensor]; |
| 982 | configure_gpio(gspca_dev, sn9c1xx); | 1189 | configure_gpio(gspca_dev, sn9c1xx); |
| 983 | 1190 | ||
| 984 | /* reg_w1(gspca_dev, 0x01, 0x44); jfm from win trace*/ | ||
| 985 | reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]); | 1191 | reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]); |
| 986 | reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]); | 1192 | reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]); |
| 987 | reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]); | 1193 | reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]); |
| @@ -994,10 +1200,17 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 994 | reg_w1(gspca_dev, 0xc8, 0x50); | 1200 | reg_w1(gspca_dev, 0xc8, 0x50); |
| 995 | reg_w1(gspca_dev, 0xc9, 0x3c); | 1201 | reg_w1(gspca_dev, 0xc9, 0x3c); |
| 996 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); | 1202 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); |
| 997 | switch (sd->bridge) { | 1203 | switch (sd->sensor) { |
| 998 | case BRIDGE_SN9C325: | 1204 | case SENSOR_OV7630: |
| 1205 | reg17 = 0xe2; | ||
| 1206 | break; | ||
| 1207 | case SENSOR_OV7648: | ||
| 999 | reg17 = 0xae; | 1208 | reg17 = 0xae; |
| 1000 | break; | 1209 | break; |
| 1210 | /*jfm: from win trace */ | ||
| 1211 | case SENSOR_OV7660: | ||
| 1212 | reg17 = 0xa0; | ||
| 1213 | break; | ||
| 1001 | default: | 1214 | default: |
| 1002 | reg17 = 0x60; | 1215 | reg17 = 0x60; |
| 1003 | break; | 1216 | break; |
| @@ -1007,24 +1220,11 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 1007 | reg_w1(gspca_dev, 0x07, sn9c1xx[7]); | 1220 | reg_w1(gspca_dev, 0x07, sn9c1xx[7]); |
| 1008 | reg_w1(gspca_dev, 0x06, sn9c1xx[6]); | 1221 | reg_w1(gspca_dev, 0x06, sn9c1xx[6]); |
| 1009 | reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]); | 1222 | reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]); |
| 1010 | switch (sd->bridge) { | 1223 | reg_w(gspca_dev, 0x20, gamma_def, sizeof gamma_def); |
| 1011 | case BRIDGE_SN9C325: | 1224 | for (i = 0; i < 8; i++) |
| 1012 | reg_w(gspca_dev, 0x20, regsn20_sn9c325, | 1225 | reg_w(gspca_dev, 0x84, reg84, sizeof reg84); |
| 1013 | sizeof regsn20_sn9c325); | ||
| 1014 | for (i = 0; i < 8; i++) | ||
| 1015 | reg_w(gspca_dev, 0x84, reg84_sn9c325, | ||
| 1016 | sizeof reg84_sn9c325); | ||
| 1017 | reg_w1(gspca_dev, 0x9a, 0x0a); | ||
| 1018 | reg_w1(gspca_dev, 0x99, 0x60); | ||
| 1019 | break; | ||
| 1020 | default: | ||
| 1021 | reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20); | ||
| 1022 | for (i = 0; i < 8; i++) | ||
| 1023 | reg_w(gspca_dev, 0x84, reg84, sizeof reg84); | ||
| 1024 | reg_w1(gspca_dev, 0x9a, 0x08); | 1226 | reg_w1(gspca_dev, 0x9a, 0x08); |
| 1025 | reg_w1(gspca_dev, 0x99, 0x59); | 1227 | reg_w1(gspca_dev, 0x99, 0x59); |
| 1026 | break; | ||
| 1027 | } | ||
| 1028 | 1228 | ||
| 1029 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; | 1229 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; |
| 1030 | if (mode) | 1230 | if (mode) |
| @@ -1049,6 +1249,15 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 1049 | /* reg1 = 0x06; * 640 clk 24Mz (done) */ | 1249 | /* reg1 = 0x06; * 640 clk 24Mz (done) */ |
| 1050 | } | 1250 | } |
| 1051 | break; | 1251 | break; |
| 1252 | case SENSOR_OM6802: | ||
| 1253 | om6802_InitSensor(gspca_dev); | ||
| 1254 | reg17 = 0x64; /* 640 MCKSIZE */ | ||
| 1255 | break; | ||
| 1256 | case SENSOR_OV7630: | ||
| 1257 | ov7630_InitSensor(gspca_dev); | ||
| 1258 | reg17 = 0xe2; | ||
| 1259 | reg1 = 0x44; | ||
| 1260 | break; | ||
| 1052 | case SENSOR_OV7648: | 1261 | case SENSOR_OV7648: |
| 1053 | ov7648_InitSensor(gspca_dev); | 1262 | ov7648_InitSensor(gspca_dev); |
| 1054 | reg17 = 0xa2; | 1263 | reg17 = 0xa2; |
| @@ -1073,9 +1282,10 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 1073 | } | 1282 | } |
| 1074 | reg_w(gspca_dev, 0xc0, C0, 6); | 1283 | reg_w(gspca_dev, 0xc0, C0, 6); |
| 1075 | reg_w(gspca_dev, 0xca, CA, 4); | 1284 | reg_w(gspca_dev, 0xca, CA, 4); |
| 1076 | switch (sd->bridge) { | 1285 | switch (sd->sensor) { |
| 1077 | case BRIDGE_SN9C325: | 1286 | case SENSOR_OV7630: |
| 1078 | reg_w(gspca_dev, 0xce, CE_sn9c325, 4); | 1287 | case SENSOR_OV7648: |
| 1288 | reg_w(gspca_dev, 0xce, CE_ov76xx, 4); | ||
| 1079 | break; | 1289 | break; |
| 1080 | default: | 1290 | default: |
| 1081 | reg_w(gspca_dev, 0xce, CE, 4); | 1291 | reg_w(gspca_dev, 0xce, CE, 4); |
| @@ -1093,10 +1303,20 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 1093 | reg_w1(gspca_dev, 0x18, reg18); | 1303 | reg_w1(gspca_dev, 0x18, reg18); |
| 1094 | 1304 | ||
| 1095 | reg_w1(gspca_dev, 0x17, reg17); | 1305 | reg_w1(gspca_dev, 0x17, reg17); |
| 1096 | reg_w1(gspca_dev, 0x01, reg1); | 1306 | switch (sd->sensor) { |
| 1097 | setbrightness(gspca_dev); | 1307 | case SENSOR_HV7131R: |
| 1098 | setcontrast(gspca_dev); | 1308 | case SENSOR_MI0360: |
| 1309 | case SENSOR_MO4000: | ||
| 1310 | case SENSOR_OM6802: | ||
| 1311 | setbrightness(gspca_dev); | ||
| 1312 | setcontrast(gspca_dev); | ||
| 1313 | break; | ||
| 1314 | default: /* OV76xx */ | ||
| 1315 | setbrightcont(gspca_dev); | ||
| 1316 | break; | ||
| 1317 | } | ||
| 1099 | setautogain(gspca_dev); | 1318 | setautogain(gspca_dev); |
| 1319 | reg_w1(gspca_dev, 0x01, reg1); | ||
| 1100 | } | 1320 | } |
| 1101 | 1321 | ||
| 1102 | static void sd_stopN(struct gspca_dev *gspca_dev) | 1322 | static void sd_stopN(struct gspca_dev *gspca_dev) |
| @@ -1119,6 +1339,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 1119 | i2c_w8(gspca_dev, stopmi0360); | 1339 | i2c_w8(gspca_dev, stopmi0360); |
| 1120 | data = 0x29; | 1340 | data = 0x29; |
| 1121 | break; | 1341 | break; |
| 1342 | case SENSOR_OV7630: | ||
| 1122 | case SENSOR_OV7648: | 1343 | case SENSOR_OV7648: |
| 1123 | data = 0x29; | 1344 | data = 0x29; |
| 1124 | break; | 1345 | break; |
| @@ -1132,15 +1353,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 1132 | reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]); | 1353 | reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]); |
| 1133 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | 1354 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); |
| 1134 | reg_w1(gspca_dev, 0x01, data); | 1355 | reg_w1(gspca_dev, 0x01, data); |
| 1135 | reg_w1(gspca_dev, 0xf1, 0x01); | 1356 | reg_w1(gspca_dev, 0xf1, 0x00); |
| 1136 | } | ||
| 1137 | |||
| 1138 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 1139 | { | ||
| 1140 | } | ||
| 1141 | |||
| 1142 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 1143 | { | ||
| 1144 | } | 1357 | } |
| 1145 | 1358 | ||
| 1146 | static void do_autogain(struct gspca_dev *gspca_dev) | 1359 | static void do_autogain(struct gspca_dev *gspca_dev) |
| @@ -1174,6 +1387,7 @@ static void do_autogain(struct gspca_dev *gspca_dev) | |||
| 1174 | default: | 1387 | default: |
| 1175 | /* case SENSOR_MO4000: */ | 1388 | /* case SENSOR_MO4000: */ |
| 1176 | /* case SENSOR_MI0360: */ | 1389 | /* case SENSOR_MI0360: */ |
| 1390 | /* case SENSOR_OM6802: */ | ||
| 1177 | expotimes = sd->exposure; | 1391 | expotimes = sd->exposure; |
| 1178 | expotimes += (luma_mean - delta) >> 6; | 1392 | expotimes += (luma_mean - delta) >> 6; |
| 1179 | if (expotimes < 0) | 1393 | if (expotimes < 0) |
| @@ -1229,69 +1443,24 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 1229 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); | 1443 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); |
| 1230 | } | 1444 | } |
| 1231 | 1445 | ||
| 1232 | static unsigned int getexposure(struct gspca_dev *gspca_dev) | ||
| 1233 | { | ||
| 1234 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1235 | __u8 hexpo, mexpo, lexpo; | ||
| 1236 | |||
| 1237 | switch (sd->sensor) { | ||
| 1238 | case SENSOR_HV7131R: | ||
| 1239 | /* read sensor exposure */ | ||
| 1240 | i2c_r5(gspca_dev, 0x25); | ||
| 1241 | return (gspca_dev->usb_buf[0] << 16) | ||
| 1242 | | (gspca_dev->usb_buf[1] << 8) | ||
| 1243 | | gspca_dev->usb_buf[2]; | ||
| 1244 | case SENSOR_MI0360: | ||
| 1245 | /* read sensor exposure */ | ||
| 1246 | i2c_r5(gspca_dev, 0x09); | ||
| 1247 | return (gspca_dev->usb_buf[0] << 8) | ||
| 1248 | | gspca_dev->usb_buf[1]; | ||
| 1249 | case SENSOR_MO4000: | ||
| 1250 | i2c_r5(gspca_dev, 0x0e); | ||
| 1251 | hexpo = 0; /* gspca_dev->usb_buf[1] & 0x07; */ | ||
| 1252 | mexpo = 0x40; /* gspca_dev->usb_buf[2] & 0xff; */ | ||
| 1253 | lexpo = (gspca_dev->usb_buf[1] & 0x30) >> 4; | ||
| 1254 | PDEBUG(D_CONF, "exposure %d", | ||
| 1255 | (hexpo << 10) | (mexpo << 2) | lexpo); | ||
| 1256 | return (hexpo << 10) | (mexpo << 2) | lexpo; | ||
| 1257 | default: | ||
| 1258 | /* case SENSOR_OV7648: * jfm: is it ok for 7648? */ | ||
| 1259 | /* case SENSOR_OV7660: */ | ||
| 1260 | /* read sensor exposure */ | ||
| 1261 | i2c_r5(gspca_dev, 0x04); | ||
| 1262 | hexpo = gspca_dev->usb_buf[3] & 0x2f; | ||
| 1263 | lexpo = gspca_dev->usb_buf[0] & 0x02; | ||
| 1264 | i2c_r5(gspca_dev, 0x08); | ||
| 1265 | mexpo = gspca_dev->usb_buf[2]; | ||
| 1266 | return (hexpo << 10) | (mexpo << 2) | lexpo; | ||
| 1267 | } | ||
| 1268 | } | ||
| 1269 | |||
| 1270 | static void getbrightness(struct gspca_dev *gspca_dev) | ||
| 1271 | { | ||
| 1272 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1273 | |||
| 1274 | /* hardcoded registers seem not readable */ | ||
| 1275 | switch (sd->sensor) { | ||
| 1276 | case SENSOR_HV7131R: | ||
| 1277 | sd->brightness = getexposure(gspca_dev) >> 4; | ||
| 1278 | break; | ||
| 1279 | case SENSOR_MI0360: | ||
| 1280 | sd->brightness = getexposure(gspca_dev) << 4; | ||
| 1281 | break; | ||
| 1282 | case SENSOR_MO4000: | ||
| 1283 | sd->brightness = getexposure(gspca_dev) << 4; | ||
| 1284 | break; | ||
| 1285 | } | ||
| 1286 | } | ||
| 1287 | |||
| 1288 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | 1446 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) |
| 1289 | { | 1447 | { |
| 1290 | struct sd *sd = (struct sd *) gspca_dev; | 1448 | struct sd *sd = (struct sd *) gspca_dev; |
| 1291 | 1449 | ||
| 1292 | sd->brightness = val; | 1450 | sd->brightness = val; |
| 1293 | if (gspca_dev->streaming) | 1451 | if (gspca_dev->streaming) { |
| 1294 | setbrightness(gspca_dev); | 1452 | switch (sd->sensor) { |
| 1453 | case SENSOR_HV7131R: | ||
| 1454 | case SENSOR_MI0360: | ||
| 1455 | case SENSOR_MO4000: | ||
| 1456 | case SENSOR_OM6802: | ||
| 1457 | setbrightness(gspca_dev); | ||
| 1458 | break; | ||
| 1459 | default: /* OV76xx */ | ||
| 1460 | setbrightcont(gspca_dev); | ||
| 1461 | break; | ||
| 1462 | } | ||
| 1463 | } | ||
| 1295 | return 0; | 1464 | return 0; |
| 1296 | } | 1465 | } |
| 1297 | 1466 | ||
| @@ -1299,7 +1468,6 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) | |||
| 1299 | { | 1468 | { |
| 1300 | struct sd *sd = (struct sd *) gspca_dev; | 1469 | struct sd *sd = (struct sd *) gspca_dev; |
| 1301 | 1470 | ||
| 1302 | getbrightness(gspca_dev); | ||
| 1303 | *val = sd->brightness; | 1471 | *val = sd->brightness; |
| 1304 | return 0; | 1472 | return 0; |
| 1305 | } | 1473 | } |
| @@ -1309,8 +1477,19 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) | |||
| 1309 | struct sd *sd = (struct sd *) gspca_dev; | 1477 | struct sd *sd = (struct sd *) gspca_dev; |
| 1310 | 1478 | ||
| 1311 | sd->contrast = val; | 1479 | sd->contrast = val; |
| 1312 | if (gspca_dev->streaming) | 1480 | if (gspca_dev->streaming) { |
| 1313 | setcontrast(gspca_dev); | 1481 | switch (sd->sensor) { |
| 1482 | case SENSOR_HV7131R: | ||
| 1483 | case SENSOR_MI0360: | ||
| 1484 | case SENSOR_MO4000: | ||
| 1485 | case SENSOR_OM6802: | ||
| 1486 | setcontrast(gspca_dev); | ||
| 1487 | break; | ||
| 1488 | default: /* OV76xx */ | ||
| 1489 | setbrightcont(gspca_dev); | ||
| 1490 | break; | ||
| 1491 | } | ||
| 1492 | } | ||
| 1314 | return 0; | 1493 | return 0; |
| 1315 | } | 1494 | } |
| 1316 | 1495 | ||
| @@ -1364,11 +1543,9 @@ static const struct sd_desc sd_desc = { | |||
| 1364 | .ctrls = sd_ctrls, | 1543 | .ctrls = sd_ctrls, |
| 1365 | .nctrls = ARRAY_SIZE(sd_ctrls), | 1544 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 1366 | .config = sd_config, | 1545 | .config = sd_config, |
| 1367 | .open = sd_open, | 1546 | .init = sd_init, |
| 1368 | .start = sd_start, | 1547 | .start = sd_start, |
| 1369 | .stopN = sd_stopN, | 1548 | .stopN = sd_stopN, |
| 1370 | .stop0 = sd_stop0, | ||
| 1371 | .close = sd_close, | ||
| 1372 | .pkt_scan = sd_pkt_scan, | 1549 | .pkt_scan = sd_pkt_scan, |
| 1373 | .dq_callback = do_autogain, | 1550 | .dq_callback = do_autogain, |
| 1374 | }; | 1551 | }; |
| @@ -1379,7 +1556,7 @@ static const struct sd_desc sd_desc = { | |||
| 1379 | | (SENSOR_ ## sensor << 8) \ | 1556 | | (SENSOR_ ## sensor << 8) \ |
| 1380 | | (i2c_addr) | 1557 | | (i2c_addr) |
| 1381 | static const __devinitdata struct usb_device_id device_table[] = { | 1558 | static const __devinitdata struct usb_device_id device_table[] = { |
| 1382 | #ifndef CONFIG_USB_SN9C102 | 1559 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
| 1383 | {USB_DEVICE(0x0458, 0x7025), BSI(SN9C120, MI0360, 0x5d)}, | 1560 | {USB_DEVICE(0x0458, 0x7025), BSI(SN9C120, MI0360, 0x5d)}, |
| 1384 | {USB_DEVICE(0x045e, 0x00f5), BSI(SN9C105, OV7660, 0x21)}, | 1561 | {USB_DEVICE(0x045e, 0x00f5), BSI(SN9C105, OV7660, 0x21)}, |
| 1385 | {USB_DEVICE(0x045e, 0x00f7), BSI(SN9C105, OV7660, 0x21)}, | 1562 | {USB_DEVICE(0x045e, 0x00f7), BSI(SN9C105, OV7660, 0x21)}, |
| @@ -1406,15 +1583,17 @@ static const __devinitdata struct usb_device_id device_table[] = { | |||
| 1406 | /* {USB_DEVICE(0x0c45, 0x6108), BSI(SN9C120, OM6801, 0x??)}, */ | 1583 | /* {USB_DEVICE(0x0c45, 0x6108), BSI(SN9C120, OM6801, 0x??)}, */ |
| 1407 | /* {USB_DEVICE(0x0c45, 0x6122), BSI(SN9C110, ICM105C, 0x??)}, */ | 1584 | /* {USB_DEVICE(0x0c45, 0x6122), BSI(SN9C110, ICM105C, 0x??)}, */ |
| 1408 | /* {USB_DEVICE(0x0c45, 0x6123), BSI(SN9C110, SanyoCCD, 0x??)}, */ | 1585 | /* {USB_DEVICE(0x0c45, 0x6123), BSI(SN9C110, SanyoCCD, 0x??)}, */ |
| 1409 | {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C325, OV7648, 0x21)}, | 1586 | {USB_DEVICE(0x0c45, 0x6128), BSI(SN9C110, OM6802, 0x21)}, /*sn9c325?*/ |
| 1410 | /* bw600.inf: | 1587 | /*bw600.inf:*/ |
| 1411 | {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C110, OV7648, 0x21)}, */ | 1588 | {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C110, OV7648, 0x21)}, /*sn9c325?*/ |
| 1412 | {USB_DEVICE(0x0c45, 0x612c), BSI(SN9C110, MO4000, 0x21)}, | 1589 | {USB_DEVICE(0x0c45, 0x612c), BSI(SN9C110, MO4000, 0x21)}, |
| 1413 | /* {USB_DEVICE(0x0c45, 0x612e), BSI(SN9C110, OV7630, 0x??)}, */ | 1590 | {USB_DEVICE(0x0c45, 0x612e), BSI(SN9C110, OV7630, 0x21)}, |
| 1414 | /* {USB_DEVICE(0x0c45, 0x612f), BSI(SN9C110, ICM105C, 0x??)}, */ | 1591 | /* {USB_DEVICE(0x0c45, 0x612f), BSI(SN9C110, ICM105C, 0x??)}, */ |
| 1415 | #ifndef CONFIG_USB_SN9C102 | 1592 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
| 1416 | {USB_DEVICE(0x0c45, 0x6130), BSI(SN9C120, MI0360, 0x5d)}, | 1593 | {USB_DEVICE(0x0c45, 0x6130), BSI(SN9C120, MI0360, 0x5d)}, |
| 1594 | #endif | ||
| 1417 | {USB_DEVICE(0x0c45, 0x6138), BSI(SN9C120, MO4000, 0x21)}, | 1595 | {USB_DEVICE(0x0c45, 0x6138), BSI(SN9C120, MO4000, 0x21)}, |
| 1596 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | ||
| 1418 | /* {USB_DEVICE(0x0c45, 0x613a), BSI(SN9C120, OV7648, 0x??)}, */ | 1597 | /* {USB_DEVICE(0x0c45, 0x613a), BSI(SN9C120, OV7648, 0x??)}, */ |
| 1419 | {USB_DEVICE(0x0c45, 0x613b), BSI(SN9C120, OV7660, 0x21)}, | 1598 | {USB_DEVICE(0x0c45, 0x613b), BSI(SN9C120, OV7660, 0x21)}, |
| 1420 | {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)}, | 1599 | {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)}, |
| @@ -1438,6 +1617,10 @@ static struct usb_driver sd_driver = { | |||
| 1438 | .id_table = device_table, | 1617 | .id_table = device_table, |
| 1439 | .probe = sd_probe, | 1618 | .probe = sd_probe, |
| 1440 | .disconnect = gspca_disconnect, | 1619 | .disconnect = gspca_disconnect, |
| 1620 | #ifdef CONFIG_PM | ||
| 1621 | .suspend = gspca_suspend, | ||
| 1622 | .resume = gspca_resume, | ||
| 1623 | #endif | ||
| 1441 | }; | 1624 | }; |
| 1442 | 1625 | ||
| 1443 | /* -- module insert / remove -- */ | 1626 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c index 17fe2c2a440d..6e733901fcca 100644 --- a/drivers/media/video/gspca/spca500.c +++ b/drivers/media/video/gspca/spca500.c | |||
| @@ -645,8 +645,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 645 | return 0; | 645 | return 0; |
| 646 | } | 646 | } |
| 647 | 647 | ||
| 648 | /* this function is called at open time */ | 648 | /* this function is called at probe and resume time */ |
| 649 | static int sd_open(struct gspca_dev *gspca_dev) | 649 | static int sd_init(struct gspca_dev *gspca_dev) |
| 650 | { | 650 | { |
| 651 | struct sd *sd = (struct sd *) gspca_dev; | 651 | struct sd *sd = (struct sd *) gspca_dev; |
| 652 | 652 | ||
| @@ -880,14 +880,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 880 | gspca_dev->usb_buf[0]); | 880 | gspca_dev->usb_buf[0]); |
| 881 | } | 881 | } |
| 882 | 882 | ||
| 883 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 884 | { | ||
| 885 | } | ||
| 886 | |||
| 887 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 888 | { | ||
| 889 | } | ||
| 890 | |||
| 891 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 883 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 892 | struct gspca_frame *frame, /* target */ | 884 | struct gspca_frame *frame, /* target */ |
| 893 | __u8 *data, /* isoc packet */ | 885 | __u8 *data, /* isoc packet */ |
| @@ -1051,11 +1043,9 @@ static struct sd_desc sd_desc = { | |||
| 1051 | .ctrls = sd_ctrls, | 1043 | .ctrls = sd_ctrls, |
| 1052 | .nctrls = ARRAY_SIZE(sd_ctrls), | 1044 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 1053 | .config = sd_config, | 1045 | .config = sd_config, |
| 1054 | .open = sd_open, | 1046 | .init = sd_init, |
| 1055 | .start = sd_start, | 1047 | .start = sd_start, |
| 1056 | .stopN = sd_stopN, | 1048 | .stopN = sd_stopN, |
| 1057 | .stop0 = sd_stop0, | ||
| 1058 | .close = sd_close, | ||
| 1059 | .pkt_scan = sd_pkt_scan, | 1049 | .pkt_scan = sd_pkt_scan, |
| 1060 | }; | 1050 | }; |
| 1061 | 1051 | ||
| @@ -1093,6 +1083,10 @@ static struct usb_driver sd_driver = { | |||
| 1093 | .id_table = device_table, | 1083 | .id_table = device_table, |
| 1094 | .probe = sd_probe, | 1084 | .probe = sd_probe, |
| 1095 | .disconnect = gspca_disconnect, | 1085 | .disconnect = gspca_disconnect, |
| 1086 | #ifdef CONFIG_PM | ||
| 1087 | .suspend = gspca_suspend, | ||
| 1088 | .resume = gspca_resume, | ||
| 1089 | #endif | ||
| 1096 | }; | 1090 | }; |
| 1097 | 1091 | ||
| 1098 | /* -- module insert / remove -- */ | 1092 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c index 51a3c3429ef0..e9eb59bae4fb 100644 --- a/drivers/media/video/gspca/spca501.c +++ b/drivers/media/video/gspca/spca501.c | |||
| @@ -1953,8 +1953,8 @@ error: | |||
| 1953 | return -EINVAL; | 1953 | return -EINVAL; |
| 1954 | } | 1954 | } |
| 1955 | 1955 | ||
| 1956 | /* this function is called at open time */ | 1956 | /* this function is called at probe and resume time */ |
| 1957 | static int sd_open(struct gspca_dev *gspca_dev) | 1957 | static int sd_init(struct gspca_dev *gspca_dev) |
| 1958 | { | 1958 | { |
| 1959 | struct sd *sd = (struct sd *) gspca_dev; | 1959 | struct sd *sd = (struct sd *) gspca_dev; |
| 1960 | 1960 | ||
| @@ -2023,11 +2023,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 2023 | 2023 | ||
| 2024 | static void sd_stop0(struct gspca_dev *gspca_dev) | 2024 | static void sd_stop0(struct gspca_dev *gspca_dev) |
| 2025 | { | 2025 | { |
| 2026 | } | ||
| 2027 | |||
| 2028 | /* this function is called at close time */ | ||
| 2029 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 2030 | { | ||
| 2031 | reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x05, 0x00); | 2026 | reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x05, 0x00); |
| 2032 | } | 2027 | } |
| 2033 | 2028 | ||
| @@ -2120,11 +2115,10 @@ static const struct sd_desc sd_desc = { | |||
| 2120 | .ctrls = sd_ctrls, | 2115 | .ctrls = sd_ctrls, |
| 2121 | .nctrls = ARRAY_SIZE(sd_ctrls), | 2116 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 2122 | .config = sd_config, | 2117 | .config = sd_config, |
| 2123 | .open = sd_open, | 2118 | .init = sd_init, |
| 2124 | .start = sd_start, | 2119 | .start = sd_start, |
| 2125 | .stopN = sd_stopN, | 2120 | .stopN = sd_stopN, |
| 2126 | .stop0 = sd_stop0, | 2121 | .stop0 = sd_stop0, |
| 2127 | .close = sd_close, | ||
| 2128 | .pkt_scan = sd_pkt_scan, | 2122 | .pkt_scan = sd_pkt_scan, |
| 2129 | }; | 2123 | }; |
| 2130 | 2124 | ||
| @@ -2154,6 +2148,10 @@ static struct usb_driver sd_driver = { | |||
| 2154 | .id_table = device_table, | 2148 | .id_table = device_table, |
| 2155 | .probe = sd_probe, | 2149 | .probe = sd_probe, |
| 2156 | .disconnect = gspca_disconnect, | 2150 | .disconnect = gspca_disconnect, |
| 2151 | #ifdef CONFIG_PM | ||
| 2152 | .suspend = gspca_suspend, | ||
| 2153 | .resume = gspca_resume, | ||
| 2154 | #endif | ||
| 2157 | }; | 2155 | }; |
| 2158 | 2156 | ||
| 2159 | /* -- module insert / remove -- */ | 2157 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c index eda29d609359..f601daf19ebe 100644 --- a/drivers/media/video/gspca/spca505.c +++ b/drivers/media/video/gspca/spca505.c | |||
| @@ -655,8 +655,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 655 | return 0; | 655 | return 0; |
| 656 | } | 656 | } |
| 657 | 657 | ||
| 658 | /* this function is called at open time */ | 658 | /* this function is called at probe and resume time */ |
| 659 | static int sd_open(struct gspca_dev *gspca_dev) | 659 | static int sd_init(struct gspca_dev *gspca_dev) |
| 660 | { | 660 | { |
| 661 | struct sd *sd = (struct sd *) gspca_dev; | 661 | struct sd *sd = (struct sd *) gspca_dev; |
| 662 | int ret; | 662 | int ret; |
| @@ -743,11 +743,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 743 | 743 | ||
| 744 | static void sd_stop0(struct gspca_dev *gspca_dev) | 744 | static void sd_stop0(struct gspca_dev *gspca_dev) |
| 745 | { | 745 | { |
| 746 | } | ||
| 747 | |||
| 748 | /* this function is called at close time */ | ||
| 749 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 750 | { | ||
| 751 | /* This maybe reset or power control */ | 746 | /* This maybe reset or power control */ |
| 752 | reg_write(gspca_dev->dev, 0x03, 0x03, 0x20); | 747 | reg_write(gspca_dev->dev, 0x03, 0x03, 0x20); |
| 753 | reg_write(gspca_dev->dev, 0x03, 0x01, 0x0); | 748 | reg_write(gspca_dev->dev, 0x03, 0x01, 0x0); |
| @@ -825,11 +820,10 @@ static const struct sd_desc sd_desc = { | |||
| 825 | .ctrls = sd_ctrls, | 820 | .ctrls = sd_ctrls, |
| 826 | .nctrls = ARRAY_SIZE(sd_ctrls), | 821 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 827 | .config = sd_config, | 822 | .config = sd_config, |
| 828 | .open = sd_open, | 823 | .init = sd_init, |
| 829 | .start = sd_start, | 824 | .start = sd_start, |
| 830 | .stopN = sd_stopN, | 825 | .stopN = sd_stopN, |
| 831 | .stop0 = sd_stop0, | 826 | .stop0 = sd_stop0, |
| 832 | .close = sd_close, | ||
| 833 | .pkt_scan = sd_pkt_scan, | 827 | .pkt_scan = sd_pkt_scan, |
| 834 | }; | 828 | }; |
| 835 | 829 | ||
| @@ -855,6 +849,10 @@ static struct usb_driver sd_driver = { | |||
| 855 | .id_table = device_table, | 849 | .id_table = device_table, |
| 856 | .probe = sd_probe, | 850 | .probe = sd_probe, |
| 857 | .disconnect = gspca_disconnect, | 851 | .disconnect = gspca_disconnect, |
| 852 | #ifdef CONFIG_PM | ||
| 853 | .suspend = gspca_suspend, | ||
| 854 | .resume = gspca_resume, | ||
| 855 | #endif | ||
| 858 | }; | 856 | }; |
| 859 | 857 | ||
| 860 | /* -- module insert / remove -- */ | 858 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c index f622fa75766d..195dce96ef06 100644 --- a/drivers/media/video/gspca/spca506.c +++ b/drivers/media/video/gspca/spca506.c | |||
| @@ -313,8 +313,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 313 | return 0; | 313 | return 0; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | /* this function is called at open time */ | 316 | /* this function is called at probe and resume time */ |
| 317 | static int sd_open(struct gspca_dev *gspca_dev) | 317 | static int sd_init(struct gspca_dev *gspca_dev) |
| 318 | { | 318 | { |
| 319 | struct usb_device *dev = gspca_dev->dev; | 319 | struct usb_device *dev = gspca_dev->dev; |
| 320 | 320 | ||
| @@ -560,14 +560,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 560 | reg_w(dev, 0x03, 0x00, 0x0003); | 560 | reg_w(dev, 0x03, 0x00, 0x0003); |
| 561 | } | 561 | } |
| 562 | 562 | ||
| 563 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 564 | { | ||
| 565 | } | ||
| 566 | |||
| 567 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 568 | { | ||
| 569 | } | ||
| 570 | |||
| 571 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 563 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 572 | struct gspca_frame *frame, /* target */ | 564 | struct gspca_frame *frame, /* target */ |
| 573 | __u8 *data, /* isoc packet */ | 565 | __u8 *data, /* isoc packet */ |
| @@ -740,11 +732,9 @@ static struct sd_desc sd_desc = { | |||
| 740 | .ctrls = sd_ctrls, | 732 | .ctrls = sd_ctrls, |
| 741 | .nctrls = ARRAY_SIZE(sd_ctrls), | 733 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 742 | .config = sd_config, | 734 | .config = sd_config, |
| 743 | .open = sd_open, | 735 | .init = sd_init, |
| 744 | .start = sd_start, | 736 | .start = sd_start, |
| 745 | .stopN = sd_stopN, | 737 | .stopN = sd_stopN, |
| 746 | .stop0 = sd_stop0, | ||
| 747 | .close = sd_close, | ||
| 748 | .pkt_scan = sd_pkt_scan, | 738 | .pkt_scan = sd_pkt_scan, |
| 749 | }; | 739 | }; |
| 750 | 740 | ||
| @@ -772,6 +762,10 @@ static struct usb_driver sd_driver = { | |||
| 772 | .id_table = device_table, | 762 | .id_table = device_table, |
| 773 | .probe = sd_probe, | 763 | .probe = sd_probe, |
| 774 | .disconnect = gspca_disconnect, | 764 | .disconnect = gspca_disconnect, |
| 765 | #ifdef CONFIG_PM | ||
| 766 | .suspend = gspca_suspend, | ||
| 767 | .resume = gspca_resume, | ||
| 768 | #endif | ||
| 775 | }; | 769 | }; |
| 776 | 770 | ||
| 777 | /* -- module insert / remove -- */ | 771 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c index 699340c17dea..281ce02103a3 100644 --- a/drivers/media/video/gspca/spca508.c +++ b/drivers/media/video/gspca/spca508.c | |||
| @@ -1521,8 +1521,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 1521 | return 0; /* success */ | 1521 | return 0; /* success */ |
| 1522 | } | 1522 | } |
| 1523 | 1523 | ||
| 1524 | /* this function is called at open time */ | 1524 | /* this function is called at probe and resume time */ |
| 1525 | static int sd_open(struct gspca_dev *gspca_dev) | 1525 | static int sd_init(struct gspca_dev *gspca_dev) |
| 1526 | { | 1526 | { |
| 1527 | /* write_vector(gspca_dev, spca508_open_data); */ | 1527 | /* write_vector(gspca_dev, spca508_open_data); */ |
| 1528 | return 0; | 1528 | return 0; |
| @@ -1554,15 +1554,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 1554 | reg_write(gspca_dev->dev, 0x8112, 0x20); | 1554 | reg_write(gspca_dev->dev, 0x8112, 0x20); |
| 1555 | } | 1555 | } |
| 1556 | 1556 | ||
| 1557 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 1558 | { | ||
| 1559 | } | ||
| 1560 | |||
| 1561 | /* this function is called at close time */ | ||
| 1562 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 1563 | { | ||
| 1564 | } | ||
| 1565 | |||
| 1566 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 1557 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 1567 | struct gspca_frame *frame, /* target */ | 1558 | struct gspca_frame *frame, /* target */ |
| 1568 | __u8 *data, /* isoc packet */ | 1559 | __u8 *data, /* isoc packet */ |
| @@ -1633,11 +1624,9 @@ static const struct sd_desc sd_desc = { | |||
| 1633 | .ctrls = sd_ctrls, | 1624 | .ctrls = sd_ctrls, |
| 1634 | .nctrls = ARRAY_SIZE(sd_ctrls), | 1625 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 1635 | .config = sd_config, | 1626 | .config = sd_config, |
| 1636 | .open = sd_open, | 1627 | .init = sd_init, |
| 1637 | .start = sd_start, | 1628 | .start = sd_start, |
| 1638 | .stopN = sd_stopN, | 1629 | .stopN = sd_stopN, |
| 1639 | .stop0 = sd_stop0, | ||
| 1640 | .close = sd_close, | ||
| 1641 | .pkt_scan = sd_pkt_scan, | 1630 | .pkt_scan = sd_pkt_scan, |
| 1642 | }; | 1631 | }; |
| 1643 | 1632 | ||
| @@ -1667,6 +1656,10 @@ static struct usb_driver sd_driver = { | |||
| 1667 | .id_table = device_table, | 1656 | .id_table = device_table, |
| 1668 | .probe = sd_probe, | 1657 | .probe = sd_probe, |
| 1669 | .disconnect = gspca_disconnect, | 1658 | .disconnect = gspca_disconnect, |
| 1659 | #ifdef CONFIG_PM | ||
| 1660 | .suspend = gspca_suspend, | ||
| 1661 | .resume = gspca_resume, | ||
| 1662 | #endif | ||
| 1670 | }; | 1663 | }; |
| 1671 | 1664 | ||
| 1672 | /* -- module insert / remove -- */ | 1665 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index 1073ac3d2ec6..cfbc9ebc5c5d 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c | |||
| @@ -32,69 +32,48 @@ MODULE_LICENSE("GPL"); | |||
| 32 | struct sd { | 32 | struct sd { |
| 33 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 33 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
| 34 | 34 | ||
| 35 | unsigned short contrast; | 35 | __u16 contrast; /* rev72a only */ |
| 36 | __u8 brightness; | 36 | #define CONTRAST_MIN 0x0000 |
| 37 | #define CONTRAST_DEF 0x2000 | ||
| 38 | #define CONTRAST_MAX 0x3fff | ||
| 39 | |||
| 40 | __u16 exposure; /* rev12a only */ | ||
| 41 | #define EXPOSURE_MIN 1 | ||
| 42 | #define EXPOSURE_DEF 200 | ||
| 43 | #define EXPOSURE_MAX (4095 - 900) /* see set_exposure */ | ||
| 44 | |||
| 45 | __u8 brightness; /* rev72a only */ | ||
| 46 | #define BRIGHTNESS_MIN 0 | ||
| 47 | #define BRIGHTNESS_DEF 32 | ||
| 48 | #define BRIGHTNESS_MAX 63 | ||
| 49 | |||
| 50 | __u8 white; /* rev12a only */ | ||
| 51 | #define WHITE_MIN 1 | ||
| 52 | #define WHITE_DEF 0x40 | ||
| 53 | #define WHITE_MAX 0x7f | ||
| 54 | |||
| 37 | __u8 autogain; | 55 | __u8 autogain; |
| 56 | #define AUTOGAIN_MIN 0 | ||
| 57 | #define AUTOGAIN_DEF 1 | ||
| 58 | #define AUTOGAIN_MAX 1 | ||
| 59 | |||
| 60 | __u8 gain; /* rev12a only */ | ||
| 61 | #define GAIN_MIN 0x0 | ||
| 62 | #define GAIN_DEF 0x24 | ||
| 63 | #define GAIN_MAX 0x24 | ||
| 64 | |||
| 65 | #define EXPO12A_DEF 3 | ||
| 66 | __u8 expo12a; /* expo/gain? for rev 12a */ | ||
| 38 | 67 | ||
| 39 | __u8 chip_revision; | 68 | __u8 chip_revision; |
| 69 | #define Rev012A 0 | ||
| 70 | #define Rev072A 1 | ||
| 71 | |||
| 40 | signed char ag_cnt; | 72 | signed char ag_cnt; |
| 41 | #define AG_CNT_START 13 | 73 | #define AG_CNT_START 13 |
| 42 | }; | 74 | }; |
| 43 | 75 | ||
| 44 | /* V4L2 controls supported by the driver */ | 76 | static struct v4l2_pix_format sif_012a_mode[] = { |
| 45 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); | ||
| 46 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); | ||
| 47 | static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); | ||
| 48 | static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); | ||
| 49 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); | ||
| 50 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); | ||
| 51 | |||
| 52 | static struct ctrl sd_ctrls[] = { | ||
| 53 | #define SD_BRIGHTNESS 0 | ||
| 54 | { | ||
| 55 | { | ||
| 56 | .id = V4L2_CID_BRIGHTNESS, | ||
| 57 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 58 | .name = "Brightness", | ||
| 59 | .minimum = 0, | ||
| 60 | .maximum = 63, | ||
| 61 | .step = 1, | ||
| 62 | .default_value = 32, | ||
| 63 | }, | ||
| 64 | .set = sd_setbrightness, | ||
| 65 | .get = sd_getbrightness, | ||
| 66 | }, | ||
| 67 | #define SD_CONTRAST 1 | ||
| 68 | { | ||
| 69 | { | ||
| 70 | .id = V4L2_CID_CONTRAST, | ||
| 71 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 72 | .name = "Contrast", | ||
| 73 | .minimum = 0, | ||
| 74 | .maximum = 0x3fff, | ||
| 75 | .step = 1, | ||
| 76 | .default_value = 0x2000, | ||
| 77 | }, | ||
| 78 | .set = sd_setcontrast, | ||
| 79 | .get = sd_getcontrast, | ||
| 80 | }, | ||
| 81 | #define SD_AUTOGAIN 2 | ||
| 82 | { | ||
| 83 | { | ||
| 84 | .id = V4L2_CID_AUTOGAIN, | ||
| 85 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
| 86 | .name = "Auto Gain", | ||
| 87 | .minimum = 0, | ||
| 88 | .maximum = 1, | ||
| 89 | .step = 1, | ||
| 90 | .default_value = 1, | ||
| 91 | }, | ||
| 92 | .set = sd_setautogain, | ||
| 93 | .get = sd_getautogain, | ||
| 94 | }, | ||
| 95 | }; | ||
| 96 | |||
| 97 | static struct v4l2_pix_format sif_mode[] = { | ||
| 98 | {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, | 77 | {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, |
| 99 | .bytesperline = 160, | 78 | .bytesperline = 160, |
| 100 | .sizeimage = 160 * 120, | 79 | .sizeimage = 160 * 120, |
| @@ -117,6 +96,29 @@ static struct v4l2_pix_format sif_mode[] = { | |||
| 117 | .priv = 0}, | 96 | .priv = 0}, |
| 118 | }; | 97 | }; |
| 119 | 98 | ||
| 99 | static struct v4l2_pix_format sif_072a_mode[] = { | ||
| 100 | {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, | ||
| 101 | .bytesperline = 160, | ||
| 102 | .sizeimage = 160 * 120, | ||
| 103 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 104 | .priv = 3}, | ||
| 105 | {176, 144, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, | ||
| 106 | .bytesperline = 176, | ||
| 107 | .sizeimage = 176 * 144, | ||
| 108 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 109 | .priv = 2}, | ||
| 110 | {320, 240, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, | ||
| 111 | .bytesperline = 320, | ||
| 112 | .sizeimage = 320 * 240, | ||
| 113 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 114 | .priv = 1}, | ||
| 115 | {352, 288, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE, | ||
| 116 | .bytesperline = 352, | ||
| 117 | .sizeimage = 352 * 288, | ||
| 118 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
| 119 | .priv = 0}, | ||
| 120 | }; | ||
| 121 | |||
| 120 | /* | 122 | /* |
| 121 | * Initialization data | 123 | * Initialization data |
| 122 | * I'm not very sure how to split initialization from open data | 124 | * I'm not very sure how to split initialization from open data |
| @@ -143,12 +145,8 @@ static struct v4l2_pix_format sif_mode[] = { | |||
| 143 | #define SPCA561_INDEX_I2C_BASE 0x8800 | 145 | #define SPCA561_INDEX_I2C_BASE 0x8800 |
| 144 | #define SPCA561_SNAPBIT 0x20 | 146 | #define SPCA561_SNAPBIT 0x20 |
| 145 | #define SPCA561_SNAPCTRL 0x40 | 147 | #define SPCA561_SNAPCTRL 0x40 |
| 146 | enum { | ||
| 147 | Rev072A = 0, | ||
| 148 | Rev012A, | ||
| 149 | }; | ||
| 150 | 148 | ||
| 151 | static void reg_w_val(struct usb_device *dev, __u16 index, __u16 value) | 149 | static void reg_w_val(struct usb_device *dev, __u16 index, __u8 value) |
| 152 | { | 150 | { |
| 153 | int ret; | 151 | int ret; |
| 154 | 152 | ||
| @@ -198,12 +196,6 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, | |||
| 198 | index, gspca_dev->usb_buf, len, 500); | 196 | index, gspca_dev->usb_buf, len, 500); |
| 199 | } | 197 | } |
| 200 | 198 | ||
| 201 | static void i2c_init(struct gspca_dev *gspca_dev, __u8 mode) | ||
| 202 | { | ||
| 203 | reg_w_val(gspca_dev->dev, 0x92, 0x8804); | ||
| 204 | reg_w_val(gspca_dev->dev, mode, 0x8802); | ||
| 205 | } | ||
| 206 | |||
| 207 | static void i2c_write(struct gspca_dev *gspca_dev, __u16 valeur, __u16 reg) | 199 | static void i2c_write(struct gspca_dev *gspca_dev, __u16 valeur, __u16 reg) |
| 208 | { | 200 | { |
| 209 | int retry = 60; | 201 | int retry = 60; |
| @@ -212,9 +204,9 @@ static void i2c_write(struct gspca_dev *gspca_dev, __u16 valeur, __u16 reg) | |||
| 212 | 204 | ||
| 213 | DataLow = valeur; | 205 | DataLow = valeur; |
| 214 | DataHight = valeur >> 8; | 206 | DataHight = valeur >> 8; |
| 215 | reg_w_val(gspca_dev->dev, reg, 0x8801); | 207 | reg_w_val(gspca_dev->dev, 0x8801, reg); |
| 216 | reg_w_val(gspca_dev->dev, DataLow, 0x8805); | 208 | reg_w_val(gspca_dev->dev, 0x8805, DataLow); |
| 217 | reg_w_val(gspca_dev->dev, DataHight, 0x8800); | 209 | reg_w_val(gspca_dev->dev, 0x8800, DataHight); |
| 218 | while (retry--) { | 210 | while (retry--) { |
| 219 | reg_r(gspca_dev, 0x8803, 1); | 211 | reg_r(gspca_dev, 0x8803, 1); |
| 220 | if (!gspca_dev->usb_buf[0]) | 212 | if (!gspca_dev->usb_buf[0]) |
| @@ -228,14 +220,14 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode) | |||
| 228 | __u8 value; | 220 | __u8 value; |
| 229 | __u8 vallsb; | 221 | __u8 vallsb; |
| 230 | 222 | ||
| 231 | reg_w_val(gspca_dev->dev, 0x92, 0x8804); | 223 | reg_w_val(gspca_dev->dev, 0x8804, 0x92); |
| 232 | reg_w_val(gspca_dev->dev, reg, 0x8801); | 224 | reg_w_val(gspca_dev->dev, 0x8801, reg); |
| 233 | reg_w_val(gspca_dev->dev, (mode | 0x01), 0x8802); | 225 | reg_w_val(gspca_dev->dev, 0x8802, (mode | 0x01)); |
| 234 | while (retry--) { | 226 | do { |
| 235 | reg_r(gspca_dev, 0x8803, 1); | 227 | reg_r(gspca_dev, 0x8803, 1); |
| 236 | if (!gspca_dev->usb_buf) | 228 | if (!gspca_dev->usb_buf) |
| 237 | break; | 229 | break; |
| 238 | } | 230 | } while (--retry); |
| 239 | if (retry == 0) | 231 | if (retry == 0) |
| 240 | return -1; | 232 | return -1; |
| 241 | reg_r(gspca_dev, 0x8800, 1); | 233 | reg_r(gspca_dev, 0x8800, 1); |
| @@ -438,21 +430,10 @@ static const __u16 spca561_init_data[][2] = { | |||
| 438 | {0x0035, 0x8801}, /* 0x14 - set gain general */ | 430 | {0x0035, 0x8801}, /* 0x14 - set gain general */ |
| 439 | {0x001f, 0x8805}, /* 0x14 */ | 431 | {0x001f, 0x8805}, /* 0x14 */ |
| 440 | {0x0000, 0x8800}, | 432 | {0x0000, 0x8800}, |
| 441 | {0x0030, 0x8112}, | 433 | {0x000e, 0x8112}, /* white balance - was 30 */ |
| 442 | {} | 434 | {} |
| 443 | }; | 435 | }; |
| 444 | 436 | ||
| 445 | static void sensor_reset(struct gspca_dev *gspca_dev) | ||
| 446 | { | ||
| 447 | reg_w_val(gspca_dev->dev, 0x8631, 0xc8); | ||
| 448 | reg_w_val(gspca_dev->dev, 0x8634, 0xc8); | ||
| 449 | reg_w_val(gspca_dev->dev, 0x8112, 0x00); | ||
| 450 | reg_w_val(gspca_dev->dev, 0x8114, 0x00); | ||
| 451 | reg_w_val(gspca_dev->dev, 0x8118, 0x21); | ||
| 452 | i2c_init(gspca_dev, 0x14); | ||
| 453 | i2c_write(gspca_dev, 1, 0x0d); | ||
| 454 | i2c_write(gspca_dev, 0, 0x0d); | ||
| 455 | } | ||
| 456 | 437 | ||
| 457 | /******************** QC Express etch2 stuff ********************/ | 438 | /******************** QC Express etch2 stuff ********************/ |
| 458 | static const __u16 Pb100_1map8300[][2] = { | 439 | static const __u16 Pb100_1map8300[][2] = { |
| @@ -462,9 +443,9 @@ static const __u16 Pb100_1map8300[][2] = { | |||
| 462 | {0x8303, 0x0125}, /* image area */ | 443 | {0x8303, 0x0125}, /* image area */ |
| 463 | {0x8304, 0x0169}, | 444 | {0x8304, 0x0169}, |
| 464 | {0x8328, 0x000b}, | 445 | {0x8328, 0x000b}, |
| 465 | {0x833c, 0x0001}, | 446 | {0x833c, 0x0001}, /*fixme: win:07*/ |
| 466 | 447 | ||
| 467 | {0x832f, 0x0419}, | 448 | {0x832f, 0x1904}, /*fixme: was 0419*/ |
| 468 | {0x8307, 0x00aa}, | 449 | {0x8307, 0x00aa}, |
| 469 | {0x8301, 0x0003}, | 450 | {0x8301, 0x0003}, |
| 470 | {0x8302, 0x000e}, | 451 | {0x8302, 0x000e}, |
| @@ -478,9 +459,10 @@ static const __u16 Pb100_2map8300[][2] = { | |||
| 478 | }; | 459 | }; |
| 479 | 460 | ||
| 480 | static const __u16 spca561_161rev12A_data1[][2] = { | 461 | static const __u16 spca561_161rev12A_data1[][2] = { |
| 481 | {0x21, 0x8118}, | 462 | {0x29, 0x8118}, /* white balance - was 21 */ |
| 482 | {0x01, 0x8114}, | 463 | {0x08, 0x8114}, /* white balance - was 01 */ |
| 483 | {0x00, 0x8112}, | 464 | {0x0e, 0x8112}, /* white balance - was 00 */ |
| 465 | {0x00, 0x8102}, /* white balance - new */ | ||
| 484 | {0x92, 0x8804}, | 466 | {0x92, 0x8804}, |
| 485 | {0x04, 0x8802}, /* windows uses 08 */ | 467 | {0x04, 0x8802}, /* windows uses 08 */ |
| 486 | {} | 468 | {} |
| @@ -505,14 +487,16 @@ static const __u16 spca561_161rev12A_data2[][2] = { | |||
| 505 | {0xb0, 0x8603}, | 487 | {0xb0, 0x8603}, |
| 506 | 488 | ||
| 507 | /* sensor gains */ | 489 | /* sensor gains */ |
| 490 | {0x07, 0x8601}, /* white balance - new */ | ||
| 491 | {0x07, 0x8602}, /* white balance - new */ | ||
| 508 | {0x00, 0x8610}, /* *red */ | 492 | {0x00, 0x8610}, /* *red */ |
| 509 | {0x00, 0x8611}, /* 3f *green */ | 493 | {0x00, 0x8611}, /* 3f *green */ |
| 510 | {0x00, 0x8612}, /* green *blue */ | 494 | {0x00, 0x8612}, /* green *blue */ |
| 511 | {0x00, 0x8613}, /* blue *green */ | 495 | {0x00, 0x8613}, /* blue *green */ |
| 512 | {0x35, 0x8614}, /* green *red */ | 496 | {0x43, 0x8614}, /* green *red - white balance - was 0x35 */ |
| 513 | {0x35, 0x8615}, /* 40 *green */ | 497 | {0x40, 0x8615}, /* 40 *green - white balance - was 0x35 */ |
| 514 | {0x35, 0x8616}, /* 7a *blue */ | 498 | {0x71, 0x8616}, /* 7a *blue - white balance - was 0x35 */ |
| 515 | {0x35, 0x8617}, /* 40 *green */ | 499 | {0x40, 0x8617}, /* 40 *green - white balance - was 0x35 */ |
| 516 | 500 | ||
| 517 | {0x0c, 0x8620}, /* 0c */ | 501 | {0x0c, 0x8620}, /* 0c */ |
| 518 | {0xc8, 0x8631}, /* c8 */ | 502 | {0xc8, 0x8631}, /* c8 */ |
| @@ -527,6 +511,7 @@ static const __u16 spca561_161rev12A_data2[][2] = { | |||
| 527 | {0xdf, 0x863c}, /* df */ | 511 | {0xdf, 0x863c}, /* df */ |
| 528 | {0xf0, 0x8505}, | 512 | {0xf0, 0x8505}, |
| 529 | {0x32, 0x850a}, | 513 | {0x32, 0x850a}, |
| 514 | /* {0x99, 0x8700}, * - white balance - new (removed) */ | ||
| 530 | {} | 515 | {} |
| 531 | }; | 516 | }; |
| 532 | 517 | ||
| @@ -545,9 +530,10 @@ static void sensor_mapwrite(struct gspca_dev *gspca_dev, | |||
| 545 | } | 530 | } |
| 546 | static void init_161rev12A(struct gspca_dev *gspca_dev) | 531 | static void init_161rev12A(struct gspca_dev *gspca_dev) |
| 547 | { | 532 | { |
| 548 | sensor_reset(gspca_dev); | 533 | /* sensor_reset(gspca_dev); (not in win) */ |
| 549 | write_vector(gspca_dev, spca561_161rev12A_data1); | 534 | write_vector(gspca_dev, spca561_161rev12A_data1); |
| 550 | sensor_mapwrite(gspca_dev, Pb100_1map8300); | 535 | sensor_mapwrite(gspca_dev, Pb100_1map8300); |
| 536 | /*fixme: should be in sd_start*/ | ||
| 551 | write_vector(gspca_dev, spca561_161rev12A_data2); | 537 | write_vector(gspca_dev, spca561_161rev12A_data2); |
| 552 | sensor_mapwrite(gspca_dev, Pb100_2map8300); | 538 | sensor_mapwrite(gspca_dev, Pb100_2map8300); |
| 553 | } | 539 | } |
| @@ -581,35 +567,38 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 581 | } | 567 | } |
| 582 | 568 | ||
| 583 | cam = &gspca_dev->cam; | 569 | cam = &gspca_dev->cam; |
| 584 | cam->dev_name = (char *) id->driver_info; | ||
| 585 | cam->epaddr = 0x01; | 570 | cam->epaddr = 0x01; |
| 586 | gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */ | 571 | gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */ |
| 587 | cam->cam_mode = sif_mode; | ||
| 588 | cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; | ||
| 589 | 572 | ||
| 590 | sd->chip_revision = id->driver_info; | 573 | sd->chip_revision = id->driver_info; |
| 591 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; | 574 | if (sd->chip_revision == Rev012A) { |
| 592 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; | 575 | cam->cam_mode = sif_012a_mode; |
| 593 | sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; | 576 | cam->nmodes = ARRAY_SIZE(sif_012a_mode); |
| 577 | } else { | ||
| 578 | cam->cam_mode = sif_072a_mode; | ||
| 579 | cam->nmodes = ARRAY_SIZE(sif_072a_mode); | ||
| 580 | } | ||
| 581 | sd->brightness = BRIGHTNESS_DEF; | ||
| 582 | sd->contrast = CONTRAST_DEF; | ||
| 583 | sd->white = WHITE_DEF; | ||
| 584 | sd->exposure = EXPOSURE_DEF; | ||
| 585 | sd->autogain = AUTOGAIN_DEF; | ||
| 586 | sd->gain = GAIN_DEF; | ||
| 587 | sd->expo12a = EXPO12A_DEF; | ||
| 594 | return 0; | 588 | return 0; |
| 595 | } | 589 | } |
| 596 | 590 | ||
| 597 | /* this function is called at open time */ | 591 | /* this function is called at probe and resume time */ |
| 598 | static int sd_open(struct gspca_dev *gspca_dev) | 592 | static int sd_init_12a(struct gspca_dev *gspca_dev) |
| 599 | { | 593 | { |
| 600 | struct sd *sd = (struct sd *) gspca_dev; | 594 | PDEBUG(D_STREAM, "Chip revision: 012a"); |
| 601 | 595 | init_161rev12A(gspca_dev); | |
| 602 | switch (sd->chip_revision) { | 596 | return 0; |
| 603 | case Rev072A: | 597 | } |
| 604 | PDEBUG(D_STREAM, "Chip revision id: 072a"); | 598 | static int sd_init_72a(struct gspca_dev *gspca_dev) |
| 605 | write_vector(gspca_dev, spca561_init_data); | 599 | { |
| 606 | break; | 600 | PDEBUG(D_STREAM, "Chip revision: 072a"); |
| 607 | default: | 601 | write_vector(gspca_dev, spca561_init_data); |
| 608 | /* case Rev012A: */ | ||
| 609 | PDEBUG(D_STREAM, "Chip revision id: 012a"); | ||
| 610 | init_161rev12A(gspca_dev); | ||
| 611 | break; | ||
| 612 | } | ||
| 613 | return 0; | 602 | return 0; |
| 614 | } | 603 | } |
| 615 | 604 | ||
| @@ -618,25 +607,20 @@ static void setcontrast(struct gspca_dev *gspca_dev) | |||
| 618 | struct sd *sd = (struct sd *) gspca_dev; | 607 | struct sd *sd = (struct sd *) gspca_dev; |
| 619 | struct usb_device *dev = gspca_dev->dev; | 608 | struct usb_device *dev = gspca_dev->dev; |
| 620 | __u8 lowb; | 609 | __u8 lowb; |
| 621 | int expotimes; | ||
| 622 | 610 | ||
| 623 | switch (sd->chip_revision) { | 611 | switch (sd->chip_revision) { |
| 624 | case Rev072A: | 612 | case Rev072A: |
| 625 | lowb = sd->contrast >> 8; | 613 | lowb = sd->contrast >> 8; |
| 626 | reg_w_val(dev, lowb, 0x8651); | 614 | reg_w_val(dev, 0x8651, lowb); |
| 627 | reg_w_val(dev, lowb, 0x8652); | 615 | reg_w_val(dev, 0x8652, lowb); |
| 628 | reg_w_val(dev, lowb, 0x8653); | 616 | reg_w_val(dev, 0x8653, lowb); |
| 629 | reg_w_val(dev, lowb, 0x8654); | 617 | reg_w_val(dev, 0x8654, lowb); |
| 630 | break; | 618 | break; |
| 631 | case Rev012A: { | 619 | default: { |
| 632 | __u8 Reg8391[] = | 620 | /* case Rev012A: { */ |
| 633 | { 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00 }; | 621 | static const __u8 Reg8391[] = |
| 634 | 622 | { 0x92, 0x30, 0x20, 0x00, 0x0c, 0x00, 0x00, 0x00 }; | |
| 635 | /* Write camera sensor settings */ | 623 | |
| 636 | expotimes = (sd->contrast >> 5) & 0x07ff; | ||
| 637 | Reg8391[0] = expotimes & 0xff; /* exposure */ | ||
| 638 | Reg8391[1] = 0x18 | (expotimes >> 8); | ||
| 639 | Reg8391[2] = sd->brightness; /* gain */ | ||
| 640 | reg_w_buf(gspca_dev, 0x8391, Reg8391, 8); | 624 | reg_w_buf(gspca_dev, 0x8391, Reg8391, 8); |
| 641 | reg_w_buf(gspca_dev, 0x8390, Reg8391, 8); | 625 | reg_w_buf(gspca_dev, 0x8390, Reg8391, 8); |
| 642 | break; | 626 | break; |
| @@ -644,93 +628,151 @@ static void setcontrast(struct gspca_dev *gspca_dev) | |||
| 644 | } | 628 | } |
| 645 | } | 629 | } |
| 646 | 630 | ||
| 647 | static void setautogain(struct gspca_dev *gspca_dev) | 631 | /* rev12a only */ |
| 632 | static void setwhite(struct gspca_dev *gspca_dev) | ||
| 648 | { | 633 | { |
| 649 | struct sd *sd = (struct sd *) gspca_dev; | 634 | struct sd *sd = (struct sd *) gspca_dev; |
| 635 | __u16 white; | ||
| 636 | __u8 reg8614, reg8616; | ||
| 637 | |||
| 638 | white = sd->white; | ||
| 639 | /* try to emulate MS-win as possible */ | ||
| 640 | reg8616 = 0x90 - white * 5 / 8; | ||
| 641 | reg_w_val(gspca_dev->dev, 0x8616, reg8616); | ||
| 642 | reg8614 = 0x20 + white * 3 / 8; | ||
| 643 | reg_w_val(gspca_dev->dev, 0x8614, reg8614); | ||
| 644 | } | ||
| 650 | 645 | ||
| 651 | if (sd->chip_revision == Rev072A) { | 646 | /* rev 12a only */ |
| 652 | if (sd->autogain) | 647 | static void setexposure(struct gspca_dev *gspca_dev) |
| 653 | sd->ag_cnt = AG_CNT_START; | 648 | { |
| 654 | else | 649 | struct sd *sd = (struct sd *) gspca_dev; |
| 655 | sd->ag_cnt = -1; | 650 | int expo; |
| 651 | int clock_divider; | ||
| 652 | __u8 data[2]; | ||
| 653 | |||
| 654 | /* Register 0x8309 controls exposure for the spca561, | ||
| 655 | the basic exposure setting goes from 1-2047, where 1 is completely | ||
| 656 | dark and 2047 is very bright. It not only influences exposure but | ||
| 657 | also the framerate (to allow for longer exposure) from 1 - 300 it | ||
| 658 | only raises the exposure time then from 300 - 600 it halves the | ||
| 659 | framerate to be able to further raise the exposure time and for every | ||
| 660 | 300 more it halves the framerate again. This allows for a maximum | ||
| 661 | exposure time of circa 0.2 - 0.25 seconds (30 / (2000/3000) fps). | ||
| 662 | Sometimes this is not enough, the 1-2047 uses bits 0-10, bits 11-12 | ||
| 663 | configure a divider for the base framerate which us used at the | ||
| 664 | exposure setting of 1-300. These bits configure the base framerate | ||
| 665 | according to the following formula: fps = 60 / (value + 2) */ | ||
| 666 | if (sd->exposure < 2048) { | ||
| 667 | expo = sd->exposure; | ||
| 668 | clock_divider = 0; | ||
| 669 | } else { | ||
| 670 | /* Add 900 to make the 0 setting of the second part of the | ||
| 671 | exposure equal to the 2047 setting of the first part. */ | ||
| 672 | expo = (sd->exposure - 2048) + 900; | ||
| 673 | clock_divider = 3; | ||
| 656 | } | 674 | } |
| 675 | expo |= clock_divider << 11; | ||
| 676 | data[0] = expo; | ||
| 677 | data[1] = expo >> 8; | ||
| 678 | reg_w_buf(gspca_dev, 0x8309, data, 2); | ||
| 657 | } | 679 | } |
| 658 | 680 | ||
| 659 | static void sd_start(struct gspca_dev *gspca_dev) | 681 | /* rev 12a only */ |
| 682 | static void setgain(struct gspca_dev *gspca_dev) | ||
| 660 | { | 683 | { |
| 661 | struct sd *sd = (struct sd *) gspca_dev; | 684 | struct sd *sd = (struct sd *) gspca_dev; |
| 685 | __u8 data[2]; | ||
| 686 | |||
| 687 | data[0] = sd->gain; | ||
| 688 | data[1] = 0; | ||
| 689 | reg_w_buf(gspca_dev, 0x8335, data, 2); | ||
| 690 | } | ||
| 691 | |||
| 692 | static void setautogain(struct gspca_dev *gspca_dev) | ||
| 693 | { | ||
| 694 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 695 | |||
| 696 | if (sd->autogain) | ||
| 697 | sd->ag_cnt = AG_CNT_START; | ||
| 698 | else | ||
| 699 | sd->ag_cnt = -1; | ||
| 700 | } | ||
| 701 | |||
| 702 | static void sd_start_12a(struct gspca_dev *gspca_dev) | ||
| 703 | { | ||
| 662 | struct usb_device *dev = gspca_dev->dev; | 704 | struct usb_device *dev = gspca_dev->dev; |
| 663 | int Clck; | 705 | int Clck = 0x8a; /* lower 0x8X values lead to fps > 30 */ |
| 664 | __u8 Reg8307[] = { 0xaa, 0x00 }; | 706 | __u8 Reg8307[] = { 0xaa, 0x00 }; |
| 665 | int mode; | 707 | int mode; |
| 666 | 708 | ||
| 667 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; | 709 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; |
| 668 | switch (sd->chip_revision) { | 710 | if (mode <= 1) { |
| 669 | case Rev072A: | 711 | /* Use compression on 320x240 and above */ |
| 670 | switch (mode) { | 712 | reg_w_val(dev, 0x8500, 0x10 | mode); |
| 671 | default: | 713 | } else { |
| 672 | /* case 0: | 714 | /* I couldn't get the compression to work below 320x240 |
| 673 | case 1: */ | 715 | * Fortunately at these resolutions the bandwidth |
| 674 | Clck = 0x25; | 716 | * is sufficient to push raw frames at ~20fps */ |
| 675 | break; | 717 | reg_w_val(dev, 0x8500, mode); |
| 676 | case 2: | 718 | } /* -- qq@kuku.eu.org */ |
| 677 | Clck = 0x22; | 719 | reg_w_buf(gspca_dev, 0x8307, Reg8307, 2); |
| 678 | break; | 720 | reg_w_val(gspca_dev->dev, 0x8700, Clck); |
| 679 | case 3: | 721 | /* 0x8f 0x85 0x27 clock */ |
| 680 | Clck = 0x21; | 722 | reg_w_val(gspca_dev->dev, 0x8112, 0x1e | 0x20); |
| 681 | break; | 723 | reg_w_val(gspca_dev->dev, 0x850b, 0x03); |
| 682 | } | 724 | setcontrast(gspca_dev); |
| 683 | reg_w_val(dev, 0x8500, mode); /* mode */ | 725 | setwhite(gspca_dev); |
| 684 | reg_w_val(dev, 0x8700, Clck); /* 0x27 clock */ | 726 | setautogain(gspca_dev); |
| 685 | reg_w_val(dev, 0x8112, 0x10 | 0x20); | 727 | setexposure(gspca_dev); |
| 686 | setautogain(gspca_dev); | 728 | } |
| 687 | break; | 729 | static void sd_start_72a(struct gspca_dev *gspca_dev) |
| 730 | { | ||
| 731 | struct usb_device *dev = gspca_dev->dev; | ||
| 732 | int Clck; | ||
| 733 | int mode; | ||
| 734 | |||
| 735 | mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; | ||
| 736 | switch (mode) { | ||
| 688 | default: | 737 | default: |
| 689 | /* case Rev012A: */ | 738 | /* case 0: |
| 690 | switch (mode) { | 739 | case 1: */ |
| 691 | case 0: | 740 | Clck = 0x25; |
| 692 | case 1: | 741 | break; |
| 693 | Clck = 0x8a; | 742 | case 2: |
| 694 | break; | 743 | Clck = 0x22; |
| 695 | case 2: | 744 | break; |
| 696 | Clck = 0x85; | 745 | case 3: |
| 697 | break; | 746 | Clck = 0x21; |
| 698 | default: | ||
| 699 | Clck = 0x83; | ||
| 700 | break; | ||
| 701 | } | ||
| 702 | if (mode <= 1) { | ||
| 703 | /* Use compression on 320x240 and above */ | ||
| 704 | reg_w_val(dev, 0x8500, 0x10 | mode); | ||
| 705 | } else { | ||
| 706 | /* I couldn't get the compression to work below 320x240 | ||
| 707 | * Fortunately at these resolutions the bandwidth | ||
| 708 | * is sufficient to push raw frames at ~20fps */ | ||
| 709 | reg_w_val(dev, 0x8500, mode); | ||
| 710 | } /* -- qq@kuku.eu.org */ | ||
| 711 | reg_w_buf(gspca_dev, 0x8307, Reg8307, 2); | ||
| 712 | reg_w_val(gspca_dev->dev, 0x8700, Clck); | ||
| 713 | /* 0x8f 0x85 0x27 clock */ | ||
| 714 | reg_w_val(gspca_dev->dev, 0x8112, 0x1e | 0x20); | ||
| 715 | reg_w_val(gspca_dev->dev, 0x850b, 0x03); | ||
| 716 | setcontrast(gspca_dev); | ||
| 717 | break; | 747 | break; |
| 718 | } | 748 | } |
| 749 | reg_w_val(dev, 0x8500, mode); /* mode */ | ||
| 750 | reg_w_val(dev, 0x8700, Clck); /* 0x27 clock */ | ||
| 751 | reg_w_val(dev, 0x8112, 0x10 | 0x20); | ||
| 752 | setautogain(gspca_dev); | ||
| 719 | } | 753 | } |
| 720 | 754 | ||
| 721 | static void sd_stopN(struct gspca_dev *gspca_dev) | 755 | static void sd_stopN(struct gspca_dev *gspca_dev) |
| 722 | { | 756 | { |
| 723 | reg_w_val(gspca_dev->dev, 0x8112, 0x20); | 757 | struct sd *sd = (struct sd *) gspca_dev; |
| 758 | |||
| 759 | if (sd->chip_revision == Rev012A) { | ||
| 760 | reg_w_val(gspca_dev->dev, 0x8112, 0x0e); | ||
| 761 | } else { | ||
| 762 | reg_w_val(gspca_dev->dev, 0x8112, 0x20); | ||
| 763 | /* reg_w_val(gspca_dev->dev, 0x8102, 0x00); ?? */ | ||
| 764 | } | ||
| 724 | } | 765 | } |
| 725 | 766 | ||
| 726 | static void sd_stop0(struct gspca_dev *gspca_dev) | 767 | static void sd_stop0(struct gspca_dev *gspca_dev) |
| 727 | { | 768 | { |
| 728 | } | 769 | struct sd *sd = (struct sd *) gspca_dev; |
| 729 | 770 | ||
| 730 | /* this function is called at close time */ | 771 | if (sd->chip_revision == Rev012A) { |
| 731 | static void sd_close(struct gspca_dev *gspca_dev) | 772 | reg_w_val(gspca_dev->dev, 0x8118, 0x29); |
| 732 | { | 773 | reg_w_val(gspca_dev->dev, 0x8114, 0x08); |
| 733 | reg_w_val(gspca_dev->dev, 0x8114, 0); | 774 | } |
| 775 | /* reg_w_val(gspca_dev->dev, 0x8114, 0); */ | ||
| 734 | } | 776 | } |
| 735 | 777 | ||
| 736 | static void do_autogain(struct gspca_dev *gspca_dev) | 778 | static void do_autogain(struct gspca_dev *gspca_dev) |
| @@ -744,6 +786,7 @@ static void do_autogain(struct gspca_dev *gspca_dev) | |||
| 744 | __u8 luma_mean = 110; | 786 | __u8 luma_mean = 110; |
| 745 | __u8 luma_delta = 20; | 787 | __u8 luma_delta = 20; |
| 746 | __u8 spring = 4; | 788 | __u8 spring = 4; |
| 789 | __u8 reg8339[2]; | ||
| 747 | 790 | ||
| 748 | if (sd->ag_cnt < 0) | 791 | if (sd->ag_cnt < 0) |
| 749 | return; | 792 | return; |
| @@ -798,13 +841,16 @@ static void do_autogain(struct gspca_dev *gspca_dev) | |||
| 798 | } | 841 | } |
| 799 | break; | 842 | break; |
| 800 | case Rev012A: | 843 | case Rev012A: |
| 801 | /* sensor registers is access and memory mapped to 0x8300 */ | 844 | reg_r(gspca_dev, 0x8330, 2); |
| 802 | /* readind all 0x83xx block the sensor */ | 845 | if (gspca_dev->usb_buf[1] > 0x08) { |
| 803 | /* | 846 | reg8339[0] = ++sd->expo12a; |
| 804 | * The data from the header seem wrong where is the luma | 847 | reg8339[1] = 0; |
| 805 | * and chroma mean value | 848 | reg_w_buf(gspca_dev, 0x8339, reg8339, 2); |
| 806 | * at the moment set exposure in contrast set | 849 | } else if (gspca_dev->usb_buf[1] < 0x02) { |
| 807 | */ | 850 | reg8339[0] = --sd->expo12a; |
| 851 | reg8339[1] = 0; | ||
| 852 | reg_w_buf(gspca_dev, 0x8339, reg8339, 2); | ||
| 853 | } | ||
| 808 | break; | 854 | break; |
| 809 | } | 855 | } |
| 810 | } | 856 | } |
| @@ -814,6 +860,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 814 | __u8 *data, /* isoc packet */ | 860 | __u8 *data, /* isoc packet */ |
| 815 | int len) /* iso packet length */ | 861 | int len) /* iso packet length */ |
| 816 | { | 862 | { |
| 863 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 864 | |||
| 817 | switch (data[0]) { | 865 | switch (data[0]) { |
| 818 | case 0: /* start of frame */ | 866 | case 0: /* start of frame */ |
| 819 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, | 867 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, |
| @@ -826,8 +874,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 826 | frame, data, len); | 874 | frame, data, len); |
| 827 | } else { | 875 | } else { |
| 828 | /* raw bayer (with a header, which we skip) */ | 876 | /* raw bayer (with a header, which we skip) */ |
| 829 | data += 20; | 877 | if (sd->chip_revision == Rev012A) { |
| 830 | len -= 20; | 878 | data += 20; |
| 879 | len -= 20; | ||
| 880 | } else { | ||
| 881 | data += 16; | ||
| 882 | len -= 16; | ||
| 883 | } | ||
| 831 | gspca_frame_add(gspca_dev, FIRST_PACKET, | 884 | gspca_frame_add(gspca_dev, FIRST_PACKET, |
| 832 | frame, data, len); | 885 | frame, data, len); |
| 833 | } | 886 | } |
| @@ -841,24 +894,17 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 841 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); | 894 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); |
| 842 | } | 895 | } |
| 843 | 896 | ||
| 897 | /* rev 72a only */ | ||
| 844 | static void setbrightness(struct gspca_dev *gspca_dev) | 898 | static void setbrightness(struct gspca_dev *gspca_dev) |
| 845 | { | 899 | { |
| 846 | struct sd *sd = (struct sd *) gspca_dev; | 900 | struct sd *sd = (struct sd *) gspca_dev; |
| 847 | __u8 value; | 901 | __u8 value; |
| 848 | 902 | ||
| 849 | switch (sd->chip_revision) { | 903 | value = sd->brightness; |
| 850 | case Rev072A: | 904 | reg_w_val(gspca_dev->dev, 0x8611, value); |
| 851 | value = sd->brightness; | 905 | reg_w_val(gspca_dev->dev, 0x8612, value); |
| 852 | reg_w_val(gspca_dev->dev, value, 0x8611); | 906 | reg_w_val(gspca_dev->dev, 0x8613, value); |
| 853 | reg_w_val(gspca_dev->dev, value, 0x8612); | 907 | reg_w_val(gspca_dev->dev, 0x8614, value); |
| 854 | reg_w_val(gspca_dev->dev, value, 0x8613); | ||
| 855 | reg_w_val(gspca_dev->dev, value, 0x8614); | ||
| 856 | break; | ||
| 857 | default: | ||
| 858 | /* case Rev012A: */ | ||
| 859 | setcontrast(gspca_dev); | ||
| 860 | break; | ||
| 861 | } | ||
| 862 | } | 908 | } |
| 863 | 909 | ||
| 864 | static void getbrightness(struct gspca_dev *gspca_dev) | 910 | static void getbrightness(struct gspca_dev *gspca_dev) |
| @@ -866,52 +912,38 @@ static void getbrightness(struct gspca_dev *gspca_dev) | |||
| 866 | struct sd *sd = (struct sd *) gspca_dev; | 912 | struct sd *sd = (struct sd *) gspca_dev; |
| 867 | __u16 tot; | 913 | __u16 tot; |
| 868 | 914 | ||
| 869 | switch (sd->chip_revision) { | 915 | tot = 0; |
| 870 | case Rev072A: | 916 | reg_r(gspca_dev, 0x8611, 1); |
| 871 | tot = 0; | 917 | tot += gspca_dev->usb_buf[0]; |
| 872 | reg_r(gspca_dev, 0x8611, 1); | 918 | reg_r(gspca_dev, 0x8612, 1); |
| 873 | tot += gspca_dev->usb_buf[0]; | 919 | tot += gspca_dev->usb_buf[0]; |
| 874 | reg_r(gspca_dev, 0x8612, 1); | 920 | reg_r(gspca_dev, 0x8613, 1); |
| 875 | tot += gspca_dev->usb_buf[0]; | 921 | tot += gspca_dev->usb_buf[0]; |
| 876 | reg_r(gspca_dev, 0x8613, 1); | 922 | reg_r(gspca_dev, 0x8614, 1); |
| 877 | tot += gspca_dev->usb_buf[0]; | 923 | tot += gspca_dev->usb_buf[0]; |
| 878 | reg_r(gspca_dev, 0x8614, 1); | 924 | sd->brightness = tot >> 2; |
| 879 | tot += gspca_dev->usb_buf[0]; | ||
| 880 | sd->brightness = tot >> 2; | ||
| 881 | break; | ||
| 882 | default: | ||
| 883 | /* case Rev012A: */ | ||
| 884 | /* no way to read sensor settings */ | ||
| 885 | break; | ||
| 886 | } | ||
| 887 | } | 925 | } |
| 888 | 926 | ||
| 927 | /* rev72a only */ | ||
| 889 | static void getcontrast(struct gspca_dev *gspca_dev) | 928 | static void getcontrast(struct gspca_dev *gspca_dev) |
| 890 | { | 929 | { |
| 891 | struct sd *sd = (struct sd *) gspca_dev; | 930 | struct sd *sd = (struct sd *) gspca_dev; |
| 892 | __u16 tot; | 931 | __u16 tot; |
| 893 | 932 | ||
| 894 | switch (sd->chip_revision) { | 933 | tot = 0; |
| 895 | case Rev072A: | 934 | reg_r(gspca_dev, 0x8651, 1); |
| 896 | tot = 0; | 935 | tot += gspca_dev->usb_buf[0]; |
| 897 | reg_r(gspca_dev, 0x8651, 1); | 936 | reg_r(gspca_dev, 0x8652, 1); |
| 898 | tot += gspca_dev->usb_buf[0]; | 937 | tot += gspca_dev->usb_buf[0]; |
| 899 | reg_r(gspca_dev, 0x8652, 1); | 938 | reg_r(gspca_dev, 0x8653, 1); |
| 900 | tot += gspca_dev->usb_buf[0]; | 939 | tot += gspca_dev->usb_buf[0]; |
| 901 | reg_r(gspca_dev, 0x8653, 1); | 940 | reg_r(gspca_dev, 0x8654, 1); |
| 902 | tot += gspca_dev->usb_buf[0]; | 941 | tot += gspca_dev->usb_buf[0]; |
| 903 | reg_r(gspca_dev, 0x8654, 1); | 942 | sd->contrast = tot << 6; |
| 904 | tot += gspca_dev->usb_buf[0]; | ||
| 905 | sd->contrast = tot << 6; | ||
| 906 | break; | ||
| 907 | default: | ||
| 908 | /* case Rev012A: */ | ||
| 909 | /* no way to read sensor settings */ | ||
| 910 | break; | ||
| 911 | } | ||
| 912 | PDEBUG(D_CONF, "get contrast %d", sd->contrast); | 943 | PDEBUG(D_CONF, "get contrast %d", sd->contrast); |
| 913 | } | 944 | } |
| 914 | 945 | ||
| 946 | /* rev 72a only */ | ||
| 915 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | 947 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) |
| 916 | { | 948 | { |
| 917 | struct sd *sd = (struct sd *) gspca_dev; | 949 | struct sd *sd = (struct sd *) gspca_dev; |
| @@ -931,6 +963,7 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) | |||
| 931 | return 0; | 963 | return 0; |
| 932 | } | 964 | } |
| 933 | 965 | ||
| 966 | /* rev 72a only */ | ||
| 934 | static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) | 967 | static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) |
| 935 | { | 968 | { |
| 936 | struct sd *sd = (struct sd *) gspca_dev; | 969 | struct sd *sd = (struct sd *) gspca_dev; |
| @@ -968,20 +1001,190 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) | |||
| 968 | return 0; | 1001 | return 0; |
| 969 | } | 1002 | } |
| 970 | 1003 | ||
| 1004 | /* rev12a only */ | ||
| 1005 | static int sd_setwhite(struct gspca_dev *gspca_dev, __s32 val) | ||
| 1006 | { | ||
| 1007 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1008 | |||
| 1009 | sd->white = val; | ||
| 1010 | if (gspca_dev->streaming) | ||
| 1011 | setwhite(gspca_dev); | ||
| 1012 | return 0; | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | static int sd_getwhite(struct gspca_dev *gspca_dev, __s32 *val) | ||
| 1016 | { | ||
| 1017 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1018 | |||
| 1019 | *val = sd->white; | ||
| 1020 | return 0; | ||
| 1021 | } | ||
| 1022 | |||
| 1023 | /* rev12a only */ | ||
| 1024 | static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val) | ||
| 1025 | { | ||
| 1026 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1027 | |||
| 1028 | sd->exposure = val; | ||
| 1029 | if (gspca_dev->streaming) | ||
| 1030 | setexposure(gspca_dev); | ||
| 1031 | return 0; | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val) | ||
| 1035 | { | ||
| 1036 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1037 | |||
| 1038 | *val = sd->exposure; | ||
| 1039 | return 0; | ||
| 1040 | } | ||
| 1041 | |||
| 1042 | /* rev12a only */ | ||
| 1043 | static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val) | ||
| 1044 | { | ||
| 1045 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1046 | |||
| 1047 | sd->gain = val; | ||
| 1048 | if (gspca_dev->streaming) | ||
| 1049 | setgain(gspca_dev); | ||
| 1050 | return 0; | ||
| 1051 | } | ||
| 1052 | |||
| 1053 | static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val) | ||
| 1054 | { | ||
| 1055 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1056 | |||
| 1057 | *val = sd->gain; | ||
| 1058 | return 0; | ||
| 1059 | } | ||
| 1060 | |||
| 1061 | /* control tables */ | ||
| 1062 | static struct ctrl sd_ctrls_12a[] = { | ||
| 1063 | { | ||
| 1064 | { | ||
| 1065 | .id = V4L2_CID_DO_WHITE_BALANCE, | ||
| 1066 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 1067 | .name = "While Balance", | ||
| 1068 | .minimum = WHITE_MIN, | ||
| 1069 | .maximum = WHITE_MAX, | ||
| 1070 | .step = 1, | ||
| 1071 | .default_value = WHITE_DEF, | ||
| 1072 | }, | ||
| 1073 | .set = sd_setwhite, | ||
| 1074 | .get = sd_getwhite, | ||
| 1075 | }, | ||
| 1076 | { | ||
| 1077 | { | ||
| 1078 | .id = V4L2_CID_EXPOSURE, | ||
| 1079 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 1080 | .name = "Exposure", | ||
| 1081 | .minimum = EXPOSURE_MIN, | ||
| 1082 | .maximum = EXPOSURE_MAX, | ||
| 1083 | .step = 1, | ||
| 1084 | .default_value = EXPOSURE_DEF, | ||
| 1085 | }, | ||
| 1086 | .set = sd_setexposure, | ||
| 1087 | .get = sd_getexposure, | ||
| 1088 | }, | ||
| 1089 | { | ||
| 1090 | { | ||
| 1091 | .id = V4L2_CID_AUTOGAIN, | ||
| 1092 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
| 1093 | .name = "Auto Gain", | ||
| 1094 | .minimum = AUTOGAIN_MIN, | ||
| 1095 | .maximum = AUTOGAIN_MAX, | ||
| 1096 | .step = 1, | ||
| 1097 | .default_value = AUTOGAIN_DEF, | ||
| 1098 | }, | ||
| 1099 | .set = sd_setautogain, | ||
| 1100 | .get = sd_getautogain, | ||
| 1101 | }, | ||
| 1102 | { | ||
| 1103 | { | ||
| 1104 | .id = V4L2_CID_GAIN, | ||
| 1105 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 1106 | .name = "Gain", | ||
| 1107 | .minimum = GAIN_MIN, | ||
| 1108 | .maximum = GAIN_MAX, | ||
| 1109 | .step = 1, | ||
| 1110 | .default_value = GAIN_DEF, | ||
| 1111 | }, | ||
| 1112 | .set = sd_setgain, | ||
| 1113 | .get = sd_getgain, | ||
| 1114 | }, | ||
| 1115 | }; | ||
| 1116 | |||
| 1117 | static struct ctrl sd_ctrls_72a[] = { | ||
| 1118 | { | ||
| 1119 | { | ||
| 1120 | .id = V4L2_CID_BRIGHTNESS, | ||
| 1121 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 1122 | .name = "Brightness", | ||
| 1123 | .minimum = BRIGHTNESS_MIN, | ||
| 1124 | .maximum = BRIGHTNESS_MAX, | ||
| 1125 | .step = 1, | ||
| 1126 | .default_value = BRIGHTNESS_DEF, | ||
| 1127 | }, | ||
| 1128 | .set = sd_setbrightness, | ||
| 1129 | .get = sd_getbrightness, | ||
| 1130 | }, | ||
| 1131 | { | ||
| 1132 | { | ||
| 1133 | .id = V4L2_CID_CONTRAST, | ||
| 1134 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
| 1135 | .name = "Contrast", | ||
| 1136 | .minimum = CONTRAST_MIN, | ||
| 1137 | .maximum = CONTRAST_MAX, | ||
| 1138 | .step = 1, | ||
| 1139 | .default_value = CONTRAST_DEF, | ||
| 1140 | }, | ||
| 1141 | .set = sd_setcontrast, | ||
| 1142 | .get = sd_getcontrast, | ||
| 1143 | }, | ||
| 1144 | { | ||
| 1145 | { | ||
| 1146 | .id = V4L2_CID_AUTOGAIN, | ||
| 1147 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
| 1148 | .name = "Auto Gain", | ||
| 1149 | .minimum = AUTOGAIN_MIN, | ||
| 1150 | .maximum = AUTOGAIN_MAX, | ||
| 1151 | .step = 1, | ||
| 1152 | .default_value = AUTOGAIN_DEF, | ||
| 1153 | }, | ||
| 1154 | .set = sd_setautogain, | ||
| 1155 | .get = sd_getautogain, | ||
| 1156 | }, | ||
| 1157 | }; | ||
| 1158 | |||
| 971 | /* sub-driver description */ | 1159 | /* sub-driver description */ |
| 972 | static const struct sd_desc sd_desc = { | 1160 | static const struct sd_desc sd_desc_12a = { |
| 1161 | .name = MODULE_NAME, | ||
| 1162 | .ctrls = sd_ctrls_12a, | ||
| 1163 | .nctrls = ARRAY_SIZE(sd_ctrls_12a), | ||
| 1164 | .config = sd_config, | ||
| 1165 | .init = sd_init_12a, | ||
| 1166 | .start = sd_start_12a, | ||
| 1167 | .stopN = sd_stopN, | ||
| 1168 | .stop0 = sd_stop0, | ||
| 1169 | .pkt_scan = sd_pkt_scan, | ||
| 1170 | /* .dq_callback = do_autogain, * fixme */ | ||
| 1171 | }; | ||
| 1172 | static const struct sd_desc sd_desc_72a = { | ||
| 973 | .name = MODULE_NAME, | 1173 | .name = MODULE_NAME, |
| 974 | .ctrls = sd_ctrls, | 1174 | .ctrls = sd_ctrls_72a, |
| 975 | .nctrls = ARRAY_SIZE(sd_ctrls), | 1175 | .nctrls = ARRAY_SIZE(sd_ctrls_72a), |
| 976 | .config = sd_config, | 1176 | .config = sd_config, |
| 977 | .open = sd_open, | 1177 | .init = sd_init_72a, |
| 978 | .start = sd_start, | 1178 | .start = sd_start_72a, |
| 979 | .stopN = sd_stopN, | 1179 | .stopN = sd_stopN, |
| 980 | .stop0 = sd_stop0, | 1180 | .stop0 = sd_stop0, |
| 981 | .close = sd_close, | ||
| 982 | .pkt_scan = sd_pkt_scan, | 1181 | .pkt_scan = sd_pkt_scan, |
| 983 | .dq_callback = do_autogain, | 1182 | .dq_callback = do_autogain, |
| 984 | }; | 1183 | }; |
| 1184 | static const struct sd_desc *sd_desc[2] = { | ||
| 1185 | &sd_desc_12a, | ||
| 1186 | &sd_desc_72a | ||
| 1187 | }; | ||
| 985 | 1188 | ||
| 986 | /* -- module initialisation -- */ | 1189 | /* -- module initialisation -- */ |
| 987 | static const __devinitdata struct usb_device_id device_table[] = { | 1190 | static const __devinitdata struct usb_device_id device_table[] = { |
| @@ -1009,7 +1212,9 @@ MODULE_DEVICE_TABLE(usb, device_table); | |||
| 1009 | static int sd_probe(struct usb_interface *intf, | 1212 | static int sd_probe(struct usb_interface *intf, |
| 1010 | const struct usb_device_id *id) | 1213 | const struct usb_device_id *id) |
| 1011 | { | 1214 | { |
| 1012 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), | 1215 | return gspca_dev_probe(intf, id, |
| 1216 | sd_desc[id->driver_info], | ||
| 1217 | sizeof(struct sd), | ||
| 1013 | THIS_MODULE); | 1218 | THIS_MODULE); |
| 1014 | } | 1219 | } |
| 1015 | 1220 | ||
| @@ -1018,6 +1223,10 @@ static struct usb_driver sd_driver = { | |||
| 1018 | .id_table = device_table, | 1223 | .id_table = device_table, |
| 1019 | .probe = sd_probe, | 1224 | .probe = sd_probe, |
| 1020 | .disconnect = gspca_disconnect, | 1225 | .disconnect = gspca_disconnect, |
| 1226 | #ifdef CONFIG_PM | ||
| 1227 | .suspend = gspca_suspend, | ||
| 1228 | .resume = gspca_resume, | ||
| 1229 | #endif | ||
| 1021 | }; | 1230 | }; |
| 1022 | 1231 | ||
| 1023 | /* -- module insert / remove -- */ | 1232 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index 16219cf6a6d5..2f2de429e273 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c | |||
| @@ -306,8 +306,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 306 | return 0; | 306 | return 0; |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | /* this function is called at open time */ | 309 | /* this function is called at probe and resume time */ |
| 310 | static int sd_open(struct gspca_dev *gspca_dev) | 310 | static int sd_init(struct gspca_dev *gspca_dev) |
| 311 | { | 311 | { |
| 312 | int ret; | 312 | int ret; |
| 313 | 313 | ||
| @@ -398,14 +398,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 398 | PDEBUG(D_STREAM, "camera stopped"); | 398 | PDEBUG(D_STREAM, "camera stopped"); |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 402 | { | ||
| 403 | } | ||
| 404 | |||
| 405 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 406 | { | ||
| 407 | } | ||
| 408 | |||
| 409 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 401 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 410 | struct gspca_frame *frame, /* target */ | 402 | struct gspca_frame *frame, /* target */ |
| 411 | __u8 *data, /* isoc packet */ | 403 | __u8 *data, /* isoc packet */ |
| @@ -535,11 +527,9 @@ static const struct sd_desc sd_desc = { | |||
| 535 | .ctrls = sd_ctrls, | 527 | .ctrls = sd_ctrls, |
| 536 | .nctrls = ARRAY_SIZE(sd_ctrls), | 528 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 537 | .config = sd_config, | 529 | .config = sd_config, |
| 538 | .open = sd_open, | 530 | .init = sd_init, |
| 539 | .start = sd_start, | 531 | .start = sd_start, |
| 540 | .stopN = sd_stopN, | 532 | .stopN = sd_stopN, |
| 541 | .stop0 = sd_stop0, | ||
| 542 | .close = sd_close, | ||
| 543 | .pkt_scan = sd_pkt_scan, | 533 | .pkt_scan = sd_pkt_scan, |
| 544 | .querymenu = sd_querymenu, | 534 | .querymenu = sd_querymenu, |
| 545 | }; | 535 | }; |
| @@ -564,6 +554,10 @@ static struct usb_driver sd_driver = { | |||
| 564 | .id_table = device_table, | 554 | .id_table = device_table, |
| 565 | .probe = sd_probe, | 555 | .probe = sd_probe, |
| 566 | .disconnect = gspca_disconnect, | 556 | .disconnect = gspca_disconnect, |
| 557 | #ifdef CONFIG_PM | ||
| 558 | .suspend = gspca_suspend, | ||
| 559 | .resume = gspca_resume, | ||
| 560 | #endif | ||
| 567 | }; | 561 | }; |
| 568 | 562 | ||
| 569 | /* -- module insert / remove -- */ | 563 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index 54efa48bee01..1cfcc6c49558 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c | |||
| @@ -449,31 +449,47 @@ static const __u8 qtable_spca504_default[2][64] = { | |||
| 449 | 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e} | 449 | 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e} |
| 450 | }; | 450 | }; |
| 451 | 451 | ||
| 452 | static void reg_r(struct usb_device *dev, | 452 | /* read <len> bytes to gspca_dev->usb_buf */ |
| 453 | __u16 req, | 453 | static void reg_r(struct gspca_dev *gspca_dev, |
| 454 | __u16 index, | 454 | __u16 req, |
| 455 | __u8 *buffer, __u16 length) | 455 | __u16 index, |
| 456 | __u16 len) | ||
| 456 | { | 457 | { |
| 457 | usb_control_msg(dev, | 458 | #ifdef GSPCA_DEBUG |
| 458 | usb_rcvctrlpipe(dev, 0), | 459 | if (len > USB_BUF_SZ) { |
| 460 | err("reg_r: buffer overflow"); | ||
| 461 | return; | ||
| 462 | } | ||
| 463 | #endif | ||
| 464 | usb_control_msg(gspca_dev->dev, | ||
| 465 | usb_rcvctrlpipe(gspca_dev->dev, 0), | ||
| 459 | req, | 466 | req, |
| 460 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 467 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 461 | 0, /* value */ | 468 | 0, /* value */ |
| 462 | index, buffer, length, | 469 | index, |
| 470 | len ? gspca_dev->usb_buf : NULL, len, | ||
| 463 | 500); | 471 | 500); |
| 464 | } | 472 | } |
| 465 | 473 | ||
| 466 | static void reg_w(struct usb_device *dev, | 474 | /* write <len> bytes from gspca_dev->usb_buf */ |
| 467 | __u16 req, | 475 | static void reg_w(struct gspca_dev *gspca_dev, |
| 468 | __u16 value, | 476 | __u16 req, |
| 469 | __u16 index, | 477 | __u16 value, |
| 470 | __u8 *buffer, __u16 length) | 478 | __u16 index, |
| 479 | __u16 len) | ||
| 471 | { | 480 | { |
| 472 | usb_control_msg(dev, | 481 | #ifdef GSPCA_DEBUG |
| 473 | usb_sndctrlpipe(dev, 0), | 482 | if (len > USB_BUF_SZ) { |
| 483 | err("reg_w: buffer overflow"); | ||
| 484 | return; | ||
| 485 | } | ||
| 486 | #endif | ||
| 487 | usb_control_msg(gspca_dev->dev, | ||
| 488 | usb_sndctrlpipe(gspca_dev->dev, 0), | ||
| 474 | req, | 489 | req, |
| 475 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 490 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 476 | value, index, buffer, length, | 491 | value, index, |
| 492 | len ? gspca_dev->usb_buf : NULL, len, | ||
| 477 | 500); | 493 | 500); |
| 478 | } | 494 | } |
| 479 | 495 | ||
| @@ -634,7 +650,7 @@ static int spca504B_PollingDataReady(struct gspca_dev *gspca_dev) | |||
| 634 | int count = 10; | 650 | int count = 10; |
| 635 | 651 | ||
| 636 | while (--count > 0) { | 652 | while (--count > 0) { |
| 637 | reg_r(gspca_dev->dev, 0x21, 0, gspca_dev->usb_buf, 1); | 653 | reg_r(gspca_dev, 0x21, 0, 1); |
| 638 | if ((gspca_dev->usb_buf[0] & 0x01) == 0) | 654 | if ((gspca_dev->usb_buf[0] & 0x01) == 0) |
| 639 | break; | 655 | break; |
| 640 | msleep(10); | 656 | msleep(10); |
| @@ -644,15 +660,14 @@ static int spca504B_PollingDataReady(struct gspca_dev *gspca_dev) | |||
| 644 | 660 | ||
| 645 | static void spca504B_WaitCmdStatus(struct gspca_dev *gspca_dev) | 661 | static void spca504B_WaitCmdStatus(struct gspca_dev *gspca_dev) |
| 646 | { | 662 | { |
| 647 | struct usb_device *dev = gspca_dev->dev; | ||
| 648 | int count = 50; | 663 | int count = 50; |
| 649 | 664 | ||
| 650 | while (--count > 0) { | 665 | while (--count > 0) { |
| 651 | reg_r(dev, 0x21, 1, gspca_dev->usb_buf, 1); | 666 | reg_r(gspca_dev, 0x21, 1, 1); |
| 652 | if (gspca_dev->usb_buf[0] != 0) { | 667 | if (gspca_dev->usb_buf[0] != 0) { |
| 653 | gspca_dev->usb_buf[0] = 0; | 668 | gspca_dev->usb_buf[0] = 0; |
| 654 | reg_w(dev, 0x21, 0, 1, gspca_dev->usb_buf, 1); | 669 | reg_w(gspca_dev, 0x21, 0, 1, 1); |
| 655 | reg_r(dev, 0x21, 1, gspca_dev->usb_buf, 1); | 670 | reg_r(gspca_dev, 0x21, 1, 1); |
| 656 | spca504B_PollingDataReady(gspca_dev); | 671 | spca504B_PollingDataReady(gspca_dev); |
| 657 | break; | 672 | break; |
| 658 | } | 673 | } |
| @@ -662,16 +677,14 @@ static void spca504B_WaitCmdStatus(struct gspca_dev *gspca_dev) | |||
| 662 | 677 | ||
| 663 | static void spca50x_GetFirmware(struct gspca_dev *gspca_dev) | 678 | static void spca50x_GetFirmware(struct gspca_dev *gspca_dev) |
| 664 | { | 679 | { |
| 665 | struct usb_device *dev = gspca_dev->dev; | ||
| 666 | __u8 *data; | 680 | __u8 *data; |
| 667 | 681 | ||
| 668 | data = kmalloc(64, GFP_KERNEL); | 682 | data = gspca_dev->usb_buf; |
| 669 | reg_r(dev, 0x20, 0, data, 5); | 683 | reg_r(gspca_dev, 0x20, 0, 5); |
| 670 | PDEBUG(D_STREAM, "FirmWare : %d %d %d %d %d ", | 684 | PDEBUG(D_STREAM, "FirmWare : %d %d %d %d %d ", |
| 671 | data[0], data[1], data[2], data[3], data[4]); | 685 | data[0], data[1], data[2], data[3], data[4]); |
| 672 | reg_r(dev, 0x23, 0, data, 64); | 686 | reg_r(gspca_dev, 0x23, 0, 64); |
| 673 | reg_r(dev, 0x23, 1, data, 64); | 687 | reg_r(gspca_dev, 0x23, 1, 64); |
| 674 | kfree(data); | ||
| 675 | } | 688 | } |
| 676 | 689 | ||
| 677 | static void spca504B_SetSizeType(struct gspca_dev *gspca_dev) | 690 | static void spca504B_SetSizeType(struct gspca_dev *gspca_dev) |
| @@ -686,21 +699,21 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev) | |||
| 686 | Type = 0; | 699 | Type = 0; |
| 687 | switch (sd->bridge) { | 700 | switch (sd->bridge) { |
| 688 | case BRIDGE_SPCA533: | 701 | case BRIDGE_SPCA533: |
| 689 | reg_w(dev, 0x31, 0, 0, NULL, 0); | 702 | reg_w(gspca_dev, 0x31, 0, 0, 0); |
| 690 | spca504B_WaitCmdStatus(gspca_dev); | 703 | spca504B_WaitCmdStatus(gspca_dev); |
| 691 | rc = spca504B_PollingDataReady(gspca_dev); | 704 | rc = spca504B_PollingDataReady(gspca_dev); |
| 692 | spca50x_GetFirmware(gspca_dev); | 705 | spca50x_GetFirmware(gspca_dev); |
| 693 | gspca_dev->usb_buf[0] = 2; /* type */ | 706 | gspca_dev->usb_buf[0] = 2; /* type */ |
| 694 | reg_w(dev, 0x24, 0, 8, gspca_dev->usb_buf, 1); | 707 | reg_w(gspca_dev, 0x24, 0, 8, 1); |
| 695 | reg_r(dev, 0x24, 8, gspca_dev->usb_buf, 1); | 708 | reg_r(gspca_dev, 0x24, 8, 1); |
| 696 | 709 | ||
| 697 | gspca_dev->usb_buf[0] = Size; | 710 | gspca_dev->usb_buf[0] = Size; |
| 698 | reg_w(dev, 0x25, 0, 4, gspca_dev->usb_buf, 1); | 711 | reg_w(gspca_dev, 0x25, 0, 4, 1); |
| 699 | reg_r(dev, 0x25, 4, gspca_dev->usb_buf, 1); /* size */ | 712 | reg_r(gspca_dev, 0x25, 4, 1); /* size */ |
| 700 | rc = spca504B_PollingDataReady(gspca_dev); | 713 | rc = spca504B_PollingDataReady(gspca_dev); |
| 701 | 714 | ||
| 702 | /* Init the cam width height with some values get on init ? */ | 715 | /* Init the cam width height with some values get on init ? */ |
| 703 | reg_w(dev, 0x31, 0, 4, NULL, 0); | 716 | reg_w(gspca_dev, 0x31, 0, 4, 0); |
| 704 | spca504B_WaitCmdStatus(gspca_dev); | 717 | spca504B_WaitCmdStatus(gspca_dev); |
| 705 | rc = spca504B_PollingDataReady(gspca_dev); | 718 | rc = spca504B_PollingDataReady(gspca_dev); |
| 706 | break; | 719 | break; |
| @@ -708,12 +721,12 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev) | |||
| 708 | /* case BRIDGE_SPCA504B: */ | 721 | /* case BRIDGE_SPCA504B: */ |
| 709 | /* case BRIDGE_SPCA536: */ | 722 | /* case BRIDGE_SPCA536: */ |
| 710 | gspca_dev->usb_buf[0] = Size; | 723 | gspca_dev->usb_buf[0] = Size; |
| 711 | reg_w(dev, 0x25, 0, 4, gspca_dev->usb_buf, 1); | 724 | reg_w(gspca_dev, 0x25, 0, 4, 1); |
| 712 | reg_r(dev, 0x25, 4, gspca_dev->usb_buf, 1); /* size */ | 725 | reg_r(gspca_dev, 0x25, 4, 1); /* size */ |
| 713 | Type = 6; | 726 | Type = 6; |
| 714 | gspca_dev->usb_buf[0] = Type; | 727 | gspca_dev->usb_buf[0] = Type; |
| 715 | reg_w(dev, 0x27, 0, 0, gspca_dev->usb_buf, 1); | 728 | reg_w(gspca_dev, 0x27, 0, 0, 1); |
| 716 | reg_r(dev, 0x27, 0, gspca_dev->usb_buf, 1); /* type */ | 729 | reg_r(gspca_dev, 0x27, 0, 1); /* type */ |
| 717 | rc = spca504B_PollingDataReady(gspca_dev); | 730 | rc = spca504B_PollingDataReady(gspca_dev); |
| 718 | break; | 731 | break; |
| 719 | case BRIDGE_SPCA504: | 732 | case BRIDGE_SPCA504: |
| @@ -752,18 +765,15 @@ static void spca504_wait_status(struct gspca_dev *gspca_dev) | |||
| 752 | 765 | ||
| 753 | static void spca504B_setQtable(struct gspca_dev *gspca_dev) | 766 | static void spca504B_setQtable(struct gspca_dev *gspca_dev) |
| 754 | { | 767 | { |
| 755 | struct usb_device *dev = gspca_dev->dev; | ||
| 756 | |||
| 757 | gspca_dev->usb_buf[0] = 3; | 768 | gspca_dev->usb_buf[0] = 3; |
| 758 | reg_w(dev, 0x26, 0, 0, gspca_dev->usb_buf, 1); | 769 | reg_w(gspca_dev, 0x26, 0, 0, 1); |
| 759 | reg_r(dev, 0x26, 0, gspca_dev->usb_buf, 1); | 770 | reg_r(gspca_dev, 0x26, 0, 1); |
| 760 | spca504B_PollingDataReady(gspca_dev); | 771 | spca504B_PollingDataReady(gspca_dev); |
| 761 | } | 772 | } |
| 762 | 773 | ||
| 763 | static void sp5xx_initContBrigHueRegisters(struct gspca_dev *gspca_dev) | 774 | static void sp5xx_initContBrigHueRegisters(struct gspca_dev *gspca_dev) |
| 764 | { | 775 | { |
| 765 | struct sd *sd = (struct sd *) gspca_dev; | 776 | struct sd *sd = (struct sd *) gspca_dev; |
| 766 | struct usb_device *dev = gspca_dev->dev; | ||
| 767 | int pollreg = 1; | 777 | int pollreg = 1; |
| 768 | 778 | ||
| 769 | switch (sd->bridge) { | 779 | switch (sd->bridge) { |
| @@ -774,20 +784,20 @@ static void sp5xx_initContBrigHueRegisters(struct gspca_dev *gspca_dev) | |||
| 774 | default: | 784 | default: |
| 775 | /* case BRIDGE_SPCA533: */ | 785 | /* case BRIDGE_SPCA533: */ |
| 776 | /* case BRIDGE_SPCA504B: */ | 786 | /* case BRIDGE_SPCA504B: */ |
| 777 | reg_w(dev, 0, 0, 0x21a7, NULL, 0); /* brightness */ | 787 | reg_w(gspca_dev, 0, 0, 0x21a7, 0); /* brightness */ |
| 778 | reg_w(dev, 0, 0x20, 0x21a8, NULL, 0); /* contrast */ | 788 | reg_w(gspca_dev, 0, 0x20, 0x21a8, 0); /* contrast */ |
| 779 | reg_w(dev, 0, 0, 0x21ad, NULL, 0); /* hue */ | 789 | reg_w(gspca_dev, 0, 0, 0x21ad, 0); /* hue */ |
| 780 | reg_w(dev, 0, 1, 0x21ac, NULL, 0); /* sat/hue */ | 790 | reg_w(gspca_dev, 0, 1, 0x21ac, 0); /* sat/hue */ |
| 781 | reg_w(dev, 0, 0x20, 0x21ae, NULL, 0); /* saturation */ | 791 | reg_w(gspca_dev, 0, 0x20, 0x21ae, 0); /* saturation */ |
| 782 | reg_w(dev, 0, 0, 0x21a3, NULL, 0); /* gamma */ | 792 | reg_w(gspca_dev, 0, 0, 0x21a3, 0); /* gamma */ |
| 783 | break; | 793 | break; |
| 784 | case BRIDGE_SPCA536: | 794 | case BRIDGE_SPCA536: |
| 785 | reg_w(dev, 0, 0, 0x20f0, NULL, 0); | 795 | reg_w(gspca_dev, 0, 0, 0x20f0, 0); |
| 786 | reg_w(dev, 0, 0x21, 0x20f1, NULL, 0); | 796 | reg_w(gspca_dev, 0, 0x21, 0x20f1, 0); |
| 787 | reg_w(dev, 0, 0x40, 0x20f5, NULL, 0); | 797 | reg_w(gspca_dev, 0, 0x40, 0x20f5, 0); |
| 788 | reg_w(dev, 0, 1, 0x20f4, NULL, 0); | 798 | reg_w(gspca_dev, 0, 1, 0x20f4, 0); |
| 789 | reg_w(dev, 0, 0x40, 0x20f6, NULL, 0); | 799 | reg_w(gspca_dev, 0, 0x40, 0x20f6, 0); |
| 790 | reg_w(dev, 0, 0, 0x2089, NULL, 0); | 800 | reg_w(gspca_dev, 0, 0, 0x2089, 0); |
| 791 | break; | 801 | break; |
| 792 | } | 802 | } |
| 793 | if (pollreg) | 803 | if (pollreg) |
| @@ -799,7 +809,6 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 799 | const struct usb_device_id *id) | 809 | const struct usb_device_id *id) |
| 800 | { | 810 | { |
| 801 | struct sd *sd = (struct sd *) gspca_dev; | 811 | struct sd *sd = (struct sd *) gspca_dev; |
| 802 | struct usb_device *dev = gspca_dev->dev; | ||
| 803 | struct cam *cam; | 812 | struct cam *cam; |
| 804 | 813 | ||
| 805 | cam = &gspca_dev->cam; | 814 | cam = &gspca_dev->cam; |
| @@ -811,7 +820,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 811 | if (sd->subtype == AiptekMiniPenCam13) { | 820 | if (sd->subtype == AiptekMiniPenCam13) { |
| 812 | /* try to get the firmware as some cam answer 2.0.1.2.2 | 821 | /* try to get the firmware as some cam answer 2.0.1.2.2 |
| 813 | * and should be a spca504b then overwrite that setting */ | 822 | * and should be a spca504b then overwrite that setting */ |
| 814 | reg_r(dev, 0x20, 0, gspca_dev->usb_buf, 1); | 823 | reg_r(gspca_dev, 0x20, 0, 1); |
| 815 | switch (gspca_dev->usb_buf[0]) { | 824 | switch (gspca_dev->usb_buf[0]) { |
| 816 | case 1: | 825 | case 1: |
| 817 | break; /* (right bridge/subtype) */ | 826 | break; /* (right bridge/subtype) */ |
| @@ -848,8 +857,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 848 | return 0; | 857 | return 0; |
| 849 | } | 858 | } |
| 850 | 859 | ||
| 851 | /* this function is called at open time */ | 860 | /* this function is called at probe and resume time */ |
| 852 | static int sd_open(struct gspca_dev *gspca_dev) | 861 | static int sd_init(struct gspca_dev *gspca_dev) |
| 853 | { | 862 | { |
| 854 | struct sd *sd = (struct sd *) gspca_dev; | 863 | struct sd *sd = (struct sd *) gspca_dev; |
| 855 | struct usb_device *dev = gspca_dev->dev; | 864 | struct usb_device *dev = gspca_dev->dev; |
| @@ -860,12 +869,12 @@ static int sd_open(struct gspca_dev *gspca_dev) | |||
| 860 | 869 | ||
| 861 | switch (sd->bridge) { | 870 | switch (sd->bridge) { |
| 862 | case BRIDGE_SPCA504B: | 871 | case BRIDGE_SPCA504B: |
| 863 | reg_w(dev, 0x1d, 0, 0, NULL, 0); | 872 | reg_w(gspca_dev, 0x1d, 0, 0, 0); |
| 864 | reg_w(dev, 0, 1, 0x2306, NULL, 0); | 873 | reg_w(gspca_dev, 0, 1, 0x2306, 0); |
| 865 | reg_w(dev, 0, 0, 0x0d04, NULL, 0); | 874 | reg_w(gspca_dev, 0, 0, 0x0d04, 0); |
| 866 | reg_w(dev, 0, 0, 0x2000, NULL, 0); | 875 | reg_w(gspca_dev, 0, 0, 0x2000, 0); |
| 867 | reg_w(dev, 0, 0x13, 0x2301, NULL, 0); | 876 | reg_w(gspca_dev, 0, 0x13, 0x2301, 0); |
| 868 | reg_w(dev, 0, 0, 0x2306, NULL, 0); | 877 | reg_w(gspca_dev, 0, 0, 0x2306, 0); |
| 869 | /* fall thru */ | 878 | /* fall thru */ |
| 870 | case BRIDGE_SPCA533: | 879 | case BRIDGE_SPCA533: |
| 871 | rc = spca504B_PollingDataReady(gspca_dev); | 880 | rc = spca504B_PollingDataReady(gspca_dev); |
| @@ -873,12 +882,12 @@ static int sd_open(struct gspca_dev *gspca_dev) | |||
| 873 | break; | 882 | break; |
| 874 | case BRIDGE_SPCA536: | 883 | case BRIDGE_SPCA536: |
| 875 | spca50x_GetFirmware(gspca_dev); | 884 | spca50x_GetFirmware(gspca_dev); |
| 876 | reg_r(dev, 0x00, 0x5002, gspca_dev->usb_buf, 1); | 885 | reg_r(gspca_dev, 0x00, 0x5002, 1); |
| 877 | gspca_dev->usb_buf[0] = 0; | 886 | gspca_dev->usb_buf[0] = 0; |
| 878 | reg_w(dev, 0x24, 0, 0, gspca_dev->usb_buf, 1); | 887 | reg_w(gspca_dev, 0x24, 0, 0, 1); |
| 879 | reg_r(dev, 0x24, 0, gspca_dev->usb_buf, 1); | 888 | reg_r(gspca_dev, 0x24, 0, 1); |
| 880 | rc = spca504B_PollingDataReady(gspca_dev); | 889 | rc = spca504B_PollingDataReady(gspca_dev); |
| 881 | reg_w(dev, 0x34, 0, 0, NULL, 0); | 890 | reg_w(gspca_dev, 0x34, 0, 0, 0); |
| 882 | spca504B_WaitCmdStatus(gspca_dev); | 891 | spca504B_WaitCmdStatus(gspca_dev); |
| 883 | break; | 892 | break; |
| 884 | case BRIDGE_SPCA504C: /* pccam600 */ | 893 | case BRIDGE_SPCA504C: /* pccam600 */ |
| @@ -971,12 +980,12 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 971 | /* case BRIDGE_SPCA536: */ | 980 | /* case BRIDGE_SPCA536: */ |
| 972 | if (sd->subtype == MegapixV4 || | 981 | if (sd->subtype == MegapixV4 || |
| 973 | sd->subtype == LogitechClickSmart820) { | 982 | sd->subtype == LogitechClickSmart820) { |
| 974 | reg_w(dev, 0xf0, 0, 0, NULL, 0); | 983 | reg_w(gspca_dev, 0xf0, 0, 0, 0); |
| 975 | spca504B_WaitCmdStatus(gspca_dev); | 984 | spca504B_WaitCmdStatus(gspca_dev); |
| 976 | reg_r(dev, 0xf0, 4, NULL, 0); | 985 | reg_r(gspca_dev, 0xf0, 4, 0); |
| 977 | spca504B_WaitCmdStatus(gspca_dev); | 986 | spca504B_WaitCmdStatus(gspca_dev); |
| 978 | } else { | 987 | } else { |
| 979 | reg_w(dev, 0x31, 0, 4, NULL, 0); | 988 | reg_w(gspca_dev, 0x31, 0, 4, 0); |
| 980 | spca504B_WaitCmdStatus(gspca_dev); | 989 | spca504B_WaitCmdStatus(gspca_dev); |
| 981 | rc = spca504B_PollingDataReady(gspca_dev); | 990 | rc = spca504B_PollingDataReady(gspca_dev); |
| 982 | } | 991 | } |
| @@ -1045,7 +1054,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 1045 | /* case BRIDGE_SPCA533: */ | 1054 | /* case BRIDGE_SPCA533: */ |
| 1046 | /* case BRIDGE_SPCA536: */ | 1055 | /* case BRIDGE_SPCA536: */ |
| 1047 | /* case BRIDGE_SPCA504B: */ | 1056 | /* case BRIDGE_SPCA504B: */ |
| 1048 | reg_w(dev, 0x31, 0, 0, NULL, 0); | 1057 | reg_w(gspca_dev, 0x31, 0, 0, 0); |
| 1049 | spca504B_WaitCmdStatus(gspca_dev); | 1058 | spca504B_WaitCmdStatus(gspca_dev); |
| 1050 | spca504B_PollingDataReady(gspca_dev); | 1059 | spca504B_PollingDataReady(gspca_dev); |
| 1051 | break; | 1060 | break; |
| @@ -1069,14 +1078,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 1069 | } | 1078 | } |
| 1070 | } | 1079 | } |
| 1071 | 1080 | ||
| 1072 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 1073 | { | ||
| 1074 | } | ||
| 1075 | |||
| 1076 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 1077 | { | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 1081 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 1081 | struct gspca_frame *frame, /* target */ | 1082 | struct gspca_frame *frame, /* target */ |
| 1082 | __u8 *data, /* isoc packet */ | 1083 | __u8 *data, /* isoc packet */ |
| @@ -1369,11 +1370,9 @@ static const struct sd_desc sd_desc = { | |||
| 1369 | .ctrls = sd_ctrls, | 1370 | .ctrls = sd_ctrls, |
| 1370 | .nctrls = ARRAY_SIZE(sd_ctrls), | 1371 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 1371 | .config = sd_config, | 1372 | .config = sd_config, |
| 1372 | .open = sd_open, | 1373 | .init = sd_init, |
| 1373 | .start = sd_start, | 1374 | .start = sd_start, |
| 1374 | .stopN = sd_stopN, | 1375 | .stopN = sd_stopN, |
| 1375 | .stop0 = sd_stop0, | ||
| 1376 | .close = sd_close, | ||
| 1377 | .pkt_scan = sd_pkt_scan, | 1376 | .pkt_scan = sd_pkt_scan, |
| 1378 | }; | 1377 | }; |
| 1379 | 1378 | ||
| @@ -1456,6 +1455,10 @@ static struct usb_driver sd_driver = { | |||
| 1456 | .id_table = device_table, | 1455 | .id_table = device_table, |
| 1457 | .probe = sd_probe, | 1456 | .probe = sd_probe, |
| 1458 | .disconnect = gspca_disconnect, | 1457 | .disconnect = gspca_disconnect, |
| 1458 | #ifdef CONFIG_PM | ||
| 1459 | .suspend = gspca_suspend, | ||
| 1460 | .resume = gspca_resume, | ||
| 1461 | #endif | ||
| 1459 | }; | 1462 | }; |
| 1460 | 1463 | ||
| 1461 | /* -- module insert / remove -- */ | 1464 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 91b555c34c68..f034c748fc7e 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | #define MAX_GAMMA 0x10 /* 0 to 15 */ | 31 | #define MAX_GAMMA 0x10 /* 0 to 15 */ |
| 32 | 32 | ||
| 33 | #define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 3) | 33 | #define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 0) |
| 34 | 34 | ||
| 35 | MODULE_AUTHOR("Leandro Costantino <le_costantino@pixartargentina.com.ar>"); | 35 | MODULE_AUTHOR("Leandro Costantino <le_costantino@pixartargentina.com.ar>"); |
| 36 | MODULE_DESCRIPTION("GSPCA/T613 (JPEG Compliance) USB Camera Driver"); | 36 | MODULE_DESCRIPTION("GSPCA/T613 (JPEG Compliance) USB Camera Driver"); |
| @@ -233,7 +233,7 @@ static char *effects_control[] = { | |||
| 233 | static struct v4l2_pix_format vga_mode_t16[] = { | 233 | static struct v4l2_pix_format vga_mode_t16[] = { |
| 234 | {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | 234 | {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
| 235 | .bytesperline = 160, | 235 | .bytesperline = 160, |
| 236 | .sizeimage = 160 * 120 * 3 / 8 + 590, | 236 | .sizeimage = 160 * 120 * 4 / 8 + 590, |
| 237 | .colorspace = V4L2_COLORSPACE_JPEG, | 237 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 238 | .priv = 4}, | 238 | .priv = 4}, |
| 239 | {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | 239 | {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
| @@ -391,7 +391,7 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
| 391 | NULL, 0, 500); | 391 | NULL, 0, 500); |
| 392 | return; | 392 | return; |
| 393 | } | 393 | } |
| 394 | if (len <= sizeof gspca_dev->usb_buf) { | 394 | if (len <= USB_BUF_SZ) { |
| 395 | memcpy(gspca_dev->usb_buf, buffer, len); | 395 | memcpy(gspca_dev->usb_buf, buffer, len); |
| 396 | usb_control_msg(gspca_dev->dev, | 396 | usb_control_msg(gspca_dev->dev, |
| 397 | usb_sndctrlpipe(gspca_dev->dev, 0), | 397 | usb_sndctrlpipe(gspca_dev->dev, 0), |
| @@ -552,6 +552,13 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) | |||
| 552 | return 0; | 552 | return 0; |
| 553 | } | 553 | } |
| 554 | 554 | ||
| 555 | /* this function is called at probe and resume time */ | ||
| 556 | static int sd_init(struct gspca_dev *gspca_dev) | ||
| 557 | { | ||
| 558 | init_default_parameters(gspca_dev); | ||
| 559 | return 0; | ||
| 560 | } | ||
| 561 | |||
| 555 | static void setbrightness(struct gspca_dev *gspca_dev) | 562 | static void setbrightness(struct gspca_dev *gspca_dev) |
| 556 | { | 563 | { |
| 557 | struct sd *sd = (struct sd *) gspca_dev; | 564 | struct sd *sd = (struct sd *) gspca_dev; |
| @@ -893,18 +900,6 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 893 | setcolors(gspca_dev); | 900 | setcolors(gspca_dev); |
| 894 | } | 901 | } |
| 895 | 902 | ||
| 896 | static void sd_stopN(struct gspca_dev *gspca_dev) | ||
| 897 | { | ||
| 898 | } | ||
| 899 | |||
| 900 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 901 | { | ||
| 902 | } | ||
| 903 | |||
| 904 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 905 | { | ||
| 906 | } | ||
| 907 | |||
| 908 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 903 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 909 | struct gspca_frame *frame, /* target */ | 904 | struct gspca_frame *frame, /* target */ |
| 910 | __u8 *data, /* isoc packet */ | 905 | __u8 *data, /* isoc packet */ |
| @@ -972,24 +967,14 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, | |||
| 972 | return -EINVAL; | 967 | return -EINVAL; |
| 973 | } | 968 | } |
| 974 | 969 | ||
| 975 | /* this function is called at open time */ | ||
| 976 | static int sd_open(struct gspca_dev *gspca_dev) | ||
| 977 | { | ||
| 978 | init_default_parameters(gspca_dev); | ||
| 979 | return 0; | ||
| 980 | } | ||
| 981 | |||
| 982 | /* sub-driver description */ | 970 | /* sub-driver description */ |
| 983 | static const struct sd_desc sd_desc = { | 971 | static const struct sd_desc sd_desc = { |
| 984 | .name = MODULE_NAME, | 972 | .name = MODULE_NAME, |
| 985 | .ctrls = sd_ctrls, | 973 | .ctrls = sd_ctrls, |
| 986 | .nctrls = ARRAY_SIZE(sd_ctrls), | 974 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 987 | .config = sd_config, | 975 | .config = sd_config, |
| 988 | .open = sd_open, | 976 | .init = sd_init, |
| 989 | .start = sd_start, | 977 | .start = sd_start, |
| 990 | .stopN = sd_stopN, | ||
| 991 | .stop0 = sd_stop0, | ||
| 992 | .close = sd_close, | ||
| 993 | .pkt_scan = sd_pkt_scan, | 978 | .pkt_scan = sd_pkt_scan, |
| 994 | .querymenu = sd_querymenu, | 979 | .querymenu = sd_querymenu, |
| 995 | }; | 980 | }; |
| @@ -1014,6 +999,10 @@ static struct usb_driver sd_driver = { | |||
| 1014 | .id_table = device_table, | 999 | .id_table = device_table, |
| 1015 | .probe = sd_probe, | 1000 | .probe = sd_probe, |
| 1016 | .disconnect = gspca_disconnect, | 1001 | .disconnect = gspca_disconnect, |
| 1002 | #ifdef CONFIG_PM | ||
| 1003 | .suspend = gspca_suspend, | ||
| 1004 | .resume = gspca_resume, | ||
| 1005 | #endif | ||
| 1017 | }; | 1006 | }; |
| 1018 | 1007 | ||
| 1019 | /* -- module insert / remove -- */ | 1008 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c index 1ff8ba2f7fe5..084af05302a0 100644 --- a/drivers/media/video/gspca/tv8532.c +++ b/drivers/media/video/gspca/tv8532.c | |||
| @@ -331,8 +331,8 @@ static void tv_8532_PollReg(struct gspca_dev *gspca_dev) | |||
| 331 | } | 331 | } |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | /* this function is called at open time */ | 334 | /* this function is called at probe and resume time */ |
| 335 | static int sd_open(struct gspca_dev *gspca_dev) | 335 | static int sd_init(struct gspca_dev *gspca_dev) |
| 336 | { | 336 | { |
| 337 | reg_w_1(gspca_dev, TV8532_AD_SLOPE, 0x32); | 337 | reg_w_1(gspca_dev, TV8532_AD_SLOPE, 0x32); |
| 338 | reg_w_1(gspca_dev, TV8532_AD_BITCTRL, 0x00); | 338 | reg_w_1(gspca_dev, TV8532_AD_BITCTRL, 0x00); |
| @@ -450,14 +450,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 450 | reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0b); | 450 | reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0b); |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | static void sd_stop0(struct gspca_dev *gspca_dev) | ||
| 454 | { | ||
| 455 | } | ||
| 456 | |||
| 457 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 458 | { | ||
| 459 | } | ||
| 460 | |||
| 461 | static void tv8532_preprocess(struct gspca_dev *gspca_dev) | 453 | static void tv8532_preprocess(struct gspca_dev *gspca_dev) |
| 462 | { | 454 | { |
| 463 | struct sd *sd = (struct sd *) gspca_dev; | 455 | struct sd *sd = (struct sd *) gspca_dev; |
| @@ -611,11 +603,9 @@ static const struct sd_desc sd_desc = { | |||
| 611 | .ctrls = sd_ctrls, | 603 | .ctrls = sd_ctrls, |
| 612 | .nctrls = ARRAY_SIZE(sd_ctrls), | 604 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 613 | .config = sd_config, | 605 | .config = sd_config, |
| 614 | .open = sd_open, | 606 | .init = sd_init, |
| 615 | .start = sd_start, | 607 | .start = sd_start, |
| 616 | .stopN = sd_stopN, | 608 | .stopN = sd_stopN, |
| 617 | .stop0 = sd_stop0, | ||
| 618 | .close = sd_close, | ||
| 619 | .pkt_scan = sd_pkt_scan, | 609 | .pkt_scan = sd_pkt_scan, |
| 620 | }; | 610 | }; |
| 621 | 611 | ||
| @@ -644,6 +634,10 @@ static struct usb_driver sd_driver = { | |||
| 644 | .id_table = device_table, | 634 | .id_table = device_table, |
| 645 | .probe = sd_probe, | 635 | .probe = sd_probe, |
| 646 | .disconnect = gspca_disconnect, | 636 | .disconnect = gspca_disconnect, |
| 637 | #ifdef CONFIG_PM | ||
| 638 | .suspend = gspca_suspend, | ||
| 639 | .resume = gspca_resume, | ||
| 640 | #endif | ||
| 647 | }; | 641 | }; |
| 648 | 642 | ||
| 649 | /* -- module insert / remove -- */ | 643 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index f4a52956e0d9..bd4c226c9a07 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c | |||
| @@ -69,6 +69,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 69 | .set = sd_setautogain, | 69 | .set = sd_setautogain, |
| 70 | .get = sd_getautogain, | 70 | .get = sd_getautogain, |
| 71 | }, | 71 | }, |
| 72 | #define LIGHTFREQ_IDX 1 | ||
| 72 | { | 73 | { |
| 73 | { | 74 | { |
| 74 | .id = V4L2_CID_POWER_LINE_FREQUENCY, | 75 | .id = V4L2_CID_POWER_LINE_FREQUENCY, |
| @@ -87,12 +88,12 @@ static struct ctrl sd_ctrls[] = { | |||
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | static struct v4l2_pix_format vc0321_mode[] = { | 90 | static struct v4l2_pix_format vc0321_mode[] = { |
| 90 | {320, 240, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE, | 91 | {320, 240, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE, |
| 91 | .bytesperline = 320, | 92 | .bytesperline = 320, |
| 92 | .sizeimage = 320 * 240 * 2, | 93 | .sizeimage = 320 * 240 * 2, |
| 93 | .colorspace = V4L2_COLORSPACE_SRGB, | 94 | .colorspace = V4L2_COLORSPACE_SRGB, |
| 94 | .priv = 1}, | 95 | .priv = 1}, |
| 95 | {640, 480, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE, | 96 | {640, 480, V4L2_PIX_FMT_YVYU, V4L2_FIELD_NONE, |
| 96 | .bytesperline = 640, | 97 | .bytesperline = 640, |
| 97 | .sizeimage = 640 * 480 * 2, | 98 | .sizeimage = 640 * 480 * 2, |
| 98 | .colorspace = V4L2_COLORSPACE_SRGB, | 99 | .colorspace = V4L2_COLORSPACE_SRGB, |
| @@ -1463,6 +1464,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 1463 | sd->qindex = 7; | 1464 | sd->qindex = 7; |
| 1464 | sd->autogain = AUTOGAIN_DEF; | 1465 | sd->autogain = AUTOGAIN_DEF; |
| 1465 | sd->lightfreq = FREQ_DEF; | 1466 | sd->lightfreq = FREQ_DEF; |
| 1467 | if (sd->sensor != SENSOR_OV7670) | ||
| 1468 | gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX); | ||
| 1466 | 1469 | ||
| 1467 | if (sd->bridge == BRIDGE_VC0321) { | 1470 | if (sd->bridge == BRIDGE_VC0321) { |
| 1468 | reg_r(gspca_dev, 0x8a, 0, 3); | 1471 | reg_r(gspca_dev, 0x8a, 0, 3); |
| @@ -1474,8 +1477,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 1474 | return 0; | 1477 | return 0; |
| 1475 | } | 1478 | } |
| 1476 | 1479 | ||
| 1477 | /* this function is called at open time */ | 1480 | /* this function is called at probe and time */ |
| 1478 | static int sd_open(struct gspca_dev *gspca_dev) | 1481 | static int sd_init(struct gspca_dev *gspca_dev) |
| 1479 | { | 1482 | { |
| 1480 | return 0; | 1483 | return 0; |
| 1481 | } | 1484 | } |
| @@ -1637,19 +1640,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev) | |||
| 1637 | reg_w(dev, 0x89, 0xffff, 0xffff); | 1640 | reg_w(dev, 0x89, 0xffff, 0xffff); |
| 1638 | } | 1641 | } |
| 1639 | 1642 | ||
| 1640 | /* this function is called at close time */ | ||
| 1641 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 1642 | { | ||
| 1643 | /* struct usb_device *dev = gspca_dev->dev; | ||
| 1644 | __u8 buffread; | ||
| 1645 | |||
| 1646 | reg_w(dev, 0x89, 0xffff, 0xffff); | ||
| 1647 | reg_w(dev, 0xa0, 0x01, 0xb301); | ||
| 1648 | reg_w(dev, 0xa0, 0x09, 0xb303); | ||
| 1649 | reg_w(dev, 0x89, 0xffff, 0xffff); | ||
| 1650 | */ | ||
| 1651 | } | ||
| 1652 | |||
| 1653 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 1643 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 1654 | struct gspca_frame *frame, /* target */ | 1644 | struct gspca_frame *frame, /* target */ |
| 1655 | __u8 *data, /* isoc packet */ | 1645 | __u8 *data, /* isoc packet */ |
| @@ -1738,11 +1728,10 @@ static const struct sd_desc sd_desc = { | |||
| 1738 | .ctrls = sd_ctrls, | 1728 | .ctrls = sd_ctrls, |
| 1739 | .nctrls = ARRAY_SIZE(sd_ctrls), | 1729 | .nctrls = ARRAY_SIZE(sd_ctrls), |
| 1740 | .config = sd_config, | 1730 | .config = sd_config, |
| 1741 | .open = sd_open, | 1731 | .init = sd_init, |
| 1742 | .start = sd_start, | 1732 | .start = sd_start, |
| 1743 | .stopN = sd_stopN, | 1733 | .stopN = sd_stopN, |
| 1744 | .stop0 = sd_stop0, | 1734 | .stop0 = sd_stop0, |
| 1745 | .close = sd_close, | ||
| 1746 | .pkt_scan = sd_pkt_scan, | 1735 | .pkt_scan = sd_pkt_scan, |
| 1747 | .querymenu = sd_querymenu, | 1736 | .querymenu = sd_querymenu, |
| 1748 | }; | 1737 | }; |
| @@ -1774,6 +1763,10 @@ static struct usb_driver sd_driver = { | |||
| 1774 | .id_table = device_table, | 1763 | .id_table = device_table, |
| 1775 | .probe = sd_probe, | 1764 | .probe = sd_probe, |
| 1776 | .disconnect = gspca_disconnect, | 1765 | .disconnect = gspca_disconnect, |
| 1766 | #ifdef CONFIG_PM | ||
| 1767 | .suspend = gspca_suspend, | ||
| 1768 | .resume = gspca_resume, | ||
| 1769 | #endif | ||
| 1777 | }; | 1770 | }; |
| 1778 | 1771 | ||
| 1779 | /* -- module insert / remove -- */ | 1772 | /* -- module insert / remove -- */ |
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index bc7d0eedcd81..8d7c27e6ac77 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c | |||
| @@ -85,6 +85,7 @@ static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); | |||
| 85 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); | 85 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); |
| 86 | 86 | ||
| 87 | static struct ctrl sd_ctrls[] = { | 87 | static struct ctrl sd_ctrls[] = { |
| 88 | #define BRIGHTNESS_IDX 0 | ||
| 88 | #define SD_BRIGHTNESS 0 | 89 | #define SD_BRIGHTNESS 0 |
| 89 | { | 90 | { |
| 90 | { | 91 | { |
| @@ -141,6 +142,7 @@ static struct ctrl sd_ctrls[] = { | |||
| 141 | .set = sd_setautogain, | 142 | .set = sd_setautogain, |
| 142 | .get = sd_getautogain, | 143 | .get = sd_getautogain, |
| 143 | }, | 144 | }, |
| 145 | #define LIGHTFREQ_IDX 4 | ||
| 144 | #define SD_FREQ 4 | 146 | #define SD_FREQ 4 |
| 145 | { | 147 | { |
| 146 | { | 148 | { |
| @@ -6964,8 +6966,13 @@ static int zcxx_probeSensor(struct gspca_dev *gspca_dev) | |||
| 6964 | case SENSOR_MC501CB: | 6966 | case SENSOR_MC501CB: |
| 6965 | return -1; /* don't probe */ | 6967 | return -1; /* don't probe */ |
| 6966 | case SENSOR_TAS5130C_VF0250: | 6968 | case SENSOR_TAS5130C_VF0250: |
| 6967 | /* may probe but with write in reg 0x0010 */ | 6969 | /* may probe but with no write in reg 0x0010 */ |
| 6968 | return -1; /* don't probe */ | 6970 | return -1; /* don't probe */ |
| 6971 | case SENSOR_PAS106: | ||
| 6972 | sensor = sif_probe(gspca_dev); | ||
| 6973 | if (sensor >= 0) | ||
| 6974 | return sensor; | ||
| 6975 | break; | ||
| 6969 | } | 6976 | } |
| 6970 | sensor = vga_2wr_probe(gspca_dev); | 6977 | sensor = vga_2wr_probe(gspca_dev); |
| 6971 | if (sensor >= 0) { | 6978 | if (sensor >= 0) { |
| @@ -6974,12 +6981,10 @@ static int zcxx_probeSensor(struct gspca_dev *gspca_dev) | |||
| 6974 | /* next probe is needed for OmniVision ? */ | 6981 | /* next probe is needed for OmniVision ? */ |
| 6975 | } | 6982 | } |
| 6976 | sensor2 = vga_3wr_probe(gspca_dev); | 6983 | sensor2 = vga_3wr_probe(gspca_dev); |
| 6977 | if (sensor2 >= 0) { | 6984 | if (sensor2 >= 0 |
| 6978 | if (sensor >= 0) | 6985 | && sensor >= 0) |
| 6979 | return sensor; | 6986 | return sensor; |
| 6980 | return sensor2; | 6987 | return sensor2; |
| 6981 | } | ||
| 6982 | return sif_probe(gspca_dev); | ||
| 6983 | } | 6988 | } |
| 6984 | 6989 | ||
| 6985 | /* this function is called at probe time */ | 6990 | /* this function is called at probe time */ |
| @@ -7147,13 +7152,27 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 7147 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; | 7152 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; |
| 7148 | sd->sharpness = sd_ctrls[SD_SHARPNESS].qctrl.default_value; | 7153 | sd->sharpness = sd_ctrls[SD_SHARPNESS].qctrl.default_value; |
| 7149 | 7154 | ||
| 7155 | switch (sd->sensor) { | ||
| 7156 | case SENSOR_GC0305: | ||
| 7157 | case SENSOR_OV7620: | ||
| 7158 | case SENSOR_PO2030: | ||
| 7159 | gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX); | ||
| 7160 | break; | ||
| 7161 | case SENSOR_HDCS2020: | ||
| 7162 | case SENSOR_HV7131B: | ||
| 7163 | case SENSOR_HV7131C: | ||
| 7164 | case SENSOR_OV7630C: | ||
| 7165 | gspca_dev->ctrl_dis = (1 << LIGHTFREQ_IDX); | ||
| 7166 | break; | ||
| 7167 | } | ||
| 7168 | |||
| 7150 | /* switch the led off */ | 7169 | /* switch the led off */ |
| 7151 | reg_w(gspca_dev->dev, 0x01, 0x0000); | 7170 | reg_w(gspca_dev->dev, 0x01, 0x0000); |
| 7152 | return 0; | 7171 | return 0; |
| 7153 | } | 7172 | } |
| 7154 | 7173 | ||
| 7155 | /* this function is called at open time */ | 7174 | /* this function is called at probe and resume time */ |
| 7156 | static int sd_open(struct gspca_dev *gspca_dev) | 7175 | static int sd_init(struct gspca_dev *gspca_dev) |
| 7157 | { | 7176 | { |
| 7158 | reg_w(gspca_dev->dev, 0x01, 0x0000); | 7177 | reg_w(gspca_dev->dev, 0x01, 0x0000); |
| 7159 | return 0; | 7178 | return 0; |
| @@ -7314,10 +7333,6 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
| 7314 | } | 7333 | } |
| 7315 | } | 7334 | } |
| 7316 | 7335 | ||
| 7317 | static void sd_stopN(struct gspca_dev *gspca_dev) | ||
| 7318 | { | ||
| 7319 | } | ||
| 7320 | |||
| 7321 | static void sd_stop0(struct gspca_dev *gspca_dev) | 7336 | static void sd_stop0(struct gspca_dev *gspca_dev) |
| 7322 | { | 7337 | { |
| 7323 | struct sd *sd = (struct sd *) gspca_dev; | 7338 | struct sd *sd = (struct sd *) gspca_dev; |
| @@ -7325,11 +7340,6 @@ static void sd_stop0(struct gspca_dev *gspca_dev) | |||
| 7325 | send_unknown(gspca_dev->dev, sd->sensor); | 7340 | send_unknown(gspca_dev->dev, sd->sensor); |
| 7326 | } | 7341 | } |
| 7327 | 7342 | ||
| 7328 | /* this function is called at close time */ | ||
| 7329 | static void sd_close(struct gspca_dev *gspca_dev) | ||
| 7330 | { | ||
| 7331 | } | ||
| 7332 | |||
| 7333 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 7343 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
| 7334 | struct gspca_frame *frame, | 7344 | struct gspca_frame *frame, |
| 7335 | __u8 *data, | 7345 | __u8 *data, |
| @@ -7489,37 +7499,30 @@ static const struct sd_desc sd_desc = { | |||
| 7489 | .ctrls = sd_ctrls, | 7499 | .ctrls = sd_ctrls, |
| 7490 | .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0], | 7500 | .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0], |
| 7491 | .config = sd_config, | 7501 | .config = sd_config, |
| 7492 | .open = sd_open, | 7502 | .init = sd_init, |
| 7493 | .start = sd_start, | 7503 | .start = sd_start, |
| 7494 | .stopN = sd_stopN, | ||
| 7495 | .stop0 = sd_stop0, | 7504 | .stop0 = sd_stop0, |
| 7496 | .close = sd_close, | ||
| 7497 | .pkt_scan = sd_pkt_scan, | 7505 | .pkt_scan = sd_pkt_scan, |
| 7498 | .querymenu = sd_querymenu, | 7506 | .querymenu = sd_querymenu, |
| 7499 | }; | 7507 | }; |
| 7500 | 7508 | ||
| 7501 | static const __devinitdata struct usb_device_id device_table[] = { | 7509 | static const __devinitdata struct usb_device_id device_table[] = { |
| 7502 | {USB_DEVICE(0x041e, 0x041e)}, | 7510 | {USB_DEVICE(0x041e, 0x041e)}, |
| 7503 | #ifndef CONFIG_USB_ZC0301 | ||
| 7504 | {USB_DEVICE(0x041e, 0x4017)}, | 7511 | {USB_DEVICE(0x041e, 0x4017)}, |
| 7505 | {USB_DEVICE(0x041e, 0x401c)}, | 7512 | {USB_DEVICE(0x041e, 0x401c), .driver_info = SENSOR_PAS106}, |
| 7506 | {USB_DEVICE(0x041e, 0x401e)}, | 7513 | {USB_DEVICE(0x041e, 0x401e)}, |
| 7507 | {USB_DEVICE(0x041e, 0x401f)}, | 7514 | {USB_DEVICE(0x041e, 0x401f)}, |
| 7508 | #endif | 7515 | {USB_DEVICE(0x041e, 0x4022)}, |
| 7509 | {USB_DEVICE(0x041e, 0x4029)}, | 7516 | {USB_DEVICE(0x041e, 0x4029)}, |
| 7510 | #ifndef CONFIG_USB_ZC0301 | 7517 | {USB_DEVICE(0x041e, 0x4034), .driver_info = SENSOR_PAS106}, |
| 7511 | {USB_DEVICE(0x041e, 0x4034)}, | 7518 | {USB_DEVICE(0x041e, 0x4035), .driver_info = SENSOR_PAS106}, |
| 7512 | {USB_DEVICE(0x041e, 0x4035)}, | ||
| 7513 | {USB_DEVICE(0x041e, 0x4036)}, | 7519 | {USB_DEVICE(0x041e, 0x4036)}, |
| 7514 | {USB_DEVICE(0x041e, 0x403a)}, | 7520 | {USB_DEVICE(0x041e, 0x403a)}, |
| 7515 | #endif | ||
| 7516 | {USB_DEVICE(0x041e, 0x4051), .driver_info = SENSOR_TAS5130C_VF0250}, | 7521 | {USB_DEVICE(0x041e, 0x4051), .driver_info = SENSOR_TAS5130C_VF0250}, |
| 7517 | {USB_DEVICE(0x041e, 0x4053), .driver_info = SENSOR_TAS5130C_VF0250}, | 7522 | {USB_DEVICE(0x041e, 0x4053), .driver_info = SENSOR_TAS5130C_VF0250}, |
| 7518 | #ifndef CONFIG_USB_ZC0301 | ||
| 7519 | {USB_DEVICE(0x0458, 0x7007)}, | 7523 | {USB_DEVICE(0x0458, 0x7007)}, |
| 7520 | {USB_DEVICE(0x0458, 0x700c)}, | 7524 | {USB_DEVICE(0x0458, 0x700c)}, |
| 7521 | {USB_DEVICE(0x0458, 0x700f)}, | 7525 | {USB_DEVICE(0x0458, 0x700f)}, |
| 7522 | #endif | ||
| 7523 | {USB_DEVICE(0x0461, 0x0a00)}, | 7526 | {USB_DEVICE(0x0461, 0x0a00)}, |
| 7524 | {USB_DEVICE(0x046d, 0x08a0)}, | 7527 | {USB_DEVICE(0x046d, 0x08a0)}, |
| 7525 | {USB_DEVICE(0x046d, 0x08a1)}, | 7528 | {USB_DEVICE(0x046d, 0x08a1)}, |
| @@ -7531,7 +7534,7 @@ static const __devinitdata struct usb_device_id device_table[] = { | |||
| 7531 | {USB_DEVICE(0x046d, 0x08aa)}, | 7534 | {USB_DEVICE(0x046d, 0x08aa)}, |
| 7532 | {USB_DEVICE(0x046d, 0x08ac)}, | 7535 | {USB_DEVICE(0x046d, 0x08ac)}, |
| 7533 | {USB_DEVICE(0x046d, 0x08ad)}, | 7536 | {USB_DEVICE(0x046d, 0x08ad)}, |
| 7534 | #ifndef CONFIG_USB_ZC0301 | 7537 | #if !defined CONFIG_USB_ZC0301 && !defined CONFIG_USB_ZC0301_MODULE |
| 7535 | {USB_DEVICE(0x046d, 0x08ae)}, | 7538 | {USB_DEVICE(0x046d, 0x08ae)}, |
| 7536 | #endif | 7539 | #endif |
| 7537 | {USB_DEVICE(0x046d, 0x08af)}, | 7540 | {USB_DEVICE(0x046d, 0x08af)}, |
| @@ -7541,27 +7544,25 @@ static const __devinitdata struct usb_device_id device_table[] = { | |||
| 7541 | {USB_DEVICE(0x046d, 0x08d8)}, | 7544 | {USB_DEVICE(0x046d, 0x08d8)}, |
| 7542 | {USB_DEVICE(0x046d, 0x08da)}, | 7545 | {USB_DEVICE(0x046d, 0x08da)}, |
| 7543 | {USB_DEVICE(0x046d, 0x08dd), .driver_info = SENSOR_MC501CB}, | 7546 | {USB_DEVICE(0x046d, 0x08dd), .driver_info = SENSOR_MC501CB}, |
| 7544 | {USB_DEVICE(0x0471, 0x0325)}, | 7547 | {USB_DEVICE(0x0471, 0x0325), .driver_info = SENSOR_PAS106}, |
| 7545 | {USB_DEVICE(0x0471, 0x0326)}, | 7548 | {USB_DEVICE(0x0471, 0x0326), .driver_info = SENSOR_PAS106}, |
| 7546 | {USB_DEVICE(0x0471, 0x032d)}, | 7549 | {USB_DEVICE(0x0471, 0x032d), .driver_info = SENSOR_PAS106}, |
| 7547 | {USB_DEVICE(0x0471, 0x032e)}, | 7550 | {USB_DEVICE(0x0471, 0x032e), .driver_info = SENSOR_PAS106}, |
| 7548 | {USB_DEVICE(0x055f, 0xc005)}, | 7551 | {USB_DEVICE(0x055f, 0xc005)}, |
| 7549 | #ifndef CONFIG_USB_ZC0301 | ||
| 7550 | {USB_DEVICE(0x055f, 0xd003)}, | 7552 | {USB_DEVICE(0x055f, 0xd003)}, |
| 7551 | {USB_DEVICE(0x055f, 0xd004)}, | 7553 | {USB_DEVICE(0x055f, 0xd004)}, |
| 7552 | #endif | ||
| 7553 | {USB_DEVICE(0x0698, 0x2003)}, | 7554 | {USB_DEVICE(0x0698, 0x2003)}, |
| 7555 | {USB_DEVICE(0x0ac8, 0x0301), .driver_info = SENSOR_PAS106}, | ||
| 7554 | {USB_DEVICE(0x0ac8, 0x0302)}, | 7556 | {USB_DEVICE(0x0ac8, 0x0302)}, |
| 7555 | #ifndef CONFIG_USB_ZC0301 | ||
| 7556 | {USB_DEVICE(0x0ac8, 0x301b)}, | 7557 | {USB_DEVICE(0x0ac8, 0x301b)}, |
| 7558 | #if !defined CONFIG_USB_ZC0301 && !defined CONFIG_USB_ZC0301_MODULE | ||
| 7557 | {USB_DEVICE(0x0ac8, 0x303b)}, | 7559 | {USB_DEVICE(0x0ac8, 0x303b)}, |
| 7558 | #endif | 7560 | #endif |
| 7559 | {USB_DEVICE(0x0ac8, 0x305b), .driver_info = SENSOR_TAS5130C_VF0250}, | 7561 | {USB_DEVICE(0x0ac8, 0x305b), .driver_info = SENSOR_TAS5130C_VF0250}, |
| 7560 | #ifndef CONFIG_USB_ZC0301 | ||
| 7561 | {USB_DEVICE(0x0ac8, 0x307b)}, | 7562 | {USB_DEVICE(0x0ac8, 0x307b)}, |
| 7562 | {USB_DEVICE(0x10fd, 0x0128)}, | 7563 | {USB_DEVICE(0x10fd, 0x0128)}, |
| 7564 | {USB_DEVICE(0x10fd, 0x804d)}, | ||
| 7563 | {USB_DEVICE(0x10fd, 0x8050)}, | 7565 | {USB_DEVICE(0x10fd, 0x8050)}, |
| 7564 | #endif | ||
| 7565 | {} /* end of entry */ | 7566 | {} /* end of entry */ |
| 7566 | }; | 7567 | }; |
| 7567 | #undef DVNAME | 7568 | #undef DVNAME |
| @@ -7581,6 +7582,10 @@ static struct usb_driver sd_driver = { | |||
| 7581 | .id_table = device_table, | 7582 | .id_table = device_table, |
| 7582 | .probe = sd_probe, | 7583 | .probe = sd_probe, |
| 7583 | .disconnect = gspca_disconnect, | 7584 | .disconnect = gspca_disconnect, |
| 7585 | #ifdef CONFIG_PM | ||
| 7586 | .suspend = gspca_suspend, | ||
| 7587 | .resume = gspca_resume, | ||
| 7588 | #endif | ||
| 7584 | }; | 7589 | }; |
| 7585 | 7590 | ||
| 7586 | static int __init sd_mod_init(void) | 7591 | static int __init sd_mod_init(void) |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index aea1664948ce..4afc7ea07e86 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
| @@ -688,7 +688,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) | |||
| 688 | spin_lock_init(&itv->lock); | 688 | spin_lock_init(&itv->lock); |
| 689 | spin_lock_init(&itv->dma_reg_lock); | 689 | spin_lock_init(&itv->dma_reg_lock); |
| 690 | 690 | ||
| 691 | itv->irq_work_queues = create_workqueue(itv->name); | 691 | itv->irq_work_queues = create_singlethread_workqueue(itv->name); |
| 692 | if (itv->irq_work_queues == NULL) { | 692 | if (itv->irq_work_queues == NULL) { |
| 693 | IVTV_ERR("Could not create ivtv workqueue\n"); | 693 | IVTV_ERR("Could not create ivtv workqueue\n"); |
| 694 | return -1; | 694 | return -1; |
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index ab287b48fc2b..2ceb5227637c 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
| @@ -251,6 +251,7 @@ struct ivtv_mailbox_data { | |||
| 251 | #define IVTV_F_I_DEC_PAUSED 20 /* the decoder is paused */ | 251 | #define IVTV_F_I_DEC_PAUSED 20 /* the decoder is paused */ |
| 252 | #define IVTV_F_I_INITED 21 /* set after first open */ | 252 | #define IVTV_F_I_INITED 21 /* set after first open */ |
| 253 | #define IVTV_F_I_FAILED 22 /* set if first open failed */ | 253 | #define IVTV_F_I_FAILED 22 /* set if first open failed */ |
| 254 | #define IVTV_F_I_WORK_INITED 23 /* worker thread was initialized */ | ||
| 254 | 255 | ||
| 255 | /* Event notifications */ | 256 | /* Event notifications */ |
| 256 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ | 257 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ |
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index fba150a6cd23..34f3ab827858 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c | |||
| @@ -76,6 +76,13 @@ void ivtv_irq_work_handler(struct work_struct *work) | |||
| 76 | 76 | ||
| 77 | DEFINE_WAIT(wait); | 77 | DEFINE_WAIT(wait); |
| 78 | 78 | ||
| 79 | if (test_and_clear_bit(IVTV_F_I_WORK_INITED, &itv->i_flags)) { | ||
| 80 | struct sched_param param = { .sched_priority = 99 }; | ||
| 81 | |||
| 82 | /* This thread must use the FIFO scheduler as it | ||
| 83 | is realtime sensitive. */ | ||
| 84 | sched_setscheduler(current, SCHED_FIFO, ¶m); | ||
| 85 | } | ||
| 79 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags)) | 86 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags)) |
| 80 | ivtv_pio_work_handler(itv); | 87 | ivtv_pio_work_handler(itv); |
| 81 | 88 | ||
| @@ -678,34 +685,14 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv) | |||
| 678 | 685 | ||
| 679 | static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) | 686 | static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) |
| 680 | { | 687 | { |
| 681 | struct ivtv_stream *s_mpg = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG]; | ||
| 682 | u32 data[CX2341X_MBOX_MAX_DATA]; | 688 | u32 data[CX2341X_MBOX_MAX_DATA]; |
| 683 | struct ivtv_stream *s; | 689 | struct ivtv_stream *s; |
| 684 | 690 | ||
| 685 | IVTV_DEBUG_HI_IRQ("ENC START VBI CAP\n"); | 691 | IVTV_DEBUG_HI_IRQ("ENC START VBI CAP\n"); |
| 686 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | 692 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; |
| 687 | 693 | ||
| 688 | /* If more than two VBI buffers are pending, then | 694 | if (!stream_enc_dma_append(s, data)) |
| 689 | clear the old ones and start with this new one. | ||
| 690 | This can happen during transition stages when MPEG capturing is | ||
| 691 | started, but the first interrupts haven't arrived yet. During | ||
| 692 | that period VBI requests can accumulate without being able to | ||
| 693 | DMA the data. Since at most four VBI DMA buffers are available, | ||
| 694 | we just drop the old requests when there are already three | ||
| 695 | requests queued. */ | ||
| 696 | if (s->sg_pending_size > 2) { | ||
| 697 | struct ivtv_buffer *buf; | ||
| 698 | list_for_each_entry(buf, &s->q_predma.list, list) | ||
| 699 | ivtv_buf_sync_for_cpu(s, buf); | ||
| 700 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_free, 0); | ||
| 701 | s->sg_pending_size = 0; | ||
| 702 | } | ||
| 703 | /* if we can append the data, and the MPEG stream isn't capturing, | ||
| 704 | then start a DMA request for just the VBI data. */ | ||
| 705 | if (!stream_enc_dma_append(s, data) && | ||
| 706 | !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) { | ||
| 707 | set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); | 695 | set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); |
| 708 | } | ||
| 709 | } | 696 | } |
| 710 | 697 | ||
| 711 | static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv) | 698 | static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv) |
diff --git a/drivers/media/video/ivtv/ivtv-queue.h b/drivers/media/video/ivtv/ivtv-queue.h index 7cfc0c9ab050..476556afd39a 100644 --- a/drivers/media/video/ivtv/ivtv-queue.h +++ b/drivers/media/video/ivtv/ivtv-queue.h | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | #define IVTV_QUEUE_H | 23 | #define IVTV_QUEUE_H |
| 24 | 24 | ||
| 25 | #define IVTV_DMA_UNMAPPED ((u32) -1) | 25 | #define IVTV_DMA_UNMAPPED ((u32) -1) |
| 26 | #define SLICED_VBI_PIO 1 | 26 | #define SLICED_VBI_PIO 0 |
| 27 | 27 | ||
| 28 | /* ivtv_buffer utility functions */ | 28 | /* ivtv_buffer utility functions */ |
| 29 | 29 | ||
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 54d2023b26c4..730e85d86fc8 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
| @@ -363,7 +363,7 @@ static void ivtv_vbi_setup(struct ivtv *itv) | |||
| 363 | /* Every X number of frames a VBI interrupt arrives (frames as in 25 or 30 fps) */ | 363 | /* Every X number of frames a VBI interrupt arrives (frames as in 25 or 30 fps) */ |
| 364 | data[1] = 1; | 364 | data[1] = 1; |
| 365 | /* The VBI frames are stored in a ringbuffer with this size (with a VBI frame as unit) */ | 365 | /* The VBI frames are stored in a ringbuffer with this size (with a VBI frame as unit) */ |
| 366 | data[2] = raw ? 4 : 8; | 366 | data[2] = raw ? 4 : 4 * (itv->vbi.raw_size / itv->vbi.enc_size); |
| 367 | /* The start/stop codes determine which VBI lines end up in the raw VBI data area. | 367 | /* The start/stop codes determine which VBI lines end up in the raw VBI data area. |
| 368 | The codes are from table 24 in the saa7115 datasheet. Each raw/sliced/video line | 368 | The codes are from table 24 in the saa7115 datasheet. Each raw/sliced/video line |
| 369 | is framed with codes FF0000XX where XX is the SAV/EAV (Start/End of Active Video) | 369 | is framed with codes FF0000XX where XX is the SAV/EAV (Start/End of Active Video) |
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index 71798f0da27f..1ce9deb1104f 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c | |||
| @@ -293,6 +293,7 @@ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8 | |||
| 293 | u32 line_size = itv->vbi.sliced_decoder_line_size; | 293 | u32 line_size = itv->vbi.sliced_decoder_line_size; |
| 294 | struct v4l2_decode_vbi_line vbi; | 294 | struct v4l2_decode_vbi_line vbi; |
| 295 | int i; | 295 | int i; |
| 296 | unsigned lines = 0; | ||
| 296 | 297 | ||
| 297 | /* find the first valid line */ | 298 | /* find the first valid line */ |
| 298 | for (i = 0; i < size; i++, buf++) { | 299 | for (i = 0; i < size; i++, buf++) { |
| @@ -313,7 +314,8 @@ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8 | |||
| 313 | } | 314 | } |
| 314 | vbi.p = p + 4; | 315 | vbi.p = p + 4; |
| 315 | itv->video_dec_func(itv, VIDIOC_INT_DECODE_VBI_LINE, &vbi); | 316 | itv->video_dec_func(itv, VIDIOC_INT_DECODE_VBI_LINE, &vbi); |
| 316 | if (vbi.type) { | 317 | if (vbi.type && !(lines & (1 << vbi.line))) { |
| 318 | lines |= 1 << vbi.line; | ||
| 317 | itv->vbi.sliced_data[line].id = vbi.type; | 319 | itv->vbi.sliced_data[line].id = vbi.type; |
| 318 | itv->vbi.sliced_data[line].field = vbi.is_second_field; | 320 | itv->vbi.sliced_data[line].field = vbi.is_second_field; |
| 319 | itv->vbi.sliced_data[line].line = vbi.line; | 321 | itv->vbi.sliced_data[line].line = vbi.line; |
diff --git a/drivers/media/video/ivtv/ivtv-version.h b/drivers/media/video/ivtv/ivtv-version.h index 442f43f11b73..8cd753d30bf7 100644 --- a/drivers/media/video/ivtv/ivtv-version.h +++ b/drivers/media/video/ivtv/ivtv-version.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #define IVTV_DRIVER_NAME "ivtv" | 23 | #define IVTV_DRIVER_NAME "ivtv" |
| 24 | #define IVTV_DRIVER_VERSION_MAJOR 1 | 24 | #define IVTV_DRIVER_VERSION_MAJOR 1 |
| 25 | #define IVTV_DRIVER_VERSION_MINOR 3 | 25 | #define IVTV_DRIVER_VERSION_MINOR 4 |
| 26 | #define IVTV_DRIVER_VERSION_PATCHLEVEL 0 | 26 | #define IVTV_DRIVER_VERSION_PATCHLEVEL 0 |
| 27 | 27 | ||
| 28 | #define IVTV_VERSION __stringify(IVTV_DRIVER_VERSION_MAJOR) "." __stringify(IVTV_DRIVER_VERSION_MINOR) "." __stringify(IVTV_DRIVER_VERSION_PATCHLEVEL) | 28 | #define IVTV_VERSION __stringify(IVTV_DRIVER_VERSION_MAJOR) "." __stringify(IVTV_DRIVER_VERSION_MINOR) "." __stringify(IVTV_DRIVER_VERSION_PATCHLEVEL) |
diff --git a/drivers/media/video/ks0127.c b/drivers/media/video/ks0127.c index 4895540be195..2fd4b4a44aa9 100644 --- a/drivers/media/video/ks0127.c +++ b/drivers/media/video/ks0127.c | |||
| @@ -679,26 +679,27 @@ static int ks0127_command(struct i2c_client *client, | |||
| 679 | 679 | ||
| 680 | case DECODER_ENABLE_OUTPUT: | 680 | case DECODER_ENABLE_OUTPUT: |
| 681 | { | 681 | { |
| 682 | int enable; | ||
| 682 | 683 | ||
| 683 | int *iarg = arg; | 684 | iarg = arg; |
| 684 | int enable = (*iarg != 0); | 685 | enable = (*iarg != 0); |
| 685 | if (enable) { | 686 | if (enable) { |
| 686 | dprintk("ks0127: command " | 687 | dprintk("ks0127: command " |
| 687 | "DECODER_ENABLE_OUTPUT on " | 688 | "DECODER_ENABLE_OUTPUT on " |
| 688 | "(%d)\n", enable); | 689 | "(%d)\n", enable); |
| 689 | /* All output pins on */ | 690 | /* All output pins on */ |
| 690 | ks0127_and_or(ks, KS_OFMTA, 0xcf, 0x30); | 691 | ks0127_and_or(ks, KS_OFMTA, 0xcf, 0x30); |
| 691 | /* Obey the OEN pin */ | 692 | /* Obey the OEN pin */ |
| 692 | ks0127_and_or(ks, KS_CDEM, 0x7f, 0x00); | 693 | ks0127_and_or(ks, KS_CDEM, 0x7f, 0x00); |
| 693 | } else { | 694 | } else { |
| 694 | dprintk("ks0127: command " | 695 | dprintk("ks0127: command " |
| 695 | "DECODER_ENABLE_OUTPUT off " | 696 | "DECODER_ENABLE_OUTPUT off " |
| 696 | "(%d)\n", enable); | 697 | "(%d)\n", enable); |
| 697 | /* Video output pins off */ | 698 | /* Video output pins off */ |
| 698 | ks0127_and_or(ks, KS_OFMTA, 0xcf, 0x00); | 699 | ks0127_and_or(ks, KS_OFMTA, 0xcf, 0x00); |
| 699 | /* Ignore the OEN pin */ | 700 | /* Ignore the OEN pin */ |
| 700 | ks0127_and_or(ks, KS_CDEM, 0x7f, 0x80); | 701 | ks0127_and_or(ks, KS_CDEM, 0x7f, 0x80); |
| 701 | } | 702 | } |
| 702 | } | 703 | } |
| 703 | break; | 704 | break; |
| 704 | 705 | ||
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 7c8ef6ac6c39..a9ef7802eb5f 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c | |||
| @@ -1806,6 +1806,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev, | |||
| 1806 | memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); | 1806 | memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); |
| 1807 | meye.video_dev->parent = &meye.mchip_dev->dev; | 1807 | meye.video_dev->parent = &meye.mchip_dev->dev; |
| 1808 | 1808 | ||
| 1809 | ret = -EIO; | ||
| 1809 | if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) { | 1810 | if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) { |
| 1810 | printk(KERN_ERR "meye: unable to power on the camera\n"); | 1811 | printk(KERN_ERR "meye: unable to power on the camera\n"); |
| 1811 | printk(KERN_ERR "meye: did you enable the camera in " | 1812 | printk(KERN_ERR "meye: did you enable the camera in " |
| @@ -1813,7 +1814,6 @@ static int __devinit meye_probe(struct pci_dev *pcidev, | |||
| 1813 | goto outsonypienable; | 1814 | goto outsonypienable; |
| 1814 | } | 1815 | } |
| 1815 | 1816 | ||
| 1816 | ret = -EIO; | ||
| 1817 | if ((ret = pci_enable_device(meye.mchip_dev))) { | 1817 | if ((ret = pci_enable_device(meye.mchip_dev))) { |
| 1818 | printk(KERN_ERR "meye: pci_enable_device failed\n"); | 1818 | printk(KERN_ERR "meye: pci_enable_device failed\n"); |
| 1819 | goto outenabledev; | 1819 | goto outenabledev; |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index f68e91fbe7fb..8ef578caba3b 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
| @@ -931,27 +931,29 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
| 931 | return 0; | 931 | return 0; |
| 932 | } | 932 | } |
| 933 | 933 | ||
| 934 | static int std_callback(struct saa7146_dev* dev, struct saa7146_standard *std) | 934 | static int std_callback(struct saa7146_dev *dev, struct saa7146_standard *standard) |
| 935 | { | 935 | { |
| 936 | struct mxb* mxb = (struct mxb*)dev->ext_priv; | 936 | struct mxb *mxb = (struct mxb *)dev->ext_priv; |
| 937 | int zero = 0; | 937 | int zero = 0; |
| 938 | int one = 1; | 938 | int one = 1; |
| 939 | 939 | ||
| 940 | if(V4L2_STD_PAL_I == std->id ) { | 940 | if (V4L2_STD_PAL_I == standard->id) { |
| 941 | v4l2_std_id std = V4L2_STD_PAL_I; | 941 | v4l2_std_id std = V4L2_STD_PAL_I; |
| 942 | |||
| 942 | DEB_D(("VIDIOC_S_STD: setting mxb for PAL_I.\n")); | 943 | DEB_D(("VIDIOC_S_STD: setting mxb for PAL_I.\n")); |
| 943 | /* set the 7146 gpio register -- I don't know what this does exactly */ | 944 | /* set the 7146 gpio register -- I don't know what this does exactly */ |
| 944 | saa7146_write(dev, GPIO_CTRL, 0x00404050); | 945 | saa7146_write(dev, GPIO_CTRL, 0x00404050); |
| 945 | /* unset the 7111 gpio register -- I don't know what this does exactly */ | 946 | /* unset the 7111 gpio register -- I don't know what this does exactly */ |
| 946 | mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &zero); | 947 | mxb->saa7111a->driver->command(mxb->saa7111a, DECODER_SET_GPIO, &zero); |
| 947 | mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); | 948 | mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); |
| 948 | } else { | 949 | } else { |
| 949 | v4l2_std_id std = V4L2_STD_PAL_BG; | 950 | v4l2_std_id std = V4L2_STD_PAL_BG; |
| 951 | |||
| 950 | DEB_D(("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM.\n")); | 952 | DEB_D(("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM.\n")); |
| 951 | /* set the 7146 gpio register -- I don't know what this does exactly */ | 953 | /* set the 7146 gpio register -- I don't know what this does exactly */ |
| 952 | saa7146_write(dev, GPIO_CTRL, 0x00404050); | 954 | saa7146_write(dev, GPIO_CTRL, 0x00404050); |
| 953 | /* set the 7111 gpio register -- I don't know what this does exactly */ | 955 | /* set the 7111 gpio register -- I don't know what this does exactly */ |
| 954 | mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &one); | 956 | mxb->saa7111a->driver->command(mxb->saa7111a, DECODER_SET_GPIO, &one); |
| 955 | mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); | 957 | mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); |
| 956 | } | 958 | } |
| 957 | return 0; | 959 | return 0; |
diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index 9edaca4371d7..3d3c48db45d9 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c | |||
| @@ -626,9 +626,9 @@ ov511_i2c_write_internal(struct usb_ov511 *ov, | |||
| 626 | break; | 626 | break; |
| 627 | 627 | ||
| 628 | /* Retry until idle */ | 628 | /* Retry until idle */ |
| 629 | do | 629 | do { |
| 630 | rc = reg_r(ov, R511_I2C_CTL); | 630 | rc = reg_r(ov, R511_I2C_CTL); |
| 631 | while (rc > 0 && ((rc&1) == 0)); | 631 | } while (rc > 0 && ((rc&1) == 0)); |
| 632 | if (rc < 0) | 632 | if (rc < 0) |
| 633 | break; | 633 | break; |
| 634 | 634 | ||
| @@ -703,9 +703,9 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg) | |||
| 703 | return rc; | 703 | return rc; |
| 704 | 704 | ||
| 705 | /* Retry until idle */ | 705 | /* Retry until idle */ |
| 706 | do | 706 | do { |
| 707 | rc = reg_r(ov, R511_I2C_CTL); | 707 | rc = reg_r(ov, R511_I2C_CTL); |
| 708 | while (rc > 0 && ((rc&1) == 0)); | 708 | } while (rc > 0 && ((rc & 1) == 0)); |
| 709 | if (rc < 0) | 709 | if (rc < 0) |
| 710 | return rc; | 710 | return rc; |
| 711 | 711 | ||
| @@ -729,9 +729,9 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg) | |||
| 729 | return rc; | 729 | return rc; |
| 730 | 730 | ||
| 731 | /* Retry until idle */ | 731 | /* Retry until idle */ |
| 732 | do | 732 | do { |
| 733 | rc = reg_r(ov, R511_I2C_CTL); | 733 | rc = reg_r(ov, R511_I2C_CTL); |
| 734 | while (rc > 0 && ((rc&1) == 0)); | 734 | } while (rc > 0 && ((rc&1) == 0)); |
| 735 | if (rc < 0) | 735 | if (rc < 0) |
| 736 | return rc; | 736 | return rc; |
| 737 | 737 | ||
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 00425d743656..7c84f795db54 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
| @@ -1019,10 +1019,23 @@ static int init_mediavision(void) | |||
| 1019 | * Initialization and module stuff | 1019 | * Initialization and module stuff |
| 1020 | */ | 1020 | */ |
| 1021 | 1021 | ||
| 1022 | #ifndef MODULE | ||
| 1023 | static int enable; | ||
| 1024 | module_param(enable, int, 0); | ||
| 1025 | #endif | ||
| 1026 | |||
| 1022 | static int __init init_pms_cards(void) | 1027 | static int __init init_pms_cards(void) |
| 1023 | { | 1028 | { |
| 1024 | printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); | 1029 | printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); |
| 1025 | 1030 | ||
| 1031 | #ifndef MODULE | ||
| 1032 | if (!enable) { | ||
| 1033 | printk(KERN_INFO "PMS: not enabled, use pms.enable=1 to " | ||
| 1034 | "probe\n"); | ||
| 1035 | return -ENODEV; | ||
| 1036 | } | ||
| 1037 | #endif | ||
| 1038 | |||
| 1026 | data_port = io_port +1; | 1039 | data_port = io_port +1; |
| 1027 | 1040 | ||
| 1028 | if(init_mediavision()) | 1041 | if(init_mediavision()) |
diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 1cccd5c77048..dbc560742553 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c | |||
| @@ -1635,15 +1635,15 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
| 1635 | 1635 | ||
| 1636 | case VIDIOCPWCGVIDCMD: | 1636 | case VIDIOCPWCGVIDCMD: |
| 1637 | { | 1637 | { |
| 1638 | ARG_DEF(struct pwc_video_command, cmd); | 1638 | ARG_DEF(struct pwc_video_command, vcmd); |
| 1639 | 1639 | ||
| 1640 | ARGR(cmd).type = pdev->type; | 1640 | ARGR(vcmd).type = pdev->type; |
| 1641 | ARGR(cmd).release = pdev->release; | 1641 | ARGR(vcmd).release = pdev->release; |
| 1642 | ARGR(cmd).command_len = pdev->cmd_len; | 1642 | ARGR(vcmd).command_len = pdev->cmd_len; |
| 1643 | memcpy(&ARGR(cmd).command_buf, pdev->cmd_buf, pdev->cmd_len); | 1643 | memcpy(&ARGR(vcmd).command_buf, pdev->cmd_buf, pdev->cmd_len); |
| 1644 | ARGR(cmd).bandlength = pdev->vbandlength; | 1644 | ARGR(vcmd).bandlength = pdev->vbandlength; |
| 1645 | ARGR(cmd).frame_size = pdev->frame_size; | 1645 | ARGR(vcmd).frame_size = pdev->frame_size; |
| 1646 | ARG_OUT(cmd) | 1646 | ARG_OUT(vcmd) |
| 1647 | break; | 1647 | break; |
| 1648 | } | 1648 | } |
| 1649 | /* | 1649 | /* |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index bcd1c8f6cf6b..ad733caec720 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
| @@ -1489,10 +1489,9 @@ static int saa7115_probe(struct i2c_client *client, | |||
| 1489 | client->addr << 1, client->adapter->name); | 1489 | client->addr << 1, client->adapter->name); |
| 1490 | 1490 | ||
| 1491 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); | 1491 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); |
| 1492 | i2c_set_clientdata(client, state); | 1492 | if (state == NULL) |
| 1493 | if (state == NULL) { | ||
| 1494 | return -ENOMEM; | 1493 | return -ENOMEM; |
| 1495 | } | 1494 | i2c_set_clientdata(client, state); |
| 1496 | state->input = -1; | 1495 | state->input = -1; |
| 1497 | state->output = SAA7115_IPORT_ON; | 1496 | state->output = SAA7115_IPORT_ON; |
| 1498 | state->enable = 1; | 1497 | state->enable = 1; |
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index f481277892da..acceed5d04ae 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c | |||
| @@ -1397,7 +1397,7 @@ static int se401_probe(struct usb_interface *intf, | |||
| 1397 | mutex_init(&se401->lock); | 1397 | mutex_init(&se401->lock); |
| 1398 | wmb(); | 1398 | wmb(); |
| 1399 | 1399 | ||
| 1400 | if (video_register_device(&se401->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 1400 | if (video_register_device(&se401->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { |
| 1401 | kfree(se401); | 1401 | kfree(se401); |
| 1402 | err("video_register_device failed"); | 1402 | err("video_register_device failed"); |
| 1403 | return -EIO; | 1403 | return -EIO; |
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 23408764d0ef..2da6938718f2 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
| @@ -3312,6 +3312,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
| 3312 | cam->v4ldev->fops = &sn9c102_fops; | 3312 | cam->v4ldev->fops = &sn9c102_fops; |
| 3313 | cam->v4ldev->minor = video_nr[dev_nr]; | 3313 | cam->v4ldev->minor = video_nr[dev_nr]; |
| 3314 | cam->v4ldev->release = video_device_release; | 3314 | cam->v4ldev->release = video_device_release; |
| 3315 | cam->v4ldev->parent = &udev->dev; | ||
| 3315 | 3316 | ||
| 3316 | init_completion(&cam->probe); | 3317 | init_completion(&cam->probe); |
| 3317 | 3318 | ||
diff --git a/drivers/media/video/sn9c102/sn9c102_devtable.h b/drivers/media/video/sn9c102/sn9c102_devtable.h index 6ff489baacf3..90a401dc3884 100644 --- a/drivers/media/video/sn9c102/sn9c102_devtable.h +++ b/drivers/media/video/sn9c102/sn9c102_devtable.h | |||
| @@ -40,11 +40,14 @@ struct sn9c102_device; | |||
| 40 | 40 | ||
| 41 | static const struct usb_device_id sn9c102_id_table[] = { | 41 | static const struct usb_device_id sn9c102_id_table[] = { |
| 42 | /* SN9C101 and SN9C102 */ | 42 | /* SN9C101 and SN9C102 */ |
| 43 | #if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE | ||
| 43 | { SN9C102_USB_DEVICE(0x0c45, 0x6001, BRIDGE_SN9C102), }, | 44 | { SN9C102_USB_DEVICE(0x0c45, 0x6001, BRIDGE_SN9C102), }, |
| 44 | { SN9C102_USB_DEVICE(0x0c45, 0x6005, BRIDGE_SN9C102), }, | 45 | { SN9C102_USB_DEVICE(0x0c45, 0x6005, BRIDGE_SN9C102), }, |
| 46 | #endif | ||
| 45 | { SN9C102_USB_DEVICE(0x0c45, 0x6007, BRIDGE_SN9C102), }, | 47 | { SN9C102_USB_DEVICE(0x0c45, 0x6007, BRIDGE_SN9C102), }, |
| 46 | { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), }, | 48 | { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), }, |
| 47 | { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), }, | 49 | { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), }, |
| 50 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, OV6650 */ | ||
| 48 | { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), }, | 51 | { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), }, |
| 49 | { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), }, | 52 | { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), }, |
| 50 | { SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), }, | 53 | { SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), }, |
| @@ -53,29 +56,33 @@ static const struct usb_device_id sn9c102_id_table[] = { | |||
| 53 | { SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), }, | 56 | { SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), }, |
| 54 | { SN9C102_USB_DEVICE(0x0c45, 0x602b, BRIDGE_SN9C102), }, | 57 | { SN9C102_USB_DEVICE(0x0c45, 0x602b, BRIDGE_SN9C102), }, |
| 55 | { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), }, | 58 | { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), }, |
| 56 | { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, | 59 | /* { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, HV7131R */ |
| 57 | { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), }, | 60 | { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), }, |
| 58 | { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), }, | 61 | { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), }, |
| 59 | /* SN9C103 */ | 62 | /* SN9C103 */ |
| 60 | { SN9C102_USB_DEVICE(0x0c45, 0x6080, BRIDGE_SN9C103), }, | 63 | { SN9C102_USB_DEVICE(0x0c45, 0x6080, BRIDGE_SN9C103), }, |
| 61 | { SN9C102_USB_DEVICE(0x0c45, 0x6082, BRIDGE_SN9C103), }, | 64 | { SN9C102_USB_DEVICE(0x0c45, 0x6082, BRIDGE_SN9C103), }, |
| 62 | { SN9C102_USB_DEVICE(0x0c45, 0x6083, BRIDGE_SN9C103), }, | 65 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6083, BRIDGE_SN9C103), }, HY7131D/E */ |
| 63 | { SN9C102_USB_DEVICE(0x0c45, 0x6088, BRIDGE_SN9C103), }, | 66 | { SN9C102_USB_DEVICE(0x0c45, 0x6088, BRIDGE_SN9C103), }, |
| 64 | { SN9C102_USB_DEVICE(0x0c45, 0x608a, BRIDGE_SN9C103), }, | 67 | { SN9C102_USB_DEVICE(0x0c45, 0x608a, BRIDGE_SN9C103), }, |
| 65 | { SN9C102_USB_DEVICE(0x0c45, 0x608b, BRIDGE_SN9C103), }, | 68 | { SN9C102_USB_DEVICE(0x0c45, 0x608b, BRIDGE_SN9C103), }, |
| 66 | { SN9C102_USB_DEVICE(0x0c45, 0x608c, BRIDGE_SN9C103), }, | 69 | { SN9C102_USB_DEVICE(0x0c45, 0x608c, BRIDGE_SN9C103), }, |
| 67 | { SN9C102_USB_DEVICE(0x0c45, 0x608e, BRIDGE_SN9C103), }, | 70 | /* { SN9C102_USB_DEVICE(0x0c45, 0x608e, BRIDGE_SN9C103), }, CISVF10 */ |
| 71 | #if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE | ||
| 68 | { SN9C102_USB_DEVICE(0x0c45, 0x608f, BRIDGE_SN9C103), }, | 72 | { SN9C102_USB_DEVICE(0x0c45, 0x608f, BRIDGE_SN9C103), }, |
| 73 | #endif | ||
| 69 | { SN9C102_USB_DEVICE(0x0c45, 0x60a0, BRIDGE_SN9C103), }, | 74 | { SN9C102_USB_DEVICE(0x0c45, 0x60a0, BRIDGE_SN9C103), }, |
| 70 | { SN9C102_USB_DEVICE(0x0c45, 0x60a2, BRIDGE_SN9C103), }, | 75 | { SN9C102_USB_DEVICE(0x0c45, 0x60a2, BRIDGE_SN9C103), }, |
| 71 | { SN9C102_USB_DEVICE(0x0c45, 0x60a3, BRIDGE_SN9C103), }, | 76 | { SN9C102_USB_DEVICE(0x0c45, 0x60a3, BRIDGE_SN9C103), }, |
| 72 | { SN9C102_USB_DEVICE(0x0c45, 0x60a8, BRIDGE_SN9C103), }, | 77 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60a8, BRIDGE_SN9C103), }, PAS106 */ |
| 73 | { SN9C102_USB_DEVICE(0x0c45, 0x60aa, BRIDGE_SN9C103), }, | 78 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60aa, BRIDGE_SN9C103), }, TAS5130 */ |
| 74 | { SN9C102_USB_DEVICE(0x0c45, 0x60ab, BRIDGE_SN9C103), }, | 79 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ab, BRIDGE_SN9C103), }, TAS5130 */ |
| 75 | { SN9C102_USB_DEVICE(0x0c45, 0x60ac, BRIDGE_SN9C103), }, | 80 | { SN9C102_USB_DEVICE(0x0c45, 0x60ac, BRIDGE_SN9C103), }, |
| 76 | { SN9C102_USB_DEVICE(0x0c45, 0x60ae, BRIDGE_SN9C103), }, | 81 | { SN9C102_USB_DEVICE(0x0c45, 0x60ae, BRIDGE_SN9C103), }, |
| 77 | { SN9C102_USB_DEVICE(0x0c45, 0x60af, BRIDGE_SN9C103), }, | 82 | { SN9C102_USB_DEVICE(0x0c45, 0x60af, BRIDGE_SN9C103), }, |
| 83 | #if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE | ||
| 78 | { SN9C102_USB_DEVICE(0x0c45, 0x60b0, BRIDGE_SN9C103), }, | 84 | { SN9C102_USB_DEVICE(0x0c45, 0x60b0, BRIDGE_SN9C103), }, |
| 85 | #endif | ||
| 79 | { SN9C102_USB_DEVICE(0x0c45, 0x60b2, BRIDGE_SN9C103), }, | 86 | { SN9C102_USB_DEVICE(0x0c45, 0x60b2, BRIDGE_SN9C103), }, |
| 80 | { SN9C102_USB_DEVICE(0x0c45, 0x60b3, BRIDGE_SN9C103), }, | 87 | { SN9C102_USB_DEVICE(0x0c45, 0x60b3, BRIDGE_SN9C103), }, |
| 81 | { SN9C102_USB_DEVICE(0x0c45, 0x60b8, BRIDGE_SN9C103), }, | 88 | { SN9C102_USB_DEVICE(0x0c45, 0x60b8, BRIDGE_SN9C103), }, |
| @@ -105,7 +112,7 @@ static const struct usb_device_id sn9c102_id_table[] = { | |||
| 105 | { SN9C102_USB_DEVICE(0x0c45, 0x6108, BRIDGE_SN9C120), }, | 112 | { SN9C102_USB_DEVICE(0x0c45, 0x6108, BRIDGE_SN9C120), }, |
| 106 | { SN9C102_USB_DEVICE(0x0c45, 0x610f, BRIDGE_SN9C120), }, | 113 | { SN9C102_USB_DEVICE(0x0c45, 0x610f, BRIDGE_SN9C120), }, |
| 107 | { SN9C102_USB_DEVICE(0x0c45, 0x6130, BRIDGE_SN9C120), }, | 114 | { SN9C102_USB_DEVICE(0x0c45, 0x6130, BRIDGE_SN9C120), }, |
| 108 | { SN9C102_USB_DEVICE(0x0c45, 0x6138, BRIDGE_SN9C120), }, | 115 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6138, BRIDGE_SN9C120), }, MO8000 */ |
| 109 | { SN9C102_USB_DEVICE(0x0c45, 0x613a, BRIDGE_SN9C120), }, | 116 | { SN9C102_USB_DEVICE(0x0c45, 0x613a, BRIDGE_SN9C120), }, |
| 110 | { SN9C102_USB_DEVICE(0x0c45, 0x613b, BRIDGE_SN9C120), }, | 117 | { SN9C102_USB_DEVICE(0x0c45, 0x613b, BRIDGE_SN9C120), }, |
| 111 | { SN9C102_USB_DEVICE(0x0c45, 0x613c, BRIDGE_SN9C120), }, | 118 | { SN9C102_USB_DEVICE(0x0c45, 0x613c, BRIDGE_SN9C120), }, |
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index 56dc3d6b5b29..dce947439459 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c | |||
| @@ -1462,7 +1462,7 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id | |||
| 1462 | mutex_init (&stv680->lock); | 1462 | mutex_init (&stv680->lock); |
| 1463 | wmb (); | 1463 | wmb (); |
| 1464 | 1464 | ||
| 1465 | if (video_register_device (stv680->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 1465 | if (video_register_device(stv680->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { |
| 1466 | PDEBUG (0, "STV(e): video_register_device failed"); | 1466 | PDEBUG (0, "STV(e): video_register_device failed"); |
| 1467 | retval = -EIO; | 1467 | retval = -EIO; |
| 1468 | goto error_vdev; | 1468 | goto error_vdev; |
diff --git a/drivers/media/video/usbvideo/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c index 59166b760104..cc27efe121dd 100644 --- a/drivers/media/video/usbvideo/ibmcam.c +++ b/drivers/media/video/usbvideo/ibmcam.c | |||
| @@ -736,12 +736,12 @@ static enum ParseState ibmcam_model2_320x240_parse_lines( | |||
| 736 | * make black color and quit the horizontal scanning loop. | 736 | * make black color and quit the horizontal scanning loop. |
| 737 | */ | 737 | */ |
| 738 | if (((frame->curline + 2) >= scanHeight) || (i >= scanLength)) { | 738 | if (((frame->curline + 2) >= scanHeight) || (i >= scanLength)) { |
| 739 | const int j = i * V4L_BYTES_PER_PIXEL; | 739 | const int offset = i * V4L_BYTES_PER_PIXEL; |
| 740 | #if USES_IBMCAM_PUTPIXEL | 740 | #if USES_IBMCAM_PUTPIXEL |
| 741 | /* Refresh 'f' because we don't use it much with PUTPIXEL */ | 741 | /* Refresh 'f' because we don't use it much with PUTPIXEL */ |
| 742 | f = frame->data + (v4l_linesize * frame->curline) + j; | 742 | f = frame->data + (v4l_linesize * frame->curline) + offset; |
| 743 | #endif | 743 | #endif |
| 744 | memset(f, 0, v4l_linesize - j); | 744 | memset(f, 0, v4l_linesize - offset); |
| 745 | break; | 745 | break; |
| 746 | } | 746 | } |
| 747 | 747 | ||
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index b7792451a299..2eb45829791c 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
| @@ -866,7 +866,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) | |||
| 866 | cam->udev = dev; | 866 | cam->udev = dev; |
| 867 | cam->bulkEndpoint = bulkEndpoint; | 867 | cam->bulkEndpoint = bulkEndpoint; |
| 868 | 868 | ||
| 869 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, -1) == -1) { | 869 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, -1) < 0) { |
| 870 | kfree(cam); | 870 | kfree(cam); |
| 871 | printk(KERN_WARNING "video_register_device failed\n"); | 871 | printk(KERN_WARNING "video_register_device failed\n"); |
| 872 | return -EIO; | 872 | return -EIO; |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 6f36006aecda..155fdec9ac7d 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
| @@ -257,6 +257,9 @@ int video_register_device_index(struct video_device *vfd, int type, int nr, | |||
| 257 | int ret; | 257 | int ret; |
| 258 | char *name_base; | 258 | char *name_base; |
| 259 | 259 | ||
| 260 | if (vfd == NULL) | ||
| 261 | return -EINVAL; | ||
| 262 | |||
| 260 | switch (type) { | 263 | switch (type) { |
| 261 | case VFL_TYPE_GRABBER: | 264 | case VFL_TYPE_GRABBER: |
| 262 | base = MINOR_VFL_TYPE_GRABBER_MIN; | 265 | base = MINOR_VFL_TYPE_GRABBER_MIN; |
| @@ -281,7 +284,7 @@ int video_register_device_index(struct video_device *vfd, int type, int nr, | |||
| 281 | default: | 284 | default: |
| 282 | printk(KERN_ERR "%s called with unknown type: %d\n", | 285 | printk(KERN_ERR "%s called with unknown type: %d\n", |
| 283 | __func__, type); | 286 | __func__, type); |
| 284 | return -1; | 287 | return -EINVAL; |
| 285 | } | 288 | } |
| 286 | 289 | ||
| 287 | /* pick a minor number */ | 290 | /* pick a minor number */ |
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index fdfe7739c96e..140ef92c19c1 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
| @@ -499,7 +499,7 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd, | |||
| 499 | p->timestamp.tv_sec / 3600, | 499 | p->timestamp.tv_sec / 3600, |
| 500 | (int)(p->timestamp.tv_sec / 60) % 60, | 500 | (int)(p->timestamp.tv_sec / 60) % 60, |
| 501 | (int)(p->timestamp.tv_sec % 60), | 501 | (int)(p->timestamp.tv_sec % 60), |
| 502 | p->timestamp.tv_usec, | 502 | (long)p->timestamp.tv_usec, |
| 503 | p->index, | 503 | p->index, |
| 504 | prt_names(p->type, v4l2_type_names), | 504 | prt_names(p->type, v4l2_type_names), |
| 505 | p->bytesused, p->flags, | 505 | p->bytesused, p->flags, |
| @@ -674,7 +674,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
| 674 | __video_do_ioctl will be called again, with one or more | 674 | __video_do_ioctl will be called again, with one or more |
| 675 | V4L2 ioctls. | 675 | V4L2 ioctls. |
| 676 | ********************************************************/ | 676 | ********************************************************/ |
| 677 | if (_IOC_TYPE(cmd) == 'v') | 677 | if (_IOC_TYPE(cmd) == 'v' && _IOC_NR(cmd) < BASE_VIDIOCPRIVATE) |
| 678 | return v4l_compat_translate_ioctl(inode, file, cmd, arg, | 678 | return v4l_compat_translate_ioctl(inode, file, cmd, arg, |
| 679 | __video_do_ioctl); | 679 | __video_do_ioctl); |
| 680 | #endif | 680 | #endif |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 3518af071a2e..8ba8daafd7ea 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
| @@ -1021,13 +1021,13 @@ static int vivi_release(void) | |||
| 1021 | dev = list_entry(list, struct vivi_dev, vivi_devlist); | 1021 | dev = list_entry(list, struct vivi_dev, vivi_devlist); |
| 1022 | 1022 | ||
| 1023 | if (-1 != dev->vfd->minor) { | 1023 | if (-1 != dev->vfd->minor) { |
| 1024 | video_unregister_device(dev->vfd); | 1024 | printk(KERN_INFO "%s: unregistering /dev/video%d\n", |
| 1025 | printk(KERN_INFO "%s: /dev/video%d unregistered.\n", | ||
| 1026 | VIVI_MODULE_NAME, dev->vfd->minor); | 1025 | VIVI_MODULE_NAME, dev->vfd->minor); |
| 1026 | video_unregister_device(dev->vfd); | ||
| 1027 | } else { | 1027 | } else { |
| 1028 | video_device_release(dev->vfd); | 1028 | printk(KERN_INFO "%s: releasing /dev/video%d\n", |
| 1029 | printk(KERN_INFO "%s: /dev/video%d released.\n", | ||
| 1030 | VIVI_MODULE_NAME, dev->vfd->minor); | 1029 | VIVI_MODULE_NAME, dev->vfd->minor); |
| 1030 | video_device_release(dev->vfd); | ||
| 1031 | } | 1031 | } |
| 1032 | 1032 | ||
| 1033 | kfree(dev); | 1033 | kfree(dev); |
| @@ -1104,19 +1104,29 @@ static struct video_device vivi_template = { | |||
| 1104 | Initialization and module stuff | 1104 | Initialization and module stuff |
| 1105 | ------------------------------------------------------------------*/ | 1105 | ------------------------------------------------------------------*/ |
| 1106 | 1106 | ||
| 1107 | /* This routine allocates from 1 to n_devs virtual drivers. | ||
| 1108 | |||
| 1109 | The real maximum number of virtual drivers will depend on how many drivers | ||
| 1110 | will succeed. This is limited to the maximum number of devices that | ||
| 1111 | videodev supports. Since there are 64 minors for video grabbers, this is | ||
| 1112 | currently the theoretical maximum limit. However, a further limit does | ||
| 1113 | exist at videodev that forbids any driver to register more than 32 video | ||
| 1114 | grabbers. | ||
| 1115 | */ | ||
| 1107 | static int __init vivi_init(void) | 1116 | static int __init vivi_init(void) |
| 1108 | { | 1117 | { |
| 1109 | int ret = -ENOMEM, i; | 1118 | int ret = -ENOMEM, i; |
| 1110 | struct vivi_dev *dev; | 1119 | struct vivi_dev *dev; |
| 1111 | struct video_device *vfd; | 1120 | struct video_device *vfd; |
| 1112 | 1121 | ||
| 1122 | if (n_devs <= 0) | ||
| 1123 | n_devs = 1; | ||
| 1124 | |||
| 1113 | for (i = 0; i < n_devs; i++) { | 1125 | for (i = 0; i < n_devs; i++) { |
| 1114 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 1126 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 1115 | if (NULL == dev) | 1127 | if (!dev) |
| 1116 | break; | 1128 | break; |
| 1117 | 1129 | ||
| 1118 | list_add_tail(&dev->vivi_devlist, &vivi_devlist); | ||
| 1119 | |||
| 1120 | /* init video dma queues */ | 1130 | /* init video dma queues */ |
| 1121 | INIT_LIST_HEAD(&dev->vidq.active); | 1131 | INIT_LIST_HEAD(&dev->vidq.active); |
| 1122 | init_waitqueue_head(&dev->vidq.wq); | 1132 | init_waitqueue_head(&dev->vidq.wq); |
| @@ -1126,14 +1136,27 @@ static int __init vivi_init(void) | |||
| 1126 | mutex_init(&dev->mutex); | 1136 | mutex_init(&dev->mutex); |
| 1127 | 1137 | ||
| 1128 | vfd = video_device_alloc(); | 1138 | vfd = video_device_alloc(); |
| 1129 | if (NULL == vfd) | 1139 | if (!vfd) { |
| 1140 | kfree(dev); | ||
| 1130 | break; | 1141 | break; |
| 1142 | } | ||
| 1131 | 1143 | ||
| 1132 | *vfd = vivi_template; | 1144 | *vfd = vivi_template; |
| 1133 | 1145 | ||
| 1134 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); | 1146 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); |
| 1135 | if (ret < 0) | 1147 | if (ret < 0) { |
| 1148 | video_device_release(vfd); | ||
| 1149 | kfree(dev); | ||
| 1150 | |||
| 1151 | /* If some registers succeeded, keep driver */ | ||
| 1152 | if (i) | ||
| 1153 | ret = 0; | ||
| 1154 | |||
| 1136 | break; | 1155 | break; |
| 1156 | } | ||
| 1157 | |||
| 1158 | /* Now that everything is fine, let's add it to device list */ | ||
| 1159 | list_add_tail(&dev->vivi_devlist, &vivi_devlist); | ||
| 1137 | 1160 | ||
| 1138 | snprintf(vfd->name, sizeof(vfd->name), "%s (%i)", | 1161 | snprintf(vfd->name, sizeof(vfd->name), "%s (%i)", |
| 1139 | vivi_template.name, vfd->minor); | 1162 | vivi_template.name, vfd->minor); |
| @@ -1149,11 +1172,16 @@ static int __init vivi_init(void) | |||
| 1149 | if (ret < 0) { | 1172 | if (ret < 0) { |
| 1150 | vivi_release(); | 1173 | vivi_release(); |
| 1151 | printk(KERN_INFO "Error %d while loading vivi driver\n", ret); | 1174 | printk(KERN_INFO "Error %d while loading vivi driver\n", ret); |
| 1152 | } else | 1175 | } else { |
| 1153 | printk(KERN_INFO "Video Technology Magazine Virtual Video " | 1176 | printk(KERN_INFO "Video Technology Magazine Virtual Video " |
| 1154 | "Capture Board ver %u.%u.%u successfully loaded.\n", | 1177 | "Capture Board ver %u.%u.%u successfully loaded.\n", |
| 1155 | (VIVI_VERSION >> 16) & 0xFF, (VIVI_VERSION >> 8) & 0xFF, | 1178 | (VIVI_VERSION >> 16) & 0xFF, (VIVI_VERSION >> 8) & 0xFF, |
| 1156 | VIVI_VERSION & 0xFF); | 1179 | VIVI_VERSION & 0xFF); |
| 1180 | |||
| 1181 | /* n_devs will reflect the actual number of allocated devices */ | ||
| 1182 | n_devs = i; | ||
| 1183 | } | ||
| 1184 | |||
| 1157 | return ret; | 1185 | return ret; |
| 1158 | } | 1186 | } |
| 1159 | 1187 | ||
| @@ -1169,10 +1197,10 @@ MODULE_DESCRIPTION("Video Technology Magazine Virtual Video Capture Board"); | |||
| 1169 | MODULE_AUTHOR("Mauro Carvalho Chehab, Ted Walther and John Sokol"); | 1197 | MODULE_AUTHOR("Mauro Carvalho Chehab, Ted Walther and John Sokol"); |
| 1170 | MODULE_LICENSE("Dual BSD/GPL"); | 1198 | MODULE_LICENSE("Dual BSD/GPL"); |
| 1171 | 1199 | ||
| 1172 | module_param(video_nr, int, 0); | 1200 | module_param(video_nr, uint, 0444); |
| 1173 | MODULE_PARM_DESC(video_nr, "video iminor start number"); | 1201 | MODULE_PARM_DESC(video_nr, "video iminor start number"); |
| 1174 | 1202 | ||
| 1175 | module_param(n_devs, int, 0); | 1203 | module_param(n_devs, uint, 0444); |
| 1176 | MODULE_PARM_DESC(n_devs, "number of video devices to create"); | 1204 | MODULE_PARM_DESC(n_devs, "number of video devices to create"); |
| 1177 | 1205 | ||
| 1178 | module_param_named(debug, vivi_template.debug, int, 0444); | 1206 | module_param_named(debug, vivi_template.debug, int, 0444); |
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index 9402f40095b4..2ff00bc5ad64 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c | |||
| @@ -334,7 +334,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
| 334 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); | 334 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); |
| 335 | cam->vdev.priv = cam; | 335 | cam->vdev.priv = cam; |
| 336 | 336 | ||
| 337 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) | 337 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) |
| 338 | return -1; | 338 | return -1; |
| 339 | 339 | ||
| 340 | w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); | 340 | w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); |
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index 550ce7bd5c87..0c3287734c93 100644 --- a/drivers/media/video/zc0301/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c | |||
| @@ -1988,6 +1988,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
| 1988 | cam->v4ldev->fops = &zc0301_fops; | 1988 | cam->v4ldev->fops = &zc0301_fops; |
| 1989 | cam->v4ldev->minor = video_nr[dev_nr]; | 1989 | cam->v4ldev->minor = video_nr[dev_nr]; |
| 1990 | cam->v4ldev->release = video_device_release; | 1990 | cam->v4ldev->release = video_device_release; |
| 1991 | cam->v4ldev->parent = &udev->dev; | ||
| 1991 | video_set_drvdata(cam->v4ldev, cam); | 1992 | video_set_drvdata(cam->v4ldev, cam); |
| 1992 | 1993 | ||
| 1993 | init_completion(&cam->probe); | 1994 | init_completion(&cam->probe); |
diff --git a/drivers/media/video/zc0301/zc0301_sensor.h b/drivers/media/video/zc0301/zc0301_sensor.h index 70fe6fc6cdd5..b0cd49c438a3 100644 --- a/drivers/media/video/zc0301/zc0301_sensor.h +++ b/drivers/media/video/zc0301/zc0301_sensor.h | |||
| @@ -60,27 +60,8 @@ zc0301_attach_sensor(struct zc0301_device* cam, struct zc0301_sensor* sensor); | |||
| 60 | 60 | ||
| 61 | #define ZC0301_ID_TABLE \ | 61 | #define ZC0301_ID_TABLE \ |
| 62 | static const struct usb_device_id zc0301_id_table[] = { \ | 62 | static const struct usb_device_id zc0301_id_table[] = { \ |
| 63 | { ZC0301_USB_DEVICE(0x041e, 0x4017, 0xff), }, /* ICM105 */ \ | ||
| 64 | { ZC0301_USB_DEVICE(0x041e, 0x401c, 0xff), }, /* PAS106 */ \ | ||
| 65 | { ZC0301_USB_DEVICE(0x041e, 0x401e, 0xff), }, /* HV7131 */ \ | ||
| 66 | { ZC0301_USB_DEVICE(0x041e, 0x401f, 0xff), }, /* TAS5130 */ \ | ||
| 67 | { ZC0301_USB_DEVICE(0x041e, 0x4022, 0xff), }, \ | ||
| 68 | { ZC0301_USB_DEVICE(0x041e, 0x4034, 0xff), }, /* PAS106 */ \ | ||
| 69 | { ZC0301_USB_DEVICE(0x041e, 0x4035, 0xff), }, /* PAS106 */ \ | ||
| 70 | { ZC0301_USB_DEVICE(0x041e, 0x4036, 0xff), }, /* HV7131 */ \ | ||
| 71 | { ZC0301_USB_DEVICE(0x041e, 0x403a, 0xff), }, /* HV7131 */ \ | ||
| 72 | { ZC0301_USB_DEVICE(0x0458, 0x7007, 0xff), }, /* TAS5130 */ \ | ||
| 73 | { ZC0301_USB_DEVICE(0x0458, 0x700c, 0xff), }, /* TAS5130 */ \ | ||
| 74 | { ZC0301_USB_DEVICE(0x0458, 0x700f, 0xff), }, /* TAS5130 */ \ | ||
| 75 | { ZC0301_USB_DEVICE(0x046d, 0x08ae, 0xff), }, /* PAS202 */ \ | 63 | { ZC0301_USB_DEVICE(0x046d, 0x08ae, 0xff), }, /* PAS202 */ \ |
| 76 | { ZC0301_USB_DEVICE(0x055f, 0xd003, 0xff), }, /* TAS5130 */ \ | ||
| 77 | { ZC0301_USB_DEVICE(0x055f, 0xd004, 0xff), }, /* TAS5130 */ \ | ||
| 78 | { ZC0301_USB_DEVICE(0x0ac8, 0x0301, 0xff), }, \ | ||
| 79 | { ZC0301_USB_DEVICE(0x0ac8, 0x301b, 0xff), }, /* PB-0330/HV7131 */ \ | ||
| 80 | { ZC0301_USB_DEVICE(0x0ac8, 0x303b, 0xff), }, /* PB-0330 */ \ | 64 | { ZC0301_USB_DEVICE(0x0ac8, 0x303b, 0xff), }, /* PB-0330 */ \ |
| 81 | { ZC0301_USB_DEVICE(0x10fd, 0x0128, 0xff), }, /* TAS5130 */ \ | ||
| 82 | { ZC0301_USB_DEVICE(0x10fd, 0x8050, 0xff), }, /* TAS5130 */ \ | ||
| 83 | { ZC0301_USB_DEVICE(0x10fd, 0x804e, 0xff), }, /* TAS5130 */ \ | ||
| 84 | { } \ | 65 | { } \ |
| 85 | }; | 66 | }; |
| 86 | 67 | ||
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c index a38005008a20..cea46906408e 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c | |||
| @@ -185,7 +185,7 @@ static void memstick_free(struct device *dev) | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | static struct class memstick_host_class = { | 187 | static struct class memstick_host_class = { |
| 188 | .name = "memstick_host", | 188 | .name = "memstick_host", |
| 189 | .dev_release = memstick_free | 189 | .dev_release = memstick_free |
| 190 | }; | 190 | }; |
| 191 | 191 | ||
| @@ -264,7 +264,7 @@ EXPORT_SYMBOL(memstick_new_req); | |||
| 264 | * @sg - TPC argument | 264 | * @sg - TPC argument |
| 265 | */ | 265 | */ |
| 266 | void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, | 266 | void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, |
| 267 | struct scatterlist *sg) | 267 | const struct scatterlist *sg) |
| 268 | { | 268 | { |
| 269 | mrq->tpc = tpc; | 269 | mrq->tpc = tpc; |
| 270 | if (tpc & 8) | 270 | if (tpc & 8) |
| @@ -294,7 +294,7 @@ EXPORT_SYMBOL(memstick_init_req_sg); | |||
| 294 | * user supplied buffer. | 294 | * user supplied buffer. |
| 295 | */ | 295 | */ |
| 296 | void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, | 296 | void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, |
| 297 | void *buf, size_t length) | 297 | const void *buf, size_t length) |
| 298 | { | 298 | { |
| 299 | mrq->tpc = tpc; | 299 | mrq->tpc = tpc; |
| 300 | if (tpc & 8) | 300 | if (tpc & 8) |
| @@ -439,7 +439,7 @@ static void memstick_check(struct work_struct *work) | |||
| 439 | if (!host->card) { | 439 | if (!host->card) { |
| 440 | if (memstick_power_on(host)) | 440 | if (memstick_power_on(host)) |
| 441 | goto out_power_off; | 441 | goto out_power_off; |
| 442 | } else | 442 | } else if (host->card->stop) |
| 443 | host->card->stop(host->card); | 443 | host->card->stop(host->card); |
| 444 | 444 | ||
| 445 | card = memstick_alloc_card(host); | 445 | card = memstick_alloc_card(host); |
| @@ -458,7 +458,7 @@ static void memstick_check(struct work_struct *work) | |||
| 458 | || !(host->card->check(host->card))) { | 458 | || !(host->card->check(host->card))) { |
| 459 | device_unregister(&host->card->dev); | 459 | device_unregister(&host->card->dev); |
| 460 | host->card = NULL; | 460 | host->card = NULL; |
| 461 | } else | 461 | } else if (host->card->start) |
| 462 | host->card->start(host->card); | 462 | host->card->start(host->card); |
| 463 | } | 463 | } |
| 464 | 464 | ||
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 44b1817f2f2f..d2d2318dafa4 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
| @@ -30,6 +30,8 @@ module_param(major, int, 0644); | |||
| 30 | #define MSPRO_BLOCK_SIGNATURE 0xa5c3 | 30 | #define MSPRO_BLOCK_SIGNATURE 0xa5c3 |
| 31 | #define MSPRO_BLOCK_MAX_ATTRIBUTES 41 | 31 | #define MSPRO_BLOCK_MAX_ATTRIBUTES 41 |
| 32 | 32 | ||
| 33 | #define MSPRO_BLOCK_PART_SHIFT 3 | ||
| 34 | |||
| 33 | enum { | 35 | enum { |
| 34 | MSPRO_BLOCK_ID_SYSINFO = 0x10, | 36 | MSPRO_BLOCK_ID_SYSINFO = 0x10, |
| 35 | MSPRO_BLOCK_ID_MODELNAME = 0x15, | 37 | MSPRO_BLOCK_ID_MODELNAME = 0x15, |
| @@ -195,7 +197,7 @@ static int mspro_block_bd_open(struct inode *inode, struct file *filp) | |||
| 195 | static int mspro_block_disk_release(struct gendisk *disk) | 197 | static int mspro_block_disk_release(struct gendisk *disk) |
| 196 | { | 198 | { |
| 197 | struct mspro_block_data *msb = disk->private_data; | 199 | struct mspro_block_data *msb = disk->private_data; |
| 198 | int disk_id = disk->first_minor >> MEMSTICK_PART_SHIFT; | 200 | int disk_id = disk->first_minor >> MSPRO_BLOCK_PART_SHIFT; |
| 199 | 201 | ||
| 200 | mutex_lock(&mspro_block_disk_lock); | 202 | mutex_lock(&mspro_block_disk_lock); |
| 201 | 203 | ||
| @@ -877,6 +879,7 @@ static int mspro_block_switch_interface(struct memstick_dev *card) | |||
| 877 | struct mspro_block_data *msb = memstick_get_drvdata(card); | 879 | struct mspro_block_data *msb = memstick_get_drvdata(card); |
| 878 | int rc = 0; | 880 | int rc = 0; |
| 879 | 881 | ||
| 882 | try_again: | ||
| 880 | if (msb->caps & MEMSTICK_CAP_PAR4) | 883 | if (msb->caps & MEMSTICK_CAP_PAR4) |
| 881 | rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR4); | 884 | rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR4); |
| 882 | else | 885 | else |
| @@ -930,6 +933,18 @@ static int mspro_block_switch_interface(struct memstick_dev *card) | |||
| 930 | rc = memstick_set_rw_addr(card); | 933 | rc = memstick_set_rw_addr(card); |
| 931 | if (!rc) | 934 | if (!rc) |
| 932 | rc = mspro_block_set_interface(card, msb->system); | 935 | rc = mspro_block_set_interface(card, msb->system); |
| 936 | |||
| 937 | if (!rc) { | ||
| 938 | msleep(150); | ||
| 939 | rc = mspro_block_wait_for_ced(card); | ||
| 940 | if (rc) | ||
| 941 | return rc; | ||
| 942 | |||
| 943 | if (msb->caps & MEMSTICK_CAP_PAR8) { | ||
| 944 | msb->caps &= ~MEMSTICK_CAP_PAR8; | ||
| 945 | goto try_again; | ||
| 946 | } | ||
| 947 | } | ||
| 933 | } | 948 | } |
| 934 | return rc; | 949 | return rc; |
| 935 | } | 950 | } |
| @@ -1117,14 +1132,16 @@ static int mspro_block_init_card(struct memstick_dev *card) | |||
| 1117 | return -EIO; | 1132 | return -EIO; |
| 1118 | 1133 | ||
| 1119 | msb->caps = host->caps; | 1134 | msb->caps = host->caps; |
| 1120 | rc = mspro_block_switch_interface(card); | 1135 | |
| 1136 | msleep(150); | ||
| 1137 | rc = mspro_block_wait_for_ced(card); | ||
| 1121 | if (rc) | 1138 | if (rc) |
| 1122 | return rc; | 1139 | return rc; |
| 1123 | 1140 | ||
| 1124 | msleep(200); | 1141 | rc = mspro_block_switch_interface(card); |
| 1125 | rc = mspro_block_wait_for_ced(card); | ||
| 1126 | if (rc) | 1142 | if (rc) |
| 1127 | return rc; | 1143 | return rc; |
| 1144 | |||
| 1128 | dev_dbg(&card->dev, "card activated\n"); | 1145 | dev_dbg(&card->dev, "card activated\n"); |
| 1129 | if (msb->system != MEMSTICK_SYS_SERIAL) | 1146 | if (msb->system != MEMSTICK_SYS_SERIAL) |
| 1130 | msb->caps |= MEMSTICK_CAP_AUTO_GET_INT; | 1147 | msb->caps |= MEMSTICK_CAP_AUTO_GET_INT; |
| @@ -1192,12 +1209,12 @@ static int mspro_block_init_disk(struct memstick_dev *card) | |||
| 1192 | if (rc) | 1209 | if (rc) |
| 1193 | return rc; | 1210 | return rc; |
| 1194 | 1211 | ||
| 1195 | if ((disk_id << MEMSTICK_PART_SHIFT) > 255) { | 1212 | if ((disk_id << MSPRO_BLOCK_PART_SHIFT) > 255) { |
| 1196 | rc = -ENOSPC; | 1213 | rc = -ENOSPC; |
| 1197 | goto out_release_id; | 1214 | goto out_release_id; |
| 1198 | } | 1215 | } |
| 1199 | 1216 | ||
| 1200 | msb->disk = alloc_disk(1 << MEMSTICK_PART_SHIFT); | 1217 | msb->disk = alloc_disk(1 << MSPRO_BLOCK_PART_SHIFT); |
| 1201 | if (!msb->disk) { | 1218 | if (!msb->disk) { |
| 1202 | rc = -ENOMEM; | 1219 | rc = -ENOMEM; |
| 1203 | goto out_release_id; | 1220 | goto out_release_id; |
| @@ -1220,7 +1237,7 @@ static int mspro_block_init_disk(struct memstick_dev *card) | |||
| 1220 | MSPRO_BLOCK_MAX_PAGES * msb->page_size); | 1237 | MSPRO_BLOCK_MAX_PAGES * msb->page_size); |
| 1221 | 1238 | ||
| 1222 | msb->disk->major = major; | 1239 | msb->disk->major = major; |
| 1223 | msb->disk->first_minor = disk_id << MEMSTICK_PART_SHIFT; | 1240 | msb->disk->first_minor = disk_id << MSPRO_BLOCK_PART_SHIFT; |
| 1224 | msb->disk->fops = &ms_block_bdops; | 1241 | msb->disk->fops = &ms_block_bdops; |
| 1225 | msb->usage_count = 1; | 1242 | msb->usage_count = 1; |
| 1226 | msb->disk->private_data = msb; | 1243 | msb->disk->private_data = msb; |
| @@ -1416,7 +1433,7 @@ out_unlock: | |||
| 1416 | 1433 | ||
| 1417 | static struct memstick_device_id mspro_block_id_tbl[] = { | 1434 | static struct memstick_device_id mspro_block_id_tbl[] = { |
| 1418 | {MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_PRO, MEMSTICK_CATEGORY_STORAGE_DUO, | 1435 | {MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_PRO, MEMSTICK_CATEGORY_STORAGE_DUO, |
| 1419 | MEMSTICK_CLASS_GENERIC_DUO}, | 1436 | MEMSTICK_CLASS_DUO}, |
| 1420 | {} | 1437 | {} |
| 1421 | }; | 1438 | }; |
| 1422 | 1439 | ||
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c index 3485c63d20b0..2fb95a5b72eb 100644 --- a/drivers/memstick/host/jmb38x_ms.c +++ b/drivers/memstick/host/jmb38x_ms.c | |||
| @@ -81,6 +81,8 @@ struct jmb38x_ms { | |||
| 81 | #define TPC_CODE_SZ_MASK 0x00000700 | 81 | #define TPC_CODE_SZ_MASK 0x00000700 |
| 82 | #define TPC_DATA_SZ_MASK 0x00000007 | 82 | #define TPC_DATA_SZ_MASK 0x00000007 |
| 83 | 83 | ||
| 84 | #define HOST_CONTROL_TDELAY_EN 0x00040000 | ||
| 85 | #define HOST_CONTROL_HW_OC_P 0x00010000 | ||
| 84 | #define HOST_CONTROL_RESET_REQ 0x00008000 | 86 | #define HOST_CONTROL_RESET_REQ 0x00008000 |
| 85 | #define HOST_CONTROL_REI 0x00004000 | 87 | #define HOST_CONTROL_REI 0x00004000 |
| 86 | #define HOST_CONTROL_LED 0x00000400 | 88 | #define HOST_CONTROL_LED 0x00000400 |
| @@ -88,6 +90,7 @@ struct jmb38x_ms { | |||
| 88 | #define HOST_CONTROL_RESET 0x00000100 | 90 | #define HOST_CONTROL_RESET 0x00000100 |
| 89 | #define HOST_CONTROL_POWER_EN 0x00000080 | 91 | #define HOST_CONTROL_POWER_EN 0x00000080 |
| 90 | #define HOST_CONTROL_CLOCK_EN 0x00000040 | 92 | #define HOST_CONTROL_CLOCK_EN 0x00000040 |
| 93 | #define HOST_CONTROL_REO 0x00000008 | ||
| 91 | #define HOST_CONTROL_IF_SHIFT 4 | 94 | #define HOST_CONTROL_IF_SHIFT 4 |
| 92 | 95 | ||
| 93 | #define HOST_CONTROL_IF_SERIAL 0x0 | 96 | #define HOST_CONTROL_IF_SERIAL 0x0 |
| @@ -133,11 +136,15 @@ struct jmb38x_ms { | |||
| 133 | #define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000 | 136 | #define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000 |
| 134 | 137 | ||
| 135 | #define CLOCK_CONTROL_40MHZ 0x00000001 | 138 | #define CLOCK_CONTROL_40MHZ 0x00000001 |
| 136 | #define CLOCK_CONTROL_50MHZ 0x00000002 | 139 | #define CLOCK_CONTROL_50MHZ 0x0000000a |
| 137 | #define CLOCK_CONTROL_60MHZ 0x00000008 | 140 | #define CLOCK_CONTROL_60MHZ 0x00000008 |
| 138 | #define CLOCK_CONTROL_62_5MHZ 0x0000000c | 141 | #define CLOCK_CONTROL_62_5MHZ 0x0000000c |
| 139 | #define CLOCK_CONTROL_OFF 0x00000000 | 142 | #define CLOCK_CONTROL_OFF 0x00000000 |
| 140 | 143 | ||
| 144 | #define PCI_CTL_CLOCK_DLY_ADDR 0x000000b0 | ||
| 145 | #define PCI_CTL_CLOCK_DLY_MASK_A 0x00000f00 | ||
| 146 | #define PCI_CTL_CLOCK_DLY_MASK_B 0x0000f000 | ||
| 147 | |||
| 141 | enum { | 148 | enum { |
| 142 | CMD_READY = 0x01, | 149 | CMD_READY = 0x01, |
| 143 | FIFO_READY = 0x02, | 150 | FIFO_READY = 0x02, |
| @@ -367,8 +374,7 @@ static int jmb38x_ms_issue_cmd(struct memstick_host *msh) | |||
| 367 | return host->req->error; | 374 | return host->req->error; |
| 368 | } | 375 | } |
| 369 | 376 | ||
| 370 | dev_dbg(&msh->dev, "control %08x\n", | 377 | dev_dbg(&msh->dev, "control %08x\n", readl(host->addr + HOST_CONTROL)); |
| 371 | readl(host->addr + HOST_CONTROL)); | ||
| 372 | dev_dbg(&msh->dev, "status %08x\n", readl(host->addr + INT_STATUS)); | 378 | dev_dbg(&msh->dev, "status %08x\n", readl(host->addr + INT_STATUS)); |
| 373 | dev_dbg(&msh->dev, "hstatus %08x\n", readl(host->addr + STATUS)); | 379 | dev_dbg(&msh->dev, "hstatus %08x\n", readl(host->addr + STATUS)); |
| 374 | 380 | ||
| @@ -637,7 +643,7 @@ static int jmb38x_ms_reset(struct jmb38x_ms_host *host) | |||
| 637 | ndelay(20); | 643 | ndelay(20); |
| 638 | } | 644 | } |
| 639 | dev_dbg(&host->chip->pdev->dev, "reset_req timeout\n"); | 645 | dev_dbg(&host->chip->pdev->dev, "reset_req timeout\n"); |
| 640 | return -EIO; | 646 | /* return -EIO; */ |
| 641 | 647 | ||
| 642 | reset_next: | 648 | reset_next: |
| 643 | writel(HOST_CONTROL_RESET | HOST_CONTROL_CLOCK_EN | 649 | writel(HOST_CONTROL_RESET | HOST_CONTROL_CLOCK_EN |
| @@ -680,7 +686,9 @@ static int jmb38x_ms_set_param(struct memstick_host *msh, | |||
| 680 | 686 | ||
| 681 | host_ctl = 7; | 687 | host_ctl = 7; |
| 682 | host_ctl |= HOST_CONTROL_POWER_EN | 688 | host_ctl |= HOST_CONTROL_POWER_EN |
| 683 | | HOST_CONTROL_CLOCK_EN; | 689 | | HOST_CONTROL_CLOCK_EN |
| 690 | | HOST_CONTROL_HW_OC_P | ||
| 691 | | HOST_CONTROL_TDELAY_EN; | ||
| 684 | writel(host_ctl, host->addr + HOST_CONTROL); | 692 | writel(host_ctl, host->addr + HOST_CONTROL); |
| 685 | 693 | ||
| 686 | writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 | 694 | writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 |
| @@ -704,33 +712,40 @@ static int jmb38x_ms_set_param(struct memstick_host *msh, | |||
| 704 | break; | 712 | break; |
| 705 | case MEMSTICK_INTERFACE: | 713 | case MEMSTICK_INTERFACE: |
| 706 | host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT); | 714 | host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT); |
| 715 | pci_read_config_dword(host->chip->pdev, | ||
| 716 | PCI_CTL_CLOCK_DLY_ADDR, | ||
| 717 | &clock_delay); | ||
| 718 | clock_delay &= host->id ? ~PCI_CTL_CLOCK_DLY_MASK_B | ||
| 719 | : ~PCI_CTL_CLOCK_DLY_MASK_A; | ||
| 707 | 720 | ||
| 708 | if (value == MEMSTICK_SERIAL) { | 721 | if (value == MEMSTICK_SERIAL) { |
| 709 | host_ctl &= ~HOST_CONTROL_FAST_CLK; | 722 | host_ctl &= ~HOST_CONTROL_FAST_CLK; |
| 723 | host_ctl &= ~HOST_CONTROL_REO; | ||
| 710 | host_ctl |= HOST_CONTROL_IF_SERIAL | 724 | host_ctl |= HOST_CONTROL_IF_SERIAL |
| 711 | << HOST_CONTROL_IF_SHIFT; | 725 | << HOST_CONTROL_IF_SHIFT; |
| 712 | host_ctl |= HOST_CONTROL_REI; | 726 | host_ctl |= HOST_CONTROL_REI; |
| 713 | clock_ctl = CLOCK_CONTROL_40MHZ; | 727 | clock_ctl = CLOCK_CONTROL_40MHZ; |
| 714 | clock_delay = 0; | ||
| 715 | } else if (value == MEMSTICK_PAR4) { | 728 | } else if (value == MEMSTICK_PAR4) { |
| 716 | host_ctl |= HOST_CONTROL_FAST_CLK; | 729 | host_ctl |= HOST_CONTROL_FAST_CLK | HOST_CONTROL_REO; |
| 717 | host_ctl |= HOST_CONTROL_IF_PAR4 | 730 | host_ctl |= HOST_CONTROL_IF_PAR4 |
| 718 | << HOST_CONTROL_IF_SHIFT; | 731 | << HOST_CONTROL_IF_SHIFT; |
| 719 | host_ctl &= ~HOST_CONTROL_REI; | 732 | host_ctl &= ~HOST_CONTROL_REI; |
| 720 | clock_ctl = CLOCK_CONTROL_40MHZ; | 733 | clock_ctl = CLOCK_CONTROL_40MHZ; |
| 721 | clock_delay = 4; | 734 | clock_delay |= host->id ? (4 << 12) : (4 << 8); |
| 722 | } else if (value == MEMSTICK_PAR8) { | 735 | } else if (value == MEMSTICK_PAR8) { |
| 723 | host_ctl |= HOST_CONTROL_FAST_CLK; | 736 | host_ctl |= HOST_CONTROL_FAST_CLK; |
| 724 | host_ctl |= HOST_CONTROL_IF_PAR8 | 737 | host_ctl |= HOST_CONTROL_IF_PAR8 |
| 725 | << HOST_CONTROL_IF_SHIFT; | 738 | << HOST_CONTROL_IF_SHIFT; |
| 726 | host_ctl &= ~HOST_CONTROL_REI; | 739 | host_ctl &= ~(HOST_CONTROL_REI | HOST_CONTROL_REO); |
| 727 | clock_ctl = CLOCK_CONTROL_60MHZ; | 740 | clock_ctl = CLOCK_CONTROL_50MHZ; |
| 728 | clock_delay = 0; | ||
| 729 | } else | 741 | } else |
| 730 | return -EINVAL; | 742 | return -EINVAL; |
| 743 | |||
| 731 | writel(host_ctl, host->addr + HOST_CONTROL); | 744 | writel(host_ctl, host->addr + HOST_CONTROL); |
| 732 | writel(clock_ctl, host->addr + CLOCK_CONTROL); | 745 | writel(clock_ctl, host->addr + CLOCK_CONTROL); |
| 733 | writel(clock_delay, host->addr + CLOCK_DELAY); | 746 | pci_write_config_dword(host->chip->pdev, |
| 747 | PCI_CTL_CLOCK_DLY_ADDR, | ||
| 748 | clock_delay); | ||
| 734 | break; | 749 | break; |
| 735 | }; | 750 | }; |
| 736 | return 0; | 751 | return 0; |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 10c44d3fe01a..68dc8d9eb24e 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -21,7 +21,7 @@ config MFD_SM501 | |||
| 21 | 21 | ||
| 22 | config MFD_SM501_GPIO | 22 | config MFD_SM501_GPIO |
| 23 | bool "Export GPIO via GPIO layer" | 23 | bool "Export GPIO via GPIO layer" |
| 24 | depends on MFD_SM501 && HAVE_GPIO_LIB | 24 | depends on MFD_SM501 && GPIOLIB |
| 25 | ---help--- | 25 | ---help--- |
| 26 | This option uses the gpio library layer to export the 64 GPIO | 26 | This option uses the gpio library layer to export the 64 GPIO |
| 27 | lines on the SM501. The platform data is used to supply the | 27 | lines on the SM501. The platform data is used to supply the |
| @@ -29,7 +29,7 @@ config MFD_SM501_GPIO | |||
| 29 | 29 | ||
| 30 | config MFD_ASIC3 | 30 | config MFD_ASIC3 |
| 31 | bool "Support for Compaq ASIC3" | 31 | bool "Support for Compaq ASIC3" |
| 32 | depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM | 32 | depends on GENERIC_HARDIRQS && GPIOLIB && ARM |
| 33 | ---help--- | 33 | ---help--- |
| 34 | This driver supports the ASIC3 multifunction chip found on many | 34 | This driver supports the ASIC3 multifunction chip found on many |
| 35 | PDAs (mainly iPAQ and HTC based ones) | 35 | PDAs (mainly iPAQ and HTC based ones) |
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index c6408a62d95e..ba5aa2008273 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | * | 16 | * |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <linux/version.h> | ||
| 20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 21 | #include <linux/irq.h> | 20 | #include <linux/irq.h> |
| 22 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
| @@ -313,7 +312,6 @@ static int __init asic3_irq_probe(struct platform_device *pdev) | |||
| 313 | struct asic3 *asic = platform_get_drvdata(pdev); | 312 | struct asic3 *asic = platform_get_drvdata(pdev); |
| 314 | unsigned long clksel = 0; | 313 | unsigned long clksel = 0; |
| 315 | unsigned int irq, irq_base; | 314 | unsigned int irq, irq_base; |
| 316 | int map_size; | ||
| 317 | int ret; | 315 | int ret; |
| 318 | 316 | ||
| 319 | ret = platform_get_irq(pdev, 0); | 317 | ret = platform_get_irq(pdev, 0); |
| @@ -535,6 +533,7 @@ static int __init asic3_probe(struct platform_device *pdev) | |||
| 535 | struct asic3 *asic; | 533 | struct asic3 *asic; |
| 536 | struct resource *mem; | 534 | struct resource *mem; |
| 537 | unsigned long clksel; | 535 | unsigned long clksel; |
| 536 | int map_size; | ||
| 538 | int ret = 0; | 537 | int ret = 0; |
| 539 | 538 | ||
| 540 | asic = kzalloc(sizeof(struct asic3), GFP_KERNEL); | 539 | asic = kzalloc(sizeof(struct asic3), GFP_KERNEL); |
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c index e7a3fe508dff..d8b0d326e452 100644 --- a/drivers/misc/acer-wmi.c +++ b/drivers/misc/acer-wmi.c | |||
| @@ -192,6 +192,9 @@ static struct quirk_entry *quirks; | |||
| 192 | 192 | ||
| 193 | static void set_quirks(void) | 193 | static void set_quirks(void) |
| 194 | { | 194 | { |
| 195 | if (!interface) | ||
| 196 | return; | ||
| 197 | |||
| 195 | if (quirks->mailled) | 198 | if (quirks->mailled) |
| 196 | interface->capability |= ACER_CAP_MAILLED; | 199 | interface->capability |= ACER_CAP_MAILLED; |
| 197 | 200 | ||
| @@ -803,11 +806,30 @@ static acpi_status get_u32(u32 *value, u32 cap) | |||
| 803 | 806 | ||
| 804 | static acpi_status set_u32(u32 value, u32 cap) | 807 | static acpi_status set_u32(u32 value, u32 cap) |
| 805 | { | 808 | { |
| 809 | acpi_status status; | ||
| 810 | |||
| 806 | if (interface->capability & cap) { | 811 | if (interface->capability & cap) { |
| 807 | switch (interface->type) { | 812 | switch (interface->type) { |
| 808 | case ACER_AMW0: | 813 | case ACER_AMW0: |
| 809 | return AMW0_set_u32(value, cap, interface); | 814 | return AMW0_set_u32(value, cap, interface); |
| 810 | case ACER_AMW0_V2: | 815 | case ACER_AMW0_V2: |
| 816 | if (cap == ACER_CAP_MAILLED) | ||
| 817 | return AMW0_set_u32(value, cap, interface); | ||
| 818 | |||
| 819 | /* | ||
| 820 | * On some models, some WMID methods don't toggle | ||
| 821 | * properly. For those cases, we want to run the AMW0 | ||
| 822 | * method afterwards to be certain we've really toggled | ||
| 823 | * the device state. | ||
| 824 | */ | ||
| 825 | if (cap == ACER_CAP_WIRELESS || | ||
| 826 | cap == ACER_CAP_BLUETOOTH) { | ||
| 827 | status = WMID_set_u32(value, cap, interface); | ||
| 828 | if (ACPI_FAILURE(status)) | ||
| 829 | return status; | ||
| 830 | |||
| 831 | return AMW0_set_u32(value, cap, interface); | ||
| 832 | } | ||
| 811 | case ACER_WMID: | 833 | case ACER_WMID: |
| 812 | return WMID_set_u32(value, cap, interface); | 834 | return WMID_set_u32(value, cap, interface); |
| 813 | default: | 835 | default: |
| @@ -1167,7 +1189,7 @@ static int create_debugfs(void) | |||
| 1167 | return 0; | 1189 | return 0; |
| 1168 | 1190 | ||
| 1169 | error_debugfs: | 1191 | error_debugfs: |
| 1170 | remove_debugfs(); | 1192 | remove_debugfs(); |
| 1171 | return -ENOMEM; | 1193 | return -ENOMEM; |
| 1172 | } | 1194 | } |
| 1173 | 1195 | ||
| @@ -1218,6 +1240,8 @@ static int __init acer_wmi_init(void) | |||
| 1218 | return -ENODEV; | 1240 | return -ENODEV; |
| 1219 | } | 1241 | } |
| 1220 | 1242 | ||
| 1243 | set_quirks(); | ||
| 1244 | |||
| 1221 | if (platform_driver_register(&acer_platform_driver)) { | 1245 | if (platform_driver_register(&acer_platform_driver)) { |
| 1222 | printk(ACER_ERR "Unable to register platform driver.\n"); | 1246 | printk(ACER_ERR "Unable to register platform driver.\n"); |
| 1223 | goto error_platform_register; | 1247 | goto error_platform_register; |
| @@ -1248,6 +1272,7 @@ error_platform_register: | |||
| 1248 | static void __exit acer_wmi_exit(void) | 1272 | static void __exit acer_wmi_exit(void) |
| 1249 | { | 1273 | { |
| 1250 | remove_sysfs(acer_platform_device); | 1274 | remove_sysfs(acer_platform_device); |
| 1275 | remove_debugfs(); | ||
| 1251 | platform_device_del(acer_platform_device); | 1276 | platform_device_del(acer_platform_device); |
| 1252 | platform_driver_unregister(&acer_platform_driver); | 1277 | platform_driver_unregister(&acer_platform_driver); |
| 1253 | 1278 | ||
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c index 9e8d79e7e9f4..facdb9893c84 100644 --- a/drivers/misc/eeepc-laptop.c +++ b/drivers/misc/eeepc-laptop.c | |||
| @@ -553,9 +553,9 @@ static void eeepc_hwmon_exit(void) | |||
| 553 | hwmon = eeepc_hwmon_device; | 553 | hwmon = eeepc_hwmon_device; |
| 554 | if (!hwmon) | 554 | if (!hwmon) |
| 555 | return ; | 555 | return ; |
| 556 | hwmon_device_unregister(hwmon); | ||
| 557 | sysfs_remove_group(&hwmon->kobj, | 556 | sysfs_remove_group(&hwmon->kobj, |
| 558 | &hwmon_attribute_group); | 557 | &hwmon_attribute_group); |
| 558 | hwmon_device_unregister(hwmon); | ||
| 559 | eeepc_hwmon_device = NULL; | 559 | eeepc_hwmon_device = NULL; |
| 560 | } | 560 | } |
| 561 | 561 | ||
diff --git a/drivers/misc/eeprom_93cx6.c b/drivers/misc/eeprom_93cx6.c index ea55654e5948..15b1780025c8 100644 --- a/drivers/misc/eeprom_93cx6.c +++ b/drivers/misc/eeprom_93cx6.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 29 | #include <linux/version.h> | ||
| 30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
| 31 | #include <linux/eeprom_93cx6.h> | 30 | #include <linux/eeprom_93cx6.h> |
| 32 | 31 | ||
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c index 7a1ef6c262de..3e56203e4947 100644 --- a/drivers/misc/fujitsu-laptop.c +++ b/drivers/misc/fujitsu-laptop.c | |||
| @@ -463,6 +463,13 @@ static struct dmi_system_id __initdata fujitsu_dmi_table[] = { | |||
| 463 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6410"), | 463 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6410"), |
| 464 | }, | 464 | }, |
| 465 | .callback = dmi_check_cb_s6410}, | 465 | .callback = dmi_check_cb_s6410}, |
| 466 | { | ||
| 467 | .ident = "FUJITSU LifeBook P8010", | ||
| 468 | .matches = { | ||
| 469 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
| 470 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P8010"), | ||
| 471 | }, | ||
| 472 | .callback = dmi_check_cb_s6410}, | ||
| 466 | {} | 473 | {} |
| 467 | }; | 474 | }; |
| 468 | 475 | ||
diff --git a/drivers/misc/hp-wmi.c b/drivers/misc/hp-wmi.c index 1dbcbcb323a2..6d407c2a4f91 100644 --- a/drivers/misc/hp-wmi.c +++ b/drivers/misc/hp-wmi.c | |||
| @@ -49,6 +49,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4"); | |||
| 49 | #define HPWMI_ALS_QUERY 0x3 | 49 | #define HPWMI_ALS_QUERY 0x3 |
| 50 | #define HPWMI_DOCK_QUERY 0x4 | 50 | #define HPWMI_DOCK_QUERY 0x4 |
| 51 | #define HPWMI_WIRELESS_QUERY 0x5 | 51 | #define HPWMI_WIRELESS_QUERY 0x5 |
| 52 | #define HPWMI_HOTKEY_QUERY 0xc | ||
| 52 | 53 | ||
| 53 | static int __init hp_wmi_bios_setup(struct platform_device *device); | 54 | static int __init hp_wmi_bios_setup(struct platform_device *device); |
| 54 | static int __exit hp_wmi_bios_remove(struct platform_device *device); | 55 | static int __exit hp_wmi_bios_remove(struct platform_device *device); |
| @@ -69,7 +70,7 @@ struct bios_return { | |||
| 69 | 70 | ||
| 70 | struct key_entry { | 71 | struct key_entry { |
| 71 | char type; /* See KE_* below */ | 72 | char type; /* See KE_* below */ |
| 72 | u8 code; | 73 | u16 code; |
| 73 | u16 keycode; | 74 | u16 keycode; |
| 74 | }; | 75 | }; |
| 75 | 76 | ||
| @@ -79,7 +80,9 @@ static struct key_entry hp_wmi_keymap[] = { | |||
| 79 | {KE_SW, 0x01, SW_DOCK}, | 80 | {KE_SW, 0x01, SW_DOCK}, |
| 80 | {KE_KEY, 0x02, KEY_BRIGHTNESSUP}, | 81 | {KE_KEY, 0x02, KEY_BRIGHTNESSUP}, |
| 81 | {KE_KEY, 0x03, KEY_BRIGHTNESSDOWN}, | 82 | {KE_KEY, 0x03, KEY_BRIGHTNESSDOWN}, |
| 82 | {KE_KEY, 0x04, KEY_HELP}, | 83 | {KE_KEY, 0x20e6, KEY_PROG1}, |
| 84 | {KE_KEY, 0x2142, KEY_MEDIA}, | ||
| 85 | {KE_KEY, 0x231b, KEY_HELP}, | ||
| 83 | {KE_END, 0} | 86 | {KE_END, 0} |
| 84 | }; | 87 | }; |
| 85 | 88 | ||
| @@ -177,9 +180,9 @@ static int hp_wmi_wifi_state(void) | |||
| 177 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); | 180 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); |
| 178 | 181 | ||
| 179 | if (wireless & 0x100) | 182 | if (wireless & 0x100) |
| 180 | return 1; | 183 | return RFKILL_STATE_UNBLOCKED; |
| 181 | else | 184 | else |
| 182 | return 0; | 185 | return RFKILL_STATE_SOFT_BLOCKED; |
| 183 | } | 186 | } |
| 184 | 187 | ||
| 185 | static int hp_wmi_bluetooth_state(void) | 188 | static int hp_wmi_bluetooth_state(void) |
| @@ -187,9 +190,9 @@ static int hp_wmi_bluetooth_state(void) | |||
| 187 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); | 190 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); |
| 188 | 191 | ||
| 189 | if (wireless & 0x10000) | 192 | if (wireless & 0x10000) |
| 190 | return 1; | 193 | return RFKILL_STATE_UNBLOCKED; |
| 191 | else | 194 | else |
| 192 | return 0; | 195 | return RFKILL_STATE_SOFT_BLOCKED; |
| 193 | } | 196 | } |
| 194 | 197 | ||
| 195 | static int hp_wmi_wwan_state(void) | 198 | static int hp_wmi_wwan_state(void) |
| @@ -197,9 +200,9 @@ static int hp_wmi_wwan_state(void) | |||
| 197 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); | 200 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); |
| 198 | 201 | ||
| 199 | if (wireless & 0x1000000) | 202 | if (wireless & 0x1000000) |
| 200 | return 1; | 203 | return RFKILL_STATE_UNBLOCKED; |
| 201 | else | 204 | else |
| 202 | return 0; | 205 | return RFKILL_STATE_SOFT_BLOCKED; |
| 203 | } | 206 | } |
| 204 | 207 | ||
| 205 | static ssize_t show_display(struct device *dev, struct device_attribute *attr, | 208 | static ssize_t show_display(struct device *dev, struct device_attribute *attr, |
| @@ -318,6 +321,9 @@ void hp_wmi_notify(u32 value, void *context) | |||
| 318 | 321 | ||
| 319 | if (obj && obj->type == ACPI_TYPE_BUFFER && obj->buffer.length == 8) { | 322 | if (obj && obj->type == ACPI_TYPE_BUFFER && obj->buffer.length == 8) { |
| 320 | int eventcode = *((u8 *) obj->buffer.pointer); | 323 | int eventcode = *((u8 *) obj->buffer.pointer); |
| 324 | if (eventcode == 0x4) | ||
| 325 | eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0, | ||
| 326 | 0); | ||
| 321 | key = hp_wmi_get_entry_by_scancode(eventcode); | 327 | key = hp_wmi_get_entry_by_scancode(eventcode); |
| 322 | if (key) { | 328 | if (key) { |
| 323 | switch (key->type) { | 329 | switch (key->type) { |
| @@ -338,12 +344,14 @@ void hp_wmi_notify(u32 value, void *context) | |||
| 338 | } | 344 | } |
| 339 | } else if (eventcode == 0x5) { | 345 | } else if (eventcode == 0x5) { |
| 340 | if (wifi_rfkill) | 346 | if (wifi_rfkill) |
| 341 | wifi_rfkill->state = hp_wmi_wifi_state(); | 347 | rfkill_force_state(wifi_rfkill, |
| 348 | hp_wmi_wifi_state()); | ||
| 342 | if (bluetooth_rfkill) | 349 | if (bluetooth_rfkill) |
| 343 | bluetooth_rfkill->state = | 350 | rfkill_force_state(bluetooth_rfkill, |
| 344 | hp_wmi_bluetooth_state(); | 351 | hp_wmi_bluetooth_state()); |
| 345 | if (wwan_rfkill) | 352 | if (wwan_rfkill) |
| 346 | wwan_rfkill->state = hp_wmi_wwan_state(); | 353 | rfkill_force_state(wwan_rfkill, |
| 354 | hp_wmi_wwan_state()); | ||
| 347 | } else | 355 | } else |
| 348 | printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n", | 356 | printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n", |
| 349 | eventcode); | 357 | eventcode); |
| @@ -398,6 +406,7 @@ static void cleanup_sysfs(struct platform_device *device) | |||
| 398 | static int __init hp_wmi_bios_setup(struct platform_device *device) | 406 | static int __init hp_wmi_bios_setup(struct platform_device *device) |
| 399 | { | 407 | { |
| 400 | int err; | 408 | int err; |
| 409 | int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); | ||
| 401 | 410 | ||
| 402 | err = device_create_file(&device->dev, &dev_attr_display); | 411 | err = device_create_file(&device->dev, &dev_attr_display); |
| 403 | if (err) | 412 | if (err) |
| @@ -412,28 +421,33 @@ static int __init hp_wmi_bios_setup(struct platform_device *device) | |||
| 412 | if (err) | 421 | if (err) |
| 413 | goto add_sysfs_error; | 422 | goto add_sysfs_error; |
| 414 | 423 | ||
| 415 | wifi_rfkill = rfkill_allocate(&device->dev, RFKILL_TYPE_WLAN); | 424 | if (wireless & 0x1) { |
| 416 | wifi_rfkill->name = "hp-wifi"; | 425 | wifi_rfkill = rfkill_allocate(&device->dev, RFKILL_TYPE_WLAN); |
| 417 | wifi_rfkill->state = hp_wmi_wifi_state(); | 426 | wifi_rfkill->name = "hp-wifi"; |
| 418 | wifi_rfkill->toggle_radio = hp_wmi_wifi_set; | 427 | wifi_rfkill->state = hp_wmi_wifi_state(); |
| 419 | wifi_rfkill->user_claim_unsupported = 1; | 428 | wifi_rfkill->toggle_radio = hp_wmi_wifi_set; |
| 420 | 429 | wifi_rfkill->user_claim_unsupported = 1; | |
| 421 | bluetooth_rfkill = rfkill_allocate(&device->dev, | 430 | rfkill_register(wifi_rfkill); |
| 422 | RFKILL_TYPE_BLUETOOTH); | 431 | } |
| 423 | bluetooth_rfkill->name = "hp-bluetooth"; | 432 | |
| 424 | bluetooth_rfkill->state = hp_wmi_bluetooth_state(); | 433 | if (wireless & 0x2) { |
| 425 | bluetooth_rfkill->toggle_radio = hp_wmi_bluetooth_set; | 434 | bluetooth_rfkill = rfkill_allocate(&device->dev, |
| 426 | bluetooth_rfkill->user_claim_unsupported = 1; | 435 | RFKILL_TYPE_BLUETOOTH); |
| 427 | 436 | bluetooth_rfkill->name = "hp-bluetooth"; | |
| 428 | wwan_rfkill = rfkill_allocate(&device->dev, RFKILL_TYPE_WIMAX); | 437 | bluetooth_rfkill->state = hp_wmi_bluetooth_state(); |
| 429 | wwan_rfkill->name = "hp-wwan"; | 438 | bluetooth_rfkill->toggle_radio = hp_wmi_bluetooth_set; |
| 430 | wwan_rfkill->state = hp_wmi_wwan_state(); | 439 | bluetooth_rfkill->user_claim_unsupported = 1; |
| 431 | wwan_rfkill->toggle_radio = hp_wmi_wwan_set; | 440 | rfkill_register(bluetooth_rfkill); |
| 432 | wwan_rfkill->user_claim_unsupported = 1; | 441 | } |
| 433 | 442 | ||
| 434 | rfkill_register(wifi_rfkill); | 443 | if (wireless & 0x4) { |
| 435 | rfkill_register(bluetooth_rfkill); | 444 | wwan_rfkill = rfkill_allocate(&device->dev, RFKILL_TYPE_WWAN); |
| 436 | rfkill_register(wwan_rfkill); | 445 | wwan_rfkill->name = "hp-wwan"; |
| 446 | wwan_rfkill->state = hp_wmi_wwan_state(); | ||
| 447 | wwan_rfkill->toggle_radio = hp_wmi_wwan_set; | ||
| 448 | wwan_rfkill->user_claim_unsupported = 1; | ||
| 449 | rfkill_register(wwan_rfkill); | ||
| 450 | } | ||
| 437 | 451 | ||
| 438 | return 0; | 452 | return 0; |
| 439 | add_sysfs_error: | 453 | add_sysfs_error: |
| @@ -445,9 +459,12 @@ static int __exit hp_wmi_bios_remove(struct platform_device *device) | |||
| 445 | { | 459 | { |
| 446 | cleanup_sysfs(device); | 460 | cleanup_sysfs(device); |
| 447 | 461 | ||
| 448 | rfkill_unregister(wifi_rfkill); | 462 | if (wifi_rfkill) |
| 449 | rfkill_unregister(bluetooth_rfkill); | 463 | rfkill_unregister(wifi_rfkill); |
| 450 | rfkill_unregister(wwan_rfkill); | 464 | if (bluetooth_rfkill) |
| 465 | rfkill_unregister(bluetooth_rfkill); | ||
| 466 | if (wwan_rfkill) | ||
| 467 | rfkill_unregister(wwan_rfkill); | ||
| 451 | 468 | ||
| 452 | return 0; | 469 | return 0; |
| 453 | } | 470 | } |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index 23c91f5f6b61..d61cee796efd 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
| @@ -445,6 +445,9 @@ static void __exit gru_exit(void) | |||
| 445 | int order = get_order(sizeof(struct gru_state) * | 445 | int order = get_order(sizeof(struct gru_state) * |
| 446 | GRU_CHIPLETS_PER_BLADE); | 446 | GRU_CHIPLETS_PER_BLADE); |
| 447 | 447 | ||
| 448 | if (!IS_UV()) | ||
| 449 | return; | ||
| 450 | |||
| 448 | for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++) | 451 | for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++) |
| 449 | free_irq(IRQ_GRU + i, NULL); | 452 | free_irq(IRQ_GRU + i, NULL); |
| 450 | 453 | ||
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index d3eb7903c346..6b9300779a43 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
| @@ -3086,7 +3086,6 @@ static struct ibm_struct wan_driver_data = { | |||
| 3086 | .read = wan_read, | 3086 | .read = wan_read, |
| 3087 | .write = wan_write, | 3087 | .write = wan_write, |
| 3088 | .exit = wan_exit, | 3088 | .exit = wan_exit, |
| 3089 | .flags.experimental = 1, | ||
| 3090 | }; | 3089 | }; |
| 3091 | 3090 | ||
| 3092 | /************************************************************************* | 3091 | /************************************************************************* |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 86dbb366415a..ebc8b9d77613 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -103,8 +103,10 @@ static int mmc_blk_open(struct inode *inode, struct file *filp) | |||
| 103 | check_disk_change(inode->i_bdev); | 103 | check_disk_change(inode->i_bdev); |
| 104 | ret = 0; | 104 | ret = 0; |
| 105 | 105 | ||
| 106 | if ((filp->f_mode & FMODE_WRITE) && md->read_only) | 106 | if ((filp->f_mode & FMODE_WRITE) && md->read_only) { |
| 107 | mmc_blk_put(md); | ||
| 107 | ret = -EROFS; | 108 | ret = -EROFS; |
| 109 | } | ||
| 108 | } | 110 | } |
| 109 | 111 | ||
| 110 | return ret; | 112 | return ret; |
| @@ -613,14 +615,19 @@ static struct mmc_driver mmc_driver = { | |||
| 613 | 615 | ||
| 614 | static int __init mmc_blk_init(void) | 616 | static int __init mmc_blk_init(void) |
| 615 | { | 617 | { |
| 616 | int res = -ENOMEM; | 618 | int res; |
| 617 | 619 | ||
| 618 | res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); | 620 | res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); |
| 619 | if (res) | 621 | if (res) |
| 620 | goto out; | 622 | goto out; |
| 621 | 623 | ||
| 622 | return mmc_register_driver(&mmc_driver); | 624 | res = mmc_register_driver(&mmc_driver); |
| 625 | if (res) | ||
| 626 | goto out2; | ||
| 623 | 627 | ||
| 628 | return 0; | ||
| 629 | out2: | ||
| 630 | unregister_blkdev(MMC_BLOCK_MAJOR, "mmc"); | ||
| 624 | out: | 631 | out: |
| 625 | return res; | 632 | return res; |
| 626 | } | 633 | } |
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index f26b01d811ae..b92b172074ee 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
| @@ -1040,7 +1040,7 @@ static const struct mmc_test_case mmc_test_cases[] = { | |||
| 1040 | 1040 | ||
| 1041 | }; | 1041 | }; |
| 1042 | 1042 | ||
| 1043 | static struct mutex mmc_test_lock; | 1043 | static DEFINE_MUTEX(mmc_test_lock); |
| 1044 | 1044 | ||
| 1045 | static void mmc_test_run(struct mmc_test_card *test, int testcase) | 1045 | static void mmc_test_run(struct mmc_test_card *test, int testcase) |
| 1046 | { | 1046 | { |
| @@ -1171,8 +1171,6 @@ static int mmc_test_probe(struct mmc_card *card) | |||
| 1171 | if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD)) | 1171 | if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD)) |
| 1172 | return -ENODEV; | 1172 | return -ENODEV; |
| 1173 | 1173 | ||
| 1174 | mutex_init(&mmc_test_lock); | ||
| 1175 | |||
| 1176 | ret = device_create_file(&card->dev, &dev_attr_test); | 1174 | ret = device_create_file(&card->dev, &dev_attr_test); |
| 1177 | if (ret) | 1175 | if (ret) |
| 1178 | return ret; | 1176 | return ret; |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 6915f40ac8ab..1f8b5b36222c 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
| @@ -621,12 +621,21 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command | |||
| 621 | if (cpu_is_at91sam9260 () || cpu_is_at91sam9263()) | 621 | if (cpu_is_at91sam9260 () || cpu_is_at91sam9263()) |
| 622 | if (host->total_length < 12) | 622 | if (host->total_length < 12) |
| 623 | host->total_length = 12; | 623 | host->total_length = 12; |
| 624 | host->buffer = dma_alloc_coherent(NULL, | 624 | |
| 625 | host->total_length, | 625 | host->buffer = kmalloc(host->total_length, GFP_KERNEL); |
| 626 | &host->physical_address, GFP_KERNEL); | 626 | if (!host->buffer) { |
| 627 | pr_debug("Can't alloc tx buffer\n"); | ||
| 628 | cmd->error = -ENOMEM; | ||
| 629 | mmc_request_done(host->mmc, host->request); | ||
| 630 | return; | ||
| 631 | } | ||
| 627 | 632 | ||
| 628 | at91_mci_sg_to_dma(host, data); | 633 | at91_mci_sg_to_dma(host, data); |
| 629 | 634 | ||
| 635 | host->physical_address = dma_map_single(NULL, | ||
| 636 | host->buffer, host->total_length, | ||
| 637 | DMA_TO_DEVICE); | ||
| 638 | |||
| 630 | pr_debug("Transmitting %d bytes\n", host->total_length); | 639 | pr_debug("Transmitting %d bytes\n", host->total_length); |
| 631 | 640 | ||
| 632 | at91_mci_write(host, ATMEL_PDC_TPR, host->physical_address); | 641 | at91_mci_write(host, ATMEL_PDC_TPR, host->physical_address); |
| @@ -694,7 +703,10 @@ static void at91_mci_completed_command(struct at91mci_host *host, unsigned int s | |||
| 694 | cmd->resp[3] = at91_mci_read(host, AT91_MCI_RSPR(3)); | 703 | cmd->resp[3] = at91_mci_read(host, AT91_MCI_RSPR(3)); |
| 695 | 704 | ||
| 696 | if (host->buffer) { | 705 | if (host->buffer) { |
| 697 | dma_free_coherent(NULL, host->total_length, host->buffer, host->physical_address); | 706 | dma_unmap_single(NULL, |
| 707 | host->physical_address, host->total_length, | ||
| 708 | DMA_TO_DEVICE); | ||
| 709 | kfree(host->buffer); | ||
| 698 | host->buffer = NULL; | 710 | host->buffer = NULL; |
| 699 | } | 711 | } |
| 700 | 712 | ||
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 0bd06f5bd62f..917035e16da4 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
| @@ -195,7 +195,9 @@ static int atmci_regs_show(struct seq_file *s, void *v) | |||
| 195 | 195 | ||
| 196 | /* Grab a more or less consistent snapshot */ | 196 | /* Grab a more or less consistent snapshot */ |
| 197 | spin_lock_irq(&host->mmc->lock); | 197 | spin_lock_irq(&host->mmc->lock); |
| 198 | clk_enable(host->mck); | ||
| 198 | memcpy_fromio(buf, host->regs, MCI_REGS_SIZE); | 199 | memcpy_fromio(buf, host->regs, MCI_REGS_SIZE); |
| 200 | clk_disable(host->mck); | ||
| 199 | spin_unlock_irq(&host->mmc->lock); | 201 | spin_unlock_irq(&host->mmc->lock); |
| 200 | 202 | ||
| 201 | seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n", | 203 | seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n", |
| @@ -216,6 +218,8 @@ static int atmci_regs_show(struct seq_file *s, void *v) | |||
| 216 | atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]); | 218 | atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]); |
| 217 | atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]); | 219 | atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]); |
| 218 | 220 | ||
| 221 | kfree(buf); | ||
| 222 | |||
| 219 | return 0; | 223 | return 0; |
| 220 | } | 224 | } |
| 221 | 225 | ||
| @@ -237,7 +241,6 @@ static void atmci_init_debugfs(struct atmel_mci *host) | |||
| 237 | struct mmc_host *mmc; | 241 | struct mmc_host *mmc; |
| 238 | struct dentry *root; | 242 | struct dentry *root; |
| 239 | struct dentry *node; | 243 | struct dentry *node; |
| 240 | struct resource *res; | ||
| 241 | 244 | ||
| 242 | mmc = host->mmc; | 245 | mmc = host->mmc; |
| 243 | root = mmc->debugfs_root; | 246 | root = mmc->debugfs_root; |
| @@ -251,9 +254,6 @@ static void atmci_init_debugfs(struct atmel_mci *host) | |||
| 251 | if (!node) | 254 | if (!node) |
| 252 | goto err; | 255 | goto err; |
| 253 | 256 | ||
| 254 | res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0); | ||
| 255 | node->d_inode->i_size = res->end - res->start + 1; | ||
| 256 | |||
| 257 | node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops); | 257 | node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops); |
| 258 | if (!node) | 258 | if (!node) |
| 259 | goto err; | 259 | goto err; |
| @@ -1059,6 +1059,10 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
| 1059 | host->present = !gpio_get_value(host->detect_pin); | 1059 | host->present = !gpio_get_value(host->detect_pin); |
| 1060 | } | 1060 | } |
| 1061 | } | 1061 | } |
| 1062 | |||
| 1063 | if (!gpio_is_valid(host->detect_pin)) | ||
| 1064 | mmc->caps |= MMC_CAP_NEEDS_POLL; | ||
| 1065 | |||
| 1062 | if (gpio_is_valid(host->wp_pin)) { | 1066 | if (gpio_is_valid(host->wp_pin)) { |
| 1063 | if (gpio_request(host->wp_pin, "mmc_wp")) { | 1067 | if (gpio_request(host->wp_pin, "mmc_wp")) { |
| 1064 | dev_dbg(&mmc->class_dev, "no WP pin available\n"); | 1068 | dev_dbg(&mmc->class_dev, "no WP pin available\n"); |
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 7c994e1ae276..ae16d845d746 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c | |||
| @@ -595,8 +595,9 @@ static irqreturn_t s3cmci_irq_cd(int irq, void *dev_id) | |||
| 595 | return IRQ_HANDLED; | 595 | return IRQ_HANDLED; |
| 596 | } | 596 | } |
| 597 | 597 | ||
| 598 | void s3cmci_dma_done_callback(struct s3c2410_dma_chan *dma_ch, void *buf_id, | 598 | static void s3cmci_dma_done_callback(struct s3c2410_dma_chan *dma_ch, |
| 599 | int size, enum s3c2410_dma_buffresult result) | 599 | void *buf_id, int size, |
| 600 | enum s3c2410_dma_buffresult result) | ||
| 600 | { | 601 | { |
| 601 | struct s3cmci_host *host = buf_id; | 602 | struct s3cmci_host *host = buf_id; |
| 602 | unsigned long iflags; | 603 | unsigned long iflags; |
| @@ -740,8 +741,8 @@ request_done: | |||
| 740 | mmc_request_done(host->mmc, mrq); | 741 | mmc_request_done(host->mmc, mrq); |
| 741 | } | 742 | } |
| 742 | 743 | ||
| 743 | 744 | static void s3cmci_dma_setup(struct s3cmci_host *host, | |
| 744 | void s3cmci_dma_setup(struct s3cmci_host *host, enum s3c2410_dmasrc source) | 745 | enum s3c2410_dmasrc source) |
| 745 | { | 746 | { |
| 746 | static enum s3c2410_dmasrc last_source = -1; | 747 | static enum s3c2410_dmasrc last_source = -1; |
| 747 | static int setup_ok; | 748 | static int setup_ok; |
| @@ -1003,8 +1004,9 @@ static void s3cmci_send_request(struct mmc_host *mmc) | |||
| 1003 | enable_irq(host->irq); | 1004 | enable_irq(host->irq); |
| 1004 | } | 1005 | } |
| 1005 | 1006 | ||
| 1006 | static int s3cmci_card_present(struct s3cmci_host *host) | 1007 | static int s3cmci_card_present(struct mmc_host *mmc) |
| 1007 | { | 1008 | { |
| 1009 | struct s3cmci_host *host = mmc_priv(mmc); | ||
| 1008 | struct s3c24xx_mci_pdata *pdata = host->pdata; | 1010 | struct s3c24xx_mci_pdata *pdata = host->pdata; |
| 1009 | int ret; | 1011 | int ret; |
| 1010 | 1012 | ||
| @@ -1023,7 +1025,7 @@ static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
| 1023 | host->cmd_is_stop = 0; | 1025 | host->cmd_is_stop = 0; |
| 1024 | host->mrq = mrq; | 1026 | host->mrq = mrq; |
| 1025 | 1027 | ||
| 1026 | if (s3cmci_card_present(host) == 0) { | 1028 | if (s3cmci_card_present(mmc) == 0) { |
| 1027 | dbg(host, dbg_err, "%s: no medium present\n", __func__); | 1029 | dbg(host, dbg_err, "%s: no medium present\n", __func__); |
| 1028 | host->mrq->cmd->error = -ENOMEDIUM; | 1030 | host->mrq->cmd->error = -ENOMEDIUM; |
| 1029 | mmc_request_done(mmc, mrq); | 1031 | mmc_request_done(mmc, mrq); |
| @@ -1138,6 +1140,7 @@ static struct mmc_host_ops s3cmci_ops = { | |||
| 1138 | .request = s3cmci_request, | 1140 | .request = s3cmci_request, |
| 1139 | .set_ios = s3cmci_set_ios, | 1141 | .set_ios = s3cmci_set_ios, |
| 1140 | .get_ro = s3cmci_get_ro, | 1142 | .get_ro = s3cmci_get_ro, |
| 1143 | .get_cd = s3cmci_card_present, | ||
| 1141 | }; | 1144 | }; |
| 1142 | 1145 | ||
| 1143 | static struct s3c24xx_mci_pdata s3cmci_def_pdata = { | 1146 | static struct s3c24xx_mci_pdata s3cmci_def_pdata = { |
| @@ -1206,7 +1209,7 @@ static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) | |||
| 1206 | } | 1209 | } |
| 1207 | 1210 | ||
| 1208 | host->base = ioremap(host->mem->start, RESSIZE(host->mem)); | 1211 | host->base = ioremap(host->mem->start, RESSIZE(host->mem)); |
| 1209 | if (host->base == 0) { | 1212 | if (!host->base) { |
| 1210 | dev_err(&pdev->dev, "failed to ioremap() io memory region.\n"); | 1213 | dev_err(&pdev->dev, "failed to ioremap() io memory region.\n"); |
| 1211 | ret = -EINVAL; | 1214 | ret = -EINVAL; |
| 1212 | goto probe_free_mem_region; | 1215 | goto probe_free_mem_region; |
diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c index f99e9f721629..1df44d966bdb 100644 --- a/drivers/mmc/host/sdricoh_cs.c +++ b/drivers/mmc/host/sdricoh_cs.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
| 30 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
| 31 | #include <linux/scatterlist.h> | 31 | #include <linux/scatterlist.h> |
| 32 | #include <linux/version.h> | ||
| 33 | 32 | ||
| 34 | #include <pcmcia/cs_types.h> | 33 | #include <pcmcia/cs_types.h> |
| 35 | #include <pcmcia/cs.h> | 34 | #include <pcmcia/cs.h> |
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 9e647a06054f..ba2b4240a86a 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h | |||
| @@ -159,10 +159,10 @@ static inline void tmio_mmc_kunmap_atomic(struct tmio_mmc_host *host, | |||
| 159 | #define STATUS_TO_TEXT(a) \ | 159 | #define STATUS_TO_TEXT(a) \ |
| 160 | do { \ | 160 | do { \ |
| 161 | if (status & TMIO_STAT_##a) \ | 161 | if (status & TMIO_STAT_##a) \ |
| 162 | printf(#a); \ | 162 | printk(#a); \ |
| 163 | } while (0) | 163 | } while (0) |
| 164 | 164 | ||
| 165 | void debug_status(u32 status) | 165 | void pr_debug_status(u32 status) |
| 166 | { | 166 | { |
| 167 | printk(KERN_DEBUG "status: %08x = ", status); | 167 | printk(KERN_DEBUG "status: %08x = ", status); |
| 168 | STATUS_TO_TEXT(CARD_REMOVE); | 168 | STATUS_TO_TEXT(CARD_REMOVE); |
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c index 948b86f35ef4..d1eec7d3243f 100644 --- a/drivers/mtd/maps/amd76xrom.c +++ b/drivers/mtd/maps/amd76xrom.c | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #include <linux/version.h> | ||
| 10 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 11 | #include <linux/init.h> | 10 | #include <linux/init.h> |
| 12 | #include <asm/io.h> | 11 | #include <asm/io.h> |
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index effaf7cdefab..1a6feb4474de 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
| 12 | #include <linux/version.h> | ||
| 13 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 15 | #include <asm/io.h> | 14 | #include <asm/io.h> |
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c index aa64a4752781..bbbcdd4c8d13 100644 --- a/drivers/mtd/maps/esb2rom.c +++ b/drivers/mtd/maps/esb2rom.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/version.h> | ||
| 16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| 18 | #include <asm/io.h> | 17 | #include <asm/io.h> |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index d2f331876e4c..e00d424e6575 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
| @@ -410,16 +410,20 @@ static int mtd_ioctl(struct inode *inode, struct file *file, | |||
| 410 | 410 | ||
| 411 | case MEMGETREGIONINFO: | 411 | case MEMGETREGIONINFO: |
| 412 | { | 412 | { |
| 413 | struct region_info_user ur; | 413 | uint32_t ur_idx; |
| 414 | struct mtd_erase_region_info *kr; | ||
| 415 | struct region_info_user *ur = (struct region_info_user *) argp; | ||
| 414 | 416 | ||
| 415 | if (copy_from_user(&ur, argp, sizeof(struct region_info_user))) | 417 | if (get_user(ur_idx, &(ur->regionindex))) |
| 416 | return -EFAULT; | 418 | return -EFAULT; |
| 417 | 419 | ||
| 418 | if (ur.regionindex >= mtd->numeraseregions) | 420 | kr = &(mtd->eraseregions[ur_idx]); |
| 419 | return -EINVAL; | 421 | |
| 420 | if (copy_to_user(argp, &(mtd->eraseregions[ur.regionindex]), | 422 | if (put_user(kr->offset, &(ur->offset)) |
| 421 | sizeof(struct mtd_erase_region_info))) | 423 | || put_user(kr->erasesize, &(ur->erasesize)) |
| 424 | || put_user(kr->numblocks, &(ur->numblocks))) | ||
| 422 | return -EFAULT; | 425 | return -EFAULT; |
| 426 | |||
| 423 | break; | 427 | break; |
| 424 | } | 428 | } |
| 425 | 429 | ||
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c index 761946ea45b1..92c334ff4508 100644 --- a/drivers/mtd/nand/au1550nd.c +++ b/drivers/mtd/nand/au1550nd.c | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
| 17 | #include <linux/mtd/nand.h> | 17 | #include <linux/mtd/nand.h> |
| 18 | #include <linux/mtd/partitions.h> | 18 | #include <linux/mtd/partitions.h> |
| 19 | #include <linux/version.h> | ||
| 20 | #include <asm/io.h> | 19 | #include <asm/io.h> |
| 21 | 20 | ||
| 22 | #include <asm/mach-au1x00/au1xxx.h> | 21 | #include <asm/mach-au1x00/au1xxx.h> |
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index 64002488c6ee..917cf8d3ae95 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #include <asm/io.h> | 19 | #include <asm/io.h> |
| 20 | #include <asm/sizes.h> | 20 | #include <asm/sizes.h> |
| 21 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
| 22 | #include <asm/plat-orion/orion_nand.h> | 22 | #include <plat/orion_nand.h> |
| 23 | 23 | ||
| 24 | #ifdef CONFIG_MTD_CMDLINE_PARTS | 24 | #ifdef CONFIG_MTD_CMDLINE_PARTS |
| 25 | static const char *part_probes[] = { "cmdlinepart", NULL }; | 25 | static const char *part_probes[] = { "cmdlinepart", NULL }; |
diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c index cbab654b03c8..edb1e322113d 100644 --- a/drivers/mtd/nand/tmio_nand.c +++ b/drivers/mtd/nand/tmio_nand.c | |||
| @@ -109,7 +109,7 @@ struct tmio_nand { | |||
| 109 | 109 | ||
| 110 | void __iomem *ccr; | 110 | void __iomem *ccr; |
| 111 | void __iomem *fcr; | 111 | void __iomem *fcr; |
| 112 | unsigned long fcr_phys; | 112 | unsigned long fcr_base; |
| 113 | 113 | ||
| 114 | unsigned int irq; | 114 | unsigned int irq; |
| 115 | 115 | ||
| @@ -316,8 +316,8 @@ static int tmio_hw_init(struct platform_device *dev, struct tmio_nand *tmio) | |||
| 316 | tmio_iowrite8(0x81, tmio->ccr + CCR_ICC); | 316 | tmio_iowrite8(0x81, tmio->ccr + CCR_ICC); |
| 317 | 317 | ||
| 318 | /* (10h)BaseAddress 0x1000 spba.spba2 */ | 318 | /* (10h)BaseAddress 0x1000 spba.spba2 */ |
| 319 | tmio_iowrite16(tmio->fcr_phys, tmio->ccr + CCR_BASE); | 319 | tmio_iowrite16(tmio->fcr_base, tmio->ccr + CCR_BASE); |
| 320 | tmio_iowrite16(tmio->fcr_phys >> 16, tmio->ccr + CCR_BASE + 16); | 320 | tmio_iowrite16(tmio->fcr_base >> 16, tmio->ccr + CCR_BASE + 2); |
| 321 | 321 | ||
| 322 | /* (04h)Command Register I/O spcmd */ | 322 | /* (04h)Command Register I/O spcmd */ |
| 323 | tmio_iowrite8(0x02, tmio->ccr + CCR_COMMAND); | 323 | tmio_iowrite8(0x02, tmio->ccr + CCR_COMMAND); |
| @@ -395,7 +395,7 @@ static int tmio_probe(struct platform_device *dev) | |||
| 395 | goto err_iomap_ccr; | 395 | goto err_iomap_ccr; |
| 396 | } | 396 | } |
| 397 | 397 | ||
| 398 | tmio->fcr_phys = (unsigned long)fcr->start; | 398 | tmio->fcr_base = fcr->start & 0xfffff; |
| 399 | tmio->fcr = ioremap(fcr->start, fcr->end - fcr->start + 1); | 399 | tmio->fcr = ioremap(fcr->start, fcr->end - fcr->start + 1); |
| 400 | if (!tmio->fcr) { | 400 | if (!tmio->fcr) { |
| 401 | retval = -EIO; | 401 | retval = -EIO; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 4b4cb2bf4f11..4a11296a9514 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -822,14 +822,14 @@ config ULTRA32 | |||
| 822 | will be called smc-ultra32. | 822 | will be called smc-ultra32. |
| 823 | 823 | ||
| 824 | config BFIN_MAC | 824 | config BFIN_MAC |
| 825 | tristate "Blackfin 527/536/537 on-chip mac support" | 825 | tristate "Blackfin on-chip MAC support" |
| 826 | depends on NET_ETHERNET && (BF527 || BF537 || BF536) | 826 | depends on NET_ETHERNET && (BF526 || BF527 || BF536 || BF537) |
| 827 | select CRC32 | 827 | select CRC32 |
| 828 | select MII | 828 | select MII |
| 829 | select PHYLIB | 829 | select PHYLIB |
| 830 | select BFIN_MAC_USE_L1 if DMA_UNCACHED_NONE | 830 | select BFIN_MAC_USE_L1 if DMA_UNCACHED_NONE |
| 831 | help | 831 | help |
| 832 | This is the driver for blackfin on-chip mac device. Say Y if you want it | 832 | This is the driver for Blackfin on-chip mac device. Say Y if you want it |
| 833 | compiled into the kernel. This driver is also available as a module | 833 | compiled into the kernel. This driver is also available as a module |
| 834 | ( = code which can be inserted in and removed from the running kernel | 834 | ( = code which can be inserted in and removed from the running kernel |
| 835 | whenever you want). The module will be called bfin_mac. | 835 | whenever you want). The module will be called bfin_mac. |
| @@ -1172,7 +1172,7 @@ config ETH16I | |||
| 1172 | 1172 | ||
| 1173 | config NE2000 | 1173 | config NE2000 |
| 1174 | tristate "NE2000/NE1000 support" | 1174 | tristate "NE2000/NE1000 support" |
| 1175 | depends on NET_ISA || (Q40 && m) || M32R || TOSHIBA_RBTX4927 || TOSHIBA_RBTX4938 | 1175 | depends on NET_ISA || (Q40 && m) || M32R || MACH_TX49XX |
| 1176 | select CRC32 | 1176 | select CRC32 |
| 1177 | ---help--- | 1177 | ---help--- |
| 1178 | If you have a network (Ethernet) card of this type, say Y and read | 1178 | If you have a network (Ethernet) card of this type, say Y and read |
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index e4483de84e7f..66de80b64b92 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
| @@ -52,7 +52,6 @@ | |||
| 52 | 52 | ||
| 53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
| 54 | #include <linux/moduleparam.h> | 54 | #include <linux/moduleparam.h> |
| 55 | #include <linux/version.h> | ||
| 56 | #include <linux/types.h> | 55 | #include <linux/types.h> |
| 57 | #include <linux/errno.h> | 56 | #include <linux/errno.h> |
| 58 | #include <linux/ioport.h> | 57 | #include <linux/ioport.h> |
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c index 020771bfb603..e2d702b8b2e4 100644 --- a/drivers/net/arm/ixp4xx_eth.c +++ b/drivers/net/arm/ixp4xx_eth.c | |||
| @@ -551,7 +551,7 @@ static int eth_poll(struct napi_struct *napi, int budget) | |||
| 551 | if ((skb = netdev_alloc_skb(dev, RX_BUFF_SIZE))) { | 551 | if ((skb = netdev_alloc_skb(dev, RX_BUFF_SIZE))) { |
| 552 | phys = dma_map_single(&dev->dev, skb->data, | 552 | phys = dma_map_single(&dev->dev, skb->data, |
| 553 | RX_BUFF_SIZE, DMA_FROM_DEVICE); | 553 | RX_BUFF_SIZE, DMA_FROM_DEVICE); |
| 554 | if (dma_mapping_error(phys)) { | 554 | if (dma_mapping_error(&dev->dev, phys)) { |
| 555 | dev_kfree_skb(skb); | 555 | dev_kfree_skb(skb); |
| 556 | skb = NULL; | 556 | skb = NULL; |
| 557 | } | 557 | } |
| @@ -698,7 +698,7 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 698 | #endif | 698 | #endif |
| 699 | 699 | ||
| 700 | phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); | 700 | phys = dma_map_single(&dev->dev, mem, bytes, DMA_TO_DEVICE); |
| 701 | if (dma_mapping_error(phys)) { | 701 | if (dma_mapping_error(&dev->dev, phys)) { |
| 702 | #ifdef __ARMEB__ | 702 | #ifdef __ARMEB__ |
| 703 | dev_kfree_skb(skb); | 703 | dev_kfree_skb(skb); |
| 704 | #else | 704 | #else |
| @@ -883,7 +883,7 @@ static int init_queues(struct port *port) | |||
| 883 | desc->buf_len = MAX_MRU; | 883 | desc->buf_len = MAX_MRU; |
| 884 | desc->data = dma_map_single(&port->netdev->dev, data, | 884 | desc->data = dma_map_single(&port->netdev->dev, data, |
| 885 | RX_BUFF_SIZE, DMA_FROM_DEVICE); | 885 | RX_BUFF_SIZE, DMA_FROM_DEVICE); |
| 886 | if (dma_mapping_error(desc->data)) { | 886 | if (dma_mapping_error(&port->netdev->dev, desc->data)) { |
| 887 | free_buffer(buff); | 887 | free_buffer(buff); |
| 888 | return -EIO; | 888 | return -EIO; |
| 889 | } | 889 | } |
diff --git a/drivers/net/atl1e/atl1e_ethtool.c b/drivers/net/atl1e/atl1e_ethtool.c index cdc3b85b10b9..619c6583e1aa 100644 --- a/drivers/net/atl1e/atl1e_ethtool.c +++ b/drivers/net/atl1e/atl1e_ethtool.c | |||
| @@ -355,7 +355,7 @@ static int atl1e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
| 355 | struct atl1e_adapter *adapter = netdev_priv(netdev); | 355 | struct atl1e_adapter *adapter = netdev_priv(netdev); |
| 356 | 356 | ||
| 357 | if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE | | 357 | if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE | |
| 358 | WAKE_MCAST | WAKE_BCAST | WAKE_MCAST)) | 358 | WAKE_UCAST | WAKE_MCAST | WAKE_BCAST)) |
| 359 | return -EOPNOTSUPP; | 359 | return -EOPNOTSUPP; |
| 360 | /* these settings will always override what we currently have */ | 360 | /* these settings will always override what we currently have */ |
| 361 | adapter->wol = 0; | 361 | adapter->wol = 0; |
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c index 82d7be1655d3..7685b995ff9b 100644 --- a/drivers/net/atl1e/atl1e_main.c +++ b/drivers/net/atl1e/atl1e_main.c | |||
| @@ -2232,10 +2232,11 @@ static int atl1e_resume(struct pci_dev *pdev) | |||
| 2232 | 2232 | ||
| 2233 | AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); | 2233 | AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); |
| 2234 | 2234 | ||
| 2235 | if (netif_running(netdev)) | 2235 | if (netif_running(netdev)) { |
| 2236 | err = atl1e_request_irq(adapter); | 2236 | err = atl1e_request_irq(adapter); |
| 2237 | if (err) | 2237 | if (err) |
| 2238 | return err; | 2238 | return err; |
| 2239 | } | ||
| 2239 | 2240 | ||
| 2240 | atl1e_reset_hw(&adapter->hw); | 2241 | atl1e_reset_hw(&adapter->hw); |
| 2241 | 2242 | ||
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index e6a7bb79d4df..e23ce77712f1 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
| @@ -3022,7 +3022,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
| 3022 | netdev->features = NETIF_F_HW_CSUM; | 3022 | netdev->features = NETIF_F_HW_CSUM; |
| 3023 | netdev->features |= NETIF_F_SG; | 3023 | netdev->features |= NETIF_F_SG; |
| 3024 | netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); | 3024 | netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); |
| 3025 | netdev->features |= NETIF_F_TSO; | ||
| 3026 | netdev->features |= NETIF_F_LLTX; | 3025 | netdev->features |= NETIF_F_LLTX; |
| 3027 | 3026 | ||
| 3028 | /* | 3027 | /* |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index cb8be490e5ae..5ee1b0557a02 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
| @@ -807,7 +807,7 @@ err_out: | |||
| 807 | static int au1000_init(struct net_device *dev) | 807 | static int au1000_init(struct net_device *dev) |
| 808 | { | 808 | { |
| 809 | struct au1000_private *aup = (struct au1000_private *) dev->priv; | 809 | struct au1000_private *aup = (struct au1000_private *) dev->priv; |
| 810 | u32 flags; | 810 | unsigned long flags; |
| 811 | int i; | 811 | int i; |
| 812 | u32 control; | 812 | u32 control; |
| 813 | 813 | ||
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 0b4adf4a0f7d..a886a4b9f7e5 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c | |||
| @@ -554,7 +554,7 @@ static int ax_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
| 554 | 554 | ||
| 555 | spin_lock_irqsave(&ax->mii_lock, flags); | 555 | spin_lock_irqsave(&ax->mii_lock, flags); |
| 556 | mii_ethtool_gset(&ax->mii, cmd); | 556 | mii_ethtool_gset(&ax->mii, cmd); |
| 557 | spin_lock_irqsave(&ax->mii_lock, flags); | 557 | spin_unlock_irqrestore(&ax->mii_lock, flags); |
| 558 | 558 | ||
| 559 | return 0; | 559 | return 0; |
| 560 | } | 560 | } |
| @@ -567,7 +567,7 @@ static int ax_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
| 567 | 567 | ||
| 568 | spin_lock_irqsave(&ax->mii_lock, flags); | 568 | spin_lock_irqsave(&ax->mii_lock, flags); |
| 569 | rc = mii_ethtool_sset(&ax->mii, cmd); | 569 | rc = mii_ethtool_sset(&ax->mii, cmd); |
| 570 | spin_lock_irqsave(&ax->mii_lock, flags); | 570 | spin_unlock_irqrestore(&ax->mii_lock, flags); |
| 571 | 571 | ||
| 572 | return rc; | 572 | return rc; |
| 573 | } | 573 | } |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 5ebde67d4297..2486a656f12d 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
| @@ -35,8 +35,8 @@ | |||
| 35 | #include <linux/time.h> | 35 | #include <linux/time.h> |
| 36 | #include <linux/ethtool.h> | 36 | #include <linux/ethtool.h> |
| 37 | #include <linux/mii.h> | 37 | #include <linux/mii.h> |
| 38 | #ifdef NETIF_F_HW_VLAN_TX | ||
| 39 | #include <linux/if_vlan.h> | 38 | #include <linux/if_vlan.h> |
| 39 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
| 40 | #define BCM_VLAN 1 | 40 | #define BCM_VLAN 1 |
| 41 | #endif | 41 | #endif |
| 42 | #include <net/ip.h> | 42 | #include <net/ip.h> |
| @@ -57,8 +57,8 @@ | |||
| 57 | 57 | ||
| 58 | #define DRV_MODULE_NAME "bnx2" | 58 | #define DRV_MODULE_NAME "bnx2" |
| 59 | #define PFX DRV_MODULE_NAME ": " | 59 | #define PFX DRV_MODULE_NAME ": " |
| 60 | #define DRV_MODULE_VERSION "1.7.9" | 60 | #define DRV_MODULE_VERSION "1.8.0" |
| 61 | #define DRV_MODULE_RELDATE "July 18, 2008" | 61 | #define DRV_MODULE_RELDATE "Aug 14, 2008" |
| 62 | 62 | ||
| 63 | #define RUN_AT(x) (jiffies + (x)) | 63 | #define RUN_AT(x) (jiffies + (x)) |
| 64 | 64 | ||
| @@ -2876,6 +2876,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
| 2876 | struct sw_bd *rx_buf; | 2876 | struct sw_bd *rx_buf; |
| 2877 | struct sk_buff *skb; | 2877 | struct sk_buff *skb; |
| 2878 | dma_addr_t dma_addr; | 2878 | dma_addr_t dma_addr; |
| 2879 | u16 vtag = 0; | ||
| 2880 | int hw_vlan __maybe_unused = 0; | ||
| 2879 | 2881 | ||
| 2880 | sw_ring_cons = RX_RING_IDX(sw_cons); | 2882 | sw_ring_cons = RX_RING_IDX(sw_cons); |
| 2881 | sw_ring_prod = RX_RING_IDX(sw_prod); | 2883 | sw_ring_prod = RX_RING_IDX(sw_prod); |
| @@ -2919,7 +2921,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
| 2919 | if (len <= bp->rx_copy_thresh) { | 2921 | if (len <= bp->rx_copy_thresh) { |
| 2920 | struct sk_buff *new_skb; | 2922 | struct sk_buff *new_skb; |
| 2921 | 2923 | ||
| 2922 | new_skb = netdev_alloc_skb(bp->dev, len + 2); | 2924 | new_skb = netdev_alloc_skb(bp->dev, len + 6); |
| 2923 | if (new_skb == NULL) { | 2925 | if (new_skb == NULL) { |
| 2924 | bnx2_reuse_rx_skb(bp, rxr, skb, sw_ring_cons, | 2926 | bnx2_reuse_rx_skb(bp, rxr, skb, sw_ring_cons, |
| 2925 | sw_ring_prod); | 2927 | sw_ring_prod); |
| @@ -2928,9 +2930,9 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
| 2928 | 2930 | ||
| 2929 | /* aligned copy */ | 2931 | /* aligned copy */ |
| 2930 | skb_copy_from_linear_data_offset(skb, | 2932 | skb_copy_from_linear_data_offset(skb, |
| 2931 | BNX2_RX_OFFSET - 2, | 2933 | BNX2_RX_OFFSET - 6, |
| 2932 | new_skb->data, len + 2); | 2934 | new_skb->data, len + 6); |
| 2933 | skb_reserve(new_skb, 2); | 2935 | skb_reserve(new_skb, 6); |
| 2934 | skb_put(new_skb, len); | 2936 | skb_put(new_skb, len); |
| 2935 | 2937 | ||
| 2936 | bnx2_reuse_rx_skb(bp, rxr, skb, | 2938 | bnx2_reuse_rx_skb(bp, rxr, skb, |
| @@ -2941,6 +2943,25 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
| 2941 | dma_addr, (sw_ring_cons << 16) | sw_ring_prod))) | 2943 | dma_addr, (sw_ring_cons << 16) | sw_ring_prod))) |
| 2942 | goto next_rx; | 2944 | goto next_rx; |
| 2943 | 2945 | ||
| 2946 | if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && | ||
| 2947 | !(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) { | ||
| 2948 | vtag = rx_hdr->l2_fhdr_vlan_tag; | ||
| 2949 | #ifdef BCM_VLAN | ||
| 2950 | if (bp->vlgrp) | ||
| 2951 | hw_vlan = 1; | ||
| 2952 | else | ||
| 2953 | #endif | ||
| 2954 | { | ||
| 2955 | struct vlan_ethhdr *ve = (struct vlan_ethhdr *) | ||
| 2956 | __skb_push(skb, 4); | ||
| 2957 | |||
| 2958 | memmove(ve, skb->data + 4, ETH_ALEN * 2); | ||
| 2959 | ve->h_vlan_proto = htons(ETH_P_8021Q); | ||
| 2960 | ve->h_vlan_TCI = htons(vtag); | ||
| 2961 | len += 4; | ||
| 2962 | } | ||
| 2963 | } | ||
| 2964 | |||
| 2944 | skb->protocol = eth_type_trans(skb, bp->dev); | 2965 | skb->protocol = eth_type_trans(skb, bp->dev); |
| 2945 | 2966 | ||
| 2946 | if ((len > (bp->dev->mtu + ETH_HLEN)) && | 2967 | if ((len > (bp->dev->mtu + ETH_HLEN)) && |
| @@ -2962,10 +2983,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
| 2962 | } | 2983 | } |
| 2963 | 2984 | ||
| 2964 | #ifdef BCM_VLAN | 2985 | #ifdef BCM_VLAN |
| 2965 | if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && bp->vlgrp) { | 2986 | if (hw_vlan) |
| 2966 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, | 2987 | vlan_hwaccel_receive_skb(skb, bp->vlgrp, vtag); |
| 2967 | rx_hdr->l2_fhdr_vlan_tag); | ||
| 2968 | } | ||
| 2969 | else | 2988 | else |
| 2970 | #endif | 2989 | #endif |
| 2971 | netif_receive_skb(skb); | 2990 | netif_receive_skb(skb); |
| @@ -3237,10 +3256,10 @@ bnx2_set_rx_mode(struct net_device *dev) | |||
| 3237 | BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); | 3256 | BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); |
| 3238 | sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN; | 3257 | sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN; |
| 3239 | #ifdef BCM_VLAN | 3258 | #ifdef BCM_VLAN |
| 3240 | if (!bp->vlgrp && !(bp->flags & BNX2_FLAG_ASF_ENABLE)) | 3259 | if (!bp->vlgrp && (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)) |
| 3241 | rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; | 3260 | rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; |
| 3242 | #else | 3261 | #else |
| 3243 | if (!(bp->flags & BNX2_FLAG_ASF_ENABLE)) | 3262 | if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN) |
| 3244 | rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; | 3263 | rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; |
| 3245 | #endif | 3264 | #endif |
| 3246 | if (dev->flags & IFF_PROMISC) { | 3265 | if (dev->flags & IFF_PROMISC) { |
| @@ -5963,10 +5982,12 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 5963 | vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM; | 5982 | vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM; |
| 5964 | } | 5983 | } |
| 5965 | 5984 | ||
| 5985 | #ifdef BCM_VLAN | ||
| 5966 | if (bp->vlgrp && vlan_tx_tag_present(skb)) { | 5986 | if (bp->vlgrp && vlan_tx_tag_present(skb)) { |
| 5967 | vlan_tag_flags |= | 5987 | vlan_tag_flags |= |
| 5968 | (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); | 5988 | (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); |
| 5969 | } | 5989 | } |
| 5990 | #endif | ||
| 5970 | if ((mss = skb_shinfo(skb)->gso_size)) { | 5991 | if ((mss = skb_shinfo(skb)->gso_size)) { |
| 5971 | u32 tcp_opt_len, ip_tcp_len; | 5992 | u32 tcp_opt_len, ip_tcp_len; |
| 5972 | struct iphdr *iph; | 5993 | struct iphdr *iph; |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index c3c579f98ed0..dfacd31f7ed0 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
| @@ -6597,7 +6597,7 @@ struct flash_spec { | |||
| 6597 | 6597 | ||
| 6598 | struct bnx2_irq { | 6598 | struct bnx2_irq { |
| 6599 | irq_handler_t handler; | 6599 | irq_handler_t handler; |
| 6600 | u16 vector; | 6600 | unsigned int vector; |
| 6601 | u8 requested; | 6601 | u8 requested; |
| 6602 | char name[16]; | 6602 | char name[16]; |
| 6603 | }; | 6603 | }; |
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h index b468f904c7f8..fd705d1295a7 100644 --- a/drivers/net/bnx2x.h +++ b/drivers/net/bnx2x.h | |||
| @@ -151,6 +151,8 @@ struct sw_rx_page { | |||
| 151 | #define PAGES_PER_SGE_SHIFT 0 | 151 | #define PAGES_PER_SGE_SHIFT 0 |
| 152 | #define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) | 152 | #define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) |
| 153 | 153 | ||
| 154 | #define BCM_RX_ETH_PAYLOAD_ALIGN 64 | ||
| 155 | |||
| 154 | /* SGE ring related macros */ | 156 | /* SGE ring related macros */ |
| 155 | #define NUM_RX_SGE_PAGES 2 | 157 | #define NUM_RX_SGE_PAGES 2 |
| 156 | #define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge)) | 158 | #define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge)) |
| @@ -271,7 +273,7 @@ struct bnx2x_fastpath { | |||
| 271 | (fp->tx_pkt_prod != fp->tx_pkt_cons)) | 273 | (fp->tx_pkt_prod != fp->tx_pkt_cons)) |
| 272 | 274 | ||
| 273 | #define BNX2X_HAS_RX_WORK(fp) \ | 275 | #define BNX2X_HAS_RX_WORK(fp) \ |
| 274 | (fp->rx_comp_cons != le16_to_cpu(*fp->rx_cons_sb)) | 276 | (fp->rx_comp_cons != rx_cons_sb) |
| 275 | 277 | ||
| 276 | #define BNX2X_HAS_WORK(fp) (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp)) | 278 | #define BNX2X_HAS_WORK(fp) (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp)) |
| 277 | 279 | ||
| @@ -750,8 +752,7 @@ struct bnx2x { | |||
| 750 | 752 | ||
| 751 | u32 rx_csum; | 753 | u32 rx_csum; |
| 752 | u32 rx_offset; | 754 | u32 rx_offset; |
| 753 | u32 rx_buf_use_size; /* useable size */ | 755 | u32 rx_buf_size; |
| 754 | u32 rx_buf_size; /* with alignment */ | ||
| 755 | #define ETH_OVREHEAD (ETH_HLEN + 8) /* 8 for CRC + VLAN */ | 756 | #define ETH_OVREHEAD (ETH_HLEN + 8) /* 8 for CRC + VLAN */ |
| 756 | #define ETH_MIN_PACKET_SIZE 60 | 757 | #define ETH_MIN_PACKET_SIZE 60 |
| 757 | #define ETH_MAX_PACKET_SIZE 1500 | 758 | #define ETH_MAX_PACKET_SIZE 1500 |
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c index 8b92c6ad0759..4ce7fe9c5251 100644 --- a/drivers/net/bnx2x_link.c +++ b/drivers/net/bnx2x_link.c | |||
| @@ -21,7 +21,6 @@ | |||
| 21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
| 22 | #include <linux/ethtool.h> | 22 | #include <linux/ethtool.h> |
| 23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
| 24 | #include <linux/version.h> | ||
| 25 | 24 | ||
| 26 | #include "bnx2x_reg.h" | 25 | #include "bnx2x_reg.h" |
| 27 | #include "bnx2x_fw_defs.h" | 26 | #include "bnx2x_fw_defs.h" |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 3e7dc171cdf1..a8eb3c4a47c8 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
| @@ -44,7 +44,6 @@ | |||
| 44 | #include <net/ip.h> | 44 | #include <net/ip.h> |
| 45 | #include <net/tcp.h> | 45 | #include <net/tcp.h> |
| 46 | #include <net/checksum.h> | 46 | #include <net/checksum.h> |
| 47 | #include <linux/version.h> | ||
| 48 | #include <net/ip6_checksum.h> | 47 | #include <net/ip6_checksum.h> |
| 49 | #include <linux/workqueue.h> | 48 | #include <linux/workqueue.h> |
| 50 | #include <linux/crc32.h> | 49 | #include <linux/crc32.h> |
| @@ -60,8 +59,8 @@ | |||
| 60 | #include "bnx2x.h" | 59 | #include "bnx2x.h" |
| 61 | #include "bnx2x_init.h" | 60 | #include "bnx2x_init.h" |
| 62 | 61 | ||
| 63 | #define DRV_MODULE_VERSION "1.45.17" | 62 | #define DRV_MODULE_VERSION "1.45.21" |
| 64 | #define DRV_MODULE_RELDATE "2008/08/13" | 63 | #define DRV_MODULE_RELDATE "2008/09/03" |
| 65 | #define BNX2X_BC_VER 0x040200 | 64 | #define BNX2X_BC_VER 0x040200 |
| 66 | 65 | ||
| 67 | /* Time in jiffies before concluding the transmitter is hung */ | 66 | /* Time in jiffies before concluding the transmitter is hung */ |
| @@ -1028,7 +1027,7 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp, | |||
| 1028 | if (unlikely(skb == NULL)) | 1027 | if (unlikely(skb == NULL)) |
| 1029 | return -ENOMEM; | 1028 | return -ENOMEM; |
| 1030 | 1029 | ||
| 1031 | mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size, | 1030 | mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_size, |
| 1032 | PCI_DMA_FROMDEVICE); | 1031 | PCI_DMA_FROMDEVICE); |
| 1033 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { | 1032 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { |
| 1034 | dev_kfree_skb(skb); | 1033 | dev_kfree_skb(skb); |
| @@ -1170,7 +1169,7 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, | |||
| 1170 | /* move empty skb from pool to prod and map it */ | 1169 | /* move empty skb from pool to prod and map it */ |
| 1171 | prod_rx_buf->skb = fp->tpa_pool[queue].skb; | 1170 | prod_rx_buf->skb = fp->tpa_pool[queue].skb; |
| 1172 | mapping = pci_map_single(bp->pdev, fp->tpa_pool[queue].skb->data, | 1171 | mapping = pci_map_single(bp->pdev, fp->tpa_pool[queue].skb->data, |
| 1173 | bp->rx_buf_use_size, PCI_DMA_FROMDEVICE); | 1172 | bp->rx_buf_size, PCI_DMA_FROMDEVICE); |
| 1174 | pci_unmap_addr_set(prod_rx_buf, mapping, mapping); | 1173 | pci_unmap_addr_set(prod_rx_buf, mapping, mapping); |
| 1175 | 1174 | ||
| 1176 | /* move partial skb from cons to pool (don't unmap yet) */ | 1175 | /* move partial skb from cons to pool (don't unmap yet) */ |
| @@ -1277,7 +1276,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 1277 | pool entry status to BNX2X_TPA_STOP even if new skb allocation | 1276 | pool entry status to BNX2X_TPA_STOP even if new skb allocation |
| 1278 | fails. */ | 1277 | fails. */ |
| 1279 | pci_unmap_single(bp->pdev, pci_unmap_addr(rx_buf, mapping), | 1278 | pci_unmap_single(bp->pdev, pci_unmap_addr(rx_buf, mapping), |
| 1280 | bp->rx_buf_use_size, PCI_DMA_FROMDEVICE); | 1279 | bp->rx_buf_size, PCI_DMA_FROMDEVICE); |
| 1281 | 1280 | ||
| 1282 | if (likely(new_skb)) { | 1281 | if (likely(new_skb)) { |
| 1283 | /* fix ip xsum and give it to the stack */ | 1282 | /* fix ip xsum and give it to the stack */ |
| @@ -1521,7 +1520,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) | |||
| 1521 | } else if (bnx2x_alloc_rx_skb(bp, fp, bd_prod) == 0) { | 1520 | } else if (bnx2x_alloc_rx_skb(bp, fp, bd_prod) == 0) { |
| 1522 | pci_unmap_single(bp->pdev, | 1521 | pci_unmap_single(bp->pdev, |
| 1523 | pci_unmap_addr(rx_buf, mapping), | 1522 | pci_unmap_addr(rx_buf, mapping), |
| 1524 | bp->rx_buf_use_size, | 1523 | bp->rx_buf_size, |
| 1525 | PCI_DMA_FROMDEVICE); | 1524 | PCI_DMA_FROMDEVICE); |
| 1526 | skb_reserve(skb, pad); | 1525 | skb_reserve(skb, pad); |
| 1527 | skb_put(skb, len); | 1526 | skb_put(skb, len); |
| @@ -1718,8 +1717,8 @@ static int bnx2x_acquire_hw_lock(struct bnx2x *bp, u32 resource) | |||
| 1718 | return -EEXIST; | 1717 | return -EEXIST; |
| 1719 | } | 1718 | } |
| 1720 | 1719 | ||
| 1721 | /* Try for 1 second every 5ms */ | 1720 | /* Try for 5 second every 5ms */ |
| 1722 | for (cnt = 0; cnt < 200; cnt++) { | 1721 | for (cnt = 0; cnt < 1000; cnt++) { |
| 1723 | /* Try to acquire the lock */ | 1722 | /* Try to acquire the lock */ |
| 1724 | REG_WR(bp, hw_lock_control_reg + 4, resource_bit); | 1723 | REG_WR(bp, hw_lock_control_reg + 4, resource_bit); |
| 1725 | lock_status = REG_RD(bp, hw_lock_control_reg); | 1724 | lock_status = REG_RD(bp, hw_lock_control_reg); |
| @@ -2551,6 +2550,7 @@ static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) | |||
| 2551 | BNX2X_ERR("SPIO5 hw attention\n"); | 2550 | BNX2X_ERR("SPIO5 hw attention\n"); |
| 2552 | 2551 | ||
| 2553 | switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { | 2552 | switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { |
| 2553 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G: | ||
| 2554 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: | 2554 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: |
| 2555 | /* Fan failure attention */ | 2555 | /* Fan failure attention */ |
| 2556 | 2556 | ||
| @@ -4229,7 +4229,7 @@ static inline void bnx2x_free_tpa_pool(struct bnx2x *bp, | |||
| 4229 | if (fp->tpa_state[i] == BNX2X_TPA_START) | 4229 | if (fp->tpa_state[i] == BNX2X_TPA_START) |
| 4230 | pci_unmap_single(bp->pdev, | 4230 | pci_unmap_single(bp->pdev, |
| 4231 | pci_unmap_addr(rx_buf, mapping), | 4231 | pci_unmap_addr(rx_buf, mapping), |
| 4232 | bp->rx_buf_use_size, | 4232 | bp->rx_buf_size, |
| 4233 | PCI_DMA_FROMDEVICE); | 4233 | PCI_DMA_FROMDEVICE); |
| 4234 | 4234 | ||
| 4235 | dev_kfree_skb(skb); | 4235 | dev_kfree_skb(skb); |
| @@ -4245,15 +4245,14 @@ static void bnx2x_init_rx_rings(struct bnx2x *bp) | |||
| 4245 | u16 ring_prod, cqe_ring_prod; | 4245 | u16 ring_prod, cqe_ring_prod; |
| 4246 | int i, j; | 4246 | int i, j; |
| 4247 | 4247 | ||
| 4248 | bp->rx_buf_use_size = bp->dev->mtu; | 4248 | bp->rx_buf_size = bp->dev->mtu; |
| 4249 | bp->rx_buf_use_size += bp->rx_offset + ETH_OVREHEAD; | 4249 | bp->rx_buf_size += bp->rx_offset + ETH_OVREHEAD + |
| 4250 | bp->rx_buf_size = bp->rx_buf_use_size + 64; | 4250 | BCM_RX_ETH_PAYLOAD_ALIGN; |
| 4251 | 4251 | ||
| 4252 | if (bp->flags & TPA_ENABLE_FLAG) { | 4252 | if (bp->flags & TPA_ENABLE_FLAG) { |
| 4253 | DP(NETIF_MSG_IFUP, | 4253 | DP(NETIF_MSG_IFUP, |
| 4254 | "rx_buf_use_size %d rx_buf_size %d effective_mtu %d\n", | 4254 | "rx_buf_size %d effective_mtu %d\n", |
| 4255 | bp->rx_buf_use_size, bp->rx_buf_size, | 4255 | bp->rx_buf_size, bp->dev->mtu + ETH_OVREHEAD); |
| 4256 | bp->dev->mtu + ETH_OVREHEAD); | ||
| 4257 | 4256 | ||
| 4258 | for_each_queue(bp, j) { | 4257 | for_each_queue(bp, j) { |
| 4259 | struct bnx2x_fastpath *fp = &bp->fp[j]; | 4258 | struct bnx2x_fastpath *fp = &bp->fp[j]; |
| @@ -4462,9 +4461,10 @@ static void bnx2x_init_context(struct bnx2x *bp) | |||
| 4462 | context->ustorm_st_context.common.status_block_id = sb_id; | 4461 | context->ustorm_st_context.common.status_block_id = sb_id; |
| 4463 | context->ustorm_st_context.common.flags = | 4462 | context->ustorm_st_context.common.flags = |
| 4464 | USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT; | 4463 | USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT; |
| 4465 | context->ustorm_st_context.common.mc_alignment_size = 64; | 4464 | context->ustorm_st_context.common.mc_alignment_size = |
| 4465 | BCM_RX_ETH_PAYLOAD_ALIGN; | ||
| 4466 | context->ustorm_st_context.common.bd_buff_size = | 4466 | context->ustorm_st_context.common.bd_buff_size = |
| 4467 | bp->rx_buf_use_size; | 4467 | bp->rx_buf_size; |
| 4468 | context->ustorm_st_context.common.bd_page_base_hi = | 4468 | context->ustorm_st_context.common.bd_page_base_hi = |
| 4469 | U64_HI(fp->rx_desc_mapping); | 4469 | U64_HI(fp->rx_desc_mapping); |
| 4470 | context->ustorm_st_context.common.bd_page_base_lo = | 4470 | context->ustorm_st_context.common.bd_page_base_lo = |
| @@ -4606,6 +4606,17 @@ static void bnx2x_init_internal_common(struct bnx2x *bp) | |||
| 4606 | { | 4606 | { |
| 4607 | int i; | 4607 | int i; |
| 4608 | 4608 | ||
| 4609 | if (bp->flags & TPA_ENABLE_FLAG) { | ||
| 4610 | struct tstorm_eth_tpa_exist tpa = {0}; | ||
| 4611 | |||
| 4612 | tpa.tpa_exist = 1; | ||
| 4613 | |||
| 4614 | REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET, | ||
| 4615 | ((u32 *)&tpa)[0]); | ||
| 4616 | REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET + 4, | ||
| 4617 | ((u32 *)&tpa)[1]); | ||
| 4618 | } | ||
| 4619 | |||
| 4609 | /* Zero this manually as its initialization is | 4620 | /* Zero this manually as its initialization is |
| 4610 | currently missing in the initTool */ | 4621 | currently missing in the initTool */ |
| 4611 | for (i = 0; i < (USTORM_AGG_DATA_SIZE >> 2); i++) | 4622 | for (i = 0; i < (USTORM_AGG_DATA_SIZE >> 2); i++) |
| @@ -4706,7 +4717,7 @@ static void bnx2x_init_internal_func(struct bnx2x *bp) | |||
| 4706 | } | 4717 | } |
| 4707 | 4718 | ||
| 4708 | /* Init CQ ring mapping and aggregation size */ | 4719 | /* Init CQ ring mapping and aggregation size */ |
| 4709 | max_agg_size = min((u32)(bp->rx_buf_use_size + | 4720 | max_agg_size = min((u32)(bp->rx_buf_size + |
| 4710 | 8*BCM_PAGE_SIZE*PAGES_PER_SGE), | 4721 | 8*BCM_PAGE_SIZE*PAGES_PER_SGE), |
| 4711 | (u32)0xffff); | 4722 | (u32)0xffff); |
| 4712 | for_each_queue(bp, i) { | 4723 | for_each_queue(bp, i) { |
| @@ -5338,6 +5349,7 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
| 5338 | } | 5349 | } |
| 5339 | 5350 | ||
| 5340 | switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { | 5351 | switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { |
| 5352 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G: | ||
| 5341 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: | 5353 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: |
| 5342 | /* Fan failure is indicated by SPIO 5 */ | 5354 | /* Fan failure is indicated by SPIO 5 */ |
| 5343 | bnx2x_set_spio(bp, MISC_REGISTERS_SPIO_5, | 5355 | bnx2x_set_spio(bp, MISC_REGISTERS_SPIO_5, |
| @@ -5364,17 +5376,6 @@ static int bnx2x_init_common(struct bnx2x *bp) | |||
| 5364 | 5376 | ||
| 5365 | enable_blocks_attention(bp); | 5377 | enable_blocks_attention(bp); |
| 5366 | 5378 | ||
| 5367 | if (bp->flags & TPA_ENABLE_FLAG) { | ||
| 5368 | struct tstorm_eth_tpa_exist tmp = {0}; | ||
| 5369 | |||
| 5370 | tmp.tpa_exist = 1; | ||
| 5371 | |||
| 5372 | REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET, | ||
| 5373 | ((u32 *)&tmp)[0]); | ||
| 5374 | REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET + 4, | ||
| 5375 | ((u32 *)&tmp)[1]); | ||
| 5376 | } | ||
| 5377 | |||
| 5378 | if (!BP_NOMCP(bp)) { | 5379 | if (!BP_NOMCP(bp)) { |
| 5379 | bnx2x_acquire_phy_lock(bp); | 5380 | bnx2x_acquire_phy_lock(bp); |
| 5380 | bnx2x_common_init_phy(bp, bp->common.shmem_base); | 5381 | bnx2x_common_init_phy(bp, bp->common.shmem_base); |
| @@ -5532,6 +5533,7 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
| 5532 | /* Port DMAE comes here */ | 5533 | /* Port DMAE comes here */ |
| 5533 | 5534 | ||
| 5534 | switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { | 5535 | switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { |
| 5536 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G: | ||
| 5535 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: | 5537 | case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: |
| 5536 | /* add SPIO 5 to group 0 */ | 5538 | /* add SPIO 5 to group 0 */ |
| 5537 | val = REG_RD(bp, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0); | 5539 | val = REG_RD(bp, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0); |
| @@ -5938,7 +5940,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp) | |||
| 5938 | 5940 | ||
| 5939 | pci_unmap_single(bp->pdev, | 5941 | pci_unmap_single(bp->pdev, |
| 5940 | pci_unmap_addr(rx_buf, mapping), | 5942 | pci_unmap_addr(rx_buf, mapping), |
| 5941 | bp->rx_buf_use_size, | 5943 | bp->rx_buf_size, |
| 5942 | PCI_DMA_FROMDEVICE); | 5944 | PCI_DMA_FROMDEVICE); |
| 5943 | 5945 | ||
| 5944 | rx_buf->skb = NULL; | 5946 | rx_buf->skb = NULL; |
| @@ -6056,6 +6058,44 @@ static int bnx2x_req_irq(struct bnx2x *bp) | |||
| 6056 | return rc; | 6058 | return rc; |
| 6057 | } | 6059 | } |
| 6058 | 6060 | ||
| 6061 | static void bnx2x_napi_enable(struct bnx2x *bp) | ||
| 6062 | { | ||
| 6063 | int i; | ||
| 6064 | |||
| 6065 | for_each_queue(bp, i) | ||
| 6066 | napi_enable(&bnx2x_fp(bp, i, napi)); | ||
| 6067 | } | ||
| 6068 | |||
| 6069 | static void bnx2x_napi_disable(struct bnx2x *bp) | ||
| 6070 | { | ||
| 6071 | int i; | ||
| 6072 | |||
| 6073 | for_each_queue(bp, i) | ||
| 6074 | napi_disable(&bnx2x_fp(bp, i, napi)); | ||
| 6075 | } | ||
| 6076 | |||
| 6077 | static void bnx2x_netif_start(struct bnx2x *bp) | ||
| 6078 | { | ||
| 6079 | if (atomic_dec_and_test(&bp->intr_sem)) { | ||
| 6080 | if (netif_running(bp->dev)) { | ||
| 6081 | if (bp->state == BNX2X_STATE_OPEN) | ||
| 6082 | netif_wake_queue(bp->dev); | ||
| 6083 | bnx2x_napi_enable(bp); | ||
| 6084 | bnx2x_int_enable(bp); | ||
| 6085 | } | ||
| 6086 | } | ||
| 6087 | } | ||
| 6088 | |||
| 6089 | static void bnx2x_netif_stop(struct bnx2x *bp) | ||
| 6090 | { | ||
| 6091 | bnx2x_int_disable_sync(bp); | ||
| 6092 | if (netif_running(bp->dev)) { | ||
| 6093 | bnx2x_napi_disable(bp); | ||
| 6094 | netif_tx_disable(bp->dev); | ||
| 6095 | bp->dev->trans_start = jiffies; /* prevent tx timeout */ | ||
| 6096 | } | ||
| 6097 | } | ||
| 6098 | |||
| 6059 | /* | 6099 | /* |
| 6060 | * Init service functions | 6100 | * Init service functions |
| 6061 | */ | 6101 | */ |
| @@ -6339,7 +6379,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
| 6339 | rc = bnx2x_init_hw(bp, load_code); | 6379 | rc = bnx2x_init_hw(bp, load_code); |
| 6340 | if (rc) { | 6380 | if (rc) { |
| 6341 | BNX2X_ERR("HW init failed, aborting\n"); | 6381 | BNX2X_ERR("HW init failed, aborting\n"); |
| 6342 | goto load_error; | 6382 | goto load_int_disable; |
| 6343 | } | 6383 | } |
| 6344 | 6384 | ||
| 6345 | /* Setup NIC internals and enable interrupts */ | 6385 | /* Setup NIC internals and enable interrupts */ |
| @@ -6351,7 +6391,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
| 6351 | if (!load_code) { | 6391 | if (!load_code) { |
| 6352 | BNX2X_ERR("MCP response failure, aborting\n"); | 6392 | BNX2X_ERR("MCP response failure, aborting\n"); |
| 6353 | rc = -EBUSY; | 6393 | rc = -EBUSY; |
| 6354 | goto load_int_disable; | 6394 | goto load_rings_free; |
| 6355 | } | 6395 | } |
| 6356 | } | 6396 | } |
| 6357 | 6397 | ||
| @@ -6361,8 +6401,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
| 6361 | 6401 | ||
| 6362 | /* Enable Rx interrupt handling before sending the ramrod | 6402 | /* Enable Rx interrupt handling before sending the ramrod |
| 6363 | as it's completed on Rx FP queue */ | 6403 | as it's completed on Rx FP queue */ |
| 6364 | for_each_queue(bp, i) | 6404 | bnx2x_napi_enable(bp); |
| 6365 | napi_enable(&bnx2x_fp(bp, i, napi)); | ||
| 6366 | 6405 | ||
| 6367 | /* Enable interrupt handling */ | 6406 | /* Enable interrupt handling */ |
| 6368 | atomic_set(&bp->intr_sem, 0); | 6407 | atomic_set(&bp->intr_sem, 0); |
| @@ -6370,7 +6409,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
| 6370 | rc = bnx2x_setup_leading(bp); | 6409 | rc = bnx2x_setup_leading(bp); |
| 6371 | if (rc) { | 6410 | if (rc) { |
| 6372 | BNX2X_ERR("Setup leading failed!\n"); | 6411 | BNX2X_ERR("Setup leading failed!\n"); |
| 6373 | goto load_stop_netif; | 6412 | goto load_netif_stop; |
| 6374 | } | 6413 | } |
| 6375 | 6414 | ||
| 6376 | if (CHIP_IS_E1H(bp)) | 6415 | if (CHIP_IS_E1H(bp)) |
| @@ -6383,7 +6422,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
| 6383 | for_each_nondefault_queue(bp, i) { | 6422 | for_each_nondefault_queue(bp, i) { |
| 6384 | rc = bnx2x_setup_multi(bp, i); | 6423 | rc = bnx2x_setup_multi(bp, i); |
| 6385 | if (rc) | 6424 | if (rc) |
| 6386 | goto load_stop_netif; | 6425 | goto load_netif_stop; |
| 6387 | } | 6426 | } |
| 6388 | 6427 | ||
| 6389 | if (CHIP_IS_E1(bp)) | 6428 | if (CHIP_IS_E1(bp)) |
| @@ -6428,20 +6467,17 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
| 6428 | 6467 | ||
| 6429 | return 0; | 6468 | return 0; |
| 6430 | 6469 | ||
| 6431 | load_stop_netif: | 6470 | load_netif_stop: |
| 6471 | bnx2x_napi_disable(bp); | ||
| 6472 | load_rings_free: | ||
| 6473 | /* Free SKBs, SGEs, TPA pool and driver internals */ | ||
| 6474 | bnx2x_free_skbs(bp); | ||
| 6432 | for_each_queue(bp, i) | 6475 | for_each_queue(bp, i) |
| 6433 | napi_disable(&bnx2x_fp(bp, i, napi)); | 6476 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); |
| 6434 | |||
| 6435 | load_int_disable: | 6477 | load_int_disable: |
| 6436 | bnx2x_int_disable_sync(bp); | 6478 | bnx2x_int_disable_sync(bp); |
| 6437 | |||
| 6438 | /* Release IRQs */ | 6479 | /* Release IRQs */ |
| 6439 | bnx2x_free_irq(bp); | 6480 | bnx2x_free_irq(bp); |
| 6440 | |||
| 6441 | /* Free SKBs, SGEs, TPA pool and driver internals */ | ||
| 6442 | bnx2x_free_skbs(bp); | ||
| 6443 | for_each_queue(bp, i) | ||
| 6444 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); | ||
| 6445 | load_error: | 6481 | load_error: |
| 6446 | bnx2x_free_mem(bp); | 6482 | bnx2x_free_mem(bp); |
| 6447 | 6483 | ||
| @@ -6456,7 +6492,7 @@ static int bnx2x_stop_multi(struct bnx2x *bp, int index) | |||
| 6456 | 6492 | ||
| 6457 | /* halt the connection */ | 6493 | /* halt the connection */ |
| 6458 | bp->fp[index].state = BNX2X_FP_STATE_HALTING; | 6494 | bp->fp[index].state = BNX2X_FP_STATE_HALTING; |
| 6459 | bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_HALT, index, 0, 0, 0); | 6495 | bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_HALT, index, 0, index, 0); |
| 6460 | 6496 | ||
| 6461 | /* Wait for completion */ | 6497 | /* Wait for completion */ |
| 6462 | rc = bnx2x_wait_ramrod(bp, BNX2X_FP_STATE_HALTED, index, | 6498 | rc = bnx2x_wait_ramrod(bp, BNX2X_FP_STATE_HALTED, index, |
| @@ -6614,11 +6650,9 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
| 6614 | bp->rx_mode = BNX2X_RX_MODE_NONE; | 6650 | bp->rx_mode = BNX2X_RX_MODE_NONE; |
| 6615 | bnx2x_set_storm_rx_mode(bp); | 6651 | bnx2x_set_storm_rx_mode(bp); |
| 6616 | 6652 | ||
| 6617 | if (netif_running(bp->dev)) { | 6653 | bnx2x_netif_stop(bp); |
| 6618 | netif_tx_disable(bp->dev); | 6654 | if (!netif_running(bp->dev)) |
| 6619 | bp->dev->trans_start = jiffies; /* prevent tx timeout */ | 6655 | bnx2x_napi_disable(bp); |
| 6620 | } | ||
| 6621 | |||
| 6622 | del_timer_sync(&bp->timer); | 6656 | del_timer_sync(&bp->timer); |
| 6623 | SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb, | 6657 | SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb, |
| 6624 | (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq)); | 6658 | (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq)); |
| @@ -6632,9 +6666,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
| 6632 | smp_rmb(); | 6666 | smp_rmb(); |
| 6633 | while (BNX2X_HAS_TX_WORK(fp)) { | 6667 | while (BNX2X_HAS_TX_WORK(fp)) { |
| 6634 | 6668 | ||
| 6635 | if (!netif_running(bp->dev)) | 6669 | bnx2x_tx_int(fp, 1000); |
| 6636 | bnx2x_tx_int(fp, 1000); | ||
| 6637 | |||
| 6638 | if (!cnt) { | 6670 | if (!cnt) { |
| 6639 | BNX2X_ERR("timeout waiting for queue[%d]\n", | 6671 | BNX2X_ERR("timeout waiting for queue[%d]\n", |
| 6640 | i); | 6672 | i); |
| @@ -6650,46 +6682,12 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
| 6650 | smp_rmb(); | 6682 | smp_rmb(); |
| 6651 | } | 6683 | } |
| 6652 | } | 6684 | } |
| 6653 | |||
| 6654 | /* Give HW time to discard old tx messages */ | 6685 | /* Give HW time to discard old tx messages */ |
| 6655 | msleep(1); | 6686 | msleep(1); |
| 6656 | 6687 | ||
| 6657 | for_each_queue(bp, i) | ||
| 6658 | napi_disable(&bnx2x_fp(bp, i, napi)); | ||
| 6659 | /* Disable interrupts after Tx and Rx are disabled on stack level */ | ||
| 6660 | bnx2x_int_disable_sync(bp); | ||
| 6661 | |||
| 6662 | /* Release IRQs */ | 6688 | /* Release IRQs */ |
| 6663 | bnx2x_free_irq(bp); | 6689 | bnx2x_free_irq(bp); |
| 6664 | 6690 | ||
| 6665 | if (unload_mode == UNLOAD_NORMAL) | ||
| 6666 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | ||
| 6667 | |||
| 6668 | else if (bp->flags & NO_WOL_FLAG) { | ||
| 6669 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP; | ||
| 6670 | if (CHIP_IS_E1H(bp)) | ||
| 6671 | REG_WR(bp, MISC_REG_E1HMF_MODE, 0); | ||
| 6672 | |||
| 6673 | } else if (bp->wol) { | ||
| 6674 | u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; | ||
| 6675 | u8 *mac_addr = bp->dev->dev_addr; | ||
| 6676 | u32 val; | ||
| 6677 | /* The mac address is written to entries 1-4 to | ||
| 6678 | preserve entry 0 which is used by the PMF */ | ||
| 6679 | u8 entry = (BP_E1HVN(bp) + 1)*8; | ||
| 6680 | |||
| 6681 | val = (mac_addr[0] << 8) | mac_addr[1]; | ||
| 6682 | EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry, val); | ||
| 6683 | |||
| 6684 | val = (mac_addr[2] << 24) | (mac_addr[3] << 16) | | ||
| 6685 | (mac_addr[4] << 8) | mac_addr[5]; | ||
| 6686 | EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val); | ||
| 6687 | |||
| 6688 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN; | ||
| 6689 | |||
| 6690 | } else | ||
| 6691 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | ||
| 6692 | |||
| 6693 | if (CHIP_IS_E1(bp)) { | 6691 | if (CHIP_IS_E1(bp)) { |
| 6694 | struct mac_configuration_cmd *config = | 6692 | struct mac_configuration_cmd *config = |
| 6695 | bnx2x_sp(bp, mcast_config); | 6693 | bnx2x_sp(bp, mcast_config); |
| @@ -6712,14 +6710,41 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
| 6712 | U64_LO(bnx2x_sp_mapping(bp, mcast_config)), 0); | 6710 | U64_LO(bnx2x_sp_mapping(bp, mcast_config)), 0); |
| 6713 | 6711 | ||
| 6714 | } else { /* E1H */ | 6712 | } else { /* E1H */ |
| 6713 | REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0); | ||
| 6714 | |||
| 6715 | bnx2x_set_mac_addr_e1h(bp, 0); | 6715 | bnx2x_set_mac_addr_e1h(bp, 0); |
| 6716 | 6716 | ||
| 6717 | for (i = 0; i < MC_HASH_SIZE; i++) | 6717 | for (i = 0; i < MC_HASH_SIZE; i++) |
| 6718 | REG_WR(bp, MC_HASH_OFFSET(bp, i), 0); | 6718 | REG_WR(bp, MC_HASH_OFFSET(bp, i), 0); |
| 6719 | } | 6719 | } |
| 6720 | 6720 | ||
| 6721 | if (CHIP_IS_E1H(bp)) | 6721 | if (unload_mode == UNLOAD_NORMAL) |
| 6722 | REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0); | 6722 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; |
| 6723 | |||
| 6724 | else if (bp->flags & NO_WOL_FLAG) { | ||
| 6725 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP; | ||
| 6726 | if (CHIP_IS_E1H(bp)) | ||
| 6727 | REG_WR(bp, MISC_REG_E1HMF_MODE, 0); | ||
| 6728 | |||
| 6729 | } else if (bp->wol) { | ||
| 6730 | u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; | ||
| 6731 | u8 *mac_addr = bp->dev->dev_addr; | ||
| 6732 | u32 val; | ||
| 6733 | /* The mac address is written to entries 1-4 to | ||
| 6734 | preserve entry 0 which is used by the PMF */ | ||
| 6735 | u8 entry = (BP_E1HVN(bp) + 1)*8; | ||
| 6736 | |||
| 6737 | val = (mac_addr[0] << 8) | mac_addr[1]; | ||
| 6738 | EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry, val); | ||
| 6739 | |||
| 6740 | val = (mac_addr[2] << 24) | (mac_addr[3] << 16) | | ||
| 6741 | (mac_addr[4] << 8) | mac_addr[5]; | ||
| 6742 | EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val); | ||
| 6743 | |||
| 6744 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN; | ||
| 6745 | |||
| 6746 | } else | ||
| 6747 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | ||
| 6723 | 6748 | ||
| 6724 | /* Close multi and leading connections | 6749 | /* Close multi and leading connections |
| 6725 | Completions for ramrods are collected in a synchronous way */ | 6750 | Completions for ramrods are collected in a synchronous way */ |
| @@ -6822,6 +6847,10 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | |||
| 6822 | */ | 6847 | */ |
| 6823 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | 6848 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); |
| 6824 | val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); | 6849 | val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); |
| 6850 | if (val == 0x7) | ||
| 6851 | REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0); | ||
| 6852 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | ||
| 6853 | |||
| 6825 | if (val == 0x7) { | 6854 | if (val == 0x7) { |
| 6826 | u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | 6855 | u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; |
| 6827 | /* save our func */ | 6856 | /* save our func */ |
| @@ -6899,7 +6928,6 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | |||
| 6899 | (SHMEM_RD(bp, func_mb[bp->func].drv_mb_header) & | 6928 | (SHMEM_RD(bp, func_mb[bp->func].drv_mb_header) & |
| 6900 | DRV_MSG_SEQ_NUMBER_MASK); | 6929 | DRV_MSG_SEQ_NUMBER_MASK); |
| 6901 | } | 6930 | } |
| 6902 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); | ||
| 6903 | } | 6931 | } |
| 6904 | } | 6932 | } |
| 6905 | 6933 | ||
| @@ -8618,34 +8646,6 @@ test_mem_exit: | |||
| 8618 | return rc; | 8646 | return rc; |
| 8619 | } | 8647 | } |
| 8620 | 8648 | ||
| 8621 | static void bnx2x_netif_start(struct bnx2x *bp) | ||
| 8622 | { | ||
| 8623 | int i; | ||
| 8624 | |||
| 8625 | if (atomic_dec_and_test(&bp->intr_sem)) { | ||
| 8626 | if (netif_running(bp->dev)) { | ||
| 8627 | bnx2x_int_enable(bp); | ||
| 8628 | for_each_queue(bp, i) | ||
| 8629 | napi_enable(&bnx2x_fp(bp, i, napi)); | ||
| 8630 | if (bp->state == BNX2X_STATE_OPEN) | ||
| 8631 | netif_wake_queue(bp->dev); | ||
| 8632 | } | ||
| 8633 | } | ||
| 8634 | } | ||
| 8635 | |||
| 8636 | static void bnx2x_netif_stop(struct bnx2x *bp) | ||
| 8637 | { | ||
| 8638 | int i; | ||
| 8639 | |||
| 8640 | if (netif_running(bp->dev)) { | ||
| 8641 | netif_tx_disable(bp->dev); | ||
| 8642 | bp->dev->trans_start = jiffies; /* prevent tx timeout */ | ||
| 8643 | for_each_queue(bp, i) | ||
| 8644 | napi_disable(&bnx2x_fp(bp, i, napi)); | ||
| 8645 | } | ||
| 8646 | bnx2x_int_disable_sync(bp); | ||
| 8647 | } | ||
| 8648 | |||
| 8649 | static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up) | 8649 | static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up) |
| 8650 | { | 8650 | { |
| 8651 | int cnt = 1000; | 8651 | int cnt = 1000; |
| @@ -9251,6 +9251,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget) | |||
| 9251 | napi); | 9251 | napi); |
| 9252 | struct bnx2x *bp = fp->bp; | 9252 | struct bnx2x *bp = fp->bp; |
| 9253 | int work_done = 0; | 9253 | int work_done = 0; |
| 9254 | u16 rx_cons_sb; | ||
| 9254 | 9255 | ||
| 9255 | #ifdef BNX2X_STOP_ON_ERROR | 9256 | #ifdef BNX2X_STOP_ON_ERROR |
| 9256 | if (unlikely(bp->panic)) | 9257 | if (unlikely(bp->panic)) |
| @@ -9266,10 +9267,16 @@ static int bnx2x_poll(struct napi_struct *napi, int budget) | |||
| 9266 | if (BNX2X_HAS_TX_WORK(fp)) | 9267 | if (BNX2X_HAS_TX_WORK(fp)) |
| 9267 | bnx2x_tx_int(fp, budget); | 9268 | bnx2x_tx_int(fp, budget); |
| 9268 | 9269 | ||
| 9270 | rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb); | ||
| 9271 | if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT) | ||
| 9272 | rx_cons_sb++; | ||
| 9269 | if (BNX2X_HAS_RX_WORK(fp)) | 9273 | if (BNX2X_HAS_RX_WORK(fp)) |
| 9270 | work_done = bnx2x_rx_int(fp, budget); | 9274 | work_done = bnx2x_rx_int(fp, budget); |
| 9271 | 9275 | ||
| 9272 | rmb(); /* BNX2X_HAS_WORK() reads the status block */ | 9276 | rmb(); /* BNX2X_HAS_WORK() reads the status block */ |
| 9277 | rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb); | ||
| 9278 | if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT) | ||
| 9279 | rx_cons_sb++; | ||
| 9273 | 9280 | ||
| 9274 | /* must not complete if we consumed full budget */ | 9281 | /* must not complete if we consumed full budget */ |
| 9275 | if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) { | 9282 | if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) { |
| @@ -9485,8 +9492,7 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 9485 | fp_index = (smp_processor_id() % bp->num_queues); | 9492 | fp_index = (smp_processor_id() % bp->num_queues); |
| 9486 | fp = &bp->fp[fp_index]; | 9493 | fp = &bp->fp[fp_index]; |
| 9487 | 9494 | ||
| 9488 | if (unlikely(bnx2x_tx_avail(bp->fp) < | 9495 | if (unlikely(bnx2x_tx_avail(fp) < (skb_shinfo(skb)->nr_frags + 3))) { |
| 9489 | (skb_shinfo(skb)->nr_frags + 3))) { | ||
| 9490 | bp->eth_stats.driver_xoff++, | 9496 | bp->eth_stats.driver_xoff++, |
| 9491 | netif_stop_queue(dev); | 9497 | netif_stop_queue(dev); |
| 9492 | BNX2X_ERR("BUG! Tx ring full when queue awake!\n"); | 9498 | BNX2X_ERR("BUG! Tx ring full when queue awake!\n"); |
| @@ -9549,7 +9555,6 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 9549 | tx_bd->vlan = cpu_to_le16(pkt_prod); | 9555 | tx_bd->vlan = cpu_to_le16(pkt_prod); |
| 9550 | 9556 | ||
| 9551 | if (xmit_type) { | 9557 | if (xmit_type) { |
| 9552 | |||
| 9553 | /* turn on parsing and get a BD */ | 9558 | /* turn on parsing and get a BD */ |
| 9554 | bd_prod = TX_BD(NEXT_TX_IDX(bd_prod)); | 9559 | bd_prod = TX_BD(NEXT_TX_IDX(bd_prod)); |
| 9555 | pbd = (void *)&fp->tx_desc_ring[bd_prod]; | 9560 | pbd = (void *)&fp->tx_desc_ring[bd_prod]; |
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index a7800e559090..ec6b0af3d46b 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/errno.h> | 26 | #include <linux/errno.h> |
| 27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
| 28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
| 29 | #include <linux/version.h> | ||
| 30 | 29 | ||
| 31 | #include <linux/netdevice.h> | 30 | #include <linux/netdevice.h> |
| 32 | #include <linux/etherdevice.h> | 31 | #include <linux/etherdevice.h> |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 19d32a227be1..5cf78d612c45 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
| @@ -1838,7 +1838,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
| 1838 | if ((le16_to_cpu(rfd->command) & cb_el) && | 1838 | if ((le16_to_cpu(rfd->command) & cb_el) && |
| 1839 | (RU_RUNNING == nic->ru_running)) | 1839 | (RU_RUNNING == nic->ru_running)) |
| 1840 | 1840 | ||
| 1841 | if (readb(&nic->csr->scb.status) & rus_no_res) | 1841 | if (ioread8(&nic->csr->scb.status) & rus_no_res) |
| 1842 | nic->ru_running = RU_SUSPENDED; | 1842 | nic->ru_running = RU_SUSPENDED; |
| 1843 | return -ENODATA; | 1843 | return -ENODATA; |
| 1844 | } | 1844 | } |
| @@ -1861,7 +1861,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
| 1861 | if ((le16_to_cpu(rfd->command) & cb_el) && | 1861 | if ((le16_to_cpu(rfd->command) & cb_el) && |
| 1862 | (RU_RUNNING == nic->ru_running)) { | 1862 | (RU_RUNNING == nic->ru_running)) { |
| 1863 | 1863 | ||
| 1864 | if (readb(&nic->csr->scb.status) & rus_no_res) | 1864 | if (ioread8(&nic->csr->scb.status) & rus_no_res) |
| 1865 | nic->ru_running = RU_SUSPENDED; | 1865 | nic->ru_running = RU_SUSPENDED; |
| 1866 | } | 1866 | } |
| 1867 | 1867 | ||
| @@ -2738,9 +2738,7 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
| 2738 | nic->flags |= wol_magic; | 2738 | nic->flags |= wol_magic; |
| 2739 | 2739 | ||
| 2740 | /* ack any pending wake events, disable PME */ | 2740 | /* ack any pending wake events, disable PME */ |
| 2741 | err = pci_enable_wake(pdev, 0, 0); | 2741 | pci_pme_active(pdev, false); |
| 2742 | if (err) | ||
| 2743 | DPRINTK(PROBE, ERR, "Error clearing wake event\n"); | ||
| 2744 | 2742 | ||
| 2745 | strcpy(netdev->name, "eth%d"); | 2743 | strcpy(netdev->name, "eth%d"); |
| 2746 | if((err = register_netdev(netdev))) { | 2744 | if((err = register_netdev(netdev))) { |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 9d6edf3e73f9..d04eef53571e 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
| @@ -144,6 +144,8 @@ static s32 e1000_host_if_read_cookie(struct e1000_hw *hw, u8 *buffer); | |||
| 144 | static u8 e1000_calculate_mng_checksum(char *buffer, u32 length); | 144 | static u8 e1000_calculate_mng_checksum(char *buffer, u32 length); |
| 145 | static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex); | 145 | static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex); |
| 146 | static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw); | 146 | static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw); |
| 147 | static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); | ||
| 148 | static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); | ||
| 147 | 149 | ||
| 148 | /* IGP cable length table */ | 150 | /* IGP cable length table */ |
| 149 | static const | 151 | static const |
| @@ -168,6 +170,8 @@ u16 e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] = | |||
| 168 | 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, | 170 | 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, |
| 169 | 104, 109, 114, 118, 121, 124}; | 171 | 104, 109, 114, 118, 121, 124}; |
| 170 | 172 | ||
| 173 | static DEFINE_SPINLOCK(e1000_eeprom_lock); | ||
| 174 | |||
| 171 | /****************************************************************************** | 175 | /****************************************************************************** |
| 172 | * Set the phy type member in the hw struct. | 176 | * Set the phy type member in the hw struct. |
| 173 | * | 177 | * |
| @@ -4904,6 +4908,15 @@ static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw) | |||
| 4904 | *****************************************************************************/ | 4908 | *****************************************************************************/ |
| 4905 | s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) | 4909 | s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) |
| 4906 | { | 4910 | { |
| 4911 | s32 ret; | ||
| 4912 | spin_lock(&e1000_eeprom_lock); | ||
| 4913 | ret = e1000_do_read_eeprom(hw, offset, words, data); | ||
| 4914 | spin_unlock(&e1000_eeprom_lock); | ||
| 4915 | return ret; | ||
| 4916 | } | ||
| 4917 | |||
| 4918 | static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) | ||
| 4919 | { | ||
| 4907 | struct e1000_eeprom_info *eeprom = &hw->eeprom; | 4920 | struct e1000_eeprom_info *eeprom = &hw->eeprom; |
| 4908 | u32 i = 0; | 4921 | u32 i = 0; |
| 4909 | 4922 | ||
| @@ -5236,6 +5249,16 @@ s32 e1000_update_eeprom_checksum(struct e1000_hw *hw) | |||
| 5236 | *****************************************************************************/ | 5249 | *****************************************************************************/ |
| 5237 | s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) | 5250 | s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) |
| 5238 | { | 5251 | { |
| 5252 | s32 ret; | ||
| 5253 | spin_lock(&e1000_eeprom_lock); | ||
| 5254 | ret = e1000_do_write_eeprom(hw, offset, words, data); | ||
| 5255 | spin_unlock(&e1000_eeprom_lock); | ||
| 5256 | return ret; | ||
| 5257 | } | ||
| 5258 | |||
| 5259 | |||
| 5260 | static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) | ||
| 5261 | { | ||
| 5239 | struct e1000_eeprom_info *eeprom = &hw->eeprom; | 5262 | struct e1000_eeprom_info *eeprom = &hw->eeprom; |
| 5240 | s32 status = 0; | 5263 | s32 status = 0; |
| 5241 | 5264 | ||
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index b9f90a5d3d4d..213437d13154 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
| @@ -208,7 +208,7 @@ struct e1000_option { | |||
| 208 | } r; | 208 | } r; |
| 209 | struct { /* list_option info */ | 209 | struct { /* list_option info */ |
| 210 | int nr; | 210 | int nr; |
| 211 | struct e1000_opt_list { int i; char *str; } *p; | 211 | const struct e1000_opt_list { int i; char *str; } *p; |
| 212 | } l; | 212 | } l; |
| 213 | } arg; | 213 | } arg; |
| 214 | }; | 214 | }; |
| @@ -242,7 +242,7 @@ static int __devinit e1000_validate_option(unsigned int *value, | |||
| 242 | break; | 242 | break; |
| 243 | case list_option: { | 243 | case list_option: { |
| 244 | int i; | 244 | int i; |
| 245 | struct e1000_opt_list *ent; | 245 | const struct e1000_opt_list *ent; |
| 246 | 246 | ||
| 247 | for (i = 0; i < opt->arg.l.nr; i++) { | 247 | for (i = 0; i < opt->arg.l.nr; i++) { |
| 248 | ent = &opt->arg.l.p[i]; | 248 | ent = &opt->arg.l.p[i]; |
| @@ -279,7 +279,9 @@ static void e1000_check_copper_options(struct e1000_adapter *adapter); | |||
| 279 | 279 | ||
| 280 | void __devinit e1000_check_options(struct e1000_adapter *adapter) | 280 | void __devinit e1000_check_options(struct e1000_adapter *adapter) |
| 281 | { | 281 | { |
| 282 | struct e1000_option opt; | ||
| 282 | int bd = adapter->bd_number; | 283 | int bd = adapter->bd_number; |
| 284 | |||
| 283 | if (bd >= E1000_MAX_NIC) { | 285 | if (bd >= E1000_MAX_NIC) { |
| 284 | DPRINTK(PROBE, NOTICE, | 286 | DPRINTK(PROBE, NOTICE, |
| 285 | "Warning: no configuration for board #%i\n", bd); | 287 | "Warning: no configuration for board #%i\n", bd); |
| @@ -287,19 +289,21 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 287 | } | 289 | } |
| 288 | 290 | ||
| 289 | { /* Transmit Descriptor Count */ | 291 | { /* Transmit Descriptor Count */ |
| 290 | struct e1000_option opt = { | 292 | struct e1000_tx_ring *tx_ring = adapter->tx_ring; |
| 293 | int i; | ||
| 294 | e1000_mac_type mac_type = adapter->hw.mac_type; | ||
| 295 | |||
| 296 | opt = (struct e1000_option) { | ||
| 291 | .type = range_option, | 297 | .type = range_option, |
| 292 | .name = "Transmit Descriptors", | 298 | .name = "Transmit Descriptors", |
| 293 | .err = "using default of " | 299 | .err = "using default of " |
| 294 | __MODULE_STRING(E1000_DEFAULT_TXD), | 300 | __MODULE_STRING(E1000_DEFAULT_TXD), |
| 295 | .def = E1000_DEFAULT_TXD, | 301 | .def = E1000_DEFAULT_TXD, |
| 296 | .arg = { .r = { .min = E1000_MIN_TXD }} | 302 | .arg = { .r = { |
| 303 | .min = E1000_MIN_TXD, | ||
| 304 | .max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD | ||
| 305 | }} | ||
| 297 | }; | 306 | }; |
| 298 | struct e1000_tx_ring *tx_ring = adapter->tx_ring; | ||
| 299 | int i; | ||
| 300 | e1000_mac_type mac_type = adapter->hw.mac_type; | ||
| 301 | opt.arg.r.max = mac_type < e1000_82544 ? | ||
| 302 | E1000_MAX_TXD : E1000_MAX_82544_TXD; | ||
| 303 | 307 | ||
| 304 | if (num_TxDescriptors > bd) { | 308 | if (num_TxDescriptors > bd) { |
| 305 | tx_ring->count = TxDescriptors[bd]; | 309 | tx_ring->count = TxDescriptors[bd]; |
| @@ -313,19 +317,21 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 313 | tx_ring[i].count = tx_ring->count; | 317 | tx_ring[i].count = tx_ring->count; |
| 314 | } | 318 | } |
| 315 | { /* Receive Descriptor Count */ | 319 | { /* Receive Descriptor Count */ |
| 316 | struct e1000_option opt = { | 320 | struct e1000_rx_ring *rx_ring = adapter->rx_ring; |
| 321 | int i; | ||
| 322 | e1000_mac_type mac_type = adapter->hw.mac_type; | ||
| 323 | |||
| 324 | opt = (struct e1000_option) { | ||
| 317 | .type = range_option, | 325 | .type = range_option, |
| 318 | .name = "Receive Descriptors", | 326 | .name = "Receive Descriptors", |
| 319 | .err = "using default of " | 327 | .err = "using default of " |
| 320 | __MODULE_STRING(E1000_DEFAULT_RXD), | 328 | __MODULE_STRING(E1000_DEFAULT_RXD), |
| 321 | .def = E1000_DEFAULT_RXD, | 329 | .def = E1000_DEFAULT_RXD, |
| 322 | .arg = { .r = { .min = E1000_MIN_RXD }} | 330 | .arg = { .r = { |
| 331 | .min = E1000_MIN_RXD, | ||
| 332 | .max = mac_type < e1000_82544 ? E1000_MAX_RXD : E1000_MAX_82544_RXD | ||
| 333 | }} | ||
| 323 | }; | 334 | }; |
| 324 | struct e1000_rx_ring *rx_ring = adapter->rx_ring; | ||
| 325 | int i; | ||
| 326 | e1000_mac_type mac_type = adapter->hw.mac_type; | ||
| 327 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : | ||
| 328 | E1000_MAX_82544_RXD; | ||
| 329 | 335 | ||
| 330 | if (num_RxDescriptors > bd) { | 336 | if (num_RxDescriptors > bd) { |
| 331 | rx_ring->count = RxDescriptors[bd]; | 337 | rx_ring->count = RxDescriptors[bd]; |
| @@ -339,7 +345,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 339 | rx_ring[i].count = rx_ring->count; | 345 | rx_ring[i].count = rx_ring->count; |
| 340 | } | 346 | } |
| 341 | { /* Checksum Offload Enable/Disable */ | 347 | { /* Checksum Offload Enable/Disable */ |
| 342 | struct e1000_option opt = { | 348 | opt = (struct e1000_option) { |
| 343 | .type = enable_option, | 349 | .type = enable_option, |
| 344 | .name = "Checksum Offload", | 350 | .name = "Checksum Offload", |
| 345 | .err = "defaulting to Enabled", | 351 | .err = "defaulting to Enabled", |
| @@ -363,7 +369,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 363 | { E1000_FC_FULL, "Flow Control Enabled" }, | 369 | { E1000_FC_FULL, "Flow Control Enabled" }, |
| 364 | { E1000_FC_DEFAULT, "Flow Control Hardware Default" }}; | 370 | { E1000_FC_DEFAULT, "Flow Control Hardware Default" }}; |
| 365 | 371 | ||
| 366 | struct e1000_option opt = { | 372 | opt = (struct e1000_option) { |
| 367 | .type = list_option, | 373 | .type = list_option, |
| 368 | .name = "Flow Control", | 374 | .name = "Flow Control", |
| 369 | .err = "reading default settings from EEPROM", | 375 | .err = "reading default settings from EEPROM", |
| @@ -381,7 +387,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 381 | } | 387 | } |
| 382 | } | 388 | } |
| 383 | { /* Transmit Interrupt Delay */ | 389 | { /* Transmit Interrupt Delay */ |
| 384 | struct e1000_option opt = { | 390 | opt = (struct e1000_option) { |
| 385 | .type = range_option, | 391 | .type = range_option, |
| 386 | .name = "Transmit Interrupt Delay", | 392 | .name = "Transmit Interrupt Delay", |
| 387 | .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), | 393 | .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), |
| @@ -399,7 +405,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 399 | } | 405 | } |
| 400 | } | 406 | } |
| 401 | { /* Transmit Absolute Interrupt Delay */ | 407 | { /* Transmit Absolute Interrupt Delay */ |
| 402 | struct e1000_option opt = { | 408 | opt = (struct e1000_option) { |
| 403 | .type = range_option, | 409 | .type = range_option, |
| 404 | .name = "Transmit Absolute Interrupt Delay", | 410 | .name = "Transmit Absolute Interrupt Delay", |
| 405 | .err = "using default of " __MODULE_STRING(DEFAULT_TADV), | 411 | .err = "using default of " __MODULE_STRING(DEFAULT_TADV), |
| @@ -417,7 +423,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 417 | } | 423 | } |
| 418 | } | 424 | } |
| 419 | { /* Receive Interrupt Delay */ | 425 | { /* Receive Interrupt Delay */ |
| 420 | struct e1000_option opt = { | 426 | opt = (struct e1000_option) { |
| 421 | .type = range_option, | 427 | .type = range_option, |
| 422 | .name = "Receive Interrupt Delay", | 428 | .name = "Receive Interrupt Delay", |
| 423 | .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), | 429 | .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), |
| @@ -435,7 +441,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 435 | } | 441 | } |
| 436 | } | 442 | } |
| 437 | { /* Receive Absolute Interrupt Delay */ | 443 | { /* Receive Absolute Interrupt Delay */ |
| 438 | struct e1000_option opt = { | 444 | opt = (struct e1000_option) { |
| 439 | .type = range_option, | 445 | .type = range_option, |
| 440 | .name = "Receive Absolute Interrupt Delay", | 446 | .name = "Receive Absolute Interrupt Delay", |
| 441 | .err = "using default of " __MODULE_STRING(DEFAULT_RADV), | 447 | .err = "using default of " __MODULE_STRING(DEFAULT_RADV), |
| @@ -453,7 +459,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 453 | } | 459 | } |
| 454 | } | 460 | } |
| 455 | { /* Interrupt Throttling Rate */ | 461 | { /* Interrupt Throttling Rate */ |
| 456 | struct e1000_option opt = { | 462 | opt = (struct e1000_option) { |
| 457 | .type = range_option, | 463 | .type = range_option, |
| 458 | .name = "Interrupt Throttling Rate (ints/sec)", | 464 | .name = "Interrupt Throttling Rate (ints/sec)", |
| 459 | .err = "using default of " __MODULE_STRING(DEFAULT_ITR), | 465 | .err = "using default of " __MODULE_STRING(DEFAULT_ITR), |
| @@ -497,7 +503,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 497 | } | 503 | } |
| 498 | } | 504 | } |
| 499 | { /* Smart Power Down */ | 505 | { /* Smart Power Down */ |
| 500 | struct e1000_option opt = { | 506 | opt = (struct e1000_option) { |
| 501 | .type = enable_option, | 507 | .type = enable_option, |
| 502 | .name = "PHY Smart Power Down", | 508 | .name = "PHY Smart Power Down", |
| 503 | .err = "defaulting to Disabled", | 509 | .err = "defaulting to Disabled", |
| @@ -513,7 +519,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
| 513 | } | 519 | } |
| 514 | } | 520 | } |
| 515 | { /* Kumeran Lock Loss Workaround */ | 521 | { /* Kumeran Lock Loss Workaround */ |
| 516 | struct e1000_option opt = { | 522 | opt = (struct e1000_option) { |
| 517 | .type = enable_option, | 523 | .type = enable_option, |
| 518 | .name = "Kumeran Lock Loss Workaround", | 524 | .name = "Kumeran Lock Loss Workaround", |
| 519 | .err = "defaulting to Enabled", | 525 | .err = "defaulting to Enabled", |
| @@ -578,16 +584,18 @@ static void __devinit e1000_check_fiber_options(struct e1000_adapter *adapter) | |||
| 578 | 584 | ||
| 579 | static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) | 585 | static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) |
| 580 | { | 586 | { |
| 587 | struct e1000_option opt; | ||
| 581 | unsigned int speed, dplx, an; | 588 | unsigned int speed, dplx, an; |
| 582 | int bd = adapter->bd_number; | 589 | int bd = adapter->bd_number; |
| 583 | 590 | ||
| 584 | { /* Speed */ | 591 | { /* Speed */ |
| 585 | struct e1000_opt_list speed_list[] = {{ 0, "" }, | 592 | static const struct e1000_opt_list speed_list[] = { |
| 586 | { SPEED_10, "" }, | 593 | { 0, "" }, |
| 587 | { SPEED_100, "" }, | 594 | { SPEED_10, "" }, |
| 588 | { SPEED_1000, "" }}; | 595 | { SPEED_100, "" }, |
| 596 | { SPEED_1000, "" }}; | ||
| 589 | 597 | ||
| 590 | struct e1000_option opt = { | 598 | opt = (struct e1000_option) { |
| 591 | .type = list_option, | 599 | .type = list_option, |
| 592 | .name = "Speed", | 600 | .name = "Speed", |
| 593 | .err = "parameter ignored", | 601 | .err = "parameter ignored", |
| @@ -604,11 +612,12 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) | |||
| 604 | } | 612 | } |
| 605 | } | 613 | } |
| 606 | { /* Duplex */ | 614 | { /* Duplex */ |
| 607 | struct e1000_opt_list dplx_list[] = {{ 0, "" }, | 615 | static const struct e1000_opt_list dplx_list[] = { |
| 608 | { HALF_DUPLEX, "" }, | 616 | { 0, "" }, |
| 609 | { FULL_DUPLEX, "" }}; | 617 | { HALF_DUPLEX, "" }, |
| 618 | { FULL_DUPLEX, "" }}; | ||
| 610 | 619 | ||
| 611 | struct e1000_option opt = { | 620 | opt = (struct e1000_option) { |
| 612 | .type = list_option, | 621 | .type = list_option, |
| 613 | .name = "Duplex", | 622 | .name = "Duplex", |
| 614 | .err = "parameter ignored", | 623 | .err = "parameter ignored", |
| @@ -637,7 +646,7 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) | |||
| 637 | "parameter ignored\n"); | 646 | "parameter ignored\n"); |
| 638 | adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; | 647 | adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; |
| 639 | } else { /* Autoneg */ | 648 | } else { /* Autoneg */ |
| 640 | struct e1000_opt_list an_list[] = | 649 | static const struct e1000_opt_list an_list[] = |
| 641 | #define AA "AutoNeg advertising " | 650 | #define AA "AutoNeg advertising " |
| 642 | {{ 0x01, AA "10/HD" }, | 651 | {{ 0x01, AA "10/HD" }, |
| 643 | { 0x02, AA "10/FD" }, | 652 | { 0x02, AA "10/FD" }, |
| @@ -671,7 +680,7 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) | |||
| 671 | { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" }, | 680 | { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" }, |
| 672 | { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }}; | 681 | { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }}; |
| 673 | 682 | ||
| 674 | struct e1000_option opt = { | 683 | opt = (struct e1000_option) { |
| 675 | .type = list_option, | 684 | .type = list_option, |
| 676 | .name = "AutoNeg", | 685 | .name = "AutoNeg", |
| 677 | .err = "parameter ignored", | 686 | .err = "parameter ignored", |
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index f823b8ba5785..14b0e6cd3b8d 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
| @@ -389,7 +389,7 @@ | |||
| 389 | 389 | ||
| 390 | /* Interrupt Cause Set */ | 390 | /* Interrupt Cause Set */ |
| 391 | #define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ | 391 | #define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ |
| 392 | #define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* rx desc min. threshold */ | 392 | #define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ |
| 393 | #define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ | 393 | #define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ |
| 394 | 394 | ||
| 395 | /* Transmit Descriptor Control */ | 395 | /* Transmit Descriptor Control */ |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index cf57050d99d8..5ea6b60fa377 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
| @@ -257,7 +257,6 @@ struct e1000_adapter { | |||
| 257 | struct net_device *netdev; | 257 | struct net_device *netdev; |
| 258 | struct pci_dev *pdev; | 258 | struct pci_dev *pdev; |
| 259 | struct net_device_stats net_stats; | 259 | struct net_device_stats net_stats; |
| 260 | spinlock_t stats_lock; /* prevent concurrent stats updates */ | ||
| 261 | 260 | ||
| 262 | /* structs defined in e1000_hw.h */ | 261 | /* structs defined in e1000_hw.h */ |
| 263 | struct e1000_hw hw; | 262 | struct e1000_hw hw; |
| @@ -284,6 +283,8 @@ struct e1000_adapter { | |||
| 284 | unsigned long led_status; | 283 | unsigned long led_status; |
| 285 | 284 | ||
| 286 | unsigned int flags; | 285 | unsigned int flags; |
| 286 | struct work_struct downshift_task; | ||
| 287 | struct work_struct update_phy_task; | ||
| 287 | }; | 288 | }; |
| 288 | 289 | ||
| 289 | struct e1000_info { | 290 | struct e1000_info { |
| @@ -305,6 +306,7 @@ struct e1000_info { | |||
| 305 | #define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5) | 306 | #define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5) |
| 306 | #define FLAG_HAS_SWSM_ON_LOAD (1 << 6) | 307 | #define FLAG_HAS_SWSM_ON_LOAD (1 << 6) |
| 307 | #define FLAG_HAS_JUMBO_FRAMES (1 << 7) | 308 | #define FLAG_HAS_JUMBO_FRAMES (1 << 7) |
| 309 | #define FLAG_READ_ONLY_NVM (1 << 8) | ||
| 308 | #define FLAG_IS_ICH (1 << 9) | 310 | #define FLAG_IS_ICH (1 << 9) |
| 309 | #define FLAG_HAS_SMART_POWER_DOWN (1 << 11) | 311 | #define FLAG_HAS_SMART_POWER_DOWN (1 << 11) |
| 310 | #define FLAG_IS_QUAD_PORT_A (1 << 12) | 312 | #define FLAG_IS_QUAD_PORT_A (1 << 12) |
| @@ -326,6 +328,7 @@ struct e1000_info { | |||
| 326 | #define FLAG_RX_CSUM_ENABLED (1 << 28) | 328 | #define FLAG_RX_CSUM_ENABLED (1 << 28) |
| 327 | #define FLAG_TSO_FORCE (1 << 29) | 329 | #define FLAG_TSO_FORCE (1 << 29) |
| 328 | #define FLAG_RX_RESTART_NOW (1 << 30) | 330 | #define FLAG_RX_RESTART_NOW (1 << 30) |
| 331 | #define FLAG_MSI_TEST_FAILED (1 << 31) | ||
| 329 | 332 | ||
| 330 | #define E1000_RX_DESC_PS(R, i) \ | 333 | #define E1000_RX_DESC_PS(R, i) \ |
| 331 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) | 334 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) |
| @@ -384,6 +387,7 @@ extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw); | |||
| 384 | extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw); | 387 | extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw); |
| 385 | extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state); | 388 | extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state); |
| 386 | 389 | ||
| 390 | extern void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw); | ||
| 387 | extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, | 391 | extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, |
| 388 | bool state); | 392 | bool state); |
| 389 | extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); | 393 | extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index cf9679f2b7c4..33a3ff17b5d0 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
| @@ -177,7 +177,7 @@ static u32 e1000_get_link(struct net_device *netdev) | |||
| 177 | u32 status; | 177 | u32 status; |
| 178 | 178 | ||
| 179 | status = er32(STATUS); | 179 | status = er32(STATUS); |
| 180 | return (status & E1000_STATUS_LU); | 180 | return (status & E1000_STATUS_LU) ? 1 : 0; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) | 183 | static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) |
| @@ -432,6 +432,10 @@ static void e1000_get_regs(struct net_device *netdev, | |||
| 432 | regs_buff[11] = er32(TIDV); | 432 | regs_buff[11] = er32(TIDV); |
| 433 | 433 | ||
| 434 | regs_buff[12] = adapter->hw.phy.type; /* PHY type (IGP=1, M88=0) */ | 434 | regs_buff[12] = adapter->hw.phy.type; /* PHY type (IGP=1, M88=0) */ |
| 435 | |||
| 436 | /* ethtool doesn't use anything past this point, so all this | ||
| 437 | * code is likely legacy junk for apps that may or may not | ||
| 438 | * exist */ | ||
| 435 | if (hw->phy.type == e1000_phy_m88) { | 439 | if (hw->phy.type == e1000_phy_m88) { |
| 436 | e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); | 440 | e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
| 437 | regs_buff[13] = (u32)phy_data; /* cable length */ | 441 | regs_buff[13] = (u32)phy_data; /* cable length */ |
| @@ -447,7 +451,7 @@ static void e1000_get_regs(struct net_device *netdev, | |||
| 447 | regs_buff[22] = adapter->phy_stats.receive_errors; | 451 | regs_buff[22] = adapter->phy_stats.receive_errors; |
| 448 | regs_buff[23] = regs_buff[13]; /* mdix mode */ | 452 | regs_buff[23] = regs_buff[13]; /* mdix mode */ |
| 449 | } | 453 | } |
| 450 | regs_buff[21] = adapter->phy_stats.idle_errors; /* phy idle errors */ | 454 | regs_buff[21] = 0; /* was idle_errors */ |
| 451 | e1e_rphy(hw, PHY_1000T_STATUS, &phy_data); | 455 | e1e_rphy(hw, PHY_1000T_STATUS, &phy_data); |
| 452 | regs_buff[24] = (u32)phy_data; /* phy local receiver status */ | 456 | regs_buff[24] = (u32)phy_data; /* phy local receiver status */ |
| 453 | regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ | 457 | regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ |
| @@ -529,6 +533,9 @@ static int e1000_set_eeprom(struct net_device *netdev, | |||
| 529 | if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16))) | 533 | if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16))) |
| 530 | return -EFAULT; | 534 | return -EFAULT; |
| 531 | 535 | ||
| 536 | if (adapter->flags & FLAG_READ_ONLY_NVM) | ||
| 537 | return -EINVAL; | ||
| 538 | |||
| 532 | max_len = hw->nvm.word_size * 2; | 539 | max_len = hw->nvm.word_size * 2; |
| 533 | 540 | ||
| 534 | first_word = eeprom->offset >> 1; | 541 | first_word = eeprom->offset >> 1; |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 9e38452a738c..bcd2bc477af2 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
| @@ -58,6 +58,7 @@ | |||
| 58 | #define ICH_FLASH_HSFCTL 0x0006 | 58 | #define ICH_FLASH_HSFCTL 0x0006 |
| 59 | #define ICH_FLASH_FADDR 0x0008 | 59 | #define ICH_FLASH_FADDR 0x0008 |
| 60 | #define ICH_FLASH_FDATA0 0x0010 | 60 | #define ICH_FLASH_FDATA0 0x0010 |
| 61 | #define ICH_FLASH_PR0 0x0074 | ||
| 61 | 62 | ||
| 62 | #define ICH_FLASH_READ_COMMAND_TIMEOUT 500 | 63 | #define ICH_FLASH_READ_COMMAND_TIMEOUT 500 |
| 63 | #define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500 | 64 | #define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500 |
| @@ -150,6 +151,19 @@ union ich8_hws_flash_regacc { | |||
| 150 | u16 regval; | 151 | u16 regval; |
| 151 | }; | 152 | }; |
| 152 | 153 | ||
| 154 | /* ICH Flash Protected Region */ | ||
| 155 | union ich8_flash_protected_range { | ||
| 156 | struct ich8_pr { | ||
| 157 | u32 base:13; /* 0:12 Protected Range Base */ | ||
| 158 | u32 reserved1:2; /* 13:14 Reserved */ | ||
| 159 | u32 rpe:1; /* 15 Read Protection Enable */ | ||
| 160 | u32 limit:13; /* 16:28 Protected Range Limit */ | ||
| 161 | u32 reserved2:2; /* 29:30 Reserved */ | ||
| 162 | u32 wpe:1; /* 31 Write Protection Enable */ | ||
| 163 | } range; | ||
| 164 | u32 regval; | ||
| 165 | }; | ||
| 166 | |||
| 153 | static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); | 167 | static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); |
| 154 | static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); | 168 | static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); |
| 155 | static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); | 169 | static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); |
| @@ -366,6 +380,9 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) | |||
| 366 | return 0; | 380 | return 0; |
| 367 | } | 381 | } |
| 368 | 382 | ||
| 383 | static DEFINE_MUTEX(nvm_mutex); | ||
| 384 | static pid_t nvm_owner = -1; | ||
| 385 | |||
| 369 | /** | 386 | /** |
| 370 | * e1000_acquire_swflag_ich8lan - Acquire software control flag | 387 | * e1000_acquire_swflag_ich8lan - Acquire software control flag |
| 371 | * @hw: pointer to the HW structure | 388 | * @hw: pointer to the HW structure |
| @@ -379,6 +396,15 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
| 379 | u32 extcnf_ctrl; | 396 | u32 extcnf_ctrl; |
| 380 | u32 timeout = PHY_CFG_TIMEOUT; | 397 | u32 timeout = PHY_CFG_TIMEOUT; |
| 381 | 398 | ||
| 399 | might_sleep(); | ||
| 400 | |||
| 401 | if (!mutex_trylock(&nvm_mutex)) { | ||
| 402 | WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n", | ||
| 403 | nvm_owner); | ||
| 404 | mutex_lock(&nvm_mutex); | ||
| 405 | } | ||
| 406 | nvm_owner = current->pid; | ||
| 407 | |||
| 382 | while (timeout) { | 408 | while (timeout) { |
| 383 | extcnf_ctrl = er32(EXTCNF_CTRL); | 409 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| 384 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; | 410 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; |
| @@ -393,6 +419,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
| 393 | 419 | ||
| 394 | if (!timeout) { | 420 | if (!timeout) { |
| 395 | hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); | 421 | hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); |
| 422 | nvm_owner = -1; | ||
| 423 | mutex_unlock(&nvm_mutex); | ||
| 396 | return -E1000_ERR_CONFIG; | 424 | return -E1000_ERR_CONFIG; |
| 397 | } | 425 | } |
| 398 | 426 | ||
| @@ -414,6 +442,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw) | |||
| 414 | extcnf_ctrl = er32(EXTCNF_CTRL); | 442 | extcnf_ctrl = er32(EXTCNF_CTRL); |
| 415 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; | 443 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; |
| 416 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 444 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
| 445 | |||
| 446 | nvm_owner = -1; | ||
| 447 | mutex_unlock(&nvm_mutex); | ||
| 417 | } | 448 | } |
| 418 | 449 | ||
| 419 | /** | 450 | /** |
| @@ -1284,6 +1315,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1284 | * programming failed. | 1315 | * programming failed. |
| 1285 | */ | 1316 | */ |
| 1286 | if (ret_val) { | 1317 | if (ret_val) { |
| 1318 | /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ | ||
| 1287 | hw_dbg(hw, "Flash commit failed.\n"); | 1319 | hw_dbg(hw, "Flash commit failed.\n"); |
| 1288 | e1000_release_swflag_ich8lan(hw); | 1320 | e1000_release_swflag_ich8lan(hw); |
| 1289 | return ret_val; | 1321 | return ret_val; |
| @@ -1374,6 +1406,49 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
| 1374 | } | 1406 | } |
| 1375 | 1407 | ||
| 1376 | /** | 1408 | /** |
| 1409 | * e1000e_write_protect_nvm_ich8lan - Make the NVM read-only | ||
| 1410 | * @hw: pointer to the HW structure | ||
| 1411 | * | ||
| 1412 | * To prevent malicious write/erase of the NVM, set it to be read-only | ||
| 1413 | * so that the hardware ignores all write/erase cycles of the NVM via | ||
| 1414 | * the flash control registers. The shadow-ram copy of the NVM will | ||
| 1415 | * still be updated, however any updates to this copy will not stick | ||
| 1416 | * across driver reloads. | ||
| 1417 | **/ | ||
| 1418 | void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw) | ||
| 1419 | { | ||
| 1420 | union ich8_flash_protected_range pr0; | ||
| 1421 | union ich8_hws_flash_status hsfsts; | ||
| 1422 | u32 gfpreg; | ||
| 1423 | s32 ret_val; | ||
| 1424 | |||
| 1425 | ret_val = e1000_acquire_swflag_ich8lan(hw); | ||
| 1426 | if (ret_val) | ||
| 1427 | return; | ||
| 1428 | |||
| 1429 | gfpreg = er32flash(ICH_FLASH_GFPREG); | ||
| 1430 | |||
| 1431 | /* Write-protect GbE Sector of NVM */ | ||
| 1432 | pr0.regval = er32flash(ICH_FLASH_PR0); | ||
| 1433 | pr0.range.base = gfpreg & FLASH_GFPREG_BASE_MASK; | ||
| 1434 | pr0.range.limit = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK); | ||
| 1435 | pr0.range.wpe = true; | ||
| 1436 | ew32flash(ICH_FLASH_PR0, pr0.regval); | ||
| 1437 | |||
| 1438 | /* | ||
| 1439 | * Lock down a subset of GbE Flash Control Registers, e.g. | ||
| 1440 | * PR0 to prevent the write-protection from being lifted. | ||
| 1441 | * Once FLOCKDN is set, the registers protected by it cannot | ||
| 1442 | * be written until FLOCKDN is cleared by a hardware reset. | ||
| 1443 | */ | ||
| 1444 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); | ||
| 1445 | hsfsts.hsf_status.flockdn = true; | ||
| 1446 | ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); | ||
| 1447 | |||
| 1448 | e1000_release_swflag_ich8lan(hw); | ||
| 1449 | } | ||
| 1450 | |||
| 1451 | /** | ||
| 1377 | * e1000_write_flash_data_ich8lan - Writes bytes to the NVM | 1452 | * e1000_write_flash_data_ich8lan - Writes bytes to the NVM |
| 1378 | * @hw: pointer to the HW structure | 1453 | * @hw: pointer to the HW structure |
| 1379 | * @offset: The offset (in bytes) of the byte/word to read. | 1454 | * @offset: The offset (in bytes) of the byte/word to read. |
| @@ -1720,6 +1795,9 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
| 1720 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); | 1795 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); |
| 1721 | msleep(20); | 1796 | msleep(20); |
| 1722 | 1797 | ||
| 1798 | /* release the swflag because it is not reset by hardware reset */ | ||
| 1799 | e1000_release_swflag_ich8lan(hw); | ||
| 1800 | |||
| 1723 | ret_val = e1000e_get_auto_rd_done(hw); | 1801 | ret_val = e1000e_get_auto_rd_done(hw); |
| 1724 | if (ret_val) { | 1802 | if (ret_val) { |
| 1725 | /* | 1803 | /* |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 05b0b2f9c54b..b81c4237b5d3 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
| @@ -47,7 +47,7 @@ | |||
| 47 | 47 | ||
| 48 | #include "e1000.h" | 48 | #include "e1000.h" |
| 49 | 49 | ||
| 50 | #define DRV_VERSION "0.3.3.3-k2" | 50 | #define DRV_VERSION "0.3.3.3-k6" |
| 51 | char e1000e_driver_name[] = "e1000e"; | 51 | char e1000e_driver_name[] = "e1000e"; |
| 52 | const char e1000e_driver_version[] = DRV_VERSION; | 52 | const char e1000e_driver_version[] = DRV_VERSION; |
| 53 | 53 | ||
| @@ -510,9 +510,12 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
| 510 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 510 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
| 511 | if (new_skb) { | 511 | if (new_skb) { |
| 512 | skb_reserve(new_skb, NET_IP_ALIGN); | 512 | skb_reserve(new_skb, NET_IP_ALIGN); |
| 513 | memcpy(new_skb->data - NET_IP_ALIGN, | 513 | skb_copy_to_linear_data_offset(new_skb, |
| 514 | skb->data - NET_IP_ALIGN, | 514 | -NET_IP_ALIGN, |
| 515 | length + NET_IP_ALIGN); | 515 | (skb->data - |
| 516 | NET_IP_ALIGN), | ||
| 517 | (length + | ||
| 518 | NET_IP_ALIGN)); | ||
| 516 | /* save the skb in buffer_info as good */ | 519 | /* save the skb in buffer_info as good */ |
| 517 | buffer_info->skb = skb; | 520 | buffer_info->skb = skb; |
| 518 | skb = new_skb; | 521 | skb = new_skb; |
| @@ -1112,6 +1115,14 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
| 1112 | writel(0, adapter->hw.hw_addr + rx_ring->tail); | 1115 | writel(0, adapter->hw.hw_addr + rx_ring->tail); |
| 1113 | } | 1116 | } |
| 1114 | 1117 | ||
| 1118 | static void e1000e_downshift_workaround(struct work_struct *work) | ||
| 1119 | { | ||
| 1120 | struct e1000_adapter *adapter = container_of(work, | ||
| 1121 | struct e1000_adapter, downshift_task); | ||
| 1122 | |||
| 1123 | e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); | ||
| 1124 | } | ||
| 1125 | |||
| 1115 | /** | 1126 | /** |
| 1116 | * e1000_intr_msi - Interrupt Handler | 1127 | * e1000_intr_msi - Interrupt Handler |
| 1117 | * @irq: interrupt number | 1128 | * @irq: interrupt number |
| @@ -1136,7 +1147,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) | |||
| 1136 | */ | 1147 | */ |
| 1137 | if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && | 1148 | if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && |
| 1138 | (!(er32(STATUS) & E1000_STATUS_LU))) | 1149 | (!(er32(STATUS) & E1000_STATUS_LU))) |
| 1139 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1150 | schedule_work(&adapter->downshift_task); |
| 1140 | 1151 | ||
| 1141 | /* | 1152 | /* |
| 1142 | * 80003ES2LAN workaround-- For packet buffer work-around on | 1153 | * 80003ES2LAN workaround-- For packet buffer work-around on |
| @@ -1202,7 +1213,7 @@ static irqreturn_t e1000_intr(int irq, void *data) | |||
| 1202 | */ | 1213 | */ |
| 1203 | if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && | 1214 | if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && |
| 1204 | (!(er32(STATUS) & E1000_STATUS_LU))) | 1215 | (!(er32(STATUS) & E1000_STATUS_LU))) |
| 1205 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1216 | schedule_work(&adapter->downshift_task); |
| 1206 | 1217 | ||
| 1207 | /* | 1218 | /* |
| 1208 | * 80003ES2LAN workaround-- | 1219 | * 80003ES2LAN workaround-- |
| @@ -1233,26 +1244,36 @@ static irqreturn_t e1000_intr(int irq, void *data) | |||
| 1233 | return IRQ_HANDLED; | 1244 | return IRQ_HANDLED; |
| 1234 | } | 1245 | } |
| 1235 | 1246 | ||
| 1247 | /** | ||
| 1248 | * e1000_request_irq - initialize interrupts | ||
| 1249 | * | ||
| 1250 | * Attempts to configure interrupts using the best available | ||
| 1251 | * capabilities of the hardware and kernel. | ||
| 1252 | **/ | ||
| 1236 | static int e1000_request_irq(struct e1000_adapter *adapter) | 1253 | static int e1000_request_irq(struct e1000_adapter *adapter) |
| 1237 | { | 1254 | { |
| 1238 | struct net_device *netdev = adapter->netdev; | 1255 | struct net_device *netdev = adapter->netdev; |
| 1239 | irq_handler_t handler = e1000_intr; | ||
| 1240 | int irq_flags = IRQF_SHARED; | 1256 | int irq_flags = IRQF_SHARED; |
| 1241 | int err; | 1257 | int err; |
| 1242 | 1258 | ||
| 1243 | if (!pci_enable_msi(adapter->pdev)) { | 1259 | if (!(adapter->flags & FLAG_MSI_TEST_FAILED)) { |
| 1244 | adapter->flags |= FLAG_MSI_ENABLED; | 1260 | err = pci_enable_msi(adapter->pdev); |
| 1245 | handler = e1000_intr_msi; | 1261 | if (!err) { |
| 1246 | irq_flags = 0; | 1262 | adapter->flags |= FLAG_MSI_ENABLED; |
| 1263 | irq_flags = 0; | ||
| 1264 | } | ||
| 1247 | } | 1265 | } |
| 1248 | 1266 | ||
| 1249 | err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, | 1267 | err = request_irq(adapter->pdev->irq, |
| 1250 | netdev); | 1268 | ((adapter->flags & FLAG_MSI_ENABLED) ? |
| 1269 | &e1000_intr_msi : &e1000_intr), | ||
| 1270 | irq_flags, netdev->name, netdev); | ||
| 1251 | if (err) { | 1271 | if (err) { |
| 1252 | e_err("Unable to allocate %s interrupt (return: %d)\n", | 1272 | if (adapter->flags & FLAG_MSI_ENABLED) { |
| 1253 | adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx", err); | ||
| 1254 | if (adapter->flags & FLAG_MSI_ENABLED) | ||
| 1255 | pci_disable_msi(adapter->pdev); | 1273 | pci_disable_msi(adapter->pdev); |
| 1274 | adapter->flags &= ~FLAG_MSI_ENABLED; | ||
| 1275 | } | ||
| 1276 | e_err("Unable to allocate interrupt, Error: %d\n", err); | ||
| 1256 | } | 1277 | } |
| 1257 | 1278 | ||
| 1258 | return err; | 1279 | return err; |
| @@ -2579,8 +2600,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter) | |||
| 2579 | /* Explicitly disable IRQ since the NIC can be in any state. */ | 2600 | /* Explicitly disable IRQ since the NIC can be in any state. */ |
| 2580 | e1000_irq_disable(adapter); | 2601 | e1000_irq_disable(adapter); |
| 2581 | 2602 | ||
| 2582 | spin_lock_init(&adapter->stats_lock); | ||
| 2583 | |||
| 2584 | set_bit(__E1000_DOWN, &adapter->state); | 2603 | set_bit(__E1000_DOWN, &adapter->state); |
| 2585 | return 0; | 2604 | return 0; |
| 2586 | 2605 | ||
| @@ -2592,6 +2611,135 @@ err: | |||
| 2592 | } | 2611 | } |
| 2593 | 2612 | ||
| 2594 | /** | 2613 | /** |
| 2614 | * e1000_intr_msi_test - Interrupt Handler | ||
| 2615 | * @irq: interrupt number | ||
| 2616 | * @data: pointer to a network interface device structure | ||
| 2617 | **/ | ||
| 2618 | static irqreturn_t e1000_intr_msi_test(int irq, void *data) | ||
| 2619 | { | ||
| 2620 | struct net_device *netdev = data; | ||
| 2621 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
| 2622 | struct e1000_hw *hw = &adapter->hw; | ||
| 2623 | u32 icr = er32(ICR); | ||
| 2624 | |||
| 2625 | e_dbg("%s: icr is %08X\n", netdev->name, icr); | ||
| 2626 | if (icr & E1000_ICR_RXSEQ) { | ||
| 2627 | adapter->flags &= ~FLAG_MSI_TEST_FAILED; | ||
| 2628 | wmb(); | ||
| 2629 | } | ||
| 2630 | |||
| 2631 | return IRQ_HANDLED; | ||
| 2632 | } | ||
| 2633 | |||
| 2634 | /** | ||
| 2635 | * e1000_test_msi_interrupt - Returns 0 for successful test | ||
| 2636 | * @adapter: board private struct | ||
| 2637 | * | ||
| 2638 | * code flow taken from tg3.c | ||
| 2639 | **/ | ||
| 2640 | static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) | ||
| 2641 | { | ||
| 2642 | struct net_device *netdev = adapter->netdev; | ||
| 2643 | struct e1000_hw *hw = &adapter->hw; | ||
| 2644 | int err; | ||
| 2645 | |||
| 2646 | /* poll_enable hasn't been called yet, so don't need disable */ | ||
| 2647 | /* clear any pending events */ | ||
| 2648 | er32(ICR); | ||
| 2649 | |||
| 2650 | /* free the real vector and request a test handler */ | ||
| 2651 | e1000_free_irq(adapter); | ||
| 2652 | |||
| 2653 | /* Assume that the test fails, if it succeeds then the test | ||
| 2654 | * MSI irq handler will unset this flag */ | ||
| 2655 | adapter->flags |= FLAG_MSI_TEST_FAILED; | ||
| 2656 | |||
| 2657 | err = pci_enable_msi(adapter->pdev); | ||
| 2658 | if (err) | ||
| 2659 | goto msi_test_failed; | ||
| 2660 | |||
| 2661 | err = request_irq(adapter->pdev->irq, &e1000_intr_msi_test, 0, | ||
| 2662 | netdev->name, netdev); | ||
| 2663 | if (err) { | ||
| 2664 | pci_disable_msi(adapter->pdev); | ||
| 2665 | goto msi_test_failed; | ||
| 2666 | } | ||
| 2667 | |||
| 2668 | wmb(); | ||
| 2669 | |||
| 2670 | e1000_irq_enable(adapter); | ||
| 2671 | |||
| 2672 | /* fire an unusual interrupt on the test handler */ | ||
| 2673 | ew32(ICS, E1000_ICS_RXSEQ); | ||
| 2674 | e1e_flush(); | ||
| 2675 | msleep(50); | ||
| 2676 | |||
| 2677 | e1000_irq_disable(adapter); | ||
| 2678 | |||
| 2679 | rmb(); | ||
| 2680 | |||
| 2681 | if (adapter->flags & FLAG_MSI_TEST_FAILED) { | ||
| 2682 | err = -EIO; | ||
| 2683 | e_info("MSI interrupt test failed!\n"); | ||
| 2684 | } | ||
| 2685 | |||
| 2686 | free_irq(adapter->pdev->irq, netdev); | ||
| 2687 | pci_disable_msi(adapter->pdev); | ||
| 2688 | |||
| 2689 | if (err == -EIO) | ||
| 2690 | goto msi_test_failed; | ||
| 2691 | |||
| 2692 | /* okay so the test worked, restore settings */ | ||
| 2693 | e_dbg("%s: MSI interrupt test succeeded!\n", netdev->name); | ||
| 2694 | msi_test_failed: | ||
| 2695 | /* restore the original vector, even if it failed */ | ||
| 2696 | e1000_request_irq(adapter); | ||
| 2697 | return err; | ||
| 2698 | } | ||
| 2699 | |||
| 2700 | /** | ||
| 2701 | * e1000_test_msi - Returns 0 if MSI test succeeds or INTx mode is restored | ||
| 2702 | * @adapter: board private struct | ||
| 2703 | * | ||
| 2704 | * code flow taken from tg3.c, called with e1000 interrupts disabled. | ||
| 2705 | **/ | ||
| 2706 | static int e1000_test_msi(struct e1000_adapter *adapter) | ||
| 2707 | { | ||
| 2708 | int err; | ||
| 2709 | u16 pci_cmd; | ||
| 2710 | |||
| 2711 | if (!(adapter->flags & FLAG_MSI_ENABLED)) | ||
| 2712 | return 0; | ||
| 2713 | |||
| 2714 | /* disable SERR in case the MSI write causes a master abort */ | ||
| 2715 | pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd); | ||
| 2716 | pci_write_config_word(adapter->pdev, PCI_COMMAND, | ||
| 2717 | pci_cmd & ~PCI_COMMAND_SERR); | ||
| 2718 | |||
| 2719 | err = e1000_test_msi_interrupt(adapter); | ||
| 2720 | |||
| 2721 | /* restore previous setting of command word */ | ||
| 2722 | pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd); | ||
| 2723 | |||
| 2724 | /* success ! */ | ||
| 2725 | if (!err) | ||
| 2726 | return 0; | ||
| 2727 | |||
| 2728 | /* EIO means MSI test failed */ | ||
| 2729 | if (err != -EIO) | ||
| 2730 | return err; | ||
| 2731 | |||
| 2732 | /* back to INTx mode */ | ||
| 2733 | e_warn("MSI interrupt test failed, using legacy interrupt.\n"); | ||
| 2734 | |||
| 2735 | e1000_free_irq(adapter); | ||
| 2736 | |||
| 2737 | err = e1000_request_irq(adapter); | ||
| 2738 | |||
| 2739 | return err; | ||
| 2740 | } | ||
| 2741 | |||
| 2742 | /** | ||
| 2595 | * e1000_open - Called when a network interface is made active | 2743 | * e1000_open - Called when a network interface is made active |
| 2596 | * @netdev: network interface device structure | 2744 | * @netdev: network interface device structure |
| 2597 | * | 2745 | * |
| @@ -2649,6 +2797,19 @@ static int e1000_open(struct net_device *netdev) | |||
| 2649 | if (err) | 2797 | if (err) |
| 2650 | goto err_req_irq; | 2798 | goto err_req_irq; |
| 2651 | 2799 | ||
| 2800 | /* | ||
| 2801 | * Work around PCIe errata with MSI interrupts causing some chipsets to | ||
| 2802 | * ignore e1000e MSI messages, which means we need to test our MSI | ||
| 2803 | * interrupt now | ||
| 2804 | */ | ||
| 2805 | { | ||
| 2806 | err = e1000_test_msi(adapter); | ||
| 2807 | if (err) { | ||
| 2808 | e_err("Interrupt allocation failed\n"); | ||
| 2809 | goto err_req_irq; | ||
| 2810 | } | ||
| 2811 | } | ||
| 2812 | |||
| 2652 | /* From here on the code is the same as e1000e_up() */ | 2813 | /* From here on the code is the same as e1000e_up() */ |
| 2653 | clear_bit(__E1000_DOWN, &adapter->state); | 2814 | clear_bit(__E1000_DOWN, &adapter->state); |
| 2654 | 2815 | ||
| @@ -2757,6 +2918,21 @@ static int e1000_set_mac(struct net_device *netdev, void *p) | |||
| 2757 | return 0; | 2918 | return 0; |
| 2758 | } | 2919 | } |
| 2759 | 2920 | ||
| 2921 | /** | ||
| 2922 | * e1000e_update_phy_task - work thread to update phy | ||
| 2923 | * @work: pointer to our work struct | ||
| 2924 | * | ||
| 2925 | * this worker thread exists because we must acquire a | ||
| 2926 | * semaphore to read the phy, which we could msleep while | ||
| 2927 | * waiting for it, and we can't msleep in a timer. | ||
| 2928 | **/ | ||
| 2929 | static void e1000e_update_phy_task(struct work_struct *work) | ||
| 2930 | { | ||
| 2931 | struct e1000_adapter *adapter = container_of(work, | ||
| 2932 | struct e1000_adapter, update_phy_task); | ||
| 2933 | e1000_get_phy_info(&adapter->hw); | ||
| 2934 | } | ||
| 2935 | |||
| 2760 | /* | 2936 | /* |
| 2761 | * Need to wait a few seconds after link up to get diagnostic information from | 2937 | * Need to wait a few seconds after link up to get diagnostic information from |
| 2762 | * the phy | 2938 | * the phy |
| @@ -2764,7 +2940,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p) | |||
| 2764 | static void e1000_update_phy_info(unsigned long data) | 2940 | static void e1000_update_phy_info(unsigned long data) |
| 2765 | { | 2941 | { |
| 2766 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; | 2942 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
| 2767 | e1000_get_phy_info(&adapter->hw); | 2943 | schedule_work(&adapter->update_phy_task); |
| 2768 | } | 2944 | } |
| 2769 | 2945 | ||
| 2770 | /** | 2946 | /** |
| @@ -2775,10 +2951,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
| 2775 | { | 2951 | { |
| 2776 | struct e1000_hw *hw = &adapter->hw; | 2952 | struct e1000_hw *hw = &adapter->hw; |
| 2777 | struct pci_dev *pdev = adapter->pdev; | 2953 | struct pci_dev *pdev = adapter->pdev; |
| 2778 | unsigned long irq_flags; | ||
| 2779 | u16 phy_tmp; | ||
| 2780 | |||
| 2781 | #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF | ||
| 2782 | 2954 | ||
| 2783 | /* | 2955 | /* |
| 2784 | * Prevent stats update while adapter is being reset, or if the pci | 2956 | * Prevent stats update while adapter is being reset, or if the pci |
| @@ -2789,14 +2961,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
| 2789 | if (pci_channel_offline(pdev)) | 2961 | if (pci_channel_offline(pdev)) |
| 2790 | return; | 2962 | return; |
| 2791 | 2963 | ||
| 2792 | spin_lock_irqsave(&adapter->stats_lock, irq_flags); | ||
| 2793 | |||
| 2794 | /* | ||
| 2795 | * these counters are modified from e1000_adjust_tbi_stats, | ||
| 2796 | * called from the interrupt context, so they must only | ||
| 2797 | * be written while holding adapter->stats_lock | ||
| 2798 | */ | ||
| 2799 | |||
| 2800 | adapter->stats.crcerrs += er32(CRCERRS); | 2964 | adapter->stats.crcerrs += er32(CRCERRS); |
| 2801 | adapter->stats.gprc += er32(GPRC); | 2965 | adapter->stats.gprc += er32(GPRC); |
| 2802 | adapter->stats.gorc += er32(GORCL); | 2966 | adapter->stats.gorc += er32(GORCL); |
| @@ -2867,21 +3031,10 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
| 2867 | 3031 | ||
| 2868 | /* Tx Dropped needs to be maintained elsewhere */ | 3032 | /* Tx Dropped needs to be maintained elsewhere */ |
| 2869 | 3033 | ||
| 2870 | /* Phy Stats */ | ||
| 2871 | if (hw->phy.media_type == e1000_media_type_copper) { | ||
| 2872 | if ((adapter->link_speed == SPEED_1000) && | ||
| 2873 | (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) { | ||
| 2874 | phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; | ||
| 2875 | adapter->phy_stats.idle_errors += phy_tmp; | ||
| 2876 | } | ||
| 2877 | } | ||
| 2878 | |||
| 2879 | /* Management Stats */ | 3034 | /* Management Stats */ |
| 2880 | adapter->stats.mgptc += er32(MGTPTC); | 3035 | adapter->stats.mgptc += er32(MGTPTC); |
| 2881 | adapter->stats.mgprc += er32(MGTPRC); | 3036 | adapter->stats.mgprc += er32(MGTPRC); |
| 2882 | adapter->stats.mgpdc += er32(MGTPDC); | 3037 | adapter->stats.mgpdc += er32(MGTPDC); |
| 2883 | |||
| 2884 | spin_unlock_irqrestore(&adapter->stats_lock, irq_flags); | ||
| 2885 | } | 3038 | } |
| 2886 | 3039 | ||
| 2887 | /** | 3040 | /** |
| @@ -2893,10 +3046,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
| 2893 | struct e1000_hw *hw = &adapter->hw; | 3046 | struct e1000_hw *hw = &adapter->hw; |
| 2894 | struct e1000_phy_regs *phy = &adapter->phy_regs; | 3047 | struct e1000_phy_regs *phy = &adapter->phy_regs; |
| 2895 | int ret_val; | 3048 | int ret_val; |
| 2896 | unsigned long irq_flags; | ||
| 2897 | |||
| 2898 | |||
| 2899 | spin_lock_irqsave(&adapter->stats_lock, irq_flags); | ||
| 2900 | 3049 | ||
| 2901 | if ((er32(STATUS) & E1000_STATUS_LU) && | 3050 | if ((er32(STATUS) & E1000_STATUS_LU) && |
| 2902 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { | 3051 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { |
| @@ -2927,8 +3076,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
| 2927 | phy->stat1000 = 0; | 3076 | phy->stat1000 = 0; |
| 2928 | phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); | 3077 | phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); |
| 2929 | } | 3078 | } |
| 2930 | |||
| 2931 | spin_unlock_irqrestore(&adapter->stats_lock, irq_flags); | ||
| 2932 | } | 3079 | } |
| 2933 | 3080 | ||
| 2934 | static void e1000_print_link_info(struct e1000_adapter *adapter) | 3081 | static void e1000_print_link_info(struct e1000_adapter *adapter) |
| @@ -3055,7 +3202,7 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
| 3055 | case SPEED_10: | 3202 | case SPEED_10: |
| 3056 | txb2b = 0; | 3203 | txb2b = 0; |
| 3057 | netdev->tx_queue_len = 10; | 3204 | netdev->tx_queue_len = 10; |
| 3058 | adapter->tx_timeout_factor = 14; | 3205 | adapter->tx_timeout_factor = 16; |
| 3059 | break; | 3206 | break; |
| 3060 | case SPEED_100: | 3207 | case SPEED_100: |
| 3061 | txb2b = 0; | 3208 | txb2b = 0; |
| @@ -3721,7 +3868,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 3721 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3868 | struct e1000_adapter *adapter = netdev_priv(netdev); |
| 3722 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; | 3869 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
| 3723 | 3870 | ||
| 3724 | if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || | 3871 | if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) || |
| 3725 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { | 3872 | (max_frame > MAX_JUMBO_FRAME_SIZE)) { |
| 3726 | e_err("Invalid MTU setting\n"); | 3873 | e_err("Invalid MTU setting\n"); |
| 3727 | return -EINVAL; | 3874 | return -EINVAL; |
| @@ -4312,6 +4459,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
| 4312 | 4459 | ||
| 4313 | adapter->bd_number = cards_found++; | 4460 | adapter->bd_number = cards_found++; |
| 4314 | 4461 | ||
| 4462 | e1000e_check_options(adapter); | ||
| 4463 | |||
| 4315 | /* setup adapter struct */ | 4464 | /* setup adapter struct */ |
| 4316 | err = e1000_sw_init(adapter); | 4465 | err = e1000_sw_init(adapter); |
| 4317 | if (err) | 4466 | if (err) |
| @@ -4327,6 +4476,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
| 4327 | if (err) | 4476 | if (err) |
| 4328 | goto err_hw_init; | 4477 | goto err_hw_init; |
| 4329 | 4478 | ||
| 4479 | if ((adapter->flags & FLAG_IS_ICH) && | ||
| 4480 | (adapter->flags & FLAG_READ_ONLY_NVM)) | ||
| 4481 | e1000e_write_protect_nvm_ich8lan(&adapter->hw); | ||
| 4482 | |||
| 4330 | hw->mac.ops.get_bus_info(&adapter->hw); | 4483 | hw->mac.ops.get_bus_info(&adapter->hw); |
| 4331 | 4484 | ||
| 4332 | adapter->hw.phy.autoneg_wait_to_complete = 0; | 4485 | adapter->hw.phy.autoneg_wait_to_complete = 0; |
| @@ -4417,8 +4570,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
| 4417 | 4570 | ||
| 4418 | INIT_WORK(&adapter->reset_task, e1000_reset_task); | 4571 | INIT_WORK(&adapter->reset_task, e1000_reset_task); |
| 4419 | INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); | 4572 | INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); |
| 4420 | 4573 | INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround); | |
| 4421 | e1000e_check_options(adapter); | 4574 | INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task); |
| 4422 | 4575 | ||
| 4423 | /* Initialize link parameters. User can change them with ethtool */ | 4576 | /* Initialize link parameters. User can change them with ethtool */ |
| 4424 | adapter->hw.mac.autoneg = 1; | 4577 | adapter->hw.mac.autoneg = 1; |
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c index 8effc3107f9a..d91dbf7ba434 100644 --- a/drivers/net/e1000e/param.c +++ b/drivers/net/e1000e/param.c | |||
| @@ -133,6 +133,15 @@ E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); | |||
| 133 | */ | 133 | */ |
| 134 | E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); | 134 | E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); |
| 135 | 135 | ||
| 136 | /* | ||
| 137 | * Write Protect NVM | ||
| 138 | * | ||
| 139 | * Valid Range: 0, 1 | ||
| 140 | * | ||
| 141 | * Default Value: 1 (enabled) | ||
| 142 | */ | ||
| 143 | E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); | ||
| 144 | |||
| 136 | struct e1000_option { | 145 | struct e1000_option { |
| 137 | enum { enable_option, range_option, list_option } type; | 146 | enum { enable_option, range_option, list_option } type; |
| 138 | const char *name; | 147 | const char *name; |
| @@ -324,14 +333,27 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
| 324 | adapter->itr = 20000; | 333 | adapter->itr = 20000; |
| 325 | break; | 334 | break; |
| 326 | default: | 335 | default: |
| 327 | e1000_validate_option(&adapter->itr, &opt, | ||
| 328 | adapter); | ||
| 329 | /* | 336 | /* |
| 330 | * save the setting, because the dynamic bits | 337 | * Save the setting, because the dynamic bits |
| 331 | * change itr. clear the lower two bits | 338 | * change itr. |
| 332 | * because they are used as control | ||
| 333 | */ | 339 | */ |
| 334 | adapter->itr_setting = adapter->itr & ~3; | 340 | if (e1000_validate_option(&adapter->itr, &opt, |
| 341 | adapter) && | ||
| 342 | (adapter->itr == 3)) { | ||
| 343 | /* | ||
| 344 | * In case of invalid user value, | ||
| 345 | * default to conservative mode. | ||
| 346 | */ | ||
| 347 | adapter->itr_setting = adapter->itr; | ||
| 348 | adapter->itr = 20000; | ||
| 349 | } else { | ||
| 350 | /* | ||
| 351 | * Clear the lower two bits because | ||
| 352 | * they are used as control. | ||
| 353 | */ | ||
| 354 | adapter->itr_setting = | ||
| 355 | adapter->itr & ~3; | ||
| 356 | } | ||
| 335 | break; | 357 | break; |
| 336 | } | 358 | } |
| 337 | } else { | 359 | } else { |
| @@ -375,4 +397,25 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
| 375 | opt.def); | 397 | opt.def); |
| 376 | } | 398 | } |
| 377 | } | 399 | } |
| 400 | { /* Write-protect NVM */ | ||
| 401 | const struct e1000_option opt = { | ||
| 402 | .type = enable_option, | ||
| 403 | .name = "Write-protect NVM", | ||
| 404 | .err = "defaulting to Enabled", | ||
| 405 | .def = OPTION_ENABLED | ||
| 406 | }; | ||
| 407 | |||
| 408 | if (adapter->flags & FLAG_IS_ICH) { | ||
| 409 | if (num_WriteProtectNVM > bd) { | ||
| 410 | unsigned int write_protect_nvm = WriteProtectNVM[bd]; | ||
| 411 | e1000_validate_option(&write_protect_nvm, &opt, | ||
| 412 | adapter); | ||
| 413 | if (write_protect_nvm) | ||
| 414 | adapter->flags |= FLAG_READ_ONLY_NVM; | ||
| 415 | } else { | ||
| 416 | if (opt.def) | ||
| 417 | adapter->flags |= FLAG_READ_ONLY_NVM; | ||
| 418 | } | ||
| 419 | } | ||
| 420 | } | ||
| 378 | } | 421 | } |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 053971e5fc94..eeb55ed2152d 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
| @@ -5522,7 +5522,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
| 5522 | if (id->driver_data & DEV_HAS_CHECKSUM) { | 5522 | if (id->driver_data & DEV_HAS_CHECKSUM) { |
| 5523 | np->rx_csum = 1; | 5523 | np->rx_csum = 1; |
| 5524 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; | 5524 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
| 5525 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; | 5525 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; |
| 5526 | dev->features |= NETIF_F_TSO; | 5526 | dev->features |= NETIF_F_TSO; |
| 5527 | } | 5527 | } |
| 5528 | 5528 | ||
| @@ -5643,6 +5643,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
| 5643 | dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; | 5643 | dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; |
| 5644 | dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; | 5644 | dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; |
| 5645 | writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); | 5645 | writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); |
| 5646 | printk(KERN_DEBUG "nv_probe: set workaround bit for reversed mac addr\n"); | ||
| 5646 | } | 5647 | } |
| 5647 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | 5648 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
| 5648 | 5649 | ||
| @@ -5835,7 +5836,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
| 5835 | 5836 | ||
| 5836 | dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n", | 5837 | dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n", |
| 5837 | dev->features & NETIF_F_HIGHDMA ? "highdma " : "", | 5838 | dev->features & NETIF_F_HIGHDMA ? "highdma " : "", |
| 5838 | dev->features & (NETIF_F_HW_CSUM | NETIF_F_SG) ? | 5839 | dev->features & (NETIF_F_IP_CSUM | NETIF_F_SG) ? |
| 5839 | "csum " : "", | 5840 | "csum " : "", |
| 5840 | dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ? | 5841 | dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ? |
| 5841 | "vlan " : "", | 5842 | "vlan " : "", |
| @@ -5890,14 +5891,12 @@ static void nv_restore_phy(struct net_device *dev) | |||
| 5890 | } | 5891 | } |
| 5891 | } | 5892 | } |
| 5892 | 5893 | ||
| 5893 | static void __devexit nv_remove(struct pci_dev *pci_dev) | 5894 | static void nv_restore_mac_addr(struct pci_dev *pci_dev) |
| 5894 | { | 5895 | { |
| 5895 | struct net_device *dev = pci_get_drvdata(pci_dev); | 5896 | struct net_device *dev = pci_get_drvdata(pci_dev); |
| 5896 | struct fe_priv *np = netdev_priv(dev); | 5897 | struct fe_priv *np = netdev_priv(dev); |
| 5897 | u8 __iomem *base = get_hwbase(dev); | 5898 | u8 __iomem *base = get_hwbase(dev); |
| 5898 | 5899 | ||
| 5899 | unregister_netdev(dev); | ||
| 5900 | |||
| 5901 | /* special op: write back the misordered MAC address - otherwise | 5900 | /* special op: write back the misordered MAC address - otherwise |
| 5902 | * the next nv_probe would see a wrong address. | 5901 | * the next nv_probe would see a wrong address. |
| 5903 | */ | 5902 | */ |
| @@ -5905,6 +5904,15 @@ static void __devexit nv_remove(struct pci_dev *pci_dev) | |||
| 5905 | writel(np->orig_mac[1], base + NvRegMacAddrB); | 5904 | writel(np->orig_mac[1], base + NvRegMacAddrB); |
| 5906 | writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV, | 5905 | writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV, |
| 5907 | base + NvRegTransmitPoll); | 5906 | base + NvRegTransmitPoll); |
| 5907 | } | ||
| 5908 | |||
| 5909 | static void __devexit nv_remove(struct pci_dev *pci_dev) | ||
| 5910 | { | ||
| 5911 | struct net_device *dev = pci_get_drvdata(pci_dev); | ||
| 5912 | |||
| 5913 | unregister_netdev(dev); | ||
| 5914 | |||
| 5915 | nv_restore_mac_addr(pci_dev); | ||
| 5908 | 5916 | ||
| 5909 | /* restore any phy related changes */ | 5917 | /* restore any phy related changes */ |
| 5910 | nv_restore_phy(dev); | 5918 | nv_restore_phy(dev); |
| @@ -5975,10 +5983,14 @@ static void nv_shutdown(struct pci_dev *pdev) | |||
| 5975 | if (netif_running(dev)) | 5983 | if (netif_running(dev)) |
| 5976 | nv_close(dev); | 5984 | nv_close(dev); |
| 5977 | 5985 | ||
| 5978 | pci_enable_wake(pdev, PCI_D3hot, np->wolenabled); | 5986 | nv_restore_mac_addr(pdev); |
| 5979 | pci_enable_wake(pdev, PCI_D3cold, np->wolenabled); | 5987 | |
| 5980 | pci_disable_device(pdev); | 5988 | pci_disable_device(pdev); |
| 5981 | pci_set_power_state(pdev, PCI_D3hot); | 5989 | if (system_state == SYSTEM_POWER_OFF) { |
| 5990 | if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled)) | ||
| 5991 | pci_enable_wake(pdev, PCI_D3hot, np->wolenabled); | ||
| 5992 | pci_set_power_state(pdev, PCI_D3hot); | ||
| 5993 | } | ||
| 5982 | } | 5994 | } |
| 5983 | #else | 5995 | #else |
| 5984 | #define nv_suspend NULL | 5996 | #define nv_suspend NULL |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 9a51ec8293cc..9d461825bf4c 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
| @@ -792,6 +792,10 @@ static int fs_enet_open(struct net_device *dev) | |||
| 792 | int r; | 792 | int r; |
| 793 | int err; | 793 | int err; |
| 794 | 794 | ||
| 795 | /* to initialize the fep->cur_rx,... */ | ||
| 796 | /* not doing this, will cause a crash in fs_enet_rx_napi */ | ||
| 797 | fs_init_bds(fep->ndev); | ||
| 798 | |||
| 795 | if (fep->fpi->use_napi) | 799 | if (fep->fpi->use_napi) |
| 796 | napi_enable(&fep->napi); | 800 | napi_enable(&fep->napi); |
| 797 | 801 | ||
| @@ -1167,6 +1171,10 @@ static struct of_device_id fs_enet_match[] = { | |||
| 1167 | .compatible = "fsl,cpm1-scc-enet", | 1171 | .compatible = "fsl,cpm1-scc-enet", |
| 1168 | .data = (void *)&fs_scc_ops, | 1172 | .data = (void *)&fs_scc_ops, |
| 1169 | }, | 1173 | }, |
| 1174 | { | ||
| 1175 | .compatible = "fsl,cpm2-scc-enet", | ||
| 1176 | .data = (void *)&fs_scc_ops, | ||
| 1177 | }, | ||
| 1170 | #endif | 1178 | #endif |
| 1171 | #ifdef CONFIG_FS_ENET_HAS_FCC | 1179 | #ifdef CONFIG_FS_ENET_HAS_FCC |
| 1172 | { | 1180 | { |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index 029b3c7ef29c..22f50dd8b277 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
| @@ -47,7 +47,6 @@ | |||
| 47 | #include "fs_enet.h" | 47 | #include "fs_enet.h" |
| 48 | 48 | ||
| 49 | /*************************************************/ | 49 | /*************************************************/ |
| 50 | |||
| 51 | #if defined(CONFIG_CPM1) | 50 | #if defined(CONFIG_CPM1) |
| 52 | /* for a 8xx __raw_xxx's are sufficient */ | 51 | /* for a 8xx __raw_xxx's are sufficient */ |
| 53 | #define __fs_out32(addr, x) __raw_writel(x, addr) | 52 | #define __fs_out32(addr, x) __raw_writel(x, addr) |
| @@ -62,6 +61,8 @@ | |||
| 62 | #define __fs_out16(addr, x) out_be16(addr, x) | 61 | #define __fs_out16(addr, x) out_be16(addr, x) |
| 63 | #define __fs_in32(addr) in_be32(addr) | 62 | #define __fs_in32(addr) in_be32(addr) |
| 64 | #define __fs_in16(addr) in_be16(addr) | 63 | #define __fs_in16(addr) in_be16(addr) |
| 64 | #define __fs_out8(addr, x) out_8(addr, x) | ||
| 65 | #define __fs_in8(addr) in_8(addr) | ||
| 65 | #endif | 66 | #endif |
| 66 | 67 | ||
| 67 | /* write, read, set bits, clear bits */ | 68 | /* write, read, set bits, clear bits */ |
| @@ -262,8 +263,13 @@ static void restart(struct net_device *dev) | |||
| 262 | 263 | ||
| 263 | /* Initialize function code registers for big-endian. | 264 | /* Initialize function code registers for big-endian. |
| 264 | */ | 265 | */ |
| 266 | #ifndef CONFIG_NOT_COHERENT_CACHE | ||
| 267 | W8(ep, sen_genscc.scc_rfcr, SCC_EB | SCC_GBL); | ||
| 268 | W8(ep, sen_genscc.scc_tfcr, SCC_EB | SCC_GBL); | ||
| 269 | #else | ||
| 265 | W8(ep, sen_genscc.scc_rfcr, SCC_EB); | 270 | W8(ep, sen_genscc.scc_rfcr, SCC_EB); |
| 266 | W8(ep, sen_genscc.scc_tfcr, SCC_EB); | 271 | W8(ep, sen_genscc.scc_tfcr, SCC_EB); |
| 272 | #endif | ||
| 267 | 273 | ||
| 268 | /* Set maximum bytes per receive buffer. | 274 | /* Set maximum bytes per receive buffer. |
| 269 | * This appears to be an Ethernet frame size, not the buffer | 275 | * This appears to be an Ethernet frame size, not the buffer |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index ca6cf6ecb37b..4320a983a588 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -105,6 +105,7 @@ const char gfar_driver_version[] = "1.3"; | |||
| 105 | 105 | ||
| 106 | static int gfar_enet_open(struct net_device *dev); | 106 | static int gfar_enet_open(struct net_device *dev); |
| 107 | static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); | 107 | static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); |
| 108 | static void gfar_reset_task(struct work_struct *work); | ||
| 108 | static void gfar_timeout(struct net_device *dev); | 109 | static void gfar_timeout(struct net_device *dev); |
| 109 | static int gfar_close(struct net_device *dev); | 110 | static int gfar_close(struct net_device *dev); |
| 110 | struct sk_buff *gfar_new_skb(struct net_device *dev); | 111 | struct sk_buff *gfar_new_skb(struct net_device *dev); |
| @@ -134,9 +135,7 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int l | |||
| 134 | static void gfar_vlan_rx_register(struct net_device *netdev, | 135 | static void gfar_vlan_rx_register(struct net_device *netdev, |
| 135 | struct vlan_group *grp); | 136 | struct vlan_group *grp); |
| 136 | void gfar_halt(struct net_device *dev); | 137 | void gfar_halt(struct net_device *dev); |
| 137 | #ifdef CONFIG_PM | ||
| 138 | static void gfar_halt_nodisable(struct net_device *dev); | 138 | static void gfar_halt_nodisable(struct net_device *dev); |
| 139 | #endif | ||
| 140 | void gfar_start(struct net_device *dev); | 139 | void gfar_start(struct net_device *dev); |
| 141 | static void gfar_clear_exact_match(struct net_device *dev); | 140 | static void gfar_clear_exact_match(struct net_device *dev); |
| 142 | static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); | 141 | static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); |
| @@ -211,6 +210,7 @@ static int gfar_probe(struct platform_device *pdev) | |||
| 211 | spin_lock_init(&priv->txlock); | 210 | spin_lock_init(&priv->txlock); |
| 212 | spin_lock_init(&priv->rxlock); | 211 | spin_lock_init(&priv->rxlock); |
| 213 | spin_lock_init(&priv->bflock); | 212 | spin_lock_init(&priv->bflock); |
| 213 | INIT_WORK(&priv->reset_task, gfar_reset_task); | ||
| 214 | 214 | ||
| 215 | platform_set_drvdata(pdev, dev); | 215 | platform_set_drvdata(pdev, dev); |
| 216 | 216 | ||
| @@ -631,7 +631,6 @@ static void init_registers(struct net_device *dev) | |||
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | 633 | ||
| 634 | #ifdef CONFIG_PM | ||
| 635 | /* Halt the receive and transmit queues */ | 634 | /* Halt the receive and transmit queues */ |
| 636 | static void gfar_halt_nodisable(struct net_device *dev) | 635 | static void gfar_halt_nodisable(struct net_device *dev) |
| 637 | { | 636 | { |
| @@ -657,7 +656,6 @@ static void gfar_halt_nodisable(struct net_device *dev) | |||
| 657 | cpu_relax(); | 656 | cpu_relax(); |
| 658 | } | 657 | } |
| 659 | } | 658 | } |
| 660 | #endif | ||
| 661 | 659 | ||
| 662 | /* Halt the receive and transmit queues */ | 660 | /* Halt the receive and transmit queues */ |
| 663 | void gfar_halt(struct net_device *dev) | 661 | void gfar_halt(struct net_device *dev) |
| @@ -666,6 +664,8 @@ void gfar_halt(struct net_device *dev) | |||
| 666 | struct gfar __iomem *regs = priv->regs; | 664 | struct gfar __iomem *regs = priv->regs; |
| 667 | u32 tempval; | 665 | u32 tempval; |
| 668 | 666 | ||
| 667 | gfar_halt_nodisable(dev); | ||
| 668 | |||
| 669 | /* Disable Rx and Tx */ | 669 | /* Disable Rx and Tx */ |
| 670 | tempval = gfar_read(®s->maccfg1); | 670 | tempval = gfar_read(®s->maccfg1); |
| 671 | tempval &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); | 671 | tempval &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN); |
| @@ -1214,6 +1214,7 @@ static int gfar_close(struct net_device *dev) | |||
| 1214 | 1214 | ||
| 1215 | napi_disable(&priv->napi); | 1215 | napi_disable(&priv->napi); |
| 1216 | 1216 | ||
| 1217 | cancel_work_sync(&priv->reset_task); | ||
| 1217 | stop_gfar(dev); | 1218 | stop_gfar(dev); |
| 1218 | 1219 | ||
| 1219 | /* Disconnect from the PHY */ | 1220 | /* Disconnect from the PHY */ |
| @@ -1328,13 +1329,16 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1328 | return 0; | 1329 | return 0; |
| 1329 | } | 1330 | } |
| 1330 | 1331 | ||
| 1331 | /* gfar_timeout gets called when a packet has not been | 1332 | /* gfar_reset_task gets scheduled when a packet has not been |
| 1332 | * transmitted after a set amount of time. | 1333 | * transmitted after a set amount of time. |
| 1333 | * For now, assume that clearing out all the structures, and | 1334 | * For now, assume that clearing out all the structures, and |
| 1334 | * starting over will fix the problem. */ | 1335 | * starting over will fix the problem. |
| 1335 | static void gfar_timeout(struct net_device *dev) | 1336 | */ |
| 1337 | static void gfar_reset_task(struct work_struct *work) | ||
| 1336 | { | 1338 | { |
| 1337 | dev->stats.tx_errors++; | 1339 | struct gfar_private *priv = container_of(work, struct gfar_private, |
| 1340 | reset_task); | ||
| 1341 | struct net_device *dev = priv->dev; | ||
| 1338 | 1342 | ||
| 1339 | if (dev->flags & IFF_UP) { | 1343 | if (dev->flags & IFF_UP) { |
| 1340 | stop_gfar(dev); | 1344 | stop_gfar(dev); |
| @@ -1344,6 +1348,14 @@ static void gfar_timeout(struct net_device *dev) | |||
| 1344 | netif_tx_schedule_all(dev); | 1348 | netif_tx_schedule_all(dev); |
| 1345 | } | 1349 | } |
| 1346 | 1350 | ||
| 1351 | static void gfar_timeout(struct net_device *dev) | ||
| 1352 | { | ||
| 1353 | struct gfar_private *priv = netdev_priv(dev); | ||
| 1354 | |||
| 1355 | dev->stats.tx_errors++; | ||
| 1356 | schedule_work(&priv->reset_task); | ||
| 1357 | } | ||
| 1358 | |||
| 1347 | /* Interrupt Handler for Transmit complete */ | 1359 | /* Interrupt Handler for Transmit complete */ |
| 1348 | static int gfar_clean_tx_ring(struct net_device *dev) | 1360 | static int gfar_clean_tx_ring(struct net_device *dev) |
| 1349 | { | 1361 | { |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index d59df98bd636..f46e9b63af13 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
| @@ -756,6 +756,7 @@ struct gfar_private { | |||
| 756 | 756 | ||
| 757 | uint32_t msg_enable; | 757 | uint32_t msg_enable; |
| 758 | 758 | ||
| 759 | struct work_struct reset_task; | ||
| 759 | /* Network Statistics */ | 760 | /* Network Statistics */ |
| 760 | struct gfar_extra_stats extra_stats; | 761 | struct gfar_extra_stats extra_stats; |
| 761 | }; | 762 | }; |
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c index 5116f68e01b9..782c20170082 100644 --- a/drivers/net/gianfar_sysfs.c +++ b/drivers/net/gianfar_sysfs.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | 33 | ||
| 34 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
| 35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 36 | #include <linux/version.h> | ||
| 37 | 36 | ||
| 38 | #include "gianfar.h" | 37 | #include "gianfar.h" |
| 39 | 38 | ||
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c index 8239939554bc..fbbd3e660c27 100644 --- a/drivers/net/hp-plus.c +++ b/drivers/net/hp-plus.c | |||
| @@ -139,7 +139,7 @@ static int __init do_hpp_probe(struct net_device *dev) | |||
| 139 | #ifndef MODULE | 139 | #ifndef MODULE |
| 140 | struct net_device * __init hp_plus_probe(int unit) | 140 | struct net_device * __init hp_plus_probe(int unit) |
| 141 | { | 141 | { |
| 142 | struct net_device *dev = alloc_ei_netdev(); | 142 | struct net_device *dev = alloc_eip_netdev(); |
| 143 | int err; | 143 | int err; |
| 144 | 144 | ||
| 145 | if (!dev) | 145 | if (!dev) |
| @@ -284,7 +284,7 @@ hpp_open(struct net_device *dev) | |||
| 284 | int option_reg; | 284 | int option_reg; |
| 285 | int retval; | 285 | int retval; |
| 286 | 286 | ||
| 287 | if ((retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) { | 287 | if ((retval = request_irq(dev->irq, eip_interrupt, 0, dev->name, dev))) { |
| 288 | return retval; | 288 | return retval; |
| 289 | } | 289 | } |
| 290 | 290 | ||
| @@ -302,7 +302,7 @@ hpp_open(struct net_device *dev) | |||
| 302 | /* Select the operational page. */ | 302 | /* Select the operational page. */ |
| 303 | outw(Perf_Page, ioaddr + HP_PAGING); | 303 | outw(Perf_Page, ioaddr + HP_PAGING); |
| 304 | 304 | ||
| 305 | ei_open(dev); | 305 | eip_open(dev); |
| 306 | return 0; | 306 | return 0; |
| 307 | } | 307 | } |
| 308 | 308 | ||
| @@ -313,7 +313,7 @@ hpp_close(struct net_device *dev) | |||
| 313 | int option_reg = inw(ioaddr + HPP_OPTION); | 313 | int option_reg = inw(ioaddr + HPP_OPTION); |
| 314 | 314 | ||
| 315 | free_irq(dev->irq, dev); | 315 | free_irq(dev->irq, dev); |
| 316 | ei_close(dev); | 316 | eip_close(dev); |
| 317 | outw((option_reg & ~EnableIRQ) | MemDisable | NICReset | ChipReset, | 317 | outw((option_reg & ~EnableIRQ) | MemDisable | NICReset | ChipReset, |
| 318 | ioaddr + HPP_OPTION); | 318 | ioaddr + HPP_OPTION); |
| 319 | 319 | ||
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 2e720f26ca83..ccd9d9058f6d 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
| @@ -663,9 +663,6 @@ static int emac_configure(struct emac_instance *dev) | |||
| 663 | if (emac_phy_gpcs(dev->phy.mode)) | 663 | if (emac_phy_gpcs(dev->phy.mode)) |
| 664 | emac_mii_reset_phy(&dev->phy); | 664 | emac_mii_reset_phy(&dev->phy); |
| 665 | 665 | ||
| 666 | /* Required for Pause packet support in EMAC */ | ||
| 667 | dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1); | ||
| 668 | |||
| 669 | return 0; | 666 | return 0; |
| 670 | } | 667 | } |
| 671 | 668 | ||
| @@ -1150,6 +1147,9 @@ static int emac_open(struct net_device *ndev) | |||
| 1150 | } else | 1147 | } else |
| 1151 | netif_carrier_on(dev->ndev); | 1148 | netif_carrier_on(dev->ndev); |
| 1152 | 1149 | ||
| 1150 | /* Required for Pause packet support in EMAC */ | ||
| 1151 | dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1); | ||
| 1152 | |||
| 1153 | emac_configure(dev); | 1153 | emac_configure(dev); |
| 1154 | mal_poll_add(dev->mal, &dev->commac); | 1154 | mal_poll_add(dev->mal, &dev->commac); |
| 1155 | mal_enable_tx_channel(dev->mal, dev->mal_tx_chan); | 1155 | mal_enable_tx_channel(dev->mal, dev->mal_tx_chan); |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index a03fe1fb61ca..c2d57f836088 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
| @@ -904,8 +904,6 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 904 | unsigned long data_dma_addr; | 904 | unsigned long data_dma_addr; |
| 905 | 905 | ||
| 906 | desc.fields.flags_len = IBMVETH_BUF_VALID | skb->len; | 906 | desc.fields.flags_len = IBMVETH_BUF_VALID | skb->len; |
| 907 | data_dma_addr = dma_map_single(&adapter->vdev->dev, skb->data, | ||
| 908 | skb->len, DMA_TO_DEVICE); | ||
| 909 | 907 | ||
| 910 | if (skb->ip_summed == CHECKSUM_PARTIAL && | 908 | if (skb->ip_summed == CHECKSUM_PARTIAL && |
| 911 | ip_hdr(skb)->protocol != IPPROTO_TCP && skb_checksum_help(skb)) { | 909 | ip_hdr(skb)->protocol != IPPROTO_TCP && skb_checksum_help(skb)) { |
| @@ -924,6 +922,8 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 924 | buf[1] = 0; | 922 | buf[1] = 0; |
| 925 | } | 923 | } |
| 926 | 924 | ||
| 925 | data_dma_addr = dma_map_single(&adapter->vdev->dev, skb->data, | ||
| 926 | skb->len, DMA_TO_DEVICE); | ||
| 927 | if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) { | 927 | if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) { |
| 928 | if (!firmware_has_feature(FW_FEATURE_CMO)) | 928 | if (!firmware_has_feature(FW_FEATURE_CMO)) |
| 929 | ibmveth_error_printk("tx: unable to map xmit buffer\n"); | 929 | ibmveth_error_printk("tx: unable to map xmit buffer\n"); |
| @@ -932,6 +932,7 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 932 | desc.fields.address = adapter->bounce_buffer_dma; | 932 | desc.fields.address = adapter->bounce_buffer_dma; |
| 933 | tx_map_failed++; | 933 | tx_map_failed++; |
| 934 | used_bounce = 1; | 934 | used_bounce = 1; |
| 935 | wmb(); | ||
| 935 | } else | 936 | } else |
| 936 | desc.fields.address = data_dma_addr; | 937 | desc.fields.address = data_dma_addr; |
| 937 | 938 | ||
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index bb823acc7443..f5e2e7235fcb 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
| @@ -87,7 +87,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
| 87 | case E1000_DEV_ID_82576: | 87 | case E1000_DEV_ID_82576: |
| 88 | case E1000_DEV_ID_82576_FIBER: | 88 | case E1000_DEV_ID_82576_FIBER: |
| 89 | case E1000_DEV_ID_82576_SERDES: | 89 | case E1000_DEV_ID_82576_SERDES: |
| 90 | case E1000_DEV_ID_82576_QUAD_COPPER: | ||
| 91 | mac->type = e1000_82576; | 90 | mac->type = e1000_82576; |
| 92 | break; | 91 | break; |
| 93 | default: | 92 | default: |
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h index a65ccc3095c3..99504a600a80 100644 --- a/drivers/net/igb/e1000_hw.h +++ b/drivers/net/igb/e1000_hw.h | |||
| @@ -41,7 +41,6 @@ struct e1000_hw; | |||
| 41 | #define E1000_DEV_ID_82576 0x10C9 | 41 | #define E1000_DEV_ID_82576 0x10C9 |
| 42 | #define E1000_DEV_ID_82576_FIBER 0x10E6 | 42 | #define E1000_DEV_ID_82576_FIBER 0x10E6 |
| 43 | #define E1000_DEV_ID_82576_SERDES 0x10E7 | 43 | #define E1000_DEV_ID_82576_SERDES 0x10E7 |
| 44 | #define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8 | ||
| 45 | #define E1000_DEV_ID_82575EB_COPPER 0x10A7 | 44 | #define E1000_DEV_ID_82575EB_COPPER 0x10A7 |
| 46 | #define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9 | 45 | #define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9 |
| 47 | #define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6 | 46 | #define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6 |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index 11aee1309951..58906c984be9 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
| @@ -373,13 +373,17 @@ static void igb_get_regs(struct net_device *netdev, | |||
| 373 | regs_buff[12] = rd32(E1000_EECD); | 373 | regs_buff[12] = rd32(E1000_EECD); |
| 374 | 374 | ||
| 375 | /* Interrupt */ | 375 | /* Interrupt */ |
| 376 | regs_buff[13] = rd32(E1000_EICR); | 376 | /* Reading EICS for EICR because they read the |
| 377 | * same but EICS does not clear on read */ | ||
| 378 | regs_buff[13] = rd32(E1000_EICS); | ||
| 377 | regs_buff[14] = rd32(E1000_EICS); | 379 | regs_buff[14] = rd32(E1000_EICS); |
| 378 | regs_buff[15] = rd32(E1000_EIMS); | 380 | regs_buff[15] = rd32(E1000_EIMS); |
| 379 | regs_buff[16] = rd32(E1000_EIMC); | 381 | regs_buff[16] = rd32(E1000_EIMC); |
| 380 | regs_buff[17] = rd32(E1000_EIAC); | 382 | regs_buff[17] = rd32(E1000_EIAC); |
| 381 | regs_buff[18] = rd32(E1000_EIAM); | 383 | regs_buff[18] = rd32(E1000_EIAM); |
| 382 | regs_buff[19] = rd32(E1000_ICR); | 384 | /* Reading ICS for ICR because they read the |
| 385 | * same but ICS does not clear on read */ | ||
| 386 | regs_buff[19] = rd32(E1000_ICS); | ||
| 383 | regs_buff[20] = rd32(E1000_ICS); | 387 | regs_buff[20] = rd32(E1000_ICS); |
| 384 | regs_buff[21] = rd32(E1000_IMS); | 388 | regs_buff[21] = rd32(E1000_IMS); |
| 385 | regs_buff[22] = rd32(E1000_IMC); | 389 | regs_buff[22] = rd32(E1000_IMC); |
| @@ -1746,15 +1750,6 @@ static int igb_wol_exclusion(struct igb_adapter *adapter, | |||
| 1746 | /* return success for non excluded adapter ports */ | 1750 | /* return success for non excluded adapter ports */ |
| 1747 | retval = 0; | 1751 | retval = 0; |
| 1748 | break; | 1752 | break; |
| 1749 | case E1000_DEV_ID_82576_QUAD_COPPER: | ||
| 1750 | /* quad port adapters only support WoL on port A */ | ||
| 1751 | if (!(adapter->flags & IGB_FLAG_QUAD_PORT_A)) { | ||
| 1752 | wol->supported = 0; | ||
| 1753 | break; | ||
| 1754 | } | ||
| 1755 | /* return success for non excluded adapter ports */ | ||
| 1756 | retval = 0; | ||
| 1757 | break; | ||
| 1758 | default: | 1753 | default: |
| 1759 | /* dual port cards only support WoL on port A from now on | 1754 | /* dual port cards only support WoL on port A from now on |
| 1760 | * unless it was enabled in the eeprom for port B | 1755 | * unless it was enabled in the eeprom for port B |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 8f66e15ec8d6..634c4c9d87be 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
| @@ -61,7 +61,6 @@ static struct pci_device_id igb_pci_tbl[] = { | |||
| 61 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 }, | 61 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 }, |
| 62 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 }, | 62 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 }, |
| 63 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 }, | 63 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 }, |
| 64 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER), board_82575 }, | ||
| 65 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 }, | 64 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 }, |
| 66 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 }, | 65 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 }, |
| 67 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER), board_82575 }, | 66 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER), board_82575 }, |
| @@ -521,7 +520,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter) | |||
| 521 | adapter->msix_entries, | 520 | adapter->msix_entries, |
| 522 | numvecs); | 521 | numvecs); |
| 523 | if (err == 0) | 522 | if (err == 0) |
| 524 | return; | 523 | goto out; |
| 525 | 524 | ||
| 526 | igb_reset_interrupt_capability(adapter); | 525 | igb_reset_interrupt_capability(adapter); |
| 527 | 526 | ||
| @@ -531,7 +530,7 @@ msi_only: | |||
| 531 | adapter->num_tx_queues = 1; | 530 | adapter->num_tx_queues = 1; |
| 532 | if (!pci_enable_msi(adapter->pdev)) | 531 | if (!pci_enable_msi(adapter->pdev)) |
| 533 | adapter->flags |= IGB_FLAG_HAS_MSI; | 532 | adapter->flags |= IGB_FLAG_HAS_MSI; |
| 534 | 533 | out: | |
| 535 | /* Notify the stack of the (possibly) reduced Tx Queue count. */ | 534 | /* Notify the stack of the (possibly) reduced Tx Queue count. */ |
| 536 | adapter->netdev->real_num_tx_queues = adapter->num_tx_queues; | 535 | adapter->netdev->real_num_tx_queues = adapter->num_tx_queues; |
| 537 | return; | 536 | return; |
| @@ -1217,16 +1216,6 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
| 1217 | if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) | 1216 | if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) |
| 1218 | adapter->eeprom_wol = 0; | 1217 | adapter->eeprom_wol = 0; |
| 1219 | break; | 1218 | break; |
| 1220 | case E1000_DEV_ID_82576_QUAD_COPPER: | ||
| 1221 | /* if quad port adapter, disable WoL on all but port A */ | ||
| 1222 | if (global_quad_port_a != 0) | ||
| 1223 | adapter->eeprom_wol = 0; | ||
| 1224 | else | ||
| 1225 | adapter->flags |= IGB_FLAG_QUAD_PORT_A; | ||
| 1226 | /* Reset for multiple quad port adapters */ | ||
| 1227 | if (++global_quad_port_a == 4) | ||
| 1228 | global_quad_port_a = 0; | ||
| 1229 | break; | ||
| 1230 | } | 1219 | } |
| 1231 | 1220 | ||
| 1232 | /* initialize the wol settings based on the eeprom settings */ | 1221 | /* initialize the wol settings based on the eeprom settings */ |
| @@ -2290,7 +2279,9 @@ static void igb_watchdog_task(struct work_struct *work) | |||
| 2290 | struct igb_ring *tx_ring = adapter->tx_ring; | 2279 | struct igb_ring *tx_ring = adapter->tx_ring; |
| 2291 | struct e1000_mac_info *mac = &adapter->hw.mac; | 2280 | struct e1000_mac_info *mac = &adapter->hw.mac; |
| 2292 | u32 link; | 2281 | u32 link; |
| 2282 | u32 eics = 0; | ||
| 2293 | s32 ret_val; | 2283 | s32 ret_val; |
| 2284 | int i; | ||
| 2294 | 2285 | ||
| 2295 | if ((netif_carrier_ok(netdev)) && | 2286 | if ((netif_carrier_ok(netdev)) && |
| 2296 | (rd32(E1000_STATUS) & E1000_STATUS_LU)) | 2287 | (rd32(E1000_STATUS) & E1000_STATUS_LU)) |
| @@ -2392,7 +2383,13 @@ link_up: | |||
| 2392 | } | 2383 | } |
| 2393 | 2384 | ||
| 2394 | /* Cause software interrupt to ensure rx ring is cleaned */ | 2385 | /* Cause software interrupt to ensure rx ring is cleaned */ |
| 2395 | wr32(E1000_ICS, E1000_ICS_RXDMT0); | 2386 | if (adapter->msix_entries) { |
| 2387 | for (i = 0; i < adapter->num_rx_queues; i++) | ||
| 2388 | eics |= adapter->rx_ring[i].eims_value; | ||
| 2389 | wr32(E1000_EICS, eics); | ||
| 2390 | } else { | ||
| 2391 | wr32(E1000_ICS, E1000_ICS_RXDMT0); | ||
| 2392 | } | ||
| 2396 | 2393 | ||
| 2397 | /* Force detection of hung controller every watchdog period */ | 2394 | /* Force detection of hung controller every watchdog period */ |
| 2398 | tx_ring->detect_tx_hung = true; | 2395 | tx_ring->detect_tx_hung = true; |
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h index e0e718ab4c2e..dd9318f19497 100644 --- a/drivers/net/ipg.h +++ b/drivers/net/ipg.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #ifndef __LINUX_IPG_H | 7 | #ifndef __LINUX_IPG_H |
| 8 | #define __LINUX_IPG_H | 8 | #define __LINUX_IPG_H |
| 9 | 9 | ||
| 10 | #include <linux/version.h> | ||
| 11 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 12 | 11 | ||
| 13 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
| @@ -21,7 +20,6 @@ | |||
| 21 | #include <linux/etherdevice.h> | 20 | #include <linux/etherdevice.h> |
| 22 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 23 | #include <linux/skbuff.h> | 22 | #include <linux/skbuff.h> |
| 24 | #include <linux/version.h> | ||
| 25 | #include <asm/bitops.h> | 23 | #include <asm/bitops.h> |
| 26 | 24 | ||
| 27 | /* | 25 | /* |
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index 2f38e847e2cd..f96358b641af 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
| @@ -190,6 +190,7 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw) | |||
| 190 | case IXGBE_DEV_ID_82598AF_DUAL_PORT: | 190 | case IXGBE_DEV_ID_82598AF_DUAL_PORT: |
| 191 | case IXGBE_DEV_ID_82598AF_SINGLE_PORT: | 191 | case IXGBE_DEV_ID_82598AF_SINGLE_PORT: |
| 192 | case IXGBE_DEV_ID_82598EB_CX4: | 192 | case IXGBE_DEV_ID_82598EB_CX4: |
| 193 | case IXGBE_DEV_ID_82598_CX4_DUAL_PORT: | ||
| 193 | media_type = ixgbe_media_type_fiber; | 194 | media_type = ixgbe_media_type_fiber; |
| 194 | break; | 195 | break; |
| 195 | case IXGBE_DEV_ID_82598AT_DUAL_PORT: | 196 | case IXGBE_DEV_ID_82598AT_DUAL_PORT: |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index e5f3da8468cc..a417be7f8be5 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
| @@ -48,7 +48,7 @@ char ixgbe_driver_name[] = "ixgbe"; | |||
| 48 | static const char ixgbe_driver_string[] = | 48 | static const char ixgbe_driver_string[] = |
| 49 | "Intel(R) 10 Gigabit PCI Express Network Driver"; | 49 | "Intel(R) 10 Gigabit PCI Express Network Driver"; |
| 50 | 50 | ||
| 51 | #define DRV_VERSION "1.3.18-k2" | 51 | #define DRV_VERSION "1.3.18-k4" |
| 52 | const char ixgbe_driver_version[] = DRV_VERSION; | 52 | const char ixgbe_driver_version[] = DRV_VERSION; |
| 53 | static const char ixgbe_copyright[] = | 53 | static const char ixgbe_copyright[] = |
| 54 | "Copyright (c) 1999-2007 Intel Corporation."; | 54 | "Copyright (c) 1999-2007 Intel Corporation."; |
| @@ -72,6 +72,8 @@ static struct pci_device_id ixgbe_pci_tbl[] = { | |||
| 72 | board_82598 }, | 72 | board_82598 }, |
| 73 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598EB_CX4), | 73 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598EB_CX4), |
| 74 | board_82598 }, | 74 | board_82598 }, |
| 75 | {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598_CX4_DUAL_PORT), | ||
| 76 | board_82598 }, | ||
| 75 | 77 | ||
| 76 | /* required last entry */ | 78 | /* required last entry */ |
| 77 | {0, } | 79 | {0, } |
| @@ -1634,16 +1636,17 @@ static void ixgbe_set_multi(struct net_device *netdev) | |||
| 1634 | struct ixgbe_hw *hw = &adapter->hw; | 1636 | struct ixgbe_hw *hw = &adapter->hw; |
| 1635 | struct dev_mc_list *mc_ptr; | 1637 | struct dev_mc_list *mc_ptr; |
| 1636 | u8 *mta_list; | 1638 | u8 *mta_list; |
| 1637 | u32 fctrl; | 1639 | u32 fctrl, vlnctrl; |
| 1638 | int i; | 1640 | int i; |
| 1639 | 1641 | ||
| 1640 | /* Check for Promiscuous and All Multicast modes */ | 1642 | /* Check for Promiscuous and All Multicast modes */ |
| 1641 | 1643 | ||
| 1642 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); | 1644 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); |
| 1645 | vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); | ||
| 1643 | 1646 | ||
| 1644 | if (netdev->flags & IFF_PROMISC) { | 1647 | if (netdev->flags & IFF_PROMISC) { |
| 1645 | fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); | 1648 | fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); |
| 1646 | fctrl &= ~IXGBE_VLNCTRL_VFE; | 1649 | vlnctrl &= ~IXGBE_VLNCTRL_VFE; |
| 1647 | } else { | 1650 | } else { |
| 1648 | if (netdev->flags & IFF_ALLMULTI) { | 1651 | if (netdev->flags & IFF_ALLMULTI) { |
| 1649 | fctrl |= IXGBE_FCTRL_MPE; | 1652 | fctrl |= IXGBE_FCTRL_MPE; |
| @@ -1651,10 +1654,11 @@ static void ixgbe_set_multi(struct net_device *netdev) | |||
| 1651 | } else { | 1654 | } else { |
| 1652 | fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); | 1655 | fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); |
| 1653 | } | 1656 | } |
| 1654 | fctrl |= IXGBE_VLNCTRL_VFE; | 1657 | vlnctrl |= IXGBE_VLNCTRL_VFE; |
| 1655 | } | 1658 | } |
| 1656 | 1659 | ||
| 1657 | IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); | 1660 | IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); |
| 1661 | IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl); | ||
| 1658 | 1662 | ||
| 1659 | if (netdev->mc_count) { | 1663 | if (netdev->mc_count) { |
| 1660 | mta_list = kcalloc(netdev->mc_count, ETH_ALEN, GFP_ATOMIC); | 1664 | mta_list = kcalloc(netdev->mc_count, ETH_ALEN, GFP_ATOMIC); |
| @@ -2300,6 +2304,12 @@ static int __devinit ixgbe_set_interrupt_capability(struct ixgbe_adapter | |||
| 2300 | int vector, v_budget; | 2304 | int vector, v_budget; |
| 2301 | 2305 | ||
| 2302 | /* | 2306 | /* |
| 2307 | * Set the default interrupt throttle rate. | ||
| 2308 | */ | ||
| 2309 | adapter->rx_eitr = (1000000 / IXGBE_DEFAULT_ITR_RX_USECS); | ||
| 2310 | adapter->tx_eitr = (1000000 / IXGBE_DEFAULT_ITR_TX_USECS); | ||
| 2311 | |||
| 2312 | /* | ||
| 2303 | * It's easy to be greedy for MSI-X vectors, but it really | 2313 | * It's easy to be greedy for MSI-X vectors, but it really |
| 2304 | * doesn't do us much good if we have a lot more vectors | 2314 | * doesn't do us much good if we have a lot more vectors |
| 2305 | * than CPU's. So let's be conservative and only ask for | 2315 | * than CPU's. So let's be conservative and only ask for |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 1ad7cb9c25a8..c0282a223df3 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #define IXGBE_DEV_ID_82598AF_SINGLE_PORT 0x10C7 | 39 | #define IXGBE_DEV_ID_82598AF_SINGLE_PORT 0x10C7 |
| 40 | #define IXGBE_DEV_ID_82598AT_DUAL_PORT 0x10C8 | 40 | #define IXGBE_DEV_ID_82598AT_DUAL_PORT 0x10C8 |
| 41 | #define IXGBE_DEV_ID_82598EB_CX4 0x10DD | 41 | #define IXGBE_DEV_ID_82598EB_CX4 0x10DD |
| 42 | #define IXGBE_DEV_ID_82598_CX4_DUAL_PORT 0x10EC | ||
| 42 | 43 | ||
| 43 | /* General Registers */ | 44 | /* General Registers */ |
| 44 | #define IXGBE_CTRL 0x00000 | 45 | #define IXGBE_CTRL 0x00000 |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 49f6bc036a92..3b43bfd85a0f 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
| @@ -64,68 +64,6 @@ struct pcpu_lstats { | |||
| 64 | unsigned long bytes; | 64 | unsigned long bytes; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | /* KISS: just allocate small chunks and copy bits. | ||
| 68 | * | ||
| 69 | * So, in fact, this is documentation, explaining what we expect | ||
| 70 | * of largesending device modulo TCP checksum, which is ignored for loopback. | ||
| 71 | */ | ||
| 72 | |||
| 73 | #ifdef LOOPBACK_TSO | ||
| 74 | static void emulate_large_send_offload(struct sk_buff *skb) | ||
| 75 | { | ||
| 76 | struct iphdr *iph = ip_hdr(skb); | ||
| 77 | struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) + | ||
| 78 | (iph->ihl * 4)); | ||
| 79 | unsigned int doffset = (iph->ihl + th->doff) * 4; | ||
| 80 | unsigned int mtu = skb_shinfo(skb)->gso_size + doffset; | ||
| 81 | unsigned int offset = 0; | ||
| 82 | u32 seq = ntohl(th->seq); | ||
| 83 | u16 id = ntohs(iph->id); | ||
| 84 | |||
| 85 | while (offset + doffset < skb->len) { | ||
| 86 | unsigned int frag_size = min(mtu, skb->len - offset) - doffset; | ||
| 87 | struct sk_buff *nskb = alloc_skb(mtu + 32, GFP_ATOMIC); | ||
| 88 | |||
| 89 | if (!nskb) | ||
| 90 | break; | ||
| 91 | skb_reserve(nskb, 32); | ||
| 92 | skb_set_mac_header(nskb, -ETH_HLEN); | ||
| 93 | skb_reset_network_header(nskb); | ||
| 94 | iph = ip_hdr(nskb); | ||
| 95 | skb_copy_to_linear_data(nskb, skb_network_header(skb), | ||
| 96 | doffset); | ||
| 97 | if (skb_copy_bits(skb, | ||
| 98 | doffset + offset, | ||
| 99 | nskb->data + doffset, | ||
| 100 | frag_size)) | ||
| 101 | BUG(); | ||
| 102 | skb_put(nskb, doffset + frag_size); | ||
| 103 | nskb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 104 | nskb->dev = skb->dev; | ||
| 105 | nskb->priority = skb->priority; | ||
| 106 | nskb->protocol = skb->protocol; | ||
| 107 | nskb->dst = dst_clone(skb->dst); | ||
| 108 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); | ||
| 109 | nskb->pkt_type = skb->pkt_type; | ||
| 110 | |||
| 111 | th = (struct tcphdr *)(skb_network_header(nskb) + iph->ihl * 4); | ||
| 112 | iph->tot_len = htons(frag_size + doffset); | ||
| 113 | iph->id = htons(id); | ||
| 114 | iph->check = 0; | ||
| 115 | iph->check = ip_fast_csum((unsigned char *) iph, iph->ihl); | ||
| 116 | th->seq = htonl(seq); | ||
| 117 | if (offset + doffset + frag_size < skb->len) | ||
| 118 | th->fin = th->psh = 0; | ||
| 119 | netif_rx(nskb); | ||
| 120 | offset += frag_size; | ||
| 121 | seq += frag_size; | ||
| 122 | id++; | ||
| 123 | } | ||
| 124 | |||
| 125 | dev_kfree_skb(skb); | ||
| 126 | } | ||
| 127 | #endif /* LOOPBACK_TSO */ | ||
| 128 | |||
| 129 | /* | 67 | /* |
| 130 | * The higher levels take care of making this non-reentrant (it's | 68 | * The higher levels take care of making this non-reentrant (it's |
| 131 | * called with bh's disabled). | 69 | * called with bh's disabled). |
| @@ -137,9 +75,6 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 137 | skb_orphan(skb); | 75 | skb_orphan(skb); |
| 138 | 76 | ||
| 139 | skb->protocol = eth_type_trans(skb,dev); | 77 | skb->protocol = eth_type_trans(skb,dev); |
| 140 | #ifndef LOOPBACK_MUST_CHECKSUM | ||
| 141 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 142 | #endif | ||
| 143 | 78 | ||
| 144 | #ifdef LOOPBACK_TSO | 79 | #ifdef LOOPBACK_TSO |
| 145 | if (skb_is_gso(skb)) { | 80 | if (skb_is_gso(skb)) { |
| @@ -234,9 +169,7 @@ static void loopback_setup(struct net_device *dev) | |||
| 234 | dev->type = ARPHRD_LOOPBACK; /* 0x0001*/ | 169 | dev->type = ARPHRD_LOOPBACK; /* 0x0001*/ |
| 235 | dev->flags = IFF_LOOPBACK; | 170 | dev->flags = IFF_LOOPBACK; |
| 236 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | 171 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
| 237 | #ifdef LOOPBACK_TSO | ||
| 238 | | NETIF_F_TSO | 172 | | NETIF_F_TSO |
| 239 | #endif | ||
| 240 | | NETIF_F_NO_CSUM | 173 | | NETIF_F_NO_CSUM |
| 241 | | NETIF_F_HIGHDMA | 174 | | NETIF_F_HIGHDMA |
| 242 | | NETIF_F_LLTX | 175 | | NETIF_F_LLTX |
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c index 62071d9c4a55..d1dd5b48dbd1 100644 --- a/drivers/net/mlx4/mr.c +++ b/drivers/net/mlx4/mr.c | |||
| @@ -67,11 +67,10 @@ struct mlx4_mpt_entry { | |||
| 67 | #define MLX4_MPT_FLAG_PHYSICAL (1 << 9) | 67 | #define MLX4_MPT_FLAG_PHYSICAL (1 << 9) |
| 68 | #define MLX4_MPT_FLAG_REGION (1 << 8) | 68 | #define MLX4_MPT_FLAG_REGION (1 << 8) |
| 69 | 69 | ||
| 70 | #define MLX4_MPT_PD_FLAG_FAST_REG (1 << 26) | 70 | #define MLX4_MPT_PD_FLAG_FAST_REG (1 << 27) |
| 71 | #define MLX4_MPT_PD_FLAG_RAE (1 << 28) | ||
| 71 | #define MLX4_MPT_PD_FLAG_EN_INV (3 << 24) | 72 | #define MLX4_MPT_PD_FLAG_EN_INV (3 << 24) |
| 72 | 73 | ||
| 73 | #define MLX4_MTT_FLAG_PRESENT 1 | ||
| 74 | |||
| 75 | #define MLX4_MPT_STATUS_SW 0xF0 | 74 | #define MLX4_MPT_STATUS_SW 0xF0 |
| 76 | #define MLX4_MPT_STATUS_HW 0x00 | 75 | #define MLX4_MPT_STATUS_HW 0x00 |
| 77 | 76 | ||
| @@ -348,7 +347,10 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr) | |||
| 348 | if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { | 347 | if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { |
| 349 | /* fast register MR in free state */ | 348 | /* fast register MR in free state */ |
| 350 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_FREE); | 349 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_FREE); |
| 351 | mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG); | 350 | mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG | |
| 351 | MLX4_MPT_PD_FLAG_RAE); | ||
| 352 | mpt_entry->mtt_sz = cpu_to_be32((1 << mr->mtt.order) * | ||
| 353 | MLX4_MTT_ENTRY_PER_SEG); | ||
| 352 | } else { | 354 | } else { |
| 353 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS); | 355 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS); |
| 354 | } | 356 | } |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 46819af3b062..0a18b9e96da1 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
| @@ -55,7 +55,7 @@ | |||
| 55 | #include <asm/system.h> | 55 | #include <asm/system.h> |
| 56 | 56 | ||
| 57 | static char mv643xx_eth_driver_name[] = "mv643xx_eth"; | 57 | static char mv643xx_eth_driver_name[] = "mv643xx_eth"; |
| 58 | static char mv643xx_eth_driver_version[] = "1.2"; | 58 | static char mv643xx_eth_driver_version[] = "1.3"; |
| 59 | 59 | ||
| 60 | #define MV643XX_ETH_CHECKSUM_OFFLOAD_TX | 60 | #define MV643XX_ETH_CHECKSUM_OFFLOAD_TX |
| 61 | #define MV643XX_ETH_NAPI | 61 | #define MV643XX_ETH_NAPI |
| @@ -474,11 +474,19 @@ static void rxq_refill(struct rx_queue *rxq) | |||
| 474 | /* | 474 | /* |
| 475 | * Reserve 2+14 bytes for an ethernet header (the | 475 | * Reserve 2+14 bytes for an ethernet header (the |
| 476 | * hardware automatically prepends 2 bytes of dummy | 476 | * hardware automatically prepends 2 bytes of dummy |
| 477 | * data to each received packet), 4 bytes for a VLAN | 477 | * data to each received packet), 16 bytes for up to |
| 478 | * header, and 4 bytes for the trailing FCS -- 24 | 478 | * four VLAN tags, and 4 bytes for the trailing FCS |
| 479 | * bytes total. | 479 | * -- 36 bytes total. |
| 480 | */ | 480 | */ |
| 481 | skb_size = mp->dev->mtu + 24; | 481 | skb_size = mp->dev->mtu + 36; |
| 482 | |||
| 483 | /* | ||
| 484 | * Make sure that the skb size is a multiple of 8 | ||
| 485 | * bytes, as the lower three bits of the receive | ||
| 486 | * descriptor's buffer size field are ignored by | ||
| 487 | * the hardware. | ||
| 488 | */ | ||
| 489 | skb_size = (skb_size + 7) & ~7; | ||
| 482 | 490 | ||
| 483 | skb = dev_alloc_skb(skb_size + dma_get_cache_alignment() - 1); | 491 | skb = dev_alloc_skb(skb_size + dma_get_cache_alignment() - 1); |
| 484 | if (skb == NULL) | 492 | if (skb == NULL) |
| @@ -509,10 +517,8 @@ static void rxq_refill(struct rx_queue *rxq) | |||
| 509 | skb_reserve(skb, 2); | 517 | skb_reserve(skb, 2); |
| 510 | } | 518 | } |
| 511 | 519 | ||
| 512 | if (rxq->rx_desc_count != rxq->rx_ring_size) { | 520 | if (rxq->rx_desc_count != rxq->rx_ring_size) |
| 513 | rxq->rx_oom.expires = jiffies + (HZ / 10); | 521 | mod_timer(&rxq->rx_oom, jiffies + (HZ / 10)); |
| 514 | add_timer(&rxq->rx_oom); | ||
| 515 | } | ||
| 516 | 522 | ||
| 517 | spin_unlock_irqrestore(&mp->lock, flags); | 523 | spin_unlock_irqrestore(&mp->lock, flags); |
| 518 | } | 524 | } |
| @@ -529,7 +535,7 @@ static int rxq_process(struct rx_queue *rxq, int budget) | |||
| 529 | int rx; | 535 | int rx; |
| 530 | 536 | ||
| 531 | rx = 0; | 537 | rx = 0; |
| 532 | while (rx < budget) { | 538 | while (rx < budget && rxq->rx_desc_count) { |
| 533 | struct rx_desc *rx_desc; | 539 | struct rx_desc *rx_desc; |
| 534 | unsigned int cmd_sts; | 540 | unsigned int cmd_sts; |
| 535 | struct sk_buff *skb; | 541 | struct sk_buff *skb; |
| @@ -554,7 +560,7 @@ static int rxq_process(struct rx_queue *rxq, int budget) | |||
| 554 | spin_unlock_irqrestore(&mp->lock, flags); | 560 | spin_unlock_irqrestore(&mp->lock, flags); |
| 555 | 561 | ||
| 556 | dma_unmap_single(NULL, rx_desc->buf_ptr + 2, | 562 | dma_unmap_single(NULL, rx_desc->buf_ptr + 2, |
| 557 | mp->dev->mtu + 24, DMA_FROM_DEVICE); | 563 | rx_desc->buf_size, DMA_FROM_DEVICE); |
| 558 | rxq->rx_desc_count--; | 564 | rxq->rx_desc_count--; |
| 559 | rx++; | 565 | rx++; |
| 560 | 566 | ||
| @@ -636,9 +642,9 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget) | |||
| 636 | txq_reclaim(mp->txq + i, 0); | 642 | txq_reclaim(mp->txq + i, 0); |
| 637 | 643 | ||
| 638 | if (netif_carrier_ok(mp->dev)) { | 644 | if (netif_carrier_ok(mp->dev)) { |
| 639 | spin_lock(&mp->lock); | 645 | spin_lock_irq(&mp->lock); |
| 640 | __txq_maybe_wake(mp->txq + mp->txq_primary); | 646 | __txq_maybe_wake(mp->txq + mp->txq_primary); |
| 641 | spin_unlock(&mp->lock); | 647 | spin_unlock_irq(&mp->lock); |
| 642 | } | 648 | } |
| 643 | } | 649 | } |
| 644 | #endif | 650 | #endif |
| @@ -650,8 +656,6 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget) | |||
| 650 | 656 | ||
| 651 | if (rx < budget) { | 657 | if (rx < budget) { |
| 652 | netif_rx_complete(mp->dev, napi); | 658 | netif_rx_complete(mp->dev, napi); |
| 653 | wrl(mp, INT_CAUSE(mp->port_num), 0); | ||
| 654 | wrl(mp, INT_CAUSE_EXT(mp->port_num), 0); | ||
| 655 | wrl(mp, INT_MASK(mp->port_num), INT_TX_END | INT_RX | INT_EXT); | 659 | wrl(mp, INT_MASK(mp->port_num), INT_TX_END | INT_RX | INT_EXT); |
| 656 | } | 660 | } |
| 657 | 661 | ||
| @@ -1796,6 +1800,7 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id) | |||
| 1796 | */ | 1800 | */ |
| 1797 | #ifdef MV643XX_ETH_NAPI | 1801 | #ifdef MV643XX_ETH_NAPI |
| 1798 | if (int_cause & INT_RX) { | 1802 | if (int_cause & INT_RX) { |
| 1803 | wrl(mp, INT_CAUSE(mp->port_num), ~(int_cause & INT_RX)); | ||
| 1799 | wrl(mp, INT_MASK(mp->port_num), 0x00000000); | 1804 | wrl(mp, INT_MASK(mp->port_num), 0x00000000); |
| 1800 | rdl(mp, INT_MASK(mp->port_num)); | 1805 | rdl(mp, INT_MASK(mp->port_num)); |
| 1801 | 1806 | ||
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index f1de38f8b742..d6524db321af 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
| @@ -56,7 +56,6 @@ | |||
| 56 | #include <linux/ethtool.h> | 56 | #include <linux/ethtool.h> |
| 57 | #include <linux/firmware.h> | 57 | #include <linux/firmware.h> |
| 58 | #include <linux/delay.h> | 58 | #include <linux/delay.h> |
| 59 | #include <linux/version.h> | ||
| 60 | #include <linux/timer.h> | 59 | #include <linux/timer.h> |
| 61 | #include <linux/vmalloc.h> | 60 | #include <linux/vmalloc.h> |
| 62 | #include <linux/crc32.h> | 61 | #include <linux/crc32.h> |
| @@ -76,7 +75,7 @@ | |||
| 76 | #include "myri10ge_mcp.h" | 75 | #include "myri10ge_mcp.h" |
| 77 | #include "myri10ge_mcp_gen_header.h" | 76 | #include "myri10ge_mcp_gen_header.h" |
| 78 | 77 | ||
| 79 | #define MYRI10GE_VERSION_STR "1.3.99-1.347" | 78 | #define MYRI10GE_VERSION_STR "1.4.3-1.358" |
| 80 | 79 | ||
| 81 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); | 80 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); |
| 82 | MODULE_AUTHOR("Maintainer: help@myri.com"); | 81 | MODULE_AUTHOR("Maintainer: help@myri.com"); |
| @@ -3548,7 +3547,11 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp) | |||
| 3548 | 3547 | ||
| 3549 | /* try to load the slice aware rss firmware */ | 3548 | /* try to load the slice aware rss firmware */ |
| 3550 | old_fw = mgp->fw_name; | 3549 | old_fw = mgp->fw_name; |
| 3551 | if (old_fw == myri10ge_fw_aligned) | 3550 | if (myri10ge_fw_name != NULL) { |
| 3551 | dev_info(&mgp->pdev->dev, "overriding rss firmware to %s\n", | ||
| 3552 | myri10ge_fw_name); | ||
| 3553 | mgp->fw_name = myri10ge_fw_name; | ||
| 3554 | } else if (old_fw == myri10ge_fw_aligned) | ||
| 3552 | mgp->fw_name = myri10ge_fw_rss_aligned; | 3555 | mgp->fw_name = myri10ge_fw_rss_aligned; |
| 3553 | else | 3556 | else |
| 3554 | mgp->fw_name = myri10ge_fw_rss_unaligned; | 3557 | mgp->fw_name = myri10ge_fw_rss_unaligned; |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 42443d697423..fa3ceca4e15c 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
| @@ -118,7 +118,7 @@ bad_clone_list[] __initdata = { | |||
| 118 | {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */ | 118 | {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */ |
| 119 | {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */ | 119 | {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */ |
| 120 | {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */ | 120 | {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */ |
| 121 | #if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) | 121 | #ifdef CONFIG_MACH_TX49XX |
| 122 | {"RBHMA4X00-RTL8019", "RBHMA4X00/RTL8019", {0x00, 0x60, 0x0a}}, /* Toshiba built-in */ | 122 | {"RBHMA4X00-RTL8019", "RBHMA4X00/RTL8019", {0x00, 0x60, 0x0a}}, /* Toshiba built-in */ |
| 123 | #endif | 123 | #endif |
| 124 | {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */ | 124 | {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */ |
| @@ -142,7 +142,7 @@ bad_clone_list[] __initdata = { | |||
| 142 | #if defined(CONFIG_PLAT_MAPPI) | 142 | #if defined(CONFIG_PLAT_MAPPI) |
| 143 | # define DCR_VAL 0x4b | 143 | # define DCR_VAL 0x4b |
| 144 | #elif defined(CONFIG_PLAT_OAKS32R) || \ | 144 | #elif defined(CONFIG_PLAT_OAKS32R) || \ |
| 145 | defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) | 145 | defined(CONFIG_MACH_TX49XX) |
| 146 | # define DCR_VAL 0x48 /* 8-bit mode */ | 146 | # define DCR_VAL 0x48 /* 8-bit mode */ |
| 147 | #else | 147 | #else |
| 148 | # define DCR_VAL 0x49 | 148 | # define DCR_VAL 0x49 |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 93a7b9b668d5..244ab49c4337 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
| @@ -45,7 +45,6 @@ | |||
| 45 | #include <linux/in.h> | 45 | #include <linux/in.h> |
| 46 | #include <linux/tcp.h> | 46 | #include <linux/tcp.h> |
| 47 | #include <linux/skbuff.h> | 47 | #include <linux/skbuff.h> |
| 48 | #include <linux/version.h> | ||
| 49 | 48 | ||
| 50 | #include <linux/ethtool.h> | 49 | #include <linux/ethtool.h> |
| 51 | #include <linux/mii.h> | 50 | #include <linux/mii.h> |
| @@ -66,8 +65,8 @@ | |||
| 66 | 65 | ||
| 67 | #define _NETXEN_NIC_LINUX_MAJOR 4 | 66 | #define _NETXEN_NIC_LINUX_MAJOR 4 |
| 68 | #define _NETXEN_NIC_LINUX_MINOR 0 | 67 | #define _NETXEN_NIC_LINUX_MINOR 0 |
| 69 | #define _NETXEN_NIC_LINUX_SUBVERSION 0 | 68 | #define _NETXEN_NIC_LINUX_SUBVERSION 11 |
| 70 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.0" | 69 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.11" |
| 71 | 70 | ||
| 72 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c)) | 71 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c)) |
| 73 | 72 | ||
| @@ -1615,7 +1614,8 @@ dma_watchdog_wakeup(struct netxen_adapter *adapter) | |||
| 1615 | 1614 | ||
| 1616 | 1615 | ||
| 1617 | int netxen_is_flash_supported(struct netxen_adapter *adapter); | 1616 | int netxen_is_flash_supported(struct netxen_adapter *adapter); |
| 1618 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 mac[]); | 1617 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac); |
| 1618 | int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac); | ||
| 1619 | extern void netxen_change_ringparam(struct netxen_adapter *adapter); | 1619 | extern void netxen_change_ringparam(struct netxen_adapter *adapter); |
| 1620 | extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, | 1620 | extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, |
| 1621 | int *valp); | 1621 | int *valp); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 4ad3e0844b99..b974ca0fc530 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
| 39 | #include <linux/netdevice.h> | 39 | #include <linux/netdevice.h> |
| 40 | #include <linux/ethtool.h> | 40 | #include <linux/ethtool.h> |
| 41 | #include <linux/version.h> | ||
| 42 | 41 | ||
| 43 | #include "netxen_nic.h" | 42 | #include "netxen_nic.h" |
| 44 | #include "netxen_nic_hw.h" | 43 | #include "netxen_nic_hw.h" |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index e8e8d73f6ed7..e80f9e3e5973 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
| @@ -32,8 +32,6 @@ | |||
| 32 | 32 | ||
| 33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
| 34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
| 35 | #include <linux/version.h> | ||
| 36 | |||
| 37 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
| 38 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
| 39 | #include <linux/init.h> | 37 | #include <linux/init.h> |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 9aa20f961618..84978f80f396 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
| @@ -733,31 +733,56 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base, | |||
| 733 | return 0; | 733 | return 0; |
| 734 | } | 734 | } |
| 735 | 735 | ||
| 736 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 mac[]) | 736 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac) |
| 737 | { | 737 | { |
| 738 | __le32 *pmac = (__le32 *) & mac[0]; | 738 | __le32 *pmac = (__le32 *) mac; |
| 739 | u32 offset; | ||
| 739 | 740 | ||
| 740 | if (netxen_get_flash_block(adapter, | 741 | offset = NETXEN_USER_START + |
| 741 | NETXEN_USER_START + | 742 | offsetof(struct netxen_new_user_info, mac_addr) + |
| 742 | offsetof(struct netxen_new_user_info, | 743 | adapter->portnum * sizeof(u64); |
| 743 | mac_addr), | 744 | |
| 744 | FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) { | 745 | if (netxen_get_flash_block(adapter, offset, sizeof(u64), pmac) == -1) |
| 745 | return -1; | 746 | return -1; |
| 746 | } | 747 | |
| 747 | if (*mac == cpu_to_le64(~0ULL)) { | 748 | if (*mac == cpu_to_le64(~0ULL)) { |
| 749 | |||
| 750 | offset = NETXEN_USER_START_OLD + | ||
| 751 | offsetof(struct netxen_user_old_info, mac_addr) + | ||
| 752 | adapter->portnum * sizeof(u64); | ||
| 753 | |||
| 748 | if (netxen_get_flash_block(adapter, | 754 | if (netxen_get_flash_block(adapter, |
| 749 | NETXEN_USER_START_OLD + | 755 | offset, sizeof(u64), pmac) == -1) |
| 750 | offsetof(struct netxen_user_old_info, | ||
| 751 | mac_addr), | ||
| 752 | FLASH_NUM_PORTS * sizeof(u64), | ||
| 753 | pmac) == -1) | ||
| 754 | return -1; | 756 | return -1; |
| 757 | |||
| 755 | if (*mac == cpu_to_le64(~0ULL)) | 758 | if (*mac == cpu_to_le64(~0ULL)) |
| 756 | return -1; | 759 | return -1; |
| 757 | } | 760 | } |
| 758 | return 0; | 761 | return 0; |
| 759 | } | 762 | } |
| 760 | 763 | ||
| 764 | int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac) | ||
| 765 | { | ||
| 766 | uint32_t crbaddr, mac_hi, mac_lo; | ||
| 767 | int pci_func = adapter->ahw.pci_func; | ||
| 768 | |||
| 769 | crbaddr = CRB_MAC_BLOCK_START + | ||
| 770 | (4 * ((pci_func/2) * 3)) + (4 * (pci_func & 1)); | ||
| 771 | |||
| 772 | adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); | ||
| 773 | adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); | ||
| 774 | |||
| 775 | mac_hi = cpu_to_le32(mac_hi); | ||
| 776 | mac_lo = cpu_to_le32(mac_lo); | ||
| 777 | |||
| 778 | if (pci_func & 1) | ||
| 779 | *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16)); | ||
| 780 | else | ||
| 781 | *mac = ((mac_lo) | ((u64)mac_hi << 32)); | ||
| 782 | |||
| 783 | return 0; | ||
| 784 | } | ||
| 785 | |||
| 761 | #define CRB_WIN_LOCK_TIMEOUT 100000000 | 786 | #define CRB_WIN_LOCK_TIMEOUT 100000000 |
| 762 | 787 | ||
| 763 | static int crb_win_lock(struct netxen_adapter *adapter) | 788 | static int crb_win_lock(struct netxen_adapter *adapter) |
| @@ -2183,10 +2208,10 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
| 2183 | if (adapter->portnum == 0) { | 2208 | if (adapter->portnum == 0) { |
| 2184 | get_brd_name_by_type(board_info->board_type, brd_name); | 2209 | get_brd_name_by_type(board_info->board_type, brd_name); |
| 2185 | 2210 | ||
| 2186 | printk("NetXen %s Board S/N %s Chip id 0x%x\n", | 2211 | printk(KERN_INFO "NetXen %s Board S/N %s Chip rev 0x%x\n", |
| 2187 | brd_name, serial_num, board_info->chip_id); | 2212 | brd_name, serial_num, adapter->ahw.revision_id); |
| 2188 | printk("NetXen Firmware version %d.%d.%d\n", fw_major, | 2213 | printk(KERN_INFO "NetXen Firmware version %d.%d.%d\n", |
| 2189 | fw_minor, fw_build); | 2214 | fw_major, fw_minor, fw_build); |
| 2190 | } | 2215 | } |
| 2191 | 2216 | ||
| 2192 | if (NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build) < | 2217 | if (NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build) < |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 519fc860e17e..5bba675d0504 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
| @@ -1079,10 +1079,12 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) | |||
| 1079 | 1079 | ||
| 1080 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) | 1080 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) |
| 1081 | { | 1081 | { |
| 1082 | int i; | 1082 | int i = 100; |
| 1083 | |||
| 1084 | if (!adapter->dummy_dma.addr) | ||
| 1085 | return; | ||
| 1083 | 1086 | ||
| 1084 | if (adapter->dummy_dma.addr) { | 1087 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
| 1085 | i = 100; | ||
| 1086 | do { | 1088 | do { |
| 1087 | if (dma_watchdog_shutdown_request(adapter) == 1) | 1089 | if (dma_watchdog_shutdown_request(adapter) == 1) |
| 1088 | break; | 1090 | break; |
| @@ -1090,17 +1092,17 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter) | |||
| 1090 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) | 1092 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) |
| 1091 | break; | 1093 | break; |
| 1092 | } while (--i); | 1094 | } while (--i); |
| 1095 | } | ||
| 1093 | 1096 | ||
| 1094 | if (i) { | 1097 | if (i) { |
| 1095 | pci_free_consistent(adapter->pdev, | 1098 | pci_free_consistent(adapter->pdev, |
| 1096 | NETXEN_HOST_DUMMY_DMA_SIZE, | 1099 | NETXEN_HOST_DUMMY_DMA_SIZE, |
| 1097 | adapter->dummy_dma.addr, | 1100 | adapter->dummy_dma.addr, |
| 1098 | adapter->dummy_dma.phys_addr); | 1101 | adapter->dummy_dma.phys_addr); |
| 1099 | adapter->dummy_dma.addr = NULL; | 1102 | adapter->dummy_dma.addr = NULL; |
| 1100 | } else { | 1103 | } else { |
| 1101 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", | 1104 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", |
| 1102 | adapter->netdev->name); | 1105 | adapter->netdev->name); |
| 1103 | } | ||
| 1104 | } | 1106 | } |
| 1105 | } | 1107 | } |
| 1106 | 1108 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 7615c715e66e..008fd6618a5f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
| @@ -149,76 +149,18 @@ static uint32_t msi_tgt_status[8] = { | |||
| 149 | 149 | ||
| 150 | static struct netxen_legacy_intr_set legacy_intr[] = NX_LEGACY_INTR_CONFIG; | 150 | static struct netxen_legacy_intr_set legacy_intr[] = NX_LEGACY_INTR_CONFIG; |
| 151 | 151 | ||
| 152 | static void netxen_nic_disable_int(struct netxen_adapter *adapter) | 152 | static inline void netxen_nic_disable_int(struct netxen_adapter *adapter) |
| 153 | { | 153 | { |
| 154 | u32 mask = 0x7ff; | 154 | adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0); |
| 155 | int retries = 32; | ||
| 156 | int pci_fn = adapter->ahw.pci_func; | ||
| 157 | |||
| 158 | if (adapter->msi_mode != MSI_MODE_MULTIFUNC) | ||
| 159 | adapter->pci_write_normalize(adapter, | ||
| 160 | adapter->crb_intr_mask, 0); | ||
| 161 | |||
| 162 | if (adapter->intr_scheme != -1 && | ||
| 163 | adapter->intr_scheme != INTR_SCHEME_PERPORT) | ||
| 164 | adapter->pci_write_immediate(adapter, ISR_INT_MASK, mask); | ||
| 165 | |||
| 166 | if (!NETXEN_IS_MSI_FAMILY(adapter)) { | ||
| 167 | do { | ||
| 168 | adapter->pci_write_immediate(adapter, | ||
| 169 | adapter->legacy_intr.tgt_status_reg, | ||
| 170 | 0xffffffff); | ||
| 171 | mask = adapter->pci_read_immediate(adapter, | ||
| 172 | ISR_INT_VECTOR); | ||
| 173 | if (!(mask & 0x80)) | ||
| 174 | break; | ||
| 175 | udelay(10); | ||
| 176 | } while (--retries); | ||
| 177 | |||
| 178 | if (!retries) { | ||
| 179 | printk(KERN_NOTICE "%s: Failed to disable interrupt\n", | ||
| 180 | netxen_nic_driver_name); | ||
| 181 | } | ||
| 182 | } else { | ||
| 183 | if (adapter->msi_mode == MSI_MODE_MULTIFUNC) { | ||
| 184 | adapter->pci_write_immediate(adapter, | ||
| 185 | msi_tgt_status[pci_fn], 0xffffffff); | ||
| 186 | } | ||
| 187 | } | ||
| 188 | } | 155 | } |
| 189 | 156 | ||
| 190 | static void netxen_nic_enable_int(struct netxen_adapter *adapter) | 157 | static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) |
| 191 | { | 158 | { |
| 192 | u32 mask; | ||
| 193 | |||
| 194 | if (adapter->intr_scheme != -1 && | ||
| 195 | adapter->intr_scheme != INTR_SCHEME_PERPORT) { | ||
| 196 | switch (adapter->ahw.board_type) { | ||
| 197 | case NETXEN_NIC_GBE: | ||
| 198 | mask = 0x77b; | ||
| 199 | break; | ||
| 200 | case NETXEN_NIC_XGBE: | ||
| 201 | mask = 0x77f; | ||
| 202 | break; | ||
| 203 | default: | ||
| 204 | mask = 0x7ff; | ||
| 205 | break; | ||
| 206 | } | ||
| 207 | |||
| 208 | adapter->pci_write_immediate(adapter, ISR_INT_MASK, mask); | ||
| 209 | } | ||
| 210 | |||
| 211 | adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0x1); | 159 | adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0x1); |
| 212 | 160 | ||
| 213 | if (!NETXEN_IS_MSI_FAMILY(adapter)) { | 161 | if (!NETXEN_IS_MSI_FAMILY(adapter)) |
| 214 | mask = 0xbff; | 162 | adapter->pci_write_immediate(adapter, |
| 215 | if (adapter->intr_scheme == INTR_SCHEME_PERPORT) | 163 | adapter->legacy_intr.tgt_mask_reg, 0xfbff); |
| 216 | adapter->pci_write_immediate(adapter, | ||
| 217 | adapter->legacy_intr.tgt_mask_reg, mask); | ||
| 218 | else | ||
| 219 | adapter->pci_write_normalize(adapter, | ||
| 220 | CRB_INT_VECTOR, 0); | ||
| 221 | } | ||
| 222 | } | 164 | } |
| 223 | 165 | ||
| 224 | static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) | 166 | static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) |
| @@ -417,16 +359,6 @@ static void netxen_pcie_strap_init(struct netxen_adapter *adapter) | |||
| 417 | int i, pos; | 359 | int i, pos; |
| 418 | struct pci_dev *pdev; | 360 | struct pci_dev *pdev; |
| 419 | 361 | ||
| 420 | pdev = pci_get_device(0x1166, 0x0140, NULL); | ||
| 421 | if (pdev) { | ||
| 422 | pci_dev_put(pdev); | ||
| 423 | adapter->hw_read_wx(adapter, | ||
| 424 | NETXEN_PCIE_REG(PCIE_TGT_SPLIT_CHICKEN), &chicken, 4); | ||
| 425 | chicken |= 0x4000; | ||
| 426 | adapter->hw_write_wx(adapter, | ||
| 427 | NETXEN_PCIE_REG(PCIE_TGT_SPLIT_CHICKEN), &chicken, 4); | ||
| 428 | } | ||
| 429 | |||
| 430 | pdev = adapter->pdev; | 362 | pdev = adapter->pdev; |
| 431 | 363 | ||
| 432 | adapter->hw_read_wx(adapter, | 364 | adapter->hw_read_wx(adapter, |
| @@ -501,6 +433,44 @@ static void netxen_init_msix_entries(struct netxen_adapter *adapter) | |||
| 501 | adapter->msix_entries[i].entry = i; | 433 | adapter->msix_entries[i].entry = i; |
| 502 | } | 434 | } |
| 503 | 435 | ||
| 436 | static int | ||
| 437 | netxen_read_mac_addr(struct netxen_adapter *adapter) | ||
| 438 | { | ||
| 439 | int i; | ||
| 440 | unsigned char *p; | ||
| 441 | __le64 mac_addr; | ||
| 442 | DECLARE_MAC_BUF(mac); | ||
| 443 | struct net_device *netdev = adapter->netdev; | ||
| 444 | struct pci_dev *pdev = adapter->pdev; | ||
| 445 | |||
| 446 | if (netxen_is_flash_supported(adapter) != 0) | ||
| 447 | return -EIO; | ||
| 448 | |||
| 449 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | ||
| 450 | if (netxen_p3_get_mac_addr(adapter, &mac_addr) != 0) | ||
| 451 | return -EIO; | ||
| 452 | } else { | ||
| 453 | if (netxen_get_flash_mac_addr(adapter, &mac_addr) != 0) | ||
| 454 | return -EIO; | ||
| 455 | } | ||
| 456 | |||
| 457 | p = (unsigned char *)&mac_addr; | ||
| 458 | for (i = 0; i < 6; i++) | ||
| 459 | netdev->dev_addr[i] = *(p + 5 - i); | ||
| 460 | |||
| 461 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); | ||
| 462 | |||
| 463 | /* set station address */ | ||
| 464 | |||
| 465 | if (!is_valid_ether_addr(netdev->perm_addr)) { | ||
| 466 | dev_warn(&pdev->dev, "Bad MAC address %s.\n", | ||
| 467 | print_mac(mac, netdev->dev_addr)); | ||
| 468 | } else | ||
| 469 | adapter->macaddr_set(adapter, netdev->dev_addr); | ||
| 470 | |||
| 471 | return 0; | ||
| 472 | } | ||
| 473 | |||
| 504 | /* | 474 | /* |
| 505 | * netxen_nic_probe() | 475 | * netxen_nic_probe() |
| 506 | * | 476 | * |
| @@ -529,10 +499,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 529 | unsigned long mem_base, mem_len, db_base, db_len, pci_len0 = 0; | 499 | unsigned long mem_base, mem_len, db_base, db_len, pci_len0 = 0; |
| 530 | int i = 0, err; | 500 | int i = 0, err; |
| 531 | int first_driver, first_boot; | 501 | int first_driver, first_boot; |
| 532 | __le64 mac_addr[FLASH_NUM_PORTS + 1]; | ||
| 533 | u32 val; | 502 | u32 val; |
| 534 | int pci_func_id = PCI_FUNC(pdev->devfn); | 503 | int pci_func_id = PCI_FUNC(pdev->devfn); |
| 535 | DECLARE_MAC_BUF(mac); | ||
| 536 | struct netxen_legacy_intr_set *legacy_intrp; | 504 | struct netxen_legacy_intr_set *legacy_intrp; |
| 537 | uint8_t revision_id; | 505 | uint8_t revision_id; |
| 538 | 506 | ||
| @@ -545,6 +513,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 545 | return -ENODEV; | 513 | return -ENODEV; |
| 546 | } | 514 | } |
| 547 | 515 | ||
| 516 | if (pdev->revision >= NX_P3_A0 && pdev->revision < NX_P3_B1) { | ||
| 517 | printk(KERN_WARNING "NetXen chip revisions between 0x%x-0x%x" | ||
| 518 | "will not be enabled.\n", | ||
| 519 | NX_P3_A0, NX_P3_B1); | ||
| 520 | return -ENODEV; | ||
| 521 | } | ||
| 522 | |||
| 548 | if ((err = pci_enable_device(pdev))) | 523 | if ((err = pci_enable_device(pdev))) |
| 549 | return err; | 524 | return err; |
| 550 | 525 | ||
| @@ -898,34 +873,14 @@ request_msi: | |||
| 898 | goto err_out_disable_msi; | 873 | goto err_out_disable_msi; |
| 899 | 874 | ||
| 900 | init_timer(&adapter->watchdog_timer); | 875 | init_timer(&adapter->watchdog_timer); |
| 901 | adapter->ahw.linkup = 0; | ||
| 902 | adapter->watchdog_timer.function = &netxen_watchdog; | 876 | adapter->watchdog_timer.function = &netxen_watchdog; |
| 903 | adapter->watchdog_timer.data = (unsigned long)adapter; | 877 | adapter->watchdog_timer.data = (unsigned long)adapter; |
| 904 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); | 878 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); |
| 905 | INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task); | 879 | INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task); |
| 906 | 880 | ||
| 907 | if (netxen_is_flash_supported(adapter) == 0 && | 881 | err = netxen_read_mac_addr(adapter); |
| 908 | netxen_get_flash_mac_addr(adapter, mac_addr) == 0) { | 882 | if (err) |
| 909 | unsigned char *p; | 883 | dev_warn(&pdev->dev, "failed to read mac addr\n"); |
| 910 | |||
| 911 | p = (unsigned char *)&mac_addr[adapter->portnum]; | ||
| 912 | netdev->dev_addr[0] = *(p + 5); | ||
| 913 | netdev->dev_addr[1] = *(p + 4); | ||
| 914 | netdev->dev_addr[2] = *(p + 3); | ||
| 915 | netdev->dev_addr[3] = *(p + 2); | ||
| 916 | netdev->dev_addr[4] = *(p + 1); | ||
| 917 | netdev->dev_addr[5] = *(p + 0); | ||
| 918 | |||
| 919 | memcpy(netdev->perm_addr, netdev->dev_addr, | ||
| 920 | netdev->addr_len); | ||
| 921 | if (!is_valid_ether_addr(netdev->perm_addr)) { | ||
| 922 | printk(KERN_ERR "%s: Bad MAC address %s.\n", | ||
| 923 | netxen_nic_driver_name, | ||
| 924 | print_mac(mac, netdev->dev_addr)); | ||
| 925 | } else { | ||
| 926 | adapter->macaddr_set(adapter, netdev->dev_addr); | ||
| 927 | } | ||
| 928 | } | ||
| 929 | 884 | ||
| 930 | netif_carrier_off(netdev); | 885 | netif_carrier_off(netdev); |
| 931 | netif_stop_queue(netdev); | 886 | netif_stop_queue(netdev); |
| @@ -1000,6 +955,7 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
| 1000 | 955 | ||
| 1001 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { | 956 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { |
| 1002 | netxen_free_hw_resources(adapter); | 957 | netxen_free_hw_resources(adapter); |
| 958 | netxen_release_rx_buffers(adapter); | ||
| 1003 | netxen_free_sw_resources(adapter); | 959 | netxen_free_sw_resources(adapter); |
| 1004 | } | 960 | } |
| 1005 | 961 | ||
| @@ -1069,6 +1025,15 @@ static int netxen_nic_open(struct net_device *netdev) | |||
| 1069 | goto err_out_free_sw; | 1025 | goto err_out_free_sw; |
| 1070 | } | 1026 | } |
| 1071 | 1027 | ||
| 1028 | if ((adapter->msi_mode != MSI_MODE_MULTIFUNC) || | ||
| 1029 | (adapter->intr_scheme != INTR_SCHEME_PERPORT)) { | ||
| 1030 | printk(KERN_ERR "%s: Firmware interrupt scheme is " | ||
| 1031 | "incompatible with driver\n", | ||
| 1032 | netdev->name); | ||
| 1033 | adapter->driver_mismatch = 1; | ||
| 1034 | goto err_out_free_hw; | ||
| 1035 | } | ||
| 1036 | |||
| 1072 | if (adapter->fw_major < 4) { | 1037 | if (adapter->fw_major < 4) { |
| 1073 | adapter->crb_addr_cmd_producer = | 1038 | adapter->crb_addr_cmd_producer = |
| 1074 | crb_cmd_producer[adapter->portnum]; | 1039 | crb_cmd_producer[adapter->portnum]; |
| @@ -1094,7 +1059,7 @@ static int netxen_nic_open(struct net_device *netdev) | |||
| 1094 | flags, netdev->name, adapter); | 1059 | flags, netdev->name, adapter); |
| 1095 | if (err) { | 1060 | if (err) { |
| 1096 | printk(KERN_ERR "request_irq failed with: %d\n", err); | 1061 | printk(KERN_ERR "request_irq failed with: %d\n", err); |
| 1097 | goto err_out_free_hw; | 1062 | goto err_out_free_rxbuf; |
| 1098 | } | 1063 | } |
| 1099 | 1064 | ||
| 1100 | adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; | 1065 | adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; |
| @@ -1116,6 +1081,7 @@ static int netxen_nic_open(struct net_device *netdev) | |||
| 1116 | if (adapter->set_mtu) | 1081 | if (adapter->set_mtu) |
| 1117 | adapter->set_mtu(adapter, netdev->mtu); | 1082 | adapter->set_mtu(adapter, netdev->mtu); |
| 1118 | 1083 | ||
| 1084 | adapter->ahw.linkup = 0; | ||
| 1119 | mod_timer(&adapter->watchdog_timer, jiffies); | 1085 | mod_timer(&adapter->watchdog_timer, jiffies); |
| 1120 | 1086 | ||
| 1121 | napi_enable(&adapter->napi); | 1087 | napi_enable(&adapter->napi); |
| @@ -1127,6 +1093,8 @@ static int netxen_nic_open(struct net_device *netdev) | |||
| 1127 | 1093 | ||
| 1128 | err_out_free_irq: | 1094 | err_out_free_irq: |
| 1129 | free_irq(adapter->irq, adapter); | 1095 | free_irq(adapter->irq, adapter); |
| 1096 | err_out_free_rxbuf: | ||
| 1097 | netxen_release_rx_buffers(adapter); | ||
| 1130 | err_out_free_hw: | 1098 | err_out_free_hw: |
| 1131 | netxen_free_hw_resources(adapter); | 1099 | netxen_free_hw_resources(adapter); |
| 1132 | err_out_free_sw: | 1100 | err_out_free_sw: |
| @@ -1152,10 +1120,8 @@ static int netxen_nic_close(struct net_device *netdev) | |||
| 1152 | 1120 | ||
| 1153 | netxen_release_tx_buffers(adapter); | 1121 | netxen_release_tx_buffers(adapter); |
| 1154 | 1122 | ||
| 1155 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { | 1123 | FLUSH_SCHEDULED_WORK(); |
| 1156 | FLUSH_SCHEDULED_WORK(); | 1124 | del_timer_sync(&adapter->watchdog_timer); |
| 1157 | del_timer_sync(&adapter->watchdog_timer); | ||
| 1158 | } | ||
| 1159 | 1125 | ||
| 1160 | return 0; | 1126 | return 0; |
| 1161 | } | 1127 | } |
| @@ -1458,7 +1424,8 @@ void netxen_watchdog_task(struct work_struct *work) | |||
| 1458 | 1424 | ||
| 1459 | netxen_nic_handle_phy_intr(adapter); | 1425 | netxen_nic_handle_phy_intr(adapter); |
| 1460 | 1426 | ||
| 1461 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 1427 | if (netif_running(adapter->netdev)) |
| 1428 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
| 1462 | } | 1429 | } |
| 1463 | 1430 | ||
| 1464 | static void netxen_tx_timeout(struct net_device *netdev) | 1431 | static void netxen_tx_timeout(struct net_device *netdev) |
| @@ -1518,18 +1485,9 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | |||
| 1518 | return stats; | 1485 | return stats; |
| 1519 | } | 1486 | } |
| 1520 | 1487 | ||
| 1521 | static inline void | ||
| 1522 | netxen_handle_int(struct netxen_adapter *adapter) | ||
| 1523 | { | ||
| 1524 | netxen_nic_disable_int(adapter); | ||
| 1525 | napi_schedule(&adapter->napi); | ||
| 1526 | } | ||
| 1527 | |||
| 1528 | static irqreturn_t netxen_intr(int irq, void *data) | 1488 | static irqreturn_t netxen_intr(int irq, void *data) |
| 1529 | { | 1489 | { |
| 1530 | struct netxen_adapter *adapter = data; | 1490 | struct netxen_adapter *adapter = data; |
| 1531 | u32 our_int = 0; | ||
| 1532 | |||
| 1533 | u32 status = 0; | 1491 | u32 status = 0; |
| 1534 | 1492 | ||
| 1535 | status = adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | 1493 | status = adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); |
| @@ -1544,22 +1502,32 @@ static irqreturn_t netxen_intr(int irq, void *data) | |||
| 1544 | if (!ISR_LEGACY_INT_TRIGGERED(status)) | 1502 | if (!ISR_LEGACY_INT_TRIGGERED(status)) |
| 1545 | return IRQ_NONE; | 1503 | return IRQ_NONE; |
| 1546 | 1504 | ||
| 1547 | } else if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 1505 | } else { |
| 1506 | unsigned long our_int = 0; | ||
| 1548 | 1507 | ||
| 1549 | our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR); | 1508 | our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR); |
| 1509 | |||
| 1550 | /* not our interrupt */ | 1510 | /* not our interrupt */ |
| 1551 | if ((our_int & (0x80 << adapter->portnum)) == 0) | 1511 | if (!test_and_clear_bit((7 + adapter->portnum), &our_int)) |
| 1552 | return IRQ_NONE; | 1512 | return IRQ_NONE; |
| 1553 | 1513 | ||
| 1554 | if (adapter->intr_scheme == INTR_SCHEME_PERPORT) { | 1514 | /* claim interrupt */ |
| 1555 | /* claim interrupt */ | 1515 | adapter->pci_write_normalize(adapter, |
| 1556 | adapter->pci_write_normalize(adapter, | 1516 | CRB_INT_VECTOR, (our_int & 0xffffffff)); |
| 1557 | CRB_INT_VECTOR, | ||
| 1558 | our_int & ~((u32)(0x80 << adapter->portnum))); | ||
| 1559 | } | ||
| 1560 | } | 1517 | } |
| 1561 | 1518 | ||
| 1562 | netxen_handle_int(adapter); | 1519 | /* clear interrupt */ |
| 1520 | if (adapter->fw_major < 4) | ||
| 1521 | netxen_nic_disable_int(adapter); | ||
| 1522 | |||
| 1523 | adapter->pci_write_immediate(adapter, | ||
| 1524 | adapter->legacy_intr.tgt_status_reg, | ||
| 1525 | 0xffffffff); | ||
| 1526 | /* read twice to ensure write is flushed */ | ||
| 1527 | adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | ||
| 1528 | adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | ||
| 1529 | |||
| 1530 | napi_schedule(&adapter->napi); | ||
| 1563 | 1531 | ||
| 1564 | return IRQ_HANDLED; | 1532 | return IRQ_HANDLED; |
| 1565 | } | 1533 | } |
| @@ -1568,7 +1536,11 @@ static irqreturn_t netxen_msi_intr(int irq, void *data) | |||
| 1568 | { | 1536 | { |
| 1569 | struct netxen_adapter *adapter = data; | 1537 | struct netxen_adapter *adapter = data; |
| 1570 | 1538 | ||
| 1571 | netxen_handle_int(adapter); | 1539 | /* clear interrupt */ |
| 1540 | adapter->pci_write_immediate(adapter, | ||
| 1541 | msi_tgt_status[adapter->ahw.pci_func], 0xffffffff); | ||
| 1542 | |||
| 1543 | napi_schedule(&adapter->napi); | ||
| 1572 | return IRQ_HANDLED; | 1544 | return IRQ_HANDLED; |
| 1573 | } | 1545 | } |
| 1574 | 1546 | ||
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h index 83e5ee57bfef..b293adcc95ab 100644 --- a/drivers/net/netxen/netxen_nic_phan_reg.h +++ b/drivers/net/netxen/netxen_nic_phan_reg.h | |||
| @@ -125,6 +125,8 @@ | |||
| 125 | #define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4) | 125 | #define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4) |
| 126 | #define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8) | 126 | #define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8) |
| 127 | 127 | ||
| 128 | #define CRB_MAC_BLOCK_START NETXEN_CAM_RAM(0x1c0) | ||
| 129 | |||
| 128 | /* | 130 | /* |
| 129 | * capabilities register, can be used to selectively enable/disable features | 131 | * capabilities register, can be used to selectively enable/disable features |
| 130 | * for backward compability | 132 | * for backward compability |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index e4765b713aba..e3be81eba8a4 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
| @@ -5984,6 +5984,56 @@ static void niu_netif_start(struct niu *np) | |||
| 5984 | niu_enable_interrupts(np, 1); | 5984 | niu_enable_interrupts(np, 1); |
| 5985 | } | 5985 | } |
| 5986 | 5986 | ||
| 5987 | static void niu_reset_buffers(struct niu *np) | ||
| 5988 | { | ||
| 5989 | int i, j, k, err; | ||
| 5990 | |||
| 5991 | if (np->rx_rings) { | ||
| 5992 | for (i = 0; i < np->num_rx_rings; i++) { | ||
| 5993 | struct rx_ring_info *rp = &np->rx_rings[i]; | ||
| 5994 | |||
| 5995 | for (j = 0, k = 0; j < MAX_RBR_RING_SIZE; j++) { | ||
| 5996 | struct page *page; | ||
| 5997 | |||
| 5998 | page = rp->rxhash[j]; | ||
| 5999 | while (page) { | ||
| 6000 | struct page *next = | ||
| 6001 | (struct page *) page->mapping; | ||
| 6002 | u64 base = page->index; | ||
| 6003 | base = base >> RBR_DESCR_ADDR_SHIFT; | ||
| 6004 | rp->rbr[k++] = cpu_to_le32(base); | ||
| 6005 | page = next; | ||
| 6006 | } | ||
| 6007 | } | ||
| 6008 | for (; k < MAX_RBR_RING_SIZE; k++) { | ||
| 6009 | err = niu_rbr_add_page(np, rp, GFP_ATOMIC, k); | ||
| 6010 | if (unlikely(err)) | ||
| 6011 | break; | ||
| 6012 | } | ||
| 6013 | |||
| 6014 | rp->rbr_index = rp->rbr_table_size - 1; | ||
| 6015 | rp->rcr_index = 0; | ||
| 6016 | rp->rbr_pending = 0; | ||
| 6017 | rp->rbr_refill_pending = 0; | ||
| 6018 | } | ||
| 6019 | } | ||
| 6020 | if (np->tx_rings) { | ||
| 6021 | for (i = 0; i < np->num_tx_rings; i++) { | ||
| 6022 | struct tx_ring_info *rp = &np->tx_rings[i]; | ||
| 6023 | |||
| 6024 | for (j = 0; j < MAX_TX_RING_SIZE; j++) { | ||
| 6025 | if (rp->tx_buffs[j].skb) | ||
| 6026 | (void) release_tx_packet(np, rp, j); | ||
| 6027 | } | ||
| 6028 | |||
| 6029 | rp->pending = MAX_TX_RING_SIZE; | ||
| 6030 | rp->prod = 0; | ||
| 6031 | rp->cons = 0; | ||
| 6032 | rp->wrap_bit = 0; | ||
| 6033 | } | ||
| 6034 | } | ||
| 6035 | } | ||
| 6036 | |||
| 5987 | static void niu_reset_task(struct work_struct *work) | 6037 | static void niu_reset_task(struct work_struct *work) |
| 5988 | { | 6038 | { |
| 5989 | struct niu *np = container_of(work, struct niu, reset_task); | 6039 | struct niu *np = container_of(work, struct niu, reset_task); |
| @@ -6006,6 +6056,12 @@ static void niu_reset_task(struct work_struct *work) | |||
| 6006 | 6056 | ||
| 6007 | niu_stop_hw(np); | 6057 | niu_stop_hw(np); |
| 6008 | 6058 | ||
| 6059 | spin_unlock_irqrestore(&np->lock, flags); | ||
| 6060 | |||
| 6061 | niu_reset_buffers(np); | ||
| 6062 | |||
| 6063 | spin_lock_irqsave(&np->lock, flags); | ||
| 6064 | |||
| 6009 | err = niu_init_hw(np); | 6065 | err = niu_init_hw(np); |
| 6010 | if (!err) { | 6066 | if (!err) { |
| 6011 | np->timer.expires = jiffies + HZ; | 6067 | np->timer.expires = jiffies + HZ; |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 3f682d49a4e6..52bf11b73c6e 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
| @@ -784,6 +784,7 @@ static struct pcmcia_device_id axnet_ids[] = { | |||
| 784 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEther PCC-TXD", 0x5261440f, 0x436768c5), | 784 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEther PCC-TXD", 0x5261440f, 0x436768c5), |
| 785 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEtherII PCC-TXD", 0x5261440f, 0x730df72e), | 785 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEtherII PCC-TXD", 0x5261440f, 0x730df72e), |
| 786 | PCMCIA_DEVICE_PROD_ID12("Dynalink", "L100C16", 0x55632fd5, 0x66bc2a90), | 786 | PCMCIA_DEVICE_PROD_ID12("Dynalink", "L100C16", 0x55632fd5, 0x66bc2a90), |
| 787 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "ETXPCM", 0x547e66dc, 0x233adac2), | ||
| 787 | PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V3)", 0x0733cc81, 0x232019a8), | 788 | PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V3)", 0x0733cc81, 0x232019a8), |
| 788 | PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC3-TX", 0x481e0094, 0xf91af609), | 789 | PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC3-TX", 0x481e0094, 0xf91af609), |
| 789 | PCMCIA_DEVICE_PROD_ID12("PCMCIA", "100BASE", 0x281f1c5d, 0x7c2add04), | 790 | PCMCIA_DEVICE_PROD_ID12("PCMCIA", "100BASE", 0x281f1c5d, 0x7c2add04), |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 2d4c4ad89b8d..ebc1ae6bcbe5 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
| @@ -1626,6 +1626,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
| 1626 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), | 1626 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), |
| 1627 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), | 1627 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), |
| 1628 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), | 1628 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), |
| 1629 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-TD", 0x5261440f, 0x47d5ca83), | ||
| 1629 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), | 1630 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), |
| 1630 | PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2), | 1631 | PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2), |
| 1631 | PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2), | 1632 | PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2), |
| @@ -1737,7 +1738,6 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
| 1737 | PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360), | 1738 | PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360), |
| 1738 | PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de), | 1739 | PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de), |
| 1739 | PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f), | 1740 | PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f), |
| 1740 | PCMCIA_DEVICE_PROD_ID1("IC-CARD", 0x60cb09a6), | ||
| 1741 | PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a), | 1741 | PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a), |
| 1742 | PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078), | 1742 | PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078), |
| 1743 | /* too generic! */ | 1743 | /* too generic! */ |
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c index b35d79449500..88f03c9e9403 100644 --- a/drivers/net/ppp_mppe.c +++ b/drivers/net/ppp_mppe.c | |||
| @@ -46,7 +46,6 @@ | |||
| 46 | #include <linux/err.h> | 46 | #include <linux/err.h> |
| 47 | #include <linux/module.h> | 47 | #include <linux/module.h> |
| 48 | #include <linux/kernel.h> | 48 | #include <linux/kernel.h> |
| 49 | #include <linux/version.h> | ||
| 50 | #include <linux/init.h> | 49 | #include <linux/init.h> |
| 51 | #include <linux/types.h> | 50 | #include <linux/types.h> |
| 52 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index f9298827a76c..ff175e8f36b2 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
| @@ -61,7 +61,6 @@ | |||
| 61 | */ | 61 | */ |
| 62 | 62 | ||
| 63 | #include <linux/module.h> | 63 | #include <linux/module.h> |
| 64 | #include <linux/version.h> | ||
| 65 | #include <linux/string.h> | 64 | #include <linux/string.h> |
| 66 | #include <linux/list.h> | 65 | #include <linux/list.h> |
| 67 | #include <asm/uaccess.h> | 66 | #include <asm/uaccess.h> |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 6531ff565c54..5d86281d9363 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| 26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 27 | #include <linux/version.h> | ||
| 28 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
| 29 | #include <linux/string.h> | 28 | #include <linux/string.h> |
| 30 | #include <linux/timer.h> | 29 | #include <linux/timer.h> |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index a3e3895e5032..0f6f9747d255 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
| @@ -2792,7 +2792,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
| 2792 | pkt_size, PCI_DMA_FROMDEVICE); | 2792 | pkt_size, PCI_DMA_FROMDEVICE); |
| 2793 | rtl8169_mark_to_asic(desc, tp->rx_buf_sz); | 2793 | rtl8169_mark_to_asic(desc, tp->rx_buf_sz); |
| 2794 | } else { | 2794 | } else { |
| 2795 | pci_unmap_single(pdev, addr, pkt_size, | 2795 | pci_unmap_single(pdev, addr, tp->rx_buf_sz, |
| 2796 | PCI_DMA_FROMDEVICE); | 2796 | PCI_DMA_FROMDEVICE); |
| 2797 | tp->Rx_skbuff[entry] = NULL; | 2797 | tp->Rx_skbuff[entry] = NULL; |
| 2798 | } | 2798 | } |
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 25e62cf58d3a..1c370e6aa641 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | * the file called "COPYING". | 20 | * the file called "COPYING". |
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | #include <linux/version.h> | ||
| 24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
| 25 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
| 26 | #include <linux/etherdevice.h> | 25 | #include <linux/etherdevice.h> |
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c index 889f98724610..a85efcfd9d0e 100644 --- a/drivers/net/skfp/ess.c +++ b/drivers/net/skfp/ess.c | |||
| @@ -510,7 +510,7 @@ static void ess_send_response(struct s_smc *smc, struct smt_header *sm, | |||
| 510 | chg->path.para.p_type = SMT_P320B ; | 510 | chg->path.para.p_type = SMT_P320B ; |
| 511 | chg->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ; | 511 | chg->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ; |
| 512 | chg->path.mib_index = SBAPATHINDEX ; | 512 | chg->path.mib_index = SBAPATHINDEX ; |
| 513 | chg->path.path_pad = (u_short)NULL ; | 513 | chg->path.path_pad = 0; |
| 514 | chg->path.path_index = PRIMARY_RING ; | 514 | chg->path.path_index = PRIMARY_RING ; |
| 515 | 515 | ||
| 516 | /* set P320F */ | 516 | /* set P320F */ |
| @@ -606,7 +606,7 @@ static void ess_send_alc_req(struct s_smc *smc) | |||
| 606 | req->path.para.p_type = SMT_P320B ; | 606 | req->path.para.p_type = SMT_P320B ; |
| 607 | req->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ; | 607 | req->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ; |
| 608 | req->path.mib_index = SBAPATHINDEX ; | 608 | req->path.mib_index = SBAPATHINDEX ; |
| 609 | req->path.path_pad = (u_short)NULL ; | 609 | req->path.path_pad = 0; |
| 610 | req->path.path_index = PRIMARY_RING ; | 610 | req->path.path_index = PRIMARY_RING ; |
| 611 | 611 | ||
| 612 | /* set P0017 */ | 612 | /* set P0017 */ |
| @@ -636,7 +636,7 @@ static void ess_send_alc_req(struct s_smc *smc) | |||
| 636 | /* set P19 */ | 636 | /* set P19 */ |
| 637 | req->a_addr.para.p_type = SMT_P0019 ; | 637 | req->a_addr.para.p_type = SMT_P0019 ; |
| 638 | req->a_addr.para.p_len = sizeof(struct smt_p_0019) - PARA_LEN ; | 638 | req->a_addr.para.p_len = sizeof(struct smt_p_0019) - PARA_LEN ; |
| 639 | req->a_addr.sba_pad = (u_short)NULL ; | 639 | req->a_addr.sba_pad = 0; |
| 640 | req->a_addr.alloc_addr = null_addr ; | 640 | req->a_addr.alloc_addr = null_addr ; |
| 641 | 641 | ||
| 642 | /* set P1A */ | 642 | /* set P1A */ |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 7d29edcd40b4..e24b25ca1c69 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/crc32.h> | 25 | #include <linux/crc32.h> |
| 26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
| 27 | #include <linux/version.h> | ||
| 28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 29 | #include <linux/netdevice.h> | 28 | #include <linux/netdevice.h> |
| 30 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
| @@ -666,11 +665,16 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port) | |||
| 666 | 665 | ||
| 667 | if (hw->chip_id != CHIP_ID_YUKON_EC) { | 666 | if (hw->chip_id != CHIP_ID_YUKON_EC) { |
| 668 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { | 667 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { |
| 669 | ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); | 668 | /* select page 2 to access MAC control register */ |
| 669 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 2); | ||
| 670 | 670 | ||
| 671 | ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); | ||
| 671 | /* enable Power Down */ | 672 | /* enable Power Down */ |
| 672 | ctrl |= PHY_M_PC_POW_D_ENA; | 673 | ctrl |= PHY_M_PC_POW_D_ENA; |
| 673 | gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl); | 674 | gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl); |
| 675 | |||
| 676 | /* set page register back to 0 */ | ||
| 677 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 0); | ||
| 674 | } | 678 | } |
| 675 | 679 | ||
| 676 | /* set IEEE compatible Power Down Mode (dev. #4.99) */ | 680 | /* set IEEE compatible Power Down Mode (dev. #4.99) */ |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 2040965d7724..24768c10cadb 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
| @@ -2255,7 +2255,7 @@ static int smc_drv_remove(struct platform_device *pdev) | |||
| 2255 | 2255 | ||
| 2256 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs"); | 2256 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs"); |
| 2257 | if (!res) | 2257 | if (!res) |
| 2258 | platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2258 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 2259 | release_mem_region(res->start, SMC_IO_EXTENT); | 2259 | release_mem_region(res->start, SMC_IO_EXTENT); |
| 2260 | 2260 | ||
| 2261 | free_netdev(ndev); | 2261 | free_netdev(ndev); |
diff --git a/drivers/net/tehuti.h b/drivers/net/tehuti.h index c66dfc9ec1ec..7db48f1cd949 100644 --- a/drivers/net/tehuti.h +++ b/drivers/net/tehuti.h | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
| 28 | #include <linux/tty.h> | 28 | #include <linux/tty.h> |
| 29 | #include <linux/if_vlan.h> | 29 | #include <linux/if_vlan.h> |
| 30 | #include <linux/version.h> | ||
| 31 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
| 32 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
| 33 | #include <asm/byteorder.h> | 32 | #include <asm/byteorder.h> |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index d2439b85a790..71d2c5cfdad9 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
| @@ -66,8 +66,8 @@ | |||
| 66 | 66 | ||
| 67 | #define DRV_MODULE_NAME "tg3" | 67 | #define DRV_MODULE_NAME "tg3" |
| 68 | #define PFX DRV_MODULE_NAME ": " | 68 | #define PFX DRV_MODULE_NAME ": " |
| 69 | #define DRV_MODULE_VERSION "3.93" | 69 | #define DRV_MODULE_VERSION "3.94" |
| 70 | #define DRV_MODULE_RELDATE "May 22, 2008" | 70 | #define DRV_MODULE_RELDATE "August 14, 2008" |
| 71 | 71 | ||
| 72 | #define TG3_DEF_MAC_MODE 0 | 72 | #define TG3_DEF_MAC_MODE 0 |
| 73 | #define TG3_DEF_RX_MODE 0 | 73 | #define TG3_DEF_RX_MODE 0 |
| @@ -536,6 +536,7 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum) | |||
| 536 | return 0; | 536 | return 0; |
| 537 | 537 | ||
| 538 | switch (locknum) { | 538 | switch (locknum) { |
| 539 | case TG3_APE_LOCK_GRC: | ||
| 539 | case TG3_APE_LOCK_MEM: | 540 | case TG3_APE_LOCK_MEM: |
| 540 | break; | 541 | break; |
| 541 | default: | 542 | default: |
| @@ -573,6 +574,7 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum) | |||
| 573 | return; | 574 | return; |
| 574 | 575 | ||
| 575 | switch (locknum) { | 576 | switch (locknum) { |
| 577 | case TG3_APE_LOCK_GRC: | ||
| 576 | case TG3_APE_LOCK_MEM: | 578 | case TG3_APE_LOCK_MEM: |
| 577 | break; | 579 | break; |
| 578 | default: | 580 | default: |
| @@ -1018,15 +1020,43 @@ static void tg3_mdio_fini(struct tg3 *tp) | |||
| 1018 | } | 1020 | } |
| 1019 | 1021 | ||
| 1020 | /* tp->lock is held. */ | 1022 | /* tp->lock is held. */ |
| 1023 | static inline void tg3_generate_fw_event(struct tg3 *tp) | ||
| 1024 | { | ||
| 1025 | u32 val; | ||
| 1026 | |||
| 1027 | val = tr32(GRC_RX_CPU_EVENT); | ||
| 1028 | val |= GRC_RX_CPU_DRIVER_EVENT; | ||
| 1029 | tw32_f(GRC_RX_CPU_EVENT, val); | ||
| 1030 | |||
| 1031 | tp->last_event_jiffies = jiffies; | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | #define TG3_FW_EVENT_TIMEOUT_USEC 2500 | ||
| 1035 | |||
| 1036 | /* tp->lock is held. */ | ||
| 1021 | static void tg3_wait_for_event_ack(struct tg3 *tp) | 1037 | static void tg3_wait_for_event_ack(struct tg3 *tp) |
| 1022 | { | 1038 | { |
| 1023 | int i; | 1039 | int i; |
| 1040 | unsigned int delay_cnt; | ||
| 1041 | long time_remain; | ||
| 1042 | |||
| 1043 | /* If enough time has passed, no wait is necessary. */ | ||
| 1044 | time_remain = (long)(tp->last_event_jiffies + 1 + | ||
| 1045 | usecs_to_jiffies(TG3_FW_EVENT_TIMEOUT_USEC)) - | ||
| 1046 | (long)jiffies; | ||
| 1047 | if (time_remain < 0) | ||
| 1048 | return; | ||
| 1024 | 1049 | ||
| 1025 | /* Wait for up to 2.5 milliseconds */ | 1050 | /* Check if we can shorten the wait time. */ |
| 1026 | for (i = 0; i < 250000; i++) { | 1051 | delay_cnt = jiffies_to_usecs(time_remain); |
| 1052 | if (delay_cnt > TG3_FW_EVENT_TIMEOUT_USEC) | ||
| 1053 | delay_cnt = TG3_FW_EVENT_TIMEOUT_USEC; | ||
| 1054 | delay_cnt = (delay_cnt >> 3) + 1; | ||
| 1055 | |||
| 1056 | for (i = 0; i < delay_cnt; i++) { | ||
| 1027 | if (!(tr32(GRC_RX_CPU_EVENT) & GRC_RX_CPU_DRIVER_EVENT)) | 1057 | if (!(tr32(GRC_RX_CPU_EVENT) & GRC_RX_CPU_DRIVER_EVENT)) |
| 1028 | break; | 1058 | break; |
| 1029 | udelay(10); | 1059 | udelay(8); |
| 1030 | } | 1060 | } |
| 1031 | } | 1061 | } |
| 1032 | 1062 | ||
| @@ -1075,9 +1105,7 @@ static void tg3_ump_link_report(struct tg3 *tp) | |||
| 1075 | val = 0; | 1105 | val = 0; |
| 1076 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 12, val); | 1106 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 12, val); |
| 1077 | 1107 | ||
| 1078 | val = tr32(GRC_RX_CPU_EVENT); | 1108 | tg3_generate_fw_event(tp); |
| 1079 | val |= GRC_RX_CPU_DRIVER_EVENT; | ||
| 1080 | tw32_f(GRC_RX_CPU_EVENT, val); | ||
| 1081 | } | 1109 | } |
| 1082 | 1110 | ||
| 1083 | static void tg3_link_report(struct tg3 *tp) | 1111 | static void tg3_link_report(struct tg3 *tp) |
| @@ -2124,6 +2152,13 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
| 2124 | (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)) | 2152 | (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)) |
| 2125 | mac_mode |= MAC_MODE_MAGIC_PKT_ENABLE; | 2153 | mac_mode |= MAC_MODE_MAGIC_PKT_ENABLE; |
| 2126 | 2154 | ||
| 2155 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { | ||
| 2156 | mac_mode |= tp->mac_mode & | ||
| 2157 | (MAC_MODE_APE_TX_EN | MAC_MODE_APE_RX_EN); | ||
| 2158 | if (mac_mode & MAC_MODE_APE_TX_EN) | ||
| 2159 | mac_mode |= MAC_MODE_TDE_ENABLE; | ||
| 2160 | } | ||
| 2161 | |||
| 2127 | tw32_f(MAC_MODE, mac_mode); | 2162 | tw32_f(MAC_MODE, mac_mode); |
| 2128 | udelay(100); | 2163 | udelay(100); |
| 2129 | 2164 | ||
| @@ -5493,7 +5528,7 @@ static void tg3_ape_send_event(struct tg3 *tp, u32 event) | |||
| 5493 | return; | 5528 | return; |
| 5494 | 5529 | ||
| 5495 | apedata = tg3_ape_read32(tp, TG3_APE_FW_STATUS); | 5530 | apedata = tg3_ape_read32(tp, TG3_APE_FW_STATUS); |
| 5496 | if (apedata != APE_FW_STATUS_READY) | 5531 | if (!(apedata & APE_FW_STATUS_READY)) |
| 5497 | return; | 5532 | return; |
| 5498 | 5533 | ||
| 5499 | /* Wait for up to 1 millisecond for APE to service previous event. */ | 5534 | /* Wait for up to 1 millisecond for APE to service previous event. */ |
| @@ -5760,6 +5795,8 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
| 5760 | 5795 | ||
| 5761 | tg3_mdio_stop(tp); | 5796 | tg3_mdio_stop(tp); |
| 5762 | 5797 | ||
| 5798 | tg3_ape_lock(tp, TG3_APE_LOCK_GRC); | ||
| 5799 | |||
| 5763 | /* No matching tg3_nvram_unlock() after this because | 5800 | /* No matching tg3_nvram_unlock() after this because |
| 5764 | * chip reset below will undo the nvram lock. | 5801 | * chip reset below will undo the nvram lock. |
| 5765 | */ | 5802 | */ |
| @@ -5908,12 +5945,19 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
| 5908 | } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { | 5945 | } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { |
| 5909 | tp->mac_mode = MAC_MODE_PORT_MODE_GMII; | 5946 | tp->mac_mode = MAC_MODE_PORT_MODE_GMII; |
| 5910 | tw32_f(MAC_MODE, tp->mac_mode); | 5947 | tw32_f(MAC_MODE, tp->mac_mode); |
| 5948 | } else if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { | ||
| 5949 | tp->mac_mode &= (MAC_MODE_APE_TX_EN | MAC_MODE_APE_RX_EN); | ||
| 5950 | if (tp->mac_mode & MAC_MODE_APE_TX_EN) | ||
| 5951 | tp->mac_mode |= MAC_MODE_TDE_ENABLE; | ||
| 5952 | tw32_f(MAC_MODE, tp->mac_mode); | ||
| 5911 | } else | 5953 | } else |
| 5912 | tw32_f(MAC_MODE, 0); | 5954 | tw32_f(MAC_MODE, 0); |
| 5913 | udelay(40); | 5955 | udelay(40); |
| 5914 | 5956 | ||
| 5915 | tg3_mdio_start(tp); | 5957 | tg3_mdio_start(tp); |
| 5916 | 5958 | ||
| 5959 | tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); | ||
| 5960 | |||
| 5917 | err = tg3_poll_fw(tp); | 5961 | err = tg3_poll_fw(tp); |
| 5918 | if (err) | 5962 | if (err) |
| 5919 | return err; | 5963 | return err; |
| @@ -5935,6 +5979,7 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
| 5935 | tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg); | 5979 | tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg); |
| 5936 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { | 5980 | if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) { |
| 5937 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; | 5981 | tp->tg3_flags |= TG3_FLAG_ENABLE_ASF; |
| 5982 | tp->last_event_jiffies = jiffies; | ||
| 5938 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) | 5983 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) |
| 5939 | tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE; | 5984 | tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE; |
| 5940 | } | 5985 | } |
| @@ -5948,15 +5993,12 @@ static void tg3_stop_fw(struct tg3 *tp) | |||
| 5948 | { | 5993 | { |
| 5949 | if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) && | 5994 | if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) && |
| 5950 | !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) { | 5995 | !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) { |
| 5951 | u32 val; | ||
| 5952 | |||
| 5953 | /* Wait for RX cpu to ACK the previous event. */ | 5996 | /* Wait for RX cpu to ACK the previous event. */ |
| 5954 | tg3_wait_for_event_ack(tp); | 5997 | tg3_wait_for_event_ack(tp); |
| 5955 | 5998 | ||
| 5956 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_PAUSE_FW); | 5999 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_PAUSE_FW); |
| 5957 | val = tr32(GRC_RX_CPU_EVENT); | 6000 | |
| 5958 | val |= GRC_RX_CPU_DRIVER_EVENT; | 6001 | tg3_generate_fw_event(tp); |
| 5959 | tw32(GRC_RX_CPU_EVENT, val); | ||
| 5960 | 6002 | ||
| 5961 | /* Wait for RX cpu to ACK this event. */ | 6003 | /* Wait for RX cpu to ACK this event. */ |
| 5962 | tg3_wait_for_event_ack(tp); | 6004 | tg3_wait_for_event_ack(tp); |
| @@ -7406,7 +7448,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
| 7406 | udelay(10); | 7448 | udelay(10); |
| 7407 | } | 7449 | } |
| 7408 | 7450 | ||
| 7409 | tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | | 7451 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) |
| 7452 | tp->mac_mode &= MAC_MODE_APE_TX_EN | MAC_MODE_APE_RX_EN; | ||
| 7453 | else | ||
| 7454 | tp->mac_mode = 0; | ||
| 7455 | tp->mac_mode |= MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE | | ||
| 7410 | MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; | 7456 | MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE; |
| 7411 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) && | 7457 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) && |
| 7412 | !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && | 7458 | !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && |
| @@ -7840,9 +7886,8 @@ static void tg3_timer(unsigned long __opaque) | |||
| 7840 | * resets. | 7886 | * resets. |
| 7841 | */ | 7887 | */ |
| 7842 | if (!--tp->asf_counter) { | 7888 | if (!--tp->asf_counter) { |
| 7843 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { | 7889 | if ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) && |
| 7844 | u32 val; | 7890 | !(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE)) { |
| 7845 | |||
| 7846 | tg3_wait_for_event_ack(tp); | 7891 | tg3_wait_for_event_ack(tp); |
| 7847 | 7892 | ||
| 7848 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, | 7893 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, |
| @@ -7850,9 +7895,8 @@ static void tg3_timer(unsigned long __opaque) | |||
| 7850 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); | 7895 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); |
| 7851 | /* 5 seconds timeout */ | 7896 | /* 5 seconds timeout */ |
| 7852 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); | 7897 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); |
| 7853 | val = tr32(GRC_RX_CPU_EVENT); | 7898 | |
| 7854 | val |= GRC_RX_CPU_DRIVER_EVENT; | 7899 | tg3_generate_fw_event(tp); |
| 7855 | tw32_f(GRC_RX_CPU_EVENT, val); | ||
| 7856 | } | 7900 | } |
| 7857 | tp->asf_counter = tp->asf_multiplier; | 7901 | tp->asf_counter = tp->asf_multiplier; |
| 7858 | } | 7902 | } |
| @@ -8422,6 +8466,11 @@ static inline unsigned long get_stat64(tg3_stat64_t *val) | |||
| 8422 | return ret; | 8466 | return ret; |
| 8423 | } | 8467 | } |
| 8424 | 8468 | ||
| 8469 | static inline u64 get_estat64(tg3_stat64_t *val) | ||
| 8470 | { | ||
| 8471 | return ((u64)val->high << 32) | ((u64)val->low); | ||
| 8472 | } | ||
| 8473 | |||
| 8425 | static unsigned long calc_crc_errors(struct tg3 *tp) | 8474 | static unsigned long calc_crc_errors(struct tg3 *tp) |
| 8426 | { | 8475 | { |
| 8427 | struct tg3_hw_stats *hw_stats = tp->hw_stats; | 8476 | struct tg3_hw_stats *hw_stats = tp->hw_stats; |
| @@ -8450,7 +8499,7 @@ static unsigned long calc_crc_errors(struct tg3 *tp) | |||
| 8450 | 8499 | ||
| 8451 | #define ESTAT_ADD(member) \ | 8500 | #define ESTAT_ADD(member) \ |
| 8452 | estats->member = old_estats->member + \ | 8501 | estats->member = old_estats->member + \ |
| 8453 | get_stat64(&hw_stats->member) | 8502 | get_estat64(&hw_stats->member) |
| 8454 | 8503 | ||
| 8455 | static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) | 8504 | static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) |
| 8456 | { | 8505 | { |
| @@ -12416,6 +12465,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
| 12416 | tp->misc_host_ctrl); | 12465 | tp->misc_host_ctrl); |
| 12417 | } | 12466 | } |
| 12418 | 12467 | ||
| 12468 | /* Preserve the APE MAC_MODE bits */ | ||
| 12469 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) | ||
| 12470 | tp->mac_mode = tr32(MAC_MODE) | | ||
| 12471 | MAC_MODE_APE_TX_EN | MAC_MODE_APE_RX_EN; | ||
| 12472 | else | ||
| 12473 | tp->mac_mode = TG3_DEF_MAC_MODE; | ||
| 12474 | |||
| 12419 | /* these are limited to 10/100 only */ | 12475 | /* these are limited to 10/100 only */ |
| 12420 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && | 12476 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 && |
| 12421 | (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) || | 12477 | (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) || |
| @@ -13275,7 +13331,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
| 13275 | tp->pdev = pdev; | 13331 | tp->pdev = pdev; |
| 13276 | tp->dev = dev; | 13332 | tp->dev = dev; |
| 13277 | tp->pm_cap = pm_cap; | 13333 | tp->pm_cap = pm_cap; |
| 13278 | tp->mac_mode = TG3_DEF_MAC_MODE; | ||
| 13279 | tp->rx_mode = TG3_DEF_RX_MODE; | 13334 | tp->rx_mode = TG3_DEF_RX_MODE; |
| 13280 | tp->tx_mode = TG3_DEF_TX_MODE; | 13335 | tp->tx_mode = TG3_DEF_TX_MODE; |
| 13281 | 13336 | ||
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index df07842172b7..f5b8cab8d4b5 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
| @@ -325,6 +325,8 @@ | |||
| 325 | #define MAC_MODE_TDE_ENABLE 0x00200000 | 325 | #define MAC_MODE_TDE_ENABLE 0x00200000 |
| 326 | #define MAC_MODE_RDE_ENABLE 0x00400000 | 326 | #define MAC_MODE_RDE_ENABLE 0x00400000 |
| 327 | #define MAC_MODE_FHDE_ENABLE 0x00800000 | 327 | #define MAC_MODE_FHDE_ENABLE 0x00800000 |
| 328 | #define MAC_MODE_APE_RX_EN 0x08000000 | ||
| 329 | #define MAC_MODE_APE_TX_EN 0x10000000 | ||
| 328 | #define MAC_STATUS 0x00000404 | 330 | #define MAC_STATUS 0x00000404 |
| 329 | #define MAC_STATUS_PCS_SYNCED 0x00000001 | 331 | #define MAC_STATUS_PCS_SYNCED 0x00000001 |
| 330 | #define MAC_STATUS_SIGNAL_DET 0x00000002 | 332 | #define MAC_STATUS_SIGNAL_DET 0x00000002 |
| @@ -1889,6 +1891,7 @@ | |||
| 1889 | #define APE_EVENT_STATUS_EVENT_PENDING 0x80000000 | 1891 | #define APE_EVENT_STATUS_EVENT_PENDING 0x80000000 |
| 1890 | 1892 | ||
| 1891 | /* APE convenience enumerations. */ | 1893 | /* APE convenience enumerations. */ |
| 1894 | #define TG3_APE_LOCK_GRC 1 | ||
| 1892 | #define TG3_APE_LOCK_MEM 4 | 1895 | #define TG3_APE_LOCK_MEM 4 |
| 1893 | 1896 | ||
| 1894 | #define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10 | 1897 | #define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10 |
| @@ -2429,7 +2432,10 @@ struct tg3 { | |||
| 2429 | struct tg3_ethtool_stats estats; | 2432 | struct tg3_ethtool_stats estats; |
| 2430 | struct tg3_ethtool_stats estats_prev; | 2433 | struct tg3_ethtool_stats estats_prev; |
| 2431 | 2434 | ||
| 2435 | union { | ||
| 2432 | unsigned long phy_crc_errors; | 2436 | unsigned long phy_crc_errors; |
| 2437 | unsigned long last_event_jiffies; | ||
| 2438 | }; | ||
| 2433 | 2439 | ||
| 2434 | u32 rx_offset; | 2440 | u32 rx_offset; |
| 2435 | u32 tg3_flags; | 2441 | u32 tg3_flags; |
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index 85246ed7cb9c..ec871f646766 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c | |||
| @@ -360,8 +360,8 @@ TLan_GetSKB( const struct tlan_list_tag *tag) | |||
| 360 | { | 360 | { |
| 361 | unsigned long addr; | 361 | unsigned long addr; |
| 362 | 362 | ||
| 363 | addr = tag->buffer[8].address; | 363 | addr = tag->buffer[9].address; |
| 364 | addr |= (tag->buffer[9].address << 16) << 16; | 364 | addr |= (tag->buffer[8].address << 16) << 16; |
| 365 | return (struct sk_buff *) addr; | 365 | return (struct sk_buff *) addr; |
| 366 | } | 366 | } |
| 367 | 367 | ||
| @@ -1984,7 +1984,6 @@ static void TLan_ResetLists( struct net_device *dev ) | |||
| 1984 | TLanList *list; | 1984 | TLanList *list; |
| 1985 | dma_addr_t list_phys; | 1985 | dma_addr_t list_phys; |
| 1986 | struct sk_buff *skb; | 1986 | struct sk_buff *skb; |
| 1987 | void *t = NULL; | ||
| 1988 | 1987 | ||
| 1989 | priv->txHead = 0; | 1988 | priv->txHead = 0; |
| 1990 | priv->txTail = 0; | 1989 | priv->txTail = 0; |
| @@ -2022,7 +2021,8 @@ static void TLan_ResetLists( struct net_device *dev ) | |||
| 2022 | } | 2021 | } |
| 2023 | 2022 | ||
| 2024 | skb_reserve( skb, NET_IP_ALIGN ); | 2023 | skb_reserve( skb, NET_IP_ALIGN ); |
| 2025 | list->buffer[0].address = pci_map_single(priv->pciDev, t, | 2024 | list->buffer[0].address = pci_map_single(priv->pciDev, |
| 2025 | skb->data, | ||
| 2026 | TLAN_MAX_FRAME_SIZE, | 2026 | TLAN_MAX_FRAME_SIZE, |
| 2027 | PCI_DMA_FROMDEVICE); | 2027 | PCI_DMA_FROMDEVICE); |
| 2028 | TLan_StoreSKB(list, skb); | 2028 | TLan_StoreSKB(list, skb); |
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index 47d84cd28097..59d1673f9387 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c | |||
| @@ -119,7 +119,6 @@ | |||
| 119 | #include <linux/pci.h> | 119 | #include <linux/pci.h> |
| 120 | #include <linux/dma-mapping.h> | 120 | #include <linux/dma-mapping.h> |
| 121 | #include <linux/spinlock.h> | 121 | #include <linux/spinlock.h> |
| 122 | #include <linux/version.h> | ||
| 123 | #include <linux/bitops.h> | 122 | #include <linux/bitops.h> |
| 124 | #include <linux/jiffies.h> | 123 | #include <linux/jiffies.h> |
| 125 | 124 | ||
diff --git a/drivers/net/tokenring/lanstreamer.h b/drivers/net/tokenring/lanstreamer.h index e7bb3494afc7..13ccee6449c1 100644 --- a/drivers/net/tokenring/lanstreamer.h +++ b/drivers/net/tokenring/lanstreamer.h | |||
| @@ -60,8 +60,6 @@ | |||
| 60 | * | 60 | * |
| 61 | */ | 61 | */ |
| 62 | 62 | ||
| 63 | #include <linux/version.h> | ||
| 64 | |||
| 65 | /* MAX_INTR - the maximum number of times we can loop | 63 | /* MAX_INTR - the maximum number of times we can loop |
| 66 | * inside the interrupt function before returning | 64 | * inside the interrupt function before returning |
| 67 | * control to the OS (maximum value is 256) | 65 | * control to the OS (maximum value is 256) |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index e6bbc639c2d0..6daea0c91862 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -358,6 +358,66 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait) | |||
| 358 | return mask; | 358 | return mask; |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | /* prepad is the amount to reserve at front. len is length after that. | ||
| 362 | * linear is a hint as to how much to copy (usually headers). */ | ||
| 363 | static struct sk_buff *tun_alloc_skb(size_t prepad, size_t len, size_t linear, | ||
| 364 | gfp_t gfp) | ||
| 365 | { | ||
| 366 | struct sk_buff *skb; | ||
| 367 | unsigned int i; | ||
| 368 | |||
| 369 | skb = alloc_skb(prepad + len, gfp|__GFP_NOWARN); | ||
| 370 | if (skb) { | ||
| 371 | skb_reserve(skb, prepad); | ||
| 372 | skb_put(skb, len); | ||
| 373 | return skb; | ||
| 374 | } | ||
| 375 | |||
| 376 | /* Under a page? Don't bother with paged skb. */ | ||
| 377 | if (prepad + len < PAGE_SIZE) | ||
| 378 | return NULL; | ||
| 379 | |||
| 380 | /* Start with a normal skb, and add pages. */ | ||
| 381 | skb = alloc_skb(prepad + linear, gfp); | ||
| 382 | if (!skb) | ||
| 383 | return NULL; | ||
| 384 | |||
| 385 | skb_reserve(skb, prepad); | ||
| 386 | skb_put(skb, linear); | ||
| 387 | |||
| 388 | len -= linear; | ||
| 389 | |||
| 390 | for (i = 0; i < MAX_SKB_FRAGS; i++) { | ||
| 391 | skb_frag_t *f = &skb_shinfo(skb)->frags[i]; | ||
| 392 | |||
| 393 | f->page = alloc_page(gfp|__GFP_ZERO); | ||
| 394 | if (!f->page) | ||
| 395 | break; | ||
| 396 | |||
| 397 | f->page_offset = 0; | ||
| 398 | f->size = PAGE_SIZE; | ||
| 399 | |||
| 400 | skb->data_len += PAGE_SIZE; | ||
| 401 | skb->len += PAGE_SIZE; | ||
| 402 | skb->truesize += PAGE_SIZE; | ||
| 403 | skb_shinfo(skb)->nr_frags++; | ||
| 404 | |||
| 405 | if (len < PAGE_SIZE) { | ||
| 406 | len = 0; | ||
| 407 | break; | ||
| 408 | } | ||
| 409 | len -= PAGE_SIZE; | ||
| 410 | } | ||
| 411 | |||
| 412 | /* Too large, or alloc fail? */ | ||
| 413 | if (unlikely(len)) { | ||
| 414 | kfree_skb(skb); | ||
| 415 | skb = NULL; | ||
| 416 | } | ||
| 417 | |||
| 418 | return skb; | ||
| 419 | } | ||
| 420 | |||
| 361 | /* Get packet from user space buffer */ | 421 | /* Get packet from user space buffer */ |
| 362 | static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, size_t count) | 422 | static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, size_t count) |
| 363 | { | 423 | { |
| @@ -391,14 +451,12 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, | |||
| 391 | return -EINVAL; | 451 | return -EINVAL; |
| 392 | } | 452 | } |
| 393 | 453 | ||
| 394 | if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { | 454 | if (!(skb = tun_alloc_skb(align, len, gso.hdr_len, GFP_KERNEL))) { |
| 395 | tun->dev->stats.rx_dropped++; | 455 | tun->dev->stats.rx_dropped++; |
| 396 | return -ENOMEM; | 456 | return -ENOMEM; |
| 397 | } | 457 | } |
| 398 | 458 | ||
| 399 | if (align) | 459 | if (skb_copy_datagram_from_iovec(skb, 0, iv, len)) { |
| 400 | skb_reserve(skb, align); | ||
| 401 | if (memcpy_fromiovec(skb_put(skb, len), iv, len)) { | ||
| 402 | tun->dev->stats.rx_dropped++; | 460 | tun->dev->stats.rx_dropped++; |
| 403 | kfree_skb(skb); | 461 | kfree_skb(skb); |
| 404 | return -EFAULT; | 462 | return -EFAULT; |
| @@ -748,6 +806,36 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
| 748 | return err; | 806 | return err; |
| 749 | } | 807 | } |
| 750 | 808 | ||
| 809 | static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr) | ||
| 810 | { | ||
| 811 | struct tun_struct *tun = file->private_data; | ||
| 812 | |||
| 813 | if (!tun) | ||
| 814 | return -EBADFD; | ||
| 815 | |||
| 816 | DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name); | ||
| 817 | |||
| 818 | strcpy(ifr->ifr_name, tun->dev->name); | ||
| 819 | |||
| 820 | ifr->ifr_flags = 0; | ||
| 821 | |||
| 822 | if (ifr->ifr_flags & TUN_TUN_DEV) | ||
| 823 | ifr->ifr_flags |= IFF_TUN; | ||
| 824 | else | ||
| 825 | ifr->ifr_flags |= IFF_TAP; | ||
| 826 | |||
| 827 | if (tun->flags & TUN_NO_PI) | ||
| 828 | ifr->ifr_flags |= IFF_NO_PI; | ||
| 829 | |||
| 830 | if (tun->flags & TUN_ONE_QUEUE) | ||
| 831 | ifr->ifr_flags |= IFF_ONE_QUEUE; | ||
| 832 | |||
| 833 | if (tun->flags & TUN_VNET_HDR) | ||
| 834 | ifr->ifr_flags |= IFF_VNET_HDR; | ||
| 835 | |||
| 836 | return 0; | ||
| 837 | } | ||
| 838 | |||
| 751 | /* This is like a cut-down ethtool ops, except done via tun fd so no | 839 | /* This is like a cut-down ethtool ops, except done via tun fd so no |
| 752 | * privs required. */ | 840 | * privs required. */ |
| 753 | static int set_offload(struct net_device *dev, unsigned long arg) | 841 | static int set_offload(struct net_device *dev, unsigned long arg) |
| @@ -833,6 +921,15 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
| 833 | DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); | 921 | DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); |
| 834 | 922 | ||
| 835 | switch (cmd) { | 923 | switch (cmd) { |
| 924 | case TUNGETIFF: | ||
| 925 | ret = tun_get_iff(current->nsproxy->net_ns, file, &ifr); | ||
| 926 | if (ret) | ||
| 927 | return ret; | ||
| 928 | |||
| 929 | if (copy_to_user(argp, &ifr, sizeof(ifr))) | ||
| 930 | return -EFAULT; | ||
| 931 | break; | ||
| 932 | |||
| 836 | case TUNSETNOCSUM: | 933 | case TUNSETNOCSUM: |
| 837 | /* Disable/Enable checksum */ | 934 | /* Disable/Enable checksum */ |
| 838 | if (arg) | 935 | if (arg) |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 8549f1159a30..734ce0977f02 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
| @@ -128,7 +128,6 @@ static const int multicast_filter_limit = 32; | |||
| 128 | #include <asm/io.h> | 128 | #include <asm/io.h> |
| 129 | #include <asm/uaccess.h> | 129 | #include <asm/uaccess.h> |
| 130 | #include <linux/in6.h> | 130 | #include <linux/in6.h> |
| 131 | #include <linux/version.h> | ||
| 132 | #include <linux/dma-mapping.h> | 131 | #include <linux/dma-mapping.h> |
| 133 | 132 | ||
| 134 | #include "typhoon.h" | 133 | #include "typhoon.h" |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 68e198bd538b..0973b6e37024 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
| @@ -154,17 +154,6 @@ config USB_NET_AX8817X | |||
| 154 | This driver creates an interface named "ethX", where X depends on | 154 | This driver creates an interface named "ethX", where X depends on |
| 155 | what other networking devices you have in use. | 155 | what other networking devices you have in use. |
| 156 | 156 | ||
| 157 | config USB_HSO | ||
| 158 | tristate "Option USB High Speed Mobile Devices" | ||
| 159 | depends on USB && RFKILL | ||
| 160 | default n | ||
| 161 | help | ||
| 162 | Choose this option if you have an Option HSDPA/HSUPA card. | ||
| 163 | These cards support downlink speeds of 7.2Mbps or greater. | ||
| 164 | |||
| 165 | To compile this driver as a module, choose M here: the | ||
| 166 | module will be called hso. | ||
| 167 | |||
| 168 | config USB_NET_CDCETHER | 157 | config USB_NET_CDCETHER |
| 169 | tristate "CDC Ethernet support (smart devices such as cable modems)" | 158 | tristate "CDC Ethernet support (smart devices such as cable modems)" |
| 170 | depends on USB_USBNET | 159 | depends on USB_USBNET |
| @@ -337,5 +326,15 @@ config USB_NET_ZAURUS | |||
| 337 | really need this non-conformant variant of CDC Ethernet (or in | 326 | really need this non-conformant variant of CDC Ethernet (or in |
| 338 | some cases CDC MDLM) protocol, not "g_ether". | 327 | some cases CDC MDLM) protocol, not "g_ether". |
| 339 | 328 | ||
| 329 | config USB_HSO | ||
| 330 | tristate "Option USB High Speed Mobile Devices" | ||
| 331 | depends on USB && RFKILL | ||
| 332 | default n | ||
| 333 | help | ||
| 334 | Choose this option if you have an Option HSDPA/HSUPA card. | ||
| 335 | These cards support downlink speeds of 7.2Mbps or greater. | ||
| 336 | |||
| 337 | To compile this driver as a module, choose M here: the | ||
| 338 | module will be called hso. | ||
| 340 | 339 | ||
| 341 | endmenu | 340 | endmenu |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 031d07b105af..6e42b5a8c22b 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
| @@ -102,8 +102,12 @@ | |||
| 102 | 102 | ||
| 103 | #define MAX_RX_URBS 2 | 103 | #define MAX_RX_URBS 2 |
| 104 | 104 | ||
| 105 | #define get_serial_by_tty(x) \ | 105 | static inline struct hso_serial *get_serial_by_tty(struct tty_struct *tty) |
| 106 | (x ? (struct hso_serial *)x->driver_data : NULL) | 106 | { |
| 107 | if (tty) | ||
| 108 | return tty->driver_data; | ||
| 109 | return NULL; | ||
| 110 | } | ||
| 107 | 111 | ||
| 108 | /*****************************************************************************/ | 112 | /*****************************************************************************/ |
| 109 | /* Debugging functions */ | 113 | /* Debugging functions */ |
| @@ -294,24 +298,25 @@ static int hso_get_activity(struct hso_device *hso_dev); | |||
| 294 | 298 | ||
| 295 | /* #define DEBUG */ | 299 | /* #define DEBUG */ |
| 296 | 300 | ||
| 297 | #define dev2net(x) (x->port_data.dev_net) | 301 | static inline struct hso_net *dev2net(struct hso_device *hso_dev) |
| 298 | #define dev2ser(x) (x->port_data.dev_serial) | 302 | { |
| 303 | return hso_dev->port_data.dev_net; | ||
| 304 | } | ||
| 305 | |||
| 306 | static inline struct hso_serial *dev2ser(struct hso_device *hso_dev) | ||
| 307 | { | ||
| 308 | return hso_dev->port_data.dev_serial; | ||
| 309 | } | ||
| 299 | 310 | ||
| 300 | /* Debugging functions */ | 311 | /* Debugging functions */ |
| 301 | #ifdef DEBUG | 312 | #ifdef DEBUG |
| 302 | static void dbg_dump(int line_count, const char *func_name, unsigned char *buf, | 313 | static void dbg_dump(int line_count, const char *func_name, unsigned char *buf, |
| 303 | unsigned int len) | 314 | unsigned int len) |
| 304 | { | 315 | { |
| 305 | u8 i = 0; | 316 | static char name[255]; |
| 306 | 317 | ||
| 307 | printk(KERN_DEBUG "[%d:%s]: len %d", line_count, func_name, len); | 318 | sprintf(name, "hso[%d:%s]", line_count, func_name); |
| 308 | 319 | print_hex_dump_bytes(name, DUMP_PREFIX_NONE, buf, len); | |
| 309 | for (i = 0; i < len; i++) { | ||
| 310 | if (!(i % 16)) | ||
| 311 | printk("\n 0x%03x: ", i); | ||
| 312 | printk("%02x ", (unsigned char)buf[i]); | ||
| 313 | } | ||
| 314 | printk("\n"); | ||
| 315 | } | 320 | } |
| 316 | 321 | ||
| 317 | #define DUMP(buf_, len_) \ | 322 | #define DUMP(buf_, len_) \ |
| @@ -392,7 +397,7 @@ static const struct usb_device_id hso_ids[] = { | |||
| 392 | {default_port_device(0x0af0, 0xc031)}, /* Icon-Edge */ | 397 | {default_port_device(0x0af0, 0xc031)}, /* Icon-Edge */ |
| 393 | {icon321_port_device(0x0af0, 0xd013)}, /* Module HSxPA */ | 398 | {icon321_port_device(0x0af0, 0xd013)}, /* Module HSxPA */ |
| 394 | {icon321_port_device(0x0af0, 0xd031)}, /* Icon-321 */ | 399 | {icon321_port_device(0x0af0, 0xd031)}, /* Icon-321 */ |
| 395 | {default_port_device(0x0af0, 0xd033)}, /* Icon-322 */ | 400 | {icon321_port_device(0x0af0, 0xd033)}, /* Icon-322 */ |
| 396 | {USB_DEVICE(0x0af0, 0x7301)}, /* GE40x */ | 401 | {USB_DEVICE(0x0af0, 0x7301)}, /* GE40x */ |
| 397 | {USB_DEVICE(0x0af0, 0x7361)}, /* GE40x */ | 402 | {USB_DEVICE(0x0af0, 0x7361)}, /* GE40x */ |
| 398 | {USB_DEVICE(0x0af0, 0x7401)}, /* GI 0401 */ | 403 | {USB_DEVICE(0x0af0, 0x7401)}, /* GI 0401 */ |
| @@ -528,13 +533,12 @@ static struct hso_serial *get_serial_by_shared_int_and_type( | |||
| 528 | 533 | ||
| 529 | static struct hso_serial *get_serial_by_index(unsigned index) | 534 | static struct hso_serial *get_serial_by_index(unsigned index) |
| 530 | { | 535 | { |
| 531 | struct hso_serial *serial; | 536 | struct hso_serial *serial = NULL; |
| 532 | unsigned long flags; | 537 | unsigned long flags; |
| 533 | 538 | ||
| 534 | if (!serial_table[index]) | ||
| 535 | return NULL; | ||
| 536 | spin_lock_irqsave(&serial_table_lock, flags); | 539 | spin_lock_irqsave(&serial_table_lock, flags); |
| 537 | serial = dev2ser(serial_table[index]); | 540 | if (serial_table[index]) |
| 541 | serial = dev2ser(serial_table[index]); | ||
| 538 | spin_unlock_irqrestore(&serial_table_lock, flags); | 542 | spin_unlock_irqrestore(&serial_table_lock, flags); |
| 539 | 543 | ||
| 540 | return serial; | 544 | return serial; |
| @@ -561,6 +565,7 @@ static int get_free_serial_index(void) | |||
| 561 | static void set_serial_by_index(unsigned index, struct hso_serial *serial) | 565 | static void set_serial_by_index(unsigned index, struct hso_serial *serial) |
| 562 | { | 566 | { |
| 563 | unsigned long flags; | 567 | unsigned long flags; |
| 568 | |||
| 564 | spin_lock_irqsave(&serial_table_lock, flags); | 569 | spin_lock_irqsave(&serial_table_lock, flags); |
| 565 | if (serial) | 570 | if (serial) |
| 566 | serial_table[index] = serial->parent; | 571 | serial_table[index] = serial->parent; |
| @@ -569,7 +574,7 @@ static void set_serial_by_index(unsigned index, struct hso_serial *serial) | |||
| 569 | spin_unlock_irqrestore(&serial_table_lock, flags); | 574 | spin_unlock_irqrestore(&serial_table_lock, flags); |
| 570 | } | 575 | } |
| 571 | 576 | ||
| 572 | /* log a meaningfull explanation of an USB status */ | 577 | /* log a meaningful explanation of an USB status */ |
| 573 | static void log_usb_status(int status, const char *function) | 578 | static void log_usb_status(int status, const char *function) |
| 574 | { | 579 | { |
| 575 | char *explanation; | 580 | char *explanation; |
| @@ -1103,8 +1108,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) | |||
| 1103 | /* reset the rts and dtr */ | 1108 | /* reset the rts and dtr */ |
| 1104 | /* do the actual close */ | 1109 | /* do the actual close */ |
| 1105 | serial->open_count--; | 1110 | serial->open_count--; |
| 1111 | kref_put(&serial->parent->ref, hso_serial_ref_free); | ||
| 1106 | if (serial->open_count <= 0) { | 1112 | if (serial->open_count <= 0) { |
| 1107 | kref_put(&serial->parent->ref, hso_serial_ref_free); | ||
| 1108 | serial->open_count = 0; | 1113 | serial->open_count = 0; |
| 1109 | if (serial->tty) { | 1114 | if (serial->tty) { |
| 1110 | serial->tty->driver_data = NULL; | 1115 | serial->tty->driver_data = NULL; |
| @@ -1467,7 +1472,8 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb) | |||
| 1467 | return; | 1472 | return; |
| 1468 | } | 1473 | } |
| 1469 | hso_put_activity(serial->parent); | 1474 | hso_put_activity(serial->parent); |
| 1470 | tty_wakeup(serial->tty); | 1475 | if (serial->tty) |
| 1476 | tty_wakeup(serial->tty); | ||
| 1471 | hso_kick_transmit(serial); | 1477 | hso_kick_transmit(serial); |
| 1472 | 1478 | ||
| 1473 | D1(" "); | 1479 | D1(" "); |
| @@ -1538,7 +1544,8 @@ static void ctrl_callback(struct urb *urb) | |||
| 1538 | clear_bit(HSO_SERIAL_FLAG_RX_SENT, &serial->flags); | 1544 | clear_bit(HSO_SERIAL_FLAG_RX_SENT, &serial->flags); |
| 1539 | } else { | 1545 | } else { |
| 1540 | hso_put_activity(serial->parent); | 1546 | hso_put_activity(serial->parent); |
| 1541 | tty_wakeup(serial->tty); | 1547 | if (serial->tty) |
| 1548 | tty_wakeup(serial->tty); | ||
| 1542 | /* response to a write command */ | 1549 | /* response to a write command */ |
| 1543 | hso_kick_transmit(serial); | 1550 | hso_kick_transmit(serial); |
| 1544 | } | 1551 | } |
| @@ -2606,6 +2613,7 @@ static int hso_resume(struct usb_interface *iface) | |||
| 2606 | "Transmitting lingering data\n"); | 2613 | "Transmitting lingering data\n"); |
| 2607 | hso_net_start_xmit(hso_net->skb_tx_buf, | 2614 | hso_net_start_xmit(hso_net->skb_tx_buf, |
| 2608 | hso_net->net); | 2615 | hso_net->net); |
| 2616 | hso_net->skb_tx_buf = NULL; | ||
| 2609 | } | 2617 | } |
| 2610 | result = hso_start_net_device(network_table[i]); | 2618 | result = hso_start_net_device(network_table[i]); |
| 2611 | if (result) | 2619 | if (result) |
| @@ -2652,7 +2660,7 @@ static void hso_free_interface(struct usb_interface *interface) | |||
| 2652 | hso_stop_net_device(network_table[i]); | 2660 | hso_stop_net_device(network_table[i]); |
| 2653 | cancel_work_sync(&network_table[i]->async_put_intf); | 2661 | cancel_work_sync(&network_table[i]->async_put_intf); |
| 2654 | cancel_work_sync(&network_table[i]->async_get_intf); | 2662 | cancel_work_sync(&network_table[i]->async_get_intf); |
| 2655 | if(rfk) | 2663 | if (rfk) |
| 2656 | rfkill_unregister(rfk); | 2664 | rfkill_unregister(rfk); |
| 2657 | hso_free_net_device(network_table[i]); | 2665 | hso_free_net_device(network_table[i]); |
| 2658 | } | 2666 | } |
| @@ -2723,7 +2731,7 @@ static int hso_mux_submit_intr_urb(struct hso_shared_int *shared_int, | |||
| 2723 | } | 2731 | } |
| 2724 | 2732 | ||
| 2725 | /* operations setup of the serial interface */ | 2733 | /* operations setup of the serial interface */ |
| 2726 | static struct tty_operations hso_serial_ops = { | 2734 | static const struct tty_operations hso_serial_ops = { |
| 2727 | .open = hso_serial_open, | 2735 | .open = hso_serial_open, |
| 2728 | .close = hso_serial_close, | 2736 | .close = hso_serial_close, |
| 2729 | .write = hso_serial_write, | 2737 | .write = hso_serial_write, |
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index c3d119f997f5..ca9d00c1194e 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c | |||
| @@ -46,6 +46,10 @@ | |||
| 46 | 46 | ||
| 47 | #define MCS7830_VENDOR_ID 0x9710 | 47 | #define MCS7830_VENDOR_ID 0x9710 |
| 48 | #define MCS7830_PRODUCT_ID 0x7830 | 48 | #define MCS7830_PRODUCT_ID 0x7830 |
| 49 | #define MCS7730_PRODUCT_ID 0x7730 | ||
| 50 | |||
| 51 | #define SITECOM_VENDOR_ID 0x0DF6 | ||
| 52 | #define LN_030_PRODUCT_ID 0x0021 | ||
| 49 | 53 | ||
| 50 | #define MCS7830_MII_ADVERTISE (ADVERTISE_PAUSE_CAP | ADVERTISE_100FULL | \ | 54 | #define MCS7830_MII_ADVERTISE (ADVERTISE_PAUSE_CAP | ADVERTISE_100FULL | \ |
| 51 | ADVERTISE_100HALF | ADVERTISE_10FULL | \ | 55 | ADVERTISE_100HALF | ADVERTISE_10FULL | \ |
| @@ -442,6 +446,29 @@ static struct ethtool_ops mcs7830_ethtool_ops = { | |||
| 442 | .nway_reset = usbnet_nway_reset, | 446 | .nway_reset = usbnet_nway_reset, |
| 443 | }; | 447 | }; |
| 444 | 448 | ||
| 449 | static int mcs7830_set_mac_address(struct net_device *netdev, void *p) | ||
| 450 | { | ||
| 451 | int ret; | ||
| 452 | struct usbnet *dev = netdev_priv(netdev); | ||
| 453 | struct sockaddr *addr = p; | ||
| 454 | |||
| 455 | if (netif_running(netdev)) | ||
| 456 | return -EBUSY; | ||
| 457 | |||
| 458 | if (!is_valid_ether_addr(addr->sa_data)) | ||
| 459 | return -EINVAL; | ||
| 460 | |||
| 461 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | ||
| 462 | |||
| 463 | ret = mcs7830_set_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN, | ||
| 464 | netdev->dev_addr); | ||
| 465 | |||
| 466 | if (ret < 0) | ||
| 467 | return ret; | ||
| 468 | |||
| 469 | return 0; | ||
| 470 | } | ||
| 471 | |||
| 445 | static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) | 472 | static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) |
| 446 | { | 473 | { |
| 447 | struct net_device *net = dev->net; | 474 | struct net_device *net = dev->net; |
| @@ -455,6 +482,7 @@ static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) | |||
| 455 | net->ethtool_ops = &mcs7830_ethtool_ops; | 482 | net->ethtool_ops = &mcs7830_ethtool_ops; |
| 456 | net->set_multicast_list = mcs7830_set_multicast; | 483 | net->set_multicast_list = mcs7830_set_multicast; |
| 457 | mcs7830_set_multicast(net); | 484 | mcs7830_set_multicast(net); |
| 485 | net->set_mac_address = mcs7830_set_mac_address; | ||
| 458 | 486 | ||
| 459 | /* reserve space for the status byte on rx */ | 487 | /* reserve space for the status byte on rx */ |
| 460 | dev->rx_urb_size = ETH_FRAME_LEN + 1; | 488 | dev->rx_urb_size = ETH_FRAME_LEN + 1; |
| @@ -491,7 +519,16 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
| 491 | } | 519 | } |
| 492 | 520 | ||
| 493 | static const struct driver_info moschip_info = { | 521 | static const struct driver_info moschip_info = { |
| 494 | .description = "MOSCHIP 7830 usb-NET adapter", | 522 | .description = "MOSCHIP 7830/7730 usb-NET adapter", |
| 523 | .bind = mcs7830_bind, | ||
| 524 | .rx_fixup = mcs7830_rx_fixup, | ||
| 525 | .flags = FLAG_ETHER, | ||
| 526 | .in = 1, | ||
| 527 | .out = 2, | ||
| 528 | }; | ||
| 529 | |||
| 530 | static const struct driver_info sitecom_info = { | ||
| 531 | .description = "Sitecom LN-30 usb-NET adapter", | ||
| 495 | .bind = mcs7830_bind, | 532 | .bind = mcs7830_bind, |
| 496 | .rx_fixup = mcs7830_rx_fixup, | 533 | .rx_fixup = mcs7830_rx_fixup, |
| 497 | .flags = FLAG_ETHER, | 534 | .flags = FLAG_ETHER, |
| @@ -504,6 +541,14 @@ static const struct usb_device_id products[] = { | |||
| 504 | USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID), | 541 | USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID), |
| 505 | .driver_info = (unsigned long) &moschip_info, | 542 | .driver_info = (unsigned long) &moschip_info, |
| 506 | }, | 543 | }, |
| 544 | { | ||
| 545 | USB_DEVICE(MCS7830_VENDOR_ID, MCS7730_PRODUCT_ID), | ||
| 546 | .driver_info = (unsigned long) &moschip_info, | ||
| 547 | }, | ||
| 548 | { | ||
| 549 | USB_DEVICE(SITECOM_VENDOR_ID, LN_030_PRODUCT_ID), | ||
| 550 | .driver_info = (unsigned long) &sitecom_info, | ||
| 551 | }, | ||
| 507 | {}, | 552 | {}, |
| 508 | }; | 553 | }; |
| 509 | MODULE_DEVICE_TABLE(usb, products); | 554 | MODULE_DEVICE_TABLE(usb, products); |
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index a84ba487c713..8c19307e5040 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
| @@ -117,7 +117,7 @@ static void ctrl_callback(struct urb *urb) | |||
| 117 | case -ENOENT: | 117 | case -ENOENT: |
| 118 | break; | 118 | break; |
| 119 | default: | 119 | default: |
| 120 | if (netif_msg_drv(pegasus)) | 120 | if (netif_msg_drv(pegasus) && printk_ratelimit()) |
| 121 | dev_dbg(&pegasus->intf->dev, "%s, status %d\n", | 121 | dev_dbg(&pegasus->intf->dev, "%s, status %d\n", |
| 122 | __FUNCTION__, urb->status); | 122 | __FUNCTION__, urb->status); |
| 123 | } | 123 | } |
| @@ -166,7 +166,7 @@ static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size, | |||
| 166 | set_current_state(TASK_RUNNING); | 166 | set_current_state(TASK_RUNNING); |
| 167 | if (ret == -ENODEV) | 167 | if (ret == -ENODEV) |
| 168 | netif_device_detach(pegasus->net); | 168 | netif_device_detach(pegasus->net); |
| 169 | if (netif_msg_drv(pegasus)) | 169 | if (netif_msg_drv(pegasus) && printk_ratelimit()) |
| 170 | dev_err(&pegasus->intf->dev, "%s, status %d\n", | 170 | dev_err(&pegasus->intf->dev, "%s, status %d\n", |
| 171 | __FUNCTION__, ret); | 171 | __FUNCTION__, ret); |
| 172 | goto out; | 172 | goto out; |
| @@ -275,7 +275,7 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data) | |||
| 275 | if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) { | 275 | if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) { |
| 276 | if (ret == -ENODEV) | 276 | if (ret == -ENODEV) |
| 277 | netif_device_detach(pegasus->net); | 277 | netif_device_detach(pegasus->net); |
| 278 | if (netif_msg_drv(pegasus)) | 278 | if (netif_msg_drv(pegasus) && printk_ratelimit()) |
| 279 | dev_err(&pegasus->intf->dev, "%s, status %d\n", | 279 | dev_err(&pegasus->intf->dev, "%s, status %d\n", |
| 280 | __FUNCTION__, ret); | 280 | __FUNCTION__, ret); |
| 281 | goto out; | 281 | goto out; |
| @@ -1209,8 +1209,7 @@ static void pegasus_set_multicast(struct net_device *net) | |||
| 1209 | pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS; | 1209 | pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS; |
| 1210 | if (netif_msg_link(pegasus)) | 1210 | if (netif_msg_link(pegasus)) |
| 1211 | pr_info("%s: Promiscuous mode enabled.\n", net->name); | 1211 | pr_info("%s: Promiscuous mode enabled.\n", net->name); |
| 1212 | } else if (net->mc_count || | 1212 | } else if (net->mc_count || (net->flags & IFF_ALLMULTI)) { |
| 1213 | (net->flags & IFF_ALLMULTI)) { | ||
| 1214 | pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST; | 1213 | pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST; |
| 1215 | pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; | 1214 | pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; |
| 1216 | if (netif_msg_link(pegasus)) | 1215 | if (netif_msg_link(pegasus)) |
| @@ -1220,6 +1219,8 @@ static void pegasus_set_multicast(struct net_device *net) | |||
| 1220 | pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; | 1219 | pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; |
| 1221 | } | 1220 | } |
| 1222 | 1221 | ||
| 1222 | pegasus->ctrl_urb->status = 0; | ||
| 1223 | |||
| 1223 | pegasus->flags |= ETH_REGS_CHANGE; | 1224 | pegasus->flags |= ETH_REGS_CHANGE; |
| 1224 | ctrl_callback(pegasus->ctrl_urb); | 1225 | ctrl_callback(pegasus->ctrl_urb); |
| 1225 | } | 1226 | } |
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index e59255a155a9..6596cd0742b9 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
| @@ -1317,7 +1317,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd ) | |||
| 1317 | break; | 1317 | break; |
| 1318 | 1318 | ||
| 1319 | case SIOCDEVRESINSTATS : | 1319 | case SIOCDEVRESINSTATS : |
| 1320 | if( current->euid != 0 ) /* root only */ | 1320 | if (!capable(CAP_NET_ADMIN)) |
| 1321 | return -EPERM; | 1321 | return -EPERM; |
| 1322 | memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); | 1322 | memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); |
| 1323 | break; | 1323 | break; |
| @@ -1334,7 +1334,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd ) | |||
| 1334 | break; | 1334 | break; |
| 1335 | 1335 | ||
| 1336 | case SIOCDEVSHWSTATE : | 1336 | case SIOCDEVSHWSTATE : |
| 1337 | if( current->euid != 0 ) /* root only */ | 1337 | if (!capable(CAP_NET_ADMIN)) |
| 1338 | return -EPERM; | 1338 | return -EPERM; |
| 1339 | 1339 | ||
| 1340 | spin_lock( &nl->lock ); | 1340 | spin_lock( &nl->lock ); |
| @@ -1355,7 +1355,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd ) | |||
| 1355 | #ifdef CONFIG_SBNI_MULTILINE | 1355 | #ifdef CONFIG_SBNI_MULTILINE |
| 1356 | 1356 | ||
| 1357 | case SIOCDEVENSLAVE : | 1357 | case SIOCDEVENSLAVE : |
| 1358 | if( current->euid != 0 ) /* root only */ | 1358 | if (!capable(CAP_NET_ADMIN)) |
| 1359 | return -EPERM; | 1359 | return -EPERM; |
| 1360 | 1360 | ||
| 1361 | if (copy_from_user( slave_name, ifr->ifr_data, sizeof slave_name )) | 1361 | if (copy_from_user( slave_name, ifr->ifr_data, sizeof slave_name )) |
| @@ -1370,7 +1370,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd ) | |||
| 1370 | return enslave( dev, slave_dev ); | 1370 | return enslave( dev, slave_dev ); |
| 1371 | 1371 | ||
| 1372 | case SIOCDEVEMANSIPATE : | 1372 | case SIOCDEVEMANSIPATE : |
| 1373 | if( current->euid != 0 ) /* root only */ | 1373 | if (!capable(CAP_NET_ADMIN)) |
| 1374 | return -EPERM; | 1374 | return -EPERM; |
| 1375 | 1375 | ||
| 1376 | return emancipate( dev ); | 1376 | return emancipate( dev ); |
diff --git a/drivers/net/wd.c b/drivers/net/wd.c index 6f9aa1643743..fa14255282af 100644 --- a/drivers/net/wd.c +++ b/drivers/net/wd.c | |||
| @@ -337,7 +337,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr) | |||
| 337 | #ifdef CONFIG_NET_POLL_CONTROLLER | 337 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 338 | dev->poll_controller = ei_poll; | 338 | dev->poll_controller = ei_poll; |
| 339 | #endif | 339 | #endif |
| 340 | NS8390p_init(dev, 0); | 340 | NS8390_init(dev, 0); |
| 341 | 341 | ||
| 342 | #if 1 | 342 | #if 1 |
| 343 | /* Enable interrupt generation on softconfig cards -- M.U */ | 343 | /* Enable interrupt generation on softconfig cards -- M.U */ |
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index 2028866f5995..0676c6d84383 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c | |||
| @@ -40,7 +40,6 @@ | |||
| 40 | * | 40 | * |
| 41 | */ | 41 | */ |
| 42 | 42 | ||
| 43 | #include <linux/version.h> | ||
| 44 | #include <linux/module.h> | 43 | #include <linux/module.h> |
| 45 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
| 46 | #include <linux/hardirq.h> | 45 | #include <linux/hardirq.h> |
| @@ -252,7 +251,7 @@ static inline void ath5k_txbuf_free(struct ath5k_softc *sc, | |||
| 252 | return; | 251 | return; |
| 253 | pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len, | 252 | pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len, |
| 254 | PCI_DMA_TODEVICE); | 253 | PCI_DMA_TODEVICE); |
| 255 | dev_kfree_skb(bf->skb); | 254 | dev_kfree_skb_any(bf->skb); |
| 256 | bf->skb = NULL; | 255 | bf->skb = NULL; |
| 257 | } | 256 | } |
| 258 | 257 | ||
| @@ -467,6 +466,7 @@ ath5k_pci_probe(struct pci_dev *pdev, | |||
| 467 | mutex_init(&sc->lock); | 466 | mutex_init(&sc->lock); |
| 468 | spin_lock_init(&sc->rxbuflock); | 467 | spin_lock_init(&sc->rxbuflock); |
| 469 | spin_lock_init(&sc->txbuflock); | 468 | spin_lock_init(&sc->txbuflock); |
| 469 | spin_lock_init(&sc->block); | ||
| 470 | 470 | ||
| 471 | /* Set private data */ | 471 | /* Set private data */ |
| 472 | pci_set_drvdata(pdev, hw); | 472 | pci_set_drvdata(pdev, hw); |
| @@ -587,7 +587,6 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 587 | ath5k_stop_hw(sc); | 587 | ath5k_stop_hw(sc); |
| 588 | 588 | ||
| 589 | free_irq(pdev->irq, sc); | 589 | free_irq(pdev->irq, sc); |
| 590 | pci_disable_msi(pdev); | ||
| 591 | pci_save_state(pdev); | 590 | pci_save_state(pdev); |
| 592 | pci_disable_device(pdev); | 591 | pci_disable_device(pdev); |
| 593 | pci_set_power_state(pdev, PCI_D3hot); | 592 | pci_set_power_state(pdev, PCI_D3hot); |
| @@ -616,12 +615,10 @@ ath5k_pci_resume(struct pci_dev *pdev) | |||
| 616 | */ | 615 | */ |
| 617 | pci_write_config_byte(pdev, 0x41, 0); | 616 | pci_write_config_byte(pdev, 0x41, 0); |
| 618 | 617 | ||
| 619 | pci_enable_msi(pdev); | ||
| 620 | |||
| 621 | err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc); | 618 | err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc); |
| 622 | if (err) { | 619 | if (err) { |
| 623 | ATH5K_ERR(sc, "request_irq failed\n"); | 620 | ATH5K_ERR(sc, "request_irq failed\n"); |
| 624 | goto err_msi; | 621 | goto err_no_irq; |
| 625 | } | 622 | } |
| 626 | 623 | ||
| 627 | err = ath5k_init(sc); | 624 | err = ath5k_init(sc); |
| @@ -642,8 +639,7 @@ ath5k_pci_resume(struct pci_dev *pdev) | |||
| 642 | return 0; | 639 | return 0; |
| 643 | err_irq: | 640 | err_irq: |
| 644 | free_irq(pdev->irq, sc); | 641 | free_irq(pdev->irq, sc); |
| 645 | err_msi: | 642 | err_no_irq: |
| 646 | pci_disable_msi(pdev); | ||
| 647 | pci_disable_device(pdev); | 643 | pci_disable_device(pdev); |
| 648 | return err; | 644 | return err; |
| 649 | } | 645 | } |
| @@ -2184,8 +2180,11 @@ ath5k_beacon_config(struct ath5k_softc *sc) | |||
| 2184 | 2180 | ||
| 2185 | sc->imask |= AR5K_INT_SWBA; | 2181 | sc->imask |= AR5K_INT_SWBA; |
| 2186 | 2182 | ||
| 2187 | if (ath5k_hw_hasveol(ah)) | 2183 | if (ath5k_hw_hasveol(ah)) { |
| 2184 | spin_lock(&sc->block); | ||
| 2188 | ath5k_beacon_send(sc); | 2185 | ath5k_beacon_send(sc); |
| 2186 | spin_unlock(&sc->block); | ||
| 2187 | } | ||
| 2189 | } | 2188 | } |
| 2190 | /* TODO else AP */ | 2189 | /* TODO else AP */ |
| 2191 | 2190 | ||
| @@ -2408,7 +2407,9 @@ ath5k_intr(int irq, void *dev_id) | |||
| 2408 | TSF_TO_TU(tsf), | 2407 | TSF_TO_TU(tsf), |
| 2409 | (unsigned long long) tsf); | 2408 | (unsigned long long) tsf); |
| 2410 | } else { | 2409 | } else { |
| 2410 | spin_lock(&sc->block); | ||
| 2411 | ath5k_beacon_send(sc); | 2411 | ath5k_beacon_send(sc); |
| 2412 | spin_unlock(&sc->block); | ||
| 2412 | } | 2413 | } |
| 2413 | } | 2414 | } |
| 2414 | if (status & AR5K_INT_RXEOL) { | 2415 | if (status & AR5K_INT_RXEOL) { |
| @@ -2750,6 +2751,11 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, | |||
| 2750 | ret = -EOPNOTSUPP; | 2751 | ret = -EOPNOTSUPP; |
| 2751 | goto end; | 2752 | goto end; |
| 2752 | } | 2753 | } |
| 2754 | |||
| 2755 | /* Set to a reasonable value. Note that this will | ||
| 2756 | * be set to mac80211's value at ath5k_config(). */ | ||
| 2757 | sc->bintval = 1000; | ||
| 2758 | |||
| 2753 | ret = 0; | 2759 | ret = 0; |
| 2754 | end: | 2760 | end: |
| 2755 | mutex_unlock(&sc->lock); | 2761 | mutex_unlock(&sc->lock); |
| @@ -2794,9 +2800,6 @@ ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
| 2794 | struct ath5k_hw *ah = sc->ah; | 2800 | struct ath5k_hw *ah = sc->ah; |
| 2795 | int ret; | 2801 | int ret; |
| 2796 | 2802 | ||
| 2797 | /* Set to a reasonable value. Note that this will | ||
| 2798 | * be set to mac80211's value at ath5k_config(). */ | ||
| 2799 | sc->bintval = 1000; | ||
| 2800 | mutex_lock(&sc->lock); | 2803 | mutex_lock(&sc->lock); |
| 2801 | if (sc->vif != vif) { | 2804 | if (sc->vif != vif) { |
| 2802 | ret = -EIO; | 2805 | ret = -EIO; |
| @@ -3055,6 +3058,7 @@ static int | |||
| 3055 | ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | 3058 | ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) |
| 3056 | { | 3059 | { |
| 3057 | struct ath5k_softc *sc = hw->priv; | 3060 | struct ath5k_softc *sc = hw->priv; |
| 3061 | unsigned long flags; | ||
| 3058 | int ret; | 3062 | int ret; |
| 3059 | 3063 | ||
| 3060 | ath5k_debug_dump_skb(sc, skb, "BC ", 1); | 3064 | ath5k_debug_dump_skb(sc, skb, "BC ", 1); |
| @@ -3064,12 +3068,14 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 3064 | goto end; | 3068 | goto end; |
| 3065 | } | 3069 | } |
| 3066 | 3070 | ||
| 3071 | spin_lock_irqsave(&sc->block, flags); | ||
| 3067 | ath5k_txbuf_free(sc, sc->bbuf); | 3072 | ath5k_txbuf_free(sc, sc->bbuf); |
| 3068 | sc->bbuf->skb = skb; | 3073 | sc->bbuf->skb = skb; |
| 3069 | ret = ath5k_beacon_setup(sc, sc->bbuf); | 3074 | ret = ath5k_beacon_setup(sc, sc->bbuf); |
| 3070 | if (ret) | 3075 | if (ret) |
| 3071 | sc->bbuf->skb = NULL; | 3076 | sc->bbuf->skb = NULL; |
| 3072 | else { | 3077 | spin_unlock_irqrestore(&sc->block, flags); |
| 3078 | if (!ret) { | ||
| 3073 | ath5k_beacon_config(sc); | 3079 | ath5k_beacon_config(sc); |
| 3074 | mmiowb(); | 3080 | mmiowb(); |
| 3075 | } | 3081 | } |
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h index d7e03e6b8271..7ec2f377d5c7 100644 --- a/drivers/net/wireless/ath5k/base.h +++ b/drivers/net/wireless/ath5k/base.h | |||
| @@ -172,6 +172,7 @@ struct ath5k_softc { | |||
| 172 | struct tasklet_struct txtq; /* tx intr tasklet */ | 172 | struct tasklet_struct txtq; /* tx intr tasklet */ |
| 173 | struct ath5k_led tx_led; /* tx led */ | 173 | struct ath5k_led tx_led; /* tx led */ |
| 174 | 174 | ||
| 175 | spinlock_t block; /* protects beacon */ | ||
| 175 | struct ath5k_buf *bbuf; /* beacon buffer */ | 176 | struct ath5k_buf *bbuf; /* beacon buffer */ |
| 176 | unsigned int bhalq, /* SW q for outgoing beacons */ | 177 | unsigned int bhalq, /* SW q for outgoing beacons */ |
| 177 | bmisscount, /* missed beacon transmits */ | 178 | bmisscount, /* missed beacon transmits */ |
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c index caf569401a34..00a0eaa08866 100644 --- a/drivers/net/wireless/ath9k/beacon.c +++ b/drivers/net/wireless/ath9k/beacon.c | |||
| @@ -209,6 +209,7 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) | |||
| 209 | unsigned int curlen; | 209 | unsigned int curlen; |
| 210 | struct ath_txq *cabq; | 210 | struct ath_txq *cabq; |
| 211 | struct ath_txq *mcastq; | 211 | struct ath_txq *mcastq; |
| 212 | struct ieee80211_tx_info *info; | ||
| 212 | avp = sc->sc_vaps[if_id]; | 213 | avp = sc->sc_vaps[if_id]; |
| 213 | 214 | ||
| 214 | mcastq = &avp->av_mcastq; | 215 | mcastq = &avp->av_mcastq; |
| @@ -232,6 +233,18 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) | |||
| 232 | */ | 233 | */ |
| 233 | curlen = skb->len; | 234 | curlen = skb->len; |
| 234 | 235 | ||
| 236 | info = IEEE80211_SKB_CB(skb); | ||
| 237 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | ||
| 238 | /* | ||
| 239 | * TODO: make sure the seq# gets assigned properly (vs. other | ||
| 240 | * TX frames) | ||
| 241 | */ | ||
| 242 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
| 243 | sc->seq_no += 0x10; | ||
| 244 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
| 245 | hdr->seq_ctrl |= cpu_to_le16(sc->seq_no); | ||
| 246 | } | ||
| 247 | |||
| 235 | /* XXX: spin_lock_bh should not be used here, but sparse bitches | 248 | /* XXX: spin_lock_bh should not be used here, but sparse bitches |
| 236 | * otherwise. We should fix sparse :) */ | 249 | * otherwise. We should fix sparse :) */ |
| 237 | spin_lock_bh(&mcastq->axq_lock); | 250 | spin_lock_bh(&mcastq->axq_lock); |
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c index f6c45288d0e7..87e37bc39145 100644 --- a/drivers/net/wireless/ath9k/core.c +++ b/drivers/net/wireless/ath9k/core.c | |||
| @@ -294,8 +294,6 @@ static int ath_stop(struct ath_softc *sc) | |||
| 294 | * hardware is gone (invalid). | 294 | * hardware is gone (invalid). |
| 295 | */ | 295 | */ |
| 296 | 296 | ||
| 297 | if (!sc->sc_invalid) | ||
| 298 | ath9k_hw_set_interrupts(ah, 0); | ||
| 299 | ath_draintxq(sc, false); | 297 | ath_draintxq(sc, false); |
| 300 | if (!sc->sc_invalid) { | 298 | if (!sc->sc_invalid) { |
| 301 | ath_stoprecv(sc); | 299 | ath_stoprecv(sc); |
| @@ -797,6 +795,12 @@ int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan) | |||
| 797 | if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) | 795 | if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) |
| 798 | sc->sc_imask |= ATH9K_INT_CST; | 796 | sc->sc_imask |= ATH9K_INT_CST; |
| 799 | 797 | ||
| 798 | /* Note: We disable MIB interrupts for now as we don't yet | ||
| 799 | * handle processing ANI, otherwise you will get an interrupt | ||
| 800 | * storm after about 7 hours of usage making the system unusable | ||
| 801 | * with huge latency. Once we do have ANI processing included | ||
| 802 | * we can re-enable this interrupt. */ | ||
| 803 | #if 0 | ||
| 800 | /* | 804 | /* |
| 801 | * Enable MIB interrupts when there are hardware phy counters. | 805 | * Enable MIB interrupts when there are hardware phy counters. |
| 802 | * Note we only do this (at the moment) for station mode. | 806 | * Note we only do this (at the moment) for station mode. |
| @@ -804,6 +808,7 @@ int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan) | |||
| 804 | if (ath9k_hw_phycounters(ah) && | 808 | if (ath9k_hw_phycounters(ah) && |
| 805 | ((sc->sc_opmode == ATH9K_M_STA) || (sc->sc_opmode == ATH9K_M_IBSS))) | 809 | ((sc->sc_opmode == ATH9K_M_STA) || (sc->sc_opmode == ATH9K_M_IBSS))) |
| 806 | sc->sc_imask |= ATH9K_INT_MIB; | 810 | sc->sc_imask |= ATH9K_INT_MIB; |
| 811 | #endif | ||
| 807 | /* | 812 | /* |
| 808 | * Some hardware processes the TIM IE and fires an | 813 | * Some hardware processes the TIM IE and fires an |
| 809 | * interrupt when the TIM bit is set. For hardware | 814 | * interrupt when the TIM bit is set. For hardware |
| @@ -1336,6 +1341,8 @@ void ath_deinit(struct ath_softc *sc) | |||
| 1336 | 1341 | ||
| 1337 | DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__); | 1342 | DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__); |
| 1338 | 1343 | ||
| 1344 | tasklet_kill(&sc->intr_tq); | ||
| 1345 | tasklet_kill(&sc->bcon_tasklet); | ||
| 1339 | ath_stop(sc); | 1346 | ath_stop(sc); |
| 1340 | if (!sc->sc_invalid) | 1347 | if (!sc->sc_invalid) |
| 1341 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); | 1348 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); |
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index 673b3d81133a..2f84093331ee 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
| @@ -974,7 +974,6 @@ struct ath_softc { | |||
| 974 | u32 sc_keymax; /* size of key cache */ | 974 | u32 sc_keymax; /* size of key cache */ |
| 975 | DECLARE_BITMAP(sc_keymap, ATH_KEYMAX); /* key use bit map */ | 975 | DECLARE_BITMAP(sc_keymap, ATH_KEYMAX); /* key use bit map */ |
| 976 | u8 sc_splitmic; /* split TKIP MIC keys */ | 976 | u8 sc_splitmic; /* split TKIP MIC keys */ |
| 977 | int sc_keytype; | ||
| 978 | 977 | ||
| 979 | /* RX */ | 978 | /* RX */ |
| 980 | struct list_head sc_rxbuf; | 979 | struct list_head sc_rxbuf; |
| @@ -992,6 +991,7 @@ struct ath_softc { | |||
| 992 | u32 sc_txintrperiod; /* tx interrupt batching */ | 991 | u32 sc_txintrperiod; /* tx interrupt batching */ |
| 993 | int sc_haltype2q[ATH9K_WME_AC_VO+1]; /* HAL WME AC -> h/w qnum */ | 992 | int sc_haltype2q[ATH9K_WME_AC_VO+1]; /* HAL WME AC -> h/w qnum */ |
| 994 | u32 sc_ant_tx[8]; /* recent tx frames/antenna */ | 993 | u32 sc_ant_tx[8]; /* recent tx frames/antenna */ |
| 994 | u16 seq_no; /* TX sequence number */ | ||
| 995 | 995 | ||
| 996 | /* Beacon */ | 996 | /* Beacon */ |
| 997 | struct ath9k_tx_queue_info sc_beacon_qi; | 997 | struct ath9k_tx_queue_info sc_beacon_qi; |
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index bde162f128ab..6dbfed0b4149 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
| @@ -5017,7 +5017,11 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, | |||
| 5017 | 5017 | ||
| 5018 | for (i = 0; i < 123; i++) { | 5018 | for (i = 0; i < 123; i++) { |
| 5019 | if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) { | 5019 | if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) { |
| 5020 | if ((abs(cur_vit_mask - bin)) < 75) | 5020 | |
| 5021 | /* workaround for gcc bug #37014 */ | ||
| 5022 | volatile int tmp = abs(cur_vit_mask - bin); | ||
| 5023 | |||
| 5024 | if (tmp < 75) | ||
| 5021 | mask_amt = 1; | 5025 | mask_amt = 1; |
| 5022 | else | 5026 | else |
| 5023 | mask_amt = 0; | 5027 | mask_amt = 0; |
| @@ -7281,15 +7285,15 @@ ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry, | |||
| 7281 | } | 7285 | } |
| 7282 | break; | 7286 | break; |
| 7283 | case ATH9K_CIPHER_WEP: | 7287 | case ATH9K_CIPHER_WEP: |
| 7284 | if (k->kv_len < 40 / NBBY) { | 7288 | if (k->kv_len < LEN_WEP40) { |
| 7285 | DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, | 7289 | DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, |
| 7286 | "%s: WEP key length %u too small\n", | 7290 | "%s: WEP key length %u too small\n", |
| 7287 | __func__, k->kv_len); | 7291 | __func__, k->kv_len); |
| 7288 | return false; | 7292 | return false; |
| 7289 | } | 7293 | } |
| 7290 | if (k->kv_len <= 40 / NBBY) | 7294 | if (k->kv_len <= LEN_WEP40) |
| 7291 | keyType = AR_KEYTABLE_TYPE_40; | 7295 | keyType = AR_KEYTABLE_TYPE_40; |
| 7292 | else if (k->kv_len <= 104 / NBBY) | 7296 | else if (k->kv_len <= LEN_WEP104) |
| 7293 | keyType = AR_KEYTABLE_TYPE_104; | 7297 | keyType = AR_KEYTABLE_TYPE_104; |
| 7294 | else | 7298 | else |
| 7295 | keyType = AR_KEYTABLE_TYPE_128; | 7299 | keyType = AR_KEYTABLE_TYPE_128; |
| @@ -7309,7 +7313,7 @@ ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry, | |||
| 7309 | key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask; | 7313 | key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask; |
| 7310 | key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff; | 7314 | key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff; |
| 7311 | key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask; | 7315 | key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask; |
| 7312 | if (k->kv_len <= 104 / NBBY) | 7316 | if (k->kv_len <= LEN_WEP104) |
| 7313 | key4 &= 0xff; | 7317 | key4 &= 0xff; |
| 7314 | 7318 | ||
| 7315 | if (keyType == AR_KEYTABLE_TYPE_TKIP && ATH9K_IS_MIC_ENABLED(ah)) { | 7319 | if (keyType == AR_KEYTABLE_TYPE_TKIP && ATH9K_IS_MIC_ENABLED(ah)) { |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 2888778040e4..acebdf1d20a8 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
| @@ -206,7 +206,6 @@ static int ath_key_config(struct ath_softc *sc, | |||
| 206 | if (!ret) | 206 | if (!ret) |
| 207 | return -EIO; | 207 | return -EIO; |
| 208 | 208 | ||
| 209 | sc->sc_keytype = hk.kv_type; | ||
| 210 | return 0; | 209 | return 0; |
| 211 | } | 210 | } |
| 212 | 211 | ||
| @@ -368,6 +367,20 @@ static int ath9k_tx(struct ieee80211_hw *hw, | |||
| 368 | { | 367 | { |
| 369 | struct ath_softc *sc = hw->priv; | 368 | struct ath_softc *sc = hw->priv; |
| 370 | int hdrlen, padsize; | 369 | int hdrlen, padsize; |
| 370 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
| 371 | |||
| 372 | /* | ||
| 373 | * As a temporary workaround, assign seq# here; this will likely need | ||
| 374 | * to be cleaned up to work better with Beacon transmission and virtual | ||
| 375 | * BSSes. | ||
| 376 | */ | ||
| 377 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | ||
| 378 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
| 379 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | ||
| 380 | sc->seq_no += 0x10; | ||
| 381 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
| 382 | hdr->seq_ctrl |= cpu_to_le16(sc->seq_no); | ||
| 383 | } | ||
| 371 | 384 | ||
| 372 | /* Add the padding after the header if this is not already done */ | 385 | /* Add the padding after the header if this is not already done */ |
| 373 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 386 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
| @@ -756,13 +769,13 @@ static int ath9k_set_key(struct ieee80211_hw *hw, | |||
| 756 | key->hw_key_idx = key->keyidx; | 769 | key->hw_key_idx = key->keyidx; |
| 757 | /* push IV and Michael MIC generation to stack */ | 770 | /* push IV and Michael MIC generation to stack */ |
| 758 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 771 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
| 759 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | 772 | if (key->alg == ALG_TKIP) |
| 773 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | ||
| 760 | } | 774 | } |
| 761 | break; | 775 | break; |
| 762 | case DISABLE_KEY: | 776 | case DISABLE_KEY: |
| 763 | ath_key_delete(sc, key); | 777 | ath_key_delete(sc, key); |
| 764 | clear_bit(key->keyidx, sc->sc_keymap); | 778 | clear_bit(key->keyidx, sc->sc_keymap); |
| 765 | sc->sc_keytype = ATH9K_CIPHER_CLR; | ||
| 766 | break; | 779 | break; |
| 767 | default: | 780 | default: |
| 768 | ret = -EINVAL; | 781 | ret = -EINVAL; |
| @@ -1065,8 +1078,16 @@ void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
| 1065 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; | 1078 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; |
| 1066 | tx_status->flags &= ~ATH_TX_BAR; | 1079 | tx_status->flags &= ~ATH_TX_BAR; |
| 1067 | } | 1080 | } |
| 1068 | if (tx_status->flags) | 1081 | |
| 1069 | tx_info->status.excessive_retries = 1; | 1082 | if (tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY)) { |
| 1083 | if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { | ||
| 1084 | /* Frame was not ACKed, but an ACK was expected */ | ||
| 1085 | tx_info->status.excessive_retries = 1; | ||
| 1086 | } | ||
| 1087 | } else { | ||
| 1088 | /* Frame was ACKed */ | ||
| 1089 | tx_info->flags |= IEEE80211_TX_STAT_ACK; | ||
| 1090 | } | ||
| 1070 | 1091 | ||
| 1071 | tx_info->status.retry_count = tx_status->retries; | 1092 | tx_info->status.retry_count = tx_status->retries; |
| 1072 | 1093 | ||
| @@ -1390,10 +1411,17 @@ static void ath_pci_remove(struct pci_dev *pdev) | |||
| 1390 | { | 1411 | { |
| 1391 | struct ieee80211_hw *hw = pci_get_drvdata(pdev); | 1412 | struct ieee80211_hw *hw = pci_get_drvdata(pdev); |
| 1392 | struct ath_softc *sc = hw->priv; | 1413 | struct ath_softc *sc = hw->priv; |
| 1414 | enum ath9k_int status; | ||
| 1393 | 1415 | ||
| 1394 | if (pdev->irq) | 1416 | if (pdev->irq) { |
| 1417 | ath9k_hw_set_interrupts(sc->sc_ah, 0); | ||
| 1418 | /* clear the ISR */ | ||
| 1419 | ath9k_hw_getisr(sc->sc_ah, &status); | ||
| 1420 | sc->sc_invalid = 1; | ||
| 1395 | free_irq(pdev->irq, sc); | 1421 | free_irq(pdev->irq, sc); |
| 1422 | } | ||
| 1396 | ath_detach(sc); | 1423 | ath_detach(sc); |
| 1424 | |||
| 1397 | pci_iounmap(pdev, sc->mem); | 1425 | pci_iounmap(pdev, sc->mem); |
| 1398 | pci_release_region(pdev, 0); | 1426 | pci_release_region(pdev, 0); |
| 1399 | pci_disable_device(pdev); | 1427 | pci_disable_device(pdev); |
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 2fe806175c01..20ddb7acdb94 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
| @@ -360,8 +360,9 @@ static void ath_rx_flush_tid(struct ath_softc *sc, | |||
| 360 | struct ath_arx_tid *rxtid, int drop) | 360 | struct ath_arx_tid *rxtid, int drop) |
| 361 | { | 361 | { |
| 362 | struct ath_rxbuf *rxbuf; | 362 | struct ath_rxbuf *rxbuf; |
| 363 | unsigned long flag; | ||
| 363 | 364 | ||
| 364 | spin_lock_bh(&rxtid->tidlock); | 365 | spin_lock_irqsave(&rxtid->tidlock, flag); |
| 365 | while (rxtid->baw_head != rxtid->baw_tail) { | 366 | while (rxtid->baw_head != rxtid->baw_tail) { |
| 366 | rxbuf = rxtid->rxbuf + rxtid->baw_head; | 367 | rxbuf = rxtid->rxbuf + rxtid->baw_head; |
| 367 | if (!rxbuf->rx_wbuf) { | 368 | if (!rxbuf->rx_wbuf) { |
| @@ -382,7 +383,7 @@ static void ath_rx_flush_tid(struct ath_softc *sc, | |||
| 382 | INCR(rxtid->baw_head, ATH_TID_MAX_BUFS); | 383 | INCR(rxtid->baw_head, ATH_TID_MAX_BUFS); |
| 383 | INCR(rxtid->seq_next, IEEE80211_SEQ_MAX); | 384 | INCR(rxtid->seq_next, IEEE80211_SEQ_MAX); |
| 384 | } | 385 | } |
| 385 | spin_unlock_bh(&rxtid->tidlock); | 386 | spin_unlock_irqrestore(&rxtid->tidlock, flag); |
| 386 | } | 387 | } |
| 387 | 388 | ||
| 388 | static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, | 389 | static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, |
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c index 157f830ee6b8..8b332e11a656 100644 --- a/drivers/net/wireless/ath9k/xmit.c +++ b/drivers/net/wireless/ath9k/xmit.c | |||
| @@ -315,11 +315,11 @@ static int ath_tx_prepare(struct ath_softc *sc, | |||
| 315 | txctl->keyix = tx_info->control.hw_key->hw_key_idx; | 315 | txctl->keyix = tx_info->control.hw_key->hw_key_idx; |
| 316 | txctl->frmlen += tx_info->control.icv_len; | 316 | txctl->frmlen += tx_info->control.icv_len; |
| 317 | 317 | ||
| 318 | if (sc->sc_keytype == ATH9K_CIPHER_WEP) | 318 | if (tx_info->control.hw_key->alg == ALG_WEP) |
| 319 | txctl->keytype = ATH9K_KEY_TYPE_WEP; | 319 | txctl->keytype = ATH9K_KEY_TYPE_WEP; |
| 320 | else if (sc->sc_keytype == ATH9K_CIPHER_TKIP) | 320 | else if (tx_info->control.hw_key->alg == ALG_TKIP) |
| 321 | txctl->keytype = ATH9K_KEY_TYPE_TKIP; | 321 | txctl->keytype = ATH9K_KEY_TYPE_TKIP; |
| 322 | else if (sc->sc_keytype == ATH9K_CIPHER_AES_CCM) | 322 | else if (tx_info->control.hw_key->alg == ALG_CCMP) |
| 323 | txctl->keytype = ATH9K_KEY_TYPE_AES; | 323 | txctl->keytype = ATH9K_KEY_TYPE_AES; |
| 324 | } | 324 | } |
| 325 | 325 | ||
| @@ -357,9 +357,9 @@ static int ath_tx_prepare(struct ath_softc *sc, | |||
| 357 | txctl->flags = ATH9K_TXDESC_CLRDMASK; /* needed for crypto errors */ | 357 | txctl->flags = ATH9K_TXDESC_CLRDMASK; /* needed for crypto errors */ |
| 358 | 358 | ||
| 359 | if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) | 359 | if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) |
| 360 | tx_info->flags |= ATH9K_TXDESC_NOACK; | 360 | txctl->flags |= ATH9K_TXDESC_NOACK; |
| 361 | if (tx_info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) | 361 | if (tx_info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) |
| 362 | tx_info->flags |= ATH9K_TXDESC_RTSENA; | 362 | txctl->flags |= ATH9K_TXDESC_RTSENA; |
| 363 | 363 | ||
| 364 | /* | 364 | /* |
| 365 | * Setup for rate calculations. | 365 | * Setup for rate calculations. |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index bd35bb0a1480..bd65c485098c 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
| @@ -1304,7 +1304,7 @@ EXPORT_SYMBOL(atmel_open); | |||
| 1304 | int atmel_open(struct net_device *dev) | 1304 | int atmel_open(struct net_device *dev) |
| 1305 | { | 1305 | { |
| 1306 | struct atmel_private *priv = netdev_priv(dev); | 1306 | struct atmel_private *priv = netdev_priv(dev); |
| 1307 | int i, channel; | 1307 | int i, channel, err; |
| 1308 | 1308 | ||
| 1309 | /* any scheduled timer is no longer needed and might screw things up.. */ | 1309 | /* any scheduled timer is no longer needed and might screw things up.. */ |
| 1310 | del_timer_sync(&priv->management_timer); | 1310 | del_timer_sync(&priv->management_timer); |
| @@ -1328,8 +1328,9 @@ int atmel_open(struct net_device *dev) | |||
| 1328 | priv->site_survey_state = SITE_SURVEY_IDLE; | 1328 | priv->site_survey_state = SITE_SURVEY_IDLE; |
| 1329 | priv->station_is_associated = 0; | 1329 | priv->station_is_associated = 0; |
| 1330 | 1330 | ||
| 1331 | if (!reset_atmel_card(dev)) | 1331 | err = reset_atmel_card(dev); |
| 1332 | return -EAGAIN; | 1332 | if (err) |
| 1333 | return err; | ||
| 1333 | 1334 | ||
| 1334 | if (priv->config_reg_domain) { | 1335 | if (priv->config_reg_domain) { |
| 1335 | priv->reg_domain = priv->config_reg_domain; | 1336 | priv->reg_domain = priv->config_reg_domain; |
| @@ -3061,12 +3062,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
| 3061 | } | 3062 | } |
| 3062 | 3063 | ||
| 3063 | if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { | 3064 | if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { |
| 3064 | /* Do opensystem first, then try sharedkey */ | 3065 | /* Flip back and forth between WEP auth modes until the max |
| 3066 | * authentication tries has been exceeded. | ||
| 3067 | */ | ||
| 3065 | if (system == WLAN_AUTH_OPEN) { | 3068 | if (system == WLAN_AUTH_OPEN) { |
| 3066 | priv->CurrentAuthentTransactionSeqNum = 0x001; | 3069 | priv->CurrentAuthentTransactionSeqNum = 0x001; |
| 3067 | priv->exclude_unencrypted = 1; | 3070 | priv->exclude_unencrypted = 1; |
| 3068 | send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); | 3071 | send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); |
| 3069 | return; | 3072 | return; |
| 3073 | } else if ( system == WLAN_AUTH_SHARED_KEY | ||
| 3074 | && priv->wep_is_on) { | ||
| 3075 | priv->CurrentAuthentTransactionSeqNum = 0x001; | ||
| 3076 | priv->exclude_unencrypted = 0; | ||
| 3077 | send_authentication_request(priv, WLAN_AUTH_OPEN, NULL, 0); | ||
| 3078 | return; | ||
| 3070 | } else if (priv->connect_to_any_BSS) { | 3079 | } else if (priv->connect_to_any_BSS) { |
| 3071 | int bss_index; | 3080 | int bss_index; |
| 3072 | 3081 | ||
| @@ -3580,12 +3589,12 @@ static int atmel_wakeup_firmware(struct atmel_private *priv) | |||
| 3580 | 3589 | ||
| 3581 | if (i == 0) { | 3590 | if (i == 0) { |
| 3582 | printk(KERN_ALERT "%s: MAC failed to boot.\n", priv->dev->name); | 3591 | printk(KERN_ALERT "%s: MAC failed to boot.\n", priv->dev->name); |
| 3583 | return 0; | 3592 | return -EIO; |
| 3584 | } | 3593 | } |
| 3585 | 3594 | ||
| 3586 | if ((priv->host_info_base = atmel_read16(priv->dev, MR2)) == 0xffff) { | 3595 | if ((priv->host_info_base = atmel_read16(priv->dev, MR2)) == 0xffff) { |
| 3587 | printk(KERN_ALERT "%s: card missing.\n", priv->dev->name); | 3596 | printk(KERN_ALERT "%s: card missing.\n", priv->dev->name); |
| 3588 | return 0; | 3597 | return -ENODEV; |
| 3589 | } | 3598 | } |
| 3590 | 3599 | ||
| 3591 | /* now check for completion of MAC initialization through | 3600 | /* now check for completion of MAC initialization through |
| @@ -3609,19 +3618,19 @@ static int atmel_wakeup_firmware(struct atmel_private *priv) | |||
| 3609 | if (i == 0) { | 3618 | if (i == 0) { |
| 3610 | printk(KERN_ALERT "%s: MAC failed to initialise.\n", | 3619 | printk(KERN_ALERT "%s: MAC failed to initialise.\n", |
| 3611 | priv->dev->name); | 3620 | priv->dev->name); |
| 3612 | return 0; | 3621 | return -EIO; |
| 3613 | } | 3622 | } |
| 3614 | 3623 | ||
| 3615 | /* Check for MAC_INIT_OK only on the register that the MAC_INIT_OK was set */ | 3624 | /* Check for MAC_INIT_OK only on the register that the MAC_INIT_OK was set */ |
| 3616 | if ((mr3 & MAC_INIT_COMPLETE) && | 3625 | if ((mr3 & MAC_INIT_COMPLETE) && |
| 3617 | !(atmel_read16(priv->dev, MR3) & MAC_INIT_OK)) { | 3626 | !(atmel_read16(priv->dev, MR3) & MAC_INIT_OK)) { |
| 3618 | printk(KERN_ALERT "%s: MAC failed MR3 self-test.\n", priv->dev->name); | 3627 | printk(KERN_ALERT "%s: MAC failed MR3 self-test.\n", priv->dev->name); |
| 3619 | return 0; | 3628 | return -EIO; |
| 3620 | } | 3629 | } |
| 3621 | if ((mr1 & MAC_INIT_COMPLETE) && | 3630 | if ((mr1 & MAC_INIT_COMPLETE) && |
| 3622 | !(atmel_read16(priv->dev, MR1) & MAC_INIT_OK)) { | 3631 | !(atmel_read16(priv->dev, MR1) & MAC_INIT_OK)) { |
| 3623 | printk(KERN_ALERT "%s: MAC failed MR1 self-test.\n", priv->dev->name); | 3632 | printk(KERN_ALERT "%s: MAC failed MR1 self-test.\n", priv->dev->name); |
| 3624 | return 0; | 3633 | return -EIO; |
| 3625 | } | 3634 | } |
| 3626 | 3635 | ||
| 3627 | atmel_copy_to_host(priv->dev, (unsigned char *)iface, | 3636 | atmel_copy_to_host(priv->dev, (unsigned char *)iface, |
| @@ -3642,7 +3651,7 @@ static int atmel_wakeup_firmware(struct atmel_private *priv) | |||
| 3642 | iface->func_ctrl = le16_to_cpu(iface->func_ctrl); | 3651 | iface->func_ctrl = le16_to_cpu(iface->func_ctrl); |
| 3643 | iface->mac_status = le16_to_cpu(iface->mac_status); | 3652 | iface->mac_status = le16_to_cpu(iface->mac_status); |
| 3644 | 3653 | ||
| 3645 | return 1; | 3654 | return 0; |
| 3646 | } | 3655 | } |
| 3647 | 3656 | ||
| 3648 | /* determine type of memory and MAC address */ | 3657 | /* determine type of memory and MAC address */ |
| @@ -3693,7 +3702,7 @@ static int probe_atmel_card(struct net_device *dev) | |||
| 3693 | /* Standard firmware in flash, boot it up and ask | 3702 | /* Standard firmware in flash, boot it up and ask |
| 3694 | for the Mac Address */ | 3703 | for the Mac Address */ |
| 3695 | priv->card_type = CARD_TYPE_SPI_FLASH; | 3704 | priv->card_type = CARD_TYPE_SPI_FLASH; |
| 3696 | if (atmel_wakeup_firmware(priv)) { | 3705 | if (atmel_wakeup_firmware(priv) == 0) { |
| 3697 | atmel_get_mib(priv, Mac_Address_Mib_Type, 0, dev->dev_addr, 6); | 3706 | atmel_get_mib(priv, Mac_Address_Mib_Type, 0, dev->dev_addr, 6); |
| 3698 | 3707 | ||
| 3699 | /* got address, now squash it again until the network | 3708 | /* got address, now squash it again until the network |
| @@ -3835,6 +3844,7 @@ static int reset_atmel_card(struct net_device *dev) | |||
| 3835 | struct atmel_private *priv = netdev_priv(dev); | 3844 | struct atmel_private *priv = netdev_priv(dev); |
| 3836 | u8 configuration; | 3845 | u8 configuration; |
| 3837 | int old_state = priv->station_state; | 3846 | int old_state = priv->station_state; |
| 3847 | int err = 0; | ||
| 3838 | 3848 | ||
| 3839 | /* data to add to the firmware names, in priority order | 3849 | /* data to add to the firmware names, in priority order |
| 3840 | this implemenents firmware versioning */ | 3850 | this implemenents firmware versioning */ |
| @@ -3868,11 +3878,12 @@ static int reset_atmel_card(struct net_device *dev) | |||
| 3868 | dev->name); | 3878 | dev->name); |
| 3869 | strcpy(priv->firmware_id, "atmel_at76c502.bin"); | 3879 | strcpy(priv->firmware_id, "atmel_at76c502.bin"); |
| 3870 | } | 3880 | } |
| 3871 | if (request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev) != 0) { | 3881 | err = request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev); |
| 3882 | if (err != 0) { | ||
| 3872 | printk(KERN_ALERT | 3883 | printk(KERN_ALERT |
| 3873 | "%s: firmware %s is missing, cannot continue.\n", | 3884 | "%s: firmware %s is missing, cannot continue.\n", |
| 3874 | dev->name, priv->firmware_id); | 3885 | dev->name, priv->firmware_id); |
| 3875 | return 0; | 3886 | return err; |
| 3876 | } | 3887 | } |
| 3877 | } else { | 3888 | } else { |
| 3878 | int fw_index = 0; | 3889 | int fw_index = 0; |
| @@ -3901,7 +3912,7 @@ static int reset_atmel_card(struct net_device *dev) | |||
| 3901 | "%s: firmware %s is missing, cannot start.\n", | 3912 | "%s: firmware %s is missing, cannot start.\n", |
| 3902 | dev->name, priv->firmware_id); | 3913 | dev->name, priv->firmware_id); |
| 3903 | priv->firmware_id[0] = '\0'; | 3914 | priv->firmware_id[0] = '\0'; |
| 3904 | return 0; | 3915 | return -ENOENT; |
| 3905 | } | 3916 | } |
| 3906 | } | 3917 | } |
| 3907 | 3918 | ||
| @@ -3926,8 +3937,9 @@ static int reset_atmel_card(struct net_device *dev) | |||
| 3926 | release_firmware(fw_entry); | 3937 | release_firmware(fw_entry); |
| 3927 | } | 3938 | } |
| 3928 | 3939 | ||
| 3929 | if (!atmel_wakeup_firmware(priv)) | 3940 | err = atmel_wakeup_firmware(priv); |
| 3930 | return 0; | 3941 | if (err != 0) |
| 3942 | return err; | ||
| 3931 | 3943 | ||
| 3932 | /* Check the version and set the correct flag for wpa stuff, | 3944 | /* Check the version and set the correct flag for wpa stuff, |
| 3933 | old and new firmware is incompatible. | 3945 | old and new firmware is incompatible. |
| @@ -3968,10 +3980,9 @@ static int reset_atmel_card(struct net_device *dev) | |||
| 3968 | if (!priv->radio_on_broken) { | 3980 | if (!priv->radio_on_broken) { |
| 3969 | if (atmel_send_command_wait(priv, CMD_EnableRadio, NULL, 0) == | 3981 | if (atmel_send_command_wait(priv, CMD_EnableRadio, NULL, 0) == |
| 3970 | CMD_STATUS_REJECTED_RADIO_OFF) { | 3982 | CMD_STATUS_REJECTED_RADIO_OFF) { |
| 3971 | printk(KERN_INFO | 3983 | printk(KERN_INFO "%s: cannot turn the radio on.\n", |
| 3972 | "%s: cannot turn the radio on. (Hey radio, you're beautiful!)\n", | ||
| 3973 | dev->name); | 3984 | dev->name); |
| 3974 | return 0; | 3985 | return -EIO; |
| 3975 | } | 3986 | } |
| 3976 | } | 3987 | } |
| 3977 | 3988 | ||
| @@ -4006,7 +4017,7 @@ static int reset_atmel_card(struct net_device *dev) | |||
| 4006 | wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); | 4017 | wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); |
| 4007 | } | 4018 | } |
| 4008 | 4019 | ||
| 4009 | return 1; | 4020 | return 0; |
| 4010 | } | 4021 | } |
| 4011 | 4022 | ||
| 4012 | static void atmel_send_command(struct atmel_private *priv, int command, | 4023 | static void atmel_send_command(struct atmel_private *priv, int command, |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 3bf3a869361f..7205a936ec74 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <linux/moduleparam.h> | 33 | #include <linux/moduleparam.h> |
| 34 | #include <linux/if_arp.h> | 34 | #include <linux/if_arp.h> |
| 35 | #include <linux/etherdevice.h> | 35 | #include <linux/etherdevice.h> |
| 36 | #include <linux/version.h> | ||
| 37 | #include <linux/firmware.h> | 36 | #include <linux/firmware.h> |
| 38 | #include <linux/wireless.h> | 37 | #include <linux/wireless.h> |
| 39 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
| @@ -4615,7 +4614,9 @@ static void b43_sprom_fixup(struct ssb_bus *bus) | |||
| 4615 | if (bus->bustype == SSB_BUSTYPE_PCI) { | 4614 | if (bus->bustype == SSB_BUSTYPE_PCI) { |
| 4616 | pdev = bus->host_pci; | 4615 | pdev = bus->host_pci; |
| 4617 | if (IS_PDEV(pdev, BROADCOM, 0x4318, ASUSTEK, 0x100F) || | 4616 | if (IS_PDEV(pdev, BROADCOM, 0x4318, ASUSTEK, 0x100F) || |
| 4617 | IS_PDEV(pdev, BROADCOM, 0x4320, DELL, 0x0003) || | ||
| 4618 | IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0015) || | 4618 | IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0015) || |
| 4619 | IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0014) || | ||
| 4619 | IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0013)) | 4620 | IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0013)) |
| 4620 | bus->sprom.boardflags_lo &= ~B43_BFL_BTCOEXIST; | 4621 | bus->sprom.boardflags_lo &= ~B43_BFL_BTCOEXIST; |
| 4621 | } | 4622 | } |
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index fec5645944a4..34ae125d5384 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c | |||
| @@ -43,23 +43,6 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) | |||
| 43 | return 0; | 43 | return 0; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /* Update the rfkill state */ | ||
| 47 | static void b43_rfkill_update_state(struct b43_wldev *dev) | ||
| 48 | { | ||
| 49 | struct b43_rfkill *rfk = &(dev->wl->rfkill); | ||
| 50 | |||
| 51 | if (!dev->radio_hw_enable) { | ||
| 52 | rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED; | ||
| 53 | return; | ||
| 54 | } | ||
| 55 | |||
| 56 | if (!dev->phy.radio_on) | ||
| 57 | rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED; | ||
| 58 | else | ||
| 59 | rfk->rfkill->state = RFKILL_STATE_UNBLOCKED; | ||
| 60 | |||
| 61 | } | ||
| 62 | |||
| 63 | /* The poll callback for the hardware button. */ | 46 | /* The poll callback for the hardware button. */ |
| 64 | static void b43_rfkill_poll(struct input_polled_dev *poll_dev) | 47 | static void b43_rfkill_poll(struct input_polled_dev *poll_dev) |
| 65 | { | 48 | { |
| @@ -77,7 +60,6 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev) | |||
| 77 | if (unlikely(enabled != dev->radio_hw_enable)) { | 60 | if (unlikely(enabled != dev->radio_hw_enable)) { |
| 78 | dev->radio_hw_enable = enabled; | 61 | dev->radio_hw_enable = enabled; |
| 79 | report_change = 1; | 62 | report_change = 1; |
| 80 | b43_rfkill_update_state(dev); | ||
| 81 | b43info(wl, "Radio hardware status changed to %s\n", | 63 | b43info(wl, "Radio hardware status changed to %s\n", |
| 82 | enabled ? "ENABLED" : "DISABLED"); | 64 | enabled ? "ENABLED" : "DISABLED"); |
| 83 | } | 65 | } |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 2541c81932f0..1cb77db5c292 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
| 35 | #include <linux/if_arp.h> | 35 | #include <linux/if_arp.h> |
| 36 | #include <linux/etherdevice.h> | 36 | #include <linux/etherdevice.h> |
| 37 | #include <linux/version.h> | ||
| 38 | #include <linux/firmware.h> | 37 | #include <linux/firmware.h> |
| 39 | #include <linux/wireless.h> | 38 | #include <linux/wireless.h> |
| 40 | #include <linux/workqueue.h> | 39 | #include <linux/workqueue.h> |
diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c index 476add97e974..b32bf6a94f19 100644 --- a/drivers/net/wireless/b43legacy/rfkill.c +++ b/drivers/net/wireless/b43legacy/rfkill.c | |||
| @@ -44,23 +44,6 @@ static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev) | |||
| 44 | return 0; | 44 | return 0; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | /* Update the rfkill state */ | ||
| 48 | static void b43legacy_rfkill_update_state(struct b43legacy_wldev *dev) | ||
| 49 | { | ||
| 50 | struct b43legacy_rfkill *rfk = &(dev->wl->rfkill); | ||
| 51 | |||
| 52 | if (!dev->radio_hw_enable) { | ||
| 53 | rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED; | ||
| 54 | return; | ||
| 55 | } | ||
| 56 | |||
| 57 | if (!dev->phy.radio_on) | ||
| 58 | rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED; | ||
| 59 | else | ||
| 60 | rfk->rfkill->state = RFKILL_STATE_UNBLOCKED; | ||
| 61 | |||
| 62 | } | ||
| 63 | |||
| 64 | /* The poll callback for the hardware button. */ | 47 | /* The poll callback for the hardware button. */ |
| 65 | static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev) | 48 | static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev) |
| 66 | { | 49 | { |
| @@ -78,7 +61,6 @@ static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev) | |||
| 78 | if (unlikely(enabled != dev->radio_hw_enable)) { | 61 | if (unlikely(enabled != dev->radio_hw_enable)) { |
| 79 | dev->radio_hw_enable = enabled; | 62 | dev->radio_hw_enable = enabled; |
| 80 | report_change = 1; | 63 | report_change = 1; |
| 81 | b43legacy_rfkill_update_state(dev); | ||
| 82 | b43legacyinfo(wl, "Radio hardware status changed to %s\n", | 64 | b43legacyinfo(wl, "Radio hardware status changed to %s\n", |
| 83 | enabled ? "ENABLED" : "DISABLED"); | 65 | enabled ? "ENABLED" : "DISABLED"); |
| 84 | } | 66 | } |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index c6f886ec08a3..19a401c4a0dc 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
| @@ -157,7 +157,6 @@ that only one external action is invoked at a time. | |||
| 157 | #include <linux/stringify.h> | 157 | #include <linux/stringify.h> |
| 158 | #include <linux/tcp.h> | 158 | #include <linux/tcp.h> |
| 159 | #include <linux/types.h> | 159 | #include <linux/types.h> |
| 160 | #include <linux/version.h> | ||
| 161 | #include <linux/time.h> | 160 | #include <linux/time.h> |
| 162 | #include <linux/firmware.h> | 161 | #include <linux/firmware.h> |
| 163 | #include <linux/acpi.h> | 162 | #include <linux/acpi.h> |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 36e8d2f6e7b4..dcce3542d5a7 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | ******************************************************************************/ | 31 | ******************************************************************************/ |
| 32 | 32 | ||
| 33 | #include "ipw2200.h" | 33 | #include "ipw2200.h" |
| 34 | #include <linux/version.h> | ||
| 35 | 34 | ||
| 36 | 35 | ||
| 37 | #ifndef KBUILD_EXTMOD | 36 | #ifndef KBUILD_EXTMOD |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c index d3336966b6b5..705c65bed9fd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | 27 | ||
| 28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
| 29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
| 30 | #include <linux/version.h> | ||
| 31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
| 32 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| 33 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index b3931f6135a4..3f51f3635344 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 29 | #include <linux/version.h> | ||
| 30 | #include <linux/init.h> | 29 | #include <linux/init.h> |
| 31 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
| 32 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 22bb26985c2e..23fed3298962 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 29 | #include <linux/version.h> | ||
| 30 | #include <linux/init.h> | 29 | #include <linux/init.h> |
| 31 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
| 32 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
| @@ -475,8 +474,8 @@ static void iwl4965_apm_stop(struct iwl_priv *priv) | |||
| 475 | iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); | 474 | iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); |
| 476 | 475 | ||
| 477 | udelay(10); | 476 | udelay(10); |
| 478 | 477 | /* clear "init complete" move adapter D0A* --> D0U state */ | |
| 479 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 478 | iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
| 480 | spin_unlock_irqrestore(&priv->lock, flags); | 479 | spin_unlock_irqrestore(&priv->lock, flags); |
| 481 | } | 480 | } |
| 482 | 481 | ||
| @@ -967,7 +966,7 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel, | |||
| 967 | 966 | ||
| 968 | s = iwl4965_get_sub_band(priv, channel); | 967 | s = iwl4965_get_sub_band(priv, channel); |
| 969 | if (s >= EEPROM_TX_POWER_BANDS) { | 968 | if (s >= EEPROM_TX_POWER_BANDS) { |
| 970 | IWL_ERROR("Tx Power can not find channel %d ", channel); | 969 | IWL_ERROR("Tx Power can not find channel %d\n", channel); |
| 971 | return -1; | 970 | return -1; |
| 972 | } | 971 | } |
| 973 | 972 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index f3d139b663e6..b08036a9d894 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/version.h> | ||
| 29 | #include <linux/init.h> | 28 | #include <linux/init.h> |
| 30 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
| 31 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
| @@ -146,7 +145,8 @@ static void iwl5000_apm_stop(struct iwl_priv *priv) | |||
| 146 | 145 | ||
| 147 | udelay(10); | 146 | udelay(10); |
| 148 | 147 | ||
| 149 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 148 | /* clear "init complete" move adapter D0A* --> D0U state */ |
| 149 | iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | ||
| 150 | 150 | ||
| 151 | spin_unlock_irqrestore(&priv->lock, flags); | 151 | spin_unlock_irqrestore(&priv->lock, flags); |
| 152 | } | 152 | } |
| @@ -578,14 +578,11 @@ static int iwl5000_load_section(struct iwl_priv *priv, | |||
| 578 | FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), | 578 | FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), |
| 579 | phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); | 579 | phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); |
| 580 | 580 | ||
| 581 | /* FIME: write the MSB of the phy_addr in CTRL1 | ||
| 582 | * iwl_write_direct32(priv, | ||
| 583 | IWL_FH_TFDIB_CTRL1_REG(IWL_FH_SRVC_CHNL), | ||
| 584 | ((phy_addr & MSB_MSK) | ||
| 585 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_count); | ||
| 586 | */ | ||
| 587 | iwl_write_direct32(priv, | 581 | iwl_write_direct32(priv, |
| 588 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), byte_cnt); | 582 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), |
| 583 | (iwl_get_dma_hi_address(phy_addr) | ||
| 584 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); | ||
| 585 | |||
| 589 | iwl_write_direct32(priv, | 586 | iwl_write_direct32(priv, |
| 590 | FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), | 587 | FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), |
| 591 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | | 588 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 754fef5b592f..90a2b6dee7c0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
| @@ -1153,7 +1153,8 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
| 1153 | !sta->ht_info.ht_supported) | 1153 | !sta->ht_info.ht_supported) |
| 1154 | return -1; | 1154 | return -1; |
| 1155 | 1155 | ||
| 1156 | if (priv->current_ht_config.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC) | 1156 | if (((sta->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS) >> 2) |
| 1157 | == IWL_MIMO_PS_STATIC) | ||
| 1157 | return -1; | 1158 | return -1; |
| 1158 | 1159 | ||
| 1159 | /* Need both Tx chains/antennas to support MIMO */ | 1160 | /* Need both Tx chains/antennas to support MIMO */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index ed09e48b1b61..e01f048a02dd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
| 31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
| 32 | #include <linux/version.h> | ||
| 33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
| 34 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
| 35 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
| @@ -182,14 +181,14 @@ static int iwl4965_check_rxon_cmd(struct iwl_rxon_cmd *rxon) | |||
| 182 | } | 181 | } |
| 183 | 182 | ||
| 184 | /** | 183 | /** |
| 185 | * iwl4965_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed | 184 | * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed |
| 186 | * @priv: staging_rxon is compared to active_rxon | 185 | * @priv: staging_rxon is compared to active_rxon |
| 187 | * | 186 | * |
| 188 | * If the RXON structure is changing enough to require a new tune, | 187 | * If the RXON structure is changing enough to require a new tune, |
| 189 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that | 188 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that |
| 190 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. | 189 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. |
| 191 | */ | 190 | */ |
| 192 | static int iwl4965_full_rxon_required(struct iwl_priv *priv) | 191 | static int iwl_full_rxon_required(struct iwl_priv *priv) |
| 193 | { | 192 | { |
| 194 | 193 | ||
| 195 | /* These items are only settable from the full RXON command */ | 194 | /* These items are only settable from the full RXON command */ |
| @@ -208,7 +207,6 @@ static int iwl4965_full_rxon_required(struct iwl_priv *priv) | |||
| 208 | priv->active_rxon.ofdm_ht_single_stream_basic_rates) || | 207 | priv->active_rxon.ofdm_ht_single_stream_basic_rates) || |
| 209 | (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates != | 208 | (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates != |
| 210 | priv->active_rxon.ofdm_ht_dual_stream_basic_rates) || | 209 | priv->active_rxon.ofdm_ht_dual_stream_basic_rates) || |
| 211 | (priv->staging_rxon.rx_chain != priv->active_rxon.rx_chain) || | ||
| 212 | (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id)) | 210 | (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id)) |
| 213 | return 1; | 211 | return 1; |
| 214 | 212 | ||
| @@ -264,7 +262,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
| 264 | /* If we don't need to send a full RXON, we can use | 262 | /* If we don't need to send a full RXON, we can use |
| 265 | * iwl4965_rxon_assoc_cmd which is used to reconfigure filter | 263 | * iwl4965_rxon_assoc_cmd which is used to reconfigure filter |
| 266 | * and other flags for the current radio configuration. */ | 264 | * and other flags for the current radio configuration. */ |
| 267 | if (!iwl4965_full_rxon_required(priv)) { | 265 | if (!iwl_full_rxon_required(priv)) { |
| 268 | ret = iwl_send_rxon_assoc(priv); | 266 | ret = iwl_send_rxon_assoc(priv); |
| 269 | if (ret) { | 267 | if (ret) { |
| 270 | IWL_ERROR("Error setting RXON_ASSOC (%d)\n", ret); | 268 | IWL_ERROR("Error setting RXON_ASSOC (%d)\n", ret); |
| @@ -588,8 +586,6 @@ static void iwl4965_ht_conf(struct iwl_priv *priv, | |||
| 588 | iwl_conf->supported_chan_width = 0; | 586 | iwl_conf->supported_chan_width = 0; |
| 589 | } | 587 | } |
| 590 | 588 | ||
| 591 | iwl_conf->tx_mimo_ps_mode = | ||
| 592 | (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2); | ||
| 593 | memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); | 589 | memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); |
| 594 | 590 | ||
| 595 | iwl_conf->control_channel = ht_bss_conf->primary_channel; | 591 | iwl_conf->control_channel = ht_bss_conf->primary_channel; |
| @@ -2191,7 +2187,10 @@ static void __iwl4965_down(struct iwl_priv *priv) | |||
| 2191 | udelay(5); | 2187 | udelay(5); |
| 2192 | 2188 | ||
| 2193 | /* FIXME: apm_ops.suspend(priv) */ | 2189 | /* FIXME: apm_ops.suspend(priv) */ |
| 2194 | priv->cfg->ops->lib->apm_ops.reset(priv); | 2190 | if (exit_pending || test_bit(STATUS_IN_SUSPEND, &priv->status)) |
| 2191 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
| 2192 | else | ||
| 2193 | priv->cfg->ops->lib->apm_ops.reset(priv); | ||
| 2195 | priv->cfg->ops->lib->free_shared_mem(priv); | 2194 | priv->cfg->ops->lib->free_shared_mem(priv); |
| 2196 | 2195 | ||
| 2197 | exit: | 2196 | exit: |
| @@ -2603,6 +2602,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) | |||
| 2603 | { | 2602 | { |
| 2604 | struct iwl_priv *priv = hw->priv; | 2603 | struct iwl_priv *priv = hw->priv; |
| 2605 | int ret; | 2604 | int ret; |
| 2605 | u16 pci_cmd; | ||
| 2606 | 2606 | ||
| 2607 | IWL_DEBUG_MAC80211("enter\n"); | 2607 | IWL_DEBUG_MAC80211("enter\n"); |
| 2608 | 2608 | ||
| @@ -2613,6 +2613,13 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw) | |||
| 2613 | pci_restore_state(priv->pci_dev); | 2613 | pci_restore_state(priv->pci_dev); |
| 2614 | pci_enable_msi(priv->pci_dev); | 2614 | pci_enable_msi(priv->pci_dev); |
| 2615 | 2615 | ||
| 2616 | /* enable interrupts if needed: hw bug w/a */ | ||
| 2617 | pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); | ||
| 2618 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { | ||
| 2619 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; | ||
| 2620 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); | ||
| 2621 | } | ||
| 2622 | |||
| 2616 | ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, | 2623 | ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, |
| 2617 | DRV_NAME, priv); | 2624 | DRV_NAME, priv); |
| 2618 | if (ret) { | 2625 | if (ret) { |
| @@ -3581,7 +3588,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
| 3581 | 3588 | ||
| 3582 | priv->assoc_id = 0; | 3589 | priv->assoc_id = 0; |
| 3583 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | 3590 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; |
| 3584 | priv->timestamp = le64_to_cpu(timestamp) + (priv->beacon_int * 1000); | 3591 | priv->timestamp = le64_to_cpu(timestamp); |
| 3585 | 3592 | ||
| 3586 | IWL_DEBUG_MAC80211("leave\n"); | 3593 | IWL_DEBUG_MAC80211("leave\n"); |
| 3587 | spin_unlock_irqrestore(&priv->lock, flags); | 3594 | spin_unlock_irqrestore(&priv->lock, flags); |
| @@ -4365,15 +4372,18 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) | |||
| 4365 | iwl_dbgfs_unregister(priv); | 4372 | iwl_dbgfs_unregister(priv); |
| 4366 | sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); | 4373 | sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); |
| 4367 | 4374 | ||
| 4375 | /* ieee80211_unregister_hw call wil cause iwl4965_mac_stop to | ||
| 4376 | * to be called and iwl4965_down since we are removing the device | ||
| 4377 | * we need to set STATUS_EXIT_PENDING bit. | ||
| 4378 | */ | ||
| 4379 | set_bit(STATUS_EXIT_PENDING, &priv->status); | ||
| 4368 | if (priv->mac80211_registered) { | 4380 | if (priv->mac80211_registered) { |
| 4369 | ieee80211_unregister_hw(priv->hw); | 4381 | ieee80211_unregister_hw(priv->hw); |
| 4370 | priv->mac80211_registered = 0; | 4382 | priv->mac80211_registered = 0; |
| 4383 | } else { | ||
| 4384 | iwl4965_down(priv); | ||
| 4371 | } | 4385 | } |
| 4372 | 4386 | ||
| 4373 | set_bit(STATUS_EXIT_PENDING, &priv->status); | ||
| 4374 | |||
| 4375 | iwl4965_down(priv); | ||
| 4376 | |||
| 4377 | /* make sure we flush any pending irq or | 4387 | /* make sure we flush any pending irq or |
| 4378 | * tasklet for the driver | 4388 | * tasklet for the driver |
| 4379 | */ | 4389 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 9bd61809129f..80f2f84defa8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
| 30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
| 31 | #include <linux/version.h> | ||
| 32 | #include <net/mac80211.h> | 31 | #include <net/mac80211.h> |
| 33 | 32 | ||
| 34 | struct iwl_priv; /* FIXME: remove */ | 33 | struct iwl_priv; /* FIXME: remove */ |
| @@ -593,12 +592,11 @@ static void iwlcore_free_geos(struct iwl_priv *priv) | |||
| 593 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); | 592 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); |
| 594 | } | 593 | } |
| 595 | 594 | ||
| 596 | static u8 is_single_rx_stream(struct iwl_priv *priv) | 595 | static bool is_single_rx_stream(struct iwl_priv *priv) |
| 597 | { | 596 | { |
| 598 | return !priv->current_ht_config.is_ht || | 597 | return !priv->current_ht_config.is_ht || |
| 599 | ((priv->current_ht_config.supp_mcs_set[1] == 0) && | 598 | ((priv->current_ht_config.supp_mcs_set[1] == 0) && |
| 600 | (priv->current_ht_config.supp_mcs_set[2] == 0)) || | 599 | (priv->current_ht_config.supp_mcs_set[2] == 0)); |
| 601 | priv->ps_mode == IWL_MIMO_PS_STATIC; | ||
| 602 | } | 600 | } |
| 603 | 601 | ||
| 604 | static u8 iwl_is_channel_extension(struct iwl_priv *priv, | 602 | static u8 iwl_is_channel_extension(struct iwl_priv *priv, |
| @@ -705,33 +703,39 @@ EXPORT_SYMBOL(iwl_set_rxon_ht); | |||
| 705 | * MIMO (dual stream) requires at least 2, but works better with 3. | 703 | * MIMO (dual stream) requires at least 2, but works better with 3. |
| 706 | * This does not determine *which* chains to use, just how many. | 704 | * This does not determine *which* chains to use, just how many. |
| 707 | */ | 705 | */ |
| 708 | static int iwlcore_get_rx_chain_counter(struct iwl_priv *priv, | 706 | static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) |
| 709 | u8 *idle_state, u8 *rx_state) | ||
| 710 | { | 707 | { |
| 711 | u8 is_single = is_single_rx_stream(priv); | 708 | bool is_single = is_single_rx_stream(priv); |
| 712 | u8 is_cam = test_bit(STATUS_POWER_PMI, &priv->status) ? 0 : 1; | 709 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); |
| 713 | 710 | ||
| 714 | /* # of Rx chains to use when expecting MIMO. */ | 711 | /* # of Rx chains to use when expecting MIMO. */ |
| 715 | if (is_single || (!is_cam && (priv->ps_mode == IWL_MIMO_PS_STATIC))) | 712 | if (is_single || (!is_cam && (priv->ps_mode == IWL_MIMO_PS_STATIC))) |
| 716 | *rx_state = 2; | 713 | return 2; |
| 717 | else | 714 | else |
| 718 | *rx_state = 3; | 715 | return 3; |
| 716 | } | ||
| 719 | 717 | ||
| 718 | static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) | ||
| 719 | { | ||
| 720 | int idle_cnt; | ||
| 721 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); | ||
| 720 | /* # Rx chains when idling and maybe trying to save power */ | 722 | /* # Rx chains when idling and maybe trying to save power */ |
| 721 | switch (priv->ps_mode) { | 723 | switch (priv->ps_mode) { |
| 722 | case IWL_MIMO_PS_STATIC: | 724 | case IWL_MIMO_PS_STATIC: |
| 723 | case IWL_MIMO_PS_DYNAMIC: | 725 | case IWL_MIMO_PS_DYNAMIC: |
| 724 | *idle_state = (is_cam) ? 2 : 1; | 726 | idle_cnt = (is_cam) ? 2 : 1; |
| 725 | break; | 727 | break; |
| 726 | case IWL_MIMO_PS_NONE: | 728 | case IWL_MIMO_PS_NONE: |
| 727 | *idle_state = (is_cam) ? *rx_state : 1; | 729 | idle_cnt = (is_cam) ? active_cnt : 1; |
| 728 | break; | 730 | break; |
| 731 | case IWL_MIMO_PS_INVALID: | ||
| 729 | default: | 732 | default: |
| 730 | *idle_state = 1; | 733 | IWL_ERROR("invalide mimo ps mode %d\n", priv->ps_mode); |
| 734 | WARN_ON(1); | ||
| 735 | idle_cnt = -1; | ||
| 731 | break; | 736 | break; |
| 732 | } | 737 | } |
| 733 | 738 | return idle_cnt; | |
| 734 | return 0; | ||
| 735 | } | 739 | } |
| 736 | 740 | ||
| 737 | /** | 741 | /** |
| @@ -742,34 +746,44 @@ static int iwlcore_get_rx_chain_counter(struct iwl_priv *priv, | |||
| 742 | */ | 746 | */ |
| 743 | void iwl_set_rxon_chain(struct iwl_priv *priv) | 747 | void iwl_set_rxon_chain(struct iwl_priv *priv) |
| 744 | { | 748 | { |
| 745 | u8 is_single = is_single_rx_stream(priv); | 749 | bool is_single = is_single_rx_stream(priv); |
| 746 | u8 idle_state, rx_state; | 750 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); |
| 747 | 751 | u8 idle_rx_cnt, active_rx_cnt; | |
| 748 | priv->staging_rxon.rx_chain = 0; | 752 | u16 rx_chain; |
| 749 | rx_state = idle_state = 3; | ||
| 750 | 753 | ||
| 751 | /* Tell uCode which antennas are actually connected. | 754 | /* Tell uCode which antennas are actually connected. |
| 752 | * Before first association, we assume all antennas are connected. | 755 | * Before first association, we assume all antennas are connected. |
| 753 | * Just after first association, iwl_chain_noise_calibration() | 756 | * Just after first association, iwl_chain_noise_calibration() |
| 754 | * checks which antennas actually *are* connected. */ | 757 | * checks which antennas actually *are* connected. */ |
| 755 | priv->staging_rxon.rx_chain |= | 758 | rx_chain = priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; |
| 756 | cpu_to_le16(priv->hw_params.valid_rx_ant << | ||
| 757 | RXON_RX_CHAIN_VALID_POS); | ||
| 758 | 759 | ||
| 759 | /* How many receivers should we use? */ | 760 | /* How many receivers should we use? */ |
| 760 | iwlcore_get_rx_chain_counter(priv, &idle_state, &rx_state); | 761 | active_rx_cnt = iwl_get_active_rx_chain_count(priv); |
| 761 | priv->staging_rxon.rx_chain |= | 762 | idle_rx_cnt = iwl_get_idle_rx_chain_count(priv, active_rx_cnt); |
| 762 | cpu_to_le16(rx_state << RXON_RX_CHAIN_MIMO_CNT_POS); | 763 | |
| 763 | priv->staging_rxon.rx_chain |= | 764 | /* correct rx chain count accoridng hw settings */ |
| 764 | cpu_to_le16(idle_state << RXON_RX_CHAIN_CNT_POS); | 765 | if (priv->hw_params.rx_chains_num < active_rx_cnt) |
| 765 | 766 | active_rx_cnt = priv->hw_params.rx_chains_num; | |
| 766 | if (!is_single && (rx_state >= 2) && | 767 | |
| 767 | !test_bit(STATUS_POWER_PMI, &priv->status)) | 768 | if (priv->hw_params.rx_chains_num < idle_rx_cnt) |
| 769 | idle_rx_cnt = priv->hw_params.rx_chains_num; | ||
| 770 | |||
| 771 | rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; | ||
| 772 | rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; | ||
| 773 | |||
| 774 | priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain); | ||
| 775 | |||
| 776 | if (!is_single && (active_rx_cnt >= 2) && is_cam) | ||
| 768 | priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; | 777 | priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; |
| 769 | else | 778 | else |
| 770 | priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; | 779 | priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; |
| 771 | 780 | ||
| 772 | IWL_DEBUG_ASSOC("rx chain %X\n", priv->staging_rxon.rx_chain); | 781 | IWL_DEBUG_ASSOC("rx_chain=0x%Xi active=%d idle=%d\n", |
| 782 | priv->staging_rxon.rx_chain, | ||
| 783 | active_rx_cnt, idle_rx_cnt); | ||
| 784 | |||
| 785 | WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 || | ||
| 786 | active_rx_cnt < idle_rx_cnt); | ||
| 773 | } | 787 | } |
| 774 | EXPORT_SYMBOL(iwl_set_rxon_chain); | 788 | EXPORT_SYMBOL(iwl_set_rxon_chain); |
| 775 | 789 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index c19db438306c..cdfb343c7ec6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
| @@ -412,7 +412,6 @@ struct iwl_ht_info { | |||
| 412 | /* self configuration data */ | 412 | /* self configuration data */ |
| 413 | u8 is_ht; | 413 | u8 is_ht; |
| 414 | u8 supported_chan_width; | 414 | u8 supported_chan_width; |
| 415 | u16 tx_mimo_ps_mode; | ||
| 416 | u8 is_green_field; | 415 | u8 is_green_field; |
| 417 | u8 sgf; /* HT_SHORT_GI_* short guard interval */ | 416 | u8 sgf; /* HT_SHORT_GI_* short guard interval */ |
| 418 | u8 max_amsdu_size; | 417 | u8 max_amsdu_size; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index bce53830b301..37155755efc5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
| @@ -63,7 +63,6 @@ | |||
| 63 | 63 | ||
| 64 | #include <linux/kernel.h> | 64 | #include <linux/kernel.h> |
| 65 | #include <linux/module.h> | 65 | #include <linux/module.h> |
| 66 | #include <linux/version.h> | ||
| 67 | #include <linux/init.h> | 66 | #include <linux/init.h> |
| 68 | 67 | ||
| 69 | #include <net/mac80211.h> | 68 | #include <net/mac80211.h> |
| @@ -146,7 +145,7 @@ int iwlcore_eeprom_verify_signature(struct iwl_priv *priv) | |||
| 146 | { | 145 | { |
| 147 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); | 146 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); |
| 148 | if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { | 147 | if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { |
| 149 | IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x", gp); | 148 | IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp); |
| 150 | return -ENOENT; | 149 | return -ENOENT; |
| 151 | } | 150 | } |
| 152 | return 0; | 151 | return 0; |
| @@ -227,7 +226,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
| 227 | 226 | ||
| 228 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); | 227 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); |
| 229 | if (ret < 0) { | 228 | if (ret < 0) { |
| 230 | IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x", gp); | 229 | IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp); |
| 231 | ret = -ENOENT; | 230 | ret = -ENOENT; |
| 232 | goto err; | 231 | goto err; |
| 233 | } | 232 | } |
| @@ -254,7 +253,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
| 254 | } | 253 | } |
| 255 | 254 | ||
| 256 | if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { | 255 | if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { |
| 257 | IWL_ERROR("Time out reading EEPROM[%d]", addr); | 256 | IWL_ERROR("Time out reading EEPROM[%d]\n", addr); |
| 258 | ret = -ETIMEDOUT; | 257 | ret = -ETIMEDOUT; |
| 259 | goto done; | 258 | goto done; |
| 260 | } | 259 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index 944642450d3d..cd11c0ca2991 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
| @@ -287,6 +287,7 @@ | |||
| 287 | 287 | ||
| 288 | #define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) | 288 | #define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) |
| 289 | 289 | ||
| 290 | #define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 | ||
| 290 | 291 | ||
| 291 | /** | 292 | /** |
| 292 | * Transmit DMA Channel Control/Status Registers (TCSR) | 293 | * Transmit DMA Channel Control/Status Registers (TCSR) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 6512834bb916..2eb03eea1908 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
| 30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
| 31 | #include <linux/version.h> | ||
| 32 | #include <net/mac80211.h> | 31 | #include <net/mac80211.h> |
| 33 | 32 | ||
| 34 | #include "iwl-dev.h" /* FIXME: remove */ | 33 | #include "iwl-dev.h" /* FIXME: remove */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c index cb11c4a4d691..4eee1b163cd2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-led.c | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | 27 | ||
| 28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
| 29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
| 30 | #include <linux/version.h> | ||
| 31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
| 32 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| 33 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 028e3053c0ca..a099c9e30e55 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
| 31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
| 32 | #include <linux/version.h> | ||
| 33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
| 34 | 33 | ||
| 35 | #include <net/mac80211.h> | 34 | #include <net/mac80211.h> |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c index e5e5846e9f25..5d642298f04c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c +++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
| 28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
| 29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
| 30 | #include <linux/version.h> | ||
| 31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
| 32 | 31 | ||
| 33 | #include <net/mac80211.h> | 32 | #include <net/mac80211.h> |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index f3f6ea49fdd2..e81bfc42a7cb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
| @@ -1173,7 +1173,10 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
| 1173 | 1173 | ||
| 1174 | rx_status.antenna = 0; | 1174 | rx_status.antenna = 0; |
| 1175 | rx_status.flag = 0; | 1175 | rx_status.flag = 0; |
| 1176 | rx_status.flag |= RX_FLAG_TSFT; | 1176 | |
| 1177 | /* TSF isn't reliable. In order to allow smooth user experience, | ||
| 1178 | * this W/A doesn't propagate it to the mac80211 */ | ||
| 1179 | /*rx_status.flag |= RX_FLAG_TSFT;*/ | ||
| 1177 | 1180 | ||
| 1178 | if ((unlikely(rx_start->cfg_phy_cnt > 20))) { | 1181 | if ((unlikely(rx_start->cfg_phy_cnt > 20))) { |
| 1179 | IWL_DEBUG_DROP("dsp size out of range [0,20]: %d/n", | 1182 | IWL_DEBUG_DROP("dsp size out of range [0,20]: %d/n", |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 9bb6adb28b73..6c8ac3a87d54 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
| @@ -421,7 +421,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, | |||
| 421 | else | 421 | else |
| 422 | scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; | 422 | scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; |
| 423 | 423 | ||
| 424 | if ((scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) && n_probes) | 424 | if (n_probes) |
| 425 | scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); | 425 | scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); |
| 426 | 426 | ||
| 427 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | 427 | scan_ch->active_dwell = cpu_to_le16(active_dwell); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 60a6e0106036..6283a3a707f5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
| @@ -207,7 +207,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, | |||
| 207 | case WLAN_HT_CAP_MIMO_PS_DISABLED: | 207 | case WLAN_HT_CAP_MIMO_PS_DISABLED: |
| 208 | break; | 208 | break; |
| 209 | default: | 209 | default: |
| 210 | IWL_WARNING("Invalid MIMO PS mode %d", mimo_ps_mode); | 210 | IWL_WARNING("Invalid MIMO PS mode %d\n", mimo_ps_mode); |
| 211 | break; | 211 | break; |
| 212 | } | 212 | } |
| 213 | 213 | ||
| @@ -969,7 +969,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
| 969 | return priv->hw_params.bcast_sta_id; | 969 | return priv->hw_params.bcast_sta_id; |
| 970 | 970 | ||
| 971 | default: | 971 | default: |
| 972 | IWL_WARNING("Unknown mode of operation: %d", priv->iw_mode); | 972 | IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode); |
| 973 | return priv->hw_params.bcast_sta_id; | 973 | return priv->hw_params.bcast_sta_id; |
| 974 | } | 974 | } |
| 975 | } | 975 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 4108c7c8f00f..78b1a7a4ca40 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
| @@ -402,12 +402,11 @@ static int iwl_hw_tx_queue_init(struct iwl_priv *priv, | |||
| 402 | /** | 402 | /** |
| 403 | * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue | 403 | * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue |
| 404 | */ | 404 | */ |
| 405 | static int iwl_tx_queue_init(struct iwl_priv *priv, | 405 | static int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, |
| 406 | struct iwl_tx_queue *txq, | ||
| 407 | int slots_num, u32 txq_id) | 406 | int slots_num, u32 txq_id) |
| 408 | { | 407 | { |
| 409 | int i, len; | 408 | int i, len; |
| 410 | int rc = 0; | 409 | int ret; |
| 411 | 410 | ||
| 412 | /* | 411 | /* |
| 413 | * Alloc buffer array for commands (Tx or other types of commands). | 412 | * Alloc buffer array for commands (Tx or other types of commands). |
| @@ -426,19 +425,16 @@ static int iwl_tx_queue_init(struct iwl_priv *priv, | |||
| 426 | continue; | 425 | continue; |
| 427 | } | 426 | } |
| 428 | 427 | ||
| 429 | txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA); | 428 | txq->cmd[i] = kmalloc(len, GFP_KERNEL); |
| 430 | if (!txq->cmd[i]) | 429 | if (!txq->cmd[i]) |
| 431 | return -ENOMEM; | 430 | goto err; |
| 432 | } | 431 | } |
| 433 | 432 | ||
| 434 | /* Alloc driver data array and TFD circular buffer */ | 433 | /* Alloc driver data array and TFD circular buffer */ |
| 435 | rc = iwl_tx_queue_alloc(priv, txq, txq_id); | 434 | ret = iwl_tx_queue_alloc(priv, txq, txq_id); |
| 436 | if (rc) { | 435 | if (ret) |
| 437 | for (i = 0; i < slots_num; i++) | 436 | goto err; |
| 438 | kfree(txq->cmd[i]); | ||
| 439 | 437 | ||
| 440 | return -ENOMEM; | ||
| 441 | } | ||
| 442 | txq->need_update = 0; | 438 | txq->need_update = 0; |
| 443 | 439 | ||
| 444 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise | 440 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise |
| @@ -452,6 +448,17 @@ static int iwl_tx_queue_init(struct iwl_priv *priv, | |||
| 452 | iwl_hw_tx_queue_init(priv, txq); | 448 | iwl_hw_tx_queue_init(priv, txq); |
| 453 | 449 | ||
| 454 | return 0; | 450 | return 0; |
| 451 | err: | ||
| 452 | for (i = 0; i < slots_num; i++) { | ||
| 453 | kfree(txq->cmd[i]); | ||
| 454 | txq->cmd[i] = NULL; | ||
| 455 | } | ||
| 456 | |||
| 457 | if (txq_id == IWL_CMD_QUEUE_NUM) { | ||
| 458 | kfree(txq->cmd[slots_num]); | ||
| 459 | txq->cmd[slots_num] = NULL; | ||
| 460 | } | ||
| 461 | return -ENOMEM; | ||
| 455 | } | 462 | } |
| 456 | /** | 463 | /** |
| 457 | * iwl_hw_txq_ctx_free - Free TXQ Context | 464 | * iwl_hw_txq_ctx_free - Free TXQ Context |
| @@ -493,7 +500,7 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv) | |||
| 493 | /* Alloc keep-warm buffer */ | 500 | /* Alloc keep-warm buffer */ |
| 494 | ret = iwl_kw_alloc(priv); | 501 | ret = iwl_kw_alloc(priv); |
| 495 | if (ret) { | 502 | if (ret) { |
| 496 | IWL_ERROR("Keep Warm allocation failed"); | 503 | IWL_ERROR("Keep Warm allocation failed\n"); |
| 497 | goto error_kw; | 504 | goto error_kw; |
| 498 | } | 505 | } |
| 499 | spin_lock_irqsave(&priv->lock, flags); | 506 | spin_lock_irqsave(&priv->lock, flags); |
| @@ -1463,7 +1470,7 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
| 1463 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); | 1470 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); |
| 1464 | 1471 | ||
| 1465 | if (scd_flow >= priv->hw_params.max_txq_num) { | 1472 | if (scd_flow >= priv->hw_params.max_txq_num) { |
| 1466 | IWL_ERROR("BUG_ON scd_flow is bigger than number of queues"); | 1473 | IWL_ERROR("BUG_ON scd_flow is bigger than number of queues\n"); |
| 1467 | return; | 1474 | return; |
| 1468 | } | 1475 | } |
| 1469 | 1476 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 444847ab1b5a..b775d5bab668 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
| 31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
| 32 | #include <linux/version.h> | ||
| 33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
| 34 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
| 35 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
| @@ -1558,7 +1557,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv) | |||
| 1558 | BUILD_BUG_ON(sizeof(priv->eeprom) != IWL_EEPROM_IMAGE_SIZE); | 1557 | BUILD_BUG_ON(sizeof(priv->eeprom) != IWL_EEPROM_IMAGE_SIZE); |
| 1559 | 1558 | ||
| 1560 | if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { | 1559 | if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { |
| 1561 | IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x", gp); | 1560 | IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp); |
| 1562 | return -ENOENT; | 1561 | return -ENOENT; |
| 1563 | } | 1562 | } |
| 1564 | 1563 | ||
| @@ -1583,7 +1582,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv) | |||
| 1583 | } | 1582 | } |
| 1584 | 1583 | ||
| 1585 | if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { | 1584 | if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { |
| 1586 | IWL_ERROR("Time out reading EEPROM[%d]", addr); | 1585 | IWL_ERROR("Time out reading EEPROM[%d]\n", addr); |
| 1587 | return -ETIMEDOUT; | 1586 | return -ETIMEDOUT; |
| 1588 | } | 1587 | } |
| 1589 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); | 1588 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); |
| @@ -2507,7 +2506,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
| 2507 | return priv->hw_setting.bcast_sta_id; | 2506 | return priv->hw_setting.bcast_sta_id; |
| 2508 | 2507 | ||
| 2509 | default: | 2508 | default: |
| 2510 | IWL_WARNING("Unknown mode of operation: %d", priv->iw_mode); | 2509 | IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode); |
| 2511 | return priv->hw_setting.bcast_sta_id; | 2510 | return priv->hw_setting.bcast_sta_id; |
| 2512 | } | 2511 | } |
| 2513 | } | 2512 | } |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 04d7a251e3f0..8941919001bb 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
| @@ -595,7 +595,7 @@ static int if_cs_prog_helper(struct if_cs_card *card) | |||
| 595 | if (ret < 0) { | 595 | if (ret < 0) { |
| 596 | lbs_pr_err("can't download helper at 0x%x, ret %d\n", | 596 | lbs_pr_err("can't download helper at 0x%x, ret %d\n", |
| 597 | sent, ret); | 597 | sent, ret); |
| 598 | goto done; | 598 | goto err_release; |
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | if (count == 0) | 601 | if (count == 0) |
| @@ -604,9 +604,8 @@ static int if_cs_prog_helper(struct if_cs_card *card) | |||
| 604 | sent += count; | 604 | sent += count; |
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | err_release: | ||
| 607 | release_firmware(fw); | 608 | release_firmware(fw); |
| 608 | ret = 0; | ||
| 609 | |||
| 610 | done: | 609 | done: |
| 611 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); | 610 | lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); |
| 612 | return ret; | 611 | return ret; |
| @@ -676,14 +675,8 @@ static int if_cs_prog_real(struct if_cs_card *card) | |||
| 676 | } | 675 | } |
| 677 | 676 | ||
| 678 | ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); | 677 | ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); |
| 679 | if (ret < 0) { | 678 | if (ret < 0) |
| 680 | lbs_pr_err("firmware download failed\n"); | 679 | lbs_pr_err("firmware download failed\n"); |
| 681 | goto err_release; | ||
| 682 | } | ||
| 683 | |||
| 684 | ret = 0; | ||
| 685 | goto done; | ||
| 686 | |||
| 687 | 680 | ||
| 688 | err_release: | 681 | err_release: |
| 689 | release_firmware(fw); | 682 | release_firmware(fw); |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 1ebcafe7ca5f..36c004e15602 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
| @@ -1970,6 +1970,9 @@ __orinoco_set_multicast_list(struct net_device *dev) | |||
| 1970 | priv->promiscuous = promisc; | 1970 | priv->promiscuous = promisc; |
| 1971 | } | 1971 | } |
| 1972 | 1972 | ||
| 1973 | /* If we're not in promiscuous mode, then we need to set the | ||
| 1974 | * group address if either we want to multicast, or if we were | ||
| 1975 | * multicasting and want to stop */ | ||
| 1973 | if (! promisc && (mc_count || priv->mc_count) ) { | 1976 | if (! promisc && (mc_count || priv->mc_count) ) { |
| 1974 | struct dev_mc_list *p = dev->mc_list; | 1977 | struct dev_mc_list *p = dev->mc_list; |
| 1975 | struct hermes_multicast mclist; | 1978 | struct hermes_multicast mclist; |
| @@ -1989,9 +1992,10 @@ __orinoco_set_multicast_list(struct net_device *dev) | |||
| 1989 | printk(KERN_WARNING "%s: Multicast list is " | 1992 | printk(KERN_WARNING "%s: Multicast list is " |
| 1990 | "longer than mc_count\n", dev->name); | 1993 | "longer than mc_count\n", dev->name); |
| 1991 | 1994 | ||
| 1992 | err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFGROUPADDRESSES, | 1995 | err = hermes_write_ltv(hw, USER_BAP, |
| 1993 | HERMES_BYTES_TO_RECLEN(priv->mc_count * ETH_ALEN), | 1996 | HERMES_RID_CNFGROUPADDRESSES, |
| 1994 | &mclist); | 1997 | HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN), |
| 1998 | &mclist); | ||
| 1995 | if (err) | 1999 | if (err) |
| 1996 | printk(KERN_ERR "%s: Error %d setting multicast list.\n", | 2000 | printk(KERN_ERR "%s: Error %d setting multicast list.\n", |
| 1997 | dev->name, err); | 2001 | dev->name, err); |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 83cd85e1f847..29be3dc8ee09 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
| @@ -413,12 +413,12 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 413 | last_addr = range->end_addr; | 413 | last_addr = range->end_addr; |
| 414 | __skb_unlink(entry, &priv->tx_queue); | 414 | __skb_unlink(entry, &priv->tx_queue); |
| 415 | memset(&info->status, 0, sizeof(info->status)); | 415 | memset(&info->status, 0, sizeof(info->status)); |
| 416 | priv->tx_stats[skb_get_queue_mapping(skb)].len--; | ||
| 417 | entry_hdr = (struct p54_control_hdr *) entry->data; | 416 | entry_hdr = (struct p54_control_hdr *) entry->data; |
| 418 | entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; | 417 | entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; |
| 419 | if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) | 418 | if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) |
| 420 | pad = entry_data->align[0]; | 419 | pad = entry_data->align[0]; |
| 421 | 420 | ||
| 421 | priv->tx_stats[entry_data->hw_queue - 4].len--; | ||
| 422 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { | 422 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { |
| 423 | if (!(payload->status & 0x01)) | 423 | if (!(payload->status & 0x01)) |
| 424 | info->flags |= IEEE80211_TX_STAT_ACK; | 424 | info->flags |= IEEE80211_TX_STAT_ACK; |
| @@ -557,6 +557,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 557 | struct p54_tx_control_allocdata *txhdr; | 557 | struct p54_tx_control_allocdata *txhdr; |
| 558 | size_t padding, len; | 558 | size_t padding, len; |
| 559 | u8 rate; | 559 | u8 rate; |
| 560 | u8 cts_rate = 0x20; | ||
| 560 | 561 | ||
| 561 | current_queue = &priv->tx_stats[skb_get_queue_mapping(skb)]; | 562 | current_queue = &priv->tx_stats[skb_get_queue_mapping(skb)]; |
| 562 | if (unlikely(current_queue->len > current_queue->limit)) | 563 | if (unlikely(current_queue->len > current_queue->limit)) |
| @@ -581,28 +582,28 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 581 | hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1); | 582 | hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1); |
| 582 | hdr->retry1 = hdr->retry2 = info->control.retry_limit; | 583 | hdr->retry1 = hdr->retry2 = info->control.retry_limit; |
| 583 | 584 | ||
| 584 | memset(txhdr->wep_key, 0x0, 16); | ||
| 585 | txhdr->padding = 0; | ||
| 586 | txhdr->padding2 = 0; | ||
| 587 | |||
| 588 | /* TODO: add support for alternate retry TX rates */ | 585 | /* TODO: add support for alternate retry TX rates */ |
| 589 | rate = ieee80211_get_tx_rate(dev, info)->hw_value; | 586 | rate = ieee80211_get_tx_rate(dev, info)->hw_value; |
| 590 | if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) | 587 | if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) { |
| 591 | rate |= 0x10; | 588 | rate |= 0x10; |
| 592 | if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) | 589 | cts_rate |= 0x10; |
| 590 | } | ||
| 591 | if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { | ||
| 593 | rate |= 0x40; | 592 | rate |= 0x40; |
| 594 | else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) | 593 | cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value; |
| 594 | } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { | ||
| 595 | rate |= 0x20; | 595 | rate |= 0x20; |
| 596 | cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value; | ||
| 597 | } | ||
| 596 | memset(txhdr->rateset, rate, 8); | 598 | memset(txhdr->rateset, rate, 8); |
| 597 | txhdr->wep_key_present = 0; | 599 | txhdr->key_type = 0; |
| 598 | txhdr->wep_key_len = 0; | 600 | txhdr->key_len = 0; |
| 599 | txhdr->frame_type = cpu_to_le32(skb_get_queue_mapping(skb) + 4); | 601 | txhdr->hw_queue = skb_get_queue_mapping(skb) + 4; |
| 600 | txhdr->magic4 = 0; | 602 | txhdr->tx_antenna = (info->antenna_sel_tx == 0) ? |
| 601 | txhdr->antenna = (info->antenna_sel_tx == 0) ? | ||
| 602 | 2 : info->antenna_sel_tx - 1; | 603 | 2 : info->antenna_sel_tx - 1; |
| 603 | txhdr->output_power = 0x7f; // HW Maximum | 604 | txhdr->output_power = 0x7f; // HW Maximum |
| 604 | txhdr->magic5 = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? | 605 | txhdr->cts_rate = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? |
| 605 | 0 : ((rate > 0x3) ? cpu_to_le32(0x33) : cpu_to_le32(0x23)); | 606 | 0 : cts_rate; |
| 606 | if (padding) | 607 | if (padding) |
| 607 | txhdr->align[0] = padding; | 608 | txhdr->align[0] = padding; |
| 608 | 609 | ||
| @@ -836,10 +837,21 @@ static int p54_start(struct ieee80211_hw *dev) | |||
| 836 | struct p54_common *priv = dev->priv; | 837 | struct p54_common *priv = dev->priv; |
| 837 | int err; | 838 | int err; |
| 838 | 839 | ||
| 840 | if (!priv->cached_vdcf) { | ||
| 841 | priv->cached_vdcf = kzalloc(sizeof(struct p54_tx_control_vdcf)+ | ||
| 842 | priv->tx_hdr_len + sizeof(struct p54_control_hdr), | ||
| 843 | GFP_KERNEL); | ||
| 844 | |||
| 845 | if (!priv->cached_vdcf) | ||
| 846 | return -ENOMEM; | ||
| 847 | } | ||
| 848 | |||
| 839 | err = priv->open(dev); | 849 | err = priv->open(dev); |
| 840 | if (!err) | 850 | if (!err) |
| 841 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 851 | priv->mode = IEEE80211_IF_TYPE_MNTR; |
| 842 | 852 | ||
| 853 | p54_init_vdcf(dev); | ||
| 854 | |||
| 843 | return err; | 855 | return err; |
| 844 | } | 856 | } |
| 845 | 857 | ||
| @@ -1019,15 +1031,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len) | |||
| 1019 | dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 + | 1031 | dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 + |
| 1020 | sizeof(struct p54_tx_control_allocdata); | 1032 | sizeof(struct p54_tx_control_allocdata); |
| 1021 | 1033 | ||
| 1022 | priv->cached_vdcf = kzalloc(sizeof(struct p54_tx_control_vdcf) + | ||
| 1023 | priv->tx_hdr_len + sizeof(struct p54_control_hdr), GFP_KERNEL); | ||
| 1024 | |||
| 1025 | if (!priv->cached_vdcf) { | ||
| 1026 | ieee80211_free_hw(dev); | ||
| 1027 | return NULL; | ||
| 1028 | } | ||
| 1029 | |||
| 1030 | p54_init_vdcf(dev); | ||
| 1031 | mutex_init(&priv->conf_mutex); | 1034 | mutex_init(&priv->conf_mutex); |
| 1032 | 1035 | ||
| 1033 | return dev; | 1036 | return dev; |
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h index 2245fcce92dc..8db6c0e8e540 100644 --- a/drivers/net/wireless/p54/p54common.h +++ b/drivers/net/wireless/p54/p54common.h | |||
| @@ -183,16 +183,16 @@ struct p54_frame_sent_hdr { | |||
| 183 | 183 | ||
| 184 | struct p54_tx_control_allocdata { | 184 | struct p54_tx_control_allocdata { |
| 185 | u8 rateset[8]; | 185 | u8 rateset[8]; |
| 186 | u16 padding; | 186 | u8 unalloc0[2]; |
| 187 | u8 wep_key_present; | 187 | u8 key_type; |
| 188 | u8 wep_key_len; | 188 | u8 key_len; |
| 189 | u8 wep_key[16]; | 189 | u8 key[16]; |
| 190 | __le32 frame_type; | 190 | u8 hw_queue; |
| 191 | u32 padding2; | 191 | u8 unalloc1[9]; |
| 192 | __le16 magic4; | 192 | u8 tx_antenna; |
| 193 | u8 antenna; | ||
| 194 | u8 output_power; | 193 | u8 output_power; |
| 195 | __le32 magic5; | 194 | u8 cts_rate; |
| 195 | u8 unalloc2[3]; | ||
| 196 | u8 align[0]; | 196 | u8 align[0]; |
| 197 | } __attribute__ ((packed)); | 197 | } __attribute__ ((packed)); |
| 198 | 198 | ||
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 815c095ef797..cbaca23a9453 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
| @@ -109,7 +109,17 @@ static void p54u_rx_cb(struct urb *urb) | |||
| 109 | urb->context = skb; | 109 | urb->context = skb; |
| 110 | skb_queue_tail(&priv->rx_queue, skb); | 110 | skb_queue_tail(&priv->rx_queue, skb); |
| 111 | } else { | 111 | } else { |
| 112 | if (!priv->hw_type) | ||
| 113 | skb_push(skb, sizeof(struct net2280_tx_hdr)); | ||
| 114 | |||
| 115 | skb_reset_tail_pointer(skb); | ||
| 112 | skb_trim(skb, 0); | 116 | skb_trim(skb, 0); |
| 117 | if (urb->transfer_buffer != skb_tail_pointer(skb)) { | ||
| 118 | /* this should not happen */ | ||
| 119 | WARN_ON(1); | ||
| 120 | urb->transfer_buffer = skb_tail_pointer(skb); | ||
| 121 | } | ||
| 122 | |||
| 113 | skb_queue_tail(&priv->rx_queue, skb); | 123 | skb_queue_tail(&priv->rx_queue, skb); |
| 114 | } | 124 | } |
| 115 | 125 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index a4a8c57004db..ff78e52ce43c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
| @@ -173,10 +173,10 @@ struct rxdone_entry_desc { | |||
| 173 | * frame transmission failed due to excessive retries. | 173 | * frame transmission failed due to excessive retries. |
| 174 | */ | 174 | */ |
| 175 | enum txdone_entry_desc_flags { | 175 | enum txdone_entry_desc_flags { |
| 176 | TXDONE_UNKNOWN = 1 << 0, | 176 | TXDONE_UNKNOWN, |
| 177 | TXDONE_SUCCESS = 1 << 1, | 177 | TXDONE_SUCCESS, |
| 178 | TXDONE_FAILURE = 1 << 2, | 178 | TXDONE_FAILURE, |
| 179 | TXDONE_EXCESSIVE_RETRY = 1 << 3, | 179 | TXDONE_EXCESSIVE_RETRY, |
| 180 | }; | 180 | }; |
| 181 | 181 | ||
| 182 | /** | 182 | /** |
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h index 7e88ce5651b9..2ea7866abd5d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00reg.h +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h | |||
| @@ -136,7 +136,7 @@ struct rt2x00_field32 { | |||
| 136 | */ | 136 | */ |
| 137 | #define is_power_of_two(x) ( !((x) & ((x)-1)) ) | 137 | #define is_power_of_two(x) ( !((x) & ((x)-1)) ) |
| 138 | #define low_bit_mask(x) ( ((x)-1) & ~(x) ) | 138 | #define low_bit_mask(x) ( ((x)-1) & ~(x) ) |
| 139 | #define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x)) | 139 | #define is_valid_mask(x) is_power_of_two(1LU + (x) + low_bit_mask(x)) |
| 140 | 140 | ||
| 141 | /* | 141 | /* |
| 142 | * Macro's to find first set bit in a variable. | 142 | * Macro's to find first set bit in a variable. |
| @@ -173,8 +173,7 @@ struct rt2x00_field32 { | |||
| 173 | * does not exceed the given typelimit. | 173 | * does not exceed the given typelimit. |
| 174 | */ | 174 | */ |
| 175 | #define FIELD_CHECK(__mask, __type) \ | 175 | #define FIELD_CHECK(__mask, __type) \ |
| 176 | BUILD_BUG_ON(!__builtin_constant_p(__mask) || \ | 176 | BUILD_BUG_ON(!(__mask) || \ |
| 177 | !(__mask) || \ | ||
| 178 | !is_valid_mask(__mask) || \ | 177 | !is_valid_mask(__mask) || \ |
| 179 | (__mask) != (__type)(__mask)) \ | 178 | (__mask) != (__type)(__mask)) \ |
| 180 | 179 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 8d76bb2e0312..2050227ea530 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
| @@ -181,6 +181,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb) | |||
| 181 | * (Only indirectly by looking at the failed TX counters | 181 | * (Only indirectly by looking at the failed TX counters |
| 182 | * in the register). | 182 | * in the register). |
| 183 | */ | 183 | */ |
| 184 | txdesc.flags = 0; | ||
| 184 | if (!urb->status) | 185 | if (!urb->status) |
| 185 | __set_bit(TXDONE_UNKNOWN, &txdesc.flags); | 186 | __set_bit(TXDONE_UNKNOWN, &txdesc.flags); |
| 186 | else | 187 | else |
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index 57376fb993ed..ca5deb6244e6 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
| @@ -40,6 +40,7 @@ static struct usb_device_id rtl8187_table[] __devinitdata = { | |||
| 40 | /* Netgear */ | 40 | /* Netgear */ |
| 41 | {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187}, | 41 | {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187}, |
| 42 | {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187}, | 42 | {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187}, |
| 43 | {USB_DEVICE(0x0846, 0x4260), .driver_info = DEVICE_RTL8187B}, | ||
| 43 | /* HP */ | 44 | /* HP */ |
| 44 | {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187}, | 45 | {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187}, |
| 45 | /* Sitecom */ | 46 | /* Sitecom */ |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index da8b7433e3a6..a60ae86bd5c9 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
| @@ -58,6 +58,7 @@ static struct usb_device_id usb_ids[] = { | |||
| 58 | { USB_DEVICE(0x0586, 0x3407), .driver_info = DEVICE_ZD1211 }, | 58 | { USB_DEVICE(0x0586, 0x3407), .driver_info = DEVICE_ZD1211 }, |
| 59 | { USB_DEVICE(0x129b, 0x1666), .driver_info = DEVICE_ZD1211 }, | 59 | { USB_DEVICE(0x129b, 0x1666), .driver_info = DEVICE_ZD1211 }, |
| 60 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, | 60 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, |
| 61 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, | ||
| 61 | /* ZD1211B */ | 62 | /* ZD1211B */ |
| 62 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, | 63 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, |
| 63 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, | 64 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, |
diff --git a/drivers/of/device.c b/drivers/of/device.c index 8a1d93a2bb81..51e5214071da 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
| @@ -57,6 +57,15 @@ static ssize_t devspec_show(struct device *dev, | |||
| 57 | return sprintf(buf, "%s\n", ofdev->node->full_name); | 57 | return sprintf(buf, "%s\n", ofdev->node->full_name); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | static ssize_t name_show(struct device *dev, | ||
| 61 | struct device_attribute *attr, char *buf) | ||
| 62 | { | ||
| 63 | struct of_device *ofdev; | ||
| 64 | |||
| 65 | ofdev = to_of_device(dev); | ||
| 66 | return sprintf(buf, "%s\n", ofdev->node->name); | ||
| 67 | } | ||
| 68 | |||
| 60 | static ssize_t modalias_show(struct device *dev, | 69 | static ssize_t modalias_show(struct device *dev, |
| 61 | struct device_attribute *attr, char *buf) | 70 | struct device_attribute *attr, char *buf) |
| 62 | { | 71 | { |
| @@ -71,6 +80,7 @@ static ssize_t modalias_show(struct device *dev, | |||
| 71 | 80 | ||
| 72 | struct device_attribute of_platform_device_attrs[] = { | 81 | struct device_attribute of_platform_device_attrs[] = { |
| 73 | __ATTR_RO(devspec), | 82 | __ATTR_RO(devspec), |
| 83 | __ATTR_RO(name), | ||
| 74 | __ATTR_RO(modalias), | 84 | __ATTR_RO(modalias), |
| 75 | __ATTR_NULL | 85 | __ATTR_NULL |
| 76 | }; | 86 | }; |
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c index 2450b3a393ff..7ba78e6d210e 100644 --- a/drivers/oprofile/cpu_buffer.c +++ b/drivers/oprofile/cpu_buffer.c | |||
| @@ -38,8 +38,10 @@ void free_cpu_buffers(void) | |||
| 38 | { | 38 | { |
| 39 | int i; | 39 | int i; |
| 40 | 40 | ||
| 41 | for_each_online_cpu(i) | 41 | for_each_online_cpu(i) { |
| 42 | vfree(per_cpu(cpu_buffer, i).buffer); | 42 | vfree(per_cpu(cpu_buffer, i).buffer); |
| 43 | per_cpu(cpu_buffer, i).buffer = NULL; | ||
| 44 | } | ||
| 43 | } | 45 | } |
| 44 | 46 | ||
| 45 | int alloc_cpu_buffers(void) | 47 | int alloc_cpu_buffers(void) |
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index e7fbac529935..8d692a5c8e73 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c | |||
| @@ -93,6 +93,8 @@ out: | |||
| 93 | void free_event_buffer(void) | 93 | void free_event_buffer(void) |
| 94 | { | 94 | { |
| 95 | vfree(event_buffer); | 95 | vfree(event_buffer); |
| 96 | |||
| 97 | event_buffer = NULL; | ||
| 96 | } | 98 | } |
| 97 | 99 | ||
| 98 | 100 | ||
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index 93e37f0666ab..e17ef54f0efc 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c | |||
| @@ -382,7 +382,7 @@ EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware); | |||
| 382 | int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) | 382 | int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) |
| 383 | { | 383 | { |
| 384 | acpi_status status; | 384 | acpi_status status; |
| 385 | acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev)); | 385 | acpi_handle chandle, handle; |
| 386 | struct pci_dev *pdev = dev; | 386 | struct pci_dev *pdev = dev; |
| 387 | struct pci_bus *parent; | 387 | struct pci_bus *parent; |
| 388 | struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; | 388 | struct acpi_buffer string = { ACPI_ALLOCATE_BUFFER, NULL }; |
| @@ -399,10 +399,25 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) | |||
| 399 | * Per PCI firmware specification, we should run the ACPI _OSC | 399 | * Per PCI firmware specification, we should run the ACPI _OSC |
| 400 | * method to get control of hotplug hardware before using it. If | 400 | * method to get control of hotplug hardware before using it. If |
| 401 | * an _OSC is missing, we look for an OSHP to do the same thing. | 401 | * an _OSC is missing, we look for an OSHP to do the same thing. |
| 402 | * To handle different BIOS behavior, we look for _OSC and OSHP | 402 | * To handle different BIOS behavior, we look for _OSC on a root |
| 403 | * within the scope of the hotplug controller and its parents, | 403 | * bridge preferentially (according to PCI fw spec). Later for |
| 404 | * OSHP within the scope of the hotplug controller and its parents, | ||
| 404 | * upto the host bridge under which this controller exists. | 405 | * upto the host bridge under which this controller exists. |
| 405 | */ | 406 | */ |
| 407 | handle = acpi_find_root_bridge_handle(pdev); | ||
| 408 | if (handle) { | ||
| 409 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); | ||
| 410 | dbg("Trying to get hotplug control for %s\n", | ||
| 411 | (char *)string.pointer); | ||
| 412 | status = pci_osc_control_set(handle, flags); | ||
| 413 | if (ACPI_SUCCESS(status)) | ||
| 414 | goto got_one; | ||
| 415 | kfree(string.pointer); | ||
| 416 | string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL }; | ||
| 417 | } | ||
| 418 | |||
| 419 | pdev = dev; | ||
| 420 | handle = DEVICE_ACPI_HANDLE(&dev->dev); | ||
| 406 | while (!handle) { | 421 | while (!handle) { |
| 407 | /* | 422 | /* |
| 408 | * This hotplug controller was not listed in the ACPI name | 423 | * This hotplug controller was not listed in the ACPI name |
| @@ -427,15 +442,9 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) | |||
| 427 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); | 442 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); |
| 428 | dbg("Trying to get hotplug control for %s \n", | 443 | dbg("Trying to get hotplug control for %s \n", |
| 429 | (char *)string.pointer); | 444 | (char *)string.pointer); |
| 430 | status = pci_osc_control_set(handle, flags); | 445 | status = acpi_run_oshp(handle); |
| 431 | if (status == AE_NOT_FOUND) | 446 | if (ACPI_SUCCESS(status)) |
| 432 | status = acpi_run_oshp(handle); | 447 | goto got_one; |
| 433 | if (ACPI_SUCCESS(status)) { | ||
| 434 | dbg("Gained control for hotplug HW for pci %s (%s)\n", | ||
| 435 | pci_name(dev), (char *)string.pointer); | ||
| 436 | kfree(string.pointer); | ||
| 437 | return 0; | ||
| 438 | } | ||
| 439 | if (acpi_root_bridge(handle)) | 448 | if (acpi_root_bridge(handle)) |
| 440 | break; | 449 | break; |
| 441 | chandle = handle; | 450 | chandle = handle; |
| @@ -449,6 +458,11 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) | |||
| 449 | 458 | ||
| 450 | kfree(string.pointer); | 459 | kfree(string.pointer); |
| 451 | return -ENODEV; | 460 | return -ENODEV; |
| 461 | got_one: | ||
| 462 | dbg("Gained control for hotplug HW for pci %s (%s)\n", pci_name(dev), | ||
| 463 | (char *)string.pointer); | ||
| 464 | kfree(string.pointer); | ||
| 465 | return 0; | ||
| 452 | } | 466 | } |
| 453 | EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); | 467 | EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); |
| 454 | 468 | ||
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c index 40337a06c18a..146ca9cd1567 100644 --- a/drivers/pci/hotplug/fakephp.c +++ b/drivers/pci/hotplug/fakephp.c | |||
| @@ -320,15 +320,15 @@ static int disable_slot(struct hotplug_slot *slot) | |||
| 320 | return -ENODEV; | 320 | return -ENODEV; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | /* remove the device from the pci core */ | ||
| 324 | pci_remove_bus_device(dev); | ||
| 325 | |||
| 323 | /* queue work item to blow away this sysfs entry and other | 326 | /* queue work item to blow away this sysfs entry and other |
| 324 | * parts. | 327 | * parts. |
| 325 | */ | 328 | */ |
| 326 | INIT_WORK(&dslot->remove_work, remove_slot_worker); | 329 | INIT_WORK(&dslot->remove_work, remove_slot_worker); |
| 327 | queue_work(dummyphp_wq, &dslot->remove_work); | 330 | queue_work(dummyphp_wq, &dslot->remove_work); |
| 328 | 331 | ||
| 329 | /* blow away this sysfs entry and other parts. */ | ||
| 330 | remove_slot(dslot); | ||
| 331 | |||
| 332 | pci_dev_put(dev); | 332 | pci_dev_put(dev); |
| 333 | } | 333 | } |
| 334 | return 0; | 334 | return 0; |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index e3a1e7e7dba2..9e6cec67e1cc 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
| @@ -43,7 +43,6 @@ extern int pciehp_poll_mode; | |||
| 43 | extern int pciehp_poll_time; | 43 | extern int pciehp_poll_time; |
| 44 | extern int pciehp_debug; | 44 | extern int pciehp_debug; |
| 45 | extern int pciehp_force; | 45 | extern int pciehp_force; |
| 46 | extern int pciehp_slot_with_bus; | ||
| 47 | extern struct workqueue_struct *pciehp_wq; | 46 | extern struct workqueue_struct *pciehp_wq; |
| 48 | 47 | ||
| 49 | #define dbg(format, arg...) \ | 48 | #define dbg(format, arg...) \ |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 3677495c4f91..4fd5355bc3b5 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
| @@ -41,7 +41,6 @@ int pciehp_debug; | |||
| 41 | int pciehp_poll_mode; | 41 | int pciehp_poll_mode; |
| 42 | int pciehp_poll_time; | 42 | int pciehp_poll_time; |
| 43 | int pciehp_force; | 43 | int pciehp_force; |
| 44 | int pciehp_slot_with_bus; | ||
| 45 | struct workqueue_struct *pciehp_wq; | 44 | struct workqueue_struct *pciehp_wq; |
| 46 | 45 | ||
| 47 | #define DRIVER_VERSION "0.4" | 46 | #define DRIVER_VERSION "0.4" |
| @@ -56,12 +55,10 @@ module_param(pciehp_debug, bool, 0644); | |||
| 56 | module_param(pciehp_poll_mode, bool, 0644); | 55 | module_param(pciehp_poll_mode, bool, 0644); |
| 57 | module_param(pciehp_poll_time, int, 0644); | 56 | module_param(pciehp_poll_time, int, 0644); |
| 58 | module_param(pciehp_force, bool, 0644); | 57 | module_param(pciehp_force, bool, 0644); |
| 59 | module_param(pciehp_slot_with_bus, bool, 0644); | ||
| 60 | MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not"); | 58 | MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not"); |
| 61 | MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); | 59 | MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); |
| 62 | MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); | 60 | MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); |
| 63 | MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if _OSC and OSHP are missing"); | 61 | MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if _OSC and OSHP are missing"); |
| 64 | MODULE_PARM_DESC(pciehp_slot_with_bus, "Use bus number in the slot name"); | ||
| 65 | 62 | ||
| 66 | #define PCIE_MODULE_NAME "pciehp" | 63 | #define PCIE_MODULE_NAME "pciehp" |
| 67 | 64 | ||
| @@ -194,6 +191,7 @@ static int init_slots(struct controller *ctrl) | |||
| 194 | struct slot *slot; | 191 | struct slot *slot; |
| 195 | struct hotplug_slot *hotplug_slot; | 192 | struct hotplug_slot *hotplug_slot; |
| 196 | struct hotplug_slot_info *info; | 193 | struct hotplug_slot_info *info; |
| 194 | int len, dup = 1; | ||
| 197 | int retval = -ENOMEM; | 195 | int retval = -ENOMEM; |
| 198 | 196 | ||
| 199 | list_for_each_entry(slot, &ctrl->slot_list, slot_list) { | 197 | list_for_each_entry(slot, &ctrl->slot_list, slot_list) { |
| @@ -220,15 +218,24 @@ static int init_slots(struct controller *ctrl) | |||
| 220 | dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " | 218 | dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " |
| 221 | "slot_device_offset=%x\n", slot->bus, slot->device, | 219 | "slot_device_offset=%x\n", slot->bus, slot->device, |
| 222 | slot->hp_slot, slot->number, ctrl->slot_device_offset); | 220 | slot->hp_slot, slot->number, ctrl->slot_device_offset); |
| 221 | duplicate_name: | ||
| 223 | retval = pci_hp_register(hotplug_slot, | 222 | retval = pci_hp_register(hotplug_slot, |
| 224 | ctrl->pci_dev->subordinate, | 223 | ctrl->pci_dev->subordinate, |
| 225 | slot->device); | 224 | slot->device); |
| 226 | if (retval) { | 225 | if (retval) { |
| 226 | /* | ||
| 227 | * If slot N already exists, we'll try to create | ||
| 228 | * slot N-1, N-2 ... N-M, until we overflow. | ||
| 229 | */ | ||
| 230 | if (retval == -EEXIST) { | ||
| 231 | len = snprintf(slot->name, SLOT_NAME_SIZE, | ||
| 232 | "%d-%d", slot->number, dup++); | ||
| 233 | if (len < SLOT_NAME_SIZE) | ||
| 234 | goto duplicate_name; | ||
| 235 | else | ||
| 236 | err("duplicate slot name overflow\n"); | ||
| 237 | } | ||
| 227 | err("pci_hp_register failed with error %d\n", retval); | 238 | err("pci_hp_register failed with error %d\n", retval); |
| 228 | if (retval == -EEXIST) | ||
| 229 | err("Failed to register slot because of name " | ||
| 230 | "collision. Try \'pciehp_slot_with_bus\' " | ||
| 231 | "module option.\n"); | ||
| 232 | goto error_info; | 239 | goto error_info; |
| 233 | } | 240 | } |
| 234 | /* create additional sysfs entries */ | 241 | /* create additional sysfs entries */ |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index ad27e9e225a6..9d934ddee956 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
| @@ -258,7 +258,7 @@ static int pcie_poll_cmd(struct controller *ctrl) | |||
| 258 | return 1; | 258 | return 1; |
| 259 | } | 259 | } |
| 260 | } | 260 | } |
| 261 | while (timeout > 1000) { | 261 | while (timeout > 0) { |
| 262 | msleep(10); | 262 | msleep(10); |
| 263 | timeout -= 10; | 263 | timeout -= 10; |
| 264 | if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) { | 264 | if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) { |
| @@ -1030,15 +1030,6 @@ static void pcie_shutdown_notification(struct controller *ctrl) | |||
| 1030 | pciehp_free_irq(ctrl); | 1030 | pciehp_free_irq(ctrl); |
| 1031 | } | 1031 | } |
| 1032 | 1032 | ||
| 1033 | static void make_slot_name(struct slot *slot) | ||
| 1034 | { | ||
| 1035 | if (pciehp_slot_with_bus) | ||
| 1036 | snprintf(slot->name, SLOT_NAME_SIZE, "%04d_%04d", | ||
| 1037 | slot->bus, slot->number); | ||
| 1038 | else | ||
| 1039 | snprintf(slot->name, SLOT_NAME_SIZE, "%d", slot->number); | ||
| 1040 | } | ||
| 1041 | |||
| 1042 | static int pcie_init_slot(struct controller *ctrl) | 1033 | static int pcie_init_slot(struct controller *ctrl) |
| 1043 | { | 1034 | { |
| 1044 | struct slot *slot; | 1035 | struct slot *slot; |
| @@ -1053,7 +1044,7 @@ static int pcie_init_slot(struct controller *ctrl) | |||
| 1053 | slot->device = ctrl->slot_device_offset + slot->hp_slot; | 1044 | slot->device = ctrl->slot_device_offset + slot->hp_slot; |
| 1054 | slot->hpc_ops = ctrl->hpc_ops; | 1045 | slot->hpc_ops = ctrl->hpc_ops; |
| 1055 | slot->number = ctrl->first_slot; | 1046 | slot->number = ctrl->first_slot; |
| 1056 | make_slot_name(slot); | 1047 | snprintf(slot->name, SLOT_NAME_SIZE, "%d", slot->number); |
| 1057 | mutex_init(&slot->lock); | 1048 | mutex_init(&slot->lock); |
| 1058 | INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); | 1049 | INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); |
| 1059 | list_add(&slot->slot_list, &ctrl->slot_list); | 1050 | list_add(&slot->slot_list, &ctrl->slot_list); |
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index a8cbd039b85b..cc38615395f1 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | int shpchp_debug; | 39 | int shpchp_debug; |
| 40 | int shpchp_poll_mode; | 40 | int shpchp_poll_mode; |
| 41 | int shpchp_poll_time; | 41 | int shpchp_poll_time; |
| 42 | static int shpchp_slot_with_bus; | ||
| 43 | struct workqueue_struct *shpchp_wq; | 42 | struct workqueue_struct *shpchp_wq; |
| 44 | 43 | ||
| 45 | #define DRIVER_VERSION "0.4" | 44 | #define DRIVER_VERSION "0.4" |
| @@ -53,11 +52,9 @@ MODULE_LICENSE("GPL"); | |||
| 53 | module_param(shpchp_debug, bool, 0644); | 52 | module_param(shpchp_debug, bool, 0644); |
| 54 | module_param(shpchp_poll_mode, bool, 0644); | 53 | module_param(shpchp_poll_mode, bool, 0644); |
| 55 | module_param(shpchp_poll_time, int, 0644); | 54 | module_param(shpchp_poll_time, int, 0644); |
| 56 | module_param(shpchp_slot_with_bus, bool, 0644); | ||
| 57 | MODULE_PARM_DESC(shpchp_debug, "Debugging mode enabled or not"); | 55 | MODULE_PARM_DESC(shpchp_debug, "Debugging mode enabled or not"); |
| 58 | MODULE_PARM_DESC(shpchp_poll_mode, "Using polling mechanism for hot-plug events or not"); | 56 | MODULE_PARM_DESC(shpchp_poll_mode, "Using polling mechanism for hot-plug events or not"); |
| 59 | MODULE_PARM_DESC(shpchp_poll_time, "Polling mechanism frequency, in seconds"); | 57 | MODULE_PARM_DESC(shpchp_poll_time, "Polling mechanism frequency, in seconds"); |
| 60 | MODULE_PARM_DESC(shpchp_slot_with_bus, "Use bus number in the slot name"); | ||
| 61 | 58 | ||
| 62 | #define SHPC_MODULE_NAME "shpchp" | 59 | #define SHPC_MODULE_NAME "shpchp" |
| 63 | 60 | ||
| @@ -99,23 +96,13 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
| 99 | kfree(slot); | 96 | kfree(slot); |
| 100 | } | 97 | } |
| 101 | 98 | ||
| 102 | static void make_slot_name(struct slot *slot) | ||
| 103 | { | ||
| 104 | if (shpchp_slot_with_bus) | ||
| 105 | snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d", | ||
| 106 | slot->bus, slot->number); | ||
| 107 | else | ||
| 108 | snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%d", | ||
| 109 | slot->number); | ||
| 110 | } | ||
| 111 | |||
| 112 | static int init_slots(struct controller *ctrl) | 99 | static int init_slots(struct controller *ctrl) |
| 113 | { | 100 | { |
| 114 | struct slot *slot; | 101 | struct slot *slot; |
| 115 | struct hotplug_slot *hotplug_slot; | 102 | struct hotplug_slot *hotplug_slot; |
| 116 | struct hotplug_slot_info *info; | 103 | struct hotplug_slot_info *info; |
| 117 | int retval = -ENOMEM; | 104 | int retval = -ENOMEM; |
| 118 | int i; | 105 | int i, len, dup = 1; |
| 119 | 106 | ||
| 120 | for (i = 0; i < ctrl->num_slots; i++) { | 107 | for (i = 0; i < ctrl->num_slots; i++) { |
| 121 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); | 108 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); |
| @@ -146,7 +133,7 @@ static int init_slots(struct controller *ctrl) | |||
| 146 | /* register this slot with the hotplug pci core */ | 133 | /* register this slot with the hotplug pci core */ |
| 147 | hotplug_slot->private = slot; | 134 | hotplug_slot->private = slot; |
| 148 | hotplug_slot->release = &release_slot; | 135 | hotplug_slot->release = &release_slot; |
| 149 | make_slot_name(slot); | 136 | snprintf(slot->name, SLOT_NAME_SIZE, "%d", slot->number); |
| 150 | hotplug_slot->ops = &shpchp_hotplug_slot_ops; | 137 | hotplug_slot->ops = &shpchp_hotplug_slot_ops; |
| 151 | 138 | ||
| 152 | get_power_status(hotplug_slot, &info->power_status); | 139 | get_power_status(hotplug_slot, &info->power_status); |
| @@ -157,14 +144,23 @@ static int init_slots(struct controller *ctrl) | |||
| 157 | dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " | 144 | dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " |
| 158 | "slot_device_offset=%x\n", slot->bus, slot->device, | 145 | "slot_device_offset=%x\n", slot->bus, slot->device, |
| 159 | slot->hp_slot, slot->number, ctrl->slot_device_offset); | 146 | slot->hp_slot, slot->number, ctrl->slot_device_offset); |
| 147 | duplicate_name: | ||
| 160 | retval = pci_hp_register(slot->hotplug_slot, | 148 | retval = pci_hp_register(slot->hotplug_slot, |
| 161 | ctrl->pci_dev->subordinate, slot->device); | 149 | ctrl->pci_dev->subordinate, slot->device); |
| 162 | if (retval) { | 150 | if (retval) { |
| 151 | /* | ||
| 152 | * If slot N already exists, we'll try to create | ||
| 153 | * slot N-1, N-2 ... N-M, until we overflow. | ||
| 154 | */ | ||
| 155 | if (retval == -EEXIST) { | ||
| 156 | len = snprintf(slot->name, SLOT_NAME_SIZE, | ||
| 157 | "%d-%d", slot->number, dup++); | ||
| 158 | if (len < SLOT_NAME_SIZE) | ||
| 159 | goto duplicate_name; | ||
| 160 | else | ||
| 161 | err("duplicate slot name overflow\n"); | ||
| 162 | } | ||
| 163 | err("pci_hp_register failed with error %d\n", retval); | 163 | err("pci_hp_register failed with error %d\n", retval); |
| 164 | if (retval == -EEXIST) | ||
| 165 | err("Failed to register slot because of name " | ||
| 166 | "collision. Try \'shpchp_slot_with_bus\' " | ||
| 167 | "module option.\n"); | ||
| 168 | goto error_info; | 164 | goto error_info; |
| 169 | } | 165 | } |
| 170 | 166 | ||
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 8d0e60ac849c..c3edcdc08e72 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
| @@ -2348,11 +2348,34 @@ static void __init iommu_exit_mempool(void) | |||
| 2348 | 2348 | ||
| 2349 | } | 2349 | } |
| 2350 | 2350 | ||
| 2351 | static int blacklist_iommu(const struct dmi_system_id *id) | ||
| 2352 | { | ||
| 2353 | printk(KERN_INFO "%s detected; disabling IOMMU\n", | ||
| 2354 | id->ident); | ||
| 2355 | dmar_disabled = 1; | ||
| 2356 | return 0; | ||
| 2357 | } | ||
| 2358 | |||
| 2359 | static struct dmi_system_id __initdata intel_iommu_dmi_table[] = { | ||
| 2360 | { /* Some DG33BU BIOS revisions advertised non-existent VT-d */ | ||
| 2361 | .callback = blacklist_iommu, | ||
| 2362 | .ident = "Intel DG33BU", | ||
| 2363 | { DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"), | ||
| 2364 | DMI_MATCH(DMI_BOARD_NAME, "DG33BU"), | ||
| 2365 | } | ||
| 2366 | }, | ||
| 2367 | { } | ||
| 2368 | }; | ||
| 2369 | |||
| 2370 | |||
| 2351 | void __init detect_intel_iommu(void) | 2371 | void __init detect_intel_iommu(void) |
| 2352 | { | 2372 | { |
| 2353 | if (swiotlb || no_iommu || iommu_detected || dmar_disabled) | 2373 | if (swiotlb || no_iommu || iommu_detected || dmar_disabled) |
| 2354 | return; | 2374 | return; |
| 2355 | if (early_dmar_detect()) { | 2375 | if (early_dmar_detect()) { |
| 2376 | dmi_check_system(intel_iommu_dmi_table); | ||
| 2377 | if (dmar_disabled) | ||
| 2378 | return; | ||
| 2356 | iommu_detected = 1; | 2379 | iommu_detected = 1; |
| 2357 | } | 2380 | } |
| 2358 | } | 2381 | } |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 9c718583a237..77baff022f71 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 19 | #include <linux/sched.h> | ||
| 19 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
| 20 | #include <linux/stat.h> | 21 | #include <linux/stat.h> |
| 21 | #include <linux/topology.h> | 22 | #include <linux/topology.h> |
| @@ -484,6 +485,21 @@ pci_mmap_legacy_mem(struct kobject *kobj, struct bin_attribute *attr, | |||
| 484 | #endif /* HAVE_PCI_LEGACY */ | 485 | #endif /* HAVE_PCI_LEGACY */ |
| 485 | 486 | ||
| 486 | #ifdef HAVE_PCI_MMAP | 487 | #ifdef HAVE_PCI_MMAP |
| 488 | |||
| 489 | static int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma) | ||
| 490 | { | ||
| 491 | unsigned long nr, start, size; | ||
| 492 | |||
| 493 | nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | ||
| 494 | start = vma->vm_pgoff; | ||
| 495 | size = pci_resource_len(pdev, resno) >> PAGE_SHIFT; | ||
| 496 | if (start < size && size - start >= nr) | ||
| 497 | return 1; | ||
| 498 | WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", | ||
| 499 | current->comm, start, start+nr, pci_name(pdev), resno, size); | ||
| 500 | return 0; | ||
| 501 | } | ||
| 502 | |||
| 487 | /** | 503 | /** |
| 488 | * pci_mmap_resource - map a PCI resource into user memory space | 504 | * pci_mmap_resource - map a PCI resource into user memory space |
| 489 | * @kobj: kobject for mapping | 505 | * @kobj: kobject for mapping |
| @@ -510,6 +526,9 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | |||
| 510 | if (i >= PCI_ROM_RESOURCE) | 526 | if (i >= PCI_ROM_RESOURCE) |
| 511 | return -ENODEV; | 527 | return -ENODEV; |
| 512 | 528 | ||
| 529 | if (!pci_mmap_fits(pdev, i, vma)) | ||
| 530 | return -EINVAL; | ||
| 531 | |||
| 513 | /* pci_mmap_page_range() expects the same kind of entry as coming | 532 | /* pci_mmap_page_range() expects the same kind of entry as coming |
| 514 | * from /proc/bus/pci/ which is a "user visible" value. If this is | 533 | * from /proc/bus/pci/ which is a "user visible" value. If this is |
| 515 | * different from the resource itself, arch will do necessary fixup. | 534 | * different from the resource itself, arch will do necessary fixup. |
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c index 30f581b8791f..6dd7b13e9808 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c | |||
| @@ -36,12 +36,7 @@ int aer_osc_setup(struct pcie_device *pciedev) | |||
| 36 | if (acpi_pci_disabled) | 36 | if (acpi_pci_disabled) |
| 37 | return -1; | 37 | return -1; |
| 38 | 38 | ||
| 39 | /* Find root host bridge */ | 39 | handle = acpi_find_root_bridge_handle(pdev); |
| 40 | while (pdev->bus->self) | ||
| 41 | pdev = pdev->bus->self; | ||
| 42 | handle = acpi_get_pci_rootbridge_handle( | ||
| 43 | pci_domain_nr(pdev->bus), pdev->bus->number); | ||
| 44 | |||
| 45 | if (handle) { | 40 | if (handle) { |
| 46 | pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT); | 41 | pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT); |
| 47 | status = pci_osc_control_set(handle, | 42 | status = pci_osc_control_set(handle, |
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 9a7c9e1408a4..851f5b83cdbc 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
| @@ -527,7 +527,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev) | |||
| 527 | */ | 527 | */ |
| 528 | pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP, | 528 | pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP, |
| 529 | ®32); | 529 | ®32); |
| 530 | if (!(reg32 & PCI_EXP_DEVCAP_RBER && !aspm_force)) { | 530 | if (!(reg32 & PCI_EXP_DEVCAP_RBER) && !aspm_force) { |
| 531 | printk("Pre-1.1 PCIe device detected, " | 531 | printk("Pre-1.1 PCIe device detected, " |
| 532 | "disable ASPM for %s. It can be enabled forcedly" | 532 | "disable ASPM for %s. It can be enabled forcedly" |
| 533 | " with 'pcie_aspm=force'\n", pci_name(pdev)); | 533 | " with 'pcie_aspm=force'\n", pci_name(pdev)); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a04498d390c8..36698e57b97f 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -304,6 +304,9 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
| 304 | } else { | 304 | } else { |
| 305 | res->start = l64; | 305 | res->start = l64; |
| 306 | res->end = l64 + sz64; | 306 | res->end = l64 + sz64; |
| 307 | printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n", | ||
| 308 | pci_name(dev), pos, (unsigned long long)res->start, | ||
| 309 | (unsigned long long)res->end); | ||
| 307 | } | 310 | } |
| 308 | } else { | 311 | } else { |
| 309 | sz = pci_size(l, sz, mask); | 312 | sz = pci_size(l, sz, mask); |
| @@ -313,6 +316,9 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
| 313 | 316 | ||
| 314 | res->start = l; | 317 | res->start = l; |
| 315 | res->end = l + sz; | 318 | res->end = l + sz; |
| 319 | printk(KERN_DEBUG "PCI: %s reg %x %s: [%llx, %llx]\n", pci_name(dev), | ||
| 320 | pos, (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio", | ||
| 321 | (unsigned long long)res->start, (unsigned long long)res->end); | ||
| 316 | } | 322 | } |
| 317 | 323 | ||
| 318 | out: | 324 | out: |
| @@ -383,6 +389,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
| 383 | res->start = base; | 389 | res->start = base; |
| 384 | if (!res->end) | 390 | if (!res->end) |
| 385 | res->end = limit + 0xfff; | 391 | res->end = limit + 0xfff; |
| 392 | printk(KERN_DEBUG "PCI: bridge %s io port: [%llx, %llx]\n", | ||
| 393 | pci_name(dev), (unsigned long long) res->start, | ||
| 394 | (unsigned long long) res->end); | ||
| 386 | } | 395 | } |
| 387 | 396 | ||
| 388 | res = child->resource[1]; | 397 | res = child->resource[1]; |
| @@ -394,6 +403,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
| 394 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; | 403 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; |
| 395 | res->start = base; | 404 | res->start = base; |
| 396 | res->end = limit + 0xfffff; | 405 | res->end = limit + 0xfffff; |
| 406 | printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", | ||
| 407 | pci_name(dev), (unsigned long long) res->start, | ||
| 408 | (unsigned long long) res->end); | ||
| 397 | } | 409 | } |
| 398 | 410 | ||
| 399 | res = child->resource[2]; | 411 | res = child->resource[2]; |
| @@ -429,6 +441,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
| 429 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; | 441 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; |
| 430 | res->start = base; | 442 | res->start = base; |
| 431 | res->end = limit + 0xfffff; | 443 | res->end = limit + 0xfffff; |
| 444 | printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", | ||
| 445 | pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32", | ||
| 446 | (unsigned long long) res->start, (unsigned long long) res->end); | ||
| 432 | } | 447 | } |
| 433 | } | 448 | } |
| 434 | 449 | ||
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 217814fef4ef..4edfc4731bd4 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
| @@ -162,7 +162,7 @@ EXPORT_SYMBOL(pci_find_slot); | |||
| 162 | * time. | 162 | * time. |
| 163 | */ | 163 | */ |
| 164 | struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, | 164 | struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, |
| 165 | const struct pci_dev *from) | 165 | struct pci_dev *from) |
| 166 | { | 166 | { |
| 167 | struct pci_dev *pdev; | 167 | struct pci_dev *pdev; |
| 168 | 168 | ||
| @@ -263,7 +263,7 @@ static int match_pci_dev_by_id(struct device *dev, void *data) | |||
| 263 | * this file. | 263 | * this file. |
| 264 | */ | 264 | */ |
| 265 | static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, | 265 | static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, |
| 266 | const struct pci_dev *from) | 266 | struct pci_dev *from) |
| 267 | { | 267 | { |
| 268 | struct device *dev; | 268 | struct device *dev; |
| 269 | struct device *dev_start = NULL; | 269 | struct device *dev_start = NULL; |
| @@ -280,6 +280,8 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, | |||
| 280 | match_pci_dev_by_id); | 280 | match_pci_dev_by_id); |
| 281 | if (dev) | 281 | if (dev) |
| 282 | pdev = to_pci_dev(dev); | 282 | pdev = to_pci_dev(dev); |
| 283 | if (from) | ||
| 284 | pci_dev_put(from); | ||
| 283 | return pdev; | 285 | return pdev; |
| 284 | } | 286 | } |
| 285 | 287 | ||
| @@ -301,7 +303,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, | |||
| 301 | */ | 303 | */ |
| 302 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | 304 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
| 303 | unsigned int ss_vendor, unsigned int ss_device, | 305 | unsigned int ss_vendor, unsigned int ss_device, |
| 304 | const struct pci_dev *from) | 306 | struct pci_dev *from) |
| 305 | { | 307 | { |
| 306 | struct pci_dev *pdev; | 308 | struct pci_dev *pdev; |
| 307 | struct pci_device_id *id; | 309 | struct pci_device_id *id; |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 827c0a520e2b..3abbfad9ddab 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
| @@ -352,11 +352,12 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long | |||
| 352 | continue; | 352 | continue; |
| 353 | r_size = r->end - r->start + 1; | 353 | r_size = r->end - r->start + 1; |
| 354 | /* For bridges size != alignment */ | 354 | /* For bridges size != alignment */ |
| 355 | align = (i < PCI_BRIDGE_RESOURCES) ? r_size : r->start; | 355 | align = resource_alignment(r); |
| 356 | order = __ffs(align) - 20; | 356 | order = __ffs(align) - 20; |
| 357 | if (order > 11) { | 357 | if (order > 11) { |
| 358 | dev_warn(&dev->dev, "BAR %d too large: " | 358 | dev_warn(&dev->dev, "BAR %d bad alignment %llx: " |
| 359 | "%#016llx-%#016llx\n", i, | 359 | "%#016llx-%#016llx\n", i, |
| 360 | (unsigned long long)align, | ||
| 360 | (unsigned long long)r->start, | 361 | (unsigned long long)r->start, |
| 361 | (unsigned long long)r->end); | 362 | (unsigned long long)r->end); |
| 362 | r->flags = 0; | 363 | r->flags = 0; |
| @@ -530,6 +531,40 @@ void __ref pci_bus_assign_resources(struct pci_bus *bus) | |||
| 530 | } | 531 | } |
| 531 | EXPORT_SYMBOL(pci_bus_assign_resources); | 532 | EXPORT_SYMBOL(pci_bus_assign_resources); |
| 532 | 533 | ||
| 534 | static void pci_bus_dump_res(struct pci_bus *bus) | ||
| 535 | { | ||
| 536 | int i; | ||
| 537 | |||
| 538 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { | ||
| 539 | struct resource *res = bus->resource[i]; | ||
| 540 | if (!res) | ||
| 541 | continue; | ||
| 542 | |||
| 543 | printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", | ||
| 544 | bus->number, i, | ||
| 545 | (res->flags & IORESOURCE_IO) ? "io port" : "mmio", | ||
| 546 | (unsigned long long) res->start, | ||
| 547 | (unsigned long long) res->end); | ||
| 548 | } | ||
| 549 | } | ||
| 550 | |||
| 551 | static void pci_bus_dump_resources(struct pci_bus *bus) | ||
| 552 | { | ||
| 553 | struct pci_bus *b; | ||
| 554 | struct pci_dev *dev; | ||
| 555 | |||
| 556 | |||
| 557 | pci_bus_dump_res(bus); | ||
| 558 | |||
| 559 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
| 560 | b = dev->subordinate; | ||
| 561 | if (!b) | ||
| 562 | continue; | ||
| 563 | |||
| 564 | pci_bus_dump_resources(b); | ||
| 565 | } | ||
| 566 | } | ||
| 567 | |||
| 533 | void __init | 568 | void __init |
| 534 | pci_assign_unassigned_resources(void) | 569 | pci_assign_unassigned_resources(void) |
| 535 | { | 570 | { |
| @@ -545,4 +580,9 @@ pci_assign_unassigned_resources(void) | |||
| 545 | pci_bus_assign_resources(bus); | 580 | pci_bus_assign_resources(bus); |
| 546 | pci_enable_bridges(bus); | 581 | pci_enable_bridges(bus); |
| 547 | } | 582 | } |
| 583 | |||
| 584 | /* dump the resource on buses */ | ||
| 585 | list_for_each_entry(bus, &pci_root_buses, node) { | ||
| 586 | pci_bus_dump_resources(bus); | ||
| 587 | } | ||
| 548 | } | 588 | } |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 4174d9656e35..34c83d3ca0fa 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
| @@ -427,6 +427,18 @@ static int pcmcia_device_probe(struct device * dev) | |||
| 427 | p_drv = to_pcmcia_drv(dev->driver); | 427 | p_drv = to_pcmcia_drv(dev->driver); |
| 428 | s = p_dev->socket; | 428 | s = p_dev->socket; |
| 429 | 429 | ||
| 430 | /* The PCMCIA code passes the match data in via dev->driver_data | ||
| 431 | * which is an ugly hack. Once the driver probe is called it may | ||
| 432 | * and often will overwrite the match data so we must save it first | ||
| 433 | * | ||
| 434 | * handle pseudo multifunction devices: | ||
| 435 | * there are at most two pseudo multifunction devices. | ||
| 436 | * if we're matching against the first, schedule a | ||
| 437 | * call which will then check whether there are two | ||
| 438 | * pseudo devices, and if not, add the second one. | ||
| 439 | */ | ||
| 440 | did = p_dev->dev.driver_data; | ||
| 441 | |||
| 430 | ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id, | 442 | ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id, |
| 431 | p_drv->drv.name); | 443 | p_drv->drv.name); |
| 432 | 444 | ||
| @@ -455,21 +467,14 @@ static int pcmcia_device_probe(struct device * dev) | |||
| 455 | goto put_module; | 467 | goto put_module; |
| 456 | } | 468 | } |
| 457 | 469 | ||
| 458 | /* handle pseudo multifunction devices: | ||
| 459 | * there are at most two pseudo multifunction devices. | ||
| 460 | * if we're matching against the first, schedule a | ||
| 461 | * call which will then check whether there are two | ||
| 462 | * pseudo devices, and if not, add the second one. | ||
| 463 | */ | ||
| 464 | did = p_dev->dev.driver_data; | ||
| 465 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 470 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
| 466 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) | 471 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) |
| 467 | pcmcia_add_device_later(p_dev->socket, 0); | 472 | pcmcia_add_device_later(p_dev->socket, 0); |
| 468 | 473 | ||
| 469 | put_module: | 474 | put_module: |
| 470 | if (ret) | 475 | if (ret) |
| 471 | module_put(p_drv->owner); | 476 | module_put(p_drv->owner); |
| 472 | put_dev: | 477 | put_dev: |
| 473 | if (ret) | 478 | if (ret) |
| 474 | put_device(dev); | 479 | put_device(dev); |
| 475 | return (ret); | 480 | return (ret); |
diff --git a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c index a8771ffc61e8..e07b5c51ec5b 100644 --- a/drivers/pcmcia/pxa2xx_palmtx.c +++ b/drivers/pcmcia/pxa2xx_palmtx.c | |||
| @@ -23,12 +23,57 @@ | |||
| 23 | 23 | ||
| 24 | static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 24 | static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
| 25 | { | 25 | { |
| 26 | skt->irq = IRQ_GPIO(GPIO_NR_PALMTX_PCMCIA_READY); | 26 | int ret; |
| 27 | |||
| 28 | ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER1, "PCMCIA PWR1"); | ||
| 29 | if (ret) | ||
| 30 | goto err1; | ||
| 31 | ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER1, 0); | ||
| 32 | if (ret) | ||
| 33 | goto err2; | ||
| 34 | |||
| 35 | ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER2, "PCMCIA PWR2"); | ||
| 36 | if (ret) | ||
| 37 | goto err2; | ||
| 38 | ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER2, 0); | ||
| 39 | if (ret) | ||
| 40 | goto err3; | ||
| 41 | |||
| 42 | ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_RESET, "PCMCIA RST"); | ||
| 43 | if (ret) | ||
| 44 | goto err3; | ||
| 45 | ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_RESET, 1); | ||
| 46 | if (ret) | ||
| 47 | goto err4; | ||
| 48 | |||
| 49 | ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_READY, "PCMCIA RDY"); | ||
| 50 | if (ret) | ||
| 51 | goto err4; | ||
| 52 | ret = gpio_direction_input(GPIO_NR_PALMTX_PCMCIA_READY); | ||
| 53 | if (ret) | ||
| 54 | goto err5; | ||
| 55 | |||
| 56 | skt->irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); | ||
| 27 | return 0; | 57 | return 0; |
| 58 | |||
| 59 | err5: | ||
| 60 | gpio_free(GPIO_NR_PALMTX_PCMCIA_READY); | ||
| 61 | err4: | ||
| 62 | gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET); | ||
| 63 | err3: | ||
| 64 | gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2); | ||
| 65 | err2: | ||
| 66 | gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1); | ||
| 67 | err1: | ||
| 68 | return ret; | ||
| 28 | } | 69 | } |
| 29 | 70 | ||
| 30 | static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | 71 | static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) |
| 31 | { | 72 | { |
| 73 | gpio_free(GPIO_NR_PALMTX_PCMCIA_READY); | ||
| 74 | gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET); | ||
| 75 | gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2); | ||
| 76 | gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1); | ||
| 32 | } | 77 | } |
| 33 | 78 | ||
| 34 | static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 79 | static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
| @@ -109,7 +154,7 @@ static void __exit palmtx_pcmcia_exit(void) | |||
| 109 | platform_device_unregister(palmtx_pcmcia_device); | 154 | platform_device_unregister(palmtx_pcmcia_device); |
| 110 | } | 155 | } |
| 111 | 156 | ||
| 112 | fs_initcall(palmtx_pcmcia_init); | 157 | module_init(palmtx_pcmcia_init); |
| 113 | module_exit(palmtx_pcmcia_exit); | 158 | module_exit(palmtx_pcmcia_exit); |
| 114 | 159 | ||
| 115 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); | 160 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index c48f3f69bdaf..da3972153226 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
| @@ -748,7 +748,9 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops | |||
| 748 | 748 | ||
| 749 | add_timer(&skt->poll_timer); | 749 | add_timer(&skt->poll_timer); |
| 750 | 750 | ||
| 751 | device_create_file(&skt->socket.dev, &dev_attr_status); | 751 | ret = device_create_file(&skt->socket.dev, &dev_attr_status); |
| 752 | if (ret) | ||
| 753 | goto out_err_8; | ||
| 752 | } | 754 | } |
| 753 | 755 | ||
| 754 | dev_set_drvdata(dev, sinfo); | 756 | dev_set_drvdata(dev, sinfo); |
| @@ -758,6 +760,8 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops | |||
| 758 | do { | 760 | do { |
| 759 | skt = &sinfo->skt[i]; | 761 | skt = &sinfo->skt[i]; |
| 760 | 762 | ||
| 763 | device_remove_file(&skt->socket.dev, &dev_attr_status); | ||
| 764 | out_err_8: | ||
| 761 | del_timer_sync(&skt->poll_timer); | 765 | del_timer_sync(&skt->poll_timer); |
| 762 | pcmcia_unregister_socket(&skt->socket); | 766 | pcmcia_unregister_socket(&skt->socket); |
| 763 | 767 | ||
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index d7e9f2152df0..95015cbfd33f 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
| @@ -405,8 +405,6 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
| 405 | 405 | ||
| 406 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 406 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
| 407 | extended_irq = &res->data.extended_irq; | 407 | extended_irq = &res->data.extended_irq; |
| 408 | if (extended_irq->producer_consumer == ACPI_PRODUCER) | ||
| 409 | return AE_OK; | ||
| 410 | 408 | ||
| 411 | if (extended_irq->interrupt_count == 0) | 409 | if (extended_irq->interrupt_count == 0) |
| 412 | pnp_add_irq_resource(dev, 0, IORESOURCE_DISABLED); | 410 | pnp_add_irq_resource(dev, 0, IORESOURCE_DISABLED); |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 90ab73825401..9a9755c92fad 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
| @@ -561,7 +561,7 @@ config RTC_DRV_AT91SAM9_GPBR | |||
| 561 | 561 | ||
| 562 | config RTC_DRV_BFIN | 562 | config RTC_DRV_BFIN |
| 563 | tristate "Blackfin On-Chip RTC" | 563 | tristate "Blackfin On-Chip RTC" |
| 564 | depends on BLACKFIN | 564 | depends on BLACKFIN && !BF561 |
| 565 | help | 565 | help |
| 566 | If you say yes here you will get support for the | 566 | If you say yes here you will get support for the |
| 567 | Blackfin On-Chip Real Time Clock. | 567 | Blackfin On-Chip Real Time Clock. |
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index a1af4c27939b..34439ce3967e 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
| @@ -218,26 +218,6 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id) | |||
| 218 | return IRQ_NONE; | 218 | return IRQ_NONE; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | static int bfin_rtc_open(struct device *dev) | ||
| 222 | { | ||
| 223 | int ret; | ||
| 224 | |||
| 225 | dev_dbg_stamp(dev); | ||
| 226 | |||
| 227 | ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, to_platform_device(dev)->name, dev); | ||
| 228 | if (!ret) | ||
| 229 | bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE); | ||
| 230 | |||
| 231 | return ret; | ||
| 232 | } | ||
| 233 | |||
| 234 | static void bfin_rtc_release(struct device *dev) | ||
| 235 | { | ||
| 236 | dev_dbg_stamp(dev); | ||
| 237 | bfin_rtc_reset(dev, 0); | ||
| 238 | free_irq(IRQ_RTC, dev); | ||
| 239 | } | ||
| 240 | |||
| 241 | static void bfin_rtc_int_set(u16 rtc_int) | 221 | static void bfin_rtc_int_set(u16 rtc_int) |
| 242 | { | 222 | { |
| 243 | bfin_write_RTC_ISTAT(rtc_int); | 223 | bfin_write_RTC_ISTAT(rtc_int); |
| @@ -370,8 +350,6 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq) | |||
| 370 | } | 350 | } |
| 371 | 351 | ||
| 372 | static struct rtc_class_ops bfin_rtc_ops = { | 352 | static struct rtc_class_ops bfin_rtc_ops = { |
| 373 | .open = bfin_rtc_open, | ||
| 374 | .release = bfin_rtc_release, | ||
| 375 | .ioctl = bfin_rtc_ioctl, | 353 | .ioctl = bfin_rtc_ioctl, |
| 376 | .read_time = bfin_rtc_read_time, | 354 | .read_time = bfin_rtc_read_time, |
| 377 | .set_time = bfin_rtc_set_time, | 355 | .set_time = bfin_rtc_set_time, |
| @@ -383,29 +361,44 @@ static struct rtc_class_ops bfin_rtc_ops = { | |||
| 383 | static int __devinit bfin_rtc_probe(struct platform_device *pdev) | 361 | static int __devinit bfin_rtc_probe(struct platform_device *pdev) |
| 384 | { | 362 | { |
| 385 | struct bfin_rtc *rtc; | 363 | struct bfin_rtc *rtc; |
| 364 | struct device *dev = &pdev->dev; | ||
| 386 | int ret = 0; | 365 | int ret = 0; |
| 366 | unsigned long timeout; | ||
| 387 | 367 | ||
| 388 | dev_dbg_stamp(&pdev->dev); | 368 | dev_dbg_stamp(dev); |
| 389 | 369 | ||
| 370 | /* Allocate memory for our RTC struct */ | ||
| 390 | rtc = kzalloc(sizeof(*rtc), GFP_KERNEL); | 371 | rtc = kzalloc(sizeof(*rtc), GFP_KERNEL); |
| 391 | if (unlikely(!rtc)) | 372 | if (unlikely(!rtc)) |
| 392 | return -ENOMEM; | 373 | return -ENOMEM; |
| 374 | platform_set_drvdata(pdev, rtc); | ||
| 375 | device_init_wakeup(dev, 1); | ||
| 393 | 376 | ||
| 394 | rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE); | 377 | /* Grab the IRQ and init the hardware */ |
| 395 | if (IS_ERR(rtc)) { | 378 | ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, pdev->name, dev); |
| 396 | ret = PTR_ERR(rtc->rtc_dev); | 379 | if (unlikely(ret)) |
| 397 | goto err; | 380 | goto err; |
| 398 | } | 381 | /* sometimes the bootloader touched things, but the write complete was not |
| 399 | 382 | * enabled, so let's just do a quick timeout here since the IRQ will not fire ... | |
| 400 | /* see comment at top of file about stopwatch/PIE */ | 383 | */ |
| 384 | timeout = jiffies + HZ; | ||
| 385 | while (bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING) | ||
| 386 | if (time_after(jiffies, timeout)) | ||
| 387 | break; | ||
| 388 | bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE); | ||
| 401 | bfin_write_RTC_SWCNT(0); | 389 | bfin_write_RTC_SWCNT(0); |
| 402 | 390 | ||
| 403 | platform_set_drvdata(pdev, rtc); | 391 | /* Register our RTC with the RTC framework */ |
| 404 | 392 | rtc->rtc_dev = rtc_device_register(pdev->name, dev, &bfin_rtc_ops, THIS_MODULE); | |
| 405 | device_init_wakeup(&pdev->dev, 1); | 393 | if (unlikely(IS_ERR(rtc))) { |
| 394 | ret = PTR_ERR(rtc->rtc_dev); | ||
| 395 | goto err_irq; | ||
| 396 | } | ||
| 406 | 397 | ||
| 407 | return 0; | 398 | return 0; |
| 408 | 399 | ||
| 400 | err_irq: | ||
| 401 | free_irq(IRQ_RTC, dev); | ||
| 409 | err: | 402 | err: |
| 410 | kfree(rtc); | 403 | kfree(rtc); |
| 411 | return ret; | 404 | return ret; |
| @@ -414,7 +407,10 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev) | |||
| 414 | static int __devexit bfin_rtc_remove(struct platform_device *pdev) | 407 | static int __devexit bfin_rtc_remove(struct platform_device *pdev) |
| 415 | { | 408 | { |
| 416 | struct bfin_rtc *rtc = platform_get_drvdata(pdev); | 409 | struct bfin_rtc *rtc = platform_get_drvdata(pdev); |
| 410 | struct device *dev = &pdev->dev; | ||
| 417 | 411 | ||
| 412 | bfin_rtc_reset(dev, 0); | ||
| 413 | free_irq(IRQ_RTC, dev); | ||
| 418 | rtc_device_unregister(rtc->rtc_dev); | 414 | rtc_device_unregister(rtc->rtc_dev); |
| 419 | platform_set_drvdata(pdev, NULL); | 415 | platform_set_drvdata(pdev, NULL); |
| 420 | kfree(rtc); | 416 | kfree(rtc); |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 6ea349aba3ba..b184367637d0 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
| @@ -800,7 +800,6 @@ static void __exit cmos_do_remove(struct device *dev) | |||
| 800 | static int cmos_suspend(struct device *dev, pm_message_t mesg) | 800 | static int cmos_suspend(struct device *dev, pm_message_t mesg) |
| 801 | { | 801 | { |
| 802 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | 802 | struct cmos_rtc *cmos = dev_get_drvdata(dev); |
| 803 | int do_wake = device_may_wakeup(dev); | ||
| 804 | unsigned char tmp; | 803 | unsigned char tmp; |
| 805 | 804 | ||
| 806 | /* only the alarm might be a wakeup event source */ | 805 | /* only the alarm might be a wakeup event source */ |
| @@ -809,7 +808,7 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg) | |||
| 809 | if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) { | 808 | if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) { |
| 810 | unsigned char mask; | 809 | unsigned char mask; |
| 811 | 810 | ||
| 812 | if (do_wake) | 811 | if (device_may_wakeup(dev)) |
| 813 | mask = RTC_IRQMASK & ~RTC_AIE; | 812 | mask = RTC_IRQMASK & ~RTC_AIE; |
| 814 | else | 813 | else |
| 815 | mask = RTC_IRQMASK; | 814 | mask = RTC_IRQMASK; |
| @@ -837,6 +836,17 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg) | |||
| 837 | return 0; | 836 | return 0; |
| 838 | } | 837 | } |
| 839 | 838 | ||
| 839 | /* We want RTC alarms to wake us from e.g. ACPI G2/S5 "soft off", even | ||
| 840 | * after a detour through G3 "mechanical off", although the ACPI spec | ||
| 841 | * says wakeup should only work from G1/S4 "hibernate". To most users, | ||
| 842 | * distinctions between S4 and S5 are pointless. So when the hardware | ||
| 843 | * allows, don't draw that distinction. | ||
| 844 | */ | ||
| 845 | static inline int cmos_poweroff(struct device *dev) | ||
| 846 | { | ||
| 847 | return cmos_suspend(dev, PMSG_HIBERNATE); | ||
| 848 | } | ||
| 849 | |||
| 840 | static int cmos_resume(struct device *dev) | 850 | static int cmos_resume(struct device *dev) |
| 841 | { | 851 | { |
| 842 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | 852 | struct cmos_rtc *cmos = dev_get_drvdata(dev); |
| @@ -884,6 +894,12 @@ static int cmos_resume(struct device *dev) | |||
| 884 | #else | 894 | #else |
| 885 | #define cmos_suspend NULL | 895 | #define cmos_suspend NULL |
| 886 | #define cmos_resume NULL | 896 | #define cmos_resume NULL |
| 897 | |||
| 898 | static inline int cmos_poweroff(struct device *dev) | ||
| 899 | { | ||
| 900 | return -ENOSYS; | ||
| 901 | } | ||
| 902 | |||
| 887 | #endif | 903 | #endif |
| 888 | 904 | ||
| 889 | /*----------------------------------------------------------------*/ | 905 | /*----------------------------------------------------------------*/ |
| @@ -903,10 +919,6 @@ static int cmos_resume(struct device *dev) | |||
| 903 | static int __devinit | 919 | static int __devinit |
| 904 | cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) | 920 | cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) |
| 905 | { | 921 | { |
| 906 | /* REVISIT paranoia argues for a shutdown notifier, since PNP | ||
| 907 | * drivers can't provide shutdown() methods to disable IRQs. | ||
| 908 | * Or better yet, fix PNP to allow those methods... | ||
| 909 | */ | ||
| 910 | if (pnp_port_start(pnp,0) == 0x70 && !pnp_irq_valid(pnp,0)) | 922 | if (pnp_port_start(pnp,0) == 0x70 && !pnp_irq_valid(pnp,0)) |
| 911 | /* Some machines contain a PNP entry for the RTC, but | 923 | /* Some machines contain a PNP entry for the RTC, but |
| 912 | * don't define the IRQ. It should always be safe to | 924 | * don't define the IRQ. It should always be safe to |
| @@ -942,6 +954,13 @@ static int cmos_pnp_resume(struct pnp_dev *pnp) | |||
| 942 | #define cmos_pnp_resume NULL | 954 | #define cmos_pnp_resume NULL |
| 943 | #endif | 955 | #endif |
| 944 | 956 | ||
| 957 | static void cmos_pnp_shutdown(struct device *pdev) | ||
| 958 | { | ||
| 959 | if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(pdev)) | ||
| 960 | return; | ||
| 961 | |||
| 962 | cmos_do_shutdown(); | ||
| 963 | } | ||
| 945 | 964 | ||
| 946 | static const struct pnp_device_id rtc_ids[] = { | 965 | static const struct pnp_device_id rtc_ids[] = { |
| 947 | { .id = "PNP0b00", }, | 966 | { .id = "PNP0b00", }, |
| @@ -961,6 +980,10 @@ static struct pnp_driver cmos_pnp_driver = { | |||
| 961 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, | 980 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, |
| 962 | .suspend = cmos_pnp_suspend, | 981 | .suspend = cmos_pnp_suspend, |
| 963 | .resume = cmos_pnp_resume, | 982 | .resume = cmos_pnp_resume, |
| 983 | .driver = { | ||
| 984 | .name = (char *)driver_name, | ||
| 985 | .shutdown = cmos_pnp_shutdown, | ||
| 986 | } | ||
| 964 | }; | 987 | }; |
| 965 | 988 | ||
| 966 | #endif /* CONFIG_PNP */ | 989 | #endif /* CONFIG_PNP */ |
| @@ -986,6 +1009,9 @@ static int __exit cmos_platform_remove(struct platform_device *pdev) | |||
| 986 | 1009 | ||
| 987 | static void cmos_platform_shutdown(struct platform_device *pdev) | 1010 | static void cmos_platform_shutdown(struct platform_device *pdev) |
| 988 | { | 1011 | { |
| 1012 | if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(&pdev->dev)) | ||
| 1013 | return; | ||
| 1014 | |||
| 989 | cmos_do_shutdown(); | 1015 | cmos_do_shutdown(); |
| 990 | } | 1016 | } |
| 991 | 1017 | ||
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 35dcc06eb3e2..52e2743b04ec 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
| @@ -403,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file, | |||
| 403 | 403 | ||
| 404 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 404 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL |
| 405 | case RTC_UIE_OFF: | 405 | case RTC_UIE_OFF: |
| 406 | mutex_unlock(&rtc->ops_lock); | ||
| 406 | clear_uie(rtc); | 407 | clear_uie(rtc); |
| 407 | break; | 408 | return 0; |
| 408 | 409 | ||
| 409 | case RTC_UIE_ON: | 410 | case RTC_UIE_ON: |
| 411 | mutex_unlock(&rtc->ops_lock); | ||
| 410 | err = set_uie(rtc); | 412 | err = set_uie(rtc); |
| 413 | return err; | ||
| 411 | #endif | 414 | #endif |
| 412 | default: | 415 | default: |
| 413 | err = -ENOTTY; | 416 | err = -ENOTTY; |
| @@ -419,6 +422,12 @@ done: | |||
| 419 | return err; | 422 | return err; |
| 420 | } | 423 | } |
| 421 | 424 | ||
| 425 | static int rtc_dev_fasync(int fd, struct file *file, int on) | ||
| 426 | { | ||
| 427 | struct rtc_device *rtc = file->private_data; | ||
| 428 | return fasync_helper(fd, file, on, &rtc->async_queue); | ||
| 429 | } | ||
| 430 | |||
| 422 | static int rtc_dev_release(struct inode *inode, struct file *file) | 431 | static int rtc_dev_release(struct inode *inode, struct file *file) |
| 423 | { | 432 | { |
| 424 | struct rtc_device *rtc = file->private_data; | 433 | struct rtc_device *rtc = file->private_data; |
| @@ -431,16 +440,13 @@ static int rtc_dev_release(struct inode *inode, struct file *file) | |||
| 431 | if (rtc->ops->release) | 440 | if (rtc->ops->release) |
| 432 | rtc->ops->release(rtc->dev.parent); | 441 | rtc->ops->release(rtc->dev.parent); |
| 433 | 442 | ||
| 443 | if (file->f_flags & FASYNC) | ||
| 444 | rtc_dev_fasync(-1, file, 0); | ||
| 445 | |||
| 434 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); | 446 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); |
| 435 | return 0; | 447 | return 0; |
| 436 | } | 448 | } |
| 437 | 449 | ||
| 438 | static int rtc_dev_fasync(int fd, struct file *file, int on) | ||
| 439 | { | ||
| 440 | struct rtc_device *rtc = file->private_data; | ||
| 441 | return fasync_helper(fd, file, on, &rtc->async_queue); | ||
| 442 | } | ||
| 443 | |||
| 444 | static const struct file_operations rtc_dev_fops = { | 450 | static const struct file_operations rtc_dev_fops = { |
| 445 | .owner = THIS_MODULE, | 451 | .owner = THIS_MODULE, |
| 446 | .llseek = no_llseek, | 452 | .llseek = no_llseek, |
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 640acd20fdde..a150418fba76 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
| @@ -173,7 +173,7 @@ static int ds1374_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
| 173 | int cr, sr; | 173 | int cr, sr; |
| 174 | int ret = 0; | 174 | int ret = 0; |
| 175 | 175 | ||
| 176 | if (client->irq < 0) | 176 | if (client->irq <= 0) |
| 177 | return -EINVAL; | 177 | return -EINVAL; |
| 178 | 178 | ||
| 179 | mutex_lock(&ds1374->mutex); | 179 | mutex_lock(&ds1374->mutex); |
| @@ -212,7 +212,7 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
| 212 | int cr; | 212 | int cr; |
| 213 | int ret = 0; | 213 | int ret = 0; |
| 214 | 214 | ||
| 215 | if (client->irq < 0) | 215 | if (client->irq <= 0) |
| 216 | return -EINVAL; | 216 | return -EINVAL; |
| 217 | 217 | ||
| 218 | ret = ds1374_read_time(dev, &now); | 218 | ret = ds1374_read_time(dev, &now); |
| @@ -381,7 +381,7 @@ static int ds1374_probe(struct i2c_client *client, | |||
| 381 | if (ret) | 381 | if (ret) |
| 382 | goto out_free; | 382 | goto out_free; |
| 383 | 383 | ||
| 384 | if (client->irq >= 0) { | 384 | if (client->irq > 0) { |
| 385 | ret = request_irq(client->irq, ds1374_irq, 0, | 385 | ret = request_irq(client->irq, ds1374_irq, 0, |
| 386 | "ds1374", client); | 386 | "ds1374", client); |
| 387 | if (ret) { | 387 | if (ret) { |
| @@ -401,7 +401,7 @@ static int ds1374_probe(struct i2c_client *client, | |||
| 401 | return 0; | 401 | return 0; |
| 402 | 402 | ||
| 403 | out_irq: | 403 | out_irq: |
| 404 | if (client->irq >= 0) | 404 | if (client->irq > 0) |
| 405 | free_irq(client->irq, client); | 405 | free_irq(client->irq, client); |
| 406 | 406 | ||
| 407 | out_free: | 407 | out_free: |
| @@ -414,7 +414,7 @@ static int __devexit ds1374_remove(struct i2c_client *client) | |||
| 414 | { | 414 | { |
| 415 | struct ds1374 *ds1374 = i2c_get_clientdata(client); | 415 | struct ds1374 *ds1374 = i2c_get_clientdata(client); |
| 416 | 416 | ||
| 417 | if (client->irq >= 0) { | 417 | if (client->irq > 0) { |
| 418 | mutex_lock(&ds1374->mutex); | 418 | mutex_lock(&ds1374->mutex); |
| 419 | ds1374->exiting = 1; | 419 | ds1374->exiting = 1; |
| 420 | mutex_unlock(&ds1374->mutex); | 420 | mutex_unlock(&ds1374->mutex); |
diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c index 9f996ec881ce..dd70bf73ce9d 100644 --- a/drivers/rtc/rtc-lib.c +++ b/drivers/rtc/rtc-lib.c | |||
| @@ -51,10 +51,11 @@ EXPORT_SYMBOL(rtc_year_days); | |||
| 51 | */ | 51 | */ |
| 52 | void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) | 52 | void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) |
| 53 | { | 53 | { |
| 54 | unsigned int days, month, year; | 54 | unsigned int month, year; |
| 55 | int days; | ||
| 55 | 56 | ||
| 56 | days = time / 86400; | 57 | days = time / 86400; |
| 57 | time -= days * 86400; | 58 | time -= (unsigned int) days * 86400; |
| 58 | 59 | ||
| 59 | /* day of the week, 1970-01-01 was a Thursday */ | 60 | /* day of the week, 1970-01-01 was a Thursday */ |
| 60 | tm->tm_wday = (days + 4) % 7; | 61 | tm->tm_wday = (days + 4) % 7; |
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 12f0310ae89c..78b2551fb19d 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
| @@ -20,8 +20,6 @@ | |||
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 23 | #include <linux/version.h> | ||
| 24 | |||
| 25 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
| 26 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
| 27 | #include <linux/init.h> | 25 | #include <linux/init.h> |
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index b35f9bfa2af4..395985b339c9 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/version.h> | ||
| 18 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
| 19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
| 20 | #include <linux/device.h> | 19 | #include <linux/device.h> |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 1b6c52ef7339..acb78017e7d0 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
| @@ -2333,13 +2333,11 @@ int dasd_generic_notify(struct ccw_device *cdev, int event) | |||
| 2333 | { | 2333 | { |
| 2334 | struct dasd_device *device; | 2334 | struct dasd_device *device; |
| 2335 | struct dasd_ccw_req *cqr; | 2335 | struct dasd_ccw_req *cqr; |
| 2336 | unsigned long flags; | ||
| 2337 | int ret; | 2336 | int ret; |
| 2338 | 2337 | ||
| 2339 | device = dasd_device_from_cdev(cdev); | 2338 | device = dasd_device_from_cdev_locked(cdev); |
| 2340 | if (IS_ERR(device)) | 2339 | if (IS_ERR(device)) |
| 2341 | return 0; | 2340 | return 0; |
| 2342 | spin_lock_irqsave(get_ccwdev_lock(cdev), flags); | ||
| 2343 | ret = 0; | 2341 | ret = 0; |
| 2344 | switch (event) { | 2342 | switch (event) { |
| 2345 | case CIO_GONE: | 2343 | case CIO_GONE: |
| @@ -2369,7 +2367,6 @@ int dasd_generic_notify(struct ccw_device *cdev, int event) | |||
| 2369 | ret = 1; | 2367 | ret = 1; |
| 2370 | break; | 2368 | break; |
| 2371 | } | 2369 | } |
| 2372 | spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); | ||
| 2373 | dasd_put_device(device); | 2370 | dasd_put_device(device); |
| 2374 | return ret; | 2371 | return ret; |
| 2375 | } | 2372 | } |
diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h index 4bf0aa5112c1..2476f87d21d0 100644 --- a/drivers/s390/block/dasd_eckd.h +++ b/drivers/s390/block/dasd_eckd.h | |||
| @@ -308,7 +308,7 @@ struct dasd_psf_prssd_data { | |||
| 308 | unsigned char flags; | 308 | unsigned char flags; |
| 309 | unsigned char reserved[4]; | 309 | unsigned char reserved[4]; |
| 310 | unsigned char suborder; | 310 | unsigned char suborder; |
| 311 | unsigned char varies[9]; | 311 | unsigned char varies[5]; |
| 312 | } __attribute__ ((packed)); | 312 | } __attribute__ ((packed)); |
| 313 | 313 | ||
| 314 | /* | 314 | /* |
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c index 29da4413ad43..bf512ac75b9e 100644 --- a/drivers/s390/block/dasd_eer.c +++ b/drivers/s390/block/dasd_eer.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/poll.h> | 16 | #include <linux/poll.h> |
| 17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
| 18 | #include <linux/smp_lock.h> | 18 | #include <linux/smp_lock.h> |
| 19 | #include <linux/err.h> | ||
| 19 | 20 | ||
| 20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
| 21 | #include <asm/atomic.h> | 22 | #include <asm/atomic.h> |
| @@ -457,7 +458,7 @@ int dasd_eer_enable(struct dasd_device *device) | |||
| 457 | 458 | ||
| 458 | cqr = dasd_kmalloc_request("ECKD", 1 /* SNSS */, | 459 | cqr = dasd_kmalloc_request("ECKD", 1 /* SNSS */, |
| 459 | SNSS_DATA_SIZE, device); | 460 | SNSS_DATA_SIZE, device); |
| 460 | if (!cqr) | 461 | if (IS_ERR(cqr)) |
| 461 | return -ENOMEM; | 462 | return -ENOMEM; |
| 462 | 463 | ||
| 463 | cqr->startdev = device; | 464 | cqr->startdev = device; |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 01fcdd91b846..711b3004b3e6 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
| @@ -384,6 +384,11 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char | |||
| 384 | * get minor, add to list | 384 | * get minor, add to list |
| 385 | */ | 385 | */ |
| 386 | down_write(&dcssblk_devices_sem); | 386 | down_write(&dcssblk_devices_sem); |
| 387 | if (dcssblk_get_device_by_name(local_buf)) { | ||
| 388 | up_write(&dcssblk_devices_sem); | ||
| 389 | rc = -EEXIST; | ||
| 390 | goto unload_seg; | ||
| 391 | } | ||
| 387 | rc = dcssblk_assign_free_minor(dev_info); | 392 | rc = dcssblk_assign_free_minor(dev_info); |
| 388 | if (rc) { | 393 | if (rc) { |
| 389 | up_write(&dcssblk_devices_sem); | 394 | up_write(&dcssblk_devices_sem); |
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 687720b552d1..be0ce2215c8d 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c | |||
| @@ -109,7 +109,7 @@ tapechar_check_idalbuffer(struct tape_device *device, size_t block_size) | |||
| 109 | 109 | ||
| 110 | /* The current idal buffer is not correct. Allocate a new one. */ | 110 | /* The current idal buffer is not correct. Allocate a new one. */ |
| 111 | new = idal_buffer_alloc(block_size, 0); | 111 | new = idal_buffer_alloc(block_size, 0); |
| 112 | if (new == NULL) | 112 | if (IS_ERR(new)) |
| 113 | return -ENOMEM; | 113 | return -ENOMEM; |
| 114 | 114 | ||
| 115 | if (device->char_data.idal_buf != NULL) | 115 | if (device->char_data.idal_buf != NULL) |
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c index 2a1af4e60be0..cc8fd781ee22 100644 --- a/drivers/s390/char/tape_std.c +++ b/drivers/s390/char/tape_std.c | |||
| @@ -248,7 +248,7 @@ tape_std_mtsetblk(struct tape_device *device, int count) | |||
| 248 | 248 | ||
| 249 | /* Allocate a new idal buffer. */ | 249 | /* Allocate a new idal buffer. */ |
| 250 | new = idal_buffer_alloc(count, 0); | 250 | new = idal_buffer_alloc(count, 0); |
| 251 | if (new == NULL) | 251 | if (IS_ERR(new)) |
| 252 | return -ENOMEM; | 252 | return -ENOMEM; |
| 253 | if (device->char_data.idal_buf != NULL) | 253 | if (device->char_data.idal_buf != NULL) |
| 254 | idal_buffer_free(device->char_data.idal_buf); | 254 | idal_buffer_free(device->char_data.idal_buf); |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 26a930e832bd..9a50f245774b 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
| @@ -112,8 +112,11 @@ ccwgroup_release (struct device *dev) | |||
| 112 | gdev = to_ccwgroupdev(dev); | 112 | gdev = to_ccwgroupdev(dev); |
| 113 | 113 | ||
| 114 | for (i = 0; i < gdev->count; i++) { | 114 | for (i = 0; i < gdev->count; i++) { |
| 115 | dev_set_drvdata(&gdev->cdev[i]->dev, NULL); | 115 | if (gdev->cdev[i]) { |
| 116 | put_device(&gdev->cdev[i]->dev); | 116 | if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev) |
| 117 | dev_set_drvdata(&gdev->cdev[i]->dev, NULL); | ||
| 118 | put_device(&gdev->cdev[i]->dev); | ||
| 119 | } | ||
| 117 | } | 120 | } |
| 118 | kfree(gdev); | 121 | kfree(gdev); |
| 119 | } | 122 | } |
| @@ -221,6 +224,13 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, | |||
| 221 | atomic_set(&gdev->onoff, 0); | 224 | atomic_set(&gdev->onoff, 0); |
| 222 | mutex_init(&gdev->reg_mutex); | 225 | mutex_init(&gdev->reg_mutex); |
| 223 | mutex_lock(&gdev->reg_mutex); | 226 | mutex_lock(&gdev->reg_mutex); |
| 227 | gdev->creator_id = creator_id; | ||
| 228 | gdev->count = num_devices; | ||
| 229 | gdev->dev.bus = &ccwgroup_bus_type; | ||
| 230 | gdev->dev.parent = root; | ||
| 231 | gdev->dev.release = ccwgroup_release; | ||
| 232 | device_initialize(&gdev->dev); | ||
| 233 | |||
| 224 | curr_buf = buf; | 234 | curr_buf = buf; |
| 225 | for (i = 0; i < num_devices && curr_buf; i++) { | 235 | for (i = 0; i < num_devices && curr_buf; i++) { |
| 226 | rc = __get_next_bus_id(&curr_buf, tmp_bus_id); | 236 | rc = __get_next_bus_id(&curr_buf, tmp_bus_id); |
| @@ -258,16 +268,11 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, | |||
| 258 | rc = -EINVAL; | 268 | rc = -EINVAL; |
| 259 | goto error; | 269 | goto error; |
| 260 | } | 270 | } |
| 261 | gdev->creator_id = creator_id; | ||
| 262 | gdev->count = num_devices; | ||
| 263 | gdev->dev.bus = &ccwgroup_bus_type; | ||
| 264 | gdev->dev.parent = root; | ||
| 265 | gdev->dev.release = ccwgroup_release; | ||
| 266 | 271 | ||
| 267 | snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", | 272 | snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", |
| 268 | gdev->cdev[0]->dev.bus_id); | 273 | gdev->cdev[0]->dev.bus_id); |
| 269 | 274 | ||
| 270 | rc = device_register(&gdev->dev); | 275 | rc = device_add(&gdev->dev); |
| 271 | if (rc) | 276 | if (rc) |
| 272 | goto error; | 277 | goto error; |
| 273 | get_device(&gdev->dev); | 278 | get_device(&gdev->dev); |
| @@ -292,6 +297,7 @@ error: | |||
| 292 | if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev) | 297 | if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev) |
| 293 | dev_set_drvdata(&gdev->cdev[i]->dev, NULL); | 298 | dev_set_drvdata(&gdev->cdev[i]->dev, NULL); |
| 294 | put_device(&gdev->cdev[i]->dev); | 299 | put_device(&gdev->cdev[i]->dev); |
| 300 | gdev->cdev[i] = NULL; | ||
| 295 | } | 301 | } |
| 296 | mutex_unlock(&gdev->reg_mutex); | 302 | mutex_unlock(&gdev->reg_mutex); |
| 297 | put_device(&gdev->dev); | 303 | put_device(&gdev->dev); |
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index db00b0591733..f1216cf6fa8f 100644 --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c | |||
| @@ -423,7 +423,7 @@ int chp_new(struct chp_id chpid) | |||
| 423 | ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); | 423 | ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); |
| 424 | if (ret) { | 424 | if (ret) { |
| 425 | device_unregister(&chp->dev); | 425 | device_unregister(&chp->dev); |
| 426 | goto out_free; | 426 | goto out; |
| 427 | } | 427 | } |
| 428 | mutex_lock(&channel_subsystems[chpid.cssid]->mutex); | 428 | mutex_lock(&channel_subsystems[chpid.cssid]->mutex); |
| 429 | if (channel_subsystems[chpid.cssid]->cm_enabled) { | 429 | if (channel_subsystems[chpid.cssid]->cm_enabled) { |
| @@ -432,14 +432,15 @@ int chp_new(struct chp_id chpid) | |||
| 432 | sysfs_remove_group(&chp->dev.kobj, &chp_attr_group); | 432 | sysfs_remove_group(&chp->dev.kobj, &chp_attr_group); |
| 433 | device_unregister(&chp->dev); | 433 | device_unregister(&chp->dev); |
| 434 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); | 434 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); |
| 435 | goto out_free; | 435 | goto out; |
| 436 | } | 436 | } |
| 437 | } | 437 | } |
| 438 | channel_subsystems[chpid.cssid]->chps[chpid.id] = chp; | 438 | channel_subsystems[chpid.cssid]->chps[chpid.id] = chp; |
| 439 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); | 439 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); |
| 440 | return ret; | 440 | goto out; |
| 441 | out_free: | 441 | out_free: |
| 442 | kfree(chp); | 442 | kfree(chp); |
| 443 | out: | ||
| 443 | return ret; | 444 | return ret; |
| 444 | } | 445 | } |
| 445 | 446 | ||
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 33bff8fec7d1..326f4cc7f92c 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
| @@ -174,6 +174,7 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */ | |||
| 174 | CIO_TRACE_EVENT(4, sch->dev.bus_id); | 174 | CIO_TRACE_EVENT(4, sch->dev.bus_id); |
| 175 | 175 | ||
| 176 | orb = &to_io_private(sch)->orb; | 176 | orb = &to_io_private(sch)->orb; |
| 177 | memset(orb, 0, sizeof(union orb)); | ||
| 177 | /* sch is always under 2G. */ | 178 | /* sch is always under 2G. */ |
| 178 | orb->cmd.intparm = (u32)(addr_t)sch; | 179 | orb->cmd.intparm = (u32)(addr_t)sch; |
| 179 | orb->cmd.fmt = 1; | 180 | orb->cmd.fmt = 1; |
| @@ -208,8 +209,10 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */ | |||
| 208 | case 1: /* status pending */ | 209 | case 1: /* status pending */ |
| 209 | case 2: /* busy */ | 210 | case 2: /* busy */ |
| 210 | return -EBUSY; | 211 | return -EBUSY; |
| 211 | default: /* device/path not operational */ | 212 | case 3: /* device/path not operational */ |
| 212 | return cio_start_handle_notoper(sch, lpm); | 213 | return cio_start_handle_notoper(sch, lpm); |
| 214 | default: | ||
| 215 | return ccode; | ||
| 213 | } | 216 | } |
| 214 | } | 217 | } |
| 215 | 218 | ||
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 46c021d880dc..1261e1a9e8cd 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
| @@ -477,7 +477,6 @@ void css_schedule_eval_all(void) | |||
| 477 | 477 | ||
| 478 | void css_wait_for_slow_path(void) | 478 | void css_wait_for_slow_path(void) |
| 479 | { | 479 | { |
| 480 | flush_workqueue(ccw_device_notify_work); | ||
| 481 | flush_workqueue(slow_path_wq); | 480 | flush_workqueue(slow_path_wq); |
| 482 | } | 481 | } |
| 483 | 482 | ||
| @@ -634,6 +633,11 @@ channel_subsystem_release(struct device *dev) | |||
| 634 | 633 | ||
| 635 | css = to_css(dev); | 634 | css = to_css(dev); |
| 636 | mutex_destroy(&css->mutex); | 635 | mutex_destroy(&css->mutex); |
| 636 | if (css->pseudo_subchannel) { | ||
| 637 | /* Implies that it has been generated but never registered. */ | ||
| 638 | css_subchannel_release(&css->pseudo_subchannel->dev); | ||
| 639 | css->pseudo_subchannel = NULL; | ||
| 640 | } | ||
| 637 | kfree(css); | 641 | kfree(css); |
| 638 | } | 642 | } |
| 639 | 643 | ||
| @@ -786,11 +790,15 @@ init_channel_subsystem (void) | |||
| 786 | } | 790 | } |
| 787 | channel_subsystems[i] = css; | 791 | channel_subsystems[i] = css; |
| 788 | ret = setup_css(i); | 792 | ret = setup_css(i); |
| 789 | if (ret) | 793 | if (ret) { |
| 790 | goto out_free; | 794 | kfree(channel_subsystems[i]); |
| 795 | goto out_unregister; | ||
| 796 | } | ||
| 791 | ret = device_register(&css->device); | 797 | ret = device_register(&css->device); |
| 792 | if (ret) | 798 | if (ret) { |
| 793 | goto out_free_all; | 799 | put_device(&css->device); |
| 800 | goto out_unregister; | ||
| 801 | } | ||
| 794 | if (css_chsc_characteristics.secm) { | 802 | if (css_chsc_characteristics.secm) { |
| 795 | ret = device_create_file(&css->device, | 803 | ret = device_create_file(&css->device, |
| 796 | &dev_attr_cm_enable); | 804 | &dev_attr_cm_enable); |
| @@ -803,7 +811,7 @@ init_channel_subsystem (void) | |||
| 803 | } | 811 | } |
| 804 | ret = register_reboot_notifier(&css_reboot_notifier); | 812 | ret = register_reboot_notifier(&css_reboot_notifier); |
| 805 | if (ret) | 813 | if (ret) |
| 806 | goto out_pseudo; | 814 | goto out_unregister; |
| 807 | css_init_done = 1; | 815 | css_init_done = 1; |
| 808 | 816 | ||
| 809 | /* Enable default isc for I/O subchannels. */ | 817 | /* Enable default isc for I/O subchannels. */ |
| @@ -811,18 +819,12 @@ init_channel_subsystem (void) | |||
| 811 | 819 | ||
| 812 | for_each_subchannel(__init_channel_subsystem, NULL); | 820 | for_each_subchannel(__init_channel_subsystem, NULL); |
| 813 | return 0; | 821 | return 0; |
| 814 | out_pseudo: | ||
| 815 | device_unregister(&channel_subsystems[i]->pseudo_subchannel->dev); | ||
| 816 | out_file: | 822 | out_file: |
| 817 | device_remove_file(&channel_subsystems[i]->device, | 823 | if (css_chsc_characteristics.secm) |
| 818 | &dev_attr_cm_enable); | 824 | device_remove_file(&channel_subsystems[i]->device, |
| 825 | &dev_attr_cm_enable); | ||
| 819 | out_device: | 826 | out_device: |
| 820 | device_unregister(&channel_subsystems[i]->device); | 827 | device_unregister(&channel_subsystems[i]->device); |
| 821 | out_free_all: | ||
| 822 | kfree(channel_subsystems[i]->pseudo_subchannel->lock); | ||
| 823 | kfree(channel_subsystems[i]->pseudo_subchannel); | ||
| 824 | out_free: | ||
| 825 | kfree(channel_subsystems[i]); | ||
| 826 | out_unregister: | 828 | out_unregister: |
| 827 | while (i > 0) { | 829 | while (i > 0) { |
| 828 | struct channel_subsystem *css; | 830 | struct channel_subsystem *css; |
| @@ -830,6 +832,7 @@ out_unregister: | |||
| 830 | i--; | 832 | i--; |
| 831 | css = channel_subsystems[i]; | 833 | css = channel_subsystems[i]; |
| 832 | device_unregister(&css->pseudo_subchannel->dev); | 834 | device_unregister(&css->pseudo_subchannel->dev); |
| 835 | css->pseudo_subchannel = NULL; | ||
| 833 | if (css_chsc_characteristics.secm) | 836 | if (css_chsc_characteristics.secm) |
| 834 | device_remove_file(&css->device, | 837 | device_remove_file(&css->device, |
| 835 | &dev_attr_cm_enable); | 838 | &dev_attr_cm_enable); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index e818d0c54c09..28221030b886 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
| @@ -150,7 +150,6 @@ static struct css_driver io_subchannel_driver = { | |||
| 150 | }; | 150 | }; |
| 151 | 151 | ||
| 152 | struct workqueue_struct *ccw_device_work; | 152 | struct workqueue_struct *ccw_device_work; |
| 153 | struct workqueue_struct *ccw_device_notify_work; | ||
| 154 | wait_queue_head_t ccw_device_init_wq; | 153 | wait_queue_head_t ccw_device_init_wq; |
| 155 | atomic_t ccw_device_init_count; | 154 | atomic_t ccw_device_init_count; |
| 156 | 155 | ||
| @@ -168,11 +167,6 @@ init_ccw_bus_type (void) | |||
| 168 | ccw_device_work = create_singlethread_workqueue("cio"); | 167 | ccw_device_work = create_singlethread_workqueue("cio"); |
| 169 | if (!ccw_device_work) | 168 | if (!ccw_device_work) |
| 170 | return -ENOMEM; /* FIXME: better errno ? */ | 169 | return -ENOMEM; /* FIXME: better errno ? */ |
| 171 | ccw_device_notify_work = create_singlethread_workqueue("cio_notify"); | ||
| 172 | if (!ccw_device_notify_work) { | ||
| 173 | ret = -ENOMEM; /* FIXME: better errno ? */ | ||
| 174 | goto out_err; | ||
| 175 | } | ||
| 176 | slow_path_wq = create_singlethread_workqueue("kslowcrw"); | 170 | slow_path_wq = create_singlethread_workqueue("kslowcrw"); |
| 177 | if (!slow_path_wq) { | 171 | if (!slow_path_wq) { |
| 178 | ret = -ENOMEM; /* FIXME: better errno ? */ | 172 | ret = -ENOMEM; /* FIXME: better errno ? */ |
| @@ -192,8 +186,6 @@ init_ccw_bus_type (void) | |||
| 192 | out_err: | 186 | out_err: |
| 193 | if (ccw_device_work) | 187 | if (ccw_device_work) |
| 194 | destroy_workqueue(ccw_device_work); | 188 | destroy_workqueue(ccw_device_work); |
| 195 | if (ccw_device_notify_work) | ||
| 196 | destroy_workqueue(ccw_device_notify_work); | ||
| 197 | if (slow_path_wq) | 189 | if (slow_path_wq) |
| 198 | destroy_workqueue(slow_path_wq); | 190 | destroy_workqueue(slow_path_wq); |
| 199 | return ret; | 191 | return ret; |
| @@ -204,7 +196,6 @@ cleanup_ccw_bus_type (void) | |||
| 204 | { | 196 | { |
| 205 | css_driver_unregister(&io_subchannel_driver); | 197 | css_driver_unregister(&io_subchannel_driver); |
| 206 | bus_unregister(&ccw_bus_type); | 198 | bus_unregister(&ccw_bus_type); |
| 207 | destroy_workqueue(ccw_device_notify_work); | ||
| 208 | destroy_workqueue(ccw_device_work); | 199 | destroy_workqueue(ccw_device_work); |
| 209 | } | 200 | } |
| 210 | 201 | ||
| @@ -1496,11 +1487,22 @@ static void device_set_disconnected(struct ccw_device *cdev) | |||
| 1496 | ccw_device_schedule_recovery(); | 1487 | ccw_device_schedule_recovery(); |
| 1497 | } | 1488 | } |
| 1498 | 1489 | ||
| 1490 | void ccw_device_set_notoper(struct ccw_device *cdev) | ||
| 1491 | { | ||
| 1492 | struct subchannel *sch = to_subchannel(cdev->dev.parent); | ||
| 1493 | |||
| 1494 | CIO_TRACE_EVENT(2, "notoper"); | ||
| 1495 | CIO_TRACE_EVENT(2, sch->dev.bus_id); | ||
| 1496 | ccw_device_set_timeout(cdev, 0); | ||
| 1497 | cio_disable_subchannel(sch); | ||
| 1498 | cdev->private->state = DEV_STATE_NOT_OPER; | ||
| 1499 | } | ||
| 1500 | |||
| 1499 | static int io_subchannel_sch_event(struct subchannel *sch, int slow) | 1501 | static int io_subchannel_sch_event(struct subchannel *sch, int slow) |
| 1500 | { | 1502 | { |
| 1501 | int event, ret, disc; | 1503 | int event, ret, disc; |
| 1502 | unsigned long flags; | 1504 | unsigned long flags; |
| 1503 | enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE } action; | 1505 | enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE, DISC } action; |
| 1504 | struct ccw_device *cdev; | 1506 | struct ccw_device *cdev; |
| 1505 | 1507 | ||
| 1506 | spin_lock_irqsave(sch->lock, flags); | 1508 | spin_lock_irqsave(sch->lock, flags); |
| @@ -1535,16 +1537,11 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow) | |||
| 1535 | } | 1537 | } |
| 1536 | /* fall through */ | 1538 | /* fall through */ |
| 1537 | case CIO_GONE: | 1539 | case CIO_GONE: |
| 1538 | /* Prevent unwanted effects when opening lock. */ | ||
| 1539 | cio_disable_subchannel(sch); | ||
| 1540 | device_set_disconnected(cdev); | ||
| 1541 | /* Ask driver what to do with device. */ | 1540 | /* Ask driver what to do with device. */ |
| 1542 | action = UNREGISTER; | 1541 | if (io_subchannel_notify(sch, event)) |
| 1543 | spin_unlock_irqrestore(sch->lock, flags); | 1542 | action = DISC; |
| 1544 | ret = io_subchannel_notify(sch, event); | 1543 | else |
| 1545 | spin_lock_irqsave(sch->lock, flags); | 1544 | action = UNREGISTER; |
| 1546 | if (ret) | ||
| 1547 | action = NONE; | ||
| 1548 | break; | 1545 | break; |
| 1549 | case CIO_REVALIDATE: | 1546 | case CIO_REVALIDATE: |
| 1550 | /* Device will be removed, so no notify necessary. */ | 1547 | /* Device will be removed, so no notify necessary. */ |
| @@ -1565,6 +1562,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow) | |||
| 1565 | switch (action) { | 1562 | switch (action) { |
| 1566 | case UNREGISTER: | 1563 | case UNREGISTER: |
| 1567 | case UNREGISTER_PROBE: | 1564 | case UNREGISTER_PROBE: |
| 1565 | ccw_device_set_notoper(cdev); | ||
| 1568 | /* Unregister device (will use subchannel lock). */ | 1566 | /* Unregister device (will use subchannel lock). */ |
| 1569 | spin_unlock_irqrestore(sch->lock, flags); | 1567 | spin_unlock_irqrestore(sch->lock, flags); |
| 1570 | css_sch_device_unregister(sch); | 1568 | css_sch_device_unregister(sch); |
| @@ -1577,6 +1575,9 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow) | |||
| 1577 | case REPROBE: | 1575 | case REPROBE: |
| 1578 | ccw_device_trigger_reprobe(cdev); | 1576 | ccw_device_trigger_reprobe(cdev); |
| 1579 | break; | 1577 | break; |
| 1578 | case DISC: | ||
| 1579 | device_set_disconnected(cdev); | ||
| 1580 | break; | ||
| 1580 | default: | 1581 | default: |
| 1581 | break; | 1582 | break; |
| 1582 | } | 1583 | } |
| @@ -1828,5 +1829,4 @@ EXPORT_SYMBOL(ccw_driver_unregister); | |||
| 1828 | EXPORT_SYMBOL(get_ccwdev_by_busid); | 1829 | EXPORT_SYMBOL(get_ccwdev_by_busid); |
| 1829 | EXPORT_SYMBOL(ccw_bus_type); | 1830 | EXPORT_SYMBOL(ccw_bus_type); |
| 1830 | EXPORT_SYMBOL(ccw_device_work); | 1831 | EXPORT_SYMBOL(ccw_device_work); |
| 1831 | EXPORT_SYMBOL(ccw_device_notify_work); | ||
| 1832 | EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id); | 1832 | EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id); |
diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h index 9800a8335a3f..6f5c3f2b3587 100644 --- a/drivers/s390/cio/device.h +++ b/drivers/s390/cio/device.h | |||
| @@ -72,7 +72,6 @@ dev_fsm_final_state(struct ccw_device *cdev) | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | extern struct workqueue_struct *ccw_device_work; | 74 | extern struct workqueue_struct *ccw_device_work; |
| 75 | extern struct workqueue_struct *ccw_device_notify_work; | ||
| 76 | extern wait_queue_head_t ccw_device_init_wq; | 75 | extern wait_queue_head_t ccw_device_init_wq; |
| 77 | extern atomic_t ccw_device_init_count; | 76 | extern atomic_t ccw_device_init_count; |
| 78 | 77 | ||
| @@ -120,6 +119,7 @@ int ccw_device_stlck(struct ccw_device *); | |||
| 120 | void ccw_device_trigger_reprobe(struct ccw_device *); | 119 | void ccw_device_trigger_reprobe(struct ccw_device *); |
| 121 | void ccw_device_kill_io(struct ccw_device *); | 120 | void ccw_device_kill_io(struct ccw_device *); |
| 122 | int ccw_device_notify(struct ccw_device *, int); | 121 | int ccw_device_notify(struct ccw_device *, int); |
| 122 | void ccw_device_set_notoper(struct ccw_device *cdev); | ||
| 123 | 123 | ||
| 124 | /* qdio needs this. */ | 124 | /* qdio needs this. */ |
| 125 | void ccw_device_set_timeout(struct ccw_device *, int); | 125 | void ccw_device_set_timeout(struct ccw_device *, int); |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 8b5fe57fb2f3..84cc9ea346db 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
| @@ -337,26 +337,34 @@ int ccw_device_notify(struct ccw_device *cdev, int event) | |||
| 337 | return 0; | 337 | return 0; |
| 338 | if (!cdev->online) | 338 | if (!cdev->online) |
| 339 | return 0; | 339 | return 0; |
| 340 | CIO_MSG_EVENT(2, "notify called for 0.%x.%04x, event=%d\n", | ||
| 341 | cdev->private->dev_id.ssid, cdev->private->dev_id.devno, | ||
| 342 | event); | ||
| 340 | return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0; | 343 | return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0; |
| 341 | } | 344 | } |
| 342 | 345 | ||
| 343 | static void | 346 | static void cmf_reenable_delayed(struct work_struct *work) |
| 344 | ccw_device_oper_notify(struct work_struct *work) | ||
| 345 | { | 347 | { |
| 346 | struct ccw_device_private *priv; | 348 | struct ccw_device_private *priv; |
| 347 | struct ccw_device *cdev; | 349 | struct ccw_device *cdev; |
| 348 | int ret; | ||
| 349 | 350 | ||
| 350 | priv = container_of(work, struct ccw_device_private, kick_work); | 351 | priv = container_of(work, struct ccw_device_private, kick_work); |
| 351 | cdev = priv->cdev; | 352 | cdev = priv->cdev; |
| 352 | ret = ccw_device_notify(cdev, CIO_OPER); | 353 | cmf_reenable(cdev); |
| 353 | if (ret) { | 354 | } |
| 355 | |||
| 356 | static void ccw_device_oper_notify(struct ccw_device *cdev) | ||
| 357 | { | ||
| 358 | if (ccw_device_notify(cdev, CIO_OPER)) { | ||
| 354 | /* Reenable channel measurements, if needed. */ | 359 | /* Reenable channel measurements, if needed. */ |
| 355 | cmf_reenable(cdev); | 360 | PREPARE_WORK(&cdev->private->kick_work, cmf_reenable_delayed); |
| 356 | wake_up(&cdev->private->wait_q); | 361 | queue_work(ccw_device_work, &cdev->private->kick_work); |
| 357 | } else | 362 | return; |
| 358 | /* Driver doesn't want device back. */ | 363 | } |
| 359 | ccw_device_do_unreg_rereg(work); | 364 | /* Driver doesn't want device back. */ |
| 365 | ccw_device_set_notoper(cdev); | ||
| 366 | PREPARE_WORK(&cdev->private->kick_work, ccw_device_do_unreg_rereg); | ||
| 367 | queue_work(ccw_device_work, &cdev->private->kick_work); | ||
| 360 | } | 368 | } |
| 361 | 369 | ||
| 362 | /* | 370 | /* |
| @@ -386,8 +394,7 @@ ccw_device_done(struct ccw_device *cdev, int state) | |||
| 386 | 394 | ||
| 387 | if (cdev->private->flags.donotify) { | 395 | if (cdev->private->flags.donotify) { |
| 388 | cdev->private->flags.donotify = 0; | 396 | cdev->private->flags.donotify = 0; |
| 389 | PREPARE_WORK(&cdev->private->kick_work, ccw_device_oper_notify); | 397 | ccw_device_oper_notify(cdev); |
| 390 | queue_work(ccw_device_notify_work, &cdev->private->kick_work); | ||
| 391 | } | 398 | } |
| 392 | wake_up(&cdev->private->wait_q); | 399 | wake_up(&cdev->private->wait_q); |
| 393 | 400 | ||
| @@ -651,6 +658,13 @@ ccw_device_offline(struct ccw_device *cdev) | |||
| 651 | { | 658 | { |
| 652 | struct subchannel *sch; | 659 | struct subchannel *sch; |
| 653 | 660 | ||
| 661 | /* Allow ccw_device_offline while disconnected. */ | ||
| 662 | if (cdev->private->state == DEV_STATE_DISCONNECTED || | ||
| 663 | cdev->private->state == DEV_STATE_NOT_OPER) { | ||
| 664 | cdev->private->flags.donotify = 0; | ||
| 665 | ccw_device_done(cdev, DEV_STATE_NOT_OPER); | ||
| 666 | return 0; | ||
| 667 | } | ||
| 654 | if (ccw_device_is_orphan(cdev)) { | 668 | if (ccw_device_is_orphan(cdev)) { |
| 655 | ccw_device_done(cdev, DEV_STATE_OFFLINE); | 669 | ccw_device_done(cdev, DEV_STATE_OFFLINE); |
| 656 | return 0; | 670 | return 0; |
diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h index 8484b83698e1..5a4d85b829ad 100644 --- a/drivers/s390/cio/qdio_debug.h +++ b/drivers/s390/cio/qdio_debug.h | |||
| @@ -61,18 +61,18 @@ | |||
| 61 | 61 | ||
| 62 | /* s390dbf views */ | 62 | /* s390dbf views */ |
| 63 | #define QDIO_DBF_SETUP_LEN 8 | 63 | #define QDIO_DBF_SETUP_LEN 8 |
| 64 | #define QDIO_DBF_SETUP_PAGES 4 | 64 | #define QDIO_DBF_SETUP_PAGES 8 |
| 65 | #define QDIO_DBF_SETUP_NR_AREAS 1 | 65 | #define QDIO_DBF_SETUP_NR_AREAS 1 |
| 66 | 66 | ||
| 67 | #define QDIO_DBF_TRACE_LEN 8 | 67 | #define QDIO_DBF_TRACE_LEN 8 |
| 68 | #define QDIO_DBF_TRACE_NR_AREAS 2 | 68 | #define QDIO_DBF_TRACE_NR_AREAS 2 |
| 69 | 69 | ||
| 70 | #ifdef CONFIG_QDIO_DEBUG | 70 | #ifdef CONFIG_QDIO_DEBUG |
| 71 | #define QDIO_DBF_TRACE_PAGES 16 | 71 | #define QDIO_DBF_TRACE_PAGES 32 |
| 72 | #define QDIO_DBF_SETUP_LEVEL 6 | 72 | #define QDIO_DBF_SETUP_LEVEL 6 |
| 73 | #define QDIO_DBF_TRACE_LEVEL 4 | 73 | #define QDIO_DBF_TRACE_LEVEL 4 |
| 74 | #else /* !CONFIG_QDIO_DEBUG */ | 74 | #else /* !CONFIG_QDIO_DEBUG */ |
| 75 | #define QDIO_DBF_TRACE_PAGES 4 | 75 | #define QDIO_DBF_TRACE_PAGES 8 |
| 76 | #define QDIO_DBF_SETUP_LEVEL 2 | 76 | #define QDIO_DBF_SETUP_LEVEL 2 |
| 77 | #define QDIO_DBF_TRACE_LEVEL 2 | 77 | #define QDIO_DBF_TRACE_LEVEL 2 |
| 78 | #endif /* CONFIG_QDIO_DEBUG */ | 78 | #endif /* CONFIG_QDIO_DEBUG */ |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index d15648514a0f..e6eabc853422 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
| @@ -330,6 +330,7 @@ static int qdio_siga_output(struct qdio_q *q) | |||
| 330 | int cc; | 330 | int cc; |
| 331 | u32 busy_bit; | 331 | u32 busy_bit; |
| 332 | u64 start_time = 0; | 332 | u64 start_time = 0; |
| 333 | char dbf_text[15]; | ||
| 333 | 334 | ||
| 334 | QDIO_DBF_TEXT5(0, trace, "sigaout"); | 335 | QDIO_DBF_TEXT5(0, trace, "sigaout"); |
| 335 | QDIO_DBF_HEX5(0, trace, &q, sizeof(void *)); | 336 | QDIO_DBF_HEX5(0, trace, &q, sizeof(void *)); |
| @@ -338,6 +339,9 @@ static int qdio_siga_output(struct qdio_q *q) | |||
| 338 | again: | 339 | again: |
| 339 | cc = qdio_do_siga_output(q, &busy_bit); | 340 | cc = qdio_do_siga_output(q, &busy_bit); |
| 340 | if (queue_type(q) == QDIO_IQDIO_QFMT && cc == 2 && busy_bit) { | 341 | if (queue_type(q) == QDIO_IQDIO_QFMT && cc == 2 && busy_bit) { |
| 342 | sprintf(dbf_text, "bb%4x%2x", q->irq_ptr->schid.sch_no, q->nr); | ||
| 343 | QDIO_DBF_TEXT3(0, trace, dbf_text); | ||
| 344 | |||
| 341 | if (!start_time) | 345 | if (!start_time) |
| 342 | start_time = get_usecs(); | 346 | start_time = get_usecs(); |
| 343 | else if ((get_usecs() - start_time) < QDIO_BUSY_BIT_PATIENCE) | 347 | else if ((get_usecs() - start_time) < QDIO_BUSY_BIT_PATIENCE) |
| @@ -748,16 +752,18 @@ static void qdio_kick_outbound_q(struct qdio_q *q) | |||
| 748 | rc = qdio_siga_output(q); | 752 | rc = qdio_siga_output(q); |
| 749 | switch (rc) { | 753 | switch (rc) { |
| 750 | case 0: | 754 | case 0: |
| 751 | /* went smooth this time, reset timestamp */ | ||
| 752 | q->u.out.timestamp = 0; | ||
| 753 | |||
| 754 | /* TODO: improve error handling for CC=0 case */ | 755 | /* TODO: improve error handling for CC=0 case */ |
| 755 | #ifdef CONFIG_QDIO_DEBUG | 756 | #ifdef CONFIG_QDIO_DEBUG |
| 756 | QDIO_DBF_TEXT3(0, trace, "cc2reslv"); | 757 | if (q->u.out.timestamp) { |
| 757 | sprintf(dbf_text, "%4x%2x%2x", q->irq_ptr->schid.sch_no, q->nr, | 758 | QDIO_DBF_TEXT3(0, trace, "cc2reslv"); |
| 758 | atomic_read(&q->u.out.busy_siga_counter)); | 759 | sprintf(dbf_text, "%4x%2x%2x", q->irq_ptr->schid.sch_no, |
| 759 | QDIO_DBF_TEXT3(0, trace, dbf_text); | 760 | q->nr, |
| 761 | atomic_read(&q->u.out.busy_siga_counter)); | ||
| 762 | QDIO_DBF_TEXT3(0, trace, dbf_text); | ||
| 763 | } | ||
| 760 | #endif /* CONFIG_QDIO_DEBUG */ | 764 | #endif /* CONFIG_QDIO_DEBUG */ |
| 765 | /* went smooth this time, reset timestamp */ | ||
| 766 | q->u.out.timestamp = 0; | ||
| 761 | break; | 767 | break; |
| 762 | /* cc=2 and busy bit */ | 768 | /* cc=2 and busy bit */ |
| 763 | case (2 | QDIO_ERROR_SIGA_BUSY): | 769 | case (2 | QDIO_ERROR_SIGA_BUSY): |
| @@ -1066,14 +1072,12 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, | |||
| 1066 | if (IS_ERR(irb)) { | 1072 | if (IS_ERR(irb)) { |
| 1067 | switch (PTR_ERR(irb)) { | 1073 | switch (PTR_ERR(irb)) { |
| 1068 | case -EIO: | 1074 | case -EIO: |
| 1069 | sprintf(dbf_text, "ierr%4x", | 1075 | sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no); |
| 1070 | cdev->private->schid.sch_no); | ||
| 1071 | QDIO_DBF_TEXT2(1, setup, dbf_text); | 1076 | QDIO_DBF_TEXT2(1, setup, dbf_text); |
| 1072 | qdio_int_error(cdev); | 1077 | qdio_int_error(cdev); |
| 1073 | return; | 1078 | return; |
| 1074 | case -ETIMEDOUT: | 1079 | case -ETIMEDOUT: |
| 1075 | sprintf(dbf_text, "qtoh%4x", | 1080 | sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no); |
| 1076 | cdev->private->schid.sch_no); | ||
| 1077 | QDIO_DBF_TEXT2(1, setup, dbf_text); | 1081 | QDIO_DBF_TEXT2(1, setup, dbf_text); |
| 1078 | qdio_int_error(cdev); | 1082 | qdio_int_error(cdev); |
| 1079 | return; | 1083 | return; |
| @@ -1124,8 +1128,10 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, | |||
| 1124 | struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev) | 1128 | struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev) |
| 1125 | { | 1129 | { |
| 1126 | struct qdio_irq *irq_ptr; | 1130 | struct qdio_irq *irq_ptr; |
| 1131 | char dbf_text[15]; | ||
| 1127 | 1132 | ||
| 1128 | QDIO_DBF_TEXT0(0, setup, "getssqd"); | 1133 | sprintf(dbf_text, "qssq%4x", cdev->private->schid.sch_no); |
| 1134 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1129 | 1135 | ||
| 1130 | irq_ptr = cdev->private->qdio_data; | 1136 | irq_ptr = cdev->private->qdio_data; |
| 1131 | if (!irq_ptr) | 1137 | if (!irq_ptr) |
| @@ -1149,14 +1155,13 @@ int qdio_cleanup(struct ccw_device *cdev, int how) | |||
| 1149 | char dbf_text[15]; | 1155 | char dbf_text[15]; |
| 1150 | int rc; | 1156 | int rc; |
| 1151 | 1157 | ||
| 1158 | sprintf(dbf_text, "qcln%4x", cdev->private->schid.sch_no); | ||
| 1159 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1160 | |||
| 1152 | irq_ptr = cdev->private->qdio_data; | 1161 | irq_ptr = cdev->private->qdio_data; |
| 1153 | if (!irq_ptr) | 1162 | if (!irq_ptr) |
| 1154 | return -ENODEV; | 1163 | return -ENODEV; |
| 1155 | 1164 | ||
| 1156 | sprintf(dbf_text, "qcln%4x", irq_ptr->schid.sch_no); | ||
| 1157 | QDIO_DBF_TEXT1(0, trace, dbf_text); | ||
| 1158 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1159 | |||
| 1160 | rc = qdio_shutdown(cdev, how); | 1165 | rc = qdio_shutdown(cdev, how); |
| 1161 | if (rc == 0) | 1166 | if (rc == 0) |
| 1162 | rc = qdio_free(cdev); | 1167 | rc = qdio_free(cdev); |
| @@ -1191,6 +1196,9 @@ int qdio_shutdown(struct ccw_device *cdev, int how) | |||
| 1191 | unsigned long flags; | 1196 | unsigned long flags; |
| 1192 | char dbf_text[15]; | 1197 | char dbf_text[15]; |
| 1193 | 1198 | ||
| 1199 | sprintf(dbf_text, "qshu%4x", cdev->private->schid.sch_no); | ||
| 1200 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1201 | |||
| 1194 | irq_ptr = cdev->private->qdio_data; | 1202 | irq_ptr = cdev->private->qdio_data; |
| 1195 | if (!irq_ptr) | 1203 | if (!irq_ptr) |
| 1196 | return -ENODEV; | 1204 | return -ENODEV; |
| @@ -1205,10 +1213,6 @@ int qdio_shutdown(struct ccw_device *cdev, int how) | |||
| 1205 | return 0; | 1213 | return 0; |
| 1206 | } | 1214 | } |
| 1207 | 1215 | ||
| 1208 | sprintf(dbf_text, "qsqs%4x", irq_ptr->schid.sch_no); | ||
| 1209 | QDIO_DBF_TEXT1(0, trace, dbf_text); | ||
| 1210 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1211 | |||
| 1212 | tiqdio_remove_input_queues(irq_ptr); | 1216 | tiqdio_remove_input_queues(irq_ptr); |
| 1213 | qdio_shutdown_queues(cdev); | 1217 | qdio_shutdown_queues(cdev); |
| 1214 | qdio_shutdown_debug_entries(irq_ptr, cdev); | 1218 | qdio_shutdown_debug_entries(irq_ptr, cdev); |
| @@ -1247,7 +1251,6 @@ no_cleanup: | |||
| 1247 | 1251 | ||
| 1248 | qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); | 1252 | qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); |
| 1249 | mutex_unlock(&irq_ptr->setup_mutex); | 1253 | mutex_unlock(&irq_ptr->setup_mutex); |
| 1250 | module_put(THIS_MODULE); | ||
| 1251 | if (rc) | 1254 | if (rc) |
| 1252 | return rc; | 1255 | return rc; |
| 1253 | return 0; | 1256 | return 0; |
| @@ -1263,16 +1266,14 @@ int qdio_free(struct ccw_device *cdev) | |||
| 1263 | struct qdio_irq *irq_ptr; | 1266 | struct qdio_irq *irq_ptr; |
| 1264 | char dbf_text[15]; | 1267 | char dbf_text[15]; |
| 1265 | 1268 | ||
| 1269 | sprintf(dbf_text, "qfre%4x", cdev->private->schid.sch_no); | ||
| 1270 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1271 | |||
| 1266 | irq_ptr = cdev->private->qdio_data; | 1272 | irq_ptr = cdev->private->qdio_data; |
| 1267 | if (!irq_ptr) | 1273 | if (!irq_ptr) |
| 1268 | return -ENODEV; | 1274 | return -ENODEV; |
| 1269 | 1275 | ||
| 1270 | mutex_lock(&irq_ptr->setup_mutex); | 1276 | mutex_lock(&irq_ptr->setup_mutex); |
| 1271 | |||
| 1272 | sprintf(dbf_text, "qfqs%4x", irq_ptr->schid.sch_no); | ||
| 1273 | QDIO_DBF_TEXT1(0, trace, dbf_text); | ||
| 1274 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1275 | |||
| 1276 | cdev->private->qdio_data = NULL; | 1277 | cdev->private->qdio_data = NULL; |
| 1277 | mutex_unlock(&irq_ptr->setup_mutex); | 1278 | mutex_unlock(&irq_ptr->setup_mutex); |
| 1278 | 1279 | ||
| @@ -1295,7 +1296,6 @@ int qdio_initialize(struct qdio_initialize *init_data) | |||
| 1295 | 1296 | ||
| 1296 | sprintf(dbf_text, "qini%4x", init_data->cdev->private->schid.sch_no); | 1297 | sprintf(dbf_text, "qini%4x", init_data->cdev->private->schid.sch_no); |
| 1297 | QDIO_DBF_TEXT0(0, setup, dbf_text); | 1298 | QDIO_DBF_TEXT0(0, setup, dbf_text); |
| 1298 | QDIO_DBF_TEXT0(0, trace, dbf_text); | ||
| 1299 | 1299 | ||
| 1300 | rc = qdio_allocate(init_data); | 1300 | rc = qdio_allocate(init_data); |
| 1301 | if (rc) | 1301 | if (rc) |
| @@ -1319,7 +1319,6 @@ int qdio_allocate(struct qdio_initialize *init_data) | |||
| 1319 | 1319 | ||
| 1320 | sprintf(dbf_text, "qalc%4x", init_data->cdev->private->schid.sch_no); | 1320 | sprintf(dbf_text, "qalc%4x", init_data->cdev->private->schid.sch_no); |
| 1321 | QDIO_DBF_TEXT0(0, setup, dbf_text); | 1321 | QDIO_DBF_TEXT0(0, setup, dbf_text); |
| 1322 | QDIO_DBF_TEXT0(0, trace, dbf_text); | ||
| 1323 | 1322 | ||
| 1324 | if ((init_data->no_input_qs && !init_data->input_handler) || | 1323 | if ((init_data->no_input_qs && !init_data->input_handler) || |
| 1325 | (init_data->no_output_qs && !init_data->output_handler)) | 1324 | (init_data->no_output_qs && !init_data->output_handler)) |
| @@ -1389,6 +1388,9 @@ int qdio_establish(struct qdio_initialize *init_data) | |||
| 1389 | unsigned long saveflags; | 1388 | unsigned long saveflags; |
| 1390 | int rc; | 1389 | int rc; |
| 1391 | 1390 | ||
| 1391 | sprintf(dbf_text, "qest%4x", cdev->private->schid.sch_no); | ||
| 1392 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1393 | |||
| 1392 | irq_ptr = cdev->private->qdio_data; | 1394 | irq_ptr = cdev->private->qdio_data; |
| 1393 | if (!irq_ptr) | 1395 | if (!irq_ptr) |
| 1394 | return -ENODEV; | 1396 | return -ENODEV; |
| @@ -1396,13 +1398,6 @@ int qdio_establish(struct qdio_initialize *init_data) | |||
| 1396 | if (cdev->private->state != DEV_STATE_ONLINE) | 1398 | if (cdev->private->state != DEV_STATE_ONLINE) |
| 1397 | return -EINVAL; | 1399 | return -EINVAL; |
| 1398 | 1400 | ||
| 1399 | if (!try_module_get(THIS_MODULE)) | ||
| 1400 | return -EINVAL; | ||
| 1401 | |||
| 1402 | sprintf(dbf_text, "qest%4x", cdev->private->schid.sch_no); | ||
| 1403 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1404 | QDIO_DBF_TEXT0(0, trace, dbf_text); | ||
| 1405 | |||
| 1406 | mutex_lock(&irq_ptr->setup_mutex); | 1401 | mutex_lock(&irq_ptr->setup_mutex); |
| 1407 | qdio_setup_irq(init_data); | 1402 | qdio_setup_irq(init_data); |
| 1408 | 1403 | ||
| @@ -1472,6 +1467,9 @@ int qdio_activate(struct ccw_device *cdev) | |||
| 1472 | unsigned long saveflags; | 1467 | unsigned long saveflags; |
| 1473 | char dbf_text[20]; | 1468 | char dbf_text[20]; |
| 1474 | 1469 | ||
| 1470 | sprintf(dbf_text, "qact%4x", cdev->private->schid.sch_no); | ||
| 1471 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
| 1472 | |||
| 1475 | irq_ptr = cdev->private->qdio_data; | 1473 | irq_ptr = cdev->private->qdio_data; |
| 1476 | if (!irq_ptr) | 1474 | if (!irq_ptr) |
| 1477 | return -ENODEV; | 1475 | return -ENODEV; |
| @@ -1485,10 +1483,6 @@ int qdio_activate(struct ccw_device *cdev) | |||
| 1485 | goto out; | 1483 | goto out; |
| 1486 | } | 1484 | } |
| 1487 | 1485 | ||
| 1488 | sprintf(dbf_text, "qact%4x", irq_ptr->schid.sch_no); | ||
| 1489 | QDIO_DBF_TEXT2(0, setup, dbf_text); | ||
| 1490 | QDIO_DBF_TEXT2(0, trace, dbf_text); | ||
| 1491 | |||
| 1492 | irq_ptr->ccw.cmd_code = irq_ptr->aqueue.cmd; | 1486 | irq_ptr->ccw.cmd_code = irq_ptr->aqueue.cmd; |
| 1493 | irq_ptr->ccw.flags = CCW_FLAG_SLI; | 1487 | irq_ptr->ccw.flags = CCW_FLAG_SLI; |
| 1494 | irq_ptr->ccw.count = irq_ptr->aqueue.count; | 1488 | irq_ptr->ccw.count = irq_ptr->aqueue.count; |
| @@ -1663,7 +1657,7 @@ int do_QDIO(struct ccw_device *cdev, unsigned int callflags, | |||
| 1663 | #ifdef CONFIG_QDIO_DEBUG | 1657 | #ifdef CONFIG_QDIO_DEBUG |
| 1664 | char dbf_text[20]; | 1658 | char dbf_text[20]; |
| 1665 | 1659 | ||
| 1666 | sprintf(dbf_text, "doQD%04x", cdev->private->schid.sch_no); | 1660 | sprintf(dbf_text, "doQD%4x", cdev->private->schid.sch_no); |
| 1667 | QDIO_DBF_TEXT3(0, trace, dbf_text); | 1661 | QDIO_DBF_TEXT3(0, trace, dbf_text); |
| 1668 | #endif /* CONFIG_QDIO_DEBUG */ | 1662 | #endif /* CONFIG_QDIO_DEBUG */ |
| 1669 | 1663 | ||
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c index 1bd2a208db28..a0b6b46e7466 100644 --- a/drivers/s390/cio/qdio_setup.c +++ b/drivers/s390/cio/qdio_setup.c | |||
| @@ -165,7 +165,7 @@ static void setup_queues(struct qdio_irq *irq_ptr, | |||
| 165 | void **output_sbal_array = qdio_init->output_sbal_addr_array; | 165 | void **output_sbal_array = qdio_init->output_sbal_addr_array; |
| 166 | int i; | 166 | int i; |
| 167 | 167 | ||
| 168 | sprintf(dbf_text, "qfqs%4x", qdio_init->cdev->private->schid.sch_no); | 168 | sprintf(dbf_text, "qset%4x", qdio_init->cdev->private->schid.sch_no); |
| 169 | QDIO_DBF_TEXT0(0, setup, dbf_text); | 169 | QDIO_DBF_TEXT0(0, setup, dbf_text); |
| 170 | 170 | ||
| 171 | for_each_input_queue(irq_ptr, q, i) { | 171 | for_each_input_queue(irq_ptr, q, i) { |
| @@ -285,7 +285,7 @@ void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr) | |||
| 285 | rc = __get_ssqd_info(irq_ptr); | 285 | rc = __get_ssqd_info(irq_ptr); |
| 286 | if (rc) { | 286 | if (rc) { |
| 287 | QDIO_DBF_TEXT2(0, setup, "ssqdasig"); | 287 | QDIO_DBF_TEXT2(0, setup, "ssqdasig"); |
| 288 | sprintf(dbf_text, "schno%x", irq_ptr->schid.sch_no); | 288 | sprintf(dbf_text, "schn%4x", irq_ptr->schid.sch_no); |
| 289 | QDIO_DBF_TEXT2(0, setup, dbf_text); | 289 | QDIO_DBF_TEXT2(0, setup, dbf_text); |
| 290 | sprintf(dbf_text, "rc:%d", rc); | 290 | sprintf(dbf_text, "rc:%d", rc); |
| 291 | QDIO_DBF_TEXT2(0, setup, dbf_text); | 291 | QDIO_DBF_TEXT2(0, setup, dbf_text); |
| @@ -447,51 +447,36 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr, | |||
| 447 | { | 447 | { |
| 448 | char s[80]; | 448 | char s[80]; |
| 449 | 449 | ||
| 450 | sprintf(s, "%s ", cdev->dev.bus_id); | 450 | sprintf(s, "qdio: %s ", dev_name(&cdev->dev)); |
| 451 | |||
| 452 | switch (irq_ptr->qib.qfmt) { | 451 | switch (irq_ptr->qib.qfmt) { |
| 453 | case QDIO_QETH_QFMT: | 452 | case QDIO_QETH_QFMT: |
| 454 | sprintf(s + strlen(s), "OSADE "); | 453 | sprintf(s + strlen(s), "OSA "); |
| 455 | break; | 454 | break; |
| 456 | case QDIO_ZFCP_QFMT: | 455 | case QDIO_ZFCP_QFMT: |
| 457 | sprintf(s + strlen(s), "ZFCP "); | 456 | sprintf(s + strlen(s), "ZFCP "); |
| 458 | break; | 457 | break; |
| 459 | case QDIO_IQDIO_QFMT: | 458 | case QDIO_IQDIO_QFMT: |
| 460 | sprintf(s + strlen(s), "HiperSockets "); | 459 | sprintf(s + strlen(s), "HS "); |
| 461 | break; | 460 | break; |
| 462 | } | 461 | } |
| 463 | sprintf(s + strlen(s), "using: "); | 462 | sprintf(s + strlen(s), "on SC %x using ", irq_ptr->schid.sch_no); |
| 464 | 463 | sprintf(s + strlen(s), "AI:%d ", is_thinint_irq(irq_ptr)); | |
| 465 | if (!is_thinint_irq(irq_ptr)) | 464 | sprintf(s + strlen(s), "QEBSM:%d ", (irq_ptr->sch_token) ? 1 : 0); |
| 466 | sprintf(s + strlen(s), "no"); | 465 | sprintf(s + strlen(s), "PCI:%d ", |
| 467 | sprintf(s + strlen(s), "AdapterInterrupts "); | 466 | (irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) ? 1 : 0); |
| 468 | if (!(irq_ptr->sch_token != 0)) | 467 | sprintf(s + strlen(s), "TDD:%d ", css_general_characteristics.aif_tdd); |
| 469 | sprintf(s + strlen(s), "no"); | 468 | sprintf(s + strlen(s), "SIGA:"); |
| 470 | sprintf(s + strlen(s), "QEBSM "); | 469 | sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.input) ? "R" : " "); |
| 471 | if (!(irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED)) | 470 | sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.output) ? "W" : " "); |
| 472 | sprintf(s + strlen(s), "no"); | 471 | sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.sync) ? "S" : " "); |
| 473 | sprintf(s + strlen(s), "OutboundPCI "); | 472 | sprintf(s + strlen(s), "%s", |
| 474 | if (!css_general_characteristics.aif_tdd) | 473 | (!irq_ptr->siga_flag.no_sync_ti) ? "A" : " "); |
| 475 | sprintf(s + strlen(s), "no"); | 474 | sprintf(s + strlen(s), "%s", |
| 476 | sprintf(s + strlen(s), "TDD\n"); | 475 | (!irq_ptr->siga_flag.no_sync_out_ti) ? "O" : " "); |
| 477 | printk(KERN_INFO "qdio: %s", s); | 476 | sprintf(s + strlen(s), "%s", |
| 478 | 477 | (!irq_ptr->siga_flag.no_sync_out_pci) ? "P" : " "); | |
| 479 | memset(s, 0, sizeof(s)); | ||
| 480 | sprintf(s, "%s SIGA required: ", cdev->dev.bus_id); | ||
| 481 | if (irq_ptr->siga_flag.input) | ||
| 482 | sprintf(s + strlen(s), "Read "); | ||
| 483 | if (irq_ptr->siga_flag.output) | ||
| 484 | sprintf(s + strlen(s), "Write "); | ||
| 485 | if (irq_ptr->siga_flag.sync) | ||
| 486 | sprintf(s + strlen(s), "Sync "); | ||
| 487 | if (!irq_ptr->siga_flag.no_sync_ti) | ||
| 488 | sprintf(s + strlen(s), "SyncAI "); | ||
| 489 | if (!irq_ptr->siga_flag.no_sync_out_ti) | ||
| 490 | sprintf(s + strlen(s), "SyncOutAI "); | ||
| 491 | if (!irq_ptr->siga_flag.no_sync_out_pci) | ||
| 492 | sprintf(s + strlen(s), "SyncOutPCI"); | ||
| 493 | sprintf(s + strlen(s), "\n"); | 478 | sprintf(s + strlen(s), "\n"); |
| 494 | printk(KERN_INFO "qdio: %s", s); | 479 | printk(KERN_INFO "%s", s); |
| 495 | } | 480 | } |
| 496 | 481 | ||
| 497 | int __init qdio_setup_init(void) | 482 | int __init qdio_setup_init(void) |
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c index 9291a771d812..ea7f61400267 100644 --- a/drivers/s390/cio/qdio_thinint.c +++ b/drivers/s390/cio/qdio_thinint.c | |||
| @@ -113,7 +113,11 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr) | |||
| 113 | struct qdio_q *q; | 113 | struct qdio_q *q; |
| 114 | int i; | 114 | int i; |
| 115 | 115 | ||
| 116 | for_each_input_queue(irq_ptr, q, i) { | 116 | for (i = 0; i < irq_ptr->nr_input_qs; i++) { |
| 117 | q = irq_ptr->input_qs[i]; | ||
| 118 | /* if establish triggered an error */ | ||
| 119 | if (!q || !q->entry.prev || !q->entry.next) | ||
| 120 | continue; | ||
| 117 | list_del_rcu(&q->entry); | 121 | list_del_rcu(&q->entry); |
| 118 | synchronize_rcu(); | 122 | synchronize_rcu(); |
| 119 | } | 123 | } |
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index a08b1682c8e8..e10ac9ab2d44 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
| @@ -133,14 +133,14 @@ claw_register_debug_facility(void) | |||
| 133 | static inline void | 133 | static inline void |
| 134 | claw_set_busy(struct net_device *dev) | 134 | claw_set_busy(struct net_device *dev) |
| 135 | { | 135 | { |
| 136 | ((struct claw_privbk *) dev->priv)->tbusy=1; | 136 | ((struct claw_privbk *)dev->ml_priv)->tbusy = 1; |
| 137 | eieio(); | 137 | eieio(); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | static inline void | 140 | static inline void |
| 141 | claw_clear_busy(struct net_device *dev) | 141 | claw_clear_busy(struct net_device *dev) |
| 142 | { | 142 | { |
| 143 | clear_bit(0, &(((struct claw_privbk *) dev->priv)->tbusy)); | 143 | clear_bit(0, &(((struct claw_privbk *) dev->ml_priv)->tbusy)); |
| 144 | netif_wake_queue(dev); | 144 | netif_wake_queue(dev); |
| 145 | eieio(); | 145 | eieio(); |
| 146 | } | 146 | } |
| @@ -149,20 +149,20 @@ static inline int | |||
| 149 | claw_check_busy(struct net_device *dev) | 149 | claw_check_busy(struct net_device *dev) |
| 150 | { | 150 | { |
| 151 | eieio(); | 151 | eieio(); |
| 152 | return ((struct claw_privbk *) dev->priv)->tbusy; | 152 | return ((struct claw_privbk *) dev->ml_priv)->tbusy; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | static inline void | 155 | static inline void |
| 156 | claw_setbit_busy(int nr,struct net_device *dev) | 156 | claw_setbit_busy(int nr,struct net_device *dev) |
| 157 | { | 157 | { |
| 158 | netif_stop_queue(dev); | 158 | netif_stop_queue(dev); |
| 159 | set_bit(nr, (void *)&(((struct claw_privbk *)dev->priv)->tbusy)); | 159 | set_bit(nr, (void *)&(((struct claw_privbk *)dev->ml_priv)->tbusy)); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | static inline void | 162 | static inline void |
| 163 | claw_clearbit_busy(int nr,struct net_device *dev) | 163 | claw_clearbit_busy(int nr,struct net_device *dev) |
| 164 | { | 164 | { |
| 165 | clear_bit(nr,(void *)&(((struct claw_privbk *)dev->priv)->tbusy)); | 165 | clear_bit(nr, (void *)&(((struct claw_privbk *)dev->ml_priv)->tbusy)); |
| 166 | netif_wake_queue(dev); | 166 | netif_wake_queue(dev); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| @@ -171,7 +171,7 @@ claw_test_and_setbit_busy(int nr,struct net_device *dev) | |||
| 171 | { | 171 | { |
| 172 | netif_stop_queue(dev); | 172 | netif_stop_queue(dev); |
| 173 | return test_and_set_bit(nr, | 173 | return test_and_set_bit(nr, |
| 174 | (void *)&(((struct claw_privbk *) dev->priv)->tbusy)); | 174 | (void *)&(((struct claw_privbk *) dev->ml_priv)->tbusy)); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | 177 | ||
| @@ -271,6 +271,7 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
| 271 | if (!get_device(&cgdev->dev)) | 271 | if (!get_device(&cgdev->dev)) |
| 272 | return -ENODEV; | 272 | return -ENODEV; |
| 273 | privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); | 273 | privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); |
| 274 | cgdev->dev.driver_data = privptr; | ||
| 274 | if (privptr == NULL) { | 275 | if (privptr == NULL) { |
| 275 | probe_error(cgdev); | 276 | probe_error(cgdev); |
| 276 | put_device(&cgdev->dev); | 277 | put_device(&cgdev->dev); |
| @@ -305,7 +306,6 @@ claw_probe(struct ccwgroup_device *cgdev) | |||
| 305 | privptr->p_env->p_priv = privptr; | 306 | privptr->p_env->p_priv = privptr; |
| 306 | cgdev->cdev[0]->handler = claw_irq_handler; | 307 | cgdev->cdev[0]->handler = claw_irq_handler; |
| 307 | cgdev->cdev[1]->handler = claw_irq_handler; | 308 | cgdev->cdev[1]->handler = claw_irq_handler; |
| 308 | cgdev->dev.driver_data = privptr; | ||
| 309 | CLAW_DBF_TEXT(2, setup, "prbext 0"); | 309 | CLAW_DBF_TEXT(2, setup, "prbext 0"); |
| 310 | 310 | ||
| 311 | return 0; | 311 | return 0; |
| @@ -319,7 +319,7 @@ static int | |||
| 319 | claw_tx(struct sk_buff *skb, struct net_device *dev) | 319 | claw_tx(struct sk_buff *skb, struct net_device *dev) |
| 320 | { | 320 | { |
| 321 | int rc; | 321 | int rc; |
| 322 | struct claw_privbk *privptr=dev->priv; | 322 | struct claw_privbk *privptr = dev->ml_priv; |
| 323 | unsigned long saveflags; | 323 | unsigned long saveflags; |
| 324 | struct chbk *p_ch; | 324 | struct chbk *p_ch; |
| 325 | 325 | ||
| @@ -404,7 +404,7 @@ claw_pack_skb(struct claw_privbk *privptr) | |||
| 404 | static int | 404 | static int |
| 405 | claw_change_mtu(struct net_device *dev, int new_mtu) | 405 | claw_change_mtu(struct net_device *dev, int new_mtu) |
| 406 | { | 406 | { |
| 407 | struct claw_privbk *privptr=dev->priv; | 407 | struct claw_privbk *privptr = dev->ml_priv; |
| 408 | int buff_size; | 408 | int buff_size; |
| 409 | CLAW_DBF_TEXT(4, trace, "setmtu"); | 409 | CLAW_DBF_TEXT(4, trace, "setmtu"); |
| 410 | buff_size = privptr->p_env->write_size; | 410 | buff_size = privptr->p_env->write_size; |
| @@ -434,7 +434,7 @@ claw_open(struct net_device *dev) | |||
| 434 | struct ccwbk *p_buf; | 434 | struct ccwbk *p_buf; |
| 435 | 435 | ||
| 436 | CLAW_DBF_TEXT(4, trace, "open"); | 436 | CLAW_DBF_TEXT(4, trace, "open"); |
| 437 | privptr = (struct claw_privbk *)dev->priv; | 437 | privptr = (struct claw_privbk *)dev->ml_priv; |
| 438 | /* allocate and initialize CCW blocks */ | 438 | /* allocate and initialize CCW blocks */ |
| 439 | if (privptr->buffs_alloc == 0) { | 439 | if (privptr->buffs_alloc == 0) { |
| 440 | rc=init_ccw_bk(dev); | 440 | rc=init_ccw_bk(dev); |
| @@ -780,7 +780,7 @@ claw_irq_tasklet ( unsigned long data ) | |||
| 780 | p_ch = (struct chbk *) data; | 780 | p_ch = (struct chbk *) data; |
| 781 | dev = (struct net_device *)p_ch->ndev; | 781 | dev = (struct net_device *)p_ch->ndev; |
| 782 | CLAW_DBF_TEXT(4, trace, "IRQtask"); | 782 | CLAW_DBF_TEXT(4, trace, "IRQtask"); |
| 783 | privptr = (struct claw_privbk *) dev->priv; | 783 | privptr = (struct claw_privbk *)dev->ml_priv; |
| 784 | unpack_read(dev); | 784 | unpack_read(dev); |
| 785 | clear_bit(CLAW_BH_ACTIVE, (void *)&p_ch->flag_a); | 785 | clear_bit(CLAW_BH_ACTIVE, (void *)&p_ch->flag_a); |
| 786 | CLAW_DBF_TEXT(4, trace, "TskletXt"); | 786 | CLAW_DBF_TEXT(4, trace, "TskletXt"); |
| @@ -805,7 +805,7 @@ claw_release(struct net_device *dev) | |||
| 805 | 805 | ||
| 806 | if (!dev) | 806 | if (!dev) |
| 807 | return 0; | 807 | return 0; |
| 808 | privptr = (struct claw_privbk *) dev->priv; | 808 | privptr = (struct claw_privbk *)dev->ml_priv; |
| 809 | if (!privptr) | 809 | if (!privptr) |
| 810 | return 0; | 810 | return 0; |
| 811 | CLAW_DBF_TEXT(4, trace, "release"); | 811 | CLAW_DBF_TEXT(4, trace, "release"); |
| @@ -960,7 +960,7 @@ claw_write_next ( struct chbk * p_ch ) | |||
| 960 | if (p_ch->claw_state == CLAW_STOP) | 960 | if (p_ch->claw_state == CLAW_STOP) |
| 961 | return; | 961 | return; |
| 962 | dev = (struct net_device *) p_ch->ndev; | 962 | dev = (struct net_device *) p_ch->ndev; |
| 963 | privptr = (struct claw_privbk *) dev->priv; | 963 | privptr = (struct claw_privbk *) dev->ml_priv; |
| 964 | claw_free_wrt_buf( dev ); | 964 | claw_free_wrt_buf( dev ); |
| 965 | if ((privptr->write_free_count > 0) && | 965 | if ((privptr->write_free_count > 0) && |
| 966 | !skb_queue_empty(&p_ch->collect_queue)) { | 966 | !skb_queue_empty(&p_ch->collect_queue)) { |
| @@ -1042,7 +1042,7 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, | |||
| 1042 | struct ccw1 temp_ccw; | 1042 | struct ccw1 temp_ccw; |
| 1043 | struct endccw * p_end; | 1043 | struct endccw * p_end; |
| 1044 | CLAW_DBF_TEXT(4, trace, "addreads"); | 1044 | CLAW_DBF_TEXT(4, trace, "addreads"); |
| 1045 | privptr = dev->priv; | 1045 | privptr = dev->ml_priv; |
| 1046 | p_end = privptr->p_end_ccw; | 1046 | p_end = privptr->p_end_ccw; |
| 1047 | 1047 | ||
| 1048 | /* first CCW and last CCW contains a new set of read channel programs | 1048 | /* first CCW and last CCW contains a new set of read channel programs |
| @@ -1212,7 +1212,7 @@ find_link(struct net_device *dev, char *host_name, char *ws_name ) | |||
| 1212 | int rc=0; | 1212 | int rc=0; |
| 1213 | 1213 | ||
| 1214 | CLAW_DBF_TEXT(2, setup, "findlink"); | 1214 | CLAW_DBF_TEXT(2, setup, "findlink"); |
| 1215 | privptr=dev->priv; | 1215 | privptr = dev->ml_priv; |
| 1216 | p_env=privptr->p_env; | 1216 | p_env=privptr->p_env; |
| 1217 | switch (p_env->packing) | 1217 | switch (p_env->packing) |
| 1218 | { | 1218 | { |
| @@ -1264,7 +1264,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
| 1264 | struct chbk *ch; | 1264 | struct chbk *ch; |
| 1265 | 1265 | ||
| 1266 | CLAW_DBF_TEXT(4, trace, "hw_tx"); | 1266 | CLAW_DBF_TEXT(4, trace, "hw_tx"); |
| 1267 | privptr = (struct claw_privbk *) (dev->priv); | 1267 | privptr = (struct claw_privbk *)(dev->ml_priv); |
| 1268 | p_ch=(struct chbk *)&privptr->channel[WRITE]; | 1268 | p_ch=(struct chbk *)&privptr->channel[WRITE]; |
| 1269 | p_env =privptr->p_env; | 1269 | p_env =privptr->p_env; |
| 1270 | claw_free_wrt_buf(dev); /* Clean up free chain if posible */ | 1270 | claw_free_wrt_buf(dev); /* Clean up free chain if posible */ |
| @@ -1483,8 +1483,8 @@ init_ccw_bk(struct net_device *dev) | |||
| 1483 | struct ccwbk*p_last_CCWB; | 1483 | struct ccwbk*p_last_CCWB; |
| 1484 | struct ccwbk*p_first_CCWB; | 1484 | struct ccwbk*p_first_CCWB; |
| 1485 | struct endccw *p_endccw=NULL; | 1485 | struct endccw *p_endccw=NULL; |
| 1486 | addr_t real_address; | 1486 | addr_t real_address; |
| 1487 | struct claw_privbk *privptr=dev->priv; | 1487 | struct claw_privbk *privptr = dev->ml_priv; |
| 1488 | struct clawh *pClawH=NULL; | 1488 | struct clawh *pClawH=NULL; |
| 1489 | addr_t real_TIC_address; | 1489 | addr_t real_TIC_address; |
| 1490 | int i,j; | 1490 | int i,j; |
| @@ -1960,19 +1960,16 @@ init_ccw_bk(struct net_device *dev) | |||
| 1960 | static void | 1960 | static void |
| 1961 | probe_error( struct ccwgroup_device *cgdev) | 1961 | probe_error( struct ccwgroup_device *cgdev) |
| 1962 | { | 1962 | { |
| 1963 | struct claw_privbk *privptr; | 1963 | struct claw_privbk *privptr; |
| 1964 | 1964 | ||
| 1965 | CLAW_DBF_TEXT(4, trace, "proberr"); | 1965 | CLAW_DBF_TEXT(4, trace, "proberr"); |
| 1966 | privptr=(struct claw_privbk *)cgdev->dev.driver_data; | 1966 | privptr = (struct claw_privbk *) cgdev->dev.driver_data; |
| 1967 | if (privptr!=NULL) { | 1967 | if (privptr != NULL) { |
| 1968 | cgdev->dev.driver_data = NULL; | ||
| 1968 | kfree(privptr->p_env); | 1969 | kfree(privptr->p_env); |
| 1969 | privptr->p_env=NULL; | 1970 | kfree(privptr->p_mtc_envelope); |
| 1970 | kfree(privptr->p_mtc_envelope); | 1971 | kfree(privptr); |
| 1971 | privptr->p_mtc_envelope=NULL; | 1972 | } |
| 1972 | kfree(privptr); | ||
| 1973 | privptr=NULL; | ||
| 1974 | } | ||
| 1975 | return; | ||
| 1976 | } /* probe_error */ | 1973 | } /* probe_error */ |
| 1977 | 1974 | ||
| 1978 | /*-------------------------------------------------------------------* | 1975 | /*-------------------------------------------------------------------* |
| @@ -2000,7 +1997,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw) | |||
| 2000 | CLAW_DBF_TEXT(2, setup, "clw_cntl"); | 1997 | CLAW_DBF_TEXT(2, setup, "clw_cntl"); |
| 2001 | udelay(1000); /* Wait a ms for the control packets to | 1998 | udelay(1000); /* Wait a ms for the control packets to |
| 2002 | *catch up to each other */ | 1999 | *catch up to each other */ |
| 2003 | privptr=dev->priv; | 2000 | privptr = dev->ml_priv; |
| 2004 | p_env=privptr->p_env; | 2001 | p_env=privptr->p_env; |
| 2005 | tdev = &privptr->channel[READ].cdev->dev; | 2002 | tdev = &privptr->channel[READ].cdev->dev; |
| 2006 | memcpy( &temp_host_name, p_env->host_name, 8); | 2003 | memcpy( &temp_host_name, p_env->host_name, 8); |
| @@ -2278,7 +2275,7 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link, | |||
| 2278 | struct sk_buff *skb; | 2275 | struct sk_buff *skb; |
| 2279 | 2276 | ||
| 2280 | CLAW_DBF_TEXT(2, setup, "sndcntl"); | 2277 | CLAW_DBF_TEXT(2, setup, "sndcntl"); |
| 2281 | privptr=dev->priv; | 2278 | privptr = dev->ml_priv; |
| 2282 | p_ctl=(struct clawctl *)&privptr->ctl_bk; | 2279 | p_ctl=(struct clawctl *)&privptr->ctl_bk; |
| 2283 | 2280 | ||
| 2284 | p_ctl->command=type; | 2281 | p_ctl->command=type; |
| @@ -2348,7 +2345,7 @@ static int | |||
| 2348 | claw_snd_conn_req(struct net_device *dev, __u8 link) | 2345 | claw_snd_conn_req(struct net_device *dev, __u8 link) |
| 2349 | { | 2346 | { |
| 2350 | int rc; | 2347 | int rc; |
| 2351 | struct claw_privbk *privptr=dev->priv; | 2348 | struct claw_privbk *privptr = dev->ml_priv; |
| 2352 | struct clawctl *p_ctl; | 2349 | struct clawctl *p_ctl; |
| 2353 | 2350 | ||
| 2354 | CLAW_DBF_TEXT(2, setup, "snd_conn"); | 2351 | CLAW_DBF_TEXT(2, setup, "snd_conn"); |
| @@ -2408,7 +2405,7 @@ claw_snd_sys_validate_rsp(struct net_device *dev, | |||
| 2408 | int rc; | 2405 | int rc; |
| 2409 | 2406 | ||
| 2410 | CLAW_DBF_TEXT(2, setup, "chkresp"); | 2407 | CLAW_DBF_TEXT(2, setup, "chkresp"); |
| 2411 | privptr = dev->priv; | 2408 | privptr = dev->ml_priv; |
| 2412 | p_env=privptr->p_env; | 2409 | p_env=privptr->p_env; |
| 2413 | rc=claw_send_control(dev, SYSTEM_VALIDATE_RESPONSE, | 2410 | rc=claw_send_control(dev, SYSTEM_VALIDATE_RESPONSE, |
| 2414 | p_ctl->linkid, | 2411 | p_ctl->linkid, |
| @@ -2446,7 +2443,7 @@ net_device_stats *claw_stats(struct net_device *dev) | |||
| 2446 | struct claw_privbk *privptr; | 2443 | struct claw_privbk *privptr; |
| 2447 | 2444 | ||
| 2448 | CLAW_DBF_TEXT(4, trace, "stats"); | 2445 | CLAW_DBF_TEXT(4, trace, "stats"); |
| 2449 | privptr = dev->priv; | 2446 | privptr = dev->ml_priv; |
| 2450 | return &privptr->stats; | 2447 | return &privptr->stats; |
| 2451 | } /* end of claw_stats */ | 2448 | } /* end of claw_stats */ |
| 2452 | 2449 | ||
| @@ -2482,7 +2479,7 @@ unpack_read(struct net_device *dev ) | |||
| 2482 | p_last_ccw=NULL; | 2479 | p_last_ccw=NULL; |
| 2483 | p_packh=NULL; | 2480 | p_packh=NULL; |
| 2484 | p_packd=NULL; | 2481 | p_packd=NULL; |
| 2485 | privptr=dev->priv; | 2482 | privptr = dev->ml_priv; |
| 2486 | 2483 | ||
| 2487 | p_dev = &privptr->channel[READ].cdev->dev; | 2484 | p_dev = &privptr->channel[READ].cdev->dev; |
| 2488 | p_env = privptr->p_env; | 2485 | p_env = privptr->p_env; |
| @@ -2651,7 +2648,7 @@ claw_strt_read (struct net_device *dev, int lock ) | |||
| 2651 | int rc = 0; | 2648 | int rc = 0; |
| 2652 | __u32 parm; | 2649 | __u32 parm; |
| 2653 | unsigned long saveflags = 0; | 2650 | unsigned long saveflags = 0; |
| 2654 | struct claw_privbk *privptr=dev->priv; | 2651 | struct claw_privbk *privptr = dev->ml_priv; |
| 2655 | struct ccwbk*p_ccwbk; | 2652 | struct ccwbk*p_ccwbk; |
| 2656 | struct chbk *p_ch; | 2653 | struct chbk *p_ch; |
| 2657 | struct clawh *p_clawh; | 2654 | struct clawh *p_clawh; |
| @@ -2708,7 +2705,7 @@ claw_strt_out_IO( struct net_device *dev ) | |||
| 2708 | if (!dev) { | 2705 | if (!dev) { |
| 2709 | return; | 2706 | return; |
| 2710 | } | 2707 | } |
| 2711 | privptr=(struct claw_privbk *)dev->priv; | 2708 | privptr = (struct claw_privbk *)dev->ml_priv; |
| 2712 | p_ch=&privptr->channel[WRITE]; | 2709 | p_ch=&privptr->channel[WRITE]; |
| 2713 | 2710 | ||
| 2714 | CLAW_DBF_TEXT(4, trace, "strt_io"); | 2711 | CLAW_DBF_TEXT(4, trace, "strt_io"); |
| @@ -2741,7 +2738,7 @@ static void | |||
| 2741 | claw_free_wrt_buf( struct net_device *dev ) | 2738 | claw_free_wrt_buf( struct net_device *dev ) |
| 2742 | { | 2739 | { |
| 2743 | 2740 | ||
| 2744 | struct claw_privbk *privptr=(struct claw_privbk *)dev->priv; | 2741 | struct claw_privbk *privptr = (struct claw_privbk *)dev->ml_priv; |
| 2745 | struct ccwbk*p_first_ccw; | 2742 | struct ccwbk*p_first_ccw; |
| 2746 | struct ccwbk*p_last_ccw; | 2743 | struct ccwbk*p_last_ccw; |
| 2747 | struct ccwbk*p_this_ccw; | 2744 | struct ccwbk*p_this_ccw; |
| @@ -2798,13 +2795,13 @@ claw_free_netdevice(struct net_device * dev, int free_dev) | |||
| 2798 | if (!dev) | 2795 | if (!dev) |
| 2799 | return; | 2796 | return; |
| 2800 | CLAW_DBF_TEXT_(2, setup, "%s", dev->name); | 2797 | CLAW_DBF_TEXT_(2, setup, "%s", dev->name); |
| 2801 | privptr = dev->priv; | 2798 | privptr = dev->ml_priv; |
| 2802 | if (dev->flags & IFF_RUNNING) | 2799 | if (dev->flags & IFF_RUNNING) |
| 2803 | claw_release(dev); | 2800 | claw_release(dev); |
| 2804 | if (privptr) { | 2801 | if (privptr) { |
| 2805 | privptr->channel[READ].ndev = NULL; /* say it's free */ | 2802 | privptr->channel[READ].ndev = NULL; /* say it's free */ |
| 2806 | } | 2803 | } |
| 2807 | dev->priv=NULL; | 2804 | dev->ml_priv = NULL; |
| 2808 | #ifdef MODULE | 2805 | #ifdef MODULE |
| 2809 | if (free_dev) { | 2806 | if (free_dev) { |
| 2810 | free_netdev(dev); | 2807 | free_netdev(dev); |
| @@ -2921,7 +2918,7 @@ claw_new_device(struct ccwgroup_device *cgdev) | |||
| 2921 | printk(KERN_WARNING "%s:alloc_netdev failed\n",__func__); | 2918 | printk(KERN_WARNING "%s:alloc_netdev failed\n",__func__); |
| 2922 | goto out; | 2919 | goto out; |
| 2923 | } | 2920 | } |
| 2924 | dev->priv = privptr; | 2921 | dev->ml_priv = privptr; |
| 2925 | cgdev->dev.driver_data = privptr; | 2922 | cgdev->dev.driver_data = privptr; |
| 2926 | cgdev->cdev[READ]->dev.driver_data = privptr; | 2923 | cgdev->cdev[READ]->dev.driver_data = privptr; |
| 2927 | cgdev->cdev[WRITE]->dev.driver_data = privptr; | 2924 | cgdev->cdev[WRITE]->dev.driver_data = privptr; |
| @@ -3002,7 +2999,7 @@ claw_shutdown_device(struct ccwgroup_device *cgdev) | |||
| 3002 | ret = claw_release(ndev); | 2999 | ret = claw_release(ndev); |
| 3003 | ndev->flags &=~IFF_RUNNING; | 3000 | ndev->flags &=~IFF_RUNNING; |
| 3004 | unregister_netdev(ndev); | 3001 | unregister_netdev(ndev); |
| 3005 | ndev->priv = NULL; /* cgdev data, not ndev's to free */ | 3002 | ndev->ml_priv = NULL; /* cgdev data, not ndev's to free */ |
| 3006 | claw_free_netdevice(ndev, 1); | 3003 | claw_free_netdevice(ndev, 1); |
| 3007 | priv->channel[READ].ndev = NULL; | 3004 | priv->channel[READ].ndev = NULL; |
| 3008 | priv->channel[WRITE].ndev = NULL; | 3005 | priv->channel[WRITE].ndev = NULL; |
diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c index 0b4e6253abe4..42776550acfd 100644 --- a/drivers/s390/net/ctcm_fsms.c +++ b/drivers/s390/net/ctcm_fsms.c | |||
| @@ -245,7 +245,7 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg) | |||
| 245 | { | 245 | { |
| 246 | struct channel *ch = arg; | 246 | struct channel *ch = arg; |
| 247 | struct net_device *dev = ch->netdev; | 247 | struct net_device *dev = ch->netdev; |
| 248 | struct ctcm_priv *priv = dev->priv; | 248 | struct ctcm_priv *priv = dev->ml_priv; |
| 249 | struct sk_buff *skb; | 249 | struct sk_buff *skb; |
| 250 | int first = 1; | 250 | int first = 1; |
| 251 | int i; | 251 | int i; |
| @@ -336,7 +336,7 @@ void ctcm_chx_txidle(fsm_instance *fi, int event, void *arg) | |||
| 336 | { | 336 | { |
| 337 | struct channel *ch = arg; | 337 | struct channel *ch = arg; |
| 338 | struct net_device *dev = ch->netdev; | 338 | struct net_device *dev = ch->netdev; |
| 339 | struct ctcm_priv *priv = dev->priv; | 339 | struct ctcm_priv *priv = dev->ml_priv; |
| 340 | 340 | ||
| 341 | CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); | 341 | CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); |
| 342 | 342 | ||
| @@ -357,7 +357,7 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) | |||
| 357 | { | 357 | { |
| 358 | struct channel *ch = arg; | 358 | struct channel *ch = arg; |
| 359 | struct net_device *dev = ch->netdev; | 359 | struct net_device *dev = ch->netdev; |
| 360 | struct ctcm_priv *priv = dev->priv; | 360 | struct ctcm_priv *priv = dev->ml_priv; |
| 361 | int len = ch->max_bufsize - ch->irb->scsw.cmd.count; | 361 | int len = ch->max_bufsize - ch->irb->scsw.cmd.count; |
| 362 | struct sk_buff *skb = ch->trans_skb; | 362 | struct sk_buff *skb = ch->trans_skb; |
| 363 | __u16 block_len = *((__u16 *)skb->data); | 363 | __u16 block_len = *((__u16 *)skb->data); |
| @@ -459,7 +459,7 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg) | |||
| 459 | chx_rxidle(fi, event, arg); | 459 | chx_rxidle(fi, event, arg); |
| 460 | } else { | 460 | } else { |
| 461 | struct net_device *dev = ch->netdev; | 461 | struct net_device *dev = ch->netdev; |
| 462 | struct ctcm_priv *priv = dev->priv; | 462 | struct ctcm_priv *priv = dev->ml_priv; |
| 463 | fsm_newstate(fi, CTC_STATE_TXIDLE); | 463 | fsm_newstate(fi, CTC_STATE_TXIDLE); |
| 464 | fsm_event(priv->fsm, DEV_EVENT_TXUP, dev); | 464 | fsm_event(priv->fsm, DEV_EVENT_TXUP, dev); |
| 465 | } | 465 | } |
| @@ -496,7 +496,7 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg) | |||
| 496 | if ((CHANNEL_DIRECTION(ch->flags) == READ) && | 496 | if ((CHANNEL_DIRECTION(ch->flags) == READ) && |
| 497 | (ch->protocol == CTCM_PROTO_S390)) { | 497 | (ch->protocol == CTCM_PROTO_S390)) { |
| 498 | struct net_device *dev = ch->netdev; | 498 | struct net_device *dev = ch->netdev; |
| 499 | struct ctcm_priv *priv = dev->priv; | 499 | struct ctcm_priv *priv = dev->ml_priv; |
| 500 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); | 500 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); |
| 501 | } | 501 | } |
| 502 | } | 502 | } |
| @@ -514,7 +514,7 @@ static void chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
| 514 | { | 514 | { |
| 515 | struct channel *ch = arg; | 515 | struct channel *ch = arg; |
| 516 | struct net_device *dev = ch->netdev; | 516 | struct net_device *dev = ch->netdev; |
| 517 | struct ctcm_priv *priv = dev->priv; | 517 | struct ctcm_priv *priv = dev->ml_priv; |
| 518 | __u16 buflen; | 518 | __u16 buflen; |
| 519 | int rc; | 519 | int rc; |
| 520 | 520 | ||
| @@ -699,7 +699,7 @@ static void ctcm_chx_cleanup(fsm_instance *fi, int state, | |||
| 699 | struct channel *ch) | 699 | struct channel *ch) |
| 700 | { | 700 | { |
| 701 | struct net_device *dev = ch->netdev; | 701 | struct net_device *dev = ch->netdev; |
| 702 | struct ctcm_priv *priv = dev->priv; | 702 | struct ctcm_priv *priv = dev->ml_priv; |
| 703 | 703 | ||
| 704 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, | 704 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, |
| 705 | "%s(%s): %s[%d]\n", | 705 | "%s(%s): %s[%d]\n", |
| @@ -784,7 +784,7 @@ static void ctcm_chx_setuperr(fsm_instance *fi, int event, void *arg) | |||
| 784 | { | 784 | { |
| 785 | struct channel *ch = arg; | 785 | struct channel *ch = arg; |
| 786 | struct net_device *dev = ch->netdev; | 786 | struct net_device *dev = ch->netdev; |
| 787 | struct ctcm_priv *priv = dev->priv; | 787 | struct ctcm_priv *priv = dev->ml_priv; |
| 788 | 788 | ||
| 789 | /* | 789 | /* |
| 790 | * Special case: Got UC_RCRESET on setmode. | 790 | * Special case: Got UC_RCRESET on setmode. |
| @@ -874,7 +874,7 @@ static void ctcm_chx_rxiniterr(fsm_instance *fi, int event, void *arg) | |||
| 874 | { | 874 | { |
| 875 | struct channel *ch = arg; | 875 | struct channel *ch = arg; |
| 876 | struct net_device *dev = ch->netdev; | 876 | struct net_device *dev = ch->netdev; |
| 877 | struct ctcm_priv *priv = dev->priv; | 877 | struct ctcm_priv *priv = dev->ml_priv; |
| 878 | 878 | ||
| 879 | if (event == CTC_EVENT_TIMER) { | 879 | if (event == CTC_EVENT_TIMER) { |
| 880 | if (!IS_MPCDEV(dev)) | 880 | if (!IS_MPCDEV(dev)) |
| @@ -902,7 +902,7 @@ static void ctcm_chx_rxinitfail(fsm_instance *fi, int event, void *arg) | |||
| 902 | { | 902 | { |
| 903 | struct channel *ch = arg; | 903 | struct channel *ch = arg; |
| 904 | struct net_device *dev = ch->netdev; | 904 | struct net_device *dev = ch->netdev; |
| 905 | struct ctcm_priv *priv = dev->priv; | 905 | struct ctcm_priv *priv = dev->ml_priv; |
| 906 | 906 | ||
| 907 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, | 907 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
| 908 | "%s(%s): RX %s busy, init. fail", | 908 | "%s(%s): RX %s busy, init. fail", |
| @@ -923,7 +923,7 @@ static void ctcm_chx_rxdisc(fsm_instance *fi, int event, void *arg) | |||
| 923 | struct channel *ch = arg; | 923 | struct channel *ch = arg; |
| 924 | struct channel *ch2; | 924 | struct channel *ch2; |
| 925 | struct net_device *dev = ch->netdev; | 925 | struct net_device *dev = ch->netdev; |
| 926 | struct ctcm_priv *priv = dev->priv; | 926 | struct ctcm_priv *priv = dev->ml_priv; |
| 927 | 927 | ||
| 928 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, | 928 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
| 929 | "%s: %s: remote disconnect - re-init ...", | 929 | "%s: %s: remote disconnect - re-init ...", |
| @@ -954,7 +954,7 @@ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg) | |||
| 954 | { | 954 | { |
| 955 | struct channel *ch = arg; | 955 | struct channel *ch = arg; |
| 956 | struct net_device *dev = ch->netdev; | 956 | struct net_device *dev = ch->netdev; |
| 957 | struct ctcm_priv *priv = dev->priv; | 957 | struct ctcm_priv *priv = dev->ml_priv; |
| 958 | 958 | ||
| 959 | if (event == CTC_EVENT_TIMER) { | 959 | if (event == CTC_EVENT_TIMER) { |
| 960 | fsm_deltimer(&ch->timer); | 960 | fsm_deltimer(&ch->timer); |
| @@ -984,7 +984,7 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) | |||
| 984 | { | 984 | { |
| 985 | struct channel *ch = arg; | 985 | struct channel *ch = arg; |
| 986 | struct net_device *dev = ch->netdev; | 986 | struct net_device *dev = ch->netdev; |
| 987 | struct ctcm_priv *priv = dev->priv; | 987 | struct ctcm_priv *priv = dev->ml_priv; |
| 988 | struct sk_buff *skb; | 988 | struct sk_buff *skb; |
| 989 | 989 | ||
| 990 | CTCM_PR_DEBUG("Enter: %s: cp=%i ch=0x%p id=%s\n", | 990 | CTCM_PR_DEBUG("Enter: %s: cp=%i ch=0x%p id=%s\n", |
| @@ -1057,7 +1057,7 @@ static void ctcm_chx_iofatal(fsm_instance *fi, int event, void *arg) | |||
| 1057 | { | 1057 | { |
| 1058 | struct channel *ch = arg; | 1058 | struct channel *ch = arg; |
| 1059 | struct net_device *dev = ch->netdev; | 1059 | struct net_device *dev = ch->netdev; |
| 1060 | struct ctcm_priv *priv = dev->priv; | 1060 | struct ctcm_priv *priv = dev->ml_priv; |
| 1061 | int rd = CHANNEL_DIRECTION(ch->flags); | 1061 | int rd = CHANNEL_DIRECTION(ch->flags); |
| 1062 | 1062 | ||
| 1063 | fsm_deltimer(&ch->timer); | 1063 | fsm_deltimer(&ch->timer); |
| @@ -1207,7 +1207,7 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
| 1207 | { | 1207 | { |
| 1208 | struct channel *ch = arg; | 1208 | struct channel *ch = arg; |
| 1209 | struct net_device *dev = ch->netdev; | 1209 | struct net_device *dev = ch->netdev; |
| 1210 | struct ctcm_priv *priv = dev->priv; | 1210 | struct ctcm_priv *priv = dev->ml_priv; |
| 1211 | struct mpc_group *grp = priv->mpcg; | 1211 | struct mpc_group *grp = priv->mpcg; |
| 1212 | struct sk_buff *skb; | 1212 | struct sk_buff *skb; |
| 1213 | int first = 1; | 1213 | int first = 1; |
| @@ -1368,7 +1368,7 @@ static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg) | |||
| 1368 | { | 1368 | { |
| 1369 | struct channel *ch = arg; | 1369 | struct channel *ch = arg; |
| 1370 | struct net_device *dev = ch->netdev; | 1370 | struct net_device *dev = ch->netdev; |
| 1371 | struct ctcm_priv *priv = dev->priv; | 1371 | struct ctcm_priv *priv = dev->ml_priv; |
| 1372 | struct mpc_group *grp = priv->mpcg; | 1372 | struct mpc_group *grp = priv->mpcg; |
| 1373 | struct sk_buff *skb = ch->trans_skb; | 1373 | struct sk_buff *skb = ch->trans_skb; |
| 1374 | struct sk_buff *new_skb; | 1374 | struct sk_buff *new_skb; |
| @@ -1471,7 +1471,7 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg) | |||
| 1471 | { | 1471 | { |
| 1472 | struct channel *ch = arg; | 1472 | struct channel *ch = arg; |
| 1473 | struct net_device *dev = ch->netdev; | 1473 | struct net_device *dev = ch->netdev; |
| 1474 | struct ctcm_priv *priv = dev->priv; | 1474 | struct ctcm_priv *priv = dev->ml_priv; |
| 1475 | struct mpc_group *gptr = priv->mpcg; | 1475 | struct mpc_group *gptr = priv->mpcg; |
| 1476 | 1476 | ||
| 1477 | CTCM_PR_DEBUG("Enter %s: id=%s, ch=0x%p\n", | 1477 | CTCM_PR_DEBUG("Enter %s: id=%s, ch=0x%p\n", |
| @@ -1525,7 +1525,7 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
| 1525 | { | 1525 | { |
| 1526 | struct channel *ch = arg; | 1526 | struct channel *ch = arg; |
| 1527 | struct net_device *dev = ch->netdev; | 1527 | struct net_device *dev = ch->netdev; |
| 1528 | struct ctcm_priv *priv = dev->priv; | 1528 | struct ctcm_priv *priv = dev->ml_priv; |
| 1529 | struct mpc_group *grp = priv->mpcg; | 1529 | struct mpc_group *grp = priv->mpcg; |
| 1530 | int rc; | 1530 | int rc; |
| 1531 | unsigned long saveflags = 0; /* avoids compiler warning */ | 1531 | unsigned long saveflags = 0; /* avoids compiler warning */ |
| @@ -1580,7 +1580,7 @@ static void ctcmpc_chx_attn(fsm_instance *fsm, int event, void *arg) | |||
| 1580 | { | 1580 | { |
| 1581 | struct channel *ch = arg; | 1581 | struct channel *ch = arg; |
| 1582 | struct net_device *dev = ch->netdev; | 1582 | struct net_device *dev = ch->netdev; |
| 1583 | struct ctcm_priv *priv = dev->priv; | 1583 | struct ctcm_priv *priv = dev->ml_priv; |
| 1584 | struct mpc_group *grp = priv->mpcg; | 1584 | struct mpc_group *grp = priv->mpcg; |
| 1585 | 1585 | ||
| 1586 | CTCM_PR_DEBUG("%s(%s): %s(ch=0x%p), cp=%i, ChStat:%s, GrpStat:%s\n", | 1586 | CTCM_PR_DEBUG("%s(%s): %s(ch=0x%p), cp=%i, ChStat:%s, GrpStat:%s\n", |
| @@ -1639,7 +1639,7 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg) | |||
| 1639 | { | 1639 | { |
| 1640 | struct channel *ch = arg; | 1640 | struct channel *ch = arg; |
| 1641 | struct net_device *dev = ch->netdev; | 1641 | struct net_device *dev = ch->netdev; |
| 1642 | struct ctcm_priv *priv = dev->priv; | 1642 | struct ctcm_priv *priv = dev->ml_priv; |
| 1643 | struct mpc_group *grp = priv->mpcg; | 1643 | struct mpc_group *grp = priv->mpcg; |
| 1644 | 1644 | ||
| 1645 | CTCM_PR_DEBUG("%s(%s): %s\n ChState:%s GrpState:%s\n", | 1645 | CTCM_PR_DEBUG("%s(%s): %s\n ChState:%s GrpState:%s\n", |
| @@ -1724,7 +1724,7 @@ static void ctcmpc_chx_resend(fsm_instance *fsm, int event, void *arg) | |||
| 1724 | { | 1724 | { |
| 1725 | struct channel *ch = arg; | 1725 | struct channel *ch = arg; |
| 1726 | struct net_device *dev = ch->netdev; | 1726 | struct net_device *dev = ch->netdev; |
| 1727 | struct ctcm_priv *priv = dev->priv; | 1727 | struct ctcm_priv *priv = dev->ml_priv; |
| 1728 | struct mpc_group *grp = priv->mpcg; | 1728 | struct mpc_group *grp = priv->mpcg; |
| 1729 | 1729 | ||
| 1730 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); | 1730 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); |
| @@ -1740,7 +1740,7 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) | |||
| 1740 | { | 1740 | { |
| 1741 | struct channel *ach = arg; | 1741 | struct channel *ach = arg; |
| 1742 | struct net_device *dev = ach->netdev; | 1742 | struct net_device *dev = ach->netdev; |
| 1743 | struct ctcm_priv *priv = dev->priv; | 1743 | struct ctcm_priv *priv = dev->ml_priv; |
| 1744 | struct mpc_group *grp = priv->mpcg; | 1744 | struct mpc_group *grp = priv->mpcg; |
| 1745 | struct channel *wch = priv->channel[WRITE]; | 1745 | struct channel *wch = priv->channel[WRITE]; |
| 1746 | struct channel *rch = priv->channel[READ]; | 1746 | struct channel *rch = priv->channel[READ]; |
| @@ -2050,7 +2050,7 @@ int mpc_ch_fsm_len = ARRAY_SIZE(ctcmpc_ch_fsm); | |||
| 2050 | static void dev_action_start(fsm_instance *fi, int event, void *arg) | 2050 | static void dev_action_start(fsm_instance *fi, int event, void *arg) |
| 2051 | { | 2051 | { |
| 2052 | struct net_device *dev = arg; | 2052 | struct net_device *dev = arg; |
| 2053 | struct ctcm_priv *priv = dev->priv; | 2053 | struct ctcm_priv *priv = dev->ml_priv; |
| 2054 | int direction; | 2054 | int direction; |
| 2055 | 2055 | ||
| 2056 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); | 2056 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); |
| @@ -2076,7 +2076,7 @@ static void dev_action_stop(fsm_instance *fi, int event, void *arg) | |||
| 2076 | { | 2076 | { |
| 2077 | int direction; | 2077 | int direction; |
| 2078 | struct net_device *dev = arg; | 2078 | struct net_device *dev = arg; |
| 2079 | struct ctcm_priv *priv = dev->priv; | 2079 | struct ctcm_priv *priv = dev->ml_priv; |
| 2080 | 2080 | ||
| 2081 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); | 2081 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); |
| 2082 | 2082 | ||
| @@ -2096,7 +2096,7 @@ static void dev_action_restart(fsm_instance *fi, int event, void *arg) | |||
| 2096 | { | 2096 | { |
| 2097 | int restart_timer; | 2097 | int restart_timer; |
| 2098 | struct net_device *dev = arg; | 2098 | struct net_device *dev = arg; |
| 2099 | struct ctcm_priv *priv = dev->priv; | 2099 | struct ctcm_priv *priv = dev->ml_priv; |
| 2100 | 2100 | ||
| 2101 | CTCMY_DBF_DEV_NAME(TRACE, dev, ""); | 2101 | CTCMY_DBF_DEV_NAME(TRACE, dev, ""); |
| 2102 | 2102 | ||
| @@ -2133,12 +2133,12 @@ static void dev_action_restart(fsm_instance *fi, int event, void *arg) | |||
| 2133 | static void dev_action_chup(fsm_instance *fi, int event, void *arg) | 2133 | static void dev_action_chup(fsm_instance *fi, int event, void *arg) |
| 2134 | { | 2134 | { |
| 2135 | struct net_device *dev = arg; | 2135 | struct net_device *dev = arg; |
| 2136 | struct ctcm_priv *priv = dev->priv; | 2136 | struct ctcm_priv *priv = dev->ml_priv; |
| 2137 | int dev_stat = fsm_getstate(fi); | 2137 | int dev_stat = fsm_getstate(fi); |
| 2138 | 2138 | ||
| 2139 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, | 2139 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, |
| 2140 | "%s(%s): priv = %p [%d,%d]\n ", CTCM_FUNTAIL, | 2140 | "%s(%s): priv = %p [%d,%d]\n ", CTCM_FUNTAIL, |
| 2141 | dev->name, dev->priv, dev_stat, event); | 2141 | dev->name, dev->ml_priv, dev_stat, event); |
| 2142 | 2142 | ||
| 2143 | switch (fsm_getstate(fi)) { | 2143 | switch (fsm_getstate(fi)) { |
| 2144 | case DEV_STATE_STARTWAIT_RXTX: | 2144 | case DEV_STATE_STARTWAIT_RXTX: |
| @@ -2195,7 +2195,7 @@ static void dev_action_chdown(fsm_instance *fi, int event, void *arg) | |||
| 2195 | { | 2195 | { |
| 2196 | 2196 | ||
| 2197 | struct net_device *dev = arg; | 2197 | struct net_device *dev = arg; |
| 2198 | struct ctcm_priv *priv = dev->priv; | 2198 | struct ctcm_priv *priv = dev->ml_priv; |
| 2199 | 2199 | ||
| 2200 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); | 2200 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); |
| 2201 | 2201 | ||
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 126a3ebb8ab2..b11fec24c7d2 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c | |||
| @@ -69,7 +69,7 @@ struct channel *channels; | |||
| 69 | void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | 69 | void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) |
| 70 | { | 70 | { |
| 71 | struct net_device *dev = ch->netdev; | 71 | struct net_device *dev = ch->netdev; |
| 72 | struct ctcm_priv *priv = dev->priv; | 72 | struct ctcm_priv *priv = dev->ml_priv; |
| 73 | __u16 len = *((__u16 *) pskb->data); | 73 | __u16 len = *((__u16 *) pskb->data); |
| 74 | 74 | ||
| 75 | skb_put(pskb, 2 + LL_HEADER_LENGTH); | 75 | skb_put(pskb, 2 + LL_HEADER_LENGTH); |
| @@ -414,7 +414,7 @@ int ctcm_ch_alloc_buffer(struct channel *ch) | |||
| 414 | */ | 414 | */ |
| 415 | int ctcm_open(struct net_device *dev) | 415 | int ctcm_open(struct net_device *dev) |
| 416 | { | 416 | { |
| 417 | struct ctcm_priv *priv = dev->priv; | 417 | struct ctcm_priv *priv = dev->ml_priv; |
| 418 | 418 | ||
| 419 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); | 419 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); |
| 420 | if (!IS_MPC(priv)) | 420 | if (!IS_MPC(priv)) |
| @@ -432,7 +432,7 @@ int ctcm_open(struct net_device *dev) | |||
| 432 | */ | 432 | */ |
| 433 | int ctcm_close(struct net_device *dev) | 433 | int ctcm_close(struct net_device *dev) |
| 434 | { | 434 | { |
| 435 | struct ctcm_priv *priv = dev->priv; | 435 | struct ctcm_priv *priv = dev->ml_priv; |
| 436 | 436 | ||
| 437 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); | 437 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); |
| 438 | if (!IS_MPC(priv)) | 438 | if (!IS_MPC(priv)) |
| @@ -573,7 +573,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
| 573 | skb_pull(skb, LL_HEADER_LENGTH + 2); | 573 | skb_pull(skb, LL_HEADER_LENGTH + 2); |
| 574 | } else if (ccw_idx == 0) { | 574 | } else if (ccw_idx == 0) { |
| 575 | struct net_device *dev = ch->netdev; | 575 | struct net_device *dev = ch->netdev; |
| 576 | struct ctcm_priv *priv = dev->priv; | 576 | struct ctcm_priv *priv = dev->ml_priv; |
| 577 | priv->stats.tx_packets++; | 577 | priv->stats.tx_packets++; |
| 578 | priv->stats.tx_bytes += skb->len - LL_HEADER_LENGTH; | 578 | priv->stats.tx_bytes += skb->len - LL_HEADER_LENGTH; |
| 579 | } | 579 | } |
| @@ -592,7 +592,7 @@ static void ctcmpc_send_sweep_req(struct channel *rch) | |||
| 592 | struct channel *ch; | 592 | struct channel *ch; |
| 593 | /* int rc = 0; */ | 593 | /* int rc = 0; */ |
| 594 | 594 | ||
| 595 | priv = dev->priv; | 595 | priv = dev->ml_priv; |
| 596 | grp = priv->mpcg; | 596 | grp = priv->mpcg; |
| 597 | ch = priv->channel[WRITE]; | 597 | ch = priv->channel[WRITE]; |
| 598 | 598 | ||
| @@ -652,7 +652,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
| 652 | { | 652 | { |
| 653 | struct pdu *p_header; | 653 | struct pdu *p_header; |
| 654 | struct net_device *dev = ch->netdev; | 654 | struct net_device *dev = ch->netdev; |
| 655 | struct ctcm_priv *priv = dev->priv; | 655 | struct ctcm_priv *priv = dev->ml_priv; |
| 656 | struct mpc_group *grp = priv->mpcg; | 656 | struct mpc_group *grp = priv->mpcg; |
| 657 | struct th_header *header; | 657 | struct th_header *header; |
| 658 | struct sk_buff *nskb; | 658 | struct sk_buff *nskb; |
| @@ -867,7 +867,7 @@ done: | |||
| 867 | /* first merge version - leaving both functions separated */ | 867 | /* first merge version - leaving both functions separated */ |
| 868 | static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) | 868 | static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) |
| 869 | { | 869 | { |
| 870 | struct ctcm_priv *priv = dev->priv; | 870 | struct ctcm_priv *priv = dev->ml_priv; |
| 871 | 871 | ||
| 872 | if (skb == NULL) { | 872 | if (skb == NULL) { |
| 873 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, | 873 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
| @@ -911,7 +911,7 @@ static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) | |||
| 911 | static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | 911 | static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) |
| 912 | { | 912 | { |
| 913 | int len = 0; | 913 | int len = 0; |
| 914 | struct ctcm_priv *priv = dev->priv; | 914 | struct ctcm_priv *priv = dev->ml_priv; |
| 915 | struct mpc_group *grp = priv->mpcg; | 915 | struct mpc_group *grp = priv->mpcg; |
| 916 | struct sk_buff *newskb = NULL; | 916 | struct sk_buff *newskb = NULL; |
| 917 | 917 | ||
| @@ -1025,7 +1025,7 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1025 | if (new_mtu < 576 || new_mtu > 65527) | 1025 | if (new_mtu < 576 || new_mtu > 65527) |
| 1026 | return -EINVAL; | 1026 | return -EINVAL; |
| 1027 | 1027 | ||
| 1028 | priv = dev->priv; | 1028 | priv = dev->ml_priv; |
| 1029 | max_bufsize = priv->channel[READ]->max_bufsize; | 1029 | max_bufsize = priv->channel[READ]->max_bufsize; |
| 1030 | 1030 | ||
| 1031 | if (IS_MPC(priv)) { | 1031 | if (IS_MPC(priv)) { |
| @@ -1050,7 +1050,7 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1050 | */ | 1050 | */ |
| 1051 | static struct net_device_stats *ctcm_stats(struct net_device *dev) | 1051 | static struct net_device_stats *ctcm_stats(struct net_device *dev) |
| 1052 | { | 1052 | { |
| 1053 | return &((struct ctcm_priv *)dev->priv)->stats; | 1053 | return &((struct ctcm_priv *)dev->ml_priv)->stats; |
| 1054 | } | 1054 | } |
| 1055 | 1055 | ||
| 1056 | static void ctcm_free_netdevice(struct net_device *dev) | 1056 | static void ctcm_free_netdevice(struct net_device *dev) |
| @@ -1060,7 +1060,7 @@ static void ctcm_free_netdevice(struct net_device *dev) | |||
| 1060 | 1060 | ||
| 1061 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, | 1061 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
| 1062 | "%s(%s)", CTCM_FUNTAIL, dev->name); | 1062 | "%s(%s)", CTCM_FUNTAIL, dev->name); |
| 1063 | priv = dev->priv; | 1063 | priv = dev->ml_priv; |
| 1064 | if (priv) { | 1064 | if (priv) { |
| 1065 | grp = priv->mpcg; | 1065 | grp = priv->mpcg; |
| 1066 | if (grp) { | 1066 | if (grp) { |
| @@ -1125,7 +1125,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) | |||
| 1125 | CTCM_FUNTAIL); | 1125 | CTCM_FUNTAIL); |
| 1126 | return NULL; | 1126 | return NULL; |
| 1127 | } | 1127 | } |
| 1128 | dev->priv = priv; | 1128 | dev->ml_priv = priv; |
| 1129 | priv->fsm = init_fsm("ctcmdev", dev_state_names, dev_event_names, | 1129 | priv->fsm = init_fsm("ctcmdev", dev_state_names, dev_event_names, |
| 1130 | CTCM_NR_DEV_STATES, CTCM_NR_DEV_EVENTS, | 1130 | CTCM_NR_DEV_STATES, CTCM_NR_DEV_EVENTS, |
| 1131 | dev_fsm, dev_fsm_len, GFP_KERNEL); | 1131 | dev_fsm, dev_fsm_len, GFP_KERNEL); |
diff --git a/drivers/s390/net/ctcm_main.h b/drivers/s390/net/ctcm_main.h index a72e0feeb27f..8e10ee86a5ee 100644 --- a/drivers/s390/net/ctcm_main.h +++ b/drivers/s390/net/ctcm_main.h | |||
| @@ -229,14 +229,14 @@ void ctcm_remove_files(struct device *dev); | |||
| 229 | */ | 229 | */ |
| 230 | static inline void ctcm_clear_busy_do(struct net_device *dev) | 230 | static inline void ctcm_clear_busy_do(struct net_device *dev) |
| 231 | { | 231 | { |
| 232 | clear_bit(0, &(((struct ctcm_priv *)dev->priv)->tbusy)); | 232 | clear_bit(0, &(((struct ctcm_priv *)dev->ml_priv)->tbusy)); |
| 233 | netif_wake_queue(dev); | 233 | netif_wake_queue(dev); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | static inline void ctcm_clear_busy(struct net_device *dev) | 236 | static inline void ctcm_clear_busy(struct net_device *dev) |
| 237 | { | 237 | { |
| 238 | struct mpc_group *grp; | 238 | struct mpc_group *grp; |
| 239 | grp = ((struct ctcm_priv *)dev->priv)->mpcg; | 239 | grp = ((struct ctcm_priv *)dev->ml_priv)->mpcg; |
| 240 | 240 | ||
| 241 | if (!(grp && grp->in_sweep)) | 241 | if (!(grp && grp->in_sweep)) |
| 242 | ctcm_clear_busy_do(dev); | 242 | ctcm_clear_busy_do(dev); |
| @@ -246,7 +246,8 @@ static inline void ctcm_clear_busy(struct net_device *dev) | |||
| 246 | static inline int ctcm_test_and_set_busy(struct net_device *dev) | 246 | static inline int ctcm_test_and_set_busy(struct net_device *dev) |
| 247 | { | 247 | { |
| 248 | netif_stop_queue(dev); | 248 | netif_stop_queue(dev); |
| 249 | return test_and_set_bit(0, &(((struct ctcm_priv *)dev->priv)->tbusy)); | 249 | return test_and_set_bit(0, |
| 250 | &(((struct ctcm_priv *)dev->ml_priv)->tbusy)); | ||
| 250 | } | 251 | } |
| 251 | 252 | ||
| 252 | extern int loglevel; | 253 | extern int loglevel; |
| @@ -292,7 +293,7 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv); | |||
| 292 | #define IS_MPC(p) ((p)->protocol == CTCM_PROTO_MPC) | 293 | #define IS_MPC(p) ((p)->protocol == CTCM_PROTO_MPC) |
| 293 | 294 | ||
| 294 | /* test if struct ctcm_priv of struct net_device has MPC protocol setting */ | 295 | /* test if struct ctcm_priv of struct net_device has MPC protocol setting */ |
| 295 | #define IS_MPCDEV(d) IS_MPC((struct ctcm_priv *)d->priv) | 296 | #define IS_MPCDEV(dev) IS_MPC((struct ctcm_priv *)dev->ml_priv) |
| 296 | 297 | ||
| 297 | static inline gfp_t gfp_type(void) | 298 | static inline gfp_t gfp_type(void) |
| 298 | { | 299 | { |
diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c index 49ae1cd25caa..cbe470493bf0 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #undef DEBUGDATA | 19 | #undef DEBUGDATA |
| 20 | #undef DEBUGCCW | 20 | #undef DEBUGCCW |
| 21 | 21 | ||
| 22 | #include <linux/version.h> | ||
| 23 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
| 25 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
| @@ -313,10 +312,10 @@ static struct net_device *ctcmpc_get_dev(int port_num) | |||
| 313 | CTCM_FUNTAIL, device); | 312 | CTCM_FUNTAIL, device); |
| 314 | return NULL; | 313 | return NULL; |
| 315 | } | 314 | } |
| 316 | priv = dev->priv; | 315 | priv = dev->ml_priv; |
| 317 | if (priv == NULL) { | 316 | if (priv == NULL) { |
| 318 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | 317 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
| 319 | "%s(%s): dev->priv is NULL", | 318 | "%s(%s): dev->ml_priv is NULL", |
| 320 | CTCM_FUNTAIL, device); | 319 | CTCM_FUNTAIL, device); |
| 321 | return NULL; | 320 | return NULL; |
| 322 | } | 321 | } |
| @@ -345,7 +344,7 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) | |||
| 345 | dev = ctcmpc_get_dev(port_num); | 344 | dev = ctcmpc_get_dev(port_num); |
| 346 | if (dev == NULL) | 345 | if (dev == NULL) |
| 347 | return 1; | 346 | return 1; |
| 348 | priv = dev->priv; | 347 | priv = dev->ml_priv; |
| 349 | grp = priv->mpcg; | 348 | grp = priv->mpcg; |
| 350 | 349 | ||
| 351 | grp->allochanfunc = callback; | 350 | grp->allochanfunc = callback; |
| @@ -417,7 +416,7 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
| 417 | dev = ctcmpc_get_dev(port_num); | 416 | dev = ctcmpc_get_dev(port_num); |
| 418 | if (dev == NULL) | 417 | if (dev == NULL) |
| 419 | return; | 418 | return; |
| 420 | priv = dev->priv; | 419 | priv = dev->ml_priv; |
| 421 | grp = priv->mpcg; | 420 | grp = priv->mpcg; |
| 422 | rch = priv->channel[READ]; | 421 | rch = priv->channel[READ]; |
| 423 | wch = priv->channel[WRITE]; | 422 | wch = priv->channel[WRITE]; |
| @@ -535,7 +534,7 @@ void ctc_mpc_dealloc_ch(int port_num) | |||
| 535 | dev = ctcmpc_get_dev(port_num); | 534 | dev = ctcmpc_get_dev(port_num); |
| 536 | if (dev == NULL) | 535 | if (dev == NULL) |
| 537 | return; | 536 | return; |
| 538 | priv = dev->priv; | 537 | priv = dev->ml_priv; |
| 539 | grp = priv->mpcg; | 538 | grp = priv->mpcg; |
| 540 | 539 | ||
| 541 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_DEBUG, | 540 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_DEBUG, |
| @@ -571,7 +570,7 @@ void ctc_mpc_flow_control(int port_num, int flowc) | |||
| 571 | dev = ctcmpc_get_dev(port_num); | 570 | dev = ctcmpc_get_dev(port_num); |
| 572 | if (dev == NULL) | 571 | if (dev == NULL) |
| 573 | return; | 572 | return; |
| 574 | priv = dev->priv; | 573 | priv = dev->ml_priv; |
| 575 | grp = priv->mpcg; | 574 | grp = priv->mpcg; |
| 576 | 575 | ||
| 577 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, | 576 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
| @@ -620,7 +619,7 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo) | |||
| 620 | { | 619 | { |
| 621 | struct channel *rch = mpcginfo->ch; | 620 | struct channel *rch = mpcginfo->ch; |
| 622 | struct net_device *dev = rch->netdev; | 621 | struct net_device *dev = rch->netdev; |
| 623 | struct ctcm_priv *priv = dev->priv; | 622 | struct ctcm_priv *priv = dev->ml_priv; |
| 624 | struct mpc_group *grp = priv->mpcg; | 623 | struct mpc_group *grp = priv->mpcg; |
| 625 | struct channel *ch = priv->channel[WRITE]; | 624 | struct channel *ch = priv->channel[WRITE]; |
| 626 | 625 | ||
| @@ -651,7 +650,7 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo) | |||
| 651 | static void ctcmpc_send_sweep_resp(struct channel *rch) | 650 | static void ctcmpc_send_sweep_resp(struct channel *rch) |
| 652 | { | 651 | { |
| 653 | struct net_device *dev = rch->netdev; | 652 | struct net_device *dev = rch->netdev; |
| 654 | struct ctcm_priv *priv = dev->priv; | 653 | struct ctcm_priv *priv = dev->ml_priv; |
| 655 | struct mpc_group *grp = priv->mpcg; | 654 | struct mpc_group *grp = priv->mpcg; |
| 656 | int rc = 0; | 655 | int rc = 0; |
| 657 | struct th_sweep *header; | 656 | struct th_sweep *header; |
| @@ -713,7 +712,7 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo) | |||
| 713 | { | 712 | { |
| 714 | struct channel *rch = mpcginfo->ch; | 713 | struct channel *rch = mpcginfo->ch; |
| 715 | struct net_device *dev = rch->netdev; | 714 | struct net_device *dev = rch->netdev; |
| 716 | struct ctcm_priv *priv = dev->priv; | 715 | struct ctcm_priv *priv = dev->ml_priv; |
| 717 | struct mpc_group *grp = priv->mpcg; | 716 | struct mpc_group *grp = priv->mpcg; |
| 718 | struct channel *ch = priv->channel[WRITE]; | 717 | struct channel *ch = priv->channel[WRITE]; |
| 719 | 718 | ||
| @@ -847,7 +846,7 @@ static int mpcg_fsm_len = ARRAY_SIZE(mpcg_fsm); | |||
| 847 | static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) | 846 | static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) |
| 848 | { | 847 | { |
| 849 | struct net_device *dev = arg; | 848 | struct net_device *dev = arg; |
| 850 | struct ctcm_priv *priv = dev->priv; | 849 | struct ctcm_priv *priv = dev->ml_priv; |
| 851 | struct mpc_group *grp = priv->mpcg; | 850 | struct mpc_group *grp = priv->mpcg; |
| 852 | 851 | ||
| 853 | if (grp == NULL) { | 852 | if (grp == NULL) { |
| @@ -891,7 +890,7 @@ static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) | |||
| 891 | void mpc_group_ready(unsigned long adev) | 890 | void mpc_group_ready(unsigned long adev) |
| 892 | { | 891 | { |
| 893 | struct net_device *dev = (struct net_device *)adev; | 892 | struct net_device *dev = (struct net_device *)adev; |
| 894 | struct ctcm_priv *priv = dev->priv; | 893 | struct ctcm_priv *priv = dev->ml_priv; |
| 895 | struct mpc_group *grp = priv->mpcg; | 894 | struct mpc_group *grp = priv->mpcg; |
| 896 | struct channel *ch = NULL; | 895 | struct channel *ch = NULL; |
| 897 | 896 | ||
| @@ -947,7 +946,7 @@ void mpc_group_ready(unsigned long adev) | |||
| 947 | void mpc_channel_action(struct channel *ch, int direction, int action) | 946 | void mpc_channel_action(struct channel *ch, int direction, int action) |
| 948 | { | 947 | { |
| 949 | struct net_device *dev = ch->netdev; | 948 | struct net_device *dev = ch->netdev; |
| 950 | struct ctcm_priv *priv = dev->priv; | 949 | struct ctcm_priv *priv = dev->ml_priv; |
| 951 | struct mpc_group *grp = priv->mpcg; | 950 | struct mpc_group *grp = priv->mpcg; |
| 952 | 951 | ||
| 953 | if (grp == NULL) { | 952 | if (grp == NULL) { |
| @@ -1057,7 +1056,7 @@ done: | |||
| 1057 | static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | 1056 | static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) |
| 1058 | { | 1057 | { |
| 1059 | struct net_device *dev = ch->netdev; | 1058 | struct net_device *dev = ch->netdev; |
| 1060 | struct ctcm_priv *priv = dev->priv; | 1059 | struct ctcm_priv *priv = dev->ml_priv; |
| 1061 | struct mpc_group *grp = priv->mpcg; | 1060 | struct mpc_group *grp = priv->mpcg; |
| 1062 | struct pdu *curr_pdu; | 1061 | struct pdu *curr_pdu; |
| 1063 | struct mpcg_info *mpcginfo; | 1062 | struct mpcg_info *mpcginfo; |
| @@ -1255,7 +1254,7 @@ void ctcmpc_bh(unsigned long thischan) | |||
| 1255 | struct channel *ch = (struct channel *)thischan; | 1254 | struct channel *ch = (struct channel *)thischan; |
| 1256 | struct sk_buff *skb; | 1255 | struct sk_buff *skb; |
| 1257 | struct net_device *dev = ch->netdev; | 1256 | struct net_device *dev = ch->netdev; |
| 1258 | struct ctcm_priv *priv = dev->priv; | 1257 | struct ctcm_priv *priv = dev->ml_priv; |
| 1259 | struct mpc_group *grp = priv->mpcg; | 1258 | struct mpc_group *grp = priv->mpcg; |
| 1260 | 1259 | ||
| 1261 | CTCM_PR_DEBUG("%s cp:%i enter: %s() %s\n", | 1260 | CTCM_PR_DEBUG("%s cp:%i enter: %s() %s\n", |
| @@ -1377,7 +1376,7 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) | |||
| 1377 | BUG_ON(dev == NULL); | 1376 | BUG_ON(dev == NULL); |
| 1378 | CTCM_PR_DEBUG("Enter %s: %s\n", __func__, dev->name); | 1377 | CTCM_PR_DEBUG("Enter %s: %s\n", __func__, dev->name); |
| 1379 | 1378 | ||
| 1380 | priv = dev->priv; | 1379 | priv = dev->ml_priv; |
| 1381 | grp = priv->mpcg; | 1380 | grp = priv->mpcg; |
| 1382 | grp->flow_off_called = 0; | 1381 | grp->flow_off_called = 0; |
| 1383 | fsm_deltimer(&grp->timer); | 1382 | fsm_deltimer(&grp->timer); |
| @@ -1483,7 +1482,7 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) | |||
| 1483 | 1482 | ||
| 1484 | BUG_ON(dev == NULL); | 1483 | BUG_ON(dev == NULL); |
| 1485 | 1484 | ||
| 1486 | priv = dev->priv; | 1485 | priv = dev->ml_priv; |
| 1487 | grp = priv->mpcg; | 1486 | grp = priv->mpcg; |
| 1488 | wch = priv->channel[WRITE]; | 1487 | wch = priv->channel[WRITE]; |
| 1489 | rch = priv->channel[READ]; | 1488 | rch = priv->channel[READ]; |
| @@ -1521,7 +1520,7 @@ void mpc_action_discontact(fsm_instance *fi, int event, void *arg) | |||
| 1521 | if (ch) { | 1520 | if (ch) { |
| 1522 | dev = ch->netdev; | 1521 | dev = ch->netdev; |
| 1523 | if (dev) { | 1522 | if (dev) { |
| 1524 | priv = dev->priv; | 1523 | priv = dev->ml_priv; |
| 1525 | if (priv) { | 1524 | if (priv) { |
| 1526 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, | 1525 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
| 1527 | "%s: %s: %s\n", | 1526 | "%s: %s: %s\n", |
| @@ -1569,7 +1568,7 @@ static int mpc_validate_xid(struct mpcg_info *mpcginfo) | |||
| 1569 | { | 1568 | { |
| 1570 | struct channel *ch = mpcginfo->ch; | 1569 | struct channel *ch = mpcginfo->ch; |
| 1571 | struct net_device *dev = ch->netdev; | 1570 | struct net_device *dev = ch->netdev; |
| 1572 | struct ctcm_priv *priv = dev->priv; | 1571 | struct ctcm_priv *priv = dev->ml_priv; |
| 1573 | struct mpc_group *grp = priv->mpcg; | 1572 | struct mpc_group *grp = priv->mpcg; |
| 1574 | struct xid2 *xid = mpcginfo->xid; | 1573 | struct xid2 *xid = mpcginfo->xid; |
| 1575 | int rc = 0; | 1574 | int rc = 0; |
| @@ -1866,7 +1865,7 @@ static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) | |||
| 1866 | { | 1865 | { |
| 1867 | struct channel *ch = arg; | 1866 | struct channel *ch = arg; |
| 1868 | struct net_device *dev = ch->netdev; | 1867 | struct net_device *dev = ch->netdev; |
| 1869 | struct ctcm_priv *priv = dev->priv; | 1868 | struct ctcm_priv *priv = dev->ml_priv; |
| 1870 | struct mpc_group *grp = priv->mpcg; | 1869 | struct mpc_group *grp = priv->mpcg; |
| 1871 | 1870 | ||
| 1872 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", | 1871 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", |
| @@ -1906,7 +1905,7 @@ static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) | |||
| 1906 | static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) | 1905 | static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) |
| 1907 | { | 1906 | { |
| 1908 | struct net_device *dev = arg; | 1907 | struct net_device *dev = arg; |
| 1909 | struct ctcm_priv *priv = dev->priv; | 1908 | struct ctcm_priv *priv = dev->ml_priv; |
| 1910 | struct mpc_group *grp = NULL; | 1909 | struct mpc_group *grp = NULL; |
| 1911 | int direction; | 1910 | int direction; |
| 1912 | int send = 0; | 1911 | int send = 0; |
| @@ -1983,7 +1982,7 @@ static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) | |||
| 1983 | struct mpcg_info *mpcginfo = arg; | 1982 | struct mpcg_info *mpcginfo = arg; |
| 1984 | struct channel *ch = mpcginfo->ch; | 1983 | struct channel *ch = mpcginfo->ch; |
| 1985 | struct net_device *dev = ch->netdev; | 1984 | struct net_device *dev = ch->netdev; |
| 1986 | struct ctcm_priv *priv = dev->priv; | 1985 | struct ctcm_priv *priv = dev->ml_priv; |
| 1987 | struct mpc_group *grp = priv->mpcg; | 1986 | struct mpc_group *grp = priv->mpcg; |
| 1988 | 1987 | ||
| 1989 | CTCM_PR_DEBUG("%s: ch-id:%s xid2:%i xid7:%i xidt_p2:%i \n", | 1988 | CTCM_PR_DEBUG("%s: ch-id:%s xid2:%i xid7:%i xidt_p2:%i \n", |
| @@ -2045,7 +2044,7 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) | |||
| 2045 | struct mpcg_info *mpcginfo = arg; | 2044 | struct mpcg_info *mpcginfo = arg; |
| 2046 | struct channel *ch = mpcginfo->ch; | 2045 | struct channel *ch = mpcginfo->ch; |
| 2047 | struct net_device *dev = ch->netdev; | 2046 | struct net_device *dev = ch->netdev; |
| 2048 | struct ctcm_priv *priv = dev->priv; | 2047 | struct ctcm_priv *priv = dev->ml_priv; |
| 2049 | struct mpc_group *grp = priv->mpcg; | 2048 | struct mpc_group *grp = priv->mpcg; |
| 2050 | 2049 | ||
| 2051 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", | 2050 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", |
| @@ -2097,7 +2096,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
| 2097 | __u32 new_len = 0; | 2096 | __u32 new_len = 0; |
| 2098 | struct sk_buff *skb; | 2097 | struct sk_buff *skb; |
| 2099 | struct qllc *qllcptr; | 2098 | struct qllc *qllcptr; |
| 2100 | struct ctcm_priv *priv = dev->priv; | 2099 | struct ctcm_priv *priv = dev->ml_priv; |
| 2101 | struct mpc_group *grp = priv->mpcg; | 2100 | struct mpc_group *grp = priv->mpcg; |
| 2102 | 2101 | ||
| 2103 | CTCM_PR_DEBUG("%s: GROUP STATE: %s\n", | 2102 | CTCM_PR_DEBUG("%s: GROUP STATE: %s\n", |
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 6de28385b354..9bcfa04d863b 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
| @@ -1412,7 +1412,8 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
| 1412 | } | 1412 | } |
| 1413 | /* How far in the ccw chain have we processed? */ | 1413 | /* How far in the ccw chain have we processed? */ |
| 1414 | if ((channel->state != LCS_CH_STATE_INIT) && | 1414 | if ((channel->state != LCS_CH_STATE_INIT) && |
| 1415 | (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC)) { | 1415 | (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC) && |
| 1416 | (irb->scsw.cmd.cpa != 0)) { | ||
| 1416 | index = (struct ccw1 *) __va((addr_t) irb->scsw.cmd.cpa) | 1417 | index = (struct ccw1 *) __va((addr_t) irb->scsw.cmd.cpa) |
| 1417 | - channel->ccws; | 1418 | - channel->ccws; |
| 1418 | if ((irb->scsw.cmd.actl & SCSW_ACTL_SUSPENDED) || | 1419 | if ((irb->scsw.cmd.actl & SCSW_ACTL_SUSPENDED) || |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 80971c21ea1a..bf8a75c92f28 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
| @@ -689,6 +689,7 @@ struct qeth_mc_mac { | |||
| 689 | struct list_head list; | 689 | struct list_head list; |
| 690 | __u8 mc_addr[MAX_ADDR_LEN]; | 690 | __u8 mc_addr[MAX_ADDR_LEN]; |
| 691 | unsigned char mc_addrlen; | 691 | unsigned char mc_addrlen; |
| 692 | int is_vmac; | ||
| 692 | }; | 693 | }; |
| 693 | 694 | ||
| 694 | struct qeth_card { | 695 | struct qeth_card { |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index bd420d1b9a0d..c7ab1b864516 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
| @@ -3024,7 +3024,7 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb, | |||
| 3024 | struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill, | 3024 | struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill, |
| 3025 | int offset) | 3025 | int offset) |
| 3026 | { | 3026 | { |
| 3027 | int length = skb->len; | 3027 | int length = skb->len - offset; |
| 3028 | int length_here; | 3028 | int length_here; |
| 3029 | int element; | 3029 | int element; |
| 3030 | char *data; | 3030 | char *data; |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index b3cee032f578..3ac3cc1e03cc 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
| @@ -177,9 +177,10 @@ static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac) | |||
| 177 | qeth_l2_send_delgroupmac_cb); | 177 | qeth_l2_send_delgroupmac_cb); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac) | 180 | static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac) |
| 181 | { | 181 | { |
| 182 | struct qeth_mc_mac *mc; | 182 | struct qeth_mc_mac *mc; |
| 183 | int rc; | ||
| 183 | 184 | ||
| 184 | mc = kmalloc(sizeof(struct qeth_mc_mac), GFP_ATOMIC); | 185 | mc = kmalloc(sizeof(struct qeth_mc_mac), GFP_ATOMIC); |
| 185 | 186 | ||
| @@ -188,8 +189,16 @@ static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac) | |||
| 188 | 189 | ||
| 189 | memcpy(mc->mc_addr, mac, OSA_ADDR_LEN); | 190 | memcpy(mc->mc_addr, mac, OSA_ADDR_LEN); |
| 190 | mc->mc_addrlen = OSA_ADDR_LEN; | 191 | mc->mc_addrlen = OSA_ADDR_LEN; |
| 192 | mc->is_vmac = vmac; | ||
| 193 | |||
| 194 | if (vmac) { | ||
| 195 | rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC, | ||
| 196 | NULL); | ||
| 197 | } else { | ||
| 198 | rc = qeth_l2_send_setgroupmac(card, mac); | ||
| 199 | } | ||
| 191 | 200 | ||
| 192 | if (!qeth_l2_send_setgroupmac(card, mac)) | 201 | if (!rc) |
| 193 | list_add_tail(&mc->list, &card->mc_list); | 202 | list_add_tail(&mc->list, &card->mc_list); |
| 194 | else | 203 | else |
| 195 | kfree(mc); | 204 | kfree(mc); |
| @@ -201,7 +210,11 @@ static void qeth_l2_del_all_mc(struct qeth_card *card) | |||
| 201 | 210 | ||
| 202 | spin_lock_bh(&card->mclock); | 211 | spin_lock_bh(&card->mclock); |
| 203 | list_for_each_entry_safe(mc, tmp, &card->mc_list, list) { | 212 | list_for_each_entry_safe(mc, tmp, &card->mc_list, list) { |
| 204 | qeth_l2_send_delgroupmac(card, mc->mc_addr); | 213 | if (mc->is_vmac) |
| 214 | qeth_l2_send_setdelmac(card, mc->mc_addr, | ||
| 215 | IPA_CMD_DELVMAC, NULL); | ||
| 216 | else | ||
| 217 | qeth_l2_send_delgroupmac(card, mc->mc_addr); | ||
| 205 | list_del(&mc->list); | 218 | list_del(&mc->list); |
| 206 | kfree(mc); | 219 | kfree(mc); |
| 207 | } | 220 | } |
| @@ -590,7 +603,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) | |||
| 590 | static void qeth_l2_set_multicast_list(struct net_device *dev) | 603 | static void qeth_l2_set_multicast_list(struct net_device *dev) |
| 591 | { | 604 | { |
| 592 | struct qeth_card *card = dev->ml_priv; | 605 | struct qeth_card *card = dev->ml_priv; |
| 593 | struct dev_mc_list *dm; | 606 | struct dev_addr_list *dm; |
| 594 | 607 | ||
| 595 | if (card->info.type == QETH_CARD_TYPE_OSN) | 608 | if (card->info.type == QETH_CARD_TYPE_OSN) |
| 596 | return ; | 609 | return ; |
| @@ -599,7 +612,11 @@ static void qeth_l2_set_multicast_list(struct net_device *dev) | |||
| 599 | qeth_l2_del_all_mc(card); | 612 | qeth_l2_del_all_mc(card); |
| 600 | spin_lock_bh(&card->mclock); | 613 | spin_lock_bh(&card->mclock); |
| 601 | for (dm = dev->mc_list; dm; dm = dm->next) | 614 | for (dm = dev->mc_list; dm; dm = dm->next) |
| 602 | qeth_l2_add_mc(card, dm->dmi_addr); | 615 | qeth_l2_add_mc(card, dm->da_addr, 0); |
| 616 | |||
| 617 | for (dm = dev->uc_list; dm; dm = dm->next) | ||
| 618 | qeth_l2_add_mc(card, dm->da_addr, 1); | ||
| 619 | |||
| 603 | spin_unlock_bh(&card->mclock); | 620 | spin_unlock_bh(&card->mclock); |
| 604 | if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) | 621 | if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) |
| 605 | return; | 622 | return; |
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c index ac1993708ae9..210ddb639748 100644 --- a/drivers/s390/net/qeth_l3_sys.c +++ b/drivers/s390/net/qeth_l3_sys.c | |||
| @@ -136,7 +136,7 @@ static ssize_t qeth_l3_dev_route6_store(struct device *dev, | |||
| 136 | return -EINVAL; | 136 | return -EINVAL; |
| 137 | 137 | ||
| 138 | if (!qeth_is_supported(card, IPA_IPV6)) { | 138 | if (!qeth_is_supported(card, IPA_IPV6)) { |
| 139 | return -ENOTSUPP; | 139 | return -EOPNOTSUPP; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | return qeth_l3_dev_route_store(card, &card->options.route6, | 142 | return qeth_l3_dev_route_store(card, &card->options.route6, |
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index 391dd29749f8..51b6a05f4d12 100644 --- a/drivers/s390/scsi/zfcp_ccw.c +++ b/drivers/s390/scsi/zfcp_ccw.c | |||
| @@ -152,10 +152,8 @@ static int zfcp_ccw_set_offline(struct ccw_device *ccw_device) | |||
| 152 | */ | 152 | */ |
| 153 | static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event) | 153 | static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event) |
| 154 | { | 154 | { |
| 155 | struct zfcp_adapter *adapter; | 155 | struct zfcp_adapter *adapter = dev_get_drvdata(&ccw_device->dev); |
| 156 | 156 | ||
| 157 | down(&zfcp_data.config_sema); | ||
| 158 | adapter = dev_get_drvdata(&ccw_device->dev); | ||
| 159 | switch (event) { | 157 | switch (event) { |
| 160 | case CIO_GONE: | 158 | case CIO_GONE: |
| 161 | dev_warn(&adapter->ccw_device->dev, "device gone\n"); | 159 | dev_warn(&adapter->ccw_device->dev, "device gone\n"); |
| @@ -174,8 +172,6 @@ static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event) | |||
| 174 | 89, NULL); | 172 | 89, NULL); |
| 175 | break; | 173 | break; |
| 176 | } | 174 | } |
| 177 | zfcp_erp_wait(adapter); | ||
| 178 | up(&zfcp_data.config_sema); | ||
| 179 | return 1; | 175 | return 1; |
| 180 | } | 176 | } |
| 181 | 177 | ||
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index e984469bb98b..56196c98c07b 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c | |||
| @@ -39,18 +39,6 @@ struct zfcp_gpn_ft { | |||
| 39 | struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS]; | 39 | struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS]; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | static struct zfcp_port *zfcp_get_port_by_did(struct zfcp_adapter *adapter, | ||
| 43 | u32 d_id) | ||
| 44 | { | ||
| 45 | struct zfcp_port *port; | ||
| 46 | |||
| 47 | list_for_each_entry(port, &adapter->port_list_head, list) | ||
| 48 | if ((port->d_id == d_id) && | ||
| 49 | !atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status)) | ||
| 50 | return port; | ||
| 51 | return NULL; | ||
| 52 | } | ||
| 53 | |||
| 54 | static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, | 42 | static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, |
| 55 | struct fcp_rscn_element *elem) | 43 | struct fcp_rscn_element *elem) |
| 56 | { | 44 | { |
| @@ -341,12 +329,13 @@ void zfcp_test_link(struct zfcp_port *port) | |||
| 341 | 329 | ||
| 342 | zfcp_port_get(port); | 330 | zfcp_port_get(port); |
| 343 | retval = zfcp_fc_adisc(port); | 331 | retval = zfcp_fc_adisc(port); |
| 344 | if (retval == 0 || retval == -EBUSY) | 332 | if (retval == 0) |
| 345 | return; | 333 | return; |
| 346 | 334 | ||
| 347 | /* send of ADISC was not possible */ | 335 | /* send of ADISC was not possible */ |
| 348 | zfcp_port_put(port); | 336 | zfcp_port_put(port); |
| 349 | zfcp_erp_port_forced_reopen(port, 0, 65, NULL); | 337 | if (retval != -EBUSY) |
| 338 | zfcp_erp_port_forced_reopen(port, 0, 65, NULL); | ||
| 350 | } | 339 | } |
| 351 | 340 | ||
| 352 | static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter) | 341 | static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter) |
| @@ -363,7 +352,6 @@ static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter) | |||
| 363 | if (ret) | 352 | if (ret) |
| 364 | return ret; | 353 | return ret; |
| 365 | zfcp_erp_wait(adapter); | 354 | zfcp_erp_wait(adapter); |
| 366 | zfcp_port_put(adapter->nameserver_port); | ||
| 367 | } | 355 | } |
| 368 | return !atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, | 356 | return !atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, |
| 369 | &adapter->nameserver_port->status); | 357 | &adapter->nameserver_port->status); |
| @@ -475,7 +463,7 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft) | |||
| 475 | struct zfcp_adapter *adapter = ct->port->adapter; | 463 | struct zfcp_adapter *adapter = ct->port->adapter; |
| 476 | struct zfcp_port *port, *tmp; | 464 | struct zfcp_port *port, *tmp; |
| 477 | u32 d_id; | 465 | u32 d_id; |
| 478 | int ret = 0, x; | 466 | int ret = 0, x, last = 0; |
| 479 | 467 | ||
| 480 | if (ct->status) | 468 | if (ct->status) |
| 481 | return -EIO; | 469 | return -EIO; |
| @@ -492,19 +480,24 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft) | |||
| 492 | down(&zfcp_data.config_sema); | 480 | down(&zfcp_data.config_sema); |
| 493 | 481 | ||
| 494 | /* first entry is the header */ | 482 | /* first entry is the header */ |
| 495 | for (x = 1; x < ZFCP_GPN_FT_MAX_ENTRIES; x++) { | 483 | for (x = 1; x < ZFCP_GPN_FT_MAX_ENTRIES && !last; x++) { |
| 496 | if (x % (ZFCP_GPN_FT_ENTRIES + 1)) | 484 | if (x % (ZFCP_GPN_FT_ENTRIES + 1)) |
| 497 | acc++; | 485 | acc++; |
| 498 | else | 486 | else |
| 499 | acc = sg_virt(++sg); | 487 | acc = sg_virt(++sg); |
| 500 | 488 | ||
| 489 | last = acc->control & 0x80; | ||
| 501 | d_id = acc->port_id[0] << 16 | acc->port_id[1] << 8 | | 490 | d_id = acc->port_id[0] << 16 | acc->port_id[1] << 8 | |
| 502 | acc->port_id[2]; | 491 | acc->port_id[2]; |
| 503 | 492 | ||
| 504 | /* skip the adapter's port and known remote ports */ | 493 | /* skip the adapter's port and known remote ports */ |
| 505 | if (acc->wwpn == fc_host_port_name(adapter->scsi_host) || | 494 | if (acc->wwpn == fc_host_port_name(adapter->scsi_host)) |
| 506 | zfcp_get_port_by_did(adapter, d_id)) | 495 | continue; |
| 496 | port = zfcp_get_port_by_wwpn(adapter, acc->wwpn); | ||
| 497 | if (port) { | ||
| 498 | zfcp_port_get(port); | ||
| 507 | continue; | 499 | continue; |
| 500 | } | ||
| 508 | 501 | ||
| 509 | port = zfcp_port_enqueue(adapter, acc->wwpn, | 502 | port = zfcp_port_enqueue(adapter, acc->wwpn, |
| 510 | ZFCP_STATUS_PORT_DID_DID | | 503 | ZFCP_STATUS_PORT_DID_DID | |
| @@ -513,8 +506,6 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft) | |||
| 513 | ret = PTR_ERR(port); | 506 | ret = PTR_ERR(port); |
| 514 | else | 507 | else |
| 515 | zfcp_erp_port_reopen(port, 0, 149, NULL); | 508 | zfcp_erp_port_reopen(port, 0, 149, NULL); |
| 516 | if (acc->control & 0x80) /* last entry */ | ||
| 517 | break; | ||
| 518 | } | 509 | } |
| 519 | 510 | ||
| 520 | zfcp_erp_wait(adapter); | 511 | zfcp_erp_wait(adapter); |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 19c1ca913874..49dbeb754e5f 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
| @@ -710,10 +710,10 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req) | |||
| 710 | 710 | ||
| 711 | static int zfcp_fsf_sbal_check(struct zfcp_qdio_queue *queue) | 711 | static int zfcp_fsf_sbal_check(struct zfcp_qdio_queue *queue) |
| 712 | { | 712 | { |
| 713 | spin_lock(&queue->lock); | 713 | spin_lock_bh(&queue->lock); |
| 714 | if (atomic_read(&queue->count)) | 714 | if (atomic_read(&queue->count)) |
| 715 | return 1; | 715 | return 1; |
| 716 | spin_unlock(&queue->lock); | 716 | spin_unlock_bh(&queue->lock); |
| 717 | return 0; | 717 | return 0; |
| 718 | } | 718 | } |
| 719 | 719 | ||
| @@ -722,13 +722,13 @@ static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter) | |||
| 722 | long ret; | 722 | long ret; |
| 723 | struct zfcp_qdio_queue *req_q = &adapter->req_q; | 723 | struct zfcp_qdio_queue *req_q = &adapter->req_q; |
| 724 | 724 | ||
| 725 | spin_unlock(&req_q->lock); | 725 | spin_unlock_bh(&req_q->lock); |
| 726 | ret = wait_event_interruptible_timeout(adapter->request_wq, | 726 | ret = wait_event_interruptible_timeout(adapter->request_wq, |
| 727 | zfcp_fsf_sbal_check(req_q), 5 * HZ); | 727 | zfcp_fsf_sbal_check(req_q), 5 * HZ); |
| 728 | if (ret > 0) | 728 | if (ret > 0) |
| 729 | return 0; | 729 | return 0; |
| 730 | 730 | ||
| 731 | spin_lock(&req_q->lock); | 731 | spin_lock_bh(&req_q->lock); |
| 732 | return -EIO; | 732 | return -EIO; |
| 733 | } | 733 | } |
| 734 | 734 | ||
| @@ -870,14 +870,14 @@ int zfcp_fsf_status_read(struct zfcp_adapter *adapter) | |||
| 870 | volatile struct qdio_buffer_element *sbale; | 870 | volatile struct qdio_buffer_element *sbale; |
| 871 | int retval = -EIO; | 871 | int retval = -EIO; |
| 872 | 872 | ||
| 873 | spin_lock(&adapter->req_q.lock); | 873 | spin_lock_bh(&adapter->req_q.lock); |
| 874 | if (zfcp_fsf_req_sbal_get(adapter)) | 874 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 875 | goto out; | 875 | goto out; |
| 876 | 876 | ||
| 877 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_UNSOLICITED_STATUS, | 877 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_UNSOLICITED_STATUS, |
| 878 | ZFCP_REQ_NO_QTCB, | 878 | ZFCP_REQ_NO_QTCB, |
| 879 | adapter->pool.fsf_req_status_read); | 879 | adapter->pool.fsf_req_status_read); |
| 880 | if (unlikely(IS_ERR(req))) { | 880 | if (IS_ERR(req)) { |
| 881 | retval = PTR_ERR(req); | 881 | retval = PTR_ERR(req); |
| 882 | goto out; | 882 | goto out; |
| 883 | } | 883 | } |
| @@ -910,7 +910,7 @@ failed_buf: | |||
| 910 | zfcp_fsf_req_free(req); | 910 | zfcp_fsf_req_free(req); |
| 911 | zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL); | 911 | zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL); |
| 912 | out: | 912 | out: |
| 913 | spin_unlock(&adapter->req_q.lock); | 913 | spin_unlock_bh(&adapter->req_q.lock); |
| 914 | return retval; | 914 | return retval; |
| 915 | } | 915 | } |
| 916 | 916 | ||
| @@ -988,7 +988,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id, | |||
| 988 | goto out; | 988 | goto out; |
| 989 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, | 989 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, |
| 990 | req_flags, adapter->pool.fsf_req_abort); | 990 | req_flags, adapter->pool.fsf_req_abort); |
| 991 | if (unlikely(IS_ERR(req))) | 991 | if (IS_ERR(req)) |
| 992 | goto out; | 992 | goto out; |
| 993 | 993 | ||
| 994 | if (unlikely(!(atomic_read(&unit->status) & | 994 | if (unlikely(!(atomic_read(&unit->status) & |
| @@ -1106,13 +1106,13 @@ int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool, | |||
| 1106 | struct zfcp_fsf_req *req; | 1106 | struct zfcp_fsf_req *req; |
| 1107 | int ret = -EIO; | 1107 | int ret = -EIO; |
| 1108 | 1108 | ||
| 1109 | spin_lock(&adapter->req_q.lock); | 1109 | spin_lock_bh(&adapter->req_q.lock); |
| 1110 | if (zfcp_fsf_req_sbal_get(adapter)) | 1110 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 1111 | goto out; | 1111 | goto out; |
| 1112 | 1112 | ||
| 1113 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC, | 1113 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC, |
| 1114 | ZFCP_REQ_AUTO_CLEANUP, pool); | 1114 | ZFCP_REQ_AUTO_CLEANUP, pool); |
| 1115 | if (unlikely(IS_ERR(req))) { | 1115 | if (IS_ERR(req)) { |
| 1116 | ret = PTR_ERR(req); | 1116 | ret = PTR_ERR(req); |
| 1117 | goto out; | 1117 | goto out; |
| 1118 | } | 1118 | } |
| @@ -1148,7 +1148,7 @@ failed_send: | |||
| 1148 | if (erp_action) | 1148 | if (erp_action) |
| 1149 | erp_action->fsf_req = NULL; | 1149 | erp_action->fsf_req = NULL; |
| 1150 | out: | 1150 | out: |
| 1151 | spin_unlock(&adapter->req_q.lock); | 1151 | spin_unlock_bh(&adapter->req_q.lock); |
| 1152 | return ret; | 1152 | return ret; |
| 1153 | } | 1153 | } |
| 1154 | 1154 | ||
| @@ -1223,7 +1223,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els) | |||
| 1223 | goto out; | 1223 | goto out; |
| 1224 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS, | 1224 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS, |
| 1225 | ZFCP_REQ_AUTO_CLEANUP, NULL); | 1225 | ZFCP_REQ_AUTO_CLEANUP, NULL); |
| 1226 | if (unlikely(IS_ERR(req))) { | 1226 | if (IS_ERR(req)) { |
| 1227 | ret = PTR_ERR(req); | 1227 | ret = PTR_ERR(req); |
| 1228 | goto out; | 1228 | goto out; |
| 1229 | } | 1229 | } |
| @@ -1263,14 +1263,14 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) | |||
| 1263 | struct zfcp_adapter *adapter = erp_action->adapter; | 1263 | struct zfcp_adapter *adapter = erp_action->adapter; |
| 1264 | int retval = -EIO; | 1264 | int retval = -EIO; |
| 1265 | 1265 | ||
| 1266 | spin_lock(&adapter->req_q.lock); | 1266 | spin_lock_bh(&adapter->req_q.lock); |
| 1267 | if (!atomic_read(&adapter->req_q.count)) | 1267 | if (!atomic_read(&adapter->req_q.count)) |
| 1268 | goto out; | 1268 | goto out; |
| 1269 | req = zfcp_fsf_req_create(adapter, | 1269 | req = zfcp_fsf_req_create(adapter, |
| 1270 | FSF_QTCB_EXCHANGE_CONFIG_DATA, | 1270 | FSF_QTCB_EXCHANGE_CONFIG_DATA, |
| 1271 | ZFCP_REQ_AUTO_CLEANUP, | 1271 | ZFCP_REQ_AUTO_CLEANUP, |
| 1272 | adapter->pool.fsf_req_erp); | 1272 | adapter->pool.fsf_req_erp); |
| 1273 | if (unlikely(IS_ERR(req))) { | 1273 | if (IS_ERR(req)) { |
| 1274 | retval = PTR_ERR(req); | 1274 | retval = PTR_ERR(req); |
| 1275 | goto out; | 1275 | goto out; |
| 1276 | } | 1276 | } |
| @@ -1295,7 +1295,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) | |||
| 1295 | erp_action->fsf_req = NULL; | 1295 | erp_action->fsf_req = NULL; |
| 1296 | } | 1296 | } |
| 1297 | out: | 1297 | out: |
| 1298 | spin_unlock(&adapter->req_q.lock); | 1298 | spin_unlock_bh(&adapter->req_q.lock); |
| 1299 | return retval; | 1299 | return retval; |
| 1300 | } | 1300 | } |
| 1301 | 1301 | ||
| @@ -1306,13 +1306,13 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter, | |||
| 1306 | struct zfcp_fsf_req *req = NULL; | 1306 | struct zfcp_fsf_req *req = NULL; |
| 1307 | int retval = -EIO; | 1307 | int retval = -EIO; |
| 1308 | 1308 | ||
| 1309 | spin_lock(&adapter->req_q.lock); | 1309 | spin_lock_bh(&adapter->req_q.lock); |
| 1310 | if (zfcp_fsf_req_sbal_get(adapter)) | 1310 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 1311 | goto out; | 1311 | goto out; |
| 1312 | 1312 | ||
| 1313 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, | 1313 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, |
| 1314 | 0, NULL); | 1314 | 0, NULL); |
| 1315 | if (unlikely(IS_ERR(req))) { | 1315 | if (IS_ERR(req)) { |
| 1316 | retval = PTR_ERR(req); | 1316 | retval = PTR_ERR(req); |
| 1317 | goto out; | 1317 | goto out; |
| 1318 | } | 1318 | } |
| @@ -1334,7 +1334,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter, | |||
| 1334 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 1334 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
| 1335 | retval = zfcp_fsf_req_send(req); | 1335 | retval = zfcp_fsf_req_send(req); |
| 1336 | out: | 1336 | out: |
| 1337 | spin_unlock(&adapter->req_q.lock); | 1337 | spin_unlock_bh(&adapter->req_q.lock); |
| 1338 | if (!retval) | 1338 | if (!retval) |
| 1339 | wait_event(req->completion_wq, | 1339 | wait_event(req->completion_wq, |
| 1340 | req->status & ZFCP_STATUS_FSFREQ_COMPLETED); | 1340 | req->status & ZFCP_STATUS_FSFREQ_COMPLETED); |
| @@ -1359,13 +1359,13 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) | |||
| 1359 | if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) | 1359 | if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) |
| 1360 | return -EOPNOTSUPP; | 1360 | return -EOPNOTSUPP; |
| 1361 | 1361 | ||
| 1362 | spin_lock(&adapter->req_q.lock); | 1362 | spin_lock_bh(&adapter->req_q.lock); |
| 1363 | if (!atomic_read(&adapter->req_q.count)) | 1363 | if (!atomic_read(&adapter->req_q.count)) |
| 1364 | goto out; | 1364 | goto out; |
| 1365 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, | 1365 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, |
| 1366 | ZFCP_REQ_AUTO_CLEANUP, | 1366 | ZFCP_REQ_AUTO_CLEANUP, |
| 1367 | adapter->pool.fsf_req_erp); | 1367 | adapter->pool.fsf_req_erp); |
| 1368 | if (unlikely(IS_ERR(req))) { | 1368 | if (IS_ERR(req)) { |
| 1369 | retval = PTR_ERR(req); | 1369 | retval = PTR_ERR(req); |
| 1370 | goto out; | 1370 | goto out; |
| 1371 | } | 1371 | } |
| @@ -1385,7 +1385,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) | |||
| 1385 | erp_action->fsf_req = NULL; | 1385 | erp_action->fsf_req = NULL; |
| 1386 | } | 1386 | } |
| 1387 | out: | 1387 | out: |
| 1388 | spin_unlock(&adapter->req_q.lock); | 1388 | spin_unlock_bh(&adapter->req_q.lock); |
| 1389 | return retval; | 1389 | return retval; |
| 1390 | } | 1390 | } |
| 1391 | 1391 | ||
| @@ -1405,13 +1405,13 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter, | |||
| 1405 | if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) | 1405 | if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) |
| 1406 | return -EOPNOTSUPP; | 1406 | return -EOPNOTSUPP; |
| 1407 | 1407 | ||
| 1408 | spin_lock(&adapter->req_q.lock); | 1408 | spin_lock_bh(&adapter->req_q.lock); |
| 1409 | if (!atomic_read(&adapter->req_q.count)) | 1409 | if (!atomic_read(&adapter->req_q.count)) |
| 1410 | goto out; | 1410 | goto out; |
| 1411 | 1411 | ||
| 1412 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 0, | 1412 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 0, |
| 1413 | NULL); | 1413 | NULL); |
| 1414 | if (unlikely(IS_ERR(req))) { | 1414 | if (IS_ERR(req)) { |
| 1415 | retval = PTR_ERR(req); | 1415 | retval = PTR_ERR(req); |
| 1416 | goto out; | 1416 | goto out; |
| 1417 | } | 1417 | } |
| @@ -1427,7 +1427,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter, | |||
| 1427 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 1427 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
| 1428 | retval = zfcp_fsf_req_send(req); | 1428 | retval = zfcp_fsf_req_send(req); |
| 1429 | out: | 1429 | out: |
| 1430 | spin_unlock(&adapter->req_q.lock); | 1430 | spin_unlock_bh(&adapter->req_q.lock); |
| 1431 | if (!retval) | 1431 | if (!retval) |
| 1432 | wait_event(req->completion_wq, | 1432 | wait_event(req->completion_wq, |
| 1433 | req->status & ZFCP_STATUS_FSFREQ_COMPLETED); | 1433 | req->status & ZFCP_STATUS_FSFREQ_COMPLETED); |
| @@ -1531,7 +1531,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | |||
| 1531 | struct zfcp_fsf_req *req; | 1531 | struct zfcp_fsf_req *req; |
| 1532 | int retval = -EIO; | 1532 | int retval = -EIO; |
| 1533 | 1533 | ||
| 1534 | spin_lock(&adapter->req_q.lock); | 1534 | spin_lock_bh(&adapter->req_q.lock); |
| 1535 | if (zfcp_fsf_req_sbal_get(adapter)) | 1535 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 1536 | goto out; | 1536 | goto out; |
| 1537 | 1537 | ||
| @@ -1539,7 +1539,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | |||
| 1539 | FSF_QTCB_OPEN_PORT_WITH_DID, | 1539 | FSF_QTCB_OPEN_PORT_WITH_DID, |
| 1540 | ZFCP_REQ_AUTO_CLEANUP, | 1540 | ZFCP_REQ_AUTO_CLEANUP, |
| 1541 | adapter->pool.fsf_req_erp); | 1541 | adapter->pool.fsf_req_erp); |
| 1542 | if (unlikely(IS_ERR(req))) { | 1542 | if (IS_ERR(req)) { |
| 1543 | retval = PTR_ERR(req); | 1543 | retval = PTR_ERR(req); |
| 1544 | goto out; | 1544 | goto out; |
| 1545 | } | 1545 | } |
| @@ -1562,7 +1562,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | |||
| 1562 | erp_action->fsf_req = NULL; | 1562 | erp_action->fsf_req = NULL; |
| 1563 | } | 1563 | } |
| 1564 | out: | 1564 | out: |
| 1565 | spin_unlock(&adapter->req_q.lock); | 1565 | spin_unlock_bh(&adapter->req_q.lock); |
| 1566 | return retval; | 1566 | return retval; |
| 1567 | } | 1567 | } |
| 1568 | 1568 | ||
| @@ -1603,14 +1603,14 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) | |||
| 1603 | struct zfcp_fsf_req *req; | 1603 | struct zfcp_fsf_req *req; |
| 1604 | int retval = -EIO; | 1604 | int retval = -EIO; |
| 1605 | 1605 | ||
| 1606 | spin_lock(&adapter->req_q.lock); | 1606 | spin_lock_bh(&adapter->req_q.lock); |
| 1607 | if (zfcp_fsf_req_sbal_get(adapter)) | 1607 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 1608 | goto out; | 1608 | goto out; |
| 1609 | 1609 | ||
| 1610 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PORT, | 1610 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PORT, |
| 1611 | ZFCP_REQ_AUTO_CLEANUP, | 1611 | ZFCP_REQ_AUTO_CLEANUP, |
| 1612 | adapter->pool.fsf_req_erp); | 1612 | adapter->pool.fsf_req_erp); |
| 1613 | if (unlikely(IS_ERR(req))) { | 1613 | if (IS_ERR(req)) { |
| 1614 | retval = PTR_ERR(req); | 1614 | retval = PTR_ERR(req); |
| 1615 | goto out; | 1615 | goto out; |
| 1616 | } | 1616 | } |
| @@ -1633,7 +1633,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) | |||
| 1633 | erp_action->fsf_req = NULL; | 1633 | erp_action->fsf_req = NULL; |
| 1634 | } | 1634 | } |
| 1635 | out: | 1635 | out: |
| 1636 | spin_unlock(&adapter->req_q.lock); | 1636 | spin_unlock_bh(&adapter->req_q.lock); |
| 1637 | return retval; | 1637 | return retval; |
| 1638 | } | 1638 | } |
| 1639 | 1639 | ||
| @@ -1700,14 +1700,14 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) | |||
| 1700 | struct zfcp_fsf_req *req; | 1700 | struct zfcp_fsf_req *req; |
| 1701 | int retval = -EIO; | 1701 | int retval = -EIO; |
| 1702 | 1702 | ||
| 1703 | spin_lock(&adapter->req_q.lock); | 1703 | spin_lock_bh(&adapter->req_q.lock); |
| 1704 | if (zfcp_fsf_req_sbal_get(adapter)) | 1704 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 1705 | goto out; | 1705 | goto out; |
| 1706 | 1706 | ||
| 1707 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PHYSICAL_PORT, | 1707 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PHYSICAL_PORT, |
| 1708 | ZFCP_REQ_AUTO_CLEANUP, | 1708 | ZFCP_REQ_AUTO_CLEANUP, |
| 1709 | adapter->pool.fsf_req_erp); | 1709 | adapter->pool.fsf_req_erp); |
| 1710 | if (unlikely(IS_ERR(req))) { | 1710 | if (IS_ERR(req)) { |
| 1711 | retval = PTR_ERR(req); | 1711 | retval = PTR_ERR(req); |
| 1712 | goto out; | 1712 | goto out; |
| 1713 | } | 1713 | } |
| @@ -1731,7 +1731,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) | |||
| 1731 | erp_action->fsf_req = NULL; | 1731 | erp_action->fsf_req = NULL; |
| 1732 | } | 1732 | } |
| 1733 | out: | 1733 | out: |
| 1734 | spin_unlock(&adapter->req_q.lock); | 1734 | spin_unlock_bh(&adapter->req_q.lock); |
| 1735 | return retval; | 1735 | return retval; |
| 1736 | } | 1736 | } |
| 1737 | 1737 | ||
| @@ -1875,14 +1875,14 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) | |||
| 1875 | struct zfcp_fsf_req *req; | 1875 | struct zfcp_fsf_req *req; |
| 1876 | int retval = -EIO; | 1876 | int retval = -EIO; |
| 1877 | 1877 | ||
| 1878 | spin_lock(&adapter->req_q.lock); | 1878 | spin_lock_bh(&adapter->req_q.lock); |
| 1879 | if (zfcp_fsf_req_sbal_get(adapter)) | 1879 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 1880 | goto out; | 1880 | goto out; |
| 1881 | 1881 | ||
| 1882 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_OPEN_LUN, | 1882 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_OPEN_LUN, |
| 1883 | ZFCP_REQ_AUTO_CLEANUP, | 1883 | ZFCP_REQ_AUTO_CLEANUP, |
| 1884 | adapter->pool.fsf_req_erp); | 1884 | adapter->pool.fsf_req_erp); |
| 1885 | if (unlikely(IS_ERR(req))) { | 1885 | if (IS_ERR(req)) { |
| 1886 | retval = PTR_ERR(req); | 1886 | retval = PTR_ERR(req); |
| 1887 | goto out; | 1887 | goto out; |
| 1888 | } | 1888 | } |
| @@ -1910,7 +1910,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) | |||
| 1910 | erp_action->fsf_req = NULL; | 1910 | erp_action->fsf_req = NULL; |
| 1911 | } | 1911 | } |
| 1912 | out: | 1912 | out: |
| 1913 | spin_unlock(&adapter->req_q.lock); | 1913 | spin_unlock_bh(&adapter->req_q.lock); |
| 1914 | return retval; | 1914 | return retval; |
| 1915 | } | 1915 | } |
| 1916 | 1916 | ||
| @@ -1965,13 +1965,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) | |||
| 1965 | struct zfcp_fsf_req *req; | 1965 | struct zfcp_fsf_req *req; |
| 1966 | int retval = -EIO; | 1966 | int retval = -EIO; |
| 1967 | 1967 | ||
| 1968 | spin_lock(&adapter->req_q.lock); | 1968 | spin_lock_bh(&adapter->req_q.lock); |
| 1969 | if (zfcp_fsf_req_sbal_get(adapter)) | 1969 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 1970 | goto out; | 1970 | goto out; |
| 1971 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_LUN, | 1971 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_LUN, |
| 1972 | ZFCP_REQ_AUTO_CLEANUP, | 1972 | ZFCP_REQ_AUTO_CLEANUP, |
| 1973 | adapter->pool.fsf_req_erp); | 1973 | adapter->pool.fsf_req_erp); |
| 1974 | if (unlikely(IS_ERR(req))) { | 1974 | if (IS_ERR(req)) { |
| 1975 | retval = PTR_ERR(req); | 1975 | retval = PTR_ERR(req); |
| 1976 | goto out; | 1976 | goto out; |
| 1977 | } | 1977 | } |
| @@ -1995,7 +1995,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) | |||
| 1995 | erp_action->fsf_req = NULL; | 1995 | erp_action->fsf_req = NULL; |
| 1996 | } | 1996 | } |
| 1997 | out: | 1997 | out: |
| 1998 | spin_unlock(&adapter->req_q.lock); | 1998 | spin_unlock_bh(&adapter->req_q.lock); |
| 1999 | return retval; | 1999 | return retval; |
| 2000 | } | 2000 | } |
| 2001 | 2001 | ||
| @@ -2228,7 +2228,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter, | |||
| 2228 | goto out; | 2228 | goto out; |
| 2229 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, | 2229 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, |
| 2230 | adapter->pool.fsf_req_scsi); | 2230 | adapter->pool.fsf_req_scsi); |
| 2231 | if (unlikely(IS_ERR(req))) { | 2231 | if (IS_ERR(req)) { |
| 2232 | retval = PTR_ERR(req); | 2232 | retval = PTR_ERR(req); |
| 2233 | goto out; | 2233 | goto out; |
| 2234 | } | 2234 | } |
| @@ -2351,7 +2351,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *adapter, | |||
| 2351 | goto out; | 2351 | goto out; |
| 2352 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, | 2352 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, |
| 2353 | adapter->pool.fsf_req_scsi); | 2353 | adapter->pool.fsf_req_scsi); |
| 2354 | if (unlikely(IS_ERR(req))) | 2354 | if (IS_ERR(req)) |
| 2355 | goto out; | 2355 | goto out; |
| 2356 | 2356 | ||
| 2357 | req->status |= ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT; | 2357 | req->status |= ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT; |
| @@ -2417,12 +2417,12 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
| 2417 | return ERR_PTR(-EINVAL); | 2417 | return ERR_PTR(-EINVAL); |
| 2418 | } | 2418 | } |
| 2419 | 2419 | ||
| 2420 | spin_lock(&adapter->req_q.lock); | 2420 | spin_lock_bh(&adapter->req_q.lock); |
| 2421 | if (zfcp_fsf_req_sbal_get(adapter)) | 2421 | if (zfcp_fsf_req_sbal_get(adapter)) |
| 2422 | goto out; | 2422 | goto out; |
| 2423 | 2423 | ||
| 2424 | req = zfcp_fsf_req_create(adapter, fsf_cfdc->command, 0, NULL); | 2424 | req = zfcp_fsf_req_create(adapter, fsf_cfdc->command, 0, NULL); |
| 2425 | if (unlikely(IS_ERR(req))) { | 2425 | if (IS_ERR(req)) { |
| 2426 | retval = -EPERM; | 2426 | retval = -EPERM; |
| 2427 | goto out; | 2427 | goto out; |
| 2428 | } | 2428 | } |
| @@ -2447,7 +2447,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
| 2447 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 2447 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
| 2448 | retval = zfcp_fsf_req_send(req); | 2448 | retval = zfcp_fsf_req_send(req); |
| 2449 | out: | 2449 | out: |
| 2450 | spin_unlock(&adapter->req_q.lock); | 2450 | spin_unlock_bh(&adapter->req_q.lock); |
| 2451 | 2451 | ||
| 2452 | if (!retval) { | 2452 | if (!retval) { |
| 2453 | wait_event(req->completion_wq, | 2453 | wait_event(req->completion_wq, |
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c index d6dbd653fde9..69d632d851d9 100644 --- a/drivers/s390/scsi/zfcp_qdio.c +++ b/drivers/s390/scsi/zfcp_qdio.c | |||
| @@ -423,9 +423,9 @@ void zfcp_qdio_close(struct zfcp_adapter *adapter) | |||
| 423 | 423 | ||
| 424 | /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */ | 424 | /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */ |
| 425 | req_q = &adapter->req_q; | 425 | req_q = &adapter->req_q; |
| 426 | spin_lock(&req_q->lock); | 426 | spin_lock_bh(&req_q->lock); |
| 427 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); | 427 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); |
| 428 | spin_unlock(&req_q->lock); | 428 | spin_unlock_bh(&req_q->lock); |
| 429 | 429 | ||
| 430 | qdio_shutdown(adapter->ccw_device, QDIO_FLAG_CLEANUP_USING_CLEAR); | 430 | qdio_shutdown(adapter->ccw_device, QDIO_FLAG_CLEANUP_USING_CLEAR); |
| 431 | 431 | ||
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index c7f06298bd3c..4e0322b1c1ea 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
| @@ -63,7 +63,7 @@ comment "SCSI support type (disk, tape, CD-ROM)" | |||
| 63 | config BLK_DEV_SD | 63 | config BLK_DEV_SD |
| 64 | tristate "SCSI disk support" | 64 | tristate "SCSI disk support" |
| 65 | depends on SCSI | 65 | depends on SCSI |
| 66 | select CRC_T10DIF | 66 | select CRC_T10DIF if BLK_DEV_INTEGRITY |
| 67 | ---help--- | 67 | ---help--- |
| 68 | If you want to use SCSI hard disks, Fibre Channel disks, | 68 | If you want to use SCSI hard disks, Fibre Channel disks, |
| 69 | Serial ATA (SATA) or Parallel ATA (PATA) hard disks, | 69 | Serial ATA (SATA) or Parallel ATA (PATA) hard disks, |
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 994da56fffed..708e475896b9 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c | |||
| @@ -425,7 +425,7 @@ static int alua_check_sense(struct scsi_device *sdev, | |||
| 425 | /* | 425 | /* |
| 426 | * LUN Not Accessible - ALUA state transition | 426 | * LUN Not Accessible - ALUA state transition |
| 427 | */ | 427 | */ |
| 428 | return NEEDS_RETRY; | 428 | return ADD_TO_MLQUEUE; |
| 429 | if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0b) | 429 | if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0b) |
| 430 | /* | 430 | /* |
| 431 | * LUN Not Accessible -- Target port in standby state | 431 | * LUN Not Accessible -- Target port in standby state |
| @@ -447,18 +447,18 @@ static int alua_check_sense(struct scsi_device *sdev, | |||
| 447 | /* | 447 | /* |
| 448 | * Power On, Reset, or Bus Device Reset, just retry. | 448 | * Power On, Reset, or Bus Device Reset, just retry. |
| 449 | */ | 449 | */ |
| 450 | return NEEDS_RETRY; | 450 | return ADD_TO_MLQUEUE; |
| 451 | if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x06) { | 451 | if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x06) { |
| 452 | /* | 452 | /* |
| 453 | * ALUA state changed | 453 | * ALUA state changed |
| 454 | */ | 454 | */ |
| 455 | return NEEDS_RETRY; | 455 | return ADD_TO_MLQUEUE; |
| 456 | } | 456 | } |
| 457 | if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x07) { | 457 | if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x07) { |
| 458 | /* | 458 | /* |
| 459 | * Implicit ALUA state transition failed | 459 | * Implicit ALUA state transition failed |
| 460 | */ | 460 | */ |
| 461 | return NEEDS_RETRY; | 461 | return ADD_TO_MLQUEUE; |
| 462 | } | 462 | } |
| 463 | break; | 463 | break; |
| 464 | } | 464 | } |
| @@ -490,7 +490,7 @@ static int alua_stpg(struct scsi_device *sdev, int state, | |||
| 490 | if (!err) | 490 | if (!err) |
| 491 | return SCSI_DH_IO; | 491 | return SCSI_DH_IO; |
| 492 | err = alua_check_sense(sdev, &sense_hdr); | 492 | err = alua_check_sense(sdev, &sense_hdr); |
| 493 | if (retry > 0 && err == NEEDS_RETRY) { | 493 | if (retry > 0 && err == ADD_TO_MLQUEUE) { |
| 494 | retry--; | 494 | retry--; |
| 495 | goto retry; | 495 | goto retry; |
| 496 | } | 496 | } |
| @@ -535,7 +535,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h) | |||
| 535 | return SCSI_DH_IO; | 535 | return SCSI_DH_IO; |
| 536 | 536 | ||
| 537 | err = alua_check_sense(sdev, &sense_hdr); | 537 | err = alua_check_sense(sdev, &sense_hdr); |
| 538 | if (err == NEEDS_RETRY) | 538 | if (err == ADD_TO_MLQUEUE) |
| 539 | goto retry; | 539 | goto retry; |
| 540 | sdev_printk(KERN_INFO, sdev, | 540 | sdev_printk(KERN_INFO, sdev, |
| 541 | "%s: rtpg sense code %02x/%02x/%02x\n", | 541 | "%s: rtpg sense code %02x/%02x/%02x\n", |
diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c index b9d23e9e9a44..ef693e8412e9 100644 --- a/drivers/scsi/device_handler/scsi_dh_emc.c +++ b/drivers/scsi/device_handler/scsi_dh_emc.c | |||
| @@ -439,7 +439,7 @@ static int clariion_check_sense(struct scsi_device *sdev, | |||
| 439 | * Unit Attention Code. This is the first IO | 439 | * Unit Attention Code. This is the first IO |
| 440 | * to the new path, so just retry. | 440 | * to the new path, so just retry. |
| 441 | */ | 441 | */ |
| 442 | return NEEDS_RETRY; | 442 | return ADD_TO_MLQUEUE; |
| 443 | break; | 443 | break; |
| 444 | } | 444 | } |
| 445 | 445 | ||
| @@ -514,7 +514,7 @@ retry: | |||
| 514 | return SCSI_DH_IO; | 514 | return SCSI_DH_IO; |
| 515 | 515 | ||
| 516 | err = clariion_check_sense(sdev, &sshdr); | 516 | err = clariion_check_sense(sdev, &sshdr); |
| 517 | if (retry > 0 && err == NEEDS_RETRY) { | 517 | if (retry > 0 && err == ADD_TO_MLQUEUE) { |
| 518 | retry--; | 518 | retry--; |
| 519 | goto retry; | 519 | goto retry; |
| 520 | } | 520 | } |
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index e7c7b4ebc1fe..6e2f130d56de 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c | |||
| @@ -376,7 +376,7 @@ static int get_lun(struct scsi_device *sdev, struct rdac_dh_data *h) | |||
| 376 | if (inqp->page_id[0] != 'e' || inqp->page_id[1] != 'd' || | 376 | if (inqp->page_id[0] != 'e' || inqp->page_id[1] != 'd' || |
| 377 | inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd') | 377 | inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd') |
| 378 | return SCSI_DH_NOSYS; | 378 | return SCSI_DH_NOSYS; |
| 379 | h->lun = scsilun_to_int((struct scsi_lun *)inqp->lun); | 379 | h->lun = inqp->lun[7]; /* Uses only the last byte */ |
| 380 | } | 380 | } |
| 381 | return err; | 381 | return err; |
| 382 | } | 382 | } |
| @@ -386,6 +386,7 @@ static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h) | |||
| 386 | int err; | 386 | int err; |
| 387 | struct c9_inquiry *inqp; | 387 | struct c9_inquiry *inqp; |
| 388 | 388 | ||
| 389 | h->lun_state = RDAC_LUN_UNOWNED; | ||
| 389 | err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h); | 390 | err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h); |
| 390 | if (err == SCSI_DH_OK) { | 391 | if (err == SCSI_DH_OK) { |
| 391 | inqp = &h->inq.c9; | 392 | inqp = &h->inq.c9; |
| @@ -550,7 +551,7 @@ static int rdac_check_sense(struct scsi_device *sdev, | |||
| 550 | * | 551 | * |
| 551 | * Just retry and wait. | 552 | * Just retry and wait. |
| 552 | */ | 553 | */ |
| 553 | return NEEDS_RETRY; | 554 | return ADD_TO_MLQUEUE; |
| 554 | break; | 555 | break; |
| 555 | case ILLEGAL_REQUEST: | 556 | case ILLEGAL_REQUEST: |
| 556 | if (sense_hdr->asc == 0x94 && sense_hdr->ascq == 0x01) { | 557 | if (sense_hdr->asc == 0x94 && sense_hdr->ascq == 0x01) { |
| @@ -567,7 +568,7 @@ static int rdac_check_sense(struct scsi_device *sdev, | |||
| 567 | /* | 568 | /* |
| 568 | * Power On, Reset, or Bus Device Reset, just retry. | 569 | * Power On, Reset, or Bus Device Reset, just retry. |
| 569 | */ | 570 | */ |
| 570 | return NEEDS_RETRY; | 571 | return ADD_TO_MLQUEUE; |
| 571 | break; | 572 | break; |
| 572 | } | 573 | } |
| 573 | /* success just means we do not care what scsi-ml does */ | 574 | /* success just means we do not care what scsi-ml does */ |
diff --git a/drivers/scsi/dpt/dpti_i2o.h b/drivers/scsi/dpt/dpti_i2o.h index 19406cea6d6a..179ad77f6cc9 100644 --- a/drivers/scsi/dpt/dpti_i2o.h +++ b/drivers/scsi/dpt/dpti_i2o.h | |||
| @@ -21,7 +21,6 @@ | |||
| 21 | 21 | ||
| 22 | #include <linux/i2o-dev.h> | 22 | #include <linux/i2o-dev.h> |
| 23 | 23 | ||
| 24 | #include <linux/version.h> | ||
| 25 | #include <linux/notifier.h> | 24 | #include <linux/notifier.h> |
| 26 | #include <asm/atomic.h> | 25 | #include <asm/atomic.h> |
| 27 | 26 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index ae560bc04f9d..4e0b7c8eb32e 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
| @@ -556,11 +556,12 @@ static void ibmvfc_link_down(struct ibmvfc_host *vhost, | |||
| 556 | /** | 556 | /** |
| 557 | * ibmvfc_init_host - Start host initialization | 557 | * ibmvfc_init_host - Start host initialization |
| 558 | * @vhost: ibmvfc host struct | 558 | * @vhost: ibmvfc host struct |
| 559 | * @relogin: is this a re-login? | ||
| 559 | * | 560 | * |
| 560 | * Return value: | 561 | * Return value: |
| 561 | * nothing | 562 | * nothing |
| 562 | **/ | 563 | **/ |
| 563 | static void ibmvfc_init_host(struct ibmvfc_host *vhost) | 564 | static void ibmvfc_init_host(struct ibmvfc_host *vhost, int relogin) |
| 564 | { | 565 | { |
| 565 | struct ibmvfc_target *tgt; | 566 | struct ibmvfc_target *tgt; |
| 566 | 567 | ||
| @@ -574,6 +575,11 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost) | |||
| 574 | } | 575 | } |
| 575 | 576 | ||
| 576 | if (!ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) { | 577 | if (!ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) { |
| 578 | if (!relogin) { | ||
| 579 | memset(vhost->async_crq.msgs, 0, PAGE_SIZE); | ||
| 580 | vhost->async_crq.cur = 0; | ||
| 581 | } | ||
| 582 | |||
| 577 | list_for_each_entry(tgt, &vhost->targets, queue) | 583 | list_for_each_entry(tgt, &vhost->targets, queue) |
| 578 | tgt->need_login = 1; | 584 | tgt->need_login = 1; |
| 579 | scsi_block_requests(vhost->host); | 585 | scsi_block_requests(vhost->host); |
| @@ -1059,9 +1065,10 @@ static void ibmvfc_get_starget_port_id(struct scsi_target *starget) | |||
| 1059 | static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost) | 1065 | static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost) |
| 1060 | { | 1066 | { |
| 1061 | long timeout = wait_event_timeout(vhost->init_wait_q, | 1067 | long timeout = wait_event_timeout(vhost->init_wait_q, |
| 1062 | (vhost->state == IBMVFC_ACTIVE || | 1068 | ((vhost->state == IBMVFC_ACTIVE || |
| 1063 | vhost->state == IBMVFC_HOST_OFFLINE || | 1069 | vhost->state == IBMVFC_HOST_OFFLINE || |
| 1064 | vhost->state == IBMVFC_LINK_DEAD), | 1070 | vhost->state == IBMVFC_LINK_DEAD) && |
| 1071 | vhost->action == IBMVFC_HOST_ACTION_NONE), | ||
| 1065 | (init_timeout * HZ)); | 1072 | (init_timeout * HZ)); |
| 1066 | 1073 | ||
| 1067 | return timeout ? 0 : -EIO; | 1074 | return timeout ? 0 : -EIO; |
| @@ -1450,8 +1457,8 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt) | |||
| 1450 | struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; | 1457 | struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; |
| 1451 | struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; | 1458 | struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp; |
| 1452 | struct scsi_cmnd *cmnd = evt->cmnd; | 1459 | struct scsi_cmnd *cmnd = evt->cmnd; |
| 1453 | int rsp_len = 0; | 1460 | u32 rsp_len = 0; |
| 1454 | int sense_len = rsp->fcp_sense_len; | 1461 | u32 sense_len = rsp->fcp_sense_len; |
| 1455 | 1462 | ||
| 1456 | if (cmnd) { | 1463 | if (cmnd) { |
| 1457 | if (vfc_cmd->response_flags & IBMVFC_ADAPTER_RESID_VALID) | 1464 | if (vfc_cmd->response_flags & IBMVFC_ADAPTER_RESID_VALID) |
| @@ -1468,7 +1475,7 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt) | |||
| 1468 | rsp_len = rsp->fcp_rsp_len; | 1475 | rsp_len = rsp->fcp_rsp_len; |
| 1469 | if ((sense_len + rsp_len) > SCSI_SENSE_BUFFERSIZE) | 1476 | if ((sense_len + rsp_len) > SCSI_SENSE_BUFFERSIZE) |
| 1470 | sense_len = SCSI_SENSE_BUFFERSIZE - rsp_len; | 1477 | sense_len = SCSI_SENSE_BUFFERSIZE - rsp_len; |
| 1471 | if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len) | 1478 | if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len && rsp_len <= 8) |
| 1472 | memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len); | 1479 | memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len); |
| 1473 | 1480 | ||
| 1474 | ibmvfc_log_error(evt); | 1481 | ibmvfc_log_error(evt); |
| @@ -2077,17 +2084,18 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, | |||
| 2077 | { | 2084 | { |
| 2078 | const char *desc = ibmvfc_get_ae_desc(crq->event); | 2085 | const char *desc = ibmvfc_get_ae_desc(crq->event); |
| 2079 | 2086 | ||
| 2080 | ibmvfc_log(vhost, 3, "%s event received\n", desc); | 2087 | ibmvfc_log(vhost, 3, "%s event received. scsi_id: %lx, wwpn: %lx," |
| 2088 | " node_name: %lx\n", desc, crq->scsi_id, crq->wwpn, crq->node_name); | ||
| 2081 | 2089 | ||
| 2082 | switch (crq->event) { | 2090 | switch (crq->event) { |
| 2083 | case IBMVFC_AE_LINK_UP: | 2091 | case IBMVFC_AE_LINK_UP: |
| 2084 | case IBMVFC_AE_RESUME: | 2092 | case IBMVFC_AE_RESUME: |
| 2085 | vhost->events_to_log |= IBMVFC_AE_LINKUP; | 2093 | vhost->events_to_log |= IBMVFC_AE_LINKUP; |
| 2086 | ibmvfc_init_host(vhost); | 2094 | ibmvfc_init_host(vhost, 1); |
| 2087 | break; | 2095 | break; |
| 2088 | case IBMVFC_AE_SCN_FABRIC: | 2096 | case IBMVFC_AE_SCN_FABRIC: |
| 2089 | vhost->events_to_log |= IBMVFC_AE_RSCN; | 2097 | vhost->events_to_log |= IBMVFC_AE_RSCN; |
| 2090 | ibmvfc_init_host(vhost); | 2098 | ibmvfc_init_host(vhost, 1); |
| 2091 | break; | 2099 | break; |
| 2092 | case IBMVFC_AE_SCN_NPORT: | 2100 | case IBMVFC_AE_SCN_NPORT: |
| 2093 | case IBMVFC_AE_SCN_GROUP: | 2101 | case IBMVFC_AE_SCN_GROUP: |
| @@ -2133,13 +2141,13 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost) | |||
| 2133 | /* Send back a response */ | 2141 | /* Send back a response */ |
| 2134 | rc = ibmvfc_send_crq_init_complete(vhost); | 2142 | rc = ibmvfc_send_crq_init_complete(vhost); |
| 2135 | if (rc == 0) | 2143 | if (rc == 0) |
| 2136 | ibmvfc_init_host(vhost); | 2144 | ibmvfc_init_host(vhost, 0); |
| 2137 | else | 2145 | else |
| 2138 | dev_err(vhost->dev, "Unable to send init rsp. rc=%ld\n", rc); | 2146 | dev_err(vhost->dev, "Unable to send init rsp. rc=%ld\n", rc); |
| 2139 | break; | 2147 | break; |
| 2140 | case IBMVFC_CRQ_INIT_COMPLETE: | 2148 | case IBMVFC_CRQ_INIT_COMPLETE: |
| 2141 | dev_info(vhost->dev, "Partner initialization complete\n"); | 2149 | dev_info(vhost->dev, "Partner initialization complete\n"); |
| 2142 | ibmvfc_init_host(vhost); | 2150 | ibmvfc_init_host(vhost, 0); |
| 2143 | break; | 2151 | break; |
| 2144 | default: | 2152 | default: |
| 2145 | dev_err(vhost->dev, "Unknown crq message type: %d\n", crq->format); | 2153 | dev_err(vhost->dev, "Unknown crq message type: %d\n", crq->format); |
| @@ -3357,8 +3365,6 @@ static void ibmvfc_npiv_login(struct ibmvfc_host *vhost) | |||
| 3357 | mad->buffer.va = vhost->login_buf_dma; | 3365 | mad->buffer.va = vhost->login_buf_dma; |
| 3358 | mad->buffer.len = sizeof(*vhost->login_buf); | 3366 | mad->buffer.len = sizeof(*vhost->login_buf); |
| 3359 | 3367 | ||
| 3360 | memset(vhost->async_crq.msgs, 0, PAGE_SIZE); | ||
| 3361 | vhost->async_crq.cur = 0; | ||
| 3362 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); | 3368 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT_WAIT); |
| 3363 | 3369 | ||
| 3364 | if (!ibmvfc_send_event(evt, vhost, default_timeout)) | 3370 | if (!ibmvfc_send_event(evt, vhost, default_timeout)) |
| @@ -3601,8 +3607,9 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost) | |||
| 3601 | } | 3607 | } |
| 3602 | } | 3608 | } |
| 3603 | 3609 | ||
| 3604 | if (vhost->reinit) { | 3610 | if (vhost->reinit && !ibmvfc_set_host_state(vhost, IBMVFC_INITIALIZING)) { |
| 3605 | vhost->reinit = 0; | 3611 | vhost->reinit = 0; |
| 3612 | scsi_block_requests(vhost->host); | ||
| 3606 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); | 3613 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY); |
| 3607 | } else { | 3614 | } else { |
| 3608 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_NONE); | 3615 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_NONE); |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 4bf6e374f076..fb3177ab6691 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h | |||
| @@ -29,8 +29,8 @@ | |||
| 29 | #include "viosrp.h" | 29 | #include "viosrp.h" |
| 30 | 30 | ||
| 31 | #define IBMVFC_NAME "ibmvfc" | 31 | #define IBMVFC_NAME "ibmvfc" |
| 32 | #define IBMVFC_DRIVER_VERSION "1.0.1" | 32 | #define IBMVFC_DRIVER_VERSION "1.0.2" |
| 33 | #define IBMVFC_DRIVER_DATE "(July 11, 2008)" | 33 | #define IBMVFC_DRIVER_DATE "(August 14, 2008)" |
| 34 | 34 | ||
| 35 | #define IBMVFC_DEFAULT_TIMEOUT 15 | 35 | #define IBMVFC_DEFAULT_TIMEOUT 15 |
| 36 | #define IBMVFC_INIT_TIMEOUT 30 | 36 | #define IBMVFC_INIT_TIMEOUT 30 |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 6b24b9cdb04c..7b1502c0ab6e 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
| @@ -1636,7 +1636,7 @@ static unsigned long ibmvscsi_get_desired_dma(struct vio_dev *vdev) | |||
| 1636 | unsigned long desired_io = max_requests * sizeof(union viosrp_iu); | 1636 | unsigned long desired_io = max_requests * sizeof(union viosrp_iu); |
| 1637 | 1637 | ||
| 1638 | /* add io space for sg data */ | 1638 | /* add io space for sg data */ |
| 1639 | desired_io += (IBMVSCSI_MAX_SECTORS_DEFAULT * | 1639 | desired_io += (IBMVSCSI_MAX_SECTORS_DEFAULT * 512 * |
| 1640 | IBMVSCSI_CMDS_PER_LUN_DEFAULT); | 1640 | IBMVSCSI_CMDS_PER_LUN_DEFAULT); |
| 1641 | 1641 | ||
| 1642 | return desired_io; | 1642 | return desired_io; |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 7c615c70ec5c..bc9e6ddf41df 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
| @@ -165,7 +165,6 @@ | |||
| 165 | #include <asm/byteorder.h> | 165 | #include <asm/byteorder.h> |
| 166 | #include <asm/page.h> | 166 | #include <asm/page.h> |
| 167 | #include <linux/stddef.h> | 167 | #include <linux/stddef.h> |
| 168 | #include <linux/version.h> | ||
| 169 | #include <linux/string.h> | 168 | #include <linux/string.h> |
| 170 | #include <linux/errno.h> | 169 | #include <linux/errno.h> |
| 171 | #include <linux/kernel.h> | 170 | #include <linux/kernel.h> |
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h index e0657b6f009c..4e49fbcfe8af 100644 --- a/drivers/scsi/ips.h +++ b/drivers/scsi/ips.h | |||
| @@ -50,7 +50,6 @@ | |||
| 50 | #ifndef _IPS_H_ | 50 | #ifndef _IPS_H_ |
| 51 | #define _IPS_H_ | 51 | #define _IPS_H_ |
| 52 | 52 | ||
| 53 | #include <linux/version.h> | ||
| 54 | #include <linux/nmi.h> | 53 | #include <linux/nmi.h> |
| 55 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
| 56 | #include <asm/io.h> | 55 | #include <asm/io.h> |
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 90272e65957a..094b47e94b29 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
| 28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
| 29 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
| 30 | #include <linux/version.h> | ||
| 31 | 30 | ||
| 32 | #include <scsi/scsi.h> | 31 | #include <scsi/scsi.h> |
| 33 | #include <scsi/scsi_device.h> | 32 | #include <scsi/scsi_device.h> |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index fc7ac158476c..97b763378e7d 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
| 11 | * | 11 | * |
| 12 | * FILE : megaraid_sas.c | 12 | * FILE : megaraid_sas.c |
| 13 | * Version : v00.00.03.20-rc1 | 13 | * Version : v00.00.04.01-rc1 |
| 14 | * | 14 | * |
| 15 | * Authors: | 15 | * Authors: |
| 16 | * (email-id : megaraidlinux@lsi.com) | 16 | * (email-id : megaraidlinux@lsi.com) |
| @@ -71,6 +71,10 @@ static struct pci_device_id megasas_pci_table[] = { | |||
| 71 | /* ppc IOP */ | 71 | /* ppc IOP */ |
| 72 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078DE)}, | 72 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078DE)}, |
| 73 | /* ppc IOP */ | 73 | /* ppc IOP */ |
| 74 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1078GEN2)}, | ||
| 75 | /* gen2*/ | ||
| 76 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS0079GEN2)}, | ||
| 77 | /* gen2*/ | ||
| 74 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VERDE_ZCR)}, | 78 | {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_VERDE_ZCR)}, |
| 75 | /* xscale IOP, vega */ | 79 | /* xscale IOP, vega */ |
| 76 | {PCI_DEVICE(PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_PERC5)}, | 80 | {PCI_DEVICE(PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_PERC5)}, |
| @@ -198,6 +202,9 @@ megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs) | |||
| 198 | */ | 202 | */ |
| 199 | writel(status, ®s->outbound_intr_status); | 203 | writel(status, ®s->outbound_intr_status); |
| 200 | 204 | ||
| 205 | /* Dummy readl to force pci flush */ | ||
| 206 | readl(®s->outbound_intr_status); | ||
| 207 | |||
| 201 | return 0; | 208 | return 0; |
| 202 | } | 209 | } |
| 203 | 210 | ||
| @@ -293,6 +300,9 @@ megasas_clear_intr_ppc(struct megasas_register_set __iomem * regs) | |||
| 293 | */ | 300 | */ |
| 294 | writel(status, ®s->outbound_doorbell_clear); | 301 | writel(status, ®s->outbound_doorbell_clear); |
| 295 | 302 | ||
| 303 | /* Dummy readl to force pci flush */ | ||
| 304 | readl(®s->outbound_doorbell_clear); | ||
| 305 | |||
| 296 | return 0; | 306 | return 0; |
| 297 | } | 307 | } |
| 298 | /** | 308 | /** |
| @@ -318,6 +328,99 @@ static struct megasas_instance_template megasas_instance_template_ppc = { | |||
| 318 | }; | 328 | }; |
| 319 | 329 | ||
| 320 | /** | 330 | /** |
| 331 | * The following functions are defined for gen2 (deviceid : 0x78 0x79) | ||
| 332 | * controllers | ||
| 333 | */ | ||
| 334 | |||
| 335 | /** | ||
| 336 | * megasas_enable_intr_gen2 - Enables interrupts | ||
| 337 | * @regs: MFI register set | ||
| 338 | */ | ||
| 339 | static inline void | ||
| 340 | megasas_enable_intr_gen2(struct megasas_register_set __iomem *regs) | ||
| 341 | { | ||
| 342 | writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear); | ||
| 343 | |||
| 344 | /* write ~0x00000005 (4 & 1) to the intr mask*/ | ||
| 345 | writel(~MFI_GEN2_ENABLE_INTERRUPT_MASK, &(regs)->outbound_intr_mask); | ||
| 346 | |||
| 347 | /* Dummy readl to force pci flush */ | ||
| 348 | readl(®s->outbound_intr_mask); | ||
| 349 | } | ||
| 350 | |||
| 351 | /** | ||
| 352 | * megasas_disable_intr_gen2 - Disables interrupt | ||
| 353 | * @regs: MFI register set | ||
| 354 | */ | ||
| 355 | static inline void | ||
| 356 | megasas_disable_intr_gen2(struct megasas_register_set __iomem *regs) | ||
| 357 | { | ||
| 358 | u32 mask = 0xFFFFFFFF; | ||
| 359 | writel(mask, ®s->outbound_intr_mask); | ||
| 360 | /* Dummy readl to force pci flush */ | ||
| 361 | readl(®s->outbound_intr_mask); | ||
| 362 | } | ||
| 363 | |||
| 364 | /** | ||
| 365 | * megasas_read_fw_status_reg_gen2 - returns the current FW status value | ||
| 366 | * @regs: MFI register set | ||
| 367 | */ | ||
| 368 | static u32 | ||
| 369 | megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem *regs) | ||
| 370 | { | ||
| 371 | return readl(&(regs)->outbound_scratch_pad); | ||
| 372 | } | ||
| 373 | |||
| 374 | /** | ||
| 375 | * megasas_clear_interrupt_gen2 - Check & clear interrupt | ||
| 376 | * @regs: MFI register set | ||
| 377 | */ | ||
| 378 | static int | ||
| 379 | megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs) | ||
| 380 | { | ||
| 381 | u32 status; | ||
| 382 | /* | ||
| 383 | * Check if it is our interrupt | ||
| 384 | */ | ||
| 385 | status = readl(®s->outbound_intr_status); | ||
| 386 | |||
| 387 | if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK)) | ||
| 388 | return 1; | ||
| 389 | |||
| 390 | /* | ||
| 391 | * Clear the interrupt by writing back the same value | ||
| 392 | */ | ||
| 393 | writel(status, ®s->outbound_doorbell_clear); | ||
| 394 | |||
| 395 | /* Dummy readl to force pci flush */ | ||
| 396 | readl(®s->outbound_intr_status); | ||
| 397 | |||
| 398 | return 0; | ||
| 399 | } | ||
| 400 | /** | ||
| 401 | * megasas_fire_cmd_gen2 - Sends command to the FW | ||
| 402 | * @frame_phys_addr : Physical address of cmd | ||
| 403 | * @frame_count : Number of frames for the command | ||
| 404 | * @regs : MFI register set | ||
| 405 | */ | ||
| 406 | static inline void | ||
| 407 | megasas_fire_cmd_gen2(dma_addr_t frame_phys_addr, u32 frame_count, | ||
| 408 | struct megasas_register_set __iomem *regs) | ||
| 409 | { | ||
| 410 | writel((frame_phys_addr | (frame_count<<1))|1, | ||
| 411 | &(regs)->inbound_queue_port); | ||
| 412 | } | ||
| 413 | |||
| 414 | static struct megasas_instance_template megasas_instance_template_gen2 = { | ||
| 415 | |||
| 416 | .fire_cmd = megasas_fire_cmd_gen2, | ||
| 417 | .enable_intr = megasas_enable_intr_gen2, | ||
| 418 | .disable_intr = megasas_disable_intr_gen2, | ||
| 419 | .clear_intr = megasas_clear_intr_gen2, | ||
| 420 | .read_fw_status_reg = megasas_read_fw_status_reg_gen2, | ||
| 421 | }; | ||
| 422 | |||
| 423 | /** | ||
| 321 | * This is the end of set of functions & definitions | 424 | * This is the end of set of functions & definitions |
| 322 | * specific to ppc (deviceid : 0x60) controllers | 425 | * specific to ppc (deviceid : 0x60) controllers |
| 323 | */ | 426 | */ |
| @@ -1976,7 +2079,12 @@ static int megasas_init_mfi(struct megasas_instance *instance) | |||
| 1976 | /* | 2079 | /* |
| 1977 | * Map the message registers | 2080 | * Map the message registers |
| 1978 | */ | 2081 | */ |
| 1979 | instance->base_addr = pci_resource_start(instance->pdev, 0); | 2082 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1078GEN2) || |
| 2083 | (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0079GEN2)) { | ||
| 2084 | instance->base_addr = pci_resource_start(instance->pdev, 1); | ||
| 2085 | } else { | ||
| 2086 | instance->base_addr = pci_resource_start(instance->pdev, 0); | ||
| 2087 | } | ||
| 1980 | 2088 | ||
| 1981 | if (pci_request_regions(instance->pdev, "megasas: LSI")) { | 2089 | if (pci_request_regions(instance->pdev, "megasas: LSI")) { |
| 1982 | printk(KERN_DEBUG "megasas: IO memory region busy!\n"); | 2090 | printk(KERN_DEBUG "megasas: IO memory region busy!\n"); |
| @@ -1998,6 +2106,10 @@ static int megasas_init_mfi(struct megasas_instance *instance) | |||
| 1998 | case PCI_DEVICE_ID_LSI_SAS1078DE: | 2106 | case PCI_DEVICE_ID_LSI_SAS1078DE: |
| 1999 | instance->instancet = &megasas_instance_template_ppc; | 2107 | instance->instancet = &megasas_instance_template_ppc; |
| 2000 | break; | 2108 | break; |
| 2109 | case PCI_DEVICE_ID_LSI_SAS1078GEN2: | ||
| 2110 | case PCI_DEVICE_ID_LSI_SAS0079GEN2: | ||
| 2111 | instance->instancet = &megasas_instance_template_gen2; | ||
| 2112 | break; | ||
| 2001 | case PCI_DEVICE_ID_LSI_SAS1064R: | 2113 | case PCI_DEVICE_ID_LSI_SAS1064R: |
| 2002 | case PCI_DEVICE_ID_DELL_PERC5: | 2114 | case PCI_DEVICE_ID_DELL_PERC5: |
| 2003 | default: | 2115 | default: |
| @@ -2857,6 +2969,7 @@ static void megasas_shutdown(struct pci_dev *pdev) | |||
| 2857 | { | 2969 | { |
| 2858 | struct megasas_instance *instance = pci_get_drvdata(pdev); | 2970 | struct megasas_instance *instance = pci_get_drvdata(pdev); |
| 2859 | megasas_flush_cache(instance); | 2971 | megasas_flush_cache(instance); |
| 2972 | megasas_shutdown_controller(instance, MR_DCMD_CTRL_SHUTDOWN); | ||
| 2860 | } | 2973 | } |
| 2861 | 2974 | ||
| 2862 | /** | 2975 | /** |
| @@ -3292,7 +3405,7 @@ megasas_sysfs_set_dbg_lvl(struct device_driver *dd, const char *buf, size_t coun | |||
| 3292 | return retval; | 3405 | return retval; |
| 3293 | } | 3406 | } |
| 3294 | 3407 | ||
| 3295 | static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUGO, megasas_sysfs_show_dbg_lvl, | 3408 | static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUSR, megasas_sysfs_show_dbg_lvl, |
| 3296 | megasas_sysfs_set_dbg_lvl); | 3409 | megasas_sysfs_set_dbg_lvl); |
| 3297 | 3410 | ||
| 3298 | static ssize_t | 3411 | static ssize_t |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index b0c41e671702..0d033248fdf1 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
| @@ -18,9 +18,9 @@ | |||
| 18 | /* | 18 | /* |
| 19 | * MegaRAID SAS Driver meta data | 19 | * MegaRAID SAS Driver meta data |
| 20 | */ | 20 | */ |
| 21 | #define MEGASAS_VERSION "00.00.03.20-rc1" | 21 | #define MEGASAS_VERSION "00.00.04.01" |
| 22 | #define MEGASAS_RELDATE "March 10, 2008" | 22 | #define MEGASAS_RELDATE "July 24, 2008" |
| 23 | #define MEGASAS_EXT_VERSION "Mon. March 10 11:02:31 PDT 2008" | 23 | #define MEGASAS_EXT_VERSION "Thu July 24 11:41:51 PST 2008" |
| 24 | 24 | ||
| 25 | /* | 25 | /* |
| 26 | * Device IDs | 26 | * Device IDs |
| @@ -28,6 +28,8 @@ | |||
| 28 | #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 | 28 | #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060 |
| 29 | #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C | 29 | #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C |
| 30 | #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 | 30 | #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 |
| 31 | #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078 | ||
| 32 | #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079 | ||
| 31 | 33 | ||
| 32 | /* | 34 | /* |
| 33 | * ===================================== | 35 | * ===================================== |
| @@ -580,6 +582,8 @@ struct megasas_ctrl_info { | |||
| 580 | #define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) | 582 | #define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) |
| 581 | 583 | ||
| 582 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 | 584 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 |
| 585 | #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 | ||
| 586 | #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004) | ||
| 583 | 587 | ||
| 584 | /* | 588 | /* |
| 585 | * register set for both 1068 and 1078 controllers | 589 | * register set for both 1068 and 1078 controllers |
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index edf9fdb3cb3c..22052bb7becb 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | * 1.2: PowerPC (big endian) support. | 23 | * 1.2: PowerPC (big endian) support. |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include <linux/version.h> | ||
| 27 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 28 | #include <linux/init.h> | 27 | #include <linux/init.h> |
| 29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
diff --git a/drivers/scsi/nsp32.h b/drivers/scsi/nsp32.h index 6715ecb3bfca..9565acf1aa72 100644 --- a/drivers/scsi/nsp32.h +++ b/drivers/scsi/nsp32.h | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #ifndef _NSP32_H | 16 | #ifndef _NSP32_H |
| 17 | #define _NSP32_H | 17 | #define _NSP32_H |
| 18 | 18 | ||
| 19 | #include <linux/version.h> | ||
| 20 | //#define NSP32_DEBUG 9 | 19 | //#define NSP32_DEBUG 9 |
| 21 | 20 | ||
| 22 | /* | 21 | /* |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index a221b6ef9fa9..24e6cb8396e3 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | ***********************************************************************/ | 26 | ***********************************************************************/ |
| 27 | 27 | ||
| 28 | #include <linux/version.h> | ||
| 29 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 30 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
| 31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index a319a20ed440..45e7dcb4b34d 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
| @@ -993,6 +993,17 @@ qla2x00_terminate_rport_io(struct fc_rport *rport) | |||
| 993 | { | 993 | { |
| 994 | fc_port_t *fcport = *(fc_port_t **)rport->dd_data; | 994 | fc_port_t *fcport = *(fc_port_t **)rport->dd_data; |
| 995 | 995 | ||
| 996 | /* | ||
| 997 | * At this point all fcport's software-states are cleared. Perform any | ||
| 998 | * final cleanup of firmware resources (PCBs and XCBs). | ||
| 999 | */ | ||
| 1000 | if (fcport->loop_id != FC_NO_LOOP_ID) { | ||
| 1001 | fcport->ha->isp_ops->fabric_logout(fcport->ha, fcport->loop_id, | ||
| 1002 | fcport->d_id.b.domain, fcport->d_id.b.area, | ||
| 1003 | fcport->d_id.b.al_pa); | ||
| 1004 | fcport->loop_id = FC_NO_LOOP_ID; | ||
| 1005 | } | ||
| 1006 | |||
| 996 | qla2x00_abort_fcport_cmds(fcport); | 1007 | qla2x00_abort_fcport_cmds(fcport); |
| 997 | scsi_target_unblock(&rport->dev); | 1008 | scsi_target_unblock(&rport->dev); |
| 998 | } | 1009 | } |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 6da31ba94404..94a720eabfd8 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
| @@ -2237,6 +2237,7 @@ typedef struct scsi_qla_host { | |||
| 2237 | #define REGISTER_FDMI_NEEDED 26 | 2237 | #define REGISTER_FDMI_NEEDED 26 |
| 2238 | #define FCPORT_UPDATE_NEEDED 27 | 2238 | #define FCPORT_UPDATE_NEEDED 27 |
| 2239 | #define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */ | 2239 | #define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */ |
| 2240 | #define UNLOADING 29 | ||
| 2240 | 2241 | ||
| 2241 | uint32_t device_flags; | 2242 | uint32_t device_flags; |
| 2242 | #define DFLG_LOCAL_DEVICES BIT_0 | 2243 | #define DFLG_LOCAL_DEVICES BIT_0 |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 601a6b29750c..ee89ddd64aae 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
| @@ -976,8 +976,9 @@ qla2x00_setup_chip(scsi_qla_host_t *ha) | |||
| 976 | &ha->fw_attributes, &ha->fw_memory_size); | 976 | &ha->fw_attributes, &ha->fw_memory_size); |
| 977 | qla2x00_resize_request_q(ha); | 977 | qla2x00_resize_request_q(ha); |
| 978 | ha->flags.npiv_supported = 0; | 978 | ha->flags.npiv_supported = 0; |
| 979 | if ((IS_QLA24XX(ha) || IS_QLA25XX(ha)) && | 979 | if ((IS_QLA24XX(ha) || IS_QLA25XX(ha) || |
| 980 | (ha->fw_attributes & BIT_2)) { | 980 | IS_QLA84XX(ha)) && |
| 981 | (ha->fw_attributes & BIT_2)) { | ||
| 981 | ha->flags.npiv_supported = 1; | 982 | ha->flags.npiv_supported = 1; |
| 982 | if ((!ha->max_npiv_vports) || | 983 | if ((!ha->max_npiv_vports) || |
| 983 | ((ha->max_npiv_vports + 1) % | 984 | ((ha->max_npiv_vports + 1) % |
| @@ -3251,6 +3252,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
| 3251 | { | 3252 | { |
| 3252 | int rval; | 3253 | int rval; |
| 3253 | uint8_t status = 0; | 3254 | uint8_t status = 0; |
| 3255 | scsi_qla_host_t *vha; | ||
| 3254 | 3256 | ||
| 3255 | if (ha->flags.online) { | 3257 | if (ha->flags.online) { |
| 3256 | ha->flags.online = 0; | 3258 | ha->flags.online = 0; |
| @@ -3265,6 +3267,8 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
| 3265 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { | 3267 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { |
| 3266 | atomic_set(&ha->loop_state, LOOP_DOWN); | 3268 | atomic_set(&ha->loop_state, LOOP_DOWN); |
| 3267 | qla2x00_mark_all_devices_lost(ha, 0); | 3269 | qla2x00_mark_all_devices_lost(ha, 0); |
| 3270 | list_for_each_entry(vha, &ha->vp_list, vp_list) | ||
| 3271 | qla2x00_mark_all_devices_lost(vha, 0); | ||
| 3268 | } else { | 3272 | } else { |
| 3269 | if (!atomic_read(&ha->loop_down_timer)) | 3273 | if (!atomic_read(&ha->loop_down_timer)) |
| 3270 | atomic_set(&ha->loop_down_timer, | 3274 | atomic_set(&ha->loop_down_timer, |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 874d802edb7d..bf41887cdd65 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
| @@ -879,11 +879,12 @@ qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t sense_len) | |||
| 879 | sp->request_sense_ptr += sense_len; | 879 | sp->request_sense_ptr += sense_len; |
| 880 | sp->request_sense_length -= sense_len; | 880 | sp->request_sense_length -= sense_len; |
| 881 | if (sp->request_sense_length != 0) | 881 | if (sp->request_sense_length != 0) |
| 882 | sp->ha->status_srb = sp; | 882 | sp->fcport->ha->status_srb = sp; |
| 883 | 883 | ||
| 884 | DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) " | 884 | DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) " |
| 885 | "cmd=%p pid=%ld\n", __func__, sp->ha->host_no, cp->device->channel, | 885 | "cmd=%p pid=%ld\n", __func__, sp->fcport->ha->host_no, |
| 886 | cp->device->id, cp->device->lun, cp, cp->serial_number)); | 886 | cp->device->channel, cp->device->id, cp->device->lun, cp, |
| 887 | cp->serial_number)); | ||
| 887 | if (sense_len) | 888 | if (sense_len) |
| 888 | DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, | 889 | DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, |
| 889 | CMD_ACTUAL_SNSLEN(cp))); | 890 | CMD_ACTUAL_SNSLEN(cp))); |
| @@ -1184,9 +1185,8 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
| 1184 | atomic_read(&fcport->state))); | 1185 | atomic_read(&fcport->state))); |
| 1185 | 1186 | ||
| 1186 | cp->result = DID_BUS_BUSY << 16; | 1187 | cp->result = DID_BUS_BUSY << 16; |
| 1187 | if (atomic_read(&fcport->state) == FCS_ONLINE) { | 1188 | if (atomic_read(&fcport->state) == FCS_ONLINE) |
| 1188 | qla2x00_mark_device_lost(ha, fcport, 1, 1); | 1189 | qla2x00_mark_device_lost(fcport->ha, fcport, 1, 1); |
| 1189 | } | ||
| 1190 | break; | 1190 | break; |
| 1191 | 1191 | ||
| 1192 | case CS_RESET: | 1192 | case CS_RESET: |
| @@ -1229,7 +1229,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
| 1229 | 1229 | ||
| 1230 | /* Check to see if logout occurred. */ | 1230 | /* Check to see if logout occurred. */ |
| 1231 | if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT)) | 1231 | if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT)) |
| 1232 | qla2x00_mark_device_lost(ha, fcport, 1, 1); | 1232 | qla2x00_mark_device_lost(fcport->ha, fcport, 1, 1); |
| 1233 | break; | 1233 | break; |
| 1234 | 1234 | ||
| 1235 | default: | 1235 | default: |
| @@ -1834,7 +1834,6 @@ clear_risc_ints: | |||
| 1834 | WRT_REG_WORD(®->isp.hccr, HCCR_CLR_HOST_INT); | 1834 | WRT_REG_WORD(®->isp.hccr, HCCR_CLR_HOST_INT); |
| 1835 | } | 1835 | } |
| 1836 | spin_unlock_irq(&ha->hardware_lock); | 1836 | spin_unlock_irq(&ha->hardware_lock); |
| 1837 | ha->isp_ops->enable_intrs(ha); | ||
| 1838 | 1837 | ||
| 1839 | fail: | 1838 | fail: |
| 1840 | return ret; | 1839 | return ret; |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index bc90d6b8d0a0..813bc7784c0a 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
| @@ -2686,7 +2686,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha, | |||
| 2686 | set_bit(VP_IDX_ACQUIRED, &vha->vp_flags); | 2686 | set_bit(VP_IDX_ACQUIRED, &vha->vp_flags); |
| 2687 | set_bit(VP_DPC_NEEDED, &ha->dpc_flags); | 2687 | set_bit(VP_DPC_NEEDED, &ha->dpc_flags); |
| 2688 | 2688 | ||
| 2689 | wake_up_process(ha->dpc_thread); | 2689 | qla2xxx_wake_dpc(ha); |
| 2690 | } | 2690 | } |
| 2691 | } | 2691 | } |
| 2692 | 2692 | ||
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 50baf6a1d67c..93560cd72784 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | */ | 6 | */ |
| 7 | #include "qla_def.h" | 7 | #include "qla_def.h" |
| 8 | 8 | ||
| 9 | #include <linux/version.h> | ||
| 10 | #include <linux/moduleparam.h> | 9 | #include <linux/moduleparam.h> |
| 11 | #include <linux/vmalloc.h> | 10 | #include <linux/vmalloc.h> |
| 12 | #include <linux/smp_lock.h> | 11 | #include <linux/smp_lock.h> |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 7c8af7ed2a5d..6d0f0e5f2827 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -780,7 +780,8 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha, unsigned int t, | |||
| 780 | sp = pha->outstanding_cmds[cnt]; | 780 | sp = pha->outstanding_cmds[cnt]; |
| 781 | if (!sp) | 781 | if (!sp) |
| 782 | continue; | 782 | continue; |
| 783 | if (ha->vp_idx != sp->ha->vp_idx) | 783 | |
| 784 | if (ha->vp_idx != sp->fcport->ha->vp_idx) | ||
| 784 | continue; | 785 | continue; |
| 785 | match = 0; | 786 | match = 0; |
| 786 | switch (type) { | 787 | switch (type) { |
| @@ -1080,9 +1081,7 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *ha, int res) | |||
| 1080 | sp = ha->outstanding_cmds[cnt]; | 1081 | sp = ha->outstanding_cmds[cnt]; |
| 1081 | if (sp) { | 1082 | if (sp) { |
| 1082 | ha->outstanding_cmds[cnt] = NULL; | 1083 | ha->outstanding_cmds[cnt] = NULL; |
| 1083 | sp->flags = 0; | ||
| 1084 | sp->cmd->result = res; | 1084 | sp->cmd->result = res; |
| 1085 | sp->cmd->host_scribble = (unsigned char *)NULL; | ||
| 1086 | qla2x00_sp_compl(ha, sp); | 1085 | qla2x00_sp_compl(ha, sp); |
| 1087 | } | 1086 | } |
| 1088 | } | 1087 | } |
| @@ -1741,6 +1740,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1741 | if (ret) | 1740 | if (ret) |
| 1742 | goto probe_failed; | 1741 | goto probe_failed; |
| 1743 | 1742 | ||
| 1743 | ha->isp_ops->enable_intrs(ha); | ||
| 1744 | |||
| 1744 | scsi_scan_host(host); | 1745 | scsi_scan_host(host); |
| 1745 | 1746 | ||
| 1746 | qla2x00_alloc_sysfs_attr(ha); | 1747 | qla2x00_alloc_sysfs_attr(ha); |
| @@ -1776,10 +1777,15 @@ probe_out: | |||
| 1776 | static void | 1777 | static void |
| 1777 | qla2x00_remove_one(struct pci_dev *pdev) | 1778 | qla2x00_remove_one(struct pci_dev *pdev) |
| 1778 | { | 1779 | { |
| 1779 | scsi_qla_host_t *ha; | 1780 | scsi_qla_host_t *ha, *vha, *temp; |
| 1780 | 1781 | ||
| 1781 | ha = pci_get_drvdata(pdev); | 1782 | ha = pci_get_drvdata(pdev); |
| 1782 | 1783 | ||
| 1784 | list_for_each_entry_safe(vha, temp, &ha->vp_list, vp_list) | ||
| 1785 | fc_vport_terminate(vha->fc_vport); | ||
| 1786 | |||
| 1787 | set_bit(UNLOADING, &ha->dpc_flags); | ||
| 1788 | |||
| 1783 | qla2x00_dfs_remove(ha); | 1789 | qla2x00_dfs_remove(ha); |
| 1784 | 1790 | ||
| 1785 | qla84xx_put_chip(ha); | 1791 | qla84xx_put_chip(ha); |
| @@ -2451,8 +2457,10 @@ qla2x00_do_dpc(void *data) | |||
| 2451 | void | 2457 | void |
| 2452 | qla2xxx_wake_dpc(scsi_qla_host_t *ha) | 2458 | qla2xxx_wake_dpc(scsi_qla_host_t *ha) |
| 2453 | { | 2459 | { |
| 2454 | if (ha->dpc_thread) | 2460 | struct task_struct *t = ha->dpc_thread; |
| 2455 | wake_up_process(ha->dpc_thread); | 2461 | |
| 2462 | if (!test_bit(UNLOADING, &ha->dpc_flags) && t) | ||
| 2463 | wake_up_process(t); | ||
| 2456 | } | 2464 | } |
| 2457 | 2465 | ||
| 2458 | /* | 2466 | /* |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 676c390db354..4160e4caa7b9 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | /* | 7 | /* |
| 8 | * Driver version | 8 | * Driver version |
| 9 | */ | 9 | */ |
| 10 | #define QLA2XXX_VERSION "8.02.01-k6" | 10 | #define QLA2XXX_VERSION "8.02.01-k7" |
| 11 | 11 | ||
| 12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
| 13 | #define QLA_DRIVER_MINOR_VER 2 | 13 | #define QLA_DRIVER_MINOR_VER 2 |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 4a1cf6377f6c..905350896725 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
| @@ -914,6 +914,7 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd, | |||
| 914 | ds[i].d_count = sg_dma_len(s); | 914 | ds[i].d_count = sg_dma_len(s); |
| 915 | } | 915 | } |
| 916 | sg_count -= n; | 916 | sg_count -= n; |
| 917 | sg = s; | ||
| 917 | } | 918 | } |
| 918 | } else { | 919 | } else { |
| 919 | cmd->dataseg[0].d_base = 0; | 920 | cmd->dataseg[0].d_base = 0; |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 880051c89bde..39ce3aba1dac 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
| @@ -391,7 +391,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) | |||
| 391 | 391 | ||
| 392 | case HARDWARE_ERROR: | 392 | case HARDWARE_ERROR: |
| 393 | if (scmd->device->retry_hwerror) | 393 | if (scmd->device->retry_hwerror) |
| 394 | return NEEDS_RETRY; | 394 | return ADD_TO_MLQUEUE; |
| 395 | else | 395 | else |
| 396 | return SUCCESS; | 396 | return SUCCESS; |
| 397 | 397 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ff5d56b3ee4d..62307bd794a9 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -852,7 +852,7 @@ static void scsi_end_bidi_request(struct scsi_cmnd *cmd) | |||
| 852 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | 852 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) |
| 853 | { | 853 | { |
| 854 | int result = cmd->result; | 854 | int result = cmd->result; |
| 855 | int this_count = scsi_bufflen(cmd); | 855 | int this_count; |
| 856 | struct request_queue *q = cmd->device->request_queue; | 856 | struct request_queue *q = cmd->device->request_queue; |
| 857 | struct request *req = cmd->request; | 857 | struct request *req = cmd->request; |
| 858 | int error = 0; | 858 | int error = 0; |
| @@ -908,6 +908,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
| 908 | */ | 908 | */ |
| 909 | if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) | 909 | if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) |
| 910 | return; | 910 | return; |
| 911 | this_count = blk_rq_bytes(req); | ||
| 911 | 912 | ||
| 912 | /* good_bytes = 0, or (inclusive) there were leftovers and | 913 | /* good_bytes = 0, or (inclusive) there were leftovers and |
| 913 | * result = 0, so scsi_end_request couldn't retry. | 914 | * result = 0, so scsi_end_request couldn't retry. |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 84b4879cff11..34d0de6cd511 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
| @@ -1080,7 +1080,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget, | |||
| 1080 | * PDT=1Fh none (no FDD connected to the requested logical unit) | 1080 | * PDT=1Fh none (no FDD connected to the requested logical unit) |
| 1081 | */ | 1081 | */ |
| 1082 | if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) && | 1082 | if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) && |
| 1083 | (result[0] & 0x1f) == 0x1f) { | 1083 | (result[0] & 0x1f) == 0x1f && |
| 1084 | !scsi_is_wlun(lun)) { | ||
| 1084 | SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO | 1085 | SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO |
| 1085 | "scsi scan: peripheral device type" | 1086 | "scsi scan: peripheral device type" |
| 1086 | " of 31, no device added\n")); | 1087 | " of 31, no device added\n")); |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 3d36270a8b4d..661f9f21650a 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
| @@ -217,6 +217,18 @@ static int sg_last_dev(void); | |||
| 217 | #define SZ_SG_IOVEC sizeof(sg_iovec_t) | 217 | #define SZ_SG_IOVEC sizeof(sg_iovec_t) |
| 218 | #define SZ_SG_REQ_INFO sizeof(sg_req_info_t) | 218 | #define SZ_SG_REQ_INFO sizeof(sg_req_info_t) |
| 219 | 219 | ||
| 220 | static int sg_allow_access(struct file *filp, unsigned char *cmd) | ||
| 221 | { | ||
| 222 | struct sg_fd *sfp = (struct sg_fd *)filp->private_data; | ||
| 223 | struct request_queue *q = sfp->parentdp->device->request_queue; | ||
| 224 | |||
| 225 | if (sfp->parentdp->device->type == TYPE_SCANNER) | ||
| 226 | return 0; | ||
| 227 | |||
| 228 | return blk_verify_command(&q->cmd_filter, | ||
| 229 | cmd, filp->f_mode & FMODE_WRITE); | ||
| 230 | } | ||
| 231 | |||
| 220 | static int | 232 | static int |
| 221 | sg_open(struct inode *inode, struct file *filp) | 233 | sg_open(struct inode *inode, struct file *filp) |
| 222 | { | 234 | { |
| @@ -689,7 +701,7 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf, | |||
| 689 | sg_remove_request(sfp, srp); | 701 | sg_remove_request(sfp, srp); |
| 690 | return -EFAULT; | 702 | return -EFAULT; |
| 691 | } | 703 | } |
| 692 | if (read_only && !blk_verify_command(file, cmnd)) { | 704 | if (read_only && sg_allow_access(file, cmnd)) { |
| 693 | sg_remove_request(sfp, srp); | 705 | sg_remove_request(sfp, srp); |
| 694 | return -EPERM; | 706 | return -EPERM; |
| 695 | } | 707 | } |
| @@ -793,6 +805,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
| 793 | 805 | ||
| 794 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) | 806 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) |
| 795 | return -ENXIO; | 807 | return -ENXIO; |
| 808 | |||
| 796 | SCSI_LOG_TIMEOUT(3, printk("sg_ioctl: %s, cmd=0x%x\n", | 809 | SCSI_LOG_TIMEOUT(3, printk("sg_ioctl: %s, cmd=0x%x\n", |
| 797 | sdp->disk->disk_name, (int) cmd_in)); | 810 | sdp->disk->disk_name, (int) cmd_in)); |
| 798 | read_only = (O_RDWR != (filp->f_flags & O_ACCMODE)); | 811 | read_only = (O_RDWR != (filp->f_flags & O_ACCMODE)); |
| @@ -1061,7 +1074,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
| 1061 | 1074 | ||
| 1062 | if (copy_from_user(&opcode, siocp->data, 1)) | 1075 | if (copy_from_user(&opcode, siocp->data, 1)) |
| 1063 | return -EFAULT; | 1076 | return -EFAULT; |
| 1064 | if (!blk_verify_command(filp, &opcode)) | 1077 | if (sg_allow_access(filp, &opcode)) |
| 1065 | return -EPERM; | 1078 | return -EPERM; |
| 1066 | } | 1079 | } |
| 1067 | return sg_scsi_ioctl(filp, sdp->device->request_queue, NULL, p); | 1080 | return sg_scsi_ioctl(filp, sdp->device->request_queue, NULL, p); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 342e12fb1c25..9ccc563d8730 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
| @@ -1908,15 +1908,23 @@ static int serial8250_startup(struct uart_port *port) | |||
| 1908 | * kick the UART on a regular basis. | 1908 | * kick the UART on a regular basis. |
| 1909 | */ | 1909 | */ |
| 1910 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { | 1910 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { |
| 1911 | up->bugs |= UART_BUG_THRE; | ||
| 1911 | pr_debug("ttyS%d - using backup timer\n", port->line); | 1912 | pr_debug("ttyS%d - using backup timer\n", port->line); |
| 1912 | up->timer.function = serial8250_backup_timeout; | ||
| 1913 | up->timer.data = (unsigned long)up; | ||
| 1914 | mod_timer(&up->timer, jiffies + | ||
| 1915 | poll_timeout(up->port.timeout) + HZ / 5); | ||
| 1916 | } | 1913 | } |
| 1917 | } | 1914 | } |
| 1918 | 1915 | ||
| 1919 | /* | 1916 | /* |
| 1917 | * The above check will only give an accurate result the first time | ||
| 1918 | * the port is opened so this value needs to be preserved. | ||
| 1919 | */ | ||
| 1920 | if (up->bugs & UART_BUG_THRE) { | ||
| 1921 | up->timer.function = serial8250_backup_timeout; | ||
| 1922 | up->timer.data = (unsigned long)up; | ||
| 1923 | mod_timer(&up->timer, jiffies + | ||
| 1924 | poll_timeout(up->port.timeout) + HZ / 5); | ||
| 1925 | } | ||
| 1926 | |||
| 1927 | /* | ||
| 1920 | * If the "interrupt" for this port doesn't correspond with any | 1928 | * If the "interrupt" for this port doesn't correspond with any |
| 1921 | * hardware interrupt, we use a timer-based system. The original | 1929 | * hardware interrupt, we use a timer-based system. The original |
| 1922 | * driver used to do this with IRQ0. | 1930 | * driver used to do this with IRQ0. |
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h index 78c00162b04e..520260326f3d 100644 --- a/drivers/serial/8250.h +++ b/drivers/serial/8250.h | |||
| @@ -47,6 +47,7 @@ struct serial8250_config { | |||
| 47 | #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ | 47 | #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ |
| 48 | #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ | 48 | #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ |
| 49 | #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ | 49 | #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ |
| 50 | #define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */ | ||
| 50 | 51 | ||
| 51 | #define PROBE_RSA (1 << 0) | 52 | #define PROBE_RSA (1 << 0) |
| 52 | #define PROBE_ANY (~0) | 53 | #define PROBE_ANY (~0) |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 3b4a14e355c1..77cb34270fc1 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
| @@ -449,6 +449,7 @@ config SERIAL_CLPS711X_CONSOLE | |||
| 449 | config SERIAL_SAMSUNG | 449 | config SERIAL_SAMSUNG |
| 450 | tristate "Samsung SoC serial support" | 450 | tristate "Samsung SoC serial support" |
| 451 | depends on ARM && PLAT_S3C24XX | 451 | depends on ARM && PLAT_S3C24XX |
| 452 | select SERIAL_CORE | ||
| 452 | help | 453 | help |
| 453 | Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, | 454 | Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, |
| 454 | providing /dev/ttySAC0, 1 and 2 (note, some machines may not | 455 | providing /dev/ttySAC0, 1 and 2 (note, some machines may not |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 3a6da80b081c..61fb8b6d19af 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
| @@ -131,7 +131,8 @@ struct atmel_uart_char { | |||
| 131 | struct atmel_uart_port { | 131 | struct atmel_uart_port { |
| 132 | struct uart_port uart; /* uart */ | 132 | struct uart_port uart; /* uart */ |
| 133 | struct clk *clk; /* uart clock */ | 133 | struct clk *clk; /* uart clock */ |
| 134 | unsigned short suspended; /* is port suspended? */ | 134 | int may_wakeup; /* cached value of device_may_wakeup for times we need to disable it */ |
| 135 | u32 backup_imr; /* IMR saved during suspend */ | ||
| 135 | int break_active; /* break being received */ | 136 | int break_active; /* break being received */ |
| 136 | 137 | ||
| 137 | short use_dma_rx; /* enable PDC receiver */ | 138 | short use_dma_rx; /* enable PDC receiver */ |
| @@ -984,8 +985,15 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state, | |||
| 984 | * This is called on uart_open() or a resume event. | 985 | * This is called on uart_open() or a resume event. |
| 985 | */ | 986 | */ |
| 986 | clk_enable(atmel_port->clk); | 987 | clk_enable(atmel_port->clk); |
| 988 | |||
| 989 | /* re-enable interrupts if we disabled some on suspend */ | ||
| 990 | UART_PUT_IER(port, atmel_port->backup_imr); | ||
| 987 | break; | 991 | break; |
| 988 | case 3: | 992 | case 3: |
| 993 | /* Back up the interrupt mask and disable all interrupts */ | ||
| 994 | atmel_port->backup_imr = UART_GET_IMR(port); | ||
| 995 | UART_PUT_IDR(port, -1); | ||
| 996 | |||
| 989 | /* | 997 | /* |
| 990 | * Disable the peripheral clock for this serial port. | 998 | * Disable the peripheral clock for this serial port. |
| 991 | * This is called on uart_close() or a suspend event. | 999 | * This is called on uart_close() or a suspend event. |
| @@ -1475,13 +1483,12 @@ static int atmel_serial_suspend(struct platform_device *pdev, | |||
| 1475 | cpu_relax(); | 1483 | cpu_relax(); |
| 1476 | } | 1484 | } |
| 1477 | 1485 | ||
| 1478 | if (device_may_wakeup(&pdev->dev) | 1486 | /* we can not wake up if we're running on slow clock */ |
| 1479 | && !atmel_serial_clk_will_stop()) | 1487 | atmel_port->may_wakeup = device_may_wakeup(&pdev->dev); |
| 1480 | enable_irq_wake(port->irq); | 1488 | if (atmel_serial_clk_will_stop()) |
| 1481 | else { | 1489 | device_set_wakeup_enable(&pdev->dev, 0); |
| 1482 | uart_suspend_port(&atmel_uart, port); | 1490 | |
| 1483 | atmel_port->suspended = 1; | 1491 | uart_suspend_port(&atmel_uart, port); |
| 1484 | } | ||
| 1485 | 1492 | ||
| 1486 | return 0; | 1493 | return 0; |
| 1487 | } | 1494 | } |
| @@ -1491,11 +1498,8 @@ static int atmel_serial_resume(struct platform_device *pdev) | |||
| 1491 | struct uart_port *port = platform_get_drvdata(pdev); | 1498 | struct uart_port *port = platform_get_drvdata(pdev); |
| 1492 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 1499 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
| 1493 | 1500 | ||
| 1494 | if (atmel_port->suspended) { | 1501 | uart_resume_port(&atmel_uart, port); |
| 1495 | uart_resume_port(&atmel_uart, port); | 1502 | device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup); |
| 1496 | atmel_port->suspended = 0; | ||
| 1497 | } else | ||
| 1498 | disable_irq_wake(port->irq); | ||
| 1499 | 1503 | ||
| 1500 | return 0; | 1504 | return 0; |
| 1501 | } | 1505 | } |
| @@ -1513,6 +1517,8 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev) | |||
| 1513 | BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); | 1517 | BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); |
| 1514 | 1518 | ||
| 1515 | port = &atmel_ports[pdev->id]; | 1519 | port = &atmel_ports[pdev->id]; |
| 1520 | port->backup_imr = 0; | ||
| 1521 | |||
| 1516 | atmel_init_port(port, pdev); | 1522 | atmel_init_port(port, pdev); |
| 1517 | 1523 | ||
| 1518 | if (!atmel_use_dma_rx(&port->uart)) { | 1524 | if (!atmel_use_dma_rx(&port->uart)) { |
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index efcd44344fb1..4a0d30bed9f1 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | #include <asm/gpio.h> | 30 | #include <asm/gpio.h> |
| 31 | #include <asm/mach/bfin_serial_5xx.h> | 31 | #include <mach/bfin_serial_5xx.h> |
| 32 | 32 | ||
| 33 | #ifdef CONFIG_SERIAL_BFIN_DMA | 33 | #ifdef CONFIG_SERIAL_BFIN_DMA |
| 34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 6a29f9330a73..3f90f1bbbbcd 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
| @@ -127,8 +127,13 @@ | |||
| 127 | #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ | 127 | #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ |
| 128 | #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ | 128 | #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ |
| 129 | #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ | 129 | #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ |
| 130 | #define UCR3_REF25 (1<<3) /* Ref freq 25 MHz */ | 130 | #ifdef CONFIG_ARCH_IMX |
| 131 | #define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz */ | 131 | #define UCR3_REF25 (1<<3) /* Ref freq 25 MHz, only on mx1 */ |
| 132 | #define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz, only on mx1 */ | ||
| 133 | #endif | ||
| 134 | #if defined CONFIG_ARCH_MX2 || defined CONFIG_ARCH_MX3 | ||
| 135 | #define UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */ | ||
| 136 | #endif | ||
| 132 | #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ | 137 | #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ |
| 133 | #define UCR3_BPEN (1<<0) /* Preset registers enable */ | 138 | #define UCR3_BPEN (1<<0) /* Preset registers enable */ |
| 134 | #define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ | 139 | #define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ |
| @@ -445,7 +450,7 @@ static irqreturn_t imx_int(int irq, void *dev_id) | |||
| 445 | readl(sport->port.membase + UCR1) & UCR1_TXMPTYEN) | 450 | readl(sport->port.membase + UCR1) & UCR1_TXMPTYEN) |
| 446 | imx_txint(irq, dev_id); | 451 | imx_txint(irq, dev_id); |
| 447 | 452 | ||
| 448 | if (sts & USR1_RTSS) | 453 | if (sts & USR1_RTSD) |
| 449 | imx_rtsint(irq, dev_id); | 454 | imx_rtsint(irq, dev_id); |
| 450 | 455 | ||
| 451 | return IRQ_HANDLED; | 456 | return IRQ_HANDLED; |
| @@ -598,6 +603,12 @@ static int imx_startup(struct uart_port *port) | |||
| 598 | temp |= (UCR2_RXEN | UCR2_TXEN); | 603 | temp |= (UCR2_RXEN | UCR2_TXEN); |
| 599 | writel(temp, sport->port.membase + UCR2); | 604 | writel(temp, sport->port.membase + UCR2); |
| 600 | 605 | ||
| 606 | #if defined CONFIG_ARCH_MX2 || defined CONFIG_ARCH_MX3 | ||
| 607 | temp = readl(sport->port.membase + UCR3); | ||
| 608 | temp |= UCR3_RXDMUXSEL; | ||
| 609 | writel(temp, sport->port.membase + UCR3); | ||
| 610 | #endif | ||
| 611 | |||
| 601 | /* | 612 | /* |
| 602 | * Enable modem status interrupts | 613 | * Enable modem status interrupts |
| 603 | */ | 614 | */ |
| @@ -1133,13 +1144,19 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
| 1133 | if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) | 1144 | if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) |
| 1134 | sport->have_rtscts = 1; | 1145 | sport->have_rtscts = 1; |
| 1135 | 1146 | ||
| 1136 | if (pdata->init) | 1147 | if (pdata->init) { |
| 1137 | pdata->init(pdev); | 1148 | ret = pdata->init(pdev); |
| 1149 | if (ret) | ||
| 1150 | goto clkput; | ||
| 1151 | } | ||
| 1138 | 1152 | ||
| 1139 | uart_add_one_port(&imx_reg, &sport->port); | 1153 | uart_add_one_port(&imx_reg, &sport->port); |
| 1140 | platform_set_drvdata(pdev, &sport->port); | 1154 | platform_set_drvdata(pdev, &sport->port); |
| 1141 | 1155 | ||
| 1142 | return 0; | 1156 | return 0; |
| 1157 | clkput: | ||
| 1158 | clk_put(sport->clk); | ||
| 1159 | clk_disable(sport->clk); | ||
| 1143 | unmap: | 1160 | unmap: |
| 1144 | iounmap(sport->port.membase); | 1161 | iounmap(sport->port.membase); |
| 1145 | free: | 1162 | free: |
diff --git a/drivers/spi/orion_spi.c b/drivers/spi/orion_spi.c index c4eaacd6e553..b872bfaf4bd2 100644 --- a/drivers/spi/orion_spi.c +++ b/drivers/spi/orion_spi.c | |||
| @@ -427,7 +427,7 @@ static int orion_spi_transfer(struct spi_device *spi, struct spi_message *m) | |||
| 427 | goto msg_rejected; | 427 | goto msg_rejected; |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | if (t->speed_hz < orion_spi->min_speed) { | 430 | if (t->speed_hz && t->speed_hz < orion_spi->min_speed) { |
| 431 | dev_err(&spi->dev, | 431 | dev_err(&spi->dev, |
| 432 | "message rejected : " | 432 | "message rejected : " |
| 433 | "device min speed (%d Hz) exceeds " | 433 | "device min speed (%d Hz) exceeds " |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 34c7c9875681..d47d3636227f 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
| @@ -47,9 +47,10 @@ MODULE_ALIAS("platform:pxa2xx-spi"); | |||
| 47 | 47 | ||
| 48 | #define MAX_BUSES 3 | 48 | #define MAX_BUSES 3 |
| 49 | 49 | ||
| 50 | #define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR) | 50 | #define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR) |
| 51 | #define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK) | 51 | #define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK) |
| 52 | #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) | 52 | #define IS_DMA_ALIGNED(x) ((((u32)(x)) & 0x07) == 0) |
| 53 | #define MAX_DMA_LEN 8191 | ||
| 53 | 54 | ||
| 54 | /* | 55 | /* |
| 55 | * for testing SSCR1 changes that require SSP restart, basically | 56 | * for testing SSCR1 changes that require SSP restart, basically |
| @@ -144,7 +145,6 @@ struct driver_data { | |||
| 144 | size_t tx_map_len; | 145 | size_t tx_map_len; |
| 145 | u8 n_bytes; | 146 | u8 n_bytes; |
| 146 | u32 dma_width; | 147 | u32 dma_width; |
| 147 | int cs_change; | ||
| 148 | int (*write)(struct driver_data *drv_data); | 148 | int (*write)(struct driver_data *drv_data); |
| 149 | int (*read)(struct driver_data *drv_data); | 149 | int (*read)(struct driver_data *drv_data); |
| 150 | irqreturn_t (*transfer_handler)(struct driver_data *drv_data); | 150 | irqreturn_t (*transfer_handler)(struct driver_data *drv_data); |
| @@ -406,8 +406,45 @@ static void giveback(struct driver_data *drv_data) | |||
| 406 | struct spi_transfer, | 406 | struct spi_transfer, |
| 407 | transfer_list); | 407 | transfer_list); |
| 408 | 408 | ||
| 409 | /* Delay if requested before any change in chip select */ | ||
| 410 | if (last_transfer->delay_usecs) | ||
| 411 | udelay(last_transfer->delay_usecs); | ||
| 412 | |||
| 413 | /* Drop chip select UNLESS cs_change is true or we are returning | ||
| 414 | * a message with an error, or next message is for another chip | ||
| 415 | */ | ||
| 409 | if (!last_transfer->cs_change) | 416 | if (!last_transfer->cs_change) |
| 410 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | 417 | drv_data->cs_control(PXA2XX_CS_DEASSERT); |
| 418 | else { | ||
| 419 | struct spi_message *next_msg; | ||
| 420 | |||
| 421 | /* Holding of cs was hinted, but we need to make sure | ||
| 422 | * the next message is for the same chip. Don't waste | ||
| 423 | * time with the following tests unless this was hinted. | ||
| 424 | * | ||
| 425 | * We cannot postpone this until pump_messages, because | ||
| 426 | * after calling msg->complete (below) the driver that | ||
| 427 | * sent the current message could be unloaded, which | ||
| 428 | * could invalidate the cs_control() callback... | ||
| 429 | */ | ||
| 430 | |||
| 431 | /* get a pointer to the next message, if any */ | ||
| 432 | spin_lock_irqsave(&drv_data->lock, flags); | ||
| 433 | if (list_empty(&drv_data->queue)) | ||
| 434 | next_msg = NULL; | ||
| 435 | else | ||
| 436 | next_msg = list_entry(drv_data->queue.next, | ||
| 437 | struct spi_message, queue); | ||
| 438 | spin_unlock_irqrestore(&drv_data->lock, flags); | ||
| 439 | |||
| 440 | /* see if the next and current messages point | ||
| 441 | * to the same chip | ||
| 442 | */ | ||
| 443 | if (next_msg && next_msg->spi != msg->spi) | ||
| 444 | next_msg = NULL; | ||
| 445 | if (!next_msg || msg->state == ERROR_STATE) | ||
| 446 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
| 447 | } | ||
| 411 | 448 | ||
| 412 | msg->state = NULL; | 449 | msg->state = NULL; |
| 413 | if (msg->complete) | 450 | if (msg->complete) |
| @@ -490,10 +527,9 @@ static void dma_transfer_complete(struct driver_data *drv_data) | |||
| 490 | msg->actual_length += drv_data->len - | 527 | msg->actual_length += drv_data->len - |
| 491 | (drv_data->rx_end - drv_data->rx); | 528 | (drv_data->rx_end - drv_data->rx); |
| 492 | 529 | ||
| 493 | /* Release chip select if requested, transfer delays are | 530 | /* Transfer delays and chip select release are |
| 494 | * handled in pump_transfers */ | 531 | * handled in pump_transfers or giveback |
| 495 | if (drv_data->cs_change) | 532 | */ |
| 496 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
| 497 | 533 | ||
| 498 | /* Move to next transfer */ | 534 | /* Move to next transfer */ |
| 499 | msg->state = next_transfer(drv_data); | 535 | msg->state = next_transfer(drv_data); |
| @@ -602,10 +638,9 @@ static void int_transfer_complete(struct driver_data *drv_data) | |||
| 602 | drv_data->cur_msg->actual_length += drv_data->len - | 638 | drv_data->cur_msg->actual_length += drv_data->len - |
| 603 | (drv_data->rx_end - drv_data->rx); | 639 | (drv_data->rx_end - drv_data->rx); |
| 604 | 640 | ||
| 605 | /* Release chip select if requested, transfer delays are | 641 | /* Transfer delays and chip select release are |
| 606 | * handled in pump_transfers */ | 642 | * handled in pump_transfers or giveback |
| 607 | if (drv_data->cs_change) | 643 | */ |
| 608 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
| 609 | 644 | ||
| 610 | /* Move to next transfer */ | 645 | /* Move to next transfer */ |
| 611 | drv_data->cur_msg->state = next_transfer(drv_data); | 646 | drv_data->cur_msg->state = next_transfer(drv_data); |
| @@ -840,23 +875,40 @@ static void pump_transfers(unsigned long data) | |||
| 840 | return; | 875 | return; |
| 841 | } | 876 | } |
| 842 | 877 | ||
| 843 | /* Delay if requested at end of transfer*/ | 878 | /* Delay if requested at end of transfer before CS change */ |
| 844 | if (message->state == RUNNING_STATE) { | 879 | if (message->state == RUNNING_STATE) { |
| 845 | previous = list_entry(transfer->transfer_list.prev, | 880 | previous = list_entry(transfer->transfer_list.prev, |
| 846 | struct spi_transfer, | 881 | struct spi_transfer, |
| 847 | transfer_list); | 882 | transfer_list); |
| 848 | if (previous->delay_usecs) | 883 | if (previous->delay_usecs) |
| 849 | udelay(previous->delay_usecs); | 884 | udelay(previous->delay_usecs); |
| 885 | |||
| 886 | /* Drop chip select only if cs_change is requested */ | ||
| 887 | if (previous->cs_change) | ||
| 888 | drv_data->cs_control(PXA2XX_CS_DEASSERT); | ||
| 850 | } | 889 | } |
| 851 | 890 | ||
| 852 | /* Check transfer length */ | 891 | /* Check for transfers that need multiple DMA segments */ |
| 853 | if (transfer->len > 8191) | 892 | if (transfer->len > MAX_DMA_LEN && chip->enable_dma) { |
| 854 | { | 893 | |
| 855 | dev_warn(&drv_data->pdev->dev, "pump_transfers: transfer " | 894 | /* reject already-mapped transfers; PIO won't always work */ |
| 856 | "length greater than 8191\n"); | 895 | if (message->is_dma_mapped |
| 857 | message->status = -EINVAL; | 896 | || transfer->rx_dma || transfer->tx_dma) { |
| 858 | giveback(drv_data); | 897 | dev_err(&drv_data->pdev->dev, |
| 859 | return; | 898 | "pump_transfers: mapped transfer length " |
| 899 | "of %u is greater than %d\n", | ||
| 900 | transfer->len, MAX_DMA_LEN); | ||
| 901 | message->status = -EINVAL; | ||
| 902 | giveback(drv_data); | ||
| 903 | return; | ||
| 904 | } | ||
| 905 | |||
| 906 | /* warn ... we force this to PIO mode */ | ||
| 907 | if (printk_ratelimit()) | ||
| 908 | dev_warn(&message->spi->dev, "pump_transfers: " | ||
| 909 | "DMA disabled for transfer length %ld " | ||
| 910 | "greater than %d\n", | ||
| 911 | (long)drv_data->len, MAX_DMA_LEN); | ||
| 860 | } | 912 | } |
| 861 | 913 | ||
| 862 | /* Setup the transfer state based on the type of transfer */ | 914 | /* Setup the transfer state based on the type of transfer */ |
| @@ -878,7 +930,6 @@ static void pump_transfers(unsigned long data) | |||
| 878 | drv_data->len = transfer->len & DCMD_LENGTH; | 930 | drv_data->len = transfer->len & DCMD_LENGTH; |
| 879 | drv_data->write = drv_data->tx ? chip->write : null_writer; | 931 | drv_data->write = drv_data->tx ? chip->write : null_writer; |
| 880 | drv_data->read = drv_data->rx ? chip->read : null_reader; | 932 | drv_data->read = drv_data->rx ? chip->read : null_reader; |
| 881 | drv_data->cs_change = transfer->cs_change; | ||
| 882 | 933 | ||
| 883 | /* Change speed and bit per word on a per transfer */ | 934 | /* Change speed and bit per word on a per transfer */ |
| 884 | cr0 = chip->cr0; | 935 | cr0 = chip->cr0; |
| @@ -925,7 +976,7 @@ static void pump_transfers(unsigned long data) | |||
| 925 | &dma_thresh)) | 976 | &dma_thresh)) |
| 926 | if (printk_ratelimit()) | 977 | if (printk_ratelimit()) |
| 927 | dev_warn(&message->spi->dev, | 978 | dev_warn(&message->spi->dev, |
| 928 | "pump_transfer: " | 979 | "pump_transfers: " |
| 929 | "DMA burst size reduced to " | 980 | "DMA burst size reduced to " |
| 930 | "match bits_per_word\n"); | 981 | "match bits_per_word\n"); |
| 931 | } | 982 | } |
| @@ -939,8 +990,23 @@ static void pump_transfers(unsigned long data) | |||
| 939 | 990 | ||
| 940 | message->state = RUNNING_STATE; | 991 | message->state = RUNNING_STATE; |
| 941 | 992 | ||
| 942 | /* Try to map dma buffer and do a dma transfer if successful */ | 993 | /* Try to map dma buffer and do a dma transfer if successful, but |
| 943 | if ((drv_data->dma_mapped = map_dma_buffers(drv_data))) { | 994 | * only if the length is non-zero and less than MAX_DMA_LEN. |
| 995 | * | ||
| 996 | * Zero-length non-descriptor DMA is illegal on PXA2xx; force use | ||
| 997 | * of PIO instead. Care is needed above because the transfer may | ||
| 998 | * have have been passed with buffers that are already dma mapped. | ||
| 999 | * A zero-length transfer in PIO mode will not try to write/read | ||
| 1000 | * to/from the buffers | ||
| 1001 | * | ||
| 1002 | * REVISIT large transfers are exactly where we most want to be | ||
| 1003 | * using DMA. If this happens much, split those transfers into | ||
| 1004 | * multiple DMA segments rather than forcing PIO. | ||
| 1005 | */ | ||
| 1006 | drv_data->dma_mapped = 0; | ||
| 1007 | if (drv_data->len > 0 && drv_data->len <= MAX_DMA_LEN) | ||
| 1008 | drv_data->dma_mapped = map_dma_buffers(drv_data); | ||
| 1009 | if (drv_data->dma_mapped) { | ||
| 944 | 1010 | ||
| 945 | /* Ensure we have the correct interrupt handler */ | 1011 | /* Ensure we have the correct interrupt handler */ |
| 946 | drv_data->transfer_handler = dma_transfer; | 1012 | drv_data->transfer_handler = dma_transfer; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 964124b60db2..75e86865234c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -226,10 +226,11 @@ EXPORT_SYMBOL_GPL(spi_alloc_device); | |||
| 226 | * Companion function to spi_alloc_device. Devices allocated with | 226 | * Companion function to spi_alloc_device. Devices allocated with |
| 227 | * spi_alloc_device can be added onto the spi bus with this function. | 227 | * spi_alloc_device can be added onto the spi bus with this function. |
| 228 | * | 228 | * |
| 229 | * Returns 0 on success; non-zero on failure | 229 | * Returns 0 on success; negative errno on failure |
| 230 | */ | 230 | */ |
| 231 | int spi_add_device(struct spi_device *spi) | 231 | int spi_add_device(struct spi_device *spi) |
| 232 | { | 232 | { |
| 233 | static DEFINE_MUTEX(spi_add_lock); | ||
| 233 | struct device *dev = spi->master->dev.parent; | 234 | struct device *dev = spi->master->dev.parent; |
| 234 | int status; | 235 | int status; |
| 235 | 236 | ||
| @@ -246,26 +247,43 @@ int spi_add_device(struct spi_device *spi) | |||
| 246 | "%s.%u", spi->master->dev.bus_id, | 247 | "%s.%u", spi->master->dev.bus_id, |
| 247 | spi->chip_select); | 248 | spi->chip_select); |
| 248 | 249 | ||
| 249 | /* drivers may modify this initial i/o setup */ | 250 | |
| 251 | /* We need to make sure there's no other device with this | ||
| 252 | * chipselect **BEFORE** we call setup(), else we'll trash | ||
| 253 | * its configuration. Lock against concurrent add() calls. | ||
| 254 | */ | ||
| 255 | mutex_lock(&spi_add_lock); | ||
| 256 | |||
| 257 | if (bus_find_device_by_name(&spi_bus_type, NULL, spi->dev.bus_id) | ||
| 258 | != NULL) { | ||
| 259 | dev_err(dev, "chipselect %d already in use\n", | ||
| 260 | spi->chip_select); | ||
| 261 | status = -EBUSY; | ||
| 262 | goto done; | ||
| 263 | } | ||
| 264 | |||
| 265 | /* Drivers may modify this initial i/o setup, but will | ||
| 266 | * normally rely on the device being setup. Devices | ||
| 267 | * using SPI_CS_HIGH can't coexist well otherwise... | ||
| 268 | */ | ||
| 250 | status = spi->master->setup(spi); | 269 | status = spi->master->setup(spi); |
| 251 | if (status < 0) { | 270 | if (status < 0) { |
| 252 | dev_err(dev, "can't %s %s, status %d\n", | 271 | dev_err(dev, "can't %s %s, status %d\n", |
| 253 | "setup", spi->dev.bus_id, status); | 272 | "setup", spi->dev.bus_id, status); |
| 254 | return status; | 273 | goto done; |
| 255 | } | 274 | } |
| 256 | 275 | ||
| 257 | /* driver core catches callers that misbehave by defining | 276 | /* Device may be bound to an active driver when this returns */ |
| 258 | * devices that already exist. | ||
| 259 | */ | ||
| 260 | status = device_add(&spi->dev); | 277 | status = device_add(&spi->dev); |
| 261 | if (status < 0) { | 278 | if (status < 0) |
| 262 | dev_err(dev, "can't %s %s, status %d\n", | 279 | dev_err(dev, "can't %s %s, status %d\n", |
| 263 | "add", spi->dev.bus_id, status); | 280 | "add", spi->dev.bus_id, status); |
| 264 | return status; | 281 | else |
| 265 | } | 282 | dev_dbg(dev, "registered child %s\n", spi->dev.bus_id); |
| 266 | 283 | ||
| 267 | dev_dbg(dev, "registered child %s\n", spi->dev.bus_id); | 284 | done: |
| 268 | return 0; | 285 | mutex_unlock(&spi_add_lock); |
| 286 | return status; | ||
| 269 | } | 287 | } |
| 270 | EXPORT_SYMBOL_GPL(spi_add_device); | 288 | EXPORT_SYMBOL_GPL(spi_add_device); |
| 271 | 289 | ||
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c index 070c6219e2d6..ac0e3e4b3c54 100644 --- a/drivers/spi/spi_mpc83xx.c +++ b/drivers/spi/spi_mpc83xx.c | |||
| @@ -267,16 +267,13 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
| 267 | cs->hw_mode |= SPMODE_LEN(bits_per_word); | 267 | cs->hw_mode |= SPMODE_LEN(bits_per_word); |
| 268 | 268 | ||
| 269 | if ((mpc83xx_spi->spibrg / hz) > 64) { | 269 | if ((mpc83xx_spi->spibrg / hz) > 64) { |
| 270 | cs->hw_mode |= SPMODE_DIV16; | ||
| 270 | pm = mpc83xx_spi->spibrg / (hz * 64); | 271 | pm = mpc83xx_spi->spibrg / (hz * 64); |
| 271 | if (pm > 16) { | 272 | if (pm > 16) { |
| 272 | cs->hw_mode |= SPMODE_DIV16; | 273 | dev_err(&spi->dev, "Requested speed is too " |
| 273 | pm /= 16; | 274 | "low: %d Hz. Will use %d Hz instead.\n", |
| 274 | if (pm > 16) { | 275 | hz, mpc83xx_spi->spibrg / 1024); |
| 275 | dev_err(&spi->dev, "Requested speed is too " | 276 | pm = 16; |
| 276 | "low: %d Hz. Will use %d Hz instead.\n", | ||
| 277 | hz, mpc83xx_spi->spibrg / 1024); | ||
| 278 | pm = 16; | ||
| 279 | } | ||
| 280 | } | 277 | } |
| 281 | } else | 278 | } else |
| 282 | pm = mpc83xx_spi->spibrg / (hz * 4); | 279 | pm = mpc83xx_spi->spibrg / (hz * 4); |
| @@ -315,11 +312,20 @@ static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
| 315 | if (t->bits_per_word) | 312 | if (t->bits_per_word) |
| 316 | bits_per_word = t->bits_per_word; | 313 | bits_per_word = t->bits_per_word; |
| 317 | len = t->len; | 314 | len = t->len; |
| 318 | if (bits_per_word > 8) | 315 | if (bits_per_word > 8) { |
| 316 | /* invalid length? */ | ||
| 317 | if (len & 1) | ||
| 318 | return -EINVAL; | ||
| 319 | len /= 2; | 319 | len /= 2; |
| 320 | if (bits_per_word > 16) | 320 | } |
| 321 | if (bits_per_word > 16) { | ||
| 322 | /* invalid length? */ | ||
| 323 | if (len & 1) | ||
| 324 | return -EINVAL; | ||
| 321 | len /= 2; | 325 | len /= 2; |
| 326 | } | ||
| 322 | mpc83xx_spi->count = len; | 327 | mpc83xx_spi->count = len; |
| 328 | |||
| 323 | INIT_COMPLETION(mpc83xx_spi->done); | 329 | INIT_COMPLETION(mpc83xx_spi->done); |
| 324 | 330 | ||
| 325 | /* enable rx ints */ | 331 | /* enable rx ints */ |
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 98abc73c1a1d..3eb414b84a9d 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
| @@ -430,7 +430,7 @@ static int s3c24xx_spi_resume(struct platform_device *pdev) | |||
| 430 | #endif | 430 | #endif |
| 431 | 431 | ||
| 432 | MODULE_ALIAS("platform:s3c2410-spi"); | 432 | MODULE_ALIAS("platform:s3c2410-spi"); |
| 433 | static struct platform_driver s3c24xx_spidrv = { | 433 | static struct platform_driver s3c24xx_spi_driver = { |
| 434 | .remove = __exit_p(s3c24xx_spi_remove), | 434 | .remove = __exit_p(s3c24xx_spi_remove), |
| 435 | .suspend = s3c24xx_spi_suspend, | 435 | .suspend = s3c24xx_spi_suspend, |
| 436 | .resume = s3c24xx_spi_resume, | 436 | .resume = s3c24xx_spi_resume, |
| @@ -442,12 +442,12 @@ static struct platform_driver s3c24xx_spidrv = { | |||
| 442 | 442 | ||
| 443 | static int __init s3c24xx_spi_init(void) | 443 | static int __init s3c24xx_spi_init(void) |
| 444 | { | 444 | { |
| 445 | return platform_driver_probe(&s3c24xx_spidrv, s3c24xx_spi_probe); | 445 | return platform_driver_probe(&s3c24xx_spi_driver, s3c24xx_spi_probe); |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | static void __exit s3c24xx_spi_exit(void) | 448 | static void __exit s3c24xx_spi_exit(void) |
| 449 | { | 449 | { |
| 450 | platform_driver_unregister(&s3c24xx_spidrv); | 450 | platform_driver_unregister(&s3c24xx_spi_driver); |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | module_init(s3c24xx_spi_init); | 453 | module_init(s3c24xx_spi_init); |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index d831a2beff39..0ffabf5c0b60 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
| @@ -471,6 +471,7 @@ static int ssb_devices_register(struct ssb_bus *bus) | |||
| 471 | #endif | 471 | #endif |
| 472 | break; | 472 | break; |
| 473 | case SSB_BUSTYPE_SSB: | 473 | case SSB_BUSTYPE_SSB: |
| 474 | dev->dma_mask = &dev->coherent_dma_mask; | ||
| 474 | break; | 475 | break; |
| 475 | } | 476 | } |
| 476 | 477 | ||
| @@ -1165,15 +1166,19 @@ EXPORT_SYMBOL(ssb_dma_translation); | |||
| 1165 | 1166 | ||
| 1166 | int ssb_dma_set_mask(struct ssb_device *dev, u64 mask) | 1167 | int ssb_dma_set_mask(struct ssb_device *dev, u64 mask) |
| 1167 | { | 1168 | { |
| 1169 | #ifdef CONFIG_SSB_PCIHOST | ||
| 1168 | int err; | 1170 | int err; |
| 1171 | #endif | ||
| 1169 | 1172 | ||
| 1170 | switch (dev->bus->bustype) { | 1173 | switch (dev->bus->bustype) { |
| 1171 | case SSB_BUSTYPE_PCI: | 1174 | case SSB_BUSTYPE_PCI: |
| 1175 | #ifdef CONFIG_SSB_PCIHOST | ||
| 1172 | err = pci_set_dma_mask(dev->bus->host_pci, mask); | 1176 | err = pci_set_dma_mask(dev->bus->host_pci, mask); |
| 1173 | if (err) | 1177 | if (err) |
| 1174 | return err; | 1178 | return err; |
| 1175 | err = pci_set_consistent_dma_mask(dev->bus->host_pci, mask); | 1179 | err = pci_set_consistent_dma_mask(dev->bus->host_pci, mask); |
| 1176 | return err; | 1180 | return err; |
| 1181 | #endif | ||
| 1177 | case SSB_BUSTYPE_SSB: | 1182 | case SSB_BUSTYPE_SSB: |
| 1178 | return dma_set_mask(dev->dev, mask); | 1183 | return dma_set_mask(dev->dev, mask); |
| 1179 | default: | 1184 | default: |
| @@ -1188,6 +1193,7 @@ void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size, | |||
| 1188 | { | 1193 | { |
| 1189 | switch (dev->bus->bustype) { | 1194 | switch (dev->bus->bustype) { |
| 1190 | case SSB_BUSTYPE_PCI: | 1195 | case SSB_BUSTYPE_PCI: |
| 1196 | #ifdef CONFIG_SSB_PCIHOST | ||
| 1191 | if (gfp_flags & GFP_DMA) { | 1197 | if (gfp_flags & GFP_DMA) { |
| 1192 | /* Workaround: The PCI API does not support passing | 1198 | /* Workaround: The PCI API does not support passing |
| 1193 | * a GFP flag. */ | 1199 | * a GFP flag. */ |
| @@ -1195,6 +1201,7 @@ void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size, | |||
| 1195 | size, dma_handle, gfp_flags); | 1201 | size, dma_handle, gfp_flags); |
| 1196 | } | 1202 | } |
| 1197 | return pci_alloc_consistent(dev->bus->host_pci, size, dma_handle); | 1203 | return pci_alloc_consistent(dev->bus->host_pci, size, dma_handle); |
| 1204 | #endif | ||
| 1198 | case SSB_BUSTYPE_SSB: | 1205 | case SSB_BUSTYPE_SSB: |
| 1199 | return dma_alloc_coherent(dev->dev, size, dma_handle, gfp_flags); | 1206 | return dma_alloc_coherent(dev->dev, size, dma_handle, gfp_flags); |
| 1200 | default: | 1207 | default: |
| @@ -1210,6 +1217,7 @@ void ssb_dma_free_consistent(struct ssb_device *dev, size_t size, | |||
| 1210 | { | 1217 | { |
| 1211 | switch (dev->bus->bustype) { | 1218 | switch (dev->bus->bustype) { |
| 1212 | case SSB_BUSTYPE_PCI: | 1219 | case SSB_BUSTYPE_PCI: |
| 1220 | #ifdef CONFIG_SSB_PCIHOST | ||
| 1213 | if (gfp_flags & GFP_DMA) { | 1221 | if (gfp_flags & GFP_DMA) { |
| 1214 | /* Workaround: The PCI API does not support passing | 1222 | /* Workaround: The PCI API does not support passing |
| 1215 | * a GFP flag. */ | 1223 | * a GFP flag. */ |
| @@ -1220,6 +1228,7 @@ void ssb_dma_free_consistent(struct ssb_device *dev, size_t size, | |||
| 1220 | pci_free_consistent(dev->bus->host_pci, size, | 1228 | pci_free_consistent(dev->bus->host_pci, size, |
| 1221 | vaddr, dma_handle); | 1229 | vaddr, dma_handle); |
| 1222 | return; | 1230 | return; |
| 1231 | #endif | ||
| 1223 | case SSB_BUSTYPE_SSB: | 1232 | case SSB_BUSTYPE_SSB: |
| 1224 | dma_free_coherent(dev->dev, size, vaddr, dma_handle); | 1233 | dma_free_coherent(dev->dev, size, vaddr, dma_handle); |
| 1225 | return; | 1234 | return; |
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 2e9079df26b3..4190be64917f 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig | |||
| @@ -33,6 +33,19 @@ config UIO_PDRV | |||
| 33 | 33 | ||
| 34 | If you don't know what to do here, say N. | 34 | If you don't know what to do here, say N. |
| 35 | 35 | ||
| 36 | config UIO_PDRV_GENIRQ | ||
| 37 | tristate "Userspace I/O platform driver with generic IRQ handling" | ||
| 38 | help | ||
| 39 | Platform driver for Userspace I/O devices, including generic | ||
| 40 | interrupt handling code. Shared interrupts are not supported. | ||
| 41 | |||
| 42 | This kernel driver requires that the matching userspace driver | ||
| 43 | handles interrupts in a special way. Userspace is responsible | ||
| 44 | for acknowledging the hardware device if needed, and re-enabling | ||
| 45 | interrupts in the interrupt controller using the write() syscall. | ||
| 46 | |||
| 47 | If you don't know what to do here, say N. | ||
| 48 | |||
| 36 | config UIO_SMX | 49 | config UIO_SMX |
| 37 | tristate "SMX cryptengine UIO interface" | 50 | tristate "SMX cryptengine UIO interface" |
| 38 | default n | 51 | default n |
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile index e00ce0def1a0..8667bbdef904 100644 --- a/drivers/uio/Makefile +++ b/drivers/uio/Makefile | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | obj-$(CONFIG_UIO) += uio.o | 1 | obj-$(CONFIG_UIO) += uio.o |
| 2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o | 2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o |
| 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o | 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o |
| 4 | obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o | ||
| 4 | obj-$(CONFIG_UIO_SMX) += uio_smx.o | 5 | obj-$(CONFIG_UIO_SMX) += uio_smx.o |
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c index 5d0d2e85d982..0b4ef39cd85d 100644 --- a/drivers/uio/uio_pdrv.c +++ b/drivers/uio/uio_pdrv.c | |||
| @@ -88,6 +88,8 @@ static int uio_pdrv_remove(struct platform_device *pdev) | |||
| 88 | 88 | ||
| 89 | uio_unregister_device(pdata->uioinfo); | 89 | uio_unregister_device(pdata->uioinfo); |
| 90 | 90 | ||
| 91 | kfree(pdata); | ||
| 92 | |||
| 91 | return 0; | 93 | return 0; |
| 92 | } | 94 | } |
| 93 | 95 | ||
| @@ -114,5 +116,5 @@ module_exit(uio_pdrv_exit); | |||
| 114 | 116 | ||
| 115 | MODULE_AUTHOR("Uwe Kleine-Koenig"); | 117 | MODULE_AUTHOR("Uwe Kleine-Koenig"); |
| 116 | MODULE_DESCRIPTION("Userspace I/O platform driver"); | 118 | MODULE_DESCRIPTION("Userspace I/O platform driver"); |
| 117 | MODULE_LICENSE("GPL"); | 119 | MODULE_LICENSE("GPL v2"); |
| 118 | MODULE_ALIAS("platform:" DRIVER_NAME); | 120 | MODULE_ALIAS("platform:" DRIVER_NAME); |
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c new file mode 100644 index 000000000000..1f82c83a92ae --- /dev/null +++ b/drivers/uio/uio_pdrv_genirq.c | |||
| @@ -0,0 +1,188 @@ | |||
| 1 | /* | ||
| 2 | * drivers/uio/uio_pdrv_genirq.c | ||
| 3 | * | ||
| 4 | * Userspace I/O platform driver with generic IRQ handling code. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2008 Magnus Damm | ||
| 7 | * | ||
| 8 | * Based on uio_pdrv.c by Uwe Kleine-Koenig, | ||
| 9 | * Copyright (C) 2008 by Digi International Inc. | ||
| 10 | * All rights reserved. | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify it | ||
| 13 | * under the terms of the GNU General Public License version 2 as published by | ||
| 14 | * the Free Software Foundation. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include <linux/platform_device.h> | ||
| 18 | #include <linux/uio_driver.h> | ||
| 19 | #include <linux/spinlock.h> | ||
| 20 | #include <linux/bitops.h> | ||
| 21 | #include <linux/interrupt.h> | ||
| 22 | #include <linux/stringify.h> | ||
| 23 | |||
| 24 | #define DRIVER_NAME "uio_pdrv_genirq" | ||
| 25 | |||
| 26 | struct uio_pdrv_genirq_platdata { | ||
| 27 | struct uio_info *uioinfo; | ||
| 28 | spinlock_t lock; | ||
| 29 | unsigned long flags; | ||
| 30 | }; | ||
| 31 | |||
| 32 | static irqreturn_t uio_pdrv_genirq_handler(int irq, struct uio_info *dev_info) | ||
| 33 | { | ||
| 34 | struct uio_pdrv_genirq_platdata *priv = dev_info->priv; | ||
| 35 | |||
| 36 | /* Just disable the interrupt in the interrupt controller, and | ||
| 37 | * remember the state so we can allow user space to enable it later. | ||
| 38 | */ | ||
| 39 | |||
| 40 | if (!test_and_set_bit(0, &priv->flags)) | ||
| 41 | disable_irq_nosync(irq); | ||
| 42 | |||
| 43 | return IRQ_HANDLED; | ||
| 44 | } | ||
| 45 | |||
| 46 | static int uio_pdrv_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on) | ||
| 47 | { | ||
| 48 | struct uio_pdrv_genirq_platdata *priv = dev_info->priv; | ||
| 49 | unsigned long flags; | ||
| 50 | |||
| 51 | /* Allow user space to enable and disable the interrupt | ||
| 52 | * in the interrupt controller, but keep track of the | ||
| 53 | * state to prevent per-irq depth damage. | ||
| 54 | * | ||
| 55 | * Serialize this operation to support multiple tasks. | ||
| 56 | */ | ||
| 57 | |||
| 58 | spin_lock_irqsave(&priv->lock, flags); | ||
| 59 | if (irq_on) { | ||
| 60 | if (test_and_clear_bit(0, &priv->flags)) | ||
| 61 | enable_irq(dev_info->irq); | ||
| 62 | } else { | ||
| 63 | if (!test_and_set_bit(0, &priv->flags)) | ||
| 64 | disable_irq(dev_info->irq); | ||
| 65 | } | ||
| 66 | spin_unlock_irqrestore(&priv->lock, flags); | ||
| 67 | |||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 71 | static int uio_pdrv_genirq_probe(struct platform_device *pdev) | ||
| 72 | { | ||
| 73 | struct uio_info *uioinfo = pdev->dev.platform_data; | ||
| 74 | struct uio_pdrv_genirq_platdata *priv; | ||
| 75 | struct uio_mem *uiomem; | ||
| 76 | int ret = -EINVAL; | ||
| 77 | int i; | ||
| 78 | |||
| 79 | if (!uioinfo || !uioinfo->name || !uioinfo->version) { | ||
| 80 | dev_err(&pdev->dev, "missing platform_data\n"); | ||
| 81 | goto bad0; | ||
| 82 | } | ||
| 83 | |||
| 84 | if (uioinfo->handler || uioinfo->irqcontrol || uioinfo->irq_flags) { | ||
| 85 | dev_err(&pdev->dev, "interrupt configuration error\n"); | ||
| 86 | goto bad0; | ||
| 87 | } | ||
| 88 | |||
| 89 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
| 90 | if (!priv) { | ||
| 91 | ret = -ENOMEM; | ||
| 92 | dev_err(&pdev->dev, "unable to kmalloc\n"); | ||
| 93 | goto bad0; | ||
| 94 | } | ||
| 95 | |||
| 96 | priv->uioinfo = uioinfo; | ||
| 97 | spin_lock_init(&priv->lock); | ||
| 98 | priv->flags = 0; /* interrupt is enabled to begin with */ | ||
| 99 | |||
| 100 | uiomem = &uioinfo->mem[0]; | ||
| 101 | |||
| 102 | for (i = 0; i < pdev->num_resources; ++i) { | ||
| 103 | struct resource *r = &pdev->resource[i]; | ||
| 104 | |||
| 105 | if (r->flags != IORESOURCE_MEM) | ||
| 106 | continue; | ||
| 107 | |||
| 108 | if (uiomem >= &uioinfo->mem[MAX_UIO_MAPS]) { | ||
| 109 | dev_warn(&pdev->dev, "device has more than " | ||
| 110 | __stringify(MAX_UIO_MAPS) | ||
| 111 | " I/O memory resources.\n"); | ||
| 112 | break; | ||
| 113 | } | ||
| 114 | |||
| 115 | uiomem->memtype = UIO_MEM_PHYS; | ||
| 116 | uiomem->addr = r->start; | ||
| 117 | uiomem->size = r->end - r->start + 1; | ||
| 118 | ++uiomem; | ||
| 119 | } | ||
| 120 | |||
| 121 | while (uiomem < &uioinfo->mem[MAX_UIO_MAPS]) { | ||
| 122 | uiomem->size = 0; | ||
| 123 | ++uiomem; | ||
| 124 | } | ||
| 125 | |||
| 126 | /* This driver requires no hardware specific kernel code to handle | ||
| 127 | * interrupts. Instead, the interrupt handler simply disables the | ||
| 128 | * interrupt in the interrupt controller. User space is responsible | ||
| 129 | * for performing hardware specific acknowledge and re-enabling of | ||
| 130 | * the interrupt in the interrupt controller. | ||
| 131 | * | ||
| 132 | * Interrupt sharing is not supported. | ||
| 133 | */ | ||
| 134 | |||
| 135 | uioinfo->irq_flags = IRQF_DISABLED; | ||
| 136 | uioinfo->handler = uio_pdrv_genirq_handler; | ||
| 137 | uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol; | ||
| 138 | uioinfo->priv = priv; | ||
| 139 | |||
| 140 | ret = uio_register_device(&pdev->dev, priv->uioinfo); | ||
| 141 | if (ret) { | ||
| 142 | dev_err(&pdev->dev, "unable to register uio device\n"); | ||
| 143 | goto bad1; | ||
| 144 | } | ||
| 145 | |||
| 146 | platform_set_drvdata(pdev, priv); | ||
| 147 | return 0; | ||
| 148 | bad1: | ||
| 149 | kfree(priv); | ||
| 150 | bad0: | ||
| 151 | return ret; | ||
| 152 | } | ||
| 153 | |||
| 154 | static int uio_pdrv_genirq_remove(struct platform_device *pdev) | ||
| 155 | { | ||
| 156 | struct uio_pdrv_genirq_platdata *priv = platform_get_drvdata(pdev); | ||
| 157 | |||
| 158 | uio_unregister_device(priv->uioinfo); | ||
| 159 | kfree(priv); | ||
| 160 | return 0; | ||
| 161 | } | ||
| 162 | |||
| 163 | static struct platform_driver uio_pdrv_genirq = { | ||
| 164 | .probe = uio_pdrv_genirq_probe, | ||
| 165 | .remove = uio_pdrv_genirq_remove, | ||
| 166 | .driver = { | ||
| 167 | .name = DRIVER_NAME, | ||
| 168 | .owner = THIS_MODULE, | ||
| 169 | }, | ||
| 170 | }; | ||
| 171 | |||
| 172 | static int __init uio_pdrv_genirq_init(void) | ||
| 173 | { | ||
| 174 | return platform_driver_register(&uio_pdrv_genirq); | ||
| 175 | } | ||
| 176 | |||
| 177 | static void __exit uio_pdrv_genirq_exit(void) | ||
| 178 | { | ||
| 179 | platform_driver_unregister(&uio_pdrv_genirq); | ||
| 180 | } | ||
| 181 | |||
| 182 | module_init(uio_pdrv_genirq_init); | ||
| 183 | module_exit(uio_pdrv_genirq_exit); | ||
| 184 | |||
| 185 | MODULE_AUTHOR("Magnus Damm"); | ||
| 186 | MODULE_DESCRIPTION("Userspace I/O platform driver with generic IRQ handling"); | ||
| 187 | MODULE_LICENSE("GPL v2"); | ||
| 188 | MODULE_ALIAS("platform:" DRIVER_NAME); | ||
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index cb01b5106efd..b6483dd98acc 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
| @@ -64,7 +64,6 @@ | |||
| 64 | #include <linux/ctype.h> | 64 | #include <linux/ctype.h> |
| 65 | #include <linux/sched.h> | 65 | #include <linux/sched.h> |
| 66 | #include <linux/kthread.h> | 66 | #include <linux/kthread.h> |
| 67 | #include <linux/version.h> | ||
| 68 | #include <linux/mutex.h> | 67 | #include <linux/mutex.h> |
| 69 | #include <linux/freezer.h> | 68 | #include <linux/freezer.h> |
| 70 | 69 | ||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index efc4373ededb..c257453fa9de 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -589,8 +589,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) | |||
| 589 | tasklet_schedule(&acm->urb_task); | 589 | tasklet_schedule(&acm->urb_task); |
| 590 | 590 | ||
| 591 | done: | 591 | done: |
| 592 | err_out: | ||
| 593 | mutex_unlock(&acm->mutex); | 592 | mutex_unlock(&acm->mutex); |
| 593 | err_out: | ||
| 594 | mutex_unlock(&open_mutex); | 594 | mutex_unlock(&open_mutex); |
| 595 | return rv; | 595 | return rv; |
| 596 | 596 | ||
| @@ -1362,6 +1362,9 @@ static struct usb_device_id acm_ids[] = { | |||
| 1362 | { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */ | 1362 | { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */ |
| 1363 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 1363 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
| 1364 | }, | 1364 | }, |
| 1365 | { USB_DEVICE(0x0572, 0x1321), /* Conexant USB MODEM CX93010 */ | ||
| 1366 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | ||
| 1367 | }, | ||
| 1365 | 1368 | ||
| 1366 | /* control interfaces with various AT-command sets */ | 1369 | /* control interfaces with various AT-command sets */ |
| 1367 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, | 1370 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 2be37fe466f2..5a7fa6f09958 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
| @@ -230,6 +230,13 @@ static int usb_probe_interface(struct device *dev) | |||
| 230 | */ | 230 | */ |
| 231 | intf->pm_usage_cnt = !(driver->supports_autosuspend); | 231 | intf->pm_usage_cnt = !(driver->supports_autosuspend); |
| 232 | 232 | ||
| 233 | /* Carry out a deferred switch to altsetting 0 */ | ||
| 234 | if (intf->needs_altsetting0) { | ||
| 235 | usb_set_interface(udev, intf->altsetting[0]. | ||
| 236 | desc.bInterfaceNumber, 0); | ||
| 237 | intf->needs_altsetting0 = 0; | ||
| 238 | } | ||
| 239 | |||
| 233 | error = driver->probe(intf, id); | 240 | error = driver->probe(intf, id); |
| 234 | if (error) { | 241 | if (error) { |
| 235 | mark_quiesced(intf); | 242 | mark_quiesced(intf); |
| @@ -266,8 +273,17 @@ static int usb_unbind_interface(struct device *dev) | |||
| 266 | 273 | ||
| 267 | driver->disconnect(intf); | 274 | driver->disconnect(intf); |
| 268 | 275 | ||
| 269 | /* reset other interface state */ | 276 | /* Reset other interface state. |
| 270 | usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0); | 277 | * We cannot do a Set-Interface if the device is suspended or |
| 278 | * if it is prepared for a system sleep (since installing a new | ||
| 279 | * altsetting means creating new endpoint device entries). | ||
| 280 | * When either of these happens, defer the Set-Interface. | ||
| 281 | */ | ||
| 282 | if (!error && intf->dev.power.status == DPM_ON) | ||
| 283 | usb_set_interface(udev, intf->altsetting[0]. | ||
| 284 | desc.bInterfaceNumber, 0); | ||
| 285 | else | ||
| 286 | intf->needs_altsetting0 = 1; | ||
| 271 | usb_set_intfdata(intf, NULL); | 287 | usb_set_intfdata(intf, NULL); |
| 272 | 288 | ||
| 273 | intf->condition = USB_INTERFACE_UNBOUND; | 289 | intf->condition = USB_INTERFACE_UNBOUND; |
| @@ -798,7 +814,8 @@ void usb_forced_unbind_intf(struct usb_interface *intf) | |||
| 798 | * The caller must hold @intf's device's lock, but not its pm_mutex | 814 | * The caller must hold @intf's device's lock, but not its pm_mutex |
| 799 | * and not @intf->dev.sem. | 815 | * and not @intf->dev.sem. |
| 800 | * | 816 | * |
| 801 | * FIXME: The caller must block system sleep transitions. | 817 | * Note: Rebinds will be skipped if a system sleep transition is in |
| 818 | * progress and the PM "complete" callback hasn't occurred yet. | ||
| 802 | */ | 819 | */ |
| 803 | void usb_rebind_intf(struct usb_interface *intf) | 820 | void usb_rebind_intf(struct usb_interface *intf) |
| 804 | { | 821 | { |
| @@ -814,10 +831,12 @@ void usb_rebind_intf(struct usb_interface *intf) | |||
| 814 | } | 831 | } |
| 815 | 832 | ||
| 816 | /* Try to rebind the interface */ | 833 | /* Try to rebind the interface */ |
| 817 | intf->needs_binding = 0; | 834 | if (intf->dev.power.status == DPM_ON) { |
| 818 | rc = device_attach(&intf->dev); | 835 | intf->needs_binding = 0; |
| 819 | if (rc < 0) | 836 | rc = device_attach(&intf->dev); |
| 820 | dev_warn(&intf->dev, "rebind failed: %d\n", rc); | 837 | if (rc < 0) |
| 838 | dev_warn(&intf->dev, "rebind failed: %d\n", rc); | ||
| 839 | } | ||
| 821 | } | 840 | } |
| 822 | 841 | ||
| 823 | #ifdef CONFIG_PM | 842 | #ifdef CONFIG_PM |
| @@ -829,7 +848,6 @@ void usb_rebind_intf(struct usb_interface *intf) | |||
| 829 | * or rebind interfaces that have been unbound, according to @action. | 848 | * or rebind interfaces that have been unbound, according to @action. |
| 830 | * | 849 | * |
| 831 | * The caller must hold @udev's device lock. | 850 | * The caller must hold @udev's device lock. |
| 832 | * FIXME: For rebinds, the caller must block system sleep transitions. | ||
| 833 | */ | 851 | */ |
| 834 | static void do_unbind_rebind(struct usb_device *udev, int action) | 852 | static void do_unbind_rebind(struct usb_device *udev, int action) |
| 835 | { | 853 | { |
| @@ -851,22 +869,8 @@ static void do_unbind_rebind(struct usb_device *udev, int action) | |||
| 851 | } | 869 | } |
| 852 | break; | 870 | break; |
| 853 | case DO_REBIND: | 871 | case DO_REBIND: |
| 854 | if (intf->needs_binding) { | 872 | if (intf->needs_binding) |
| 855 | |||
| 856 | /* FIXME: The next line is needed because we are going to probe | ||
| 857 | * the interface, but as far as the PM core is concerned the | ||
| 858 | * interface is still suspended. The problem wouldn't exist | ||
| 859 | * if we could rebind the interface during the interface's own | ||
| 860 | * resume() call, but at the time the usb_device isn't locked! | ||
| 861 | * | ||
| 862 | * The real solution will be to carry this out during the device's | ||
| 863 | * complete() callback. Until that is implemented, we have to | ||
| 864 | * use this hack. | ||
| 865 | */ | ||
| 866 | // intf->dev.power.sleeping = 0; | ||
| 867 | |||
| 868 | usb_rebind_intf(intf); | 873 | usb_rebind_intf(intf); |
| 869 | } | ||
| 870 | break; | 874 | break; |
| 871 | } | 875 | } |
| 872 | } | 876 | } |
| @@ -926,14 +930,14 @@ static int usb_resume_device(struct usb_device *udev) | |||
| 926 | } | 930 | } |
| 927 | 931 | ||
| 928 | /* Caller has locked intf's usb_device's pm mutex */ | 932 | /* Caller has locked intf's usb_device's pm mutex */ |
| 929 | static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) | 933 | static int usb_suspend_interface(struct usb_device *udev, |
| 934 | struct usb_interface *intf, pm_message_t msg) | ||
| 930 | { | 935 | { |
| 931 | struct usb_driver *driver; | 936 | struct usb_driver *driver; |
| 932 | int status = 0; | 937 | int status = 0; |
| 933 | 938 | ||
| 934 | /* with no hardware, USB interfaces only use FREEZE and ON states */ | 939 | /* with no hardware, USB interfaces only use FREEZE and ON states */ |
| 935 | if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || | 940 | if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf)) |
| 936 | !is_active(intf)) | ||
| 937 | goto done; | 941 | goto done; |
| 938 | 942 | ||
| 939 | if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ | 943 | if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ |
| @@ -944,7 +948,7 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) | |||
| 944 | status = driver->suspend(intf, msg); | 948 | status = driver->suspend(intf, msg); |
| 945 | if (status == 0) | 949 | if (status == 0) |
| 946 | mark_quiesced(intf); | 950 | mark_quiesced(intf); |
| 947 | else if (!interface_to_usbdev(intf)->auto_pm) | 951 | else if (!udev->auto_pm) |
| 948 | dev_err(&intf->dev, "%s error %d\n", | 952 | dev_err(&intf->dev, "%s error %d\n", |
| 949 | "suspend", status); | 953 | "suspend", status); |
| 950 | } else { | 954 | } else { |
| @@ -961,13 +965,13 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) | |||
| 961 | } | 965 | } |
| 962 | 966 | ||
| 963 | /* Caller has locked intf's usb_device's pm_mutex */ | 967 | /* Caller has locked intf's usb_device's pm_mutex */ |
| 964 | static int usb_resume_interface(struct usb_interface *intf, int reset_resume) | 968 | static int usb_resume_interface(struct usb_device *udev, |
| 969 | struct usb_interface *intf, int reset_resume) | ||
| 965 | { | 970 | { |
| 966 | struct usb_driver *driver; | 971 | struct usb_driver *driver; |
| 967 | int status = 0; | 972 | int status = 0; |
| 968 | 973 | ||
| 969 | if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || | 974 | if (udev->state == USB_STATE_NOTATTACHED || is_active(intf)) |
| 970 | is_active(intf)) | ||
| 971 | goto done; | 975 | goto done; |
| 972 | 976 | ||
| 973 | /* Don't let autoresume interfere with unbinding */ | 977 | /* Don't let autoresume interfere with unbinding */ |
| @@ -975,8 +979,17 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume) | |||
| 975 | goto done; | 979 | goto done; |
| 976 | 980 | ||
| 977 | /* Can't resume it if it doesn't have a driver. */ | 981 | /* Can't resume it if it doesn't have a driver. */ |
| 978 | if (intf->condition == USB_INTERFACE_UNBOUND) | 982 | if (intf->condition == USB_INTERFACE_UNBOUND) { |
| 983 | |||
| 984 | /* Carry out a deferred switch to altsetting 0 */ | ||
| 985 | if (intf->needs_altsetting0 && | ||
| 986 | intf->dev.power.status == DPM_ON) { | ||
| 987 | usb_set_interface(udev, intf->altsetting[0]. | ||
| 988 | desc.bInterfaceNumber, 0); | ||
| 989 | intf->needs_altsetting0 = 0; | ||
| 990 | } | ||
| 979 | goto done; | 991 | goto done; |
| 992 | } | ||
| 980 | 993 | ||
| 981 | /* Don't resume if the interface is marked for rebinding */ | 994 | /* Don't resume if the interface is marked for rebinding */ |
| 982 | if (intf->needs_binding) | 995 | if (intf->needs_binding) |
| @@ -1151,7 +1164,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
| 1151 | if (udev->actconfig) { | 1164 | if (udev->actconfig) { |
| 1152 | for (; i < udev->actconfig->desc.bNumInterfaces; i++) { | 1165 | for (; i < udev->actconfig->desc.bNumInterfaces; i++) { |
| 1153 | intf = udev->actconfig->interface[i]; | 1166 | intf = udev->actconfig->interface[i]; |
| 1154 | status = usb_suspend_interface(intf, msg); | 1167 | status = usb_suspend_interface(udev, intf, msg); |
| 1155 | if (status != 0) | 1168 | if (status != 0) |
| 1156 | break; | 1169 | break; |
| 1157 | } | 1170 | } |
| @@ -1163,7 +1176,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
| 1163 | if (status != 0) { | 1176 | if (status != 0) { |
| 1164 | while (--i >= 0) { | 1177 | while (--i >= 0) { |
| 1165 | intf = udev->actconfig->interface[i]; | 1178 | intf = udev->actconfig->interface[i]; |
| 1166 | usb_resume_interface(intf, 0); | 1179 | usb_resume_interface(udev, intf, 0); |
| 1167 | } | 1180 | } |
| 1168 | 1181 | ||
| 1169 | /* Try another autosuspend when the interfaces aren't busy */ | 1182 | /* Try another autosuspend when the interfaces aren't busy */ |
| @@ -1276,7 +1289,7 @@ static int usb_resume_both(struct usb_device *udev) | |||
| 1276 | if (status == 0 && udev->actconfig) { | 1289 | if (status == 0 && udev->actconfig) { |
| 1277 | for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { | 1290 | for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { |
| 1278 | intf = udev->actconfig->interface[i]; | 1291 | intf = udev->actconfig->interface[i]; |
| 1279 | usb_resume_interface(intf, udev->reset_resume); | 1292 | usb_resume_interface(udev, intf, udev->reset_resume); |
| 1280 | } | 1293 | } |
| 1281 | } | 1294 | } |
| 1282 | 1295 | ||
| @@ -1605,12 +1618,10 @@ int usb_external_resume_device(struct usb_device *udev) | |||
| 1605 | return status; | 1618 | return status; |
| 1606 | } | 1619 | } |
| 1607 | 1620 | ||
| 1608 | static int usb_suspend(struct device *dev, pm_message_t message) | 1621 | int usb_suspend(struct device *dev, pm_message_t message) |
| 1609 | { | 1622 | { |
| 1610 | struct usb_device *udev; | 1623 | struct usb_device *udev; |
| 1611 | 1624 | ||
| 1612 | if (!is_usb_device(dev)) /* Ignore PM for interfaces */ | ||
| 1613 | return 0; | ||
| 1614 | udev = to_usb_device(dev); | 1625 | udev = to_usb_device(dev); |
| 1615 | 1626 | ||
| 1616 | /* If udev is already suspended, we can skip this suspend and | 1627 | /* If udev is already suspended, we can skip this suspend and |
| @@ -1629,12 +1640,10 @@ static int usb_suspend(struct device *dev, pm_message_t message) | |||
| 1629 | return usb_external_suspend_device(udev, message); | 1640 | return usb_external_suspend_device(udev, message); |
| 1630 | } | 1641 | } |
| 1631 | 1642 | ||
| 1632 | static int usb_resume(struct device *dev) | 1643 | int usb_resume(struct device *dev) |
| 1633 | { | 1644 | { |
| 1634 | struct usb_device *udev; | 1645 | struct usb_device *udev; |
| 1635 | 1646 | ||
| 1636 | if (!is_usb_device(dev)) /* Ignore PM for interfaces */ | ||
| 1637 | return 0; | ||
| 1638 | udev = to_usb_device(dev); | 1647 | udev = to_usb_device(dev); |
| 1639 | 1648 | ||
| 1640 | /* If udev->skip_sys_resume is set then udev was already suspended | 1649 | /* If udev->skip_sys_resume is set then udev was already suspended |
| @@ -1646,17 +1655,10 @@ static int usb_resume(struct device *dev) | |||
| 1646 | return usb_external_resume_device(udev); | 1655 | return usb_external_resume_device(udev); |
| 1647 | } | 1656 | } |
| 1648 | 1657 | ||
| 1649 | #else | ||
| 1650 | |||
| 1651 | #define usb_suspend NULL | ||
| 1652 | #define usb_resume NULL | ||
| 1653 | |||
| 1654 | #endif /* CONFIG_PM */ | 1658 | #endif /* CONFIG_PM */ |
| 1655 | 1659 | ||
| 1656 | struct bus_type usb_bus_type = { | 1660 | struct bus_type usb_bus_type = { |
| 1657 | .name = "usb", | 1661 | .name = "usb", |
| 1658 | .match = usb_device_match, | 1662 | .match = usb_device_match, |
| 1659 | .uevent = usb_uevent, | 1663 | .uevent = usb_uevent, |
| 1660 | .suspend = usb_suspend, | ||
| 1661 | .resume = usb_resume, | ||
| 1662 | }; | 1664 | }; |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index f7bfd72ef115..8ab389dca2b9 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -924,15 +924,6 @@ static int register_root_hub(struct usb_hcd *hcd) | |||
| 924 | return retval; | 924 | return retval; |
| 925 | } | 925 | } |
| 926 | 926 | ||
| 927 | void usb_enable_root_hub_irq (struct usb_bus *bus) | ||
| 928 | { | ||
| 929 | struct usb_hcd *hcd; | ||
| 930 | |||
| 931 | hcd = container_of (bus, struct usb_hcd, self); | ||
| 932 | if (hcd->driver->hub_irq_enable && hcd->state != HC_STATE_HALT) | ||
| 933 | hcd->driver->hub_irq_enable (hcd); | ||
| 934 | } | ||
| 935 | |||
| 936 | 927 | ||
| 937 | /*-------------------------------------------------------------------------*/ | 928 | /*-------------------------------------------------------------------------*/ |
| 938 | 929 | ||
| @@ -1885,7 +1876,8 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
| 1885 | * with IRQF_SHARED. As usb_hcd_irq() will always disable | 1876 | * with IRQF_SHARED. As usb_hcd_irq() will always disable |
| 1886 | * interrupts we can remove it here. | 1877 | * interrupts we can remove it here. |
| 1887 | */ | 1878 | */ |
| 1888 | irqflags &= ~IRQF_DISABLED; | 1879 | if (irqflags & IRQF_SHARED) |
| 1880 | irqflags &= ~IRQF_DISABLED; | ||
| 1889 | 1881 | ||
| 1890 | snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d", | 1882 | snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d", |
| 1891 | hcd->driver->description, hcd->self.busnum); | 1883 | hcd->driver->description, hcd->self.busnum); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 5b0b59b0d89b..e710ce04e228 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
| @@ -212,8 +212,6 @@ struct hc_driver { | |||
| 212 | int (*bus_suspend)(struct usb_hcd *); | 212 | int (*bus_suspend)(struct usb_hcd *); |
| 213 | int (*bus_resume)(struct usb_hcd *); | 213 | int (*bus_resume)(struct usb_hcd *); |
| 214 | int (*start_port_reset)(struct usb_hcd *, unsigned port_num); | 214 | int (*start_port_reset)(struct usb_hcd *, unsigned port_num); |
| 215 | void (*hub_irq_enable)(struct usb_hcd *); | ||
| 216 | /* Needed only if port-change IRQs are level-triggered */ | ||
| 217 | 215 | ||
| 218 | /* force handover of high-speed port to full-speed companion */ | 216 | /* force handover of high-speed port to full-speed companion */ |
| 219 | void (*relinquish_port)(struct usb_hcd *, int); | 217 | void (*relinquish_port)(struct usb_hcd *, int); |
| @@ -379,8 +377,6 @@ extern struct list_head usb_bus_list; | |||
| 379 | extern struct mutex usb_bus_list_lock; | 377 | extern struct mutex usb_bus_list_lock; |
| 380 | extern wait_queue_head_t usb_kill_urb_queue; | 378 | extern wait_queue_head_t usb_kill_urb_queue; |
| 381 | 379 | ||
| 382 | extern void usb_enable_root_hub_irq(struct usb_bus *bus); | ||
| 383 | |||
| 384 | extern int usb_find_interface_driver(struct usb_device *dev, | 380 | extern int usb_find_interface_driver(struct usb_device *dev, |
| 385 | struct usb_interface *interface); | 381 | struct usb_interface *interface); |
| 386 | 382 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 107e1d25ddec..d99963873e37 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -2102,8 +2102,6 @@ int usb_port_resume(struct usb_device *udev) | |||
| 2102 | } | 2102 | } |
| 2103 | 2103 | ||
| 2104 | clear_bit(port1, hub->busy_bits); | 2104 | clear_bit(port1, hub->busy_bits); |
| 2105 | if (!hub->hdev->parent && !hub->busy_bits[0]) | ||
| 2106 | usb_enable_root_hub_irq(hub->hdev->bus); | ||
| 2107 | 2105 | ||
| 2108 | status = check_port_resume_type(udev, | 2106 | status = check_port_resume_type(udev, |
| 2109 | hub, port1, status, portchange, portstatus); | 2107 | hub, port1, status, portchange, portstatus); |
| @@ -2685,35 +2683,17 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
| 2685 | USB_PORT_STAT_C_ENABLE); | 2683 | USB_PORT_STAT_C_ENABLE); |
| 2686 | #endif | 2684 | #endif |
| 2687 | 2685 | ||
| 2688 | /* Try to use the debounce delay for protection against | ||
| 2689 | * port-enable changes caused, for example, by EMI. | ||
| 2690 | */ | ||
| 2691 | if (portchange & (USB_PORT_STAT_C_CONNECTION | | ||
| 2692 | USB_PORT_STAT_C_ENABLE)) { | ||
| 2693 | status = hub_port_debounce(hub, port1); | ||
| 2694 | if (status < 0) { | ||
| 2695 | if (printk_ratelimit()) | ||
| 2696 | dev_err (hub_dev, "connect-debounce failed, " | ||
| 2697 | "port %d disabled\n", port1); | ||
| 2698 | portstatus &= ~USB_PORT_STAT_CONNECTION; | ||
| 2699 | } else { | ||
| 2700 | portstatus = status; | ||
| 2701 | } | ||
| 2702 | } | ||
| 2703 | |||
| 2704 | /* Try to resuscitate an existing device */ | 2686 | /* Try to resuscitate an existing device */ |
| 2705 | udev = hdev->children[port1-1]; | 2687 | udev = hdev->children[port1-1]; |
| 2706 | if ((portstatus & USB_PORT_STAT_CONNECTION) && udev && | 2688 | if ((portstatus & USB_PORT_STAT_CONNECTION) && udev && |
| 2707 | udev->state != USB_STATE_NOTATTACHED) { | 2689 | udev->state != USB_STATE_NOTATTACHED) { |
| 2708 | |||
| 2709 | usb_lock_device(udev); | 2690 | usb_lock_device(udev); |
| 2710 | if (portstatus & USB_PORT_STAT_ENABLE) { | 2691 | if (portstatus & USB_PORT_STAT_ENABLE) { |
| 2711 | status = 0; /* Nothing to do */ | 2692 | status = 0; /* Nothing to do */ |
| 2712 | } else if (!udev->persist_enabled) { | ||
| 2713 | status = -ENODEV; /* Mustn't resuscitate */ | ||
| 2714 | 2693 | ||
| 2715 | #ifdef CONFIG_USB_SUSPEND | 2694 | #ifdef CONFIG_USB_SUSPEND |
| 2716 | } else if (udev->state == USB_STATE_SUSPENDED) { | 2695 | } else if (udev->state == USB_STATE_SUSPENDED && |
| 2696 | udev->persist_enabled) { | ||
| 2717 | /* For a suspended device, treat this as a | 2697 | /* For a suspended device, treat this as a |
| 2718 | * remote wakeup event. | 2698 | * remote wakeup event. |
| 2719 | */ | 2699 | */ |
| @@ -2728,7 +2708,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
| 2728 | #endif | 2708 | #endif |
| 2729 | 2709 | ||
| 2730 | } else { | 2710 | } else { |
| 2731 | status = usb_reset_device(udev); | 2711 | status = -ENODEV; /* Don't resuscitate */ |
| 2732 | } | 2712 | } |
| 2733 | usb_unlock_device(udev); | 2713 | usb_unlock_device(udev); |
| 2734 | 2714 | ||
| @@ -2743,6 +2723,19 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
| 2743 | usb_disconnect(&hdev->children[port1-1]); | 2723 | usb_disconnect(&hdev->children[port1-1]); |
| 2744 | clear_bit(port1, hub->change_bits); | 2724 | clear_bit(port1, hub->change_bits); |
| 2745 | 2725 | ||
| 2726 | if (portchange & (USB_PORT_STAT_C_CONNECTION | | ||
| 2727 | USB_PORT_STAT_C_ENABLE)) { | ||
| 2728 | status = hub_port_debounce(hub, port1); | ||
| 2729 | if (status < 0) { | ||
| 2730 | if (printk_ratelimit()) | ||
| 2731 | dev_err(hub_dev, "connect-debounce failed, " | ||
| 2732 | "port %d disabled\n", port1); | ||
| 2733 | portstatus &= ~USB_PORT_STAT_CONNECTION; | ||
| 2734 | } else { | ||
| 2735 | portstatus = status; | ||
| 2736 | } | ||
| 2737 | } | ||
| 2738 | |||
| 2746 | /* Return now if debouncing failed or nothing is connected */ | 2739 | /* Return now if debouncing failed or nothing is connected */ |
| 2747 | if (!(portstatus & USB_PORT_STAT_CONNECTION)) { | 2740 | if (!(portstatus & USB_PORT_STAT_CONNECTION)) { |
| 2748 | 2741 | ||
| @@ -2750,7 +2743,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
| 2750 | if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2 | 2743 | if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2 |
| 2751 | && !(portstatus & (1 << USB_PORT_FEAT_POWER))) | 2744 | && !(portstatus & (1 << USB_PORT_FEAT_POWER))) |
| 2752 | set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); | 2745 | set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); |
| 2753 | 2746 | ||
| 2754 | if (portstatus & USB_PORT_STAT_ENABLE) | 2747 | if (portstatus & USB_PORT_STAT_ENABLE) |
| 2755 | goto done; | 2748 | goto done; |
| 2756 | return; | 2749 | return; |
| @@ -3081,11 +3074,6 @@ static void hub_events(void) | |||
| 3081 | } | 3074 | } |
| 3082 | } | 3075 | } |
| 3083 | 3076 | ||
| 3084 | /* If this is a root hub, tell the HCD it's okay to | ||
| 3085 | * re-enable port-change interrupts now. */ | ||
| 3086 | if (!hdev->parent && !hub->busy_bits[0]) | ||
| 3087 | usb_enable_root_hub_irq(hdev->bus); | ||
| 3088 | |||
| 3089 | loop_autopm: | 3077 | loop_autopm: |
| 3090 | /* Allow autosuspend if we're not going to run again */ | 3078 | /* Allow autosuspend if we're not going to run again */ |
| 3091 | if (list_empty(&hub->event_list)) | 3079 | if (list_empty(&hub->event_list)) |
| @@ -3311,8 +3299,6 @@ static int usb_reset_and_verify_device(struct usb_device *udev) | |||
| 3311 | break; | 3299 | break; |
| 3312 | } | 3300 | } |
| 3313 | clear_bit(port1, parent_hub->busy_bits); | 3301 | clear_bit(port1, parent_hub->busy_bits); |
| 3314 | if (!parent_hdev->parent && !parent_hub->busy_bits[0]) | ||
| 3315 | usb_enable_root_hub_irq(parent_hdev->bus); | ||
| 3316 | 3302 | ||
| 3317 | if (ret < 0) | 3303 | if (ret < 0) |
| 3318 | goto re_enumerate; | 3304 | goto re_enumerate; |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index c0b1ae25ae2a..47111e88f791 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
| @@ -601,15 +601,20 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs); | |||
| 601 | void usb_unlink_anchored_urbs(struct usb_anchor *anchor) | 601 | void usb_unlink_anchored_urbs(struct usb_anchor *anchor) |
| 602 | { | 602 | { |
| 603 | struct urb *victim; | 603 | struct urb *victim; |
| 604 | unsigned long flags; | ||
| 604 | 605 | ||
| 605 | spin_lock_irq(&anchor->lock); | 606 | spin_lock_irqsave(&anchor->lock, flags); |
| 606 | while (!list_empty(&anchor->urb_list)) { | 607 | while (!list_empty(&anchor->urb_list)) { |
| 607 | victim = list_entry(anchor->urb_list.prev, struct urb, | 608 | victim = list_entry(anchor->urb_list.prev, struct urb, |
| 608 | anchor_list); | 609 | anchor_list); |
| 610 | usb_get_urb(victim); | ||
| 611 | spin_unlock_irqrestore(&anchor->lock, flags); | ||
| 609 | /* this will unanchor the URB */ | 612 | /* this will unanchor the URB */ |
| 610 | usb_unlink_urb(victim); | 613 | usb_unlink_urb(victim); |
| 614 | usb_put_urb(victim); | ||
| 615 | spin_lock_irqsave(&anchor->lock, flags); | ||
| 611 | } | 616 | } |
| 612 | spin_unlock_irq(&anchor->lock); | 617 | spin_unlock_irqrestore(&anchor->lock, flags); |
| 613 | } | 618 | } |
| 614 | EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); | 619 | EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); |
| 615 | 620 | ||
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 84fcaa6a21ec..be1fa0723f2c 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
| @@ -219,12 +219,6 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 219 | } | 219 | } |
| 220 | #endif /* CONFIG_HOTPLUG */ | 220 | #endif /* CONFIG_HOTPLUG */ |
| 221 | 221 | ||
| 222 | struct device_type usb_device_type = { | ||
| 223 | .name = "usb_device", | ||
| 224 | .release = usb_release_dev, | ||
| 225 | .uevent = usb_dev_uevent, | ||
| 226 | }; | ||
| 227 | |||
| 228 | #ifdef CONFIG_PM | 222 | #ifdef CONFIG_PM |
| 229 | 223 | ||
| 230 | static int ksuspend_usb_init(void) | 224 | static int ksuspend_usb_init(void) |
| @@ -244,13 +238,80 @@ static void ksuspend_usb_cleanup(void) | |||
| 244 | destroy_workqueue(ksuspend_usb_wq); | 238 | destroy_workqueue(ksuspend_usb_wq); |
| 245 | } | 239 | } |
| 246 | 240 | ||
| 241 | /* USB device Power-Management thunks. | ||
| 242 | * There's no need to distinguish here between quiescing a USB device | ||
| 243 | * and powering it down; the generic_suspend() routine takes care of | ||
| 244 | * it by skipping the usb_port_suspend() call for a quiesce. And for | ||
| 245 | * USB interfaces there's no difference at all. | ||
| 246 | */ | ||
| 247 | |||
| 248 | static int usb_dev_prepare(struct device *dev) | ||
| 249 | { | ||
| 250 | return 0; /* Implement eventually? */ | ||
| 251 | } | ||
| 252 | |||
| 253 | static void usb_dev_complete(struct device *dev) | ||
| 254 | { | ||
| 255 | /* Currently used only for rebinding interfaces */ | ||
| 256 | usb_resume(dev); /* Implement eventually? */ | ||
| 257 | } | ||
| 258 | |||
| 259 | static int usb_dev_suspend(struct device *dev) | ||
| 260 | { | ||
| 261 | return usb_suspend(dev, PMSG_SUSPEND); | ||
| 262 | } | ||
| 263 | |||
| 264 | static int usb_dev_resume(struct device *dev) | ||
| 265 | { | ||
| 266 | return usb_resume(dev); | ||
| 267 | } | ||
| 268 | |||
| 269 | static int usb_dev_freeze(struct device *dev) | ||
| 270 | { | ||
| 271 | return usb_suspend(dev, PMSG_FREEZE); | ||
| 272 | } | ||
| 273 | |||
| 274 | static int usb_dev_thaw(struct device *dev) | ||
| 275 | { | ||
| 276 | return usb_resume(dev); | ||
| 277 | } | ||
| 278 | |||
| 279 | static int usb_dev_poweroff(struct device *dev) | ||
| 280 | { | ||
| 281 | return usb_suspend(dev, PMSG_HIBERNATE); | ||
| 282 | } | ||
| 283 | |||
| 284 | static int usb_dev_restore(struct device *dev) | ||
| 285 | { | ||
| 286 | return usb_resume(dev); | ||
| 287 | } | ||
| 288 | |||
| 289 | static struct pm_ops usb_device_pm_ops = { | ||
| 290 | .prepare = usb_dev_prepare, | ||
| 291 | .complete = usb_dev_complete, | ||
| 292 | .suspend = usb_dev_suspend, | ||
| 293 | .resume = usb_dev_resume, | ||
| 294 | .freeze = usb_dev_freeze, | ||
| 295 | .thaw = usb_dev_thaw, | ||
| 296 | .poweroff = usb_dev_poweroff, | ||
| 297 | .restore = usb_dev_restore, | ||
| 298 | }; | ||
| 299 | |||
| 247 | #else | 300 | #else |
| 248 | 301 | ||
| 249 | #define ksuspend_usb_init() 0 | 302 | #define ksuspend_usb_init() 0 |
| 250 | #define ksuspend_usb_cleanup() do {} while (0) | 303 | #define ksuspend_usb_cleanup() do {} while (0) |
| 304 | #define usb_device_pm_ops (*(struct pm_ops *)0) | ||
| 251 | 305 | ||
| 252 | #endif /* CONFIG_PM */ | 306 | #endif /* CONFIG_PM */ |
| 253 | 307 | ||
| 308 | struct device_type usb_device_type = { | ||
| 309 | .name = "usb_device", | ||
| 310 | .release = usb_release_dev, | ||
| 311 | .uevent = usb_dev_uevent, | ||
| 312 | .pm = &usb_device_pm_ops, | ||
| 313 | }; | ||
| 314 | |||
| 254 | 315 | ||
| 255 | /* Returns 1 if @usb_bus is WUSB, 0 otherwise */ | 316 | /* Returns 1 if @usb_bus is WUSB, 0 otherwise */ |
| 256 | static unsigned usb_bus_is_wusb(struct usb_bus *bus) | 317 | static unsigned usb_bus_is_wusb(struct usb_bus *bus) |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index d9a6e16dbf84..9a1a45ac3add 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
| @@ -41,6 +41,9 @@ extern void usb_host_cleanup(void); | |||
| 41 | 41 | ||
| 42 | #ifdef CONFIG_PM | 42 | #ifdef CONFIG_PM |
| 43 | 43 | ||
| 44 | extern int usb_suspend(struct device *dev, pm_message_t msg); | ||
| 45 | extern int usb_resume(struct device *dev); | ||
| 46 | |||
| 44 | extern void usb_autosuspend_work(struct work_struct *work); | 47 | extern void usb_autosuspend_work(struct work_struct *work); |
| 45 | extern int usb_port_suspend(struct usb_device *dev); | 48 | extern int usb_port_suspend(struct usb_device *dev); |
| 46 | extern int usb_port_resume(struct usb_device *dev); | 49 | extern int usb_port_resume(struct usb_device *dev); |
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 1500e1b3c302..abf8192f89e8 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
| @@ -44,7 +44,6 @@ | |||
| 44 | #include <linux/module.h> | 44 | #include <linux/module.h> |
| 45 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
| 46 | #include <linux/kernel.h> | 46 | #include <linux/kernel.h> |
| 47 | #include <linux/version.h> | ||
| 48 | #include <linux/delay.h> | 47 | #include <linux/delay.h> |
| 49 | #include <linux/ioport.h> | 48 | #include <linux/ioport.h> |
| 50 | #include <linux/sched.h> | 49 | #include <linux/sched.h> |
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 1cfccf102a2d..45ad556169f1 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c | |||
| @@ -223,7 +223,7 @@ static int dr_controller_setup(struct fsl_udc *udc) | |||
| 223 | fsl_writel(tmp, &dr_regs->endpointlistaddr); | 223 | fsl_writel(tmp, &dr_regs->endpointlistaddr); |
| 224 | 224 | ||
| 225 | VDBG("vir[qh_base] is %p phy[qh_base] is 0x%8x reg is 0x%8x", | 225 | VDBG("vir[qh_base] is %p phy[qh_base] is 0x%8x reg is 0x%8x", |
| 226 | (int)udc->ep_qh, (int)tmp, | 226 | udc->ep_qh, (int)tmp, |
| 227 | fsl_readl(&dr_regs->endpointlistaddr)); | 227 | fsl_readl(&dr_regs->endpointlistaddr)); |
| 228 | 228 | ||
| 229 | /* Config PHY interface */ | 229 | /* Config PHY interface */ |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 574c53831a05..bb54cca4c543 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
| @@ -787,7 +787,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel) | |||
| 787 | omap_set_dma_dest_params(ep->lch, | 787 | omap_set_dma_dest_params(ep->lch, |
| 788 | OMAP_DMA_PORT_TIPB, | 788 | OMAP_DMA_PORT_TIPB, |
| 789 | OMAP_DMA_AMODE_CONSTANT, | 789 | OMAP_DMA_AMODE_CONSTANT, |
| 790 | (unsigned long) io_v2p(UDC_DATA_DMA), | 790 | UDC_DATA_DMA, |
| 791 | 0, 0); | 791 | 0, 0); |
| 792 | } | 792 | } |
| 793 | } else { | 793 | } else { |
| @@ -804,7 +804,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel) | |||
| 804 | omap_set_dma_src_params(ep->lch, | 804 | omap_set_dma_src_params(ep->lch, |
| 805 | OMAP_DMA_PORT_TIPB, | 805 | OMAP_DMA_PORT_TIPB, |
| 806 | OMAP_DMA_AMODE_CONSTANT, | 806 | OMAP_DMA_AMODE_CONSTANT, |
| 807 | (unsigned long) io_v2p(UDC_DATA_DMA), | 807 | UDC_DATA_DMA, |
| 808 | 0, 0); | 808 | 0, 0); |
| 809 | /* EMIFF or SDRC */ | 809 | /* EMIFF or SDRC */ |
| 810 | omap_set_dma_dest_burst_mode(ep->lch, | 810 | omap_set_dma_dest_burst_mode(ep->lch, |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index a28513ecbe5b..7cbc78a6853d 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
| @@ -1622,7 +1622,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) | |||
| 1622 | struct pxa_udc *udc = the_controller; | 1622 | struct pxa_udc *udc = the_controller; |
| 1623 | int retval; | 1623 | int retval; |
| 1624 | 1624 | ||
| 1625 | if (!driver || driver->speed != USB_SPEED_FULL || !driver->bind | 1625 | if (!driver || driver->speed < USB_SPEED_FULL || !driver->bind |
| 1626 | || !driver->disconnect || !driver->setup) | 1626 | || !driver->disconnect || !driver->setup) |
| 1627 | return -EINVAL; | 1627 | return -EINVAL; |
| 1628 | if (!udc) | 1628 | if (!udc) |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index 538807384592..29d13ebe7500 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include <linux/list.h> | 35 | #include <linux/list.h> |
| 36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
| 37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
| 38 | #include <linux/version.h> | ||
| 39 | #include <linux/clk.h> | 38 | #include <linux/clk.h> |
| 40 | 39 | ||
| 41 | #include <linux/debugfs.h> | 40 | #include <linux/debugfs.h> |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index d9d53f289caf..8409e0705d63 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -145,16 +145,6 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr, | |||
| 145 | return -ETIMEDOUT; | 145 | return -ETIMEDOUT; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, | ||
| 149 | u32 mask, u32 done, int usec) | ||
| 150 | { | ||
| 151 | int error = handshake(ehci, ptr, mask, done, usec); | ||
| 152 | if (error) | ||
| 153 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | ||
| 154 | |||
| 155 | return error; | ||
| 156 | } | ||
| 157 | |||
| 158 | /* force HC to halt state from unknown (EHCI spec section 2.3) */ | 148 | /* force HC to halt state from unknown (EHCI spec section 2.3) */ |
| 159 | static int ehci_halt (struct ehci_hcd *ehci) | 149 | static int ehci_halt (struct ehci_hcd *ehci) |
| 160 | { | 150 | { |
| @@ -173,6 +163,22 @@ static int ehci_halt (struct ehci_hcd *ehci) | |||
| 173 | STS_HALT, STS_HALT, 16 * 125); | 163 | STS_HALT, STS_HALT, 16 * 125); |
| 174 | } | 164 | } |
| 175 | 165 | ||
| 166 | static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr, | ||
| 167 | u32 mask, u32 done, int usec) | ||
| 168 | { | ||
| 169 | int error; | ||
| 170 | |||
| 171 | error = handshake(ehci, ptr, mask, done, usec); | ||
| 172 | if (error) { | ||
| 173 | ehci_halt(ehci); | ||
| 174 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | ||
| 175 | ehci_err(ehci, "force halt; handhake %p %08x %08x -> %d\n", | ||
| 176 | ptr, mask, done, error); | ||
| 177 | } | ||
| 178 | |||
| 179 | return error; | ||
| 180 | } | ||
| 181 | |||
| 176 | /* put TDI/ARC silicon into EHCI mode */ | 182 | /* put TDI/ARC silicon into EHCI mode */ |
| 177 | static void tdi_reset (struct ehci_hcd *ehci) | 183 | static void tdi_reset (struct ehci_hcd *ehci) |
| 178 | { | 184 | { |
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 5fbdc14e63b3..5416cf969005 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
| 13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/mbus.h> | 14 | #include <linux/mbus.h> |
| 15 | #include <asm/plat-orion/ehci-orion.h> | 15 | #include <plat/ehci-orion.h> |
| 16 | 16 | ||
| 17 | #define rdl(off) __raw_readl(hcd->regs + (off)) | 17 | #define rdl(off) __raw_readl(hcd->regs + (off)) |
| 18 | #define wrl(off, val) __raw_writel((val), hcd->regs + (off)) | 18 | #define wrl(off, val) __raw_writel((val), hcd->regs + (off)) |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index b7853c8bac0f..4a0c5a78b2ed 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
| @@ -437,6 +437,9 @@ static int enable_periodic (struct ehci_hcd *ehci) | |||
| 437 | u32 cmd; | 437 | u32 cmd; |
| 438 | int status; | 438 | int status; |
| 439 | 439 | ||
| 440 | if (ehci->periodic_sched++) | ||
| 441 | return 0; | ||
| 442 | |||
| 440 | /* did clearing PSE did take effect yet? | 443 | /* did clearing PSE did take effect yet? |
| 441 | * takes effect only at frame boundaries... | 444 | * takes effect only at frame boundaries... |
| 442 | */ | 445 | */ |
| @@ -461,6 +464,9 @@ static int disable_periodic (struct ehci_hcd *ehci) | |||
| 461 | u32 cmd; | 464 | u32 cmd; |
| 462 | int status; | 465 | int status; |
| 463 | 466 | ||
| 467 | if (--ehci->periodic_sched) | ||
| 468 | return 0; | ||
| 469 | |||
| 464 | /* did setting PSE not take effect yet? | 470 | /* did setting PSE not take effect yet? |
| 465 | * takes effect only at frame boundaries... | 471 | * takes effect only at frame boundaries... |
| 466 | */ | 472 | */ |
| @@ -544,13 +550,10 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
| 544 | : (qh->usecs * 8); | 550 | : (qh->usecs * 8); |
| 545 | 551 | ||
| 546 | /* maybe enable periodic schedule processing */ | 552 | /* maybe enable periodic schedule processing */ |
| 547 | if (!ehci->periodic_sched++) | 553 | return enable_periodic(ehci); |
| 548 | return enable_periodic (ehci); | ||
| 549 | |||
| 550 | return 0; | ||
| 551 | } | 554 | } |
| 552 | 555 | ||
| 553 | static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) | 556 | static int qh_unlink_periodic(struct ehci_hcd *ehci, struct ehci_qh *qh) |
| 554 | { | 557 | { |
| 555 | unsigned i; | 558 | unsigned i; |
| 556 | unsigned period; | 559 | unsigned period; |
| @@ -586,9 +589,7 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
| 586 | qh_put (qh); | 589 | qh_put (qh); |
| 587 | 590 | ||
| 588 | /* maybe turn off periodic schedule */ | 591 | /* maybe turn off periodic schedule */ |
| 589 | ehci->periodic_sched--; | 592 | return disable_periodic(ehci); |
| 590 | if (!ehci->periodic_sched) | ||
| 591 | (void) disable_periodic (ehci); | ||
| 592 | } | 593 | } |
| 593 | 594 | ||
| 594 | static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh) | 595 | static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh) |
| @@ -1562,9 +1563,7 @@ itd_link_urb ( | |||
| 1562 | urb->hcpriv = NULL; | 1563 | urb->hcpriv = NULL; |
| 1563 | 1564 | ||
| 1564 | timer_action (ehci, TIMER_IO_WATCHDOG); | 1565 | timer_action (ehci, TIMER_IO_WATCHDOG); |
| 1565 | if (unlikely (!ehci->periodic_sched++)) | 1566 | return enable_periodic(ehci); |
| 1566 | return enable_periodic (ehci); | ||
| 1567 | return 0; | ||
| 1568 | } | 1567 | } |
| 1569 | 1568 | ||
| 1570 | #define ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR) | 1569 | #define ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR) |
| @@ -1642,7 +1641,7 @@ itd_complete ( | |||
| 1642 | ehci_urb_done(ehci, urb, 0); | 1641 | ehci_urb_done(ehci, urb, 0); |
| 1643 | retval = true; | 1642 | retval = true; |
| 1644 | urb = NULL; | 1643 | urb = NULL; |
| 1645 | ehci->periodic_sched--; | 1644 | (void) disable_periodic(ehci); |
| 1646 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; | 1645 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; |
| 1647 | 1646 | ||
| 1648 | if (unlikely (list_empty (&stream->td_list))) { | 1647 | if (unlikely (list_empty (&stream->td_list))) { |
| @@ -1951,9 +1950,7 @@ sitd_link_urb ( | |||
| 1951 | urb->hcpriv = NULL; | 1950 | urb->hcpriv = NULL; |
| 1952 | 1951 | ||
| 1953 | timer_action (ehci, TIMER_IO_WATCHDOG); | 1952 | timer_action (ehci, TIMER_IO_WATCHDOG); |
| 1954 | if (!ehci->periodic_sched++) | 1953 | return enable_periodic(ehci); |
| 1955 | return enable_periodic (ehci); | ||
| 1956 | return 0; | ||
| 1957 | } | 1954 | } |
| 1958 | 1955 | ||
| 1959 | /*-------------------------------------------------------------------------*/ | 1956 | /*-------------------------------------------------------------------------*/ |
| @@ -2019,7 +2016,7 @@ sitd_complete ( | |||
| 2019 | ehci_urb_done(ehci, urb, 0); | 2016 | ehci_urb_done(ehci, urb, 0); |
| 2020 | retval = true; | 2017 | retval = true; |
| 2021 | urb = NULL; | 2018 | urb = NULL; |
| 2022 | ehci->periodic_sched--; | 2019 | (void) disable_periodic(ehci); |
| 2023 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; | 2020 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; |
| 2024 | 2021 | ||
| 2025 | if (list_empty (&stream->td_list)) { | 2022 | if (list_empty (&stream->td_list)) { |
| @@ -2243,8 +2240,7 @@ restart: | |||
| 2243 | if (unlikely (modified)) { | 2240 | if (unlikely (modified)) { |
| 2244 | if (likely(ehci->periodic_sched > 0)) | 2241 | if (likely(ehci->periodic_sched > 0)) |
| 2245 | goto restart; | 2242 | goto restart; |
| 2246 | /* maybe we can short-circuit this scan! */ | 2243 | /* short-circuit this scan */ |
| 2247 | disable_periodic(ehci); | ||
| 2248 | now_uframe = clock; | 2244 | now_uframe = clock; |
| 2249 | break; | 2245 | break; |
| 2250 | } | 2246 | } |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index d22a84f86a33..8017f1cf78e2 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
| @@ -988,7 +988,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd) | |||
| 988 | /* | 988 | /* |
| 989 | * write bank1 address twice to ensure the 90ns delay (time | 989 | * write bank1 address twice to ensure the 90ns delay (time |
| 990 | * between BANK0 write and the priv_read_copy() call is at | 990 | * between BANK0 write and the priv_read_copy() call is at |
| 991 | * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 92ns) | 991 | * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 109ns) |
| 992 | */ | 992 | */ |
| 993 | isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs + | 993 | isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs + |
| 994 | HC_MEMORY_REG); | 994 | HC_MEMORY_REG); |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 6db7a2889e66..4ed228a89943 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
| @@ -260,7 +260,6 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
| 260 | */ | 260 | */ |
| 261 | .hub_status_data = ohci_hub_status_data, | 261 | .hub_status_data = ohci_hub_status_data, |
| 262 | .hub_control = ohci_hub_control, | 262 | .hub_control = ohci_hub_control, |
| 263 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 264 | #ifdef CONFIG_PM | 263 | #ifdef CONFIG_PM |
| 265 | .bus_suspend = ohci_bus_suspend, | 264 | .bus_suspend = ohci_bus_suspend, |
| 266 | .bus_resume = ohci_bus_resume, | 265 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index c0948008fe3d..2ac4e022a13f 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
| @@ -163,7 +163,6 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { | |||
| 163 | */ | 163 | */ |
| 164 | .hub_status_data = ohci_hub_status_data, | 164 | .hub_status_data = ohci_hub_status_data, |
| 165 | .hub_control = ohci_hub_control, | 165 | .hub_control = ohci_hub_control, |
| 166 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 167 | #ifdef CONFIG_PM | 166 | #ifdef CONFIG_PM |
| 168 | .bus_suspend = ohci_bus_suspend, | 167 | .bus_suspend = ohci_bus_suspend, |
| 169 | .bus_resume = ohci_bus_resume, | 168 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index cb0b506f8259..fb3055f084b5 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c | |||
| @@ -134,7 +134,6 @@ static struct hc_driver ohci_ep93xx_hc_driver = { | |||
| 134 | .get_frame_number = ohci_get_frame, | 134 | .get_frame_number = ohci_get_frame, |
| 135 | .hub_status_data = ohci_hub_status_data, | 135 | .hub_status_data = ohci_hub_status_data, |
| 136 | .hub_control = ohci_hub_control, | 136 | .hub_control = ohci_hub_control, |
| 137 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 138 | #ifdef CONFIG_PM | 137 | #ifdef CONFIG_PM |
| 139 | .bus_suspend = ohci_bus_suspend, | 138 | .bus_suspend = ohci_bus_suspend, |
| 140 | .bus_resume = ohci_bus_resume, | 139 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 439beb784f3e..7ea9a7b31155 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
| @@ -36,18 +36,6 @@ | |||
| 36 | 36 | ||
| 37 | /*-------------------------------------------------------------------------*/ | 37 | /*-------------------------------------------------------------------------*/ |
| 38 | 38 | ||
| 39 | /* hcd->hub_irq_enable() */ | ||
| 40 | static void ohci_rhsc_enable (struct usb_hcd *hcd) | ||
| 41 | { | ||
| 42 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | ||
| 43 | |||
| 44 | spin_lock_irq(&ohci->lock); | ||
| 45 | if (!ohci->autostop) | ||
| 46 | del_timer(&hcd->rh_timer); /* Prevent next poll */ | ||
| 47 | ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); | ||
| 48 | spin_unlock_irq(&ohci->lock); | ||
| 49 | } | ||
| 50 | |||
| 51 | #define OHCI_SCHED_ENABLES \ | 39 | #define OHCI_SCHED_ENABLES \ |
| 52 | (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) | 40 | (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) |
| 53 | 41 | ||
| @@ -374,18 +362,28 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
| 374 | int any_connected) | 362 | int any_connected) |
| 375 | { | 363 | { |
| 376 | int poll_rh = 1; | 364 | int poll_rh = 1; |
| 365 | int rhsc; | ||
| 377 | 366 | ||
| 367 | rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC; | ||
| 378 | switch (ohci->hc_control & OHCI_CTRL_HCFS) { | 368 | switch (ohci->hc_control & OHCI_CTRL_HCFS) { |
| 379 | 369 | ||
| 380 | case OHCI_USB_OPER: | 370 | case OHCI_USB_OPER: |
| 381 | /* keep on polling until we know a device is connected | 371 | /* If no status changes are pending, enable status-change |
| 382 | * and RHSC is enabled */ | 372 | * interrupts. |
| 373 | */ | ||
| 374 | if (!rhsc && !changed) { | ||
| 375 | rhsc = OHCI_INTR_RHSC; | ||
| 376 | ohci_writel(ohci, rhsc, &ohci->regs->intrenable); | ||
| 377 | } | ||
| 378 | |||
| 379 | /* Keep on polling until we know a device is connected | ||
| 380 | * and RHSC is enabled, or until we autostop. | ||
| 381 | */ | ||
| 383 | if (!ohci->autostop) { | 382 | if (!ohci->autostop) { |
| 384 | if (any_connected || | 383 | if (any_connected || |
| 385 | !device_may_wakeup(&ohci_to_hcd(ohci) | 384 | !device_may_wakeup(&ohci_to_hcd(ohci) |
| 386 | ->self.root_hub->dev)) { | 385 | ->self.root_hub->dev)) { |
| 387 | if (ohci_readl(ohci, &ohci->regs->intrenable) & | 386 | if (rhsc) |
| 388 | OHCI_INTR_RHSC) | ||
| 389 | poll_rh = 0; | 387 | poll_rh = 0; |
| 390 | } else { | 388 | } else { |
| 391 | ohci->autostop = 1; | 389 | ohci->autostop = 1; |
| @@ -398,12 +396,13 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
| 398 | ohci->autostop = 0; | 396 | ohci->autostop = 0; |
| 399 | ohci->next_statechange = jiffies + | 397 | ohci->next_statechange = jiffies + |
| 400 | STATECHANGE_DELAY; | 398 | STATECHANGE_DELAY; |
| 401 | } else if (time_after_eq(jiffies, | 399 | } else if (rhsc && time_after_eq(jiffies, |
| 402 | ohci->next_statechange) | 400 | ohci->next_statechange) |
| 403 | && !ohci->ed_rm_list | 401 | && !ohci->ed_rm_list |
| 404 | && !(ohci->hc_control & | 402 | && !(ohci->hc_control & |
| 405 | OHCI_SCHED_ENABLES)) { | 403 | OHCI_SCHED_ENABLES)) { |
| 406 | ohci_rh_suspend(ohci, 1); | 404 | ohci_rh_suspend(ohci, 1); |
| 405 | poll_rh = 0; | ||
| 407 | } | 406 | } |
| 408 | } | 407 | } |
| 409 | break; | 408 | break; |
| @@ -417,6 +416,12 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
| 417 | else | 416 | else |
| 418 | usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); | 417 | usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); |
| 419 | } else { | 418 | } else { |
| 419 | if (!rhsc && (ohci->autostop || | ||
| 420 | ohci_to_hcd(ohci)->self.root_hub-> | ||
| 421 | do_remote_wakeup)) | ||
| 422 | ohci_writel(ohci, OHCI_INTR_RHSC, | ||
| 423 | &ohci->regs->intrenable); | ||
| 424 | |||
| 420 | /* everything is idle, no need for polling */ | 425 | /* everything is idle, no need for polling */ |
| 421 | poll_rh = 0; | 426 | poll_rh = 0; |
| 422 | } | 427 | } |
| @@ -438,12 +443,16 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci) | |||
| 438 | static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | 443 | static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, |
| 439 | int any_connected) | 444 | int any_connected) |
| 440 | { | 445 | { |
| 441 | int poll_rh = 1; | 446 | /* If RHSC is enabled, don't poll */ |
| 442 | |||
| 443 | /* keep on polling until RHSC is enabled */ | ||
| 444 | if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) | 447 | if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) |
| 445 | poll_rh = 0; | 448 | return 0; |
| 446 | return poll_rh; | 449 | |
| 450 | /* If no status changes are pending, enable status-change interrupts */ | ||
| 451 | if (!changed) { | ||
| 452 | ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); | ||
| 453 | return 0; | ||
| 454 | } | ||
| 455 | return 1; | ||
| 447 | } | 456 | } |
| 448 | 457 | ||
| 449 | #endif /* CONFIG_PM */ | 458 | #endif /* CONFIG_PM */ |
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 9e31d440d115..de42283149c7 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c | |||
| @@ -193,7 +193,6 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { | |||
| 193 | */ | 193 | */ |
| 194 | .hub_status_data = ohci_hub_status_data, | 194 | .hub_status_data = ohci_hub_status_data, |
| 195 | .hub_control = ohci_hub_control, | 195 | .hub_control = ohci_hub_control, |
| 196 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 197 | #ifdef CONFIG_PM | 196 | #ifdef CONFIG_PM |
| 198 | .bus_suspend = ohci_bus_suspend, | 197 | .bus_suspend = ohci_bus_suspend, |
| 199 | .bus_resume = ohci_bus_resume, | 198 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 3d532b709670..95b3ec89c126 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
| @@ -208,7 +208,7 @@ static int ohci_omap_init(struct usb_hcd *hcd) | |||
| 208 | if (cpu_is_omap16xx()) | 208 | if (cpu_is_omap16xx()) |
| 209 | ocpi_enable(); | 209 | ocpi_enable(); |
| 210 | 210 | ||
| 211 | #ifdef CONFIG_ARCH_OMAP_OTG | 211 | #ifdef CONFIG_USB_OTG |
| 212 | if (need_transceiver) { | 212 | if (need_transceiver) { |
| 213 | ohci->transceiver = otg_get_transceiver(); | 213 | ohci->transceiver = otg_get_transceiver(); |
| 214 | if (ohci->transceiver) { | 214 | if (ohci->transceiver) { |
| @@ -470,7 +470,6 @@ static const struct hc_driver ohci_omap_hc_driver = { | |||
| 470 | */ | 470 | */ |
| 471 | .hub_status_data = ohci_hub_status_data, | 471 | .hub_status_data = ohci_hub_status_data, |
| 472 | .hub_control = ohci_hub_control, | 472 | .hub_control = ohci_hub_control, |
| 473 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 474 | #ifdef CONFIG_PM | 473 | #ifdef CONFIG_PM |
| 475 | .bus_suspend = ohci_bus_suspend, | 474 | .bus_suspend = ohci_bus_suspend, |
| 476 | .bus_resume = ohci_bus_resume, | 475 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 083e8df0a817..a9c2ae36c7ad 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
| @@ -459,7 +459,6 @@ static const struct hc_driver ohci_pci_hc_driver = { | |||
| 459 | */ | 459 | */ |
| 460 | .hub_status_data = ohci_hub_status_data, | 460 | .hub_status_data = ohci_hub_status_data, |
| 461 | .hub_control = ohci_hub_control, | 461 | .hub_control = ohci_hub_control, |
| 462 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 463 | #ifdef CONFIG_PM | 462 | #ifdef CONFIG_PM |
| 464 | .bus_suspend = ohci_bus_suspend, | 463 | .bus_suspend = ohci_bus_suspend, |
| 465 | .bus_resume = ohci_bus_resume, | 464 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c index b02cd0761977..658a2a978c32 100644 --- a/drivers/usb/host/ohci-pnx4008.c +++ b/drivers/usb/host/ohci-pnx4008.c | |||
| @@ -277,7 +277,6 @@ static const struct hc_driver ohci_pnx4008_hc_driver = { | |||
| 277 | */ | 277 | */ |
| 278 | .hub_status_data = ohci_hub_status_data, | 278 | .hub_status_data = ohci_hub_status_data, |
| 279 | .hub_control = ohci_hub_control, | 279 | .hub_control = ohci_hub_control, |
| 280 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 281 | #ifdef CONFIG_PM | 280 | #ifdef CONFIG_PM |
| 282 | .bus_suspend = ohci_bus_suspend, | 281 | .bus_suspend = ohci_bus_suspend, |
| 283 | .bus_resume = ohci_bus_resume, | 282 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c index 605d59cba28e..28467e288a93 100644 --- a/drivers/usb/host/ohci-pnx8550.c +++ b/drivers/usb/host/ohci-pnx8550.c | |||
| @@ -201,7 +201,6 @@ static const struct hc_driver ohci_pnx8550_hc_driver = { | |||
| 201 | */ | 201 | */ |
| 202 | .hub_status_data = ohci_hub_status_data, | 202 | .hub_status_data = ohci_hub_status_data, |
| 203 | .hub_control = ohci_hub_control, | 203 | .hub_control = ohci_hub_control, |
| 204 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 205 | #ifdef CONFIG_PM | 204 | #ifdef CONFIG_PM |
| 206 | .bus_suspend = ohci_bus_suspend, | 205 | .bus_suspend = ohci_bus_suspend, |
| 207 | .bus_resume = ohci_bus_resume, | 206 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index 91e6e101a4cc..7ac53264ead3 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c | |||
| @@ -72,7 +72,6 @@ static const struct hc_driver ohci_ppc_of_hc_driver = { | |||
| 72 | */ | 72 | */ |
| 73 | .hub_status_data = ohci_hub_status_data, | 73 | .hub_status_data = ohci_hub_status_data, |
| 74 | .hub_control = ohci_hub_control, | 74 | .hub_control = ohci_hub_control, |
| 75 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 76 | #ifdef CONFIG_PM | 75 | #ifdef CONFIG_PM |
| 77 | .bus_suspend = ohci_bus_suspend, | 76 | .bus_suspend = ohci_bus_suspend, |
| 78 | .bus_resume = ohci_bus_resume, | 77 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 523c30125577..cd3398b675b2 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c | |||
| @@ -172,7 +172,6 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = { | |||
| 172 | */ | 172 | */ |
| 173 | .hub_status_data = ohci_hub_status_data, | 173 | .hub_status_data = ohci_hub_status_data, |
| 174 | .hub_control = ohci_hub_control, | 174 | .hub_control = ohci_hub_control, |
| 175 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 176 | #ifdef CONFIG_PM | 175 | #ifdef CONFIG_PM |
| 177 | .bus_suspend = ohci_bus_suspend, | 176 | .bus_suspend = ohci_bus_suspend, |
| 178 | .bus_resume = ohci_bus_resume, | 177 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c index 55c95647f008..2089d8a46c4b 100644 --- a/drivers/usb/host/ohci-ps3.c +++ b/drivers/usb/host/ohci-ps3.c | |||
| @@ -68,7 +68,6 @@ static const struct hc_driver ps3_ohci_hc_driver = { | |||
| 68 | .get_frame_number = ohci_get_frame, | 68 | .get_frame_number = ohci_get_frame, |
| 69 | .hub_status_data = ohci_hub_status_data, | 69 | .hub_status_data = ohci_hub_status_data, |
| 70 | .hub_control = ohci_hub_control, | 70 | .hub_control = ohci_hub_control, |
| 71 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 72 | .start_port_reset = ohci_start_port_reset, | 71 | .start_port_reset = ohci_start_port_reset, |
| 73 | #if defined(CONFIG_PM) | 72 | #if defined(CONFIG_PM) |
| 74 | .bus_suspend = ohci_bus_suspend, | 73 | .bus_suspend = ohci_bus_suspend, |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 8c9c4849db6e..7f0f35c78185 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
| @@ -298,7 +298,6 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { | |||
| 298 | */ | 298 | */ |
| 299 | .hub_status_data = ohci_hub_status_data, | 299 | .hub_status_data = ohci_hub_status_data, |
| 300 | .hub_control = ohci_hub_control, | 300 | .hub_control = ohci_hub_control, |
| 301 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 302 | #ifdef CONFIG_PM | 301 | #ifdef CONFIG_PM |
| 303 | .bus_suspend = ohci_bus_suspend, | 302 | .bus_suspend = ohci_bus_suspend, |
| 304 | .bus_resume = ohci_bus_resume, | 303 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 9e3dc4069e8b..f46af7a718d4 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
| @@ -466,7 +466,6 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { | |||
| 466 | */ | 466 | */ |
| 467 | .hub_status_data = ohci_s3c2410_hub_status_data, | 467 | .hub_status_data = ohci_s3c2410_hub_status_data, |
| 468 | .hub_control = ohci_s3c2410_hub_control, | 468 | .hub_control = ohci_s3c2410_hub_control, |
| 469 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 470 | #ifdef CONFIG_PM | 469 | #ifdef CONFIG_PM |
| 471 | .bus_suspend = ohci_bus_suspend, | 470 | .bus_suspend = ohci_bus_suspend, |
| 472 | .bus_resume = ohci_bus_resume, | 471 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index 4626b002e670..e4bbe8e188e4 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c | |||
| @@ -231,7 +231,6 @@ static const struct hc_driver ohci_sa1111_hc_driver = { | |||
| 231 | */ | 231 | */ |
| 232 | .hub_status_data = ohci_hub_status_data, | 232 | .hub_status_data = ohci_hub_status_data, |
| 233 | .hub_control = ohci_hub_control, | 233 | .hub_control = ohci_hub_control, |
| 234 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 235 | #ifdef CONFIG_PM | 234 | #ifdef CONFIG_PM |
| 236 | .bus_suspend = ohci_bus_suspend, | 235 | .bus_suspend = ohci_bus_suspend, |
| 237 | .bus_resume = ohci_bus_resume, | 236 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c index e7ee607278fe..60f03cc7ec4f 100644 --- a/drivers/usb/host/ohci-sh.c +++ b/drivers/usb/host/ohci-sh.c | |||
| @@ -68,7 +68,6 @@ static const struct hc_driver ohci_sh_hc_driver = { | |||
| 68 | */ | 68 | */ |
| 69 | .hub_status_data = ohci_hub_status_data, | 69 | .hub_status_data = ohci_hub_status_data, |
| 70 | .hub_control = ohci_hub_control, | 70 | .hub_control = ohci_hub_control, |
| 71 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 72 | #ifdef CONFIG_PM | 71 | #ifdef CONFIG_PM |
| 73 | .bus_suspend = ohci_bus_suspend, | 72 | .bus_suspend = ohci_bus_suspend, |
| 74 | .bus_resume = ohci_bus_resume, | 73 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index 21b164e4abeb..cff23637cfcc 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c | |||
| @@ -75,7 +75,6 @@ static const struct hc_driver ohci_sm501_hc_driver = { | |||
| 75 | */ | 75 | */ |
| 76 | .hub_status_data = ohci_hub_status_data, | 76 | .hub_status_data = ohci_hub_status_data, |
| 77 | .hub_control = ohci_hub_control, | 77 | .hub_control = ohci_hub_control, |
| 78 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 79 | #ifdef CONFIG_PM | 78 | #ifdef CONFIG_PM |
| 80 | .bus_suspend = ohci_bus_suspend, | 79 | .bus_suspend = ohci_bus_suspend, |
| 81 | .bus_resume = ohci_bus_resume, | 80 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c index 3660c83d80af..23fd6a886bdd 100644 --- a/drivers/usb/host/ohci-ssb.c +++ b/drivers/usb/host/ohci-ssb.c | |||
| @@ -81,7 +81,6 @@ static const struct hc_driver ssb_ohci_hc_driver = { | |||
| 81 | 81 | ||
| 82 | .hub_status_data = ohci_hub_status_data, | 82 | .hub_status_data = ohci_hub_status_data, |
| 83 | .hub_control = ohci_hub_control, | 83 | .hub_control = ohci_hub_control, |
| 84 | .hub_irq_enable = ohci_rhsc_enable, | ||
| 85 | #ifdef CONFIG_PM | 84 | #ifdef CONFIG_PM |
| 86 | .bus_suspend = ohci_bus_suspend, | 85 | .bus_suspend = ohci_bus_suspend, |
| 87 | .bus_resume = ohci_bus_resume, | 86 | .bus_resume = ohci_bus_resume, |
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 20ad3c48fcb2..228f2b070f2b 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c | |||
| @@ -2934,16 +2934,6 @@ static int u132_start_port_reset(struct usb_hcd *hcd, unsigned port_num) | |||
| 2934 | return 0; | 2934 | return 0; |
| 2935 | } | 2935 | } |
| 2936 | 2936 | ||
| 2937 | static void u132_hub_irq_enable(struct usb_hcd *hcd) | ||
| 2938 | { | ||
| 2939 | struct u132 *u132 = hcd_to_u132(hcd); | ||
| 2940 | if (u132->going > 1) { | ||
| 2941 | dev_err(&u132->platform_dev->dev, "device has been removed %d\n" | ||
| 2942 | , u132->going); | ||
| 2943 | } else if (u132->going > 0) | ||
| 2944 | dev_err(&u132->platform_dev->dev, "device is being removed\n"); | ||
| 2945 | } | ||
| 2946 | |||
| 2947 | 2937 | ||
| 2948 | #ifdef CONFIG_PM | 2938 | #ifdef CONFIG_PM |
| 2949 | static int u132_bus_suspend(struct usb_hcd *hcd) | 2939 | static int u132_bus_suspend(struct usb_hcd *hcd) |
| @@ -2995,7 +2985,6 @@ static struct hc_driver u132_hc_driver = { | |||
| 2995 | .bus_suspend = u132_bus_suspend, | 2985 | .bus_suspend = u132_bus_suspend, |
| 2996 | .bus_resume = u132_bus_resume, | 2986 | .bus_resume = u132_bus_resume, |
| 2997 | .start_port_reset = u132_start_port_reset, | 2987 | .start_port_reset = u132_start_port_reset, |
| 2998 | .hub_irq_enable = u132_hub_irq_enable, | ||
| 2999 | }; | 2988 | }; |
| 3000 | 2989 | ||
| 3001 | /* | 2990 | /* |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index e6ca9979e3ae..a4ef77ef917d 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
| 21 | #include <linux/poll.h> | 21 | #include <linux/poll.h> |
| 22 | #include <linux/version.h> | ||
| 23 | #include <linux/usb/iowarrior.h> | 22 | #include <linux/usb/iowarrior.h> |
| 24 | 23 | ||
| 25 | /* Version Information */ | 24 | /* Version Information */ |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index fbace41a7cba..69c34a58e205 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
| @@ -3270,6 +3270,7 @@ static struct usb_device_id sisusb_table [] = { | |||
| 3270 | { USB_DEVICE(0x0711, 0x0900) }, | 3270 | { USB_DEVICE(0x0711, 0x0900) }, |
| 3271 | { USB_DEVICE(0x0711, 0x0901) }, | 3271 | { USB_DEVICE(0x0711, 0x0901) }, |
| 3272 | { USB_DEVICE(0x0711, 0x0902) }, | 3272 | { USB_DEVICE(0x0711, 0x0902) }, |
| 3273 | { USB_DEVICE(0x0711, 0x0918) }, | ||
| 3273 | { USB_DEVICE(0x182d, 0x021c) }, | 3274 | { USB_DEVICE(0x182d, 0x021c) }, |
| 3274 | { USB_DEVICE(0x182d, 0x0269) }, | 3275 | { USB_DEVICE(0x182d, 0x0269) }, |
| 3275 | { } | 3276 | { } |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index faca4333f27a..58b2b8fc9439 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
| @@ -9,6 +9,7 @@ comment "Enable Host or Gadget support to see Inventra options" | |||
| 9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller | 9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller |
| 10 | config USB_MUSB_HDRC | 10 | config USB_MUSB_HDRC |
| 11 | depends on (USB || USB_GADGET) && HAVE_CLK | 11 | depends on (USB || USB_GADGET) && HAVE_CLK |
| 12 | depends on !SUPERH | ||
| 12 | select TWL4030_USB if MACH_OMAP_3430SDP | 13 | select TWL4030_USB if MACH_OMAP_3430SDP |
| 13 | tristate 'Inventra Highspeed Dual Role Controller (TI, ...)' | 14 | tristate 'Inventra Highspeed Dual Role Controller (TI, ...)' |
| 14 | help | 15 | help |
| @@ -165,12 +166,11 @@ config USB_TUSB_OMAP_DMA | |||
| 165 | help | 166 | help |
| 166 | Enable DMA transfers on TUSB 6010 when OMAP DMA is available. | 167 | Enable DMA transfers on TUSB 6010 when OMAP DMA is available. |
| 167 | 168 | ||
| 168 | config USB_MUSB_LOGLEVEL | 169 | config USB_MUSB_DEBUG |
| 169 | depends on USB_MUSB_HDRC | 170 | depends on USB_MUSB_HDRC |
| 170 | int 'Logging Level (0 - none / 3 - annoying / ... )' | 171 | bool "Enable debugging messages" |
| 171 | default 0 | 172 | default n |
| 172 | help | 173 | help |
| 173 | Set the logging level. 0 disables the debugging altogether, | 174 | This enables musb debugging. To set the logging level use the debug |
| 174 | although when USB_DEBUG is set the value is at least 1. | 175 | module parameter. Starting at level 3, per-transfer (urb, usb_request, |
| 175 | Starting at level 3, per-transfer (urb, usb_request, packet, | 176 | packet, or dma transfer) tracing may kick in. |
| 176 | or dma transfer) tracing may kick in. | ||
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index 88eb67de08ae..b6af0d687a73 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile | |||
| @@ -64,23 +64,6 @@ endif | |||
| 64 | 64 | ||
| 65 | # Debugging | 65 | # Debugging |
| 66 | 66 | ||
| 67 | MUSB_DEBUG:=$(CONFIG_USB_MUSB_LOGLEVEL) | 67 | ifeq ($(CONFIG_USB_MUSB_DEBUG),y) |
| 68 | 68 | EXTRA_CFLAGS += -DDEBUG | |
| 69 | ifeq ("$(strip $(MUSB_DEBUG))","") | ||
| 70 | ifdef CONFIG_USB_DEBUG | ||
| 71 | MUSB_DEBUG:=1 | ||
| 72 | else | ||
| 73 | MUSB_DEBUG:=0 | ||
| 74 | endif | ||
| 75 | endif | 69 | endif |
| 76 | |||
| 77 | ifneq ($(MUSB_DEBUG),0) | ||
| 78 | EXTRA_CFLAGS += -DDEBUG | ||
| 79 | |||
| 80 | ifeq ($(CONFIG_PROC_FS),y) | ||
| 81 | musb_hdrc-objs += musb_procfs.o | ||
| 82 | endif | ||
| 83 | |||
| 84 | endif | ||
| 85 | |||
| 86 | EXTRA_CFLAGS += -DMUSB_DEBUG=$(MUSB_DEBUG) | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index d68ec6daf335..128e949db47c 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -100,8 +100,8 @@ | |||
| 100 | #include <linux/io.h> | 100 | #include <linux/io.h> |
| 101 | 101 | ||
| 102 | #ifdef CONFIG_ARM | 102 | #ifdef CONFIG_ARM |
| 103 | #include <asm/arch/hardware.h> | 103 | #include <mach/hardware.h> |
| 104 | #include <asm/arch/memory.h> | 104 | #include <mach/memory.h> |
| 105 | #include <asm/mach-types.h> | 105 | #include <asm/mach-types.h> |
| 106 | #endif | 106 | #endif |
| 107 | 107 | ||
| @@ -114,23 +114,14 @@ | |||
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | 116 | ||
| 117 | #if MUSB_DEBUG > 0 | 117 | unsigned debug; |
| 118 | unsigned debug = MUSB_DEBUG; | 118 | module_param(debug, uint, S_IRUGO | S_IWUSR); |
| 119 | module_param(debug, uint, 0); | 119 | MODULE_PARM_DESC(debug, "Debug message level. Default = 0"); |
| 120 | MODULE_PARM_DESC(debug, "initial debug message level"); | ||
| 121 | |||
| 122 | #define MUSB_VERSION_SUFFIX "/dbg" | ||
| 123 | #endif | ||
| 124 | 120 | ||
| 125 | #define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" | 121 | #define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" |
| 126 | #define DRIVER_DESC "Inventra Dual-Role USB Controller Driver" | 122 | #define DRIVER_DESC "Inventra Dual-Role USB Controller Driver" |
| 127 | 123 | ||
| 128 | #define MUSB_VERSION_BASE "6.0" | 124 | #define MUSB_VERSION "6.0" |
| 129 | |||
| 130 | #ifndef MUSB_VERSION_SUFFIX | ||
| 131 | #define MUSB_VERSION_SUFFIX "" | ||
| 132 | #endif | ||
| 133 | #define MUSB_VERSION MUSB_VERSION_BASE MUSB_VERSION_SUFFIX | ||
| 134 | 125 | ||
| 135 | #define DRIVER_INFO DRIVER_DESC ", v" MUSB_VERSION | 126 | #define DRIVER_INFO DRIVER_DESC ", v" MUSB_VERSION |
| 136 | 127 | ||
| @@ -2037,6 +2028,8 @@ bad_config: | |||
| 2037 | musb->xceiv.state = OTG_STATE_A_IDLE; | 2028 | musb->xceiv.state = OTG_STATE_A_IDLE; |
| 2038 | 2029 | ||
| 2039 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); | 2030 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); |
| 2031 | if (status) | ||
| 2032 | goto fail; | ||
| 2040 | 2033 | ||
| 2041 | DBG(1, "%s mode, status %d, devctl %02x %c\n", | 2034 | DBG(1, "%s mode, status %d, devctl %02x %c\n", |
| 2042 | "HOST", status, | 2035 | "HOST", status, |
| @@ -2051,6 +2044,8 @@ bad_config: | |||
| 2051 | musb->xceiv.state = OTG_STATE_B_IDLE; | 2044 | musb->xceiv.state = OTG_STATE_B_IDLE; |
| 2052 | 2045 | ||
| 2053 | status = musb_gadget_setup(musb); | 2046 | status = musb_gadget_setup(musb); |
| 2047 | if (status) | ||
| 2048 | goto fail; | ||
| 2054 | 2049 | ||
| 2055 | DBG(1, "%s mode, status %d, dev%02x\n", | 2050 | DBG(1, "%s mode, status %d, dev%02x\n", |
| 2056 | is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", | 2051 | is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", |
| @@ -2059,16 +2054,14 @@ bad_config: | |||
| 2059 | 2054 | ||
| 2060 | } | 2055 | } |
| 2061 | 2056 | ||
| 2062 | if (status == 0) | 2057 | return 0; |
| 2063 | musb_debug_create("driver/musb_hdrc", musb); | 2058 | |
| 2064 | else { | ||
| 2065 | fail: | 2059 | fail: |
| 2066 | if (musb->clock) | 2060 | if (musb->clock) |
| 2067 | clk_put(musb->clock); | 2061 | clk_put(musb->clock); |
| 2068 | device_init_wakeup(dev, 0); | 2062 | device_init_wakeup(dev, 0); |
| 2069 | musb_free(musb); | 2063 | musb_free(musb); |
| 2070 | return status; | 2064 | return status; |
| 2071 | } | ||
| 2072 | 2065 | ||
| 2073 | #ifdef CONFIG_SYSFS | 2066 | #ifdef CONFIG_SYSFS |
| 2074 | status = device_create_file(dev, &dev_attr_mode); | 2067 | status = device_create_file(dev, &dev_attr_mode); |
| @@ -2131,7 +2124,6 @@ static int __devexit musb_remove(struct platform_device *pdev) | |||
| 2131 | * - OTG mode: both roles are deactivated (or never-activated) | 2124 | * - OTG mode: both roles are deactivated (or never-activated) |
| 2132 | */ | 2125 | */ |
| 2133 | musb_shutdown(pdev); | 2126 | musb_shutdown(pdev); |
| 2134 | musb_debug_delete("driver/musb_hdrc", musb); | ||
| 2135 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | 2127 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
| 2136 | if (musb->board_mode == MUSB_HOST) | 2128 | if (musb->board_mode == MUSB_HOST) |
| 2137 | usb_remove_hcd(musb_to_hcd(musb)); | 2129 | usb_remove_hcd(musb_to_hcd(musb)); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index eade46d81708..82227251931b 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
| @@ -485,23 +485,4 @@ extern int musb_platform_get_vbus_status(struct musb *musb); | |||
| 485 | extern int __init musb_platform_init(struct musb *musb); | 485 | extern int __init musb_platform_init(struct musb *musb); |
| 486 | extern int musb_platform_exit(struct musb *musb); | 486 | extern int musb_platform_exit(struct musb *musb); |
| 487 | 487 | ||
| 488 | /*-------------------------- ProcFS definitions ---------------------*/ | ||
| 489 | |||
| 490 | struct proc_dir_entry; | ||
| 491 | |||
| 492 | #if (MUSB_DEBUG > 0) && defined(MUSB_CONFIG_PROC_FS) | ||
| 493 | extern struct proc_dir_entry *musb_debug_create(char *name, struct musb *data); | ||
| 494 | extern void musb_debug_delete(char *name, struct musb *data); | ||
| 495 | |||
| 496 | #else | ||
| 497 | static inline struct proc_dir_entry * | ||
| 498 | musb_debug_create(char *name, struct musb *data) | ||
| 499 | { | ||
| 500 | return NULL; | ||
| 501 | } | ||
| 502 | static inline void musb_debug_delete(char *name, struct musb *data) | ||
| 503 | { | ||
| 504 | } | ||
| 505 | #endif | ||
| 506 | |||
| 507 | #endif /* __MUSB_CORE_H__ */ | 488 | #endif /* __MUSB_CORE_H__ */ |
diff --git a/drivers/usb/musb/musb_debug.h b/drivers/usb/musb/musb_debug.h index 3bdb311e820d..4d2794441b15 100644 --- a/drivers/usb/musb/musb_debug.h +++ b/drivers/usb/musb/musb_debug.h | |||
| @@ -48,11 +48,7 @@ | |||
| 48 | __func__, __LINE__ , ## args); \ | 48 | __func__, __LINE__ , ## args); \ |
| 49 | } } while (0) | 49 | } } while (0) |
| 50 | 50 | ||
| 51 | #if MUSB_DEBUG > 0 | ||
| 52 | extern unsigned debug; | 51 | extern unsigned debug; |
| 53 | #else | ||
| 54 | #define debug 0 | ||
| 55 | #endif | ||
| 56 | 52 | ||
| 57 | static inline int _dbg_level(unsigned l) | 53 | static inline int _dbg_level(unsigned l) |
| 58 | { | 54 | { |
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c index 48d7d3ccb243..a57652fff39c 100644 --- a/drivers/usb/musb/musb_gadget_ep0.c +++ b/drivers/usb/musb/musb_gadget_ep0.c | |||
| @@ -476,6 +476,7 @@ static void ep0_rxstate(struct musb *musb) | |||
| 476 | return; | 476 | return; |
| 477 | musb->ackpend = 0; | 477 | musb->ackpend = 0; |
| 478 | } | 478 | } |
| 479 | musb_ep_select(musb->mregs, 0); | ||
| 479 | musb_writew(regs, MUSB_CSR0, tmp); | 480 | musb_writew(regs, MUSB_CSR0, tmp); |
| 480 | } | 481 | } |
| 481 | 482 | ||
| @@ -528,6 +529,7 @@ static void ep0_txstate(struct musb *musb) | |||
| 528 | } | 529 | } |
| 529 | 530 | ||
| 530 | /* send it out, triggering a "txpktrdy cleared" irq */ | 531 | /* send it out, triggering a "txpktrdy cleared" irq */ |
| 532 | musb_ep_select(musb->mregs, 0); | ||
| 531 | musb_writew(regs, MUSB_CSR0, csr); | 533 | musb_writew(regs, MUSB_CSR0, csr); |
| 532 | } | 534 | } |
| 533 | 535 | ||
diff --git a/drivers/usb/musb/musb_procfs.c b/drivers/usb/musb/musb_procfs.c deleted file mode 100644 index 55e6b78bdccc..000000000000 --- a/drivers/usb/musb/musb_procfs.c +++ /dev/null | |||
| @@ -1,830 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * MUSB OTG driver debug support | ||
| 3 | * | ||
| 4 | * Copyright 2005 Mentor Graphics Corporation | ||
| 5 | * Copyright (C) 2005-2006 by Texas Instruments | ||
| 6 | * Copyright (C) 2006-2007 Nokia Corporation | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU General Public License | ||
| 10 | * version 2 as published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| 20 | * 02110-1301 USA | ||
| 21 | * | ||
| 22 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED | ||
| 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
| 25 | * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
| 28 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
| 29 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 32 | * | ||
| 33 | */ | ||
| 34 | |||
| 35 | #include <linux/kernel.h> | ||
| 36 | #include <linux/proc_fs.h> | ||
| 37 | #include <linux/seq_file.h> | ||
| 38 | #include <linux/uaccess.h> /* FIXME remove procfs writes */ | ||
| 39 | #include <asm/arch/hardware.h> | ||
| 40 | |||
| 41 | #include "musb_core.h" | ||
| 42 | |||
| 43 | #include "davinci.h" | ||
| 44 | |||
| 45 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
| 46 | |||
| 47 | static int dump_qh(struct musb_qh *qh, char *buf, unsigned max) | ||
| 48 | { | ||
| 49 | int count; | ||
| 50 | int tmp; | ||
| 51 | struct usb_host_endpoint *hep = qh->hep; | ||
| 52 | struct urb *urb; | ||
| 53 | |||
| 54 | count = snprintf(buf, max, " qh %p dev%d ep%d%s max%d\n", | ||
| 55 | qh, qh->dev->devnum, qh->epnum, | ||
| 56 | ({ char *s; switch (qh->type) { | ||
| 57 | case USB_ENDPOINT_XFER_BULK: | ||
| 58 | s = "-bulk"; break; | ||
| 59 | case USB_ENDPOINT_XFER_INT: | ||
| 60 | s = "-int"; break; | ||
| 61 | case USB_ENDPOINT_XFER_CONTROL: | ||
| 62 | s = ""; break; | ||
| 63 | default: | ||
| 64 | s = "iso"; break; | ||
| 65 | }; s; }), | ||
| 66 | qh->maxpacket); | ||
| 67 | if (count <= 0) | ||
| 68 | return 0; | ||
| 69 | buf += count; | ||
| 70 | max -= count; | ||
| 71 | |||
| 72 | list_for_each_entry(urb, &hep->urb_list, urb_list) { | ||
| 73 | tmp = snprintf(buf, max, "\t%s urb %p %d/%d\n", | ||
| 74 | usb_pipein(urb->pipe) ? "in" : "out", | ||
| 75 | urb, urb->actual_length, | ||
| 76 | urb->transfer_buffer_length); | ||
| 77 | if (tmp <= 0) | ||
| 78 | break; | ||
| 79 | tmp = min(tmp, (int)max); | ||
| 80 | count += tmp; | ||
| 81 | buf += tmp; | ||
| 82 | max -= tmp; | ||
| 83 | } | ||
| 84 | return count; | ||
| 85 | } | ||
| 86 | |||
| 87 | static int | ||
| 88 | dump_queue(struct list_head *q, char *buf, unsigned max) | ||
| 89 | { | ||
| 90 | int count = 0; | ||
| 91 | struct musb_qh *qh; | ||
| 92 | |||
| 93 | list_for_each_entry(qh, q, ring) { | ||
| 94 | int tmp; | ||
| 95 | |||
| 96 | tmp = dump_qh(qh, buf, max); | ||
| 97 | if (tmp <= 0) | ||
| 98 | break; | ||
| 99 | tmp = min(tmp, (int)max); | ||
| 100 | count += tmp; | ||
| 101 | buf += tmp; | ||
| 102 | max -= tmp; | ||
| 103 | } | ||
| 104 | return count; | ||
| 105 | } | ||
| 106 | |||
| 107 | #endif /* HCD */ | ||
| 108 | |||
| 109 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
| 110 | static int dump_ep(struct musb_ep *ep, char *buffer, unsigned max) | ||
| 111 | { | ||
| 112 | char *buf = buffer; | ||
| 113 | int code = 0; | ||
| 114 | void __iomem *regs = ep->hw_ep->regs; | ||
| 115 | char *mode = "1buf"; | ||
| 116 | |||
| 117 | if (ep->is_in) { | ||
| 118 | if (ep->hw_ep->tx_double_buffered) | ||
| 119 | mode = "2buf"; | ||
| 120 | } else { | ||
| 121 | if (ep->hw_ep->rx_double_buffered) | ||
| 122 | mode = "2buf"; | ||
| 123 | } | ||
| 124 | |||
| 125 | do { | ||
| 126 | struct usb_request *req; | ||
| 127 | |||
| 128 | code = snprintf(buf, max, | ||
| 129 | "\n%s (hw%d): %s%s, csr %04x maxp %04x\n", | ||
| 130 | ep->name, ep->current_epnum, | ||
| 131 | mode, ep->dma ? " dma" : "", | ||
| 132 | musb_readw(regs, | ||
| 133 | (ep->is_in || !ep->current_epnum) | ||
| 134 | ? MUSB_TXCSR | ||
| 135 | : MUSB_RXCSR), | ||
| 136 | musb_readw(regs, ep->is_in | ||
| 137 | ? MUSB_TXMAXP | ||
| 138 | : MUSB_RXMAXP) | ||
| 139 | ); | ||
| 140 | if (code <= 0) | ||
| 141 | break; | ||
| 142 | code = min(code, (int) max); | ||
| 143 | buf += code; | ||
| 144 | max -= code; | ||
| 145 | |||
| 146 | if (is_cppi_enabled() && ep->current_epnum) { | ||
| 147 | unsigned cppi = ep->current_epnum - 1; | ||
| 148 | void __iomem *base = ep->musb->ctrl_base; | ||
| 149 | unsigned off1 = cppi << 2; | ||
| 150 | void __iomem *ram = base; | ||
| 151 | char tmp[16]; | ||
| 152 | |||
| 153 | if (ep->is_in) { | ||
| 154 | ram += DAVINCI_TXCPPI_STATERAM_OFFSET(cppi); | ||
| 155 | tmp[0] = 0; | ||
| 156 | } else { | ||
| 157 | ram += DAVINCI_RXCPPI_STATERAM_OFFSET(cppi); | ||
| 158 | snprintf(tmp, sizeof tmp, "%d left, ", | ||
| 159 | musb_readl(base, | ||
| 160 | DAVINCI_RXCPPI_BUFCNT0_REG + off1)); | ||
| 161 | } | ||
| 162 | |||
| 163 | code = snprintf(buf, max, "%cX DMA%d: %s" | ||
| 164 | "%08x %08x, %08x %08x; " | ||
| 165 | "%08x %08x %08x .. %08x\n", | ||
| 166 | ep->is_in ? 'T' : 'R', | ||
| 167 | ep->current_epnum - 1, tmp, | ||
| 168 | musb_readl(ram, 0 * 4), | ||
| 169 | musb_readl(ram, 1 * 4), | ||
| 170 | musb_readl(ram, 2 * 4), | ||
| 171 | musb_readl(ram, 3 * 4), | ||
| 172 | musb_readl(ram, 4 * 4), | ||
| 173 | musb_readl(ram, 5 * 4), | ||
| 174 | musb_readl(ram, 6 * 4), | ||
| 175 | musb_readl(ram, 7 * 4)); | ||
| 176 | if (code <= 0) | ||
| 177 | break; | ||
| 178 | code = min(code, (int) max); | ||
| 179 | buf += code; | ||
| 180 | max -= code; | ||
| 181 | } | ||
| 182 | |||
| 183 | if (list_empty(&ep->req_list)) { | ||
| 184 | code = snprintf(buf, max, "\t(queue empty)\n"); | ||
| 185 | if (code <= 0) | ||
| 186 | break; | ||
| 187 | code = min(code, (int) max); | ||
| 188 | buf += code; | ||
| 189 | max -= code; | ||
| 190 | break; | ||
| 191 | } | ||
| 192 | list_for_each_entry(req, &ep->req_list, list) { | ||
| 193 | code = snprintf(buf, max, "\treq %p, %s%s%d/%d\n", | ||
| 194 | req, | ||
| 195 | req->zero ? "zero, " : "", | ||
| 196 | req->short_not_ok ? "!short, " : "", | ||
| 197 | req->actual, req->length); | ||
| 198 | if (code <= 0) | ||
| 199 | break; | ||
| 200 | code = min(code, (int) max); | ||
| 201 | buf += code; | ||
| 202 | max -= code; | ||
| 203 | } | ||
| 204 | } while (0); | ||
| 205 | return buf - buffer; | ||
| 206 | } | ||
| 207 | #endif | ||
| 208 | |||
| 209 | static int | ||
| 210 | dump_end_info(struct musb *musb, u8 epnum, char *aBuffer, unsigned max) | ||
| 211 | { | ||
| 212 | int code = 0; | ||
| 213 | char *buf = aBuffer; | ||
| 214 | struct musb_hw_ep *hw_ep = &musb->endpoints[epnum]; | ||
| 215 | |||
| 216 | do { | ||
| 217 | musb_ep_select(musb->mregs, epnum); | ||
| 218 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
| 219 | if (is_host_active(musb)) { | ||
| 220 | int dump_rx, dump_tx; | ||
| 221 | void __iomem *regs = hw_ep->regs; | ||
| 222 | |||
| 223 | /* TEMPORARY (!) until we have a real periodic | ||
| 224 | * schedule tree ... | ||
| 225 | */ | ||
| 226 | if (!epnum) { | ||
| 227 | /* control is shared, uses RX queue | ||
| 228 | * but (mostly) shadowed tx registers | ||
| 229 | */ | ||
| 230 | dump_tx = !list_empty(&musb->control); | ||
| 231 | dump_rx = 0; | ||
| 232 | } else if (hw_ep == musb->bulk_ep) { | ||
| 233 | dump_tx = !list_empty(&musb->out_bulk); | ||
| 234 | dump_rx = !list_empty(&musb->in_bulk); | ||
| 235 | } else if (musb->periodic[epnum]) { | ||
| 236 | struct usb_host_endpoint *hep; | ||
| 237 | |||
| 238 | hep = musb->periodic[epnum]->hep; | ||
| 239 | dump_rx = hep->desc.bEndpointAddress | ||
| 240 | & USB_ENDPOINT_DIR_MASK; | ||
| 241 | dump_tx = !dump_rx; | ||
| 242 | } else | ||
| 243 | break; | ||
| 244 | /* END TEMPORARY */ | ||
| 245 | |||
| 246 | |||
| 247 | if (dump_rx) { | ||
| 248 | code = snprintf(buf, max, | ||
| 249 | "\nRX%d: %s rxcsr %04x interval %02x " | ||
| 250 | "max %04x type %02x; " | ||
| 251 | "dev %d hub %d port %d" | ||
| 252 | "\n", | ||
| 253 | epnum, | ||
| 254 | hw_ep->rx_double_buffered | ||
| 255 | ? "2buf" : "1buf", | ||
| 256 | musb_readw(regs, MUSB_RXCSR), | ||
| 257 | musb_readb(regs, MUSB_RXINTERVAL), | ||
| 258 | musb_readw(regs, MUSB_RXMAXP), | ||
| 259 | musb_readb(regs, MUSB_RXTYPE), | ||
| 260 | /* FIXME: assumes multipoint */ | ||
| 261 | musb_readb(musb->mregs, | ||
| 262 | MUSB_BUSCTL_OFFSET(epnum, | ||
| 263 | MUSB_RXFUNCADDR)), | ||
| 264 | musb_readb(musb->mregs, | ||
| 265 | MUSB_BUSCTL_OFFSET(epnum, | ||
| 266 | MUSB_RXHUBADDR)), | ||
| 267 | musb_readb(musb->mregs, | ||
| 268 | MUSB_BUSCTL_OFFSET(epnum, | ||
| 269 | MUSB_RXHUBPORT)) | ||
| 270 | ); | ||
| 271 | if (code <= 0) | ||
| 272 | break; | ||
| 273 | code = min(code, (int) max); | ||
| 274 | buf += code; | ||
| 275 | max -= code; | ||
| 276 | |||
| 277 | if (is_cppi_enabled() | ||
| 278 | && epnum | ||
| 279 | && hw_ep->rx_channel) { | ||
| 280 | unsigned cppi = epnum - 1; | ||
| 281 | unsigned off1 = cppi << 2; | ||
| 282 | void __iomem *base; | ||
| 283 | void __iomem *ram; | ||
| 284 | char tmp[16]; | ||
| 285 | |||
| 286 | base = musb->ctrl_base; | ||
| 287 | ram = DAVINCI_RXCPPI_STATERAM_OFFSET( | ||
| 288 | cppi) + base; | ||
| 289 | snprintf(tmp, sizeof tmp, "%d left, ", | ||
| 290 | musb_readl(base, | ||
| 291 | DAVINCI_RXCPPI_BUFCNT0_REG | ||
| 292 | + off1)); | ||
| 293 | |||
| 294 | code = snprintf(buf, max, | ||
| 295 | " rx dma%d: %s" | ||
| 296 | "%08x %08x, %08x %08x; " | ||
| 297 | "%08x %08x %08x .. %08x\n", | ||
| 298 | cppi, tmp, | ||
| 299 | musb_readl(ram, 0 * 4), | ||
| 300 | musb_readl(ram, 1 * 4), | ||
| 301 | musb_readl(ram, 2 * 4), | ||
| 302 | musb_readl(ram, 3 * 4), | ||
| 303 | musb_readl(ram, 4 * 4), | ||
| 304 | musb_readl(ram, 5 * 4), | ||
| 305 | musb_readl(ram, 6 * 4), | ||
| 306 | musb_readl(ram, 7 * 4)); | ||
| 307 | if (code <= 0) | ||
| 308 | break; | ||
| 309 | code = min(code, (int) max); | ||
| 310 | buf += code; | ||
| 311 | max -= code; | ||
| 312 | } | ||
| 313 | |||
| 314 | if (hw_ep == musb->bulk_ep | ||
| 315 | && !list_empty( | ||
| 316 | &musb->in_bulk)) { | ||
| 317 | code = dump_queue(&musb->in_bulk, | ||
| 318 | buf, max); | ||
| 319 | if (code <= 0) | ||
| 320 | break; | ||
| 321 | code = min(code, (int) max); | ||
| 322 | buf += code; | ||
| 323 | max -= code; | ||
| 324 | } else if (musb->periodic[epnum]) { | ||
| 325 | code = dump_qh(musb->periodic[epnum], | ||
| 326 | buf, max); | ||
| 327 | if (code <= 0) | ||
| 328 | break; | ||
| 329 | code = min(code, (int) max); | ||
| 330 | buf += code; | ||
| 331 | max -= code; | ||
| 332 | } | ||
| 333 | } | ||
| 334 | |||
| 335 | if (dump_tx) { | ||
| 336 | code = snprintf(buf, max, | ||
| 337 | "\nTX%d: %s txcsr %04x interval %02x " | ||
| 338 | "max %04x type %02x; " | ||
| 339 | "dev %d hub %d port %d" | ||
| 340 | "\n", | ||
| 341 | epnum, | ||
| 342 | hw_ep->tx_double_buffered | ||
| 343 | ? "2buf" : "1buf", | ||
| 344 | musb_readw(regs, MUSB_TXCSR), | ||
| 345 | musb_readb(regs, MUSB_TXINTERVAL), | ||
| 346 | musb_readw(regs, MUSB_TXMAXP), | ||
| 347 | musb_readb(regs, MUSB_TXTYPE), | ||
| 348 | /* FIXME: assumes multipoint */ | ||
| 349 | musb_readb(musb->mregs, | ||
| 350 | MUSB_BUSCTL_OFFSET(epnum, | ||
| 351 | MUSB_TXFUNCADDR)), | ||
| 352 | musb_readb(musb->mregs, | ||
| 353 | MUSB_BUSCTL_OFFSET(epnum, | ||
| 354 | MUSB_TXHUBADDR)), | ||
| 355 | musb_readb(musb->mregs, | ||
| 356 | MUSB_BUSCTL_OFFSET(epnum, | ||
| 357 | MUSB_TXHUBPORT)) | ||
| 358 | ); | ||
| 359 | if (code <= 0) | ||
| 360 | break; | ||
| 361 | code = min(code, (int) max); | ||
| 362 | buf += code; | ||
| 363 | max -= code; | ||
| 364 | |||
| 365 | if (is_cppi_enabled() | ||
| 366 | && epnum | ||
| 367 | && hw_ep->tx_channel) { | ||
| 368 | unsigned cppi = epnum - 1; | ||
| 369 | void __iomem *base; | ||
| 370 | void __iomem *ram; | ||
| 371 | |||
| 372 | base = musb->ctrl_base; | ||
| 373 | ram = DAVINCI_RXCPPI_STATERAM_OFFSET( | ||
| 374 | cppi) + base; | ||
| 375 | code = snprintf(buf, max, | ||
| 376 | " tx dma%d: " | ||
| 377 | "%08x %08x, %08x %08x; " | ||
| 378 | "%08x %08x %08x .. %08x\n", | ||
| 379 | cppi, | ||
| 380 | musb_readl(ram, 0 * 4), | ||
| 381 | musb_readl(ram, 1 * 4), | ||
| 382 | musb_readl(ram, 2 * 4), | ||
| 383 | musb_readl(ram, 3 * 4), | ||
| 384 | musb_readl(ram, 4 * 4), | ||
| 385 | musb_readl(ram, 5 * 4), | ||
| 386 | musb_readl(ram, 6 * 4), | ||
| 387 | musb_readl(ram, 7 * 4)); | ||
| 388 | if (code <= 0) | ||
| 389 | break; | ||
| 390 | code = min(code, (int) max); | ||
| 391 | buf += code; | ||
| 392 | max -= code; | ||
| 393 | } | ||
| 394 | |||
| 395 | if (hw_ep == musb->control_ep | ||
| 396 | && !list_empty( | ||
| 397 | &musb->control)) { | ||
| 398 | code = dump_queue(&musb->control, | ||
| 399 | buf, max); | ||
| 400 | if (code <= 0) | ||
| 401 | break; | ||
| 402 | code = min(code, (int) max); | ||
| 403 | buf += code; | ||
| 404 | max -= code; | ||
| 405 | } else if (hw_ep == musb->bulk_ep | ||
| 406 | && !list_empty( | ||
| 407 | &musb->out_bulk)) { | ||
| 408 | code = dump_queue(&musb->out_bulk, | ||
| 409 | buf, max); | ||
| 410 | if (code <= 0) | ||
| 411 | break; | ||
| 412 | code = min(code, (int) max); | ||
| 413 | buf += code; | ||
| 414 | max -= code; | ||
| 415 | } else if (musb->periodic[epnum]) { | ||
| 416 | code = dump_qh(musb->periodic[epnum], | ||
| 417 | buf, max); | ||
| 418 | if (code <= 0) | ||
| 419 | break; | ||
| 420 | code = min(code, (int) max); | ||
| 421 | buf += code; | ||
| 422 | max -= code; | ||
| 423 | } | ||
| 424 | } | ||
| 425 | } | ||
| 426 | #endif | ||
| 427 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
| 428 | if (is_peripheral_active(musb)) { | ||
| 429 | code = 0; | ||
| 430 | |||
| 431 | if (hw_ep->ep_in.desc || !epnum) { | ||
| 432 | code = dump_ep(&hw_ep->ep_in, buf, max); | ||
| 433 | if (code <= 0) | ||
| 434 | break; | ||
| 435 | code = min(code, (int) max); | ||
| 436 | buf += code; | ||
| 437 | max -= code; | ||
| 438 | } | ||
| 439 | if (hw_ep->ep_out.desc) { | ||
| 440 | code = dump_ep(&hw_ep->ep_out, buf, max); | ||
| 441 | if (code <= 0) | ||
| 442 | break; | ||
| 443 | code = min(code, (int) max); | ||
| 444 | buf += code; | ||
| 445 | max -= code; | ||
| 446 | } | ||
| 447 | } | ||
| 448 | #endif | ||
| 449 | } while (0); | ||
| 450 | |||
| 451 | return buf - aBuffer; | ||
| 452 | } | ||
| 453 | |||
| 454 | /* Dump the current status and compile options. | ||
| 455 | * @param musb the device driver instance | ||
| 456 | * @param buffer where to dump the status; it must be big enough to hold the | ||
| 457 | * result otherwise "BAD THINGS HAPPENS(TM)". | ||
| 458 | */ | ||
| 459 | static int dump_header_stats(struct musb *musb, char *buffer) | ||
| 460 | { | ||
| 461 | int code, count = 0; | ||
| 462 | const void __iomem *mbase = musb->mregs; | ||
| 463 | |||
| 464 | *buffer = 0; | ||
| 465 | count = sprintf(buffer, "Status: %sHDRC, Mode=%s " | ||
| 466 | "(Power=%02x, DevCtl=%02x)\n", | ||
| 467 | (musb->is_multipoint ? "M" : ""), MUSB_MODE(musb), | ||
| 468 | musb_readb(mbase, MUSB_POWER), | ||
| 469 | musb_readb(mbase, MUSB_DEVCTL)); | ||
| 470 | if (count <= 0) | ||
| 471 | return 0; | ||
| 472 | buffer += count; | ||
| 473 | |||
| 474 | code = sprintf(buffer, "OTG state: %s; %sactive\n", | ||
| 475 | otg_state_string(musb), | ||
| 476 | musb->is_active ? "" : "in"); | ||
| 477 | if (code <= 0) | ||
| 478 | goto done; | ||
| 479 | buffer += code; | ||
| 480 | count += code; | ||
| 481 | |||
| 482 | code = sprintf(buffer, | ||
| 483 | "Options: " | ||
| 484 | #ifdef CONFIG_MUSB_PIO_ONLY | ||
| 485 | "pio" | ||
| 486 | #elif defined(CONFIG_USB_TI_CPPI_DMA) | ||
| 487 | "cppi-dma" | ||
| 488 | #elif defined(CONFIG_USB_INVENTRA_DMA) | ||
| 489 | "musb-dma" | ||
| 490 | #elif defined(CONFIG_USB_TUSB_OMAP_DMA) | ||
| 491 | "tusb-omap-dma" | ||
| 492 | #else | ||
| 493 | "?dma?" | ||
| 494 | #endif | ||
| 495 | ", " | ||
| 496 | #ifdef CONFIG_USB_MUSB_OTG | ||
| 497 | "otg (peripheral+host)" | ||
| 498 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) | ||
| 499 | "peripheral" | ||
| 500 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) | ||
| 501 | "host" | ||
| 502 | #endif | ||
| 503 | ", debug=%d [eps=%d]\n", | ||
| 504 | debug, | ||
| 505 | musb->nr_endpoints); | ||
| 506 | if (code <= 0) | ||
| 507 | goto done; | ||
| 508 | count += code; | ||
| 509 | buffer += code; | ||
| 510 | |||
| 511 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
| 512 | code = sprintf(buffer, "Peripheral address: %02x\n", | ||
| 513 | musb_readb(musb->ctrl_base, MUSB_FADDR)); | ||
| 514 | if (code <= 0) | ||
| 515 | goto done; | ||
| 516 | buffer += code; | ||
| 517 | count += code; | ||
| 518 | #endif | ||
| 519 | |||
| 520 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
| 521 | code = sprintf(buffer, "Root port status: %08x\n", | ||
| 522 | musb->port1_status); | ||
| 523 | if (code <= 0) | ||
| 524 | goto done; | ||
| 525 | buffer += code; | ||
| 526 | count += code; | ||
| 527 | #endif | ||
| 528 | |||
| 529 | #ifdef CONFIG_ARCH_DAVINCI | ||
| 530 | code = sprintf(buffer, | ||
| 531 | "DaVinci: ctrl=%02x stat=%1x phy=%03x\n" | ||
| 532 | "\trndis=%05x auto=%04x intsrc=%08x intmsk=%08x" | ||
| 533 | "\n", | ||
| 534 | musb_readl(musb->ctrl_base, DAVINCI_USB_CTRL_REG), | ||
| 535 | musb_readl(musb->ctrl_base, DAVINCI_USB_STAT_REG), | ||
| 536 | __raw_readl((void __force __iomem *) | ||
| 537 | IO_ADDRESS(USBPHY_CTL_PADDR)), | ||
| 538 | musb_readl(musb->ctrl_base, DAVINCI_RNDIS_REG), | ||
| 539 | musb_readl(musb->ctrl_base, DAVINCI_AUTOREQ_REG), | ||
| 540 | musb_readl(musb->ctrl_base, | ||
| 541 | DAVINCI_USB_INT_SOURCE_REG), | ||
| 542 | musb_readl(musb->ctrl_base, | ||
| 543 | DAVINCI_USB_INT_MASK_REG)); | ||
| 544 | if (code <= 0) | ||
| 545 | goto done; | ||
| 546 | count += code; | ||
| 547 | buffer += code; | ||
| 548 | #endif /* DAVINCI */ | ||
| 549 | |||
| 550 | #ifdef CONFIG_USB_TUSB6010 | ||
| 551 | code = sprintf(buffer, | ||
| 552 | "TUSB6010: devconf %08x, phy enable %08x drive %08x" | ||
| 553 | "\n\totg %03x timer %08x" | ||
| 554 | "\n\tprcm conf %08x mgmt %08x; int src %08x mask %08x" | ||
| 555 | "\n", | ||
| 556 | musb_readl(musb->ctrl_base, TUSB_DEV_CONF), | ||
| 557 | musb_readl(musb->ctrl_base, TUSB_PHY_OTG_CTRL_ENABLE), | ||
| 558 | musb_readl(musb->ctrl_base, TUSB_PHY_OTG_CTRL), | ||
| 559 | musb_readl(musb->ctrl_base, TUSB_DEV_OTG_STAT), | ||
| 560 | musb_readl(musb->ctrl_base, TUSB_DEV_OTG_TIMER), | ||
| 561 | musb_readl(musb->ctrl_base, TUSB_PRCM_CONF), | ||
| 562 | musb_readl(musb->ctrl_base, TUSB_PRCM_MNGMT), | ||
| 563 | musb_readl(musb->ctrl_base, TUSB_INT_SRC), | ||
| 564 | musb_readl(musb->ctrl_base, TUSB_INT_MASK)); | ||
| 565 | if (code <= 0) | ||
| 566 | goto done; | ||
| 567 | count += code; | ||
| 568 | buffer += code; | ||
| 569 | #endif /* DAVINCI */ | ||
| 570 | |||
| 571 | if (is_cppi_enabled() && musb->dma_controller) { | ||
| 572 | code = sprintf(buffer, | ||
| 573 | "CPPI: txcr=%d txsrc=%01x txena=%01x; " | ||
| 574 | "rxcr=%d rxsrc=%01x rxena=%01x " | ||
| 575 | "\n", | ||
| 576 | musb_readl(musb->ctrl_base, | ||
| 577 | DAVINCI_TXCPPI_CTRL_REG), | ||
| 578 | musb_readl(musb->ctrl_base, | ||
| 579 | DAVINCI_TXCPPI_RAW_REG), | ||
| 580 | musb_readl(musb->ctrl_base, | ||
| 581 | DAVINCI_TXCPPI_INTENAB_REG), | ||
| 582 | musb_readl(musb->ctrl_base, | ||
| 583 | DAVINCI_RXCPPI_CTRL_REG), | ||
| 584 | musb_readl(musb->ctrl_base, | ||
| 585 | DAVINCI_RXCPPI_RAW_REG), | ||
| 586 | musb_readl(musb->ctrl_base, | ||
| 587 | DAVINCI_RXCPPI_INTENAB_REG)); | ||
| 588 | if (code <= 0) | ||
| 589 | goto done; | ||
| 590 | count += code; | ||
| 591 | buffer += code; | ||
| 592 | } | ||
| 593 | |||
| 594 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
| 595 | if (is_peripheral_enabled(musb)) { | ||
| 596 | code = sprintf(buffer, "Gadget driver: %s\n", | ||
| 597 | musb->gadget_driver | ||
| 598 | ? musb->gadget_driver->driver.name | ||
| 599 | : "(none)"); | ||
| 600 | if (code <= 0) | ||
| 601 | goto done; | ||
| 602 | count += code; | ||
| 603 | buffer += code; | ||
| 604 | } | ||
| 605 | #endif | ||
| 606 | |||
| 607 | done: | ||
| 608 | return count; | ||
| 609 | } | ||
| 610 | |||
| 611 | /* Write to ProcFS | ||
| 612 | * | ||
| 613 | * C soft-connect | ||
| 614 | * c soft-disconnect | ||
| 615 | * I enable HS | ||
| 616 | * i disable HS | ||
| 617 | * s stop session | ||
| 618 | * F force session (OTG-unfriendly) | ||
| 619 | * E rElinquish bus (OTG) | ||
| 620 | * H request host mode | ||
| 621 | * h cancel host request | ||
| 622 | * T start sending TEST_PACKET | ||
| 623 | * D<num> set/query the debug level | ||
| 624 | */ | ||
| 625 | static int musb_proc_write(struct file *file, const char __user *buffer, | ||
| 626 | unsigned long count, void *data) | ||
| 627 | { | ||
| 628 | char cmd; | ||
| 629 | u8 reg; | ||
| 630 | struct musb *musb = (struct musb *)data; | ||
| 631 | void __iomem *mbase = musb->mregs; | ||
| 632 | |||
| 633 | /* MOD_INC_USE_COUNT; */ | ||
| 634 | |||
| 635 | if (unlikely(copy_from_user(&cmd, buffer, 1))) | ||
| 636 | return -EFAULT; | ||
| 637 | |||
| 638 | switch (cmd) { | ||
| 639 | case 'C': | ||
| 640 | if (mbase) { | ||
| 641 | reg = musb_readb(mbase, MUSB_POWER) | ||
| 642 | | MUSB_POWER_SOFTCONN; | ||
| 643 | musb_writeb(mbase, MUSB_POWER, reg); | ||
| 644 | } | ||
| 645 | break; | ||
| 646 | |||
| 647 | case 'c': | ||
| 648 | if (mbase) { | ||
| 649 | reg = musb_readb(mbase, MUSB_POWER) | ||
| 650 | & ~MUSB_POWER_SOFTCONN; | ||
| 651 | musb_writeb(mbase, MUSB_POWER, reg); | ||
| 652 | } | ||
| 653 | break; | ||
| 654 | |||
| 655 | case 'I': | ||
| 656 | if (mbase) { | ||
| 657 | reg = musb_readb(mbase, MUSB_POWER) | ||
| 658 | | MUSB_POWER_HSENAB; | ||
| 659 | musb_writeb(mbase, MUSB_POWER, reg); | ||
| 660 | } | ||
| 661 | break; | ||
| 662 | |||
| 663 | case 'i': | ||
| 664 | if (mbase) { | ||
| 665 | reg = musb_readb(mbase, MUSB_POWER) | ||
| 666 | & ~MUSB_POWER_HSENAB; | ||
| 667 | musb_writeb(mbase, MUSB_POWER, reg); | ||
| 668 | } | ||
| 669 | break; | ||
| 670 | |||
| 671 | case 'F': | ||
| 672 | reg = musb_readb(mbase, MUSB_DEVCTL); | ||
| 673 | reg |= MUSB_DEVCTL_SESSION; | ||
| 674 | musb_writeb(mbase, MUSB_DEVCTL, reg); | ||
| 675 | break; | ||
| 676 | |||
| 677 | case 'H': | ||
| 678 | if (mbase) { | ||
| 679 | reg = musb_readb(mbase, MUSB_DEVCTL); | ||
| 680 | reg |= MUSB_DEVCTL_HR; | ||
| 681 | musb_writeb(mbase, MUSB_DEVCTL, reg); | ||
| 682 | /* MUSB_HST_MODE( ((struct musb*)data) ); */ | ||
| 683 | /* WARNING("Host Mode\n"); */ | ||
| 684 | } | ||
| 685 | break; | ||
| 686 | |||
| 687 | case 'h': | ||
| 688 | if (mbase) { | ||
| 689 | reg = musb_readb(mbase, MUSB_DEVCTL); | ||
| 690 | reg &= ~MUSB_DEVCTL_HR; | ||
| 691 | musb_writeb(mbase, MUSB_DEVCTL, reg); | ||
| 692 | } | ||
| 693 | break; | ||
| 694 | |||
| 695 | case 'T': | ||
| 696 | if (mbase) { | ||
| 697 | musb_load_testpacket(musb); | ||
| 698 | musb_writeb(mbase, MUSB_TESTMODE, | ||
| 699 | MUSB_TEST_PACKET); | ||
| 700 | } | ||
| 701 | break; | ||
| 702 | |||
| 703 | #if (MUSB_DEBUG > 0) | ||
| 704 | /* set/read debug level */ | ||
| 705 | case 'D':{ | ||
| 706 | if (count > 1) { | ||
| 707 | char digits[8], *p = digits; | ||
| 708 | int i = 0, level = 0, sign = 1; | ||
| 709 | int len = min(count - 1, (unsigned long)8); | ||
| 710 | |||
| 711 | if (copy_from_user(&digits, &buffer[1], len)) | ||
| 712 | return -EFAULT; | ||
| 713 | |||
| 714 | /* optional sign */ | ||
| 715 | if (*p == '-') { | ||
| 716 | len -= 1; | ||
| 717 | sign = -sign; | ||
| 718 | p++; | ||
| 719 | } | ||
| 720 | |||
| 721 | /* read it */ | ||
| 722 | while (i++ < len && *p > '0' && *p < '9') { | ||
| 723 | level = level * 10 + (*p - '0'); | ||
| 724 | p++; | ||
| 725 | } | ||
| 726 | |||
| 727 | level *= sign; | ||
| 728 | DBG(1, "debug level %d\n", level); | ||
| 729 | debug = level; | ||
| 730 | } | ||
| 731 | } | ||
| 732 | break; | ||
| 733 | |||
| 734 | |||
| 735 | case '?': | ||
| 736 | INFO("?: you are seeing it\n"); | ||
| 737 | INFO("C/c: soft connect enable/disable\n"); | ||
| 738 | INFO("I/i: hispeed enable/disable\n"); | ||
| 739 | INFO("F: force session start\n"); | ||
| 740 | INFO("H: host mode\n"); | ||
| 741 | INFO("T: start sending TEST_PACKET\n"); | ||
| 742 | INFO("D: set/read dbug level\n"); | ||
| 743 | break; | ||
| 744 | #endif | ||
| 745 | |||
| 746 | default: | ||
| 747 | ERR("Command %c not implemented\n", cmd); | ||
| 748 | break; | ||
| 749 | } | ||
| 750 | |||
| 751 | musb_platform_try_idle(musb, 0); | ||
| 752 | |||
| 753 | return count; | ||
| 754 | } | ||
| 755 | |||
| 756 | static int musb_proc_read(char *page, char **start, | ||
| 757 | off_t off, int count, int *eof, void *data) | ||
| 758 | { | ||
| 759 | char *buffer = page; | ||
| 760 | int code = 0; | ||
| 761 | unsigned long flags; | ||
| 762 | struct musb *musb = data; | ||
| 763 | unsigned epnum; | ||
| 764 | |||
| 765 | count -= off; | ||
| 766 | count -= 1; /* for NUL at end */ | ||
| 767 | if (count <= 0) | ||
| 768 | return -EINVAL; | ||
| 769 | |||
| 770 | spin_lock_irqsave(&musb->lock, flags); | ||
| 771 | |||
| 772 | code = dump_header_stats(musb, buffer); | ||
| 773 | if (code > 0) { | ||
| 774 | buffer += code; | ||
| 775 | count -= code; | ||
| 776 | } | ||
| 777 | |||
| 778 | /* generate the report for the end points */ | ||
| 779 | /* REVISIT ... not unless something's connected! */ | ||
| 780 | for (epnum = 0; count >= 0 && epnum < musb->nr_endpoints; | ||
| 781 | epnum++) { | ||
| 782 | code = dump_end_info(musb, epnum, buffer, count); | ||
| 783 | if (code > 0) { | ||
| 784 | buffer += code; | ||
| 785 | count -= code; | ||
| 786 | } | ||
| 787 | } | ||
| 788 | |||
| 789 | musb_platform_try_idle(musb, 0); | ||
| 790 | |||
| 791 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 792 | *eof = 1; | ||
| 793 | |||
| 794 | return buffer - page; | ||
| 795 | } | ||
| 796 | |||
| 797 | void __devexit musb_debug_delete(char *name, struct musb *musb) | ||
| 798 | { | ||
| 799 | if (musb->proc_entry) | ||
| 800 | remove_proc_entry(name, NULL); | ||
| 801 | } | ||
| 802 | |||
| 803 | struct proc_dir_entry *__init | ||
| 804 | musb_debug_create(char *name, struct musb *data) | ||
| 805 | { | ||
| 806 | struct proc_dir_entry *pde; | ||
| 807 | |||
| 808 | /* FIXME convert everything to seq_file; then later, debugfs */ | ||
| 809 | |||
| 810 | if (!name) | ||
| 811 | return NULL; | ||
| 812 | |||
| 813 | pde = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, NULL); | ||
| 814 | data->proc_entry = pde; | ||
| 815 | if (pde) { | ||
| 816 | pde->data = data; | ||
| 817 | /* pde->owner = THIS_MODULE; */ | ||
| 818 | |||
| 819 | pde->read_proc = musb_proc_read; | ||
| 820 | pde->write_proc = musb_proc_write; | ||
| 821 | |||
| 822 | pde->size = 0; | ||
| 823 | |||
| 824 | pr_debug("Registered /proc/%s\n", name); | ||
| 825 | } else { | ||
| 826 | pr_debug("Cannot create a valid proc file entry"); | ||
| 827 | } | ||
| 828 | |||
| 829 | return pde; | ||
| 830 | } | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 298b22e6ad0d..9d2dcb121c5e 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
| @@ -35,8 +35,8 @@ | |||
| 35 | #include <linux/io.h> | 35 | #include <linux/io.h> |
| 36 | 36 | ||
| 37 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
| 38 | #include <asm/arch/hardware.h> | 38 | #include <mach/hardware.h> |
| 39 | #include <asm/arch/mux.h> | 39 | #include <mach/mux.h> |
| 40 | 40 | ||
| 41 | #include "musb_core.h" | 41 | #include "musb_core.h" |
| 42 | #include "omap2430.h" | 42 | #include "omap2430.h" |
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h index 786a62071f72..dc7670718cd2 100644 --- a/drivers/usb/musb/omap2430.h +++ b/drivers/usb/musb/omap2430.h | |||
| @@ -11,8 +11,8 @@ | |||
| 11 | #define __MUSB_OMAP243X_H__ | 11 | #define __MUSB_OMAP243X_H__ |
| 12 | 12 | ||
| 13 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) | 13 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) |
| 14 | #include <asm/arch/hardware.h> | 14 | #include <mach/hardware.h> |
| 15 | #include <asm/arch/usb.h> | 15 | #include <mach/usb.h> |
| 16 | 16 | ||
| 17 | /* | 17 | /* |
| 18 | * OMAP2430-specific definitions | 18 | * OMAP2430-specific definitions |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 7b74238ad1c7..e980766bb84b 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
| @@ -161,7 +161,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
| 161 | if (serial->type->set_termios) { | 161 | if (serial->type->set_termios) { |
| 162 | termios->c_cflag = cflag; | 162 | termios->c_cflag = cflag; |
| 163 | tty_termios_encode_baud_rate(termios, baud, baud); | 163 | tty_termios_encode_baud_rate(termios, baud, baud); |
| 164 | serial->type->set_termios(NULL, port, &dummy); | 164 | serial->type->set_termios(tty, port, &dummy); |
| 165 | 165 | ||
| 166 | port->port.tty = NULL; | 166 | port->port.tty = NULL; |
| 167 | kfree(termios); | 167 | kfree(termios); |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index 442cba69cce5..1279553381e3 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
| @@ -72,6 +72,7 @@ static struct usb_device_id id_table [] = { | |||
| 72 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ | 72 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ |
| 73 | { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */ | 73 | { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */ |
| 74 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ | 74 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ |
| 75 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ | ||
| 75 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ | 76 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ |
| 76 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | 77 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
| 77 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 78 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
| @@ -83,6 +84,7 @@ static struct usb_device_id id_table [] = { | |||
| 83 | { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ | 84 | { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ |
| 84 | { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ | 85 | { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ |
| 85 | { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */ | 86 | { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */ |
| 87 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ | ||
| 86 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 88 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
| 87 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ | 89 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
| 88 | { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ | 90 | { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ |
| @@ -93,6 +95,7 @@ static struct usb_device_id id_table [] = { | |||
| 93 | { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ | 95 | { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ |
| 94 | { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ | 96 | { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ |
| 95 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ | 97 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ |
| 98 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | ||
| 96 | { } /* Terminating Entry */ | 99 | { } /* Terminating Entry */ |
| 97 | }; | 100 | }; |
| 98 | 101 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 984f6eff4c47..3dc93b542b30 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -654,6 +654,9 @@ static struct usb_device_id id_table_combined [] = { | |||
| 654 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 654 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
| 655 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | 655 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, |
| 656 | { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, | 656 | { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, |
| 657 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, | ||
| 658 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, | ||
| 659 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, | ||
| 657 | { }, /* Optional parameter entry */ | 660 | { }, /* Optional parameter entry */ |
| 658 | { } /* Terminating entry */ | 661 | { } /* Terminating entry */ |
| 659 | }; | 662 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 382265bba969..8a5b6df3a976 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
| @@ -750,6 +750,7 @@ | |||
| 750 | 750 | ||
| 751 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ | 751 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ |
| 752 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ | 752 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ |
| 753 | #define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */ | ||
| 753 | 754 | ||
| 754 | /* | 755 | /* |
| 755 | * ACG Identification Technologies GmbH products (http://www.acg.de/). | 756 | * ACG Identification Technologies GmbH products (http://www.acg.de/). |
| @@ -838,6 +839,10 @@ | |||
| 838 | /* Rig Expert Ukraine devices */ | 839 | /* Rig Expert Ukraine devices */ |
| 839 | #define FTDI_REU_TINY_PID 0xED22 /* RigExpert Tiny */ | 840 | #define FTDI_REU_TINY_PID 0xED22 /* RigExpert Tiny */ |
| 840 | 841 | ||
| 842 | /* Domintell products http://www.domintell.com */ | ||
| 843 | #define FTDI_DOMINTELL_DGQG_PID 0xEF50 /* Master */ | ||
| 844 | #define FTDI_DOMINTELL_DUSB_PID 0xEF51 /* DUSB01 module */ | ||
| 845 | |||
| 841 | /* Commands */ | 846 | /* Commands */ |
| 842 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 847 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
| 843 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 848 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 2e663f1afd5e..d95382088075 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
| @@ -38,8 +38,6 @@ | |||
| 38 | #include <linux/usb.h> | 38 | #include <linux/usb.h> |
| 39 | #include <linux/usb/serial.h> | 39 | #include <linux/usb/serial.h> |
| 40 | 40 | ||
| 41 | #include <linux/version.h> | ||
| 42 | |||
| 43 | /* the mode to be set when the port ist opened */ | 41 | /* the mode to be set when the port ist opened */ |
| 44 | static int initial_mode = 1; | 42 | static int initial_mode = 1; |
| 45 | 43 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e143198aeb02..73f8277f88f2 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -173,6 +173,7 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po | |||
| 173 | #define KYOCERA_PRODUCT_KPC680 0x180a | 173 | #define KYOCERA_PRODUCT_KPC680 0x180a |
| 174 | 174 | ||
| 175 | #define ANYDATA_VENDOR_ID 0x16d5 | 175 | #define ANYDATA_VENDOR_ID 0x16d5 |
| 176 | #define ANYDATA_PRODUCT_ADU_620UW 0x6202 | ||
| 176 | #define ANYDATA_PRODUCT_ADU_E100A 0x6501 | 177 | #define ANYDATA_PRODUCT_ADU_E100A 0x6501 |
| 177 | #define ANYDATA_PRODUCT_ADU_500A 0x6502 | 178 | #define ANYDATA_PRODUCT_ADU_500A 0x6502 |
| 178 | 179 | ||
| @@ -217,6 +218,7 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po | |||
| 217 | /* ZTE PRODUCTS */ | 218 | /* ZTE PRODUCTS */ |
| 218 | #define ZTE_VENDOR_ID 0x19d2 | 219 | #define ZTE_VENDOR_ID 0x19d2 |
| 219 | #define ZTE_PRODUCT_MF628 0x0015 | 220 | #define ZTE_PRODUCT_MF628 0x0015 |
| 221 | #define ZTE_PRODUCT_CDMA_TECH 0xfffe | ||
| 220 | 222 | ||
| 221 | static struct usb_device_id option_ids[] = { | 223 | static struct usb_device_id option_ids[] = { |
| 222 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 224 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
| @@ -318,6 +320,7 @@ static struct usb_device_id option_ids[] = { | |||
| 318 | { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */ | 320 | { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */ |
| 319 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, | 321 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, |
| 320 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, | 322 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
| 323 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, | ||
| 321 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, | 324 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, |
| 322 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, | 325 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, |
| 323 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, | 326 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, |
| @@ -345,6 +348,7 @@ static struct usb_device_id option_ids[] = { | |||
| 345 | { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ | 348 | { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ |
| 346 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, | 349 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, |
| 347 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, | 350 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, |
| 351 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, | ||
| 348 | { } /* Terminating entry */ | 352 | { } /* Terminating entry */ |
| 349 | }; | 353 | }; |
| 350 | MODULE_DEVICE_TABLE(usb, option_ids); | 354 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 706033753adb..ea1a103c99be 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> | 14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #define DRIVER_VERSION "v.1.2.13a" | 17 | #define DRIVER_VERSION "v.1.3.2" |
| 18 | #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" | 18 | #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" |
| 19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" | 19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" |
| 20 | 20 | ||
| @@ -30,9 +30,6 @@ | |||
| 30 | 30 | ||
| 31 | #define SWIMS_USB_REQUEST_SetPower 0x00 | 31 | #define SWIMS_USB_REQUEST_SetPower 0x00 |
| 32 | #define SWIMS_USB_REQUEST_SetNmea 0x07 | 32 | #define SWIMS_USB_REQUEST_SetNmea 0x07 |
| 33 | #define SWIMS_USB_REQUEST_SetMode 0x0B | ||
| 34 | #define SWIMS_USB_REQUEST_GetSwocInfo 0x0A | ||
| 35 | #define SWIMS_SET_MODE_Modem 0x0001 | ||
| 36 | 33 | ||
| 37 | /* per port private data */ | 34 | /* per port private data */ |
| 38 | #define N_IN_URB 4 | 35 | #define N_IN_URB 4 |
| @@ -163,7 +160,7 @@ static struct usb_device_id id_table [] = { | |||
| 163 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ | 160 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ |
| 164 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ | 161 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ |
| 165 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ | 162 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ |
| 166 | { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ | 163 | { USB_DEVICE(0x03f0, 0x1b1d) }, /* HP ev2200 a.k.a MC5720 */ |
| 167 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ | 164 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ |
| 168 | { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ | 165 | { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ |
| 169 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ | 166 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ |
| @@ -175,6 +172,8 @@ static struct usb_device_id id_table [] = { | |||
| 175 | /* Sierra Wireless Device */ | 172 | /* Sierra Wireless Device */ |
| 176 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, | 173 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, |
| 177 | { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */ | 174 | { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */ |
| 175 | { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless Device */ | ||
| 176 | { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless Device */ | ||
| 178 | 177 | ||
| 179 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ | 178 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ |
| 180 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ | 179 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ |
| @@ -187,6 +186,7 @@ static struct usb_device_id id_table [] = { | |||
| 187 | { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ | 186 | { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ |
| 188 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ | 187 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ |
| 189 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ | 188 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ |
| 189 | { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */ | ||
| 190 | { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ | 190 | { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ |
| 191 | { USB_DEVICE(0x1199, 0x683C) }, /* Sierra Wireless MC8790 */ | 191 | { USB_DEVICE(0x1199, 0x683C) }, /* Sierra Wireless MC8790 */ |
| 192 | { USB_DEVICE(0x1199, 0x683D) }, /* Sierra Wireless MC8790 */ | 192 | { USB_DEVICE(0x1199, 0x683D) }, /* Sierra Wireless MC8790 */ |
| @@ -204,6 +204,8 @@ static struct usb_device_id id_table [] = { | |||
| 204 | /* Sierra Wireless Device */ | 204 | /* Sierra Wireless Device */ |
| 205 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, | 205 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, |
| 206 | /* Sierra Wireless Device */ | 206 | /* Sierra Wireless Device */ |
| 207 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)}, | ||
| 208 | /* Sierra Wireless Device */ | ||
| 207 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 209 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
| 208 | 210 | ||
| 209 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ | 211 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index e39c779e4160..9a3e495c769c 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
| @@ -1744,7 +1744,7 @@ static int ti_download_firmware(struct ti_device *tdev, int type) | |||
| 1744 | if (buffer) { | 1744 | if (buffer) { |
| 1745 | memcpy(buffer, fw_p->data, fw_p->size); | 1745 | memcpy(buffer, fw_p->data, fw_p->size); |
| 1746 | memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size); | 1746 | memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size); |
| 1747 | ti_do_download(dev, pipe, buffer, fw_p->size); | 1747 | status = ti_do_download(dev, pipe, buffer, fw_p->size); |
| 1748 | kfree(buffer); | 1748 | kfree(buffer); |
| 1749 | } | 1749 | } |
| 1750 | release_firmware(fw_p); | 1750 | release_firmware(fw_p); |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index b157c48e8b78..4f7f9e3ae0a4 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
| @@ -733,7 +733,9 @@ int usb_serial_probe(struct usb_interface *interface, | |||
| 733 | ((le16_to_cpu(dev->descriptor.idVendor) == ATEN_VENDOR_ID) && | 733 | ((le16_to_cpu(dev->descriptor.idVendor) == ATEN_VENDOR_ID) && |
| 734 | (le16_to_cpu(dev->descriptor.idProduct) == ATEN_PRODUCT_ID)) || | 734 | (le16_to_cpu(dev->descriptor.idProduct) == ATEN_PRODUCT_ID)) || |
| 735 | ((le16_to_cpu(dev->descriptor.idVendor) == ALCOR_VENDOR_ID) && | 735 | ((le16_to_cpu(dev->descriptor.idVendor) == ALCOR_VENDOR_ID) && |
| 736 | (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID))) { | 736 | (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID)) || |
| 737 | ((le16_to_cpu(dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && | ||
| 738 | (le16_to_cpu(dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_EF81))) { | ||
| 737 | if (interface != dev->actconfig->interface[0]) { | 739 | if (interface != dev->actconfig->interface[0]) { |
| 738 | /* check out the endpoints of the other interface*/ | 740 | /* check out the endpoints of the other interface*/ |
| 739 | iface_desc = dev->actconfig->interface[0]->cur_altsetting; | 741 | iface_desc = dev->actconfig->interface[0]->cur_altsetting; |
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index c76034672c18..3d9249632ae1 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig | |||
| @@ -146,18 +146,6 @@ config USB_STORAGE_KARMA | |||
| 146 | on the resulting scsi device node returns the Karma to normal | 146 | on the resulting scsi device node returns the Karma to normal |
| 147 | operation. | 147 | operation. |
| 148 | 148 | ||
| 149 | config USB_STORAGE_SIERRA | ||
| 150 | bool "Sierra Wireless TRU-Install Feature Support" | ||
| 151 | depends on USB_STORAGE | ||
| 152 | help | ||
| 153 | Say Y here to include additional code to support Sierra Wireless | ||
| 154 | products with the TRU-Install feature (e.g., AC597E, AC881U). | ||
| 155 | |||
| 156 | This code switches the Sierra Wireless device from being in | ||
| 157 | Mass Storage mode to Modem mode. It also has the ability to | ||
| 158 | support host software upgrades should full Linux support be added | ||
| 159 | to TRU-Install. | ||
| 160 | |||
| 161 | config USB_STORAGE_CYPRESS_ATACB | 149 | config USB_STORAGE_CYPRESS_ATACB |
| 162 | bool "SAT emulation on Cypress USB/ATA Bridge with ATACB" | 150 | bool "SAT emulation on Cypress USB/ATA Bridge with ATACB" |
| 163 | depends on USB_STORAGE | 151 | depends on USB_STORAGE |
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile index bc3415b475c9..7f8beb5366ae 100644 --- a/drivers/usb/storage/Makefile +++ b/drivers/usb/storage/Makefile | |||
| @@ -21,11 +21,10 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o | |||
| 21 | usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o | 21 | usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o |
| 22 | usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o | 22 | usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o |
| 23 | usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o | 23 | usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o |
| 24 | usb-storage-obj-$(CONFIG_USB_STORAGE_SIERRA) += sierra_ms.o | ||
| 25 | usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o | 24 | usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o |
| 26 | 25 | ||
| 27 | usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ | 26 | usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ |
| 28 | initializers.o $(usb-storage-obj-y) | 27 | initializers.o sierra_ms.o $(usb-storage-obj-y) |
| 29 | 28 | ||
| 30 | ifneq ($(CONFIG_USB_LIBUSUAL),) | 29 | ifneq ($(CONFIG_USB_LIBUSUAL),) |
| 31 | obj-$(CONFIG_USB) += libusual.o | 30 | obj-$(CONFIG_USB) += libusual.o |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index ba412e68d474..cd155475cb6e 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -160,6 +160,13 @@ UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592, | |||
| 160 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 160 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 161 | US_FL_MAX_SECTORS_64 ), | 161 | US_FL_MAX_SECTORS_64 ), |
| 162 | 162 | ||
| 163 | /* Reported by Filip Joelsson <filip@blueturtle.nu> */ | ||
| 164 | UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600, | ||
| 165 | "Nokia", | ||
| 166 | "Nokia 3110c", | ||
| 167 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 168 | US_FL_FIX_CAPACITY ), | ||
| 169 | |||
| 163 | /* Reported by Mario Rettig <mariorettig@web.de> */ | 170 | /* Reported by Mario Rettig <mariorettig@web.de> */ |
| 164 | UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, | 171 | UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, |
| 165 | "Nokia", | 172 | "Nokia", |
| @@ -232,6 +239,20 @@ UNUSUAL_DEV( 0x0421, 0x04b9, 0x0551, 0x0551, | |||
| 232 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 239 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 233 | US_FL_FIX_CAPACITY ), | 240 | US_FL_FIX_CAPACITY ), |
| 234 | 241 | ||
| 242 | /* Reported by Richard Nauber <RichardNauber@web.de> */ | ||
| 243 | UNUSUAL_DEV( 0x0421, 0x04fa, 0x0601, 0x0601, | ||
| 244 | "Nokia", | ||
| 245 | "6300", | ||
| 246 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 247 | US_FL_FIX_CAPACITY ), | ||
| 248 | |||
| 249 | /* Patch for Nokia 5310 capacity */ | ||
| 250 | UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591, | ||
| 251 | "Nokia", | ||
| 252 | "5310", | ||
| 253 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 254 | US_FL_FIX_CAPACITY ), | ||
| 255 | |||
| 235 | /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ | 256 | /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ |
| 236 | UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, | 257 | UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, |
| 237 | "SMSC", | 258 | "SMSC", |
| @@ -987,6 +1008,13 @@ UNUSUAL_DEV( 0x069b, 0x3004, 0x0001, 0x0001, | |||
| 987 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1008 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 988 | US_FL_FIX_CAPACITY ), | 1009 | US_FL_FIX_CAPACITY ), |
| 989 | 1010 | ||
| 1011 | /* Reported by Adrian Pilchowiec <adi1981@epf.pl> */ | ||
| 1012 | UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x0000, | ||
| 1013 | "RockChip", | ||
| 1014 | "MP3", | ||
| 1015 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 1016 | US_FL_NO_WP_DETECT | US_FL_MAX_SECTORS_64), | ||
| 1017 | |||
| 990 | /* Reported by Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com> | 1018 | /* Reported by Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com> |
| 991 | * This USB MP3/AVI player device fails and disconnects if more than 128 | 1019 | * This USB MP3/AVI player device fails and disconnects if more than 128 |
| 992 | * sectors (64kB) are read/written in a single command, and may be present | 1020 | * sectors (64kB) are read/written in a single command, and may be present |
| @@ -1576,7 +1604,6 @@ UNUSUAL_DEV( 0x10d6, 0x2200, 0x0100, 0x0100, | |||
| 1576 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1604 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 1577 | 0), | 1605 | 0), |
| 1578 | 1606 | ||
| 1579 | #ifdef CONFIG_USB_STORAGE_SIERRA | ||
| 1580 | /* Reported by Kevin Lloyd <linux@sierrawireless.com> | 1607 | /* Reported by Kevin Lloyd <linux@sierrawireless.com> |
| 1581 | * Entry is needed for the initializer function override, | 1608 | * Entry is needed for the initializer function override, |
| 1582 | * which instructs the device to load as a modem | 1609 | * which instructs the device to load as a modem |
| @@ -1587,7 +1614,6 @@ UNUSUAL_DEV( 0x1199, 0x0fff, 0x0000, 0x9999, | |||
| 1587 | "USB MMC Storage", | 1614 | "USB MMC Storage", |
| 1588 | US_SC_DEVICE, US_PR_DEVICE, sierra_ms_init, | 1615 | US_SC_DEVICE, US_PR_DEVICE, sierra_ms_init, |
| 1589 | 0), | 1616 | 0), |
| 1590 | #endif | ||
| 1591 | 1617 | ||
| 1592 | /* Reported by Jaco Kroon <jaco@kroon.co.za> | 1618 | /* Reported by Jaco Kroon <jaco@kroon.co.za> |
| 1593 | * The usb-storage module found on the Digitech GNX4 (and supposedly other | 1619 | * The usb-storage module found on the Digitech GNX4 (and supposedly other |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 73679aa506de..27016fd2cad1 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
| @@ -102,9 +102,7 @@ | |||
| 102 | #ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB | 102 | #ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB |
| 103 | #include "cypress_atacb.h" | 103 | #include "cypress_atacb.h" |
| 104 | #endif | 104 | #endif |
| 105 | #ifdef CONFIG_USB_STORAGE_SIERRA | ||
| 106 | #include "sierra_ms.h" | 105 | #include "sierra_ms.h" |
| 107 | #endif | ||
| 108 | 106 | ||
| 109 | /* Some informational data */ | 107 | /* Some informational data */ |
| 110 | MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>"); | 108 | MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>"); |
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c index 4bd569e479a7..314d18694b6a 100644 --- a/drivers/video/arkfb.c +++ b/drivers/video/arkfb.c | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | * Code is based on s3fb | 11 | * Code is based on s3fb |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <linux/version.h> | ||
| 15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 17 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 9c5925927ece..75dac578104f 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
| @@ -208,6 +208,36 @@ static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2) | |||
| 208 | return value; | 208 | return value; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo) | ||
| 212 | { | ||
| 213 | /* Turn off the LCD controller and the DMA controller */ | ||
| 214 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, | ||
| 215 | sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); | ||
| 216 | |||
| 217 | /* Wait for the LCDC core to become idle */ | ||
| 218 | while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY) | ||
| 219 | msleep(10); | ||
| 220 | |||
| 221 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); | ||
| 222 | } | ||
| 223 | |||
| 224 | static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo) | ||
| 225 | { | ||
| 226 | atmel_lcdfb_stop_nowait(sinfo); | ||
| 227 | |||
| 228 | /* Wait for DMA engine to become idle... */ | ||
| 229 | while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) | ||
| 230 | msleep(10); | ||
| 231 | } | ||
| 232 | |||
| 233 | static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo) | ||
| 234 | { | ||
| 235 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon); | ||
| 236 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, | ||
| 237 | (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET) | ||
| 238 | | ATMEL_LCDC_PWR); | ||
| 239 | } | ||
| 240 | |||
| 211 | static void atmel_lcdfb_update_dma(struct fb_info *info, | 241 | static void atmel_lcdfb_update_dma(struct fb_info *info, |
| 212 | struct fb_var_screeninfo *var) | 242 | struct fb_var_screeninfo *var) |
| 213 | { | 243 | { |
| @@ -420,26 +450,8 @@ static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo) | |||
| 420 | { | 450 | { |
| 421 | might_sleep(); | 451 | might_sleep(); |
| 422 | 452 | ||
| 423 | /* LCD power off */ | 453 | atmel_lcdfb_stop(sinfo); |
| 424 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); | 454 | atmel_lcdfb_start(sinfo); |
| 425 | |||
| 426 | /* wait for the LCDC core to become idle */ | ||
| 427 | while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY) | ||
| 428 | msleep(10); | ||
| 429 | |||
| 430 | /* DMA disable */ | ||
| 431 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); | ||
| 432 | |||
| 433 | /* wait for DMA engine to become idle */ | ||
| 434 | while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) | ||
| 435 | msleep(10); | ||
| 436 | |||
| 437 | /* LCD power on */ | ||
| 438 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, | ||
| 439 | (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR); | ||
| 440 | |||
| 441 | /* DMA enable */ | ||
| 442 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon); | ||
| 443 | } | 455 | } |
| 444 | 456 | ||
| 445 | /** | 457 | /** |
| @@ -471,14 +483,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
| 471 | info->var.xres, info->var.yres, | 483 | info->var.xres, info->var.yres, |
| 472 | info->var.xres_virtual, info->var.yres_virtual); | 484 | info->var.xres_virtual, info->var.yres_virtual); |
| 473 | 485 | ||
| 474 | /* Turn off the LCD controller and the DMA controller */ | 486 | atmel_lcdfb_stop_nowait(sinfo); |
| 475 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); | ||
| 476 | |||
| 477 | /* Wait for the LCDC core to become idle */ | ||
| 478 | while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY) | ||
| 479 | msleep(10); | ||
| 480 | |||
| 481 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); | ||
| 482 | 487 | ||
| 483 | if (info->var.bits_per_pixel == 1) | 488 | if (info->var.bits_per_pixel == 1) |
| 484 | info->fix.visual = FB_VISUAL_MONO01; | 489 | info->fix.visual = FB_VISUAL_MONO01; |
| @@ -583,13 +588,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
| 583 | while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) | 588 | while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) |
| 584 | msleep(10); | 589 | msleep(10); |
| 585 | 590 | ||
| 586 | dev_dbg(info->device, " * re-enable DMA engine\n"); | 591 | atmel_lcdfb_start(sinfo); |
| 587 | /* ...and enable it with updated configuration */ | ||
| 588 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon); | ||
| 589 | |||
| 590 | dev_dbg(info->device, " * re-enable LCDC core\n"); | ||
| 591 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, | ||
| 592 | (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR); | ||
| 593 | 592 | ||
| 594 | dev_dbg(info->device, " * DONE\n"); | 593 | dev_dbg(info->device, " * DONE\n"); |
| 595 | 594 | ||
| @@ -939,7 +938,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
| 939 | ret = register_framebuffer(info); | 938 | ret = register_framebuffer(info); |
| 940 | if (ret < 0) { | 939 | if (ret < 0) { |
| 941 | dev_err(dev, "failed to register framebuffer device: %d\n", ret); | 940 | dev_err(dev, "failed to register framebuffer device: %d\n", ret); |
| 942 | goto free_cmap; | 941 | goto reset_drvdata; |
| 943 | } | 942 | } |
| 944 | 943 | ||
| 945 | /* add selected videomode to modelist */ | 944 | /* add selected videomode to modelist */ |
| @@ -955,7 +954,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
| 955 | 954 | ||
| 956 | return 0; | 955 | return 0; |
| 957 | 956 | ||
| 958 | 957 | reset_drvdata: | |
| 958 | dev_set_drvdata(dev, NULL); | ||
| 959 | free_cmap: | 959 | free_cmap: |
| 960 | fb_dealloc_cmap(&info->cmap); | 960 | fb_dealloc_cmap(&info->cmap); |
| 961 | unregister_irqs: | 961 | unregister_irqs: |
| @@ -992,10 +992,11 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) | |||
| 992 | { | 992 | { |
| 993 | struct device *dev = &pdev->dev; | 993 | struct device *dev = &pdev->dev; |
| 994 | struct fb_info *info = dev_get_drvdata(dev); | 994 | struct fb_info *info = dev_get_drvdata(dev); |
| 995 | struct atmel_lcdfb_info *sinfo = info->par; | 995 | struct atmel_lcdfb_info *sinfo; |
| 996 | 996 | ||
| 997 | if (!sinfo) | 997 | if (!info || !info->par) |
| 998 | return 0; | 998 | return 0; |
| 999 | sinfo = info->par; | ||
| 999 | 1000 | ||
| 1000 | cancel_work_sync(&sinfo->task); | 1001 | cancel_work_sync(&sinfo->task); |
| 1001 | exit_backlight(sinfo); | 1002 | exit_backlight(sinfo); |
| @@ -1030,11 +1031,20 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
| 1030 | struct fb_info *info = platform_get_drvdata(pdev); | 1031 | struct fb_info *info = platform_get_drvdata(pdev); |
| 1031 | struct atmel_lcdfb_info *sinfo = info->par; | 1032 | struct atmel_lcdfb_info *sinfo = info->par; |
| 1032 | 1033 | ||
| 1034 | /* | ||
| 1035 | * We don't want to handle interrupts while the clock is | ||
| 1036 | * stopped. It may take forever. | ||
| 1037 | */ | ||
| 1038 | lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL); | ||
| 1039 | |||
| 1033 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); | 1040 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); |
| 1034 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); | 1041 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); |
| 1035 | if (sinfo->atmel_lcdfb_power_control) | 1042 | if (sinfo->atmel_lcdfb_power_control) |
| 1036 | sinfo->atmel_lcdfb_power_control(0); | 1043 | sinfo->atmel_lcdfb_power_control(0); |
| 1044 | |||
| 1045 | atmel_lcdfb_stop(sinfo); | ||
| 1037 | atmel_lcdfb_stop_clock(sinfo); | 1046 | atmel_lcdfb_stop_clock(sinfo); |
| 1047 | |||
| 1038 | return 0; | 1048 | return 0; |
| 1039 | } | 1049 | } |
| 1040 | 1050 | ||
| @@ -1044,9 +1054,15 @@ static int atmel_lcdfb_resume(struct platform_device *pdev) | |||
| 1044 | struct atmel_lcdfb_info *sinfo = info->par; | 1054 | struct atmel_lcdfb_info *sinfo = info->par; |
| 1045 | 1055 | ||
| 1046 | atmel_lcdfb_start_clock(sinfo); | 1056 | atmel_lcdfb_start_clock(sinfo); |
| 1057 | atmel_lcdfb_start(sinfo); | ||
| 1047 | if (sinfo->atmel_lcdfb_power_control) | 1058 | if (sinfo->atmel_lcdfb_power_control) |
| 1048 | sinfo->atmel_lcdfb_power_control(1); | 1059 | sinfo->atmel_lcdfb_power_control(1); |
| 1049 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); | 1060 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); |
| 1061 | |||
| 1062 | /* Enable FIFO & DMA errors */ | ||
| 1063 | lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI | ||
| 1064 | | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI); | ||
| 1065 | |||
| 1050 | return 0; | 1066 | return 0; |
| 1051 | } | 1067 | } |
| 1052 | 1068 | ||
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index 940467aed13f..7644ed249564 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c | |||
| @@ -58,7 +58,7 @@ | |||
| 58 | #include <asm/gpio.h> | 58 | #include <asm/gpio.h> |
| 59 | #include <asm/portmux.h> | 59 | #include <asm/portmux.h> |
| 60 | 60 | ||
| 61 | #include <asm/mach/bf54x-lq043.h> | 61 | #include <mach/bf54x-lq043.h> |
| 62 | 62 | ||
| 63 | #define NO_BL_SUPPORT | 63 | #define NO_BL_SUPPORT |
| 64 | 64 | ||
| @@ -733,7 +733,6 @@ static int bfin_bf54x_remove(struct platform_device *pdev) | |||
| 733 | static int bfin_bf54x_suspend(struct platform_device *pdev, pm_message_t state) | 733 | static int bfin_bf54x_suspend(struct platform_device *pdev, pm_message_t state) |
| 734 | { | 734 | { |
| 735 | struct fb_info *fbinfo = platform_get_drvdata(pdev); | 735 | struct fb_info *fbinfo = platform_get_drvdata(pdev); |
| 736 | struct bfin_bf54xfb_info *info = fbinfo->par; | ||
| 737 | 736 | ||
| 738 | bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() & ~EPPI_EN); | 737 | bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() & ~EPPI_EN); |
| 739 | disable_dma(CH_EPPI0); | 738 | disable_dma(CH_EPPI0); |
| @@ -747,8 +746,18 @@ static int bfin_bf54x_resume(struct platform_device *pdev) | |||
| 747 | struct fb_info *fbinfo = platform_get_drvdata(pdev); | 746 | struct fb_info *fbinfo = platform_get_drvdata(pdev); |
| 748 | struct bfin_bf54xfb_info *info = fbinfo->par; | 747 | struct bfin_bf54xfb_info *info = fbinfo->par; |
| 749 | 748 | ||
| 750 | enable_dma(CH_EPPI0); | 749 | if (info->lq043_open_cnt) { |
| 751 | bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() | EPPI_EN); | 750 | |
| 751 | bfin_write_EPPI0_CONTROL(0); | ||
| 752 | SSYNC(); | ||
| 753 | |||
| 754 | config_dma(info); | ||
| 755 | config_ppi(info); | ||
| 756 | |||
| 757 | /* start dma */ | ||
| 758 | enable_dma(CH_EPPI0); | ||
| 759 | bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() | EPPI_EN); | ||
| 760 | } | ||
| 752 | 761 | ||
| 753 | return 0; | 762 | return 0; |
| 754 | } | 763 | } |
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index c14b2435d23e..e729fb279645 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
| @@ -628,27 +628,18 @@ static long cirrusfb_get_mclk(long freq, int bpp, long *div) | |||
| 628 | static int cirrusfb_check_var(struct fb_var_screeninfo *var, | 628 | static int cirrusfb_check_var(struct fb_var_screeninfo *var, |
| 629 | struct fb_info *info) | 629 | struct fb_info *info) |
| 630 | { | 630 | { |
| 631 | int nom, den; /* translyting from pixels->bytes */ | 631 | int yres; |
| 632 | int yres, i; | 632 | /* memory size in pixels */ |
| 633 | static struct { int xres, yres; } modes[] = | 633 | unsigned pixels = info->screen_size * 8 / var->bits_per_pixel; |
| 634 | { { 1600, 1280 }, | ||
| 635 | { 1280, 1024 }, | ||
| 636 | { 1024, 768 }, | ||
| 637 | { 800, 600 }, | ||
| 638 | { 640, 480 }, | ||
| 639 | { -1, -1 } }; | ||
| 640 | 634 | ||
| 641 | switch (var->bits_per_pixel) { | 635 | switch (var->bits_per_pixel) { |
| 642 | case 1: | 636 | case 1: |
| 643 | nom = 4; | 637 | pixels /= 4; |
| 644 | den = 8; | ||
| 645 | break; /* 8 pixel per byte, only 1/4th of mem usable */ | 638 | break; /* 8 pixel per byte, only 1/4th of mem usable */ |
| 646 | case 8: | 639 | case 8: |
| 647 | case 16: | 640 | case 16: |
| 648 | case 24: | 641 | case 24: |
| 649 | case 32: | 642 | case 32: |
| 650 | nom = var->bits_per_pixel / 8; | ||
| 651 | den = 1; | ||
| 652 | break; /* 1 pixel == 1 byte */ | 643 | break; /* 1 pixel == 1 byte */ |
| 653 | default: | 644 | default: |
| 654 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." | 645 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." |
| @@ -658,43 +649,29 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, | |||
| 658 | return -EINVAL; | 649 | return -EINVAL; |
| 659 | } | 650 | } |
| 660 | 651 | ||
| 661 | if (var->xres * nom / den * var->yres > info->screen_size) { | 652 | if (var->xres_virtual < var->xres) |
| 662 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected..." | 653 | var->xres_virtual = var->xres; |
| 663 | "resolution too high to fit into video memory!\n", | ||
| 664 | var->xres, var->yres, var->bits_per_pixel); | ||
| 665 | DPRINTK("EXIT - EINVAL error\n"); | ||
| 666 | return -EINVAL; | ||
| 667 | } | ||
| 668 | |||
| 669 | /* use highest possible virtual resolution */ | 654 | /* use highest possible virtual resolution */ |
| 670 | if (var->xres_virtual == -1 && | 655 | if (var->yres_virtual == -1) { |
| 671 | var->yres_virtual == -1) { | 656 | var->yres_virtual = pixels / var->xres_virtual; |
| 672 | printk(KERN_INFO | ||
| 673 | "cirrusfb: using maximum available virtual resolution\n"); | ||
| 674 | for (i = 0; modes[i].xres != -1; i++) { | ||
| 675 | int size = modes[i].xres * nom / den * modes[i].yres; | ||
| 676 | if (size < info->screen_size / 2) | ||
| 677 | break; | ||
| 678 | } | ||
| 679 | if (modes[i].xres == -1) { | ||
| 680 | printk(KERN_ERR "cirrusfb: could not find a virtual " | ||
| 681 | "resolution that fits into video memory!!\n"); | ||
| 682 | DPRINTK("EXIT - EINVAL error\n"); | ||
| 683 | return -EINVAL; | ||
| 684 | } | ||
| 685 | var->xres_virtual = modes[i].xres; | ||
| 686 | var->yres_virtual = modes[i].yres; | ||
| 687 | 657 | ||
| 688 | printk(KERN_INFO "cirrusfb: virtual resolution set to " | 658 | printk(KERN_INFO "cirrusfb: virtual resolution set to " |
| 689 | "maximum of %dx%d\n", var->xres_virtual, | 659 | "maximum of %dx%d\n", var->xres_virtual, |
| 690 | var->yres_virtual); | 660 | var->yres_virtual); |
| 691 | } | 661 | } |
| 692 | |||
| 693 | if (var->xres_virtual < var->xres) | ||
| 694 | var->xres_virtual = var->xres; | ||
| 695 | if (var->yres_virtual < var->yres) | 662 | if (var->yres_virtual < var->yres) |
| 696 | var->yres_virtual = var->yres; | 663 | var->yres_virtual = var->yres; |
| 697 | 664 | ||
| 665 | if (var->xres_virtual * var->yres_virtual > pixels) { | ||
| 666 | printk(KERN_ERR "cirrusfb: mode %dx%dx%d rejected... " | ||
| 667 | "virtual resolution too high to fit into video memory!\n", | ||
| 668 | var->xres_virtual, var->yres_virtual, | ||
| 669 | var->bits_per_pixel); | ||
| 670 | DPRINTK("EXIT - EINVAL error\n"); | ||
| 671 | return -EINVAL; | ||
| 672 | } | ||
| 673 | |||
| 674 | |||
| 698 | if (var->xoffset < 0) | 675 | if (var->xoffset < 0) |
| 699 | var->xoffset = 0; | 676 | var->xoffset = 0; |
| 700 | if (var->yoffset < 0) | 677 | if (var->yoffset < 0) |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index c6299e8a041d..9cbff84b787d 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
| @@ -2400,11 +2400,15 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) | |||
| 2400 | 2400 | ||
| 2401 | if (!fbcon_is_inactive(vc, info)) { | 2401 | if (!fbcon_is_inactive(vc, info)) { |
| 2402 | if (ops->blank_state != blank) { | 2402 | if (ops->blank_state != blank) { |
| 2403 | int ret = 1; | ||
| 2404 | |||
| 2403 | ops->blank_state = blank; | 2405 | ops->blank_state = blank; |
| 2404 | fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); | 2406 | fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); |
| 2405 | ops->cursor_flash = (!blank); | 2407 | ops->cursor_flash = (!blank); |
| 2406 | 2408 | ||
| 2407 | if (fb_blank(info, blank)) | 2409 | if (info->fbops->fb_blank) |
| 2410 | ret = info->fbops->fb_blank(blank, info); | ||
| 2411 | if (ret) | ||
| 2408 | fbcon_generic_blank(vc, info, blank); | 2412 | fbcon_generic_blank(vc, info, blank); |
| 2409 | } | 2413 | } |
| 2410 | 2414 | ||
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index a6e38e9ea73f..89a346880ec0 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h | |||
| @@ -110,7 +110,7 @@ static inline int mono_col(const struct fb_info *info) | |||
| 110 | __u32 max_len; | 110 | __u32 max_len; |
| 111 | max_len = max(info->var.green.length, info->var.red.length); | 111 | max_len = max(info->var.green.length, info->var.red.length); |
| 112 | max_len = max(info->var.blue.length, max_len); | 112 | max_len = max(info->var.blue.length, max_len); |
| 113 | return ~(0xfff << (max_len & 0xff)); | 113 | return (~(0xfff << max_len)) & 0xff; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static inline int attr_col_ec(int shift, struct vc_data *vc, | 116 | static inline int attr_col_ec(int shift, struct vc_data *vc, |
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c index 59df132cc375..4835bdc4e9f1 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fb_defio.c | |||
| @@ -114,6 +114,17 @@ static struct vm_operations_struct fb_deferred_io_vm_ops = { | |||
| 114 | .page_mkwrite = fb_deferred_io_mkwrite, | 114 | .page_mkwrite = fb_deferred_io_mkwrite, |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
| 117 | static int fb_deferred_io_set_page_dirty(struct page *page) | ||
| 118 | { | ||
| 119 | if (!PageDirty(page)) | ||
| 120 | SetPageDirty(page); | ||
| 121 | return 0; | ||
| 122 | } | ||
| 123 | |||
| 124 | static const struct address_space_operations fb_deferred_io_aops = { | ||
| 125 | .set_page_dirty = fb_deferred_io_set_page_dirty, | ||
| 126 | }; | ||
| 127 | |||
| 117 | static int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma) | 128 | static int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma) |
| 118 | { | 129 | { |
| 119 | vma->vm_ops = &fb_deferred_io_vm_ops; | 130 | vma->vm_ops = &fb_deferred_io_vm_ops; |
| @@ -163,6 +174,14 @@ void fb_deferred_io_init(struct fb_info *info) | |||
| 163 | } | 174 | } |
| 164 | EXPORT_SYMBOL_GPL(fb_deferred_io_init); | 175 | EXPORT_SYMBOL_GPL(fb_deferred_io_init); |
| 165 | 176 | ||
| 177 | void fb_deferred_io_open(struct fb_info *info, | ||
| 178 | struct inode *inode, | ||
| 179 | struct file *file) | ||
| 180 | { | ||
| 181 | file->f_mapping->a_ops = &fb_deferred_io_aops; | ||
| 182 | } | ||
| 183 | EXPORT_SYMBOL_GPL(fb_deferred_io_open); | ||
| 184 | |||
| 166 | void fb_deferred_io_cleanup(struct fb_info *info) | 185 | void fb_deferred_io_cleanup(struct fb_info *info) |
| 167 | { | 186 | { |
| 168 | void *screen_base = (void __force *) info->screen_base; | 187 | void *screen_base = (void __force *) info->screen_base; |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 6b487801eeae..98843c2ecf73 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
| @@ -1344,6 +1344,10 @@ fb_open(struct inode *inode, struct file *file) | |||
| 1344 | if (res) | 1344 | if (res) |
| 1345 | module_put(info->fbops->owner); | 1345 | module_put(info->fbops->owner); |
| 1346 | } | 1346 | } |
| 1347 | #ifdef CONFIG_FB_DEFERRED_IO | ||
| 1348 | if (info->fbdefio) | ||
| 1349 | fb_deferred_io_open(info, inode, file); | ||
| 1350 | #endif | ||
| 1347 | out: | 1351 | out: |
| 1348 | unlock_kernel(); | 1352 | unlock_kernel(); |
| 1349 | return res; | 1353 | return res; |
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index bd320a2bfb7c..fb51197d1c98 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
| @@ -479,6 +479,10 @@ static void adjust_aoi_size_position(struct fb_var_screeninfo *var, | |||
| 479 | base_plane_width = machine_data->fsl_diu_info[0]->var.xres; | 479 | base_plane_width = machine_data->fsl_diu_info[0]->var.xres; |
| 480 | base_plane_height = machine_data->fsl_diu_info[0]->var.yres; | 480 | base_plane_height = machine_data->fsl_diu_info[0]->var.yres; |
| 481 | 481 | ||
| 482 | if (mfbi->x_aoi_d < 0) | ||
| 483 | mfbi->x_aoi_d = 0; | ||
| 484 | if (mfbi->y_aoi_d < 0) | ||
| 485 | mfbi->y_aoi_d = 0; | ||
| 482 | switch (index) { | 486 | switch (index) { |
| 483 | case 0: | 487 | case 0: |
| 484 | if (mfbi->x_aoi_d != 0) | 488 | if (mfbi->x_aoi_d != 0) |
| @@ -778,6 +782,22 @@ static void unmap_video_memory(struct fb_info *info) | |||
| 778 | } | 782 | } |
| 779 | 783 | ||
| 780 | /* | 784 | /* |
| 785 | * Using the fb_var_screeninfo in fb_info we set the aoi of this | ||
| 786 | * particular framebuffer. It is a light version of fsl_diu_set_par. | ||
| 787 | */ | ||
| 788 | static int fsl_diu_set_aoi(struct fb_info *info) | ||
| 789 | { | ||
| 790 | struct fb_var_screeninfo *var = &info->var; | ||
| 791 | struct mfb_info *mfbi = info->par; | ||
| 792 | struct diu_ad *ad = mfbi->ad; | ||
| 793 | |||
| 794 | /* AOI should not be greater than display size */ | ||
| 795 | ad->offset_xyi = cpu_to_le32((var->yoffset << 16) | var->xoffset); | ||
| 796 | ad->offset_xyd = cpu_to_le32((mfbi->y_aoi_d << 16) | mfbi->x_aoi_d); | ||
| 797 | return 0; | ||
| 798 | } | ||
| 799 | |||
| 800 | /* | ||
| 781 | * Using the fb_var_screeninfo in fb_info we set the resolution of this | 801 | * Using the fb_var_screeninfo in fb_info we set the resolution of this |
| 782 | * particular framebuffer. This function alters the fb_fix_screeninfo stored | 802 | * particular framebuffer. This function alters the fb_fix_screeninfo stored |
| 783 | * in fb_info. It does not alter var in fb_info since we are using that | 803 | * in fb_info. It does not alter var in fb_info since we are using that |
| @@ -817,11 +837,11 @@ static int fsl_diu_set_par(struct fb_info *info) | |||
| 817 | diu_ops.get_pixel_format(var->bits_per_pixel, | 837 | diu_ops.get_pixel_format(var->bits_per_pixel, |
| 818 | machine_data->monitor_port); | 838 | machine_data->monitor_port); |
| 819 | ad->addr = cpu_to_le32(info->fix.smem_start); | 839 | ad->addr = cpu_to_le32(info->fix.smem_start); |
| 820 | ad->src_size_g_alpha = cpu_to_le32((var->yres << 12) | | 840 | ad->src_size_g_alpha = cpu_to_le32((var->yres_virtual << 12) | |
| 821 | var->xres) | mfbi->g_alpha; | 841 | var->xres_virtual) | mfbi->g_alpha; |
| 822 | /* fix me. AOI should not be greater than display size */ | 842 | /* AOI should not be greater than display size */ |
| 823 | ad->aoi_size = cpu_to_le32((var->yres << 16) | var->xres); | 843 | ad->aoi_size = cpu_to_le32((var->yres << 16) | var->xres); |
| 824 | ad->offset_xyi = 0; | 844 | ad->offset_xyi = cpu_to_le32((var->yoffset << 16) | var->xoffset); |
| 825 | ad->offset_xyd = cpu_to_le32((mfbi->y_aoi_d << 16) | mfbi->x_aoi_d); | 845 | ad->offset_xyd = cpu_to_le32((mfbi->y_aoi_d << 16) | mfbi->x_aoi_d); |
| 826 | 846 | ||
| 827 | /* Disable chroma keying function */ | 847 | /* Disable chroma keying function */ |
| @@ -921,6 +941,8 @@ static int fsl_diu_pan_display(struct fb_var_screeninfo *var, | |||
| 921 | else | 941 | else |
| 922 | info->var.vmode &= ~FB_VMODE_YWRAP; | 942 | info->var.vmode &= ~FB_VMODE_YWRAP; |
| 923 | 943 | ||
| 944 | fsl_diu_set_aoi(info); | ||
| 945 | |||
| 924 | return 0; | 946 | return 0; |
| 925 | } | 947 | } |
| 926 | 948 | ||
| @@ -989,7 +1011,7 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, | |||
| 989 | pr_debug("set AOI display offset of index %d to (%d,%d)\n", | 1011 | pr_debug("set AOI display offset of index %d to (%d,%d)\n", |
| 990 | mfbi->index, aoi_d.x_aoi_d, aoi_d.y_aoi_d); | 1012 | mfbi->index, aoi_d.x_aoi_d, aoi_d.y_aoi_d); |
| 991 | fsl_diu_check_var(&info->var, info); | 1013 | fsl_diu_check_var(&info->var, info); |
| 992 | fsl_diu_set_par(info); | 1014 | fsl_diu_set_aoi(info); |
| 993 | break; | 1015 | break; |
| 994 | case MFB_GET_AOID: | 1016 | case MFB_GET_AOID: |
| 995 | aoi_d.x_aoi_d = mfbi->x_aoi_d; | 1017 | aoi_d.x_aoi_d = mfbi->x_aoi_d; |
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index 3f1ca2adda3d..c6dd924976a4 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c | |||
| @@ -1746,6 +1746,7 @@ static void __devexit pm2fb_remove(struct pci_dev *pdev) | |||
| 1746 | release_mem_region(fix->mmio_start, fix->mmio_len); | 1746 | release_mem_region(fix->mmio_start, fix->mmio_len); |
| 1747 | 1747 | ||
| 1748 | pci_set_drvdata(pdev, NULL); | 1748 | pci_set_drvdata(pdev, NULL); |
| 1749 | fb_dealloc_cmap(&info->cmap); | ||
| 1749 | kfree(info->pixmap.addr); | 1750 | kfree(info->pixmap.addr); |
| 1750 | kfree(info); | 1751 | kfree(info); |
| 1751 | } | 1752 | } |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index e7aa7ae8fca8..97204497d9f7 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
| @@ -1031,7 +1031,9 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi) | |||
| 1031 | pxa_gpio_mode(GPIO74_LCD_FCLK_MD); | 1031 | pxa_gpio_mode(GPIO74_LCD_FCLK_MD); |
| 1032 | pxa_gpio_mode(GPIO75_LCD_LCLK_MD); | 1032 | pxa_gpio_mode(GPIO75_LCD_LCLK_MD); |
| 1033 | pxa_gpio_mode(GPIO76_LCD_PCLK_MD); | 1033 | pxa_gpio_mode(GPIO76_LCD_PCLK_MD); |
| 1034 | pxa_gpio_mode(GPIO77_LCD_ACBIAS_MD); | 1034 | |
| 1035 | if ((lccr0 & LCCR0_PAS) == 0) | ||
| 1036 | pxa_gpio_mode(GPIO77_LCD_ACBIAS_MD); | ||
| 1035 | } | 1037 | } |
| 1036 | 1038 | ||
| 1037 | static void pxafb_enable_controller(struct pxafb_info *fbi) | 1039 | static void pxafb_enable_controller(struct pxafb_info *fbi) |
| @@ -1400,6 +1402,8 @@ static void pxafb_decode_mach_info(struct pxafb_info *fbi, | |||
| 1400 | if (lcd_conn == LCD_MONO_STN_8BPP) | 1402 | if (lcd_conn == LCD_MONO_STN_8BPP) |
| 1401 | fbi->lccr0 |= LCCR0_DPD; | 1403 | fbi->lccr0 |= LCCR0_DPD; |
| 1402 | 1404 | ||
| 1405 | fbi->lccr0 |= (lcd_conn & LCD_ALTERNATE_MAPPING) ? LCCR0_LDDALT : 0; | ||
| 1406 | |||
| 1403 | fbi->lccr3 = LCCR3_Acb((inf->lcd_conn >> 10) & 0xff); | 1407 | fbi->lccr3 = LCCR3_Acb((inf->lcd_conn >> 10) & 0xff); |
| 1404 | fbi->lccr3 |= (lcd_conn & LCD_BIAS_ACTIVE_LOW) ? LCCR3_OEP : 0; | 1408 | fbi->lccr3 |= (lcd_conn & LCD_BIAS_ACTIVE_LOW) ? LCCR3_OEP : 0; |
| 1405 | fbi->lccr3 |= (lcd_conn & LCD_PCLK_EDGE_FALL) ? LCCR3_PCP : 0; | 1409 | fbi->lccr3 |= (lcd_conn & LCD_PCLK_EDGE_FALL) ? LCCR3_PCP : 0; |
| @@ -1673,53 +1677,63 @@ MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)"); | |||
| 1673 | #define pxafb_setup_options() (0) | 1677 | #define pxafb_setup_options() (0) |
| 1674 | #endif | 1678 | #endif |
| 1675 | 1679 | ||
| 1676 | static int __devinit pxafb_probe(struct platform_device *dev) | ||
| 1677 | { | ||
| 1678 | struct pxafb_info *fbi; | ||
| 1679 | struct pxafb_mach_info *inf; | ||
| 1680 | struct resource *r; | ||
| 1681 | int irq, ret; | ||
| 1682 | |||
| 1683 | dev_dbg(&dev->dev, "pxafb_probe\n"); | ||
| 1684 | |||
| 1685 | inf = dev->dev.platform_data; | ||
| 1686 | ret = -ENOMEM; | ||
| 1687 | fbi = NULL; | ||
| 1688 | if (!inf) | ||
| 1689 | goto failed; | ||
| 1690 | |||
| 1691 | ret = pxafb_parse_options(&dev->dev, g_options); | ||
| 1692 | if (ret < 0) | ||
| 1693 | goto failed; | ||
| 1694 | |||
| 1695 | #ifdef DEBUG_VAR | 1680 | #ifdef DEBUG_VAR |
| 1696 | /* Check for various illegal bit-combinations. Currently only | 1681 | /* Check for various illegal bit-combinations. Currently only |
| 1697 | * a warning is given. */ | 1682 | * a warning is given. */ |
| 1683 | static void __devinit pxafb_check_options(struct device *dev, | ||
| 1684 | struct pxafb_mach_info *inf) | ||
| 1685 | { | ||
| 1686 | if (inf->lcd_conn) | ||
| 1687 | return; | ||
| 1698 | 1688 | ||
| 1699 | if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) | 1689 | if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) |
| 1700 | dev_warn(&dev->dev, "machine LCCR0 setting contains " | 1690 | dev_warn(dev, "machine LCCR0 setting contains " |
| 1701 | "illegal bits: %08x\n", | 1691 | "illegal bits: %08x\n", |
| 1702 | inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); | 1692 | inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); |
| 1703 | if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) | 1693 | if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) |
| 1704 | dev_warn(&dev->dev, "machine LCCR3 setting contains " | 1694 | dev_warn(dev, "machine LCCR3 setting contains " |
| 1705 | "illegal bits: %08x\n", | 1695 | "illegal bits: %08x\n", |
| 1706 | inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); | 1696 | inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); |
| 1707 | if (inf->lccr0 & LCCR0_DPD && | 1697 | if (inf->lccr0 & LCCR0_DPD && |
| 1708 | ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || | 1698 | ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || |
| 1709 | (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || | 1699 | (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || |
| 1710 | (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) | 1700 | (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) |
| 1711 | dev_warn(&dev->dev, "Double Pixel Data (DPD) mode is " | 1701 | dev_warn(dev, "Double Pixel Data (DPD) mode is " |
| 1712 | "only valid in passive mono" | 1702 | "only valid in passive mono" |
| 1713 | " single panel mode\n"); | 1703 | " single panel mode\n"); |
| 1714 | if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && | 1704 | if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && |
| 1715 | (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) | 1705 | (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) |
| 1716 | dev_warn(&dev->dev, "Dual panel only valid in passive mode\n"); | 1706 | dev_warn(dev, "Dual panel only valid in passive mode\n"); |
| 1717 | if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && | 1707 | if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && |
| 1718 | (inf->modes->upper_margin || inf->modes->lower_margin)) | 1708 | (inf->modes->upper_margin || inf->modes->lower_margin)) |
| 1719 | dev_warn(&dev->dev, "Upper and lower margins must be 0 in " | 1709 | dev_warn(dev, "Upper and lower margins must be 0 in " |
| 1720 | "passive mode\n"); | 1710 | "passive mode\n"); |
| 1711 | } | ||
| 1712 | #else | ||
| 1713 | #define pxafb_check_options(...) do {} while (0) | ||
| 1721 | #endif | 1714 | #endif |
| 1722 | 1715 | ||
| 1716 | static int __devinit pxafb_probe(struct platform_device *dev) | ||
| 1717 | { | ||
| 1718 | struct pxafb_info *fbi; | ||
| 1719 | struct pxafb_mach_info *inf; | ||
| 1720 | struct resource *r; | ||
| 1721 | int irq, ret; | ||
| 1722 | |||
| 1723 | dev_dbg(&dev->dev, "pxafb_probe\n"); | ||
| 1724 | |||
| 1725 | inf = dev->dev.platform_data; | ||
| 1726 | ret = -ENOMEM; | ||
| 1727 | fbi = NULL; | ||
| 1728 | if (!inf) | ||
| 1729 | goto failed; | ||
| 1730 | |||
| 1731 | ret = pxafb_parse_options(&dev->dev, g_options); | ||
| 1732 | if (ret < 0) | ||
| 1733 | goto failed; | ||
| 1734 | |||
| 1735 | pxafb_check_options(&dev->dev, inf); | ||
| 1736 | |||
| 1723 | dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n", | 1737 | dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n", |
| 1724 | inf->modes->xres, | 1738 | inf->modes->xres, |
| 1725 | inf->modes->yres, | 1739 | inf->modes->yres, |
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c index 8361bd0e3df1..4dcec48a1d78 100644 --- a/drivers/video/s3fb.c +++ b/drivers/video/s3fb.c | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | * which is based on the code of neofb. | 11 | * which is based on the code of neofb. |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <linux/version.h> | ||
| 15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 17 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index f6ef6cca73cd..4c32c06579a0 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
| @@ -595,6 +595,8 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
| 595 | info->fbops = &sh_mobile_lcdc_ops; | 595 | info->fbops = &sh_mobile_lcdc_ops; |
| 596 | info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres; | 596 | info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres; |
| 597 | info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres; | 597 | info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres; |
| 598 | info->var.width = cfg->lcd_size_cfg.width; | ||
| 599 | info->var.height = cfg->lcd_size_cfg.height; | ||
| 598 | info->var.activate = FB_ACTIVATE_NOW; | 600 | info->var.activate = FB_ACTIVATE_NOW; |
| 599 | error = sh_mobile_lcdc_set_bpp(&info->var, cfg->bpp); | 601 | error = sh_mobile_lcdc_set_bpp(&info->var, cfg->bpp); |
| 600 | if (error) | 602 | if (error) |
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index 77aafcfae037..4599a4385bc9 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c | |||
| @@ -95,7 +95,6 @@ static inline int mtrr_del(int reg, unsigned long base, | |||
| 95 | #define VOODOO5_MAX_PIXCLOCK 350000 | 95 | #define VOODOO5_MAX_PIXCLOCK 350000 |
| 96 | 96 | ||
| 97 | static struct fb_fix_screeninfo tdfx_fix __devinitdata = { | 97 | static struct fb_fix_screeninfo tdfx_fix __devinitdata = { |
| 98 | .id = "3Dfx", | ||
| 99 | .type = FB_TYPE_PACKED_PIXELS, | 98 | .type = FB_TYPE_PACKED_PIXELS, |
| 100 | .visual = FB_VISUAL_PSEUDOCOLOR, | 99 | .visual = FB_VISUAL_PSEUDOCOLOR, |
| 101 | .ypanstep = 1, | 100 | .ypanstep = 1, |
| @@ -426,7 +425,7 @@ static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id) | |||
| 426 | if (dev_id < PCI_DEVICE_ID_3DFX_VOODOO5) { | 425 | if (dev_id < PCI_DEVICE_ID_3DFX_VOODOO5) { |
| 427 | /* Banshee/Voodoo3 */ | 426 | /* Banshee/Voodoo3 */ |
| 428 | chip_size = 2; | 427 | chip_size = 2; |
| 429 | if (has_sgram && (draminit0 & DRAMINIT0_SGRAM_TYPE)) | 428 | if (has_sgram && !(draminit0 & DRAMINIT0_SGRAM_TYPE)) |
| 430 | chip_size = 1; | 429 | chip_size = 1; |
| 431 | } else { | 430 | } else { |
| 432 | /* Voodoo4/5 */ | 431 | /* Voodoo4/5 */ |
| @@ -1200,15 +1199,15 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, | |||
| 1200 | /* Configure the default fb_fix_screeninfo first */ | 1199 | /* Configure the default fb_fix_screeninfo first */ |
| 1201 | switch (pdev->device) { | 1200 | switch (pdev->device) { |
| 1202 | case PCI_DEVICE_ID_3DFX_BANSHEE: | 1201 | case PCI_DEVICE_ID_3DFX_BANSHEE: |
| 1203 | strcat(tdfx_fix.id, " Banshee"); | 1202 | strcpy(tdfx_fix.id, "3Dfx Banshee"); |
| 1204 | default_par->max_pixclock = BANSHEE_MAX_PIXCLOCK; | 1203 | default_par->max_pixclock = BANSHEE_MAX_PIXCLOCK; |
| 1205 | break; | 1204 | break; |
| 1206 | case PCI_DEVICE_ID_3DFX_VOODOO3: | 1205 | case PCI_DEVICE_ID_3DFX_VOODOO3: |
| 1207 | strcat(tdfx_fix.id, " Voodoo3"); | 1206 | strcpy(tdfx_fix.id, "3Dfx Voodoo3"); |
| 1208 | default_par->max_pixclock = VOODOO3_MAX_PIXCLOCK; | 1207 | default_par->max_pixclock = VOODOO3_MAX_PIXCLOCK; |
| 1209 | break; | 1208 | break; |
| 1210 | case PCI_DEVICE_ID_3DFX_VOODOO5: | 1209 | case PCI_DEVICE_ID_3DFX_VOODOO5: |
| 1211 | strcat(tdfx_fix.id, " Voodoo5"); | 1210 | strcpy(tdfx_fix.id, "3Dfx Voodoo5"); |
| 1212 | default_par->max_pixclock = VOODOO5_MAX_PIXCLOCK; | 1211 | default_par->max_pixclock = VOODOO5_MAX_PIXCLOCK; |
| 1213 | break; | 1212 | break; |
| 1214 | } | 1213 | } |
diff --git a/drivers/video/vermilion/vermilion.h b/drivers/video/vermilion/vermilion.h index c4aba59d4809..7491abfcf1fc 100644 --- a/drivers/video/vermilion/vermilion.h +++ b/drivers/video/vermilion/vermilion.h | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #define _VERMILION_H_ | 30 | #define _VERMILION_H_ |
| 31 | 31 | ||
| 32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
| 33 | #include <linux/version.h> | ||
| 34 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
| 35 | #include <asm/atomic.h> | 34 | #include <asm/atomic.h> |
| 36 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c index 34aae7a2a62b..3df17dc8c3d7 100644 --- a/drivers/video/vt8623fb.c +++ b/drivers/video/vt8623fb.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | * (http://davesdomain.org.uk/viafb/) | 12 | * (http://davesdomain.org.uk/viafb/) |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <linux/version.h> | ||
| 16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 17 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 18 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index 7b3a8423f485..5da3d2423cc0 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
| 25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| 26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
| 27 | #include <linux/version.h> | ||
| 28 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
| 29 | #include <linux/string.h> | 28 | #include <linux/string.h> |
| 30 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index bfef604160d1..62eab43152d2 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
| @@ -158,7 +158,7 @@ static inline s64 towards_target(struct virtio_balloon *vb) | |||
| 158 | vb->vdev->config->get(vb->vdev, | 158 | vb->vdev->config->get(vb->vdev, |
| 159 | offsetof(struct virtio_balloon_config, num_pages), | 159 | offsetof(struct virtio_balloon_config, num_pages), |
| 160 | &v, sizeof(v)); | 160 | &v, sizeof(v)); |
| 161 | return v - vb->num_pages; | 161 | return (s64)v - vb->num_pages; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | static void update_balloon_size(struct virtio_balloon *vb) | 164 | static void update_balloon_size(struct virtio_balloon *vb) |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index db20542796bf..c51036716700 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
| @@ -465,6 +465,16 @@ config PC87413_WDT | |||
| 465 | 465 | ||
| 466 | Most people will say N. | 466 | Most people will say N. |
| 467 | 467 | ||
| 468 | config RDC321X_WDT | ||
| 469 | tristate "RDC R-321x SoC watchdog" | ||
| 470 | depends on X86_RDC321X | ||
| 471 | help | ||
| 472 | This is the driver for the built in hardware watchdog | ||
| 473 | in the RDC R-321x SoC. | ||
| 474 | |||
| 475 | To compile this driver as a module, choose M here: the | ||
| 476 | module will be called rdc321x_wdt. | ||
| 477 | |||
| 468 | config 60XX_WDT | 478 | config 60XX_WDT |
| 469 | tristate "SBC-60XX Watchdog Timer" | 479 | tristate "SBC-60XX Watchdog Timer" |
| 470 | depends on X86 | 480 | depends on X86 |
| @@ -633,6 +643,16 @@ config SBC_EPX_C3_WATCHDOG | |||
| 633 | 643 | ||
| 634 | # MIPS Architecture | 644 | # MIPS Architecture |
| 635 | 645 | ||
| 646 | config RC32434_WDT | ||
| 647 | tristate "IDT RC32434 SoC Watchdog Timer" | ||
| 648 | depends on MIKROTIK_RB532 | ||
| 649 | help | ||
| 650 | Hardware driver for the IDT RC32434 SoC built-in | ||
| 651 | watchdog timer. | ||
| 652 | |||
| 653 | To compile this driver as a module, choose M here: the | ||
| 654 | module will be called rc32434_wdt. | ||
| 655 | |||
| 636 | config INDYDOG | 656 | config INDYDOG |
| 637 | tristate "Indy/I2 Hardware Watchdog" | 657 | tristate "Indy/I2 Hardware Watchdog" |
| 638 | depends on SGI_HAS_INDYDOG | 658 | depends on SGI_HAS_INDYDOG |
| @@ -692,10 +712,6 @@ config MPC5200_WDT | |||
| 692 | tristate "MPC5200 Watchdog Timer" | 712 | tristate "MPC5200 Watchdog Timer" |
| 693 | depends on PPC_MPC52xx | 713 | depends on PPC_MPC52xx |
| 694 | 714 | ||
| 695 | config 8xx_WDT | ||
| 696 | tristate "MPC8xx Watchdog Timer" | ||
| 697 | depends on 8xx | ||
| 698 | |||
| 699 | config 8xxx_WDT | 715 | config 8xxx_WDT |
| 700 | tristate "MPC8xxx Platform Watchdog Timer" | 716 | tristate "MPC8xxx Platform Watchdog Timer" |
| 701 | depends on PPC_8xx || PPC_83xx || PPC_86xx | 717 | depends on PPC_8xx || PPC_83xx || PPC_86xx |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index ca3dc043d786..e0ef123fbdea 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
| @@ -75,6 +75,7 @@ obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o | |||
| 75 | obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o | 75 | obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o |
| 76 | obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o | 76 | obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o |
| 77 | obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o | 77 | obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o |
| 78 | obj-$(CONFIG_RDC321X_WDT) += rdc321x_wdt.o | ||
| 78 | obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o | 79 | obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o |
| 79 | obj-$(CONFIG_SBC8360_WDT) += sbc8360.o | 80 | obj-$(CONFIG_SBC8360_WDT) += sbc8360.o |
| 80 | obj-$(CONFIG_SBC7240_WDT) += sbc7240_wdt.o | 81 | obj-$(CONFIG_SBC7240_WDT) += sbc7240_wdt.o |
| @@ -94,6 +95,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o | |||
| 94 | # M68KNOMMU Architecture | 95 | # M68KNOMMU Architecture |
| 95 | 96 | ||
| 96 | # MIPS Architecture | 97 | # MIPS Architecture |
| 98 | obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o | ||
| 97 | obj-$(CONFIG_INDYDOG) += indydog.o | 99 | obj-$(CONFIG_INDYDOG) += indydog.o |
| 98 | obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o | 100 | obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o |
| 99 | obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o | 101 | obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o |
| @@ -104,7 +106,6 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o | |||
| 104 | # PARISC Architecture | 106 | # PARISC Architecture |
| 105 | 107 | ||
| 106 | # POWERPC Architecture | 108 | # POWERPC Architecture |
| 107 | obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o | ||
| 108 | obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o | 109 | obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o |
| 109 | obj-$(CONFIG_8xxx_WDT) += mpc8xxx_wdt.o | 110 | obj-$(CONFIG_8xxx_WDT) += mpc8xxx_wdt.o |
| 110 | obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o | 111 | obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o |
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c index d061f0ad2d20..993e5f52afef 100644 --- a/drivers/watchdog/at91rm9200_wdt.c +++ b/drivers/watchdog/at91rm9200_wdt.c | |||
| @@ -241,7 +241,7 @@ static int at91wdt_resume(struct platform_device *pdev) | |||
| 241 | { | 241 | { |
| 242 | if (at91wdt_busy) | 242 | if (at91wdt_busy) |
| 243 | at91_wdt_start(); | 243 | at91_wdt_start(); |
| 244 | return 0; | 244 | return 0; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | #else | 247 | #else |
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 614a5c7017b6..6799a6de66fe 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c | |||
| @@ -130,8 +130,8 @@ static ssize_t geodewdt_write(struct file *file, const char __user *data, | |||
| 130 | return len; | 130 | return len; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | static int geodewdt_ioctl(struct inode *inode, struct file *file, | 133 | static long geodewdt_ioctl(struct file *file, unsigned int cmd, |
| 134 | unsigned int cmd, unsigned long arg) | 134 | unsigned long arg) |
| 135 | { | 135 | { |
| 136 | void __user *argp = (void __user *)arg; | 136 | void __user *argp = (void __user *)arg; |
| 137 | int __user *p = argp; | 137 | int __user *p = argp; |
| @@ -198,7 +198,7 @@ static const struct file_operations geodewdt_fops = { | |||
| 198 | .owner = THIS_MODULE, | 198 | .owner = THIS_MODULE, |
| 199 | .llseek = no_llseek, | 199 | .llseek = no_llseek, |
| 200 | .write = geodewdt_write, | 200 | .write = geodewdt_write, |
| 201 | .ioctl = geodewdt_ioctl, | 201 | .unlocked_ioctl = geodewdt_ioctl, |
| 202 | .open = geodewdt_open, | 202 | .open = geodewdt_open, |
| 203 | .release = geodewdt_release, | 203 | .release = geodewdt_release, |
| 204 | }; | 204 | }; |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index d039d5f2fd1c..a3765e0be4a8 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
| @@ -116,6 +116,7 @@ static unsigned int reload; /* the computed soft_margin */ | |||
| 116 | static int nowayout = WATCHDOG_NOWAYOUT; | 116 | static int nowayout = WATCHDOG_NOWAYOUT; |
| 117 | static char expect_release; | 117 | static char expect_release; |
| 118 | static unsigned long hpwdt_is_open; | 118 | static unsigned long hpwdt_is_open; |
| 119 | static unsigned int allow_kdump; | ||
| 119 | 120 | ||
| 120 | static void __iomem *pci_mem_addr; /* the PCI-memory address */ | 121 | static void __iomem *pci_mem_addr; /* the PCI-memory address */ |
| 121 | static unsigned long __iomem *hpwdt_timer_reg; | 122 | static unsigned long __iomem *hpwdt_timer_reg; |
| @@ -221,19 +222,19 @@ static int __devinit cru_detect(unsigned long map_entry, | |||
| 221 | 222 | ||
| 222 | if (cmn_regs.u1.ral != 0) { | 223 | if (cmn_regs.u1.ral != 0) { |
| 223 | printk(KERN_WARNING | 224 | printk(KERN_WARNING |
| 224 | "hpwdt: Call succeeded but with an error: 0x%x\n", | 225 | "hpwdt: Call succeeded but with an error: 0x%x\n", |
| 225 | cmn_regs.u1.ral); | 226 | cmn_regs.u1.ral); |
| 226 | } else { | 227 | } else { |
| 227 | physical_bios_base = cmn_regs.u2.rebx; | 228 | physical_bios_base = cmn_regs.u2.rebx; |
| 228 | physical_bios_offset = cmn_regs.u4.redx; | 229 | physical_bios_offset = cmn_regs.u4.redx; |
| 229 | cru_length = cmn_regs.u3.recx; | 230 | cru_length = cmn_regs.u3.recx; |
| 230 | cru_physical_address = | 231 | cru_physical_address = |
| 231 | physical_bios_base + physical_bios_offset; | 232 | physical_bios_base + physical_bios_offset; |
| 232 | 233 | ||
| 233 | /* If the values look OK, then map it in. */ | 234 | /* If the values look OK, then map it in. */ |
| 234 | if ((physical_bios_base + physical_bios_offset)) { | 235 | if ((physical_bios_base + physical_bios_offset)) { |
| 235 | cru_rom_addr = | 236 | cru_rom_addr = |
| 236 | ioremap(cru_physical_address, cru_length); | 237 | ioremap(cru_physical_address, cru_length); |
| 237 | if (cru_rom_addr) | 238 | if (cru_rom_addr) |
| 238 | retval = 0; | 239 | retval = 0; |
| 239 | } | 240 | } |
| @@ -356,7 +357,6 @@ asm(".text \n\t" | |||
| 356 | "call *%r12 \n\t" | 357 | "call *%r12 \n\t" |
| 357 | "pushfq \n\t" | 358 | "pushfq \n\t" |
| 358 | "popq %r12 \n\t" | 359 | "popq %r12 \n\t" |
| 359 | "popfq \n\t" | ||
| 360 | "movl %eax, (%r9) \n\t" | 360 | "movl %eax, (%r9) \n\t" |
| 361 | "movl %ebx, 4(%r9) \n\t" | 361 | "movl %ebx, 4(%r9) \n\t" |
| 362 | "movl %ecx, 8(%r9) \n\t" | 362 | "movl %ecx, 8(%r9) \n\t" |
| @@ -390,10 +390,10 @@ static void __devinit dmi_find_cru(const struct dmi_header *dm) | |||
| 390 | smbios_cru64_ptr = (struct smbios_cru64_info *) dm; | 390 | smbios_cru64_ptr = (struct smbios_cru64_info *) dm; |
| 391 | if (smbios_cru64_ptr->signature == CRU_BIOS_SIGNATURE_VALUE) { | 391 | if (smbios_cru64_ptr->signature == CRU_BIOS_SIGNATURE_VALUE) { |
| 392 | cru_physical_address = | 392 | cru_physical_address = |
| 393 | smbios_cru64_ptr->physical_address + | 393 | smbios_cru64_ptr->physical_address + |
| 394 | smbios_cru64_ptr->double_offset; | 394 | smbios_cru64_ptr->double_offset; |
| 395 | cru_rom_addr = ioremap(cru_physical_address, | 395 | cru_rom_addr = ioremap(cru_physical_address, |
| 396 | smbios_cru64_ptr->double_length); | 396 | smbios_cru64_ptr->double_length); |
| 397 | } | 397 | } |
| 398 | } | 398 | } |
| 399 | } | 399 | } |
| @@ -405,7 +405,7 @@ static int __devinit detect_cru_service(void) | |||
| 405 | dmi_walk(dmi_find_cru); | 405 | dmi_walk(dmi_find_cru); |
| 406 | 406 | ||
| 407 | /* if cru_rom_addr has been set then we found a CRU service */ | 407 | /* if cru_rom_addr has been set then we found a CRU service */ |
| 408 | return ((cru_rom_addr != NULL) ? 0: -ENODEV); | 408 | return ((cru_rom_addr != NULL) ? 0 : -ENODEV); |
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | /* ------------------------------------------------------------------------- */ | 411 | /* ------------------------------------------------------------------------- */ |
| @@ -413,34 +413,6 @@ static int __devinit detect_cru_service(void) | |||
| 413 | #endif | 413 | #endif |
| 414 | 414 | ||
| 415 | /* | 415 | /* |
| 416 | * NMI Handler | ||
| 417 | */ | ||
| 418 | static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason, | ||
| 419 | void *data) | ||
| 420 | { | ||
| 421 | unsigned long rom_pl; | ||
| 422 | static int die_nmi_called; | ||
| 423 | |||
| 424 | if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) | ||
| 425 | return NOTIFY_OK; | ||
| 426 | |||
| 427 | spin_lock_irqsave(&rom_lock, rom_pl); | ||
| 428 | if (!die_nmi_called) | ||
| 429 | asminline_call(&cmn_regs, cru_rom_addr); | ||
| 430 | die_nmi_called = 1; | ||
| 431 | spin_unlock_irqrestore(&rom_lock, rom_pl); | ||
| 432 | if (cmn_regs.u1.ral == 0) { | ||
| 433 | printk(KERN_WARNING "hpwdt: An NMI occurred, " | ||
| 434 | "but unable to determine source.\n"); | ||
| 435 | } else { | ||
| 436 | panic("An NMI occurred, please see the Integrated " | ||
| 437 | "Management Log for details.\n"); | ||
| 438 | } | ||
| 439 | |||
| 440 | return NOTIFY_STOP; | ||
| 441 | } | ||
| 442 | |||
| 443 | /* | ||
| 444 | * Watchdog operations | 416 | * Watchdog operations |
| 445 | */ | 417 | */ |
| 446 | static void hpwdt_start(void) | 418 | static void hpwdt_start(void) |
| @@ -484,6 +456,36 @@ static int hpwdt_change_timer(int new_margin) | |||
| 484 | } | 456 | } |
| 485 | 457 | ||
| 486 | /* | 458 | /* |
| 459 | * NMI Handler | ||
| 460 | */ | ||
| 461 | static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason, | ||
| 462 | void *data) | ||
| 463 | { | ||
| 464 | unsigned long rom_pl; | ||
| 465 | static int die_nmi_called; | ||
| 466 | |||
| 467 | if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) | ||
| 468 | return NOTIFY_OK; | ||
| 469 | |||
| 470 | spin_lock_irqsave(&rom_lock, rom_pl); | ||
| 471 | if (!die_nmi_called) | ||
| 472 | asminline_call(&cmn_regs, cru_rom_addr); | ||
| 473 | die_nmi_called = 1; | ||
| 474 | spin_unlock_irqrestore(&rom_lock, rom_pl); | ||
| 475 | if (cmn_regs.u1.ral == 0) { | ||
| 476 | printk(KERN_WARNING "hpwdt: An NMI occurred, " | ||
| 477 | "but unable to determine source.\n"); | ||
| 478 | } else { | ||
| 479 | if (allow_kdump) | ||
| 480 | hpwdt_stop(); | ||
| 481 | panic("An NMI occurred, please see the Integrated " | ||
| 482 | "Management Log for details.\n"); | ||
| 483 | } | ||
| 484 | |||
| 485 | return NOTIFY_STOP; | ||
| 486 | } | ||
| 487 | |||
| 488 | /* | ||
| 487 | * /dev/watchdog handling | 489 | * /dev/watchdog handling |
| 488 | */ | 490 | */ |
| 489 | static int hpwdt_open(struct inode *inode, struct file *file) | 491 | static int hpwdt_open(struct inode *inode, struct file *file) |
| @@ -625,17 +627,18 @@ static struct notifier_block die_notifier = { | |||
| 625 | */ | 627 | */ |
| 626 | 628 | ||
| 627 | static int __devinit hpwdt_init_one(struct pci_dev *dev, | 629 | static int __devinit hpwdt_init_one(struct pci_dev *dev, |
| 628 | const struct pci_device_id *ent) | 630 | const struct pci_device_id *ent) |
| 629 | { | 631 | { |
| 630 | int retval; | 632 | int retval; |
| 631 | 633 | ||
| 632 | /* | 634 | /* |
| 633 | * First let's find out if we are on an iLO2 server. We will | 635 | * First let's find out if we are on an iLO2 server. We will |
| 634 | * not run on a legacy ASM box. | 636 | * not run on a legacy ASM box. |
| 637 | * So we only support the G5 ProLiant servers and higher. | ||
| 635 | */ | 638 | */ |
| 636 | if (dev->subsystem_vendor != PCI_VENDOR_ID_HP) { | 639 | if (dev->subsystem_vendor != PCI_VENDOR_ID_HP) { |
| 637 | dev_warn(&dev->dev, | 640 | dev_warn(&dev->dev, |
| 638 | "This server does not have an iLO2 ASIC.\n"); | 641 | "This server does not have an iLO2 ASIC.\n"); |
| 639 | return -ENODEV; | 642 | return -ENODEV; |
| 640 | } | 643 | } |
| 641 | 644 | ||
| @@ -669,7 +672,7 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, | |||
| 669 | retval = detect_cru_service(); | 672 | retval = detect_cru_service(); |
| 670 | if (retval < 0) { | 673 | if (retval < 0) { |
| 671 | dev_warn(&dev->dev, | 674 | dev_warn(&dev->dev, |
| 672 | "Unable to detect the %d Bit CRU Service.\n", | 675 | "Unable to detect the %d Bit CRU Service.\n", |
| 673 | HPWDT_ARCH); | 676 | HPWDT_ARCH); |
| 674 | goto error_get_cru; | 677 | goto error_get_cru; |
| 675 | } | 678 | } |
| @@ -684,7 +687,7 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, | |||
| 684 | retval = register_die_notifier(&die_notifier); | 687 | retval = register_die_notifier(&die_notifier); |
| 685 | if (retval != 0) { | 688 | if (retval != 0) { |
| 686 | dev_warn(&dev->dev, | 689 | dev_warn(&dev->dev, |
| 687 | "Unable to register a die notifier (err=%d).\n", | 690 | "Unable to register a die notifier (err=%d).\n", |
| 688 | retval); | 691 | retval); |
| 689 | goto error_die_notifier; | 692 | goto error_die_notifier; |
| 690 | } | 693 | } |
| @@ -699,8 +702,9 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, | |||
| 699 | 702 | ||
| 700 | printk(KERN_INFO | 703 | printk(KERN_INFO |
| 701 | "hp Watchdog Timer Driver: 1.00" | 704 | "hp Watchdog Timer Driver: 1.00" |
| 702 | ", timer margin: %d seconds( nowayout=%d).\n", | 705 | ", timer margin: %d seconds (nowayout=%d)" |
| 703 | soft_margin, nowayout); | 706 | ", allow kernel dump: %s (default = 0/OFF).\n", |
| 707 | soft_margin, nowayout, (allow_kdump == 0) ? "OFF" : "ON"); | ||
| 704 | 708 | ||
| 705 | return 0; | 709 | return 0; |
| 706 | 710 | ||
| @@ -755,6 +759,9 @@ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | |||
| 755 | module_param(soft_margin, int, 0); | 759 | module_param(soft_margin, int, 0); |
| 756 | MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds"); | 760 | MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds"); |
| 757 | 761 | ||
| 762 | module_param(allow_kdump, int, 0); | ||
| 763 | MODULE_PARM_DESC(allow_kdump, "Start a kernel dump after NMI occurs"); | ||
| 764 | |||
| 758 | module_param(nowayout, int, 0); | 765 | module_param(nowayout, int, 0); |
| 759 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 766 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
| 760 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 767 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
diff --git a/drivers/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c index b82405cfb4cd..89fcefcc8510 100644 --- a/drivers/watchdog/ibmasr.c +++ b/drivers/watchdog/ibmasr.c | |||
| @@ -85,7 +85,6 @@ static void __asr_toggle(void) | |||
| 85 | 85 | ||
| 86 | outb(reg & ~asr_toggle_mask, asr_write_addr); | 86 | outb(reg & ~asr_toggle_mask, asr_write_addr); |
| 87 | reg = inb(asr_read_addr); | 87 | reg = inb(asr_read_addr); |
| 88 | spin_unlock(&asr_lock); | ||
| 89 | } | 88 | } |
| 90 | 89 | ||
| 91 | static void asr_toggle(void) | 90 | static void asr_toggle(void) |
diff --git a/drivers/watchdog/mpc8xx_wdt.c b/drivers/watchdog/mpc8xx_wdt.c deleted file mode 100644 index 1336425acf20..000000000000 --- a/drivers/watchdog/mpc8xx_wdt.c +++ /dev/null | |||
| @@ -1,170 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * mpc8xx_wdt.c - MPC8xx watchdog userspace interface | ||
| 3 | * | ||
| 4 | * Author: Florian Schirmer <jolt@tuxbox.org> | ||
| 5 | * | ||
| 6 | * 2002 (c) Florian Schirmer <jolt@tuxbox.org> This file is licensed under | ||
| 7 | * the terms of the GNU General Public License version 2. This program | ||
| 8 | * is licensed "as is" without any warranty of any kind, whether express | ||
| 9 | * or implied. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/fs.h> | ||
| 13 | #include <linux/init.h> | ||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/miscdevice.h> | ||
| 16 | #include <linux/module.h> | ||
| 17 | #include <linux/watchdog.h> | ||
| 18 | #include <asm/8xx_immap.h> | ||
| 19 | #include <linux/uaccess.h> | ||
| 20 | #include <linux/io.h> | ||
| 21 | #include <syslib/m8xx_wdt.h> | ||
| 22 | |||
| 23 | static unsigned long wdt_opened; | ||
| 24 | static int wdt_status; | ||
| 25 | static spinlock_t wdt_lock; | ||
| 26 | |||
| 27 | static void mpc8xx_wdt_handler_disable(void) | ||
| 28 | { | ||
| 29 | volatile uint __iomem *piscr; | ||
| 30 | piscr = (uint *)&((immap_t *)IMAP_ADDR)->im_sit.sit_piscr; | ||
| 31 | |||
| 32 | if (!m8xx_has_internal_rtc) | ||
| 33 | m8xx_wdt_stop_timer(); | ||
| 34 | else | ||
| 35 | out_be32(piscr, in_be32(piscr) & ~(PISCR_PIE | PISCR_PTE)); | ||
| 36 | printk(KERN_NOTICE "mpc8xx_wdt: keep-alive handler deactivated\n"); | ||
| 37 | } | ||
| 38 | |||
| 39 | static void mpc8xx_wdt_handler_enable(void) | ||
| 40 | { | ||
| 41 | volatile uint __iomem *piscr; | ||
| 42 | piscr = (uint *)&((immap_t *)IMAP_ADDR)->im_sit.sit_piscr; | ||
| 43 | |||
| 44 | if (!m8xx_has_internal_rtc) | ||
| 45 | m8xx_wdt_install_timer(); | ||
| 46 | else | ||
| 47 | out_be32(piscr, in_be32(piscr) | PISCR_PIE | PISCR_PTE); | ||
| 48 | printk(KERN_NOTICE "mpc8xx_wdt: keep-alive handler activated\n"); | ||
| 49 | } | ||
| 50 | |||
| 51 | static int mpc8xx_wdt_open(struct inode *inode, struct file *file) | ||
| 52 | { | ||
| 53 | if (test_and_set_bit(0, &wdt_opened)) | ||
| 54 | return -EBUSY; | ||
| 55 | m8xx_wdt_reset(); | ||
| 56 | mpc8xx_wdt_handler_disable(); | ||
| 57 | return nonseekable_open(inode, file); | ||
| 58 | } | ||
| 59 | |||
| 60 | static int mpc8xx_wdt_release(struct inode *inode, struct file *file) | ||
| 61 | { | ||
| 62 | m8xx_wdt_reset(); | ||
| 63 | #if !defined(CONFIG_WATCHDOG_NOWAYOUT) | ||
| 64 | mpc8xx_wdt_handler_enable(); | ||
| 65 | #endif | ||
| 66 | clear_bit(0, &wdt_opened); | ||
| 67 | return 0; | ||
| 68 | } | ||
| 69 | |||
| 70 | static ssize_t mpc8xx_wdt_write(struct file *file, const char *data, | ||
| 71 | size_t len, loff_t *ppos) | ||
| 72 | { | ||
| 73 | if (len) { | ||
| 74 | spin_lock(&wdt_lock); | ||
| 75 | m8xx_wdt_reset(); | ||
| 76 | spin_unlock(&wdt_lock); | ||
| 77 | } | ||
| 78 | return len; | ||
| 79 | } | ||
| 80 | |||
| 81 | static long mpc8xx_wdt_ioctl(struct file *file, | ||
| 82 | unsigned int cmd, unsigned long arg) | ||
| 83 | { | ||
| 84 | int timeout; | ||
| 85 | static struct watchdog_info info = { | ||
| 86 | .options = WDIOF_KEEPALIVEPING, | ||
| 87 | .firmware_version = 0, | ||
| 88 | .identity = "MPC8xx watchdog", | ||
| 89 | }; | ||
| 90 | |||
| 91 | switch (cmd) { | ||
| 92 | case WDIOC_GETSUPPORT: | ||
| 93 | if (copy_to_user((void *)arg, &info, sizeof(info))) | ||
| 94 | return -EFAULT; | ||
| 95 | break; | ||
| 96 | |||
| 97 | case WDIOC_GETSTATUS: | ||
| 98 | case WDIOC_GETBOOTSTATUS: | ||
| 99 | if (put_user(wdt_status, (int *)arg)) | ||
| 100 | return -EFAULT; | ||
| 101 | wdt_status &= ~WDIOF_KEEPALIVEPING; | ||
| 102 | break; | ||
| 103 | |||
| 104 | case WDIOC_GETTEMP: | ||
| 105 | return -EOPNOTSUPP; | ||
| 106 | |||
| 107 | case WDIOC_SETOPTIONS: | ||
| 108 | return -EOPNOTSUPP; | ||
| 109 | |||
| 110 | case WDIOC_KEEPALIVE: | ||
| 111 | spin_lock(&wdt_lock); | ||
| 112 | m8xx_wdt_reset(); | ||
| 113 | wdt_status |= WDIOF_KEEPALIVEPING; | ||
| 114 | spin_unlock(&wdt_lock); | ||
| 115 | break; | ||
| 116 | |||
| 117 | case WDIOC_SETTIMEOUT: | ||
| 118 | return -EOPNOTSUPP; | ||
| 119 | |||
| 120 | case WDIOC_GETTIMEOUT: | ||
| 121 | spin_lock(&wdt_lock); | ||
| 122 | timeout = m8xx_wdt_get_timeout(); | ||
| 123 | spin_unlock(&wdt_lock); | ||
| 124 | if (put_user(timeout, (int *)arg)) | ||
| 125 | return -EFAULT; | ||
| 126 | break; | ||
| 127 | |||
| 128 | default: | ||
| 129 | return -ENOTTY; | ||
| 130 | } | ||
| 131 | |||
| 132 | return 0; | ||
| 133 | } | ||
| 134 | |||
| 135 | static const struct file_operations mpc8xx_wdt_fops = { | ||
| 136 | .owner = THIS_MODULE, | ||
| 137 | .llseek = no_llseek, | ||
| 138 | .write = mpc8xx_wdt_write, | ||
| 139 | .unlocked_ioctl = mpc8xx_wdt_ioctl, | ||
| 140 | .open = mpc8xx_wdt_open, | ||
| 141 | .release = mpc8xx_wdt_release, | ||
| 142 | }; | ||
| 143 | |||
| 144 | static struct miscdevice mpc8xx_wdt_miscdev = { | ||
| 145 | .minor = WATCHDOG_MINOR, | ||
| 146 | .name = "watchdog", | ||
| 147 | .fops = &mpc8xx_wdt_fops, | ||
| 148 | }; | ||
| 149 | |||
| 150 | static int __init mpc8xx_wdt_init(void) | ||
| 151 | { | ||
| 152 | spin_lock_init(&wdt_lock); | ||
| 153 | return misc_register(&mpc8xx_wdt_miscdev); | ||
| 154 | } | ||
| 155 | |||
| 156 | static void __exit mpc8xx_wdt_exit(void) | ||
| 157 | { | ||
| 158 | misc_deregister(&mpc8xx_wdt_miscdev); | ||
| 159 | |||
| 160 | m8xx_wdt_reset(); | ||
| 161 | mpc8xx_wdt_handler_enable(); | ||
| 162 | } | ||
| 163 | |||
| 164 | module_init(mpc8xx_wdt_init); | ||
| 165 | module_exit(mpc8xx_wdt_exit); | ||
| 166 | |||
| 167 | MODULE_AUTHOR("Florian Schirmer <jolt@tuxbox.org>"); | ||
| 168 | MODULE_DESCRIPTION("MPC8xx watchdog driver"); | ||
| 169 | MODULE_LICENSE("GPL"); | ||
| 170 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c index f2094960e662..38c588ee694f 100644 --- a/drivers/watchdog/mpc8xxx_wdt.c +++ b/drivers/watchdog/mpc8xxx_wdt.c | |||
| @@ -48,6 +48,7 @@ struct mpc8xxx_wdt_type { | |||
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | static struct mpc8xxx_wdt __iomem *wd_base; | 50 | static struct mpc8xxx_wdt __iomem *wd_base; |
| 51 | static int mpc8xxx_wdt_init_late(void); | ||
| 51 | 52 | ||
| 52 | static u16 timeout = 0xffff; | 53 | static u16 timeout = 0xffff; |
| 53 | module_param(timeout, ushort, 0); | 54 | module_param(timeout, ushort, 0); |
| @@ -213,6 +214,12 @@ static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev, | |||
| 213 | else | 214 | else |
| 214 | timeout_sec = timeout / freq; | 215 | timeout_sec = timeout / freq; |
| 215 | 216 | ||
| 217 | #ifdef MODULE | ||
| 218 | ret = mpc8xxx_wdt_init_late(); | ||
| 219 | if (ret) | ||
| 220 | goto err_unmap; | ||
| 221 | #endif | ||
| 222 | |||
| 216 | pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d " | 223 | pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d " |
| 217 | "(%d seconds)\n", reset ? "reset" : "interrupt", timeout, | 224 | "(%d seconds)\n", reset ? "reset" : "interrupt", timeout, |
| 218 | timeout_sec); | 225 | timeout_sec); |
| @@ -280,7 +287,7 @@ static struct of_platform_driver mpc8xxx_wdt_driver = { | |||
| 280 | * very early to start pinging the watchdog (misc devices are not yet | 287 | * very early to start pinging the watchdog (misc devices are not yet |
| 281 | * available), and later module_init() just registers the misc device. | 288 | * available), and later module_init() just registers the misc device. |
| 282 | */ | 289 | */ |
| 283 | static int __init mpc8xxx_wdt_init_late(void) | 290 | static int mpc8xxx_wdt_init_late(void) |
| 284 | { | 291 | { |
| 285 | int ret; | 292 | int ret; |
| 286 | 293 | ||
| @@ -295,7 +302,9 @@ static int __init mpc8xxx_wdt_init_late(void) | |||
| 295 | } | 302 | } |
| 296 | return 0; | 303 | return 0; |
| 297 | } | 304 | } |
| 305 | #ifndef MODULE | ||
| 298 | module_init(mpc8xxx_wdt_init_late); | 306 | module_init(mpc8xxx_wdt_init_late); |
| 307 | #endif | ||
| 299 | 308 | ||
| 300 | static int __init mpc8xxx_wdt_init(void) | 309 | static int __init mpc8xxx_wdt_init(void) |
| 301 | { | 310 | { |
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index e91ada72da1d..484c215e9f3f 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
| 31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
| 32 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
| 33 | #include <linux/version.h> | ||
| 34 | #include <linux/io.h> | 33 | #include <linux/io.h> |
| 35 | #include <linux/uaccess.h> | 34 | #include <linux/uaccess.h> |
| 36 | 35 | ||
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index 0ed84162437b..6d9f3d4a9987 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
| @@ -173,8 +173,8 @@ static const struct watchdog_info ident = { | |||
| 173 | .identity = "PNX4008 Watchdog", | 173 | .identity = "PNX4008 Watchdog", |
| 174 | }; | 174 | }; |
| 175 | 175 | ||
| 176 | static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file, | 176 | static long pnx4008_wdt_ioctl(struct file *file, unsigned int cmd, |
| 177 | unsigned int cmd, unsigned long arg) | 177 | unsigned long arg) |
| 178 | { | 178 | { |
| 179 | int ret = -ENOTTY; | 179 | int ret = -ENOTTY; |
| 180 | int time; | 180 | int time; |
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c new file mode 100644 index 000000000000..c9c73b69c5e5 --- /dev/null +++ b/drivers/watchdog/rc32434_wdt.c | |||
| @@ -0,0 +1,344 @@ | |||
| 1 | /* | ||
| 2 | * IDT Interprise 79RC32434 watchdog driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006, Ondrej Zajicek <santiago@crfreenet.org> | ||
| 5 | * Copyright (C) 2008, Florian Fainelli <florian@openwrt.org> | ||
| 6 | * | ||
| 7 | * based on | ||
| 8 | * SoftDog 0.05: A Software Watchdog Device | ||
| 9 | * | ||
| 10 | * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or | ||
| 13 | * modify it under the terms of the GNU General Public License | ||
| 14 | * as published by the Free Software Foundation; either version | ||
| 15 | * 2 of the License, or (at your option) any later version. | ||
| 16 | * | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/module.h> | ||
| 20 | #include <linux/types.h> | ||
| 21 | #include <linux/kernel.h> | ||
| 22 | #include <linux/fs.h> | ||
| 23 | #include <linux/mm.h> | ||
| 24 | #include <linux/miscdevice.h> | ||
| 25 | #include <linux/watchdog.h> | ||
| 26 | #include <linux/reboot.h> | ||
| 27 | #include <linux/smp_lock.h> | ||
| 28 | #include <linux/init.h> | ||
| 29 | #include <linux/platform_device.h> | ||
| 30 | #include <linux/uaccess.h> | ||
| 31 | |||
| 32 | #include <asm/bootinfo.h> | ||
| 33 | #include <asm/time.h> | ||
| 34 | #include <asm/mach-rc32434/integ.h> | ||
| 35 | |||
| 36 | #define MAX_TIMEOUT 20 | ||
| 37 | #define RC32434_WDT_INTERVAL (15 * HZ) | ||
| 38 | |||
| 39 | #define VERSION "0.2" | ||
| 40 | |||
| 41 | static struct { | ||
| 42 | struct completion stop; | ||
| 43 | int running; | ||
| 44 | struct timer_list timer; | ||
| 45 | int queue; | ||
| 46 | int default_ticks; | ||
| 47 | unsigned long inuse; | ||
| 48 | } rc32434_wdt_device; | ||
| 49 | |||
| 50 | static struct integ __iomem *wdt_reg; | ||
| 51 | static int ticks = 100 * HZ; | ||
| 52 | |||
| 53 | static int expect_close; | ||
| 54 | static int timeout; | ||
| 55 | |||
| 56 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
| 57 | module_param(nowayout, int, 0); | ||
| 58 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | ||
| 59 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
| 60 | |||
| 61 | |||
| 62 | static void rc32434_wdt_start(void) | ||
| 63 | { | ||
| 64 | u32 val; | ||
| 65 | |||
| 66 | if (!rc32434_wdt_device.inuse) { | ||
| 67 | writel(0, &wdt_reg->wtcount); | ||
| 68 | |||
| 69 | val = RC32434_ERR_WRE; | ||
| 70 | writel(readl(&wdt_reg->errcs) | val, &wdt_reg->errcs); | ||
| 71 | |||
| 72 | val = RC32434_WTC_EN; | ||
| 73 | writel(readl(&wdt_reg->wtc) | val, &wdt_reg->wtc); | ||
| 74 | } | ||
| 75 | rc32434_wdt_device.running++; | ||
| 76 | } | ||
| 77 | |||
| 78 | static void rc32434_wdt_stop(void) | ||
| 79 | { | ||
| 80 | u32 val; | ||
| 81 | |||
| 82 | if (rc32434_wdt_device.running) { | ||
| 83 | |||
| 84 | val = ~RC32434_WTC_EN; | ||
| 85 | writel(readl(&wdt_reg->wtc) & val, &wdt_reg->wtc); | ||
| 86 | |||
| 87 | val = ~RC32434_ERR_WRE; | ||
| 88 | writel(readl(&wdt_reg->errcs) & val, &wdt_reg->errcs); | ||
| 89 | |||
| 90 | rc32434_wdt_device.running = 0; | ||
| 91 | } | ||
| 92 | } | ||
| 93 | |||
| 94 | static void rc32434_wdt_set(int new_timeout) | ||
| 95 | { | ||
| 96 | u32 cmp = new_timeout * HZ; | ||
| 97 | u32 state, val; | ||
| 98 | |||
| 99 | timeout = new_timeout; | ||
| 100 | /* | ||
| 101 | * store and disable WTC | ||
| 102 | */ | ||
| 103 | state = (u32)(readl(&wdt_reg->wtc) & RC32434_WTC_EN); | ||
| 104 | val = ~RC32434_WTC_EN; | ||
| 105 | writel(readl(&wdt_reg->wtc) & val, &wdt_reg->wtc); | ||
| 106 | |||
| 107 | writel(0, &wdt_reg->wtcount); | ||
| 108 | writel(cmp, &wdt_reg->wtcompare); | ||
| 109 | |||
| 110 | /* | ||
| 111 | * restore WTC | ||
| 112 | */ | ||
| 113 | |||
| 114 | writel(readl(&wdt_reg->wtc) | state, &wdt_reg); | ||
| 115 | } | ||
| 116 | |||
| 117 | static void rc32434_wdt_reset(void) | ||
| 118 | { | ||
| 119 | ticks = rc32434_wdt_device.default_ticks; | ||
| 120 | } | ||
| 121 | |||
| 122 | static void rc32434_wdt_update(unsigned long unused) | ||
| 123 | { | ||
| 124 | if (rc32434_wdt_device.running) | ||
| 125 | ticks--; | ||
| 126 | |||
| 127 | writel(0, &wdt_reg->wtcount); | ||
| 128 | |||
| 129 | if (rc32434_wdt_device.queue && ticks) | ||
| 130 | mod_timer(&rc32434_wdt_device.timer, | ||
| 131 | jiffies + RC32434_WDT_INTERVAL); | ||
| 132 | else | ||
| 133 | complete(&rc32434_wdt_device.stop); | ||
| 134 | } | ||
| 135 | |||
| 136 | static int rc32434_wdt_open(struct inode *inode, struct file *file) | ||
| 137 | { | ||
| 138 | if (test_and_set_bit(0, &rc32434_wdt_device.inuse)) | ||
| 139 | return -EBUSY; | ||
| 140 | |||
| 141 | if (nowayout) | ||
| 142 | __module_get(THIS_MODULE); | ||
| 143 | |||
| 144 | return nonseekable_open(inode, file); | ||
| 145 | } | ||
| 146 | |||
| 147 | static int rc32434_wdt_release(struct inode *inode, struct file *file) | ||
| 148 | { | ||
| 149 | if (expect_close && nowayout == 0) { | ||
| 150 | rc32434_wdt_stop(); | ||
| 151 | printk(KERN_INFO KBUILD_MODNAME ": disabling watchdog timer\n"); | ||
| 152 | module_put(THIS_MODULE); | ||
| 153 | } else | ||
| 154 | printk(KERN_CRIT KBUILD_MODNAME | ||
| 155 | ": device closed unexpectedly. WDT will not stop !\n"); | ||
| 156 | |||
| 157 | clear_bit(0, &rc32434_wdt_device.inuse); | ||
| 158 | return 0; | ||
| 159 | } | ||
| 160 | |||
| 161 | static ssize_t rc32434_wdt_write(struct file *file, const char *data, | ||
| 162 | size_t len, loff_t *ppos) | ||
| 163 | { | ||
| 164 | if (len) { | ||
| 165 | if (!nowayout) { | ||
| 166 | size_t i; | ||
| 167 | |||
| 168 | /* In case it was set long ago */ | ||
| 169 | expect_close = 0; | ||
| 170 | |||
| 171 | for (i = 0; i != len; i++) { | ||
| 172 | char c; | ||
| 173 | if (get_user(c, data + i)) | ||
| 174 | return -EFAULT; | ||
| 175 | if (c == 'V') | ||
| 176 | expect_close = 1; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | rc32434_wdt_update(0); | ||
| 180 | return len; | ||
| 181 | } | ||
| 182 | return 0; | ||
| 183 | } | ||
| 184 | |||
| 185 | static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd, | ||
| 186 | unsigned long arg) | ||
| 187 | { | ||
| 188 | void __user *argp = (void __user *)arg; | ||
| 189 | int new_timeout; | ||
| 190 | unsigned int value; | ||
| 191 | static struct watchdog_info ident = { | ||
| 192 | .options = WDIOF_SETTIMEOUT | | ||
| 193 | WDIOF_KEEPALIVEPING | | ||
| 194 | WDIOF_MAGICCLOSE, | ||
| 195 | .identity = "RC32434_WDT Watchdog", | ||
| 196 | }; | ||
| 197 | switch (cmd) { | ||
| 198 | case WDIOC_KEEPALIVE: | ||
| 199 | rc32434_wdt_reset(); | ||
| 200 | break; | ||
| 201 | case WDIOC_GETSTATUS: | ||
| 202 | case WDIOC_GETBOOTSTATUS: | ||
| 203 | value = readl(&wdt_reg->wtcount); | ||
| 204 | if (copy_to_user(argp, &value, sizeof(int))) | ||
| 205 | return -EFAULT; | ||
| 206 | break; | ||
| 207 | case WDIOC_GETSUPPORT: | ||
| 208 | if (copy_to_user(argp, &ident, sizeof(ident))) | ||
| 209 | return -EFAULT; | ||
| 210 | break; | ||
| 211 | case WDIOC_SETOPTIONS: | ||
| 212 | if (copy_from_user(&value, argp, sizeof(int))) | ||
| 213 | return -EFAULT; | ||
| 214 | switch (value) { | ||
| 215 | case WDIOS_ENABLECARD: | ||
| 216 | rc32434_wdt_start(); | ||
| 217 | break; | ||
| 218 | case WDIOS_DISABLECARD: | ||
| 219 | rc32434_wdt_stop(); | ||
| 220 | default: | ||
| 221 | return -EINVAL; | ||
| 222 | } | ||
| 223 | break; | ||
| 224 | case WDIOC_SETTIMEOUT: | ||
| 225 | if (copy_from_user(&new_timeout, argp, sizeof(int))) | ||
| 226 | return -EFAULT; | ||
| 227 | if (new_timeout < 1) | ||
| 228 | return -EINVAL; | ||
| 229 | if (new_timeout > MAX_TIMEOUT) | ||
| 230 | return -EINVAL; | ||
| 231 | rc32434_wdt_set(new_timeout); | ||
| 232 | case WDIOC_GETTIMEOUT: | ||
| 233 | return copy_to_user(argp, &timeout, sizeof(int)); | ||
| 234 | default: | ||
| 235 | return -ENOTTY; | ||
| 236 | } | ||
| 237 | |||
| 238 | return 0; | ||
| 239 | } | ||
| 240 | |||
| 241 | static struct file_operations rc32434_wdt_fops = { | ||
| 242 | .owner = THIS_MODULE, | ||
| 243 | .llseek = no_llseek, | ||
| 244 | .write = rc32434_wdt_write, | ||
| 245 | .unlocked_ioctl = rc32434_wdt_ioctl, | ||
| 246 | .open = rc32434_wdt_open, | ||
| 247 | .release = rc32434_wdt_release, | ||
| 248 | }; | ||
| 249 | |||
| 250 | static struct miscdevice rc32434_wdt_miscdev = { | ||
| 251 | .minor = WATCHDOG_MINOR, | ||
| 252 | .name = "watchdog", | ||
| 253 | .fops = &rc32434_wdt_fops, | ||
| 254 | }; | ||
| 255 | |||
| 256 | static char banner[] = KERN_INFO KBUILD_MODNAME | ||
| 257 | ": Watchdog Timer version " VERSION ", timer margin: %d sec\n"; | ||
| 258 | |||
| 259 | static int rc32434_wdt_probe(struct platform_device *pdev) | ||
| 260 | { | ||
| 261 | int ret; | ||
| 262 | struct resource *r; | ||
| 263 | |||
| 264 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb500_wdt_res"); | ||
| 265 | if (!r) { | ||
| 266 | printk(KERN_ERR KBUILD_MODNAME | ||
| 267 | "failed to retrieve resources\n"); | ||
| 268 | return -ENODEV; | ||
| 269 | } | ||
| 270 | |||
| 271 | wdt_reg = ioremap_nocache(r->start, r->end - r->start); | ||
| 272 | if (!wdt_reg) { | ||
| 273 | printk(KERN_ERR KBUILD_MODNAME | ||
| 274 | "failed to remap I/O resources\n"); | ||
| 275 | return -ENXIO; | ||
| 276 | } | ||
| 277 | |||
| 278 | ret = misc_register(&rc32434_wdt_miscdev); | ||
| 279 | |||
| 280 | if (ret < 0) { | ||
| 281 | printk(KERN_ERR KBUILD_MODNAME | ||
| 282 | "failed to register watchdog device\n"); | ||
| 283 | goto unmap; | ||
| 284 | } | ||
| 285 | |||
| 286 | init_completion(&rc32434_wdt_device.stop); | ||
| 287 | rc32434_wdt_device.queue = 0; | ||
| 288 | |||
| 289 | clear_bit(0, &rc32434_wdt_device.inuse); | ||
| 290 | |||
| 291 | setup_timer(&rc32434_wdt_device.timer, rc32434_wdt_update, 0L); | ||
| 292 | |||
| 293 | rc32434_wdt_device.default_ticks = ticks; | ||
| 294 | |||
| 295 | rc32434_wdt_start(); | ||
| 296 | |||
| 297 | printk(banner, timeout); | ||
| 298 | |||
| 299 | return 0; | ||
| 300 | |||
| 301 | unmap: | ||
| 302 | iounmap(wdt_reg); | ||
| 303 | return ret; | ||
| 304 | } | ||
| 305 | |||
| 306 | static int rc32434_wdt_remove(struct platform_device *pdev) | ||
| 307 | { | ||
| 308 | if (rc32434_wdt_device.queue) { | ||
| 309 | rc32434_wdt_device.queue = 0; | ||
| 310 | wait_for_completion(&rc32434_wdt_device.stop); | ||
| 311 | } | ||
| 312 | misc_deregister(&rc32434_wdt_miscdev); | ||
| 313 | |||
| 314 | iounmap(wdt_reg); | ||
| 315 | |||
| 316 | return 0; | ||
| 317 | } | ||
| 318 | |||
| 319 | static struct platform_driver rc32434_wdt = { | ||
| 320 | .probe = rc32434_wdt_probe, | ||
| 321 | .remove = rc32434_wdt_remove, | ||
| 322 | .driver = { | ||
| 323 | .name = "rc32434_wdt", | ||
| 324 | } | ||
| 325 | }; | ||
| 326 | |||
| 327 | static int __init rc32434_wdt_init(void) | ||
| 328 | { | ||
| 329 | return platform_driver_register(&rc32434_wdt); | ||
| 330 | } | ||
| 331 | |||
| 332 | static void __exit rc32434_wdt_exit(void) | ||
| 333 | { | ||
| 334 | platform_driver_unregister(&rc32434_wdt); | ||
| 335 | } | ||
| 336 | |||
| 337 | module_init(rc32434_wdt_init); | ||
| 338 | module_exit(rc32434_wdt_exit); | ||
| 339 | |||
| 340 | MODULE_AUTHOR("Ondrej Zajicek <santiago@crfreenet.org>," | ||
| 341 | "Florian Fainelli <florian@openwrt.org>"); | ||
| 342 | MODULE_DESCRIPTION("Driver for the IDT RC32434 SoC watchdog"); | ||
| 343 | MODULE_LICENSE("GPL"); | ||
| 344 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c new file mode 100644 index 000000000000..bf92802f2bbe --- /dev/null +++ b/drivers/watchdog/rdc321x_wdt.c | |||
| @@ -0,0 +1,285 @@ | |||
| 1 | /* | ||
| 2 | * RDC321x watchdog driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org> | ||
| 5 | * | ||
| 6 | * This driver is highly inspired from the cpu5_wdt driver | ||
| 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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 21 | * | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include <linux/module.h> | ||
| 25 | #include <linux/moduleparam.h> | ||
| 26 | #include <linux/types.h> | ||
| 27 | #include <linux/errno.h> | ||
| 28 | #include <linux/miscdevice.h> | ||
| 29 | #include <linux/fs.h> | ||
| 30 | #include <linux/init.h> | ||
| 31 | #include <linux/ioport.h> | ||
| 32 | #include <linux/timer.h> | ||
| 33 | #include <linux/completion.h> | ||
| 34 | #include <linux/jiffies.h> | ||
| 35 | #include <linux/platform_device.h> | ||
| 36 | #include <linux/watchdog.h> | ||
| 37 | #include <linux/io.h> | ||
| 38 | #include <linux/uaccess.h> | ||
| 39 | |||
| 40 | #include <asm/mach-rdc321x/rdc321x_defs.h> | ||
| 41 | |||
| 42 | #define RDC_WDT_MASK 0x80000000 /* Mask */ | ||
| 43 | #define RDC_WDT_EN 0x00800000 /* Enable bit */ | ||
| 44 | #define RDC_WDT_WTI 0x00200000 /* Generate CPU reset/NMI/WDT on timeout */ | ||
| 45 | #define RDC_WDT_RST 0x00100000 /* Reset bit */ | ||
| 46 | #define RDC_WDT_WIF 0x00040000 /* WDT IRQ Flag */ | ||
| 47 | #define RDC_WDT_IRT 0x00000100 /* IRQ Routing table */ | ||
| 48 | #define RDC_WDT_CNT 0x00000001 /* WDT count */ | ||
| 49 | |||
| 50 | #define RDC_CLS_TMR 0x80003844 /* Clear timer */ | ||
| 51 | |||
| 52 | #define RDC_WDT_INTERVAL (HZ/10+1) | ||
| 53 | |||
| 54 | static int ticks = 1000; | ||
| 55 | |||
| 56 | /* some device data */ | ||
| 57 | |||
| 58 | static struct { | ||
| 59 | struct completion stop; | ||
| 60 | int running; | ||
| 61 | struct timer_list timer; | ||
| 62 | int queue; | ||
| 63 | int default_ticks; | ||
| 64 | unsigned long inuse; | ||
| 65 | spinlock_t lock; | ||
| 66 | } rdc321x_wdt_device; | ||
| 67 | |||
| 68 | /* generic helper functions */ | ||
| 69 | |||
| 70 | static void rdc321x_wdt_trigger(unsigned long unused) | ||
| 71 | { | ||
| 72 | unsigned long flags; | ||
| 73 | |||
| 74 | if (rdc321x_wdt_device.running) | ||
| 75 | ticks--; | ||
| 76 | |||
| 77 | /* keep watchdog alive */ | ||
| 78 | spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); | ||
| 79 | outl(RDC_WDT_EN | inl(RDC3210_CFGREG_DATA), | ||
| 80 | RDC3210_CFGREG_DATA); | ||
| 81 | spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); | ||
| 82 | |||
| 83 | /* requeue?? */ | ||
| 84 | if (rdc321x_wdt_device.queue && ticks) | ||
| 85 | mod_timer(&rdc321x_wdt_device.timer, | ||
| 86 | jiffies + RDC_WDT_INTERVAL); | ||
| 87 | else { | ||
| 88 | /* ticks doesn't matter anyway */ | ||
| 89 | complete(&rdc321x_wdt_device.stop); | ||
| 90 | } | ||
| 91 | |||
| 92 | } | ||
| 93 | |||
| 94 | static void rdc321x_wdt_reset(void) | ||
| 95 | { | ||
| 96 | ticks = rdc321x_wdt_device.default_ticks; | ||
| 97 | } | ||
| 98 | |||
| 99 | static void rdc321x_wdt_start(void) | ||
| 100 | { | ||
| 101 | unsigned long flags; | ||
| 102 | |||
| 103 | if (!rdc321x_wdt_device.queue) { | ||
| 104 | rdc321x_wdt_device.queue = 1; | ||
| 105 | |||
| 106 | /* Clear the timer */ | ||
| 107 | spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); | ||
| 108 | outl(RDC_CLS_TMR, RDC3210_CFGREG_ADDR); | ||
| 109 | |||
| 110 | /* Enable watchdog and set the timeout to 81.92 us */ | ||
| 111 | outl(RDC_WDT_EN | RDC_WDT_CNT, RDC3210_CFGREG_DATA); | ||
| 112 | spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); | ||
| 113 | |||
| 114 | mod_timer(&rdc321x_wdt_device.timer, | ||
| 115 | jiffies + RDC_WDT_INTERVAL); | ||
| 116 | } | ||
| 117 | |||
| 118 | /* if process dies, counter is not decremented */ | ||
| 119 | rdc321x_wdt_device.running++; | ||
| 120 | } | ||
| 121 | |||
| 122 | static int rdc321x_wdt_stop(void) | ||
| 123 | { | ||
| 124 | if (rdc321x_wdt_device.running) | ||
| 125 | rdc321x_wdt_device.running = 0; | ||
| 126 | |||
| 127 | ticks = rdc321x_wdt_device.default_ticks; | ||
| 128 | |||
| 129 | return -EIO; | ||
| 130 | } | ||
| 131 | |||
| 132 | /* filesystem operations */ | ||
| 133 | static int rdc321x_wdt_open(struct inode *inode, struct file *file) | ||
| 134 | { | ||
| 135 | if (test_and_set_bit(0, &rdc321x_wdt_device.inuse)) | ||
| 136 | return -EBUSY; | ||
| 137 | |||
| 138 | return nonseekable_open(inode, file); | ||
| 139 | } | ||
| 140 | |||
| 141 | static int rdc321x_wdt_release(struct inode *inode, struct file *file) | ||
| 142 | { | ||
| 143 | clear_bit(0, &rdc321x_wdt_device.inuse); | ||
| 144 | return 0; | ||
| 145 | } | ||
| 146 | |||
| 147 | static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd, | ||
| 148 | unsigned long arg) | ||
| 149 | { | ||
| 150 | void __user *argp = (void __user *)arg; | ||
| 151 | unsigned int value; | ||
| 152 | static struct watchdog_info ident = { | ||
| 153 | .options = WDIOF_CARDRESET, | ||
| 154 | .identity = "RDC321x WDT", | ||
| 155 | }; | ||
| 156 | unsigned long flags; | ||
| 157 | |||
| 158 | switch (cmd) { | ||
| 159 | case WDIOC_KEEPALIVE: | ||
| 160 | rdc321x_wdt_reset(); | ||
| 161 | break; | ||
| 162 | case WDIOC_GETSTATUS: | ||
| 163 | /* Read the value from the DATA register */ | ||
| 164 | spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); | ||
| 165 | value = inl(RDC3210_CFGREG_DATA); | ||
| 166 | spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); | ||
| 167 | if (copy_to_user(argp, &value, sizeof(int))) | ||
| 168 | return -EFAULT; | ||
| 169 | break; | ||
| 170 | case WDIOC_GETSUPPORT: | ||
| 171 | if (copy_to_user(argp, &ident, sizeof(ident))) | ||
| 172 | return -EFAULT; | ||
| 173 | break; | ||
| 174 | case WDIOC_SETOPTIONS: | ||
| 175 | if (copy_from_user(&value, argp, sizeof(int))) | ||
| 176 | return -EFAULT; | ||
| 177 | switch (value) { | ||
| 178 | case WDIOS_ENABLECARD: | ||
| 179 | rdc321x_wdt_start(); | ||
| 180 | break; | ||
| 181 | case WDIOS_DISABLECARD: | ||
| 182 | return rdc321x_wdt_stop(); | ||
| 183 | default: | ||
| 184 | return -EINVAL; | ||
| 185 | } | ||
| 186 | break; | ||
| 187 | default: | ||
| 188 | return -ENOTTY; | ||
| 189 | } | ||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | |||
| 193 | static ssize_t rdc321x_wdt_write(struct file *file, const char __user *buf, | ||
| 194 | size_t count, loff_t *ppos) | ||
| 195 | { | ||
| 196 | if (!count) | ||
| 197 | return -EIO; | ||
| 198 | |||
| 199 | rdc321x_wdt_reset(); | ||
| 200 | |||
| 201 | return count; | ||
| 202 | } | ||
| 203 | |||
| 204 | static const struct file_operations rdc321x_wdt_fops = { | ||
| 205 | .owner = THIS_MODULE, | ||
| 206 | .llseek = no_llseek, | ||
| 207 | .unlocked_ioctl = rdc321x_wdt_ioctl, | ||
| 208 | .open = rdc321x_wdt_open, | ||
| 209 | .write = rdc321x_wdt_write, | ||
| 210 | .release = rdc321x_wdt_release, | ||
| 211 | }; | ||
| 212 | |||
| 213 | static struct miscdevice rdc321x_wdt_misc = { | ||
| 214 | .minor = WATCHDOG_MINOR, | ||
| 215 | .name = "watchdog", | ||
| 216 | .fops = &rdc321x_wdt_fops, | ||
| 217 | }; | ||
| 218 | |||
| 219 | static int __devinit rdc321x_wdt_probe(struct platform_device *pdev) | ||
| 220 | { | ||
| 221 | int err; | ||
| 222 | |||
| 223 | err = misc_register(&rdc321x_wdt_misc); | ||
| 224 | if (err < 0) { | ||
| 225 | printk(KERN_ERR PFX "watchdog misc_register failed\n"); | ||
| 226 | return err; | ||
| 227 | } | ||
| 228 | |||
| 229 | spin_lock_init(&rdc321x_wdt_device.lock); | ||
| 230 | |||
| 231 | /* Reset the watchdog */ | ||
| 232 | outl(RDC_WDT_RST, RDC3210_CFGREG_DATA); | ||
| 233 | |||
| 234 | init_completion(&rdc321x_wdt_device.stop); | ||
| 235 | rdc321x_wdt_device.queue = 0; | ||
| 236 | |||
| 237 | clear_bit(0, &rdc321x_wdt_device.inuse); | ||
| 238 | |||
| 239 | setup_timer(&rdc321x_wdt_device.timer, rdc321x_wdt_trigger, 0); | ||
| 240 | |||
| 241 | rdc321x_wdt_device.default_ticks = ticks; | ||
| 242 | |||
| 243 | printk(KERN_INFO PFX "watchdog init success\n"); | ||
| 244 | |||
| 245 | return 0; | ||
| 246 | } | ||
| 247 | |||
| 248 | static int rdc321x_wdt_remove(struct platform_device *pdev) | ||
| 249 | { | ||
| 250 | if (rdc321x_wdt_device.queue) { | ||
| 251 | rdc321x_wdt_device.queue = 0; | ||
| 252 | wait_for_completion(&rdc321x_wdt_device.stop); | ||
| 253 | } | ||
| 254 | |||
| 255 | misc_deregister(&rdc321x_wdt_misc); | ||
| 256 | |||
| 257 | return 0; | ||
| 258 | } | ||
| 259 | |||
| 260 | static struct platform_driver rdc321x_wdt_driver = { | ||
| 261 | .probe = rdc321x_wdt_probe, | ||
| 262 | .remove = rdc321x_wdt_remove, | ||
| 263 | .driver = { | ||
| 264 | .owner = THIS_MODULE, | ||
| 265 | .name = "rdc321x-wdt", | ||
| 266 | }, | ||
| 267 | }; | ||
| 268 | |||
| 269 | static int __init rdc321x_wdt_init(void) | ||
| 270 | { | ||
| 271 | return platform_driver_register(&rdc321x_wdt_driver); | ||
| 272 | } | ||
| 273 | |||
| 274 | static void __exit rdc321x_wdt_exit(void) | ||
| 275 | { | ||
| 276 | platform_driver_unregister(&rdc321x_wdt_driver); | ||
| 277 | } | ||
| 278 | |||
| 279 | module_init(rdc321x_wdt_init); | ||
| 280 | module_exit(rdc321x_wdt_exit); | ||
| 281 | |||
| 282 | MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>"); | ||
| 283 | MODULE_DESCRIPTION("RDC321x watchdog driver"); | ||
| 284 | MODULE_LICENSE("GPL"); | ||
| 285 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 3da2b90d2fe6..86d42801de45 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c | |||
| @@ -21,18 +21,6 @@ | |||
| 21 | * You should have received a copy of the GNU General Public License | 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software | 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | * | ||
| 25 | * Changelog: | ||
| 26 | * 05-Oct-2004 BJD Added semaphore init to stop crashes on open | ||
| 27 | * Fixed tmr_count / wdt_count confusion | ||
| 28 | * Added configurable debug | ||
| 29 | * | ||
| 30 | * 11-Jan-2005 BJD Fixed divide-by-2 in timeout code | ||
| 31 | * | ||
| 32 | * 25-Jan-2005 DA Added suspend/resume support | ||
| 33 | * Replaced reboot notifier with .shutdown method | ||
| 34 | * | ||
| 35 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | ||
| 36 | */ | 24 | */ |
| 37 | 25 | ||
| 38 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| @@ -157,8 +145,6 @@ static void s3c2410wdt_start(void) | |||
| 157 | writel(wdt_count, wdt_base + S3C2410_WTCNT); | 145 | writel(wdt_count, wdt_base + S3C2410_WTCNT); |
| 158 | writel(wtcon, wdt_base + S3C2410_WTCON); | 146 | writel(wtcon, wdt_base + S3C2410_WTCON); |
| 159 | spin_unlock(&wdt_lock); | 147 | spin_unlock(&wdt_lock); |
| 160 | |||
| 161 | return 0; | ||
| 162 | } | 148 | } |
| 163 | 149 | ||
| 164 | static int s3c2410wdt_set_heartbeat(int timeout) | 150 | static int s3c2410wdt_set_heartbeat(int timeout) |
| @@ -367,7 +353,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) | |||
| 367 | return -ENOENT; | 353 | return -ENOENT; |
| 368 | } | 354 | } |
| 369 | 355 | ||
| 370 | size = (res->end-res->start)+1; | 356 | size = (res->end - res->start) + 1; |
| 371 | wdt_mem = request_mem_region(res->start, size, pdev->name); | 357 | wdt_mem = request_mem_region(res->start, size, pdev->name); |
| 372 | if (wdt_mem == NULL) { | 358 | if (wdt_mem == NULL) { |
| 373 | dev_err(dev, "failed to get memory region\n"); | 359 | dev_err(dev, "failed to get memory region\n"); |
| @@ -376,7 +362,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) | |||
| 376 | } | 362 | } |
| 377 | 363 | ||
| 378 | wdt_base = ioremap(res->start, size); | 364 | wdt_base = ioremap(res->start, size); |
| 379 | if (wdt_base == 0) { | 365 | if (wdt_base == NULL) { |
| 380 | dev_err(dev, "failed to ioremap() region\n"); | 366 | dev_err(dev, "failed to ioremap() region\n"); |
| 381 | ret = -EINVAL; | 367 | ret = -EINVAL; |
| 382 | goto err_req; | 368 | goto err_req; |
diff --git a/drivers/watchdog/wdt285.c b/drivers/watchdog/wdt285.c index db362c34958b..191ea6302107 100644 --- a/drivers/watchdog/wdt285.c +++ b/drivers/watchdog/wdt285.c | |||
| @@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file) | |||
| 115 | return 0; | 115 | return 0; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | static ssize_t watchdog_write(struct file *file, const char *data, | 118 | static ssize_t watchdog_write(struct file *file, const char __user *data, |
| 119 | size_t len, loff_t *ppos) | 119 | size_t len, loff_t *ppos) |
| 120 | { | 120 | { |
| 121 | /* | 121 | /* |
| 122 | * Refresh the timer. | 122 | * Refresh the timer. |
| @@ -133,21 +133,22 @@ static const struct watchdog_info ident = { | |||
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | static long watchdog_ioctl(struct file *file, unsigned int cmd, | 135 | static long watchdog_ioctl(struct file *file, unsigned int cmd, |
| 136 | unsigned long arg) | 136 | unsigned long arg) |
| 137 | { | 137 | { |
| 138 | unsigned int new_margin; | 138 | unsigned int new_margin; |
| 139 | int __user *int_arg = (int __user *)arg; | ||
| 139 | int ret = -ENOTTY; | 140 | int ret = -ENOTTY; |
| 140 | 141 | ||
| 141 | switch (cmd) { | 142 | switch (cmd) { |
| 142 | case WDIOC_GETSUPPORT: | 143 | case WDIOC_GETSUPPORT: |
| 143 | ret = 0; | 144 | ret = 0; |
| 144 | if (copy_to_user((void *)arg, &ident, sizeof(ident))) | 145 | if (copy_to_user((void __user *)arg, &ident, sizeof(ident))) |
| 145 | ret = -EFAULT; | 146 | ret = -EFAULT; |
| 146 | break; | 147 | break; |
| 147 | 148 | ||
| 148 | case WDIOC_GETSTATUS: | 149 | case WDIOC_GETSTATUS: |
| 149 | case WDIOC_GETBOOTSTATUS: | 150 | case WDIOC_GETBOOTSTATUS: |
| 150 | ret = put_user(0, (int *)arg); | 151 | ret = put_user(0, int_arg); |
| 151 | break; | 152 | break; |
| 152 | 153 | ||
| 153 | case WDIOC_KEEPALIVE: | 154 | case WDIOC_KEEPALIVE: |
| @@ -156,7 +157,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
| 156 | break; | 157 | break; |
| 157 | 158 | ||
| 158 | case WDIOC_SETTIMEOUT: | 159 | case WDIOC_SETTIMEOUT: |
| 159 | ret = get_user(new_margin, (int *)arg); | 160 | ret = get_user(new_margin, int_arg); |
| 160 | if (ret) | 161 | if (ret) |
| 161 | break; | 162 | break; |
| 162 | 163 | ||
| @@ -171,7 +172,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
| 171 | watchdog_ping(); | 172 | watchdog_ping(); |
| 172 | /* Fall */ | 173 | /* Fall */ |
| 173 | case WDIOC_GETTIMEOUT: | 174 | case WDIOC_GETTIMEOUT: |
| 174 | ret = put_user(soft_margin, (int *)arg); | 175 | ret = put_user(soft_margin, int_arg); |
| 175 | break; | 176 | break; |
| 176 | } | 177 | } |
| 177 | return ret; | 178 | return ret; |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index d4427cb86979..2e15da5459cf 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | 60 | ||
| 61 | #define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10)) | 61 | #define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10)) |
| 62 | 62 | ||
| 63 | #define BALLOON_CLASS_NAME "memory" | 63 | #define BALLOON_CLASS_NAME "xen_memory" |
| 64 | 64 | ||
| 65 | struct balloon_stats { | 65 | struct balloon_stats { |
| 66 | /* We aim for 'current allocation' == 'target allocation'. */ | 66 | /* We aim for 'current allocation' == 'target allocation'. */ |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index a5bc91ae6ff6..d0e87cbe157c 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
| @@ -102,7 +102,7 @@ static void do_suspend(void) | |||
| 102 | /* XXX use normal device tree? */ | 102 | /* XXX use normal device tree? */ |
| 103 | xenbus_suspend(); | 103 | xenbus_suspend(); |
| 104 | 104 | ||
| 105 | err = stop_machine_run(xen_suspend, &cancelled, 0); | 105 | err = stop_machine(xen_suspend, &cancelled, &cpumask_of_cpu(0)); |
| 106 | if (err) { | 106 | if (err) { |
| 107 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); | 107 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); |
| 108 | goto out; | 108 | goto out; |
